Your Name
2022-03-14 aaebe147d319e59a8b510ff4ce9271088a330732
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
 *
 * Copyright 2011-2017 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *
 *  该版本修改了部分代码,主要是汉化、优化功能、添加接口 等 by 火星科技 http://marsgis.cn
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Cesium={})}(this,function(exports){"use strict";function appendForwardSlash(e){return 0!==e.length&&"/"===e[e.length-1]||(e+="/"),e}function defined(e){return null!=e}function DeveloperError(e){var t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){var e=this.name+": "+this.message;return defined(this.stack)&&(e+="\n"+this.stack.toString()),e},DeveloperError.throwInstantiationError=function(){throw new DeveloperError("This function defines an interface and should not be called directly.")};var Check={};function getUndefinedErrorMessage(e){return e+" is required, actual value was undefined"}function getFailedTypeErrorMessage(e,t,i){return"Expected "+i+" to be typeof "+t+", actual typeof was "+e}Check.typeOf={},Check.defined=function(e,t){if(!defined(t))throw new DeveloperError(getUndefinedErrorMessage(e))},Check.typeOf.func=function(e,t){if("function"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"function",e))},Check.typeOf.string=function(e,t){if("string"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"string",e))},Check.typeOf.number=function(e,t){if("number"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"number",e))},Check.typeOf.number.lessThan=function(e,t,i){if(Check.typeOf.number(e,t),i<=t)throw new DeveloperError("Expected "+e+" to be less than "+i+", actual value was "+t)},Check.typeOf.number.lessThanOrEquals=function(e,t,i){if(Check.typeOf.number(e,t),i<t)throw new DeveloperError("Expected "+e+" to be less than or equal to "+i+", actual value was "+t)},Check.typeOf.number.greaterThan=function(e,t,i){if(Check.typeOf.number(e,t),t<=i)throw new DeveloperError("Expected "+e+" to be greater than "+i+", actual value was "+t)},Check.typeOf.number.greaterThanOrEquals=function(e,t,i){if(Check.typeOf.number(e,t),t<i)throw new DeveloperError("Expected "+e+" to be greater than or equal to"+i+", actual value was "+t)},Check.typeOf.object=function(e,t){if("object"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"object",e))},Check.typeOf.bool=function(e,t){if("boolean"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"boolean",e))},Check.typeOf.number.equals=function(e,t,i,r){if(Check.typeOf.number(e,i),Check.typeOf.number(t,r),i!==r)throw new DeveloperError(e+" must be equal to "+t+", the actual values are "+i+" and "+r)};var freezeObject=Object.freeze;defined(freezeObject)||(freezeObject=function(e){return e});var freezeObject$1=freezeObject;function defaultValue(e,t){return null!=e?e:t}defaultValue.EMPTY_OBJECT=freezeObject$1({});var MersenneTwister=function(e){null==e&&(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,this.init_genrand(e)};MersenneTwister.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var i;for(this.mti==this.N+1&&this.init_genrand(5489),i=0;i<this.N-this.M;i++)e=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+this.M]^e>>>1^t[1&e];for(;i<this.N-1;i++)e=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+(this.M-this.N)]^e>>>1^t[1&e];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[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,(e^=e>>>18)>>>0},MersenneTwister.prototype.random=function(){return this.genrand_int32()*(1/4294967296)};var CesiumMath={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,EPSILON21:1e-21,GRAVITATIONALPARAMETER:3986004418e5,SOLAR_RADIUS:6955e5,LUNAR_RADIUS:1737400,SIXTY_FOUR_KILOBYTES:65536,FOUR_GIGABYTES:4294967296};CesiumMath.sign=defaultValue(Math.sign,function(e){return 0===(e=+e)||e!=e?e:0<e?1:-1}),CesiumMath.signNotZero=function(e){return e<0?-1:1},CesiumMath.toSNorm=function(e,t){return t=defaultValue(t,255),Math.round((.5*CesiumMath.clamp(e,-1,1)+.5)*t)},CesiumMath.fromSNorm=function(e,t){return t=defaultValue(t,255),CesiumMath.clamp(e,0,t)/t*2-1},CesiumMath.normalize=function(e,t,i){return 0===(i=Math.max(i-t,0))?0:CesiumMath.clamp((e-t)/i,0,1)},CesiumMath.sinh=defaultValue(Math.sinh,function(e){return(Math.exp(e)-Math.exp(-e))/2}),CesiumMath.cosh=defaultValue(Math.cosh,function(e){return(Math.exp(e)+Math.exp(-e))/2}),CesiumMath.lerp=function(e,t,i){return(1-i)*e+i*t},CesiumMath.PI=Math.PI,CesiumMath.ONE_OVER_PI=1/Math.PI,CesiumMath.PI_OVER_TWO=Math.PI/2,CesiumMath.PI_OVER_THREE=Math.PI/3,CesiumMath.PI_OVER_FOUR=Math.PI/4,CesiumMath.PI_OVER_SIX=Math.PI/6,CesiumMath.THREE_PI_OVER_TWO=3*Math.PI/2,CesiumMath.TWO_PI=2*Math.PI,CesiumMath.ONE_OVER_TWO_PI=1/(2*Math.PI),CesiumMath.RADIANS_PER_DEGREE=Math.PI/180,CesiumMath.DEGREES_PER_RADIAN=180/Math.PI,CesiumMath.RADIANS_PER_ARCSECOND=CesiumMath.RADIANS_PER_DEGREE/3600,CesiumMath.toRadians=function(e){return e*CesiumMath.RADIANS_PER_DEGREE},CesiumMath.toDegrees=function(e){return e*CesiumMath.DEGREES_PER_RADIAN},CesiumMath.convertLongitudeRange=function(e){var t=CesiumMath.TWO_PI,i=e-Math.floor(e/t)*t;return i<-Math.PI?i+t:i>=Math.PI?i-t:i},CesiumMath.clampToLatitudeRange=function(e){return CesiumMath.clamp(e,-1*CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO)},CesiumMath.negativePiToPi=function(e){return CesiumMath.zeroToTwoPi(e+CesiumMath.PI)-CesiumMath.PI},CesiumMath.zeroToTwoPi=function(e){var t=CesiumMath.mod(e,CesiumMath.TWO_PI);return Math.abs(t)<CesiumMath.EPSILON14&&Math.abs(e)>CesiumMath.EPSILON14?CesiumMath.TWO_PI:t},CesiumMath.mod=function(e,t){return(e%t+t)%t},CesiumMath.equalsEpsilon=function(e,t,i,r){r=defaultValue(r,i);var n=Math.abs(e-t);return n<=r||n<=i*Math.max(Math.abs(e),Math.abs(t))},CesiumMath.lessThan=function(e,t,i){return e-t<-i},CesiumMath.lessThanOrEquals=function(e,t,i){return e-t<i},CesiumMath.greaterThan=function(e,t,i){return i<e-t},CesiumMath.greaterThanOrEquals=function(e,t,i){return-i<e-t};var factorials=[1];CesiumMath.factorial=function(e){var t=factorials.length;if(t<=e)for(var i=factorials[t-1],r=t;r<=e;r++){var n=i*r;factorials.push(n),i=n}return factorials[e]},CesiumMath.incrementWrap=function(e,t,i){return i=defaultValue(i,0),t<++e&&(e=i),e},CesiumMath.isPowerOfTwo=function(e){return 0!==e&&0==(e&e-1)},CesiumMath.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},CesiumMath.clamp=function(e,t,i){return e<t?t:i<e?i:e};var randomNumberGenerator=new MersenneTwister;function Cartesian3(e,t,i){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(i,0)}CesiumMath.setRandomNumberSeed=function(e){randomNumberGenerator=new MersenneTwister(e)},CesiumMath.nextRandomNumber=function(){return randomNumberGenerator.random()},CesiumMath.randomBetween=function(e,t){return CesiumMath.nextRandomNumber()*(t-e)+e},CesiumMath.acosClamped=function(e){return Math.acos(CesiumMath.clamp(e,-1,1))},CesiumMath.asinClamped=function(e){return Math.asin(CesiumMath.clamp(e,-1,1))},CesiumMath.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},CesiumMath.logBase=function(e,t){return Math.log(e)/Math.log(t)},CesiumMath.cbrt=defaultValue(Math.cbrt,function(e){var t=Math.pow(Math.abs(e),1/3);return e<0?-t:t}),CesiumMath.log2=defaultValue(Math.log2,function(e){return Math.log(e)*Math.LOG2E}),CesiumMath.fog=function(e,t){var i=e*t;return 1-Math.exp(-i*i)},CesiumMath.fastApproximateAtan=function(e){return e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},CesiumMath.fastApproximateAtan2=function(e,t){var i,r,n=Math.abs(e);i=Math.abs(t),r=Math.max(n,i);var a=(i=Math.min(n,i))/r;return n=CesiumMath.fastApproximateAtan(a),n=Math.abs(t)>Math.abs(e)?CesiumMath.PI_OVER_TWO-n:n,n=e<0?CesiumMath.PI-n:n,n=t<0?-n:n},Cartesian3.fromSpherical=function(e,t){defined(t)||(t=new Cartesian3);var i=e.clock,r=e.cone,n=defaultValue(e.magnitude,1),a=n*Math.sin(r);return t.x=a*Math.cos(i),t.y=a*Math.sin(i),t.z=n*Math.cos(r),t},Cartesian3.fromElements=function(e,t,i,r){return defined(r)?(r.x=e,r.y=t,r.z=i,r):new Cartesian3(e,t,i)},Cartesian3.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new Cartesian3(e.x,e.y,e.z)},Cartesian3.fromCartesian4=Cartesian3.clone,Cartesian3.packedLength=3,Cartesian3.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i]=e.z,t},Cartesian3.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Cartesian3),i.x=e[t++],i.y=e[t++],i.z=e[t],i},Cartesian3.packArray=function(e,t){var i=e.length;defined(t)?t.length=3*i:t=new Array(3*i);for(var r=0;r<i;++r)Cartesian3.pack(e[r],t,3*r);return t},Cartesian3.unpackArray=function(e,t){var i=e.length;defined(t)?t.length=i/3:t=new Array(i/3);for(var r=0;r<i;r+=3){var n=r/3;t[n]=Cartesian3.unpack(e,r,t[n])}return t},Cartesian3.fromArray=Cartesian3.unpack,Cartesian3.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)},Cartesian3.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)},Cartesian3.minimumByComponent=function(e,t,i){return i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i.z=Math.min(e.z,t.z),i},Cartesian3.maximumByComponent=function(e,t,i){return i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i.z=Math.max(e.z,t.z),i},Cartesian3.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},Cartesian3.magnitude=function(e){return Math.sqrt(Cartesian3.magnitudeSquared(e))};var distanceScratch=new Cartesian3;Cartesian3.distance=function(e,t){return Cartesian3.subtract(e,t,distanceScratch),Cartesian3.magnitude(distanceScratch)},Cartesian3.distanceSquared=function(e,t){return Cartesian3.subtract(e,t,distanceScratch),Cartesian3.magnitudeSquared(distanceScratch)},Cartesian3.normalize=function(e,t){var i=Cartesian3.magnitude(e);return t.x=e.x/i,t.y=e.y/i,t.z=e.z/i,t},Cartesian3.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Cartesian3.multiplyComponents=function(e,t,i){return i.x=e.x*t.x,i.y=e.y*t.y,i.z=e.z*t.z,i},Cartesian3.divideComponents=function(e,t,i){return i.x=e.x/t.x,i.y=e.y/t.y,i.z=e.z/t.z,i},Cartesian3.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i},Cartesian3.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i},Cartesian3.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i},Cartesian3.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i},Cartesian3.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},Cartesian3.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var lerpScratch=new Cartesian3;Cartesian3.lerp=function(e,t,i,r){return Cartesian3.multiplyByScalar(t,i,lerpScratch),r=Cartesian3.multiplyByScalar(e,1-i,r),Cartesian3.add(lerpScratch,r,r)};var angleBetweenScratch=new Cartesian3,angleBetweenScratch2=new Cartesian3;Cartesian3.angleBetween=function(e,t){Cartesian3.normalize(e,angleBetweenScratch),Cartesian3.normalize(t,angleBetweenScratch2);var i=Cartesian3.dot(angleBetweenScratch,angleBetweenScratch2),r=Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch,angleBetweenScratch2,angleBetweenScratch));return Math.atan2(r,i)};var mostOrthogonalAxisScratch=new Cartesian3;Cartesian3.mostOrthogonalAxis=function(e,t){var i=Cartesian3.normalize(e,mostOrthogonalAxisScratch);return Cartesian3.abs(i,i),t=i.x<=i.y?i.x<=i.z?Cartesian3.clone(Cartesian3.UNIT_X,t):Cartesian3.clone(Cartesian3.UNIT_Z,t):i.y<=i.z?Cartesian3.clone(Cartesian3.UNIT_Y,t):Cartesian3.clone(Cartesian3.UNIT_Z,t)},Cartesian3.projectVector=function(e,t,i){var r=Cartesian3.dot(e,t)/Cartesian3.dot(t,t);return Cartesian3.multiplyByScalar(t,r,i)},Cartesian3.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},Cartesian3.equalsArray=function(e,t,i){return e.x===t[i]&&e.y===t[i+1]&&e.z===t[i+2]},Cartesian3.equalsEpsilon=function(e,t,i,r){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,i,r)&&CesiumMath.equalsEpsilon(e.y,t.y,i,r)&&CesiumMath.equalsEpsilon(e.z,t.z,i,r)},Cartesian3.cross=function(e,t,i){var r=e.x,n=e.y,a=e.z,o=t.x,s=t.y,l=t.z,c=n*l-a*s,u=a*o-r*l,d=r*s-n*o;return i.x=c,i.y=u,i.z=d,i},Cartesian3.midpoint=function(e,t,i){return i.x=.5*(e.x+t.x),i.y=.5*(e.y+t.y),i.z=.5*(e.z+t.z),i},Cartesian3.fromDegrees=function(e,t,i,r,n){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartesian3.fromRadians(e,t,i,r,n)};var scratchN=new Cartesian3,scratchK=new Cartesian3,wgs84RadiiSquared=new Cartesian3(40680631590769,40680631590769,40408299984661.445);Cartesian3.fromRadians=function(e,t,i,r,n){i=defaultValue(i,0);var a=defined(r)?r.radiiSquared:wgs84RadiiSquared,o=Math.cos(t);scratchN.x=o*Math.cos(e),scratchN.y=o*Math.sin(e),scratchN.z=Math.sin(t),scratchN=Cartesian3.normalize(scratchN,scratchN),Cartesian3.multiplyComponents(a,scratchN,scratchK);var s=Math.sqrt(Cartesian3.dot(scratchN,scratchK));return scratchK=Cartesian3.divideByScalar(scratchK,s,scratchK),scratchN=Cartesian3.multiplyByScalar(scratchN,i,scratchN),defined(n)||(n=new Cartesian3),Cartesian3.add(scratchK,scratchN,n)},Cartesian3.fromDegreesArray=function(e,t,i){var r=e.length;defined(i)?i.length=r/2:i=new Array(r/2);for(var n=0;n<r;n+=2){var a=e[n],o=e[n+1],s=n/2;i[s]=Cartesian3.fromDegrees(a,o,0,t,i[s])}return i},Cartesian3.fromRadiansArray=function(e,t,i){var r=e.length;defined(i)?i.length=r/2:i=new Array(r/2);for(var n=0;n<r;n+=2){var a=e[n],o=e[n+1],s=n/2;i[s]=Cartesian3.fromRadians(a,o,0,t,i[s])}return i},Cartesian3.fromDegreesArrayHeights=function(e,t,i){var r=e.length;defined(i)?i.length=r/3:i=new Array(r/3);for(var n=0;n<r;n+=3){var a=e[n],o=e[n+1],s=e[n+2],l=n/3;i[l]=Cartesian3.fromDegrees(a,o,s,t,i[l])}return i},Cartesian3.fromRadiansArrayHeights=function(e,t,i){var r=e.length;defined(i)?i.length=r/3:i=new Array(r/3);for(var n=0;n<r;n+=3){var a=e[n],o=e[n+1],s=e[n+2],l=n/3;i[l]=Cartesian3.fromRadians(a,o,s,t,i[l])}return i},Cartesian3.ZERO=freezeObject$1(new Cartesian3(0,0,0)),Cartesian3.UNIT_X=freezeObject$1(new Cartesian3(1,0,0)),Cartesian3.UNIT_Y=freezeObject$1(new Cartesian3(0,1,0)),Cartesian3.UNIT_Z=freezeObject$1(new Cartesian3(0,0,1)),Cartesian3.prototype.clone=function(e){return Cartesian3.clone(this,e)},Cartesian3.prototype.equals=function(e){return Cartesian3.equals(this,e)},Cartesian3.prototype.equalsEpsilon=function(e,t,i){return Cartesian3.equalsEpsilon(this,e,t,i)},Cartesian3.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};var scaleToGeodeticSurfaceIntersection=new Cartesian3,scaleToGeodeticSurfaceGradient=new Cartesian3;function scaleToGeodeticSurface(e,t,i,r,n){var a=e.x,o=e.y,s=e.z,l=t.x,c=t.y,u=t.z,d=a*a*l*l,h=o*o*c*c,p=s*s*u*u,m=d+h+p,f=Math.sqrt(1/m),g=Cartesian3.multiplyByScalar(e,f,scaleToGeodeticSurfaceIntersection);if(m<r)return isFinite(f)?Cartesian3.clone(g,n):void 0;var _=i.x,y=i.y,v=i.z,C=scaleToGeodeticSurfaceGradient;C.x=g.x*_*2,C.y=g.y*y*2,C.z=g.z*v*2;var S,x,T,b,E,P,A,w=(1-f)*Cartesian3.magnitude(e)/(.5*Cartesian3.magnitude(C)),D=0;do{D=(S=d*(E=(x=1/(1+(w-=D)*_))*x)+h*(P=(T=1/(1+w*y))*T)+p*(A=(b=1/(1+w*v))*b)-1)/(-2*(d*(E*x)*_+h*(P*T)*y+p*(A*b)*v))}while(Math.abs(S)>CesiumMath.EPSILON12);return defined(n)?(n.x=a*x,n.y=o*T,n.z=s*b,n):new Cartesian3(a*x,o*T,s*b)}function Cartographic(e,t,i){this.longitude=defaultValue(e,0),this.latitude=defaultValue(t,0),this.height=defaultValue(i,0)}Cartographic.fromRadians=function(e,t,i,r){return i=defaultValue(i,0),defined(r)?(r.longitude=e,r.latitude=t,r.height=i,r):new Cartographic(e,t,i)},Cartographic.fromDegrees=function(e,t,i,r){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartographic.fromRadians(e,t,i,r)};var cartesianToCartographicN=new Cartesian3,cartesianToCartographicP=new Cartesian3,cartesianToCartographicH=new Cartesian3,wgs84OneOverRadii=new Cartesian3(1/6378137,1/6378137,1/6356752.314245179),wgs84OneOverRadiiSquared=new Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),wgs84CenterToleranceSquared=CesiumMath.EPSILON1;Cartographic.fromCartesian=function(e,t,i){var r=defined(t)?t.oneOverRadii:wgs84OneOverRadii,n=defined(t)?t.oneOverRadiiSquared:wgs84OneOverRadiiSquared,a=scaleToGeodeticSurface(e,r,n,defined(t)?t._centerToleranceSquared:wgs84CenterToleranceSquared,cartesianToCartographicP);if(defined(a)){var o=Cartesian3.multiplyComponents(a,n,cartesianToCartographicN);o=Cartesian3.normalize(o,o);var s=Cartesian3.subtract(e,a,cartesianToCartographicH),l=Math.atan2(o.y,o.x),c=Math.asin(o.z),u=CesiumMath.sign(Cartesian3.dot(s,e))*Cartesian3.magnitude(s);return defined(i)?(i.longitude=l,i.latitude=c,i.height=u,i):new Cartographic(l,c,u)}},Cartographic.toCartesian=function(e,t,i){return Cartesian3.fromRadians(e.longitude,e.latitude,e.height,t,i)},Cartographic.clone=function(e,t){if(defined(e))return defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Cartographic(e.longitude,e.latitude,e.height)},Cartographic.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},Cartographic.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(e.longitude-t.longitude)<=i&&Math.abs(e.latitude-t.latitude)<=i&&Math.abs(e.height-t.height)<=i},Cartographic.ZERO=freezeObject$1(new Cartographic(0,0,0)),Cartographic.prototype.clone=function(e){return Cartographic.clone(this,e)},Cartographic.prototype.equals=function(e){return Cartographic.equals(this,e)},Cartographic.prototype.equalsEpsilon=function(e,t){return Cartographic.equalsEpsilon(this,e,t)},Cartographic.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"};var definePropertyWorks=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),defineProperties=Object.defineProperties;definePropertyWorks&&defined(defineProperties)||(defineProperties=function(e){return e});var defineProperties$1=defineProperties;function initialize(e,t,i,r){t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,0),e._radii=new Cartesian3(t,i,r),e._radiiSquared=new Cartesian3(t*t,i*i,r*r),e._radiiToTheFourth=new Cartesian3(t*t*t*t,i*i*i*i,r*r*r*r),e._oneOverRadii=new Cartesian3(0===t?0:1/t,0===i?0:1/i,0===r?0:1/r),e._oneOverRadiiSquared=new Cartesian3(0===t?0:1/(t*t),0===i?0:1/(i*i),0===r?0:1/(r*r)),e._minimumRadius=Math.min(t,i,r),e._maximumRadius=Math.max(t,i,r),e._centerToleranceSquared=CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function Ellipsoid(e,t,i){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,initialize(this,e,t,i)}defineProperties$1(Ellipsoid.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}}}),Ellipsoid.clone=function(e,t){if(defined(e)){var i=e._radii;return defined(t)?(Cartesian3.clone(i,t._radii),Cartesian3.clone(e._radiiSquared,t._radiiSquared),Cartesian3.clone(e._radiiToTheFourth,t._radiiToTheFourth),Cartesian3.clone(e._oneOverRadii,t._oneOverRadii),Cartesian3.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new Ellipsoid(i.x,i.y,i.z)}},Ellipsoid.fromCartesian3=function(e,t){return defined(t)||(t=new Ellipsoid),defined(e)&&initialize(t,e.x,e.y,e.z),t},Ellipsoid.WGS84=freezeObject$1(new Ellipsoid(6378137,6378137,6356752.314245179)),Ellipsoid.UNIT_SPHERE=freezeObject$1(new Ellipsoid(1,1,1)),Ellipsoid.MOON=freezeObject$1(new Ellipsoid(CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS)),Ellipsoid.prototype.clone=function(e){return Ellipsoid.clone(this,e)},Ellipsoid.packedLength=Cartesian3.packedLength,Ellipsoid.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._radii,t,i),t},Ellipsoid.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t);return Ellipsoid.fromCartesian3(r,i)},Ellipsoid.prototype.geocentricSurfaceNormal=Cartesian3.normalize,Ellipsoid.prototype.geodeticSurfaceNormalCartographic=function(e,t){var i=e.longitude,r=e.latitude,n=Math.cos(r),a=n*Math.cos(i),o=n*Math.sin(i),s=Math.sin(r);return defined(t)||(t=new Cartesian3),t.x=a,t.y=o,t.z=s,Cartesian3.normalize(t,t)},Ellipsoid.prototype.geodeticSurfaceNormal=function(e,t){return defined(t)||(t=new Cartesian3),t=Cartesian3.multiplyComponents(e,this._oneOverRadiiSquared,t),Cartesian3.normalize(t,t)};var cartographicToCartesianNormal=new Cartesian3,cartographicToCartesianK=new Cartesian3;Ellipsoid.prototype.cartographicToCartesian=function(e,t){var i=cartographicToCartesianNormal,r=cartographicToCartesianK;this.geodeticSurfaceNormalCartographic(e,i),Cartesian3.multiplyComponents(this._radiiSquared,i,r);var n=Math.sqrt(Cartesian3.dot(i,r));return Cartesian3.divideByScalar(r,n,r),Cartesian3.multiplyByScalar(i,e.height,i),defined(t)||(t=new Cartesian3),Cartesian3.add(r,i,t)},Ellipsoid.prototype.cartographicArrayToCartesianArray=function(e,t){var i=e.length;defined(t)?t.length=i:t=new Array(i);for(var r=0;r<i;r++)t[r]=this.cartographicToCartesian(e[r],t[r]);return t};var cartesianToCartographicN$1=new Cartesian3,cartesianToCartographicP$1=new Cartesian3,cartesianToCartographicH$1=new Cartesian3;function GeographicProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Ellipsoid.prototype.cartesianToCartographic=function(e,t){var i=this.scaleToGeodeticSurface(e,cartesianToCartographicP$1);if(defined(i)){var r=this.geodeticSurfaceNormal(i,cartesianToCartographicN$1),n=Cartesian3.subtract(e,i,cartesianToCartographicH$1),a=Math.atan2(r.y,r.x),o=Math.asin(r.z),s=CesiumMath.sign(Cartesian3.dot(n,e))*Cartesian3.magnitude(n);return defined(t)?(t.longitude=a,t.latitude=o,t.height=s,t):new Cartographic(a,o,s)}},Ellipsoid.prototype.cartesianArrayToCartographicArray=function(e,t){var i=e.length;defined(t)?t.length=i:t=new Array(i);for(var r=0;r<i;++r)t[r]=this.cartesianToCartographic(e[r],t[r]);return t},Ellipsoid.prototype.scaleToGeodeticSurface=function(e,t){return scaleToGeodeticSurface(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},Ellipsoid.prototype.scaleToGeocentricSurface=function(e,t){defined(t)||(t=new Cartesian3);var i=e.x,r=e.y,n=e.z,a=this._oneOverRadiiSquared,o=1/Math.sqrt(i*i*a.x+r*r*a.y+n*n*a.z);return Cartesian3.multiplyByScalar(e,o,t)},Ellipsoid.prototype.transformPositionToScaledSpace=function(e,t){return defined(t)||(t=new Cartesian3),Cartesian3.multiplyComponents(e,this._oneOverRadii,t)},Ellipsoid.prototype.transformPositionFromScaledSpace=function(e,t){return defined(t)||(t=new Cartesian3),Cartesian3.multiplyComponents(e,this._radii,t)},Ellipsoid.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this._radii,e._radii)},Ellipsoid.prototype.toString=function(){return this._radii.toString()},Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,i){t=defaultValue(t,0);var r=this._squaredXOverSquaredZ;if(defined(i)||(i=new Cartesian3),i.x=0,i.y=0,i.z=e.z*(1-r),!(Math.abs(i.z)>=this._radii.z-t))return i},defineProperties$1(GeographicProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),GeographicProjection.prototype.project=function(e,t){var i=this._semimajorAxis,r=e.longitude*i,n=e.latitude*i,a=e.height;return defined(t)?(t.x=r,t.y=n,t.z=a,t):new Cartesian3(r,n,a)},GeographicProjection.prototype.unproject=function(e,t){var i=this._oneOverSemimajorAxis,r=e.x*i,n=e.y*i,a=e.z;return defined(t)?(t.longitude=r,t.latitude=n,t.height=a,t):new Cartographic(r,n,a)};var Intersect={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Intersect$1=freezeObject$1(Intersect);function Interval(e,t){this.start=defaultValue(e,0),this.stop=defaultValue(t,0)}function Matrix3(e,t,i,r,n,a,o,s,l){this[0]=defaultValue(e,0),this[1]=defaultValue(r,0),this[2]=defaultValue(o,0),this[3]=defaultValue(t,0),this[4]=defaultValue(n,0),this[5]=defaultValue(s,0),this[6]=defaultValue(i,0),this[7]=defaultValue(a,0),this[8]=defaultValue(l,0)}Matrix3.packedLength=9,Matrix3.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e[0],t[i++]=e[1],t[i++]=e[2],t[i++]=e[3],t[i++]=e[4],t[i++]=e[5],t[i++]=e[6],t[i++]=e[7],t[i++]=e[8],t},Matrix3.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix3),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i},Matrix3.clone=function(e,t){if(defined(e))return defined(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 Matrix3(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},Matrix3.fromArray=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix3),i[0]=e[t],i[1]=e[t+1],i[2]=e[t+2],i[3]=e[t+3],i[4]=e[t+4],i[5]=e[t+5],i[6]=e[t+6],i[7]=e[t+7],i[8]=e[t+8],i},Matrix3.fromColumnMajorArray=function(e,t){return Matrix3.clone(e,t)},Matrix3.fromRowMajorArray=function(e,t){return defined(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 Matrix3(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},Matrix3.fromQuaternion=function(e,t){var i=e.x*e.x,r=e.x*e.y,n=e.x*e.z,a=e.x*e.w,o=e.y*e.y,s=e.y*e.z,l=e.y*e.w,c=e.z*e.z,u=e.z*e.w,d=e.w*e.w,h=i-o-c+d,p=2*(r-u),m=2*(n+l),f=2*(r+u),g=o-i-c+d,_=2*(s-a),y=2*(n-l),v=2*(s+a),C=-i-o+c+d;return defined(t)?(t[0]=h,t[1]=f,t[2]=y,t[3]=p,t[4]=g,t[5]=v,t[6]=m,t[7]=_,t[8]=C,t):new Matrix3(h,p,m,f,g,_,y,v,C)},Matrix3.fromHeadingPitchRoll=function(e,t){var i=Math.cos(-e.pitch),r=Math.cos(-e.heading),n=Math.cos(e.roll),a=Math.sin(-e.pitch),o=Math.sin(-e.heading),s=Math.sin(e.roll),l=i*r,c=-n*o+s*a*r,u=s*o+n*a*r,d=i*o,h=n*r+s*a*o,p=-s*r+n*a*o,m=-a,f=s*i,g=n*i;return defined(t)?(t[0]=l,t[1]=d,t[2]=m,t[3]=c,t[4]=h,t[5]=f,t[6]=u,t[7]=p,t[8]=g,t):new Matrix3(l,c,u,d,h,p,m,f,g)},Matrix3.fromScale=function(e,t){return defined(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 Matrix3(e.x,0,0,0,e.y,0,0,0,e.z)},Matrix3.fromUniformScale=function(e,t){return defined(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 Matrix3(e,0,0,0,e,0,0,0,e)},Matrix3.fromCrossProduct=function(e,t){return defined(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 Matrix3(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},Matrix3.fromRotationX=function(e,t){var i=Math.cos(e),r=Math.sin(e);return defined(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=i,t[5]=r,t[6]=0,t[7]=-r,t[8]=i,t):new Matrix3(1,0,0,0,i,-r,0,r,i)},Matrix3.fromRotationY=function(e,t){var i=Math.cos(e),r=Math.sin(e);return defined(t)?(t[0]=i,t[1]=0,t[2]=-r,t[3]=0,t[4]=1,t[5]=0,t[6]=r,t[7]=0,t[8]=i,t):new Matrix3(i,0,r,0,1,0,-r,0,i)},Matrix3.fromRotationZ=function(e,t){var i=Math.cos(e),r=Math.sin(e);return defined(t)?(t[0]=i,t[1]=r,t[2]=0,t[3]=-r,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Matrix3(i,-r,0,r,i,0,0,0,1)},Matrix3.toArray=function(e,t){return defined(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]]},Matrix3.getElementIndex=function(e,t){return 3*e+t},Matrix3.getColumn=function(e,t,i){var r=3*t,n=e[r],a=e[1+r],o=e[2+r];return i.x=n,i.y=a,i.z=o,i},Matrix3.setColumn=function(e,t,i,r){var n=3*t;return(r=Matrix3.clone(e,r))[n]=i.x,r[1+n]=i.y,r[2+n]=i.z,r},Matrix3.getRow=function(e,t,i){var r=e[t],n=e[t+3],a=e[t+6];return i.x=r,i.y=n,i.z=a,i},Matrix3.setRow=function(e,t,i,r){return(r=Matrix3.clone(e,r))[t]=i.x,r[t+3]=i.y,r[t+6]=i.z,r};var scratchColumn=new Cartesian3;Matrix3.getScale=function(e,t){return t.x=Cartesian3.magnitude(Cartesian3.fromElements(e[0],e[1],e[2],scratchColumn)),t.y=Cartesian3.magnitude(Cartesian3.fromElements(e[3],e[4],e[5],scratchColumn)),t.z=Cartesian3.magnitude(Cartesian3.fromElements(e[6],e[7],e[8],scratchColumn)),t};var scratchScale=new Cartesian3;Matrix3.getMaximumScale=function(e){return Matrix3.getScale(e,scratchScale),Cartesian3.maximumComponent(scratchScale)},Matrix3.multiply=function(e,t,i){var r=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],n=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],a=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],o=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],s=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],c=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],u=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return i[0]=r,i[1]=n,i[2]=a,i[3]=o,i[4]=s,i[5]=l,i[6]=c,i[7]=u,i[8]=d,i},Matrix3.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i},Matrix3.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i},Matrix3.multiplyByVector=function(e,t,i){var r=t.x,n=t.y,a=t.z,o=e[0]*r+e[3]*n+e[6]*a,s=e[1]*r+e[4]*n+e[7]*a,l=e[2]*r+e[5]*n+e[8]*a;return i.x=o,i.y=s,i.z=l,i},Matrix3.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i},Matrix3.multiplyByScale=function(e,t,i){return i[0]=e[0]*t.x,i[1]=e[1]*t.x,i[2]=e[2]*t.x,i[3]=e[3]*t.y,i[4]=e[4]*t.y,i[5]=e[5]*t.y,i[6]=e[6]*t.z,i[7]=e[7]*t.z,i[8]=e[8]*t.z,i},Matrix3.negate=function(e,t){return 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},Matrix3.transpose=function(e,t){var i=e[0],r=e[3],n=e[6],a=e[1],o=e[4],s=e[7],l=e[2],c=e[5],u=e[8];return t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=l,t[7]=c,t[8]=u,t};var UNIT=new Cartesian3(1,1,1);function computeFrobeniusNorm(e){for(var t=0,i=0;i<9;++i){var r=e[i];t+=r*r}return Math.sqrt(t)}Matrix3.getRotation=function(e,t){var i=Cartesian3.divideComponents(UNIT,Matrix3.getScale(e,scratchScale),scratchScale);return t=Matrix3.multiplyByScale(e,i,t)};var rowVal=[1,0,0],colVal=[2,2,1];function offDiagonalFrobeniusNorm(e){for(var t=0,i=0;i<3;++i){var r=e[Matrix3.getElementIndex(colVal[i],rowVal[i])];t+=2*r*r}return Math.sqrt(t)}function shurDecomposition(e,t){for(var i=CesiumMath.EPSILON15,r=0,n=1,a=0;a<3;++a){var o=Math.abs(e[Matrix3.getElementIndex(colVal[a],rowVal[a])]);r<o&&(n=a,r=o)}var s=1,l=0,c=rowVal[n],u=colVal[n];if(Math.abs(e[Matrix3.getElementIndex(u,c)])>i){var d,h=(e[Matrix3.getElementIndex(u,u)]-e[Matrix3.getElementIndex(c,c)])/2/e[Matrix3.getElementIndex(u,c)];l=(d=h<0?-1/(-h+Math.sqrt(1+h*h)):1/(h+Math.sqrt(1+h*h)))*(s=1/Math.sqrt(1+d*d))}return(t=Matrix3.clone(Matrix3.IDENTITY,t))[Matrix3.getElementIndex(c,c)]=t[Matrix3.getElementIndex(u,u)]=s,t[Matrix3.getElementIndex(u,c)]=l,t[Matrix3.getElementIndex(c,u)]=-l,t}var jMatrix=new Matrix3,jMatrixTranspose=new Matrix3;function Cartesian4(e,t,i,r){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(i,0),this.w=defaultValue(r,0)}Matrix3.computeEigenDecomposition=function(e,t){var i=CesiumMath.EPSILON20,r=0,n=0;defined(t)||(t={});for(var a=t.unitary=Matrix3.clone(Matrix3.IDENTITY,t.unitary),o=t.diagonal=Matrix3.clone(e,t.diagonal),s=i*computeFrobeniusNorm(o);n<10&&offDiagonalFrobeniusNorm(o)>s;)shurDecomposition(o,jMatrix),Matrix3.transpose(jMatrix,jMatrixTranspose),Matrix3.multiply(o,jMatrix,o),Matrix3.multiply(jMatrixTranspose,o,o),Matrix3.multiply(a,jMatrix,a),2<++r&&(++n,r=0);return t},Matrix3.abs=function(e,t){return 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},Matrix3.determinant=function(e){var t=e[0],i=e[3],r=e[6],n=e[1],a=e[4],o=e[7],s=e[2],l=e[5],c=e[8];return t*(a*c-l*o)+n*(l*r-i*c)+s*(i*o-a*r)},Matrix3.inverse=function(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],d=Matrix3.determinant(e);t[0]=o*u-c*s,t[1]=c*n-r*u,t[2]=r*s-o*n,t[3]=l*s-a*u,t[4]=i*u-l*n,t[5]=a*n-i*s,t[6]=a*c-l*o,t[7]=l*r-i*c,t[8]=i*o-a*r;var h=1/d;return Matrix3.multiplyByScalar(t,h,t)},Matrix3.equals=function(e,t){return e===t||defined(e)&&defined(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]},Matrix3.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=i&&Math.abs(e[1]-t[1])<=i&&Math.abs(e[2]-t[2])<=i&&Math.abs(e[3]-t[3])<=i&&Math.abs(e[4]-t[4])<=i&&Math.abs(e[5]-t[5])<=i&&Math.abs(e[6]-t[6])<=i&&Math.abs(e[7]-t[7])<=i&&Math.abs(e[8]-t[8])<=i},Matrix3.IDENTITY=freezeObject$1(new Matrix3(1,0,0,0,1,0,0,0,1)),Matrix3.ZERO=freezeObject$1(new Matrix3(0,0,0,0,0,0,0,0,0)),Matrix3.COLUMN0ROW0=0,Matrix3.COLUMN0ROW1=1,Matrix3.COLUMN0ROW2=2,Matrix3.COLUMN1ROW0=3,Matrix3.COLUMN1ROW1=4,Matrix3.COLUMN1ROW2=5,Matrix3.COLUMN2ROW0=6,Matrix3.COLUMN2ROW1=7,Matrix3.COLUMN2ROW2=8,defineProperties$1(Matrix3.prototype,{length:{get:function(){return Matrix3.packedLength}}}),Matrix3.prototype.clone=function(e){return Matrix3.clone(this,e)},Matrix3.prototype.equals=function(e){return Matrix3.equals(this,e)},Matrix3.equalsArray=function(e,t,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]&&e[4]===t[i+4]&&e[5]===t[i+5]&&e[6]===t[i+6]&&e[7]===t[i+7]&&e[8]===t[i+8]},Matrix3.prototype.equalsEpsilon=function(e,t){return Matrix3.equalsEpsilon(this,e,t)},Matrix3.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},Cartesian4.fromElements=function(e,t,i,r,n){return defined(n)?(n.x=e,n.y=t,n.z=i,n.w=r,n):new Cartesian4(e,t,i,r)},Cartesian4.fromColor=function(e,t){return defined(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new Cartesian4(e.red,e.green,e.blue,e.alpha)},Cartesian4.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Cartesian4(e.x,e.y,e.z,e.w)},Cartesian4.packedLength=4,Cartesian4.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i++]=e.z,t[i]=e.w,t},Cartesian4.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Cartesian4),i.x=e[t++],i.y=e[t++],i.z=e[t++],i.w=e[t],i},Cartesian4.packArray=function(e,t){var i=e.length;defined(t)?t.length=4*i:t=new Array(4*i);for(var r=0;r<i;++r)Cartesian4.pack(e[r],t,4*r);return t},Cartesian4.unpackArray=function(e,t){var i=e.length;defined(t)?t.length=i/4:t=new Array(i/4);for(var r=0;r<i;r+=4){var n=r/4;t[n]=Cartesian4.unpack(e,r,t[n])}return t},Cartesian4.fromArray=Cartesian4.unpack,Cartesian4.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)},Cartesian4.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)},Cartesian4.minimumByComponent=function(e,t,i){return i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i.z=Math.min(e.z,t.z),i.w=Math.min(e.w,t.w),i},Cartesian4.maximumByComponent=function(e,t,i){return i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i.z=Math.max(e.z,t.z),i.w=Math.max(e.w,t.w),i},Cartesian4.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},Cartesian4.magnitude=function(e){return Math.sqrt(Cartesian4.magnitudeSquared(e))};var distanceScratch$1=new Cartesian4;Cartesian4.distance=function(e,t){return Cartesian4.subtract(e,t,distanceScratch$1),Cartesian4.magnitude(distanceScratch$1)},Cartesian4.distanceSquared=function(e,t){return Cartesian4.subtract(e,t,distanceScratch$1),Cartesian4.magnitudeSquared(distanceScratch$1)},Cartesian4.normalize=function(e,t){var i=Cartesian4.magnitude(e);return t.x=e.x/i,t.y=e.y/i,t.z=e.z/i,t.w=e.w/i,t},Cartesian4.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},Cartesian4.multiplyComponents=function(e,t,i){return i.x=e.x*t.x,i.y=e.y*t.y,i.z=e.z*t.z,i.w=e.w*t.w,i},Cartesian4.divideComponents=function(e,t,i){return i.x=e.x/t.x,i.y=e.y/t.y,i.z=e.z/t.z,i.w=e.w/t.w,i},Cartesian4.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i.w=e.w+t.w,i},Cartesian4.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i.w=e.w-t.w,i},Cartesian4.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i.w=e.w*t,i},Cartesian4.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i.w=e.w/t,i},Cartesian4.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},Cartesian4.abs=function(e,t){return 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};var lerpScratch$1=new Cartesian4;Cartesian4.lerp=function(e,t,i,r){return Cartesian4.multiplyByScalar(t,i,lerpScratch$1),r=Cartesian4.multiplyByScalar(e,1-i,r),Cartesian4.add(lerpScratch$1,r,r)};var mostOrthogonalAxisScratch$1=new Cartesian4;Cartesian4.mostOrthogonalAxis=function(e,t){var i=Cartesian4.normalize(e,mostOrthogonalAxisScratch$1);return Cartesian4.abs(i,i),t=i.x<=i.y?i.x<=i.z?i.x<=i.w?Cartesian4.clone(Cartesian4.UNIT_X,t):Cartesian4.clone(Cartesian4.UNIT_W,t):i.z<=i.w?Cartesian4.clone(Cartesian4.UNIT_Z,t):Cartesian4.clone(Cartesian4.UNIT_W,t):i.y<=i.z?i.y<=i.w?Cartesian4.clone(Cartesian4.UNIT_Y,t):Cartesian4.clone(Cartesian4.UNIT_W,t):i.z<=i.w?Cartesian4.clone(Cartesian4.UNIT_Z,t):Cartesian4.clone(Cartesian4.UNIT_W,t)},Cartesian4.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},Cartesian4.equalsArray=function(e,t,i){return e.x===t[i]&&e.y===t[i+1]&&e.z===t[i+2]&&e.w===t[i+3]},Cartesian4.equalsEpsilon=function(e,t,i,r){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,i,r)&&CesiumMath.equalsEpsilon(e.y,t.y,i,r)&&CesiumMath.equalsEpsilon(e.z,t.z,i,r)&&CesiumMath.equalsEpsilon(e.w,t.w,i,r)},Cartesian4.ZERO=freezeObject$1(new Cartesian4(0,0,0,0)),Cartesian4.UNIT_X=freezeObject$1(new Cartesian4(1,0,0,0)),Cartesian4.UNIT_Y=freezeObject$1(new Cartesian4(0,1,0,0)),Cartesian4.UNIT_Z=freezeObject$1(new Cartesian4(0,0,1,0)),Cartesian4.UNIT_W=freezeObject$1(new Cartesian4(0,0,0,1)),Cartesian4.prototype.clone=function(e){return Cartesian4.clone(this,e)},Cartesian4.prototype.equals=function(e){return Cartesian4.equals(this,e)},Cartesian4.prototype.equalsEpsilon=function(e,t,i){return Cartesian4.equalsEpsilon(this,e,t,i)},Cartesian4.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"};var scratchFloatArray=new Float32Array(1),SHIFT_LEFT_8=256,SHIFT_LEFT_16=65536,SHIFT_LEFT_24=16777216,SHIFT_RIGHT_8=1/SHIFT_LEFT_8,SHIFT_RIGHT_16=1/SHIFT_LEFT_16,SHIFT_RIGHT_24=1/SHIFT_LEFT_24,BIAS=38;Cartesian4.packFloat=function(e,t){if(defined(t)||(t=new Cartesian4),scratchFloatArray[0]=e,0===(e=scratchFloatArray[0]))return Cartesian4.clone(Cartesian4.ZERO,t);var i,r=e<0?1:0;isFinite(e)?(e=Math.abs(e),i=Math.floor(CesiumMath.logBase(e,10))+1,e/=Math.pow(10,i)):(e=.1,i=BIAS);var n=e*SHIFT_LEFT_8;return t.x=Math.floor(n),n=(n-t.x)*SHIFT_LEFT_8,t.y=Math.floor(n),n=(n-t.y)*SHIFT_LEFT_8,t.z=Math.floor(n),t.w=2*(i+BIAS)+r,t},Cartesian4.unpackFloat=function(e){var t=e.w/2,i=Math.floor(t),r=2*(t-i);if(r=-(r=2*r-1),BIAS<=(i-=BIAS))return r<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY;var n=r*e.x*SHIFT_RIGHT_8;return n+=r*e.y*SHIFT_RIGHT_16,(n+=r*e.z*SHIFT_RIGHT_24)*Math.pow(10,i)};var warnings={};function oneTimeWarning(e,t){defined(warnings[e])||(warnings[e]=!0,console.warn(defaultValue(t,e)))}function deprecationWarning(e,t){oneTimeWarning(e,t)}function RuntimeError(e){var t;this.name="RuntimeError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}function Matrix4(e,t,i,r,n,a,o,s,l,c,u,d,h,p,m,f){this[0]=defaultValue(e,0),this[1]=defaultValue(n,0),this[2]=defaultValue(l,0),this[3]=defaultValue(h,0),this[4]=defaultValue(t,0),this[5]=defaultValue(a,0),this[6]=defaultValue(c,0),this[7]=defaultValue(p,0),this[8]=defaultValue(i,0),this[9]=defaultValue(o,0),this[10]=defaultValue(u,0),this[11]=defaultValue(m,0),this[12]=defaultValue(r,0),this[13]=defaultValue(s,0),this[14]=defaultValue(d,0),this[15]=defaultValue(f,0)}oneTimeWarning.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.",oneTimeWarning.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined.  zIndex will be ignored",oneTimeWarning.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height.  heightReference will be ignored",oneTimeWarning.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight.  extrudedHeightReference will be ignored",defined(Object.create)&&(RuntimeError.prototype=Object.create(Error.prototype),RuntimeError.prototype.constructor=RuntimeError),RuntimeError.prototype.toString=function(){var e=this.name+": "+this.message;return defined(this.stack)&&(e+="\n"+this.stack.toString()),e},Matrix4.packedLength=16,Matrix4.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e[0],t[i++]=e[1],t[i++]=e[2],t[i++]=e[3],t[i++]=e[4],t[i++]=e[5],t[i++]=e[6],t[i++]=e[7],t[i++]=e[8],t[i++]=e[9],t[i++]=e[10],t[i++]=e[11],t[i++]=e[12],t[i++]=e[13],t[i++]=e[14],t[i]=e[15],t},Matrix4.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix4),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},Matrix4.clone=function(e,t){if(defined(e))return defined(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 Matrix4(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])},Matrix4.fromArray=Matrix4.unpack,Matrix4.fromColumnMajorArray=function(e,t){return Matrix4.clone(e,t)},Matrix4.fromRowMajorArray=function(e,t){return defined(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 Matrix4(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])},Matrix4.fromRotationTranslation=function(e,t,i){return t=defaultValue(t,Cartesian3.ZERO),defined(i)?(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=0,i[4]=e[3],i[5]=e[4],i[6]=e[5],i[7]=0,i[8]=e[6],i[9]=e[7],i[10]=e[8],i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,i):new Matrix4(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)},Matrix4.fromTranslationQuaternionRotationScale=function(e,t,i,r){defined(r)||(r=new Matrix4);var n=i.x,a=i.y,o=i.z,s=t.x*t.x,l=t.x*t.y,c=t.x*t.z,u=t.x*t.w,d=t.y*t.y,h=t.y*t.z,p=t.y*t.w,m=t.z*t.z,f=t.z*t.w,g=t.w*t.w,_=s-d-m+g,y=2*(l-f),v=2*(c+p),C=2*(l+f),S=d-s-m+g,x=2*(h-u),T=2*(c-p),b=2*(h+u),E=-s-d+m+g;return r[0]=_*n,r[1]=C*n,r[2]=T*n,r[3]=0,r[4]=y*a,r[5]=S*a,r[6]=b*a,r[7]=0,r[8]=v*o,r[9]=x*o,r[10]=E*o,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,r},Matrix4.fromTranslationRotationScale=function(e,t){return Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)},Matrix4.fromTranslation=function(e,t){return Matrix4.fromRotationTranslation(Matrix3.IDENTITY,e,t)},Matrix4.fromScale=function(e,t){return defined(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 Matrix4(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},Matrix4.fromUniformScale=function(e,t){return defined(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 Matrix4(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var fromCameraF=new Cartesian3,fromCameraR=new Cartesian3,fromCameraU=new Cartesian3;Matrix4.fromCamera=function(e,t){var i=e.position,r=e.direction,n=e.up;Cartesian3.normalize(r,fromCameraF),Cartesian3.normalize(Cartesian3.cross(fromCameraF,n,fromCameraR),fromCameraR),Cartesian3.normalize(Cartesian3.cross(fromCameraR,fromCameraF,fromCameraU),fromCameraU);var a=fromCameraR.x,o=fromCameraR.y,s=fromCameraR.z,l=fromCameraF.x,c=fromCameraF.y,u=fromCameraF.z,d=fromCameraU.x,h=fromCameraU.y,p=fromCameraU.z,m=i.x,f=i.y,g=i.z,_=a*-m+o*-f+s*-g,y=d*-m+h*-f+p*-g,v=l*m+c*f+u*g;return defined(t)?(t[0]=a,t[1]=d,t[2]=-l,t[3]=0,t[4]=o,t[5]=h,t[6]=-c,t[7]=0,t[8]=s,t[9]=p,t[10]=-u,t[11]=0,t[12]=_,t[13]=y,t[14]=v,t[15]=1,t):new Matrix4(a,o,s,_,d,h,p,y,-l,-c,-u,v,0,0,0,1)},Matrix4.computePerspectiveFieldOfView=function(e,t,i,r,n){var a=1/Math.tan(.5*e),o=a/t,s=(r+i)/(i-r),l=2*r*i/(i-r);return n[0]=o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=s,n[11]=-1,n[12]=0,n[13]=0,n[14]=l,n[15]=0,n},Matrix4.computeOrthographicOffCenter=function(e,t,i,r,n,a,o){var s=1/(t-e),l=1/(r-i),c=1/(a-n),u=-(t+e)*s,d=-(r+i)*l,h=-(a+n)*c;return s*=2,l*=2,c*=-2,o[0]=s,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=0,o[12]=u,o[13]=d,o[14]=h,o[15]=1,o},Matrix4.computePerspectiveOffCenter=function(e,t,i,r,n,a,o){var s=2*n/(t-e),l=2*n/(r-i),c=(t+e)/(t-e),u=(r+i)/(r-i),d=-(a+n)/(a-n),h=-2*a*n/(a-n);return o[0]=s,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=l,o[6]=0,o[7]=0,o[8]=c,o[9]=u,o[10]=d,o[11]=-1,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o},Matrix4.computeInfinitePerspectiveOffCenter=function(e,t,i,r,n,a){var o=2*n/(t-e),s=2*n/(r-i),l=(t+e)/(t-e),c=(r+i)/(r-i),u=-2*n;return a[0]=o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=s,a[6]=0,a[7]=0,a[8]=l,a[9]=c,a[10]=-1,a[11]=-1,a[12]=0,a[13]=0,a[14]=u,a[15]=0,a},Matrix4.computeViewportTransformation=function(e,t,i,r){var n=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).x,0),a=defaultValue(e.y,0),o=defaultValue(e.width,0),s=defaultValue(e.height,0);t=defaultValue(t,0);var l=.5*o,c=.5*s,u=.5*((i=defaultValue(i,1))-t),d=l,h=c,p=u,m=n+l,f=a+c,g=t+u;return r[0]=d,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=p,r[11]=0,r[12]=m,r[13]=f,r[14]=g,r[15]=1,r},Matrix4.computeView=function(e,t,i,r,n){return n[0]=r.x,n[1]=i.x,n[2]=-t.x,n[3]=0,n[4]=r.y,n[5]=i.y,n[6]=-t.y,n[7]=0,n[8]=r.z,n[9]=i.z,n[10]=-t.z,n[11]=0,n[12]=-Cartesian3.dot(r,e),n[13]=-Cartesian3.dot(i,e),n[14]=Cartesian3.dot(t,e),n[15]=1,n},Matrix4.toArray=function(e,t){return defined(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]]},Matrix4.getElementIndex=function(e,t){return 4*e+t},Matrix4.getColumn=function(e,t,i){var r=4*t,n=e[r],a=e[1+r],o=e[2+r],s=e[3+r];return i.x=n,i.y=a,i.z=o,i.w=s,i},Matrix4.setColumn=function(e,t,i,r){var n=4*t;return(r=Matrix4.clone(e,r))[n]=i.x,r[1+n]=i.y,r[2+n]=i.z,r[3+n]=i.w,r},Matrix4.setTranslation=function(e,t,i){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=e[15],i};var scaleScratch=new Cartesian3;Matrix4.setScale=function(e,t,i){var r=Matrix4.getScale(e,scaleScratch),n=Cartesian3.divideComponents(t,r,scaleScratch);return Matrix4.multiplyByScale(e,n,i)},Matrix4.getRow=function(e,t,i){var r=e[t],n=e[t+4],a=e[t+8],o=e[t+12];return i.x=r,i.y=n,i.z=a,i.w=o,i},Matrix4.setRow=function(e,t,i,r){return(r=Matrix4.clone(e,r))[t]=i.x,r[t+4]=i.y,r[t+8]=i.z,r[t+12]=i.w,r};var scratchColumn$1=new Cartesian3;Matrix4.getScale=function(e,t){return t.x=Cartesian3.magnitude(Cartesian3.fromElements(e[0],e[1],e[2],scratchColumn$1)),t.y=Cartesian3.magnitude(Cartesian3.fromElements(e[4],e[5],e[6],scratchColumn$1)),t.z=Cartesian3.magnitude(Cartesian3.fromElements(e[8],e[9],e[10],scratchColumn$1)),t};var scratchScale$1=new Cartesian3;Matrix4.getMaximumScale=function(e){return Matrix4.getScale(e,scratchScale$1),Cartesian3.maximumComponent(scratchScale$1)},Matrix4.multiply=function(e,t,i){var r=e[0],n=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=e[9],p=e[10],m=e[11],f=e[12],g=e[13],_=e[14],y=e[15],v=t[0],C=t[1],S=t[2],x=t[3],T=t[4],b=t[5],E=t[6],P=t[7],A=t[8],w=t[9],D=t[10],M=t[11],I=t[12],R=t[13],O=t[14],L=t[15],F=r*v+s*C+d*S+f*x,N=n*v+l*C+h*S+g*x,B=a*v+c*C+p*S+_*x,V=o*v+u*C+m*S+y*x,k=r*T+s*b+d*E+f*P,$=n*T+l*b+h*E+g*P,z=a*T+c*b+p*E+_*P,U=o*T+u*b+m*E+y*P,G=r*A+s*w+d*D+f*M,H=n*A+l*w+h*D+g*M,W=a*A+c*w+p*D+_*M,q=o*A+u*w+m*D+y*M,j=r*I+s*R+d*O+f*L,Y=n*I+l*R+h*O+g*L,X=a*I+c*R+p*O+_*L,Q=o*I+u*R+m*O+y*L;return i[0]=F,i[1]=N,i[2]=B,i[3]=V,i[4]=k,i[5]=$,i[6]=z,i[7]=U,i[8]=G,i[9]=H,i[10]=W,i[11]=q,i[12]=j,i[13]=Y,i[14]=X,i[15]=Q,i},Matrix4.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i},Matrix4.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i},Matrix4.multiplyTransformation=function(e,t,i){var r=e[0],n=e[1],a=e[2],o=e[4],s=e[5],l=e[6],c=e[8],u=e[9],d=e[10],h=e[12],p=e[13],m=e[14],f=t[0],g=t[1],_=t[2],y=t[4],v=t[5],C=t[6],S=t[8],x=t[9],T=t[10],b=t[12],E=t[13],P=t[14],A=r*f+o*g+c*_,w=n*f+s*g+u*_,D=a*f+l*g+d*_,M=r*y+o*v+c*C,I=n*y+s*v+u*C,R=a*y+l*v+d*C,O=r*S+o*x+c*T,L=n*S+s*x+u*T,F=a*S+l*x+d*T,N=r*b+o*E+c*P+h,B=n*b+s*E+u*P+p,V=a*b+l*E+d*P+m;return i[0]=A,i[1]=w,i[2]=D,i[3]=0,i[4]=M,i[5]=I,i[6]=R,i[7]=0,i[8]=O,i[9]=L,i[10]=F,i[11]=0,i[12]=N,i[13]=B,i[14]=V,i[15]=1,i},Matrix4.multiplyByMatrix3=function(e,t,i){var r=e[0],n=e[1],a=e[2],o=e[4],s=e[5],l=e[6],c=e[8],u=e[9],d=e[10],h=t[0],p=t[1],m=t[2],f=t[3],g=t[4],_=t[5],y=t[6],v=t[7],C=t[8],S=r*h+o*p+c*m,x=n*h+s*p+u*m,T=a*h+l*p+d*m,b=r*f+o*g+c*_,E=n*f+s*g+u*_,P=a*f+l*g+d*_,A=r*y+o*v+c*C,w=n*y+s*v+u*C,D=a*y+l*v+d*C;return i[0]=S,i[1]=x,i[2]=T,i[3]=0,i[4]=b,i[5]=E,i[6]=P,i[7]=0,i[8]=A,i[9]=w,i[10]=D,i[11]=0,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},Matrix4.multiplyByTranslation=function(e,t,i){var r=t.x,n=t.y,a=t.z,o=r*e[0]+n*e[4]+a*e[8]+e[12],s=r*e[1]+n*e[5]+a*e[9]+e[13],l=r*e[2]+n*e[6]+a*e[10]+e[14];return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=o,i[13]=s,i[14]=l,i[15]=e[15],i};var uniformScaleScratch=new Cartesian3;Matrix4.multiplyByUniformScale=function(e,t,i){return uniformScaleScratch.x=t,uniformScaleScratch.y=t,uniformScaleScratch.z=t,Matrix4.multiplyByScale(e,uniformScaleScratch,i)},Matrix4.multiplyByScale=function(e,t,i){var r=t.x,n=t.y,a=t.z;return 1===r&&1===n&&1===a?Matrix4.clone(e,i):(i[0]=r*e[0],i[1]=r*e[1],i[2]=r*e[2],i[3]=0,i[4]=n*e[4],i[5]=n*e[5],i[6]=n*e[6],i[7]=0,i[8]=a*e[8],i[9]=a*e[9],i[10]=a*e[10],i[11]=0,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=1,i)},Matrix4.multiplyByVector=function(e,t,i){var r=t.x,n=t.y,a=t.z,o=t.w,s=e[0]*r+e[4]*n+e[8]*a+e[12]*o,l=e[1]*r+e[5]*n+e[9]*a+e[13]*o,c=e[2]*r+e[6]*n+e[10]*a+e[14]*o,u=e[3]*r+e[7]*n+e[11]*a+e[15]*o;return i.x=s,i.y=l,i.z=c,i.w=u,i},Matrix4.multiplyByPointAsVector=function(e,t,i){var r=t.x,n=t.y,a=t.z,o=e[0]*r+e[4]*n+e[8]*a,s=e[1]*r+e[5]*n+e[9]*a,l=e[2]*r+e[6]*n+e[10]*a;return i.x=o,i.y=s,i.z=l,i},Matrix4.multiplyByPoint=function(e,t,i){var r=t.x,n=t.y,a=t.z,o=e[0]*r+e[4]*n+e[8]*a+e[12],s=e[1]*r+e[5]*n+e[9]*a+e[13],l=e[2]*r+e[6]*n+e[10]*a+e[14];return i.x=o,i.y=s,i.z=l,i},Matrix4.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i},Matrix4.negate=function(e,t){return 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},Matrix4.transpose=function(e,t){var i=e[1],r=e[2],n=e[3],a=e[6],o=e[7],s=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[10]=e[10],t[11]=e[14],t[12]=n,t[13]=o,t[14]=s,t[15]=e[15],t},Matrix4.abs=function(e,t){return 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},Matrix4.equals=function(e,t){return e===t||defined(e)&&defined(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]},Matrix4.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=i&&Math.abs(e[1]-t[1])<=i&&Math.abs(e[2]-t[2])<=i&&Math.abs(e[3]-t[3])<=i&&Math.abs(e[4]-t[4])<=i&&Math.abs(e[5]-t[5])<=i&&Math.abs(e[6]-t[6])<=i&&Math.abs(e[7]-t[7])<=i&&Math.abs(e[8]-t[8])<=i&&Math.abs(e[9]-t[9])<=i&&Math.abs(e[10]-t[10])<=i&&Math.abs(e[11]-t[11])<=i&&Math.abs(e[12]-t[12])<=i&&Math.abs(e[13]-t[13])<=i&&Math.abs(e[14]-t[14])<=i&&Math.abs(e[15]-t[15])<=i},Matrix4.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t},Matrix4.getRotation=function(e,t){return deprecationWarning("Matrix4.getRotation","Matrix4.getRotation is deprecated and will be removed in Cesium 1.65. Use Matrix4.getMatrix3 instead."),Matrix4.getMatrix3(e,t)},Matrix4.getMatrix3=function(e,t){return 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};var scratchInverseRotation=new Matrix3,scratchMatrix3Zero=new Matrix3,scratchBottomRow=new Cartesian4,scratchExpectedBottomRow=new Cartesian4(0,0,0,1);function Rectangle(e,t,i,r){this.west=defaultValue(e,0),this.south=defaultValue(t,0),this.east=defaultValue(i,0),this.north=defaultValue(r,0)}Matrix4.inverse=function(e,t){var i=e[0],r=e[4],n=e[8],a=e[12],o=e[1],s=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],p=e[14],m=e[3],f=e[7],g=e[11],_=e[15],y=h*_,v=p*g,C=d*_,S=p*f,x=d*g,T=h*f,b=u*_,E=p*m,P=u*g,A=h*m,w=u*f,D=d*m,M=y*s+S*l+x*c-(v*s+C*l+T*c),I=v*o+b*l+A*c-(y*o+E*l+P*c),R=C*o+E*s+w*c-(S*o+b*s+D*c),O=T*o+P*s+D*l-(x*o+A*s+w*l),L=v*r+C*n+T*a-(y*r+S*n+x*a),F=y*i+E*n+P*a-(v*i+b*n+A*a),N=S*i+b*r+D*a-(C*i+E*r+w*a),B=x*i+A*r+w*n-(T*i+P*r+D*n),V=(y=n*c)*f+(S=a*s)*g+(x=r*l)*_-((v=a*l)*f+(C=r*c)*g+(T=n*s)*_),k=v*m+(b=i*c)*g+(A=n*o)*_-(y*m+(E=a*o)*g+(P=i*l)*_),$=C*m+E*f+(w=i*s)*_-(S*m+b*f+(D=r*o)*_),z=T*m+P*f+D*g-(x*m+A*f+w*g),U=C*h+T*p+v*d-(x*p+y*d+S*h),G=P*p+y*u+E*h-(b*h+A*p+v*u),H=b*d+D*p+S*u-(w*p+C*u+E*d),W=w*h+x*u+A*d-(P*d+D*h+T*u),q=i*M+r*I+n*R+a*O;if(Math.abs(q)<CesiumMath.EPSILON21){if(Matrix3.equalsEpsilon(Matrix4.getMatrix3(e,scratchInverseRotation),scratchMatrix3Zero,CesiumMath.EPSILON7)&&Cartesian4.equals(Matrix4.getRow(e,3,scratchBottomRow),scratchExpectedBottomRow))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 RuntimeError("matrix is not invertible because its determinate is zero.")}return q=1/q,t[0]=M*q,t[1]=I*q,t[2]=R*q,t[3]=O*q,t[4]=L*q,t[5]=F*q,t[6]=N*q,t[7]=B*q,t[8]=V*q,t[9]=k*q,t[10]=$*q,t[11]=z*q,t[12]=U*q,t[13]=G*q,t[14]=H*q,t[15]=W*q,t},Matrix4.inverseTransformation=function(e,t){var i=e[0],r=e[1],n=e[2],a=e[4],o=e[5],s=e[6],l=e[8],c=e[9],u=e[10],d=e[12],h=e[13],p=e[14],m=-i*d-r*h-n*p,f=-a*d-o*h-s*p,g=-l*d-c*h-u*p;return t[0]=i,t[1]=a,t[2]=l,t[3]=0,t[4]=r,t[5]=o,t[6]=c,t[7]=0,t[8]=n,t[9]=s,t[10]=u,t[11]=0,t[12]=m,t[13]=f,t[14]=g,t[15]=1,t},Matrix4.IDENTITY=freezeObject$1(new Matrix4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),Matrix4.ZERO=freezeObject$1(new Matrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),Matrix4.COLUMN0ROW0=0,Matrix4.COLUMN0ROW1=1,Matrix4.COLUMN0ROW2=2,Matrix4.COLUMN0ROW3=3,Matrix4.COLUMN1ROW0=4,Matrix4.COLUMN1ROW1=5,Matrix4.COLUMN1ROW2=6,Matrix4.COLUMN1ROW3=7,Matrix4.COLUMN2ROW0=8,Matrix4.COLUMN2ROW1=9,Matrix4.COLUMN2ROW2=10,Matrix4.COLUMN2ROW3=11,Matrix4.COLUMN3ROW0=12,Matrix4.COLUMN3ROW1=13,Matrix4.COLUMN3ROW2=14,Matrix4.COLUMN3ROW3=15,defineProperties$1(Matrix4.prototype,{length:{get:function(){return Matrix4.packedLength}}}),Matrix4.prototype.clone=function(e){return Matrix4.clone(this,e)},Matrix4.prototype.equals=function(e){return Matrix4.equals(this,e)},Matrix4.equalsArray=function(e,t,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]&&e[4]===t[i+4]&&e[5]===t[i+5]&&e[6]===t[i+6]&&e[7]===t[i+7]&&e[8]===t[i+8]&&e[9]===t[i+9]&&e[10]===t[i+10]&&e[11]===t[i+11]&&e[12]===t[i+12]&&e[13]===t[i+13]&&e[14]===t[i+14]&&e[15]===t[i+15]},Matrix4.prototype.equalsEpsilon=function(e,t){return Matrix4.equalsEpsilon(this,e,t)},Matrix4.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},defineProperties$1(Rectangle.prototype,{width:{get:function(){return Rectangle.computeWidth(this)}},height:{get:function(){return Rectangle.computeHeight(this)}}}),Rectangle.packedLength=4,Rectangle.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.west,t[i++]=e.south,t[i++]=e.east,t[i]=e.north,t},Rectangle.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Rectangle),i.west=e[t++],i.south=e[t++],i.east=e[t++],i.north=e[t],i},Rectangle.computeWidth=function(e){var t=e.east,i=e.west;return t<i&&(t+=CesiumMath.TWO_PI),t-i},Rectangle.computeHeight=function(e){return e.north-e.south},Rectangle.fromDegrees=function(e,t,i,r,n){return e=CesiumMath.toRadians(defaultValue(e,0)),t=CesiumMath.toRadians(defaultValue(t,0)),i=CesiumMath.toRadians(defaultValue(i,0)),r=CesiumMath.toRadians(defaultValue(r,0)),defined(n)?(n.west=e,n.south=t,n.east=i,n.north=r,n):new Rectangle(e,t,i,r)},Rectangle.fromRadians=function(e,t,i,r,n){return defined(n)?(n.west=defaultValue(e,0),n.south=defaultValue(t,0),n.east=defaultValue(i,0),n.north=defaultValue(r,0),n):new Rectangle(e,t,i,r)},Rectangle.fromCartographicArray=function(e,t){for(var i=Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=Number.MAX_VALUE,s=-Number.MAX_VALUE,l=0,c=e.length;l<c;l++){var u=e[l];i=Math.min(i,u.longitude),r=Math.max(r,u.longitude),o=Math.min(o,u.latitude),s=Math.max(s,u.latitude);var d=0<=u.longitude?u.longitude:u.longitude+CesiumMath.TWO_PI;n=Math.min(n,d),a=Math.max(a,d)}return a-n<r-i&&(i=n,(r=a)>CesiumMath.PI&&(r-=CesiumMath.TWO_PI),i>CesiumMath.PI&&(i-=CesiumMath.TWO_PI)),defined(t)?(t.west=i,t.south=o,t.east=r,t.north=s,t):new Rectangle(i,o,r,s)},Rectangle.fromCartesianArray=function(e,t,i){t=defaultValue(t,Ellipsoid.WGS84);for(var r=Number.MAX_VALUE,n=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,s=Number.MAX_VALUE,l=-Number.MAX_VALUE,c=0,u=e.length;c<u;c++){var d=t.cartesianToCartographic(e[c]);r=Math.min(r,d.longitude),n=Math.max(n,d.longitude),s=Math.min(s,d.latitude),l=Math.max(l,d.latitude);var h=0<=d.longitude?d.longitude:d.longitude+CesiumMath.TWO_PI;a=Math.min(a,h),o=Math.max(o,h)}return o-a<n-r&&(r=a,(n=o)>CesiumMath.PI&&(n-=CesiumMath.TWO_PI),r>CesiumMath.PI&&(r-=CesiumMath.TWO_PI)),defined(i)?(i.west=r,i.south=s,i.east=n,i.north=l,i):new Rectangle(r,s,n,l)},Rectangle.clone=function(e,t){if(defined(e))return defined(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new Rectangle(e.west,e.south,e.east,e.north)},Rectangle.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(e.west-t.west)<=i&&Math.abs(e.south-t.south)<=i&&Math.abs(e.east-t.east)<=i&&Math.abs(e.north-t.north)<=i},Rectangle.prototype.clone=function(e){return Rectangle.clone(this,e)},Rectangle.prototype.equals=function(e){return Rectangle.equals(this,e)},Rectangle.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},Rectangle.prototype.equalsEpsilon=function(e,t){return Rectangle.equalsEpsilon(this,e,t)},Rectangle.validate=function(e){},Rectangle.southwest=function(e,t){return defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Cartographic(e.west,e.south)},Rectangle.northwest=function(e,t){return defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Cartographic(e.west,e.north)},Rectangle.northeast=function(e,t){return defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Cartographic(e.east,e.north)},Rectangle.southeast=function(e,t){return defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Cartographic(e.east,e.south)},Rectangle.center=function(e,t){var i=e.east,r=e.west;i<r&&(i+=CesiumMath.TWO_PI);var n=CesiumMath.negativePiToPi(.5*(r+i)),a=.5*(e.south+e.north);return defined(t)?(t.longitude=n,t.latitude=a,t.height=0,t):new Cartographic(n,a)},Rectangle.intersection=function(e,t,i){var r=e.east,n=e.west,a=t.east,o=t.west;r<n&&0<a?r+=CesiumMath.TWO_PI:a<o&&0<r&&(a+=CesiumMath.TWO_PI),r<n&&o<0?o+=CesiumMath.TWO_PI:a<o&&n<0&&(n+=CesiumMath.TWO_PI);var s=CesiumMath.negativePiToPi(Math.max(n,o)),l=CesiumMath.negativePiToPi(Math.min(r,a));if(!((e.west<e.east||t.west<t.east)&&l<=s)){var c=Math.max(e.south,t.south),u=Math.min(e.north,t.north);if(!(u<=c))return defined(i)?(i.west=s,i.south=c,i.east=l,i.north=u,i):new Rectangle(s,c,l,u)}},Rectangle.simpleIntersection=function(e,t,i){var r=Math.max(e.west,t.west),n=Math.max(e.south,t.south),a=Math.min(e.east,t.east),o=Math.min(e.north,t.north);if(!(o<=n||a<=r))return defined(i)?(i.west=r,i.south=n,i.east=a,i.north=o,i):new Rectangle(r,n,a,o)},Rectangle.union=function(e,t,i){defined(i)||(i=new Rectangle);var r=e.east,n=e.west,a=t.east,o=t.west;r<n&&0<a?r+=CesiumMath.TWO_PI:a<o&&0<r&&(a+=CesiumMath.TWO_PI),r<n&&o<0?o+=CesiumMath.TWO_PI:a<o&&n<0&&(n+=CesiumMath.TWO_PI);var s=CesiumMath.convertLongitudeRange(Math.min(n,o)),l=CesiumMath.convertLongitudeRange(Math.max(r,a));return i.west=s,i.south=Math.min(e.south,t.south),i.east=l,i.north=Math.max(e.north,t.north),i},Rectangle.expand=function(e,t,i){return defined(i)||(i=new Rectangle),i.west=Math.min(e.west,t.longitude),i.south=Math.min(e.south,t.latitude),i.east=Math.max(e.east,t.longitude),i.north=Math.max(e.north,t.latitude),i},Rectangle.contains=function(e,t){var i=t.longitude,r=t.latitude,n=e.west,a=e.east;return a<n&&(a+=CesiumMath.TWO_PI,i<0&&(i+=CesiumMath.TWO_PI)),(n<i||CesiumMath.equalsEpsilon(i,n,CesiumMath.EPSILON14))&&(i<a||CesiumMath.equalsEpsilon(i,a,CesiumMath.EPSILON14))&&r>=e.south&&r<=e.north};var subsampleLlaScratch=new Cartographic;function BoundingSphere(e,t){this.center=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.radius=defaultValue(t,0)}Rectangle.subsample=function(e,t,i,r){t=defaultValue(t,Ellipsoid.WGS84),i=defaultValue(i,0),defined(r)||(r=[]);var n=0,a=e.north,o=e.south,s=e.east,l=e.west,c=subsampleLlaScratch;c.height=i,c.longitude=l,c.latitude=a,r[n]=t.cartographicToCartesian(c,r[n]),n++,c.longitude=s,r[n]=t.cartographicToCartesian(c,r[n]),n++,c.latitude=o,r[n]=t.cartographicToCartesian(c,r[n]),n++,c.longitude=l,r[n]=t.cartographicToCartesian(c,r[n]),n++,c.latitude=a<0?a:0<o?o:0;for(var u=1;u<8;++u)c.longitude=-Math.PI+u*CesiumMath.PI_OVER_TWO,Rectangle.contains(e,c)&&(r[n]=t.cartographicToCartesian(c,r[n]),n++);return 0===c.latitude&&(c.longitude=l,r[n]=t.cartographicToCartesian(c,r[n]),n++,c.longitude=s,r[n]=t.cartographicToCartesian(c,r[n]),n++),r.length=n,r},Rectangle.MAX_VALUE=freezeObject$1(new Rectangle(-Math.PI,-CesiumMath.PI_OVER_TWO,Math.PI,CesiumMath.PI_OVER_TWO));var fromPointsXMin=new Cartesian3,fromPointsYMin=new Cartesian3,fromPointsZMin=new Cartesian3,fromPointsXMax=new Cartesian3,fromPointsYMax=new Cartesian3,fromPointsZMax=new Cartesian3,fromPointsCurrentPos=new Cartesian3,fromPointsScratch=new Cartesian3,fromPointsRitterCenter=new Cartesian3,fromPointsMinBoxPt=new Cartesian3,fromPointsMaxBoxPt=new Cartesian3,fromPointsNaiveCenterScratch=new Cartesian3,volumeConstant=4/3*CesiumMath.PI;BoundingSphere.fromPoints=function(e,t){if(defined(t)||(t=new BoundingSphere),!defined(e)||0===e.length)return t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=0,t;var i,r=Cartesian3.clone(e[0],fromPointsCurrentPos),n=Cartesian3.clone(r,fromPointsXMin),a=Cartesian3.clone(r,fromPointsYMin),o=Cartesian3.clone(r,fromPointsZMin),s=Cartesian3.clone(r,fromPointsXMax),l=Cartesian3.clone(r,fromPointsYMax),c=Cartesian3.clone(r,fromPointsZMax),u=e.length;for(i=1;i<u;i++){Cartesian3.clone(e[i],r);var d=r.x,h=r.y,p=r.z;d<n.x&&Cartesian3.clone(r,n),d>s.x&&Cartesian3.clone(r,s),h<a.y&&Cartesian3.clone(r,a),h>l.y&&Cartesian3.clone(r,l),p<o.z&&Cartesian3.clone(r,o),p>c.z&&Cartesian3.clone(r,c)}var m=Cartesian3.magnitudeSquared(Cartesian3.subtract(s,n,fromPointsScratch)),f=Cartesian3.magnitudeSquared(Cartesian3.subtract(l,a,fromPointsScratch)),g=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),_=n,y=s,v=m;v<f&&(v=f,_=a,y=l),v<g&&(v=g,_=o,y=c);var C=fromPointsRitterCenter;C.x=.5*(_.x+y.x),C.y=.5*(_.y+y.y),C.z=.5*(_.z+y.z);var S=Cartesian3.magnitudeSquared(Cartesian3.subtract(y,C,fromPointsScratch)),x=Math.sqrt(S),T=fromPointsMinBoxPt;T.x=n.x,T.y=a.y,T.z=o.z;var b=fromPointsMaxBoxPt;b.x=s.x,b.y=l.y,b.z=c.z;var E=Cartesian3.midpoint(T,b,fromPointsNaiveCenterScratch),P=0;for(i=0;i<u;i++){Cartesian3.clone(e[i],r);var A=Cartesian3.magnitude(Cartesian3.subtract(r,E,fromPointsScratch));P<A&&(P=A);var w=Cartesian3.magnitudeSquared(Cartesian3.subtract(r,C,fromPointsScratch));if(S<w){var D=Math.sqrt(w);S=(x=.5*(x+D))*x;var M=D-x;C.x=(x*C.x+M*r.x)/D,C.y=(x*C.y+M*r.y)/D,C.z=(x*C.z+M*r.z)/D}}return x<P?(Cartesian3.clone(C,t.center),t.radius=x):(Cartesian3.clone(E,t.center),t.radius=P),t};var defaultProjection=new GeographicProjection,fromRectangle2DLowerLeft=new Cartesian3,fromRectangle2DUpperRight=new Cartesian3,fromRectangle2DSouthwest=new Cartographic,fromRectangle2DNortheast=new Cartographic;BoundingSphere.fromRectangle2D=function(e,t,i){return BoundingSphere.fromRectangleWithHeights2D(e,t,0,0,i)},BoundingSphere.fromRectangleWithHeights2D=function(e,t,i,r,n){if(defined(n)||(n=new BoundingSphere),!defined(e))return n.center=Cartesian3.clone(Cartesian3.ZERO,n.center),n.radius=0,n;t=defaultValue(t,defaultProjection),Rectangle.southwest(e,fromRectangle2DSouthwest),fromRectangle2DSouthwest.height=i,Rectangle.northeast(e,fromRectangle2DNortheast),fromRectangle2DNortheast.height=r;var a=t.project(fromRectangle2DSouthwest,fromRectangle2DLowerLeft),o=t.project(fromRectangle2DNortheast,fromRectangle2DUpperRight),s=o.x-a.x,l=o.y-a.y,c=o.z-a.z;n.radius=.5*Math.sqrt(s*s+l*l+c*c);var u=n.center;return u.x=a.x+.5*s,u.y=a.y+.5*l,u.z=a.z+.5*c,n};var fromRectangle3DScratch=[];BoundingSphere.fromRectangle3D=function(e,t,i,r){if(t=defaultValue(t,Ellipsoid.WGS84),i=defaultValue(i,0),defined(r)||(r=new BoundingSphere),!defined(e))return r.center=Cartesian3.clone(Cartesian3.ZERO,r.center),r.radius=0,r;var n=Rectangle.subsample(e,t,i,fromRectangle3DScratch);return BoundingSphere.fromPoints(n,r)},BoundingSphere.fromVertices=function(e,t,i,r){if(defined(r)||(r=new BoundingSphere),!defined(e)||0===e.length)return r.center=Cartesian3.clone(Cartesian3.ZERO,r.center),r.radius=0,r;t=defaultValue(t,Cartesian3.ZERO),i=defaultValue(i,3);var n=fromPointsCurrentPos;n.x=e[0]+t.x,n.y=e[1]+t.y,n.z=e[2]+t.z;var a,o=Cartesian3.clone(n,fromPointsXMin),s=Cartesian3.clone(n,fromPointsYMin),l=Cartesian3.clone(n,fromPointsZMin),c=Cartesian3.clone(n,fromPointsXMax),u=Cartesian3.clone(n,fromPointsYMax),d=Cartesian3.clone(n,fromPointsZMax),h=e.length;for(a=0;a<h;a+=i){var p=e[a]+t.x,m=e[a+1]+t.y,f=e[a+2]+t.z;n.x=p,n.y=m,n.z=f,p<o.x&&Cartesian3.clone(n,o),p>c.x&&Cartesian3.clone(n,c),m<s.y&&Cartesian3.clone(n,s),m>u.y&&Cartesian3.clone(n,u),f<l.z&&Cartesian3.clone(n,l),f>d.z&&Cartesian3.clone(n,d)}var g=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),_=Cartesian3.magnitudeSquared(Cartesian3.subtract(u,s,fromPointsScratch)),y=Cartesian3.magnitudeSquared(Cartesian3.subtract(d,l,fromPointsScratch)),v=o,C=c,S=g;S<_&&(S=_,v=s,C=u),S<y&&(S=y,v=l,C=d);var x=fromPointsRitterCenter;x.x=.5*(v.x+C.x),x.y=.5*(v.y+C.y),x.z=.5*(v.z+C.z);var T=Cartesian3.magnitudeSquared(Cartesian3.subtract(C,x,fromPointsScratch)),b=Math.sqrt(T),E=fromPointsMinBoxPt;E.x=o.x,E.y=s.y,E.z=l.z;var P=fromPointsMaxBoxPt;P.x=c.x,P.y=u.y,P.z=d.z;var A=Cartesian3.midpoint(E,P,fromPointsNaiveCenterScratch),w=0;for(a=0;a<h;a+=i){n.x=e[a]+t.x,n.y=e[a+1]+t.y,n.z=e[a+2]+t.z;var D=Cartesian3.magnitude(Cartesian3.subtract(n,A,fromPointsScratch));w<D&&(w=D);var M=Cartesian3.magnitudeSquared(Cartesian3.subtract(n,x,fromPointsScratch));if(T<M){var I=Math.sqrt(M);T=(b=.5*(b+I))*b;var R=I-b;x.x=(b*x.x+R*n.x)/I,x.y=(b*x.y+R*n.y)/I,x.z=(b*x.z+R*n.z)/I}}return b<w?(Cartesian3.clone(x,r.center),r.radius=b):(Cartesian3.clone(A,r.center),r.radius=w),r},BoundingSphere.fromEncodedCartesianVertices=function(e,t,i){if(defined(i)||(i=new BoundingSphere),!defined(e)||!defined(t)||e.length!==t.length||0===e.length)return i.center=Cartesian3.clone(Cartesian3.ZERO,i.center),i.radius=0,i;var r=fromPointsCurrentPos;r.x=e[0]+t[0],r.y=e[1]+t[1],r.z=e[2]+t[2];var n,a=Cartesian3.clone(r,fromPointsXMin),o=Cartesian3.clone(r,fromPointsYMin),s=Cartesian3.clone(r,fromPointsZMin),l=Cartesian3.clone(r,fromPointsXMax),c=Cartesian3.clone(r,fromPointsYMax),u=Cartesian3.clone(r,fromPointsZMax),d=e.length;for(n=0;n<d;n+=3){var h=e[n]+t[n],p=e[n+1]+t[n+1],m=e[n+2]+t[n+2];r.x=h,r.y=p,r.z=m,h<a.x&&Cartesian3.clone(r,a),h>l.x&&Cartesian3.clone(r,l),p<o.y&&Cartesian3.clone(r,o),p>c.y&&Cartesian3.clone(r,c),m<s.z&&Cartesian3.clone(r,s),m>u.z&&Cartesian3.clone(r,u)}var f=Cartesian3.magnitudeSquared(Cartesian3.subtract(l,a,fromPointsScratch)),g=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),_=Cartesian3.magnitudeSquared(Cartesian3.subtract(u,s,fromPointsScratch)),y=a,v=l,C=f;C<g&&(C=g,y=o,v=c),C<_&&(C=_,y=s,v=u);var S=fromPointsRitterCenter;S.x=.5*(y.x+v.x),S.y=.5*(y.y+v.y),S.z=.5*(y.z+v.z);var x=Cartesian3.magnitudeSquared(Cartesian3.subtract(v,S,fromPointsScratch)),T=Math.sqrt(x),b=fromPointsMinBoxPt;b.x=a.x,b.y=o.y,b.z=s.z;var E=fromPointsMaxBoxPt;E.x=l.x,E.y=c.y,E.z=u.z;var P=Cartesian3.midpoint(b,E,fromPointsNaiveCenterScratch),A=0;for(n=0;n<d;n+=3){r.x=e[n]+t[n],r.y=e[n+1]+t[n+1],r.z=e[n+2]+t[n+2];var w=Cartesian3.magnitude(Cartesian3.subtract(r,P,fromPointsScratch));A<w&&(A=w);var D=Cartesian3.magnitudeSquared(Cartesian3.subtract(r,S,fromPointsScratch));if(x<D){var M=Math.sqrt(D);x=(T=.5*(T+M))*T;var I=M-T;S.x=(T*S.x+I*r.x)/M,S.y=(T*S.y+I*r.y)/M,S.z=(T*S.z+I*r.z)/M}}return T<A?(Cartesian3.clone(S,i.center),i.radius=T):(Cartesian3.clone(P,i.center),i.radius=A),i},BoundingSphere.fromCornerPoints=function(e,t,i){defined(i)||(i=new BoundingSphere);var r=Cartesian3.midpoint(e,t,i.center);return i.radius=Cartesian3.distance(r,t),i},BoundingSphere.fromEllipsoid=function(e,t){return defined(t)||(t=new BoundingSphere),Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=e.maximumRadius,t};var fromBoundingSpheresScratch=new Cartesian3;BoundingSphere.fromBoundingSpheres=function(e,t){if(defined(t)||(t=new BoundingSphere),!defined(e)||0===e.length)return t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=0,t;var i=e.length;if(1===i)return BoundingSphere.clone(e[0],t);if(2===i)return BoundingSphere.union(e[0],e[1],t);var r,n=[];for(r=0;r<i;r++)n.push(e[r].center);var a=(t=BoundingSphere.fromPoints(n,t)).center,o=t.radius;for(r=0;r<i;r++){var s=e[r];o=Math.max(o,Cartesian3.distance(a,s.center,fromBoundingSpheresScratch)+s.radius)}return t.radius=o,t};var fromOrientedBoundingBoxScratchU=new Cartesian3,fromOrientedBoundingBoxScratchV=new Cartesian3,fromOrientedBoundingBoxScratchW=new Cartesian3;BoundingSphere.fromOrientedBoundingBox=function(e,t){defined(t)||(t=new BoundingSphere);var i=e.halfAxes,r=Matrix3.getColumn(i,0,fromOrientedBoundingBoxScratchU),n=Matrix3.getColumn(i,1,fromOrientedBoundingBoxScratchV),a=Matrix3.getColumn(i,2,fromOrientedBoundingBoxScratchW);return Cartesian3.add(r,n,r),Cartesian3.add(r,a,r),t.center=Cartesian3.clone(e.center,t.center),t.radius=Cartesian3.magnitude(r),t},BoundingSphere.clone=function(e,t){if(defined(e))return defined(t)?(t.center=Cartesian3.clone(e.center,t.center),t.radius=e.radius,t):new BoundingSphere(e.center,e.radius)},BoundingSphere.packedLength=4,BoundingSphere.pack=function(e,t,i){i=defaultValue(i,0);var r=e.center;return t[i++]=r.x,t[i++]=r.y,t[i++]=r.z,t[i]=e.radius,t},BoundingSphere.unpack=function(e,t,i){t=defaultValue(t,0),defined(i)||(i=new BoundingSphere);var r=i.center;return r.x=e[t++],r.y=e[t++],r.z=e[t++],i.radius=e[t],i};var unionScratch=new Cartesian3,unionScratchCenter=new Cartesian3;BoundingSphere.union=function(e,t,i){defined(i)||(i=new BoundingSphere);var r=e.center,n=e.radius,a=t.center,o=t.radius,s=Cartesian3.subtract(a,r,unionScratch),l=Cartesian3.magnitude(s);if(l+o<=n)return e.clone(i),i;if(l+n<=o)return t.clone(i),i;var c=.5*(n+l+o),u=Cartesian3.multiplyByScalar(s,(c-n)/l,unionScratchCenter);return Cartesian3.add(u,r,u),Cartesian3.clone(u,i.center),i.radius=c,i};var expandScratch=new Cartesian3;BoundingSphere.expand=function(e,t,i){i=BoundingSphere.clone(e,i);var r=Cartesian3.magnitude(Cartesian3.subtract(t,i.center,expandScratch));return r>i.radius&&(i.radius=r),i},BoundingSphere.intersectPlane=function(e,t){var i=e.center,r=e.radius,n=t.normal,a=Cartesian3.dot(n,i)+t.distance;return a<-r?Intersect$1.OUTSIDE:a<r?Intersect$1.INTERSECTING:Intersect$1.INSIDE},BoundingSphere.transform=function(e,t,i){return defined(i)||(i=new BoundingSphere),i.center=Matrix4.multiplyByPoint(t,e.center,i.center),i.radius=Matrix4.getMaximumScale(t)*e.radius,i};var distanceSquaredToScratch=new Cartesian3;BoundingSphere.distanceSquaredTo=function(e,t){var i=Cartesian3.subtract(e.center,t,distanceSquaredToScratch);return Cartesian3.magnitudeSquared(i)-e.radius*e.radius},BoundingSphere.transformWithoutScale=function(e,t,i){return defined(i)||(i=new BoundingSphere),i.center=Matrix4.multiplyByPoint(t,e.center,i.center),i.radius=e.radius,i};var scratchCartesian3=new Cartesian3;BoundingSphere.computePlaneDistances=function(e,t,i,r){defined(r)||(r=new Interval);var n=Cartesian3.subtract(e.center,t,scratchCartesian3),a=Cartesian3.dot(i,n);return r.start=a-e.radius,r.stop=a+e.radius,r};for(var projectTo2DNormalScratch=new Cartesian3,projectTo2DEastScratch=new Cartesian3,projectTo2DNorthScratch=new Cartesian3,projectTo2DWestScratch=new Cartesian3,projectTo2DSouthScratch=new Cartesian3,projectTo2DCartographicScratch=new Cartographic,projectTo2DPositionsScratch=new Array(8),n=0;n<8;++n)projectTo2DPositionsScratch[n]=new Cartesian3;var projectTo2DProjection=new GeographicProjection;function URI(e){if(e instanceof URI)this.scheme=e.scheme,this.authority=e.authority,this.path=e.path,this.query=e.query,this.fragment=e.fragment;else if(e){var t=parseRegex.exec(e);this.scheme=t[1],this.authority=t[2],this.path=t[3],this.query=t[4],this.fragment=t[5]}}BoundingSphere.projectTo2D=function(e,t,i){var r=(t=defaultValue(t,projectTo2DProjection)).ellipsoid,n=e.center,a=e.radius,o=r.geodeticSurfaceNormal(n,projectTo2DNormalScratch),s=Cartesian3.cross(Cartesian3.UNIT_Z,o,projectTo2DEastScratch);Cartesian3.normalize(s,s);var l=Cartesian3.cross(o,s,projectTo2DNorthScratch);Cartesian3.normalize(l,l),Cartesian3.multiplyByScalar(o,a,o),Cartesian3.multiplyByScalar(l,a,l),Cartesian3.multiplyByScalar(s,a,s);var c=Cartesian3.negate(l,projectTo2DSouthScratch),u=Cartesian3.negate(s,projectTo2DWestScratch),d=projectTo2DPositionsScratch,h=d[0];Cartesian3.add(o,l,h),Cartesian3.add(h,s,h),h=d[1],Cartesian3.add(o,l,h),Cartesian3.add(h,u,h),h=d[2],Cartesian3.add(o,c,h),Cartesian3.add(h,u,h),h=d[3],Cartesian3.add(o,c,h),Cartesian3.add(h,s,h),Cartesian3.negate(o,o),h=d[4],Cartesian3.add(o,l,h),Cartesian3.add(h,s,h),h=d[5],Cartesian3.add(o,l,h),Cartesian3.add(h,u,h),h=d[6],Cartesian3.add(o,c,h),Cartesian3.add(h,u,h),h=d[7],Cartesian3.add(o,c,h),Cartesian3.add(h,s,h);for(var p=d.length,m=0;m<p;++m){var f=d[m];Cartesian3.add(n,f,f);var g=r.cartesianToCartographic(f,projectTo2DCartographicScratch);t.project(g,f)}var _=(n=(i=BoundingSphere.fromPoints(d,i)).center).x,y=n.y,v=n.z;return n.x=v,n.y=_,n.z=y,i},BoundingSphere.isOccluded=function(e,t){return!t.isBoundingSphereVisible(e)},BoundingSphere.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&e.radius===t.radius},BoundingSphere.prototype.intersectPlane=function(e){return BoundingSphere.intersectPlane(this,e)},BoundingSphere.prototype.distanceSquaredTo=function(e){return BoundingSphere.distanceSquaredTo(this,e)},BoundingSphere.prototype.computePlaneDistances=function(e,t,i){return BoundingSphere.computePlaneDistances(this,e,t,i)},BoundingSphere.prototype.isOccluded=function(e){return BoundingSphere.isOccluded(this,e)},BoundingSphere.prototype.equals=function(e){return BoundingSphere.equals(this,e)},BoundingSphere.prototype.clone=function(e){return BoundingSphere.clone(this,e)},BoundingSphere.prototype.volume=function(){var e=this.radius;return volumeConstant*e*e*e},URI.prototype.scheme=null,URI.prototype.authority=null,URI.prototype.path="",URI.prototype.query=null,URI.prototype.fragment=null;var parseRegex=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");URI.prototype.getScheme=function(){return this.scheme},URI.prototype.getAuthority=function(){return this.authority},URI.prototype.getPath=function(){return this.path},URI.prototype.getQuery=function(){return this.query},URI.prototype.getFragment=function(){return this.fragment},URI.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},URI.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},URI.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},URI.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(authorityRegex,replaceAuthority).replace(caseRegex,replaceCase)),this.path&&(this.path=this.path.replace(caseRegex,replaceCase)),this.query&&(this.query=this.query.replace(caseRegex,replaceCase)),this.fragment&&(this.fragment=this.fragment.replace(caseRegex,replaceCase))};var caseRegex=/%[0-9a-z]{2}/gi,percentRegex=/[a-zA-Z0-9\-\._~]/,authorityRegex=/(.*@)?([^@:]*)(:.*)?/,reduceArray,slice,undef;function replaceCase(e){var t=unescape(e);return percentRegex.test(t)?t:e.toUpperCase()}function replaceAuthority(e,t,i,r){return(t||"")+i.toLowerCase()+(r||"")}function getAbsoluteUri(e,t){var i;return"undefined"!=typeof document&&(i=document),getAbsoluteUri._implementation(e,t,i)}function when(e,t,i,r){return resolve(e).then(t,i,r)}function resolve(e){var t;return e instanceof Promise$1?e:isPromise(e)?(t=defer(),e.then(function(e){t.resolve(e)},function(e){t.reject(e)},function(e){t.progress(e)}),t.promise):fulfilled(e)}function reject(e){return when(e,rejected)}function Promise$1(e){this.then=e}function fulfilled(t){return new Promise$1(function(e){try{return resolve(e?e(t):t)}catch(e){return rejected(e)}})}function rejected(i){return new Promise$1(function(e,t){try{return t?resolve(t(i)):rejected(i)}catch(e){return rejected(e)}})}function defer(){var e,o,s,r,t,i;return e=new Promise$1(n),o=[],s=[],r=function(t,i,r){var n,a;return n=defer(),a="function"==typeof r?function(e){try{n.progress(r(e))}catch(e){n.progress(e)}}:function(e){n.progress(e)},o.push(function(e){e.then(t,i).then(n.resolve,n.reject,a)}),s.push(a),n.promise},t=function(e){return processQueue(s,e),e},i=function(e){return e=resolve(e),r=e.then,i=resolve,t=noop,processQueue(o,e),s=o=undef,e},{then:n,resolve:a,reject:l,progress:c,promise:e,resolver:{resolve:a,reject:l,progress:c}};function n(e,t,i){return r(e,t,i)}function a(e){return i(e)}function l(e){return i(rejected(e))}function c(e){return t(e)}}function isPromise(e){return e&&"function"==typeof e.then}function some(e,p,m,f,g){return checkCallbacks(2,arguments),when(e,function(e){var t,i,r,n,a,o,s,l,c,u;if(c=e.length>>>0,t=Math.max(0,Math.min(p,c)),r=[],i=c-t+1,n=[],a=defer(),t)for(l=a.progress,s=function(e){n.push(e),--i||(o=s=noop,a.reject(n))},o=function(e){r.push(e),--t||(o=s=noop,a.resolve(r))},u=0;u<c;++u)u in e&&when(e[u],h,d,l);else a.resolve(r);return a.then(m,f,g);function d(e){s(e)}function h(e){o(e)}})}function any(e,t,i,r){return some(e,1,function(e){return t?t(e[0]):e[0]},i,r)}function all(e,t,i,r){return checkCallbacks(1,arguments),map(e,identity).then(t,i,r)}function join(){return map(arguments,identity)}function map(e,s){return when(e,function(e){var i,t,r,n,a,o;if(r=t=e.length>>>0,i=[],o=defer(),r)for(n=function(e,t){when(e,s).then(function(e){i[t]=e,--r||o.resolve(i)},o.reject)},a=0;a<t;a++)a in e?n(e[a],a):--r;else o.resolve(i);return o.promise})}function reduce(e,a){var t=slice.call(arguments,1);return when(e,function(e){var n;return n=e.length,t[0]=function(e,i,r){return when(e,function(t){return when(i,function(e){return a(t,e,r,n)})})},reduceArray.apply(e,t)})}function chain(e,t,i){var r=2<arguments.length;return when(e,function(e){return e=r?i:e,t.resolve(e),e},function(e){return t.reject(e),rejected(e)},t.progress)}function processQueue(e,t){for(var i,r=0;i=e[r++];)i(t)}function checkCallbacks(e,t){for(var i,r=t.length;e<r;)if(null!=(i=t[--r])&&"function"!=typeof i)throw new Error("arg "+r+" must be a function")}function noop(){}function identity(e){return e}function clone(e,t){if(null===e||"object"!=typeof e)return e;t=defaultValue(t,!1);var i=new e.constructor;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];t&&(n=clone(n,t)),i[r]=n}return i}function combine(e,t,i){i=defaultValue(i,!1);var r,n,a,o={},s=defined(e),l=defined(t);if(s)for(r in e)e.hasOwnProperty(r)&&(n=e[r],l&&i&&"object"==typeof n&&t.hasOwnProperty(r)?(a=t[r],o[r]="object"==typeof a?combine(n,a,i):n):o[r]=n);if(l)for(r in t)t.hasOwnProperty(r)&&!o.hasOwnProperty(r)&&(a=t[r],o[r]=a);return o}function getBaseUri(e,t){var i="",r=e.lastIndexOf("/");return-1!==r&&(i=e.substring(0,r+1)),t&&(defined((e=new URI(e)).query)&&(i+="?"+e.query),defined(e.fragment)&&(i+="#"+e.fragment)),i}function getExtensionFromUri(e){var t=new URI(e);t.normalize();var i=t.path,r=i.lastIndexOf("/");return-1!==r&&(i=i.substr(r+1)),i=-1===(r=i.lastIndexOf("."))?"":i.substr(r+1)}URI.prototype.resolve=function(e){var t=new URI;return this.scheme?(t.scheme=this.scheme,t.authority=this.authority,t.path=this.path,t.query=this.query):(t.scheme=e.scheme,this.authority?(t.authority=this.authority,t.path=this.path,t.query=this.query):(t.authority=e.authority,""==this.path?(t.path=e.path,t.query=this.query||e.query):("/"==this.path.charAt(0)?t.path=this.path:e.authority&&""==e.path?t.path="/"+this.path:t.path=e.path.substring(0,e.path.lastIndexOf("/")+1)+this.path,t.removeDotSegments(),t.query=this.query))),t.fragment=this.fragment,t},URI.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),i=[],r=""==t[0];r&&t.shift();for(""==t[0]&&t.shift();t.length;)".."==(e=t.shift())?i.pop():"."!=e&&i.push(e);"."!=e&&".."!=e||i.push(""),r&&i.unshift(""),this.path=i.join("/")},URI.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},getAbsoluteUri._implementation=function(e,t,i){if(!defined(t)){if(void 0===i)return e;t=defaultValue(i.baseURI,i.location.href)}var r=new URI(t);return new URI(e).resolve(r).toString()},when.defer=defer,when.resolve=resolve,when.reject=reject,when.join=join,when.all=all,when.map=map,when.reduce=reduce,when.any=any,when.some=some,when.chain=chain,when.isPromise=isPromise,Promise$1.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(undef,e)},yield:function(e){return this.then(function(){return e})},spread:function(t){return this.then(function(e){return all(e,function(e){return t.apply(undef,e)})})}},slice=[].slice,reduceArray=[].reduce||function(e){var t,i,r,n,a;if(a=0,n=(t=Object(this)).length>>>0,(i=arguments).length<=1)for(;;){if(a in t){r=t[a++];break}if(++a>=n)throw new TypeError}else r=i[1];for(;a<n;++a)a in t&&(r=e(r,t[a],a,t));return r};var blobUriRegex=/^blob:/i,a;function isBlobUri(e){return blobUriRegex.test(e)}function isCrossOriginUrl(e){defined(a)||(a=document.createElement("a")),a.href=window.location.href;var t=a.host,i=a.protocol;return a.href=e,a.href=a.href,i!==a.protocol||t!==a.host}var dataUriRegex=/^data:/i;function isDataUri(e){return dataUriRegex.test(e)}function loadAndExecuteScript(e){var t=when.defer(),i=document.createElement("script");i.async=!0,i.src=e;var r=document.getElementsByTagName("head")[0];return i.onload=function(){i.onload=void 0,r.removeChild(i),t.resolve()},i.onerror=function(e){t.reject(e)},r.appendChild(i),t.promise}var isArray=Array.isArray;defined(isArray)||(isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var isArray$1=isArray;function objectToQuery(e){var t="";for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],n=encodeURIComponent(i)+"=";if(isArray$1(r))for(var a=0,o=r.length;a<o;++a)t+=n+encodeURIComponent(r[a])+"&";else t+=n+encodeURIComponent(r)+"&"}return t=t.slice(0,-1)}function queryToObject(e){var t={};if(""===e)return t;for(var i=e.replace(/\+/g,"%20").split(/[&;]/),r=0,n=i.length;r<n;++r){var a=i[r].split("="),o=decodeURIComponent(a[0]),s=a[1];s=defined(s)?decodeURIComponent(s):"";var l=t[o];"string"==typeof l?t[o]=[l,s]:isArray$1(l)?l.push(s):t[o]=s}return t}var RequestState={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},RequestState$1=freezeObject$1(RequestState),RequestType={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},RequestType$1=freezeObject$1(RequestType);function Request(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).throttleByServer,!1),i=defaultValue(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=defaultValue(e.priority,0),this.throttle=i,this.throttleByServer=t,this.type=defaultValue(e.type,RequestType$1.OTHER),this.serverKey=void 0,this.state=RequestState$1.UNISSUED,this.deferred=void 0,this.cancelled=!1}function parseResponseHeaders(e){var t={};if(!e)return t;for(var i=e.split("\r\n"),r=0;r<i.length;++r){var n=i[r],a=n.indexOf(": ");if(0<a){var o=n.substring(0,a),s=n.substring(a+2);t[o]=s}}return t}function RequestErrorEvent(e,t,i){this.statusCode=e,this.response=t,this.responseHeaders=i,"string"==typeof this.responseHeaders&&(this.responseHeaders=parseResponseHeaders(this.responseHeaders))}function Event(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}function compareNumber(e,t){return t-e}function Heap(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function swap(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function sortRequests(e,t){return e.priority-t.priority}Request.prototype.cancel=function(){this.cancelled=!0},Request.prototype.clone=function(e){return defined(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=this.RequestState.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new Request(this)},RequestErrorEvent.prototype.toString=function(){var e="Request has failed.";return defined(this.statusCode)&&(e+=" Status Code: "+this.statusCode),e},defineProperties$1(Event.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),Event.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);var i=this;return function(){i.removeEventListener(e,t)}},Event.prototype.removeEventListener=function(e,t){for(var i=this._listeners,r=this._scopes,n=-1,a=0;a<i.length;a++)if(i[a]===e&&r[a]===t){n=a;break}return-1!==n&&(this._insideRaiseEvent?(this._toRemove.push(n),i[n]=void 0,r[n]=void 0):(i.splice(n,1),r.splice(n,1)),!0)},Event.prototype.raiseEvent=function(){var e;this._insideRaiseEvent=!0;var t=this._listeners,i=this._scopes,r=t.length;for(e=0;e<r;e++){defined(t[e])&&t[e].apply(i[e],arguments)}var n=this._toRemove;if(0<(r=n.length)){for(n.sort(compareNumber),e=0;e<r;e++){var a=n[e];t.splice(a,1),i.splice(a,1)}n.length=0}this._insideRaiseEvent=!1},defineProperties$1(Heap.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){this._maximumLength=e,this._length>e&&0<e&&(this._length=e,this._array.length=e)}},comparator:{get:function(){return this._comparator}}}),Heap.prototype.reserve=function(e){e=defaultValue(e,this._length),this._array.length=e},Heap.prototype.heapify=function(e){e=defaultValue(e,0);for(var t=this._length,i=this._comparator,r=this._array,n=-1,a=!0;a;){var o=2*(e+1),s=o-1;n=s<t&&i(r[s],r[e])<0?s:e,o<t&&i(r[o],r[n])<0&&(n=o),n!==e?(swap(r,n,e),e=n):a=!1}},Heap.prototype.resort=function(){for(var e=this._length,t=Math.ceil(e/2);0<=t;--t)this.heapify(t)},Heap.prototype.insert=function(e){var t,i=this._array,r=this._comparator,n=this._maximumLength,a=this._length++;for(a<i.length?i[a]=e:i.push(e);0!==a;){var o=Math.floor((a-1)/2);if(!(r(i[a],i[o])<0))break;swap(i,a,o),a=o}return defined(n)&&this._length>n&&(t=i[n],this._length=n),t},Heap.prototype.pop=function(e){if(e=defaultValue(e,0),0!==this._length){var t=this._array,i=t[e];return swap(t,e,--this._length),this.heapify(e),i}};var statistics={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0},priorityHeapLength=20,requestHeap=new Heap({comparator:sortRequests});requestHeap.maximumLength=priorityHeapLength,requestHeap.reserve(priorityHeapLength);var activeRequests=[],numberOfActiveRequestsByServer={},pageUri="undefined"!=typeof document?new URI(document.location.href):new URI,requestCompletedEvent=new Event;function RequestScheduler(){}function updatePriority(e){defined(e.priorityFunction)&&(e.priority=e.priorityFunction())}function serverHasOpenSlots(e){var t=defaultValue(RequestScheduler.requestsByServer[e],RequestScheduler.maximumRequestsPerServer);return numberOfActiveRequestsByServer[e]<t}function issueRequest(e){return e.state===RequestState$1.UNISSUED&&(e.state=RequestState$1.ISSUED,e.deferred=when.defer()),e.deferred.promise}function getRequestReceivedFunction(t){return function(e){t.state!==RequestState$1.CANCELLED&&(--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[t.serverKey],requestCompletedEvent.raiseEvent(),t.state=RequestState$1.RECEIVED,t.deferred.resolve(e))}}function getRequestFailedFunction(t){return function(e){t.state!==RequestState$1.CANCELLED&&(++statistics.numberOfFailedRequests,--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[t.serverKey],requestCompletedEvent.raiseEvent(e),t.state=RequestState$1.FAILED,t.deferred.reject(e))}}function startRequest(e){var t=issueRequest(e);return e.state=RequestState$1.ACTIVE,activeRequests.push(e),++statistics.numberOfActiveRequests,++statistics.numberOfActiveRequestsEver,++numberOfActiveRequestsByServer[e.serverKey],e.requestFunction().then(getRequestReceivedFunction(e)).otherwise(getRequestFailedFunction(e)),t}function cancelRequest(e){var t=e.state===RequestState$1.ACTIVE;e.state=RequestState$1.CANCELLED,++statistics.numberOfCancelledRequests,e.deferred.reject(),t&&(--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],++statistics.numberOfCancelledActiveRequests),defined(e.cancelFunction)&&e.cancelFunction()}function updateStatistics(){RequestScheduler.debugShowStatistics&&(0===statistics.numberOfActiveRequests&&0<statistics.lastNumberOfActiveRequests&&(0<statistics.numberOfAttemptedRequests&&(console.log("Number of attempted requests: "+statistics.numberOfAttemptedRequests),statistics.numberOfAttemptedRequests=0),0<statistics.numberOfCancelledRequests&&(console.log("Number of cancelled requests: "+statistics.numberOfCancelledRequests),statistics.numberOfCancelledRequests=0),0<statistics.numberOfCancelledActiveRequests&&(console.log("Number of cancelled active requests: "+statistics.numberOfCancelledActiveRequests),statistics.numberOfCancelledActiveRequests=0),0<statistics.numberOfFailedRequests&&(console.log("Number of failed requests: "+statistics.numberOfFailedRequests),statistics.numberOfFailedRequests=0)),statistics.lastNumberOfActiveRequests=statistics.numberOfActiveRequests)}RequestScheduler.maximumRequests=50,RequestScheduler.maximumRequestsPerServer=6,RequestScheduler.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18},RequestScheduler.throttleRequests=!0,RequestScheduler.debugShowStatistics=!1,RequestScheduler.requestCompletedEvent=requestCompletedEvent,defineProperties$1(RequestScheduler,{statistics:{get:function(){return statistics}},priorityHeapLength:{get:function(){return priorityHeapLength},set:function(e){if(e<priorityHeapLength)for(;requestHeap.length>e;){cancelRequest(requestHeap.pop())}priorityHeapLength=e,requestHeap.maximumLength=e,requestHeap.reserve(e)}}}),RequestScheduler.update=function(){var e,t,i=0,r=activeRequests.length;for(e=0;e<r;++e)(t=activeRequests[e]).cancelled&&cancelRequest(t),t.state===RequestState$1.ACTIVE?0<i&&(activeRequests[e-i]=t):++i;activeRequests.length-=i;var n=requestHeap.internalArray,a=requestHeap.length;for(e=0;e<a;++e)updatePriority(n[e]);requestHeap.resort();for(var o=Math.max(RequestScheduler.maximumRequests-activeRequests.length,0),s=0;s<o&&0<requestHeap.length;)(t=requestHeap.pop()).cancelled?cancelRequest(t):!t.throttleByServer||serverHasOpenSlots(t.serverKey)?(startRequest(t),++s):cancelRequest(t);updateStatistics()},RequestScheduler.getServerKey=function(e){var t=new URI(e).resolve(pageUri);t.normalize();var i=t.authority;return/:/.test(i)||(i=i+":"+("https"===t.scheme?"443":"80")),defined(numberOfActiveRequestsByServer[i])||(numberOfActiveRequestsByServer[i]=0),i},RequestScheduler.request=function(e){if(isDataUri(e.url)||isBlobUri(e.url))return requestCompletedEvent.raiseEvent(),e.state=RequestState$1.RECEIVED,e.requestFunction();if(++statistics.numberOfAttemptedRequests,defined(e.serverKey)||(e.serverKey=RequestScheduler.getServerKey(e.url)),!e.throttleByServer||serverHasOpenSlots(e.serverKey)){if(!RequestScheduler.throttleRequests||!e.throttle)return startRequest(e);if(!(activeRequests.length>=RequestScheduler.maximumRequests)){updatePriority(e);var t=requestHeap.insert(e);if(defined(t)){if(t===e)return;cancelRequest(t)}return issueRequest(e)}}},RequestScheduler.clearForSpecs=function(){for(;0<requestHeap.length;){cancelRequest(requestHeap.pop())}for(var e=activeRequests.length,t=0;t<e;++t)cancelRequest(activeRequests[t]);activeRequests.length=0,numberOfActiveRequestsByServer={},statistics.numberOfAttemptedRequests=0,statistics.numberOfActiveRequests=0,statistics.numberOfCancelledRequests=0,statistics.numberOfCancelledActiveRequests=0,statistics.numberOfFailedRequests=0,statistics.numberOfActiveRequestsEver=0,statistics.lastNumberOfActiveRequests=0},RequestScheduler.numberOfActiveRequestsByServer=function(e){return numberOfActiveRequestsByServer[e]},RequestScheduler.requestHeap=requestHeap;var TrustedServers={},_servers={};function getAuthority(e){var t=new URI(e);t.normalize();var i=t.getAuthority();if(defined(i)){if(-1!==i.indexOf("@"))i=i.split("@")[1];if(-1===i.indexOf(":")){var r=t.getScheme();if(defined(r)||(r=(r=window.location.protocol).substring(0,r.length-1)),"http"===r)i+=":80";else{if("https"!==r)return;i+=":443"}}return i}}TrustedServers.add=function(e,t){var i=e.toLowerCase()+":"+t;defined(_servers[i])||(_servers[i]=!0)},TrustedServers.remove=function(e,t){var i=e.toLowerCase()+":"+t;defined(_servers[i])&&delete _servers[i]},TrustedServers.contains=function(e){var t=getAuthority(e);return!(!defined(t)||!defined(_servers[t]))},TrustedServers.clear=function(){_servers={}};var xhrBlobSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","#",!0),(e.responseType="blob")===e.responseType}catch(e){return!1}}(),supportsImageBitmapOptionsPromise;function parseQuery(e,t,i,r){var n,a=e.query;if(!defined(a)||0===a.length)return{};if(-1===a.indexOf("=")){var o={};o[a]=void 0,n=o}else n=queryToObject(a);t._queryParameters=i?combineQueryParameters(n,t._queryParameters,r):n,e.query=void 0}function stringifyQuery(e,t){var i=t._queryParameters,r=Object.keys(i);1!==r.length||defined(i[r[0]])?e.query=objectToQuery(i):e.query=r[0]}function defaultClone(e,t){return defined(e)?defined(e.clone)?e.clone():clone(e):t}function checkAndResetRequest(e){if(e.state===RequestState$1.ISSUED||e.state===RequestState$1.ACTIVE)throw new RuntimeError("The Resource is already being fetched.");e.state=RequestState$1.UNISSUED,e.deferred=void 0}function combineQueryParameters(e,t,i){if(!i)return combine(e,t);var r=clone(e,!0);for(var n in t)if(t.hasOwnProperty(n)){var a=r[n],o=t[n];defined(a)?(Array.isArray(a)||(a=r[n]=[a]),r[n]=a.concat(o)):r[n]=Array.isArray(o)?o.slice():o}return r}function Resource(e){"string"==typeof(e=defaultValue(e,defaultValue.EMPTY_OBJECT))&&(e={url:e}),this._url=void 0,this._templateValues=defaultClone(e.templateValues,{}),this._queryParameters=defaultClone(e.queryParameters,{}),this.headers=defaultClone(e.headers,{}),this.request=defaultValue(e.request,new Request),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=defaultValue(e.retryAttempts,0),this._retryCount=0;var t=new URI(e.url);parseQuery(t,this,!0,!0),t.fragment=void 0,this._url=t.toString()}function fetchImage(e){var r=e.resource,n=e.flipY,a=e.preferImageBitmap,i=r.request;i.url=r.url,i.requestFunction=function(){var e=r.url,t=!1;r.isDataUri||r.isBlobUri||(t=r.isCrossOriginUrl);var i=when.defer();return Resource._Implementations.createImage(e,t,i,n,a),i.promise};var t=RequestScheduler.request(i);if(defined(t))return t.otherwise(function(t){return i.state!==RequestState$1.FAILED?when.reject(t):r.retryOnError(t).then(function(e){return e?(i.state=RequestState$1.UNISSUED,i.deferred=void 0,fetchImage({resource:r,flipY:n,preferImageBitmap:a})):when.reject(t)})})}function fetchJsonp(i,r,n){var e={};e[r]=n,i.setQueryParameters(e);var a=i.request;a.url=i.url,a.requestFunction=function(){var t=when.defer();return window[n]=function(e){t.resolve(e);try{delete window[n]}catch(e){window[n]=void 0}},Resource._Implementations.loadAndExecuteScript(i.url,n,t),t.promise};var t=RequestScheduler.request(a);if(defined(t))return t.otherwise(function(t){return a.state!==RequestState$1.FAILED?when.reject(t):i.retryOnError(t).then(function(e){return e?(a.state=RequestState$1.UNISSUED,a.deferred=void 0,fetchJsonp(i,r,n)):when.reject(t)})})}Resource.createIfNeeded=function(e){return e instanceof Resource?e.getDerivedResource({request:e.request}):"string"!=typeof e?e:new Resource({url:e})},Resource.supportsImageBitmapOptions=function(){if(defined(supportsImageBitmapOptionsPromise))return supportsImageBitmapOptionsPromise;if("function"!=typeof createImageBitmap)return supportsImageBitmapOptionsPromise=when.resolve(!1);return supportsImageBitmapOptionsPromise=Resource.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWP4////fwAJ+wP9CNHoHgAAAABJRU5ErkJggg=="}).then(function(e){return createImageBitmap(e,{imageOrientation:"flipY",premultiplyAlpha:"none"})}).then(function(e){return!0}).otherwise(function(){return!1})},defineProperties$1(Resource,{isBlobSupported:{get:function(){return xhrBlobSupported}}}),defineProperties$1(Resource.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){var t=new URI(e);parseQuery(t,this,!1),t.fragment=void 0,this._url=t.toString()}},extension:{get:function(){return getExtensionFromUri(this._url)}},isDataUri:{get:function(){return isDataUri(this._url)}},isBlobUri:{get:function(){return isBlobUri(this._url)}},isCrossOriginUrl:{get:function(){return isCrossOriginUrl(this._url)}},hasHeaders:{get:function(){return 0<Object.keys(this.headers).length}}}),Resource.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;var i=new URI(this._url);e&&stringifyQuery(i,this);var r=i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}"),n=this._templateValues;return r=r.replace(/{(.*?)}/g,function(e,t){var i=n[t];return defined(i)?encodeURIComponent(i):e}),t&&defined(this.proxy)&&(r=this.proxy.getURL(r)),r},Resource.prototype.setQueryParameters=function(e,t){this._queryParameters=t?combineQueryParameters(this._queryParameters,e,!1):combineQueryParameters(e,this._queryParameters,!1)},Resource.prototype.appendQueryParameters=function(e){this._queryParameters=combineQueryParameters(e,this._queryParameters,!0)},Resource.prototype.setTemplateValues=function(e,t){this._templateValues=t?combine(this._templateValues,e):combine(e,this._templateValues)},Resource.prototype.getDerivedResource=function(e){var t=this.clone();if(t._retryCount=0,defined(e.url)){var i=new URI(e.url);parseQuery(i,t,!0,defaultValue(e.preserveQueryParameters,!1)),i.fragment=void 0,t._url=i.resolve(new URI(getAbsoluteUri(this._url))).toString()}return defined(e.queryParameters)&&(t._queryParameters=combine(e.queryParameters,t._queryParameters)),defined(e.templateValues)&&(t._templateValues=combine(e.templateValues,t.templateValues)),defined(e.headers)&&(t.headers=combine(e.headers,t.headers)),defined(e.proxy)&&(t.proxy=e.proxy),defined(e.request)&&(t.request=e.request),defined(e.retryCallback)&&(t.retryCallback=e.retryCallback),defined(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},Resource.prototype.retryOnError=function(e){var t=this.retryCallback;if("function"!=typeof t||this._retryCount>=this.retryAttempts)return when(!1);var i=this;return when(t(this,e)).then(function(e){return++i._retryCount,e})},Resource.prototype.clone=function(e){return defined(e)||(e=new Resource({url:this._url})),e._url=this._url,e._queryParameters=clone(this._queryParameters),e._templateValues=clone(this._templateValues),e.headers=clone(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e},Resource.prototype.getBaseUri=function(e){return getBaseUri(this.getUrlComponent(e),e)},Resource.prototype.appendForwardSlash=function(){this._url=appendForwardSlash(this._url)},Resource.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},Resource.fetchArrayBuffer=function(e){return new Resource(e).fetchArrayBuffer()},Resource.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},Resource.fetchBlob=function(e){return new Resource(e).fetchBlob()},Resource.prototype.fetchImage=function(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).preferImageBitmap,!1),i=defaultValue(e.preferBlob,!1),r=defaultValue(e.flipY,!1);if(checkAndResetRequest(this.request),!xhrBlobSupported||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!i)return fetchImage({resource:this,flipY:r,preferImageBitmap:t});var n,a,o,s=this.fetchBlob();return defined(s)?Resource.supportsImageBitmapOptions().then(function(e){return n=e&&t,s}).then(function(e){if(defined(e)){if(o=e,n)return Resource.createImageBitmapFromBlob(e,{flipY:r,premultiplyAlpha:!1});var t=window.URL.createObjectURL(e);return fetchImage({resource:a=new Resource({url:t}),flipY:r,preferImageBitmap:!1})}}).then(function(e){if(defined(e))return e.blob=o,n||window.URL.revokeObjectURL(a.url),e}).otherwise(function(e){return defined(a)&&window.URL.revokeObjectURL(a.url),e.blob=o,when.reject(e)}):void 0},Resource.fetchImage=function(e){return new Resource(e).fetchImage({flipY:e.flipY,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},Resource.prototype.fetchText=function(){return this.fetch({responseType:"text"})},Resource.fetchText=function(e){return new Resource(e).fetchText()},Resource.prototype.fetchJson=function(){var e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(defined(e))return e.then(function(e){if(defined(e))return JSON.parse(e)})},Resource.fetchJson=function(e){return new Resource(e).fetchJson()},Resource.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},Resource.fetchXML=function(e){return new Resource(e).fetchXML()},Resource.prototype.fetchJsonp=function(e){var t;for(e=defaultValue(e,"callback"),checkAndResetRequest(this.request);t="loadJsonp"+Math.random().toString().substring(2,8),defined(window[t]););return fetchJsonp(this,e,t)},Resource.fetchJsonp=function(e){return new Resource(e).fetchJsonp(e.callbackParameterName)},Resource.prototype._makeRequest=function(s){var l=this;checkAndResetRequest(l.request);var c=l.request;c.url=l.url,c.requestFunction=function(){var e=s.responseType,t=combine(s.headers,l.headers),i=s.overrideMimeType,r=s.method,n=s.data,a=when.defer(),o=Resource._Implementations.loadWithXhr(l.url,e,r,n,t,a,i);return defined(o)&&defined(o.abort)&&(c.cancelFunction=function(){o.abort()}),a.promise};var e=RequestScheduler.request(c);if(defined(e))return e.then(function(e){return e}).otherwise(function(t){return c.state!==RequestState$1.FAILED?when.reject(t):l.retryOnError(t).then(function(e){return e?(c.state=RequestState$1.UNISSUED,c.deferred=void 0,l.fetch(s)):when.reject(t)})})};var dataUriRegex$1=/^data:(.*?)(;base64)?,(.*)$/;function decodeDataUriText(e,t){var i=decodeURIComponent(t);return e?atob(i):i}function decodeDataUriArrayBuffer(e,t){for(var i=decodeDataUriText(e,t),r=new ArrayBuffer(i.length),n=new Uint8Array(r),a=0;a<i.length;a++)n[a]=i.charCodeAt(a);return r}function decodeDataUri(e,t){t=defaultValue(t,"");var i=e[1],r=!!e[2],n=e[3];switch(t){case"":case"text":return decodeDataUriText(r,n);case"arraybuffer":return decodeDataUriArrayBuffer(r,n);case"blob":var a=decodeDataUriArrayBuffer(r,n);return new Blob([a],{type:i});case"document":return(new DOMParser).parseFromString(decodeDataUriText(r,n),i);case"json":return JSON.parse(decodeDataUriText(r,n))}}function loadImageElement(e,t,i){var r=new Image;r.onload=function(){i.resolve(r)},r.onerror=function(e){i.reject(e)},t&&(TrustedServers.contains(e)?r.crossOrigin="use-credentials":r.crossOrigin=""),r.src=e}function decodeResponse(e,t){switch(t){case"text":return e.toString("utf8");case"json":return JSON.parse(e.toString("utf8"));default:return new Uint8Array(e).buffer}}function loadWithHttpRequest(e,r,t,i,n,a,o){var s=global.require,l=s("url").parse(e),c="https:"===l.protocol?s("https"):s("http"),u=s("zlib"),d={protocol:l.protocol,hostname:l.hostname,port:l.port,path:l.path,query:l.query,method:t,headers:n};c.request(d).on("response",function(t){if(t.statusCode<200||300<=t.statusCode)a.reject(new RequestErrorEvent(t.statusCode,t,t.headers));else{var i=[];t.on("data",function(e){i.push(e)}),t.on("end",function(){var e=Buffer.concat(i);"gzip"===t.headers["content-encoding"]?u.gunzip(e,function(e,t){e?a.reject(new RuntimeError("Error decompressing response.")):a.resolve(decodeResponse(t,r))}):a.resolve(decodeResponse(e,r))})}}).on("error",function(e){a.reject(new RequestErrorEvent)}).end()}Resource.prototype.fetch=function(e){return(e=defaultClone(e,{})).method="GET",this._makeRequest(e)},Resource.fetch=function(e){return new Resource(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.delete=function(e){return(e=defaultClone(e,{})).method="DELETE",this._makeRequest(e)},Resource.delete=function(e){return new Resource(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})},Resource.prototype.head=function(e){return(e=defaultClone(e,{})).method="HEAD",this._makeRequest(e)},Resource.head=function(e){return new Resource(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.options=function(e){return(e=defaultClone(e,{})).method="OPTIONS",this._makeRequest(e)},Resource.options=function(e){return new Resource(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.post=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="POST",t.data=e,this._makeRequest(t)},Resource.post=function(e){return new Resource(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.put=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="PUT",t.data=e,this._makeRequest(t)},Resource.put=function(e){return new Resource(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.patch=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="PATCH",t.data=e,this._makeRequest(t)},Resource.patch=function(e){return new Resource(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource._Implementations={},Resource._Implementations.createImage=function(t,i,r,n,a){Resource.supportsImageBitmapOptions().then(function(e){if(e&&a)return Resource.fetchBlob({url:t}).then(function(e){if(defined(e))return Resource.createImageBitmapFromBlob(e,{flipY:n,premultiplyAlpha:!1});r.reject(new RuntimeError("Successfully retrieved "+t+" but it contained no content."))}).then(r.resolve);loadImageElement(t,i,r)}).otherwise(r.reject)},Resource.createImageBitmapFromBlob=function(e,t){return Check.defined("options",t),Check.typeOf.bool("options.flipY",t.flipY),Check.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none"})};var noXMLHttpRequest="undefined"==typeof XMLHttpRequest;Resource._Implementations.loadWithXhr=function(e,n,a,t,i,o,r){var s=dataUriRegex$1.exec(e);if(null===s){if(!noXMLHttpRequest){var l=new XMLHttpRequest;if(TrustedServers.contains(e)&&(l.withCredentials=!0),l.open(a,e,!0),defined(r)&&defined(l.overrideMimeType)&&l.overrideMimeType(r),defined(i))for(var c in i)i.hasOwnProperty(c)&&l.setRequestHeader(c,i[c]);defined(n)&&(l.responseType=n);var u=!1;return"string"==typeof e&&(u=0===e.indexOf("file://")||"undefined"!=typeof window&&"file://"===window.location.origin),l.onload=function(){if(!(l.status<200||300<=l.status)||u&&0===l.status){var e=l.response,t=l.responseType;if("HEAD"===a||"OPTIONS"===a){var i=l.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};return i.forEach(function(e){var t=e.split(": "),i=t.shift();r[i]=t.join(": ")}),void o.resolve(r)}if(204===l.status)o.resolve();else if(!defined(e)||defined(n)&&t!==n)if("json"===n&&"string"==typeof e)try{o.resolve(JSON.parse(e))}catch(e){o.reject(e)}else(""===t||"document"===t)&&defined(l.responseXML)&&l.responseXML.hasChildNodes()?o.resolve(l.responseXML):""!==t&&"text"!==t||!defined(l.responseText)?o.reject(new RuntimeError("Invalid XMLHttpRequest response type.")):o.resolve(l.responseText);else o.resolve(e)}else o.reject(new RequestErrorEvent(l.status,l.response,l.getAllResponseHeaders()))},l.onerror=function(e){o.reject(new RequestErrorEvent)},l.send(t),l}loadWithHttpRequest(e,n,a,t,i,o)}else o.resolve(decodeDataUri(s,n))},Resource._Implementations.loadAndExecuteScript=function(e,t,i){return loadAndExecuteScript(e).otherwise(i.reject)},Resource._DefaultImplementations={},Resource._DefaultImplementations.createImage=Resource._Implementations.createImage,Resource._DefaultImplementations.loadWithXhr=Resource._Implementations.loadWithXhr,Resource._DefaultImplementations.loadAndExecuteScript=Resource._Implementations.loadAndExecuteScript,Resource.DEFAULT=freezeObject$1(new Resource({url:"undefined"==typeof document?"":document.location.href.split("?")[0]}));var cesiumScriptRegex=/((?:.*\/)|^)Cesium\.js(?:\W|$)/i,a$1,baseResource,implementation;function getBaseUrlFromCesiumScript(){for(var e=document.getElementsByTagName("script"),t=0,i=e.length;t<i;++t){var r=e[t].getAttribute("src"),n=cesiumScriptRegex.exec(r);if(null!==n)return n[1]}}function tryMakeAbsolute(e){return"undefined"==typeof document?e:(defined(a$1)||(a$1=document.createElement("a")),a$1.href=e,a$1.href=a$1.href,a$1.href)}function getCesiumBaseUrl(){return defined(baseResource)||(e="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:"object"==typeof define&&defined(define.amd)&&!define.amd.toUrlUndefined&&defined(require.toUrl)?getAbsoluteUri("..",buildModuleUrl("Core/buildModuleUrl.js")):getBaseUrlFromCesiumScript(),(baseResource=new Resource({url:tryMakeAbsolute(e)})).appendForwardSlash()),baseResource;var e}function buildModuleUrlFromRequireToUrl(e){return tryMakeAbsolute(require.toUrl("../"+e))}function buildModuleUrlFromBaseUrl(e){return getCesiumBaseUrl().getDerivedResource({url:e}).url}function buildModuleUrl(e){return defined(implementation)||(implementation="object"==typeof define&&defined(define.amd)&&!define.amd.toUrlUndefined&&defined(require.toUrl)?buildModuleUrlFromRequireToUrl:buildModuleUrlFromBaseUrl),implementation(e)}function Cartesian2(e,t){this.x=defaultValue(e,0),this.y=defaultValue(t,0)}buildModuleUrl._cesiumScriptRegex=cesiumScriptRegex,buildModuleUrl._buildModuleUrlFromBaseUrl=buildModuleUrlFromBaseUrl,buildModuleUrl._clearBaseResource=function(){baseResource=void 0},buildModuleUrl.setBaseUrl=function(e){baseResource=Resource.DEFAULT.getDerivedResource({url:e})},buildModuleUrl.getCesiumBaseUrl=getCesiumBaseUrl,Cartesian2.fromElements=function(e,t,i){return defined(i)?(i.x=e,i.y=t,i):new Cartesian2(e,t)},Cartesian2.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t):new Cartesian2(e.x,e.y)},Cartesian2.fromCartesian3=Cartesian2.clone,Cartesian2.fromCartesian4=Cartesian2.clone,Cartesian2.packedLength=2,Cartesian2.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i]=e.y,t},Cartesian2.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Cartesian2),i.x=e[t++],i.y=e[t],i},Cartesian2.packArray=function(e,t){var i=e.length;defined(t)?t.length=2*i:t=new Array(2*i);for(var r=0;r<i;++r)Cartesian2.pack(e[r],t,2*r);return t},Cartesian2.unpackArray=function(e,t){var i=e.length;defined(t)?t.length=i/2:t=new Array(i/2);for(var r=0;r<i;r+=2){var n=r/2;t[n]=Cartesian2.unpack(e,r,t[n])}return t},Cartesian2.fromArray=Cartesian2.unpack,Cartesian2.maximumComponent=function(e){return Math.max(e.x,e.y)},Cartesian2.minimumComponent=function(e){return Math.min(e.x,e.y)},Cartesian2.minimumByComponent=function(e,t,i){return i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i},Cartesian2.maximumByComponent=function(e,t,i){return i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i},Cartesian2.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},Cartesian2.magnitude=function(e){return Math.sqrt(Cartesian2.magnitudeSquared(e))};var distanceScratch$2=new Cartesian2;Cartesian2.distance=function(e,t){return Cartesian2.subtract(e,t,distanceScratch$2),Cartesian2.magnitude(distanceScratch$2)},Cartesian2.distanceSquared=function(e,t){return Cartesian2.subtract(e,t,distanceScratch$2),Cartesian2.magnitudeSquared(distanceScratch$2)},Cartesian2.normalize=function(e,t){var i=Cartesian2.magnitude(e);return t.x=e.x/i,t.y=e.y/i,t},Cartesian2.dot=function(e,t){return e.x*t.x+e.y*t.y},Cartesian2.multiplyComponents=function(e,t,i){return i.x=e.x*t.x,i.y=e.y*t.y,i},Cartesian2.divideComponents=function(e,t,i){return i.x=e.x/t.x,i.y=e.y/t.y,i},Cartesian2.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i},Cartesian2.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i},Cartesian2.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i},Cartesian2.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i},Cartesian2.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},Cartesian2.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var lerpScratch$2=new Cartesian2;Cartesian2.lerp=function(e,t,i,r){return Cartesian2.multiplyByScalar(t,i,lerpScratch$2),r=Cartesian2.multiplyByScalar(e,1-i,r),Cartesian2.add(lerpScratch$2,r,r)};var angleBetweenScratch$1=new Cartesian2,angleBetweenScratch2$1=new Cartesian2;Cartesian2.angleBetween=function(e,t){return Cartesian2.normalize(e,angleBetweenScratch$1),Cartesian2.normalize(t,angleBetweenScratch2$1),CesiumMath.acosClamped(Cartesian2.dot(angleBetweenScratch$1,angleBetweenScratch2$1))};var mostOrthogonalAxisScratch$2=new Cartesian2;function GeographicTilingScheme(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._rectangle=defaultValue(e.rectangle,Rectangle.MAX_VALUE),this._projection=new GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=defaultValue(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=defaultValue(e.numberOfLevelZeroTilesY,1)}Cartesian2.mostOrthogonalAxis=function(e,t){var i=Cartesian2.normalize(e,mostOrthogonalAxisScratch$2);return Cartesian2.abs(i,i),t=i.x<=i.y?Cartesian2.clone(Cartesian2.UNIT_X,t):Cartesian2.clone(Cartesian2.UNIT_Y,t)},Cartesian2.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y},Cartesian2.equalsArray=function(e,t,i){return e.x===t[i]&&e.y===t[i+1]},Cartesian2.equalsEpsilon=function(e,t,i,r){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.x,t.x,i,r)&&CesiumMath.equalsEpsilon(e.y,t.y,i,r)},Cartesian2.ZERO=freezeObject$1(new Cartesian2(0,0)),Cartesian2.UNIT_X=freezeObject$1(new Cartesian2(1,0)),Cartesian2.UNIT_Y=freezeObject$1(new Cartesian2(0,1)),Cartesian2.prototype.clone=function(e){return Cartesian2.clone(this,e)},Cartesian2.prototype.equals=function(e){return Cartesian2.equals(this,e)},Cartesian2.prototype.equalsEpsilon=function(e,t,i){return Cartesian2.equalsEpsilon(this,e,t,i)},Cartesian2.prototype.toString=function(){return"("+this.x+", "+this.y+")"},defineProperties$1(GeographicTilingScheme.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),GeographicTilingScheme.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},GeographicTilingScheme.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},GeographicTilingScheme.prototype.rectangleToNativeRectangle=function(e,t){var i=CesiumMath.toDegrees(e.west),r=CesiumMath.toDegrees(e.south),n=CesiumMath.toDegrees(e.east),a=CesiumMath.toDegrees(e.north);return defined(t)?(t.west=i,t.south=r,t.east=n,t.north=a,t):new Rectangle(i,r,n,a)},GeographicTilingScheme.prototype.tileXYToNativeRectangle=function(e,t,i,r){var n=this.tileXYToRectangle(e,t,i,r);return n.west=CesiumMath.toDegrees(n.west),n.south=CesiumMath.toDegrees(n.south),n.east=CesiumMath.toDegrees(n.east),n.north=CesiumMath.toDegrees(n.north),n},GeographicTilingScheme.prototype.tileXYToRectangle=function(e,t,i,r){var n=this._rectangle,a=this.getNumberOfXTilesAtLevel(i),o=this.getNumberOfYTilesAtLevel(i),s=n.width/a,l=e*s+n.west,c=(e+1)*s+n.west,u=n.height/o,d=n.north-t*u,h=n.north-(t+1)*u;return defined(r)||(r=new Rectangle(l,h,c,d)),r.west=l,r.south=h,r.east=c,r.north=d,r},GeographicTilingScheme.prototype.positionToTileXY=function(e,t,i){var r=this._rectangle;if(Rectangle.contains(r,e)){var n=this.getNumberOfXTilesAtLevel(t),a=this.getNumberOfYTilesAtLevel(t),o=r.width/n,s=r.height/a,l=e.longitude;r.east<r.west&&(l+=CesiumMath.TWO_PI);var c=(l-r.west)/o|0;n<=c&&(c=n-1);var u=(r.north-e.latitude)/s|0;return a<=u&&(u=a-1),defined(i)?(i.x=c,i.y=u,i):new Cartesian2(c,u)}};var scratchDiagonalCartesianNE=new Cartesian3,scratchDiagonalCartesianSW=new Cartesian3,scratchDiagonalCartographic=new Cartographic,scratchCenterCartesian=new Cartesian3,scratchSurfaceCartesian=new Cartesian3,scratchBoundingSphere=new BoundingSphere,tilingScheme=new GeographicTilingScheme,scratchCorners=[new Cartographic,new Cartographic,new Cartographic,new Cartographic],scratchTileXY=new Cartesian2,ApproximateTerrainHeights={};function getTileXYLevel(e){Cartographic.fromRadians(e.east,e.north,0,scratchCorners[0]),Cartographic.fromRadians(e.west,e.north,0,scratchCorners[1]),Cartographic.fromRadians(e.east,e.south,0,scratchCorners[2]),Cartographic.fromRadians(e.west,e.south,0,scratchCorners[3]);var t,i=0,r=0,n=0,a=0,o=ApproximateTerrainHeights._terrainHeightsMaxLevel;for(t=0;t<=o;++t){for(var s=!1,l=0;l<4;++l){var c=scratchCorners[l];if(tilingScheme.positionToTileXY(c,t,scratchTileXY),0===l)n=scratchTileXY.x,a=scratchTileXY.y;else if(n!==scratchTileXY.x||a!==scratchTileXY.y){s=!0;break}}if(s)break;i=n,r=a}if(0!==t)return{x:i,y:r,level:o<t?o:t-1}}ApproximateTerrainHeights.initialize=function(){var e=ApproximateTerrainHeights._initPromise;return defined(e)?e:(e=Resource.fetchJson(buildModuleUrl("Assets/approximateTerrainHeights.json")).then(function(e){ApproximateTerrainHeights._terrainHeights=e}),ApproximateTerrainHeights._initPromise=e)},ApproximateTerrainHeights.getMinimumMaximumHeights=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=getTileXYLevel(e),r=ApproximateTerrainHeights._defaultMinTerrainHeight,n=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(i)){var a=i.level+"-"+i.x+"-"+i.y,o=ApproximateTerrainHeights._terrainHeights[a];defined(o)&&(r=o[0],n=o[1]),t.cartographicToCartesian(Rectangle.northeast(e,scratchDiagonalCartographic),scratchDiagonalCartesianNE),t.cartographicToCartesian(Rectangle.southwest(e,scratchDiagonalCartographic),scratchDiagonalCartesianSW),Cartesian3.midpoint(scratchDiagonalCartesianSW,scratchDiagonalCartesianNE,scratchCenterCartesian);var s=t.scaleToGeodeticSurface(scratchCenterCartesian,scratchSurfaceCartesian);if(defined(s)){var l=Cartesian3.distance(scratchCenterCartesian,s);r=Math.min(r,-l)}else r=ApproximateTerrainHeights._defaultMinTerrainHeight}return{minimumTerrainHeight:r=Math.max(ApproximateTerrainHeights._defaultMinTerrainHeight,r),maximumTerrainHeight:n}},ApproximateTerrainHeights.getBoundingSphere=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=getTileXYLevel(e),r=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(i)){var n=i.level+"-"+i.x+"-"+i.y,a=ApproximateTerrainHeights._terrainHeights[n];defined(a)&&(r=a[1])}var o=BoundingSphere.fromRectangle3D(e,t,0);return BoundingSphere.fromRectangle3D(e,t,r,scratchBoundingSphere),BoundingSphere.union(o,scratchBoundingSphere,o)},ApproximateTerrainHeights._terrainHeightsMaxLevel=6,ApproximateTerrainHeights._defaultMaxTerrainHeight=9e3,ApproximateTerrainHeights._defaultMinTerrainHeight=-1e5,ApproximateTerrainHeights._terrainHeights=void 0,ApproximateTerrainHeights._initPromise=void 0,defineProperties$1(ApproximateTerrainHeights,{initialized:{get:function(){return defined(ApproximateTerrainHeights._terrainHeights)}}});var html=["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","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","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"],svg=["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","audio","canvas","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","video","view","vkern"],svgFilters=["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"],mathMl=["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmuliscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mpspace","msqrt","mystyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"],text=["#text"],html$1=["accept","action","align","alt","autocomplete","background","bgcolor","border","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","coords","crossorigin","datetime","default","dir","disabled","download","enctype","face","for","headers","height","hidden","high","href","hreflang","id","integrity","ismap","label","lang","list","loop","low","max","maxlength","media","method","min","multiple","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","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","type","usemap","valign","value","width","xmlns"],svg$1=["accent-height","accumulate","additivive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","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","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","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","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"],mathMl$1=["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","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"],xml=["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"];function addToSet(e,t){for(var i=t.length;i--;)"string"==typeof t[i]&&(t[i]=t[i].toLowerCase()),e[t[i]]=!0;return e}function clone$1(e){var t={},i=void 0;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}var MUSTACHE_EXPR=/\{\{[\s\S]*|[\s\S]*\}\}/gm,ERB_EXPR=/<%[\s\S]*|[\s\S]*%>/gm,DATA_ATTR=/^data-[\-\w.\u00B7-\uFFFF]/,ARIA_ATTR=/^aria-[\-\w]+$/,IS_ALLOWED_URI=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,IS_SCRIPT_OR_DATA=/^(?:\w+script|data):/i,ATTR_WHITESPACE=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}var getGlobal=function(){return"undefined"==typeof window?null:window};function createDOMPurify(){function h(e){return createDOMPurify(e)}var l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:getGlobal();if(h.version="1.0.8",h.removed=[],!l||!l.document||9!==l.document.nodeType)return h.isSupported=!1,h;var c=l.document,a=!1,o=!1,s=l.document,u=l.DocumentFragment,e=l.HTMLTemplateElement,d=l.Node,t=l.NodeFilter,i=l.NamedNodeMap,r=void 0===i?l.NamedNodeMap||l.MozNamedAttrMap:i,n=l.Text,p=l.Comment,m=l.DOMParser;if("function"==typeof e){var f=s.createElement("template");f.content&&f.content.ownerDocument&&(s=f.content.ownerDocument)}var g=s,_=g.implementation,y=g.createNodeIterator,v=g.getElementsByTagName,C=g.createDocumentFragment,S=c.importNode,x={};h.isSupported=_&&void 0!==_.createHTMLDocument&&9!==s.documentMode;function T(e){"object"!==(void 0===e?"undefined":_typeof(e))&&(e={}),L="ALLOWED_TAGS"in e?addToSet({},e.ALLOWED_TAGS):F,N="ALLOWED_ATTR"in e?addToSet({},e.ALLOWED_ATTR):B,V="FORBID_TAGS"in e?addToSet({},e.FORBID_TAGS):{},k="FORBID_ATTR"in e?addToSet({},e.FORBID_ATTR):{},ee="USE_PROFILES"in e&&e.USE_PROFILES,$=!1!==e.ALLOW_ARIA_ATTR,z=!1!==e.ALLOW_DATA_ATTR,U=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=e.SAFE_FOR_JQUERY||!1,H=e.SAFE_FOR_TEMPLATES||!1,W=e.WHOLE_DOCUMENT||!1,Y=e.RETURN_DOM||!1,X=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_DOM_IMPORT||!1,j=e.FORCE_BODY||!1,J=!1!==e.SANITIZE_DOM,Z=!1!==e.KEEP_CONTENT,K=e.IN_PLACE||!1,O=e.ALLOWED_URI_REGEXP||O,H&&(z=!1),X&&(Y=!0),ee&&(L=addToSet({},[].concat(_toConsumableArray(text))),N=[],!0===ee.html&&(addToSet(L,html),addToSet(N,html$1)),!0===ee.svg&&(addToSet(L,svg),addToSet(N,svg$1),addToSet(N,xml)),!0===ee.svgFilters&&(addToSet(L,svgFilters),addToSet(N,svg$1),addToSet(N,xml)),!0===ee.mathMl&&(addToSet(L,mathMl),addToSet(N,mathMl$1),addToSet(N,xml))),e.ADD_TAGS&&(L===F&&(L=clone$1(L)),addToSet(L,e.ADD_TAGS)),e.ADD_ATTR&&(N===B&&(N=clone$1(N)),addToSet(N,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&addToSet(re,e.ADD_URI_SAFE_ATTR),Z&&(L["#text"]=!0),W&&addToSet(L,["html","head","body"]),L.table&&addToSet(L,["tbody"]),Object&&"freeze"in Object&&Object.freeze(e),ne=e}function b(t){h.removed.push({element:t});try{t.parentNode.removeChild(t)}catch(e){t.outerHTML=""}}function E(e,t){try{h.removed.push({attribute:t.getAttributeNode(e),from:t})}catch(e){h.removed.push({attribute:null,from:t})}t.removeAttribute(e)}function P(e){var t=void 0,i=void 0;if(j)e="<remove></remove>"+e;else{var r=e.match(/^[\s]+/);(i=r&&r[0])&&(e=e.slice(i.length))}if(a)try{t=(new m).parseFromString(e,"text/html")}catch(e){}if(o&&addToSet(V,["title"]),!t||!t.documentElement){var n=(t=_.createHTMLDocument("")).body;n.parentNode.removeChild(n.parentNode.firstElementChild),n.outerHTML=e}return i&&t.body.insertBefore(s.createTextNode(i),t.body.childNodes[0]||null),v.call(t,W?"html":"body")[0]}var A=MUSTACHE_EXPR,w=ERB_EXPR,D=DATA_ATTR,M=ARIA_ATTR,I=IS_SCRIPT_OR_DATA,R=ATTR_WHITESPACE,O=IS_ALLOWED_URI,L=null,F=addToSet({},[].concat(_toConsumableArray(html),_toConsumableArray(svg),_toConsumableArray(svgFilters),_toConsumableArray(mathMl),_toConsumableArray(text))),N=null,B=addToSet({},[].concat(_toConsumableArray(html$1),_toConsumableArray(svg$1),_toConsumableArray(mathMl$1),_toConsumableArray(xml))),V=null,k=null,$=!0,z=!0,U=!1,G=!1,H=!1,W=!1,q=!1,j=!1,Y=!1,X=!1,Q=!1,J=!0,Z=!0,K=!1,ee={},te=addToSet({},["audio","head","math","script","style","template","svg","video"]),ie=addToSet({},["audio","video","img","source","image"]),re=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ne=null,ae=s.createElement("form");h.isSupported&&(function(){try{P('<svg><p><style><img src="</style><img src=x onerror=alert(1)//">').querySelector("svg img")&&(a=!0)}catch(e){}}(),function(){try{P("<x/><title>&lt;/title&gt;&lt;img&gt;").querySelector("title").textContent.match(/<\/title/)&&(o=!0)}catch(e){}}());function oe(e){return y.call(e.ownerDocument||e,e,t.SHOW_ELEMENT|t.SHOW_COMMENT|t.SHOW_TEXT,function(){return t.FILTER_ACCEPT},!1)}function se(e){return"object"===(void 0===d?"undefined":_typeof(d))?e instanceof d:e&&"object"===(void 0===e?"undefined":_typeof(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function le(e,t,i){x[e]&&x[e].forEach(function(e){e.call(h,t,i,ne)})}function ce(e){var t=void 0;if(le("beforeSanitizeElements",e,null),function(e){return!(e instanceof n||e instanceof p)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof r&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute)}(e))return b(e),!0;var i=e.nodeName.toLowerCase();if(le("uponSanitizeElement",e,{tagName:i,allowedTags:L}),L[i]&&!V[i])return!G||e.firstElementChild||e.content&&e.content.firstElementChild||!/</g.test(e.textContent)||(h.removed.push({element:e.cloneNode()}),e.innerHTML?e.innerHTML=e.innerHTML.replace(/</g,"&lt;"):e.innerHTML=e.textContent.replace(/</g,"&lt;")),H&&3===e.nodeType&&(t=(t=(t=e.textContent).replace(A," ")).replace(w," "),e.textContent!==t&&(h.removed.push({element:e.cloneNode()}),e.textContent=t)),le("afterSanitizeElements",e,null),!1;if(Z&&!te[i]&&"function"==typeof e.insertAdjacentHTML)try{e.insertAdjacentHTML("AfterEnd",e.innerHTML)}catch(e){}return b(e),!0}function ue(e,t,i){if(J&&("id"===t||"name"===t)&&(i in s||i in ae))return!1;if(H&&(i=(i=i.replace(A," ")).replace(w," ")),!(z&&D.test(t)||$&&M.test(t))){if(!N[t]||k[t])return!1;if(!re[t]&&!O.test(i.replace(R,"")))if("src"!==t&&"xlink:href"!==t||"script"===e||0!==i.indexOf("data:")||!ie[e]){if((!U||I.test(i.replace(R,"")))&&i)return!1}else;}return!0}function de(e){var t=void 0,i=void 0,r=void 0,n=void 0,a=void 0;le("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:N};for(a=o.length;a--;){var l=t=o[a],c=l.name,u=l.namespaceURI;if(i=t.value.trim(),r=c.toLowerCase(),s.attrName=r,s.attrValue=i,s.keepAttr=!0,le("uponSanitizeAttribute",e,s),i=s.attrValue,"name"===r&&"IMG"===e.nodeName&&o.id)n=o.id,o=Array.prototype.slice.apply(o),E("id",e),E(c,e),o.indexOf(n)>a&&e.setAttribute("id",n.value);else{if("INPUT"===e.nodeName&&"type"===r&&"file"===i&&(N[r]||!k[r]))continue;"id"===c&&e.setAttribute(c,""),E(c,e)}if(s.keepAttr){var d=e.nodeName.toLowerCase();if(ue(d,r,i))try{u?e.setAttributeNS(u,c,i):e.setAttribute(c,i),h.removed.pop()}catch(e){}}}le("afterSanitizeAttributes",e,null)}}function he(e){var t=void 0,i=oe(e);for(le("beforeSanitizeShadowDOM",e,null);t=i.nextNode();)le("uponSanitizeShadowNode",t,null),ce(t)||(t.content instanceof u&&he(t.content),de(t));le("afterSanitizeShadowDOM",e,null)}return h.sanitize=function(e,t){var i=void 0,r=void 0,n=void 0,a=void 0,o=void 0;if("string"!=typeof(e=e||"\x3c!--\x3e")&&!se(e)){if("function"!=typeof e.toString)throw new TypeError("toString is not a function");if("string"!=typeof(e=e.toString()))throw new TypeError("dirty is not a string, aborting")}if(!h.isSupported){if("object"===_typeof(l.toStaticHTML)||"function"==typeof l.toStaticHTML){if("string"==typeof e)return l.toStaticHTML(e);if(se(e))return l.toStaticHTML(e.outerHTML)}return e}if(q||T(t),h.removed=[],!K)if(e instanceof d)1===(r=(i=P("\x3c!--\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===r.nodeName?i=r:i.appendChild(r);else{if(!Y&&!W&&-1===e.indexOf("<"))return e;if(!(i=P(e)))return Y?null:""}i&&j&&b(i.firstChild);for(var s=oe(K?e:i);n=s.nextNode();)3===n.nodeType&&n===a||ce(n)||(n.content instanceof u&&he(n.content),de(n),a=n);if(K)return e;if(Y){if(X)for(o=C.call(i.ownerDocument);i.firstChild;)o.appendChild(i.firstChild);else o=i;return Q&&(o=S.call(c,o,!0)),o}return W?i.outerHTML:i.innerHTML},h.setConfig=function(e){T(e),q=!0},h.clearConfig=function(){ne=null,q=!1},h.isValidAttribute=function(e,t,i){ne||T({});var r=e.toLowerCase(),n=t.toLowerCase();return ue(r,n,i)},h.addHook=function(e,t){"function"==typeof t&&(x[e]=x[e]||[],x[e].push(t))},h.removeHook=function(e){x[e]&&x[e].pop()},h.removeHooks=function(e){x[e]&&(x[e]=[])},h.removeAllHooks=function(){x={}},h}var purify=createDOMPurify(),nextCreditId=0,creditToId={};function Credit(e,t){var i,r=e;defined(creditToId[r])?i=creditToId[r]:(i=nextCreditId++,creditToId[r]=i),t=defaultValue(t,!1),this._id=i,this._html=e,this._showOnScreen=t,this._element=void 0}defineProperties$1(Credit.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen}},element:{get:function(){if(!defined(this._element)){var e=purify.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;for(var i=t.querySelectorAll("a"),r=0;r<i.length;r++)i[r].setAttribute("target","_blank");this._element=t}return this._element}}}),Credit.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e._id===t._id},Credit.prototype.equals=function(e){return Credit.equals(this,e)},Credit.getIonCredit=function(e){var t=defined(e.collapsible)&&!e.collapsible,i=new Credit(e.html,t);return i._isIon=-1!==i.html.indexOf("ion-credit.png"),i},Credit.clone=function(e){if(defined(e))return new Credit(e.html,e.showOnScreen)};var HeightmapEncoding={NONE:0,LERC:1},HeightmapEncoding$1=freezeObject$1(HeightmapEncoding);function AxisAlignedBoundingBox(e,t,i){this.minimum=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.maximum=Cartesian3.clone(defaultValue(t,Cartesian3.ZERO)),i=defined(i)?Cartesian3.clone(i):Cartesian3.midpoint(this.minimum,this.maximum,new Cartesian3),this.center=i}AxisAlignedBoundingBox.fromPoints=function(e,t){if(defined(t)||(t=new AxisAlignedBoundingBox),!defined(e)||0===e.length)return t.minimum=Cartesian3.clone(Cartesian3.ZERO,t.minimum),t.maximum=Cartesian3.clone(Cartesian3.ZERO,t.maximum),t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t;for(var i=e[0].x,r=e[0].y,n=e[0].z,a=e[0].x,o=e[0].y,s=e[0].z,l=e.length,c=1;c<l;c++){var u=e[c],d=u.x,h=u.y,p=u.z;i=Math.min(d,i),a=Math.max(d,a),r=Math.min(h,r),o=Math.max(h,o),n=Math.min(p,n),s=Math.max(p,s)}var m=t.minimum;m.x=i,m.y=r,m.z=n;var f=t.maximum;return f.x=a,f.y=o,f.z=s,t.center=Cartesian3.midpoint(m,f,t.center),t},AxisAlignedBoundingBox.clone=function(e,t){if(defined(e))return defined(t)?(t.minimum=Cartesian3.clone(e.minimum,t.minimum),t.maximum=Cartesian3.clone(e.maximum,t.maximum),t.center=Cartesian3.clone(e.center,t.center),t):new AxisAlignedBoundingBox(e.minimum,e.maximum,e.center)},AxisAlignedBoundingBox.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&Cartesian3.equals(e.minimum,t.minimum)&&Cartesian3.equals(e.maximum,t.maximum)};var intersectScratch=new Cartesian3;function EllipsoidalOccluder(e,t){this._ellipsoid=e,this._cameraPosition=new Cartesian3,this._cameraPositionInScaledSpace=new Cartesian3,this._distanceToLimbInScaledSpaceSquared=0,defined(t)&&(this.cameraPosition=t)}AxisAlignedBoundingBox.intersectPlane=function(e,t){intersectScratch=Cartesian3.subtract(e.maximum,e.minimum,intersectScratch);var i=Cartesian3.multiplyByScalar(intersectScratch,.5,intersectScratch),r=t.normal,n=i.x*Math.abs(r.x)+i.y*Math.abs(r.y)+i.z*Math.abs(r.z),a=Cartesian3.dot(e.center,r)+t.distance;return 0<a-n?Intersect$1.INSIDE:a+n<0?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},AxisAlignedBoundingBox.prototype.clone=function(e){return AxisAlignedBoundingBox.clone(this,e)},AxisAlignedBoundingBox.prototype.intersectPlane=function(e){return AxisAlignedBoundingBox.intersectPlane(this,e)},AxisAlignedBoundingBox.prototype.equals=function(e){return AxisAlignedBoundingBox.equals(this,e)},defineProperties$1(EllipsoidalOccluder.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){var t=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=Cartesian3.magnitudeSquared(t)-1;Cartesian3.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=t,this._distanceToLimbInScaledSpaceSquared=i}}});var scratchCartesian=new Cartesian3;EllipsoidalOccluder.prototype.isPointVisible=function(e){var t=this._ellipsoid.transformPositionToScaledSpace(e,scratchCartesian);return this.isScaledSpacePointVisible(t)},EllipsoidalOccluder.prototype.isScaledSpacePointVisible=function(e){var t=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared,r=Cartesian3.subtract(e,t,scratchCartesian),n=-Cartesian3.dot(r,t);return!(i<0?0<n:i<n&&n*n/Cartesian3.magnitudeSquared(r)>i)},EllipsoidalOccluder.prototype.computeHorizonCullingPoint=function(e,t,i){defined(i)||(i=new Cartesian3);for(var r=this._ellipsoid,n=computeScaledSpaceDirectionToPoint(r,e),a=0,o=0,s=t.length;o<s;++o){var l=computeMagnitude(r,t[o],n);a=Math.max(a,l)}return magnitudeToPoint(n,a,i)};var positionScratch=new Cartesian3;EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices=function(e,t,i,r,n){defined(n)||(n=new Cartesian3),r=defaultValue(r,Cartesian3.ZERO);for(var a=this._ellipsoid,o=computeScaledSpaceDirectionToPoint(a,e),s=0,l=0,c=t.length;l<c;l+=i){positionScratch.x=t[l]+r.x,positionScratch.y=t[l+1]+r.y,positionScratch.z=t[l+2]+r.z;var u=computeMagnitude(a,positionScratch,o);s=Math.max(s,u)}return magnitudeToPoint(o,s,n)};var subsampleScratch=[];EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle=function(e,t,i){var r=Rectangle.subsample(e,t,0,subsampleScratch),n=BoundingSphere.fromPoints(r);if(!(Cartesian3.magnitude(n.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(n.center,r,i)};var scaledSpaceScratch=new Cartesian3,directionScratch=new Cartesian3;function computeMagnitude(e,t,i){var r=e.transformPositionToScaledSpace(t,scaledSpaceScratch),n=Cartesian3.magnitudeSquared(r),a=Math.sqrt(n),o=Cartesian3.divideByScalar(r,a,directionScratch);n=Math.max(1,n);var s=1/(a=Math.max(1,a));return 1/(Cartesian3.dot(o,i)*s-Cartesian3.magnitude(Cartesian3.cross(o,i,o))*(Math.sqrt(n-1)*s))}function magnitudeToPoint(e,t,i){if(!(t<=0||t===1/0||t!=t))return Cartesian3.multiplyByScalar(e,t,i)}var directionToPointScratch=new Cartesian3;function computeScaledSpaceDirectionToPoint(e,t){return Cartesian3.equals(t,Cartesian3.ZERO)?t:(e.transformPositionToScaledSpace(t,directionToPointScratch),Cartesian3.normalize(directionToPointScratch,directionToPointScratch))}var QuadraticRealPolynomial={};function addWithCancellationCheck(e,t,i){var r=e+t;return CesiumMath.sign(e)!==CesiumMath.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<i?0:r}QuadraticRealPolynomial.computeDiscriminant=function(e,t,i){return t*t-4*e*i},QuadraticRealPolynomial.computeRealRoots=function(e,t,i){var r;if(0===e)return 0===t?[]:[-i/t];if(0===t){if(0===i)return[0,0];var n=Math.abs(i),a=Math.abs(e);if(n<a&&n/a<CesiumMath.EPSILON14)return[0,0];if(a<n&&a/n<CesiumMath.EPSILON14)return[];if((r=-i/e)<0)return[];var o=Math.sqrt(r);return[-o,o]}if(0===i)return(r=-t/e)<0?[r,0]:[0,r];var s=addWithCancellationCheck(t*t,-(4*e*i),CesiumMath.EPSILON14);if(s<0)return[];var l=-.5*addWithCancellationCheck(t,CesiumMath.sign(t)*Math.sqrt(s),CesiumMath.EPSILON14);return 0<t?[l/e,i/l]:[i/l,l/e]};var CubicRealPolynomial={};function computeRealRoots(e,t,i,r){var n,a,o=e,s=t/3,l=i/3,c=r,u=o*l,d=s*c,h=s*s,p=l*l,m=o*l-h,f=o*c-s*l,g=s*c-p,_=4*m*g-f*f;if(_<0){var y,v,C,S=-((C=u*p<=h*d?-2*s*(v=m)+(y=o)*f:-(y=c)*f+2*l*(v=g))<0?-1:1)*Math.abs(y)*Math.sqrt(-_),x=(a=S-C)/2,T=x<0?-Math.pow(-x,1/3):Math.pow(x,1/3),b=a===S?-T:-v/T;return n=v<=0?T+b:-C/(T*T+b*b+v),u*p<=h*d?[(n-s)/o]:[-c/(n+l)]}var E=m,P=-2*s*m+o*f,A=g,w=-c*f+2*l*g,D=Math.sqrt(_),M=Math.sqrt(3)/2,I=Math.abs(Math.atan2(o*D,-P)/3);n=2*Math.sqrt(-E);var R=Math.cos(I);a=n*R;var O=n*(-R/2-M*Math.sin(I)),L=2*s<a+O?a-s:O-s,F=o,N=L/F;I=Math.abs(Math.atan2(c*D,-w)/3);var B=-c,V=(a=(n=2*Math.sqrt(-A))*(R=Math.cos(I)))+(O=n*(-R/2-M*Math.sin(I)))<2*l?a+l:O+l,k=B/V,$=-L*V-F*B,z=(l*$-s*(L*B))/(-s*$+l*(F*V));return N<=z?N<=k?z<=k?[N,z,k]:[N,k,z]:[k,N,z]:N<=k?[z,N,k]:z<=k?[z,k,N]:[k,z,N]}CubicRealPolynomial.computeDiscriminant=function(e,t,i,r){var n=t*t,a=i*i;return 18*e*t*i*r+n*a-27*(e*e)*(r*r)-4*(e*a*i+n*t*r)},CubicRealPolynomial.computeRealRoots=function(e,t,i,r){var n,a;if(0===e)return QuadraticRealPolynomial.computeRealRoots(t,i,r);if(0!==t)return 0===i?0===r?(a=-t/e)<0?[a,0,0]:[0,0,a]:computeRealRoots(e,t,0,r):0===r?0===(n=QuadraticRealPolynomial.computeRealRoots(e,t,i)).length?[0]:n[1]<=0?[n[0],n[1],0]:0<=n[0]?[0,n[0],n[1]]:[n[0],0,n[1]]:computeRealRoots(e,t,i,r);if(0!==i)return 0===r?0===(n=QuadraticRealPolynomial.computeRealRoots(e,0,i)).Length?[0]:[n[0],0,n[1]]:computeRealRoots(e,0,i,r);if(0===r)return[0,0,0];var o=(a=-r/e)<0?-Math.pow(-a,1/3):Math.pow(a,1/3);return[o,o,o]};var QuarticRealPolynomial={};function original(e,t,i,r){var n=e*e,a=t-3*n/8,o=i-t*e/2+n*e/8,s=r-i*e/4+t*n/16-3*n*n/256,l=CubicRealPolynomial.computeRealRoots(1,2*a,a*a-4*s,-o*o);if(0<l.length){var c=-e/4,u=l[l.length-1];if(Math.abs(u)<CesiumMath.EPSILON14){var d=QuadraticRealPolynomial.computeRealRoots(1,a,s);if(2===d.length){var h,p=d[0],m=d[1];if(0<=p&&0<=m){var f=Math.sqrt(p),g=Math.sqrt(m);return[c-g,c-f,c+f,c+g]}if(0<=p&&m<0)return[c-(h=Math.sqrt(p)),c+h];if(p<0&&0<=m)return[c-(h=Math.sqrt(m)),c+h]}return[]}if(0<u){var _=Math.sqrt(u),y=(a+u-o/_)/2,v=(a+u+o/_)/2,C=QuadraticRealPolynomial.computeRealRoots(1,_,y),S=QuadraticRealPolynomial.computeRealRoots(1,-_,v);return 0!==C.length?(C[0]+=c,C[1]+=c,0!==S.length?(S[0]+=c,S[1]+=c,C[1]<=S[0]?[C[0],C[1],S[0],S[1]]:S[1]<=C[0]?[S[0],S[1],C[0],C[1]]:C[0]>=S[0]&&C[1]<=S[1]?[S[0],C[0],C[1],S[1]]:S[0]>=C[0]&&S[1]<=C[1]?[C[0],S[0],S[1],C[1]]:C[0]>S[0]&&C[0]<S[1]?[S[0],C[0],S[1],C[1]]:[C[0],S[0],C[1],S[1]]):C):0!==S.length?(S[0]+=c,S[1]+=c,S):[]}}return[]}function neumark(e,t,i,r){var n=e*e,a=-2*t,o=i*e+t*t-4*r,s=n*r-i*t*e+i*i,l=CubicRealPolynomial.computeRealRoots(1,a,o,s);if(0<l.length){var c,u,d,h,p,m,f=l[0],g=t-f,_=g*g,y=e/2,v=g/2,C=_-4*r,S=_+4*Math.abs(r),x=n-4*f,T=n+4*Math.abs(f);if(f<0||C*T<x*S){var b=Math.sqrt(x);c=b/2,u=0===b?0:(e*v-i)/b}else{var E=Math.sqrt(C);c=0===E?0:(e*v-i)/E,u=E/2}0==y&&0===c?h=d=0:CesiumMath.sign(y)===CesiumMath.sign(c)?h=f/(d=y+c):d=f/(h=y-c),0==v&&0===u?m=p=0:CesiumMath.sign(v)===CesiumMath.sign(u)?m=r/(p=v+u):p=r/(m=v-u);var P=QuadraticRealPolynomial.computeRealRoots(1,d,p),A=QuadraticRealPolynomial.computeRealRoots(1,h,m);if(0!==P.length)return 0!==A.length?P[1]<=A[0]?[P[0],P[1],A[0],A[1]]:A[1]<=P[0]?[A[0],A[1],P[0],P[1]]:P[0]>=A[0]&&P[1]<=A[1]?[A[0],P[0],P[1],A[1]]:A[0]>=P[0]&&A[1]<=P[1]?[P[0],A[0],A[1],P[1]]:P[0]>A[0]&&P[0]<A[1]?[A[0],P[0],A[1],P[1]]:[P[0],A[0],P[1],A[1]]:P;if(0!==A.length)return A}return[]}function Ray(e,t){t=Cartesian3.clone(defaultValue(t,Cartesian3.ZERO)),Cartesian3.equals(t,Cartesian3.ZERO)||Cartesian3.normalize(t,t),this.origin=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.direction=t}QuarticRealPolynomial.computeDiscriminant=function(e,t,i,r,n){var a=e*e,o=t*t,s=o*t,l=i*i,c=l*i,u=r*r,d=u*r,h=n*n;return o*l*u-4*s*d-4*e*c*u+18*e*t*i*d-27*a*u*u+256*(a*e)*(h*n)+n*(18*s*i*r-4*o*c+16*e*l*l-80*e*t*l*r-6*e*o*u+144*a*i*u)+h*(144*e*o*i-27*o*o-128*a*l-192*a*t*r)},QuarticRealPolynomial.computeRealRoots=function(e,t,i,r,n){if(Math.abs(e)<CesiumMath.EPSILON15)return CubicRealPolynomial.computeRealRoots(t,i,r,n);var a=t/e,o=i/e,s=r/e,l=n/e,c=a<0?1:0;switch(c+=o<0?c+1:c,c+=s<0?c+1:c,c+=l<0?c+1:c){case 0:return original(a,o,s,l);case 1:case 2:return neumark(a,o,s,l);case 3:case 4:return original(a,o,s,l);case 5:return neumark(a,o,s,l);case 6:case 7:return original(a,o,s,l);case 8:return neumark(a,o,s,l);case 9:case 10:return original(a,o,s,l);case 11:return neumark(a,o,s,l);case 12:case 13:case 14:case 15:return original(a,o,s,l);default:return}},Ray.clone=function(e,t){if(defined(e))return defined(t)?(t.origin=Cartesian3.clone(e.origin),t.direction=Cartesian3.clone(e.direction),t):new Ray(e.origin,e.direction)},Ray.getPoint=function(e,t,i){return defined(i)||(i=new Cartesian3),i=Cartesian3.multiplyByScalar(e.direction,t,i),Cartesian3.add(e.origin,i,i)};var IntersectionTests={rayPlane:function(e,t,i){defined(i)||(i=new Cartesian3);var r=e.origin,n=e.direction,a=t.normal,o=Cartesian3.dot(a,n);if(!(Math.abs(o)<CesiumMath.EPSILON15)){var s=(-t.distance-Cartesian3.dot(a,r))/o;if(!(s<0))return i=Cartesian3.multiplyByScalar(n,s,i),Cartesian3.add(r,i,i)}}},scratchEdge0=new Cartesian3,scratchEdge1=new Cartesian3,scratchPVec=new Cartesian3,scratchTVec=new Cartesian3,scratchQVec=new Cartesian3;IntersectionTests.rayTriangleParametric=function(e,t,i,r,n){n=defaultValue(n,!1);var a,o,s,l,c,u=e.origin,d=e.direction,h=Cartesian3.subtract(i,t,scratchEdge0),p=Cartesian3.subtract(r,t,scratchEdge1),m=Cartesian3.cross(d,p,scratchPVec),f=Cartesian3.dot(h,m);if(n){if(f<CesiumMath.EPSILON6)return;if(a=Cartesian3.subtract(u,t,scratchTVec),(s=Cartesian3.dot(a,m))<0||f<s)return;if(o=Cartesian3.cross(a,h,scratchQVec),(l=Cartesian3.dot(d,o))<0||f<s+l)return;c=Cartesian3.dot(p,o)/f}else{if(Math.abs(f)<CesiumMath.EPSILON6)return;var g=1/f;if(a=Cartesian3.subtract(u,t,scratchTVec),(s=Cartesian3.dot(a,m)*g)<0||1<s)return;if(o=Cartesian3.cross(a,h,scratchQVec),(l=Cartesian3.dot(d,o)*g)<0||1<s+l)return;c=Cartesian3.dot(p,o)*g}return c},IntersectionTests.rayTriangle=function(e,t,i,r,n,a){var o=IntersectionTests.rayTriangleParametric(e,t,i,r,n);if(defined(o)&&!(o<0))return defined(a)||(a=new Cartesian3),Cartesian3.multiplyByScalar(e.direction,o,a),Cartesian3.add(e.origin,a,a)};var scratchLineSegmentTriangleRay=new Ray;function solveQuadratic(e,t,i,r){var n=t*t-4*e*i;if(!(n<0)){if(0<n){var a=1/(2*e),o=Math.sqrt(n),s=(-t+o)*a,l=(-t-o)*a;return s<l?(r.root0=s,r.root1=l):(r.root0=l,r.root1=s),r}var c=-t/(2*e);if(0!=c)return r.root0=r.root1=c,r}}IntersectionTests.lineSegmentTriangle=function(e,t,i,r,n,a,o){var s=scratchLineSegmentTriangleRay;Cartesian3.clone(e,s.origin),Cartesian3.subtract(t,e,s.direction),Cartesian3.normalize(s.direction,s.direction);var l=IntersectionTests.rayTriangleParametric(s,i,r,n,a);if(!(!defined(l)||l<0||l>Cartesian3.distance(e,t)))return defined(o)||(o=new Cartesian3),Cartesian3.multiplyByScalar(s.direction,l,o),Cartesian3.add(s.origin,o,o)};var raySphereRoots={root0:0,root1:0};function raySphere(e,t,i){defined(i)||(i=new Interval);var r=e.origin,n=e.direction,a=t.center,o=t.radius*t.radius,s=Cartesian3.subtract(r,a,scratchPVec),l=solveQuadratic(Cartesian3.dot(n,n),2*Cartesian3.dot(n,s),Cartesian3.magnitudeSquared(s)-o,raySphereRoots);if(defined(l))return i.start=l.root0,i.stop=l.root1,i}IntersectionTests.raySphere=function(e,t,i){if(defined(i=raySphere(e,t,i))&&!(i.stop<0))return i.start=Math.max(i.start,0),i};var scratchLineSegmentRay=new Ray;IntersectionTests.lineSegmentSphere=function(e,t,i,r){var n=scratchLineSegmentRay;Cartesian3.clone(e,n.origin);var a=Cartesian3.subtract(t,e,n.direction),o=Cartesian3.magnitude(a);if(Cartesian3.normalize(a,a),!(!defined(r=raySphere(n,i,r))||r.stop<0||r.start>o))return r.start=Math.max(r.start,0),r.stop=Math.min(r.stop,o),r};var scratchQ=new Cartesian3,scratchW=new Cartesian3;function addWithCancellationCheck$1(e,t,i){var r=e+t;return CesiumMath.sign(e)!==CesiumMath.sign(t)&&Math.abs(r/Math.max(Math.abs(e),Math.abs(t)))<i?0:r}function quadraticVectorExpression(e,t,i,r,n){var a,o=r*r,s=n*n,l=(e[Matrix3.COLUMN1ROW1]-e[Matrix3.COLUMN2ROW2])*s,c=n*(r*addWithCancellationCheck$1(e[Matrix3.COLUMN1ROW0],e[Matrix3.COLUMN0ROW1],CesiumMath.EPSILON15)+t.y),u=e[Matrix3.COLUMN0ROW0]*o+e[Matrix3.COLUMN2ROW2]*s+r*t.x+i,d=s*addWithCancellationCheck$1(e[Matrix3.COLUMN2ROW1],e[Matrix3.COLUMN1ROW2],CesiumMath.EPSILON15),h=n*(r*addWithCancellationCheck$1(e[Matrix3.COLUMN2ROW0],e[Matrix3.COLUMN0ROW2])+t.z),p=[];if(0==h&&0==d){if(0===(a=QuadraticRealPolynomial.computeRealRoots(l,c,u)).length)return p;var m=a[0],f=Math.sqrt(Math.max(1-m*m,0));if(p.push(new Cartesian3(r,n*m,n*-f)),p.push(new Cartesian3(r,n*m,n*f)),2===a.length){var g=a[1],_=Math.sqrt(Math.max(1-g*g,0));p.push(new Cartesian3(r,n*g,n*-_)),p.push(new Cartesian3(r,n*g,n*_))}return p}var y=h*h,v=d*d,C=h*d,S=l*l+v,x=2*(c*l+C),T=2*u*l+c*c-v+y,b=2*(u*c-C),E=u*u-y;if(0==S&&0==x&&0==T&&0==b)return p;var P=(a=QuarticRealPolynomial.computeRealRoots(S,x,T,b,E)).length;if(0===P)return p;for(var A=0;A<P;++A){var w=a[A],D=w*w,M=Math.max(1-D,0),I=Math.sqrt(M),R=(CesiumMath.sign(l)===CesiumMath.sign(u)?addWithCancellationCheck$1(l*D+u,c*w,CesiumMath.EPSILON12):CesiumMath.sign(u)===CesiumMath.sign(c*w)?addWithCancellationCheck$1(l*D,c*w+u,CesiumMath.EPSILON12):addWithCancellationCheck$1(l*D+c*w,u,CesiumMath.EPSILON12))*addWithCancellationCheck$1(d*w,h,CesiumMath.EPSILON15);R<0?p.push(new Cartesian3(r,n*w,n*I)):0<R?p.push(new Cartesian3(r,n*w,n*-I)):0!==I?(p.push(new Cartesian3(r,n*w,n*-I)),p.push(new Cartesian3(r,n*w,n*I)),++A):p.push(new Cartesian3(r,n*w,n*I))}return p}IntersectionTests.rayEllipsoid=function(e,t){var i,r,n,a,o,s=t.oneOverRadii,l=Cartesian3.multiplyComponents(s,e.origin,scratchQ),c=Cartesian3.multiplyComponents(s,e.direction,scratchW),u=Cartesian3.magnitudeSquared(l),d=Cartesian3.dot(l,c);if(1<u){if(0<=d)return;var h=d*d;if(i=u-1,h<(n=(r=Cartesian3.magnitudeSquared(c))*i))return;if(n<h){a=d*d-n;var p=(o=-d+Math.sqrt(a))/r,m=i/o;return p<m?new Interval(p,m):{start:m,stop:p}}var f=Math.sqrt(i/r);return new Interval(f,f)}return u<1?(i=u-1,a=d*d-(n=(r=Cartesian3.magnitudeSquared(c))*i),new Interval(0,(o=-d+Math.sqrt(a))/r)):d<0?new Interval(0,-d/(r=Cartesian3.magnitudeSquared(c))):void 0};var firstAxisScratch=new Cartesian3,secondAxisScratch=new Cartesian3,thirdAxisScratch=new Cartesian3,referenceScratch=new Cartesian3,bCart=new Cartesian3,bScratch=new Matrix3,btScratch=new Matrix3,diScratch=new Matrix3,dScratch=new Matrix3,cScratch=new Matrix3,tempMatrix=new Matrix3,aScratch=new Matrix3,sScratch=new Cartesian3,closestScratch=new Cartesian3,surfPointScratch=new Cartographic;IntersectionTests.grazingAltitudeLocation=function(e,t){var i=e.origin,r=e.direction;if(!Cartesian3.equals(i,Cartesian3.ZERO)){var n=t.geodeticSurfaceNormal(i,firstAxisScratch);if(0<=Cartesian3.dot(r,n))return i}var a=defined(this.rayEllipsoid(e,t)),o=t.transformPositionToScaledSpace(r,firstAxisScratch),s=Cartesian3.normalize(o,o),l=Cartesian3.mostOrthogonalAxis(o,referenceScratch),c=Cartesian3.normalize(Cartesian3.cross(l,s,secondAxisScratch),secondAxisScratch),u=Cartesian3.normalize(Cartesian3.cross(s,c,thirdAxisScratch),thirdAxisScratch),d=bScratch;d[0]=s.x,d[1]=s.y,d[2]=s.z,d[3]=c.x,d[4]=c.y,d[5]=c.z,d[6]=u.x,d[7]=u.y,d[8]=u.z;var h=Matrix3.transpose(d,btScratch),p=Matrix3.fromScale(t.radii,diScratch),m=Matrix3.fromScale(t.oneOverRadii,dScratch),f=cScratch;f[0]=0,f[1]=-r.z,f[2]=r.y,f[3]=r.z,f[4]=0,f[5]=-r.x,f[6]=-r.y,f[7]=r.x,f[8]=0;var g,_,y=Matrix3.multiply(Matrix3.multiply(h,m,tempMatrix),f,tempMatrix),v=Matrix3.multiply(Matrix3.multiply(y,p,aScratch),d,aScratch),C=Matrix3.multiplyByVector(y,i,bCart),S=quadraticVectorExpression(v,Cartesian3.negate(C,firstAxisScratch),0,0,1),x=S.length;if(0<x){for(var T=Cartesian3.clone(Cartesian3.ZERO,closestScratch),b=Number.NEGATIVE_INFINITY,E=0;E<x;++E){g=Matrix3.multiplyByVector(p,Matrix3.multiplyByVector(d,S[E],sScratch),sScratch);var P=Cartesian3.normalize(Cartesian3.subtract(g,i,referenceScratch),referenceScratch),A=Cartesian3.dot(P,r);b<A&&(b=A,T=Cartesian3.clone(g,T))}var w=t.cartesianToCartographic(T,surfPointScratch);return b=CesiumMath.clamp(b,0,1),_=Cartesian3.magnitude(Cartesian3.subtract(T,i,referenceScratch))*Math.sqrt(1-b*b),_=a?-_:_,w.height=_,t.cartographicToCartesian(w,new Cartesian3)}};var lineSegmentPlaneDifference=new Cartesian3;function Plane(e,t){this.normal=Cartesian3.clone(e),this.distance=t}IntersectionTests.lineSegmentPlane=function(e,t,i,r){defined(r)||(r=new Cartesian3);var n=Cartesian3.subtract(t,e,lineSegmentPlaneDifference),a=i.normal,o=Cartesian3.dot(a,n);if(!(Math.abs(o)<CesiumMath.EPSILON6)){var s=Cartesian3.dot(a,e),l=-(i.distance+s)/o;if(!(l<0||1<l))return Cartesian3.multiplyByScalar(n,l,r),Cartesian3.add(e,r,r),r}},IntersectionTests.trianglePlaneIntersection=function(e,t,i,r){var n,a,o=r.normal,s=r.distance,l=Cartesian3.dot(o,e)+s<0,c=Cartesian3.dot(o,t)+s<0,u=Cartesian3.dot(o,i)+s<0,d=0;if(d+=l?1:0,d+=c?1:0,1!=(d+=u?1:0)&&2!=d||(n=new Cartesian3,a=new Cartesian3),1==d){if(l)return IntersectionTests.lineSegmentPlane(e,t,r,n),IntersectionTests.lineSegmentPlane(e,i,r,a),{positions:[e,t,i,n,a],indices:[0,3,4,1,2,4,1,4,3]};if(c)return IntersectionTests.lineSegmentPlane(t,i,r,n),IntersectionTests.lineSegmentPlane(t,e,r,a),{positions:[e,t,i,n,a],indices:[1,3,4,2,0,4,2,4,3]};if(u)return IntersectionTests.lineSegmentPlane(i,e,r,n),IntersectionTests.lineSegmentPlane(i,t,r,a),{positions:[e,t,i,n,a],indices:[2,3,4,0,1,4,0,4,3]}}else if(2==d){if(!l)return IntersectionTests.lineSegmentPlane(t,e,r,n),IntersectionTests.lineSegmentPlane(i,e,r,a),{positions:[e,t,i,n,a],indices:[1,2,4,1,4,3,0,3,4]};if(!c)return IntersectionTests.lineSegmentPlane(i,t,r,n),IntersectionTests.lineSegmentPlane(e,t,r,a),{positions:[e,t,i,n,a],indices:[2,0,4,2,4,3,1,3,4]};if(!u)return IntersectionTests.lineSegmentPlane(e,i,r,n),IntersectionTests.lineSegmentPlane(t,i,r,a),{positions:[e,t,i,n,a],indices:[0,1,4,0,4,3,2,3,4]}}},Plane.fromPointNormal=function(e,t,i){var r=-Cartesian3.dot(t,e);return defined(i)?(Cartesian3.clone(t,i.normal),i.distance=r,i):new Plane(t,r)};var scratchNormal=new Cartesian3;Plane.fromCartesian4=function(e,t){var i=Cartesian3.fromCartesian4(e,scratchNormal),r=e.w;return defined(t)?(Cartesian3.clone(i,t.normal),t.distance=r,t):new Plane(i,r)},Plane.getPointDistance=function(e,t){return Cartesian3.dot(e.normal,t)+e.distance};var scratchCartesian$1=new Cartesian3;Plane.projectPointOntoPlane=function(e,t,i){defined(i)||(i=new Cartesian3);var r=Plane.getPointDistance(e,t),n=Cartesian3.multiplyByScalar(e.normal,r,scratchCartesian$1);return Cartesian3.subtract(t,n,i)};var scratchPosition=new Cartesian3;function binarySearch(e,t,i){for(var r,n,a=0,o=e.length-1;a<=o;)if((n=i(e[r=~~((a+o)/2)],t))<0)a=1+r;else{if(!(0<n))return r;o=r-1}return~(o+1)}function EarthOrientationParametersSample(e,t,i,r,n){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=i,this.yPoleOffset=r,this.ut1MinusUtc=n}function sprintf(){function v(e,t,i,r){i=i||" ";var n=e.length>=t?"":Array(1+t-e.length>>>0).join(i);return r?e+n:n+e}function C(e,t,i,r,n,a){var o=r-e.length;return 0<o&&(e=i||!n?v(e,r,a,i):e.slice(0,t.length)+v("",o,"0",!0)+e.slice(t.length)),e}function S(e,t,i,r,n,a,o){var s=e>>>0;return e=(i=i&&s&&{2:"0b",8:"0",16:"0x"}[t]||"")+v(s.toString(t),a||0,"0",!1),C(e,i,r,n,o)}function x(e,t,i,r,n,a){return null!=r&&(e=e.slice(0,r)),C(e,"",t,i,n,a)}var T=arguments,b=0,e=T[b++];return e.replace(/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,function(e,t,i,r,n,a,o){var s,l,c,u,d;if("%%"==e)return"%";for(var h=!1,p="",m=!1,f=!1,g=" ",_=i.length,y=0;i&&y<_;y++)switch(i.charAt(y)){case" ":p=" ";break;case"+":p="+";break;case"-":h=!0;break;case"'":g=i.charAt(y+1);break;case"0":m=!0;break;case"#":f=!0}if((r=r?"*"==r?+T[b++]:"*"==r.charAt(0)?+T[r.slice(1,-1)]:+r:0)<0&&(r=-r,h=!0),!isFinite(r))throw new Error("sprintf: (minimum-)width must be finite");switch(a=a?"*"==a?+T[b++]:"*"==a.charAt(0)?+T[a.slice(1,-1)]:+a:-1<"fFeE".indexOf(o)?6:"d"==o?0:void 0,d=t?T[t.slice(0,-1)]:T[b++],o){case"s":return x(String(d),h,r,a,m,g);case"c":return x(String.fromCharCode(+d),h,r,a,m);case"b":return S(d,2,f,h,r,a,m);case"o":return S(d,8,f,h,r,a,m);case"x":return S(d,16,f,h,r,a,m);case"X":return S(d,16,f,h,r,a,m).toUpperCase();case"u":return S(d,10,f,h,r,a,m);case"i":case"d":return s=+d||0,d=(l=(s=Math.round(s-s%1))<0?"-":p)+v(String(Math.abs(s)),a,"0",!1),C(d,l,h,r,m);case"e":case"E":case"f":case"F":case"g":case"G":return l=(s=+d)<0?"-":p,c=["toExponential","toFixed","toPrecision"]["efg".indexOf(o.toLowerCase())],u=["toString","toUpperCase"]["eEfFgG".indexOf(o)%2],d=l+Math.abs(s)[c](a),C(d,l,h,r,m)[u]();default:return e}})}function GregorianDate(e,t,i,r,n,a,o,s){this.year=e,this.month=t,this.day=i,this.hour=r,this.minute=n,this.second=a,this.millisecond=o,this.isLeapSecond=s}function isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}function LeapSecond(e,t){this.julianDate=e,this.offset=t}Plane.transform=function(e,t,i){return Matrix4.multiplyByPointAsVector(t,e.normal,scratchNormal),Cartesian3.normalize(scratchNormal,scratchNormal),Cartesian3.multiplyByScalar(e.normal,-e.distance,scratchPosition),Matrix4.multiplyByPoint(t,scratchPosition,scratchPosition),Plane.fromPointNormal(scratchPosition,scratchNormal,i)},Plane.clone=function(e,t){return defined(t)?(Cartesian3.clone(e.normal,t.normal),t.distance=e.distance,t):new Plane(e.normal,e.distance)},Plane.equals=function(e,t){return e.distance===t.distance&&Cartesian3.equals(e.normal,t.normal)},Plane.ORIGIN_XY_PLANE=freezeObject$1(new Plane(Cartesian3.UNIT_Z,0)),Plane.ORIGIN_YZ_PLANE=freezeObject$1(new Plane(Cartesian3.UNIT_X,0)),Plane.ORIGIN_ZX_PLANE=freezeObject$1(new Plane(Cartesian3.UNIT_Y,0));var TimeConstants={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:2400000.5},TimeConstants$1=freezeObject$1(TimeConstants),TimeStandard={UTC:0,TAI:1},TimeStandard$1=freezeObject$1(TimeStandard),gregorianDateScratch=new GregorianDate,daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31],daysInLeapFeburary=29;function compareLeapSecondDates(e,t){return JulianDate.compare(e.julianDate,t.julianDate)}var binarySearchScratchLeapSecond=new LeapSecond;function convertUtcToTai(e){binarySearchScratchLeapSecond.julianDate=e;var t=JulianDate.leapSeconds,i=binarySearch(t,binarySearchScratchLeapSecond,compareLeapSecondDates);i<0&&(i=~i),i>=t.length&&(i=t.length-1);var r=t[i].offset;0<i&&r<JulianDate.secondsDifference(t[i].julianDate,e)&&(r=t[--i].offset);JulianDate.addSeconds(e,r,e)}function convertTaiToUtc(e,t){binarySearchScratchLeapSecond.julianDate=e;var i=JulianDate.leapSeconds,r=binarySearch(i,binarySearchScratchLeapSecond,compareLeapSecondDates);if(r<0&&(r=~r),0===r)return JulianDate.addSeconds(e,-i[0].offset,t);if(r>=i.length)return JulianDate.addSeconds(e,-i[r-1].offset,t);var n=JulianDate.secondsDifference(i[r].julianDate,e);return 0===n?JulianDate.addSeconds(e,-i[r].offset,t):n<=1?void 0:JulianDate.addSeconds(e,-i[--r].offset,t)}function setComponents(e,t,i){var r=t/TimeConstants$1.SECONDS_PER_DAY|0;return e+=r,(t-=TimeConstants$1.SECONDS_PER_DAY*r)<0&&(e--,t+=TimeConstants$1.SECONDS_PER_DAY),i.dayNumber=e,i.secondsOfDay=t,i}function computeJulianDateComponents(e,t,i,r,n,a,o){var s=(t-14)/12|0,l=e+4800+s,c=(1461*l/4|0)+(367*(t-2-12*s)/12|0)-(3*((l+100)/100|0)/4|0)+i-32075;(r-=12)<0&&(r+=24);var u=a+(r*TimeConstants$1.SECONDS_PER_HOUR+n*TimeConstants$1.SECONDS_PER_MINUTE+o*TimeConstants$1.SECONDS_PER_MILLISECOND);return 43200<=u&&(c-=1),[c,u]}var matchCalendarYear=/^(\d{4})$/,matchCalendarMonth=/^(\d{4})-(\d{2})$/,matchOrdinalDate=/^(\d{4})-?(\d{3})$/,matchWeekDate=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,matchCalendarDate=/^(\d{4})-?(\d{2})-?(\d{2})$/,utcOffset=/([Z+\-])?(\d{2})?:?(\d{2})?$/,matchHours=/^(\d{2})(\.\d+)?/.source+utcOffset.source,matchHoursMinutes=/^(\d{2}):?(\d{2})(\.\d+)?/.source+utcOffset.source,matchHoursMinutesSeconds=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+utcOffset.source;function JulianDate(e,t,i){this.dayNumber=void 0,this.secondsOfDay=void 0,e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,TimeStandard$1.UTC);var r=0|e;setComponents(r,t+=(e-r)*TimeConstants$1.SECONDS_PER_DAY,this),i===TimeStandard$1.UTC&&convertUtcToTai(this)}JulianDate.fromGregorianDate=function(e,t){var i=computeJulianDateComponents(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return defined(t)?(setComponents(i[0],i[1],t),convertUtcToTai(t),t):new JulianDate(i[0],i[1],TimeStandard$1.UTC)},JulianDate.fromDate=function(e,t){var i=computeJulianDateComponents(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return defined(t)?(setComponents(i[0],i[1],t),convertUtcToTai(t),t):new JulianDate(i[0],i[1],TimeStandard$1.UTC)},JulianDate.fromIso8601=function(e,t){var i,r,n,a,o=(e=e.replace(",",".")).split("T"),s=1,l=1,c=0,u=0,d=0,h=0,p=o[0],m=o[1];if(null!==(o=p.match(matchCalendarDate)))i=+o[1],s=+o[2],l=+o[3];else if(null!==(o=p.match(matchCalendarMonth)))i=+o[1],s=+o[2];else if(null!==(o=p.match(matchCalendarYear)))i=+o[1];else{var f;if(null!==(o=p.match(matchOrdinalDate)))i=+o[1],f=+o[2],n=isLeapYear(i);else if(null!==(o=p.match(matchWeekDate)))i=+o[1],f=7*+o[2]+(+o[3]||0)-new Date(Date.UTC(i,0,4)).getUTCDay()-3;(r=new Date(Date.UTC(i,0,1))).setUTCDate(f),s=r.getUTCMonth()+1,l=r.getUTCDate()}if(n=isLeapYear(i),defined(m)){null!==(o=m.match(matchHoursMinutesSeconds))?(c=+o[1],u=+o[2],d=+o[3],h=1e3*(o[4]||0),a=5):null!==(o=m.match(matchHoursMinutes))?(c=+o[1],u=+o[2],d=60*(o[3]||0),a=4):null!==(o=m.match(matchHours))&&(c=+o[1],u=60*(o[2]||0),a=3);var g=o[a],_=+o[a+1],y=+(o[a+2]||0);switch(g){case"+":c-=_,u-=y;break;case"-":c+=_,u+=y;break;case"Z":break;default:u+=new Date(Date.UTC(i,s-1,l,c,u)).getTimezoneOffset()}}var v=60===d;for(v&&d--;60<=u;)u-=60,c++;for(;24<=c;)c-=24,l++;for(r=n&&2===s?daysInLeapFeburary:daysInMonth[s-1];r<l;)l-=r,12<++s&&(s-=12,i++),r=n&&2===s?daysInLeapFeburary:daysInMonth[s-1];for(;u<0;)u+=60,c--;for(;c<0;)c+=24,l--;for(;l<1;)--s<1&&(s+=12,i--),l+=r=n&&2===s?daysInLeapFeburary:daysInMonth[s-1];var C=computeJulianDateComponents(i,s,l,c,u,d,h);return defined(t)?(setComponents(C[0],C[1],t),convertUtcToTai(t)):t=new JulianDate(C[0],C[1],TimeStandard$1.UTC),v&&JulianDate.addSeconds(t,1,t),t},JulianDate.now=function(e){return JulianDate.fromDate(new Date,e)};var toGregorianDateScratch=new JulianDate(0,0,TimeStandard$1.TAI);function EarthOrientationParameters(e){if(e=defaultValue(e,defaultValue.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._downloadPromise=void 0,this._dataError=void 0,this._addNewLeapSeconds=defaultValue(e.addNewLeapSeconds,!0),defined(e.data))onDataReady(this,e.data);else if(defined(e.url)){var t=Resource.createIfNeeded(e.url),i=this;this._downloadPromise=when(t.fetchJson(),function(e){onDataReady(i,e)},function(){i._dataError="An error occurred while retrieving the EOP data from the URL "+t.url+"."})}else onDataReady(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}function compareLeapSecondDates$1(e,t){return JulianDate.compare(e.julianDate,t)}function onDataReady(e,t){if(defined(t.columnNames))if(defined(t.samples)){var i=t.columnNames.indexOf("modifiedJulianDateUtc"),r=t.columnNames.indexOf("xPoleWanderRadians"),n=t.columnNames.indexOf("yPoleWanderRadians"),a=t.columnNames.indexOf("ut1MinusUtcSeconds"),o=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),s=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),l=t.columnNames.indexOf("taiMinusUtcSeconds");if(i<0||r<0||n<0||a<0||o<0||s<0||l<0)e._dataError="Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns";else{var c,u=e._samples=t.samples,d=e._dates=[];e._dateColumn=i,e._xPoleWanderRadiansColumn=r,e._yPoleWanderRadiansColumn=n,e._ut1MinusUtcSecondsColumn=a,e._xCelestialPoleOffsetRadiansColumn=o,e._yCelestialPoleOffsetRadiansColumn=s,e._taiMinusUtcSecondsColumn=l,e._columnCount=t.columnNames.length,e._lastIndex=void 0;for(var h=e._addNewLeapSeconds,p=0,m=u.length;p<m;p+=e._columnCount){var f=u[p+i],g=u[p+l],_=new JulianDate(f+TimeConstants$1.MODIFIED_JULIAN_DATE_DIFFERENCE,g,TimeStandard$1.TAI);if(d.push(_),h){if(g!==c&&defined(c)){var y=JulianDate.leapSeconds,v=binarySearch(y,_,compareLeapSecondDates$1);if(v<0){var C=new LeapSecond(_,g);y.splice(~v,0,C)}}c=g}}}}else e._dataError="Error in loaded EOP data: The samples property is required.";else e._dataError="Error in loaded EOP data: The columnNames property is required."}function fillResultFromIndex(e,t,i,r,n){var a=i*r;n.xPoleWander=t[a+e._xPoleWanderRadiansColumn],n.yPoleWander=t[a+e._yPoleWanderRadiansColumn],n.xPoleOffset=t[a+e._xCelestialPoleOffsetRadiansColumn],n.yPoleOffset=t[a+e._yCelestialPoleOffsetRadiansColumn],n.ut1MinusUtc=t[a+e._ut1MinusUtcSecondsColumn]}function linearInterp(e,t,i){return t+e*(i-t)}function interpolate(e,t,i,r,n,a,o){var s=e._columnCount;if(a>t.length-1)return o.xPoleWander=0,o.yPoleWander=0,o.xPoleOffset=0,o.yPoleOffset=0,o.ut1MinusUtc=0,o;var l=t[n],c=t[a];if(l.equals(c)||r.equals(l))return fillResultFromIndex(e,i,n,s,o),o;if(r.equals(c))return fillResultFromIndex(e,i,a,s,o),o;var u=JulianDate.secondsDifference(r,l)/JulianDate.secondsDifference(c,l),d=n*s,h=a*s,p=i[d+e._ut1MinusUtcSecondsColumn],m=i[h+e._ut1MinusUtcSecondsColumn],f=m-p;if(.5<f||f<-.5){var g=i[d+e._taiMinusUtcSecondsColumn],_=i[h+e._taiMinusUtcSecondsColumn];g!==_&&(c.equals(r)?p=m:m-=_-g)}return o.xPoleWander=linearInterp(u,i[d+e._xPoleWanderRadiansColumn],i[h+e._xPoleWanderRadiansColumn]),o.yPoleWander=linearInterp(u,i[d+e._yPoleWanderRadiansColumn],i[h+e._yPoleWanderRadiansColumn]),o.xPoleOffset=linearInterp(u,i[d+e._xCelestialPoleOffsetRadiansColumn],i[h+e._xCelestialPoleOffsetRadiansColumn]),o.yPoleOffset=linearInterp(u,i[d+e._yCelestialPoleOffsetRadiansColumn],i[h+e._yCelestialPoleOffsetRadiansColumn]),o.ut1MinusUtc=linearInterp(u,p,m),o}function HeadingPitchRoll(e,t,i){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.roll=defaultValue(i,0)}function Iau2006XysSample(e,t,i){this.x=e,this.y=t,this.s=i}function Iau2006XysData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._xysFileUrlTemplate=Resource.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=defaultValue(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=defaultValue(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new JulianDate(this._sampleZeroJulianEphemerisDate,0,TimeStandard$1.TAI),this._stepSizeDays=defaultValue(e.stepSizeDays,1),this._samplesPerXysFile=defaultValue(e.samplesPerXysFile,1e3),this._totalSamples=defaultValue(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];for(var t=this._interpolationOrder,i=this._denominators=new Array(t+1),r=this._xTable=new Array(t+1),n=Math.pow(this._stepSizeDays,t),a=0;a<=t;++a){i[a]=n,r[a]=a*this._stepSizeDays;for(var o=0;o<=t;++o)o!==a&&(i[a]*=a-o);i[a]=1/i[a]}this._work=new Array(t+1),this._coef=new Array(t+1)}JulianDate.toGregorianDate=function(e,t){var i=!1,r=convertTaiToUtc(e,toGregorianDateScratch);defined(r)||(JulianDate.addSeconds(e,-1,toGregorianDateScratch),r=convertTaiToUtc(toGregorianDateScratch,toGregorianDateScratch),i=!0);var n=r.dayNumber,a=r.secondsOfDay;43200<=a&&(n+=1);var o=n+68569|0,s=4*o/146097|0,l=4e3*((o=o-((146097*s+3)/4|0)|0)+1)/1461001|0,c=80*(o=o-(1461*l/4|0)+31|0)/2447|0,u=o-(2447*c/80|0)|0,d=2+c-12*(o=c/11|0)|0,h=100*(s-49)+l+o|0,p=a/TimeConstants$1.SECONDS_PER_HOUR|0,m=a-p*TimeConstants$1.SECONDS_PER_HOUR,f=m/TimeConstants$1.SECONDS_PER_MINUTE|0,g=0|(m-=f*TimeConstants$1.SECONDS_PER_MINUTE),_=(m-g)/TimeConstants$1.SECONDS_PER_MILLISECOND;return 23<(p+=12)&&(p-=24),i&&(g+=1),defined(t)?(t.year=h,t.month=d,t.day=u,t.hour=p,t.minute=f,t.second=g,t.millisecond=_,t.isLeapSecond=i,t):new GregorianDate(h,d,u,p,f,g,_,i)},JulianDate.toDate=function(e){var t=JulianDate.toGregorianDate(e,gregorianDateScratch),i=t.second;return t.isLeapSecond&&(i-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,i,t.millisecond))},JulianDate.toIso8601=function(e,t){var i=JulianDate.toGregorianDate(e,gregorianDateScratch),r=i.year,n=i.month,a=i.day,o=i.hour,s=i.minute,l=i.second,c=i.millisecond;return 1e4===r&&1===n&&1===a&&0===o&&0===s&&0===l&&0===c&&(r=9999,n=12,a=31,o=24),defined(t)||0===c?defined(t)&&0!==t?sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",r,n,a,o,s,l,(.01*c).toFixed(t).replace(".","").slice(0,t)):sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",r,n,a,o,s,l):sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%sZ",r,n,a,o,s,l,(.01*c).toString().replace(".",""))},JulianDate.clone=function(e,t){if(defined(e))return defined(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new JulianDate(e.dayNumber,e.secondsOfDay,TimeStandard$1.TAI)},JulianDate.compare=function(e,t){var i=e.dayNumber-t.dayNumber;return 0!=i?i:e.secondsOfDay-t.secondsOfDay},JulianDate.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},JulianDate.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(JulianDate.secondsDifference(e,t))<=i},JulianDate.totalDays=function(e){return e.dayNumber+e.secondsOfDay/TimeConstants$1.SECONDS_PER_DAY},JulianDate.secondsDifference=function(e,t){return(e.dayNumber-t.dayNumber)*TimeConstants$1.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)},JulianDate.daysDifference=function(e,t){return e.dayNumber-t.dayNumber+(e.secondsOfDay-t.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY},JulianDate.computeTaiMinusUtc=function(e){binarySearchScratchLeapSecond.julianDate=e;var t=JulianDate.leapSeconds,i=binarySearch(t,binarySearchScratchLeapSecond,compareLeapSecondDates);return i<0&&(i=~i,--i<0&&(i=0)),t[i].offset},JulianDate.addSeconds=function(e,t,i){return setComponents(e.dayNumber,e.secondsOfDay+t,i)},JulianDate.addMinutes=function(e,t,i){var r=e.secondsOfDay+t*TimeConstants$1.SECONDS_PER_MINUTE;return setComponents(e.dayNumber,r,i)},JulianDate.addHours=function(e,t,i){var r=e.secondsOfDay+t*TimeConstants$1.SECONDS_PER_HOUR;return setComponents(e.dayNumber,r,i)},JulianDate.addDays=function(e,t,i){return setComponents(e.dayNumber+t,e.secondsOfDay,i)},JulianDate.lessThan=function(e,t){return JulianDate.compare(e,t)<0},JulianDate.lessThanOrEquals=function(e,t){return JulianDate.compare(e,t)<=0},JulianDate.greaterThan=function(e,t){return 0<JulianDate.compare(e,t)},JulianDate.greaterThanOrEquals=function(e,t){return 0<=JulianDate.compare(e,t)},JulianDate.prototype.clone=function(e){return JulianDate.clone(this,e)},JulianDate.prototype.equals=function(e){return JulianDate.equals(this,e)},JulianDate.prototype.equalsEpsilon=function(e,t){return JulianDate.equalsEpsilon(this,e,t)},JulianDate.prototype.toString=function(){return JulianDate.toIso8601(this)},JulianDate.leapSeconds=[new LeapSecond(new JulianDate(2441317,43210,TimeStandard$1.TAI),10),new LeapSecond(new JulianDate(2441499,43211,TimeStandard$1.TAI),11),new LeapSecond(new JulianDate(2441683,43212,TimeStandard$1.TAI),12),new LeapSecond(new JulianDate(2442048,43213,TimeStandard$1.TAI),13),new LeapSecond(new JulianDate(2442413,43214,TimeStandard$1.TAI),14),new LeapSecond(new JulianDate(2442778,43215,TimeStandard$1.TAI),15),new LeapSecond(new JulianDate(2443144,43216,TimeStandard$1.TAI),16),new LeapSecond(new JulianDate(2443509,43217,TimeStandard$1.TAI),17),new LeapSecond(new JulianDate(2443874,43218,TimeStandard$1.TAI),18),new LeapSecond(new JulianDate(2444239,43219,TimeStandard$1.TAI),19),new LeapSecond(new JulianDate(2444786,43220,TimeStandard$1.TAI),20),new LeapSecond(new JulianDate(2445151,43221,TimeStandard$1.TAI),21),new LeapSecond(new JulianDate(2445516,43222,TimeStandard$1.TAI),22),new LeapSecond(new JulianDate(2446247,43223,TimeStandard$1.TAI),23),new LeapSecond(new JulianDate(2447161,43224,TimeStandard$1.TAI),24),new LeapSecond(new JulianDate(2447892,43225,TimeStandard$1.TAI),25),new LeapSecond(new JulianDate(2448257,43226,TimeStandard$1.TAI),26),new LeapSecond(new JulianDate(2448804,43227,TimeStandard$1.TAI),27),new LeapSecond(new JulianDate(2449169,43228,TimeStandard$1.TAI),28),new LeapSecond(new JulianDate(2449534,43229,TimeStandard$1.TAI),29),new LeapSecond(new JulianDate(2450083,43230,TimeStandard$1.TAI),30),new LeapSecond(new JulianDate(2450630,43231,TimeStandard$1.TAI),31),new LeapSecond(new JulianDate(2451179,43232,TimeStandard$1.TAI),32),new LeapSecond(new JulianDate(2453736,43233,TimeStandard$1.TAI),33),new LeapSecond(new JulianDate(2454832,43234,TimeStandard$1.TAI),34),new LeapSecond(new JulianDate(2456109,43235,TimeStandard$1.TAI),35),new LeapSecond(new JulianDate(2457204,43236,TimeStandard$1.TAI),36),new LeapSecond(new JulianDate(2457754,43237,TimeStandard$1.TAI),37)],EarthOrientationParameters.NONE=freezeObject$1({getPromiseToLoad:function(){return when()},compute:function(e,t){return defined(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new EarthOrientationParametersSample(0,0,0,0,0),t}}),EarthOrientationParameters.prototype.getPromiseToLoad=function(){return when(this._downloadPromise)},EarthOrientationParameters.prototype.compute=function(e,t){if(defined(this._samples)){if(defined(t)||(t=new EarthOrientationParametersSample(0,0,0,0,0)),0===this._samples.length)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;var i=this._dates,r=this._lastIndex,n=0,a=0;if(defined(r)){var o=i[r],s=i[r+1],l=JulianDate.lessThanOrEquals(o,e),c=!defined(s),u=c||JulianDate.greaterThanOrEquals(s,e);if(l&&u)return n=r,!c&&s.equals(e)&&++n,a=n+1,interpolate(this,i,this._samples,e,n,a,t),t}var d=binarySearch(i,e,JulianDate.compare,this._dateColumn);return 0<=d?(d<i.length-1&&i[d+1].equals(e)&&++d,a=n=d):(n=(a=~d)-1)<0&&(n=0),this._lastIndex=n,interpolate(this,i,this._samples,e,n,a,t),t}if(defined(this._dataError))throw new RuntimeError(this._dataError)},HeadingPitchRoll.fromQuaternion=function(e,t){defined(t)||(t=new HeadingPitchRoll);var i=2*(e.w*e.y-e.z*e.x),r=1-2*(e.x*e.x+e.y*e.y),n=2*(e.w*e.x+e.y*e.z),a=1-2*(e.y*e.y+e.z*e.z),o=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(o,a),t.roll=Math.atan2(n,r),t.pitch=-CesiumMath.asinClamped(i),t},HeadingPitchRoll.fromDegrees=function(e,t,i,r){return defined(r)||(r=new HeadingPitchRoll),r.heading=e*CesiumMath.RADIANS_PER_DEGREE,r.pitch=t*CesiumMath.RADIANS_PER_DEGREE,r.roll=i*CesiumMath.RADIANS_PER_DEGREE,r},HeadingPitchRoll.clone=function(e,t){if(defined(e))return defined(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new HeadingPitchRoll(e.heading,e.pitch,e.roll)},HeadingPitchRoll.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll},HeadingPitchRoll.equalsEpsilon=function(e,t,i,r){return e===t||defined(e)&&defined(t)&&CesiumMath.equalsEpsilon(e.heading,t.heading,i,r)&&CesiumMath.equalsEpsilon(e.pitch,t.pitch,i,r)&&CesiumMath.equalsEpsilon(e.roll,t.roll,i,r)},HeadingPitchRoll.prototype.clone=function(e){return HeadingPitchRoll.clone(this,e)},HeadingPitchRoll.prototype.equals=function(e){return HeadingPitchRoll.equals(this,e)},HeadingPitchRoll.prototype.equalsEpsilon=function(e,t,i){return HeadingPitchRoll.equalsEpsilon(this,e,t,i)},HeadingPitchRoll.prototype.toString=function(){return"("+this.heading+", "+this.pitch+", "+this.roll+")"};var julianDateScratch=new JulianDate(0,0,TimeStandard$1.TAI),_supportsFullscreen;function getDaysSinceEpoch(e,t,i){var r=julianDateScratch;return r.dayNumber=t,r.secondsOfDay=i,JulianDate.daysDifference(r,e._sampleZeroDateTT)}function requestXysChunk(o,s){if(o._chunkDownloadsInProgress[s])return o._chunkDownloadsInProgress[s];var l=when.defer();o._chunkDownloadsInProgress[s]=l;var e=o._xysFileUrlTemplate;return when((defined(e)?e.getDerivedResource({templateValues:{0:s}}):new Resource({url:buildModuleUrl("Assets/IAU2006_XYS/IAU2006_XYS_"+s+".json")})).fetchJson(),function(e){o._chunkDownloadsInProgress[s]=!1;for(var t=o._samples,i=e.samples,r=s*o._samplesPerXysFile*3,n=0,a=i.length;n<a;++n)t[r+n]=i[n];l.resolve()}),l.promise}Iau2006XysData.prototype.preload=function(e,t,i,r){var n=getDaysSinceEpoch(this,e,t),a=getDaysSinceEpoch(this,i,r),o=n/this._stepSizeDays-this._interpolationOrder/2|0;o<0&&(o=0);var s=a/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;s>=this._totalSamples&&(s=this._totalSamples-1);for(var l=o/this._samplesPerXysFile|0,c=s/this._samplesPerXysFile|0,u=[],d=l;d<=c;++d)u.push(requestXysChunk(this,d));return when.all(u)},Iau2006XysData.prototype.computeXysRadians=function(e,t,i){var r=getDaysSinceEpoch(this,e,t);if(!(r<0)){var n=r/this._stepSizeDays|0;if(!(n>=this._totalSamples)){var a=this._interpolationOrder,o=n-(a/2|0);o<0&&(o=0);var s=o+a;s>=this._totalSamples&&(o=(s=this._totalSamples-1)-a)<0&&(o=0);var l=!1,c=this._samples;if(defined(c[3*o])||(requestXysChunk(this,o/this._samplesPerXysFile|0),l=!0),defined(c[3*s])||(requestXysChunk(this,s/this._samplesPerXysFile|0),l=!0),!l){defined(i)?(i.x=0,i.y=0,i.s=0):i=new Iau2006XysSample(0,0,0);var u,d,h=r-o*this._stepSizeDays,p=this._work,m=this._denominators,f=this._coef,g=this._xTable;for(u=0;u<=a;++u)p[u]=h-g[u];for(u=0;u<=a;++u){for(f[u]=1,d=0;d<=a;++d)d!==u&&(f[u]*=p[d]);f[u]*=m[u];var _=3*(o+u);i.x+=f[u]*c[_++],i.y+=f[u]*c[_++],i.s+=f[u]*c[_]}return i}}}};var _names={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},Fullscreen={},theNavigator,isChromeResult,chromeVersionResult,isSafariResult,safariVersionResult,isWebkitResult,webkitVersionResult,isInternetExplorerResult,internetExplorerVersionResult,isEdgeResult,edgeVersionResult,isFirefoxResult,firefoxVersionResult,isWindowsResult,hasPointerEvents,imageRenderingValueResult,supportsImageRenderingPixelatedResult;function extractVersion(e){for(var t=e.split("."),i=0,r=t.length;i<r;++i)t[i]=parseInt(t[i],10);return t}function isChrome(){if(!defined(isChromeResult)&&(isChromeResult=!1,!isEdge())){var e=/ Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isChromeResult=!0,chromeVersionResult=extractVersion(e[1]))}return isChromeResult}function chromeVersion(){return isChrome()&&chromeVersionResult}function isSafari(){if(!defined(isSafariResult)&&(isSafariResult=!1,!isChrome()&&!isEdge()&&/ Safari\/[\.0-9]+/.test(theNavigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isSafariResult=!0,safariVersionResult=extractVersion(e[1]))}return isSafariResult}function safariVersion(){return isSafari()&&safariVersionResult}function isWebkit(){if(!defined(isWebkitResult)){isWebkitResult=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);null!==e&&(isWebkitResult=!0,(webkitVersionResult=extractVersion(e[1])).isNightly=!!e[2])}return isWebkitResult}function webkitVersion(){return isWebkit()&&webkitVersionResult}function isInternetExplorer(){var e;defined(isInternetExplorerResult)||(isInternetExplorerResult=!1,"Microsoft Internet Explorer"===theNavigator.appName?null!==(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent))&&(isInternetExplorerResult=!0,internetExplorerVersionResult=extractVersion(e[1])):"Netscape"===theNavigator.appName&&null!==(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent))&&(isInternetExplorerResult=!0,internetExplorerVersionResult=extractVersion(e[1])));return isInternetExplorerResult}function internetExplorerVersion(){return isInternetExplorer()&&internetExplorerVersionResult}function isEdge(){if(!defined(isEdgeResult)){isEdgeResult=!1;var e=/ Edge\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isEdgeResult=!0,edgeVersionResult=extractVersion(e[1]))}return isEdgeResult}function edgeVersion(){return isEdge()&&edgeVersionResult}function isFirefox(){if(!defined(isFirefoxResult)){isFirefoxResult=!1;var e=/Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);null!==e&&(isFirefoxResult=!0,firefoxVersionResult=extractVersion(e[1]))}return isFirefoxResult}function isWindows(){return defined(isWindowsResult)||(isWindowsResult=/Windows/i.test(theNavigator.appVersion)),isWindowsResult}function firefoxVersion(){return isFirefox()&&firefoxVersionResult}function supportsPointerEvents(){return defined(hasPointerEvents)||(hasPointerEvents=!isFirefox()&&"undefined"!=typeof PointerEvent&&(!defined(theNavigator.pointerEnabled)||theNavigator.pointerEnabled)),hasPointerEvents}function supportsImageRenderingPixelated(){if(!defined(supportsImageRenderingPixelatedResult)){var e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");var t=e.style.imageRendering;(supportsImageRenderingPixelatedResult=defined(t)&&""!==t)&&(imageRenderingValueResult=t)}return supportsImageRenderingPixelatedResult}function imageRenderingValue(){return supportsImageRenderingPixelated()?imageRenderingValueResult:void 0}function supportsWebP(){return supportsWebP._result}defineProperties$1(Fullscreen,{element:{get:function(){if(Fullscreen.supportsFullscreen())return document[_names.fullscreenElement]}},changeEventName:{get:function(){if(Fullscreen.supportsFullscreen())return _names.fullscreenchange}},errorEventName:{get:function(){if(Fullscreen.supportsFullscreen())return _names.fullscreenerror}},enabled:{get:function(){if(Fullscreen.supportsFullscreen())return document[_names.fullscreenEnabled]}},fullscreen:{get:function(){if(Fullscreen.supportsFullscreen())return null!==Fullscreen.element}}}),Fullscreen.supportsFullscreen=function(){if(defined(_supportsFullscreen))return _supportsFullscreen;_supportsFullscreen=!1;var e=document.body;if("function"==typeof e.requestFullscreen)return _names.requestFullscreen="requestFullscreen",_names.exitFullscreen="exitFullscreen",_names.fullscreenEnabled="fullscreenEnabled",_names.fullscreenElement="fullscreenElement",_names.fullscreenchange="fullscreenchange",_names.fullscreenerror="fullscreenerror",_supportsFullscreen=!0;for(var t,i=["webkit","moz","o","ms","khtml"],r=0,n=i.length;r<n;++r){var a=i[r];"function"==typeof e[t=a+"RequestFullscreen"]?(_names.requestFullscreen=t,_supportsFullscreen=!0):"function"==typeof e[t=a+"RequestFullScreen"]&&(_names.requestFullscreen=t,_supportsFullscreen=!0),t=a+"ExitFullscreen","function"==typeof document[t]?_names.exitFullscreen=t:(t=a+"CancelFullScreen","function"==typeof document[t]&&(_names.exitFullscreen=t)),t=a+"FullscreenEnabled",void 0!==document[t]?_names.fullscreenEnabled=t:(t=a+"FullScreenEnabled",void 0!==document[t]&&(_names.fullscreenEnabled=t)),t=a+"FullscreenElement",void 0!==document[t]?_names.fullscreenElement=t:(t=a+"FullScreenElement",void 0!==document[t]&&(_names.fullscreenElement=t)),t=a+"fullscreenchange",void 0!==document["on"+t]&&("ms"===a&&(t="MSFullscreenChange"),_names.fullscreenchange=t),t=a+"fullscreenerror",void 0!==document["on"+t]&&("ms"===a&&(t="MSFullscreenError"),_names.fullscreenerror=t)}return _supportsFullscreen},Fullscreen.requestFullscreen=function(e,t){Fullscreen.supportsFullscreen()&&e[_names.requestFullscreen]({vrDisplay:t})},Fullscreen.exitFullscreen=function(){Fullscreen.supportsFullscreen()&&document[_names.exitFullscreen]()},Fullscreen._names=_names,theNavigator="undefined"!=typeof navigator?navigator:{},supportsWebP._promise=void 0,supportsWebP._result=void 0,supportsWebP.initialize=function(){if(defined(supportsWebP._promise))return supportsWebP._promise;var e=when.defer();if(supportsWebP._promise=e.promise,isEdge())return supportsWebP._result=!1,e.resolve(supportsWebP._result),e.promise;var t=new Image;return t.onload=function(){supportsWebP._result=0<t.width&&0<t.height,e.resolve(supportsWebP._result)},t.onerror=function(){supportsWebP._result=!1,e.resolve(supportsWebP._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.promise},defineProperties$1(supportsWebP,{initialized:{get:function(){return defined(supportsWebP._result)}}});var typedArrayTypes=[];"undefined"!=typeof ArrayBuffer&&(typedArrayTypes.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),"undefined"!=typeof Uint8ClampedArray&&typedArrayTypes.push(Uint8ClampedArray),"undefined"!=typeof CanvasPixelArray&&typedArrayTypes.push(CanvasPixelArray));var FeatureDetection={isChrome:isChrome,chromeVersion:chromeVersion,isSafari:isSafari,safariVersion:safariVersion,isWebkit:isWebkit,webkitVersion:webkitVersion,isInternetExplorer:isInternetExplorer,internetExplorerVersion:internetExplorerVersion,isEdge:isEdge,edgeVersion:edgeVersion,isFirefox:isFirefox,firefoxVersion:firefoxVersion,isWindows:isWindows,hardwareConcurrency:defaultValue(theNavigator.hardwareConcurrency,3),supportsPointerEvents:supportsPointerEvents,supportsImageRenderingPixelated:supportsImageRenderingPixelated,supportsWebP:supportsWebP,imageRenderingValue:imageRenderingValue,typedArrayTypes:typedArrayTypes};function Quaternion(e,t,i,r){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(i,0),this.w=defaultValue(r,0)}FeatureDetection.supportsFullscreen=function(){return Fullscreen.supportsFullscreen()},FeatureDetection.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},FeatureDetection.supportsWebWorkers=function(){return"undefined"!=typeof Worker},FeatureDetection.supportsWebAssembly=function(){return"undefined"!=typeof WebAssembly&&!FeatureDetection.isEdge()};var fromAxisAngleScratch=new Cartesian3;Quaternion.fromAxisAngle=function(e,t,i){var r=t/2,n=Math.sin(r),a=(fromAxisAngleScratch=Cartesian3.normalize(e,fromAxisAngleScratch)).x*n,o=fromAxisAngleScratch.y*n,s=fromAxisAngleScratch.z*n,l=Math.cos(r);return defined(i)?(i.x=a,i.y=o,i.z=s,i.w=l,i):new Quaternion(a,o,s,l)};var fromRotationMatrixNext=[1,2,0],fromRotationMatrixQuat=new Array(3);Quaternion.fromRotationMatrix=function(e,t){var i,r,n,a,o,s=e[Matrix3.COLUMN0ROW0],l=e[Matrix3.COLUMN1ROW1],c=e[Matrix3.COLUMN2ROW2],u=s+l+c;if(0<u)o=.5*(i=Math.sqrt(u+1)),i=.5/i,r=(e[Matrix3.COLUMN1ROW2]-e[Matrix3.COLUMN2ROW1])*i,n=(e[Matrix3.COLUMN2ROW0]-e[Matrix3.COLUMN0ROW2])*i,a=(e[Matrix3.COLUMN0ROW1]-e[Matrix3.COLUMN1ROW0])*i;else{var d=fromRotationMatrixNext,h=0;s<l&&(h=1),s<c&&l<c&&(h=2);var p=d[h],m=d[p];i=Math.sqrt(e[Matrix3.getElementIndex(h,h)]-e[Matrix3.getElementIndex(p,p)]-e[Matrix3.getElementIndex(m,m)]+1);var f=fromRotationMatrixQuat;f[h]=.5*i,i=.5/i,o=(e[Matrix3.getElementIndex(m,p)]-e[Matrix3.getElementIndex(p,m)])*i,f[p]=(e[Matrix3.getElementIndex(p,h)]+e[Matrix3.getElementIndex(h,p)])*i,f[m]=(e[Matrix3.getElementIndex(m,h)]+e[Matrix3.getElementIndex(h,m)])*i,r=-f[0],n=-f[1],a=-f[2]}return defined(t)?(t.x=r,t.y=n,t.z=a,t.w=o,t):new Quaternion(r,n,a,o)};var scratchHPRQuaternion=new Quaternion,scratchHeadingQuaternion=new Quaternion,scratchPitchQuaternion=new Quaternion,scratchRollQuaternion=new Quaternion;Quaternion.fromHeadingPitchRoll=function(e,t){return scratchRollQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_X,e.roll,scratchHPRQuaternion),scratchPitchQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-e.pitch,t),t=Quaternion.multiply(scratchPitchQuaternion,scratchRollQuaternion,scratchPitchQuaternion),scratchHeadingQuaternion=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e.heading,scratchHPRQuaternion),Quaternion.multiply(scratchHeadingQuaternion,t,t)};var sampledQuaternionAxis=new Cartesian3,sampledQuaternionRotation=new Cartesian3,sampledQuaternionTempQuaternion=new Quaternion,sampledQuaternionQuaternion0=new Quaternion,sampledQuaternionQuaternion0Conjugate=new Quaternion;Quaternion.packedLength=4,Quaternion.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i++]=e.z,t[i]=e.w,t},Quaternion.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Quaternion),i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i},Quaternion.packedInterpolationLength=3,Quaternion.convertPackedArrayForInterpolation=function(e,t,i,r){Quaternion.unpack(e,4*i,sampledQuaternionQuaternion0Conjugate),Quaternion.conjugate(sampledQuaternionQuaternion0Conjugate,sampledQuaternionQuaternion0Conjugate);for(var n=0,a=i-t+1;n<a;n++){var o=3*n;Quaternion.unpack(e,4*(t+n),sampledQuaternionTempQuaternion),Quaternion.multiply(sampledQuaternionTempQuaternion,sampledQuaternionQuaternion0Conjugate,sampledQuaternionTempQuaternion),sampledQuaternionTempQuaternion.w<0&&Quaternion.negate(sampledQuaternionTempQuaternion,sampledQuaternionTempQuaternion),Quaternion.computeAxis(sampledQuaternionTempQuaternion,sampledQuaternionAxis);var s=Quaternion.computeAngle(sampledQuaternionTempQuaternion);r[o]=sampledQuaternionAxis.x*s,r[1+o]=sampledQuaternionAxis.y*s,r[2+o]=sampledQuaternionAxis.z*s}},Quaternion.unpackInterpolationResult=function(e,t,i,r,n){defined(n)||(n=new Quaternion),Cartesian3.fromArray(e,0,sampledQuaternionRotation);var a=Cartesian3.magnitude(sampledQuaternionRotation);return Quaternion.unpack(t,4*r,sampledQuaternionQuaternion0),0===a?Quaternion.clone(Quaternion.IDENTITY,sampledQuaternionTempQuaternion):Quaternion.fromAxisAngle(sampledQuaternionRotation,a,sampledQuaternionTempQuaternion),Quaternion.multiply(sampledQuaternionTempQuaternion,sampledQuaternionQuaternion0,n)},Quaternion.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Quaternion(e.x,e.y,e.z,e.w)},Quaternion.conjugate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},Quaternion.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},Quaternion.magnitude=function(e){return Math.sqrt(Quaternion.magnitudeSquared(e))},Quaternion.normalize=function(e,t){var i=1/Quaternion.magnitude(e),r=e.x*i,n=e.y*i,a=e.z*i,o=e.w*i;return t.x=r,t.y=n,t.z=a,t.w=o,t},Quaternion.inverse=function(e,t){var i=Quaternion.magnitudeSquared(e);return t=Quaternion.conjugate(e,t),Quaternion.multiplyByScalar(t,1/i,t)},Quaternion.add=function(e,t,i){return i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i.w=e.w+t.w,i},Quaternion.subtract=function(e,t,i){return i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i.w=e.w-t.w,i},Quaternion.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},Quaternion.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},Quaternion.multiply=function(e,t,i){var r=e.x,n=e.y,a=e.z,o=e.w,s=t.x,l=t.y,c=t.z,u=t.w,d=o*s+r*u+n*c-a*l,h=o*l-r*c+n*u+a*s,p=o*c+r*l-n*s+a*u,m=o*u-r*s-n*l-a*c;return i.x=d,i.y=h,i.z=p,i.w=m,i},Quaternion.multiplyByScalar=function(e,t,i){return i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i.w=e.w*t,i},Quaternion.divideByScalar=function(e,t,i){return i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i.w=e.w/t,i},Quaternion.computeAxis=function(e,t){var i=e.w;if(Math.abs(i-1)<CesiumMath.EPSILON6)return t.x=t.y=t.z=0,t;var r=1/Math.sqrt(1-i*i);return t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t},Quaternion.computeAngle=function(e){return Math.abs(e.w-1)<CesiumMath.EPSILON6?0:2*Math.acos(e.w)};var lerpScratch$3=new Quaternion;Quaternion.lerp=function(e,t,i,r){return lerpScratch$3=Quaternion.multiplyByScalar(t,i,lerpScratch$3),r=Quaternion.multiplyByScalar(e,1-i,r),Quaternion.add(lerpScratch$3,r,r)};var slerpEndNegated=new Quaternion,slerpScaledP=new Quaternion,slerpScaledR=new Quaternion;Quaternion.slerp=function(e,t,i,r){var n=Quaternion.dot(e,t),a=t;if(n<0&&(n=-n,a=slerpEndNegated=Quaternion.negate(t,slerpEndNegated)),1-n<CesiumMath.EPSILON6)return Quaternion.lerp(e,a,i,r);var o=Math.acos(n);return slerpScaledP=Quaternion.multiplyByScalar(e,Math.sin((1-i)*o),slerpScaledP),slerpScaledR=Quaternion.multiplyByScalar(a,Math.sin(i*o),slerpScaledR),r=Quaternion.add(slerpScaledP,slerpScaledR,r),Quaternion.multiplyByScalar(r,1/Math.sin(o),r)},Quaternion.log=function(e,t){var i=CesiumMath.acosClamped(e.w),r=0;return 0!==i&&(r=i/Math.sin(i)),Cartesian3.multiplyByScalar(e,r,t)},Quaternion.exp=function(e,t){var i=Cartesian3.magnitude(e),r=0;return 0!==i&&(r=Math.sin(i)/i),t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t.w=Math.cos(i),t};var squadScratchCartesian0=new Cartesian3,squadScratchCartesian1=new Cartesian3,squadScratchQuaternion0=new Quaternion,squadScratchQuaternion1=new Quaternion;Quaternion.computeInnerQuadrangle=function(e,t,i,r){var n=Quaternion.conjugate(t,squadScratchQuaternion0);Quaternion.multiply(n,i,squadScratchQuaternion1);var a=Quaternion.log(squadScratchQuaternion1,squadScratchCartesian0);Quaternion.multiply(n,e,squadScratchQuaternion1);var o=Quaternion.log(squadScratchQuaternion1,squadScratchCartesian1);return Cartesian3.add(a,o,a),Cartesian3.multiplyByScalar(a,.25,a),Cartesian3.negate(a,a),Quaternion.exp(a,squadScratchQuaternion0),Quaternion.multiply(t,squadScratchQuaternion0,r)},Quaternion.squad=function(e,t,i,r,n,a){var o=Quaternion.slerp(e,t,n,squadScratchQuaternion0),s=Quaternion.slerp(i,r,n,squadScratchQuaternion1);return Quaternion.slerp(o,s,2*n*(1-n),a)};for(var fastSlerpScratchQuaternion=new Quaternion,opmu=1.9011074535173003,u=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],v=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],bT=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],bD=FeatureDetection.supportsTypedArrays()?new Float32Array(8):[],i=0;i<7;++i){var s=i+1,t=2*s+1;u[i]=1/(s*t),v[i]=s/t}u[7]=opmu/136,v[7]=8*opmu/17,Quaternion.fastSlerp=function(e,t,i,r){var n,a=Quaternion.dot(e,t);0<=a?n=1:(n=-1,a=-a);for(var o=a-1,s=1-i,l=i*i,c=s*s,d=7;0<=d;--d)bT[d]=(u[d]*l-v[d])*o,bD[d]=(u[d]*c-v[d])*o;var h=n*i*(1+bT[0]*(1+bT[1]*(1+bT[2]*(1+bT[3]*(1+bT[4]*(1+bT[5]*(1+bT[6]*(1+bT[7])))))))),p=s*(1+bD[0]*(1+bD[1]*(1+bD[2]*(1+bD[3]*(1+bD[4]*(1+bD[5]*(1+bD[6]*(1+bD[7])))))))),m=Quaternion.multiplyByScalar(e,p,fastSlerpScratchQuaternion);return Quaternion.multiplyByScalar(t,h,r),Quaternion.add(m,r,r)},Quaternion.fastSquad=function(e,t,i,r,n,a){var o=Quaternion.fastSlerp(e,t,n,squadScratchQuaternion0),s=Quaternion.fastSlerp(i,r,n,squadScratchQuaternion1);return Quaternion.fastSlerp(o,s,2*n*(1-n),a)},Quaternion.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},Quaternion.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(e.x-t.x)<=i&&Math.abs(e.y-t.y)<=i&&Math.abs(e.z-t.z)<=i&&Math.abs(e.w-t.w)<=i},Quaternion.ZERO=freezeObject$1(new Quaternion(0,0,0,0)),Quaternion.IDENTITY=freezeObject$1(new Quaternion(0,0,0,1)),Quaternion.prototype.clone=function(e){return Quaternion.clone(this,e)},Quaternion.prototype.equals=function(e){return Quaternion.equals(this,e)},Quaternion.prototype.equalsEpsilon=function(e,t){return Quaternion.equalsEpsilon(this,e,t)},Quaternion.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"};var Transforms={},vectorProductLocalFrame={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"}},degeneratePositionLocalFrame={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},localFrameToFixedFrameCache={},scratchCalculateCartesian={east:new Cartesian3,north:new Cartesian3,up:new Cartesian3,west:new Cartesian3,south:new Cartesian3,down:new Cartesian3},scratchFirstCartesian=new Cartesian3,scratchSecondCartesian=new Cartesian3,scratchThirdCartesian=new Cartesian3;Transforms.localFrameToFixedFrameGenerator=function(o,s){if(!vectorProductLocalFrame.hasOwnProperty(o)||!vectorProductLocalFrame[o].hasOwnProperty(s))throw new DeveloperError("firstAxis and secondAxis must be east, north, up, west, south or down.");var e,l=vectorProductLocalFrame[o][s],t=o+s;return defined(localFrameToFixedFrameCache[t])?e=localFrameToFixedFrameCache[t]:(e=function(e,t,i){if(defined(i)||(i=new Matrix4),CesiumMath.equalsEpsilon(e.x,0,CesiumMath.EPSILON14)&&CesiumMath.equalsEpsilon(e.y,0,CesiumMath.EPSILON14)){var r=CesiumMath.sign(e.z);Cartesian3.unpack(degeneratePositionLocalFrame[o],0,scratchFirstCartesian),"east"!==o&&"west"!==o&&Cartesian3.multiplyByScalar(scratchFirstCartesian,r,scratchFirstCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[s],0,scratchSecondCartesian),"east"!==s&&"west"!==s&&Cartesian3.multiplyByScalar(scratchSecondCartesian,r,scratchSecondCartesian),Cartesian3.unpack(degeneratePositionLocalFrame[l],0,scratchThirdCartesian),"east"!==l&&"west"!==l&&Cartesian3.multiplyByScalar(scratchThirdCartesian,r,scratchThirdCartesian)}else{(t=defaultValue(t,Ellipsoid.WGS84)).geodeticSurfaceNormal(e,scratchCalculateCartesian.up);var n=scratchCalculateCartesian.up,a=scratchCalculateCartesian.east;a.x=-e.y,a.y=e.x,a.z=0,Cartesian3.normalize(a,scratchCalculateCartesian.east),Cartesian3.cross(n,a,scratchCalculateCartesian.north),Cartesian3.multiplyByScalar(scratchCalculateCartesian.up,-1,scratchCalculateCartesian.down),Cartesian3.multiplyByScalar(scratchCalculateCartesian.east,-1,scratchCalculateCartesian.west),Cartesian3.multiplyByScalar(scratchCalculateCartesian.north,-1,scratchCalculateCartesian.south),scratchFirstCartesian=scratchCalculateCartesian[o],scratchSecondCartesian=scratchCalculateCartesian[s],scratchThirdCartesian=scratchCalculateCartesian[l]}return i[0]=scratchFirstCartesian.x,i[1]=scratchFirstCartesian.y,i[2]=scratchFirstCartesian.z,i[3]=0,i[4]=scratchSecondCartesian.x,i[5]=scratchSecondCartesian.y,i[6]=scratchSecondCartesian.z,i[7]=0,i[8]=scratchThirdCartesian.x,i[9]=scratchThirdCartesian.y,i[10]=scratchThirdCartesian.z,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},localFrameToFixedFrameCache[t]=e),e},Transforms.eastNorthUpToFixedFrame=Transforms.localFrameToFixedFrameGenerator("east","north"),Transforms.northEastDownToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","east"),Transforms.northUpEastToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","up"),Transforms.northWestUpToFixedFrame=Transforms.localFrameToFixedFrameGenerator("north","west");var scratchHPRQuaternion$1=new Quaternion,scratchScale$2=new Cartesian3(1,1,1),scratchHPRMatrix4=new Matrix4;Transforms.headingPitchRollToFixedFrame=function(e,t,i,r,n){r=defaultValue(r,Transforms.eastNorthUpToFixedFrame);var a=Quaternion.fromHeadingPitchRoll(t,scratchHPRQuaternion$1),o=Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO,a,scratchScale$2,scratchHPRMatrix4);return n=r(e,i,n),Matrix4.multiply(n,o,n)};var scratchENUMatrix4=new Matrix4,scratchHPRMatrix3=new Matrix3;Transforms.headingPitchRollQuaternion=function(e,t,i,r,n){var a=Transforms.headingPitchRollToFixedFrame(e,t,i,r,scratchENUMatrix4),o=Matrix4.getMatrix3(a,scratchHPRMatrix3);return Quaternion.fromRotationMatrix(o,n)};var noScale=new Cartesian3(1,1,1),hprCenterScratch=new Cartesian3,ffScratch=new Matrix4,hprTransformScratch=new Matrix4,hprRotationScratch=new Matrix3,hprQuaternionScratch=new Quaternion;Transforms.fixedFrameToHeadingPitchRoll=function(e,t,i,r){t=defaultValue(t,Ellipsoid.WGS84),i=defaultValue(i,Transforms.eastNorthUpToFixedFrame),defined(r)||(r=new HeadingPitchRoll);var n=Matrix4.getTranslation(e,hprCenterScratch);if(Cartesian3.equals(n,Cartesian3.ZERO))return r.heading=0,r.pitch=0,r.roll=0,r;var a=Matrix4.inverseTransformation(i(n,t,ffScratch),ffScratch),o=Matrix4.setScale(e,noScale,hprTransformScratch);o=Matrix4.setTranslation(o,Cartesian3.ZERO,o),a=Matrix4.multiply(a,o,a);var s=Quaternion.fromRotationMatrix(Matrix4.getMatrix3(a,hprRotationScratch),hprQuaternionScratch);return s=Quaternion.normalize(s,s),HeadingPitchRoll.fromQuaternion(s,r)};var gmstConstant0=24110.54841,gmstConstant1=8640184.812866,gmstConstant2=.093104,gmstConstant3=-62e-7,rateCoef=11772758384668e-32,wgs84WRPrecessing=72921158553e-15,twoPiOverSecondsInDay=CesiumMath.TWO_PI/86400,dateInUtc=new JulianDate;Transforms.computeTemeToPseudoFixedMatrix=function(e,t){var i,r=(dateInUtc=JulianDate.addSeconds(e,-JulianDate.computeTaiMinusUtc(e),dateInUtc)).dayNumber,n=dateInUtc.secondsOfDay,a=r-2451545;i=43200<=n?(.5+a)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY:(a-.5)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY;var o=(gmstConstant0+i*(gmstConstant1+i*(gmstConstant2+i*gmstConstant3)))*twoPiOverSecondsInDay%CesiumMath.TWO_PI+(wgs84WRPrecessing+rateCoef*(r-2451545.5))*((n+.5*TimeConstants$1.SECONDS_PER_DAY)%TimeConstants$1.SECONDS_PER_DAY),s=Math.cos(o),l=Math.sin(o);return defined(t)?(t[0]=s,t[1]=-l,t[2]=0,t[3]=l,t[4]=s,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Matrix3(s,l,0,-l,s,0,0,0,1)},Transforms.iau2006XysData=new Iau2006XysData,Transforms.earthOrientationParameters=EarthOrientationParameters.NONE;var ttMinusTai=32.184,j2000ttDays=2451545;Transforms.preloadIcrfFixed=function(e){var t=e.start.dayNumber,i=e.start.secondsOfDay+ttMinusTai,r=e.stop.dayNumber,n=e.stop.secondsOfDay+ttMinusTai,a=Transforms.iau2006XysData.preload(t,i,r,n),o=Transforms.earthOrientationParameters.getPromiseToLoad();return when.all([a,o])},Transforms.computeIcrfToFixedMatrix=function(e,t){defined(t)||(t=new Matrix3);var i=Transforms.computeFixedToIcrfMatrix(e,t);if(defined(i))return Matrix3.transpose(i,t)};var xysScratch=new Iau2006XysSample(0,0,0),eopScratch=new EarthOrientationParametersSample(0,0,0,0,0,0),rotation1Scratch=new Matrix3,rotation2Scratch=new Matrix3;Transforms.computeFixedToIcrfMatrix=function(e,t){defined(t)||(t=new Matrix3);var i=Transforms.earthOrientationParameters.compute(e,eopScratch);if(defined(i)){var r=e.dayNumber,n=e.secondsOfDay+ttMinusTai,a=Transforms.iau2006XysData.computeXysRadians(r,n,xysScratch);if(defined(a)){var o=a.x+i.xPoleOffset,s=a.y+i.yPoleOffset,l=1/(1+Math.sqrt(1-o*o-s*s)),c=rotation1Scratch;c[0]=1-l*o*o,c[3]=-l*o*s,c[6]=o,c[1]=-l*o*s,c[4]=1-l*s*s,c[7]=s,c[2]=-o,c[5]=-s,c[8]=1-l*(o*o+s*s);var u=Matrix3.fromRotationZ(-a.s,rotation2Scratch),d=Matrix3.multiply(c,u,rotation1Scratch),h=e.dayNumber-2451545,p=(e.secondsOfDay-JulianDate.computeTaiMinusUtc(e)+i.ut1MinusUtc)/TimeConstants$1.SECONDS_PER_DAY,m=.779057273264+p+.00273781191135448*(h+p);m=m%1*CesiumMath.TWO_PI;var f=Matrix3.fromRotationZ(m,rotation2Scratch),g=Matrix3.multiply(d,f,rotation1Scratch),_=Math.cos(i.xPoleWander),y=Math.cos(i.yPoleWander),v=Math.sin(i.xPoleWander),C=Math.sin(i.yPoleWander),S=r-j2000ttDays+n/TimeConstants$1.SECONDS_PER_DAY,x=-47e-6*(S/=36525)*CesiumMath.RADIANS_PER_DEGREE/3600,T=Math.cos(x),b=Math.sin(x),E=rotation2Scratch;return E[0]=_*T,E[1]=_*b,E[2]=v,E[3]=-y*b+C*v*T,E[4]=y*T+C*v*b,E[5]=-C*_,E[6]=-C*b-y*v*T,E[7]=C*T-y*v*b,E[8]=y*_,Matrix3.multiply(g,E,t)}}};var pointToWindowCoordinatesTemp=new Cartesian4;Transforms.pointToWindowCoordinates=function(e,t,i,r){return(r=Transforms.pointToGLWindowCoordinates(e,t,i,r)).y=2*t[5]-r.y,r},Transforms.pointToGLWindowCoordinates=function(e,t,i,r){defined(r)||(r=new Cartesian2);var n=pointToWindowCoordinatesTemp;return Matrix4.multiplyByVector(e,Cartesian4.fromElements(i.x,i.y,i.z,1,n),n),Cartesian4.multiplyByScalar(n,1/n.w,n),Matrix4.multiplyByVector(t,n,n),Cartesian2.fromCartesian4(n,r)};var normalScratch=new Cartesian3,rightScratch=new Cartesian3,upScratch=new Cartesian3;Transforms.rotationMatrixFromPositionVelocity=function(e,t,i,r){var n=defaultValue(i,Ellipsoid.WGS84).geodeticSurfaceNormal(e,normalScratch),a=Cartesian3.cross(t,n,rightScratch);Cartesian3.equalsEpsilon(a,Cartesian3.ZERO,CesiumMath.EPSILON6)&&(a=Cartesian3.clone(Cartesian3.UNIT_X,a));var o=Cartesian3.cross(a,t,upScratch);return Cartesian3.normalize(o,o),Cartesian3.cross(t,o,a),Cartesian3.negate(a,a),Cartesian3.normalize(a,a),defined(r)||(r=new Matrix3),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=a.x,r[4]=a.y,r[5]=a.z,r[6]=o.x,r[7]=o.y,r[8]=o.z,r};var swizzleMatrix=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),scratchCartographic=new Cartographic,scratchCartesian3Projection=new Cartesian3,scratchCenter=new Cartesian3,scratchRotation=new Matrix3,scratchFromENU=new Matrix4,scratchToENU=new Matrix4;Transforms.basisTo2D=function(e,t,i){var r=Matrix4.getTranslation(t,scratchCenter),n=e.ellipsoid,a=n.cartesianToCartographic(r,scratchCartographic),o=e.project(a,scratchCartesian3Projection);Cartesian3.fromElements(o.z,o.x,o.y,o);var s=Transforms.eastNorthUpToFixedFrame(r,n,scratchFromENU),l=Matrix4.inverseTransformation(s,scratchToENU),c=Matrix4.getMatrix3(t,scratchRotation),u=Matrix4.multiplyByMatrix3(l,c,i);return Matrix4.multiply(swizzleMatrix,u,i),Matrix4.setTranslation(i,o,i),i},Transforms.wgs84To2DModelMatrix=function(e,t,i){var r=e.ellipsoid,n=Transforms.eastNorthUpToFixedFrame(t,r,scratchFromENU),a=Matrix4.inverseTransformation(n,scratchToENU),o=r.cartesianToCartographic(t,scratchCartographic),s=e.project(o,scratchCartesian3Projection);Cartesian3.fromElements(s.z,s.x,s.y,s);var l=Matrix4.fromTranslation(s,scratchFromENU);return Matrix4.multiply(swizzleMatrix,a,i),Matrix4.multiply(l,i,i),i};var scratchCart4=new Cartesian4;function EllipsoidTangentPlane(e,t){e=(t=defaultValue(t,Ellipsoid.WGS84)).scaleToGeodeticSurface(e);var i=Transforms.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=Cartesian3.fromCartesian4(Matrix4.getColumn(i,0,scratchCart4)),this._yAxis=Cartesian3.fromCartesian4(Matrix4.getColumn(i,1,scratchCart4));var r=Cartesian3.fromCartesian4(Matrix4.getColumn(i,2,scratchCart4));this._plane=Plane.fromPointNormal(e,r)}defineProperties$1(EllipsoidTangentPlane.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}}});var tmp=new AxisAlignedBoundingBox;EllipsoidTangentPlane.fromPoints=function(e,t){return new EllipsoidTangentPlane(AxisAlignedBoundingBox.fromPoints(e,tmp).center,t)};var scratchProjectPointOntoPlaneRay=new Ray,scratchProjectPointOntoPlaneCartesian3=new Cartesian3;EllipsoidTangentPlane.prototype.projectPointOntoPlane=function(e,t){var i=scratchProjectPointOntoPlaneRay;i.origin=e,Cartesian3.normalize(e,i.direction);var r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3);if(defined(r)||(Cartesian3.negate(i.direction,i.direction),r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3)),defined(r)){var n=Cartesian3.subtract(r,this._origin,r),a=Cartesian3.dot(this._xAxis,n),o=Cartesian3.dot(this._yAxis,n);return defined(t)?(t.x=a,t.y=o,t):new Cartesian2(a,o)}},EllipsoidTangentPlane.prototype.projectPointsOntoPlane=function(e,t){defined(t)||(t=[]);for(var i=0,r=e.length,n=0;n<r;n++){var a=this.projectPointOntoPlane(e[n],t[i]);defined(a)&&(t[i]=a,i++)}return t.length=i,t},EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane=function(e,t){defined(t)||(t=new Cartesian2);var i=scratchProjectPointOntoPlaneRay;i.origin=e,Cartesian3.clone(this._plane.normal,i.direction);var r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3);defined(r)||(Cartesian3.negate(i.direction,i.direction),r=IntersectionTests.rayPlane(i,this._plane,scratchProjectPointOntoPlaneCartesian3));var n=Cartesian3.subtract(r,this._origin,r),a=Cartesian3.dot(this._xAxis,n),o=Cartesian3.dot(this._yAxis,n);return t.x=a,t.y=o,t},EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane=function(e,t){defined(t)||(t=[]);var i=e.length;t.length=i;for(var r=0;r<i;r++)t[r]=this.projectPointToNearestOnPlane(e[r],t[r]);return t};var projectPointsOntoEllipsoidScratch=new Cartesian3;function OrientedBoundingBox(e,t){this.center=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.halfAxes=Matrix3.clone(defaultValue(t,Matrix3.ZERO))}EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid=function(e,t){defined(t)||(t=new Cartesian3);var i=this._ellipsoid,r=this._origin,n=this._xAxis,a=this._yAxis,o=projectPointsOntoEllipsoidScratch;return Cartesian3.multiplyByScalar(n,e.x,o),t=Cartesian3.add(r,o,t),Cartesian3.multiplyByScalar(a,e.y,o),Cartesian3.add(t,o,t),i.scaleToGeocentricSurface(t,t),t},EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid=function(e,t){var i=e.length;defined(t)?t.length=i:t=new Array(i);for(var r=0;r<i;++r)t[r]=this.projectPointOntoEllipsoid(e[r],t[r]);return t},OrientedBoundingBox.packedLength=Cartesian3.packedLength+Matrix3.packedLength,OrientedBoundingBox.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e.center,t,i),Matrix3.pack(e.halfAxes,t,i+Cartesian3.packedLength),t},OrientedBoundingBox.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new OrientedBoundingBox),Cartesian3.unpack(e,t,i.center),Matrix3.unpack(e,t+Cartesian3.packedLength,i.halfAxes),i};var scratchCartesian1=new Cartesian3,scratchCartesian2=new Cartesian3,scratchCartesian3$1=new Cartesian3,scratchCartesian4=new Cartesian3,scratchCartesian5=new Cartesian3,scratchCartesian6=new Cartesian3,scratchCovarianceResult=new Matrix3,scratchEigenResult={unitary:new Matrix3,diagonal:new Matrix3};OrientedBoundingBox.fromPoints=function(e,t){if(defined(t)||(t=new OrientedBoundingBox),!defined(e)||0===e.length)return t.halfAxes=Matrix3.ZERO,t.center=Cartesian3.ZERO,t;var i,r=e.length,n=Cartesian3.clone(e[0],scratchCartesian1);for(i=1;i<r;i++)Cartesian3.add(n,e[i],n);var a=1/r;Cartesian3.multiplyByScalar(n,a,n);var o,s=0,l=0,c=0,u=0,d=0,h=0;for(i=0;i<r;i++)s+=(o=Cartesian3.subtract(e[i],n,scratchCartesian2)).x*o.x,l+=o.x*o.y,c+=o.x*o.z,u+=o.y*o.y,d+=o.y*o.z,h+=o.z*o.z;s*=a,l*=a,c*=a,u*=a,d*=a,h*=a;var p=scratchCovarianceResult;p[0]=s,p[1]=l,p[2]=c,p[3]=l,p[4]=u,p[5]=d,p[6]=c,p[7]=d,p[8]=h;var m=Matrix3.computeEigenDecomposition(p,scratchEigenResult),f=Matrix3.clone(m.unitary,t.halfAxes),g=Matrix3.getColumn(f,0,scratchCartesian4),_=Matrix3.getColumn(f,1,scratchCartesian5),y=Matrix3.getColumn(f,2,scratchCartesian6),v=-Number.MAX_VALUE,C=-Number.MAX_VALUE,S=-Number.MAX_VALUE,x=Number.MAX_VALUE,T=Number.MAX_VALUE,b=Number.MAX_VALUE;for(i=0;i<r;i++)o=e[i],v=Math.max(Cartesian3.dot(g,o),v),C=Math.max(Cartesian3.dot(_,o),C),S=Math.max(Cartesian3.dot(y,o),S),x=Math.min(Cartesian3.dot(g,o),x),T=Math.min(Cartesian3.dot(_,o),T),b=Math.min(Cartesian3.dot(y,o),b);g=Cartesian3.multiplyByScalar(g,.5*(x+v),g),_=Cartesian3.multiplyByScalar(_,.5*(T+C),_),y=Cartesian3.multiplyByScalar(y,.5*(b+S),y);var E=Cartesian3.add(g,_,t.center);Cartesian3.add(E,y,E);var P=scratchCartesian3$1;return P.x=v-x,P.y=C-T,P.z=S-b,Cartesian3.multiplyByScalar(P,.5,P),Matrix3.multiplyByScale(t.halfAxes,P,t.halfAxes),t};var scratchOffset=new Cartesian3,scratchScale$3=new Cartesian3;function fromTangentPlaneExtents(e,t,i,r,n,a,o,s){defined(s)||(s=new OrientedBoundingBox);var l=s.halfAxes;Matrix3.setColumn(l,0,e.xAxis,l),Matrix3.setColumn(l,1,e.yAxis,l),Matrix3.setColumn(l,2,e.zAxis,l);var c=scratchOffset;c.x=(t+i)/2,c.y=(r+n)/2,c.z=(a+o)/2;var u=scratchScale$3;u.x=(i-t)/2,u.y=(n-r)/2,u.z=(o-a)/2;var d=s.center;return c=Matrix3.multiplyByVector(l,c,c),Cartesian3.add(e.origin,c,d),Matrix3.multiplyByScale(l,u,l),s}var scratchRectangleCenterCartographic=new Cartographic,scratchRectangleCenter=new Cartesian3,perimeterCartographicScratch=[new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic],perimeterCartesianScratch=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3],perimeterProjectedScratch=[new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2];OrientedBoundingBox.fromRectangle=function(e,t,i,r,n){t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,Ellipsoid.WGS84);var a=Rectangle.center(e,scratchRectangleCenterCartographic),o=new EllipsoidTangentPlane(r.cartographicToCartesian(a,scratchRectangleCenter),r),s=o.plane,l=perimeterCartographicScratch[0],c=perimeterCartographicScratch[1],u=perimeterCartographicScratch[2],d=perimeterCartographicScratch[3],h=perimeterCartographicScratch[4],p=perimeterCartographicScratch[5],m=perimeterCartographicScratch[6],f=perimeterCartographicScratch[7],g=a.longitude,_=e.south<0&&0<e.north?0:a.latitude;m.latitude=p.latitude=h.latitude=e.south,f.latitude=d.latitude=_,l.latitude=c.latitude=u.latitude=e.north,m.longitude=f.longitude=l.longitude=e.west,p.longitude=c.longitude=g,h.longitude=d.longitude=u.longitude=e.east,u.height=c.height=l.height=f.height=m.height=p.height=h.height=d.height=i,r.cartographicArrayToCartesianArray(perimeterCartographicScratch,perimeterCartesianScratch),o.projectPointsToNearestOnPlane(perimeterCartesianScratch,perimeterProjectedScratch);var y=Math.min(perimeterProjectedScratch[6].x,perimeterProjectedScratch[7].x,perimeterProjectedScratch[0].x),v=Math.max(perimeterProjectedScratch[2].x,perimeterProjectedScratch[3].x,perimeterProjectedScratch[4].x),C=Math.min(perimeterProjectedScratch[4].y,perimeterProjectedScratch[5].y,perimeterProjectedScratch[6].y),S=Math.max(perimeterProjectedScratch[0].y,perimeterProjectedScratch[1].y,perimeterProjectedScratch[2].y);return u.height=l.height=h.height=m.height=t,r.cartographicArrayToCartesianArray(perimeterCartographicScratch,perimeterCartesianScratch),fromTangentPlaneExtents(o,y,v,C,S,Math.min(Plane.getPointDistance(s,perimeterCartesianScratch[0]),Plane.getPointDistance(s,perimeterCartesianScratch[2]),Plane.getPointDistance(s,perimeterCartesianScratch[4]),Plane.getPointDistance(s,perimeterCartesianScratch[6])),i,n)},OrientedBoundingBox.clone=function(e,t){if(defined(e))return defined(t)?(Cartesian3.clone(e.center,t.center),Matrix3.clone(e.halfAxes,t.halfAxes),t):new OrientedBoundingBox(e.center,e.halfAxes)},OrientedBoundingBox.intersectPlane=function(e,t){var i=e.center,r=t.normal,n=e.halfAxes,a=r.x,o=r.y,s=r.z,l=Math.abs(a*n[Matrix3.COLUMN0ROW0]+o*n[Matrix3.COLUMN0ROW1]+s*n[Matrix3.COLUMN0ROW2])+Math.abs(a*n[Matrix3.COLUMN1ROW0]+o*n[Matrix3.COLUMN1ROW1]+s*n[Matrix3.COLUMN1ROW2])+Math.abs(a*n[Matrix3.COLUMN2ROW0]+o*n[Matrix3.COLUMN2ROW1]+s*n[Matrix3.COLUMN2ROW2]),c=Cartesian3.dot(r,i)+t.distance;return c<=-l?Intersect$1.OUTSIDE:l<=c?Intersect$1.INSIDE:Intersect$1.INTERSECTING};var scratchCartesianU=new Cartesian3,scratchCartesianV=new Cartesian3,scratchCartesianW=new Cartesian3,scratchPPrime=new Cartesian3;OrientedBoundingBox.distanceSquaredTo=function(e,t){var i=Cartesian3.subtract(t,e.center,scratchOffset),r=e.halfAxes,n=Matrix3.getColumn(r,0,scratchCartesianU),a=Matrix3.getColumn(r,1,scratchCartesianV),o=Matrix3.getColumn(r,2,scratchCartesianW),s=Cartesian3.magnitude(n),l=Cartesian3.magnitude(a),c=Cartesian3.magnitude(o);Cartesian3.normalize(n,n),Cartesian3.normalize(a,a),Cartesian3.normalize(o,o);var u=scratchPPrime;u.x=Cartesian3.dot(i,n),u.y=Cartesian3.dot(i,a),u.z=Cartesian3.dot(i,o);var d,h=0;return u.x<-s?h+=(d=u.x+s)*d:u.x>s&&(h+=(d=u.x-s)*d),u.y<-l?h+=(d=u.y+l)*d:u.y>l&&(h+=(d=u.y-l)*d),u.z<-c?h+=(d=u.z+c)*d:u.z>c&&(h+=(d=u.z-c)*d),h};var scratchCorner=new Cartesian3,scratchToCenter=new Cartesian3;OrientedBoundingBox.computePlaneDistances=function(e,t,i,r){defined(r)||(r=new Interval);var n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=e.center,s=e.halfAxes,l=Matrix3.getColumn(s,0,scratchCartesianU),c=Matrix3.getColumn(s,1,scratchCartesianV),u=Matrix3.getColumn(s,2,scratchCartesianW),d=Cartesian3.add(l,c,scratchCorner);Cartesian3.add(d,u,d),Cartesian3.add(d,o,d);var h=Cartesian3.subtract(d,t,scratchToCenter),p=Cartesian3.dot(i,h);return n=Math.min(p,n),a=Math.max(p,a),Cartesian3.add(o,l,d),Cartesian3.add(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.add(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.add(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.add(d,c,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.add(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.add(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),Cartesian3.subtract(o,l,d),Cartesian3.subtract(d,c,d),Cartesian3.subtract(d,u,d),Cartesian3.subtract(d,t,h),p=Cartesian3.dot(i,h),n=Math.min(p,n),a=Math.max(p,a),r.start=n,r.stop=a,r};var scratchBoundingSphere$1=new BoundingSphere;OrientedBoundingBox.isOccluded=function(e,t){var i=BoundingSphere.fromOrientedBoundingBox(e,scratchBoundingSphere$1);return!t.isBoundingSphereVisible(i)},OrientedBoundingBox.prototype.intersectPlane=function(e){return OrientedBoundingBox.intersectPlane(this,e)},OrientedBoundingBox.prototype.distanceSquaredTo=function(e){return OrientedBoundingBox.distanceSquaredTo(this,e)},OrientedBoundingBox.prototype.computePlaneDistances=function(e,t,i){return OrientedBoundingBox.computePlaneDistances(this,e,t,i)},OrientedBoundingBox.prototype.isOccluded=function(e){return OrientedBoundingBox.isOccluded(this,e)},OrientedBoundingBox.equals=function(e,t){return e===t||defined(e)&&defined(t)&&Cartesian3.equals(e.center,t.center)&&Matrix3.equals(e.halfAxes,t.halfAxes)},OrientedBoundingBox.prototype.clone=function(e){return OrientedBoundingBox.clone(this,e)},OrientedBoundingBox.prototype.equals=function(e){return OrientedBoundingBox.equals(this,e)};var RIGHT_SHIFT=1/256,LEFT_SHIFT=256,AttributeCompression={octEncodeInRange:function(e,t,i){if(i.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),i.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var r=i.x,n=i.y;i.x=(1-Math.abs(n))*CesiumMath.signNotZero(r),i.y=(1-Math.abs(r))*CesiumMath.signNotZero(n)}return i.x=CesiumMath.toSNorm(i.x,t),i.y=CesiumMath.toSNorm(i.y,t),i},octEncode:function(e,t){return AttributeCompression.octEncodeInRange(e,255,t)}},octEncodeScratch=new Cartesian2,uint8ForceArray=new Uint8Array(1);function forceUint8(e){return uint8ForceArray[0]=e,uint8ForceArray[0]}AttributeCompression.octEncodeToCartesian4=function(e,t){return AttributeCompression.octEncodeInRange(e,65535,octEncodeScratch),t.x=forceUint8(octEncodeScratch.x*RIGHT_SHIFT),t.y=forceUint8(octEncodeScratch.x),t.z=forceUint8(octEncodeScratch.y*RIGHT_SHIFT),t.w=forceUint8(octEncodeScratch.y),t},AttributeCompression.octDecodeInRange=function(e,t,i,r){if(r.x=CesiumMath.fromSNorm(e,i),r.y=CesiumMath.fromSNorm(t,i),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){var n=r.x;r.x=(1-Math.abs(r.y))*CesiumMath.signNotZero(n),r.y=(1-Math.abs(n))*CesiumMath.signNotZero(r.y)}return Cartesian3.normalize(r,r)},AttributeCompression.octDecode=function(e,t,i){return AttributeCompression.octDecodeInRange(e,t,255,i)},AttributeCompression.octDecodeFromCartesian4=function(e,t){var i=e.x,r=e.y,n=e.z,a=e.w,o=i*LEFT_SHIFT+r,s=n*LEFT_SHIFT+a;return AttributeCompression.octDecodeInRange(o,s,65535,t)},AttributeCompression.octPackFloat=function(e){return 256*e.x+e.y};var scratchEncodeCart2=new Cartesian2;function zigZagDecode(e){return e>>1^-(1&e)}AttributeCompression.octEncodeFloat=function(e){return AttributeCompression.octEncode(e,scratchEncodeCart2),AttributeCompression.octPackFloat(scratchEncodeCart2)},AttributeCompression.octDecodeFloat=function(e,t){var i=e/256,r=Math.floor(i),n=256*(i-r);return AttributeCompression.octDecode(r,n,t)},AttributeCompression.octPack=function(e,t,i,r){var n=AttributeCompression.octEncodeFloat(e),a=AttributeCompression.octEncodeFloat(t),o=AttributeCompression.octEncode(i,scratchEncodeCart2);return r.x=65536*o.x+n,r.y=65536*o.y+a,r},AttributeCompression.octUnpack=function(e,t,i,r){var n=e.x/65536,a=Math.floor(n),o=65536*(n-a);n=e.y/65536;var s=Math.floor(n),l=65536*(n-s);AttributeCompression.octDecodeFloat(o,t),AttributeCompression.octDecodeFloat(l,i),AttributeCompression.octDecode(a,s,r)},AttributeCompression.compressTextureCoordinates=function(e){return 4096*(4095*e.x|0)+(4095*e.y|0)},AttributeCompression.decompressTextureCoordinates=function(e,t){var i=e/4096,r=Math.floor(i);return t.x=r/4095,t.y=(e-4096*r)/4095,t},AttributeCompression.zigZagDeltaDecode=function(e,t,i){for(var r=e.length,n=0,a=0,o=0,s=0;s<r;++s)n+=zigZagDecode(e[s]),a+=zigZagDecode(t[s]),e[s]=n,t[s]=a,defined(i)&&(o+=zigZagDecode(i[s]),i[s]=o)};var WebGLConstants={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_RGB_ETC1_WEBGL:36196,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},WebGLConstants$1=freezeObject$1(WebGLConstants),ComponentDatatype={BYTE:WebGLConstants$1.BYTE,UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,SHORT:WebGLConstants$1.SHORT,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,INT:WebGLConstants$1.INT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,FLOAT:WebGLConstants$1.FLOAT,DOUBLE:WebGLConstants$1.DOUBLE,getSizeInBytes:function(e){switch(e){case ComponentDatatype.BYTE:return Int8Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case ComponentDatatype.SHORT:return Int16Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case ComponentDatatype.INT:return Int32Array.BYTES_PER_ELEMENT;case ComponentDatatype.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case ComponentDatatype.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case ComponentDatatype.DOUBLE:return Float64Array.BYTES_PER_ELEMENT}},fromTypedArray:function(e){return e instanceof Int8Array?ComponentDatatype.BYTE:e instanceof Uint8Array?ComponentDatatype.UNSIGNED_BYTE:e instanceof Int16Array?ComponentDatatype.SHORT:e instanceof Uint16Array?ComponentDatatype.UNSIGNED_SHORT:e instanceof Int32Array?ComponentDatatype.INT:e instanceof Uint32Array?ComponentDatatype.UNSIGNED_INT:e instanceof Float32Array?ComponentDatatype.FLOAT:e instanceof Float64Array?ComponentDatatype.DOUBLE:void 0},validate:function(e){return defined(e)&&(e===ComponentDatatype.BYTE||e===ComponentDatatype.UNSIGNED_BYTE||e===ComponentDatatype.SHORT||e===ComponentDatatype.UNSIGNED_SHORT||e===ComponentDatatype.INT||e===ComponentDatatype.UNSIGNED_INT||e===ComponentDatatype.FLOAT||e===ComponentDatatype.DOUBLE)},createTypedArray:function(e,t){switch(e){case ComponentDatatype.BYTE:return new Int8Array(t);case ComponentDatatype.UNSIGNED_BYTE:return new Uint8Array(t);case ComponentDatatype.SHORT:return new Int16Array(t);case ComponentDatatype.UNSIGNED_SHORT:return new Uint16Array(t);case ComponentDatatype.INT:return new Int32Array(t);case ComponentDatatype.UNSIGNED_INT:return new Uint32Array(t);case ComponentDatatype.FLOAT:return new Float32Array(t);case ComponentDatatype.DOUBLE:return new Float64Array(t)}},createArrayBufferView:function(e,t,i,r){switch(i=defaultValue(i,0),r=defaultValue(r,(t.byteLength-i)/ComponentDatatype.getSizeInBytes(e)),e){case ComponentDatatype.BYTE:return new Int8Array(t,i,r);case ComponentDatatype.UNSIGNED_BYTE:return new Uint8Array(t,i,r);case ComponentDatatype.SHORT:return new Int16Array(t,i,r);case ComponentDatatype.UNSIGNED_SHORT:return new Uint16Array(t,i,r);case ComponentDatatype.INT:return new Int32Array(t,i,r);case ComponentDatatype.UNSIGNED_INT:return new Uint32Array(t,i,r);case ComponentDatatype.FLOAT:return new Float32Array(t,i,r);case ComponentDatatype.DOUBLE:return new Float64Array(t,i,r)}},fromName:function(e){switch(e){case"BYTE":return ComponentDatatype.BYTE;case"UNSIGNED_BYTE":return ComponentDatatype.UNSIGNED_BYTE;case"SHORT":return ComponentDatatype.SHORT;case"UNSIGNED_SHORT":return ComponentDatatype.UNSIGNED_SHORT;case"INT":return ComponentDatatype.INT;case"UNSIGNED_INT":return ComponentDatatype.UNSIGNED_INT;case"FLOAT":return ComponentDatatype.FLOAT;case"DOUBLE":return ComponentDatatype.DOUBLE}}},ComponentDatatype$1=freezeObject$1(ComponentDatatype),TerrainQuantization={NONE:0,BITS12:1},TerrainQuantization$1=freezeObject$1(TerrainQuantization),cartesian3Scratch=new Cartesian3,cartesian3DimScratch=new Cartesian3,cartesian2Scratch=new Cartesian2,matrix4Scratch=new Matrix4,matrix4Scratch2=new Matrix4,SHIFT_LEFT_12=Math.pow(2,12);function TerrainEncoding(e,t,i,r,n,a){var o,s,l,c=TerrainQuantization$1.NONE;if(defined(e)&&defined(t)&&defined(i)&&defined(r)){var u=e.minimum,d=e.maximum,h=Cartesian3.subtract(d,u,cartesian3DimScratch),p=i-t;c=Math.max(Cartesian3.maximumComponent(h),p)<SHIFT_LEFT_12-1?TerrainQuantization$1.BITS12:TerrainQuantization$1.NONE,o=e.center,s=Matrix4.inverseTransformation(r,new Matrix4);var m=Cartesian3.negate(u,cartesian3Scratch);Matrix4.multiply(Matrix4.fromTranslation(m,matrix4Scratch),s,s);var f=cartesian3Scratch;f.x=1/h.x,f.y=1/h.y,f.z=1/h.z,Matrix4.multiply(Matrix4.fromScale(f,matrix4Scratch),s,s),l=Matrix4.clone(r),Matrix4.setTranslation(l,Cartesian3.ZERO,l),r=Matrix4.clone(r,new Matrix4);var g=Matrix4.fromTranslation(u,matrix4Scratch),_=Matrix4.fromScale(h,matrix4Scratch2),y=Matrix4.multiply(g,_,matrix4Scratch);Matrix4.multiply(r,y,r),Matrix4.multiply(l,y,l)}this.quantization=c,this.minimumHeight=t,this.maximumHeight=i,this.center=o,this.toScaledENU=s,this.fromScaledENU=r,this.matrix=l,this.hasVertexNormals=n,this.hasWebMercatorT=defaultValue(a,!1)}TerrainEncoding.prototype.encode=function(e,t,i,r,n,a,o){var s=r.x,l=r.y;if(this.quantization===TerrainQuantization$1.BITS12){(i=Matrix4.multiplyByPoint(this.toScaledENU,i,cartesian3Scratch)).x=CesiumMath.clamp(i.x,0,1),i.y=CesiumMath.clamp(i.y,0,1),i.z=CesiumMath.clamp(i.z,0,1);var c=this.maximumHeight-this.minimumHeight,u=CesiumMath.clamp((n-this.minimumHeight)/c,0,1);Cartesian2.fromElements(i.x,i.y,cartesian2Scratch);var d=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);Cartesian2.fromElements(i.z,u,cartesian2Scratch);var h=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);Cartesian2.fromElements(s,l,cartesian2Scratch);var p=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);if(e[t++]=d,e[t++]=h,e[t++]=p,this.hasWebMercatorT){Cartesian2.fromElements(o,0,cartesian2Scratch);var m=AttributeCompression.compressTextureCoordinates(cartesian2Scratch);e[t++]=m}}else Cartesian3.subtract(i,this.center,cartesian3Scratch),e[t++]=cartesian3Scratch.x,e[t++]=cartesian3Scratch.y,e[t++]=cartesian3Scratch.z,e[t++]=n,e[t++]=s,e[t++]=l,this.hasWebMercatorT&&(e[t++]=o);return this.hasVertexNormals&&(e[t++]=AttributeCompression.octPackFloat(a)),t},TerrainEncoding.prototype.decodePosition=function(e,t,i){if(defined(i)||(i=new Cartesian3),t*=this.getStride(),this.quantization!==TerrainQuantization$1.BITS12)return i.x=e[t],i.y=e[t+1],i.z=e[t+2],Cartesian3.add(i,this.center,i);var r=AttributeCompression.decompressTextureCoordinates(e[t],cartesian2Scratch);i.x=r.x,i.y=r.y;var n=AttributeCompression.decompressTextureCoordinates(e[t+1],cartesian2Scratch);return i.z=n.x,Matrix4.multiplyByPoint(this.fromScaledENU,i,i)},TerrainEncoding.prototype.decodeTextureCoordinates=function(e,t,i){return defined(i)||(i=new Cartesian2),t*=this.getStride(),this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+2],i):Cartesian2.fromElements(e[t+4],e[t+5],i)},TerrainEncoding.prototype.decodeHeight=function(e,t){return t*=this.getStride(),this.quantization!==TerrainQuantization$1.BITS12?e[t+3]:AttributeCompression.decompressTextureCoordinates(e[t+1],cartesian2Scratch).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight},TerrainEncoding.prototype.decodeWebMercatorT=function(e,t){return t*=this.getStride(),this.quantization===TerrainQuantization$1.BITS12?AttributeCompression.decompressTextureCoordinates(e[t+3],cartesian2Scratch).x:e[t+6]},TerrainEncoding.prototype.getOctEncodedNormal=function(e,t,i){var r=e[t=(t+1)*this.getStride()-1]/256,n=Math.floor(r),a=256*(r-n);return Cartesian2.fromElements(n,a,i)},TerrainEncoding.prototype.getStride=function(){var e;switch(this.quantization){case TerrainQuantization$1.BITS12:e=3;break;default:e=6}return this.hasWebMercatorT&&++e,this.hasVertexNormals&&++e,e};var attributesNone={position3DAndHeight:0,textureCoordAndEncodedNormals:1},attributes={compressed0:0,compressed1:1};function WebMercatorProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}TerrainEncoding.prototype.getAttributes=function(e){var t,i=ComponentDatatype$1.FLOAT,r=ComponentDatatype$1.getSizeInBytes(i);if(this.quantization===TerrainQuantization$1.NONE){var n=2;return this.hasWebMercatorT&&++n,this.hasVertexNormals&&++n,t=(4+n)*r,[{index:attributesNone.position3DAndHeight,vertexBuffer:e,componentDatatype:i,componentsPerAttribute:4,offsetInBytes:0,strideInBytes:t},{index:attributesNone.textureCoordAndEncodedNormals,vertexBuffer:e,componentDatatype:i,componentsPerAttribute:n,offsetInBytes:4*r,strideInBytes:t}]}var a=3,o=0;return(this.hasWebMercatorT||this.hasVertexNormals)&&++a,this.hasWebMercatorT&&this.hasVertexNormals?(t=(a+ ++o)*r,[{index:attributes.compressed0,vertexBuffer:e,componentDatatype:i,componentsPerAttribute:a,offsetInBytes:0,strideInBytes:t},{index:attributes.compressed1,vertexBuffer:e,componentDatatype:i,componentsPerAttribute:o,offsetInBytes:a*r,strideInBytes:t}]):[{index:attributes.compressed0,vertexBuffer:e,componentDatatype:i,componentsPerAttribute:a}]},TerrainEncoding.prototype.getAttributeLocations=function(){return this.quantization===TerrainQuantization$1.NONE?attributesNone:attributes},TerrainEncoding.clone=function(e,t){return defined(t)||(t=new TerrainEncoding),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=Cartesian3.clone(e.center),t.toScaledENU=Matrix4.clone(e.toScaledENU),t.fromScaledENU=Matrix4.clone(e.fromScaledENU),t.matrix=Matrix4.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t},defineProperties$1(WebMercatorProjection.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),WebMercatorProjection.mercatorAngleToGeodeticLatitude=function(e){return CesiumMath.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},WebMercatorProjection.geodeticLatitudeToMercatorAngle=function(e){e>WebMercatorProjection.MaximumLatitude?e=WebMercatorProjection.MaximumLatitude:e<-WebMercatorProjection.MaximumLatitude&&(e=-WebMercatorProjection.MaximumLatitude);var t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},WebMercatorProjection.MaximumLatitude=WebMercatorProjection.mercatorAngleToGeodeticLatitude(Math.PI),WebMercatorProjection.prototype.project=function(e,t){var i=this._semimajorAxis,r=e.longitude*i,n=WebMercatorProjection.geodeticLatitudeToMercatorAngle(e.latitude)*i,a=e.height;return defined(t)?(t.x=r,t.y=n,t.z=a,t):new Cartesian3(r,n,a)},WebMercatorProjection.prototype.unproject=function(e,t){var i=this._oneOverSemimajorAxis,r=e.x*i,n=WebMercatorProjection.mercatorAngleToGeodeticLatitude(e.y*i),a=e.z;return defined(t)?(t.longitude=r,t.latitude=n,t.height=a,t):new Cartographic(r,n,a)};var HeightmapTessellator={};HeightmapTessellator.DEFAULT_STRUCTURE=freezeObject$1({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});var cartesian3Scratch$1=new Cartesian3,matrix4Scratch$1=new Matrix4,minimumScratch=new Cartesian3,maximumScratch=new Cartesian3;function returnTrue(){return!0}function destroyObject(e,t){function i(){}for(var r in e)"function"==typeof e[r]&&(e[r]=i);e.isDestroyed=returnTrue}function canTransferArrayBuffer(){if(!defined(TaskProcessor._canTransferArrayBuffer)){var r=new Worker(getWorkerUrl("Workers/transferTypedArrayTest.js"));r.postMessage=defaultValue(r.webkitPostMessage,r.postMessage);var e=new Int8Array([99]);try{r.postMessage({array:e},[e.buffer])}catch(e){return TaskProcessor._canTransferArrayBuffer=!1,TaskProcessor._canTransferArrayBuffer}var n=when.defer();r.onmessage=function(e){var t=e.data.array,i=defined(t)&&99===t[0];n.resolve(i),r.terminate(),TaskProcessor._canTransferArrayBuffer=i},TaskProcessor._canTransferArrayBuffer=n.promise}return TaskProcessor._canTransferArrayBuffer}HeightmapTessellator.computeVertices=function(e){var t,i,r,n,a=Math.cos,o=Math.sin,s=Math.sqrt,l=Math.atan,c=Math.exp,u=CesiumMath.PI_OVER_TWO,d=CesiumMath.toRadians,h=e.heightmap,p=e.width,m=e.height,f=e.skirtHeight,g=defaultValue(e.isGeographic,!0),_=defaultValue(e.ellipsoid,Ellipsoid.WGS84),y=1/_.maximumRadius,v=e.nativeRectangle,C=e.rectangle;n=defined(C)?(t=C.west,i=C.south,r=C.east,C.north):g?(t=d(v.west),i=d(v.south),r=d(v.east),d(v.north)):(t=v.west*y,i=u-2*l(c(-v.south*y)),r=v.east*y,u-2*l(c(-v.north*y)));var S=e.relativeToCenter,x=defined(S);S=x?S:Cartesian3.ZERO;var T=defaultValue(e.exaggeration,1),b=defaultValue(e.includeWebMercatorT,!1),E=defaultValue(e.structure,HeightmapTessellator.DEFAULT_STRUCTURE),P=defaultValue(E.heightScale,HeightmapTessellator.DEFAULT_STRUCTURE.heightScale),A=defaultValue(E.heightOffset,HeightmapTessellator.DEFAULT_STRUCTURE.heightOffset),w=defaultValue(E.elementsPerHeight,HeightmapTessellator.DEFAULT_STRUCTURE.elementsPerHeight),D=defaultValue(E.stride,HeightmapTessellator.DEFAULT_STRUCTURE.stride),M=defaultValue(E.elementMultiplier,HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier),I=defaultValue(E.isBigEndian,HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian),R=Rectangle.computeWidth(v),O=Rectangle.computeHeight(v),L=R/(p-1),F=O/(m-1);g||(R*=y,O*=y);var N,B,V=_.radiiSquared,k=V.x,$=V.y,z=V.z,U=65536,G=-65536,H=Transforms.eastNorthUpToFixedFrame(S,_),W=Matrix4.inverseTransformation(H,matrix4Scratch$1);b&&(N=WebMercatorProjection.geodeticLatitudeToMercatorAngle(i),B=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(n)-N));var q=minimumScratch;q.x=Number.POSITIVE_INFINITY,q.y=Number.POSITIVE_INFINITY,q.z=Number.POSITIVE_INFINITY;var j=maximumScratch;j.x=Number.NEGATIVE_INFINITY,j.y=Number.NEGATIVE_INFINITY,j.z=Number.NEGATIVE_INFINITY;var Y=Number.POSITIVE_INFINITY,X=p+(0<f?2:0),Q=m+(0<f?2:0),J=X*Q,Z=new Array(J),K=new Array(J),ee=new Array(J),te=b?new Array(J):[],ie=0,re=m,ne=0,ae=p;0<f&&(--ie,++re,--ne,++ae);for(var oe=0,se=ie;se<re;++se){var le=se;le<0&&(le=0),m<=le&&(le=m-1);var ce,ue=v.north-F*le,de=a(ue=g?d(ue):u-2*l(c(-ue*y))),he=o(ue),pe=z*he,me=(ue-i)/(n-i);me=CesiumMath.clamp(me,0,1),b&&(ce=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(ue)-N)*B);for(var fe=ne;fe<ae;++fe){var ge=fe;ge<0&&(ge=0),p<=ge&&(ge=p-1);var _e=v.west+L*ge;g?_e=d(_e):_e*=y;var ye,ve,Ce=le*(p*D)+ge*D;if(1===w)ye=h[Ce];else if(ye=0,I)for(ve=0;ve<w;++ve)ye=ye*M+h[Ce+ve];else for(ve=w-1;0<=ve;--ve)ye=ye*M+h[Ce+ve];ye=(ye*P+A)*T;var Se=(_e-t)/(r-t);if(Se=CesiumMath.clamp(Se,0,1),ee[oe]=new Cartesian2(Se,me),G=Math.max(G,ye),U=Math.min(U,ye),fe!==ge||se!==le){fe<0?_e-=1e-5*R:_e+=1e-5*R,se<0?ue+=1e-5*O:ue-=1e-5*O,de=a(ue),pe=z*(he=o(ue)),ye-=f}var xe=de*a(_e),Te=de*o(_e),be=k*xe,Ee=$*Te,Pe=1/s(be*xe+Ee*Te+pe*he),Ae=be*Pe,we=Ee*Pe,De=pe*Pe,Me=new Cartesian3;Me.x=Ae+xe*ye,Me.y=we+Te*ye,Me.z=De+he*ye,Z[oe]=Me,K[oe]=ye,b&&(te[oe]=ce),oe++,Matrix4.multiplyByPoint(W,Me,cartesian3Scratch$1),Cartesian3.minimumByComponent(cartesian3Scratch$1,q,q),Cartesian3.maximumByComponent(cartesian3Scratch$1,j,j),Y=Math.min(Y,ye)}}var Ie,Re,Oe=BoundingSphere.fromPoints(Z);defined(C)&&C.width<CesiumMath.PI_OVER_TWO+CesiumMath.EPSILON5&&(Ie=OrientedBoundingBox.fromRectangle(C,U,G,_)),x&&(Re=new EllipsoidalOccluder(_).computeHorizonCullingPoint(S,Z));for(var Le,Fe,Ne,Be,Ve=new TerrainEncoding(new AxisAlignedBoundingBox(q,j,S),Y,G,H,!1,b),ke=new Float32Array(J*Ve.getStride()),$e=0,ze=0;ze<J;++ze)$e=Ve.encode(ke,$e,Z[ze],ee[ze],K[ze],void 0,te[ze]);if(0<f){Be=[],Fe=[];for(var Ue=0;Ue<p;++Ue)Be.push(X+1+Ue),Fe.push(X*(Q-1)-2-Ue);Le=[],Ne=[];for(var Ge=0;Ge<m;++Ge)Ne.push((Ge+1)*X+p),Le.push((m-Ge)*X+1)}else{Be=[],Fe=[];for(var He=0;He<p;++He)Be.push(He),Fe.push(p*m-1-He);Le=[],Ne=[];for(var We=0;We<m;++We)Ne.push((We+1)*p-1),Le.push((m-We-1)*p)}return{vertices:ke,maximumHeight:G,minimumHeight:U,encoding:Ve,boundingSphere3D:Oe,orientedBoundingBox:Ie,occludeePointInScaledSpace:Re,westIndicesSouthToNorth:Le,southIndicesEastToWest:Fe,eastIndicesNorthToSouth:Ne,northIndicesWestToEast:Be}};var taskCompletedEvent=new Event,bootstrapperUrlResult;function completeTask(e,t){--e._activeTasks;var i=t.id;if(defined(i)){var r=e._deferreds,n=r[i];if(defined(t.error)){var a=t.error;"RuntimeError"===a.name?(a=new RuntimeError(t.error.message)).stack=t.error.stack:"DeveloperError"===a.name&&((a=new DeveloperError(t.error.message)).stack=t.error.stack),taskCompletedEvent.raiseEvent(a),n.reject(a)}else taskCompletedEvent.raiseEvent(),n.resolve(t.result);delete r[i]}}function getWorkerUrl(e){var t=buildModuleUrl(e);if(isCrossOriginUrl(t)){var i,r='importScripts("'+t+'");';try{i=new Blob([r],{type:"application/javascript"})}catch(e){var n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);n.append(r),i=n.getBlob("application/javascript")}t=(window.URL||window.webkitURL).createObjectURL(i)}return t}function getBootstrapperUrl(){return defined(bootstrapperUrlResult)||(bootstrapperUrlResult=getWorkerUrl("Workers/cesiumWorkerBootstrapper.js")),bootstrapperUrlResult}function createWorker(t){var e=new Worker(getBootstrapperUrl());e.postMessage=defaultValue(e.webkitPostMessage,e.postMessage);var i={loaderConfig:{paths:{Workers:buildModuleUrl("Workers")},baseUrl:buildModuleUrl.getCesiumBaseUrl().url},workerModule:TaskProcessor._workerModulePrefix+t._workerName};return e.postMessage(i),e.onmessage=function(e){completeTask(t,e.data)},e}function getWebAssemblyLoaderConfig(e,t){var i={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(FeatureDetection.supportsWebAssembly())return i.modulePath=buildModuleUrl(t.modulePath),i.wasmBinaryFile=buildModuleUrl(t.wasmBinaryFile),Resource.fetchArrayBuffer({url:i.wasmBinaryFile}).then(function(e){return i.wasmBinary=e,i});if(!defined(t.fallbackModulePath))throw new RuntimeError("This browser does not support Web Assembly, and no backup module was provided for "+e._workerName);return i.modulePath=buildModuleUrl(t.fallbackModulePath),when.resolve(i)}function TaskProcessor(e,t){this._workerName=e,this._maximumActiveTasks=defaultValue(t,5),this._activeTasks=0,this._deferreds={},this._nextID=0}var emptyTransferableObjectArray=[];function TerrainMesh(e,t,i,r,n,a,o,s,l,c,u,d,h,p,m){this.center=e,this.vertices=t,this.stride=defaultValue(s,6),this.indices=i,this.minimumHeight=r,this.maximumHeight=n,this.boundingSphere3D=a,this.occludeePointInScaledSpace=o,this.orientedBoundingBox=l,this.encoding=c,this.exaggeration=u,this.westIndicesSouthToNorth=d,this.southIndicesEastToWest=h,this.eastIndicesNorthToSouth=p,this.northIndicesWestToEast=m}function TerrainProvider(){DeveloperError.throwInstantiationError()}TaskProcessor.prototype.scheduleTask=function(r,n){if(defined(this._worker)||(this._worker=createWorker(this)),!(this._activeTasks>=this._maximumActiveTasks)){++this._activeTasks;var a=this;return when(canTransferArrayBuffer(),function(e){defined(n)?e||(n.length=0):n=emptyTransferableObjectArray;var t=a._nextID++,i=when.defer();return a._deferreds[t]=i,a._worker.postMessage({id:t,parameters:r,canTransferArrayBuffer:e},n),i.promise})}},TaskProcessor.prototype.initWebAssemblyModule=function(e){defined(this._worker)||(this._worker=createWorker(this));var n=when.defer(),a=this,o=this._worker;return getWebAssemblyLoaderConfig(this,e).then(function(r){return when(canTransferArrayBuffer(),function(e){var t,i=r.wasmBinary;defined(i)&&e&&(t=[i]),o.onmessage=function(e){o.onmessage=function(e){completeTask(a,e.data)},n.resolve(e.data)},o.postMessage({webAssemblyConfig:r},t)})}),n},TaskProcessor.prototype.isDestroyed=function(){return!1},TaskProcessor.prototype.destroy=function(){return defined(this._worker)&&this._worker.terminate(),destroyObject(this)},TaskProcessor.taskCompletedEvent=taskCompletedEvent,TaskProcessor._defaultWorkerModulePrefix="Workers/",TaskProcessor._workerModulePrefix=TaskProcessor._defaultWorkerModulePrefix,TaskProcessor._canTransferArrayBuffer=void 0,defineProperties$1(TerrainProvider.prototype,{errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},hasWaterMask:{get:DeveloperError.throwInstantiationError},hasVertexNormals:{get:DeveloperError.throwInstantiationError},availability:{get:DeveloperError.throwInstantiationError}});var regularGridIndexArrays=[];function HeightmapTerrainData(e){this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=defaultValue(e.childTileMask,15),this._encoding=defaultValue(e.encoding,HeightmapEncoding$1.NONE);var t=HeightmapTessellator.DEFAULT_STRUCTURE,i=e.structure;defined(i)?i!==t&&(i.heightScale=defaultValue(i.heightScale,t.heightScale),i.heightOffset=defaultValue(i.heightOffset,t.heightOffset),i.elementsPerHeight=defaultValue(i.elementsPerHeight,t.elementsPerHeight),i.stride=defaultValue(i.stride,t.stride),i.elementMultiplier=defaultValue(i.elementMultiplier,t.elementMultiplier),i.isBigEndian=defaultValue(i.isBigEndian,t.isBigEndian)):i=t,this._structure=i,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===HeightmapEncoding$1.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}TerrainProvider.getRegularGridIndices=function(e,t){var i=regularGridIndexArrays[e];defined(i)||(regularGridIndexArrays[e]=i=[]);var r=i[t];if(!defined(r)){r=e*t<CesiumMath.SIXTY_FOUR_KILOBYTES?i[t]=new Uint16Array((e-1)*(t-1)*6):i[t]=new Uint32Array((e-1)*(t-1)*6);for(var n=0,a=0,o=0;o<t-1;++o){for(var s=0;s<e-1;++s){var l=n,c=l+e,u=c+1,d=l+1;r[a++]=l,r[a++]=c,r[a++]=d,r[a++]=d,r[a++]=c,r[a++]=u,++n}++n}}return r},TerrainProvider.heightmapTerrainQuality=.25,TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,i){return 2*e.maximumRadius*Math.PI*TerrainProvider.heightmapTerrainQuality/(t*i)},TerrainProvider.prototype.requestTileGeometry=DeveloperError.throwInstantiationError,TerrainProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,TerrainProvider.prototype.getTileDataAvailable=DeveloperError.throwInstantiationError,TerrainProvider.prototype.loadTileDataAvailability=DeveloperError.throwInstantiationError,defineProperties$1(HeightmapTerrainData.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});var taskProcessor=new TaskProcessor("createVerticesFromHeightmap");function interpolateHeight(e,t,i,r,n,a,o,s,l,c){var u=(l-a.west)*(o-1)/(a.east-a.west),d=(c-a.south)*(s-1)/(a.north-a.south),h=0|u,p=h+1;o<=p&&(p=o-1,h=o-2);var m=0|d,f=m+1;return s<=f&&(f=s-1,m=s-2),f=s-1-f,triangleInterpolateHeight(u-h,d-m,getHeight(e,t,i,r,n,(m=s-1-m)*o+h),getHeight(e,t,i,r,n,m*o+p),getHeight(e,t,i,r,n,f*o+h),getHeight(e,t,i,r,n,f*o+p))}function interpolateMeshHeight(e,t,i,r,n,a,o,s,l,c,u){var d=(l-a.west)*(o-1)/(a.east-a.west),h=(c-a.south)*(s-1)/(a.north-a.south);0<n&&(d+=1,h+=1,o+=2,s+=2);var p=0|d,m=p+1;(0<n?o-1:o)<=m&&(m=o-1,p=o-2);var f=0|h,g=f+1;(0<n?s-1:s)<=g&&(g=s-1,f=s-2);var _=h-f;return f=s-1-f,g=s-1-g,triangleInterpolateHeight(d-p,_,(t.decodeHeight(e,f*o+p)/u-i)/r,(t.decodeHeight(e,f*o+m)/u-i)/r,(t.decodeHeight(e,g*o+p)/u-i)/r,(t.decodeHeight(e,g*o+m)/u-i)/r)}function triangleInterpolateHeight(e,t,i,r,n,a){return t<e?i+e*(r-i)+t*(a-r):i+e*(a-n)+t*(n-i)}function getHeight(e,t,i,r,n,a){a*=r;var o,s=0;if(n)for(o=0;o<t;++o)s=s*i+e[a+o];else for(o=t-1;0<=o;--o)s=s*i+e[a+o];return s}function setHeight(e,t,i,r,n,a,o,s){var l;if(o*=n,a)for(l=0;l<t-1;++l)e[o+l]=s/r|0,s-=e[o+l]*r,r/=i;else for(l=t-1;0<l;--l)e[o+l]=s/r|0,s-=e[o+l]*r,r/=i;e[o+l]=s}function TileAvailability(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}HeightmapTerrainData.prototype.createMesh=function(e,t,i,r,n){var a=e.ellipsoid,o=e.tileXYToNativeRectangle(t,i,r),s=e.tileXYToRectangle(t,i,r);n=defaultValue(n,1);var l=a.cartographicToCartesian(Rectangle.center(s)),c=this._structure,u=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,e.getNumberOfXTilesAtLevel(0))/(1<<r);this._skirtHeight=Math.min(4*u,1e3);var d=taskProcessor.scheduleTask({heightmap:this._buffer,structure:c,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:o,rectangle:s,relativeToCenter:l,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:e.projection instanceof GeographicProjection,exaggeration:n,encoding:this._encoding});if(defined(d)){var h=this;return when(d,function(e){return h._mesh=new TerrainMesh(l,new Float32Array(e.vertices),TerrainProvider.getRegularGridIndices(e.gridWidth,e.gridHeight),e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),n,e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),h._buffer=void 0,h._mesh})}},HeightmapTerrainData.prototype._createMeshSync=function(e,t,i,r,n){var a=e.ellipsoid,o=e.tileXYToNativeRectangle(t,i,r),s=e.tileXYToRectangle(t,i,r);n=defaultValue(n,1);var l=a.cartographicToCartesian(Rectangle.center(s)),c=this._structure,u=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,e.getNumberOfXTilesAtLevel(0))/(1<<r);this._skirtHeight=Math.min(4*u,1e3);var d=HeightmapTessellator.computeVertices({heightmap:this._buffer,structure:c,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:o,rectangle:s,relativeToCenter:l,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:e.projection instanceof GeographicProjection,exaggeration:n});this._buffer=void 0;var h=this._width,p=this._height;return 0<this._skirtHeight&&(h+=2,p+=2),new TerrainMesh(l,d.vertices,TerrainProvider.getRegularGridIndices(h,p),d.minimumHeight,d.maximumHeight,d.boundingSphere3D,d.occludeePointInScaledSpace,d.encoding.getStride(),d.orientedBoundingBox,d.encoding,n,d.westIndicesSouthToNorth,d.southIndicesEastToWest,d.eastIndicesNorthToSouth,d.northIndicesWestToEast)},HeightmapTerrainData.prototype.interpolateHeight=function(e,t,i){var r,n=this._width,a=this._height,o=this._structure,s=o.stride,l=o.elementsPerHeight,c=o.elementMultiplier,u=o.isBigEndian,d=o.heightOffset,h=o.heightScale;defined(this._mesh)?r=interpolateMeshHeight(this._mesh.vertices,this._mesh.encoding,d,h,this._skirtHeight,e,n,a,t,i,this._mesh.exaggeration):r=(r=interpolateHeight(this._buffer,l,c,s,u,e,n,a,t,i))*h+d;return r},HeightmapTerrainData.prototype.upsample=function(e,t,i,r,n,a,o){var s=this._mesh;if(defined(s)){for(var l=this._width,c=this._height,u=this._structure,d=this._skirtHeight,h=u.stride,p=new this._bufferType(l*c*h),m=s.vertices,f=s.encoding,g=e.tileXYToRectangle(t,i,r),_=e.tileXYToRectangle(n,a,o),y=u.heightOffset,v=u.heightScale,C=s.exaggeration,S=u.elementsPerHeight,x=u.elementMultiplier,T=u.isBigEndian,b=Math.pow(x,S-1),E=0;E<c;++E)for(var P=CesiumMath.lerp(_.north,_.south,E/(c-1)),A=0;A<l;++A){var w=interpolateMeshHeight(m,f,y,v,d,g,l,c,CesiumMath.lerp(_.west,_.east,A/(l-1)),P,C);setHeight(p,S,x,b,h,T,E*l+A,w=(w=w<u.lowestEncodedHeight?u.lowestEncodedHeight:w)>u.highestEncodedHeight?u.highestEncodedHeight:w)}return new HeightmapTerrainData({buffer:p,width:l,height:c,childTileMask:0,structure:this._structure,createdByUpsampling:!0})}},HeightmapTerrainData.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!=(this._childTileMask&1<<n)},HeightmapTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var rectangleScratch=new Rectangle;function findNode(e,t,i,r){for(var n=r.length,a=0;a<n;++a){var o=r[a];if(o.x===t&&o.y===i&&o.level===e)return!0}return!1}TileAvailability.prototype.addAvailableTileRange=function(e,t,i,r,n){var a=this._tilingScheme,o=this._rootNodes;if(0===e)for(var s=i;s<=n;++s)for(var l=t;l<=r;++l)findNode(e,l,s,o)||o.push(new QuadtreeNode(a,void 0,0,l,s));a.tileXYToRectangle(t,i,e,rectangleScratch);var c=rectangleScratch.west,u=rectangleScratch.north;a.tileXYToRectangle(r,n,e,rectangleScratch);for(var d=rectangleScratch.east,h=new RectangleWithLevel(e,c,rectangleScratch.south,d,u),p=0;p<o.length;++p){var m=o[p];rectanglesOverlap(m.extent,h)&&putRectangleInQuadtree(this._maximumLevel,m,h)}},TileAvailability.prototype.computeMaximumLevelAtPosition=function(e){for(var t,i=0;i<this._rootNodes.length;++i){var r=this._rootNodes[i];if(rectangleContainsPosition(r.extent,e)){t=r;break}}return defined(t)?findMaxLevelFromNode(void 0,t,e):-1};var rectanglesScratch=[],remainingToCoverByLevelScratch=[],westScratch=new Rectangle,eastScratch=new Rectangle;TileAvailability.prototype.computeBestAvailableLevelOverRectangle=function(e){var t=rectanglesScratch;t.length=0,e.east<e.west?(t.push(Rectangle.fromRadians(-Math.PI,e.south,e.east,e.north,westScratch)),t.push(Rectangle.fromRadians(e.west,e.south,Math.PI,e.north,eastScratch))):t.push(e);var i,r=remainingToCoverByLevelScratch;for(i=r.length=0;i<this._rootNodes.length;++i)updateCoverageWithNode(r,this._rootNodes[i],t);for(i=r.length-1;0<=i;--i)if(defined(r[i])&&0===r[i].length)return i;return 0};var cartographicScratch=new Cartographic;function QuadtreeNode(e,t,i,r,n){this.tilingScheme=e,this.parent=t,this.level=i,this.x=r,this.y=n,this.extent=e.tileXYToRectangle(r,n,i),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}function RectangleWithLevel(e,t,i,r,n){this.level=e,this.west=t,this.south=i,this.east=r,this.north=n}function rectanglesOverlap(e,t){var i=Math.max(e.west,t.west),r=Math.max(e.south,t.south),n=Math.min(e.east,t.east);return r<Math.min(e.north,t.north)&&i<n}function putRectangleInQuadtree(e,t,i){for(;t.level<e;)if(rectangleFullyContainsRectangle(t.nw.extent,i))t=t.nw;else if(rectangleFullyContainsRectangle(t.ne.extent,i))t=t.ne;else if(rectangleFullyContainsRectangle(t.sw.extent,i))t=t.sw;else{if(!rectangleFullyContainsRectangle(t.se.extent,i))break;t=t.se}if(0===t.rectangles.length||t.rectangles[t.rectangles.length-1].level<=i.level)t.rectangles.push(i);else{var r=binarySearch(t.rectangles,i.level,rectangleLevelComparator);r<=0&&(r=~r),t.rectangles.splice(r,0,i)}}function rectangleLevelComparator(e,t){return e.level-t}function rectangleFullyContainsRectangle(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function rectangleContainsPosition(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function findMaxLevelFromNode(e,t,i){for(var r=0,n=!1;!n;){var a=t._nw&&rectangleContainsPosition(t._nw.extent,i),o=t._ne&&rectangleContainsPosition(t._ne.extent,i),s=t._sw&&rectangleContainsPosition(t._sw.extent,i),l=t._se&&rectangleContainsPosition(t._se.extent,i);if(1<a+o+s+l){a&&(r=Math.max(r,findMaxLevelFromNode(t,t._nw,i))),o&&(r=Math.max(r,findMaxLevelFromNode(t,t._ne,i))),s&&(r=Math.max(r,findMaxLevelFromNode(t,t._sw,i))),l&&(r=Math.max(r,findMaxLevelFromNode(t,t._se,i)));break}a?t=t._nw:o?t=t._ne:s?t=t._sw:l?t=t._se:n=!0}for(;t!==e;){for(var c=t.rectangles,u=c.length-1;0<=u&&c[u].level>r;--u){var d=c[u];rectangleContainsPosition(d,i)&&(r=d.level)}t=t.parent}return r}function updateCoverageWithNode(e,t,i){if(t){var r,n=!1;for(r=0;r<i.length;++r)n=n||rectanglesOverlap(t.extent,i[r]);if(n){var a=t.rectangles;for(r=0;r<a.length;++r){var o=a[r];e[o.level]||(e[o.level]=i),e[o.level]=subtractRectangle(e[o.level],o)}updateCoverageWithNode(e,t._nw,i),updateCoverageWithNode(e,t._ne,i),updateCoverageWithNode(e,t._sw,i),updateCoverageWithNode(e,t._se,i)}}}function subtractRectangle(e,t){for(var i=[],r=0;r<e.length;++r){var n=e[r];rectanglesOverlap(n,t)?(n.west<t.west&&i.push(new Rectangle(n.west,n.south,t.west,n.north)),n.east>t.east&&i.push(new Rectangle(t.east,n.south,n.east,n.north)),n.south<t.south&&i.push(new Rectangle(Math.max(t.west,n.west),n.south,Math.min(t.east,n.east),t.south)),n.north>t.north&&i.push(new Rectangle(Math.max(t.west,n.west),t.north,Math.min(t.east,n.east),n.north))):i.push(n)}return i}function formatError(e){var t,i=e.name,r=e.message;t=defined(i)&&defined(r)?i+": "+r:e.toString();var n=e.stack;return defined(n)&&(t+="\n"+n),t}function TileProviderError(e,t,i,r,n,a,o){this.provider=e,this.message=t,this.x=i,this.y=r,this.level=n,this.timesRetried=defaultValue(a,0),this.retry=!1,this.error=o}function WebMercatorTilingScheme(e){if(e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._numberOfLevelZeroTilesX=defaultValue(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=defaultValue(e.numberOfLevelZeroTilesY,1),this._projection=new WebMercatorProjection(this._ellipsoid),defined(e.rectangleSouthwestInMeters)&&defined(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{var t=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new Cartesian2(-t,-t),this._rectangleNortheastInMeters=new Cartesian2(t,t)}var i=this._projection.unproject(this._rectangleSouthwestInMeters),r=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new Rectangle(i.longitude,i.latitude,r.longitude,r.latitude)}TileAvailability.prototype.isTileAvailable=function(e,t,i){var r=this._tilingScheme.tileXYToRectangle(t,i,e,rectangleScratch);return Rectangle.center(r,cartographicScratch),this.computeMaximumLevelAtPosition(cartographicScratch)>=e},TileAvailability.prototype.computeChildMaskForTile=function(e,t,i){var r=e+1;if(r>=this._maximumLevel)return 0;var n=0;return n|=this.isTileAvailable(r,2*t,2*i+1)?1:0,n|=this.isTileAvailable(r,2*t+1,2*i+1)?2:0,n|=this.isTileAvailable(r,2*t,2*i)?4:0,n|=this.isTileAvailable(r,2*t+1,2*i)?8:0},defineProperties$1(QuadtreeNode.prototype,{nw:{get:function(){return this._nw||(this._nw=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x,2*this.y)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x,2*this.y+1)),this._sw}},se:{get:function(){return this._se||(this._se=new QuadtreeNode(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y+1)),this._se}}}),TileProviderError.handleError=function(e,t,i,r,n,a,o,s,l){var c=e;return defined(e)?(c.provider=t,c.message=r,c.x=n,c.y=a,c.level=o,c.retry=!1,c.error=l,++c.timesRetried):c=new TileProviderError(t,r,n,a,o,0,l),0<i.numberOfListeners?i.raiseEvent(c):console.log('An error occurred in "'+t.constructor.name+'": '+formatError(r)),c.retry&&defined(s)&&s(),c},TileProviderError.handleSuccess=function(e){defined(e)&&(e.timesRetried=-1)},defineProperties$1(WebMercatorTilingScheme.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),WebMercatorTilingScheme.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},WebMercatorTilingScheme.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},WebMercatorTilingScheme.prototype.rectangleToNativeRectangle=function(e,t){var i=this._projection,r=i.project(Rectangle.southwest(e)),n=i.project(Rectangle.northeast(e));return defined(t)?(t.west=r.x,t.south=r.y,t.east=n.x,t.north=n.y,t):new Rectangle(r.x,r.y,n.x,n.y)},WebMercatorTilingScheme.prototype.tileXYToNativeRectangle=function(e,t,i,r){var n=this.getNumberOfXTilesAtLevel(i),a=this.getNumberOfYTilesAtLevel(i),o=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/n,s=this._rectangleSouthwestInMeters.x+e*o,l=this._rectangleSouthwestInMeters.x+(e+1)*o,c=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/a,u=this._rectangleNortheastInMeters.y-t*c,d=this._rectangleNortheastInMeters.y-(t+1)*c;return defined(r)?(r.west=s,r.south=d,r.east=l,r.north=u,r):new Rectangle(s,d,l,u)},WebMercatorTilingScheme.prototype.tileXYToRectangle=function(e,t,i,r){var n=this.tileXYToNativeRectangle(e,t,i,r),a=this._projection,o=a.unproject(new Cartesian2(n.west,n.south)),s=a.unproject(new Cartesian2(n.east,n.north));return n.west=o.longitude,n.south=o.latitude,n.east=s.longitude,n.north=s.latitude,n},WebMercatorTilingScheme.prototype.positionToTileXY=function(e,t,i){var r=this._rectangle;if(Rectangle.contains(r,e)){var n=this.getNumberOfXTilesAtLevel(t),a=this.getNumberOfYTilesAtLevel(t),o=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/n,s=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/a,l=this._projection.project(e),c=(l.x-this._rectangleSouthwestInMeters.x)/o|0;n<=c&&(c=n-1);var u=(this._rectangleNortheastInMeters.y-l.y)/s|0;return a<=u&&(u=a-1),defined(i)?(i.x=c,i.y=u,i):new Cartesian2(c,u)}};var ALL_CHILDREN=15;function ArcGISTiledElevationTerrainProvider(e){this._resource=void 0,this._credit=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._maxLevel=void 0,this._terrainDataStructure=void 0,this._ready=!1,this._width=void 0,this._height=void 0,this._encoding=void 0;var i=e.token;this._hasAvailability=!1,this._tilesAvailable=void 0,this._tilesAvailablityLoaded=void 0,this._availableCache={};var s=this,l=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._readyPromise=when(e.url).then(function(e){var t=Resource.createIfNeeded(e);return t.appendForwardSlash(),defined(i)&&(t=t.getDerivedResource({queryParameters:{token:i}})),(s._resource=t).getDerivedResource({queryParameters:{f:"pjson"}}).fetchJson()}).then(function(e){var t=e.copyrightText;defined(t)&&(s._credit=new Credit(t));var i=e.spatialReference,r=defaultValue(i.latestWkid,i.wkid),n=e.extent,a={ellipsoid:l};if(4326===r)a.rectangle=Rectangle.fromDegrees(n.xmin,n.ymin,n.xmax,n.ymax),s._tilingScheme=new GeographicTilingScheme(a);else{if(3857!==r)return when.reject(new RuntimeError("Invalid spatial reference"));a.rectangleSouthwestInMeters=new Cartesian2(n.xmin,n.ymin),a.rectangleNortheastInMeters=new Cartesian2(n.xmax,n.ymax),s._tilingScheme=new WebMercatorTilingScheme(a)}var o=e.tileInfo;return defined(o)?(s._width=o.rows+1,s._height=o.cols+1,s._encoding="LERC"===o.format?HeightmapEncoding$1.LERC:HeightmapEncoding$1.NONE,s._lodCount=o.lods.length-1,(s._hasAvailability=-1!==e.capabilities.indexOf("Tilemap"))&&(s._tilesAvailable=new TileAvailability(s._tilingScheme,s._lodCount),s._tilesAvailable.addAvailableTileRange(0,0,0,s._tilingScheme.getNumberOfXTilesAtLevel(0),s._tilingScheme.getNumberOfYTilesAtLevel(0)),s._tilesAvailablityLoaded=new TileAvailability(s._tilingScheme,s._lodCount)),s._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(s._tilingScheme.ellipsoid,s._width,s._tilingScheme.getNumberOfXTilesAtLevel(0)),1<e.bandCount&&console.log("ArcGISTiledElevationTerrainProvider: Terrain data has more than 1 band. Using the first one."),s._terrainDataStructure={elementMultiplier:1,lowestEncodedHeight:e.minValues[0],highestEncodedHeight:e.maxValues[0]},s._ready=!0):when.reject(new RuntimeError("tileInfo is required"))}).otherwise(function(e){var t="An error occurred while accessing "+s._resource.url+".";return TileProviderError.handleError(void 0,s,s._errorEvent,t),when.reject(e)}),this._errorEvent=new Event}function isTileAvailable(e,t,i,r){if(e._hasAvailability){var n=e._tilesAvailablityLoaded,a=e._tilesAvailable;return!(t>e._lodCount)&&(!!a.isTileAvailable(t,i,r)||!n.isTileAvailable(t,i,r)&&void 0)}}function findRange(e,t,i,r){for(var n=t-1,a=i-1,o=r[e.y*t+e.x],s=[],l={startX:e.x,startY:e.y,endX:0,endY:0},c=new Cartesian2(e.x+1,e.y+1),u=!1,d=!1;!u||!d;){var h=c.x,p=d?c.y+1:c.y;if(!u){for(var m=e.y;m<p;++m)if(r[m*t+c.x]!==o){u=!0;break}u?(s.push(new Cartesian2(c.x,e.y)),--c.x,--h,l.endX=c.x):c.x===n?(l.endX=c.x,u=!0):++c.x}if(!d){for(var f=c.y*t,g=e.x;g<=h;++g)if(r[f+g]!==o){d=!0;break}d?(s.push(new Cartesian2(e.x,c.y)),--c.y,l.endY=c.y):c.y===a?(l.endY=c.y,d=!0):++c.y}}return{endingIndices:s,range:l,value:o}}function computeAvailability(e,t,i,r,n){var a=[];if(n.every(function(e){return e===n[0]}))return 1===n[0]&&a.push({startX:e,startY:t,endX:e+i-1,endY:t+r-1}),a;for(var o=[new Cartesian2(0,0)];0<o.length;){var s=findRange(o.pop(),i,r,n);if(1===s.value){var l=s.range;l.startX+=e,l.endX+=e,l.startY+=t,l.endY+=t,a.push(l)}var c=s.endingIndices;0<c.length&&(o=o.concat(c))}return a}function requestAvailability(a,o,s,l){if(!a._hasAvailability)return{};var c=128*Math.floor(s/128),u=128*Math.floor(l/128),d=Math.min(1<<o,128),t="tilemap/"+o+"/"+u+"/"+c+"/"+d+"/"+d,i=a._availableCache;if(defined(i[t]))return i[t];var e=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TERRAIN}),r=a._resource.getDerivedResource({url:t,request:e}).fetchJson();return defined(r)?(r=r.then(function(e){var t=computeAvailability(c,u,d,d,e.data);a._tilesAvailablityLoaded.addAvailableTileRange(c,u,c+d,u+d);for(var i=a._tilesAvailable,r=0;r<t.length;++r){var n=t[r];i.addAvailableTileRange(o,n.startX,n.startY,n.endX,n.endY)}return isTileAvailable(a,o,s,l)}),i[t]={promise:r,request:e},{promise:r=r.always(function(e){return delete i[t],e}),request:e}):{}}defineProperties$1(ArcGISTiledElevationTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}}}),ArcGISTiledElevationTerrainProvider.prototype.requestTileGeometry=function(t,i,r,n){var a,e=this._resource.getDerivedResource({url:"tile/"+r+"/"+i+"/"+t,request:n}),o=this._hasAvailability,s=when.resolve(!0);if(o&&!defined(isTileAvailable(this,r+1,2*t,2*i))){var l=requestAvailability(this,r+1,2*t,2*i);s=l.promise,a=l.request}var c=e.fetchArrayBuffer();if(defined(c)&&defined(s)){var u=this,d=this._tilesAvailable;return when.join(c,s).then(function(e){return new HeightmapTerrainData({buffer:e[0],width:u._width,height:u._height,childTileMask:o?d.computeChildMaskForTile(r,t,i):ALL_CHILDREN,structure:u._terrainDataStructure,encoding:u._encoding})}).otherwise(function(e){return defined(a)&&a.state===RequestState$1.CANCELLED?(n.cancel(),n.deferred.promise.always(function(){return n.state=RequestState$1.CANCELLED,when.reject(e)})):when.reject(e)})}},ArcGISTiledElevationTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},ArcGISTiledElevationTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){if(this._hasAvailability){var r=isTileAvailable(this,i,e,t);if(defined(r))return r;requestAvailability(this,i,e,t)}},ArcGISTiledElevationTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var ArcType={NONE:0,GEODESIC:1,RHUMB:2},ArcType$1=freezeObject$1(ArcType);function arrayFill(e,t,i,r){if("function"==typeof e.fill)return e.fill(t,i,r);for(var n=e.length>>>0,a=defaultValue(i,0),o=a<0?Math.max(n+a,0):Math.min(a,n),s=defaultValue(r,n),l=s<0?Math.max(n+s,0):Math.min(s,n);o<l;)e[o]=t,o++;return e}var removeDuplicatesEpsilon=CesiumMath.EPSILON10;function arrayRemoveDuplicates(e,t,i){if(defined(e)){i=defaultValue(i,!1);var r,n,a,o=e.length;if(o<2)return e;for(r=1;r<o&&!t(n=e[r-1],a=e[r],removeDuplicatesEpsilon);++r);if(r===o)return i&&t(e[0],e[e.length-1],removeDuplicatesEpsilon)?e.slice(1):e;for(var s=e.slice(0,r);r<o;++r)t(n,a=e[r],removeDuplicatesEpsilon)||(s.push(a),n=a);return i&&1<s.length&&t(s[0],s[s.length-1],removeDuplicatesEpsilon)&&s.shift(),s}}function arraySlice(e,t,i){if("function"==typeof e.slice)return e.slice(t,i);for(var r=Array.prototype.slice.call(e,t,i),n=FeatureDetection.typedArrayTypes,a=n.length,o=0;o<a;++o)if(e instanceof n[o]){r=new n[o](r);break}return r}function AssociativeArray(){this._array=[],this._hash={}}defineProperties$1(AssociativeArray.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}}),AssociativeArray.prototype.contains=function(e){return defined(this._hash[e])},AssociativeArray.prototype.set=function(e,t){t!==this._hash[e]&&(this.remove(e),this._hash[e]=t,this._array.push(t))},AssociativeArray.prototype.get=function(e){return this._hash[e]},AssociativeArray.prototype.remove=function(e){var t=this._hash[e],i=defined(t);if(i){var r=this._array;r.splice(r.indexOf(t),1),delete this._hash[e]}return i},AssociativeArray.prototype.removeAll=function(){var e=this._array;0<e.length&&(this._hash={},e.length=0)};var scratchCartesian1$1=new Cartesian3,scratchCartesian2$1=new Cartesian3,scratchCartesian3$2=new Cartesian3;function barycentricCoordinates(e,t,i,r,n){var a,o,s,l,c,u,d,h;if(defined(n)||(n=new Cartesian3),defined(t.z)){if(Cartesian3.equalsEpsilon(e,t,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_X,n);if(Cartesian3.equalsEpsilon(e,i,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Y,n);if(Cartesian3.equalsEpsilon(e,r,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Z,n);a=Cartesian3.subtract(i,t,scratchCartesian1$1),o=Cartesian3.subtract(r,t,scratchCartesian2$1),s=Cartesian3.subtract(e,t,scratchCartesian3$2),l=Cartesian3.dot(a,a),c=Cartesian3.dot(a,o),u=Cartesian3.dot(a,s),d=Cartesian3.dot(o,o),h=Cartesian3.dot(o,s)}else{if(Cartesian2.equalsEpsilon(e,t,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_X,n);if(Cartesian2.equalsEpsilon(e,i,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Y,n);if(Cartesian2.equalsEpsilon(e,r,CesiumMath.EPSILON14))return Cartesian3.clone(Cartesian3.UNIT_Z,n);a=Cartesian2.subtract(i,t,scratchCartesian1$1),o=Cartesian2.subtract(r,t,scratchCartesian2$1),s=Cartesian2.subtract(e,t,scratchCartesian3$2),l=Cartesian2.dot(a,a),c=Cartesian2.dot(a,o),u=Cartesian2.dot(a,s),d=Cartesian2.dot(o,o),h=Cartesian2.dot(o,s)}n.y=d*u-c*h,n.z=l*h-c*u;var p=l*d-c*c;return 0!==n.y&&(n.y/=p),0!==n.z&&(n.z/=p),n.x=1-n.y-n.z,n}var BingMapsApi={defaultKey:void 0,getKey:function(e){return defined(e)?e:BingMapsApi.defaultKey}},url="https://dev.virtualearth.net/REST/v1/Locations";function BingMapsGeocoderService(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).key;this._key=BingMapsApi.getKey(t),this._resource=new Resource({url:url,queryParameters:{key:this._key}})}function BoundingRectangle(e,t,i,r){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.width=defaultValue(i,0),this.height=defaultValue(r,0)}defineProperties$1(BingMapsGeocoderService.prototype,{url:{get:function(){return url}},key:{get:function(){return this._key}}}),BingMapsGeocoderService.prototype.geocode=function(e){return this._resource.getDerivedResource({queryParameters:{query:e}}).fetchJsonp("jsonp").then(function(e){return 0===e.resourceSets.length?[]:e.resourceSets[0].resources.map(function(e){var t=e.bbox,i=t[0],r=t[1],n=t[2],a=t[3];return{displayName:e.name,destination:Rectangle.fromDegrees(r,i,a,n)}})})},BoundingRectangle.packedLength=4,BoundingRectangle.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i++]=e.width,t[i]=e.height,t},BoundingRectangle.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new BoundingRectangle),i.x=e[t++],i.y=e[t++],i.width=e[t++],i.height=e[t],i},BoundingRectangle.fromPoints=function(e,t){if(defined(t)||(t=new BoundingRectangle),!defined(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;for(var i=e.length,r=e[0].x,n=e[0].y,a=e[0].x,o=e[0].y,s=1;s<i;s++){var l=e[s],c=l.x,u=l.y;r=Math.min(c,r),a=Math.max(c,a),n=Math.min(u,n),o=Math.max(u,o)}return t.x=r,t.y=n,t.width=a-r,t.height=o-n,t};var defaultProjection$1=new GeographicProjection,fromRectangleLowerLeft=new Cartographic,fromRectangleUpperRight=new Cartographic;BoundingRectangle.fromRectangle=function(e,t,i){if(defined(i)||(i=new BoundingRectangle),!defined(e))return i.x=0,i.y=0,i.width=0,i.height=0,i;var r=(t=defaultValue(t,defaultProjection$1)).project(Rectangle.southwest(e,fromRectangleLowerLeft)),n=t.project(Rectangle.northeast(e,fromRectangleUpperRight));return Cartesian2.subtract(n,r,n),i.x=r.x,i.y=r.y,i.width=n.x,i.height=n.y,i},BoundingRectangle.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new BoundingRectangle(e.x,e.y,e.width,e.height)},BoundingRectangle.union=function(e,t,i){defined(i)||(i=new BoundingRectangle);var r=Math.min(e.x,t.x),n=Math.min(e.y,t.y),a=Math.max(e.x+e.width,t.x+t.width),o=Math.max(e.y+e.height,t.y+t.height);return i.x=r,i.y=n,i.width=a-r,i.height=o-n,i},BoundingRectangle.expand=function(e,t,i){i=BoundingRectangle.clone(e,i);var r=t.x-i.x,n=t.y-i.y;return r>i.width?i.width=r:r<0&&(i.width-=r,i.x=t.x),n>i.height?i.height=n:n<0&&(i.height-=n,i.y=t.y),i},BoundingRectangle.intersect=function(e,t){var i=e.x,r=e.y,n=t.x,a=t.y;return i>n+t.width||i+e.width<n||r+e.height<a||r>a+t.height?Intersect$1.OUTSIDE:Intersect$1.INTERSECTING},BoundingRectangle.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},BoundingRectangle.prototype.clone=function(e){return BoundingRectangle.clone(this,e)},BoundingRectangle.prototype.intersect=function(e){return BoundingRectangle.intersect(this,e)},BoundingRectangle.prototype.equals=function(e){return BoundingRectangle.equals(this,e)};var GeometryType={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},GeometryType$1=freezeObject$1(GeometryType);function Matrix2(e,t,i,r){this[0]=defaultValue(e,0),this[1]=defaultValue(i,0),this[2]=defaultValue(t,0),this[3]=defaultValue(r,0)}Matrix2.packedLength=4,Matrix2.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e[0],t[i++]=e[1],t[i++]=e[2],t[i++]=e[3],t},Matrix2.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix2),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i},Matrix2.clone=function(e,t){if(defined(e))return defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Matrix2(e[0],e[2],e[1],e[3])},Matrix2.fromArray=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Matrix2),i[0]=e[t],i[1]=e[t+1],i[2]=e[t+2],i[3]=e[t+3],i},Matrix2.fromColumnMajorArray=function(e,t){return Matrix2.clone(e,t)},Matrix2.fromRowMajorArray=function(e,t){return defined(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Matrix2(e[0],e[1],e[2],e[3])},Matrix2.fromScale=function(e,t){return defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Matrix2(e.x,0,0,e.y)},Matrix2.fromUniformScale=function(e,t){return defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Matrix2(e,0,0,e)},Matrix2.fromRotation=function(e,t){var i=Math.cos(e),r=Math.sin(e);return defined(t)?(t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t):new Matrix2(i,-r,r,i)},Matrix2.toArray=function(e,t){return defined(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]]},Matrix2.getElementIndex=function(e,t){return 2*e+t},Matrix2.getColumn=function(e,t,i){var r=2*t,n=e[r],a=e[1+r];return i.x=n,i.y=a,i},Matrix2.setColumn=function(e,t,i,r){var n=2*t;return(r=Matrix2.clone(e,r))[n]=i.x,r[1+n]=i.y,r},Matrix2.getRow=function(e,t,i){var r=e[t],n=e[t+2];return i.x=r,i.y=n,i},Matrix2.setRow=function(e,t,i,r){return(r=Matrix2.clone(e,r))[t]=i.x,r[t+2]=i.y,r};var scratchColumn$2=new Cartesian2;Matrix2.getScale=function(e,t){return t.x=Cartesian2.magnitude(Cartesian2.fromElements(e[0],e[1],scratchColumn$2)),t.y=Cartesian2.magnitude(Cartesian2.fromElements(e[2],e[3],scratchColumn$2)),t};var scratchScale$4=new Cartesian2;Matrix2.getMaximumScale=function(e){return Matrix2.getScale(e,scratchScale$4),Cartesian2.maximumComponent(scratchScale$4)},Matrix2.multiply=function(e,t,i){var r=e[0]*t[0]+e[2]*t[1],n=e[0]*t[2]+e[2]*t[3],a=e[1]*t[0]+e[3]*t[1],o=e[1]*t[2]+e[3]*t[3];return i[0]=r,i[1]=a,i[2]=n,i[3]=o,i},Matrix2.add=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i},Matrix2.subtract=function(e,t,i){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i},Matrix2.multiplyByVector=function(e,t,i){var r=e[0]*t.x+e[2]*t.y,n=e[1]*t.x+e[3]*t.y;return i.x=r,i.y=n,i},Matrix2.multiplyByScalar=function(e,t,i){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i},Matrix2.multiplyByScale=function(e,t,i){return i[0]=e[0]*t.x,i[1]=e[1]*t.x,i[2]=e[2]*t.y,i[3]=e[3]*t.y,i},Matrix2.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},Matrix2.transpose=function(e,t){var i=e[0],r=e[2],n=e[1],a=e[3];return t[0]=i,t[1]=r,t[2]=n,t[3]=a,t},Matrix2.abs=function(e,t){return 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},Matrix2.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},Matrix2.equalsArray=function(e,t,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]},Matrix2.equalsEpsilon=function(e,t,i){return e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=i&&Math.abs(e[1]-t[1])<=i&&Math.abs(e[2]-t[2])<=i&&Math.abs(e[3]-t[3])<=i},Matrix2.IDENTITY=freezeObject$1(new Matrix2(1,0,0,1)),Matrix2.ZERO=freezeObject$1(new Matrix2(0,0,0,0)),Matrix2.COLUMN0ROW0=0,Matrix2.COLUMN0ROW1=1,Matrix2.COLUMN1ROW0=2,Matrix2.COLUMN1ROW1=3,defineProperties$1(Matrix2.prototype,{length:{get:function(){return Matrix2.packedLength}}}),Matrix2.prototype.clone=function(e){return Matrix2.clone(this,e)},Matrix2.prototype.equals=function(e){return Matrix2.equals(this,e)},Matrix2.prototype.equalsEpsilon=function(e,t){return Matrix2.equalsEpsilon(this,e,t)},Matrix2.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n("+this[1]+", "+this[3]+")"};var PrimitiveType={POINTS:WebGLConstants$1.POINTS,LINES:WebGLConstants$1.LINES,LINE_LOOP:WebGLConstants$1.LINE_LOOP,LINE_STRIP:WebGLConstants$1.LINE_STRIP,TRIANGLES:WebGLConstants$1.TRIANGLES,TRIANGLE_STRIP:WebGLConstants$1.TRIANGLE_STRIP,TRIANGLE_FAN:WebGLConstants$1.TRIANGLE_FAN,validate:function(e){return e===PrimitiveType.POINTS||e===PrimitiveType.LINES||e===PrimitiveType.LINE_LOOP||e===PrimitiveType.LINE_STRIP||e===PrimitiveType.TRIANGLES||e===PrimitiveType.TRIANGLE_STRIP||e===PrimitiveType.TRIANGLE_FAN}},PrimitiveType$1=freezeObject$1(PrimitiveType);function Geometry(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=defaultValue(e.geometryType,GeometryType$1.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Geometry.computeNumberOfVertices=function(e){var t=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&defined(e.attributes[i])&&defined(e.attributes[i].values)){var r=e.attributes[i];t=r.values.length/r.componentsPerAttribute}return t};var rectangleCenterScratch=new Cartographic,enuCenterScratch=new Cartesian3,fixedFrameToEnuScratch=new Matrix4,boundingRectanglePointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic],boundingRectanglePointsEnuScratch=[new Cartesian2,new Cartesian2,new Cartesian2],points2DScratch=[new Cartesian2,new Cartesian2,new Cartesian2],pointEnuScratch=new Cartesian3,enuRotationScratch=new Quaternion,enuRotationMatrixScratch=new Matrix4,rotation2DScratch=new Matrix2;function GeometryAttribute(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=defaultValue(e.normalize,!1),this.values=e.values}function GeometryAttributes(e){e=defaultValue(e,defaultValue.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}Geometry._textureCoordinateRotationPoints=function(e,t,i,r){var n,a=Rectangle.center(r,rectangleCenterScratch),o=Cartographic.toCartesian(a,i,enuCenterScratch),s=Transforms.eastNorthUpToFixedFrame(o,i,fixedFrameToEnuScratch),l=Matrix4.inverse(s,fixedFrameToEnuScratch),c=boundingRectanglePointsEnuScratch,u=boundingRectanglePointsCartographicScratch;u[0].longitude=r.west,u[0].latitude=r.south,u[1].longitude=r.west,u[1].latitude=r.north,u[2].longitude=r.east,u[2].latitude=r.south;var d=pointEnuScratch;for(n=0;n<3;n++)Cartographic.toCartesian(u[n],i,d),d=Matrix4.multiplyByPointAsVector(l,d,d),c[n].x=d.x,c[n].y=d.y;var h=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-t,enuRotationScratch),p=Matrix3.fromQuaternion(h,enuRotationMatrixScratch),m=e.length,f=Number.POSITIVE_INFINITY,g=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,y=Number.NEGATIVE_INFINITY;for(n=0;n<m;n++)d=Matrix4.multiplyByPointAsVector(l,e[n],d),d=Matrix3.multiplyByVector(p,d,d),f=Math.min(f,d.x),g=Math.min(g,d.y),_=Math.max(_,d.x),y=Math.max(y,d.y);var v=Matrix2.fromRotation(t,rotation2DScratch),C=points2DScratch;C[0].x=f,C[0].y=g,C[1].x=f,C[1].y=y,C[2].x=_,C[2].y=g;var S=c[0],x=c[2].x-S.x,T=c[1].y-S.y;for(n=0;n<3;n++){var b=C[n];Matrix2.multiplyByVector(v,b,b),b.x=(b.x-S.x)/x,b.y=(b.y-S.y)/T}var E=C[0],P=C[1],A=C[2],w=new Array(6);return Cartesian2.pack(E,w),Cartesian2.pack(P,w,2),Cartesian2.pack(A,w,4),w};var GeometryOffsetAttribute={NONE:0,TOP:1,ALL:2},GeometryOffsetAttribute$1=freezeObject$1(GeometryOffsetAttribute);function VertexFormat(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.position=defaultValue(e.position,!1),this.normal=defaultValue(e.normal,!1),this.st=defaultValue(e.st,!1),this.bitangent=defaultValue(e.bitangent,!1),this.tangent=defaultValue(e.tangent,!1),this.color=defaultValue(e.color,!1)}VertexFormat.POSITION_ONLY=freezeObject$1(new VertexFormat({position:!0})),VertexFormat.POSITION_AND_NORMAL=freezeObject$1(new VertexFormat({position:!0,normal:!0})),VertexFormat.POSITION_NORMAL_AND_ST=freezeObject$1(new VertexFormat({position:!0,normal:!0,st:!0})),VertexFormat.POSITION_AND_ST=freezeObject$1(new VertexFormat({position:!0,st:!0})),VertexFormat.POSITION_AND_COLOR=freezeObject$1(new VertexFormat({position:!0,color:!0})),VertexFormat.ALL=freezeObject$1(new VertexFormat({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0})),VertexFormat.DEFAULT=VertexFormat.POSITION_NORMAL_AND_ST,VertexFormat.packedLength=6,VertexFormat.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.position?1:0,t[i++]=e.normal?1:0,t[i++]=e.st?1:0,t[i++]=e.tangent?1:0,t[i++]=e.bitangent?1:0,t[i]=e.color?1:0,t},VertexFormat.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new VertexFormat),i.position=1===e[t++],i.normal=1===e[t++],i.st=1===e[t++],i.tangent=1===e[t++],i.bitangent=1===e[t++],i.color=1===e[t],i},VertexFormat.clone=function(e,t){if(defined(e))return defined(t)||(t=new VertexFormat),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};var diffScratch=new Cartesian3;function BoxGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).minimum,i=e.maximum,r=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._minimum=Cartesian3.clone(t),this._maximum=Cartesian3.clone(i),this._vertexFormat=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}BoxGeometry.fromDimensions=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).dimensions,i=Cartesian3.multiplyByScalar(t,.5,new Cartesian3);return new BoxGeometry({minimum:Cartesian3.negate(i,new Cartesian3),maximum:i,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})},BoxGeometry.fromAxisAlignedBoundingBox=function(e){return new BoxGeometry({minimum:e.minimum,maximum:e.maximum})},BoxGeometry.packedLength=2*Cartesian3.packedLength+VertexFormat.packedLength+1,BoxGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._minimum,t,i),Cartesian3.pack(e._maximum,t,i+Cartesian3.packedLength),VertexFormat.pack(e._vertexFormat,t,i+2*Cartesian3.packedLength),t[i+2*Cartesian3.packedLength+VertexFormat.packedLength]=defaultValue(e._offsetAttribute,-1),t};var scratchMin=new Cartesian3,scratchMax=new Cartesian3,scratchVertexFormat=new VertexFormat,scratchOptions={minimum:scratchMin,maximum:scratchMax,vertexFormat:scratchVertexFormat,offsetAttribute:void 0},unitBoxGeometry;BoxGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchMin),n=Cartesian3.unpack(e,t+Cartesian3.packedLength,scratchMax),a=VertexFormat.unpack(e,t+2*Cartesian3.packedLength,scratchVertexFormat),o=e[t+2*Cartesian3.packedLength+VertexFormat.packedLength];return defined(i)?(i._minimum=Cartesian3.clone(r,i._minimum),i._maximum=Cartesian3.clone(n,i._maximum),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._offsetAttribute=-1===o?void 0:o,i):(scratchOptions.offsetAttribute=-1===o?void 0:o,new BoxGeometry(scratchOptions))},BoxGeometry.createGeometry=function(e){var t=e._minimum,i=e._maximum,r=e._vertexFormat;if(!Cartesian3.equals(t,i)){var n,a,o=new GeometryAttributes;if(r.position&&(r.st||r.normal||r.tangent||r.bitangent)){if(r.position&&((a=new Float64Array(72))[0]=t.x,a[1]=t.y,a[2]=i.z,a[3]=i.x,a[4]=t.y,a[5]=i.z,a[6]=i.x,a[7]=i.y,a[8]=i.z,a[9]=t.x,a[10]=i.y,a[11]=i.z,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=i.x,a[16]=t.y,a[17]=t.z,a[18]=i.x,a[19]=i.y,a[20]=t.z,a[21]=t.x,a[22]=i.y,a[23]=t.z,a[24]=i.x,a[25]=t.y,a[26]=t.z,a[27]=i.x,a[28]=i.y,a[29]=t.z,a[30]=i.x,a[31]=i.y,a[32]=i.z,a[33]=i.x,a[34]=t.y,a[35]=i.z,a[36]=t.x,a[37]=t.y,a[38]=t.z,a[39]=t.x,a[40]=i.y,a[41]=t.z,a[42]=t.x,a[43]=i.y,a[44]=i.z,a[45]=t.x,a[46]=t.y,a[47]=i.z,a[48]=t.x,a[49]=i.y,a[50]=t.z,a[51]=i.x,a[52]=i.y,a[53]=t.z,a[54]=i.x,a[55]=i.y,a[56]=i.z,a[57]=t.x,a[58]=i.y,a[59]=i.z,a[60]=t.x,a[61]=t.y,a[62]=t.z,a[63]=i.x,a[64]=t.y,a[65]=t.z,a[66]=i.x,a[67]=t.y,a[68]=i.z,a[69]=t.x,a[70]=t.y,a[71]=i.z,o.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})),r.normal){var s=new Float32Array(72);s[0]=0,s[1]=0,s[2]=1,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=1,s[9]=0,s[10]=0,s[11]=1,s[12]=0,s[13]=0,s[14]=-1,s[15]=0,s[16]=0,s[17]=-1,s[18]=0,s[19]=0,s[20]=-1,s[21]=0,s[22]=0,s[23]=-1,s[24]=1,s[25]=0,s[26]=0,s[27]=1,s[28]=0,s[29]=0,s[30]=1,s[31]=0,s[32]=0,s[33]=1,s[34]=0,s[35]=0,s[36]=-1,s[37]=0,s[38]=0,s[39]=-1,s[40]=0,s[41]=0,s[42]=-1,s[43]=0,s[44]=0,s[45]=-1,s[46]=0,s[47]=0,s[48]=0,s[49]=1,s[50]=0,s[51]=0,s[52]=1,s[53]=0,s[54]=0,s[55]=1,s[56]=0,s[57]=0,s[58]=1,s[59]=0,s[60]=0,s[61]=-1,s[62]=0,s[63]=0,s[64]=-1,s[65]=0,s[66]=0,s[67]=-1,s[68]=0,s[69]=0,s[70]=-1,s[71]=0,o.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:s})}if(r.st){var l=new Float32Array(48);l[0]=0,l[1]=0,l[2]=1,l[3]=0,l[4]=1,l[5]=1,l[6]=0,l[7]=1,l[8]=1,l[9]=0,l[10]=0,l[11]=0,l[12]=0,l[13]=1,l[14]=1,l[15]=1,l[16]=0,l[17]=0,l[18]=1,l[19]=0,l[20]=1,l[21]=1,l[22]=0,l[23]=1,l[24]=1,l[25]=0,l[26]=0,l[27]=0,l[28]=0,l[29]=1,l[30]=1,l[31]=1,l[32]=1,l[33]=0,l[34]=0,l[35]=0,l[36]=0,l[37]=1,l[38]=1,l[39]=1,l[40]=0,l[41]=0,l[42]=1,l[43]=0,l[44]=1,l[45]=1,l[46]=0,l[47]=1,o.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:l})}if(r.tangent){var c=new Float32Array(72);c[0]=1,c[1]=0,c[2]=0,c[3]=1,c[4]=0,c[5]=0,c[6]=1,c[7]=0,c[8]=0,c[9]=1,c[10]=0,c[11]=0,c[12]=-1,c[13]=0,c[14]=0,c[15]=-1,c[16]=0,c[17]=0,c[18]=-1,c[19]=0,c[20]=0,c[21]=-1,c[22]=0,c[23]=0,c[24]=0,c[25]=1,c[26]=0,c[27]=0,c[28]=1,c[29]=0,c[30]=0,c[31]=1,c[32]=0,c[33]=0,c[34]=1,c[35]=0,c[36]=0,c[37]=-1,c[38]=0,c[39]=0,c[40]=-1,c[41]=0,c[42]=0,c[43]=-1,c[44]=0,c[45]=0,c[46]=-1,c[47]=0,c[48]=-1,c[49]=0,c[50]=0,c[51]=-1,c[52]=0,c[53]=0,c[54]=-1,c[55]=0,c[56]=0,c[57]=-1,c[58]=0,c[59]=0,c[60]=1,c[61]=0,c[62]=0,c[63]=1,c[64]=0,c[65]=0,c[66]=1,c[67]=0,c[68]=0,c[69]=1,c[70]=0,c[71]=0,o.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:c})}if(r.bitangent){var 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 GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:u})}(n=new Uint16Array(36))[0]=0,n[1]=1,n[2]=2,n[3]=0,n[4]=2,n[5]=3,n[6]=6,n[7]=5,n[8]=4,n[9]=7,n[10]=6,n[11]=4,n[12]=8,n[13]=9,n[14]=10,n[15]=8,n[16]=10,n[17]=11,n[18]=14,n[19]=13,n[20]=12,n[21]=15,n[22]=14,n[23]=12,n[24]=18,n[25]=17,n[26]=16,n[27]=19,n[28]=18,n[29]=16,n[30]=20,n[31]=21,n[32]=22,n[33]=20,n[34]=22,n[35]=23}else(a=new Float64Array(24))[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=i.x,a[4]=t.y,a[5]=t.z,a[6]=i.x,a[7]=i.y,a[8]=t.z,a[9]=t.x,a[10]=i.y,a[11]=t.z,a[12]=t.x,a[13]=t.y,a[14]=i.z,a[15]=i.x,a[16]=t.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=t.x,a[22]=i.y,a[23]=i.z,o.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a}),(n=new Uint16Array(36))[0]=4,n[1]=5,n[2]=6,n[3]=4,n[4]=6,n[5]=7,n[6]=1,n[7]=0,n[8]=3,n[9]=1,n[10]=3,n[11]=2,n[12]=1,n[13]=6,n[14]=5,n[15]=1,n[16]=2,n[17]=6,n[18]=2,n[19]=3,n[20]=7,n[21]=2,n[22]=7,n[23]=6,n[24]=3,n[25]=0,n[26]=4,n[27]=3,n[28]=4,n[29]=7,n[30]=0,n[31]=1,n[32]=5,n[33]=0,n[34]=5,n[35]=4;var d=Cartesian3.subtract(i,t,diffScratch),h=.5*Cartesian3.magnitude(d);if(defined(e._offsetAttribute)){var p=a.length,m=new Uint8Array(p/3);arrayFill(m,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),o.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}return new Geometry({attributes:o,indices:n,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,h),offsetAttribute:e._offsetAttribute})}},BoxGeometry.getUnitBox=function(){return defined(unitBoxGeometry)||(unitBoxGeometry=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(1,1,1),vertexFormat:VertexFormat.POSITION_ONLY}))),unitBoxGeometry};var diffScratch$1=new Cartesian3;function BoxOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).minimum,i=e.maximum;this._min=Cartesian3.clone(t),this._max=Cartesian3.clone(i),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}BoxOutlineGeometry.fromDimensions=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).dimensions,i=Cartesian3.multiplyByScalar(t,.5,new Cartesian3);return new BoxOutlineGeometry({minimum:Cartesian3.negate(i,new Cartesian3),maximum:i,offsetAttribute:e.offsetAttribute})},BoxOutlineGeometry.fromAxisAlignedBoundingBox=function(e){return new BoxOutlineGeometry({minimum:e.minimum,maximum:e.maximum})},BoxOutlineGeometry.packedLength=2*Cartesian3.packedLength+1,BoxOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._min,t,i),Cartesian3.pack(e._max,t,i+Cartesian3.packedLength),t[i+2*Cartesian3.packedLength]=defaultValue(e._offsetAttribute,-1),t};var scratchMin$1=new Cartesian3,scratchMax$1=new Cartesian3,scratchOptions$1={minimum:scratchMin$1,maximum:scratchMax$1,offsetAttribute:void 0},implementation$1;function cancelAnimationFramePolyfill(e){implementation$1(e)}function CartographicGeocoderService(){}function Spline(){this.times=void 0,this.points=void 0,DeveloperError.throwInstantiationError()}function LinearSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times;this._times=i,this._points=t,this._lastTimeIndex=0}BoxOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchMin$1),n=Cartesian3.unpack(e,t+Cartesian3.packedLength,scratchMax$1),a=e[t+2*Cartesian3.packedLength];return defined(i)?(i._min=Cartesian3.clone(r,i._min),i._max=Cartesian3.clone(n,i._max),i._offsetAttribute=-1===a?void 0:a,i):(scratchOptions$1.offsetAttribute=-1===a?void 0:a,new BoxOutlineGeometry(scratchOptions$1))},BoxOutlineGeometry.createGeometry=function(e){var t=e._min,i=e._max;if(!Cartesian3.equals(t,i)){var r=new GeometryAttributes,n=new Uint16Array(24),a=new Float64Array(24);a[0]=t.x,a[1]=t.y,a[2]=t.z,a[3]=i.x,a[4]=t.y,a[5]=t.z,a[6]=i.x,a[7]=i.y,a[8]=t.z,a[9]=t.x,a[10]=i.y,a[11]=t.z,a[12]=t.x,a[13]=t.y,a[14]=i.z,a[15]=i.x,a[16]=t.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=t.x,a[22]=i.y,a[23]=i.z,r.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a}),n[0]=4,n[1]=5,n[2]=5,n[3]=6,n[4]=6,n[5]=7,n[6]=7,n[7]=4,n[8]=0,n[9]=1,n[10]=1,n[11]=2,n[12]=2,n[13]=3,n[14]=3,n[15]=0,n[16]=0,n[17]=4,n[18]=1,n[19]=5,n[20]=2,n[21]=6,n[22]=3,n[23]=7;var o=Cartesian3.subtract(i,t,diffScratch$1),s=.5*Cartesian3.magnitude(o);if(defined(e._offsetAttribute)){var l=a.length,c=new Uint8Array(l/3);arrayFill(c,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),r.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new Geometry({attributes:r,indices:n,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,s),offsetAttribute:e._offsetAttribute})}},"undefined"!=typeof cancelAnimationFrame&&(implementation$1=cancelAnimationFrame),function(){if(!defined(implementation$1)&&"undefined"!=typeof window)for(var e=["webkit","moz","ms","o"],t=0,i=e.length;t<i&&!defined(implementation$1);)defined(implementation$1=window[e[t]+"CancelAnimationFrame"])||(implementation$1=window[e[t]+"CancelRequestAnimationFrame"]),++t;defined(implementation$1)||(implementation$1=clearTimeout)}(),CartographicGeocoderService.prototype.geocode=function(e){var t=e.match(/[^\s,\n]+/g);if(2===t.length||3===t.length){var i=+t[0],r=+t[1],n=3===t.length?+t[2]:300;if(isNaN(i)&&isNaN(r))for(var a=/^(\d+.?\d*)([nsew])/i,o=0;o<t.length;++o){var s=t[o].match(a);a.test(t[o])&&3===s.length&&(/^[ns]/i.test(s[2])?r=/^[n]/i.test(s[2])?+s[1]:-s[1]:/^[ew]/i.test(s[2])&&(i=/^[e]/i.test(s[2])?+s[1]:-s[1]))}if(!isNaN(i)&&!isNaN(r)&&!isNaN(n)){var l={displayName:e,destination:Cartesian3.fromDegrees(i,r,n)};return when.resolve([l])}}return when.resolve([])},Spline.prototype.evaluate=DeveloperError.throwInstantiationError,Spline.prototype.findTimeInterval=function(e,t){var i,r=this.times,n=r.length;if(e>=r[t=defaultValue(t,0)]){if(t+1<n&&e<r[t+1])return t;if(t+2<n&&e<r[t+2])return t+1}else if(0<=t-1&&e>=r[t-1])return t-1;if(e>r[t])for(i=t;i<n-1&&!(e>=r[i]&&e<r[i+1]);++i);else for(i=t-1;0<=i&&!(e>=r[i]&&e<r[i+1]);--i);return i===n-1&&(i=n-2),i},Spline.prototype.wrapTime=function(e){var t=this.times,i=t[t.length-1],r=t[0],n=i-r;return e<r&&(e+=(Math.floor((r-e)/n)+1)*n),i<e&&(e-=(Math.floor((e-i)/n)+1)*n),e},Spline.prototype.clampTime=function(e){var t=this.times;return CesiumMath.clamp(e,t[0],t[t.length-1])},defineProperties$1(LinearSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),LinearSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,LinearSpline.prototype.wrapTime=Spline.prototype.wrapTime,LinearSpline.prototype.clampTime=Spline.prototype.clampTime,LinearSpline.prototype.evaluate=function(e,t){var i=this.points,r=this.times,n=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),a=(e-r[n])/(r[n+1]-r[n]);return defined(t)||(t=new Cartesian3),Cartesian3.lerp(i[n],i[n+1],a,t)};var TridiagonalSystemSolver={solve:function(e,t,i,r){var n,a,o=new Array(i.length),s=new Array(r.length),l=new Array(r.length);for(n=0;n<s.length;n++)s[n]=new Cartesian3,l[n]=new Cartesian3;for(o[0]=i[0]/t[0],s[0]=Cartesian3.multiplyByScalar(r[0],1/t[0],s[0]),n=1;n<o.length;++n)a=1/(t[n]-o[n-1]*e[n-1]),o[n]=i[n]*a,s[n]=Cartesian3.subtract(r[n],Cartesian3.multiplyByScalar(s[n-1],e[n-1],s[n]),s[n]),s[n]=Cartesian3.multiplyByScalar(s[n],a,s[n]);for(a=1/(t[n]-o[n-1]*e[n-1]),s[n]=Cartesian3.subtract(r[n],Cartesian3.multiplyByScalar(s[n-1],e[n-1],s[n]),s[n]),s[n]=Cartesian3.multiplyByScalar(s[n],a,s[n]),l[l.length-1]=s[s.length-1],n=l.length-2;0<=n;--n)l[n]=Cartesian3.subtract(s[n],Cartesian3.multiplyByScalar(l[n+1],o[n],l[n]),l[n]);return l}},scratchLower=[],scratchDiagonal=[],scratchUpper=[],scratchRight=[];function generateClamped(e,t,i){var r,n=scratchLower,a=scratchUpper,o=scratchDiagonal,s=scratchRight;n.length=a.length=e.length-1,o.length=s.length=e.length,n[0]=o[0]=1;var l=s[a[0]=0];for(defined(l)||(l=s[0]=new Cartesian3),Cartesian3.clone(t,l),r=1;r<n.length-1;++r)n[r]=a[r]=1,o[r]=4,defined(l=s[r])||(l=s[r]=new Cartesian3),Cartesian3.subtract(e[r+1],e[r-1],l),Cartesian3.multiplyByScalar(l,3,l);return n[r]=0,a[r]=1,o[r]=4,defined(l=s[r])||(l=s[r]=new Cartesian3),Cartesian3.subtract(e[r+1],e[r-1],l),Cartesian3.multiplyByScalar(l,3,l),defined(l=s[r+(o[r+1]=1)])||(l=s[r+1]=new Cartesian3),Cartesian3.clone(i,l),TridiagonalSystemSolver.solve(n,o,a,s)}function generateNatural(e){var t,i=scratchLower,r=scratchUpper,n=scratchDiagonal,a=scratchRight;i.length=r.length=e.length-1,n.length=a.length=e.length,i[0]=r[0]=1,n[0]=2;var o=a[0];for(defined(o)||(o=a[0]=new Cartesian3),Cartesian3.subtract(e[1],e[0],o),Cartesian3.multiplyByScalar(o,3,o),t=1;t<i.length;++t)i[t]=r[t]=1,n[t]=4,defined(o=a[t])||(o=a[t]=new Cartesian3),Cartesian3.subtract(e[t+1],e[t-1],o),Cartesian3.multiplyByScalar(o,3,o);return n[t]=2,defined(o=a[t])||(o=a[t]=new Cartesian3),Cartesian3.subtract(e[t],e[t-1],o),Cartesian3.multiplyByScalar(o,3,o),TridiagonalSystemSolver.solve(i,n,r,a)}function HermiteSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times,r=e.inTangents,n=e.outTangents;this._times=i,this._points=t,this._inTangents=r,this._outTangents=n,this._lastTimeIndex=0}defineProperties$1(HermiteSpline.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}}}),HermiteSpline.createC1=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,i=e.points,r=e.tangents,n=r.slice(0,r.length-1);return new HermiteSpline({times:t,points:i,inTangents:r.slice(1,r.length),outTangents:n})},HermiteSpline.createNaturalCubic=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,i=e.points;if(i.length<3)return new LinearSpline({points:i,times:t});var r=generateNatural(i),n=r.slice(0,r.length-1);return new HermiteSpline({times:t,points:i,inTangents:r.slice(1,r.length),outTangents:n})},HermiteSpline.createClampedCubic=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times,i=e.points,r=e.firstTangent,n=e.lastTangent;if(i.length<3)return new LinearSpline({points:i,times:t});var a=generateClamped(i,r,n),o=a.slice(0,a.length-1);return new HermiteSpline({times:t,points:i,inTangents:a.slice(1,a.length),outTangents:o})},HermiteSpline.hermiteCoefficientMatrix=new Matrix4(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0),HermiteSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval;var scratchTimeVec=new Cartesian4,scratchTemp=new Cartesian3;HermiteSpline.prototype.wrapTime=Spline.prototype.wrapTime,HermiteSpline.prototype.clampTime=Spline.prototype.clampTime,HermiteSpline.prototype.evaluate=function(e,t){defined(t)||(t=new Cartesian3);var i=this.points,r=this.times,n=this.inTangents,a=this.outTangents,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),s=(e-r[o])/(r[o+1]-r[o]),l=scratchTimeVec;l.z=s,l.y=s*s,l.x=l.y*s,l.w=1;var c=Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,l,l);return t=Cartesian3.multiplyByScalar(i[o],c.x,t),Cartesian3.multiplyByScalar(i[o+1],c.y,scratchTemp),Cartesian3.add(t,scratchTemp,t),Cartesian3.multiplyByScalar(a[o],c.z,scratchTemp),Cartesian3.add(t,scratchTemp,t),Cartesian3.multiplyByScalar(n[o],c.w,scratchTemp),Cartesian3.add(t,scratchTemp,t)};var scratchTimeVec$1=new Cartesian4,scratchTemp0=new Cartesian3,scratchTemp1=new Cartesian3;function createEvaluateFunction(u){var d=u.points,h=u.times;if(d.length<3){var r=h[0],n=1/(h[1]-r),a=d[0],o=d[1];return function(e,t){defined(t)||(t=new Cartesian3);var i=(e-r)*n;return Cartesian3.lerp(a,o,i,t)}}return function(e,t){defined(t)||(t=new Cartesian3);var i,r,n,a,o,s=u._lastTimeIndex=u.findTimeInterval(e,u._lastTimeIndex),l=(e-h[s])/(h[s+1]-h[s]),c=scratchTimeVec$1;return c.z=l,c.y=l*l,c.x=c.y*l,c.w=1,o=0===s?(i=d[0],r=d[1],n=u.firstTangent,a=Cartesian3.subtract(d[2],i,scratchTemp0),Cartesian3.multiplyByScalar(a,.5,a),Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,c,c)):s===d.length-2?(i=d[s],r=d[s+1],a=u.lastTangent,n=Cartesian3.subtract(r,d[s-1],scratchTemp0),Cartesian3.multiplyByScalar(n,.5,n),Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix,c,c)):(i=d[s-1],r=d[s],n=d[s+1],a=d[s+2],Matrix4.multiplyByVector(CatmullRomSpline.catmullRomCoefficientMatrix,c,c)),t=Cartesian3.multiplyByScalar(i,o.x,t),Cartesian3.multiplyByScalar(r,o.y,scratchTemp1),Cartesian3.add(t,scratchTemp1,t),Cartesian3.multiplyByScalar(n,o.z,scratchTemp1),Cartesian3.add(t,scratchTemp1,t),Cartesian3.multiplyByScalar(a,o.w,scratchTemp1),Cartesian3.add(t,scratchTemp1,t)}}var firstTangentScratch=new Cartesian3,lastTangentScratch=new Cartesian3;function CatmullRomSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times,r=e.firstTangent,n=e.lastTangent;if(2<t.length&&(defined(r)||(r=firstTangentScratch,Cartesian3.multiplyByScalar(t[1],2,r),Cartesian3.subtract(r,t[2],r),Cartesian3.subtract(r,t[0],r),Cartesian3.multiplyByScalar(r,.5,r)),!defined(n))){var a=t.length-1;n=lastTangentScratch,Cartesian3.multiplyByScalar(t[a-1],2,n),Cartesian3.subtract(t[a],n,n),Cartesian3.add(n,t[a-2],n),Cartesian3.multiplyByScalar(n,.5,n)}this._times=i,this._points=t,this._firstTangent=Cartesian3.clone(r),this._lastTangent=Cartesian3.clone(n),this._evaluateFunction=createEvaluateFunction(this),this._lastTimeIndex=0}function getStringFromTypedArray(e,t,i){return t=defaultValue(t,0),i=defaultValue(i,e.byteLength-t),e=e.subarray(t,t+i),getStringFromTypedArray.decode(e)}function inRange(e,t,i){return t<=e&&e<=i}function utf8Handler(e){for(var t=0,i=0,r=0,n=128,a=191,o=[],s=e.length,l=0;l<s;++l){var c=e[l];if(0===r){if(inRange(c,0,127)){o.push(c);continue}if(inRange(c,194,223)){r=1,t=31&c;continue}if(inRange(c,224,239)){224===c&&(n=160),237===c&&(a=159),r=2,t=15&c;continue}if(inRange(c,240,244)){240===c&&(n=144),244===c&&(a=143),r=3,t=7&c;continue}throw new RuntimeError("String decoding failed.")}inRange(c,n,a)?(n=128,a=191,t=t<<6|63&c,++i===r&&(o.push(t),t=r=i=0)):(t=r=i=0,n=128,a=191,--l)}return o}defineProperties$1(CatmullRomSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},firstTangent:{get:function(){return this._firstTangent}},lastTangent:{get:function(){return this._lastTangent}}}),CatmullRomSpline.catmullRomCoefficientMatrix=new Matrix4(-.5,1,-.5,0,1.5,-2.5,0,1,-1.5,2,.5,0,.5,-.5,0,0),CatmullRomSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,CatmullRomSpline.prototype.wrapTime=Spline.prototype.wrapTime,CatmullRomSpline.prototype.clampTime=Spline.prototype.clampTime,CatmullRomSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)},getStringFromTypedArray.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)},getStringFromTypedArray.decodeWithFromCharCode=function(e){for(var t="",i=utf8Handler(e),r=i.length,n=0;n<r;++n){var a=i[n];a<=65535?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296+(a>>10),56320+(1023&a)))}return t},"undefined"!=typeof TextDecoder?getStringFromTypedArray.decode=getStringFromTypedArray.decodeWithTextDecoder:getStringFromTypedArray.decode=getStringFromTypedArray.decodeWithFromCharCode;var IndexDatatype={UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,getSizeInBytes:function(e){switch(e){case IndexDatatype.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case IndexDatatype.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case IndexDatatype.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},fromSizeInBytes:function(e){switch(e){case 2:return IndexDatatype.UNSIGNED_SHORT;case 4:return IndexDatatype.UNSIGNED_INT;case 1:return IndexDatatype.UNSIGNED_BYTE}},validate:function(e){return defined(e)&&(e===IndexDatatype.UNSIGNED_BYTE||e===IndexDatatype.UNSIGNED_SHORT||e===IndexDatatype.UNSIGNED_INT)},createTypedArray:function(e,t){return e>=CesiumMath.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},createTypedArrayFromArrayBuffer:function(e,t,i,r){return e>=CesiumMath.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,i,r):new Uint16Array(t,i,r)}},IndexDatatype$1=freezeObject$1(IndexDatatype),Intersections2D={clipTriangleAtAxisAlignedThreshold:function(e,t,i,r,n,a){var o,s,l;defined(a)?a.length=0:a=[],l=t?(o=i<e,s=r<e,n<e):(o=e<i,s=e<r,e<n);var c,u,d,h,p,m,f=o+s+l;return 1===f?o?(c=(e-i)/(r-i),u=(e-i)/(n-i),a.push(1),a.push(2),1!==u&&(a.push(-1),a.push(0),a.push(2),a.push(u)),1!==c&&(a.push(-1),a.push(0),a.push(1),a.push(c))):s?(d=(e-r)/(n-r),h=(e-r)/(i-r),a.push(2),a.push(0),1!==h&&(a.push(-1),a.push(1),a.push(0),a.push(h)),1!==d&&(a.push(-1),a.push(1),a.push(2),a.push(d))):l&&(p=(e-n)/(i-n),m=(e-n)/(r-n),a.push(0),a.push(1),1!==m&&(a.push(-1),a.push(2),a.push(1),a.push(m)),1!==p&&(a.push(-1),a.push(2),a.push(0),a.push(p))):2===f?o||i===e?s||r===e?l||n===e||(u=(e-i)/(n-i),d=(e-r)/(n-r),a.push(2),a.push(-1),a.push(0),a.push(2),a.push(u),a.push(-1),a.push(1),a.push(2),a.push(d)):(m=(e-n)/(r-n),c=(e-i)/(r-i),a.push(1),a.push(-1),a.push(2),a.push(1),a.push(m),a.push(-1),a.push(0),a.push(1),a.push(c)):(h=(e-r)/(i-r),p=(e-n)/(i-n),a.push(0),a.push(-1),a.push(1),a.push(0),a.push(h),a.push(-1),a.push(2),a.push(0),a.push(p)):3!==f&&(a.push(0),a.push(1),a.push(2)),a},computeBarycentricCoordinates:function(e,t,i,r,n,a,o,s,l){var c=i-o,u=o-n,d=a-s,h=r-s,p=1/(d*c+u*h),m=t-s,f=e-o,g=(d*f+u*m)*p,_=(-h*f+c*m)*p,y=1-g-_;return defined(l)?(l.x=g,l.y=_,l.z=y,l):new Cartesian3(g,_,y)},computeLineSegmentLineSegmentIntersection:function(e,t,i,r,n,a,o,s,l){var c=(s-a)*(i-e)-(o-n)*(r-t);if(0!=c){var u=((o-n)*(t-a)-(s-a)*(e-n))/c,d=((i-e)*(t-a)-(r-t)*(e-n))/c;return 0<=u&&u<=1&&0<=d&&d<=1?(defined(l)||(l=new Cartesian2),l.x=e+u*(i-e),l.y=t+u*(r-t),l):void 0}}},ExpandByMars={trustGenerator:["fanfan"],_defaultFloodAnalysis:{floodVar:[0,0,0,500],ym_pos_x:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ym_pos_y:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ym_pos_z:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rect_flood:[0,0,0,0,0,0,0,0,0],floodSpeed:1,ym_max_index:0,globe:!0,showElseArea:!0},floodAnalysis:{floodVar:[0,0,0,500],ym_pos_x:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ym_pos_y:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ym_pos_z:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rect_flood:[0,0,0,0,0,0,0,0,0],floodSpeed:1,ym_max_index:0,globe:!0,showElseArea:!0},resetFloodAnalysis:function(){this.floodAnalysis=clone(this._defaultFloodAnalysis)},_defaultExcavateAnalysis:{splitNum:30,showSelfOnly:!1,dig_pos_x:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],dig_pos_y:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],dig_pos_z:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rect_dig:[0,0,0,0,0,0,0,0,0],dig_max_index:0,excavateHeight:0,excavateMinHeight:9999,excavatePerPoint:!1},excavateAnalysis:{splitNum:30,showSelfOnly:!1,dig_pos_x:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],dig_pos_y:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],dig_pos_z:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rect_dig:[0,0,0,0,0,0,0,0,0],dig_max_index:0,excavateHeight:0,excavateMinHeight:9999,excavatePerPoint:!1},resetExcavateAnalysis:function(){this.excavateAnalysis=clone(this._defaultExcavateAnalysis)},_defaultTilesEditor:{floodVar:[0,0,0,0],flatRect:[0,0,0,0,0,0,0,0,0],yp_mat_x:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],yp_mat_y:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],yp_mat_z:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],yp_max_index:0,model_min_height:50,IsYaPing:[!1,!1,!1,!1],yp_show_InOrOut:[!1,!0,!0,!1],yp_black_texture:null,hm_dh_attr:[50,1,100],modelLight:2.2,times:(new Date).getTime(),floodColor:[0,0,0,.5]},tilesEditor:{floodVar:[0,0,0,0],flatRect:[0,0,0,0,0,0,0,0,0],yp_mat_x:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],yp_mat_y:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],yp_mat_z:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],yp_max_index:0,model_min_height:50,IsYaPing:[!1,!1,!1,!1],yp_show_InOrOut:[!1,!0,!0,!1],yp_black_texture:null,hm_dh_attr:[50,1,100],modelLight:2.2,times:(new Date).getTime(),floodColor:[0,0,0,.5]},resetTilesEditor:function(){this.tilesEditor=clone(this._defaultTilesEditor)},underEarth:{cullFace:void 0,enable:void 0,enableDepth:100,enableSkirt:!1},occlusionOpen:!0,ableTilesFbo:!1,mirror:{MirrorEnable:!1,MirrorProjectionMatrix:new Matrix4,MirrorViewMatrix:new Matrix4}};function QuantizedMeshTerrainData(e){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;var t=this._quantizedVertices.length/3,i=this._uValues=this._quantizedVertices.subarray(0,t),r=this._vValues=this._quantizedVertices.subarray(t,2*t);function n(e,t){return r[e]-r[t]}function a(e,t){return i[e]-i[t]}this._heightValues=this._quantizedVertices.subarray(2*t,3*t),this._westIndices=sortIndicesIfNecessary(e.westIndices,n,t),this._southIndices=sortIndicesIfNecessary(e.southIndices,a,t),this._eastIndices=sortIndicesIfNecessary(e.eastIndices,n,t),this._northIndices=sortIndicesIfNecessary(e.northIndices,a,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=defaultValue(e.childTileMask,15),this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}defineProperties$1(QuantizedMeshTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return defined(this._mesh)}}});var arrayScratch=[];function sortIndicesIfNecessary(e,t,i){arrayScratch.length=e.length;for(var r=!1,n=0,a=e.length;n<a;++n)arrayScratch[n]=e[n],r=r||0<n&&0<t(e[n-1],e[n]);return r?(arrayScratch.sort(t),IndexDatatype$1.createTypedArray(i,arrayScratch)):e}var createMeshTaskProcessor=new TaskProcessor("createVerticesFromQuantizedTerrainMesh");QuantizedMeshTerrainData.prototype.createMesh=function(e,t,i,r,h){var n=e.ellipsoid,a=e.tileXYToRectangle(t,i,r);h=defaultValue(h,1);var o=createMeshTaskProcessor.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:a,relativeToCenter:this._boundingSphere.center,ellipsoid:n,exaggeration:h});if(defined(o)){var p=this;return when(o,function(e){var t=p._quantizedVertices.length/3;t+=p._westIndices.length+p._southIndices.length+p._eastIndices.length+p._northIndices.length;var i=IndexDatatype$1.createTypedArray(t,e.indices),r=new Float32Array(e.vertices),n=e.center,a=e.minimumHeight,o=e.maximumHeight,s=defaultValue(BoundingSphere.clone(e.boundingSphere),p._boundingSphere),l=defaultValue(OrientedBoundingBox.clone(e.orientedBoundingBox),p._orientedBoundingBox),c=Cartesian3.clone(p._horizonOcclusionPoint),u=e.vertexStride,d=TerrainEncoding.clone(e.encoding);return p._skirtIndex=e.skirtIndex,p._vertexCountWithoutSkirts=p._quantizedVertices.length/3,p._mesh=new TerrainMesh(n,r,i,a,o,s,c,u,l,d,h,e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),p._quantizedVertices=void 0,p._encodedNormals=void 0,p._indices=void 0,p._uValues=void 0,p._vValues=void 0,p._heightValues=void 0,p._westIndices=void 0,p._southIndices=void 0,p._eastIndices=void 0,p._northIndices=void 0,p._mesh})}};var upsampleTaskProcessor=new TaskProcessor("upsampleQuantizedTerrainMesh");QuantizedMeshTerrainData.prototype.upsample=function(e,t,i,r,n,a,o){var s=this._mesh;if(defined(this._mesh)){var l=2*t!==n,c=2*i===a,u=e.ellipsoid,d=e.tileXYToRectangle(n,a,o),h=upsampleTaskProcessor.scheduleTask({vertices:s.vertices,vertexCountWithoutSkirts:this._vertexCountWithoutSkirts,indices:s.indices,skirtIndex:this._skirtIndex,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:l,isNorthChild:c,childRectangle:d,ellipsoid:u,exaggeration:s.exaggeration});if(defined(h)){var p=Math.min(this._westSkirtHeight,this._eastSkirtHeight);p=Math.min(p,this._southSkirtHeight),p=Math.min(p,this._northSkirtHeight);var m=l?.5*p:this._westSkirtHeight,f=c?.5*p:this._southSkirtHeight,g=l?this._eastSkirtHeight:.5*p,_=c?this._northSkirtHeight:.5*p,y=this._credits;return ExpandByMars.underEarth.enableSkirt&&(_=g=f=m=0),when(h).then(function(e){var t,i=new Uint16Array(e.vertices),r=IndexDatatype$1.createTypedArray(i.length/3,e.indices);return defined(e.encodedNormals)&&(t=new Uint8Array(e.encodedNormals)),new QuantizedMeshTerrainData({quantizedVertices:i,indices:r,encodedNormals:t,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:m,southSkirtHeight:f,eastSkirtHeight:g,northSkirtHeight:_,childTileMask:0,credits:y,createdByUpsampling:!0})})}}};var maxShort=32767,barycentricCoordinateScratch=new Cartesian3;function pointInBoundingBox(e,t,i,r,n,a,o,s){var l=Math.min(i,n,o),c=Math.max(i,n,o),u=Math.min(r,a,s),d=Math.max(r,a,s);return l<=e&&e<=c&&u<=t&&t<=d}QuantizedMeshTerrainData.prototype.interpolateHeight=function(e,t,i){var r=CesiumMath.clamp((t-e.west)/e.width,0,1);r*=maxShort;var n=CesiumMath.clamp((i-e.south)/e.height,0,1);return n*=maxShort,defined(this._mesh)?interpolateMeshHeight$1(this,r,n):interpolateHeight$1(this,r,n)};var texCoordScratch0=new Cartesian2,texCoordScratch1=new Cartesian2,texCoordScratch2=new Cartesian2;function interpolateMeshHeight$1(e,t,i){for(var r=e._mesh,n=r.vertices,a=r.encoding,o=r.indices,s=0,l=o.length;s<l;s+=3){var c=o[s],u=o[s+1],d=o[s+2],h=a.decodeTextureCoordinates(n,c,texCoordScratch0),p=a.decodeTextureCoordinates(n,u,texCoordScratch1),m=a.decodeTextureCoordinates(n,d,texCoordScratch2);if(pointInBoundingBox(t,i,h.x,h.y,p.x,p.y,m.x,m.y)){var f=Intersections2D.computeBarycentricCoordinates(t,i,h.x,h.y,p.x,p.y,m.x,m.y,barycentricCoordinateScratch);if(-1e-15<=f.x&&-1e-15<=f.y&&-1e-15<=f.z){var g=a.decodeHeight(n,c),_=a.decodeHeight(n,u),y=a.decodeHeight(n,d);return f.x*g+f.y*_+f.z*y}}}}function interpolateHeight$1(e,t,i){for(var r=e._uValues,n=e._vValues,a=e._heightValues,o=e._indices,s=0,l=o.length;s<l;s+=3){var c=o[s],u=o[s+1],d=o[s+2],h=r[c],p=r[u],m=r[d],f=n[c],g=n[u],_=n[d];if(pointInBoundingBox(t,i,h,f,p,g,m,_)){var y=Intersections2D.computeBarycentricCoordinates(t,i,h,f,p,g,m,_,barycentricCoordinateScratch);if(-1e-15<=y.x&&-1e-15<=y.y&&-1e-15<=y.z){var v=y.x*a[c]+y.y*a[u]+y.z*a[d];return CesiumMath.lerp(e._minimumHeight,e._maximumHeight,v/maxShort)}}}}function LayerInformation(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.availabilityTilesLoaded=e.availabilityTilesLoaded,this.availabilityPromiseCache={}}function CesiumTerrainProvider(e){this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid}),this._heightmapWidth=65,this._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,this._heightmapWidth,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._requestVertexNormals=defaultValue(e.requestVertexNormals,!1),this._requestWaterMask=defaultValue(e.requestWaterMask,!1),this._requestMetadata=defaultValue(e.requestMetadata,!0),this._errorEvent=new Event;var t=e.credit;"string"==typeof t&&(t=new Credit(t)),this._credit=t,this._availability=void 0;var i=when.defer();this._ready=!1,this._readyPromise=i,this._tileCredits=void 0;var S,x,T,b=this,E=this._layers=[],P="",A=[],w=0;function D(e){var t;if(!e.format)return t="The tile format is not specified in the layer.json file.",void(T=TileProviderError.handleError(T,b,b._errorEvent,t,void 0,void 0,void 0,I));if(!e.tiles||0===e.tiles.length)return t="The layer.json file does not specify any tile URL templates.",void(T=TileProviderError.handleError(T,b,b._errorEvent,t,void 0,void 0,void 0,I));var i=!1,r=!1,n=!1,a=!0,o=!1;if("heightmap-1.0"===e.format)o=!0,defined(b._heightmapStructure)||(b._heightmapStructure={heightScale:.2,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:65535}),r=!0,b._requestWaterMask=!0;else if(0!==e.format.indexOf("quantized-mesh-1."))return t='The tile format "'+e.format+'" is invalid or not supported.',void(T=TileProviderError.handleError(T,b,b._errorEvent,t,void 0,void 0,void 0,I));var s,l=e.tiles,c=e.maxzoom;w=Math.max(w,c),defined(e.extensions)&&-1!==e.extensions.indexOf("octvertexnormals")?i=!0:defined(e.extensions)&&-1!==e.extensions.indexOf("vertexnormals")&&(a=!(i=!0)),defined(e.extensions)&&-1!==e.extensions.indexOf("watermask")&&(r=!0),defined(e.extensions)&&-1!==e.extensions.indexOf("metadata")&&(n=!0);var u,d=e.metadataAvailability,h=e.available;if(defined(h)&&!defined(d)){u=new TileAvailability(b._tilingScheme,h.length);for(var p=0;p<h.length;++p){var m=h[p],f=b._tilingScheme.getNumberOfYTilesAtLevel(p);defined(A[p])||(A[p]=[]);for(var g=0;g<m.length;++g){var _=m[g],y=f-_.endY-1,v=f-_.startY-1;A[p].push([_.startX,y,_.endX,v]),u.addAvailableTileRange(p,_.startX,y,_.endX,v)}}}else defined(d)&&(s=new TileAvailability(b._tilingScheme,c),u=new TileAvailability(b._tilingScheme,c),A[0]=[[0,0,1,0]],u.addAvailableTileRange(0,0,0,1,0));b._hasWaterMask=b._hasWaterMask||r,b._hasVertexNormals=b._hasVertexNormals||i,b._hasMetadata=b._hasMetadata||n,defined(e.attribution)&&(0<P.length&&(P+=" "),P+=e.attribution),E.push(new LayerInformation({resource:S,version:e.version,isHeightmap:o,tileUrlTemplates:l,availability:u,hasVertexNormals:i,hasWaterMask:r,hasMetadata:n,availabilityLevels:d,availabilityTilesLoaded:s,littleEndianExtensionSize:a}));var C=e.parentUrl;return defined(C)?defined(u)?((S=S.getDerivedResource({url:C})).appendForwardSlash(),when((x=S.getDerivedResource({url:"layer.json"})).fetchJson(),D,M)):(console.log("A layer.json can't have a parentUrl if it does't have an available array."),when.resolve()):when.resolve()}function M(e){var t="An error occurred while accessing "+x.url+".";T=TileProviderError.handleError(T,b,b._errorEvent,t,void 0,void 0,void 0,I)}function r(e){D(e).then(function(){if(!defined(T)){var e=A.length;if(0<e)for(var t=b._availability=new TileAvailability(b._tilingScheme,w),i=0;i<e;++i)for(var r=A[i],n=0;n<r.length;++n){var a=r[n];t.addAvailableTileRange(i,a[0],a[1],a[2],a[3])}if(0<P.length){var o=new Credit(P);defined(b._tileCredits)?b._tileCredits.push(o):b._tileCredits=[o]}b._ready=!0,b._readyPromise.resolve(!0)}})}function n(e){defined(e)&&404===e.statusCode?r({tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]}):M()}function I(){when(x.fetchJson()).then(r).otherwise(n)}when(e.url).then(function(e){var t=Resource.createIfNeeded(e);t.appendForwardSlash(),x=(S=t).getDerivedResource({url:"layer.json"}),b._tileCredits=t.credits,I()}).otherwise(function(e){i.reject(e)})}QuantizedMeshTerrainData.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!=(this._childTileMask&1<<n)},QuantizedMeshTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var QuantizedMeshExtensionIds={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function getRequestHeader(e){return defined(e)&&0!==e.length?{Accept:"application/vnd.quantized-mesh;extensions="+e.join("-")+",application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}}function createHeightmapTerrainData(e,t,i,r,n,a){var o=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new HeightmapTerrainData({buffer:o,childTileMask:new Uint8Array(t,o.byteLength,1)[0],waterMask:new Uint8Array(t,o.byteLength+1,t.byteLength-o.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function createQuantizedMeshTerrainData(e,t,i,r,n,a,o){var s=o.littleEndianExtensionSize,l=0,c=3*Float64Array.BYTES_PER_ELEMENT,u=4*Float64Array.BYTES_PER_ELEMENT,d=3*Uint16Array.BYTES_PER_ELEMENT,h=Uint16Array.BYTES_PER_ELEMENT,p=3*h,m=new DataView(t),f=new Cartesian3(m.getFloat64(l,!0),m.getFloat64(l+8,!0),m.getFloat64(l+16,!0));l+=c;var g=m.getFloat32(l,!0);l+=Float32Array.BYTES_PER_ELEMENT;var _=m.getFloat32(l,!0);l+=Float32Array.BYTES_PER_ELEMENT;var y=new BoundingSphere(new Cartesian3(m.getFloat64(l,!0),m.getFloat64(l+8,!0),m.getFloat64(l+16,!0)),m.getFloat64(l+c,!0));l+=u;var v=new Cartesian3(m.getFloat64(l,!0),m.getFloat64(l+8,!0),m.getFloat64(l+16,!0));l+=c;var C=m.getUint32(l,!0);l+=Uint32Array.BYTES_PER_ELEMENT;var S=new Uint16Array(t,l,3*C);l+=C*d,65536<C&&(p=3*(h=Uint32Array.BYTES_PER_ELEMENT));var x=S.subarray(0,C),T=S.subarray(C,2*C),b=S.subarray(2*C,3*C);AttributeCompression.zigZagDeltaDecode(x,T,b),l%h!=0&&(l+=h-l%h);var E=m.getUint32(l,!0);l+=Uint32Array.BYTES_PER_ELEMENT;var P=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,l,3*E);l+=E*p;for(var A=0,w=P.length,D=0;D<w;++D){var M=P[D];P[D]=A-M,0===M&&++A}var I=m.getUint32(l,!0);l+=Uint32Array.BYTES_PER_ELEMENT;var R=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,l,I);l+=I*h;var O=m.getUint32(l,!0);l+=Uint32Array.BYTES_PER_ELEMENT;var L=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,l,O);l+=O*h;var F=m.getUint32(l,!0);l+=Uint32Array.BYTES_PER_ELEMENT;var N=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,l,F);l+=F*h;var B=m.getUint32(l,!0);l+=Uint32Array.BYTES_PER_ELEMENT;var V,k,$=IndexDatatype$1.createTypedArrayFromArrayBuffer(C,t,l,B);for(l+=B*h;l<m.byteLength;){var z=m.getUint8(l,!0);l+=Uint8Array.BYTES_PER_ELEMENT;var U=m.getUint32(l,s);if(l+=Uint32Array.BYTES_PER_ELEMENT,z===QuantizedMeshExtensionIds.OCT_VERTEX_NORMALS&&e._requestVertexNormals)V=new Uint8Array(t,l,2*C);else if(z===QuantizedMeshExtensionIds.WATER_MASK&&e._requestWaterMask)k=new Uint8Array(t,l,U);else if(z===QuantizedMeshExtensionIds.METADATA&&e._requestMetadata){var G=m.getUint32(l,!0);if(0<G){var H=getStringFromTypedArray(new Uint8Array(t),l+Uint32Array.BYTES_PER_ELEMENT,G),W=JSON.parse(H).available;if(defined(W))for(var q=0;q<W.length;++q)for(var j=i+q+1,Y=W[q],X=e._tilingScheme.getNumberOfYTilesAtLevel(j),Q=0;Q<Y.length;++Q){var J=Y[Q],Z=X-J.endY-1,K=X-J.startY-1;e.availability.addAvailableTileRange(j,J.startX,Z,J.endX,K),o.availability.addAvailableTileRange(j,J.startX,Z,J.endX,K)}}o.availabilityTilesLoaded.addAvailableTileRange(i,r,n,r,n)}l+=U}var ee,te=5*e.getLevelMaximumGeometricError(i),ie=e._tilingScheme.tileXYToRectangle(r,n,i);return ie.width<CesiumMath.PI_OVER_TWO+CesiumMath.EPSILON5&&(ee=OrientedBoundingBox.fromRectangle(ie,g,_,e._tilingScheme.ellipsoid)),new QuantizedMeshTerrainData({center:f,minimumHeight:g,maximumHeight:_,boundingSphere:y,orientedBoundingBox:ee,horizonOcclusionPoint:v,quantizedVertices:S,encodedNormals:V,indices:P,westIndices:R,southIndices:L,eastIndices:N,northIndices:$,westSkirtHeight:te,southSkirtHeight:te,eastSkirtHeight:te,northSkirtHeight:te,childTileMask:e.availability.computeChildMaskForTile(i,r,n),waterMask:k,credits:e._tileCredits})}function requestTileGeometry(t,i,r,n,a,e){if(!defined(a))return when.reject(new RuntimeError("Terrain tile doesn't exist"));var o=a.tileUrlTemplates;if(0!==o.length){var s,l,c=t._tilingScheme.getNumberOfYTilesAtLevel(n)-r-1,u=[];t._requestVertexNormals&&a.hasVertexNormals&&u.push(a.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),t._requestWaterMask&&a.hasWaterMask&&u.push("watermask"),t._requestMetadata&&a.hasMetadata&&u.push("metadata");var d=o[(i+c+n)%o.length],h=a.resource;s=defined(h._ionEndpoint)&&!defined(h._ionEndpoint.externalType)?(0!==u.length&&(l={extensions:u.join("-")}),getRequestHeader(void 0)):getRequestHeader(u);var p=h.getDerivedResource({url:d,templateValues:{version:a.version,z:n,x:i,y:c},queryParameters:l,headers:s,request:e}).fetchArrayBuffer();if(defined(p))return p.then(function(e){return defined(t._heightmapStructure)?createHeightmapTerrainData(t,e):createQuantizedMeshTerrainData(t,e,n,i,r,c,a)})}}function getAvailabilityTile(e,t,i,r){if(0!==r){var n=e.availabilityLevels,a=r%n==0?r-n:(r/n|0)*n,o=1<<r-a;return{level:a,x:t/o|0,y:i/o|0}}}function checkLayer(e,t,i,r,n,a){if(!defined(n.availabilityLevels))return{result:!1};for(var o,s=function(){delete n.availabilityPromiseCache[o]},l=n.availabilityTilesLoaded,c=n.availability,u=getAvailabilityTile(n,t,i,r);defined(u);){if(c.isTileAvailable(u.level,u.x,u.y)&&!l.isTileAvailable(u.level,u.x,u.y)){var d;if(!a&&(o=u.level+"-"+u.x+"-"+u.y,!defined(d=n.availabilityPromiseCache[o]))){var h=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TERRAIN});defined(d=requestTileGeometry(e,u.x,u.y,u.level,n,h))&&(n.availabilityPromiseCache[o]=d).then(s)}return{result:!0,promise:d}}u=getAvailabilityTile(n,u.x,u.y,u.level)}return{result:!1}}CesiumTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n,a=this._layers,o=a.length;if(1===o)n=a[0];else for(var s=0;s<o;++s){var l=a[s];if(!defined(l.availability)||l.availability.isTileAvailable(i,e,t)){n=l;break}}return requestTileGeometry(this,e,t,i,n,r)},defineProperties$1(CesiumTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},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}}}),CesiumTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},CesiumTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){if(defined(this._availability)){if(i>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(i,e,t))return!0;if(!this._hasMetadata)return!1;for(var r=this._layers,n=r.length,a=0;a<n;++a){if(checkLayer(this,e,t,i,r[a],0===a).result)return}return!1}},CesiumTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){if(!(!defined(this._availability)||i>this._availability._maximumLevel||this._availability.isTileAvailable(i,e,t))&&this._hasMetadata)for(var r=this._layers,n=r.length,a=0;a<n;++a){var o=checkLayer(this,e,t,i,r[a],0===a);if(defined(o.promise))return o.promise}},CesiumTerrainProvider._getAvailabilityTile=getAvailabilityTile;var EllipseGeometryLibrary={},rotAxis=new Cartesian3,tempVec=new Cartesian3,unitQuat=new Quaternion,rotMtx=new Matrix3;function pointOnEllipsoid(e,t,i,r,n,a,o,s,l,c){var u=e+t;Cartesian3.multiplyByScalar(r,Math.cos(u),rotAxis),Cartesian3.multiplyByScalar(i,Math.sin(u),tempVec),Cartesian3.add(rotAxis,tempVec,rotAxis);var d=Math.cos(e);d*=d;var h=Math.sin(e);h*=h;var p=a/Math.sqrt(o*d+n*h)/s;return Quaternion.fromAxisAngle(rotAxis,p,unitQuat),Matrix3.fromQuaternion(unitQuat,rotMtx),Matrix3.multiplyByVector(rotMtx,l,c),Cartesian3.normalize(c,c),Cartesian3.multiplyByScalar(c,s,c),c}var scratchCartesian1$2=new Cartesian3,scratchCartesian2$2=new Cartesian3,scratchCartesian3$3=new Cartesian3,scratchNormal$1=new Cartesian3;EllipseGeometryLibrary.raisePositionsToHeight=function(e,t,i){for(var r=t.ellipsoid,n=t.height,a=t.extrudedHeight,o=i?e.length/3*2:e.length/3,s=new Float64Array(3*o),l=e.length,c=i?l:0,u=0;u<l;u+=3){var d=u+1,h=u+2,p=Cartesian3.fromArray(e,u,scratchCartesian1$2);r.scaleToGeodeticSurface(p,p);var m=Cartesian3.clone(p,scratchCartesian2$2),f=r.geodeticSurfaceNormal(p,scratchNormal$1),g=Cartesian3.multiplyByScalar(f,n,scratchCartesian3$3);Cartesian3.add(p,g,p),i&&(Cartesian3.multiplyByScalar(f,a,g),Cartesian3.add(m,g,m),s[u+c]=m.x,s[d+c]=m.y,s[h+c]=m.z),s[u]=p.x,s[d]=p.y,s[h]=p.z}return s};var unitPosScratch=new Cartesian3,eastVecScratch=new Cartesian3,northVecScratch=new Cartesian3;function GeometryInstance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometry=e.geometry,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=defaultValue(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}function EncodedCartesian3(){this.high=Cartesian3.clone(Cartesian3.ZERO),this.low=Cartesian3.clone(Cartesian3.ZERO)}EllipseGeometryLibrary.computeEllipsePositions=function(e,t,i){var r=e.semiMinorAxis,n=e.semiMajorAxis,a=e.rotation,o=e.center,s=8*e.granularity,l=r*r,c=n*n,u=n*r,d=Cartesian3.magnitude(o),h=Cartesian3.normalize(o,unitPosScratch),p=Cartesian3.cross(Cartesian3.UNIT_Z,o,eastVecScratch);p=Cartesian3.normalize(p,p);var m=Cartesian3.cross(h,p,northVecScratch),f=1+Math.ceil(CesiumMath.PI_OVER_TWO/s),g=CesiumMath.PI_OVER_TWO/(f-1),_=CesiumMath.PI_OVER_TWO-f*g;_<0&&(f-=Math.ceil(Math.abs(_)/g));var y,v,C,S,x,T=t?new Array(3*(f*(f+2)*2)):void 0,b=0,E=scratchCartesian1$2,P=scratchCartesian2$2,A=4*f*3,w=A-1,D=0,M=i?new Array(A):void 0;for(E=pointOnEllipsoid(_=CesiumMath.PI_OVER_TWO,a,m,p,l,u,c,d,h,E),t&&(T[b++]=E.x,T[b++]=E.y,T[b++]=E.z),i&&(M[w--]=E.z,M[w--]=E.y,M[w--]=E.x),_=CesiumMath.PI_OVER_TWO-g,y=1;y<f+1;++y){if(E=pointOnEllipsoid(_,a,m,p,l,u,c,d,h,E),P=pointOnEllipsoid(Math.PI-_,a,m,p,l,u,c,d,h,P),t){for(T[b++]=E.x,T[b++]=E.y,T[b++]=E.z,C=2*y+2,v=1;v<C-1;++v)S=v/(C-1),x=Cartesian3.lerp(E,P,S,scratchCartesian3$3),T[b++]=x.x,T[b++]=x.y,T[b++]=x.z;T[b++]=P.x,T[b++]=P.y,T[b++]=P.z}i&&(M[w--]=E.z,M[w--]=E.y,M[w--]=E.x,M[D++]=P.x,M[D++]=P.y,M[D++]=P.z),_=CesiumMath.PI_OVER_TWO-(y+1)*g}for(y=f;1<y;--y){if(E=pointOnEllipsoid(-(_=CesiumMath.PI_OVER_TWO-(y-1)*g),a,m,p,l,u,c,d,h,E),P=pointOnEllipsoid(_+Math.PI,a,m,p,l,u,c,d,h,P),t){for(T[b++]=E.x,T[b++]=E.y,T[b++]=E.z,C=2*(y-1)+2,v=1;v<C-1;++v)S=v/(C-1),x=Cartesian3.lerp(E,P,S,scratchCartesian3$3),T[b++]=x.x,T[b++]=x.y,T[b++]=x.z;T[b++]=P.x,T[b++]=P.y,T[b++]=P.z}i&&(M[w--]=E.z,M[w--]=E.y,M[w--]=E.x,M[D++]=P.x,M[D++]=P.y,M[D++]=P.z)}E=pointOnEllipsoid(-(_=CesiumMath.PI_OVER_TWO),a,m,p,l,u,c,d,h,E);var I={};return t&&(T[b++]=E.x,T[b++]=E.y,T[b++]=E.z,I.positions=T,I.numPts=f),i&&(M[w--]=E.z,M[w--]=E.y,M[w--]=E.x,I.outerPositions=M),I},EncodedCartesian3.encode=function(e,t){var i;return defined(t)||(t={high:0,low:0}),0<=e?(i=65536*Math.floor(e/65536),t.high=i,t.low=e-i):(i=65536*Math.floor(-e/65536),t.high=-i,t.low=e+i),t};var scratchEncode={high:0,low:0};EncodedCartesian3.fromCartesian=function(e,t){defined(t)||(t=new EncodedCartesian3);var i=t.high,r=t.low;return EncodedCartesian3.encode(e.x,scratchEncode),i.x=scratchEncode.high,r.x=scratchEncode.low,EncodedCartesian3.encode(e.y,scratchEncode),i.y=scratchEncode.high,r.y=scratchEncode.low,EncodedCartesian3.encode(e.z,scratchEncode),i.z=scratchEncode.high,r.z=scratchEncode.low,t};var encodedP=new EncodedCartesian3;EncodedCartesian3.writeElements=function(e,t,i){EncodedCartesian3.fromCartesian(e,encodedP);var r=encodedP.high,n=encodedP.low;t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z,t[i+3]=n.x,t[i+4]=n.y,t[i+5]=n.z};var Tipsify={calculateACMR:function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).indices,i=e.maximumIndex,r=defaultValue(e.cacheSize,24),n=t.length;if(!defined(i))for(var a=i=0,o=t[a];a<n;)i<o&&(i=o),o=t[++a];for(var s=[],l=0;l<i+1;l++)s[l]=0;for(var c=r+1,u=0;u<n;++u)c-s[t[u]]>r&&(s[t[u]]=c,++c);return(c-r+1)/(n/3)}};Tipsify.tipsify=function(e){var h,t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).indices,i=e.maximumIndex,r=defaultValue(e.cacheSize,24);function n(e,t,i,r,n,a,o){for(var s,l=-1,c=-1,u=0;u<i.length;){var d=i[u];r[d].numLiveTriangles&&(s=0,n-r[d].timeStamp+2*r[d].numLiveTriangles<=t&&(s=n-r[d].timeStamp),(c<s||-1===c)&&(c=s,l=d)),++u}return-1===l?function(e,t,i,r){for(;1<=t.length;){var n=t[t.length-1];if(t.splice(t.length-1,1),0<e[n].numLiveTriangles)return n}for(;h<r;){if(0<e[h].numLiveTriangles)return++h-1;++h}return-1}(r,a,0,o):l}var a=t.length,o=0,s=0,l=t[s],c=a;if(defined(i))o=i+1;else{for(;s<c;)o<l&&(o=l),l=t[++s];if(-1===o)return 0;++o}var u,d=[];for(u=0;u<o;u++)d[u]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};for(var p=s=0;s<c;)d[t[s]].vertexTriangles.push(p),++d[t[s]].numLiveTriangles,d[t[s+1]].vertexTriangles.push(p),++d[t[s+1]].numLiveTriangles,d[t[s+2]].vertexTriangles.push(p),++d[t[s+2]].numLiveTriangles,++p,s+=3;var m=0,f=r+1;h=1;var g,_,y,v,C=[],S=[],x=0,T=[],b=a/3,E=[];for(u=0;u<b;u++)E[u]=!1;for(;-1!==m;){C=[],v=(_=d[m]).vertexTriangles.length;for(var P=0;P<v;++P)if(!E[p=_.vertexTriangles[P]]){E[p]=!0,s=p+p+p;for(var A=0;A<3;++A)y=t[s],C.push(y),S.push(y),T[x]=y,++x,--(g=d[y]).numLiveTriangles,f-g.timeStamp>r&&(g.timeStamp=f,++f),++s}m=n(0,r,C,d,f,S,o)}return T};var GeometryPipeline={};function addTriangle(e,t,i,r,n){e[t++]=i,e[t++]=r,e[t++]=r,e[t++]=n,e[t++]=n,e[t]=i}function trianglesToLines(e){for(var t=e.length,i=t/3*6,r=IndexDatatype$1.createTypedArray(t,i),n=0,a=0;a<t;a+=3,n+=6)addTriangle(r,n,e[a],e[a+1],e[a+2]);return r}function triangleStripToLines(e){var t=e.length;if(3<=t){var i=6*(t-2),r=IndexDatatype$1.createTypedArray(t,i);addTriangle(r,0,e[0],e[1],e[2]);for(var n=6,a=3;a<t;++a,n+=6)addTriangle(r,n,e[a-1],e[a],e[a-2]);return r}return new Uint16Array}function triangleFanToLines(e){if(0<e.length){for(var t=e.length-1,i=6*(t-1),r=IndexDatatype$1.createTypedArray(t,i),n=e[0],a=0,o=1;o<t;++o,a+=6)addTriangle(r,a,n,e[o],e[o+1]);return r}return new Uint16Array}function copyAttributesDescriptions(e){var t={};for(var i in e)if(e.hasOwnProperty(i)&&defined(e[i])&&defined(e[i].values)){var r=e[i];t[i]=new GeometryAttribute({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]})}return t}function copyVertex(e,t,i){for(var r in t)if(t.hasOwnProperty(r)&&defined(t[r])&&defined(t[r].values))for(var n=t[r],a=0;a<n.componentsPerAttribute;++a)e[r].values.push(n.values[i*n.componentsPerAttribute+a])}GeometryPipeline.toWireframe=function(e){var t=e.indices;if(defined(t)){switch(e.primitiveType){case PrimitiveType$1.TRIANGLES:e.indices=trianglesToLines(t);break;case PrimitiveType$1.TRIANGLE_STRIP:e.indices=triangleStripToLines(t);break;case PrimitiveType$1.TRIANGLE_FAN:e.indices=triangleFanToLines(t)}e.primitiveType=PrimitiveType$1.LINES}return e},GeometryPipeline.createLineSegmentsForVectors=function(e,t,i){t=defaultValue(t,"normal"),i=defaultValue(i,1e4);for(var r,n=e.attributes.position.values,a=e.attributes[t].values,o=n.length,s=new Float64Array(2*o),l=0,c=0;c<o;c+=3)s[l++]=n[c],s[l++]=n[c+1],s[l++]=n[c+2],s[l++]=n[c]+a[c]*i,s[l++]=n[c+1]+a[c+1]*i,s[l++]=n[c+2]+a[c+2]*i;var u=e.boundingSphere;return defined(u)&&(r=new BoundingSphere(u.center,u.radius+i)),new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:PrimitiveType$1.LINES,boundingSphere:r})},GeometryPipeline.createAttributeLocations=function(e){var t,i=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],r=e.attributes,n={},a=0,o=i.length;for(t=0;t<o;++t){var s=i[t];defined(r[s])&&(n[s]=a++)}for(var l in r)r.hasOwnProperty(l)&&!defined(n[l])&&(n[l]=a++);return n},GeometryPipeline.reorderForPreVertexCache=function(e){var t=Geometry.computeNumberOfVertices(e),i=e.indices;if(defined(i)){for(var r=new Int32Array(t),n=0;n<t;n++)r[n]=-1;for(var a,o=i,s=o.length,l=IndexDatatype$1.createTypedArray(t,s),c=0,u=0,d=0;c<s;)-1!==(a=r[o[c]])?l[u]=a:(r[a=o[c]]=d,l[u]=d,++d),++c,++u;e.indices=l;var h=e.attributes;for(var p in h)if(h.hasOwnProperty(p)&&defined(h[p])&&defined(h[p].values)){for(var m=h[p],f=m.values,g=0,_=m.componentsPerAttribute,y=ComponentDatatype$1.createTypedArray(m.componentDatatype,d*_);g<t;){var v=r[g];if(-1!==v)for(var C=0;C<_;C++)y[_*v+C]=f[_*g+C];++g}m.values=y}}return e},GeometryPipeline.reorderForPostVertexCache=function(e,t){var i=e.indices;if(e.primitiveType===PrimitiveType$1.TRIANGLES&&defined(i)){for(var r=i.length,n=0,a=0;a<r;a++)i[a]>n&&(n=i[a]);e.indices=Tipsify.tipsify({indices:i,maximumIndex:n,cacheSize:t})}return e},GeometryPipeline.fitToUnsignedShortIndices=function(e){var t=[],i=Geometry.computeNumberOfVertices(e);if(defined(e.indices)&&i>=CesiumMath.SIXTY_FOUR_KILOBYTES){var r,n=[],a=[],o=0,s=copyAttributesDescriptions(e.attributes),l=e.indices,c=l.length;e.primitiveType===PrimitiveType$1.TRIANGLES?r=3:e.primitiveType===PrimitiveType$1.LINES?r=2:e.primitiveType===PrimitiveType$1.POINTS&&(r=1);for(var u=0;u<c;u+=r){for(var d=0;d<r;++d){var h=l[u+d],p=n[h];defined(p)||(p=o++,n[h]=p,copyVertex(s,e.attributes,h)),a.push(p)}o+r>=CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(new Geometry({attributes:s,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),n=[],a=[],o=0,s=copyAttributesDescriptions(e.attributes))}0!==a.length&&t.push(new Geometry({attributes:s,indices:a,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var scratchProjectTo2DCartesian3=new Cartesian3,scratchProjectTo2DCartographic=new Cartographic;GeometryPipeline.projectTo2D=function(e,t,i,r,n){for(var a=e.attributes[t],o=(n=defined(n)?n:new GeographicProjection).ellipsoid,s=a.values,l=new Float64Array(s.length),c=0,u=0;u<s.length;u+=3){var d=Cartesian3.fromArray(s,u,scratchProjectTo2DCartesian3),h=o.cartesianToCartographic(d,scratchProjectTo2DCartographic),p=n.project(h,scratchProjectTo2DCartesian3);l[c++]=p.x,l[c++]=p.y,l[c++]=p.z}return e.attributes[i]=a,e.attributes[r]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l}),delete e.attributes[t],e};var encodedResult={high:0,low:0};GeometryPipeline.encodeAttribute=function(e,t,i,r){for(var n=e.attributes[t],a=n.values,o=a.length,s=new Float32Array(o),l=new Float32Array(o),c=0;c<o;++c)EncodedCartesian3.encode(a[c],encodedResult),s[c]=encodedResult.high,l[c]=encodedResult.low;var u=n.componentsPerAttribute;return e.attributes[i]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:u,values:s}),e.attributes[r]=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:u,values:l}),delete e.attributes[t],e};var scratchCartesian3$4=new Cartesian3;function transformPoint(e,t){if(defined(t))for(var i=t.values,r=i.length,n=0;n<r;n+=3)Cartesian3.unpack(i,n,scratchCartesian3$4),Matrix4.multiplyByPoint(e,scratchCartesian3$4,scratchCartesian3$4),Cartesian3.pack(scratchCartesian3$4,i,n)}function transformVector(e,t){if(defined(t))for(var i=t.values,r=i.length,n=0;n<r;n+=3)Cartesian3.unpack(i,n,scratchCartesian3$4),Matrix3.multiplyByVector(e,scratchCartesian3$4,scratchCartesian3$4),scratchCartesian3$4=Cartesian3.normalize(scratchCartesian3$4,scratchCartesian3$4),Cartesian3.pack(scratchCartesian3$4,i,n)}var inverseTranspose=new Matrix4,normalMatrix=new Matrix3;function findAttributesInAllGeometries(e,t){var i,r=e.length,n={},a=e[0][t].attributes;for(i in a)if(a.hasOwnProperty(i)&&defined(a[i])&&defined(a[i].values)){for(var o=a[i],s=o.values.length,l=!0,c=1;c<r;++c){var u=e[c][t].attributes[i];if(!defined(u)||o.componentDatatype!==u.componentDatatype||o.componentsPerAttribute!==u.componentsPerAttribute||o.normalize!==u.normalize){l=!1;break}s+=u.values.length}l&&(n[i]=new GeometryAttribute({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:ComponentDatatype$1.createTypedArray(o.componentDatatype,s)}))}return n}GeometryPipeline.transformToWorldCoordinates=function(e){var t=e.modelMatrix;if(Matrix4.equals(t,Matrix4.IDENTITY))return e;var i=e.geometry.attributes;transformPoint(t,i.position),transformPoint(t,i.prevPosition),transformPoint(t,i.nextPosition),(defined(i.normal)||defined(i.tangent)||defined(i.bitangent))&&(Matrix4.inverse(t,inverseTranspose),Matrix4.transpose(inverseTranspose,inverseTranspose),Matrix4.getMatrix3(inverseTranspose,normalMatrix),transformVector(normalMatrix,i.normal),transformVector(normalMatrix,i.tangent),transformVector(normalMatrix,i.bitangent));var r=e.geometry.boundingSphere;return defined(r)&&(e.geometry.boundingSphere=BoundingSphere.transform(r,t,r)),e.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),e};var tempScratch=new Cartesian3;function combineGeometries(e,t){var i,r,n,a,o,s,l,c,u=e.length,d=(e[0].modelMatrix,defined(e[0][t].indices)),h=e[0][t].primitiveType,p=findAttributesInAllGeometries(e,t);for(i in p)if(p.hasOwnProperty(i))for(o=p[i].values,r=a=0;r<u;++r)for(l=(s=e[r][t].attributes[i].values).length,n=0;n<l;++n)o[a++]=s[n];if(d){var m=0;for(r=0;r<u;++r)m+=e[r][t].indices.length;var f=Geometry.computeNumberOfVertices(new Geometry({attributes:p,primitiveType:PrimitiveType$1.POINTS})),g=IndexDatatype$1.createTypedArray(f,m),_=0,y=0;for(r=0;r<u;++r){var v=e[r][t].indices,C=v.length;for(a=0;a<C;++a)g[_++]=y+v[a];y+=Geometry.computeNumberOfVertices(e[r][t])}c=g}var S,x=new Cartesian3,T=0;for(r=0;r<u;++r){if(!defined(S=e[r][t].boundingSphere)){x=void 0;break}Cartesian3.add(S.center,x,x)}if(defined(x))for(Cartesian3.divideByScalar(x,u,x),r=0;r<u;++r){S=e[r][t].boundingSphere;var b=Cartesian3.magnitude(Cartesian3.subtract(S.center,x,tempScratch))+S.radius;T<b&&(T=b)}return new Geometry({attributes:p,indices:c,primitiveType:h,boundingSphere:defined(x)?new BoundingSphere(x,T):void 0})}GeometryPipeline.combineInstances=function(e){for(var t=[],i=[],r=e.length,n=0;n<r;++n){var a=e[n];defined(a.geometry)?t.push(a):defined(a.westHemisphereGeometry)&&defined(a.eastHemisphereGeometry)&&i.push(a)}var o=[];return 0<t.length&&o.push(combineGeometries(t,"geometry")),0<i.length&&(o.push(combineGeometries(i,"westHemisphereGeometry")),o.push(combineGeometries(i,"eastHemisphereGeometry"))),o};var normal=new Cartesian3,v0=new Cartesian3,v1=new Cartesian3,v2=new Cartesian3;GeometryPipeline.computeNormal=function(e){var t,i=e.indices,r=e.attributes,n=r.position.values,a=r.position.values.length/3,o=i.length,s=new Array(a),l=new Array(o/3),c=new Array(o);for(t=0;t<a;t++)s[t]={indexOffset:0,count:0,currentCount:0};var u=0;for(t=0;t<o;t+=3){var d=i[t],h=i[t+1],p=i[t+2],m=3*d,f=3*h,g=3*p;v0.x=n[m],v0.y=n[1+m],v0.z=n[2+m],v1.x=n[f],v1.y=n[1+f],v1.z=n[2+f],v2.x=n[g],v2.y=n[1+g],v2.z=n[2+g],s[d].count++,s[h].count++,s[p].count++,Cartesian3.subtract(v1,v0,v1),Cartesian3.subtract(v2,v0,v2),l[u]=Cartesian3.cross(v1,v2,new Cartesian3),u++}var _,y=0;for(t=0;t<a;t++)s[t].indexOffset+=y,y+=s[t].count;for(t=u=0;t<o;t+=3){var v=(_=s[i[t]]).indexOffset+_.currentCount;c[v]=u,_.currentCount++,c[v=(_=s[i[t+1]]).indexOffset+_.currentCount]=u,_.currentCount++,c[v=(_=s[i[t+2]]).indexOffset+_.currentCount]=u,_.currentCount++,u++}var C=new Float32Array(3*a);for(t=0;t<a;t++){var S=3*t;if(_=s[t],Cartesian3.clone(Cartesian3.ZERO,normal),0<_.count){for(u=0;u<_.count;u++)Cartesian3.add(normal,l[c[_.indexOffset+u]],normal);Cartesian3.equalsEpsilon(Cartesian3.ZERO,normal,CesiumMath.EPSILON10)&&Cartesian3.clone(l[c[_.indexOffset]],normal)}Cartesian3.equalsEpsilon(Cartesian3.ZERO,normal,CesiumMath.EPSILON10)&&(normal.z=1),Cartesian3.normalize(normal,normal),C[S]=normal.x,C[1+S]=normal.y,C[2+S]=normal.z}return e.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C}),e};var normalScratch$1=new Cartesian3,normalScale=new Cartesian3,tScratch=new Cartesian3;GeometryPipeline.computeTangentAndBitangent=function(e){e.attributes;var t,i,r,n,a=e.indices,o=e.attributes.position.values,s=e.attributes.normal.values,l=e.attributes.st.values,c=e.attributes.position.values.length/3,u=a.length,d=new Array(3*c);for(t=0;t<d.length;t++)d[t]=0;for(t=0;t<u;t+=3){var h=a[t],p=a[t+1],m=a[t+2];r=3*p,n=3*m;var f=2*h,g=2*p,_=2*m,y=o[i=3*h],v=o[i+1],C=o[i+2],S=l[f],x=l[1+f],T=l[1+g]-x,b=l[1+_]-x,E=1/((l[g]-S)*b-(l[_]-S)*T),P=(b*(o[r]-y)-T*(o[n]-y))*E,A=(b*(o[r+1]-v)-T*(o[n+1]-v))*E,w=(b*(o[r+2]-C)-T*(o[n+2]-C))*E;d[i]+=P,d[i+1]+=A,d[i+2]+=w,d[r]+=P,d[r+1]+=A,d[r+2]+=w,d[n]+=P,d[n+1]+=A,d[n+2]+=w}var D=new Float32Array(3*c),M=new Float32Array(3*c);for(t=0;t<c;t++){r=(i=3*t)+1,n=i+2;var I=Cartesian3.fromArray(s,i,normalScratch$1),R=Cartesian3.fromArray(d,i,tScratch),O=Cartesian3.dot(I,R);Cartesian3.multiplyByScalar(I,O,normalScale),Cartesian3.normalize(Cartesian3.subtract(R,normalScale,R),R),D[i]=R.x,D[r]=R.y,D[n]=R.z,Cartesian3.normalize(Cartesian3.cross(I,R,R),R),M[i]=R.x,M[r]=R.y,M[n]=R.z}return e.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:D}),e.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:M}),e};var scratchCartesian2$3=new Cartesian2,toEncode1=new Cartesian3,toEncode2=new Cartesian3,toEncode3=new Cartesian3,encodeResult2=new Cartesian2;function indexTriangles(e){if(defined(e.indices))return e;for(var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,t),r=0;r<t;++r)i[r]=r;return e.indices=i,e}function indexTriangleFan(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,3*(t-2));i[0]=1,i[1]=0,i[2]=2;for(var r=3,n=3;n<t;++n)i[r++]=n-1,i[r++]=0,i[r++]=n;return e.indices=i,e.primitiveType=PrimitiveType$1.TRIANGLES,e}function indexTriangleStrip(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,3*(t-2));i[0]=0,i[1]=1,i[2]=2,3<t&&(i[3]=0,i[4]=2,i[5]=3);for(var r=6,n=3;n<t-1;n+=2)i[r++]=n,i[r++]=n-1,i[r++]=n+1,n+2<t&&(i[r++]=n,i[r++]=n+1,i[r++]=n+2);return e.indices=i,e.primitiveType=PrimitiveType$1.TRIANGLES,e}function indexLines(e){if(defined(e.indices))return e;for(var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,t),r=0;r<t;++r)i[r]=r;return e.indices=i,e}function indexLineStrip(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,2*(t-1));i[0]=0,i[1]=1;for(var r=2,n=2;n<t;++n)i[r++]=n-1,i[r++]=n;return e.indices=i,e.primitiveType=PrimitiveType$1.LINES,e}function indexLineLoop(e){var t=Geometry.computeNumberOfVertices(e),i=IndexDatatype$1.createTypedArray(t,2*t);i[0]=0,i[1]=1;for(var r=2,n=2;n<t;++n)i[r++]=n-1,i[r++]=n;return i[r++]=t-1,i[r]=0,e.indices=i,e.primitiveType=PrimitiveType$1.LINES,e}function indexPrimitive(e){switch(e.primitiveType){case PrimitiveType$1.TRIANGLE_FAN:return indexTriangleFan(e);case PrimitiveType$1.TRIANGLE_STRIP:return indexTriangleStrip(e);case PrimitiveType$1.TRIANGLES:return indexTriangles(e);case PrimitiveType$1.LINE_STRIP:return indexLineStrip(e);case PrimitiveType$1.LINE_LOOP:return indexLineLoop(e);case PrimitiveType$1.LINES:return indexLines(e)}return e}function offsetPointFromXZPlane(e,t){Math.abs(e.y)<CesiumMath.EPSILON6&&(e.y=t?-CesiumMath.EPSILON6:CesiumMath.EPSILON6)}function offsetTriangleFromXZPlane(e,t,i){if(0!==e.y&&0!==t.y&&0!==i.y)return offsetPointFromXZPlane(e,e.y<0),offsetPointFromXZPlane(t,t.y<0),void offsetPointFromXZPlane(i,i.y<0);var r=Math.abs(e.y),n=Math.abs(t.y),a=Math.abs(i.y),o=(n<r?a<r?CesiumMath.sign(e.y):CesiumMath.sign(i.y):a<n?CesiumMath.sign(t.y):CesiumMath.sign(i.y))<0;offsetPointFromXZPlane(e,o),offsetPointFromXZPlane(t,o),offsetPointFromXZPlane(i,o)}GeometryPipeline.compressVertices=function(e){var t,i,r=e.attributes.extrudeDirection;if(defined(r)){var n=r.values;i=n.length/3;var a=new Float32Array(2*i),o=0;for(t=0;t<i;++t)Cartesian3.fromArray(n,3*t,toEncode1),Cartesian3.equals(toEncode1,Cartesian3.ZERO)?o+=2:(encodeResult2=AttributeCompression.octEncodeInRange(toEncode1,65535,encodeResult2),a[o++]=encodeResult2.x,a[o++]=encodeResult2.y);return e.attributes.compressedAttributes=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:a}),delete e.attributes.extrudeDirection,e}var s=e.attributes.normal,l=e.attributes.st,c=defined(s),u=defined(l);if(!c&&!u)return e;var d,h,p,m,f=e.attributes.tangent,g=e.attributes.bitangent,_=defined(f),y=defined(g);c&&(d=s.values),u&&(h=l.values),_&&(p=f.values),y&&(m=g.values);var v=i=(c?d.length:h.length)/(c?3:2),C=u&&c?2:1;C+=_||y?1:0;var S=new Float32Array(v*=C),x=0;for(t=0;t<i;++t){u&&(Cartesian2.fromArray(h,2*t,scratchCartesian2$3),S[x++]=AttributeCompression.compressTextureCoordinates(scratchCartesian2$3));var T=3*t;c&&defined(p)&&defined(m)?(Cartesian3.fromArray(d,T,toEncode1),Cartesian3.fromArray(p,T,toEncode2),Cartesian3.fromArray(m,T,toEncode3),AttributeCompression.octPack(toEncode1,toEncode2,toEncode3,scratchCartesian2$3),S[x++]=scratchCartesian2$3.x,S[x++]=scratchCartesian2$3.y):(c&&(Cartesian3.fromArray(d,T,toEncode1),S[x++]=AttributeCompression.octEncodeFloat(toEncode1)),_&&(Cartesian3.fromArray(p,T,toEncode1),S[x++]=AttributeCompression.octEncodeFloat(toEncode1)),y&&(Cartesian3.fromArray(m,T,toEncode1),S[x++]=AttributeCompression.octEncodeFloat(toEncode1)))}return e.attributes.compressedAttributes=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:C,values:S}),c&&delete e.attributes.normal,u&&delete e.attributes.st,y&&delete e.attributes.bitangent,_&&delete e.attributes.tangent,e};var c3=new Cartesian3;function getXZIntersectionOffsetPoints(e,t,i,r){Cartesian3.add(e,Cartesian3.multiplyByScalar(Cartesian3.subtract(t,e,c3),e.y/(e.y-t.y),c3),i),Cartesian3.clone(i,r),offsetPointFromXZPlane(i,!0),offsetPointFromXZPlane(r,!1)}var u1=new Cartesian3,u2=new Cartesian3,q1=new Cartesian3,q2=new Cartesian3,splitTriangleResult={positions:new Array(7),indices:new Array(9)};function splitTriangle(e,t,i){if(!(0<=e.x||0<=t.x||0<=i.x)){offsetTriangleFromXZPlane(e,t,i);var r=e.y<0,n=t.y<0,a=i.y<0,o=0;o+=r?1:0,o+=n?1:0,o+=a?1:0;var s=splitTriangleResult.indices;1==o?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,r?(getXZIntersectionOffsetPoints(e,t,u1,q1),getXZIntersectionOffsetPoints(e,i,u2,q2),s[0]=0,s[3]=1,s[4]=2,s[6]=1):n?(getXZIntersectionOffsetPoints(t,i,u1,q1),getXZIntersectionOffsetPoints(t,e,u2,q2),s[0]=1,s[3]=2,s[4]=0,s[6]=2):a&&(getXZIntersectionOffsetPoints(i,e,u1,q1),getXZIntersectionOffsetPoints(i,t,u2,q2),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2==o&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,r?n?a||(getXZIntersectionOffsetPoints(i,e,u1,q1),getXZIntersectionOffsetPoints(i,t,u2,q2),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(getXZIntersectionOffsetPoints(t,i,u1,q1),getXZIntersectionOffsetPoints(t,e,u2,q2),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(getXZIntersectionOffsetPoints(e,t,u1,q1),getXZIntersectionOffsetPoints(e,i,u2,q2),s[0]=1,s[1]=2,s[3]=1,s[6]=0));var l=splitTriangleResult.positions;return l[0]=e,l[1]=t,l[2]=i,l.length=3,1!=o&&2!=o||(l[3]=u1,l[4]=u2,l[5]=q1,l[6]=q2,l.length=7),splitTriangleResult}}function updateGeometryAfterSplit(e,t){var i=e.attributes;if(0!==i.position.values.length){for(var r in i)if(i.hasOwnProperty(r)&&defined(i[r])&&defined(i[r].values)){var n=i[r];n.values=ComponentDatatype$1.createTypedArray(n.componentDatatype,n.values)}var a=Geometry.computeNumberOfVertices(e);return e.indices=IndexDatatype$1.createTypedArray(a,e.indices),t&&(e.boundingSphere=BoundingSphere.fromVertices(i.position.values)),e}}function copyGeometryForSplit(e){var t=e.attributes,i={};for(var r in t)if(t.hasOwnProperty(r)&&defined(t[r])&&defined(t[r].values)){var n=t[r];i[r]=new GeometryAttribute({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return new Geometry({attributes:i,indices:[],primitiveType:e.primitiveType})}function updateInstanceAfterSplit(e,t,i){var r=defined(e.geometry.boundingSphere);t=updateGeometryAfterSplit(t,r),defined(i=updateGeometryAfterSplit(i,r))&&!defined(t)?e.geometry=i:!defined(i)&&defined(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=i,e.geometry=void 0)}function generateBarycentricInterpolateFunction(h,p){var m=new h,f=new h,g=new h;return function(e,t,i,r,n,a,o,s){var l=h.fromArray(n,e*p,m),c=h.fromArray(n,t*p,f),u=h.fromArray(n,i*p,g);h.multiplyByScalar(l,r.x,l),h.multiplyByScalar(c,r.y,c),h.multiplyByScalar(u,r.z,u);var d=h.add(l,c,l);h.add(d,u,d),s&&h.normalize(d,d),h.pack(d,a,o*p)}}var interpolateAndPackCartesian4=generateBarycentricInterpolateFunction(Cartesian4,4),interpolateAndPackCartesian3=generateBarycentricInterpolateFunction(Cartesian3,3),interpolateAndPackCartesian2=generateBarycentricInterpolateFunction(Cartesian2,2),interpolateAndPackBoolean=function(e,t,i,r,n,a,o){var s=n[e]*r.x,l=n[t]*r.y,c=n[i]*r.z;a[o]=s+l+c>CesiumMath.EPSILON6?1:0},p0Scratch=new Cartesian3,p1Scratch=new Cartesian3,p2Scratch=new Cartesian3,barycentricScratch=new Cartesian3;function computeTriangleAttributes(e,t,i,r,n,a,o,s,l,c,u,d,h,p,m,f){if(defined(a)||defined(o)||defined(s)||defined(l)||defined(c)||0!==p){var g=barycentricCoordinates(r,Cartesian3.fromArray(n,3*e,p0Scratch),Cartesian3.fromArray(n,3*t,p1Scratch),Cartesian3.fromArray(n,3*i,p2Scratch),barycentricScratch);if(defined(a)&&interpolateAndPackCartesian3(e,t,i,g,a,d.normal.values,f,!0),defined(c)){var _,y=Cartesian3.fromArray(c,3*e,p0Scratch),v=Cartesian3.fromArray(c,3*t,p1Scratch),C=Cartesian3.fromArray(c,3*i,p2Scratch);Cartesian3.multiplyByScalar(y,g.x,y),Cartesian3.multiplyByScalar(v,g.y,v),Cartesian3.multiplyByScalar(C,g.z,C),Cartesian3.equals(y,Cartesian3.ZERO)&&Cartesian3.equals(v,Cartesian3.ZERO)&&Cartesian3.equals(C,Cartesian3.ZERO)?((_=p0Scratch).x=0,_.y=0,_.z=0):(_=Cartesian3.add(y,v,y),Cartesian3.add(_,C,_),Cartesian3.normalize(_,_)),Cartesian3.pack(_,d.extrudeDirection.values,3*f)}if(defined(u)&&interpolateAndPackBoolean(e,t,i,g,u,d.applyOffset.values,f),defined(o)&&interpolateAndPackCartesian3(e,t,i,g,o,d.tangent.values,f,!0),defined(s)&&interpolateAndPackCartesian3(e,t,i,g,s,d.bitangent.values,f,!0),defined(l)&&interpolateAndPackCartesian2(e,t,i,g,l,d.st.values,f),0<p)for(var S=0;S<p;S++){var x=h[S];genericInterpolate(e,t,i,g,f,m[x],d[x])}}}function genericInterpolate(e,t,i,r,n,a,o){var s=a.componentsPerAttribute,l=a.values,c=o.values;switch(s){case 4:interpolateAndPackCartesian4(e,t,i,r,l,c,n,!1);break;case 3:interpolateAndPackCartesian3(e,t,i,r,l,c,n,!1);break;case 2:interpolateAndPackCartesian2(e,t,i,r,l,c,n,!1);break;default:c[n]=l[e]*r.x+l[t]*r.y+l[i]*r.z}}function insertSplitPoint(e,t,i,r,n,a){var o=e.position.values.length/3;if(-1===n)return e.position.values.push(a.x,a.y,a.z),t.push(o),o;var s=r[n],l=i[s];return-1===l?(i[s]=o,e.position.values.push(a.x,a.y,a.z),t.push(o),o):(t.push(l),l)}var NAMED_ATTRIBUTES={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function splitLongitudeTriangles(e){var t=e.geometry,i=t.attributes,r=i.position.values,n=defined(i.normal)?i.normal.values:void 0,a=defined(i.bitangent)?i.bitangent.values:void 0,o=defined(i.tangent)?i.tangent.values:void 0,s=defined(i.st)?i.st.values:void 0,l=defined(i.extrudeDirection)?i.extrudeDirection.values:void 0,c=defined(i.applyOffset)?i.applyOffset.values:void 0,u=t.indices,d=[];for(var h in i)i.hasOwnProperty(h)&&!NAMED_ATTRIBUTES[h]&&defined(i[h])&&d.push(h);var p,m,f,g,_=d.length,y=copyGeometryForSplit(t),v=copyGeometryForSplit(t),C=[];C.length=r.length/3;var S=[];for(S.length=r.length/3,g=0;g<C.length;++g)C[g]=-1,S[g]=-1;var x=u.length;for(g=0;g<x;g+=3){var T=u[g],b=u[g+1],E=u[g+2],P=Cartesian3.fromArray(r,3*T),A=Cartesian3.fromArray(r,3*b),w=Cartesian3.fromArray(r,3*E),D=splitTriangle(P,A,w);if(defined(D)&&3<D.positions.length)for(var M=D.positions,I=D.indices,R=I.length,O=0;O<R;++O){var L=I[O],F=M[L];f=F.y<0?(p=v.attributes,m=v.indices,C):(p=y.attributes,m=y.indices,S),computeTriangleAttributes(T,b,E,F,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,m,f,u,L<3?g+L:-1,F))}else defined(D)&&(P=D.positions[0],A=D.positions[1],w=D.positions[2]),f=P.y<0?(p=v.attributes,m=v.indices,C):(p=y.attributes,m=y.indices,S),computeTriangleAttributes(T,b,E,P,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,m,f,u,g,P)),computeTriangleAttributes(T,b,E,A,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,m,f,u,g+1,A)),computeTriangleAttributes(T,b,E,w,r,n,o,a,s,l,c,p,d,_,i,insertSplitPoint(p,m,f,u,g+2,w))}updateInstanceAfterSplit(e,v,y)}var xzPlane=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),offsetScratch=new Cartesian3,offsetPointScratch=new Cartesian3;function computeLineAttributes(e,t,i,r,n,a,o){if(defined(o)){var s=Cartesian3.fromArray(r,3*e,p0Scratch);Cartesian3.equalsEpsilon(s,i,CesiumMath.EPSILON10)?a.applyOffset.values[n]=o[e]:a.applyOffset.values[n]=o[t]}}function splitLongitudeLines(e){var t,i=e.geometry,r=i.attributes,n=r.position.values,a=defined(r.applyOffset)?r.applyOffset.values:void 0,o=i.indices,s=copyGeometryForSplit(i),l=copyGeometryForSplit(i),c=o.length,u=[];u.length=n.length/3;var d=[];for(d.length=n.length/3,t=0;t<u.length;++t)u[t]=-1,d[t]=-1;for(t=0;t<c;t+=2){var h=o[t],p=o[t+1],m=Cartesian3.fromArray(n,3*h,p0Scratch),f=Cartesian3.fromArray(n,3*p,p1Scratch);Math.abs(m.y)<CesiumMath.EPSILON6&&(m.y<0?m.y=-CesiumMath.EPSILON6:m.y=CesiumMath.EPSILON6),Math.abs(f.y)<CesiumMath.EPSILON6&&(f.y<0?f.y=-CesiumMath.EPSILON6:f.y=CesiumMath.EPSILON6);var g=s.attributes,_=s.indices,y=d,v=l.attributes,C=l.indices,S=u,x=IntersectionTests.lineSegmentPlane(m,f,xzPlane,p2Scratch);if(defined(x)){var T=Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y,5*CesiumMath.EPSILON9,offsetScratch);m.y<0&&(Cartesian3.negate(T,T),g=l.attributes,_=l.indices,y=u,v=s.attributes,C=s.indices,S=d);var b=Cartesian3.add(x,T,offsetPointScratch);computeLineAttributes(h,p,m,n,insertSplitPoint(g,_,y,o,t,m),g,a),computeLineAttributes(h,p,b,n,insertSplitPoint(g,_,y,o,-1,b),g,a),Cartesian3.negate(T,T),Cartesian3.add(x,T,b),computeLineAttributes(h,p,b,n,insertSplitPoint(v,C,S,o,-1,b),v,a),computeLineAttributes(h,p,f,n,insertSplitPoint(v,C,S,o,t+1,f),v,a)}else{var E,P,A;A=m.y<0?(E=l.attributes,P=l.indices,u):(E=s.attributes,P=s.indices,d),computeLineAttributes(h,p,m,n,insertSplitPoint(E,P,A,o,t,m),E,a),computeLineAttributes(h,p,f,n,insertSplitPoint(E,P,A,o,t+1,f),E,a)}}updateInstanceAfterSplit(e,l,s)}var cartesian2Scratch0=new Cartesian2,cartesian2Scratch1=new Cartesian2,cartesian3Scratch0=new Cartesian3,cartesian3Scratch2=new Cartesian3,cartesian3Scratch3=new Cartesian3,cartesian3Scratch4=new Cartesian3,cartesian3Scratch5=new Cartesian3,cartesian3Scratch6=new Cartesian3,cartesian4Scratch0=new Cartesian4;function updateAdjacencyAfterSplit(e){for(var t=e.attributes,i=t.position.values,r=t.prevPosition.values,n=t.nextPosition.values,a=i.length,o=0;o<a;o+=3){var s=Cartesian3.unpack(i,o,cartesian3Scratch0);if(!(0<s.x)){var l=Cartesian3.unpack(r,o,cartesian3Scratch2);(s.y<0&&0<l.y||0<s.y&&l.y<0)&&(0<o-3?(r[o]=i[o-3],r[o+1]=i[o-2],r[o+2]=i[o-1]):Cartesian3.pack(s,r,o));var c=Cartesian3.unpack(n,o,cartesian3Scratch3);(s.y<0&&0<c.y||0<s.y&&c.y<0)&&(o+3<a?(n[o]=i[o+3],n[o+1]=i[o+4],n[o+2]=i[o+5]):Cartesian3.pack(s,n,o))}}}var offsetScalar=5*CesiumMath.EPSILON9,coplanarOffset=CesiumMath.EPSILON6;function splitLongitudePolyline(e){var t,i,r,n=e.geometry,a=n.attributes,o=a.position.values,s=a.prevPosition.values,l=a.nextPosition.values,c=a.expandAndWidth.values,u=defined(a.st)?a.st.values:void 0,d=defined(a.color)?a.color.values:void 0,h=copyGeometryForSplit(n),p=copyGeometryForSplit(n),m=!1,f=o.length/3;for(t=0;t<f;t+=4){var g=t,_=t+2,y=Cartesian3.fromArray(o,3*g,cartesian3Scratch0),v=Cartesian3.fromArray(o,3*_,cartesian3Scratch2);if(Math.abs(y.y)<coplanarOffset)for(y.y=coplanarOffset*(v.y<0?-1:1),o[3*t+1]=y.y,o[3*(t+1)+1]=y.y,i=3*g;i<3*g+12;i+=3)s[i]=o[3*t],s[i+1]=o[3*t+1],s[i+2]=o[3*t+2];if(Math.abs(v.y)<coplanarOffset)for(v.y=coplanarOffset*(y.y<0?-1:1),o[3*(t+2)+1]=v.y,o[3*(t+3)+1]=v.y,i=3*g;i<3*g+12;i+=3)l[i]=o[3*(t+2)],l[i+1]=o[3*(t+2)+1],l[i+2]=o[3*(t+2)+2];var C=h.attributes,S=h.indices,x=p.attributes,T=p.indices,b=IntersectionTests.lineSegmentPlane(y,v,xzPlane,cartesian3Scratch4);if(defined(b)){m=!0;var E=Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y,offsetScalar,cartesian3Scratch5);y.y<0&&(Cartesian3.negate(E,E),C=p.attributes,S=p.indices,x=h.attributes,T=h.indices);var P=Cartesian3.add(b,E,cartesian3Scratch6);C.position.values.push(y.x,y.y,y.z,y.x,y.y,y.z),C.position.values.push(P.x,P.y,P.z),C.position.values.push(P.x,P.y,P.z),C.prevPosition.values.push(s[3*g],s[3*g+1],s[3*g+2]),C.prevPosition.values.push(s[3*g+3],s[3*g+4],s[3*g+5]),C.prevPosition.values.push(y.x,y.y,y.z,y.x,y.y,y.z),C.nextPosition.values.push(P.x,P.y,P.z),C.nextPosition.values.push(P.x,P.y,P.z),C.nextPosition.values.push(P.x,P.y,P.z),C.nextPosition.values.push(P.x,P.y,P.z),Cartesian3.negate(E,E),Cartesian3.add(b,E,P),x.position.values.push(P.x,P.y,P.z),x.position.values.push(P.x,P.y,P.z),x.position.values.push(v.x,v.y,v.z,v.x,v.y,v.z),x.prevPosition.values.push(P.x,P.y,P.z),x.prevPosition.values.push(P.x,P.y,P.z),x.prevPosition.values.push(P.x,P.y,P.z),x.prevPosition.values.push(P.x,P.y,P.z),x.nextPosition.values.push(v.x,v.y,v.z,v.x,v.y,v.z),x.nextPosition.values.push(l[3*_],l[3*_+1],l[3*_+2]),x.nextPosition.values.push(l[3*_+3],l[3*_+4],l[3*_+5]);var A=Cartesian2.fromArray(c,2*g,cartesian2Scratch0),w=Math.abs(A.y);C.expandAndWidth.values.push(-1,w,1,w),C.expandAndWidth.values.push(-1,-w,1,-w),x.expandAndWidth.values.push(-1,w,1,w),x.expandAndWidth.values.push(-1,-w,1,-w);var D=Cartesian3.magnitudeSquared(Cartesian3.subtract(b,y,cartesian3Scratch3));if(D/=Cartesian3.magnitudeSquared(Cartesian3.subtract(v,y,cartesian3Scratch3)),defined(d)){var M=Cartesian4.fromArray(d,4*g,cartesian4Scratch0),I=Cartesian4.fromArray(d,4*_,cartesian4Scratch0),R=CesiumMath.lerp(M.x,I.x,D),O=CesiumMath.lerp(M.y,I.y,D),L=CesiumMath.lerp(M.z,I.z,D),F=CesiumMath.lerp(M.w,I.w,D);for(i=4*g;i<4*g+8;++i)C.color.values.push(d[i]);for(C.color.values.push(R,O,L,F),C.color.values.push(R,O,L,F),x.color.values.push(R,O,L,F),x.color.values.push(R,O,L,F),i=4*_;i<4*_+8;++i)x.color.values.push(d[i])}if(defined(u)){var N=Cartesian2.fromArray(u,2*g,cartesian2Scratch0),B=Cartesian2.fromArray(u,2*(t+3),cartesian2Scratch1),V=CesiumMath.lerp(N.x,B.x,D);for(i=2*g;i<2*g+4;++i)C.st.values.push(u[i]);for(C.st.values.push(V,N.y),C.st.values.push(V,B.y),x.st.values.push(V,N.y),x.st.values.push(V,B.y),i=2*_;i<2*_+4;++i)x.st.values.push(u[i])}r=C.position.values.length/3-4,S.push(r,r+2,r+1),S.push(r+1,r+2,r+3),r=x.position.values.length/3-4,T.push(r,r+2,r+1),T.push(r+1,r+2,r+3)}else{var k,$;for($=y.y<0?(k=p.attributes,p.indices):(k=h.attributes,h.indices),k.position.values.push(y.x,y.y,y.z),k.position.values.push(y.x,y.y,y.z),k.position.values.push(v.x,v.y,v.z),k.position.values.push(v.x,v.y,v.z),i=3*t;i<3*t+12;++i)k.prevPosition.values.push(s[i]),k.nextPosition.values.push(l[i]);for(i=2*t;i<2*t+8;++i)k.expandAndWidth.values.push(c[i]),defined(u)&&k.st.values.push(u[i]);if(defined(d))for(i=4*t;i<4*t+16;++i)k.color.values.push(d[i]);r=k.position.values.length/3-4,$.push(r,r+2,r+1),$.push(r+1,r+2,r+3)}}m&&(updateAdjacencyAfterSplit(p),updateAdjacencyAfterSplit(h)),updateInstanceAfterSplit(e,p,h)}GeometryPipeline.splitLongitude=function(e){var t=e.geometry,i=t.boundingSphere;if(defined(i)&&(0<i.center.x-i.radius||BoundingSphere.intersectPlane(i,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING))return e;if(t.geometryType!==GeometryType$1.NONE)switch(t.geometryType){case GeometryType$1.POLYLINES:splitLongitudePolyline(e);break;case GeometryType$1.TRIANGLES:splitLongitudeTriangles(e);break;case GeometryType$1.LINES:splitLongitudeLines(e)}else indexPrimitive(t),t.primitiveType===PrimitiveType$1.TRIANGLES?splitLongitudeTriangles(e):t.primitiveType===PrimitiveType$1.LINES&&splitLongitudeLines(e);return e};var scratchCartesian1$3=new Cartesian3,scratchCartesian2$4=new Cartesian3,scratchCartesian3$5=new Cartesian3,scratchCartesian4$1=new Cartesian3,texCoordScratch=new Cartesian2,textureMatrixScratch=new Matrix3,tangentMatrixScratch=new Matrix3,quaternionScratch=new Quaternion,scratchNormal$2=new Cartesian3,scratchTangent=new Cartesian3,scratchBitangent=new Cartesian3,scratchCartographic$1=new Cartographic,projectedCenterScratch=new Cartesian3,scratchMinTexCoord=new Cartesian2,scratchMaxTexCoord=new Cartesian2;function computeTopBottomAttributes(e,t,i){var r=t.vertexFormat,n=t.center,a=t.semiMajorAxis,o=t.semiMinorAxis,s=t.ellipsoid,l=t.stRotation,c=i?e.length/3*2:e.length/3,u=t.shadowVolume,d=r.st?new Float32Array(2*c):void 0,h=r.normal?new Float32Array(3*c):void 0,p=r.tangent?new Float32Array(3*c):void 0,m=r.bitangent?new Float32Array(3*c):void 0,f=u?new Float32Array(3*c):void 0,g=0,_=scratchNormal$2,y=scratchTangent,v=scratchBitangent,C=new GeographicProjection(s),S=C.project(s.cartesianToCartographic(n,scratchCartographic$1),projectedCenterScratch),x=s.scaleToGeodeticSurface(n,scratchCartesian1$3);s.geodeticSurfaceNormal(x,x);var T=textureMatrixScratch,b=tangentMatrixScratch;if(0!==l){var E=Quaternion.fromAxisAngle(x,l,quaternionScratch);T=Matrix3.fromQuaternion(E,T),E=Quaternion.fromAxisAngle(x,-l,quaternionScratch),b=Matrix3.fromQuaternion(E,b)}else T=Matrix3.clone(Matrix3.IDENTITY,T),b=Matrix3.clone(Matrix3.IDENTITY,b);for(var P=Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,scratchMinTexCoord),A=Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,scratchMaxTexCoord),w=e.length,D=i?w:0,M=D/3*2,I=0;I<w;I+=3){var R=I+1,O=I+2,L=Cartesian3.fromArray(e,I,scratchCartesian1$3);if(r.st){var F=Matrix3.multiplyByVector(T,L,scratchCartesian2$4),N=C.project(s.cartesianToCartographic(F,scratchCartographic$1),scratchCartesian3$5);Cartesian3.subtract(N,S,N),texCoordScratch.x=(N.x+a)/(2*a),texCoordScratch.y=(N.y+o)/(2*o),P.x=Math.min(texCoordScratch.x,P.x),P.y=Math.min(texCoordScratch.y,P.y),A.x=Math.max(texCoordScratch.x,A.x),A.y=Math.max(texCoordScratch.y,A.y),i&&(d[g+M]=texCoordScratch.x,d[g+1+M]=texCoordScratch.y),d[g++]=texCoordScratch.x,d[g++]=texCoordScratch.y}(r.normal||r.tangent||r.bitangent||u)&&(_=s.geodeticSurfaceNormal(L,_),u&&(f[I+D]=-_.x,f[R+D]=-_.y,f[O+D]=-_.z),(r.normal||r.tangent||r.bitangent)&&((r.tangent||r.bitangent)&&(y=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,_,y),y),Matrix3.multiplyByVector(b,y,y)),r.normal&&(h[I]=_.x,h[R]=_.y,h[O]=_.z,i&&(h[I+D]=-_.x,h[R+D]=-_.y,h[O+D]=-_.z)),r.tangent&&(p[I]=y.x,p[R]=y.y,p[O]=y.z,i&&(p[I+D]=-y.x,p[R+D]=-y.y,p[O+D]=-y.z)),r.bitangent&&(v=Cartesian3.normalize(Cartesian3.cross(_,y,v),v),m[I]=v.x,m[R]=v.y,m[O]=v.z,i&&(m[I+D]=v.x,m[R+D]=v.y,m[O+D]=v.z))))}if(r.st){w=d.length;for(var B=0;B<w;B+=2)d[B]=(d[B]-P.x)/(A.x-P.x),d[B+1]=(d[B+1]-P.y)/(A.y-P.y)}var V=new GeometryAttributes;if(r.position){var k=EllipseGeometryLibrary.raisePositionsToHeight(e,t,i);V.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:k})}if(r.st&&(V.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:d})),r.normal&&(V.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),r.tangent&&(V.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),r.bitangent&&(V.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),u&&(V.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),i&&defined(t.offsetAttribute)){var $=new Uint8Array(c);if(t.offsetAttribute===GeometryOffsetAttribute$1.TOP)$=arrayFill($,1,0,c/2);else $=arrayFill($,t.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);V.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:$})}return V}function topIndices(e){var t,i,r,n,a,o=new Array(e*(e+1)*12-6),s=0;for(r=1,n=t=0;n<3;n++)o[s++]=r++,o[s++]=t,o[s++]=r;for(n=2;n<e+1;++n){for(r=n*(n+1)-1,t=(n-1)*n-1,o[s++]=r++,o[s++]=t,o[s++]=r,i=2*n,a=0;a<i-1;++a)o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t,o[s++]=r;o[s++]=r++,o[s++]=t,o[s++]=r}for(i=2*e,++r,++t,n=0;n<i-1;++n)o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t,o[s++]=r;for(o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t++,o[s++]=t,++t,n=e-1;1<n;--n){for(o[s++]=t++,o[s++]=t,o[s++]=r,i=2*n,a=0;a<i-1;++a)o[s++]=r,o[s++]=t++,o[s++]=t,o[s++]=r++,o[s++]=t,o[s++]=r;o[s++]=t++,o[s++]=t++,o[s++]=r++}for(n=0;n<3;n++)o[s++]=t++,o[s++]=t,o[s++]=r;return o}var boundingSphereCenter=new Cartesian3;function computeEllipse(e){var t=e.center;boundingSphereCenter=Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,boundingSphereCenter),e.height,boundingSphereCenter);var i=new BoundingSphere(boundingSphereCenter=Cartesian3.add(t,boundingSphereCenter,boundingSphereCenter),e.semiMajorAxis),r=EllipseGeometryLibrary.computeEllipsePositions(e,!0,!1),n=r.positions,a=r.numPts,o=computeTopBottomAttributes(n,e,!1),s=topIndices(a);return{boundingSphere:i,attributes:o,indices:s=IndexDatatype$1.createTypedArray(n.length/3,s)}}function computeWallAttributes(e,t){var i=t.vertexFormat,r=t.center,n=t.semiMajorAxis,a=t.semiMinorAxis,o=t.ellipsoid,s=t.height,l=t.extrudedHeight,c=t.stRotation,u=e.length/3*2,d=new Float64Array(3*u),h=i.st?new Float32Array(2*u):void 0,p=i.normal?new Float32Array(3*u):void 0,m=i.tangent?new Float32Array(3*u):void 0,f=i.bitangent?new Float32Array(3*u):void 0,g=t.shadowVolume,_=g?new Float32Array(3*u):void 0,y=0,v=scratchNormal$2,C=scratchTangent,S=scratchBitangent,x=new GeographicProjection(o),T=x.project(o.cartesianToCartographic(r,scratchCartographic$1),projectedCenterScratch),b=o.scaleToGeodeticSurface(r,scratchCartesian1$3);o.geodeticSurfaceNormal(b,b);for(var E=Quaternion.fromAxisAngle(b,c,quaternionScratch),P=Matrix3.fromQuaternion(E,textureMatrixScratch),A=Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,scratchMinTexCoord),w=Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,scratchMaxTexCoord),D=e.length,M=D/3*2,I=0;I<D;I+=3){var R,O=I+1,L=I+2,F=Cartesian3.fromArray(e,I,scratchCartesian1$3);if(i.st){var N=Matrix3.multiplyByVector(P,F,scratchCartesian2$4),B=x.project(o.cartesianToCartographic(N,scratchCartographic$1),scratchCartesian3$5);Cartesian3.subtract(B,T,B),texCoordScratch.x=(B.x+n)/(2*n),texCoordScratch.y=(B.y+a)/(2*a),A.x=Math.min(texCoordScratch.x,A.x),A.y=Math.min(texCoordScratch.y,A.y),w.x=Math.max(texCoordScratch.x,w.x),w.y=Math.max(texCoordScratch.y,w.y),h[y+M]=texCoordScratch.x,h[y+1+M]=texCoordScratch.y,h[y++]=texCoordScratch.x,h[y++]=texCoordScratch.y}F=o.scaleToGeodeticSurface(F,F),R=Cartesian3.clone(F,scratchCartesian2$4),v=o.geodeticSurfaceNormal(F,v),g&&(_[I+D]=-v.x,_[O+D]=-v.y,_[L+D]=-v.z);var V=Cartesian3.multiplyByScalar(v,s,scratchCartesian4$1);if(F=Cartesian3.add(F,V,F),V=Cartesian3.multiplyByScalar(v,l,V),R=Cartesian3.add(R,V,R),i.position&&(d[I+D]=R.x,d[O+D]=R.y,d[L+D]=R.z,d[I]=F.x,d[O]=F.y,d[L]=F.z),i.normal||i.tangent||i.bitangent){S=Cartesian3.clone(v,S);var k=Cartesian3.fromArray(e,(I+3)%D,scratchCartesian4$1);Cartesian3.subtract(k,F,k);var $=Cartesian3.subtract(R,F,scratchCartesian3$5);v=Cartesian3.normalize(Cartesian3.cross($,k,v),v),i.normal&&(p[I]=v.x,p[O]=v.y,p[L]=v.z,p[I+D]=v.x,p[O+D]=v.y,p[L+D]=v.z),i.tangent&&(C=Cartesian3.normalize(Cartesian3.cross(S,v,C),C),m[I]=C.x,m[O]=C.y,m[L]=C.z,m[I+D]=C.x,m[I+1+D]=C.y,m[I+2+D]=C.z),i.bitangent&&(f[I]=S.x,f[O]=S.y,f[L]=S.z,f[I+D]=S.x,f[O+D]=S.y,f[L+D]=S.z)}}if(i.st){D=h.length;for(var z=0;z<D;z+=2)h[z]=(h[z]-A.x)/(w.x-A.x),h[z+1]=(h[z+1]-A.y)/(w.y-A.y)}var U=new GeometryAttributes;if(i.position&&(U.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:d})),i.st&&(U.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:h})),i.normal&&(U.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),i.tangent&&(U.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),i.bitangent&&(U.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),g&&(U.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),defined(t.offsetAttribute)){var G=new Uint8Array(u);if(t.offsetAttribute===GeometryOffsetAttribute$1.TOP)G=arrayFill(G,1,0,u/2);else G=arrayFill(G,t.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);U.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:G})}return U}function computeWallIndices(e){for(var t=e.length/3,i=IndexDatatype$1.createTypedArray(t,6*t),r=0,n=0;n<t;n++){var a=n,o=n+t,s=(a+1)%t,l=s+t;i[r++]=a,i[r++]=o,i[r++]=s,i[r++]=s,i[r++]=o,i[r++]=l}return i}var topBoundingSphere=new BoundingSphere,bottomBoundingSphere=new BoundingSphere;function computeExtrudedEllipse(e){var t=e.center,i=e.ellipsoid,r=e.semiMajorAxis,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,scratchCartesian1$3),e.height,scratchCartesian1$3);topBoundingSphere.center=Cartesian3.add(t,n,topBoundingSphere.center),topBoundingSphere.radius=r,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,n),e.extrudedHeight,n),bottomBoundingSphere.center=Cartesian3.add(t,n,bottomBoundingSphere.center),bottomBoundingSphere.radius=r;var a=EllipseGeometryLibrary.computeEllipsePositions(e,!0,!0),o=a.positions,s=a.numPts,l=a.outerPositions,c=BoundingSphere.union(topBoundingSphere,bottomBoundingSphere),u=computeTopBottomAttributes(o,e,!0),d=topIndices(s),h=d.length;d.length=2*h;for(var p=o.length/3,m=0;m<h;m+=3)d[m+h]=d[m+2]+p,d[m+1+h]=d[m+1]+p,d[m+2+h]=d[m]+p;var f=new Geometry({attributes:u,indices:IndexDatatype$1.createTypedArray(2*p/3,d),primitiveType:PrimitiveType$1.TRIANGLES}),g=computeWallAttributes(l,e);d=computeWallIndices(l);var _=new Geometry({attributes:g,indices:IndexDatatype$1.createTypedArray(2*l.length/3,d),primitiveType:PrimitiveType$1.TRIANGLES}),y=GeometryPipeline.combineInstances([new GeometryInstance({geometry:f}),new GeometryInstance({geometry:_})]);return{boundingSphere:c,attributes:y[0].attributes,indices:y[0].indices}}function computeRectangle(e,t,i,r,n,a,o){for(var s=EllipseGeometryLibrary.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:i,rotation:r,granularity:n},!1,!0).outerPositions,l=s.length/3,c=new Array(l),u=0;u<l;++u)c[u]=Cartesian3.fromArray(s,3*u);var d=Rectangle.fromCartesianArray(c,a,o);return d.width>CesiumMath.PI&&(d.north=0<d.north?CesiumMath.PI_OVER_TWO-CesiumMath.EPSILON7:d.north,d.south=d.south<0?CesiumMath.EPSILON7-CesiumMath.PI_OVER_TWO:d.south,d.east=CesiumMath.PI,d.west=-CesiumMath.PI),d}function EllipseGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=e.semiMajorAxis,n=e.semiMinorAxis,a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),s=defaultValue(e.height,0),l=defaultValue(e.extrudedHeight,s);this._center=Cartesian3.clone(t),this._semiMajorAxis=r,this._semiMinorAxis=n,this._ellipsoid=Ellipsoid.clone(i),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._height=Math.max(l,s),this._granularity=a,this._vertexFormat=VertexFormat.clone(o),this._extrudedHeight=Math.min(l,s),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}EllipseGeometry.packedLength=Cartesian3.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+9,EllipseGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._semiMajorAxis,t[i++]=e._semiMinorAxis,t[i++]=e._rotation,t[i++]=e._stRotation,t[i++]=e._height,t[i++]=e._granularity,t[i++]=e._extrudedHeight,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchCenter$1=new Cartesian3,scratchEllipsoid=new Ellipsoid,scratchVertexFormat$1=new VertexFormat,scratchOptions$2={center:scratchCenter$1,ellipsoid:scratchEllipsoid,vertexFormat:scratchVertexFormat$1,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};function textureCoordinateRotationPoints(e){var t=-e._stRotation;if(0==t)return[0,0,0,1,1,0];for(var i=EllipseGeometryLibrary.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,r=i.length/3,n=new Array(r),a=0;a<r;++a)n[a]=Cartesian3.fromArray(i,3*a);var o=e._ellipsoid,s=e.rectangle;return Geometry._textureCoordinateRotationPoints(n,t,o,s)}function CircleGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radius,i={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,vertexFormat:e.vertexFormat,stRotation:e.stRotation,shadowVolume:e.shadowVolume};this._ellipseGeometry=new EllipseGeometry(i),this._workerName="createCircleGeometry"}EllipseGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchCenter$1);t+=Cartesian3.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$1);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],p=1===e[t++],m=e[t];return defined(i)?(i._center=Cartesian3.clone(r,i._center),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._semiMajorAxis=o,i._semiMinorAxis=s,i._rotation=l,i._stRotation=c,i._height=u,i._granularity=d,i._extrudedHeight=h,i._shadowVolume=p,i._offsetAttribute=-1===m?void 0:m,i):(scratchOptions$2.height=u,scratchOptions$2.extrudedHeight=h,scratchOptions$2.granularity=d,scratchOptions$2.stRotation=c,scratchOptions$2.rotation=l,scratchOptions$2.semiMajorAxis=o,scratchOptions$2.semiMinorAxis=s,scratchOptions$2.shadowVolume=p,scratchOptions$2.offsetAttribute=-1===m?void 0:m,new EllipseGeometry(scratchOptions$2))},EllipseGeometry.computeRectangle=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=e.semiMajorAxis,a=e.semiMinorAxis,o=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);return computeRectangle(i,n,a,defaultValue(e.rotation,0),o,r,t)},EllipseGeometry.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var t=e._height,i=e._extrudedHeight,r=!CesiumMath.equalsEpsilon(t,i,0,CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var n,a={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};if(r)a.extrudedHeight=i,a.shadowVolume=e._shadowVolume,a.offsetAttribute=e._offsetAttribute,n=computeExtrudedEllipse(a);else if(n=computeEllipse(a),defined(e._offsetAttribute)){var o=n.attributes.position.values.length,s=new Uint8Array(o/3);arrayFill(s,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),n.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:s})}return new Geometry({attributes:n.attributes,indices:n.indices,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:n.boundingSphere,offsetAttribute:e._offsetAttribute})}},EllipseGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new EllipseGeometry({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:n,rotation:e._rotation,stRotation:e._stRotation,granularity:r,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},defineProperties$1(EllipseGeometry.prototype,{rectangle:{get:function(){return defined(this._rectangle)||(this._rectangle=computeRectangle(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints(this)),this._textureCoordinateRotationPoints}}}),CircleGeometry.packedLength=EllipseGeometry.packedLength,CircleGeometry.pack=function(e,t,i){return EllipseGeometry.pack(e._ellipseGeometry,t,i)};var scratchEllipseGeometry=new EllipseGeometry({center:new Cartesian3,semiMajorAxis:1,semiMinorAxis:1}),scratchOptions$3={center:new Cartesian3,radius:void 0,ellipsoid:Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new VertexFormat,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0,shadowVolume:void 0};CircleGeometry.unpack=function(e,t,i){var r=EllipseGeometry.unpack(e,t,scratchEllipseGeometry);return scratchOptions$3.center=Cartesian3.clone(r._center,scratchOptions$3.center),scratchOptions$3.ellipsoid=Ellipsoid.clone(r._ellipsoid,scratchOptions$3.ellipsoid),scratchOptions$3.height=r._height,scratchOptions$3.extrudedHeight=r._extrudedHeight,scratchOptions$3.granularity=r._granularity,scratchOptions$3.vertexFormat=VertexFormat.clone(r._vertexFormat,scratchOptions$3.vertexFormat),scratchOptions$3.stRotation=r._stRotation,scratchOptions$3.shadowVolume=r._shadowVolume,defined(i)?(scratchOptions$3.semiMajorAxis=r._semiMajorAxis,scratchOptions$3.semiMinorAxis=r._semiMinorAxis,i._ellipseGeometry=new EllipseGeometry(scratchOptions$3),i):(scratchOptions$3.radius=r._semiMajorAxis,new CircleGeometry(scratchOptions$3))},CircleGeometry.createGeometry=function(e){return EllipseGeometry.createGeometry(e._ellipseGeometry)},CircleGeometry.createShadowVolume=function(e,t,i){var r=e._ellipseGeometry._granularity,n=e._ellipseGeometry._ellipsoid,a=t(r,n),o=i(r,n);return new CircleGeometry({center:e._ellipseGeometry._center,radius:e._ellipseGeometry._semiMajorAxis,ellipsoid:n,stRotation:e._ellipseGeometry._stRotation,granularity:r,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},defineProperties$1(CircleGeometry.prototype,{rectangle:{get:function(){return this._ellipseGeometry.rectangle}},textureCoordinateRotationPoints:{get:function(){return this._ellipseGeometry.textureCoordinateRotationPoints}}});var scratchCartesian1$4=new Cartesian3,boundingSphereCenter$1=new Cartesian3;function computeEllipse$1(e){var t=e.center;boundingSphereCenter$1=Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,boundingSphereCenter$1),e.height,boundingSphereCenter$1);for(var i=new BoundingSphere(boundingSphereCenter$1=Cartesian3.add(t,boundingSphereCenter$1,boundingSphereCenter$1),e.semiMajorAxis),r=EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,n=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:EllipseGeometryLibrary.raisePositionsToHeight(r,e,!1)})}),a=r.length/3,o=IndexDatatype$1.createTypedArray(a,2*a),s=0,l=0;l<a;++l)o[s++]=l,o[s++]=(l+1)%a;return{boundingSphere:i,attributes:n,indices:o}}var topBoundingSphere$1=new BoundingSphere,bottomBoundingSphere$1=new BoundingSphere;function computeExtrudedEllipse$1(e){var t=e.center,i=e.ellipsoid,r=e.semiMajorAxis,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,scratchCartesian1$4),e.height,scratchCartesian1$4);topBoundingSphere$1.center=Cartesian3.add(t,n,topBoundingSphere$1.center),topBoundingSphere$1.radius=r,n=Cartesian3.multiplyByScalar(i.geodeticSurfaceNormal(t,n),e.extrudedHeight,n),bottomBoundingSphere$1.center=Cartesian3.add(t,n,bottomBoundingSphere$1.center),bottomBoundingSphere$1.radius=r;var a=EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,o=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:EllipseGeometryLibrary.raisePositionsToHeight(a,e,!0)})});a=o.position.values;var s=BoundingSphere.union(topBoundingSphere$1,bottomBoundingSphere$1),l=a.length/3;if(defined(e.offsetAttribute)){var c=new Uint8Array(l);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)c=arrayFill(c,1,0,l/2);else c=arrayFill(c,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);o.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}var u=defaultValue(e.numberOfVerticalLines,16);u=CesiumMath.clamp(u,0,l/2);var d=IndexDatatype$1.createTypedArray(l,2*l+2*u);l/=2;var h,p,m=0;for(h=0;h<l;++h)d[m++]=h,d[m++]=(h+1)%l,d[m++]=h+l,d[m++]=(h+1)%l+l;if(0<u){var f=Math.min(u,l);p=Math.round(l/f);var g=Math.min(p*u,l);for(h=0;h<g;h+=p)d[m++]=h,d[m++]=h+l}return{boundingSphere:s,attributes:o,indices:d}}function EllipseOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).center,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=e.semiMajorAxis,n=e.semiMinorAxis,a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.height,0),s=defaultValue(e.extrudedHeight,o);this._center=Cartesian3.clone(t),this._semiMajorAxis=r,this._semiMinorAxis=n,this._ellipsoid=Ellipsoid.clone(i),this._rotation=defaultValue(e.rotation,0),this._height=Math.max(s,o),this._granularity=a,this._extrudedHeight=Math.min(s,o),this._numberOfVerticalLines=Math.max(defaultValue(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}EllipseOutlineGeometry.packedLength=Cartesian3.packedLength+Ellipsoid.packedLength+8,EllipseOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._semiMajorAxis,t[i++]=e._semiMinorAxis,t[i++]=e._rotation,t[i++]=e._height,t[i++]=e._granularity,t[i++]=e._extrudedHeight,t[i++]=e._numberOfVerticalLines,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchCenter$2=new Cartesian3,scratchEllipsoid$1=new Ellipsoid,scratchOptions$4={center:scratchCenter$2,ellipsoid:scratchEllipsoid$1,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};function CircleOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radius,i={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,numberOfVerticalLines:e.numberOfVerticalLines};this._ellipseGeometry=new EllipseOutlineGeometry(i),this._workerName="createCircleOutlineGeometry"}EllipseOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchCenter$2);t+=Cartesian3.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$1);t+=Ellipsoid.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._center=Cartesian3.clone(r,i._center),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._semiMajorAxis=a,i._semiMinorAxis=o,i._rotation=s,i._height=l,i._granularity=c,i._extrudedHeight=u,i._numberOfVerticalLines=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$4.height=l,scratchOptions$4.extrudedHeight=u,scratchOptions$4.granularity=c,scratchOptions$4.rotation=s,scratchOptions$4.semiMajorAxis=a,scratchOptions$4.semiMinorAxis=o,scratchOptions$4.numberOfVerticalLines=d,scratchOptions$4.offsetAttribute=-1===h?void 0:h,new EllipseOutlineGeometry(scratchOptions$4))},EllipseOutlineGeometry.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var t=e._height,i=e._extrudedHeight,r=!CesiumMath.equalsEpsilon(t,i,0,CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var n,a={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};if(r)a.extrudedHeight=i,a.offsetAttribute=e._offsetAttribute,n=computeExtrudedEllipse$1(a);else if(n=computeEllipse$1(a),defined(e._offsetAttribute)){var o=n.attributes.position.values.length,s=new Uint8Array(o/3);arrayFill(s,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),n.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:s})}return new Geometry({attributes:n.attributes,indices:n.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:n.boundingSphere,offsetAttribute:e._offsetAttribute})}},CircleOutlineGeometry.packedLength=EllipseOutlineGeometry.packedLength,CircleOutlineGeometry.pack=function(e,t,i){return EllipseOutlineGeometry.pack(e._ellipseGeometry,t,i)};var scratchEllipseGeometry$1=new EllipseOutlineGeometry({center:new Cartesian3,semiMajorAxis:1,semiMinorAxis:1}),scratchOptions$5={center:new Cartesian3,radius:void 0,ellipsoid:Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,numberOfVerticalLines:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};CircleOutlineGeometry.unpack=function(e,t,i){var r=EllipseOutlineGeometry.unpack(e,t,scratchEllipseGeometry$1);return scratchOptions$5.center=Cartesian3.clone(r._center,scratchOptions$5.center),scratchOptions$5.ellipsoid=Ellipsoid.clone(r._ellipsoid,scratchOptions$5.ellipsoid),scratchOptions$5.height=r._height,scratchOptions$5.extrudedHeight=r._extrudedHeight,scratchOptions$5.granularity=r._granularity,scratchOptions$5.numberOfVerticalLines=r._numberOfVerticalLines,defined(i)?(scratchOptions$5.semiMajorAxis=r._semiMajorAxis,scratchOptions$5.semiMinorAxis=r._semiMinorAxis,i._ellipseGeometry=new EllipseOutlineGeometry(scratchOptions$5),i):(scratchOptions$5.radius=r._semiMajorAxis,new CircleOutlineGeometry(scratchOptions$5))},CircleOutlineGeometry.createGeometry=function(e){return EllipseOutlineGeometry.createGeometry(e._ellipseGeometry)};var ClockRange={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},ClockRange$1=freezeObject$1(ClockRange),ClockStep={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},ClockStep$1=freezeObject$1(ClockStep),getTimestamp;getTimestamp="undefined"!=typeof performance&&"function"==typeof performance.now&&isFinite(performance.now())?function(){return performance.now()}:function(){return Date.now()};var getTimestamp$1=getTimestamp,scratchArrayBuffer,scratchUint32Array,scratchUint8Array;function Clock(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).currentTime,i=e.startTime,r=e.stopTime;t=defined(t)?JulianDate.clone(t):defined(i)?JulianDate.clone(i):defined(r)?JulianDate.addDays(r,-1,new JulianDate):JulianDate.now(),i=defined(i)?JulianDate.clone(i):JulianDate.clone(t),r=defined(r)?JulianDate.clone(r):JulianDate.addDays(i,1,new JulianDate),this.startTime=i,this.stopTime=r,this.clockRange=defaultValue(e.clockRange,ClockRange$1.UNBOUNDED),this.canAnimate=defaultValue(e.canAnimate,!0),this.onTick=new Event,this.onStop=new Event,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=getTimestamp$1(),this.currentTime=t,this.multiplier=defaultValue(e.multiplier,1),this.shouldAnimate=defaultValue(e.shouldAnimate,!1),this.clockStep=defaultValue(e.clockStep,ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)}function hue2rgb(e,t,i){return i<0&&(i+=1),1<i&&(i-=1),6*i<1?e+6*(t-e)*i:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}function Color(e,t,i,r){this.red=defaultValue(e,1),this.green=defaultValue(t,1),this.blue=defaultValue(i,1),this.alpha=defaultValue(r,1)}defineProperties$1(Clock.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){JulianDate.equals(this._currentTime,e)||(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===ClockStep$1.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=JulianDate.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===ClockStep$1.SYSTEM_CLOCK&&(this._clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}}),Clock.prototype.tick=function(){var e=getTimestamp$1(),t=JulianDate.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){var i=this._clockStep;if(i===ClockStep$1.SYSTEM_CLOCK)t=JulianDate.now(t);else{var r=this._multiplier;if(i===ClockStep$1.TICK_DEPENDENT)t=JulianDate.addSeconds(t,r,t);else{var n=e-this._lastSystemTime;t=JulianDate.addSeconds(t,r*(n/1e3),t)}var a=this.clockRange,o=this.startTime,s=this.stopTime;if(a===ClockRange$1.CLAMPED)JulianDate.lessThan(t,o)?t=JulianDate.clone(o,t):JulianDate.greaterThan(t,s)&&(t=JulianDate.clone(s,t),this.onStop.raiseEvent(this));else if(a===ClockRange$1.LOOP_STOP)for(JulianDate.lessThan(t,o)&&(t=JulianDate.clone(o,t));JulianDate.greaterThan(t,s);)t=JulianDate.addSeconds(o,JulianDate.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t},Color.fromCartesian4=function(e,t){return defined(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new Color(e.x,e.y,e.z,e.w)},Color.fromBytes=function(e,t,i,r,n){return e=Color.byteToFloat(defaultValue(e,255)),t=Color.byteToFloat(defaultValue(t,255)),i=Color.byteToFloat(defaultValue(i,255)),r=Color.byteToFloat(defaultValue(r,255)),defined(n)?(n.red=e,n.green=t,n.blue=i,n.alpha=r,n):new Color(e,t,i,r)},Color.fromAlpha=function(e,t,i){return defined(i)?(i.red=e.red,i.green=e.green,i.blue=e.blue,i.alpha=t,i):new Color(e.red,e.green,e.blue,t)},FeatureDetection.supportsTypedArrays()&&(scratchArrayBuffer=new ArrayBuffer(4),scratchUint32Array=new Uint32Array(scratchArrayBuffer),scratchUint8Array=new Uint8Array(scratchArrayBuffer)),Color.fromRgba=function(e,t){return scratchUint32Array[0]=e,Color.fromBytes(scratchUint8Array[0],scratchUint8Array[1],scratchUint8Array[2],scratchUint8Array[3],t)},Color.fromHsl=function(e,t,i,r,n){e=defaultValue(e,0)%1,t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,1);var a=i,o=i,s=i;if(0!==t){var l,c=2*i-(l=i<.5?i*(1+t):i+t-i*t);a=hue2rgb(c,l,e+1/3),o=hue2rgb(c,l,e),s=hue2rgb(c,l,e-1/3)}return defined(n)?(n.red=a,n.green=o,n.blue=s,n.alpha=r,n):new Color(a,o,s,r)},Color.fromRandom=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).red;if(!defined(i)){var r=defaultValue(e.minimumRed,0),n=defaultValue(e.maximumRed,1);i=r+CesiumMath.nextRandomNumber()*(n-r)}var a=e.green;if(!defined(a)){var o=defaultValue(e.minimumGreen,0),s=defaultValue(e.maximumGreen,1);a=o+CesiumMath.nextRandomNumber()*(s-o)}var l=e.blue;if(!defined(l)){var c=defaultValue(e.minimumBlue,0),u=defaultValue(e.maximumBlue,1);l=c+CesiumMath.nextRandomNumber()*(u-c)}var d=e.alpha;if(!defined(d)){var h=defaultValue(e.minimumAlpha,0),p=defaultValue(e.maximumAlpha,1);d=h+CesiumMath.nextRandomNumber()*(p-h)}return defined(t)?(t.red=i,t.green=a,t.blue=l,t.alpha=d,t):new Color(i,a,l,d)};var rgbMatcher=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,rrggbbMatcher=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,rgbParenthesesMatcher=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,hslParenthesesMatcher=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;function ColorGeometryInstanceAttribute(e,t,i,r){e=defaultValue(e,1),t=defaultValue(t,1),i=defaultValue(i,1),r=defaultValue(r,1),this.value=new Uint8Array([Color.floatToByte(e),Color.floatToByte(t),Color.floatToByte(i),Color.floatToByte(r)])}function CompressedTextureBuffer(e,t,i,r){this._format=e,this._width=t,this._height=i,this._buffer=r}Color.fromCssColorString=function(e,t){defined(t)||(t=new Color);var i=Color[e.toUpperCase()];if(defined(i))return Color.clone(i,t),t;var r=rgbMatcher.exec(e);return null!==r?(t.red=parseInt(r[1],16)/15,t.green=parseInt(r[2],16)/15,t.blue=parseInt(r[3],16)/15,t.alpha=1,t):null!==(r=rrggbbMatcher.exec(e))?(t.red=parseInt(r[1],16)/255,t.green=parseInt(r[2],16)/255,t.blue=parseInt(r[3],16)/255,t.alpha=1,t):null!==(r=rgbParenthesesMatcher.exec(e))?(t.red=parseFloat(r[1])/("%"===r[1].substr(-1)?100:255),t.green=parseFloat(r[2])/("%"===r[2].substr(-1)?100:255),t.blue=parseFloat(r[3])/("%"===r[3].substr(-1)?100:255),t.alpha=parseFloat(defaultValue(r[4],"1.0")),t):null!==(r=hslParenthesesMatcher.exec(e))?Color.fromHsl(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,parseFloat(defaultValue(r[4],"1.0")),t):t=void 0},Color.packedLength=4,Color.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.red,t[i++]=e.green,t[i++]=e.blue,t[i]=e.alpha,t},Color.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Color),i.red=e[t++],i.green=e[t++],i.blue=e[t++],i.alpha=e[t],i},Color.byteToFloat=function(e){return e/255},Color.floatToByte=function(e){return 1===e?255:256*e|0},Color.clone=function(e,t){if(defined(e))return defined(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new Color(e.red,e.green,e.blue,e.alpha)},Color.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha},Color.equalsArray=function(e,t,i){return e.red===t[i]&&e.green===t[i+1]&&e.blue===t[i+2]&&e.alpha===t[i+3]},Color.prototype.clone=function(e){return Color.clone(this,e)},Color.prototype.equals=function(e){return Color.equals(this,e)},Color.prototype.equalsEpsilon=function(e,t){return this===e||defined(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},Color.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},Color.prototype.toCssColorString=function(){var e=Color.floatToByte(this.red),t=Color.floatToByte(this.green),i=Color.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+t+","+i+")":"rgba("+e+","+t+","+i+","+this.alpha+")"},Color.prototype.toBytes=function(e){var t=Color.floatToByte(this.red),i=Color.floatToByte(this.green),r=Color.floatToByte(this.blue),n=Color.floatToByte(this.alpha);return defined(e)?(e[0]=t,e[1]=i,e[2]=r,e[3]=n,e):[t,i,r,n]},Color.prototype.toRgba=function(){return scratchUint8Array[0]=Color.floatToByte(this.red),scratchUint8Array[1]=Color.floatToByte(this.green),scratchUint8Array[2]=Color.floatToByte(this.blue),scratchUint8Array[3]=Color.floatToByte(this.alpha),scratchUint32Array[0]},Color.prototype.brighten=function(e,t){return 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},Color.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},Color.prototype.withAlpha=function(e,t){return Color.fromAlpha(this,e,t)},Color.add=function(e,t,i){return i.red=e.red+t.red,i.green=e.green+t.green,i.blue=e.blue+t.blue,i.alpha=e.alpha+t.alpha,i},Color.subtract=function(e,t,i){return i.red=e.red-t.red,i.green=e.green-t.green,i.blue=e.blue-t.blue,i.alpha=e.alpha-t.alpha,i},Color.multiply=function(e,t,i){return i.red=e.red*t.red,i.green=e.green*t.green,i.blue=e.blue*t.blue,i.alpha=e.alpha*t.alpha,i},Color.divide=function(e,t,i){return i.red=e.red/t.red,i.green=e.green/t.green,i.blue=e.blue/t.blue,i.alpha=e.alpha/t.alpha,i},Color.mod=function(e,t,i){return i.red=e.red%t.red,i.green=e.green%t.green,i.blue=e.blue%t.blue,i.alpha=e.alpha%t.alpha,i},Color.multiplyByScalar=function(e,t,i){return i.red=e.red*t,i.green=e.green*t,i.blue=e.blue*t,i.alpha=e.alpha*t,i},Color.divideByScalar=function(e,t,i){return i.red=e.red/t,i.green=e.green/t,i.blue=e.blue/t,i.alpha=e.alpha/t,i},Color.ALICEBLUE=freezeObject$1(Color.fromCssColorString("#F0F8FF")),Color.ANTIQUEWHITE=freezeObject$1(Color.fromCssColorString("#FAEBD7")),Color.AQUA=freezeObject$1(Color.fromCssColorString("#00FFFF")),Color.AQUAMARINE=freezeObject$1(Color.fromCssColorString("#7FFFD4")),Color.AZURE=freezeObject$1(Color.fromCssColorString("#F0FFFF")),Color.BEIGE=freezeObject$1(Color.fromCssColorString("#F5F5DC")),Color.BISQUE=freezeObject$1(Color.fromCssColorString("#FFE4C4")),Color.BLACK=freezeObject$1(Color.fromCssColorString("#000000")),Color.BLANCHEDALMOND=freezeObject$1(Color.fromCssColorString("#FFEBCD")),Color.BLUE=freezeObject$1(Color.fromCssColorString("#0000FF")),Color.BLUEVIOLET=freezeObject$1(Color.fromCssColorString("#8A2BE2")),Color.BROWN=freezeObject$1(Color.fromCssColorString("#A52A2A")),Color.BURLYWOOD=freezeObject$1(Color.fromCssColorString("#DEB887")),Color.CADETBLUE=freezeObject$1(Color.fromCssColorString("#5F9EA0")),Color.CHARTREUSE=freezeObject$1(Color.fromCssColorString("#7FFF00")),Color.CHOCOLATE=freezeObject$1(Color.fromCssColorString("#D2691E")),Color.CORAL=freezeObject$1(Color.fromCssColorString("#FF7F50")),Color.CORNFLOWERBLUE=freezeObject$1(Color.fromCssColorString("#6495ED")),Color.CORNSILK=freezeObject$1(Color.fromCssColorString("#FFF8DC")),Color.CRIMSON=freezeObject$1(Color.fromCssColorString("#DC143C")),Color.CYAN=freezeObject$1(Color.fromCssColorString("#00FFFF")),Color.DARKBLUE=freezeObject$1(Color.fromCssColorString("#00008B")),Color.DARKCYAN=freezeObject$1(Color.fromCssColorString("#008B8B")),Color.DARKGOLDENROD=freezeObject$1(Color.fromCssColorString("#B8860B")),Color.DARKGRAY=freezeObject$1(Color.fromCssColorString("#A9A9A9")),Color.DARKGREEN=freezeObject$1(Color.fromCssColorString("#006400")),Color.DARKGREY=Color.DARKGRAY,Color.DARKKHAKI=freezeObject$1(Color.fromCssColorString("#BDB76B")),Color.DARKMAGENTA=freezeObject$1(Color.fromCssColorString("#8B008B")),Color.DARKOLIVEGREEN=freezeObject$1(Color.fromCssColorString("#556B2F")),Color.DARKORANGE=freezeObject$1(Color.fromCssColorString("#FF8C00")),Color.DARKORCHID=freezeObject$1(Color.fromCssColorString("#9932CC")),Color.DARKRED=freezeObject$1(Color.fromCssColorString("#8B0000")),Color.DARKSALMON=freezeObject$1(Color.fromCssColorString("#E9967A")),Color.DARKSEAGREEN=freezeObject$1(Color.fromCssColorString("#8FBC8F")),Color.DARKSLATEBLUE=freezeObject$1(Color.fromCssColorString("#483D8B")),Color.DARKSLATEGRAY=freezeObject$1(Color.fromCssColorString("#2F4F4F")),Color.DARKSLATEGREY=Color.DARKSLATEGRAY,Color.DARKTURQUOISE=freezeObject$1(Color.fromCssColorString("#00CED1")),Color.DARKVIOLET=freezeObject$1(Color.fromCssColorString("#9400D3")),Color.DEEPPINK=freezeObject$1(Color.fromCssColorString("#FF1493")),Color.DEEPSKYBLUE=freezeObject$1(Color.fromCssColorString("#00BFFF")),Color.DIMGRAY=freezeObject$1(Color.fromCssColorString("#696969")),Color.DIMGREY=Color.DIMGRAY,Color.DODGERBLUE=freezeObject$1(Color.fromCssColorString("#1E90FF")),Color.FIREBRICK=freezeObject$1(Color.fromCssColorString("#B22222")),Color.FLORALWHITE=freezeObject$1(Color.fromCssColorString("#FFFAF0")),Color.FORESTGREEN=freezeObject$1(Color.fromCssColorString("#228B22")),Color.FUCHSIA=freezeObject$1(Color.fromCssColorString("#FF00FF")),Color.GAINSBORO=freezeObject$1(Color.fromCssColorString("#DCDCDC")),Color.GHOSTWHITE=freezeObject$1(Color.fromCssColorString("#F8F8FF")),Color.GOLD=freezeObject$1(Color.fromCssColorString("#FFD700")),Color.GOLDENROD=freezeObject$1(Color.fromCssColorString("#DAA520")),Color.GRAY=freezeObject$1(Color.fromCssColorString("#808080")),Color.GREEN=freezeObject$1(Color.fromCssColorString("#008000")),Color.GREENYELLOW=freezeObject$1(Color.fromCssColorString("#ADFF2F")),Color.GREY=Color.GRAY,Color.HONEYDEW=freezeObject$1(Color.fromCssColorString("#F0FFF0")),Color.HOTPINK=freezeObject$1(Color.fromCssColorString("#FF69B4")),Color.INDIANRED=freezeObject$1(Color.fromCssColorString("#CD5C5C")),Color.INDIGO=freezeObject$1(Color.fromCssColorString("#4B0082")),Color.IVORY=freezeObject$1(Color.fromCssColorString("#FFFFF0")),Color.KHAKI=freezeObject$1(Color.fromCssColorString("#F0E68C")),Color.LAVENDER=freezeObject$1(Color.fromCssColorString("#E6E6FA")),Color.LAVENDAR_BLUSH=freezeObject$1(Color.fromCssColorString("#FFF0F5")),Color.LAWNGREEN=freezeObject$1(Color.fromCssColorString("#7CFC00")),Color.LEMONCHIFFON=freezeObject$1(Color.fromCssColorString("#FFFACD")),Color.LIGHTBLUE=freezeObject$1(Color.fromCssColorString("#ADD8E6")),Color.LIGHTCORAL=freezeObject$1(Color.fromCssColorString("#F08080")),Color.LIGHTCYAN=freezeObject$1(Color.fromCssColorString("#E0FFFF")),Color.LIGHTGOLDENRODYELLOW=freezeObject$1(Color.fromCssColorString("#FAFAD2")),Color.LIGHTGRAY=freezeObject$1(Color.fromCssColorString("#D3D3D3")),Color.LIGHTGREEN=freezeObject$1(Color.fromCssColorString("#90EE90")),Color.LIGHTGREY=Color.LIGHTGRAY,Color.LIGHTPINK=freezeObject$1(Color.fromCssColorString("#FFB6C1")),Color.LIGHTSEAGREEN=freezeObject$1(Color.fromCssColorString("#20B2AA")),Color.LIGHTSKYBLUE=freezeObject$1(Color.fromCssColorString("#87CEFA")),Color.LIGHTSLATEGRAY=freezeObject$1(Color.fromCssColorString("#778899")),Color.LIGHTSLATEGREY=Color.LIGHTSLATEGRAY,Color.LIGHTSTEELBLUE=freezeObject$1(Color.fromCssColorString("#B0C4DE")),Color.LIGHTYELLOW=freezeObject$1(Color.fromCssColorString("#FFFFE0")),Color.LIME=freezeObject$1(Color.fromCssColorString("#00FF00")),Color.LIMEGREEN=freezeObject$1(Color.fromCssColorString("#32CD32")),Color.LINEN=freezeObject$1(Color.fromCssColorString("#FAF0E6")),Color.MAGENTA=freezeObject$1(Color.fromCssColorString("#FF00FF")),Color.MAROON=freezeObject$1(Color.fromCssColorString("#800000")),Color.MEDIUMAQUAMARINE=freezeObject$1(Color.fromCssColorString("#66CDAA")),Color.MEDIUMBLUE=freezeObject$1(Color.fromCssColorString("#0000CD")),Color.MEDIUMORCHID=freezeObject$1(Color.fromCssColorString("#BA55D3")),Color.MEDIUMPURPLE=freezeObject$1(Color.fromCssColorString("#9370DB")),Color.MEDIUMSEAGREEN=freezeObject$1(Color.fromCssColorString("#3CB371")),Color.MEDIUMSLATEBLUE=freezeObject$1(Color.fromCssColorString("#7B68EE")),Color.MEDIUMSPRINGGREEN=freezeObject$1(Color.fromCssColorString("#00FA9A")),Color.MEDIUMTURQUOISE=freezeObject$1(Color.fromCssColorString("#48D1CC")),Color.MEDIUMVIOLETRED=freezeObject$1(Color.fromCssColorString("#C71585")),Color.MIDNIGHTBLUE=freezeObject$1(Color.fromCssColorString("#191970")),Color.MINTCREAM=freezeObject$1(Color.fromCssColorString("#F5FFFA")),Color.MISTYROSE=freezeObject$1(Color.fromCssColorString("#FFE4E1")),Color.MOCCASIN=freezeObject$1(Color.fromCssColorString("#FFE4B5")),Color.NAVAJOWHITE=freezeObject$1(Color.fromCssColorString("#FFDEAD")),Color.NAVY=freezeObject$1(Color.fromCssColorString("#000080")),Color.OLDLACE=freezeObject$1(Color.fromCssColorString("#FDF5E6")),Color.OLIVE=freezeObject$1(Color.fromCssColorString("#808000")),Color.OLIVEDRAB=freezeObject$1(Color.fromCssColorString("#6B8E23")),Color.ORANGE=freezeObject$1(Color.fromCssColorString("#FFA500")),Color.ORANGERED=freezeObject$1(Color.fromCssColorString("#FF4500")),Color.ORCHID=freezeObject$1(Color.fromCssColorString("#DA70D6")),Color.PALEGOLDENROD=freezeObject$1(Color.fromCssColorString("#EEE8AA")),Color.PALEGREEN=freezeObject$1(Color.fromCssColorString("#98FB98")),Color.PALETURQUOISE=freezeObject$1(Color.fromCssColorString("#AFEEEE")),Color.PALEVIOLETRED=freezeObject$1(Color.fromCssColorString("#DB7093")),Color.PAPAYAWHIP=freezeObject$1(Color.fromCssColorString("#FFEFD5")),Color.PEACHPUFF=freezeObject$1(Color.fromCssColorString("#FFDAB9")),Color.PERU=freezeObject$1(Color.fromCssColorString("#CD853F")),Color.PINK=freezeObject$1(Color.fromCssColorString("#FFC0CB")),Color.PLUM=freezeObject$1(Color.fromCssColorString("#DDA0DD")),Color.POWDERBLUE=freezeObject$1(Color.fromCssColorString("#B0E0E6")),Color.PURPLE=freezeObject$1(Color.fromCssColorString("#800080")),Color.RED=freezeObject$1(Color.fromCssColorString("#FF0000")),Color.ROSYBROWN=freezeObject$1(Color.fromCssColorString("#BC8F8F")),Color.ROYALBLUE=freezeObject$1(Color.fromCssColorString("#4169E1")),Color.SADDLEBROWN=freezeObject$1(Color.fromCssColorString("#8B4513")),Color.SALMON=freezeObject$1(Color.fromCssColorString("#FA8072")),Color.SANDYBROWN=freezeObject$1(Color.fromCssColorString("#F4A460")),Color.SEAGREEN=freezeObject$1(Color.fromCssColorString("#2E8B57")),Color.SEASHELL=freezeObject$1(Color.fromCssColorString("#FFF5EE")),Color.SIENNA=freezeObject$1(Color.fromCssColorString("#A0522D")),Color.SILVER=freezeObject$1(Color.fromCssColorString("#C0C0C0")),Color.SKYBLUE=freezeObject$1(Color.fromCssColorString("#87CEEB")),Color.SLATEBLUE=freezeObject$1(Color.fromCssColorString("#6A5ACD")),Color.SLATEGRAY=freezeObject$1(Color.fromCssColorString("#708090")),Color.SLATEGREY=Color.SLATEGRAY,Color.SNOW=freezeObject$1(Color.fromCssColorString("#FFFAFA")),Color.SPRINGGREEN=freezeObject$1(Color.fromCssColorString("#00FF7F")),Color.STEELBLUE=freezeObject$1(Color.fromCssColorString("#4682B4")),Color.TAN=freezeObject$1(Color.fromCssColorString("#D2B48C")),Color.TEAL=freezeObject$1(Color.fromCssColorString("#008080")),Color.THISTLE=freezeObject$1(Color.fromCssColorString("#D8BFD8")),Color.TOMATO=freezeObject$1(Color.fromCssColorString("#FF6347")),Color.TURQUOISE=freezeObject$1(Color.fromCssColorString("#40E0D0")),Color.VIOLET=freezeObject$1(Color.fromCssColorString("#EE82EE")),Color.WHEAT=freezeObject$1(Color.fromCssColorString("#F5DEB3")),Color.WHITE=freezeObject$1(Color.fromCssColorString("#FFFFFF")),Color.WHITESMOKE=freezeObject$1(Color.fromCssColorString("#F5F5F5")),Color.YELLOW=freezeObject$1(Color.fromCssColorString("#FFFF00")),Color.YELLOWGREEN=freezeObject$1(Color.fromCssColorString("#9ACD32")),Color.TRANSPARENT=freezeObject$1(new Color(0,0,0,0)),defineProperties$1(ColorGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}}),ColorGeometryInstanceAttribute.fromColor=function(e){return new ColorGeometryInstanceAttribute(e.red,e.green,e.blue,e.alpha)},ColorGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?e.toBytes(t):new Uint8Array(e.toBytes())},ColorGeometryInstanceAttribute.equals=function(e,t){return e===t||defined(e)&&defined(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]},defineProperties$1(CompressedTextureBuffer.prototype,{internalFormat:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}}),CompressedTextureBuffer.clone=function(e){if(defined(e))return new CompressedTextureBuffer(e._format,e._width,e._height,e._buffer)},CompressedTextureBuffer.prototype.clone=function(){return CompressedTextureBuffer.clone(this)};var CoplanarPolygonGeometryLibrary={},scratchIntersectionPoint=new Cartesian3,scratchXAxis=new Cartesian3,scratchYAxis=new Cartesian3,scratchZAxis=new Cartesian3,obbScratch=new OrientedBoundingBox;function projectTo2D(e,t,i,r,n){var a=Cartesian3.subtract(e,t,scratchIntersectionPoint),o=Cartesian3.dot(i,a),s=Cartesian3.dot(r,a);return Cartesian2.fromElements(o,s,n)}function calculateM(e,t,i){if(0===e)return t*i;var r=e*e,n=r*r,a=n*r,o=a*r,s=o*r,l=s*r,c=i;return t*((1-r/4-3*n/64-5*a/256-175*o/16384-441*s/65536-4851*l/1048576)*c-(3*r/8+3*n/32+45*a/1024+105*o/4096+2205*s/131072+6237*l/524288)*Math.sin(2*c)+(15*n/256+45*a/1024+525*o/16384+1575*s/65536+155925*l/8388608)*Math.sin(4*c)-(35*a/3072+175*o/12288+3675*s/262144+13475*l/1048576)*Math.sin(6*c)+(315*o/131072+2205*s/524288+43659*l/8388608)*Math.sin(8*c)-(693*s/1310720+6237*l/5242880)*Math.sin(10*c)+1001*l/8388608*Math.sin(12*c))}function calculateInverseM(e,t,i){var r=e/i;if(0===t)return r;var n=r*r,a=n*r,o=a*r,s=t*t,l=s*s,c=l*s,u=c*s,d=u*s,h=d*s,p=Math.sin(2*r),m=Math.cos(2*r),f=Math.sin(4*r),g=Math.cos(4*r),_=Math.sin(6*r),y=Math.cos(6*r),v=Math.sin(8*r),C=Math.cos(8*r),S=Math.sin(10*r);return r+r*s/4+7*r*l/64+15*r*c/256+579*r*u/16384+1515*r*d/65536+16837*r*h/1048576+(3*r*l/16+45*r*c/256-r*(32*n-561)*u/4096-r*(232*n-1677)*d/16384+r*(399985-90560*n+512*o)*h/5242880)*m+(21*r*c/256+483*r*u/4096-r*(224*n-1969)*d/16384-r*(33152*n-112599)*h/1048576)*g+(151*r*u/4096+4681*r*d/65536+1479*r*h/16384-453*a*h/32768)*y+(1097*r*d/65536+42783*r*h/1048576)*C+8011*r*h/1048576*Math.cos(10*r)+(3*s/8+3*l/16+213*c/2048-3*n*c/64+255*u/4096-33*n*u/512+20861*d/524288-33*n*d/512+o*d/1024+28273*h/1048576-471*n*h/8192+9*o*h/4096)*p+(21*l/256+21*c/256+533*u/8192-21*n*u/512+197*d/4096-315*n*d/4096+584039*h/16777216-12517*n*h/131072+7*o*h/2048)*f+(151*c/6144+151*u/4096+5019*d/131072-453*n*d/16384+26965*h/786432-8607*n*h/131072)*_+(1097*u/131072+1097*d/65536+225797*h/10485760-1097*n*h/65536)*v+(8011*d/2621440+8011*h/1048576)*S+293393*h/251658240*Math.sin(12*r)}function calculateSigma(e,t){if(0===e)return Math.log(Math.tan(.5*(CesiumMath.PI_OVER_TWO+t)));var i=e*Math.sin(t);return Math.log(Math.tan(.5*(CesiumMath.PI_OVER_TWO+t)))-e/2*Math.log((1+i)/(1-i))}function calculateHeading(e,t,i,r,n){var a=calculateSigma(e._ellipticity,i),o=calculateSigma(e._ellipticity,n);return Math.atan2(CesiumMath.negativePiToPi(r-t),o-a)}function calculateArcLength(e,t,i,r,n,a,o){var s=e._heading,l=a-r,c=0;if(CesiumMath.equalsEpsilon(Math.abs(s),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8))if(t===i)c=t*Math.cos(n)*CesiumMath.negativePiToPi(l);else{var u=Math.sin(n);c=t*Math.cos(n)*CesiumMath.negativePiToPi(l)/Math.sqrt(1-e._ellipticitySquared*u*u)}else{var d=calculateM(e._ellipticity,t,n);c=(calculateM(e._ellipticity,t,o)-d)/Math.cos(s)}return Math.abs(c)}CoplanarPolygonGeometryLibrary.validOutline=function(e){var t=OrientedBoundingBox.fromPoints(e,obbScratch).halfAxes,i=Matrix3.getColumn(t,0,scratchXAxis),r=Matrix3.getColumn(t,1,scratchYAxis),n=Matrix3.getColumn(t,2,scratchZAxis),a=Cartesian3.magnitude(i),o=Cartesian3.magnitude(r),s=Cartesian3.magnitude(n);return!(0===a&&(0===o||0===s)||0===o&&0===s)},CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments=function(e,t,i,r){var n,a,o=OrientedBoundingBox.fromPoints(e,obbScratch),s=o.halfAxes,l=Matrix3.getColumn(s,0,scratchXAxis),c=Matrix3.getColumn(s,1,scratchYAxis),u=Matrix3.getColumn(s,2,scratchZAxis),d=Cartesian3.magnitude(l),h=Cartesian3.magnitude(c),p=Cartesian3.magnitude(u),m=Math.min(d,h,p);return(0!==d||0!==h&&0!==p)&&(0!==h||0!==p)&&(m!==h&&m!==p||(n=l),m===d?n=c:m===p&&(a=c),m!==d&&m!==h||(a=u),Cartesian3.normalize(n,i),Cartesian3.normalize(a,r),Cartesian3.clone(o.center,t),!0)},CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction=function(r,n,a){return function(e){for(var t=new Array(e.length),i=0;i<e.length;i++)t[i]=projectTo2D(e[i],r,n,a);return t}},CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction=function(i,r,n){return function(e,t){return projectTo2D(e,i,r,n,t)}};var scratchCart1=new Cartesian3,scratchCart2=new Cartesian3;function computeProperties(e,t,i,r){Cartesian3.normalize(r.cartographicToCartesian(t,scratchCart2),scratchCart1),Cartesian3.normalize(r.cartographicToCartesian(i,scratchCart2),scratchCart2);var n=r.maximumRadius,a=r.minimumRadius,o=n*n,s=a*a;e._ellipticitySquared=(o-s)/o,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=Cartographic.clone(t,e._start),e._start.height=0,e._end=Cartographic.clone(i,e._end),e._end.height=0,e._heading=calculateHeading(e,t.longitude,t.latitude,i.longitude,i.latitude),e._distance=calculateArcLength(e,r.maximumRadius,r.minimumRadius,t.longitude,t.latitude,i.longitude,i.latitude)}function interpolateUsingSurfaceDistance(e,t,i,r,n,a){var o,s,l,c=n*n;if(Math.abs(CesiumMath.PI_OVER_TWO-Math.abs(t))>CesiumMath.EPSILON8){s=calculateInverseM(calculateM(n,r,e.latitude)+i*Math.cos(t),n,r);var u=calculateSigma(n,e.latitude),d=calculateSigma(n,s);l=Math.tan(t)*(d-u),o=CesiumMath.negativePiToPi(e.longitude+l)}else{var h;if(s=e.latitude,0===n)h=r*Math.cos(e.latitude);else{var p=Math.sin(e.latitude);h=r*Math.cos(e.latitude)/Math.sqrt(1-c*p*p)}l=i/h,o=0<t?CesiumMath.negativePiToPi(e.longitude+l):CesiumMath.negativePiToPi(e.longitude-l)}return defined(a)?(a.longitude=o,a.latitude=s,a.height=0,a):new Cartographic(o,s,0)}function EllipsoidRhumbLine(e,t,i){var r=defaultValue(i,Ellipsoid.WGS84);this._ellipsoid=r,this._start=new Cartographic,this._end=new Cartographic,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,defined(e)&&defined(t)&&computeProperties(this,e,t,r)}function earcut(e,t,i){i=i||2;var r,n,a,o,s,l,c,u=t&&t.length,d=u?t[0]*i:e.length,h=linkedList(e,0,d,i,!0),p=[];if(!h)return p;if(u&&(h=eliminateHoles(e,t,h,i)),e.length>80*i){r=a=e[0],n=o=e[1];for(var m=i;m<d;m+=i)(s=e[m])<r&&(r=s),(l=e[m+1])<n&&(n=l),a<s&&(a=s),o<l&&(o=l);c=Math.max(a-r,o-n)}return earcutLinked(h,p,i,r,n,c),p}function linkedList(e,t,i,r,n){var a,o;if(n===0<signedArea(e,t,i,r))for(a=t;a<i;a+=r)o=insertNode(a,e[a],e[a+1],o);else for(a=i-r;t<=a;a-=r)o=insertNode(a,e[a],e[a+1],o);return o&&equals(o,o.next)&&(removeNode(o),o=o.next),o}function filterPoints(e,t){if(!e)return e;t=t||e;var i,r=e;do{if(i=!1,r.steiner||!equals(r,r.next)&&0!==area(r.prev,r,r.next))r=r.next;else{if(removeNode(r),(r=t=r.prev)===r.next)return null;i=!0}}while(i||r!==t);return t}function earcutLinked(e,t,i,r,n,a,o){if(e){!o&&a&&indexCurve(e,r,n,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?isEarHashed(e,r,n,a):isEar(e))t.push(s.i/i),t.push(e.i/i),t.push(l.i/i),removeNode(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?earcutLinked(e=cureLocalIntersections(e,t,i),t,i,r,n,a,2):2===o&&splitEarcut(e,t,i,r,n,a):earcutLinked(filterPoints(e),t,i,r,n,a,1);break}}}function isEar(e){var t=e.prev,i=e,r=e.next;if(0<=area(t,i,r))return!1;for(var n=e.next.next;n!==e.prev;){if(pointInTriangle(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&0<=area(n.prev,n,n.next))return!1;n=n.next}return!0}function isEarHashed(e,t,i,r){var n=e.prev,a=e,o=e.next;if(0<=area(n,a,o))return!1;for(var s=n.x<a.x?n.x<o.x?n.x:o.x:a.x<o.x?a.x:o.x,l=n.y<a.y?n.y<o.y?n.y:o.y:a.y<o.y?a.y:o.y,c=n.x>a.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,u=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,d=zOrder(s,l,t,i,r),h=zOrder(c,u,t,i,r),p=e.nextZ;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&pointInTriangle(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=area(p.prev,p,p.next))return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&pointInTriangle(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=area(p.prev,p,p.next))return!1;p=p.prevZ}return!0}function cureLocalIntersections(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!equals(n,a)&&intersects(n,r,r.next,a)&&locallyInside(n,a)&&locallyInside(a,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(a.i/i),removeNode(r),removeNode(r.next),r=e=a),r=r.next}while(r!==e);return r}function splitEarcut(e,t,i,r,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&isValidDiagonal(o,s)){var l=splitPolygon(o,s);return o=filterPoints(o,o.next),l=filterPoints(l,l.next),earcutLinked(o,t,i,r,n,a),void earcutLinked(l,t,i,r,n,a)}s=s.next}o=o.next}while(o!==e)}function eliminateHoles(e,t,i,r){var n,a,o,s=[];for(n=0,a=t.length;n<a;n++)(o=linkedList(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(getLeftmost(o));for(s.sort(compareX),n=0;n<s.length;n++)eliminateHole(s[n],i),i=filterPoints(i,i.next);return i}function compareX(e,t){return e.x-t.x}function eliminateHole(e,t){if(t=findHoleBridge(e,t)){var i=splitPolygon(t,e);filterPoints(i,i.next)}}function findHoleBridge(e,t){var i,r=t,n=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&o<s){if((o=s)===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===o)return i.prev;var l,c=i,u=i.x,d=i.y,h=1/0;for(r=i.next;r!==c;)n>=r.x&&r.x>=u&&pointInTriangle(a<d?n:o,a,u,d,a<d?o:n,a,r.x,r.y)&&((l=Math.abs(a-r.y)/(n-r.x))<h||l===h&&r.x>i.x)&&locallyInside(r,e)&&(i=r,h=l),r=r.next;return i}function indexCurve(e,t,i,r){for(var n=e;null===n.z&&(n.z=zOrder(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,(n=n.next)!==e;);n.prevZ.nextZ=null,n.prevZ=null,sortLinked(n)}function sortLinked(e){var t,i,r,n,a,o,s,l,c=1;do{for(i=e,a=e=null,o=0;i;){for(o++,r=i,t=s=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;0<s||0<l&&r;)0===s?(r=(n=r).nextZ,l--):0!==l&&r?i.z<=r.z?(i=(n=i).nextZ,s--):(r=(n=r).nextZ,l--):(i=(n=i).nextZ,s--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;i=r}a.nextZ=null,c*=2}while(1<o);return e}function zOrder(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)/n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)/n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function getLeftmost(e){for(var t=e,i=e;t.x<i.x&&(i=t),(t=t.next)!==e;);return i}function pointInTriangle(e,t,i,r,n,a,o,s){return 0<=(n-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(r-s)-(i-o)*(t-s)&&0<=(i-o)*(a-s)-(n-o)*(r-s)}function isValidDiagonal(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!intersectsPolygon(e,t)&&locallyInside(e,t)&&locallyInside(t,e)&&middleInside(e,t)}function area(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function equals(e,t){return e.x===t.x&&e.y===t.y}function intersects(e,t,i,r){return!!(equals(e,t)&&equals(i,r)||equals(e,r)&&equals(i,t))||0<area(e,t,i)!=0<area(e,t,r)&&0<area(i,r,e)!=0<area(i,r,t)}function intersectsPolygon(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&intersects(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function locallyInside(e,t){return area(e.prev,e,e.next)<0?0<=area(e,t,e.next)&&0<=area(e,e.prev,t):area(e,t,e.prev)<0||area(e,e.next,t)<0}function middleInside(e,t){for(var i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;i.y>a!=i.next.y>a&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),(i=i.next)!==e;);return r}function splitPolygon(e,t){var i=new Node$1(e.i,e.x,e.y),r=new Node$1(t.i,t.x,t.y),n=e.next,a=t.prev;return(e.next=t).prev=e,(i.next=n).prev=i,(r.next=i).prev=r,(a.next=r).prev=a,r}function insertNode(e,t,i,r){var n=new Node$1(e,t,i);return r?(n.next=r.next,(n.prev=r).next.prev=n,r.next=n):(n.prev=n).next=n,n}function removeNode(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 Node$1(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,t,i,r){for(var n=0,a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}defineProperties$1(EllipsoidRhumbLine.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return this._heading}}}),EllipsoidRhumbLine.fromStartHeadingDistance=function(e,t,i,r,n){var a=defaultValue(r,Ellipsoid.WGS84),o=a.maximumRadius,s=a.minimumRadius,l=o*o,c=s*s,u=Math.sqrt((l-c)/l),d=interpolateUsingSurfaceDistance(e,t=CesiumMath.negativePiToPi(t),i,a.maximumRadius,u);return!defined(n)||defined(r)&&!r.equals(n.ellipsoid)?new EllipsoidRhumbLine(e,d,a):(n.setEndPoints(e,d),n)},EllipsoidRhumbLine.prototype.setEndPoints=function(e,t){computeProperties(this,e,t,this._ellipsoid)},EllipsoidRhumbLine.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)},EllipsoidRhumbLine.prototype.interpolateUsingSurfaceDistance=function(e,t){return interpolateUsingSurfaceDistance(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)},EllipsoidRhumbLine.prototype.findIntersectionWithLongitude=function(e,t){var i=this._ellipticity,r=this._heading,n=Math.abs(r),a=this._start;if(e=CesiumMath.negativePiToPi(e),CesiumMath.equalsEpsilon(Math.abs(e),Math.PI,CesiumMath.EPSILON14)&&(e=CesiumMath.sign(a.longitude)*Math.PI),defined(t)||(t=new Cartographic),Math.abs(CesiumMath.PI_OVER_TWO-n)<=CesiumMath.EPSILON8)return t.longitude=e,t.latitude=a.latitude,t.height=0,t;if(CesiumMath.equalsEpsilon(Math.abs(CesiumMath.PI_OVER_TWO-n),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8)){if(CesiumMath.equalsEpsilon(e,a.longitude,CesiumMath.EPSILON12))return;return t.longitude=e,t.latitude=CesiumMath.PI_OVER_TWO*CesiumMath.sign(CesiumMath.PI_OVER_TWO-r),t.height=0,t}var o,s=a.latitude,l=i*Math.sin(s),c=Math.tan(.5*(CesiumMath.PI_OVER_TWO+s))*Math.exp((e-a.longitude)/Math.tan(r)),u=(1+l)/(1-l),d=a.latitude;do{o=d;var h=i*Math.sin(o),p=(1+h)/(1-h);d=2*Math.atan(c*Math.pow(p/u,i/2))-CesiumMath.PI_OVER_TWO}while(!CesiumMath.equalsEpsilon(d,o,CesiumMath.EPSILON12));return t.longitude=e,t.latitude=d,t.height=0,t},EllipsoidRhumbLine.prototype.findIntersectionWithLatitude=function(e,t){var i=this._ellipticity,r=this._heading,n=this._start;if(!CesiumMath.equalsEpsilon(Math.abs(r),CesiumMath.PI_OVER_TWO,CesiumMath.EPSILON8)){var a=calculateSigma(i,n.latitude),o=calculateSigma(i,e),s=Math.tan(r)*(o-a),l=CesiumMath.negativePiToPi(n.longitude+s);return defined(t)?(t.longitude=l,t.latitude=e,t.height=0,t):new Cartographic(l,e,0)}},earcut.deviation=function(e,t,i,r){var n=t&&t.length,a=n?t[0]*i:e.length,o=Math.abs(signedArea(e,0,a,i));if(n)for(var s=0,l=t.length;s<l;s++){var c=t[s]*i,u=s<l-1?t[s+1]*i:e.length;o-=Math.abs(signedArea(e,c,u,i))}var d=0;for(s=0;s<r.length;s+=3){var h=r[s]*i,p=r[s+1]*i,m=r[s+2]*i;d+=Math.abs((e[h]-e[m])*(e[1+p]-e[1+h])-(e[h]-e[p])*(e[1+m]-e[1+h]))}return 0===o&&0===d?0:Math.abs((d-o)/o)},earcut.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var a=0;a<e[n].length;a++)for(var o=0;o<t;o++)i.vertices.push(e[n][a][o]);0<n&&(r+=e[n-1].length,i.holes.push(r))}return i};var WindingOrder={CLOCKWISE:WebGLConstants$1.CW,COUNTER_CLOCKWISE:WebGLConstants$1.CCW,validate:function(e){return e===WindingOrder.CLOCKWISE||e===WindingOrder.COUNTER_CLOCKWISE}},WindingOrder$1=freezeObject$1(WindingOrder),scaleToGeodeticHeightN=new Cartesian3,scaleToGeodeticHeightP=new Cartesian3,PolygonPipeline={computeArea2D:function(e){for(var t=e.length,i=0,r=t-1,n=0;n<t;r=n++){var a=e[r],o=e[n];i+=a.x*o.y-o.x*a.y}return.5*i},computeWindingOrder2D:function(e){return 0<PolygonPipeline.computeArea2D(e)?WindingOrder$1.COUNTER_CLOCKWISE:WindingOrder$1.CLOCKWISE},triangulate:function(e,t){return earcut(Cartesian2.packArray(e),t,2)}},subdivisionV0Scratch=new Cartesian3,subdivisionV1Scratch=new Cartesian3,subdivisionV2Scratch=new Cartesian3,subdivisionS0Scratch=new Cartesian3,subdivisionS1Scratch=new Cartesian3,subdivisionS2Scratch=new Cartesian3,subdivisionMidScratch=new Cartesian3;PolygonPipeline.computeSubdivision=function(e,t,i,r){r=defaultValue(r,CesiumMath.RADIANS_PER_DEGREE);var n,a=i.slice(0),o=t.length,s=new Array(3*o),l=0;for(n=0;n<o;n++){var c=t[n];s[l++]=c.x,s[l++]=c.y,s[l++]=c.z}for(var u=[],d={},h=e.maximumRadius,p=CesiumMath.chordLength(r,h),m=p*p;0<a.length;){var f,g,_=a.pop(),y=a.pop(),v=a.pop(),C=Cartesian3.fromArray(s,3*v,subdivisionV0Scratch),S=Cartesian3.fromArray(s,3*y,subdivisionV1Scratch),x=Cartesian3.fromArray(s,3*_,subdivisionV2Scratch),T=Cartesian3.multiplyByScalar(Cartesian3.normalize(C,subdivisionS0Scratch),h,subdivisionS0Scratch),b=Cartesian3.multiplyByScalar(Cartesian3.normalize(S,subdivisionS1Scratch),h,subdivisionS1Scratch),E=Cartesian3.multiplyByScalar(Cartesian3.normalize(x,subdivisionS2Scratch),h,subdivisionS2Scratch),P=Cartesian3.magnitudeSquared(Cartesian3.subtract(T,b,subdivisionMidScratch)),A=Cartesian3.magnitudeSquared(Cartesian3.subtract(b,E,subdivisionMidScratch)),w=Cartesian3.magnitudeSquared(Cartesian3.subtract(E,T,subdivisionMidScratch)),D=Math.max(P,A,w);m<D?P===D?(defined(n=d[f=Math.min(v,y)+" "+Math.max(v,y)])||(g=Cartesian3.add(C,S,subdivisionMidScratch),Cartesian3.multiplyByScalar(g,.5,g),s.push(g.x,g.y,g.z),n=s.length/3-1,d[f]=n),a.push(v,n,_),a.push(n,y,_)):A===D?(defined(n=d[f=Math.min(y,_)+" "+Math.max(y,_)])||(g=Cartesian3.add(S,x,subdivisionMidScratch),Cartesian3.multiplyByScalar(g,.5,g),s.push(g.x,g.y,g.z),n=s.length/3-1,d[f]=n),a.push(y,n,v),a.push(n,_,v)):w===D&&(defined(n=d[f=Math.min(_,v)+" "+Math.max(_,v)])||(g=Cartesian3.add(x,C,subdivisionMidScratch),Cartesian3.multiplyByScalar(g,.5,g),s.push(g.x,g.y,g.z),n=s.length/3-1,d[f]=n),a.push(_,n,y),a.push(n,v,y)):(u.push(v),u.push(y),u.push(_))}return new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},indices:u,primitiveType:PrimitiveType$1.TRIANGLES})};var subdivisionC0Scratch=new Cartographic,subdivisionC1Scratch=new Cartographic,subdivisionC2Scratch=new Cartographic,subdivisionCartographicScratch=new Cartographic;function Queue(){this._array=[],this._offset=0,this._length=0}PolygonPipeline.computeRhumbLineSubdivision=function(e,t,i,r){r=defaultValue(r,CesiumMath.RADIANS_PER_DEGREE);var n,a=i.slice(0),o=t.length,s=new Array(3*o),l=0;for(n=0;n<o;n++){var c=t[n];s[l++]=c.x,s[l++]=c.y,s[l++]=c.z}for(var u=[],d={},h=e.maximumRadius,p=CesiumMath.chordLength(r,h),m=new EllipsoidRhumbLine(void 0,void 0,e),f=new EllipsoidRhumbLine(void 0,void 0,e),g=new EllipsoidRhumbLine(void 0,void 0,e);0<a.length;){var _=a.pop(),y=a.pop(),v=a.pop(),C=Cartesian3.fromArray(s,3*v,subdivisionV0Scratch),S=Cartesian3.fromArray(s,3*y,subdivisionV1Scratch),x=Cartesian3.fromArray(s,3*_,subdivisionV2Scratch),T=e.cartesianToCartographic(C,subdivisionC0Scratch),b=e.cartesianToCartographic(S,subdivisionC1Scratch),E=e.cartesianToCartographic(x,subdivisionC2Scratch);m.setEndPoints(T,b);var P=m.surfaceDistance;f.setEndPoints(b,E);var A=f.surfaceDistance;g.setEndPoints(E,T);var w,D,M,I,R=g.surfaceDistance,O=Math.max(P,A,R);p<O?P===O?(defined(n=d[w=Math.min(v,y)+" "+Math.max(v,y)])||(D=m.interpolateUsingFraction(.5,subdivisionCartographicScratch),M=.5*(T.height+b.height),I=Cartesian3.fromRadians(D.longitude,D.latitude,M,e,subdivisionMidScratch),s.push(I.x,I.y,I.z),n=s.length/3-1,d[w]=n),a.push(v,n,_),a.push(n,y,_)):A===O?(defined(n=d[w=Math.min(y,_)+" "+Math.max(y,_)])||(D=f.interpolateUsingFraction(.5,subdivisionCartographicScratch),M=.5*(b.height+E.height),I=Cartesian3.fromRadians(D.longitude,D.latitude,M,e,subdivisionMidScratch),s.push(I.x,I.y,I.z),n=s.length/3-1,d[w]=n),a.push(y,n,v),a.push(n,_,v)):R===O&&(defined(n=d[w=Math.min(_,v)+" "+Math.max(_,v)])||(D=g.interpolateUsingFraction(.5,subdivisionCartographicScratch),M=.5*(E.height+T.height),I=Cartesian3.fromRadians(D.longitude,D.latitude,M,e,subdivisionMidScratch),s.push(I.x,I.y,I.z),n=s.length/3-1,d[w]=n),a.push(_,n,y),a.push(n,v,y)):(u.push(v),u.push(y),u.push(_))}return new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:s})},indices:u,primitiveType:PrimitiveType$1.TRIANGLES})},PolygonPipeline.scaleToGeodeticHeight=function(e,t,i,r){i=defaultValue(i,Ellipsoid.WGS84);var n=scaleToGeodeticHeightN,a=scaleToGeodeticHeightP;if(t=defaultValue(t,0),r=defaultValue(r,!0),defined(e))for(var o=e.length,s=0;s<o;s+=3)Cartesian3.fromArray(e,s,a),r&&(a=i.scaleToGeodeticSurface(a,a)),0!==t&&(n=i.geodeticSurfaceNormal(a,n),Cartesian3.multiplyByScalar(n,t,n),Cartesian3.add(a,n,a)),e[s]=a.x,e[s+1]=a.y,e[s+2]=a.z;return e},defineProperties$1(Queue.prototype,{length:{get:function(){return this._length}}}),Queue.prototype.enqueue=function(e){this._array.push(e),this._length++},Queue.prototype.dequeue=function(){if(0!==this._length){var e=this._array,t=this._offset,i=e[t];return e[t]=void 0,10<++t&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,i}},Queue.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},Queue.prototype.contains=function(e){return-1!==this._array.indexOf(e)},Queue.prototype.clear=function(){this._array.length=this._offset=this._length=0},Queue.prototype.sort=function(e){0<this._offset&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};var PolygonGeometryLibrary={computeHierarchyPackedLength:function(e){for(var t=0,i=[e];0<i.length;){var r=i.pop();if(defined(r)){t+=2;var n=r.positions,a=r.holes;if(defined(n)&&(t+=n.length*Cartesian3.packedLength),defined(a))for(var o=a.length,s=0;s<o;++s)i.push(a[s])}}return t},packPolygonHierarchy:function(e,t,i){for(var r=[e];0<r.length;){var n=r.pop();if(defined(n)){var a=n.positions,o=n.holes;if(t[i++]=defined(a)?a.length:0,t[i++]=defined(o)?o.length:0,defined(a))for(var s=a.length,l=0;l<s;++l,i+=3)Cartesian3.pack(a[l],t,i);if(defined(o))for(var c=o.length,u=0;u<c;++u)r.push(o[u])}}return i},unpackPolygonHierarchy:function(e,t){for(var i=e[t++],r=e[t++],n=new Array(i),a=0<r?new Array(r):void 0,o=0;o<i;++o,t+=Cartesian3.packedLength)n[o]=Cartesian3.unpack(e,t);for(var s=0;s<r;++s)a[s]=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t),t=a[s].startingIndex,delete a[s].startingIndex;return{positions:n,holes:a,startingIndex:t}}},distanceScratch$3=new Cartesian3;function getPointAtDistance(e,t,i,r){return Cartesian3.subtract(t,e,distanceScratch$3),Cartesian3.multiplyByScalar(distanceScratch$3,i/r,distanceScratch$3),Cartesian3.add(e,distanceScratch$3,distanceScratch$3),[distanceScratch$3.x,distanceScratch$3.y,distanceScratch$3.z]}PolygonGeometryLibrary.subdivideLineCount=function(e,t,i){var r=Cartesian3.distance(e,t)/i,n=Math.max(0,Math.ceil(CesiumMath.log2(r)));return Math.pow(2,n)};var scratchCartographic0=new Cartographic,scratchCartographic1=new Cartographic,scratchCartographic2=new Cartographic,scratchCartesian0=new Cartesian3;PolygonGeometryLibrary.subdivideRhumbLineCount=function(e,t,i,r){var n=new EllipsoidRhumbLine(e.cartesianToCartographic(t,scratchCartographic0),e.cartesianToCartographic(i,scratchCartographic1),e).surfaceDistance/r,a=Math.max(0,Math.ceil(CesiumMath.log2(n)));return Math.pow(2,a)},PolygonGeometryLibrary.subdivideLine=function(e,t,i,r){var n=PolygonGeometryLibrary.subdivideLineCount(e,t,i),a=Cartesian3.distance(e,t),o=a/n;defined(r)||(r=[]);var s=r;s.length=3*n;for(var l=0,c=0;c<n;c++){var u=getPointAtDistance(e,t,c*o,a);s[l++]=u[0],s[l++]=u[1],s[l++]=u[2]}return s},PolygonGeometryLibrary.subdivideRhumbLine=function(e,t,i,r,n){var a=new EllipsoidRhumbLine(e.cartesianToCartographic(t,scratchCartographic0),e.cartesianToCartographic(i,scratchCartographic1),e),o=a.surfaceDistance/r,s=Math.max(0,Math.ceil(CesiumMath.log2(o))),l=Math.pow(2,s),c=a.surfaceDistance/l;defined(n)||(n=[]);var u=n;u.length=3*l;for(var d=0,h=0;h<l;h++){var p=a.interpolateUsingSurfaceDistance(h*c,scratchCartographic2),m=e.cartographicToCartesian(p,scratchCartesian0);u[d++]=m.x,u[d++]=m.y,u[d++]=m.z}return u};var scaleToGeodeticHeightN1=new Cartesian3,scaleToGeodeticHeightN2=new Cartesian3,scaleToGeodeticHeightP1=new Cartesian3,scaleToGeodeticHeightP2=new Cartesian3;PolygonGeometryLibrary.scaleToGeodeticHeightExtruded=function(e,t,i,r,n){r=defaultValue(r,Ellipsoid.WGS84);var a=scaleToGeodeticHeightN1,o=scaleToGeodeticHeightN2,s=scaleToGeodeticHeightP1,l=scaleToGeodeticHeightP2;if(defined(e)&&defined(e.attributes)&&defined(e.attributes.position))for(var c=e.attributes.position.values,u=c.length/2,d=0;d<u;d+=3)Cartesian3.fromArray(c,d,s),r.geodeticSurfaceNormal(s,a),l=r.scaleToGeodeticSurface(s,l),o=Cartesian3.multiplyByScalar(a,i,o),o=Cartesian3.add(l,o,o),c[d+u]=o.x,c[d+1+u]=o.y,c[d+2+u]=o.z,n&&(l=Cartesian3.clone(s,l)),o=Cartesian3.multiplyByScalar(a,t,o),o=Cartesian3.add(l,o,o),c[d]=o.x,c[d+1]=o.y,c[d+2]=o.z;return e},PolygonGeometryLibrary.polygonOutlinesFromHierarchy=function(e,t,i){var r,n,a,o=[],s=new Queue;for(s.enqueue(e);0!==s.length;){var l=s.dequeue(),c=l.positions;if(t)for(a=c.length,r=0;r<a;r++)i.scaleToGeodeticSurface(c[r],c[r]);if(!((c=arrayRemoveDuplicates(c,Cartesian3.equalsEpsilon,!0)).length<3)){var u=l.holes?l.holes.length:0;for(r=0;r<u;r++){var d=l.holes[r],h=d.positions;if(t)for(a=h.length,n=0;n<a;++n)i.scaleToGeodeticSurface(h[n],h[n]);if(!((h=arrayRemoveDuplicates(h,Cartesian3.equalsEpsilon,!0)).length<3)){o.push(h);var p=0;for(defined(d.holes)&&(p=d.holes.length),n=0;n<p;n++)s.enqueue(d.holes[n])}}o.push(c)}}return o},PolygonGeometryLibrary.polygonsFromHierarchy=function(e,t,i,r){var n=[],a=[],o=new Queue;for(o.enqueue(e);0!==o.length;){var s,l,c=o.dequeue(),u=c.positions,d=c.holes;if(i)for(l=u.length,s=0;s<l;s++)r.scaleToGeodeticSurface(u[s],u[s]);if(!((u=arrayRemoveDuplicates(u,Cartesian3.equalsEpsilon,!0)).length<3)){var h=t(u);if(defined(h)){var p=[],m=PolygonPipeline.computeWindingOrder2D(h);m===WindingOrder$1.CLOCKWISE&&(h.reverse(),u=u.slice().reverse());var f,g=u.slice(),_=defined(d)?d.length:0,y=[];for(s=0;s<_;s++){var v=d[s],C=v.positions;if(i)for(l=C.length,f=0;f<l;++f)r.scaleToGeodeticSurface(C[f],C[f]);if(!((C=arrayRemoveDuplicates(C,Cartesian3.equalsEpsilon,!0)).length<3)){var S=t(C);if(defined(S)){(m=PolygonPipeline.computeWindingOrder2D(S))===WindingOrder$1.CLOCKWISE&&(S.reverse(),C=C.slice().reverse()),y.push(C),p.push(g.length),g=g.concat(C),h=h.concat(S);var x=0;for(defined(v.holes)&&(x=v.holes.length),f=0;f<x;f++)o.enqueue(v.holes[f])}}}n.push({outerRing:u,holes:y}),a.push({positions:g,positions2D:h,holes:p})}}}return{hierarchy:n,polygons:a}};var computeBoundingRectangleCartesian2=new Cartesian2,computeBoundingRectangleCartesian3=new Cartesian3,computeBoundingRectangleQuaternion=new Quaternion,computeBoundingRectangleMatrix3=new Matrix3;PolygonGeometryLibrary.computeBoundingRectangle=function(e,t,i,r,n){for(var a=Quaternion.fromAxisAngle(e,r,computeBoundingRectangleQuaternion),o=Matrix3.fromQuaternion(a,computeBoundingRectangleMatrix3),s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=i.length,h=0;h<d;++h){var p=Cartesian3.clone(i[h],computeBoundingRectangleCartesian3);Matrix3.multiplyByVector(o,p,p);var m=t(p,computeBoundingRectangleCartesian2);defined(m)&&(s=Math.min(s,m.x),l=Math.max(l,m.x),c=Math.min(c,m.y),u=Math.max(u,m.y))}return n.x=s,n.y=c,n.width=l-s,n.height=u-c,n},PolygonGeometryLibrary.createGeometryFromPositions=function(e,t,i,r,n,a){var o=PolygonPipeline.triangulate(t.positions2D,t.holes);o.length<3&&(o=[0,1,2]);var s=t.positions;if(r){for(var l=s.length,c=new Array(3*l),u=0,d=0;d<l;d++){var h=s[d];c[u++]=h.x,c[u++]=h.y,c[u++]=h.z}var p=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:c})},indices:o,primitiveType:PrimitiveType$1.TRIANGLES});return n.normal?GeometryPipeline.computeNormal(p):p}return a===ArcType$1.GEODESIC?PolygonPipeline.computeSubdivision(e,s,o,i):a===ArcType$1.RHUMB?PolygonPipeline.computeRhumbLineSubdivision(e,s,o,i):void 0};var computeWallIndicesSubdivided=[],p1Scratch$1=new Cartesian3,p2Scratch$1=new Cartesian3;PolygonGeometryLibrary.computeWallGeometry=function(e,t,i,r,n){var a,o,s,l,c,u=e.length,d=0;if(r)for(o=3*u*2,a=new Array(2*o),s=0;s<u;s++)l=e[s],c=e[(s+1)%u],a[d]=a[d+o]=l.x,a[++d]=a[d+o]=l.y,a[++d]=a[d+o]=l.z,a[++d]=a[d+o]=c.x,a[++d]=a[d+o]=c.y,a[++d]=a[d+o]=c.z,++d;else{var h=CesiumMath.chordLength(i,t.maximumRadius),p=0;if(n===ArcType$1.GEODESIC)for(s=0;s<u;s++)p+=PolygonGeometryLibrary.subdivideLineCount(e[s],e[(s+1)%u],h);else if(n===ArcType$1.RHUMB)for(s=0;s<u;s++)p+=PolygonGeometryLibrary.subdivideRhumbLineCount(t,e[s],e[(s+1)%u],h);for(o=3*(p+u),a=new Array(2*o),s=0;s<u;s++){var m;l=e[s],c=e[(s+1)%u],n===ArcType$1.GEODESIC?m=PolygonGeometryLibrary.subdivideLine(l,c,h,computeWallIndicesSubdivided):n===ArcType$1.RHUMB&&(m=PolygonGeometryLibrary.subdivideRhumbLine(t,l,c,h,computeWallIndicesSubdivided));for(var f=m.length,g=0;g<f;++g,++d)a[d]=m[g],a[d+o]=m[g];a[d]=c.x,a[d+o]=c.x,a[++d]=c.y,a[d+o]=c.y,a[++d]=c.z,a[d+o]=c.z,++d}}u=a.length;var _=IndexDatatype$1.createTypedArray(u/3,u-6*e.length),y=0;for(u/=6,s=0;s<u;s++){var v=s,C=v+1,S=v+u,x=S+1;l=Cartesian3.fromArray(a,3*v,p1Scratch$1),c=Cartesian3.fromArray(a,3*C,p2Scratch$1),Cartesian3.equalsEpsilon(l,c,CesiumMath.EPSILON10,CesiumMath.EPSILON10)||(_[y++]=v,_[y++]=S,_[y++]=C,_[y++]=C,_[y++]=S,_[y++]=x)}return new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:_,primitiveType:PrimitiveType$1.TRIANGLES})};var scratchPosition$1=new Cartesian3,scratchBR=new BoundingRectangle,stScratch=new Cartesian2,textureCoordinatesOrigin=new Cartesian2,scratchNormal$3=new Cartesian3,scratchTangent$1=new Cartesian3,scratchBitangent$1=new Cartesian3,centerScratch=new Cartesian3,axis1Scratch=new Cartesian3,axis2Scratch=new Cartesian3,quaternionScratch$1=new Quaternion,textureMatrixScratch$1=new Matrix3,tangentRotationScratch=new Matrix3,surfaceNormalScratch=new Cartesian3;function createGeometryFromPolygon(e,t,i,r,n,a,o,s){var l=e.positions,c=PolygonPipeline.triangulate(e.positions2D,e.holes);c.length<3&&(c=[0,1,2]);var u=IndexDatatype$1.createTypedArray(l.length,c.length);u.set(c);var d=textureMatrixScratch$1;if(0!==r){var h=Quaternion.fromAxisAngle(a,r,quaternionScratch$1);if(d=Matrix3.fromQuaternion(h,d),t.tangent||t.bitangent){h=Quaternion.fromAxisAngle(a,-r,quaternionScratch$1);var p=Matrix3.fromQuaternion(h,tangentRotationScratch);o=Cartesian3.normalize(Matrix3.multiplyByVector(p,o,o),o),t.bitangent&&(s=Cartesian3.normalize(Cartesian3.cross(a,o,s),s))}}else d=Matrix3.clone(Matrix3.IDENTITY,d);var m=textureCoordinatesOrigin;t.st&&(m.x=i.x,m.y=i.y);for(var f=l.length,g=3*f,_=new Float64Array(g),y=t.normal?new Float32Array(g):void 0,v=t.tangent?new Float32Array(g):void 0,C=t.bitangent?new Float32Array(g):void 0,S=t.st?new Float32Array(2*f):void 0,x=0,T=0,b=0,E=0,P=0,A=0;A<f;A++){var w=l[A];if(_[x++]=w.x,_[x++]=w.y,_[x++]=w.z,t.st){var D=n(Matrix3.multiplyByVector(d,w,scratchPosition$1),stScratch);Cartesian2.subtract(D,m,D);var M=CesiumMath.clamp(D.x/i.width,0,1),I=CesiumMath.clamp(D.y/i.height,0,1);S[P++]=M,S[P++]=I}t.normal&&(y[T++]=a.x,y[T++]=a.y,y[T++]=a.z),t.tangent&&(v[E++]=o.x,v[E++]=o.y,v[E++]=o.z),t.bitangent&&(C[b++]=s.x,C[b++]=s.y,C[b++]=s.z)}var R=new GeometryAttributes;return t.position&&(R.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:_})),t.normal&&(R.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),t.tangent&&(R.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:v})),t.bitangent&&(R.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:C})),t.st&&(R.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:S})),new Geometry({attributes:R,indices:u,primitiveType:PrimitiveType$1.TRIANGLES})}function CoplanarPolygonGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polygonHierarchy,i=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=VertexFormat.clone(i),this._polygonHierarchy=t,this._stRotation=defaultValue(e.stRotation,0),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+VertexFormat.packedLength+Ellipsoid.packedLength+2}CoplanarPolygonGeometry.fromPositions=function(e){return new CoplanarPolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},CoplanarPolygonGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._stRotation,t[i]=e.packedLength,t};var scratchEllipsoid$2=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$2=new VertexFormat,scratchOptions$6={polygonHierarchy:{}};function createGeometryFromPositions(e){for(var t=e.length,i=new Float64Array(3*t),r=IndexDatatype$1.createTypedArray(t,2*t),n=0,a=0,o=0;o<t;o++){var s=e[o];i[n++]=s.x,i[n++]=s.y,i[n++]=s.z,r[a++]=o,r[a++]=(o+1)%t}return new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i})}),indices:r,primitiveType:PrimitiveType$1.LINES})}function CoplanarPolygonOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polygonHierarchy;this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+1}CoplanarPolygonGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$2);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$2);t+=VertexFormat.packedLength;var o=e[t++],s=e[t];return defined(i)||(i=new CoplanarPolygonGeometry(scratchOptions$6)),i._polygonHierarchy=r,i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._stRotation=o,i.packedLength=s,i},CoplanarPolygonGeometry.createGeometry=function(e){var t=e._vertexFormat,i=e._polygonHierarchy,r=e._stRotation,n=i.positions;if(!((n=arrayRemoveDuplicates(n,Cartesian3.equalsEpsilon,!0)).length<3)){var a=scratchNormal$3,o=scratchTangent$1,s=scratchBitangent$1,l=axis1Scratch,c=axis2Scratch;if(CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments(n,centerScratch,l,c)){if(a=Cartesian3.cross(l,c,a),a=Cartesian3.normalize(a,a),!Cartesian3.equalsEpsilon(centerScratch,Cartesian3.ZERO,CesiumMath.EPSILON6)){var u=e._ellipsoid.geodeticSurfaceNormal(centerScratch,surfaceNormalScratch);Cartesian3.dot(a,u)<0&&(a=Cartesian3.negate(a,a),l=Cartesian3.negate(l,l))}var d=CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction(centerScratch,l,c),h=CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction(centerScratch,l,c);t.tangent&&(o=Cartesian3.clone(l,o)),t.bitangent&&(s=Cartesian3.clone(c,s));var p=PolygonGeometryLibrary.polygonsFromHierarchy(i,d,!1),m=p.hierarchy,f=p.polygons;if(0!==m.length){n=m[0].outerRing;for(var g=BoundingSphere.fromPoints(n),_=PolygonGeometryLibrary.computeBoundingRectangle(a,h,n,r,scratchBR),y=[],v=0;v<f.length;v++){var C=new GeometryInstance({geometry:createGeometryFromPolygon(f[v],t,_,r,h,a,o,s)});y.push(C)}var S=GeometryPipeline.combineInstances(y)[0];S.attributes.position.values=new Float64Array(S.attributes.position.values),S.indices=IndexDatatype$1.createTypedArray(S.attributes.position.values.length/3,S.indices);var x=S.attributes;return t.position||delete x.position,new Geometry({attributes:x,indices:S.indices,primitiveType:S.primitiveType,boundingSphere:g})}}}},CoplanarPolygonOutlineGeometry.fromPositions=function(e){return new CoplanarPolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions}})},CoplanarPolygonOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),t[i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i)]=e.packedLength,t};var scratchOptions$7={polygonHierarchy:{}};CoplanarPolygonOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=e[t];return defined(i)||(i=new CoplanarPolygonOutlineGeometry(scratchOptions$7)),i._polygonHierarchy=r,i.packedLength=n,i},CoplanarPolygonOutlineGeometry.createGeometry=function(e){var t=e._polygonHierarchy,i=t.positions;if(!((i=arrayRemoveDuplicates(i,Cartesian3.equalsEpsilon,!0)).length<3)&&CoplanarPolygonGeometryLibrary.validOutline(i)){var r=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(t,!1);if(0!==r.length){for(var n=[],a=0;a<r.length;a++){var o=new GeometryInstance({geometry:createGeometryFromPositions(r[a])});n.push(o)}var s=GeometryPipeline.combineInstances(n)[0],l=BoundingSphere.fromPoints(t.positions);return new Geometry({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:l})}}};var CornerType={ROUNDED:0,MITERED:1,BEVELED:2},CornerType$1=freezeObject$1(CornerType);function setConstants(e){var t=e._uSquared,i=e._ellipsoid.maximumRadius,r=e._ellipsoid.minimumRadius,n=(i-r)/i,a=Math.cos(e._startHeading),o=Math.sin(e._startHeading),s=(1-n)*Math.tan(e._start.latitude),l=1/Math.sqrt(1+s*s),c=l*s,u=Math.atan2(s,a),d=l*o,h=d*d,p=1-h,m=Math.sqrt(p),f=t/4,g=f*f,_=g*f,y=g*g,v=1+f-3*g/4+5*_/4-175*y/64,C=1-f+15*g/8-35*_/8,S=1-3*f+35*g/4,x=1-5*f,T=v*u-C*Math.sin(2*u)*f/2-S*Math.sin(4*u)*g/16-x*Math.sin(6*u)*_/48-5*Math.sin(8*u)*y/512,b=e._constants;b.a=i,b.b=r,b.f=n,b.cosineHeading=a,b.sineHeading=o,b.tanU=s,b.cosineU=l,b.sineU=c,b.sigma=u,b.sineAlpha=d,b.sineSquaredAlpha=h,b.cosineSquaredAlpha=p,b.cosineAlpha=m,b.u2Over4=f,b.u4Over16=g,b.u6Over64=_,b.u8Over256=y,b.a0=v,b.a1=C,b.a2=S,b.a3=x,b.distanceRatio=T}function computeC(e,t){return e*t*(4+e*(4-3*t))/16}function computeDeltaLambda(e,t,i,r,n,a,o){var s=computeC(e,i);return(1-s)*e*t*(r+s*n*(o+s*a*(2*o*o-1)))}function vincentyInverseFormula(e,t,i,r,n,a,o){var s,l,c,u,d,h=(t-i)/t,p=a-r,m=Math.atan((1-h)*Math.tan(n)),f=Math.atan((1-h)*Math.tan(o)),g=Math.cos(m),_=Math.sin(m),y=Math.cos(f),v=Math.sin(f),C=g*y,S=g*v,x=_*v,T=_*y,b=p,E=CesiumMath.TWO_PI,P=Math.cos(b),A=Math.sin(b);do{P=Math.cos(b),A=Math.sin(b);var w,D=S-T*P;c=Math.sqrt(y*y*A*A+D*D),l=x+C*P,s=Math.atan2(c,l),E=b,d=l-2*x/(u=0===c?(w=0,1):1-(w=C*A/c)*w),isNaN(d)&&(d=0),b=p+computeDeltaLambda(h,w,u,s,c,l,d)}while(Math.abs(b-E)>CesiumMath.EPSILON12);var M=u*(t*t-i*i)/(i*i),I=M*(256+M*(M*(74-47*M)-128))/1024,R=d*d,O=i*(1+M*(4096+M*(M*(320-175*M)-768))/16384)*(s-I*c*(d+I*(l*(2*R-1)-I*d*(4*c*c-3)*(4*R-3)/6)/4)),L=Math.atan2(y*A,S-T*P),F=Math.atan2(g*A,S*P-T);e._distance=O,e._startHeading=L,e._endHeading=F,e._uSquared=M}var scratchCart1$1=new Cartesian3,scratchCart2$1=new Cartesian3;function computeProperties$1(e,t,i,r){Cartesian3.normalize(r.cartographicToCartesian(t,scratchCart2$1),scratchCart1$1),Cartesian3.normalize(r.cartographicToCartesian(i,scratchCart2$1),scratchCart2$1);vincentyInverseFormula(e,r.maximumRadius,r.minimumRadius,t.longitude,t.latitude,i.longitude,i.latitude),e._start=Cartographic.clone(t,e._start),e._end=Cartographic.clone(i,e._end),e._start.height=0,e._end.height=0,setConstants(e)}function EllipsoidGeodesic(e,t,i){var r=defaultValue(i,Ellipsoid.WGS84);this._ellipsoid=r,this._start=new Cartographic,this._end=new Cartographic,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,defined(e)&&defined(t)&&computeProperties$1(this,e,t,r)}defineProperties$1(EllipsoidGeodesic.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}}),EllipsoidGeodesic.prototype.setEndPoints=function(e,t){computeProperties$1(this,e,t,this._ellipsoid)},EllipsoidGeodesic.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance=function(e,t){var i=this._constants,r=i.distanceRatio+e/i.b,n=Math.cos(2*r),a=Math.cos(4*r),o=Math.cos(6*r),s=Math.sin(2*r),l=Math.sin(4*r),c=Math.sin(6*r),u=Math.sin(8*r),d=r*r,h=r*d,p=i.u8Over256,m=i.u2Over4,f=i.u6Over64,g=i.u4Over16,_=2*h*p*n/3+r*(1-m+7*g/4-15*f/4+579*p/64-(g-15*f/4+187*p/16)*n-(5*f/4-115*p/16)*a-29*p*o/16)+(m/2-g+71*f/32-85*p/16)*s+(5*g/16-5*f/4+383*p/96)*l-d*((f-11*p/2)*s+5*p*l/2)+(29*f/96-29*p/16)*c+539*p*u/1536,y=Math.asin(Math.sin(_)*i.cosineAlpha),v=Math.atan(i.a/i.b*Math.tan(y));_-=i.sigma;var C=Math.cos(2*i.sigma+_),S=Math.sin(_),x=Math.cos(_),T=i.cosineU*x,b=i.sineU*S,E=Math.atan2(S*i.sineHeading,T-b*i.cosineHeading)-computeDeltaLambda(i.f,i.sineAlpha,i.cosineSquaredAlpha,_,S,x,C);return defined(t)?(t.longitude=this._start.longitude+E,t.latitude=v,t.height=0,t):new Cartographic(this._start.longitude+E,v,0)};var PolylinePipeline={numberOfPoints:function(e,t,i){var r=Cartesian3.distance(e,t);return Math.ceil(r/i)},numberOfPointsRhumbLine:function(e,t,i){var r=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.ceil(Math.sqrt(r/(i*i)))}},cartoScratch=new Cartographic;PolylinePipeline.extractHeights=function(e,t){for(var i=e.length,r=new Array(i),n=0;n<i;n++){var a=e[n];r[n]=t.cartesianToCartographic(a,cartoScratch).height}return r};var wrapLongitudeInversMatrix=new Matrix4,wrapLongitudeOrigin=new Cartesian3,wrapLongitudeXZNormal=new Cartesian3,wrapLongitudeXZPlane=new Plane(Cartesian3.UNIT_X,0),wrapLongitudeYZNormal=new Cartesian3,wrapLongitudeYZPlane=new Plane(Cartesian3.UNIT_X,0),wrapLongitudeIntersection=new Cartesian3,wrapLongitudeOffset=new Cartesian3,subdivideHeightsScratchArray=[];function subdivideHeights(e,t,i){var r,n=subdivideHeightsScratchArray;if(n.length=e,t===i){for(r=0;r<e;r++)n[r]=t;return n}var a=(i-t)/e;for(r=0;r<e;r++){var o=t+r*a;n[r]=o}return n}var carto1=new Cartographic,carto2=new Cartographic,cartesian=new Cartesian3,scaleFirst=new Cartesian3,scaleLast=new Cartesian3,ellipsoidGeodesic=new EllipsoidGeodesic,ellipsoidRhumb=new EllipsoidRhumbLine;function generateCartesianArc(e,t,i,r,n,a,o,s){var l=r.scaleToGeodeticSurface(e,scaleFirst),c=r.scaleToGeodeticSurface(t,scaleLast),u=PolylinePipeline.numberOfPoints(e,t,i),d=r.cartesianToCartographic(l,carto1),h=r.cartesianToCartographic(c,carto2),p=subdivideHeights(u,n,a);ellipsoidGeodesic.setEndPoints(d,h);var m=ellipsoidGeodesic.surfaceDistance/u,f=s;d.height=n;var g=r.cartographicToCartesian(d,cartesian);Cartesian3.pack(g,o,f),f+=3;for(var _=1;_<u;_++){var y=ellipsoidGeodesic.interpolateUsingSurfaceDistance(_*m,carto2);y.height=p[_],g=r.cartographicToCartesian(y,cartesian),Cartesian3.pack(g,o,f),f+=3}return f}function generateCartesianRhumbArc(e,t,i,r,n,a,o,s){var l=r.scaleToGeodeticSurface(e,scaleFirst),c=r.scaleToGeodeticSurface(t,scaleLast),u=r.cartesianToCartographic(l,carto1),d=r.cartesianToCartographic(c,carto2),h=PolylinePipeline.numberOfPointsRhumbLine(u,d,i),p=subdivideHeights(h,n,a);ellipsoidRhumb.ellipsoid.equals(r)||(ellipsoidRhumb=new EllipsoidRhumbLine(void 0,void 0,r)),ellipsoidRhumb.setEndPoints(u,d);var m=ellipsoidRhumb.surfaceDistance/h,f=s;u.height=n;var g=r.cartographicToCartesian(u,cartesian);Cartesian3.pack(g,o,f),f+=3;for(var _=1;_<h;_++){var y=ellipsoidRhumb.interpolateUsingSurfaceDistance(_*m,carto2);y.height=p[_],g=r.cartographicToCartesian(y,cartesian),Cartesian3.pack(g,o,f),f+=3}return f}PolylinePipeline.wrapLongitude=function(e,t){var i=[],r=[];if(defined(e)&&0<e.length){t=defaultValue(t,Matrix4.IDENTITY);var n=Matrix4.inverseTransformation(t,wrapLongitudeInversMatrix),a=Matrix4.multiplyByPoint(n,Cartesian3.ZERO,wrapLongitudeOrigin),o=Cartesian3.normalize(Matrix4.multiplyByPointAsVector(n,Cartesian3.UNIT_Y,wrapLongitudeXZNormal),wrapLongitudeXZNormal),s=Plane.fromPointNormal(a,o,wrapLongitudeXZPlane),l=Cartesian3.normalize(Matrix4.multiplyByPointAsVector(n,Cartesian3.UNIT_X,wrapLongitudeYZNormal),wrapLongitudeYZNormal),c=Plane.fromPointNormal(a,l,wrapLongitudeYZPlane),u=1;i.push(Cartesian3.clone(e[0]));for(var d=i[0],h=e.length,p=1;p<h;++p){var m=e[p];if(Plane.getPointDistance(c,d)<0||Plane.getPointDistance(c,m)<0){var f=IntersectionTests.lineSegmentPlane(d,m,s,wrapLongitudeIntersection);if(defined(f)){var g=Cartesian3.multiplyByScalar(o,5e-9,wrapLongitudeOffset);Plane.getPointDistance(s,d)<0&&Cartesian3.negate(g,g),i.push(Cartesian3.add(f,g,new Cartesian3)),r.push(u+1),Cartesian3.negate(g,g),i.push(Cartesian3.add(f,g,new Cartesian3)),u=1}}i.push(Cartesian3.clone(e[p])),u++,d=m}r.push(u)}return{positions:i,lengths:r}},PolylinePipeline.generateArc=function(e){defined(e)||(e={});var t=e.positions,i=t.length,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.height,0),a=isArray$1(n);if(i<1)return[];if(1===i){var o=r.scaleToGeodeticSurface(t[0],scaleFirst);if(0!==(n=a?n[0]:n)){var s=r.geodeticSurfaceNormal(o,cartesian);Cartesian3.multiplyByScalar(s,n,s),Cartesian3.add(o,s,o)}return[o.x,o.y,o.z]}var l=e.minDistance;if(!defined(l)){var c=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE);l=CesiumMath.chordLength(c,r.maximumRadius)}var u,d=0;for(u=0;u<i-1;u++)d+=PolylinePipeline.numberOfPoints(t[u],t[u+1],l);var h=3*(d+1),p=new Array(h),m=0;for(u=0;u<i-1;u++){m=generateCartesianArc(t[u],t[u+1],l,r,a?n[u]:n,a?n[u+1]:n,p,m)}subdivideHeightsScratchArray.length=0;var f=t[i-1],g=r.cartesianToCartographic(f,carto1);g.height=a?n[i-1]:n;var _=r.cartographicToCartesian(g,cartesian);return Cartesian3.pack(_,p,h-3),p};var scratchCartographic0$1=new Cartographic,scratchCartographic1$1=new Cartographic;PolylinePipeline.generateRhumbArc=function(e){defined(e)||(e={});var t=e.positions,i=t.length,r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.height,0),a=isArray$1(n);if(i<1)return[];if(1===i){var o=r.scaleToGeodeticSurface(t[0],scaleFirst);if(0!==(n=a?n[0]:n)){var s=r.geodeticSurfaceNormal(o,cartesian);Cartesian3.multiplyByScalar(s,n,s),Cartesian3.add(o,s,o)}return[o.x,o.y,o.z]}var l,c,u=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),d=0,h=r.cartesianToCartographic(t[0],scratchCartographic0$1);for(l=0;l<i-1;l++)c=r.cartesianToCartographic(t[l+1],scratchCartographic1$1),d+=PolylinePipeline.numberOfPointsRhumbLine(h,c,u),h=Cartographic.clone(c,scratchCartographic0$1);var p=3*(d+1),m=new Array(p),f=0;for(l=0;l<i-1;l++){f=generateCartesianRhumbArc(t[l],t[l+1],u,r,a?n[l]:n,a?n[l+1]:n,m,f)}subdivideHeightsScratchArray.length=0;var g=t[i-1],_=r.cartesianToCartographic(g,carto1);_.height=a?n[i-1]:n;var y=r.cartographicToCartesian(_,cartesian);return Cartesian3.pack(y,m,p-3),m},PolylinePipeline.generateCartesianArc=function(e){for(var t=PolylinePipeline.generateArc(e),i=t.length/3,r=new Array(i),n=0;n<i;n++)r[n]=Cartesian3.unpack(t,3*n);return r},PolylinePipeline.generateCartesianRhumbArc=function(e){for(var t=PolylinePipeline.generateRhumbArc(e),i=t.length/3,r=new Array(i),n=0;n<i;n++)r[n]=Cartesian3.unpack(t,3*n);return r};var scratch2Array=[new Cartesian3,new Cartesian3],scratchCartesian1$5=new Cartesian3,scratchCartesian2$5=new Cartesian3,scratchCartesian3$6=new Cartesian3,scratchCartesian4$2=new Cartesian3,scratchCartesian5$1=new Cartesian3,scratchCartesian6$1=new Cartesian3,scratchCartesian7=new Cartesian3,scratchCartesian8=new Cartesian3,scratchCartesian9=new Cartesian3,scratch1=new Cartesian3,scratch2=new Cartesian3,PolylineVolumeGeometryLibrary={},cartographic=new Cartographic;function scaleToSurface(e,t){for(var i=new Array(e.length),r=0;r<e.length;r++){var n=e[r];cartographic=t.cartesianToCartographic(n,cartographic),i[r]=cartographic.height,e[r]=t.scaleToGeodeticSurface(n,n)}return i}function subdivideHeights$1(e,t,i,r){var n,a=e[0],o=e[1],s=Cartesian3.angleBetween(a,o),l=Math.ceil(s/r),c=new Array(l);if(t===i){for(n=0;n<l;n++)c[n]=t;return c.push(i),c}var u=(i-t)/l;for(n=1;n<l;n++){var d=t+n*u;c[n]=d}return c[0]=t,c.push(i),c}var nextScratch=new Cartesian3,prevScratch=new Cartesian3;function computeRotationAngle(e,t,i,r){var n=new EllipsoidTangentPlane(i,r),a=n.projectPointOntoPlane(Cartesian3.add(i,e,nextScratch),nextScratch),o=n.projectPointOntoPlane(Cartesian3.add(i,t,prevScratch),prevScratch),s=Cartesian2.angleBetween(a,o);return 0<=o.x*a.y-o.y*a.x?-s:s}var negativeX=new Cartesian3(-1,0,0),transform=new Matrix4,translation=new Matrix4,rotationZ=new Matrix3,scaleMatrix=Matrix3.IDENTITY.clone(),westScratch$1=new Cartesian3,finalPosScratch=new Cartesian4,heightCartesian=new Cartesian3;function addPosition(e,t,i,r,n,a,o,s){var l=westScratch$1,c=finalPosScratch;transform=Transforms.eastNorthUpToFixedFrame(e,n,transform),l=Matrix4.multiplyByPointAsVector(transform,negativeX,l);var u=computeRotationAngle(l=Cartesian3.normalize(l,l),t,e,n);rotationZ=Matrix3.fromRotationZ(u,rotationZ),heightCartesian.z=a,transform=Matrix4.multiplyTransformation(transform,Matrix4.fromRotationTranslation(rotationZ,heightCartesian,translation),transform);var d=scaleMatrix;d[0]=o;for(var h=0;h<s;h++)for(var p=0;p<i.length;p+=3)c=Cartesian3.fromArray(i,p,c),c=Matrix3.multiplyByVector(d,c,c),c=Matrix4.multiplyByPoint(transform,c,c),r.push(c.x,c.y,c.z);return r}var centerScratch$1=new Cartesian3;function addPositions(e,t,i,r,n,a,o){for(var s=0;s<e.length;s+=3){r=addPosition(Cartesian3.fromArray(e,s,centerScratch$1),t,i,r,n,a[s/3],o,1)}return r}function convertShapeTo3DDuplicate(e,t){var i=e.length,r=new Array(6*i),n=0,a=t.x+t.width/2,o=t.y+t.height/2,s=e[0];r[n++]=s.x-a,r[n++]=0,r[n++]=s.y-o;for(var l=1;l<i;l++){var c=(s=e[l]).x-a,u=s.y-o;r[n++]=c,r[n++]=0,r[n++]=u,r[n++]=c,r[n++]=0,r[n++]=u}return s=e[0],r[n++]=s.x-a,r[n++]=0,r[n++]=s.y-o,r}function convertShapeTo3D(e,t){for(var i=e.length,r=new Array(3*i),n=0,a=t.x+t.width/2,o=t.y+t.height/2,s=0;s<i;s++)r[n++]=e[s].x-a,r[n++]=0,r[n++]=e[s].y-o;return r}var quaterion=new Quaternion,startPointScratch=new Cartesian3,rotMatrix=new Matrix3;function computeRoundCorner(e,t,i,r,n,a,o,s,l,c){var u,d,h=Cartesian3.angleBetween(Cartesian3.subtract(t,e,scratch1),Cartesian3.subtract(i,e,scratch2)),p=r===CornerType$1.BEVELED?0:Math.ceil(h/CesiumMath.toRadians(5));if(u=n?Matrix3.fromQuaternion(Quaternion.fromAxisAngle(Cartesian3.negate(e,scratch1),h/(p+1),quaterion),rotMatrix):Matrix3.fromQuaternion(Quaternion.fromAxisAngle(e,h/(p+1),quaterion),rotMatrix),t=Cartesian3.clone(t,startPointScratch),0<p)for(var m=c?2:1,f=0;f<p;f++)t=Matrix3.multiplyByVector(u,t,t),d=Cartesian3.subtract(t,e,scratch1),d=Cartesian3.normalize(d,d),n||(d=Cartesian3.negate(d,d)),o=addPosition(a.scaleToGeodeticSurface(t,scratch2),d,s,o,a,l,1,m);else d=Cartesian3.subtract(t,e,scratch1),d=Cartesian3.normalize(d,d),n||(d=Cartesian3.negate(d,d)),o=addPosition(a.scaleToGeodeticSurface(t,scratch2),d,s,o,a,l,1,1),i=Cartesian3.clone(i,startPointScratch),d=Cartesian3.subtract(i,e,scratch1),d=Cartesian3.normalize(d,d),n||(d=Cartesian3.negate(d,d)),o=addPosition(a.scaleToGeodeticSurface(i,scratch2),d,s,o,a,l,1,1);return o}PolylineVolumeGeometryLibrary.removeDuplicatesFromShape=function(e){for(var t=e.length,i=[],r=t-1,n=0;n<t;r=n++){var a=e[r],o=e[n];Cartesian2.equals(a,o)||i.push(o)}return i},PolylineVolumeGeometryLibrary.angleIsGreaterThanPi=function(e,t,i,r){var n=new EllipsoidTangentPlane(i,r),a=n.projectPointOntoPlane(Cartesian3.add(i,e,nextScratch),nextScratch),o=n.projectPointOntoPlane(Cartesian3.add(i,t,prevScratch),prevScratch);return 0<=o.x*a.y-o.y*a.x};var scratchForwardProjection=new Cartesian3,scratchBackwardProjection=new Cartesian3;PolylineVolumeGeometryLibrary.computePositions=function(e,t,i,r,n){var a=r._ellipsoid,o=scaleToSurface(e,a),s=r._granularity,l=r._cornerType,c=n?convertShapeTo3DDuplicate(t,i):convertShapeTo3D(t,i),u=n?convertShapeTo3D(t,i):void 0,d=i.height/2,h=i.width/2,p=e.length,m=[],f=n?[]:void 0,g=scratchCartesian1$5,_=scratchCartesian2$5,y=scratchCartesian3$6,v=scratchCartesian4$2,C=scratchCartesian5$1,S=scratchCartesian6$1,x=scratchCartesian7,T=scratchCartesian8,b=scratchCartesian9,E=e[0],P=e[1];v=a.geodeticSurfaceNormal(E,v),g=Cartesian3.subtract(P,E,g),g=Cartesian3.normalize(g,g),T=Cartesian3.cross(v,g,T),T=Cartesian3.normalize(T,T);var A,w=o[0],D=o[1];n&&(f=addPosition(E,T,u,f,a,w+d,1,1)),b=Cartesian3.clone(E,b),E=P,_=Cartesian3.negate(g,_);for(var M=1;M<p-1;M++){var I=n?2:1;P=e[M+1],g=Cartesian3.subtract(P,E,g),g=Cartesian3.normalize(g,g),y=Cartesian3.add(g,_,y),y=Cartesian3.normalize(y,y),v=a.geodeticSurfaceNormal(E,v);var R=Cartesian3.multiplyByScalar(v,Cartesian3.dot(g,v),scratchForwardProjection);Cartesian3.subtract(g,R,R),Cartesian3.normalize(R,R);var O=Cartesian3.multiplyByScalar(v,Cartesian3.dot(_,v),scratchBackwardProjection);if(Cartesian3.subtract(_,O,O),Cartesian3.normalize(O,O),!CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(R,O)),1,CesiumMath.EPSILON7)){y=Cartesian3.cross(y,v,y),y=Cartesian3.cross(v,y,y),y=Cartesian3.normalize(y,y);var L=1/Math.max(.25,Cartesian3.magnitude(Cartesian3.cross(y,_,scratch1))),F=PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(g,_,E,a);b=(F?(C=Cartesian3.add(E,Cartesian3.multiplyByScalar(y,L*h,y),C),S=Cartesian3.add(C,Cartesian3.multiplyByScalar(T,h,S),S),scratch2Array[0]=Cartesian3.clone(b,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(S,scratch2Array[1]),A=subdivideHeights$1(scratch2Array,w+d,D+d,s),m=addPositions(PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:a}),T,c,m,a,A,1),T=Cartesian3.cross(v,g,T),T=Cartesian3.normalize(T,T),x=Cartesian3.add(C,Cartesian3.multiplyByScalar(T,h,x),x),l===CornerType$1.ROUNDED||l===CornerType$1.BEVELED?computeRoundCorner(C,S,x,l,F,a,m,c,D+d,n):m=addPosition(E,y=Cartesian3.negate(y,y),c,m,a,D+d,L,I)):(C=Cartesian3.add(E,Cartesian3.multiplyByScalar(y,L*h,y),C),S=Cartesian3.add(C,Cartesian3.multiplyByScalar(T,-h,S),S),scratch2Array[0]=Cartesian3.clone(b,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(S,scratch2Array[1]),A=subdivideHeights$1(scratch2Array,w+d,D+d,s),m=addPositions(PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:a}),T,c,m,a,A,1),T=Cartesian3.cross(v,g,T),T=Cartesian3.normalize(T,T),x=Cartesian3.add(C,Cartesian3.multiplyByScalar(T,-h,x),x),l===CornerType$1.ROUNDED||l===CornerType$1.BEVELED?computeRoundCorner(C,S,x,l,F,a,m,c,D+d,n):m=addPosition(E,y,c,m,a,D+d,L,I)),Cartesian3.clone(x,b)),_=Cartesian3.negate(g,_)}else m=addPosition(b,T,c,m,a,w+d,1,1),b=E;w=D,D=o[M+1],E=P}scratch2Array[0]=Cartesian3.clone(b,scratch2Array[0]),scratch2Array[1]=Cartesian3.clone(E,scratch2Array[1]),A=subdivideHeights$1(scratch2Array,w+d,D+d,s),m=addPositions(PolylinePipeline.generateArc({positions:scratch2Array,granularity:s,ellipsoid:a}),T,c,m,a,A,1),n&&(f=addPosition(E,T,u,f,a,D+d,1,1)),p=m.length;var N=n?p+f.length:p,B=new Float64Array(N);return B.set(m),n&&B.set(f,p),B};var CorridorGeometryLibrary={},scratch1$1=new Cartesian3,scratch2$1=new Cartesian3,scratch3=new Cartesian3,scratch4=new Cartesian3,scaleArray2=[new Cartesian3,new Cartesian3],cartesian1=new Cartesian3,cartesian2=new Cartesian3,cartesian3=new Cartesian3,cartesian4=new Cartesian3,cartesian5=new Cartesian3,cartesian6=new Cartesian3,cartesian7=new Cartesian3,cartesian8=new Cartesian3,cartesian9=new Cartesian3,cartesian10=new Cartesian3,quaterion$1=new Quaternion,rotMatrix$1=new Matrix3;function computeRoundCorner$1(e,t,i,r,n){var a,o=Cartesian3.angleBetween(Cartesian3.subtract(t,e,scratch1$1),Cartesian3.subtract(i,e,scratch2$1)),s=r===CornerType$1.BEVELED?1:Math.ceil(o/CesiumMath.toRadians(5))+1,l=3*s,c=new Array(l);c[l-3]=i.x,c[l-2]=i.y,c[l-1]=i.z,a=n?Matrix3.fromQuaternion(Quaternion.fromAxisAngle(Cartesian3.negate(e,scratch1$1),o/s,quaterion$1),rotMatrix$1):Matrix3.fromQuaternion(Quaternion.fromAxisAngle(e,o/s,quaterion$1),rotMatrix$1);var u=0;t=Cartesian3.clone(t,scratch1$1);for(var d=0;d<s;d++)t=Matrix3.multiplyByVector(a,t,t),c[u++]=t.x,c[u++]=t.y,c[u++]=t.z;return c}function addEndCaps(e){var t=cartesian1,i=cartesian2,r=cartesian3,n=e[1];i=Cartesian3.fromArray(e[1],n.length-3,i),r=Cartesian3.fromArray(e[0],0,r);var a=computeRoundCorner$1(t=Cartesian3.midpoint(i,r,t),i,r,CornerType$1.ROUNDED,!1),o=e.length-1,s=e[o-1];return n=e[o],i=Cartesian3.fromArray(s,s.length-3,i),r=Cartesian3.fromArray(n,0,r),[a,computeRoundCorner$1(t=Cartesian3.midpoint(i,r,t),i,r,CornerType$1.ROUNDED,!1)]}function computeMiteredCorner(e,t,i,r){var n=scratch1$1;return[(n=(r||(t=Cartesian3.negate(t,t)),Cartesian3.add(e,t,n))).x,n.y,n.z,i.x,i.y,i.z]}function addShiftedPositions(e,t,i,r){for(var n=new Array(e.length),a=new Array(e.length),o=Cartesian3.multiplyByScalar(t,i,scratch1$1),s=Cartesian3.negate(o,scratch2$1),l=0,c=e.length-1,u=0;u<e.length;u+=3){var d=Cartesian3.fromArray(e,u,scratch3),h=Cartesian3.add(d,s,scratch4);n[l++]=h.x,n[l++]=h.y,n[l++]=h.z;var p=Cartesian3.add(d,o,scratch4);a[c--]=p.z,a[c--]=p.y,a[c--]=p.x}return r.push(n,a),r}CorridorGeometryLibrary.addAttribute=function(e,t,i,r){var n=t.x,a=t.y,o=t.z;defined(i)&&(e[i]=n,e[i+1]=a,e[i+2]=o),defined(r)&&(e[r]=o,e[r-1]=a,e[r-2]=n)};var scratchForwardProjection$1=new Cartesian3,scratchBackwardProjection$1=new Cartesian3;CorridorGeometryLibrary.computePositions=function(e){var t=e.granularity,i=e.positions,r=e.ellipsoid,n=e.width/2,a=e.cornerType,o=e.saveAttributes,s=cartesian1,l=cartesian2,c=cartesian3,u=cartesian4,d=cartesian5,h=cartesian6,p=cartesian7,m=cartesian8,f=cartesian9,g=cartesian10,_=[],y=o?[]:void 0,v=o?[]:void 0,C=i[0],S=i[1];l=Cartesian3.normalize(Cartesian3.subtract(S,C,l),l),s=r.geodeticSurfaceNormal(C,s),u=Cartesian3.normalize(Cartesian3.cross(s,l,u),u),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),p=Cartesian3.clone(C,p),C=S,c=Cartesian3.negate(l,c);var x,T,b=[],E=i.length;for(x=1;x<E-1;x++){s=r.geodeticSurfaceNormal(C,s),S=i[x+1],l=Cartesian3.normalize(Cartesian3.subtract(S,C,l),l),d=Cartesian3.normalize(Cartesian3.add(l,c,d),d);var P=Cartesian3.multiplyByScalar(s,Cartesian3.dot(l,s),scratchForwardProjection$1);Cartesian3.subtract(l,P,P),Cartesian3.normalize(P,P);var A=Cartesian3.multiplyByScalar(s,Cartesian3.dot(c,s),scratchBackwardProjection$1);if(Cartesian3.subtract(c,A,A),Cartesian3.normalize(A,A),!CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(P,A)),1,CesiumMath.EPSILON7)){d=Cartesian3.cross(d,s,d),d=Cartesian3.cross(s,d,d),d=Cartesian3.normalize(d,d);var w=n/Math.max(.25,Cartesian3.magnitude(Cartesian3.cross(d,c,scratch1$1))),D=PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(l,c,C,r);d=Cartesian3.multiplyByScalar(d,w,d),D?(m=Cartesian3.add(C,d,m),g=Cartesian3.add(m,Cartesian3.multiplyByScalar(u,n,g),g),f=Cartesian3.add(m,Cartesian3.multiplyByScalar(u,2*n,f),f),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(g,scaleArray2[1]),_=addShiftedPositions(PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:r}),u,n,_),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),h=Cartesian3.clone(f,h),u=Cartesian3.normalize(Cartesian3.cross(s,l,u),u),f=Cartesian3.add(m,Cartesian3.multiplyByScalar(u,2*n,f),f),p=Cartesian3.add(m,Cartesian3.multiplyByScalar(u,n,p),p),a===CornerType$1.ROUNDED||a===CornerType$1.BEVELED?b.push({leftPositions:computeRoundCorner$1(m,h,f,a,D)}):b.push({leftPositions:computeMiteredCorner(C,Cartesian3.negate(d,d),f,D)})):(f=Cartesian3.add(C,d,f),g=Cartesian3.add(f,Cartesian3.negate(Cartesian3.multiplyByScalar(u,n,g),g),g),m=Cartesian3.add(f,Cartesian3.negate(Cartesian3.multiplyByScalar(u,2*n,m),m),m),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(g,scaleArray2[1]),_=addShiftedPositions(PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:r}),u,n,_),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),h=Cartesian3.clone(m,h),u=Cartesian3.normalize(Cartesian3.cross(s,l,u),u),m=Cartesian3.add(f,Cartesian3.negate(Cartesian3.multiplyByScalar(u,2*n,m),m),m),p=Cartesian3.add(f,Cartesian3.negate(Cartesian3.multiplyByScalar(u,n,p),p),p),a===CornerType$1.ROUNDED||a===CornerType$1.BEVELED?b.push({rightPositions:computeRoundCorner$1(f,h,m,a,D)}):b.push({rightPositions:computeMiteredCorner(C,d,m,D)})),c=Cartesian3.negate(l,c)}C=S}return s=r.geodeticSurfaceNormal(C,s),scaleArray2[0]=Cartesian3.clone(p,scaleArray2[0]),scaleArray2[1]=Cartesian3.clone(C,scaleArray2[1]),_=addShiftedPositions(PolylinePipeline.generateArc({positions:scaleArray2,granularity:t,ellipsoid:r}),u,n,_),o&&(y.push(u.x,u.y,u.z),v.push(s.x,s.y,s.z)),a===CornerType$1.ROUNDED&&(T=addEndCaps(_)),{positions:_,corners:b,lefts:y,normals:v,endPositions:T}};var cartesian1$1=new Cartesian3,cartesian2$1=new Cartesian3,cartesian3$1=new Cartesian3,cartesian4$1=new Cartesian3,cartesian5$1=new Cartesian3,cartesian6$1=new Cartesian3,scratch1$2=new Cartesian3,scratch2$2=new Cartesian3;function scaleToSurface$1(e,t){for(var i=0;i<e.length;i++)e[i]=t.scaleToGeodeticSurface(e[i],e[i]);return e}function addNormals(e,t,i,r,n,a){var o=e.normals,s=e.tangents,l=e.bitangents,c=Cartesian3.normalize(Cartesian3.cross(i,t,scratch1$2),scratch1$2);a.normal&&CorridorGeometryLibrary.addAttribute(o,t,r,n),a.tangent&&CorridorGeometryLibrary.addAttribute(s,c,r,n),a.bitangent&&CorridorGeometryLibrary.addAttribute(l,i,r,n)}function combine$1(e,t,i){var r,n,a,o=e.positions,s=e.corners,l=e.endPositions,c=e.lefts,u=e.normals,d=new GeometryAttributes,h=0,p=0,m=0;for(n=0;n<o.length;n+=2)h+=a=o[n].length-3,m+=2*a,p+=o[n+1].length-3;for(h+=3,p+=3,n=0;n<s.length;n++){r=s[n];var f=s[n].leftPositions;defined(f)?h+=a=f.length:p+=a=s[n].rightPositions.length,m+=a}var g,_=defined(l);_&&(h+=g=l[0].length-3,p+=g,m+=6*(g/=3));var y,v,C,S,x,T,b=h+p,E=new Float64Array(b),P={normals:t.normal?new Float32Array(b):void 0,tangents:t.tangent?new Float32Array(b):void 0,bitangents:t.bitangent?new Float32Array(b):void 0},A=0,w=b-1,D=cartesian1$1,M=cartesian2$1,I=g/2,R=IndexDatatype$1.createTypedArray(b/3,m),O=0;if(_){T=cartesian3$1,x=cartesian4$1;var L=l[0];for(D=Cartesian3.fromArray(u,0,D),M=Cartesian3.fromArray(c,0,M),n=0;n<I;n++)T=Cartesian3.fromArray(L,3*(I-1-n),T),x=Cartesian3.fromArray(L,3*(I+n),x),CorridorGeometryLibrary.addAttribute(E,x,A),CorridorGeometryLibrary.addAttribute(E,T,void 0,w),addNormals(P,D,M,A,w,t),S=(v=A/3)+1,C=(y=(w-2)/3)-1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=S,A+=3,w-=3}var F,N,B=0,V=0,k=o[B++],$=o[B++];for(E.set(k,A),E.set($,w-$.length+1),M=Cartesian3.fromArray(c,V,M),a=$.length-3,n=0;n<a;n+=3)F=i.geodeticSurfaceNormal(Cartesian3.fromArray(k,n,scratch1$2),scratch1$2),N=i.geodeticSurfaceNormal(Cartesian3.fromArray($,a-n,scratch2$2),scratch2$2),addNormals(P,D=Cartesian3.normalize(Cartesian3.add(F,N,D),D),M,A,w,t),S=(v=A/3)+1,C=(y=(w-2)/3)-1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=S,A+=3,w-=3;for(F=i.geodeticSurfaceNormal(Cartesian3.fromArray(k,a,scratch1$2),scratch1$2),N=i.geodeticSurfaceNormal(Cartesian3.fromArray($,a,scratch2$2),scratch2$2),D=Cartesian3.normalize(Cartesian3.add(F,N,D),D),V+=3,n=0;n<s.length;n++){var z,U,G,H=(r=s[n]).leftPositions,W=r.rightPositions,q=cartesian6$1,j=cartesian3$1,Y=cartesian4$1;if(D=Cartesian3.fromArray(u,V,D),defined(H)){for(addNormals(P,D,M,void 0,w,t),w-=3,U=S,G=C,z=0;z<H.length/3;z++)q=Cartesian3.fromArray(H,3*z,q),R[O++]=U,R[O++]=G-z-1,R[O++]=G-z,CorridorGeometryLibrary.addAttribute(E,q,void 0,w),j=Cartesian3.fromArray(E,3*(G-z-1),j),Y=Cartesian3.fromArray(E,3*U,Y),addNormals(P,D,M=Cartesian3.normalize(Cartesian3.subtract(j,Y,M),M),void 0,w,t),w-=3;q=Cartesian3.fromArray(E,3*U,q),j=Cartesian3.subtract(Cartesian3.fromArray(E,3*G,j),q,j),Y=Cartesian3.subtract(Cartesian3.fromArray(E,3*(G-z),Y),q,Y),addNormals(P,D,M=Cartesian3.normalize(Cartesian3.add(j,Y,M),M),A,void 0,t),A+=3}else{for(addNormals(P,D,M,A,void 0,t),A+=3,U=C,G=S,z=0;z<W.length/3;z++)q=Cartesian3.fromArray(W,3*z,q),R[O++]=U,R[O++]=G+z,R[O++]=G+z+1,CorridorGeometryLibrary.addAttribute(E,q,A),j=Cartesian3.fromArray(E,3*U,j),Y=Cartesian3.fromArray(E,3*(G+z),Y),addNormals(P,D,M=Cartesian3.normalize(Cartesian3.subtract(j,Y,M),M),A,void 0,t),A+=3;q=Cartesian3.fromArray(E,3*U,q),j=Cartesian3.subtract(Cartesian3.fromArray(E,3*(G+z),j),q,j),Y=Cartesian3.subtract(Cartesian3.fromArray(E,3*G,Y),q,Y),addNormals(P,D,M=Cartesian3.normalize(Cartesian3.negate(Cartesian3.add(Y,j,M),M),M),void 0,w,t),w-=3}for(k=o[B++],$=o[B++],k.splice(0,3),$.splice($.length-3,3),E.set(k,A),E.set($,w-$.length+1),a=$.length-3,V+=3,M=Cartesian3.fromArray(c,V,M),z=0;z<$.length;z+=3)F=i.geodeticSurfaceNormal(Cartesian3.fromArray(k,z,scratch1$2),scratch1$2),N=i.geodeticSurfaceNormal(Cartesian3.fromArray($,a-z,scratch2$2),scratch2$2),addNormals(P,D=Cartesian3.normalize(Cartesian3.add(F,N,D),D),M,A,w,t),v=(S=A/3)-1,y=(C=(w-2)/3)+1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=S,A+=3,w-=3;A-=3,w+=3}if(addNormals(P,D=Cartesian3.fromArray(u,u.length-3,D),M,A,w,t),_){A+=3,w-=3,T=cartesian3$1,x=cartesian4$1;var X=l[1];for(n=0;n<I;n++)T=Cartesian3.fromArray(X,3*(g-n-1),T),x=Cartesian3.fromArray(X,3*n,x),CorridorGeometryLibrary.addAttribute(E,T,void 0,w),CorridorGeometryLibrary.addAttribute(E,x,A),addNormals(P,D,M,A,w,t),v=(S=A/3)-1,y=(C=(w-2)/3)+1,R[O++]=y,R[O++]=v,R[O++]=C,R[O++]=C,R[O++]=v,R[O++]=S,A+=3,w-=3}if(d.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:E}),t.st){var Q,J,Z=new Float32Array(b/3*2),K=0;if(_){h/=3,p/=3;var ee,te=Math.PI/(g+1);J=1/(h-g+1),Q=1/(p-g+1);var ie=g/2;for(n=1+ie;n<g+1;n++)ee=CesiumMath.PI_OVER_TWO+te*n,Z[K++]=Q*(1+Math.cos(ee)),Z[K++]=.5*(1+Math.sin(ee));for(n=1;n<p-g+1;n++)Z[K++]=n*Q,Z[K++]=0;for(n=g;ie<n;n--)ee=CesiumMath.PI_OVER_TWO-n*te,Z[K++]=1-Q*(1+Math.cos(ee)),Z[K++]=.5*(1+Math.sin(ee));for(n=ie;0<n;n--)ee=CesiumMath.PI_OVER_TWO-te*n,Z[K++]=1-J*(1+Math.cos(ee)),Z[K++]=.5*(1+Math.sin(ee));for(n=h-g;0<n;n--)Z[K++]=n*J,Z[K++]=1;for(n=1;n<1+ie;n++)ee=CesiumMath.PI_OVER_TWO+te*n,Z[K++]=J*(1+Math.cos(ee)),Z[K++]=.5*(1+Math.sin(ee))}else{for(J=1/((h/=3)-1),Q=1/((p/=3)-1),n=0;n<p;n++)Z[K++]=n*Q,Z[K++]=0;for(n=h;0<n;n--)Z[K++]=(n-1)*J,Z[K++]=1}d.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:Z})}return t.normal&&(d.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:P.normals})),t.tangent&&(d.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:P.tangents})),t.bitangent&&(d.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:P.bitangents})),{attributes:d,indices:R}}function extrudedAttributes(e,t){if(!(t.normal||t.tangent||t.bitangent||t.st))return e;var i,r,n=e.position.values;(t.normal||t.bitangent)&&(i=e.normal.values,r=e.bitangent.values);var a,o=e.position.values.length/18,s=3*o,l=2*o,c=2*s;if(t.normal||t.bitangent||t.tangent){var u=t.normal?new Float32Array(6*s):void 0,d=t.tangent?new Float32Array(6*s):void 0,h=t.bitangent?new Float32Array(6*s):void 0,p=cartesian1$1,m=cartesian2$1,f=cartesian3$1,g=cartesian4$1,_=cartesian5$1,y=cartesian6$1,v=c;for(a=0;a<s;a+=3){var C=v+c;p=Cartesian3.fromArray(n,a,p),m=Cartesian3.fromArray(n,a+s,m),f=Cartesian3.fromArray(n,(a+3)%s,f),m=Cartesian3.subtract(m,p,m),f=Cartesian3.subtract(f,p,f),g=Cartesian3.normalize(Cartesian3.cross(m,f,g),g),t.normal&&(CorridorGeometryLibrary.addAttribute(u,g,C),CorridorGeometryLibrary.addAttribute(u,g,C+3),CorridorGeometryLibrary.addAttribute(u,g,v),CorridorGeometryLibrary.addAttribute(u,g,v+3)),(t.tangent||t.bitangent)&&(y=Cartesian3.fromArray(i,a,y),t.bitangent&&(CorridorGeometryLibrary.addAttribute(h,y,C),CorridorGeometryLibrary.addAttribute(h,y,C+3),CorridorGeometryLibrary.addAttribute(h,y,v),CorridorGeometryLibrary.addAttribute(h,y,v+3)),t.tangent&&(_=Cartesian3.normalize(Cartesian3.cross(y,g,_),_),CorridorGeometryLibrary.addAttribute(d,_,C),CorridorGeometryLibrary.addAttribute(d,_,C+3),CorridorGeometryLibrary.addAttribute(d,_,v),CorridorGeometryLibrary.addAttribute(d,_,v+3))),v+=6}if(t.normal){for(u.set(i),a=0;a<s;a+=3)u[a+s]=-i[a],u[a+s+1]=-i[a+1],u[a+s+2]=-i[a+2];e.normal.values=u}else e.normal=void 0;if(t.bitangent?(h.set(r),h.set(r,s),e.bitangent.values=h):e.bitangent=void 0,t.tangent){var S=e.tangent.values;d.set(S),d.set(S,s),e.tangent.values=d}}if(t.st){var x=e.st.values,T=new Float32Array(6*l);T.set(x),T.set(x,l);for(var b=2*l,E=0;E<2;E++){for(T[b++]=x[0],T[b++]=x[1],a=2;a<l;a+=2){var P=x[a],A=x[a+1];T[b++]=P,T[b++]=A,T[b++]=P,T[b++]=A}T[b++]=x[0],T[b++]=x[1]}e.st.values=T}return e}function addWallPositions(e,t,i){i[t++]=e[0],i[t++]=e[1],i[t++]=e[2];for(var r=3;r<e.length;r+=3){var n=e[r],a=e[r+1],o=e[r+2];i[t++]=n,i[t++]=a,i[t++]=o,i[t++]=n,i[t++]=a,i[t++]=o}return i[t++]=e[0],i[t++]=e[1],i[t++]=e[2],i}function computePositionsExtruded(e,t){var i=new VertexFormat({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),r=e.ellipsoid,n=combine$1(CorridorGeometryLibrary.computePositions(e),i,r),a=e.height,o=e.extrudedHeight,s=n.attributes,l=n.indices,c=s.position.values,u=c.length,d=new Float64Array(6*u),h=new Float64Array(u);h.set(c);var p,m=new Float64Array(4*u);m=addWallPositions(c=PolygonPipeline.scaleToGeodeticHeight(c,a,r),0,m),m=addWallPositions(h=PolygonPipeline.scaleToGeodeticHeight(h,o,r),2*u,m),d.set(c),d.set(h,u),d.set(m,2*u),s.position.values=d,s=extrudedAttributes(s,t);var f=u/3;if(e.shadowVolume){var g=s.normal.values;u=g.length;var _=new Float32Array(6*u);for(p=0;p<u;p++)g[p]=-g[p];_.set(g,u),_=addWallPositions(g,4*u,_),s.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_}),t.normal||(s.normal=void 0)}if(defined(e.offsetAttribute)){var y=new Uint8Array(6*f);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)y=arrayFill(y=arrayFill(y,1,0,f),1,2*f,4*f);else y=arrayFill(y,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);s.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}var v=l.length,C=f+f,S=IndexDatatype$1.createTypedArray(d.length/3,2*v+3*C);S.set(l);var x,T,b,E,P=v;for(p=0;p<v;p+=3){var A=l[p],w=l[p+1],D=l[p+2];S[P++]=D+f,S[P++]=w+f,S[P++]=A+f}for(p=0;p<C;p+=2)b=(x=p+C)+1,E=(T=x+C)+1,S[P++]=x,S[P++]=T,S[P++]=b,S[P++]=b,S[P++]=T,S[P++]=E;return{attributes:s,indices:S}}var scratchCartesian1$6=new Cartesian3,scratchCartesian2$6=new Cartesian3,scratchCartographic$2=new Cartographic;function computeOffsetPoints(e,t,i,r,n,a){var o=Cartesian3.subtract(t,e,scratchCartesian1$6);Cartesian3.normalize(o,o);var s=i.geodeticSurfaceNormal(e,scratchCartesian2$6),l=Cartesian3.cross(o,s,scratchCartesian1$6);Cartesian3.multiplyByScalar(l,r,l);var c=n.latitude,u=n.longitude,d=a.latitude,h=a.longitude;Cartesian3.add(e,l,scratchCartesian2$6),i.cartesianToCartographic(scratchCartesian2$6,scratchCartographic$2);var p=scratchCartographic$2.latitude,m=scratchCartographic$2.longitude;c=Math.min(c,p),u=Math.min(u,m),d=Math.max(d,p),h=Math.max(h,m),Cartesian3.subtract(e,l,scratchCartesian2$6),i.cartesianToCartographic(scratchCartesian2$6,scratchCartographic$2),p=scratchCartographic$2.latitude,m=scratchCartographic$2.longitude,c=Math.min(c,p),u=Math.min(u,m),d=Math.max(d,p),h=Math.max(h,m),n.latitude=c,n.longitude=u,a.latitude=d,a.longitude=h}var scratchCartesianOffset=new Cartesian3,scratchCartesianEnds=new Cartesian3,scratchCartographicMin=new Cartographic,scratchCartographicMax=new Cartographic;function computeRectangle$1(e,t,i,r,n){var a=arrayRemoveDuplicates(e=scaleToSurface$1(e,t),Cartesian3.equalsEpsilon),o=a.length;if(o<2||i<=0)return new Rectangle;var s,l,c=.5*i;if(scratchCartographicMin.latitude=Number.POSITIVE_INFINITY,scratchCartographicMin.longitude=Number.POSITIVE_INFINITY,scratchCartographicMax.latitude=Number.NEGATIVE_INFINITY,scratchCartographicMax.longitude=Number.NEGATIVE_INFINITY,r===CornerType$1.ROUNDED){var u=a[0];Cartesian3.subtract(u,a[1],scratchCartesianOffset),Cartesian3.normalize(scratchCartesianOffset,scratchCartesianOffset),Cartesian3.multiplyByScalar(scratchCartesianOffset,c,scratchCartesianOffset),Cartesian3.add(u,scratchCartesianOffset,scratchCartesianEnds),t.cartesianToCartographic(scratchCartesianEnds,scratchCartographic$2),s=scratchCartographic$2.latitude,l=scratchCartographic$2.longitude,scratchCartographicMin.latitude=Math.min(scratchCartographicMin.latitude,s),scratchCartographicMin.longitude=Math.min(scratchCartographicMin.longitude,l),scratchCartographicMax.latitude=Math.max(scratchCartographicMax.latitude,s),scratchCartographicMax.longitude=Math.max(scratchCartographicMax.longitude,l)}for(var d=0;d<o-1;++d)computeOffsetPoints(a[d],a[d+1],t,c,scratchCartographicMin,scratchCartographicMax);var h=a[o-1];Cartesian3.subtract(h,a[o-2],scratchCartesianOffset),Cartesian3.normalize(scratchCartesianOffset,scratchCartesianOffset),Cartesian3.multiplyByScalar(scratchCartesianOffset,c,scratchCartesianOffset),Cartesian3.add(h,scratchCartesianOffset,scratchCartesianEnds),computeOffsetPoints(h,scratchCartesianEnds,t,c,scratchCartographicMin,scratchCartographicMax),r===CornerType$1.ROUNDED&&(t.cartesianToCartographic(scratchCartesianEnds,scratchCartographic$2),s=scratchCartographic$2.latitude,l=scratchCartographic$2.longitude,scratchCartographicMin.latitude=Math.min(scratchCartographicMin.latitude,s),scratchCartographicMin.longitude=Math.min(scratchCartographicMin.longitude,l),scratchCartographicMax.latitude=Math.max(scratchCartographicMax.latitude,s),scratchCartographicMax.longitude=Math.max(scratchCartographicMax.longitude,l));var p=defined(n)?n:new Rectangle;return p.north=scratchCartographicMax.latitude,p.south=scratchCartographicMin.latitude,p.east=scratchCartographicMax.longitude,p.west=scratchCartographicMin.longitude,p}function CorridorGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.width,r=defaultValue(e.height,0),n=defaultValue(e.extrudedHeight,r);this._positions=t,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._width=i,this._height=Math.max(r,n),this._extrudedHeight=Math.min(r,n),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*Cartesian3.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7}CorridorGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._positions,n=r.length;t[i++]=n;for(var a=0;a<n;++a,i+=Cartesian3.packedLength)Cartesian3.pack(r[a],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchEllipsoid$3=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$3=new VertexFormat,scratchOptions$8={positions:void 0,ellipsoid:scratchEllipsoid$3,vertexFormat:scratchVertexFormat$3,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};CorridorGeometry.unpack=function(e,t,i){t=defaultValue(t,0);for(var r=e[t++],n=new Array(r),a=0;a<r;++a,t+=Cartesian3.packedLength)n[a]=Cartesian3.unpack(e,t);var o=Ellipsoid.unpack(e,t,scratchEllipsoid$3);t+=Ellipsoid.packedLength;var s=VertexFormat.unpack(e,t,scratchVertexFormat$3);t+=VertexFormat.packedLength;var l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],p=1===e[t++],m=e[t];return defined(i)?(i._positions=n,i._ellipsoid=Ellipsoid.clone(o,i._ellipsoid),i._vertexFormat=VertexFormat.clone(s,i._vertexFormat),i._width=l,i._height=c,i._extrudedHeight=u,i._cornerType=d,i._granularity=h,i._shadowVolume=p,i._offsetAttribute=-1===m?void 0:m,i):(scratchOptions$8.positions=n,scratchOptions$8.width=l,scratchOptions$8.height=c,scratchOptions$8.extrudedHeight=u,scratchOptions$8.cornerType=d,scratchOptions$8.granularity=h,scratchOptions$8.shadowVolume=p,scratchOptions$8.offsetAttribute=-1===m?void 0:m,new CorridorGeometry(scratchOptions$8))},CorridorGeometry.computeRectangle=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,r=e.width;return computeRectangle$1(i,defaultValue(e.ellipsoid,Ellipsoid.WGS84),r,defaultValue(e.cornerType,CornerType$1.ROUNDED),t)},CorridorGeometry.createGeometry=function(e){var t=e._positions,i=e._width,r=e._ellipsoid,n=arrayRemoveDuplicates(t=scaleToSurface$1(t,r),Cartesian3.equalsEpsilon);if(!(n.length<2||i<=0)){var a,o=e._height,s=e._extrudedHeight,l=!CesiumMath.equalsEpsilon(o,s,0,CesiumMath.EPSILON2),c=e._vertexFormat,u={ellipsoid:r,positions:n,width:i,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};if(l)u.height=o,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,a=computePositionsExtruded(u,c);else if((a=combine$1(CorridorGeometryLibrary.computePositions(u),c,r)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(a.attributes.position.values,o,r),defined(e._offsetAttribute)){var d=e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1,h=a.attributes.position.values.length,p=new Uint8Array(h/3);arrayFill(p,d),a.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}var m=a.attributes,f=BoundingSphere.fromVertices(m.position.values,void 0,3);return c.position||(a.attributes.position.values=void 0),new Geometry({attributes:m,indices:a.indices,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:f,offsetAttribute:e._offsetAttribute})}},CorridorGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new CorridorGeometry({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:n,granularity:r,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})},defineProperties$1(CorridorGeometry.prototype,{rectangle:{get:function(){return defined(this._rectangle)||(this._rectangle=computeRectangle$1(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});var cartesian1$2=new Cartesian3,cartesian2$2=new Cartesian3,cartesian3$2=new Cartesian3;function scaleToSurface$2(e,t){for(var i=0;i<e.length;i++)e[i]=t.scaleToGeodeticSurface(e[i],e[i]);return e}function combine$2(e,t){var i,r,n,a=[],o=e.positions,s=e.corners,l=e.endPositions,c=new GeometryAttributes,u=0,d=0,h=0;for(r=0;r<o.length;r+=2)u+=n=o[r].length-3,h+=n/3*4,d+=o[r+1].length-3;for(u+=3,d+=3,r=0;r<s.length;r++){i=s[r];var p=s[r].leftPositions;defined(p)?u+=n=p.length:d+=n=s[r].rightPositions.length,h+=n/3*2}var m,f=defined(l);f&&(u+=m=l[0].length-3,d+=m,h+=4*(m/=3));var g,_,y,v,C,S,x=u+d,T=new Float64Array(x),b=0,E=x-1,P=m/2,A=IndexDatatype$1.createTypedArray(x/3,h+4),w=0;if(A[w++]=b/3,A[w++]=(E-2)/3,f){a.push(b/3),S=cartesian1$2,C=cartesian2$2;var D=l[0];for(r=0;r<P;r++)S=Cartesian3.fromArray(D,3*(P-1-r),S),C=Cartesian3.fromArray(D,3*(P+r),C),CorridorGeometryLibrary.addAttribute(T,C,b),CorridorGeometryLibrary.addAttribute(T,S,void 0,E),v=(_=b/3)+1,y=(g=(E-2)/3)-1,A[w++]=g,A[w++]=y,A[w++]=_,A[w++]=v,b+=3,E-=3}var M=0,I=o[M++],R=o[M++];for(T.set(I,b),T.set(R,E-R.length+1),n=R.length-3,a.push(b/3,(E-2)/3),r=0;r<n;r+=3)v=(_=b/3)+1,y=(g=(E-2)/3)-1,A[w++]=g,A[w++]=y,A[w++]=_,A[w++]=v,b+=3,E-=3;for(r=0;r<s.length;r++){var O,L,F=(i=s[r]).leftPositions,N=i.rightPositions,B=cartesian3$2;if(defined(F)){for(E-=3,L=y,a.push(v),O=0;O<F.length/3;O++)B=Cartesian3.fromArray(F,3*O,B),A[w++]=L-O-1,A[w++]=L-O,CorridorGeometryLibrary.addAttribute(T,B,void 0,E),E-=3;a.push(L-Math.floor(F.length/6)),t===CornerType$1.BEVELED&&a.push((E-2)/3+1),b+=3}else{for(b+=3,L=v,a.push(y),O=0;O<N.length/3;O++)B=Cartesian3.fromArray(N,3*O,B),A[w++]=L+O,A[w++]=L+O+1,CorridorGeometryLibrary.addAttribute(T,B,b),b+=3;a.push(L+Math.floor(N.length/6)),t===CornerType$1.BEVELED&&a.push(b/3-1),E-=3}for(I=o[M++],R=o[M++],I.splice(0,3),R.splice(R.length-3,3),T.set(I,b),T.set(R,E-R.length+1),n=R.length-3,O=0;O<R.length;O+=3)_=(v=b/3)-1,g=(y=(E-2)/3)+1,A[w++]=g,A[w++]=y,A[w++]=_,A[w++]=v,b+=3,E-=3;b-=3,E+=3,a.push(b/3,(E-2)/3)}if(f){b+=3,E-=3,S=cartesian1$2,C=cartesian2$2;var V=l[1];for(r=0;r<P;r++)S=Cartesian3.fromArray(V,3*(m-r-1),S),C=Cartesian3.fromArray(V,3*r,C),CorridorGeometryLibrary.addAttribute(T,S,void 0,E),CorridorGeometryLibrary.addAttribute(T,C,b),_=(v=b/3)-1,g=(y=(E-2)/3)+1,A[w++]=g,A[w++]=y,A[w++]=_,A[w++]=v,b+=3,E-=3;a.push(b/3)}else a.push(b/3,(E-2)/3);return A[w++]=b/3,A[w++]=(E-2)/3,c.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:T}),{attributes:c,indices:A,wallIndices:a}}function computePositionsExtruded$1(e){var t=e.ellipsoid,i=combine$2(CorridorGeometryLibrary.computePositions(e),e.cornerType),r=i.wallIndices,n=e.height,a=e.extrudedHeight,o=i.attributes,s=i.indices,l=o.position.values,c=l.length,u=new Float64Array(c);u.set(l);var d,h=new Float64Array(2*c);if(l=PolygonPipeline.scaleToGeodeticHeight(l,n,t),u=PolygonPipeline.scaleToGeodeticHeight(u,a,t),h.set(l),h.set(u,c),o.position.values=h,c/=3,defined(e.offsetAttribute)){var p=new Uint8Array(2*c);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)p=arrayFill(p,1,0,c);else p=arrayFill(p,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);o.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}var m=s.length,f=IndexDatatype$1.createTypedArray(h.length/3,2*(m+r.length));f.set(s);var g,_,y=m;for(d=0;d<m;d+=2){var v=s[d],C=s[d+1];f[y++]=v+c,f[y++]=C+c}for(d=0;d<r.length;d++)_=(g=r[d])+c,f[y++]=g,f[y++]=_;return{attributes:o,indices:f}}function CorridorOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.width,r=defaultValue(e.height,0),n=defaultValue(e.extrudedHeight,r);this._positions=t,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._width=i,this._height=Math.max(r,n),this._extrudedHeight=Math.min(r,n),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*Cartesian3.packedLength+Ellipsoid.packedLength+6}CorridorOutlineGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._positions,n=r.length;t[i++]=n;for(var a=0;a<n;++a,i+=Cartesian3.packedLength)Cartesian3.pack(r[a],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchEllipsoid$4=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$9={positions:void 0,ellipsoid:scratchEllipsoid$4,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0},defaultTokenCredit;function createGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}CorridorOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);for(var r=e[t++],n=new Array(r),a=0;a<r;++a,t+=Cartesian3.packedLength)n[a]=Cartesian3.unpack(e,t);var o=Ellipsoid.unpack(e,t,scratchEllipsoid$4);t+=Ellipsoid.packedLength;var s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._positions=n,i._ellipsoid=Ellipsoid.clone(o,i._ellipsoid),i._width=s,i._height=l,i._extrudedHeight=c,i._cornerType=u,i._granularity=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$9.positions=n,scratchOptions$9.width=s,scratchOptions$9.height=l,scratchOptions$9.extrudedHeight=c,scratchOptions$9.cornerType=u,scratchOptions$9.granularity=d,scratchOptions$9.offsetAttribute=-1===h?void 0:h,new CorridorOutlineGeometry(scratchOptions$9))},CorridorOutlineGeometry.createGeometry=function(e){var t=e._positions,i=e._width,r=e._ellipsoid,n=arrayRemoveDuplicates(t=scaleToSurface$2(t,r),Cartesian3.equalsEpsilon);if(!(n.length<2||i<=0)){var a,o=e._height,s=e._extrudedHeight,l=!CesiumMath.equalsEpsilon(o,s,0,CesiumMath.EPSILON2),c={ellipsoid:r,positions:n,width:i,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};if(l)c.height=o,c.extrudedHeight=s,c.offsetAttribute=e._offsetAttribute,a=computePositionsExtruded$1(c);else if((a=combine$2(CorridorGeometryLibrary.computePositions(c),c.cornerType)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(a.attributes.position.values,o,r),defined(e._offsetAttribute)){var u=a.attributes.position.values.length,d=new Uint8Array(u/3);arrayFill(d,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),a.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}var h=a.attributes,p=BoundingSphere.fromVertices(h.position.values,void 0,3);return new Geometry({attributes:h,indices:a.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:p,offsetAttribute:e._offsetAttribute})}};var defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYmY1OGY2NS1kODVmLTQxNTUtOWY5YS00ODE1Y2E1ZjFkZTQiLCJpZCI6MjU5LCJzY29wZXMiOlsiYXNyIiwiZ2MiXSwiaWF0IjoxNTcyNjI4NjQ5fQ.CYr8wbSJnOsWz4x2ufDHVe7CGvWzEWl4HzcOcceaNCE",Ion={};function IonResource(e,t){var i,r=e.externalType,n=defined(r);if(n){if("3DTILES"!==r&&"STK_TERRAIN_SERVER"!==r)throw new RuntimeError("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");i={url:e.options.url}}else i={url:e.url,retryAttempts:1,retryCallback:retryCallback};Resource.call(this,i),this._ionEndpoint=e,this._ionEndpointDomain=n?void 0:new URI(e.url).authority,this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=n}function retryCallback(t,e){var i=defaultValue(t._ionRoot,t),r=i._ionEndpointResource;return defined(e)&&(401===e.statusCode||e.target instanceof Image)?(defined(i._pendingPromise)||(i._pendingPromise=r.fetchJson().then(function(e){return i._ionEndpoint=e}).always(function(e){return i._pendingPromise=void 0,e})),i._pendingPromise.then(function(e){return t._ionEndpoint=e,!0})):when.resolve(!1)}function createWorldTerrain(e){return e=defaultValue(e,defaultValue.EMPTY_OBJECT),new CesiumTerrainProvider({url:IonResource.fromAssetId(1),requestVertexNormals:defaultValue(e.requestVertexNormals,!1),requestWaterMask:defaultValue(e.requestWaterMask,!1)})}function CullingVolume(e){this.planes=defaultValue(e,[])}Ion.defaultAccessToken=defaultAccessToken,Ion.defaultServer=new Resource({url:"https://api.cesium.com/"}),Ion.getDefaultTokenCredit=function(e){if(e===defaultAccessToken){if(!defined(defaultTokenCredit)){defaultTokenCredit=new Credit('<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>',!0)}return defaultTokenCredit}},defined(Object.create)&&(IonResource.prototype=Object.create(Resource.prototype),IonResource.prototype.constructor=IonResource),IonResource.fromAssetId=function(e,t){var i=IonResource._createEndpointResource(e,t);return i.fetchJson().then(function(e){return new IonResource(e,i)})},defineProperties$1(IonResource.prototype,{credits:{get:function(){return defined(this._ionRoot)?this._ionRoot.credits:(defined(this._credits)||(this._credits=IonResource.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource)),this._credits)}}}),IonResource.getCreditsFromEndpoint=function(e,t){var i=e.attributions.map(Credit.getIonCredit),r=Ion.getDefaultTokenCredit(t.queryParameters.access_token);return defined(r)&&i.push(Credit.clone(r)),i},IonResource.prototype.clone=function(e){var t=defaultValue(this._ionRoot,this);return defined(e)||(e=new IonResource(t._ionEndpoint,t._ionEndpointResource)),(e=Resource.prototype.clone.call(this,e))._ionRoot=t,e._isExternal=this._isExternal,e},IonResource.prototype.fetchImage=function(e){if(!this._isExternal){var t=e;e={preferBlob:!0},defined(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Resource.prototype.fetchImage.call(this,e)},IonResource.prototype._makeRequest=function(e){if(this._isExternal||new URI(this.url).authority!==this._ionEndpointDomain)return Resource.prototype._makeRequest.call(this,e);var t="*/*;access_token="+this._ionEndpoint.accessToken,i=t,r=this.headers;return defined(r)&&defined(r.Accept)&&(i=r.Accept+","+t),defined(e.headers)?defined(e.headers.Accept)?e.headers.Accept=e.headers.Accept+","+t:e.headers.Accept=i:e.headers={Accept:i},Resource.prototype._makeRequest.call(this,e)},IonResource._createEndpointResource=function(e,t){var i=defaultValue((t=defaultValue(t,defaultValue.EMPTY_OBJECT)).server,Ion.defaultServer),r=defaultValue(t.accessToken,Ion.defaultAccessToken);i=Resource.createIfNeeded(i);var n={url:"v1/assets/"+e+"/endpoint"};return defined(r)&&(n.queryParameters={access_token:r}),i.getDerivedResource(n)};var faces=[new Cartesian3,new Cartesian3,new Cartesian3];Cartesian3.clone(Cartesian3.UNIT_X,faces[0]),Cartesian3.clone(Cartesian3.UNIT_Y,faces[1]),Cartesian3.clone(Cartesian3.UNIT_Z,faces[2]);var scratchPlaneCenter=new Cartesian3,scratchPlaneNormal=new Cartesian3,scratchPlane=new Plane(new Cartesian3(1,0,0),0);CullingVolume.fromBoundingSphere=function(e,t){defined(t)||(t=new CullingVolume);var i=faces.length,r=t.planes;r.length=2*i;for(var n=e.center,a=e.radius,o=0,s=0;s<i;++s){var l=faces[s],c=r[o],u=r[o+1];defined(c)||(c=r[o]=new Cartesian4),defined(u)||(u=r[o+1]=new Cartesian4),Cartesian3.multiplyByScalar(l,-a,scratchPlaneCenter),Cartesian3.add(n,scratchPlaneCenter,scratchPlaneCenter),c.x=l.x,c.y=l.y,c.z=l.z,c.w=-Cartesian3.dot(l,scratchPlaneCenter),Cartesian3.multiplyByScalar(l,a,scratchPlaneCenter),Cartesian3.add(n,scratchPlaneCenter,scratchPlaneCenter),u.x=-l.x,u.y=-l.y,u.z=-l.z,u.w=-Cartesian3.dot(Cartesian3.negate(l,scratchPlaneNormal),scratchPlaneCenter),o+=2}return t},CullingVolume.prototype.computeVisibility=function(e){for(var t=this.planes,i=!1,r=0,n=t.length;r<n;++r){var a=e.intersectPlane(Plane.fromCartesian4(t[r],scratchPlane));if(a===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE;a===Intersect$1.INTERSECTING&&(i=!0)}return i?Intersect$1.INTERSECTING:Intersect$1.INSIDE},CullingVolume.prototype.computeVisibilityWithPlaneMask=function(e,t){if(t===CullingVolume.MASK_OUTSIDE||t===CullingVolume.MASK_INSIDE)return t;for(var i=CullingVolume.MASK_INSIDE,r=this.planes,n=0,a=r.length;n<a;++n){var o=n<31?1<<n:0;if(!(n<31&&0==(t&o))){var s=e.intersectPlane(Plane.fromCartesian4(r[n],scratchPlane));if(s===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE;s===Intersect$1.INTERSECTING&&(i|=o)}}return i},CullingVolume.MASK_OUTSIDE=4294967295,CullingVolume.MASK_INSIDE=0,CullingVolume.MASK_INDETERMINATE=2147483647;var CylinderGeometryLibrary={computePositions:function(e,t,i,r,n){var a,o=.5*e,s=-o,l=r+r,c=new Float64Array(3*(n?2*l:l)),u=0,d=0,h=n?3*l:0,p=n?3*(l+r):3*r;for(a=0;a<r;a++){var m=a/r*CesiumMath.TWO_PI,f=Math.cos(m),g=Math.sin(m),_=f*i,y=g*i,v=f*t,C=g*t;c[d+h]=_,c[d+h+1]=y,c[d+h+2]=s,c[d+p]=v,c[d+p+1]=C,c[d+p+2]=o,d+=3,n&&(c[u++]=_,c[u++]=y,c[u++]=s,c[u++]=v,c[u++]=C,c[u++]=o)}return c}},radiusScratch=new Cartesian2,normalScratch$2=new Cartesian3,bitangentScratch=new Cartesian3,tangentScratch=new Cartesian3,positionScratch$1=new Cartesian3;function CylinderGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,r=e.bottomRadius,n=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),a=defaultValue(e.slices,128);this._length=t,this._topRadius=i,this._bottomRadius=r,this._vertexFormat=VertexFormat.clone(n),this._slices=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}CylinderGeometry.packedLength=VertexFormat.packedLength+5,CylinderGeometry.pack=function(e,t,i){return i=defaultValue(i,0),VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchVertexFormat$4=new VertexFormat,scratchOptions$a={vertexFormat:scratchVertexFormat$4,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0},unitCylinderGeometry;CylinderGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=VertexFormat.unpack(e,t,scratchVertexFormat$4);t+=VertexFormat.packedLength;var n=e[t++],a=e[t++],o=e[t++],s=e[t++],l=e[t];return defined(i)?(i._vertexFormat=VertexFormat.clone(r,i._vertexFormat),i._length=n,i._topRadius=a,i._bottomRadius=o,i._slices=s,i._offsetAttribute=-1===l?void 0:l,i):(scratchOptions$a.length=n,scratchOptions$a.topRadius=a,scratchOptions$a.bottomRadius=o,scratchOptions$a.slices=s,scratchOptions$a.offsetAttribute=-1===l?void 0:l,new CylinderGeometry(scratchOptions$a))},CylinderGeometry.createGeometry=function(e){var t=e._length,i=e._topRadius,r=e._bottomRadius,n=e._vertexFormat,a=e._slices;if(!(t<=0||i<0||r<0||0===i&&0===r)){var o,s=a+a,l=a+s,c=s+s,u=CylinderGeometryLibrary.computePositions(t,i,r,a,!0),d=n.st?new Float32Array(2*c):void 0,h=n.normal?new Float32Array(3*c):void 0,p=n.tangent?new Float32Array(3*c):void 0,m=n.bitangent?new Float32Array(3*c):void 0,f=n.normal||n.tangent||n.bitangent;if(f){var g=n.tangent||n.bitangent,_=0,y=0,v=0,C=Math.atan2(r-i,t),S=normalScratch$2;S.z=Math.sin(C);var x=Math.cos(C),T=tangentScratch,b=bitangentScratch;for(o=0;o<a;o++){var E=o/a*CesiumMath.TWO_PI,P=x*Math.cos(E),A=x*Math.sin(E);f&&(S.x=P,S.y=A,g&&(T=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,S,T),T)),n.normal&&(h[_++]=S.x,h[_++]=S.y,h[_++]=S.z,h[_++]=S.x,h[_++]=S.y,h[_++]=S.z),n.tangent&&(p[y++]=T.x,p[y++]=T.y,p[y++]=T.z,p[y++]=T.x,p[y++]=T.y,p[y++]=T.z),n.bitangent&&(b=Cartesian3.normalize(Cartesian3.cross(S,T,b),b),m[v++]=b.x,m[v++]=b.y,m[v++]=b.z,m[v++]=b.x,m[v++]=b.y,m[v++]=b.z))}for(o=0;o<a;o++)n.normal&&(h[_++]=0,h[_++]=0,h[_++]=-1),n.tangent&&(p[y++]=1,p[y++]=0,p[y++]=0),n.bitangent&&(m[v++]=0,m[v++]=-1,m[v++]=0);for(o=0;o<a;o++)n.normal&&(h[_++]=0,h[_++]=0,h[_++]=1),n.tangent&&(p[y++]=1,p[y++]=0,p[y++]=0),n.bitangent&&(m[v++]=0,m[v++]=1,m[v++]=0)}var w=12*a-12,D=IndexDatatype$1.createTypedArray(c,w),M=0,I=0;for(o=0;o<a-1;o++)D[M++]=I,D[M++]=I+2,D[M++]=I+3,D[M++]=I,D[M++]=I+3,D[M++]=I+1,I+=2;for(D[M++]=s-2,D[M++]=0,D[M++]=1,D[M++]=s-2,D[M++]=1,D[M++]=s-1,o=1;o<a-1;o++)D[M++]=s+o+1,D[M++]=s+o,D[M++]=s;for(o=1;o<a-1;o++)D[M++]=l,D[M++]=l+o,D[M++]=l+o+1;var R=0;if(n.st){var O=Math.max(i,r);for(o=0;o<c;o++){var L=Cartesian3.fromArray(u,3*o,positionScratch$1);d[R++]=(L.x+O)/(2*O),d[R++]=(L.y+O)/(2*O)}}var F=new GeometryAttributes;n.position&&(F.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:u})),n.normal&&(F.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),n.tangent&&(F.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),n.bitangent&&(F.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:m})),n.st&&(F.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:d})),radiusScratch.x=.5*t,radiusScratch.y=Math.max(r,i);var N=new BoundingSphere(Cartesian3.ZERO,Cartesian2.magnitude(radiusScratch));if(defined(e._offsetAttribute)){t=u.length;var B=new Uint8Array(t/3);arrayFill(B,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),F.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:B})}return new Geometry({attributes:F,indices:D,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:N,offsetAttribute:e._offsetAttribute})}},CylinderGeometry.getUnitCylinder=function(){return defined(unitCylinderGeometry)||(unitCylinderGeometry=CylinderGeometry.createGeometry(new CylinderGeometry({topRadius:1,bottomRadius:1,length:1,vertexFormat:VertexFormat.POSITION_ONLY}))),unitCylinderGeometry};var radiusScratch$1=new Cartesian2;function CylinderOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,r=e.bottomRadius,n=defaultValue(e.slices,128),a=Math.max(defaultValue(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=i,this._bottomRadius=r,this._slices=n,this._numberOfVerticalLines=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}CylinderOutlineGeometry.packedLength=6,CylinderOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i++]=e._numberOfVerticalLines,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchOptions$b={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};CylinderOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=e[t++],n=e[t++],a=e[t++],o=e[t++],s=e[t++],l=e[t];return defined(i)?(i._length=r,i._topRadius=n,i._bottomRadius=a,i._slices=o,i._numberOfVerticalLines=s,i._offsetAttribute=-1===l?void 0:l,i):(scratchOptions$b.length=r,scratchOptions$b.topRadius=n,scratchOptions$b.bottomRadius=a,scratchOptions$b.slices=o,scratchOptions$b.numberOfVerticalLines=s,scratchOptions$b.offsetAttribute=-1===l?void 0:l,new CylinderOutlineGeometry(scratchOptions$b))},CylinderOutlineGeometry.createGeometry=function(e){var t=e._length,i=e._topRadius,r=e._bottomRadius,n=e._slices,a=e._numberOfVerticalLines;if(!(t<=0||i<0||r<0||0===i&&0===r)){var o,s=2*n,l=CylinderGeometryLibrary.computePositions(t,i,r,n,!1),c=2*n;if(0<a){var u=Math.min(a,n);o=Math.round(n/u),c+=u}var d,h=IndexDatatype$1.createTypedArray(s,2*c),p=0;for(d=0;d<n-1;d++)h[p++]=d,h[p++]=d+1,h[p++]=d+n,h[p++]=d+1+n;if(h[p++]=n-1,h[p++]=0,h[p++]=n+n-1,h[p++]=n,0<a)for(d=0;d<n;d+=o)h[p++]=d,h[p++]=d+n;var m=new GeometryAttributes;m.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l}),radiusScratch$1.x=.5*t,radiusScratch$1.y=Math.max(r,i);var f=new BoundingSphere(Cartesian3.ZERO,Cartesian2.magnitude(radiusScratch$1));if(defined(e._offsetAttribute)){t=l.length;var g=new Uint8Array(t/3);arrayFill(g,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),m.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}return new Geometry({attributes:m,indices:h,primitiveType:PrimitiveType$1.LINES,boundingSphere:f,offsetAttribute:e._offsetAttribute})}};var compressedMagic=1953029805,compressedMagicSwap=2917034100;function decodeGoogleEarthEnterpriseData(e,t){if(decodeGoogleEarthEnterpriseData.passThroughDataForTesting)return t;var i=e.byteLength;if(0===i||i%4!=0)throw new RuntimeError("The length of key must be greater than 0 and a multiple of 4.");var r=new DataView(t),n=r.getUint32(0,!0);if(n===compressedMagic||n===compressedMagicSwap)return t;for(var a,o=new DataView(e),s=0,l=t.byteLength,c=l-l%8,u=i,d=8;s<c;)for(a=d=(d+8)%24;s<c&&a<u;)r.setUint32(s,r.getUint32(s,!0)^o.getUint32(a,!0),!0),r.setUint32(s+4,r.getUint32(s+4,!0)^o.getUint32(a+4,!0),!0),s+=8,a+=24;if(s<l)for(u<=a&&(a=d=(d+8)%24);s<l;)r.setUint8(s,r.getUint8(s)^o.getUint8(a)),s++,a++}function DefaultProxy(e){this.proxy=e}function DistanceDisplayCondition(e,t){e=defaultValue(e,0),this._near=e,t=defaultValue(t,Number.MAX_VALUE),this._far=t}function DistanceDisplayConditionGeometryInstanceAttribute(e,t){e=defaultValue(e,0),t=defaultValue(t,Number.MAX_VALUE),this.value=new Float32Array([e,t])}function DoublyLinkedList(){this.head=void 0,this.tail=void 0,this._length=0}function DoublyLinkedListNode(e,t,i){this.item=e,this.previous=t,this.next=i}function remove(e,t){defined(t.previous)&&defined(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):defined(t.previous)?(t.previous.next=void 0,e.tail=t.previous):defined(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}decodeGoogleEarthEnterpriseData.passThroughDataForTesting=!1,DefaultProxy.prototype.getURL=function(e){var t=-1===this.proxy.indexOf("?")?"?":"";return this.proxy+t+encodeURIComponent(e)},defineProperties$1(DistanceDisplayCondition.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}}}),DistanceDisplayCondition.packedLength=2,DistanceDisplayCondition.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.near,t[i]=e.far,t},DistanceDisplayCondition.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new DistanceDisplayCondition),i.near=e[t++],i.far=e[t],i},DistanceDisplayCondition.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.far===t.far},DistanceDisplayCondition.clone=function(e,t){if(defined(e))return defined(t)||(t=new DistanceDisplayCondition),t.near=e.near,t.far=e.far,t},DistanceDisplayCondition.prototype.clone=function(e){return DistanceDisplayCondition.clone(this,e)},DistanceDisplayCondition.prototype.equals=function(e){return DistanceDisplayCondition.equals(this,e)},defineProperties$1(DistanceDisplayConditionGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}}),DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition=function(e){return new DistanceDisplayConditionGeometryInstanceAttribute(e.near,e.far)},DistanceDisplayConditionGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])},defineProperties$1(DoublyLinkedList.prototype,{length:{get:function(){return this._length}}}),DoublyLinkedList.prototype.add=function(e){var t=new DoublyLinkedListNode(e,this.tail,void 0);return defined(this.tail)?this.tail.next=t:this.head=t,this.tail=t,++this._length,t},DoublyLinkedList.prototype.remove=function(e){defined(e)&&(remove(this,e),--this._length)},DoublyLinkedList.prototype.splice=function(e,t){if(e!==t){remove(this,t);var i=e.next;e.next=t,this.tail===e?this.tail=t:i.previous=t,t.next=i,t.previous=e}},void 0===Date.now&&(Date.now=function(){return(new Date).valueOf()});var TWEEN=TWEEN||(Nxb=[],{REVISION:"13",getAll:function(){return Nxb},removeAll:function(){Nxb=[]},add:function(e){Nxb.push(e)},remove:function(e){var t=Nxb.indexOf(e);-1!==t&&Nxb.splice(t,1)},update:function(e){if(0===Nxb.length)return!1;var t=0;for(e=void 0!==e?e:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();t<Nxb.length;)Nxb[t].update(e)?t++:Nxb.splice(t,1);return!0}}),Nxb,Xzb;TWEEN.Tween=function(e){var c=e,u={},d={},h={},p=1e3,m=0,f=!1,i=!1,g=0,_=null,y=TWEEN.Easing.Linear.None,v=TWEEN.Interpolation.Linear,C=[],S=null,x=!1,T=null,b=null,t=null;for(var r in e)u[r]=parseFloat(e[r],10);this.to=function(e,t){return void 0!==t&&(p=t),d=e,this},this.start=function(e){for(var t in TWEEN.add(this),x=!(i=!0),_=void 0!==e?e:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(),_+=g,d){if(d[t]instanceof Array){if(0===d[t].length)continue;d[t]=[c[t]].concat(d[t])}u[t]=c[t],u[t]instanceof Array==!1&&(u[t]*=1),h[t]=u[t]||0}return this},this.stop=function(){return i&&(TWEEN.remove(this),i=!1,null!==t&&t.call(c),this.stopChainedTweens()),this},this.stopChainedTweens=function(){for(var e=0,t=C.length;e<t;e++)C[e].stop()},this.delay=function(e){return g=e,this},this.repeat=function(e){return m=e,this},this.yoyo=function(e){return f=e,this},this.easing=function(e){return y=e,this},this.interpolation=function(e){return v=e,this},this.chain=function(){return C=arguments,this},this.onStart=function(e){return S=e,this},this.onUpdate=function(e){return T=e,this},this.onComplete=function(e){return b=e,this},this.onStop=function(e){return t=e,this},this.update=function(e){var t;if(e<_)return!0;!1===x&&(null!==S&&S.call(c),x=!0);var i=(e-_)/p,r=y(i=1<i?1:i);for(t in d){var n=u[t]||0,a=d[t];a instanceof Array?c[t]=v(a,r):("string"==typeof a&&(a=n+parseFloat(a,10)),"number"==typeof a&&(c[t]=n+(a-n)*r))}if(null!==T&&T.call(c,r),1!=i)return!0;if(0<m){for(t in isFinite(m)&&m--,h){if("string"==typeof d[t]&&(h[t]=h[t]+parseFloat(d[t],10)),f){var o=h[t];h[t]=d[t],d[t]=o}u[t]=h[t]}return _=e+g,!0}null!==b&&b.call(c);for(var s=0,l=C.length;s<l;s++)C[s].start(e);return!1}},TWEEN.Easing={Linear:{None:function(e){return e}},Quadratic:{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:{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:{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:{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:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{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:{In:function(e){var t,i=.1;return 0===e?0:1===e?1:(t=!i||i<1?(i=1,.1):.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4))},Out:function(e){var t,i=.1;return 0===e?0:1===e?1:(t=!i||i<1?(i=1,.1):.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*e)*Math.sin((e-t)*(2*Math.PI)/.4)+1)},InOut:function(e){var t,i=.1;return 0===e?0:1===e?1:(t=!i||i<1?(i=1,.1):.4*Math.asin(1/i)/(2*Math.PI),(e*=2)<1?i*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(e){return e*e*(2.70158*e-1.70158)},Out:function(e){return--e*e*(2.70158*e+1.70158)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((1+t)*e-t)*.5:.5*((e-=2)*e*((1+t)*e+t)+2)}},Bounce:{In:function(e){return 1-TWEEN.Easing.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?.5*TWEEN.Easing.Bounce.In(2*e):.5*TWEEN.Easing.Bounce.Out(2*e-1)+.5}}},TWEEN.Interpolation={Linear:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=TWEEN.Interpolation.Utils.Linear;return t<0?a(e[0],e[1],r):1<t?a(e[i],e[i-1],i-r):a(e[n],e[i<n+1?i:n+1],r-n)},Bezier:function(e,t){var i,r=0,n=e.length-1,a=Math.pow,o=TWEEN.Interpolation.Utils.Bernstein;for(i=0;i<=n;i++)r+=a(1-t,n-i)*a(t,i)*e[i]*o(n,i);return r},CatmullRom:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=TWEEN.Interpolation.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(n=Math.floor(r=i*(1+t))),a(e[(n-1+i)%i],e[n],e[(n+1)%i],e[(n+2)%i],r-n)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):1<t?e[i]-(a(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):a(e[n?n-1:0],e[n],e[i<n+1?i:n+1],e[i<n+2?i:n+2],r-n)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(e,t){var i=TWEEN.Interpolation.Utils.Factorial;return i(e)/i(t)/i(e-t)},Factorial:(Xzb=[1],function(e){var t,i=1;if(Xzb[e])return Xzb[e];for(t=e;1<t;t--)i*=t;return Xzb[e]=i}),CatmullRom:function(e,t,i,r,n){var a=.5*(i-e),o=.5*(r-t),s=n*n;return(2*t-2*i+a+o)*(n*s)+(-3*t+3*i-2*a-o)*s+a*n+t}}};var EasingFunction={LINEAR_NONE:TWEEN.Easing.Linear.None,QUADRACTIC_IN:TWEEN.Easing.Quadratic.In,QUADRACTIC_OUT:TWEEN.Easing.Quadratic.Out,QUADRACTIC_IN_OUT:TWEEN.Easing.Quadratic.InOut,CUBIC_IN:TWEEN.Easing.Cubic.In,CUBIC_OUT:TWEEN.Easing.Cubic.Out,CUBIC_IN_OUT:TWEEN.Easing.Cubic.InOut,QUARTIC_IN:TWEEN.Easing.Quartic.In,QUARTIC_OUT:TWEEN.Easing.Quartic.Out,QUARTIC_IN_OUT:TWEEN.Easing.Quartic.InOut,QUINTIC_IN:TWEEN.Easing.Quintic.In,QUINTIC_OUT:TWEEN.Easing.Quintic.Out,QUINTIC_IN_OUT:TWEEN.Easing.Quintic.InOut,SINUSOIDAL_IN:TWEEN.Easing.Sinusoidal.In,SINUSOIDAL_OUT:TWEEN.Easing.Sinusoidal.Out,SINUSOIDAL_IN_OUT:TWEEN.Easing.Sinusoidal.InOut,EXPONENTIAL_IN:TWEEN.Easing.Exponential.In,EXPONENTIAL_OUT:TWEEN.Easing.Exponential.Out,EXPONENTIAL_IN_OUT:TWEEN.Easing.Exponential.InOut,CIRCULAR_IN:TWEEN.Easing.Circular.In,CIRCULAR_OUT:TWEEN.Easing.Circular.Out,CIRCULAR_IN_OUT:TWEEN.Easing.Circular.InOut,ELASTIC_IN:TWEEN.Easing.Elastic.In,ELASTIC_OUT:TWEEN.Easing.Elastic.Out,ELASTIC_IN_OUT:TWEEN.Easing.Elastic.InOut,BACK_IN:TWEEN.Easing.Back.In,BACK_OUT:TWEEN.Easing.Back.Out,BACK_IN_OUT:TWEEN.Easing.Back.InOut,BOUNCE_IN:TWEEN.Easing.Bounce.In,BOUNCE_OUT:TWEEN.Easing.Bounce.Out,BOUNCE_IN_OUT:TWEEN.Easing.Bounce.InOut},EasingFunction$1=freezeObject$1(EasingFunction),scratchPosition$2=new Cartesian3,scratchNormal$4=new Cartesian3,scratchTangent$2=new Cartesian3,scratchBitangent$2=new Cartesian3,scratchNormalST=new Cartesian3,defaultRadii=new Cartesian3(1,1,1),cos=Math.cos,sin=Math.sin;function EllipsoidGeometry(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radii,defaultRadii),i=defaultValue(e.innerRadii,t),r=defaultValue(e.minimumClock,0),n=defaultValue(e.maximumClock,CesiumMath.TWO_PI),a=defaultValue(e.minimumCone,0),o=defaultValue(e.maximumCone,CesiumMath.PI),s=Math.round(defaultValue(e.stackPartitions,64)),l=Math.round(defaultValue(e.slicePartitions,64)),c=defaultValue(e.vertexFormat,VertexFormat.DEFAULT);this._radii=Cartesian3.clone(t),this._innerRadii=Cartesian3.clone(i),this._minimumClock=r,this._maximumClock=n,this._minimumCone=a,this._maximumCone=o,this._stackPartitions=s,this._slicePartitions=l,this._vertexFormat=VertexFormat.clone(c),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}EllipsoidGeometry.packedLength=2*Cartesian3.packedLength+VertexFormat.packedLength+7,EllipsoidGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._radii,t,i),i+=Cartesian3.packedLength,Cartesian3.pack(e._innerRadii,t,i),i+=Cartesian3.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._minimumClock,t[i++]=e._maximumClock,t[i++]=e._minimumCone,t[i++]=e._maximumCone,t[i++]=e._stackPartitions,t[i++]=e._slicePartitions,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRadii=new Cartesian3,scratchInnerRadii=new Cartesian3,scratchVertexFormat$5=new VertexFormat,scratchOptions$c={radii:scratchRadii,innerRadii:scratchInnerRadii,vertexFormat:scratchVertexFormat$5,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0},unitEllipsoidGeometry;EllipsoidGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchRadii);t+=Cartesian3.packedLength;var n=Cartesian3.unpack(e,t,scratchInnerRadii);t+=Cartesian3.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$5);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._radii=Cartesian3.clone(r,i._radii),i._innerRadii=Cartesian3.clone(n,i._innerRadii),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._minimumClock=o,i._maximumClock=s,i._minimumCone=l,i._maximumCone=c,i._stackPartitions=u,i._slicePartitions=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$c.minimumClock=o,scratchOptions$c.maximumClock=s,scratchOptions$c.minimumCone=l,scratchOptions$c.maximumCone=c,scratchOptions$c.stackPartitions=u,scratchOptions$c.slicePartitions=d,scratchOptions$c.offsetAttribute=-1===h?void 0:h,new EllipsoidGeometry(scratchOptions$c))},EllipsoidGeometry.createGeometry=function(e){var t=e._radii;if(!(t.x<=0||t.y<=0||t.z<=0)){var i=e._innerRadii;if(!(i.x<=0||i.y<=0||i.z<=0)){var r,n,a=e._minimumClock,o=e._maximumClock,s=e._minimumCone,l=e._maximumCone,c=e._vertexFormat,u=e._slicePartitions+1,d=e._stackPartitions+1;(u=Math.round(u*Math.abs(o-a)/CesiumMath.TWO_PI))<2&&(u=2),(d=Math.round(d*Math.abs(l-s)/CesiumMath.PI))<2&&(d=2);var h=0,p=[s],m=[a];for(r=0;r<d;r++)p.push(s+r*(l-s)/(d-1));for(p.push(l),n=0;n<u;n++)m.push(a+n*(o-a)/(u-1));m.push(o);var f=p.length,g=m.length,_=0,y=1,v=i.x!==t.x||i.y!==t.y||i.z!==t.z,C=!1,S=!1,x=!1;v&&(y=2,0<s&&(C=!0,_+=u-1),l<Math.PI&&(S=!0,_+=u-1),(o-a)%CesiumMath.TWO_PI?(x=!0,_+=2*(d-1)+1):_+=1);var T=g*f*y,b=new Float64Array(3*T),E=arrayFill(new Array(T),!1),P=arrayFill(new Array(T),!1),A=u*d*y,w=6*(A+_+1-(u+d)*y),D=IndexDatatype$1.createTypedArray(A,w),M=c.normal?new Float32Array(3*T):void 0,I=c.tangent?new Float32Array(3*T):void 0,R=c.bitangent?new Float32Array(3*T):void 0,O=c.st?new Float32Array(2*T):void 0,L=new Array(f),F=new Array(f);for(r=0;r<f;r++)L[r]=sin(p[r]),F[r]=cos(p[r]);var N=new Array(g),B=new Array(g);for(n=0;n<g;n++)B[n]=cos(m[n]),N[n]=sin(m[n]);for(r=0;r<f;r++)for(n=0;n<g;n++)b[h++]=t.x*L[r]*B[n],b[h++]=t.y*L[r]*N[n],b[h++]=t.z*F[r];var V,k,$,z,U=T/2;if(v)for(r=0;r<f;r++)for(n=0;n<g;n++)b[h++]=i.x*L[r]*B[n],b[h++]=i.y*L[r]*N[n],b[h++]=i.z*F[r],E[U]=!0,0<r&&r!==f-1&&0!==n&&n!==g-1&&(P[U]=!0),U++;for(h=0,r=1;r<f-2;r++)for(V=r*g,k=(r+1)*g,n=1;n<g-2;n++)D[h++]=k+n,D[h++]=k+n+1,D[h++]=V+n+1,D[h++]=k+n,D[h++]=V+n+1,D[h++]=V+n;if(v){var G=f*g;for(r=1;r<f-2;r++)for(V=G+r*g,k=G+(r+1)*g,n=1;n<g-2;n++)D[h++]=k+n,D[h++]=V+n,D[h++]=V+n+1,D[h++]=k+n,D[h++]=V+n+1,D[h++]=k+n+1}if(v){if(C)for(z=f*g,r=1;r<g-2;r++)D[h++]=r,D[h++]=r+1,D[h++]=z+r+1,D[h++]=r,D[h++]=z+r+1,D[h++]=z+r;if(S)for($=f*g-g,z=f*g*y-g,r=1;r<g-2;r++)D[h++]=$+r+1,D[h++]=$+r,D[h++]=z+r,D[h++]=$+r+1,D[h++]=z+r,D[h++]=z+r+1}if(x){for(r=1;r<f-2;r++)z=g*f+g*r,$=g*r,D[h++]=z,D[h++]=$+g,D[h++]=$,D[h++]=z,D[h++]=z+g,D[h++]=$+g;for(r=1;r<f-2;r++)z=g*f+g*(r+1)-1,$=g*(r+1)-1,D[h++]=$+g,D[h++]=z,D[h++]=$,D[h++]=$+g,D[h++]=z+g,D[h++]=z}var H=new GeometryAttributes;c.position&&(H.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:b}));var W,q=0,j=0,Y=0,X=0,Q=T/2,J=Ellipsoid.fromCartesian3(t),Z=Ellipsoid.fromCartesian3(i);if(c.st||c.normal||c.tangent||c.bitangent){for(r=0;r<T;r++){W=E[r]?Z:J;var K=Cartesian3.fromArray(b,3*r,scratchPosition$2),ee=W.geodeticSurfaceNormal(K,scratchNormal$4);if(P[r]&&Cartesian3.negate(ee,ee),c.st){var te=Cartesian2.negate(ee,scratchNormalST);O[q++]=Math.atan2(te.y,te.x)/CesiumMath.TWO_PI+.5,O[q++]=Math.asin(ee.z)/Math.PI+.5}if(c.normal&&(M[j++]=ee.x,M[j++]=ee.y,M[j++]=ee.z),c.tangent||c.bitangent){var ie,re=scratchTangent$2,ne=0;if(E[r]&&(ne=Q),ie=!C&&ne<=r&&r<ne+2*g?Cartesian3.UNIT_X:Cartesian3.UNIT_Z,Cartesian3.cross(ie,ee,re),Cartesian3.normalize(re,re),c.tangent&&(I[Y++]=re.x,I[Y++]=re.y,I[Y++]=re.z),c.bitangent){var ae=Cartesian3.cross(ee,re,scratchBitangent$2);Cartesian3.normalize(ae,ae),R[X++]=ae.x,R[X++]=ae.y,R[X++]=ae.z}}}c.st&&(H.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:O})),c.normal&&(H.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:M})),c.tangent&&(H.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:I})),c.bitangent&&(H.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:R}))}if(defined(e._offsetAttribute)){var oe=b.length,se=new Uint8Array(oe/3);arrayFill(se,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),H.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:se})}return new Geometry({attributes:H,indices:D,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromEllipsoid(J),offsetAttribute:e._offsetAttribute})}}},EllipsoidGeometry.getUnitEllipsoid=function(){return defined(unitEllipsoidGeometry)||(unitEllipsoidGeometry=EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(1,1,1),vertexFormat:VertexFormat.POSITION_ONLY}))),unitEllipsoidGeometry};var defaultRadii$1=new Cartesian3(1,1,1),cos$1=Math.cos,sin$1=Math.sin;function EllipsoidOutlineGeometry(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).radii,defaultRadii$1),i=defaultValue(e.innerRadii,t),r=defaultValue(e.minimumClock,0),n=defaultValue(e.maximumClock,CesiumMath.TWO_PI),a=defaultValue(e.minimumCone,0),o=defaultValue(e.maximumCone,CesiumMath.PI),s=Math.round(defaultValue(e.stackPartitions,10)),l=Math.round(defaultValue(e.slicePartitions,8)),c=Math.round(defaultValue(e.subdivisions,128));this._radii=Cartesian3.clone(t),this._innerRadii=Cartesian3.clone(i),this._minimumClock=r,this._maximumClock=n,this._minimumCone=a,this._maximumCone=o,this._stackPartitions=s,this._slicePartitions=l,this._subdivisions=c,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}EllipsoidOutlineGeometry.packedLength=2*Cartesian3.packedLength+8,EllipsoidOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Cartesian3.pack(e._radii,t,i),i+=Cartesian3.packedLength,Cartesian3.pack(e._innerRadii,t,i),i+=Cartesian3.packedLength,t[i++]=e._minimumClock,t[i++]=e._maximumClock,t[i++]=e._minimumCone,t[i++]=e._maximumCone,t[i++]=e._stackPartitions,t[i++]=e._slicePartitions,t[i++]=e._subdivisions,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRadii$1=new Cartesian3,scratchInnerRadii$1=new Cartesian3,scratchOptions$d={radii:scratchRadii$1,innerRadii:scratchInnerRadii$1,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};function EllipsoidTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,defined(this._tilingScheme)||(this._tilingScheme=new GeographicTilingScheme({ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84)})),this._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Event,this._readyPromise=when.resolve(!0)}function EventHelper(){this._removalFunctions=[]}EllipsoidOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Cartesian3.unpack(e,t,scratchRadii$1);t+=Cartesian3.packedLength;var n=Cartesian3.unpack(e,t,scratchInnerRadii$1);t+=Cartesian3.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)?(i._radii=Cartesian3.clone(r,i._radii),i._innerRadii=Cartesian3.clone(n,i._innerRadii),i._minimumClock=a,i._maximumClock=o,i._minimumCone=s,i._maximumCone=l,i._stackPartitions=c,i._slicePartitions=u,i._subdivisions=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$d.minimumClock=a,scratchOptions$d.maximumClock=o,scratchOptions$d.minimumCone=s,scratchOptions$d.maximumCone=l,scratchOptions$d.stackPartitions=c,scratchOptions$d.slicePartitions=u,scratchOptions$d.subdivisions=d,scratchOptions$d.offsetAttribute=-1===h?void 0:h,new EllipsoidOutlineGeometry(scratchOptions$d))},EllipsoidOutlineGeometry.createGeometry=function(e){var t=e._radii;if(!(t.x<=0||t.y<=0||t.z<=0)){var i=e._innerRadii;if(!(i.x<=0||i.y<=0||i.z<=0)){var r=e._minimumClock,n=e._maximumClock,a=e._minimumCone,o=e._maximumCone,s=e._subdivisions,l=Ellipsoid.fromCartesian3(t),c=e._slicePartitions+1,u=e._stackPartitions+1;(c=Math.round(c*Math.abs(n-r)/CesiumMath.TWO_PI))<2&&(c=2),(u=Math.round(u*Math.abs(o-a)/CesiumMath.PI))<2&&(u=2);var d=0,h=1,p=i.x!==t.x||i.y!==t.y||i.z!==t.z,m=!1,f=!1;p&&(h=2,0<a&&(m=!0,d+=c),o<Math.PI&&(f=!0,d+=c));var g,_,y,v,C=s*h*(u+c),S=new Float64Array(3*C),x=2*(C+d-(c+u)*h),T=IndexDatatype$1.createTypedArray(C,x),b=0,E=new Array(u),P=new Array(u);for(g=0;g<u;g++)v=a+g*(o-a)/(u-1),E[g]=sin$1(v),P[g]=cos$1(v);var A=new Array(s),w=new Array(s);for(g=0;g<s;g++)y=r+g*(n-r)/(s-1),A[g]=sin$1(y),w[g]=cos$1(y);for(g=0;g<u;g++)for(_=0;_<s;_++)S[b++]=t.x*E[g]*w[_],S[b++]=t.y*E[g]*A[_],S[b++]=t.z*P[g];if(p)for(g=0;g<u;g++)for(_=0;_<s;_++)S[b++]=i.x*E[g]*w[_],S[b++]=i.y*E[g]*A[_],S[b++]=i.z*P[g];for(E.length=s,P.length=s,g=0;g<s;g++)v=a+g*(o-a)/(s-1),E[g]=sin$1(v),P[g]=cos$1(v);for(A.length=c,w.length=c,g=0;g<c;g++)y=r+g*(n-r)/(c-1),A[g]=sin$1(y),w[g]=cos$1(y);for(g=0;g<s;g++)for(_=0;_<c;_++)S[b++]=t.x*E[g]*w[_],S[b++]=t.y*E[g]*A[_],S[b++]=t.z*P[g];if(p)for(g=0;g<s;g++)for(_=0;_<c;_++)S[b++]=i.x*E[g]*w[_],S[b++]=i.y*E[g]*A[_],S[b++]=i.z*P[g];for(g=b=0;g<u*h;g++){var D=g*s;for(_=0;_<s-1;_++)T[b++]=D+_,T[b++]=D+_+1}var M=u*s*h;for(g=0;g<c;g++)for(_=0;_<s-1;_++)T[b++]=M+g+_*c,T[b++]=M+g+(_+1)*c;if(p)for(M=u*s*h+c*s,g=0;g<c;g++)for(_=0;_<s-1;_++)T[b++]=M+g+_*c,T[b++]=M+g+(_+1)*c;if(p){var I=u*s*h,R=I+s*c;if(m)for(g=0;g<c;g++)T[b++]=I+g,T[b++]=R+g;if(f)for(I+=s*c-c,R+=s*c-c,g=0;g<c;g++)T[b++]=I+g,T[b++]=R+g}var O=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:S})});if(defined(e._offsetAttribute)){var L=S.length,F=new Uint8Array(L/3);arrayFill(F,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),O.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:F})}return new Geometry({attributes:O,indices:T,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromEllipsoid(l),offsetAttribute:e._offsetAttribute})}}},defineProperties$1(EllipsoidTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}}}),EllipsoidTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){return when.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}))},EllipsoidTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},EllipsoidTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){},EllipsoidTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){},EventHelper.prototype.add=function(e,t,i){var r=e.addEventListener(t,i);this._removalFunctions.push(r);var n=this;return function(){r();var e=n._removalFunctions;e.splice(e.indexOf(r),1)}},EventHelper.prototype.removeAll=function(){for(var e=this._removalFunctions,t=0,i=e.length;t<i;++t)e[t]();e.length=0};var ExtrapolationType={NONE:0,HOLD:1,EXTRAPOLATE:2},ExtrapolationType$1=freezeObject$1(ExtrapolationType);function OrthographicOffCenterFrustum(e){e=defaultValue(e,defaultValue.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=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new CullingVolume,this._orthographicMatrix=new Matrix4}function update(e){e.top===e._top&&e.bottom===e._bottom&&e.left===e._left&&e.right===e._right&&e.near===e._near&&e.far===e._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=Matrix4.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}defineProperties$1(OrthographicOffCenterFrustum.prototype,{projectionMatrix:{get:function(){return update(this),this._orthographicMatrix}}});var getPlanesRight=new Cartesian3,getPlanesNearCenter=new Cartesian3,getPlanesPoint=new Cartesian3,negateScratch=new Cartesian3;function OrthographicFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new OrthographicOffCenterFrustum,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far}function update$1(e){var t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;var i=1/e.aspectRatio;t.right=.5*e.width,t.left=-t.right,t.top=i*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}function PerspectiveOffCenterFrustum(e){e=defaultValue(e,defaultValue.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=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new CullingVolume,this._perspectiveMatrix=new Matrix4,this._infinitePerspective=new Matrix4}function update$2(e){var t=e.top,i=e.bottom,r=e.right,n=e.left,a=e.near,o=e.far;t===e._top&&i===e._bottom&&n===e._left&&r===e._right&&a===e._near&&o===e._far||(e._left=n,e._right=r,e._top=t,e._bottom=i,e._near=a,e._far=o,e._perspectiveMatrix=Matrix4.computePerspectiveOffCenter(n,r,i,t,a,o,e._perspectiveMatrix),e._infinitePerspective=Matrix4.computeInfinitePerspectiveOffCenter(n,r,i,t,a,e._infinitePerspective))}OrthographicOffCenterFrustum.prototype.computeCullingVolume=function(e,t,i){var r=this._cullingVolume.planes,n=this.top,a=this.bottom,o=this.right,s=this.left,l=this.near,c=this.far,u=Cartesian3.cross(t,i,getPlanesRight);Cartesian3.normalize(u,u);var d=getPlanesNearCenter;Cartesian3.multiplyByScalar(t,l,d),Cartesian3.add(e,d,d);var h=getPlanesPoint;Cartesian3.multiplyByScalar(u,s,h),Cartesian3.add(d,h,h);var p=r[0];return defined(p)||(p=r[0]=new Cartesian4),p.x=u.x,p.y=u.y,p.z=u.z,p.w=-Cartesian3.dot(u,h),Cartesian3.multiplyByScalar(u,o,h),Cartesian3.add(d,h,h),defined(p=r[1])||(p=r[1]=new Cartesian4),p.x=-u.x,p.y=-u.y,p.z=-u.z,p.w=-Cartesian3.dot(Cartesian3.negate(u,negateScratch),h),Cartesian3.multiplyByScalar(i,a,h),Cartesian3.add(d,h,h),defined(p=r[2])||(p=r[2]=new Cartesian4),p.x=i.x,p.y=i.y,p.z=i.z,p.w=-Cartesian3.dot(i,h),Cartesian3.multiplyByScalar(i,n,h),Cartesian3.add(d,h,h),defined(p=r[3])||(p=r[3]=new Cartesian4),p.x=-i.x,p.y=-i.y,p.z=-i.z,p.w=-Cartesian3.dot(Cartesian3.negate(i,negateScratch),h),defined(p=r[4])||(p=r[4]=new Cartesian4),p.x=t.x,p.y=t.y,p.z=t.z,p.w=-Cartesian3.dot(t,d),Cartesian3.multiplyByScalar(t,c,h),Cartesian3.add(e,h,h),defined(p=r[5])||(p=r[5]=new Cartesian4),p.x=-t.x,p.y=-t.y,p.z=-t.z,p.w=-Cartesian3.dot(Cartesian3.negate(t,negateScratch),h),this._cullingVolume},OrthographicOffCenterFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){update(this),r instanceof Cartesian2&&(n=r,r=1,deprecationWarning("getPixelDimensions-parameter-change","getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65."));var a=r*(this.right-this.left)/e,o=r*(this.top-this.bottom)/t;return n.x=a,n.y=o,n},OrthographicOffCenterFrustum.prototype.clone=function(e){return defined(e)||(e=new OrthographicOffCenterFrustum),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},OrthographicOffCenterFrustum.prototype.equals=function(e){return defined(e)&&e instanceof OrthographicOffCenterFrustum&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},OrthographicOffCenterFrustum.prototype.equalsEpsilon=function(e,t,i){return e===this||defined(e)&&e instanceof OrthographicOffCenterFrustum&&CesiumMath.equalsEpsilon(this.right,e.right,t,i)&&CesiumMath.equalsEpsilon(this.left,e.left,t,i)&&CesiumMath.equalsEpsilon(this.top,e.top,t,i)&&CesiumMath.equalsEpsilon(this.bottom,e.bottom,t,i)&&CesiumMath.equalsEpsilon(this.near,e.near,t,i)&&CesiumMath.equalsEpsilon(this.far,e.far,t,i)},OrthographicFrustum.packedLength=4,OrthographicFrustum.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.width,t[i++]=e.aspectRatio,t[i++]=e.near,t[i]=e.far,t},OrthographicFrustum.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new OrthographicFrustum),i.width=e[t++],i.aspectRatio=e[t++],i.near=e[t++],i.far=e[t],i},defineProperties$1(OrthographicFrustum.prototype,{projectionMatrix:{get:function(){return update$1(this),this._offCenterFrustum.projectionMatrix}}}),OrthographicFrustum.prototype.computeCullingVolume=function(e,t,i){return update$1(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},OrthographicFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){return update$1(this),r instanceof Cartesian2&&(n=r,r=1,deprecationWarning("getPixelDimensions-parameter-change","getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65.")),this._offCenterFrustum.getPixelDimensions(e,t,i,r,n)},OrthographicFrustum.prototype.clone=function(e){return defined(e)||(e=new OrthographicFrustum),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},OrthographicFrustum.prototype.equals=function(e){return!!(defined(e)&&e instanceof OrthographicFrustum)&&(update$1(this),update$1(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},OrthographicFrustum.prototype.equalsEpsilon=function(e,t,i){return!!(defined(e)&&e instanceof OrthographicFrustum)&&(update$1(this),update$1(e),CesiumMath.equalsEpsilon(this.width,e.width,t,i)&&CesiumMath.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,i)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,i))},defineProperties$1(PerspectiveOffCenterFrustum.prototype,{projectionMatrix:{get:function(){return update$2(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return update$2(this),this._infinitePerspective}}});var getPlanesRight$1=new Cartesian3,getPlanesNearCenter$1=new Cartesian3,getPlanesFarCenter=new Cartesian3,getPlanesNormal=new Cartesian3;function PerspectiveFrustum(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new PerspectiveOffCenterFrustum,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=defaultValue(e.near,1),this._near=this.near,this.far=defaultValue(e.far,5e8),this._far=this.far,this.xOffset=defaultValue(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=defaultValue(e.yOffset,0),this._yOffset=this.yOffset}function update$3(e){var t=e._offCenterFrustum;e.fov===e._fov&&e.aspectRatio===e._aspectRatio&&e.near===e._near&&e.far===e._far&&e.xOffset===e._xOffset&&e.yOffset===e._yOffset||(e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),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)}PerspectiveOffCenterFrustum.prototype.computeCullingVolume=function(e,t,i){var r=this._cullingVolume.planes,n=this.top,a=this.bottom,o=this.right,s=this.left,l=this.near,c=this.far,u=Cartesian3.cross(t,i,getPlanesRight$1),d=getPlanesNearCenter$1;Cartesian3.multiplyByScalar(t,l,d),Cartesian3.add(e,d,d);var h=getPlanesFarCenter;Cartesian3.multiplyByScalar(t,c,h),Cartesian3.add(e,h,h);var p=getPlanesNormal;Cartesian3.multiplyByScalar(u,s,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.normalize(p,p),Cartesian3.cross(p,i,p),Cartesian3.normalize(p,p);var m=r[0];return defined(m)||(m=r[0]=new Cartesian4),m.x=p.x,m.y=p.y,m.z=p.z,m.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(u,o,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(i,p,p),Cartesian3.normalize(p,p),defined(m=r[1])||(m=r[1]=new Cartesian4),m.x=p.x,m.y=p.y,m.z=p.z,m.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(i,a,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(u,p,p),Cartesian3.normalize(p,p),defined(m=r[2])||(m=r[2]=new Cartesian4),m.x=p.x,m.y=p.y,m.z=p.z,m.w=-Cartesian3.dot(p,e),Cartesian3.multiplyByScalar(i,n,p),Cartesian3.add(d,p,p),Cartesian3.subtract(p,e,p),Cartesian3.cross(p,u,p),Cartesian3.normalize(p,p),defined(m=r[3])||(m=r[3]=new Cartesian4),m.x=p.x,m.y=p.y,m.z=p.z,m.w=-Cartesian3.dot(p,e),defined(m=r[4])||(m=r[4]=new Cartesian4),m.x=t.x,m.y=t.y,m.z=t.z,m.w=-Cartesian3.dot(t,d),Cartesian3.negate(t,p),defined(m=r[5])||(m=r[5]=new Cartesian4),m.x=p.x,m.y=p.y,m.z=p.z,m.w=-Cartesian3.dot(p,h),this._cullingVolume},PerspectiveOffCenterFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){update$2(this),r instanceof Cartesian2&&(n=r,r=1,deprecationWarning("getPixelDimensions-parameter-change","getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65."));var a=1/this.near,o=this.top*a,s=2*r*i*o/t,l=2*r*i*(o=this.right*a)/e;return n.x=l,n.y=s,n},PerspectiveOffCenterFrustum.prototype.clone=function(e){return defined(e)||(e=new PerspectiveOffCenterFrustum),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},PerspectiveOffCenterFrustum.prototype.equals=function(e){return defined(e)&&e instanceof PerspectiveOffCenterFrustum&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},PerspectiveOffCenterFrustum.prototype.equalsEpsilon=function(e,t,i){return e===this||defined(e)&&e instanceof PerspectiveOffCenterFrustum&&CesiumMath.equalsEpsilon(this.right,e.right,t,i)&&CesiumMath.equalsEpsilon(this.left,e.left,t,i)&&CesiumMath.equalsEpsilon(this.top,e.top,t,i)&&CesiumMath.equalsEpsilon(this.bottom,e.bottom,t,i)&&CesiumMath.equalsEpsilon(this.near,e.near,t,i)&&CesiumMath.equalsEpsilon(this.far,e.far,t,i)},PerspectiveFrustum.packedLength=6,PerspectiveFrustum.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.fov,t[i++]=e.aspectRatio,t[i++]=e.near,t[i++]=e.far,t[i++]=e.xOffset,t[i]=e.yOffset,t},PerspectiveFrustum.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new PerspectiveFrustum),i.fov=e[t++],i.aspectRatio=e[t++],i.near=e[t++],i.far=e[t++],i.xOffset=e[t++],i.yOffset=e[t],i},defineProperties$1(PerspectiveFrustum.prototype,{projectionMatrix:{get:function(){return update$3(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return update$3(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return update$3(this),this._fovy}},sseDenominator:{get:function(){return update$3(this),this._sseDenominator}}}),PerspectiveFrustum.prototype.computeCullingVolume=function(e,t,i){return update$3(this),this._offCenterFrustum.computeCullingVolume(e,t,i)},PerspectiveFrustum.prototype.getPixelDimensions=function(e,t,i,r,n){return update$3(this),r instanceof Cartesian2&&(n=r,r=1,deprecationWarning("getPixelDimensions-parameter-change","getPixelDimensions now takes a pixelRatio argument before the result argument in Cesium 1.63. The previous function definition will no longer work in 1.65.")),this._offCenterFrustum.getPixelDimensions(e,t,i,r,n)},PerspectiveFrustum.prototype.clone=function(e){return defined(e)||(e=new PerspectiveFrustum),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},PerspectiveFrustum.prototype.equals=function(e){return!!(defined(e)&&e instanceof PerspectiveFrustum)&&(update$3(this),update$3(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},PerspectiveFrustum.prototype.equalsEpsilon=function(e,t,i){return!!(defined(e)&&e instanceof PerspectiveFrustum)&&(update$3(this),update$3(e),CesiumMath.equalsEpsilon(this.fov,e.fov,t,i)&&CesiumMath.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,i)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,i))};var PERSPECTIVE=0,ORTHOGRAPHIC=1;function FrustumGeometry(e){var t,i,r=e.frustum,n=e.orientation,a=e.origin,o=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),s=defaultValue(e._drawNearPlane,!0);r instanceof PerspectiveFrustum?(t=PERSPECTIVE,i=PerspectiveFrustum.packedLength):r instanceof OrthographicFrustum&&(t=ORTHOGRAPHIC,i=OrthographicFrustum.packedLength),this._frustumType=t,this._frustum=r.clone(),this._origin=Cartesian3.clone(a),this._orientation=Quaternion.clone(n),this._drawNearPlane=s,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+i+Cartesian3.packedLength+Quaternion.packedLength+VertexFormat.packedLength}FrustumGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._frustumType,n=e._frustum;return(t[i++]=r)===PERSPECTIVE?(PerspectiveFrustum.pack(n,t,i),i+=PerspectiveFrustum.packedLength):(OrthographicFrustum.pack(n,t,i),i+=OrthographicFrustum.packedLength),Cartesian3.pack(e._origin,t,i),i+=Cartesian3.packedLength,Quaternion.pack(e._orientation,t,i),i+=Quaternion.packedLength,VertexFormat.pack(e._vertexFormat,t,i),t[i+=VertexFormat.packedLength]=e._drawNearPlane?1:0,t};var scratchPackPerspective=new PerspectiveFrustum,scratchPackOrthographic=new OrthographicFrustum,scratchPackQuaternion=new Quaternion,scratchPackorigin=new Cartesian3,scratchVertexFormat$6=new VertexFormat;function getAttributes(e,t,i,r,n,a,o,s){for(var l=e/3*2,c=0;c<4;++c)defined(t)&&(t[e]=a.x,t[e+1]=a.y,t[e+2]=a.z),defined(i)&&(i[e]=o.x,i[e+1]=o.y,i[e+2]=o.z),defined(r)&&(r[e]=s.x,r[e+1]=s.y,r[e+2]=s.z),e+=3;n[l]=0,n[1+l]=0,n[2+l]=1,n[3+l]=0,n[4+l]=1,n[5+l]=1,n[6+l]=0,n[7+l]=1}FrustumGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r,n=e[t++];n===PERSPECTIVE?(r=PerspectiveFrustum.unpack(e,t,scratchPackPerspective),t+=PerspectiveFrustum.packedLength):(r=OrthographicFrustum.unpack(e,t,scratchPackOrthographic),t+=OrthographicFrustum.packedLength);var a=Cartesian3.unpack(e,t,scratchPackorigin);t+=Cartesian3.packedLength;var o=Quaternion.unpack(e,t,scratchPackQuaternion);t+=Quaternion.packedLength;var s=VertexFormat.unpack(e,t,scratchVertexFormat$6),l=1===e[t+=VertexFormat.packedLength];if(!defined(i))return new FrustumGeometry({frustum:r,origin:a,orientation:o,vertexFormat:s,_drawNearPlane:l});var c=n===i._frustumType?i._frustum:void 0;return i._frustum=r.clone(c),i._frustumType=n,i._origin=Cartesian3.clone(a,i._origin),i._orientation=Quaternion.clone(o,i._orientation),i._vertexFormat=VertexFormat.clone(s,i._vertexFormat),i._drawNearPlane=l,i};var scratchRotationMatrix=new Matrix3,scratchViewMatrix=new Matrix4,scratchInverseMatrix=new Matrix4,scratchXDirection=new Cartesian3,scratchYDirection=new Cartesian3,scratchZDirection=new Cartesian3,scratchNegativeX=new Cartesian3,scratchNegativeY=new Cartesian3,scratchNegativeZ=new Cartesian3,frustumSplits=new Array(3),frustumCornersNDC=new Array(4);frustumCornersNDC[0]=new Cartesian4(-1,-1,1,1),frustumCornersNDC[1]=new Cartesian4(1,-1,1,1),frustumCornersNDC[2]=new Cartesian4(1,1,1,1),frustumCornersNDC[3]=new Cartesian4(-1,1,1,1);for(var scratchFrustumCorners=new Array(4),i$1=0;i$1<4;++i$1)scratchFrustumCorners[i$1]=new Cartesian4;FrustumGeometry._computeNearFarPlanes=function(e,t,i,r,n,a,o,s){var l=Matrix3.fromQuaternion(t,scratchRotationMatrix),c=defaultValue(a,scratchXDirection),u=defaultValue(o,scratchYDirection),d=defaultValue(s,scratchZDirection);c=Matrix3.getColumn(l,0,c),u=Matrix3.getColumn(l,1,u),d=Matrix3.getColumn(l,2,d),Cartesian3.normalize(c,c),Cartesian3.normalize(u,u),Cartesian3.normalize(d,d),Cartesian3.negate(c,c);var h,p,m=Matrix4.computeView(e,d,u,c,scratchViewMatrix);if(i===PERSPECTIVE){var f=r.projectionMatrix,g=Matrix4.multiply(f,m,scratchInverseMatrix);p=Matrix4.inverse(g,scratchInverseMatrix)}else h=Matrix4.inverseTransformation(m,scratchInverseMatrix);defined(p)?(frustumSplits[0]=r.near,frustumSplits[1]=r.far):(frustumSplits[0]=0,frustumSplits[1]=r.near,frustumSplits[2]=r.far);for(var _=0;_<2;++_)for(var y=0;y<4;++y){var v=Cartesian4.clone(frustumCornersNDC[y],scratchFrustumCorners[y]);if(defined(p)){var C=1/(v=Matrix4.multiplyByVector(p,v,v)).w;Cartesian3.multiplyByScalar(v,C,v),Cartesian3.subtract(v,e,v),Cartesian3.normalize(v,v);var S=Cartesian3.dot(d,v);Cartesian3.multiplyByScalar(v,frustumSplits[_]/S,v),Cartesian3.add(v,e,v)}else{defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);var x=frustumSplits[_],T=frustumSplits[_+1];v.x=.5*(v.x*(r.right-r.left)+r.left+r.right),v.y=.5*(v.y*(r.top-r.bottom)+r.bottom+r.top),v.z=.5*(v.z*(x-T)-x-T),v.w=1,Matrix4.multiplyByVector(h,v,v)}n[12*_+3*y]=v.x,n[12*_+3*y+1]=v.y,n[12*_+3*y+2]=v.z}},FrustumGeometry.createGeometry=function(e){var t=e._frustumType,i=e._frustum,r=e._origin,n=e._orientation,a=e._drawNearPlane,o=e._vertexFormat,s=a?6:5,l=new Float64Array(72);FrustumGeometry._computeNearFarPlanes(r,n,t,i,l);var c=24;l[c]=l[12],l[c+1]=l[13],l[c+2]=l[14],l[c+3]=l[0],l[c+4]=l[1],l[c+5]=l[2],l[c+6]=l[9],l[c+7]=l[10],l[c+8]=l[11],l[c+9]=l[21],l[c+10]=l[22],l[c+11]=l[23],l[c+=12]=l[15],l[c+1]=l[16],l[c+2]=l[17],l[c+3]=l[3],l[c+4]=l[4],l[c+5]=l[5],l[c+6]=l[0],l[c+7]=l[1],l[c+8]=l[2],l[c+9]=l[12],l[c+10]=l[13],l[c+11]=l[14],l[c+=12]=l[3],l[c+1]=l[4],l[c+2]=l[5],l[c+3]=l[15],l[c+4]=l[16],l[c+5]=l[17],l[c+6]=l[18],l[c+7]=l[19],l[c+8]=l[20],l[c+9]=l[6],l[c+10]=l[7],l[c+11]=l[8],l[c+=12]=l[6],l[c+1]=l[7],l[c+2]=l[8],l[c+3]=l[18],l[c+4]=l[19],l[c+5]=l[20],l[c+6]=l[21],l[c+7]=l[22],l[c+8]=l[23],l[c+9]=l[9],l[c+10]=l[10],l[c+11]=l[11],a||(l=l.subarray(12));var u=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:l})});if(defined(o.normal)||defined(o.tangent)||defined(o.bitangent)||defined(o.st)){var d=defined(o.normal)?new Float32Array(12*s):void 0,h=defined(o.tangent)?new Float32Array(12*s):void 0,p=defined(o.bitangent)?new Float32Array(12*s):void 0,m=defined(o.st)?new Float32Array(8*s):void 0,f=scratchXDirection,g=scratchYDirection,_=scratchZDirection,y=Cartesian3.negate(f,scratchNegativeX),v=Cartesian3.negate(g,scratchNegativeY),C=Cartesian3.negate(_,scratchNegativeZ);c=0,a&&(getAttributes(c,d,h,p,m,C,f,g),c+=12),getAttributes(c,d,h,p,m,_,y,g),getAttributes(c+=12,d,h,p,m,y,C,g),getAttributes(c+=12,d,h,p,m,v,C,y),getAttributes(c+=12,d,h,p,m,f,_,g),getAttributes(c+=12,d,h,p,m,g,_,y),defined(d)&&(u.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:d})),defined(h)&&(u.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:h})),defined(p)&&(u.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:p})),defined(m)&&(u.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:m}))}for(var S=new Uint16Array(6*s),x=0;x<s;++x){var T=6*x,b=4*x;S[T]=b,S[1+T]=1+b,S[2+T]=2+b,S[3+T]=b,S[4+T]=2+b,S[5+T]=3+b}return new Geometry({attributes:u,indices:S,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromVertices(l)})};var PERSPECTIVE$1=0,ORTHOGRAPHIC$1=1;function FrustumOutlineGeometry(e){var t,i,r=e.frustum,n=e.orientation,a=e.origin,o=defaultValue(e._drawNearPlane,!0);r instanceof PerspectiveFrustum?(t=PERSPECTIVE$1,i=PerspectiveFrustum.packedLength):r instanceof OrthographicFrustum&&(t=ORTHOGRAPHIC$1,i=OrthographicFrustum.packedLength),this._frustumType=t,this._frustum=r.clone(),this._origin=Cartesian3.clone(a),this._orientation=Quaternion.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+i+Cartesian3.packedLength+Quaternion.packedLength}FrustumOutlineGeometry.pack=function(e,t,i){i=defaultValue(i,0);var r=e._frustumType,n=e._frustum;return(t[i++]=r)===PERSPECTIVE$1?(PerspectiveFrustum.pack(n,t,i),i+=PerspectiveFrustum.packedLength):(OrthographicFrustum.pack(n,t,i),i+=OrthographicFrustum.packedLength),Cartesian3.pack(e._origin,t,i),i+=Cartesian3.packedLength,Quaternion.pack(e._orientation,t,i),t[i+=Quaternion.packedLength]=e._drawNearPlane?1:0,t};var scratchPackPerspective$1=new PerspectiveFrustum,scratchPackOrthographic$1=new OrthographicFrustum,scratchPackQuaternion$1=new Quaternion,scratchPackorigin$1=new Cartesian3;function GeocoderService(){}FrustumOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r,n=e[t++];n===PERSPECTIVE$1?(r=PerspectiveFrustum.unpack(e,t,scratchPackPerspective$1),t+=PerspectiveFrustum.packedLength):(r=OrthographicFrustum.unpack(e,t,scratchPackOrthographic$1),t+=OrthographicFrustum.packedLength);var a=Cartesian3.unpack(e,t,scratchPackorigin$1);t+=Cartesian3.packedLength;var o=Quaternion.unpack(e,t,scratchPackQuaternion$1),s=1===e[t+=Quaternion.packedLength];if(!defined(i))return new FrustumOutlineGeometry({frustum:r,origin:a,orientation:o,_drawNearPlane:s});var l=n===i._frustumType?i._frustum:void 0;return i._frustum=r.clone(l),i._frustumType=n,i._origin=Cartesian3.clone(a,i._origin),i._orientation=Quaternion.clone(o,i._orientation),i._drawNearPlane=s,i},FrustumOutlineGeometry.createGeometry=function(e){var t=e._frustumType,i=e._frustum,r=e._origin,n=e._orientation,a=e._drawNearPlane,o=new Float64Array(24);FrustumGeometry._computeNearFarPlanes(r,n,t,i,o);for(var s,l,c=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:o})}),u=a?2:1,d=new Uint16Array(8*(1+u)),h=a?0:1;h<2;++h)l=4*h,d[s=a?8*h:0]=l,d[s+1]=l+1,d[s+2]=l+1,d[s+3]=l+2,d[s+4]=l+2,d[s+5]=l+3,d[s+6]=l+3,d[s+7]=l;for(h=0;h<2;++h)l=4*h,d[s=8*(u+h)]=l,d[s+1]=l+4,d[s+2]=l+1,d[s+3]=l+5,d[s+4]=l+2,d[s+5]=l+6,d[s+6]=l+3,d[s+7]=l+7;return new Geometry({attributes:c,indices:d,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromVertices(o)})},GeocoderService.prototype.geocode=DeveloperError.throwInstantiationError;var GeocodeType={SEARCH:0,AUTOCOMPLETE:1},GeocodeType$1=freezeObject$1(GeocodeType);function GeometryInstanceAttribute(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=defaultValue(e.normalize,!1),this.value=e.value}function getFilenameFromUri(e){var t=new URI(e);t.normalize();var i=t.path,r=i.lastIndexOf("/");return-1!==r&&(i=i.substr(r+1)),i}var context2DsByWidthAndHeight={};function getImagePixels(e,t,i){defined(t)||(t=e.width),defined(i)||(i=e.height);var r=context2DsByWidthAndHeight[t];defined(r)||(r={},context2DsByWidthAndHeight[t]=r);var n=r[i];if(!defined(n)){var a=document.createElement("canvas");a.width=t,a.height=i,(n=a.getContext("2d")).globalCompositeOperation="copy",r[i]=n}return n.drawImage(e,0,0,t,i),n.getImageData(0,0,t,i).data}function getMagic(e,t){return getStringFromTypedArray(e,t=defaultValue(t,0),Math.min(4,e.length))}var tmp$1={};!function(global,undefined$1){var VHb,WHb,XHb;VHb={1:[function(e,t,i){t.exports=function(e,t){for(var i=[],r=2;r<arguments.length;)i.push(arguments[r++]);var a=!0;return new Promise(function(r,n){i.push(function(e){if(a)if(a=!1,e)n(e);else{for(var t=[],i=1;i<arguments.length;)t.push(arguments[i++]);r.apply(null,t)}});try{e.apply(t||this,i)}catch(e){a&&(a=!1,n(e))}})}},{}],2:[function(e,t,i){var r=i;r.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;1<--t%4&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var l=new Array(64),c=new Array(123),n=0;n<64;)c[l[n]=n<26?n+65:n<52?n+71:n<62?n-4:n-59|43]=n++;r.encode=function(e,t,i){for(var r,n=[],a=0,o=0;t<i;){var s=e[t++];switch(o){case 0:n[a++]=l[s>>2],r=(3&s)<<4,o=1;break;case 1:n[a++]=l[r|s>>4],r=(15&s)<<2,o=2;break;case 2:n[a++]=l[r|s>>6],n[a++]=l[63&s],o=0}}return o&&(n[a++]=l[r],n[a]=61,1===o&&(n[a+1]=61)),String.fromCharCode.apply(String,n)};var u="invalid encoding";r.decode=function(e,t,i){for(var r,n=i,a=0,o=0;o<e.length;){var s=e.charCodeAt(o++);if(61===s&&1<a)break;if((s=c[s])===undefined$1)throw Error(u);switch(a){case 0:r=s,a=1;break;case 1:t[i++]=r<<2|(48&s)>>4,r=s,a=2;break;case 2:t[i++]=(15&r)<<4|(60&s)>>2,r=s,a=3;break;case 3:t[i++]=(3&r)<<6|s,a=0}}if(1===a)throw Error(u);return i-n},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,i){function r(){this._listeners={}}(t.exports=r).prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},r.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var i=this._listeners[e],r=0;r<i.length;)i[r].fn===t?i.splice(r,1):++r;return this},r.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],r=1;r<arguments.length;)i.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,i)}return this}},{}],4:[function(require,module,exports){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],5:[function(e,t,i){t.exports=function(i,r,e){var n=e||8192,a=n>>>1,o=null,s=n;return function(e){if(e<1||a<e)return i(e);n<s+e&&(o=i(n),s=0);var t=r.call(o,s,s+=e);return 7&s&&(s=1+(7|s)),t}}},{}],6:[function(e,t,i){var r=i;r.length=function(e){for(var t=0,i=0,r=0;r<e.length;++r)(i=e.charCodeAt(r))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},r.read=function(e,t,i){if(i-t<1)return"";for(var r,n=null,a=[],o=0;t<i;)(r=e[t++])<128?a[o++]=r:191<r&&r<224?a[o++]=(31&r)<<6|63&e[t++]:239<r&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a[o++]=55296+(r>>10),a[o++]=56320+(1023&r)):a[o++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],8191<o&&((n=n||[]).push(String.fromCharCode.apply(String,a)),o=0);return n?(o&&n.push(String.fromCharCode.apply(String,a.slice(0,o))),n.join("")):String.fromCharCode.apply(String,a.slice(0,o))},r.write=function(e,t,i){for(var r,n,a=i,o=0;o<e.length;++o)(r=e.charCodeAt(o))<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(55296==(64512&r)&&56320==(64512&(n=e.charCodeAt(o+1)))?(r=65536+((1023&r)<<10)+(1023&n),++o,t[i++]=r>>18|240,t[i++]=r>>12&63|128):t[i++]=r>>12|224,t[i++]=r>>6&63|128),t[i++]=63&r|128);return i-a}},{}],7:[function(e,t,i){var r=i;function n(){r.Reader._configure(r.BufferReader),r.util._configure()}r.build="minimal",r.roots={},r.Writer=e(14),r.BufferWriter=e(15),r.Reader=e(8),r.BufferReader=e(9),r.util=e(13),r.rpc=e(10),r.configure=n,r.Writer._configure(r.BufferWriter),n()},{10:10,13:13,14:14,15:15,8:8,9:9}],8:[function(e,t,i){t.exports=l;var r,n=e(13),a=n.LongBits,o=n.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")};function d(){var e=new a(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw s(this,8);return new a(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}l.create=n.Buffer?function(e){return(l.create=function(e){return n.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u,l.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return h(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|h(this.buf,this.pos+=4)};var m,f,g="undefined"!=typeof Float32Array?(m=new Float32Array(1),f=new Uint8Array(m.buffer),m[0]=-0,f[3]?function(e,t){return f[0]=e[t],f[1]=e[t+1],f[2]=e[t+2],f[3]=e[t+3],m[0]}:function(e,t){return f[0]=e[t+3],f[1]=e[t+2],f[2]=e[t+1],f[3]=e[t],m[0]}):function(e,t){var i=h(e,t+4),r=2*(i>>31)+1,n=i>>>23&255,a=8388607&i;return 255==n?a?NaN:1/0*r:0==n?1401298464324817e-60*r*a:r*Math.pow(2,n-150)*(8388608+a)};l.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=g(this.buf,this.pos);return this.pos+=4,e};var _,y,v="undefined"!=typeof Float64Array?(_=new Float64Array(1),y=new Uint8Array(_.buffer),_[0]=-0,y[7]?function(e,t){return y[0]=e[t],y[1]=e[t+1],y[2]=e[t+2],y[3]=e[t+3],y[4]=e[t+4],y[5]=e[t+5],y[6]=e[t+6],y[7]=e[t+7],_[0]}:function(e,t){return y[0]=e[t+7],y[1]=e[t+6],y[2]=e[t+5],y[3]=e[t+4],y[4]=e[t+3],y[5]=e[t+2],y[6]=e[t+1],y[7]=e[t],_[0]}):function(e,t){var i=h(e,t+4),r=h(e,t+8),n=2*(r>>31)+1,a=r>>>20&2047,o=4294967296*(1048575&r)+i;return 2047==a?o?NaN:1/0*n:0==a?5e-324*n*o:n*Math.pow(2,a-1075)*(o+4503599627370496)};l.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=v(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw s(this,e);return this.pos+=e,t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4==(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){r=e;var t=n.Long?"toLong":"toNumber";n.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},{13:13}],9:[function(e,t,i){t.exports=a;var r=e(8);(a.prototype=Object.create(r.prototype)).constructor=a;var n=e(13);function a(e){r.call(this,e)}n.Buffer&&(a.prototype._slice=n.Buffer.prototype.slice),a.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},{13:13,8:8}],10:[function(e,t,i){i.Service=e(11)},{11:11}],11:[function(e,t,i){t.exports=r;var s=e(13);function r(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");s.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}((r.prototype=Object.create(s.EventEmitter.prototype)).constructor=r).prototype.rpcCall=function e(i,t,r,n,a){if(!n)throw TypeError("request must be specified");var o=this;if(!a)return s.asPromise(e,o,i,t,r,n);if(!o.rpcImpl)return setTimeout(function(){a(Error("already ended"))},0),undefined$1;try{return o.rpcImpl(i,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(e,t){if(e)return o.emit("error",e,i),a(e);if(null===t)return o.end(!0),undefined$1;if(!(t instanceof r))try{t=r[o.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return o.emit("error",e,i),a(e)}return o.emit("data",t,i),a(null,t)})}catch(e){return o.emit("error",e,i),setTimeout(function(){a(e)},0),undefined$1}},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{13:13}],12:[function(e,t,i){t.exports=n;var r=e(13);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var a=n.zero=new n(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return a;var t=e<0;t&&(e=-e);var i=e>>>0,r=(e-i)/4294967296>>>0;return t&&(r=~r>>>0,i=~i>>>0,4294967295<++i&&(i=0,4294967295<++r&&(r=0))),new n(i,r)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(r.isString(e)){if(!r.Long)return n.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):a},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?a:new n((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0==i?0==t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},{13:13}],13:[function(e,t,i){var r=i;function n(e,t,i){for(var r=Object.keys(t),n=0;n<r.length;++n)e[r[n]]!==undefined$1&&i||(e[r[n]]=t[r[n]]);return e}function a(e){function i(e,t){if(!(this instanceof i))return new i(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,i):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return(i.prototype=Object.create(Error.prototype)).constructor=i,Object.defineProperty(i.prototype,"name",{get:function(){return e}}),i.prototype.toString=function(){return this.name+": "+this.message},i}r.asPromise=e(1),r.base64=e(2),r.EventEmitter=e(3),r.inquire=e(4),r.utf8=e(6),r.pool=e(5),r.LongBits=e(12),r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=global.dcodeIO&&global.dcodeIO.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var i=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},r.merge=n,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=a,r.ProtocolError=a("ProtocolError"),r.oneOfGetter=function(e){for(var i={},t=0;t<e.length;++t)i[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;-1<t;--t)if(1===i[e[t]]&&this[e[t]]!==undefined$1&&null!==this[e[t]])return e[t]}},r.oneOfSetter=function(i){return function(e){for(var t=0;t<i.length;++t)i[t]!==e&&delete this[i[t]]}},r.lazyResolve=function(e,t){for(var i=0;i<t.length;++i)for(var r=Object.keys(t[i]),n=0;n<r.length;++n){for(var a=t[i][r[n]].split("."),o=e;a.length;)o=o[a.shift()];t[i][r[n]]=o}},r.toJSONOptions={longs:String,enums:String,bytes:String},r._configure=function(){var i=r.Buffer;i?(r._Buffer_from=i.from!==Uint8Array.from&&i.from||function(e,t){return new i(e,t)},r._Buffer_allocUnsafe=i.allocUnsafe||function(e){return new i(e)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},{1:1,12:12,2:2,3:3,4:4,5:5,6:6}],14:[function(e,t,i){t.exports=d;var r,n=e(13),a=n.LongBits,o=n.base64,s=n.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=undefined$1,this.val=i}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}function h(e,t,i){t[i]=255&e}function p(e,t){this.len=e,this.next=undefined$1,this.val=t}function m(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;127<e.lo;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function f(e,t,i){t[i++]=255&e,t[i++]=e>>>8&255,t[i++]=e>>>16&255,t[i]=e>>>24}d.create=n.Buffer?function(){return(d.create=function(){return new r})()}:function(){return new d},d.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(d.alloc=n.pool(d.alloc,n.Array.prototype.subarray)),d.prototype.push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},(p.prototype=Object.create(l.prototype)).fn=function(e,t,i){for(;127<e;)t[i++]=127&e|128,e>>>=7;t[i]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this.push(m,10,a.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.int64=d.prototype.uint64=function(e){var t=a.from(e);return this.push(m,t.length(),t)},d.prototype.sint64=function(e){var t=a.from(e).zzEncode();return this.push(m,t.length(),t)},d.prototype.bool=function(e){return this.push(h,1,e?1:0)},d.prototype.sfixed32=d.prototype.fixed32=function(e){return this.push(f,4,e>>>0)},d.prototype.sfixed64=d.prototype.fixed64=function(e){var t=a.from(e);return this.push(f,4,t.lo).push(f,4,t.hi)};var g,_,y="undefined"!=typeof Float32Array?(g=new Float32Array(1),_=new Uint8Array(g.buffer),g[0]=-0,_[3]?function(e,t,i){g[0]=e,t[i++]=_[0],t[i++]=_[1],t[i++]=_[2],t[i]=_[3]}:function(e,t,i){g[0]=e,t[i++]=_[3],t[i++]=_[2],t[i++]=_[1],t[i]=_[0]}):function(e,t,i){var r=e<0?1:0;if(r&&(e=-e),0===e)f(0<1/e?0:2147483648,t,i);else if(isNaN(e))f(2147483647,t,i);else if(34028234663852886e22<e)f((r<<31|2139095040)>>>0,t,i);else if(e<11754943508222875e-54)f((r<<31|Math.round(e/1401298464324817e-60))>>>0,t,i);else{var n=Math.floor(Math.log(e)/Math.LN2);f((r<<31|n+127<<23|8388607&Math.round(e*Math.pow(2,-n)*8388608))>>>0,t,i)}};d.prototype.float=function(e){return this.push(y,4,e)};var v,C,S="undefined"!=typeof Float64Array?(v=new Float64Array(1),C=new Uint8Array(v.buffer),v[0]=-0,C[7]?function(e,t,i){v[0]=e,t[i++]=C[0],t[i++]=C[1],t[i++]=C[2],t[i++]=C[3],t[i++]=C[4],t[i++]=C[5],t[i++]=C[6],t[i]=C[7]}:function(e,t,i){v[0]=e,t[i++]=C[7],t[i++]=C[6],t[i++]=C[5],t[i++]=C[4],t[i++]=C[3],t[i++]=C[2],t[i++]=C[1],t[i]=C[0]}):function(e,t,i){var r=e<0?1:0;if(r&&(e=-e),0===e)f(0,t,i),f(0<1/e?0:2147483648,t,i+4);else if(isNaN(e))f(4294967295,t,i),f(2147483647,t,i+4);else if(17976931348623157e292<e)f(0,t,i),f((r<<31|2146435072)>>>0,t,i+4);else{var n;if(e<22250738585072014e-324)f((n=e/5e-324)>>>0,t,i),f((r<<31|n/4294967296)>>>0,t,i+4);else{var a=Math.floor(Math.log(e)/Math.LN2);1024===a&&(a=1023),f(4503599627370496*(n=e*Math.pow(2,-a))>>>0,t,i),f((r<<31|a+1023<<20|1048576*n&1048575)>>>0,t,i+4)}}};d.prototype.double=function(e){return this.push(S,8,e)};var x=n.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var r=0;r<e.length;++r)t[i+r]=e[r]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this.push(h,1,0);if(n.isString(e)){var i=d.alloc(t=o.length(e));o.decode(e,i,0),e=i}return this.uint32(t).push(x,t,e)},d.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t).push(s.write,t,e):this.push(h,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},d._configure=function(e){r=e}},{13:13}],15:[function(e,t,i){t.exports=o;var r=e(14);(o.prototype=Object.create(r.prototype)).constructor=o;var n=e(13),a=n.Buffer;function o(){r.call(this)}o.alloc=function(e){return(o.alloc=n._Buffer_allocUnsafe)(e)};var s=a&&a.prototype instanceof Uint8Array&&"set"===a.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var r=0;r<e.length;)t[i++]=e[r++]};function l(e,t,i){e.length<40?n.utf8.write(e,t,i):t.utf8Write(e,i)}o.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this.push(s,t,e),this},o.prototype.string=function(e){var t=a.byteLength(e);return this.uint32(t),t&&this.push(l,t,e),this}},{13:13,14:14}]},WHb={},XHb=[7],global.protobuf=function e(t){var i=WHb[t];return i||VHb[t][0].call(i=WHb[t]={exports:{}},e,i,i.exports),i.exports}(XHb[0])}(tmp$1);var protobuf=tmp$1.protobuf;function isBitSet(e,t){return 0!=(e&t)}var childrenBitmasks=[1,2,4,8],anyChildBitmask=15,cacheFlagBitmask=16,imageBitmask=64,terrainBitmask=128;function GoogleEarthEnterpriseTileInformation(e,t,i,r,n,a){this._bits=e,this.cnodeVersion=t,this.imageryVersion=i,this.terrainVersion=r,this.imageryProvider=n,this.terrainProvider=a,this.ancestorHasTerrain=!1,this.terrainState=void 0}function stringToBuffer(e){for(var t=e.length,i=new ArrayBuffer(t),r=new Uint8Array(i),n=0;n<t;++n)r[n]=e.charCodeAt(n);return i}GoogleEarthEnterpriseTileInformation.clone=function(e,t){return defined(t)?(t._bits=e._bits,t.cnodeVersion=e.cnodeVersion,t.imageryVersion=e.imageryVersion,t.terrainVersion=e.terrainVersion,t.imageryProvider=e.imageryProvider,t.terrainProvider=e.terrainProvider):t=new GoogleEarthEnterpriseTileInformation(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t},GoogleEarthEnterpriseTileInformation.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},GoogleEarthEnterpriseTileInformation.prototype.hasSubtree=function(){return isBitSet(this._bits,cacheFlagBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasImagery=function(){return isBitSet(this._bits,imageBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasTerrain=function(){return isBitSet(this._bits,terrainBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChildren=function(){return isBitSet(this._bits,anyChildBitmask)},GoogleEarthEnterpriseTileInformation.prototype.hasChild=function(e){return isBitSet(this._bits,childrenBitmasks[e])},GoogleEarthEnterpriseTileInformation.prototype.getChildBitmask=function(){return this._bits&anyChildBitmask};var defaultKey=stringToBuffer('Eô½\vyâjE"’,ÍqøIFgQ\0B%Æèa,f)\bÆ4Üjb%y\nwmiÖðœk“¡½NuàA[ß@V\fÙ»r›|3SîOlÔq°{ÀEVZ­wUe\v3’*¬l5Å0sø3>mF8J´Ýð.ÝuڌDt"úa"\f3"So¯9D\vŒ9Ù9L¹¿«\\ŒP_Ÿ"uxéq‘h;Áěð<VqH‚\'UfYNe˜u£aF}a?A\0Ÿ×´4M·F°Õ¸Š\'{‹Ü+»Mg0ÈÑö\\Pú[/F›n5/\'C.ë\n\f^¥se4ål.jC\'c#U©?q{gC}:¯ÍâTUœýKÆâŸ/(íË\\Æ-fˆ§;/*"N°k.Ý\r•}}GºC²²+>Mª>}æÎI‰Ææx\fa1-¤O¥~q ˆì\r1èN\v\0nPh}=\b\r•¦n£h—$[kó#ó¶s³\r\v@ÀŸØQ]ú".jßI\0¹ wUÆïj¿{GLƒîÜÜF…©­S+S4ÿ”Yä8è1ƒN¹XFkË-#†’p\x005ˆ"Ï1²&/çÃu-6,rt°#G·ÓÑ&…7râ\0ŒDÏÚ3-Þ`†i#i*|ÍKQ\r•T9w.)ê¦P¢joP™\\>TûïP[\vE‰m(w7ێJfJo™ åpâ¹q~\fmI-zþrÇòY0»]såÉ êx점ðŠB|G`°½&·q¶ÇŸÑ3‚=Ó«îc™È+S D\\qÆÌD2O<ÊÀ)=RÓaX©}e´ÜÏ\rô=ñ\b©BÚ#\tØ¿^PIøMÀËGLO÷{+ØÅ1’;µoÜl\r’ˆўÛ?âéÚ_ԄâFaZÞUϤ\0¾ýÎgñJi—æ HØ]~®q N®ÀV©‘<‚rçvì)IÖ]-ƒãÛ6©;f—‡jÕ¶=P^R¹KÇsWxÉô.Y•“oÐKW>\'\'Ç`Û;íšSD>?’mw¢\në?R¨ÆU^1I7…ôÅ&-©¿‹\'TÚÃj å*x°Öprª‹h½ˆ÷_H±~ÀXL?fù>áeÀp§Ï8i¯ðVldIœ\'­xtO‡ÞV9\0Úw\vË-‰û5Oõ\bQ`Á\nZGM&30xÚÀœFGâ[y`In7gS\n>éìF9²ñ4\rƄSuná\fYÙÞ)…{II¥wy¾IV.6ç\v:»Ob{ÒM1•/½8{¨O!áìFpv•})"xˆ\nÝ\\ÚÞQÏðüYRe|3ßóHÚ»*uÛ`²Ôüíì5¨ÿ(1-È܈F|Š["');function GoogleEarthEnterpriseMetadata(e){var t=e;"string"==typeof t||t instanceof Resource||(t=e.url);var i=Resource.createIfNeeded(t);i.appendForwardSlash(),this._resource=i,this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=CesiumMath.EPSILON12,this.providers={},this.key=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={};var r=this;this._readyPromise=requestDbRoot(this).then(function(){return r.getQuadTreePacket("",r._quadPacketVersion)}).then(function(){return!0}).otherwise(function(e){var t="An error occurred while accessing "+getMetadataResource(r,"",1).url+".";return when.reject(new RuntimeError(t))})}defineProperties$1(GoogleEarthEnterpriseMetadata.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}},readyPromise:{get:function(){return this._readyPromise}}}),GoogleEarthEnterpriseMetadata.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;0<=n;--n){var a=1<<n,o=0;isBitSet(t,a)?isBitSet(e,a)&&(o|=1):(o|=2,isBitSet(e,a)||(o|=1)),r+=o}return r},GoogleEarthEnterpriseMetadata.quadKeyToTileXY=function(e){for(var t=0,i=0,r=e.length-1,n=r;0<=n;--n){var a=1<<n,o=+e[r-n];isBitSet(o,2)?isBitSet(o,1)||(t|=a):(i|=a,isBitSet(o,1)&&(t|=a))}return{x:t,y:i,level:r}},GoogleEarthEnterpriseMetadata.prototype.isValid=function(e){var t=this.getTileInformationFromQuadKey(e);if(defined(t))return null!==t;for(var i,r=!0,n=e;1<n.length;){if(i=n.substring(n.length-1),n=n.substring(0,n.length-1),defined(t=this.getTileInformationFromQuadKey(n))){t.hasSubtree()||t.hasChild(parseInt(i))||(r=!1);break}if(null===t){r=!1;break}}return r};var taskProcessor$1=new TaskProcessor("decodeGoogleEarthEnterprisePacket",Number.POSITIVE_INFINITY),dbrootParser,dbrootParserPromise;function populateSubtree(e,t,i){var r,n=e._tileInfo,a=t,o=n[a];if(defined(o)&&(!o.hasSubtree()||o.hasChildren()))return o;for(;void 0===o&&1<a.length;)o=n[a=a.substring(0,a.length-1)];var s=e._subtreePromises,l=s[a];return defined(l)?l.then(function(){return r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction}),populateSubtree(e,t,r)}):defined(o)&&o.hasSubtree()?defined(l=e.getQuadTreePacket(a,o.cnodeVersion,i))?(s[a]=l).then(function(){return r=new Request({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction}),populateSubtree(e,t,r)}).always(function(){delete s[a]}):void 0:when.reject(new RuntimeError("Couldn't load metadata for tile "+t))}function getMetadataResource(e,t,i,r){return e._resource.getDerivedResource({url:"flatfile?q2-0"+t+"-q."+i.toString(),request:r})}function requestDbRoot(c){var e=c._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!defined(dbrootParserPromise)){var t=buildModuleUrl("ThirdParty/google-earth-dbroot-parser.js"),i=window.cesiumGoogleEarthDbRootParser;dbrootParserPromise=loadAndExecuteScript(t).then(function(){dbrootParser=window.cesiumGoogleEarthDbRootParser(protobuf),defined(i)?window.cesiumGoogleEarthDbRootParser=i:delete window.cesiumGoogleEarthDbRootParser})}return dbrootParserPromise.then(function(){return e.fetchArrayBuffer()}).then(function(e){var t=dbrootParser.EncryptedDbRootProto.decode(new Uint8Array(e)),i=t.encryptionData,r=i.byteOffset,n=r+i.byteLength,a=c.key=i.buffer.slice(r,n);n=(r=(i=t.dbrootData).byteOffset)+i.byteLength;var o=i.buffer.slice(r,n);return taskProcessor$1.scheduleTask({buffer:o,type:"DbRoot",key:a},[o])}).then(function(e){var t=dbrootParser.DbRootProto.decode(new Uint8Array(e.buffer));if(c.imageryPresent=defaultValue(t.imageryPresent,c.imageryPresent),c.protoImagery=t.protoImagery,c.terrainPresent=defaultValue(t.terrainPresent,c.terrainPresent),defined(t.endSnippet)&&defined(t.endSnippet.model)){var i=t.endSnippet.model;c.negativeAltitudeExponentBias=defaultValue(i.negativeAltitudeExponentBias,c.negativeAltitudeExponentBias),c.negativeAltitudeThreshold=defaultValue(i.compressedNegativeAltitudeThreshold,c.negativeAltitudeThreshold)}defined(t.databaseVersion)&&(c._quadPacketVersion=defaultValue(t.databaseVersion.quadtreeVersion,c._quadPacketVersion));for(var r=c.providers,n=defaultValue(t.providerInfo,[]),a=n.length,o=0;o<a;++o){var s=n[o],l=s.copyrightString;defined(l)&&(r[s.providerId]=new Credit(l.value))}}).otherwise(function(){console.log("Failed to retrieve "+e.url+". Using defaults."),c.key=defaultKey})}function GoogleEarthEnterpriseTerrainData(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._buffer=e.buffer,this._credits=e.credits,this._negativeAltitudeExponentBias=e.negativeAltitudeExponentBias,this._negativeElevationThreshold=e.negativeElevationThreshold;var t=defaultValue(e.childTileMask,15),i=3&t;i|=4&t?8:0,i|=8&t?4:0,this._childTileMask=i,this._createdByUpsampling=defaultValue(e.createdByUpsampling,!1),this._skirtHeight=void 0,this._bufferType=this._buffer.constructor,this._mesh=void 0,this._minimumHeight=void 0,this._maximumHeight=void 0,this._vertexCountWithoutSkirts=void 0,this._skirtIndex=void 0}GoogleEarthEnterpriseMetadata.prototype.getQuadTreePacket=function(d,e,t){e=defaultValue(e,1);var i=getMetadataResource(this,d=defaultValue(d,""),e,t).fetchArrayBuffer();if(defined(i)){var h=this._tileInfo,r=this.key;return i.then(function(e){return taskProcessor$1.scheduleTask({buffer:e,quadKey:d,type:"Metadata",key:r},[e]).then(function(e){var t,i=-1;if(""!==d){i=d.length+1;var r=e[d];(t=h[d])._bits|=r._bits,delete e[d]}var n=Object.keys(e);n.sort(function(e,t){return e.length-t.length});for(var a=n.length,o=0;o<a;++o){var s=n[o];if(null!==e[s]){var l=GoogleEarthEnterpriseTileInformation.clone(e[s]),c=s.length;if(c===i)l.setParent(t);else if(1<c){var u=h[s.substring(0,s.length-1)];l.setParent(u)}h[s]=l}else h[s]=null}})})}},GoogleEarthEnterpriseMetadata.prototype.populateSubtree=function(e,t,i,r){return populateSubtree(this,GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),r)},GoogleEarthEnterpriseMetadata.prototype.getTileInformation=function(e,t,i){var r=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i);return this._tileInfo[r]},GoogleEarthEnterpriseMetadata.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]},defineProperties$1(GoogleEarthEnterpriseTerrainData.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){}}});var taskProcessor$2=new TaskProcessor("createVerticesFromGoogleEarthEnterpriseBuffer"),nativeRectangleScratch=new Rectangle,rectangleScratch$1=new Rectangle;GoogleEarthEnterpriseTerrainData.prototype.createMesh=function(e,t,i,r,n){var a=e.ellipsoid;e.tileXYToNativeRectangle(t,i,r,nativeRectangleScratch),e.tileXYToRectangle(t,i,r,rectangleScratch$1),n=defaultValue(n,1);var o=a.cartographicToCartesian(Rectangle.center(rectangleScratch$1)),s=40075.16/(1<<r);this._skirtHeight=Math.min(8*s,1e3);var l=taskProcessor$2.scheduleTask({buffer:this._buffer,nativeRectangle:nativeRectangleScratch,rectangle:rectangleScratch$1,relativeToCenter:o,ellipsoid:a,skirtHeight:this._skirtHeight,exaggeration:n,includeWebMercatorT:!0,negativeAltitudeExponentBias:this._negativeAltitudeExponentBias,negativeElevationThreshold:this._negativeElevationThreshold});if(defined(l)){var c=this;return l.then(function(e){return c._mesh=new TerrainMesh(o,new Float32Array(e.vertices),new Uint16Array(e.indices),e.minimumHeight,e.maximumHeight,BoundingSphere.clone(e.boundingSphere3D),Cartesian3.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,OrientedBoundingBox.clone(e.orientedBoundingBox),TerrainEncoding.clone(e.encoding),n,e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),c._vertexCountWithoutSkirts=e.vertexCountWithoutSkirts,c._skirtIndex=e.skirtIndex,c._minimumHeight=e.minimumHeight,c._maximumHeight=e.maximumHeight,c._buffer=void 0,c._mesh})}},GoogleEarthEnterpriseTerrainData.prototype.interpolateHeight=function(e,t,i){var r=CesiumMath.clamp((t-e.west)/e.width,0,1),n=CesiumMath.clamp((i-e.south)/e.height,0,1);return defined(this._mesh)?interpolateMeshHeight$2(this,r,n):interpolateHeight$2(this,r,n,e)};var upsampleTaskProcessor$1=new TaskProcessor("upsampleQuantizedTerrainMesh");GoogleEarthEnterpriseTerrainData.prototype.upsample=function(e,t,i,r,n,a,o){var s=this._mesh;if(defined(this._mesh)){var l=2*t!==n,c=2*i===a,u=e.ellipsoid,d=e.tileXYToRectangle(n,a,o),h=upsampleTaskProcessor$1.scheduleTask({vertices:s.vertices,vertexCountWithoutSkirts:this._vertexCountWithoutSkirts,indices:s.indices,skirtIndex:this._skirtIndex,encoding:s.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:l,isNorthChild:c,childRectangle:d,ellipsoid:u,exaggeration:s.exaggeration});if(defined(h)){var p=this;return h.then(function(e){var t=new Uint16Array(e.vertices),i=IndexDatatype$1.createTypedArray(t.length/3,e.indices),r=p._skirtHeight;return new QuantizedMeshTerrainData({quantizedVertices:t,indices:i,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:BoundingSphere.clone(e.boundingSphere),orientedBoundingBox:OrientedBoundingBox.clone(e.orientedBoundingBox),horizonOcclusionPoint:Cartesian3.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:r,southSkirtHeight:r,eastSkirtHeight:r,northSkirtHeight:r,childTileMask:0,createdByUpsampling:!0,credits:p._credits})})}}},GoogleEarthEnterpriseTerrainData.prototype.isChildAvailable=function(e,t,i,r){var n=2;return i!==2*e&&++n,r!==2*t&&(n-=2),0!=(this._childTileMask&1<<n)},GoogleEarthEnterpriseTerrainData.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var texCoordScratch0$1=new Cartesian2,texCoordScratch1$1=new Cartesian2,texCoordScratch2$1=new Cartesian2,barycentricCoordinateScratch$1=new Cartesian3;function interpolateMeshHeight$2(e,t,i){for(var r=e._mesh,n=r.vertices,a=r.encoding,o=r.indices,s=0,l=o.length;s<l;s+=3){var c=o[s],u=o[s+1],d=o[s+2],h=a.decodeTextureCoordinates(n,c,texCoordScratch0$1),p=a.decodeTextureCoordinates(n,u,texCoordScratch1$1),m=a.decodeTextureCoordinates(n,d,texCoordScratch2$1),f=Intersections2D.computeBarycentricCoordinates(t,i,h.x,h.y,p.x,p.y,m.x,m.y,barycentricCoordinateScratch$1);if(-1e-15<=f.x&&-1e-15<=f.y&&-1e-15<=f.z){var g=a.decodeHeight(n,c),_=a.decodeHeight(n,u),y=a.decodeHeight(n,d);return f.x*g+f.y*_+f.z*y}}}var sizeOfUint16=Uint16Array.BYTES_PER_ELEMENT,sizeOfUint32=Uint32Array.BYTES_PER_ELEMENT,sizeOfInt32=Int32Array.BYTES_PER_ELEMENT,sizeOfFloat=Float32Array.BYTES_PER_ELEMENT,sizeOfDouble=Float64Array.BYTES_PER_ELEMENT;function interpolateHeight$2(e,t,i,r){var n=e._buffer,a=0,o=0,s=0;.5<i?(.5<t?(a=2,o=.5):a=3,s=.5):.5<t&&(a=1,o=.5);for(var l=new DataView(n),c=0,u=0;u<a;++u)c+=l.getUint32(c,!0),c+=sizeOfUint32;c+=sizeOfUint32,c+=2*sizeOfDouble;var d=CesiumMath.toRadians(180*l.getFloat64(c,!0));c+=sizeOfDouble;var h=CesiumMath.toRadians(180*l.getFloat64(c,!0));c+=sizeOfDouble;var p=r.width/d/2,m=r.height/h/2,f=l.getInt32(c,!0);c+=sizeOfInt32;var g=3*l.getInt32(c,!0);c+=sizeOfInt32,c+=sizeOfInt32;var _,y=new Array(f),v=new Array(f),C=new Array(f);for(_=0;_<f;++_)y[_]=o+l.getUint8(c++)*p,v[_]=s+l.getUint8(c++)*m,C[_]=6371010*l.getFloat32(c,!0),c+=sizeOfFloat;var S=new Array(g);for(_=0;_<g;++_)S[_]=l.getUint16(c,!0),c+=sizeOfUint16;for(_=0;_<g;_+=3){var x=S[_],T=S[_+1],b=S[_+2],E=y[x],P=y[T],A=y[b],w=v[x],D=v[T],M=v[b],I=Intersections2D.computeBarycentricCoordinates(t,i,E,w,P,D,A,M,barycentricCoordinateScratch$1);if(-1e-15<=I.x&&-1e-15<=I.y&&-1e-15<=I.z)return I.x*C[x]+I.y*C[T]+I.z*C[b]}}var TerrainState={UNKNOWN:0,NONE:1,SELF:2,PARENT:3},julianDateScratch$1=new JulianDate;function TerrainCache(){this._terrainCache={},this._lastTidy=JulianDate.now()}function GoogleEarthEnterpriseTerrainProvider(e){var i;if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadata))i=e.metadata;else{var t=Resource.createIfNeeded(e.url);i=new GoogleEarthEnterpriseMetadata(t)}this._metadata=i,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._levelZeroMaximumGeometricError=40075.16,this._terrainCache=new TerrainCache,this._terrainPromises={},this._terrainRequests={},this._errorEvent=new Event,this._ready=!1;var n,a=this;this._readyPromise=i.readyPromise.then(function(e){if(i.terrainPresent)return TileProviderError.handleSuccess(n),a._ready=e;var t=new RuntimeError("The server "+i.url+" doesn't have terrain");return n=TileProviderError.handleError(n,a,a._errorEvent,t.message,void 0,void 0,void 0,t),when.reject(t)}).otherwise(function(e){return n=TileProviderError.handleError(n,a,a._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)})}TerrainCache.prototype.add=function(e,t){this._terrainCache[e]={buffer:t,timestamp:JulianDate.now()}},TerrainCache.prototype.get=function(e){var t=this._terrainCache[e];if(defined(t))return delete this._terrainCache[e],t.buffer},TerrainCache.prototype.tidy=function(){if(JulianDate.now(julianDateScratch$1),10<JulianDate.secondsDifference(julianDateScratch$1,this._lastTidy)){for(var e=this._terrainCache,t=Object.keys(e),i=t.length,r=0;r<i;++r){var n=t[r],a=e[n];10<JulianDate.secondsDifference(julianDateScratch$1,a.timestamp)&&delete e[n]}JulianDate.clone(julianDateScratch$1,this._lastTidy)}},defineProperties$1(GoogleEarthEnterpriseTerrainProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tilingScheme:{get:function(){return this._tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});var taskProcessor$3=new TaskProcessor("decodeGoogleEarthEnterprisePacket",Number.POSITIVE_INFINITY);function computeChildMask(e,t,i){var r=t.getChildBitmask();if(t.terrainState===TerrainState.PARENT)for(var n=r=0;n<4;++n){var a=i.getTileInformationFromQuadKey(e+n.toString());defined(a)&&a.hasTerrain()&&(r|=1<<n)}return r}function buildTerrainResource(e,t,i,r){return i=defined(i)&&0<i?i:1,e._metadata.resource.getDerivedResource({url:"flatfile?f1c-0"+t+"-t."+i.toString(),request:r})}GoogleEarthEnterpriseTerrainProvider.prototype.requestTileGeometry=function(e,t,i,r){var n=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),s=this._terrainCache,l=this._metadata,a=l.getTileInformationFromQuadKey(n);if(!defined(a))return when.reject(new RuntimeError("Terrain tile doesn't exist"));var o=a.terrainState;defined(o)||(o=a.terrainState=TerrainState.UNKNOWN);var c,u=s.get(n);if(defined(u)){var d=l.providers[a.terrainProvider];return when.resolve(new GoogleEarthEnterpriseTerrainData({buffer:u,childTileMask:computeChildMask(n,a,l),credits:defined(d)?[d]:void 0,negativeAltitudeExponentBias:l.negativeAltitudeExponentBias,negativeElevationThreshold:l.negativeAltitudeThreshold}))}if(s.tidy(),!a.ancestorHasTerrain)return when.resolve(new HeightmapTerrainData({buffer:new Uint8Array(256),width:16,height:16}));if(o===TerrainState.NONE)return when.reject(new RuntimeError("Terrain tile doesn't exist"));var h=n,p=-1;switch(o){case TerrainState.SELF:p=a.terrainVersion;break;case TerrainState.PARENT:h=h.substring(0,h.length-1),p=(c=l.getTileInformationFromQuadKey(h)).terrainVersion;break;case TerrainState.UNKNOWN:a.hasTerrain()?p=a.terrainVersion:(h=h.substring(0,h.length-1),defined(c=l.getTileInformationFromQuadKey(h))&&c.hasTerrain()&&(p=c.terrainVersion))}if(p<0)return when.reject(new RuntimeError("Terrain tile doesn't exist"));var m,f,g=this._terrainPromises,_=this._terrainRequests;if(defined(g[h]))m=g[h],f=_[h];else{var y=buildTerrainResource(this,h,p,f=r).fetchArrayBuffer();if(!defined(y))return;m=y.then(function(e){return defined(e)?taskProcessor$3.scheduleTask({buffer:e,type:"Terrain",key:l.key},[e]).then(function(e){var t=l.getTileInformationFromQuadKey(h);t.terrainState=TerrainState.SELF,s.add(h,e[0]);for(var i=t.terrainProvider,r=e.length-1,n=0;n<r;++n){var a=h+n.toString(),o=l.getTileInformationFromQuadKey(a);defined(o)&&(s.add(a,e[n+1]),o.terrainState=TerrainState.PARENT,0===o.terrainProvider&&(o.terrainProvider=i))}}):when.reject(new RuntimeError("Failed to load terrain."))}),g[h]=m,_[h]=f,m=m.always(function(){delete g[h],delete _[h]})}return m.then(function(){var e=s.get(n);if(defined(e)){var t=l.providers[a.terrainProvider];return new GoogleEarthEnterpriseTerrainData({buffer:e,childTileMask:computeChildMask(n,a,l),credits:defined(t)?[t]:void 0,negativeAltitudeExponentBias:l.negativeAltitudeExponentBias,negativeElevationThreshold:l.negativeAltitudeThreshold})}return when.reject(new RuntimeError("Failed to load terrain."))}).otherwise(function(e){return f.state===RequestState$1.CANCELLED?r.state=f.state:a.terrainState=TerrainState.NONE,when.reject(e)})},GoogleEarthEnterpriseTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},GoogleEarthEnterpriseTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){var r=this._metadata,n=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),a=r.getTileInformation(e,t,i);if(null===a)return!1;if(defined(a)){if(!a.ancestorHasTerrain)return!0;var o=a.terrainState;if(o===TerrainState.NONE)return!1;if(!(defined(o)&&o!==TerrainState.UNKNOWN||(a.terrainState=TerrainState.UNKNOWN,a.hasTerrain()))){n=n.substring(0,n.length-1);var s=r.getTileInformationFromQuadKey(n);if(!defined(s)||!s.hasTerrain())return!1}return!0}if(r.isValid(n)){var l=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TERRAIN});r.populateSubtree(e,t,i,l)}return!1},GoogleEarthEnterpriseTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var PROJECTIONS=[GeographicProjection,WebMercatorProjection],PROJECTION_COUNT=PROJECTIONS.length,MITER_BREAK_SMALL=Math.cos(CesiumMath.toRadians(30)),MITER_BREAK_LARGE=Math.cos(CesiumMath.toRadians(150)),WALL_INITIAL_MIN_HEIGHT=0,WALL_INITIAL_MAX_HEIGHT=1e3;function GroundPolylineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions;this.width=defaultValue(e.width,1),this._positions=t,this.granularity=defaultValue(e.granularity,9999),this.loop=defaultValue(e.loop,!1),this.arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._ellipsoid=Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}defineProperties$1(GroundPolylineGeometry.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+Ellipsoid.packedLength+1+1}}}),GroundPolylineGeometry.setProjectionAndEllipsoid=function(e,t){for(var i=0,r=0;r<PROJECTION_COUNT;r++)if(t instanceof PROJECTIONS[r]){i=r;break}e._projectionIndex=i,e._ellipsoid=t.ellipsoid};var cart3Scratch1=new Cartesian3,cart3Scratch2=new Cartesian3,cart3Scratch3=new Cartesian3;function computeRightNormal(e,t,i,r,n){var a=getPosition(r,e,0,cart3Scratch1),o=getPosition(r,e,i,cart3Scratch2),s=getPosition(r,t,0,cart3Scratch3),l=direction(o,a,cart3Scratch2),c=direction(s,a,cart3Scratch3);return Cartesian3.cross(c,l,n),Cartesian3.normalize(n,n)}var interpolatedCartographicScratch=new Cartographic,interpolatedBottomScratch=new Cartesian3,interpolatedTopScratch=new Cartesian3,interpolatedNormalScratch=new Cartesian3;function interpolateSegment(e,t,i,r,n,a,o,s,l,c,u){if(0!==n){var d;a===ArcType$1.GEODESIC?d=new EllipsoidGeodesic(e,t,o):a===ArcType$1.RHUMB&&(d=new EllipsoidRhumbLine(e,t,o));var h=d.surfaceDistance;if(!(h<n))for(var p=computeRightNormal(e,t,r,o,interpolatedNormalScratch),m=Math.ceil(h/n),f=h/m,g=f,_=m-1,y=s.length,v=0;v<_;v++){var C=d.interpolateUsingSurfaceDistance(g,interpolatedCartographicScratch),S=getPosition(o,C,i,interpolatedBottomScratch),x=getPosition(o,C,r,interpolatedTopScratch);Cartesian3.pack(p,s,y),Cartesian3.pack(S,l,y),Cartesian3.pack(x,c,y),u.push(C.latitude),u.push(C.longitude),y+=3,g+=f}}}var heightlessCartographicScratch=new Cartographic;function getPosition(e,t,i,r){return Cartographic.clone(t,heightlessCartographicScratch),heightlessCartographicScratch.height=i,Cartographic.toCartesian(heightlessCartographicScratch,e,r)}function direction(e,t,i){return Cartesian3.subtract(e,t,i),Cartesian3.normalize(i,i),i}function tangentDirection(e,t,i,r){return r=direction(e,t,r),r=Cartesian3.cross(r,i,r),r=Cartesian3.normalize(r,r),r=Cartesian3.cross(i,r,r)}GroundPolylineGeometry.pack=function(e,t,i){var r=defaultValue(i,0),n=e._positions,a=n.length;t[r++]=a;for(var o=0;o<a;++o){var s=n[o];Cartesian3.pack(s,t,r),r+=3}return t[r++]=e.granularity,t[r++]=e.loop?1:0,t[r++]=e.arcType,Ellipsoid.pack(e._ellipsoid,t,r),r+=Ellipsoid.packedLength,t[r++]=e._projectionIndex,t[r++]=e._scene3DOnly?1:0,t},GroundPolylineGeometry.unpack=function(e,t,i){for(var r=defaultValue(t,0),n=e[r++],a=new Array(n),o=0;o<n;o++)a[o]=Cartesian3.unpack(e,r),r+=3;var s=e[r++],l=1===e[r++],c=e[r++],u=Ellipsoid.unpack(e,r);r+=Ellipsoid.packedLength;var d=e[r++],h=1===e[r++];return defined(i)||(i=new GroundPolylineGeometry({positions:a})),i._positions=a,i.granularity=s,i.loop=l,i.arcType=c,i._ellipsoid=u,i._projectionIndex=d,i._scene3DOnly=h,i};var toPreviousScratch=new Cartesian3,toNextScratch=new Cartesian3,forwardScratch=new Cartesian3,vertexUpScratch=new Cartesian3,cosine90=0,cosine180=-1;function computeVertexMiterNormal(e,t,i,r,n){var a=direction(i,t,vertexUpScratch),o=tangentDirection(e,t,a,toPreviousScratch),s=tangentDirection(r,t,a,toNextScratch);if(CesiumMath.equalsEpsilon(Cartesian3.dot(o,s),cosine180,CesiumMath.EPSILON5))return n=Cartesian3.cross(a,o,n),n=Cartesian3.normalize(n,n);n=Cartesian3.add(s,o,n),n=Cartesian3.normalize(n,n);var l=Cartesian3.cross(a,n,forwardScratch);return Cartesian3.dot(s,l)<cosine90&&(n=Cartesian3.negate(n,n)),n}var XZ_PLANE=Plane.fromPointNormal(Cartesian3.ZERO,Cartesian3.UNIT_Y),previousBottomScratch=new Cartesian3,vertexBottomScratch=new Cartesian3,vertexTopScratch=new Cartesian3,nextBottomScratch=new Cartesian3,vertexNormalScratch=new Cartesian3,intersectionScratch=new Cartesian3,cartographicScratch0=new Cartographic,cartographicScratch1=new Cartographic,cartographicIntersectionScratch=new Cartographic;GroundPolylineGeometry.createGeometry=function(e){var t,i,r,n,a,o,s=!e._scene3DOnly,l=e.loop,c=e._ellipsoid,u=e.granularity,d=e.arcType,h=new PROJECTIONS[e._projectionIndex](c),p=WALL_INITIAL_MIN_HEIGHT,m=WALL_INITIAL_MAX_HEIGHT,f=e._positions,g=f.length;2===g&&(l=!1);var _,y,v,C=new EllipsoidRhumbLine(void 0,void 0,c),S=[f[0]];for(i=0;i<g-1;i++)r=f[i],n=f[i+1],!defined(_=IntersectionTests.lineSegmentPlane(r,n,XZ_PLANE,intersectionScratch))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?S.push(Cartesian3.clone(_)):e.arcType===ArcType$1.RHUMB&&(v=c.cartesianToCartographic(_,cartographicScratch0).longitude,a=c.cartesianToCartographic(r,cartographicScratch0),o=c.cartesianToCartographic(n,cartographicScratch1),C.setEndPoints(a,o),y=C.findIntersectionWithLongitude(v,cartographicIntersectionScratch),!defined(_=c.cartographicToCartesian(y,intersectionScratch))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||S.push(Cartesian3.clone(_)))),S.push(n);l&&(r=f[g-1],n=f[0],!defined(_=IntersectionTests.lineSegmentPlane(r,n,XZ_PLANE,intersectionScratch))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||(e.arcType===ArcType$1.GEODESIC?S.push(Cartesian3.clone(_)):e.arcType===ArcType$1.RHUMB&&(v=c.cartesianToCartographic(_,cartographicScratch0).longitude,a=c.cartesianToCartographic(r,cartographicScratch0),o=c.cartesianToCartographic(n,cartographicScratch1),C.setEndPoints(a,o),y=C.findIntersectionWithLongitude(v,cartographicIntersectionScratch),!defined(_=c.cartographicToCartesian(y,intersectionScratch))||Cartesian3.equalsEpsilon(_,r,CesiumMath.EPSILON7)||Cartesian3.equalsEpsilon(_,n,CesiumMath.EPSILON7)||S.push(Cartesian3.clone(_)))));var x=S.length,T=new Array(x);for(i=0;i<x;i++){var b=Cartographic.fromCartesian(S[i],c);b.height=0,T[i]=b}if(!((x=(T=arrayRemoveDuplicates(T,Cartographic.equalsEpsilon)).length)<2)){var E=[],P=[],A=[],w=[],D=previousBottomScratch,M=vertexBottomScratch,I=vertexTopScratch,R=nextBottomScratch,O=vertexNormalScratch,L=T[0],F=T[1];for(D=getPosition(c,T[x-1],p,D),R=getPosition(c,F,p,R),M=getPosition(c,L,p,M),I=getPosition(c,L,m,I),O=l?computeVertexMiterNormal(D,M,I,R,O):computeRightNormal(L,F,m,c,O),Cartesian3.pack(O,P,0),Cartesian3.pack(M,A,0),Cartesian3.pack(I,w,0),E.push(L.latitude),E.push(L.longitude),interpolateSegment(L,F,p,m,u,d,c,P,A,w,E),i=1;i<x-1;++i){D=Cartesian3.clone(M,D),M=Cartesian3.clone(R,M);var N=T[i];getPosition(c,N,m,I),getPosition(c,T[i+1],p,R),computeVertexMiterNormal(D,M,I,R,O),t=P.length,Cartesian3.pack(O,P,t),Cartesian3.pack(M,A,t),Cartesian3.pack(I,w,t),E.push(N.latitude),E.push(N.longitude),interpolateSegment(T[i],T[i+1],p,m,u,d,c,P,A,w,E)}var B=T[x-1],V=T[x-2];if(M=getPosition(c,B,p,M),I=getPosition(c,B,m,I),l){var k=T[0];O=computeVertexMiterNormal(D=getPosition(c,V,p,D),M,I,R=getPosition(c,k,p,R),O)}else O=computeRightNormal(V,B,m,c,O);if(t=P.length,Cartesian3.pack(O,P,t),Cartesian3.pack(M,A,t),Cartesian3.pack(I,w,t),E.push(B.latitude),E.push(B.longitude),l){for(interpolateSegment(B,L,p,m,u,d,c,P,A,w,E),t=P.length,i=0;i<3;++i)P[t+i]=P[i],A[t+i]=A[i],w[t+i]=w[i];E.push(L.latitude),E.push(L.longitude)}return generateGeometryAttributes(l,h,A,w,P,E,s)}};var lineDirectionScratch=new Cartesian3,matrix3Scratch=new Matrix3,quaternionScratch$2=new Quaternion;function breakMiter(e,t,i,r){var n=direction(i,t,lineDirectionScratch),a=Cartesian3.dot(n,e);if(MITER_BREAK_SMALL<a||a<MITER_BREAK_LARGE){var o=direction(r,i,vertexUpScratch),s=a<MITER_BREAK_LARGE?CesiumMath.PI_OVER_TWO:-CesiumMath.PI_OVER_TWO,l=Quaternion.fromAxisAngle(o,s,quaternionScratch$2),c=Matrix3.fromQuaternion(l,matrix3Scratch);return Matrix3.multiplyByVector(c,e,e),!0}return!1}var endPosCartographicScratch=new Cartographic,normalStartpointScratch=new Cartesian3,normalEndpointScratch=new Cartesian3;function projectNormal(e,t,i,r,n){var a=Cartographic.toCartesian(t,e._ellipsoid,normalStartpointScratch),o=Cartesian3.add(a,i,normalEndpointScratch),s=!1,l=e._ellipsoid,c=l.cartesianToCartographic(o,endPosCartographicScratch);Math.abs(t.longitude-c.longitude)>CesiumMath.PI_OVER_TWO&&(s=!0,o=Cartesian3.subtract(a,i,normalEndpointScratch),c=l.cartesianToCartographic(o,endPosCartographicScratch)),c.height=0;var u=e.project(c,n);return(n=Cartesian3.subtract(u,r,n)).z=0,n=Cartesian3.normalize(n,n),s&&Cartesian3.negate(n,n),n}var adjustHeightNormalScratch=new Cartesian3,adjustHeightOffsetScratch=new Cartesian3;function adjustHeights(e,t,i,r,n,a){var o=Cartesian3.subtract(t,e,adjustHeightNormalScratch);Cartesian3.normalize(o,o);var s=i-WALL_INITIAL_MIN_HEIGHT,l=Cartesian3.multiplyByScalar(o,s,adjustHeightOffsetScratch);Cartesian3.add(e,l,n);var c=r-WALL_INITIAL_MAX_HEIGHT;l=Cartesian3.multiplyByScalar(o,c,adjustHeightOffsetScratch),Cartesian3.add(t,l,a)}var nudgeDirectionScratch=new Cartesian3;function nudgeXZ(e,t){var i=Plane.getPointDistance(XZ_PLANE,e),r=Plane.getPointDistance(XZ_PLANE,t),n=nudgeDirectionScratch;CesiumMath.equalsEpsilon(i,0,CesiumMath.EPSILON2)?(n=direction(t,e,n),Cartesian3.multiplyByScalar(n,CesiumMath.EPSILON2,n),Cartesian3.add(e,n,e)):CesiumMath.equalsEpsilon(r,0,CesiumMath.EPSILON2)&&(n=direction(e,t,n),Cartesian3.multiplyByScalar(n,CesiumMath.EPSILON2,n),Cartesian3.add(t,n,t))}function nudgeCartographic(e,t){var i=Math.abs(e.longitude),r=Math.abs(t.longitude);if(CesiumMath.equalsEpsilon(i,CesiumMath.PI,CesiumMath.EPSILON11)){var n=CesiumMath.sign(t.longitude);return e.longitude=n*(i-CesiumMath.EPSILON11),1}if(CesiumMath.equalsEpsilon(r,CesiumMath.PI,CesiumMath.EPSILON11)){var a=CesiumMath.sign(e.longitude);return t.longitude=a*(r-CesiumMath.EPSILON11),2}return 0}var startCartographicScratch=new Cartographic,endCartographicScratch=new Cartographic,segmentStartTopScratch=new Cartesian3,segmentEndTopScratch=new Cartesian3,segmentStartBottomScratch=new Cartesian3,segmentEndBottomScratch=new Cartesian3,segmentStartNormalScratch=new Cartesian3,segmentEndNormalScratch=new Cartesian3,getHeightCartographics=[startCartographicScratch,endCartographicScratch],getHeightRectangleScratch=new Rectangle,adjustHeightStartTopScratch=new Cartesian3,adjustHeightEndTopScratch=new Cartesian3,adjustHeightStartBottomScratch=new Cartesian3,adjustHeightEndBottomScratch=new Cartesian3,segmentStart2DScratch=new Cartesian3,segmentEnd2DScratch=new Cartesian3,segmentStartNormal2DScratch=new Cartesian3,segmentEndNormal2DScratch=new Cartesian3,offsetScratch$1=new Cartesian3,startUpScratch=new Cartesian3,endUpScratch=new Cartesian3,rightScratch$1=new Cartesian3,startPlaneNormalScratch=new Cartesian3,endPlaneNormalScratch=new Cartesian3,encodeScratch=new EncodedCartesian3,encodeScratch2D=new EncodedCartesian3,forwardOffset2DScratch=new Cartesian3,right2DScratch=new Cartesian3,normalNudgeScratch=new Cartesian3,scratchBoundingSpheres=[new BoundingSphere,new BoundingSphere],REFERENCE_INDICES=[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],REFERENCE_INDICES_LENGTH=REFERENCE_INDICES.length;function generateGeometryAttributes(e,t,i,r,n,a,o){var s,l,c,u,d,h,p=t._ellipsoid,m=i.length/3-1,f=8*m,g=4*f,_=36*m,y=65535<f?new Uint32Array(_):new Uint16Array(_),v=new Float64Array(3*f),C=new Float32Array(g),S=new Float32Array(g),x=new Float32Array(g),T=new Float32Array(g),b=new Float32Array(g);o&&(c=new Float32Array(g),u=new Float32Array(g),d=new Float32Array(g),h=new Float32Array(2*f));var E=a.length/2,P=0,A=startCartographicScratch;A.height=0;var w=endCartographicScratch;w.height=0;var D=segmentStartTopScratch,M=segmentEndTopScratch;if(o)for(l=0,s=1;s<E;s++)A.latitude=a[l],A.longitude=a[l+1],w.latitude=a[l+2],w.longitude=a[l+3],D=t.project(A,D),M=t.project(w,M),P+=Cartesian3.distance(D,M),l+=2;var I=r.length/3;M=Cartesian3.unpack(r,0,M);var R,O=0;for(l=3,s=1;s<I;s++)D=Cartesian3.clone(M,D),M=Cartesian3.unpack(r,l,M),O+=Cartesian3.distance(D,M),l+=3;var L=0,F=0,N=0,B=0,V=!(l=3),k=Cartesian3.unpack(i,0,segmentEndBottomScratch),$=Cartesian3.unpack(r,0,segmentEndTopScratch),z=Cartesian3.unpack(n,0,segmentEndNormalScratch);e&&breakMiter(z,Cartesian3.unpack(i,i.length-6,segmentStartBottomScratch),k,$)&&(z=Cartesian3.negate(z,z));var U=0,G=0,H=0;for(s=0;s<m;s++){var W,q,j,Y,X=Cartesian3.clone(k,segmentStartBottomScratch),Q=Cartesian3.clone($,segmentStartTopScratch),J=Cartesian3.clone(z,segmentStartNormalScratch);if(V&&(J=Cartesian3.negate(J,J)),k=Cartesian3.unpack(i,l,segmentEndBottomScratch),$=Cartesian3.unpack(r,l,segmentEndTopScratch),V=breakMiter(z=Cartesian3.unpack(n,l,segmentEndNormalScratch),X,k,$),A.latitude=a[L],A.longitude=a[L+1],w.latitude=a[L+2],w.longitude=a[L+3],o){var Z=nudgeCartographic(A,w);W=t.project(A,segmentStart2DScratch);var K=direction(q=t.project(w,segmentEnd2DScratch),W,forwardOffset2DScratch);K.y=Math.abs(K.y),j=segmentStartNormal2DScratch,Y=segmentEndNormal2DScratch,0===Z||Cartesian3.dot(K,Cartesian3.UNIT_Y)>MITER_BREAK_SMALL?(j=projectNormal(t,A,J,W,segmentStartNormal2DScratch),Y=projectNormal(t,w,z,q,segmentEndNormal2DScratch)):1===Z?(Y=projectNormal(t,w,z,q,segmentEndNormal2DScratch),j.x=0,j.y=CesiumMath.sign(A.longitude-Math.abs(w.longitude)),j.z=0):(j=projectNormal(t,A,J,W,segmentStartNormal2DScratch),Y.x=0,Y.y=CesiumMath.sign(A.longitude-w.longitude),Y.z=0)}var ee=Cartesian3.distance(Q,$),te=EncodedCartesian3.fromCartesian(X,encodeScratch),ie=Cartesian3.subtract(k,X,offsetScratch$1),re=Cartesian3.normalize(ie,rightScratch$1),ne=Cartesian3.subtract(Q,X,startUpScratch);ne=Cartesian3.normalize(ne,ne);var ae=Cartesian3.cross(re,ne,rightScratch$1);ae=Cartesian3.normalize(ae,ae);var oe=Cartesian3.cross(ne,J,startPlaneNormalScratch);oe=Cartesian3.normalize(oe,oe);var se=Cartesian3.subtract($,k,endUpScratch);se=Cartesian3.normalize(se,se);var le=Cartesian3.cross(z,se,endPlaneNormalScratch);le=Cartesian3.normalize(le,le);var ce,ue,de,he=ee/O,pe=U/O,me=0,fe=0,ge=0;if(o){me=Cartesian3.distance(W,q),ce=EncodedCartesian3.fromCartesian(W,encodeScratch2D),ue=Cartesian3.subtract(q,W,forwardOffset2DScratch);var _e=(de=Cartesian3.normalize(ue,right2DScratch)).x;de.x=de.y,de.y=-_e,fe=me/P,ge=G/P}for(R=0;R<8;R++){var ye=B+4*R,ve=F+2*R,Ce=ye+3,Se=R<4?1:-1,xe=2===R||3===R||6===R||7===R?1:-1;Cartesian3.pack(te.high,C,ye),C[Ce]=ie.x,Cartesian3.pack(te.low,S,ye),S[Ce]=ie.y,Cartesian3.pack(oe,x,ye),x[Ce]=ie.z,Cartesian3.pack(le,T,ye),T[Ce]=he*Se,Cartesian3.pack(ae,b,ye);var Te=pe*xe;0===Te&&xe<0&&(Te=9),b[Ce]=Te,o&&(c[ye]=ce.high.x,c[ye+1]=ce.high.y,c[ye+2]=ce.low.x,c[ye+3]=ce.low.y,d[ye]=-j.y,d[ye+1]=j.x,d[ye+2]=Y.y,d[ye+3]=-Y.x,u[ye]=ue.x,u[ye+1]=ue.y,u[ye+2]=de.x,u[ye+3]=de.y,h[ve]=fe*Se,0===(Te=ge*xe)&&xe<0&&(Te=9),h[ve+1]=Te)}var be=adjustHeightStartBottomScratch,Ee=adjustHeightEndBottomScratch,Pe=adjustHeightStartTopScratch,Ae=adjustHeightEndTopScratch,we=Rectangle.fromCartographicArray(getHeightCartographics,getHeightRectangleScratch),De=ApproximateTerrainHeights.getMinimumMaximumHeights(we,p),Me=De.minimumTerrainHeight,Ie=De.maximumTerrainHeight;H+=Me,H+=Ie,adjustHeights(X,Q,Me,Ie,be,Pe),adjustHeights(k,$,Me,Ie,Ee,Ae);var Re=Cartesian3.multiplyByScalar(ae,CesiumMath.EPSILON5,normalNudgeScratch);Cartesian3.add(be,Re,be),Cartesian3.add(Ee,Re,Ee),Cartesian3.add(Pe,Re,Pe),Cartesian3.add(Ae,Re,Ae),nudgeXZ(be,Ee),nudgeXZ(Pe,Ae),Cartesian3.pack(be,v,N),Cartesian3.pack(Ee,v,N+3),Cartesian3.pack(Ae,v,N+6),Cartesian3.pack(Pe,v,N+9),Re=Cartesian3.multiplyByScalar(ae,-2*CesiumMath.EPSILON5,normalNudgeScratch),Cartesian3.add(be,Re,be),Cartesian3.add(Ee,Re,Ee),Cartesian3.add(Pe,Re,Pe),Cartesian3.add(Ae,Re,Ae),nudgeXZ(be,Ee),nudgeXZ(Pe,Ae),Cartesian3.pack(be,v,N+12),Cartesian3.pack(Ee,v,N+15),Cartesian3.pack(Ae,v,N+18),Cartesian3.pack(Pe,v,N+21),L+=2,l+=3,F+=16,N+=24,B+=32,U+=ee,G+=me}var Oe=l=0;for(s=0;s<m;s++){for(R=0;R<REFERENCE_INDICES_LENGTH;R++)y[l+R]=REFERENCE_INDICES[R]+Oe;Oe+=8,l+=REFERENCE_INDICES_LENGTH}var Le=scratchBoundingSpheres;BoundingSphere.fromVertices(i,Cartesian3.ZERO,3,Le[0]),BoundingSphere.fromVertices(r,Cartesian3.ZERO,3,Le[1]);var Fe=BoundingSphere.fromBoundingSpheres(Le);Fe.radius+=H/(2*m);var Ne={position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,normalize:!1,values:v}),startHiAndForwardOffsetX:getVec4GeometryAttribute(C),startLoAndForwardOffsetY:getVec4GeometryAttribute(S),startNormalAndForwardOffsetZ:getVec4GeometryAttribute(x),endNormalAndTextureCoordinateNormalizationX:getVec4GeometryAttribute(T),rightNormalAndTextureCoordinateNormalizationY:getVec4GeometryAttribute(b)};return o&&(Ne.startHiLo2D=getVec4GeometryAttribute(c),Ne.offsetAndRight2D=getVec4GeometryAttribute(u),Ne.startEndNormals2D=getVec4GeometryAttribute(d),Ne.texcoordNormalization2D=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,normalize:!1,values:h})),new Geometry({attributes:Ne,indices:y,boundingSphere:Fe})}function getVec4GeometryAttribute(e){return new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}function HeadingPitchRange(e,t,i){this.heading=defaultValue(e,0),this.pitch=defaultValue(t,0),this.range=defaultValue(i,0)}GroundPolylineGeometry._projectNormal=projectNormal,HeadingPitchRange.clone=function(e,t){if(defined(e))return defined(t)||(t=new HeadingPitchRange),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};var factorial=CesiumMath.factorial;function calculateCoefficientTerm(e,t,i,r,n,a){var o,s,l,c=0;if(0<r){for(s=0;s<n;s++){for(o=!1,l=0;l<a.length&&!o;l++)s===a[l]&&(o=!0);o||(a.push(s),c+=calculateCoefficientTerm(e,t,i,r-1,n,a),a.splice(a.length-1,1))}return c}for(c=1,s=0;s<n;s++){for(o=!1,l=0;l<a.length&&!o;l++)s===a[l]&&(o=!0);o||(c*=e-i[t[s]])}return c}var HermitePolynomialApproximation={type:"Hermite",getRequiredDataPoints:function(e,t){return t=defaultValue(t,0),Math.max(Math.floor((e+1)/(t+1)),2)},interpolateOrderZero:function(e,t,i,r,n){var a,o,s,l,c;defined(n)||(n=new Array(r));var u=t.length,d=new Array(r);for(a=0;a<r;a++){n[a]=0;var h=new Array(u);for(d[a]=h,o=0;o<u;o++)h[o]=[]}var p=u,m=new Array(p);for(a=0;a<p;a++)m[a]=a;var f=u-1;for(l=0;l<r;l++){for(o=0;o<p;o++)c=m[o]*r+l,d[l][0].push(i[c]);for(a=1;a<p;a++){var g=!1;for(o=0;o<p-a;o++){var _,y=t[m[o]],v=t[m[o+a]];v-y<=0?(_=i[c=m[o]*r+r*a+l],d[l][a].push(_/factorial(a))):(_=d[l][a-1][o+1]-d[l][a-1][o],d[l][a].push(_/(v-y))),g=g||0!==_}g||(f=a-1)}}for(s=0;s<=0;s++)for(a=s;a<=f;a++){var C=calculateCoefficientTerm(e,m,t,s,a,[]);for(l=0;l<r;l++){var S=d[l][a][0];n[l+s*r]+=S*C}}return n}},arrayScratch$1=[];function fillCoefficientList(e,t,i,r,n,a){for(var o,s,l=-1,c=t.length,u=c*(c+1)/2,d=0;d<n;d++){var h=Math.floor(d*u);for(o=0;o<c;o++)s=t[o]*n*(a+1)+d,e[h+o]=r[s];for(var p=1;p<c;p++){var m=0,f=Math.floor(p*(1-p)/2)+c*p,g=!1;for(o=0;o<c-p;o++){var _,y,v=i[t[o]],C=i[t[o+p]];if(C-v<=0)y=(_=r[s=t[o]*n*(a+1)+n*p+d])/CesiumMath.factorial(p),e[h+f+m]=y,m++;else{var S=Math.floor((p-1)*(2-p)/2)+c*(p-1);y=(_=e[h+S+o+1]-e[h+S+o])/(C-v),e[h+f+m]=y,m++}g=g||0!==_}g&&(l=Math.max(l,p))}}return l}function IauOrientationParameters(e,t,i,r){this.rightAscension=e,this.declination=t,this.rotation=i,this.rotationRate=r}HermitePolynomialApproximation.interpolate=function(e,t,i,r,n,a,o){var s=r*(a+1);defined(o)||(o=new Array(s));for(var l=0;l<s;l++)o[l]=0;var c,u=t.length,d=new Array(u*(n+1));for(c=0;c<u;c++)for(var h=0;h<n+1;h++)d[c*(n+1)+h]=c;for(var p=d.length,m=arrayScratch$1,f=fillCoefficientList(m,d,t,i,r,n),g=[],_=p*(p+1)/2,y=Math.min(f,a),v=0;v<=y;v++)for(c=v;c<=f;c++){g.length=0;for(var C=calculateCoefficientTerm(e,d,t,v,c,g),S=Math.floor(c*(1-c)/2)+p*c,x=0;x<r;x++){var T=m[Math.floor(x*_)+S];o[x+v*r]+=T*C}}return o};var Iau2000Orientation={},TdtMinusTai=32.184,J2000d=2451545,c1=-.0529921,c2=-.1059842,c3$1=13.0120009,c4=13.3407154,c5=.9856003,c6=26.4057084,c7=13.064993,c8=.3287146,c9=1.7484877,c10=-.1589763,c11=.0036096,c12=.1643573,c13=12.9590088,dateTT=new JulianDate;function IauOrientationAxes(e){defined(e)&&"function"==typeof e||(e=Iau2000Orientation.ComputeMoon),this._computeFunction=e}Iau2000Orientation.ComputeMoon=function(e,t){defined(e)||(e=JulianDate.now()),dateTT=JulianDate.addSeconds(e,TdtMinusTai,dateTT);var i=JulianDate.totalDays(dateTT)-J2000d,r=i/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,n=(125.045+c1*i)*CesiumMath.RADIANS_PER_DEGREE,a=(250.089+c2*i)*CesiumMath.RADIANS_PER_DEGREE,o=(260.008+c3$1*i)*CesiumMath.RADIANS_PER_DEGREE,s=(176.625+c4*i)*CesiumMath.RADIANS_PER_DEGREE,l=(357.529+c5*i)*CesiumMath.RADIANS_PER_DEGREE,c=(311.589+c6*i)*CesiumMath.RADIANS_PER_DEGREE,u=(134.963+c7*i)*CesiumMath.RADIANS_PER_DEGREE,d=(276.617+c8*i)*CesiumMath.RADIANS_PER_DEGREE,h=(34.226+c9*i)*CesiumMath.RADIANS_PER_DEGREE,p=(15.134+c10*i)*CesiumMath.RADIANS_PER_DEGREE,m=(119.743+c11*i)*CesiumMath.RADIANS_PER_DEGREE,f=(239.961+c12*i)*CesiumMath.RADIANS_PER_DEGREE,g=(25.053+c13*i)*CesiumMath.RADIANS_PER_DEGREE,_=Math.sin(n),y=Math.sin(a),v=Math.sin(o),C=Math.sin(s),S=Math.sin(l),x=Math.sin(c),T=Math.sin(u),b=Math.sin(d),E=Math.sin(h),P=Math.sin(p),A=Math.sin(m),w=Math.sin(f),D=Math.sin(g),M=Math.cos(n),I=Math.cos(a),R=Math.cos(o),O=Math.cos(s),L=Math.cos(l),F=Math.cos(c),N=Math.cos(u),B=Math.cos(d),V=Math.cos(h),k=Math.cos(p),$=Math.cos(m),z=Math.cos(f),U=Math.cos(g),G=(269.9949+.0031*r-3.8787*_-.1204*y+.07*v-.0172*C+.0072*x-.0052*P+.0043*D)*CesiumMath.RADIANS_PER_DEGREE,H=(66.5392+.013*r+1.5419*M+.0239*I-.0278*R+.0068*O-.0029*F+9e-4*N+8e-4*k-9e-4*U)*CesiumMath.RADIANS_PER_DEGREE,W=(38.3213+13.17635815*i-14e-13*i*i+3.561*_+.1208*y-.0642*v+.0158*C+.0252*S-.0066*x-.0047*T-.0046*b+.0028*E+.0052*P+.004*A+.0019*w-.0044*D)*CesiumMath.RADIANS_PER_DEGREE,q=(13.17635815-2*i*14e-13+3.561*M*c1+.1208*I*c2-.0642*R*c3$1+.0158*O*c4+.0252*L*c5-.0066*F*c6-.0047*N*c7-.0046*B*c8+.0028*V*c9+.0052*k*c10+.004*$*c11+.0019*z*c12-.0044*U*c13)/86400*CesiumMath.RADIANS_PER_DEGREE;return defined(t)||(t=new IauOrientationParameters),t.rightAscension=G,t.declination=H,t.rotation=W,t.rotationRate=q,t};var xAxisScratch=new Cartesian3,yAxisScratch=new Cartesian3,zAxisScratch=new Cartesian3;function computeRotationMatrix(e,t,i){var r=xAxisScratch;r.x=Math.cos(e+CesiumMath.PI_OVER_TWO),r.y=Math.sin(e+CesiumMath.PI_OVER_TWO),r.z=0;var n=Math.cos(t),a=zAxisScratch;a.x=n*Math.cos(e),a.y=n*Math.sin(e),a.z=Math.sin(t);var o=Cartesian3.cross(a,r,yAxisScratch);return defined(i)||(i=new Matrix3),i[0]=r.x,i[1]=o.x,i[2]=a.x,i[3]=r.y,i[4]=o.y,i[5]=a.y,i[6]=r.z,i[7]=o.z,i[8]=a.z,i}var rotMtxScratch=new Matrix3,quatScratch=new Quaternion;IauOrientationAxes.prototype.evaluate=function(e,t){defined(e)||(e=JulianDate.now());var i=this._computeFunction(e),r=computeRotationMatrix(i.rightAscension,i.declination,t),n=CesiumMath.zeroToTwoPi(i.rotation),a=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,n,quatScratch),o=Matrix3.fromQuaternion(Quaternion.conjugate(a,a),rotMtxScratch);return Matrix3.multiply(o,r,r)};var InterpolationAlgorithm={};function PeliasGeocoderService(e){this._url=Resource.createIfNeeded(e),this._url.appendForwardSlash()}function IonGeocoderService(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).accessToken,Ion.defaultAccessToken),i=Resource.createIfNeeded(defaultValue(e.server,Ion.defaultServer));i.appendForwardSlash();var r=Ion.getDefaultTokenCredit(t);defined(r)&&e.scene.frameState.creditDisplay.addDefaultCredit(Credit.clone(r));var n=i.getDerivedResource({url:"v1/geocode"});defined(t)&&n.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=i,this._pelias=new PeliasGeocoderService(n)}function TimeInterval(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.start=defined(e.start)?JulianDate.clone(e.start):new JulianDate,this.stop=defined(e.stop)?JulianDate.clone(e.stop):new JulianDate,this.data=e.data,this.isStartIncluded=defaultValue(e.isStartIncluded,!0),this.isStopIncluded=defaultValue(e.isStopIncluded,!0)}InterpolationAlgorithm.type=void 0,InterpolationAlgorithm.getRequiredDataPoints=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolateOrderZero=DeveloperError.throwInstantiationError,InterpolationAlgorithm.interpolate=DeveloperError.throwInstantiationError,defineProperties$1(PeliasGeocoderService.prototype,{url:{get:function(){return this._url}}}),PeliasGeocoderService.prototype.geocode=function(e,t){return this._url.getDerivedResource({url:t===GeocodeType$1.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(e){return e.features.map(function(e){var t,i=e.bbox;if(defined(i))t=Rectangle.fromDegrees(i[0],i[1],i[2],i[3]);else{var r=e.geometry.coordinates[0],n=e.geometry.coordinates[1];t=Cartesian3.fromDegrees(r,n)}return{displayName:e.properties.label,destination:t}})})},IonGeocoderService.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)},defineProperties$1(TimeInterval.prototype,{isEmpty:{get:function(){var e=JulianDate.compare(this.stop,this.start);return e<0||0===e&&(!this.isStartIncluded||!this.isStopIncluded)}}});var scratchInterval={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};TimeInterval.fromIso8601=function(e,t){var i=e.iso8601.split("/");if(2!==i.length)throw new DeveloperError("options.iso8601 is an invalid ISO 8601 interval.");var r=JulianDate.fromIso8601(i[0]),n=JulianDate.fromIso8601(i[1]),a=defaultValue(e.isStartIncluded,!0),o=defaultValue(e.isStopIncluded,!0),s=e.data;return defined(t)?(t.start=r,t.stop=n,t.isStartIncluded=a,t.isStopIncluded=o,t.data=s,t):(scratchInterval.start=r,scratchInterval.stop=n,scratchInterval.isStartIncluded=a,scratchInterval.isStopIncluded=o,scratchInterval.data=s,new TimeInterval(scratchInterval))},TimeInterval.toIso8601=function(e,t){return JulianDate.toIso8601(e.start,t)+"/"+JulianDate.toIso8601(e.stop,t)},TimeInterval.clone=function(e,t){if(defined(e))return defined(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new TimeInterval(e)},TimeInterval.equals=function(e,t,i){return e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equals(e.start,t.start)&&JulianDate.equals(e.stop,t.stop)&&(e.data===t.data||defined(i)&&i(e.data,t.data)))},TimeInterval.equalsEpsilon=function(e,t,i,r){return e===t||defined(e)&&defined(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&JulianDate.equalsEpsilon(e.start,t.start,i)&&JulianDate.equalsEpsilon(e.stop,t.stop,i)&&(e.data===t.data||defined(r)&&r(e.data,t.data)))},TimeInterval.intersect=function(e,t,i,r){if(!defined(t))return TimeInterval.clone(TimeInterval.EMPTY,i);var n=e.start,a=e.stop,o=t.start,s=t.stop,l=JulianDate.greaterThanOrEquals(o,n)&&JulianDate.greaterThanOrEquals(a,o),c=!l&&JulianDate.lessThanOrEquals(o,n)&&JulianDate.lessThanOrEquals(n,s);if(!l&&!c)return TimeInterval.clone(TimeInterval.EMPTY,i);var u=e.isStartIncluded,d=e.isStopIncluded,h=t.isStartIncluded,p=t.isStopIncluded,m=JulianDate.lessThan(a,s);return i.start=l?o:n,i.isStartIncluded=u&&h||!JulianDate.equals(o,n)&&(l&&h||c&&u),i.stop=m?a:s,i.isStopIncluded=m?d:d&&p||!JulianDate.equals(s,a)&&p,i.data=defined(r)?r(e.data,t.data):e.data,i},TimeInterval.contains=function(e,t){if(e.isEmpty)return!1;var i=JulianDate.compare(e.start,t);if(0===i)return e.isStartIncluded;var r=JulianDate.compare(t,e.stop);return 0===r?e.isStopIncluded:i<0&&r<0},TimeInterval.prototype.clone=function(e){return TimeInterval.clone(this,e)},TimeInterval.prototype.equals=function(e,t){return TimeInterval.equals(this,e,t)},TimeInterval.prototype.equalsEpsilon=function(e,t,i){return TimeInterval.equalsEpsilon(this,e,t,i)},TimeInterval.prototype.toString=function(){return TimeInterval.toIso8601(this)},TimeInterval.EMPTY=freezeObject$1(new TimeInterval({start:new JulianDate,stop:new JulianDate,isStartIncluded:!1,isStopIncluded:!1}));var MINIMUM_VALUE=freezeObject$1(JulianDate.fromIso8601("0000-01-01T00:00:00Z")),MAXIMUM_VALUE=freezeObject$1(JulianDate.fromIso8601("9999-12-31T24:00:00Z")),MAXIMUM_INTERVAL=freezeObject$1(new TimeInterval({start:MINIMUM_VALUE,stop:MAXIMUM_VALUE})),Iso8601={MINIMUM_VALUE:MINIMUM_VALUE,MAXIMUM_VALUE:MAXIMUM_VALUE,MAXIMUM_INTERVAL:MAXIMUM_INTERVAL},KeyboardEventModifier={SHIFT:0,CTRL:1,ALT:2},KeyboardEventModifier$1=freezeObject$1(KeyboardEventModifier),LagrangePolynomialApproximation={type:"Lagrange",getRequiredDataPoints:function(e){return Math.max(e+1,2)},interpolateOrderZero:function(e,t,i,r,n){var a,o;defined(n)||(n=new Array(r));var s=t.length;for(a=0;a<r;a++)n[a]=0;for(a=0;a<s;a++){var l=1;for(o=0;o<s;o++)if(o!==a){var c=t[a]-t[o];l*=(e-t[o])/c}for(o=0;o<r;o++)n[o]+=l*i[a*r+o]}return n}},LinearApproximation={type:"Linear",getRequiredDataPoints:function(e){return 2},interpolateOrderZero:function(e,t,i,r,n){var a,o,s;defined(n)||(n=new Array(r));var l=t[0],c=t[1];for(a=0;a<r;a++)o=i[a],s=i[a+r],n[a]=((s-o)*e+c*o-l*s)/(c-l);return n}},transcodeTaskProcessor=new TaskProcessor("transcodeCRNToDXT",Number.POSITIVE_INFINITY);function loadCRN(e){var t;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=when.resolve(e):t=Resource.createIfNeeded(e).fetchArrayBuffer();if(defined(t))return t.then(function(e){if(defined(e)){var t=[];return e instanceof ArrayBuffer?t.push(e):(0===e.byteOffset&&e.byteLength===e.buffer.byteLength||(e=e.slice(0,e.length)),t.push(e.buffer)),transcodeTaskProcessor.scheduleTask(e,t)}}).then(function(e){return CompressedTextureBuffer.clone(e)})}function loadImageFromTypedArray(e){var t,i=e.uint8Array,r=e.format,n=e.request,a=defaultValue(e.flipY,!1),o=new Blob([i],{type:r});return Resource.supportsImageBitmapOptions().then(function(e){return e?when(Resource.createImageBitmapFromBlob(o,{flipY:a,premultiplyAlpha:!1})):new Resource({url:t=window.URL.createObjectURL(o),request:n}).fetchImage({flipY:a})}).then(function(e){return defined(t)&&window.URL.revokeObjectURL(t),e}).otherwise(function(e){return defined(t)&&window.URL.revokeObjectURL(t),when.reject(e)})}var PixelDatatype={UNSIGNED_BYTE:WebGLConstants$1.UNSIGNED_BYTE,UNSIGNED_SHORT:WebGLConstants$1.UNSIGNED_SHORT,UNSIGNED_INT:WebGLConstants$1.UNSIGNED_INT,FLOAT:WebGLConstants$1.FLOAT,HALF_FLOAT:WebGLConstants$1.HALF_FLOAT_OES,UNSIGNED_INT_24_8:WebGLConstants$1.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:WebGLConstants$1.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:WebGLConstants$1.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:WebGLConstants$1.UNSIGNED_SHORT_5_6_5,isPacked:function(e){return e===PixelDatatype.UNSIGNED_INT_24_8||e===PixelDatatype.UNSIGNED_SHORT_4_4_4_4||e===PixelDatatype.UNSIGNED_SHORT_5_5_5_1||e===PixelDatatype.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(e){switch(e){case PixelDatatype.UNSIGNED_BYTE:return 1;case PixelDatatype.UNSIGNED_SHORT:case PixelDatatype.UNSIGNED_SHORT_4_4_4_4:case PixelDatatype.UNSIGNED_SHORT_5_5_5_1:case PixelDatatype.UNSIGNED_SHORT_5_6_5:case PixelDatatype.HALF_FLOAT:return 2;case PixelDatatype.UNSIGNED_INT:case PixelDatatype.FLOAT:case PixelDatatype.UNSIGNED_INT_24_8:return 4}},validate:function(e){return e===PixelDatatype.UNSIGNED_BYTE||e===PixelDatatype.UNSIGNED_SHORT||e===PixelDatatype.UNSIGNED_INT||e===PixelDatatype.FLOAT||e===PixelDatatype.HALF_FLOAT||e===PixelDatatype.UNSIGNED_INT_24_8||e===PixelDatatype.UNSIGNED_SHORT_4_4_4_4||e===PixelDatatype.UNSIGNED_SHORT_5_5_5_1||e===PixelDatatype.UNSIGNED_SHORT_5_6_5}},PixelDatatype$1=freezeObject$1(PixelDatatype),PixelFormat={DEPTH_COMPONENT:WebGLConstants$1.DEPTH_COMPONENT,DEPTH_STENCIL:WebGLConstants$1.DEPTH_STENCIL,ALPHA:WebGLConstants$1.ALPHA,RGB:WebGLConstants$1.RGB,RGBA:WebGLConstants$1.RGBA,LUMINANCE:WebGLConstants$1.LUMINANCE,LUMINANCE_ALPHA:WebGLConstants$1.LUMINANCE_ALPHA,RGB_DXT1:WebGLConstants$1.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:WebGLConstants$1.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:WebGLConstants$1.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:WebGLConstants$1.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:WebGLConstants$1.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:WebGLConstants$1.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:WebGLConstants$1.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:WebGLConstants$1.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGB_ETC1:WebGLConstants$1.COMPRESSED_RGB_ETC1_WEBGL,componentsLength:function(e){switch(e){case PixelFormat.RGB:return 3;case PixelFormat.RGBA:return 4;case PixelFormat.LUMINANCE_ALPHA:return 2;case PixelFormat.ALPHA:case PixelFormat.LUMINANCE:default:return 1}},validate:function(e){return e===PixelFormat.DEPTH_COMPONENT||e===PixelFormat.DEPTH_STENCIL||e===PixelFormat.ALPHA||e===PixelFormat.RGB||e===PixelFormat.RGBA||e===PixelFormat.LUMINANCE||e===PixelFormat.LUMINANCE_ALPHA||e===PixelFormat.RGB_DXT1||e===PixelFormat.RGBA_DXT1||e===PixelFormat.RGBA_DXT3||e===PixelFormat.RGBA_DXT5||e===PixelFormat.RGB_PVRTC_4BPPV1||e===PixelFormat.RGB_PVRTC_2BPPV1||e===PixelFormat.RGBA_PVRTC_4BPPV1||e===PixelFormat.RGBA_PVRTC_2BPPV1||e===PixelFormat.RGB_ETC1},isColorFormat:function(e){return e===PixelFormat.ALPHA||e===PixelFormat.RGB||e===PixelFormat.RGBA||e===PixelFormat.LUMINANCE||e===PixelFormat.LUMINANCE_ALPHA},isDepthFormat:function(e){return e===PixelFormat.DEPTH_COMPONENT||e===PixelFormat.DEPTH_STENCIL},isCompressedFormat:function(e){return e===PixelFormat.RGB_DXT1||e===PixelFormat.RGBA_DXT1||e===PixelFormat.RGBA_DXT3||e===PixelFormat.RGBA_DXT5||e===PixelFormat.RGB_PVRTC_4BPPV1||e===PixelFormat.RGB_PVRTC_2BPPV1||e===PixelFormat.RGBA_PVRTC_4BPPV1||e===PixelFormat.RGBA_PVRTC_2BPPV1||e===PixelFormat.RGB_ETC1},isDXTFormat:function(e){return e===PixelFormat.RGB_DXT1||e===PixelFormat.RGBA_DXT1||e===PixelFormat.RGBA_DXT3||e===PixelFormat.RGBA_DXT5},isPVRTCFormat:function(e){return e===PixelFormat.RGB_PVRTC_4BPPV1||e===PixelFormat.RGB_PVRTC_2BPPV1||e===PixelFormat.RGBA_PVRTC_4BPPV1||e===PixelFormat.RGBA_PVRTC_2BPPV1},isETC1Format:function(e){return e===PixelFormat.RGB_ETC1},compressedTextureSizeInBytes:function(e,t,i){switch(e){case PixelFormat.RGB_DXT1:case PixelFormat.RGBA_DXT1:case PixelFormat.RGB_ETC1:return Math.floor((t+3)/4)*Math.floor((i+3)/4)*8;case PixelFormat.RGBA_DXT3:case PixelFormat.RGBA_DXT5:return Math.floor((t+3)/4)*Math.floor((i+3)/4)*16;case PixelFormat.RGB_PVRTC_4BPPV1:case PixelFormat.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(i,8)*4+7)/8);case PixelFormat.RGB_PVRTC_2BPPV1:case PixelFormat.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(i,8)*2+7)/8);default:return 0}},textureSizeInBytes:function(e,t,i,r){var n=PixelFormat.componentsLength(e);return PixelDatatype$1.isPacked(t)&&(n=1),n*PixelDatatype$1.sizeInBytes(t)*i*r},alignmentInBytes:function(e,t,i){var r=PixelFormat.textureSizeInBytes(e,t,i,1)%4;return 0==r?4:2==r?2:1},createTypedArray:function(e,t,i,r){var n=PixelDatatype$1.sizeInBytes(t);return new(n===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:n===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:n===Float32Array.BYTES_PER_ELEMENT&&t===PixelDatatype$1.FLOAT?Float32Array:Uint32Array)(PixelFormat.componentsLength(e)*i*r)},flipY:function(e,t,i,r,n){if(1===n)return e;for(var a=PixelFormat.createTypedArray(t,i,r,n),o=PixelFormat.componentsLength(t),s=r*o,l=0;l<n;++l)for(var c=l*n*o,u=(n-l-1)*n*o,d=0;d<s;++d)a[u+d]=e[c+d];return a}},PixelFormat$1=freezeObject$1(PixelFormat);function loadKTX(e){var t;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=when.resolve(e):t=Resource.createIfNeeded(e).fetchArrayBuffer();if(defined(t))return t.then(function(e){if(defined(e))return parseKTX(e)})}var fileIdentifier=[171,75,84,88,32,49,49,187,13,10,26,10],endiannessTest=67305985,faceOrder=["positiveX","negativeX","positiveY","negativeY","positiveZ","negativeZ"],sizeOfUint32$1=4;function parseKTX(e){var t,i,r,n=new Uint8Array(e),a=!0;for(t=0;t<fileIdentifier.length;++t)if(fileIdentifier[t]!==n[t]){a=!1;break}if(!a)throw new RuntimeError("Invalid KTX file.");r=defined(e.buffer)?(i=new DataView(e.buffer),e.byteOffset):(i=new DataView(e),0),r+=12;var o=i.getUint32(r,!0);if(r+=sizeOfUint32$1,o!==endiannessTest)throw new RuntimeError("File is the wrong endianness.");var s=i.getUint32(r,!0);r+=sizeOfUint32$1;var l=i.getUint32(r,!0);r+=sizeOfUint32$1;var c=i.getUint32(r,!0);r+=sizeOfUint32$1;var u=i.getUint32(r,!0);r+=sizeOfUint32$1;var d=i.getUint32(r,!0);r+=sizeOfUint32$1;var h=i.getUint32(r,!0);r+=sizeOfUint32$1;var p=i.getUint32(r,!0);r+=sizeOfUint32$1;var m=i.getUint32(r,!0);r+=sizeOfUint32$1;var f=i.getUint32(r,!0);r+=sizeOfUint32$1;var g=i.getUint32(r,!0);r+=sizeOfUint32$1;var _=i.getUint32(r,!0);r+=sizeOfUint32$1;var y=i.getUint32(r,!0);r+=sizeOfUint32$1,r+=y;var v,C=i.getUint32(r,!0);if(r+=sizeOfUint32$1,v=defined(e.buffer)?new Uint8Array(e.buffer,r,C):new Uint8Array(e,r,C),u===WebGLConstants$1.RGB8?u=PixelFormat$1.RGB:u===WebGLConstants$1.RGBA8&&(u=PixelFormat$1.RGBA),!PixelFormat$1.validate(u))throw new RuntimeError("glInternalFormat is not a valid format.");if(PixelFormat$1.isCompressedFormat(u)){if(0!==s)throw new RuntimeError("glType must be zero when the texture is compressed.");if(1!==l)throw new RuntimeError("The type size for compressed textures must be 1.");if(0!==c)throw new RuntimeError("glFormat must be zero when the texture is compressed.")}else{if(s!==WebGLConstants$1.UNSIGNED_BYTE)throw new RuntimeError("Only unsigned byte buffers are supported.");if(d!==c)throw new RuntimeError("The base internal format must be the same as the format for uncompressed textures.")}if(0!==m)throw new RuntimeError("3D textures are unsupported.");if(0!==f)throw new RuntimeError("Texture arrays are unsupported.");var S=v.byteOffset,x=new Array(_);for(t=0;t<_;++t){for(var T=x[t]={},b=0;b<g;++b){var E=h>>t,P=p>>t,A=PixelFormat$1.isCompressedFormat(u)?PixelFormat$1.compressedTextureSizeInBytes(u,E,P):PixelFormat$1.textureSizeInBytes(u,s,E,P),w=new Uint8Array(v.buffer,S,A);T[faceOrder[b]]=new CompressedTextureBuffer(u,E,P,w),S+=A}S+=3-(S+3)%4+4}var D=x;if(1===g)for(t=0;t<_;++t)D[t]=D[t][faceOrder[0]];return 1===_&&(D=D[0]),D}function ManagedArray(e){e=defaultValue(e,0),this._array=new Array(e),this._length=e}defineProperties$1(ManagedArray.prototype,{length:{get:function(){return this._length},set:function(e){(this._length=e)>this._array.length&&(this._array.length=e)}},values:{get:function(){return this._array}}}),ManagedArray.prototype.get=function(e){return this._array[e]},ManagedArray.prototype.set=function(e,t){e>=this.length&&(this.length=e+1),this._array[e]=t},ManagedArray.prototype.peek=function(){return this._array[this._length-1]},ManagedArray.prototype.push=function(e){var t=this.length++;this._array[t]=e},ManagedArray.prototype.pop=function(){return this._array[--this.length]},ManagedArray.prototype.reserve=function(e){e>this._array.length&&(this._array.length=e)},ManagedArray.prototype.resize=function(e){this.length=e},ManagedArray.prototype.trim=function(e){e=defaultValue(e,this.length),this._array.length=e};var MapboxApi={defaultAccessToken:void 0},printedMapboxWarning=!1,errorCredit,errorString="<b>This application is using Cesium's default Mapbox access token.  Please create a new access token for the application as soon as possible and prior to deployment by visiting <a href=https://www.mapbox.com/account/apps/>https://www.mapbox.com/account/apps/</a>, and provide your token to Cesium by setting the Cesium.MapboxApi.defaultAccessToken property before constructing the CesiumWidget or any other object that uses the Mapbox API.</b>";function MapProjection(){DeveloperError.throwInstantiationError()}MapboxApi.getAccessToken=function(e){return defined(e)?e:defined(MapboxApi.defaultAccessToken)?MapboxApi.defaultAccessToken:(printedMapboxWarning||(console.log(errorString),printedMapboxWarning=!0),"pk.eyJ1IjoiYW5hbHl0aWNhbGdyYXBoaWNzIiwiYSI6ImNpd204Zm4wejAwNzYyeW5uNjYyZmFwdWEifQ.7i-VIZZWX8pd1bTfxIVj9g")},MapboxApi.getErrorCredit=function(e){if(!defined(e)&&!defined(MapboxApi.defaultAccessToken))return defined(errorCredit)||(errorCredit=new Credit(errorString,!0)),errorCredit},defineProperties$1(MapProjection.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError}}),MapProjection.prototype.project=DeveloperError.throwInstantiationError,MapProjection.prototype.unproject=DeveloperError.throwInstantiationError;var leftScratchArray=[],rightScratchArray=[];function merge(e,t,i,r,n,a){var o,s,l=n-r+1,c=a-n,u=leftScratchArray,d=rightScratchArray;for(o=0;o<l;++o)u[o]=e[r+o];for(s=0;s<c;++s)d[s]=e[n+s+1];s=o=0;for(var h=r;h<=a;++h){var p=u[o],m=d[s];o<l&&(c<=s||t(p,m,i)<=0)?(e[h]=p,++o):s<c&&(e[h]=m,++s)}}function sort(e,t,i,r,n){if(!(n<=r)){var a=Math.floor(.5*(r+n));sort(e,t,i,r,a),sort(e,t,i,a+1,n),merge(e,t,i,r,a,n)}}function mergeSort(e,t,i){var r=e.length,n=Math.ceil(.5*r);leftScratchArray.length=n,rightScratchArray.length=n,sort(e,t,i,0,r-1),leftScratchArray.length=0,rightScratchArray.length=0}function NearFarScalar(e,t,i,r){this.near=defaultValue(e,0),this.nearValue=defaultValue(t,0),this.far=defaultValue(i,1),this.farValue=defaultValue(r,0)}NearFarScalar.clone=function(e,t){if(defined(e))return defined(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new NearFarScalar(e.near,e.nearValue,e.far,e.farValue)},NearFarScalar.packedLength=4,NearFarScalar.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.near,t[i++]=e.nearValue,t[i++]=e.far,t[i]=e.farValue,t},NearFarScalar.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new NearFarScalar),i.near=e[t++],i.nearValue=e[t++],i.far=e[t++],i.farValue=e[t],i},NearFarScalar.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue},NearFarScalar.prototype.clone=function(e){return NearFarScalar.clone(this,e)},NearFarScalar.prototype.equals=function(e){return NearFarScalar.equals(this,e)};var Visibility={NONE:-1,PARTIAL:0,FULL:1},Visibility$1=freezeObject$1(Visibility);function Occluder(e,t){this._occluderPosition=Cartesian3.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}var scratchCartesian3$7=new Cartesian3;defineProperties$1(Occluder.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){e=Cartesian3.clone(e,this._cameraPosition);var t,i,r,n=Cartesian3.subtract(this._occluderPosition,e,scratchCartesian3$7),a=Cartesian3.magnitudeSquared(n),o=this._occluderRadius*this._occluderRadius;if(o<a){t=Math.sqrt(a-o),a=1/Math.sqrt(a),i=Cartesian3.multiplyByScalar(n,a,scratchCartesian3$7);var s=t*t*a;r=Cartesian3.add(e,Cartesian3.multiplyByScalar(i,s,scratchCartesian3$7),scratchCartesian3$7)}else t=Number.MAX_VALUE;this._horizonDistance=t,this._horizonPlaneNormal=i,this._horizonPlanePosition=r,this._cameraPosition=e}}}),Occluder.fromBoundingSphere=function(e,t,i){return defined(i)?(Cartesian3.clone(e.center,i._occluderPosition),i._occluderRadius=e.radius,i.cameraPosition=t,i):new Occluder(e,t)};var tempVecScratch=new Cartesian3;Occluder.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){var t=Cartesian3.subtract(e,this._occluderPosition,tempVecScratch),i=this._occluderRadius;if(0<(i=Cartesian3.magnitudeSquared(t)-i*i))return i=Math.sqrt(i)+this._horizonDistance,t=Cartesian3.subtract(e,this._cameraPosition,t),i*i>Cartesian3.magnitudeSquared(t)}return!1};var occludeePositionScratch=new Cartesian3;Occluder.prototype.isBoundingSphereVisible=function(e){var t=Cartesian3.clone(e.center,occludeePositionScratch),i=e.radius;if(this._horizonDistance===Number.MAX_VALUE)return!1;var r=Cartesian3.subtract(t,this._occluderPosition,tempVecScratch),n=this._occluderRadius-i;if(n=Cartesian3.magnitudeSquared(r)-n*n,i<this._occluderRadius)return 0<n&&(n=Math.sqrt(n)+this._horizonDistance,r=Cartesian3.subtract(t,this._cameraPosition,r),n*n+i*i>Cartesian3.magnitudeSquared(r));if(0<n){r=Cartesian3.subtract(t,this._cameraPosition,r);var a=Cartesian3.magnitudeSquared(r),o=this._occluderRadius*this._occluderRadius,s=i*i;return(this._horizonDistance*this._horizonDistance+o)*s>a*o||a<(n=Math.sqrt(n)+this._horizonDistance)*n+s}return!0};var tempScratch$1=new Cartesian3;Occluder.prototype.computeVisibility=function(e){var t=Cartesian3.clone(e.center),i=e.radius;if(i>this._occluderRadius)return Visibility$1.FULL;if(this._horizonDistance!==Number.MAX_VALUE){var r=Cartesian3.subtract(t,this._occluderPosition,tempScratch$1),n=this._occluderRadius-i,a=Cartesian3.magnitudeSquared(r);if(0<(n=a-n*n)){n=Math.sqrt(n)+this._horizonDistance,r=Cartesian3.subtract(t,this._cameraPosition,r);var o=Cartesian3.magnitudeSquared(r);return n*n+i*i<o?Visibility$1.NONE:0<(n=a-(n=this._occluderRadius+i)*n)?o<(n=Math.sqrt(n)+this._horizonDistance)*n+i*i?Visibility$1.FULL:Visibility$1.PARTIAL:(r=Cartesian3.subtract(t,this._horizonPlanePosition,r),Cartesian3.dot(r,this._horizonPlaneNormal)>-i?Visibility$1.PARTIAL:Visibility$1.FULL)}}return Visibility$1.NONE};var occludeePointScratch=new Cartesian3;Occluder.computeOccludeePoint=function(e,t,i){var r=Cartesian3.clone(t),n=Cartesian3.clone(e.center),a=e.radius,o=i.length,s=Cartesian3.normalize(Cartesian3.subtract(r,n,occludeePointScratch),occludeePointScratch),l=-Cartesian3.dot(s,n),c=Occluder._anyRotationVector(n,s,l),u=Occluder._horizonToPlaneNormalDotProduct(e,s,l,c,i[0]);if(u){for(var d,h=1;h<o;++h){if(!(d=Occluder._horizonToPlaneNormalDotProduct(e,s,l,c,i[h])))return;d<u&&(u=d)}if(!(u<.0017453283658983088)){var p=a/u;return Cartesian3.add(n,Cartesian3.multiplyByScalar(s,p,occludeePointScratch),occludeePointScratch)}}};var computeOccludeePointFromRectangleScratch=[];Occluder.computeOccludeePointFromRectangle=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);var i=Rectangle.subsample(e,t,0,computeOccludeePointFromRectangleScratch),r=BoundingSphere.fromPoints(i),n=Cartesian3.ZERO;if(!Cartesian3.equals(n,r.center))return Occluder.computeOccludeePoint(new BoundingSphere(n,t.minimumRadius),r.center,i)};var tempVec0Scratch=new Cartesian3;Occluder._anyRotationVector=function(e,t,i){var r=Cartesian3.abs(t,tempVec0Scratch),n=r.x>r.y?0:1;(0===n&&r.z>r.x||1===n&&r.z>r.y)&&(n=2);var a,o=new Cartesian3;a=0===n?(r.x=e.x,r.y=e.y+1,r.z=e.z+1,Cartesian3.UNIT_X):1===n?(r.x=e.x+1,r.y=e.y,r.z=e.z+1,Cartesian3.UNIT_Y):(r.x=e.x+1,r.y=e.y+1,r.z=e.z,Cartesian3.UNIT_Z);var s=(Cartesian3.dot(t,r)+i)/-Cartesian3.dot(t,a);return Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(r,Cartesian3.multiplyByScalar(a,s,o),r),e,r),r)};var posDirectionScratch=new Cartesian3;Occluder._rotationVector=function(e,t,i,r,n){var a=Cartesian3.subtract(r,e,posDirectionScratch);if(a=Cartesian3.normalize(a,a),Cartesian3.dot(t,a)<.9999999847691291){var o=Cartesian3.cross(t,a,a);if(Cartesian3.magnitude(o)>CesiumMath.EPSILON13)return Cartesian3.normalize(o,new Cartesian3)}return n};var posScratch1=new Cartesian3,occluerPosScratch=new Cartesian3,posScratch2=new Cartesian3,horizonPlanePosScratch=new Cartesian3;function OffsetGeometryInstanceAttribute(e,t,i){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),this.value=new Float32Array([e,t,i])}function OpenCageGeocoderService(e,t,i){(e=Resource.createIfNeeded(e)).appendForwardSlash(),e.setQueryParameters({key:t}),this._url=e,this._params=defaultValue(i,{})}Occluder._horizonToPlaneNormalDotProduct=function(e,t,i,r,n){var a=Cartesian3.clone(n,posScratch1),o=Cartesian3.clone(e.center,occluerPosScratch),s=e.radius,l=Cartesian3.subtract(o,a,posScratch2),c=Cartesian3.magnitudeSquared(l),u=s*s;if(c<u)return!1;var d=c-u,h=Math.sqrt(d),p=h*(1/Math.sqrt(c))*h;l=Cartesian3.normalize(l,l);var m=Cartesian3.add(a,Cartesian3.multiplyByScalar(l,p,horizonPlanePosScratch),horizonPlanePosScratch),f=Math.sqrt(d-p*p),g=this._rotationVector(o,t,i,a,r),_=Cartesian3.fromElements(g.x*g.x*l.x+(g.x*g.y-g.z)*l.y+(g.x*g.z+g.y)*l.z,(g.x*g.y+g.z)*l.x+g.y*g.y*l.y+(g.y*g.z-g.x)*l.z,(g.x*g.z-g.y)*l.x+(g.y*g.z+g.x)*l.y+g.z*g.z*l.z,posScratch1);_=Cartesian3.normalize(_,_);var y=Cartesian3.multiplyByScalar(_,f,posScratch1);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.add(m,y,posScratch2),o,posScratch2),posScratch2);var v=Cartesian3.dot(t,g);g=Cartesian3.normalize(Cartesian3.subtract(Cartesian3.subtract(m,y,g),o,g),g);var C=Cartesian3.dot(t,g);return v<C?v:C},defineProperties$1(OffsetGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),OffsetGeometryInstanceAttribute.fromCartesian3=function(e){return new OffsetGeometryInstanceAttribute(e.x,e.y,e.z)},OffsetGeometryInstanceAttribute.toValue=function(e,t){return defined(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t},defineProperties$1(OpenCageGeocoderService.prototype,{url:{get:function(){return this._url}},params:{get:function(){return this._params}}}),OpenCageGeocoderService.prototype.geocode=function(e){return this._url.getDerivedResource({url:"json",queryParameters:combine(this._params,{q:e})}).fetchJson().then(function(e){return e.results.map(function(e){var t,i=e.bounds;if(defined(i))t=Rectangle.fromDegrees(i.southwest.lng,i.southwest.lat,i.northeast.lng,i.northeast.lat);else{var r=e.geometry.lat,n=e.geometry.lng;t=Cartesian3.fromDegrees(r,n)}return{displayName:e.formatted,destination:t}})})};var Packable={packedLength:void 0,pack:DeveloperError.throwInstantiationError,unpack:DeveloperError.throwInstantiationError},PackableForInterpolation={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:DeveloperError.throwInstantiationError,unpackInterpolationResult:DeveloperError.throwInstantiationError},getCSSValue=function(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)},measureText=function(e,t,i,r){var n=e.measureText(t),a=getCSSValue(e.canvas,"font-family"),o=getCSSValue(e.canvas,"font-size").replace("px",""),s=getCSSValue(e.canvas,"font-style"),l=getCSSValue(e.canvas,"font-weight"),c=!/\S/.test(t);n.fontsize=o;var u=document.createElement("div");u.style.position="absolute",u.style.opacity=0,u.style.font=s+" "+l+" "+o+"px "+a,u.innerHTML=t+"<br/>"+t,document.body.appendChild(u),n.leading=1.2*o;var d=getCSSValue(u,"height");if(2*o<=(d=d.replace("px",""))&&(n.leading=d/2|0),document.body.removeChild(u),c)n.ascent=0,n.descent=0,n.bounds={minx:0,maxx:n.width,miny:0,maxy:0},n.height=0;else{var h=document.createElement("canvas");h.width=n.width+100,h.height=3*o,h.style.opacity=1,h.style.fontFamily=a,h.style.fontSize=o,h.style.fontStyle=s,h.style.fontWeight=l;var p=h.getContext("2d");p.font=s+" "+l+" "+o+"px "+a;var m=h.width,f=h.height,g=f/2;p.fillStyle="white",p.fillRect(-1,-1,m+2,f+2),i&&(p.strokeStyle="black",p.lineWidth=e.lineWidth,p.strokeText(t,50,g)),r&&(p.fillStyle="black",p.fillText(t,50,g));for(var _=p.getImageData(0,0,m,f).data,y=0,v=4*m,C=_.length;++y<C&&255===_[y];);var S=y/v|0;for(y=C-1;0<--y&&255===_[y];);var x=y/v|0;for(y=0;y<C&&255===_[y];)C<=(y+=v)&&(y=y-C+4);var T=y%v/4|0,b=1;for(y=C-3;0<=y&&255===_[y];)(y-=v)<0&&(y=C-3-4*b++);var E=y%v/4+1|0;n.ascent=g-S,n.descent=x-g,n.bounds={minx:T-50,maxx:E-50,miny:0,maxy:x-S},n.height=x-S+1}return n},imageSmoothingEnabledName;function writeTextToCanvas(e,t){if(""!==e){var i=defaultValue((t=defaultValue(t,defaultValue.EMPTY_OBJECT)).font,"10px sans-serif"),r=defaultValue(t.stroke,!1),n=defaultValue(t.fill,!0),a=defaultValue(t.strokeWidth,1),o=defaultValue(t.backgroundColor,Color.TRANSPARENT),s=defaultValue(t.padding,0),l=2*s,c=document.createElement("canvas");c.width=1,c.height=1,c.style.font=i;var u=c.getContext("2d");defined(imageSmoothingEnabledName)||(defined(u.imageSmoothingEnabled)?imageSmoothingEnabledName="imageSmoothingEnabled":defined(u.mozImageSmoothingEnabled)?imageSmoothingEnabledName="mozImageSmoothingEnabled":defined(u.webkitImageSmoothingEnabled)?imageSmoothingEnabledName="webkitImageSmoothingEnabled":defined(u.msImageSmoothingEnabled)&&(imageSmoothingEnabledName="msImageSmoothingEnabled")),u.font=i,u.lineJoin="round",u.lineWidth=a,u[imageSmoothingEnabledName]=!1,u.textBaseline=defaultValue(t.textBaseline,"bottom"),c.style.visibility="hidden",document.body.appendChild(c);var d=measureText(u,e,r,n);c.dimensions=d,document.body.removeChild(c),c.style.visibility="";var h=-d.bounds.minx,p=Math.ceil(d.width)+h+l,m=d.height+l,f=m-(m-d.ascent+s)+l;if(c.width=p,c.height=m,u.font=i,u.lineJoin="round",u.lineWidth=a,u[imageSmoothingEnabledName]=!1,o!==Color.TRANSPARENT&&(u.fillStyle=o.toCssColorString(),u.fillRect(0,0,c.width,c.height)),r){var g=defaultValue(t.strokeColor,Color.BLACK);u.strokeStyle=g.toCssColorString(),u.strokeText(e,h+s,f)}if(n){var _=defaultValue(t.fillColor,Color.WHITE);u.fillStyle=_.toCssColorString(),u.fillText(e,h+s,f)}return c}}function PinBuilder(){this._cache={}}PinBuilder.prototype.fromColor=function(e,t){return createPin(void 0,void 0,e,t,this._cache)},PinBuilder.prototype.fromUrl=function(e,t,i){return createPin(e,void 0,t,i,this._cache)},PinBuilder.prototype.fromMakiIconId=function(e,t,i){return createPin(buildModuleUrl("Assets/Textures/maki/"+encodeURIComponent(e)+".png"),void 0,t,i,this._cache)},PinBuilder.prototype.fromText=function(e,t,i){return createPin(void 0,e,t,i,this._cache)};var colorScratch=new Color;function drawPin(e,t,i){e.save(),e.scale(i/24,i/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,colorScratch).toCssColorString(),e.lineWidth=.846,e.beginPath(),e.moveTo(6.72,.422),e.lineTo(17.28,.422),e.bezierCurveTo(18.553,.422,19.577,1.758,19.577,3.415),e.lineTo(19.577,10.973),e.bezierCurveTo(19.577,12.63,18.553,13.966,17.282,13.966),e.lineTo(14.386,14.008),e.lineTo(11.826,23.578),e.lineTo(9.614,14.008),e.lineTo(6.719,13.965),e.bezierCurveTo(5.446,13.983,4.422,12.629,4.422,10.972),e.lineTo(4.422,3.416),e.bezierCurveTo(4.423,1.76,5.447,.423,6.718,.423),e.closePath(),e.fill(),e.stroke(),e.restore()}function drawIcon(e,t,i){var r=i/2.5,n=r,a=r;t.width>t.height?a=r*(t.height/t.width):t.width<t.height&&(n=r*(t.width/t.height));var o=Math.round((i-n)/2),s=Math.round(7/24*i-a/2);e.globalCompositeOperation="destination-out",e.drawImage(t,o-1,s,n,a),e.drawImage(t,o,s-1,n,a),e.drawImage(t,o+1,s,n,a),e.drawImage(t,o,s+1,n,a),e.globalCompositeOperation="destination-over",e.fillStyle=Color.BLACK.toCssColorString(),e.fillRect(o-1,s-1,n+2,a+2),e.globalCompositeOperation="destination-out",e.drawImage(t,o,s,n,a),e.globalCompositeOperation="destination-over",e.fillStyle=Color.WHITE.toCssColorString(),e.fillRect(o-1,s-2,n+2,a+2)}var stringifyScratch=new Array(4);function createPin(e,t,i,r,n){stringifyScratch[0]=e,stringifyScratch[1]=t,stringifyScratch[2]=i,stringifyScratch[3]=r;var a=JSON.stringify(stringifyScratch),o=n[a];if(defined(o))return o;var s=document.createElement("canvas");s.width=r,s.height=r;var l=s.getContext("2d");if(drawPin(l,i,r),defined(e)){var c=Resource.createIfNeeded(e).fetchImage().then(function(e){return drawIcon(l,e,r),n[a]=s});return n[a]=c}if(defined(t)){var u=writeTextToCanvas(t,{font:"bold "+r+"px sans-serif"});drawIcon(l,u,r)}return n[a]=s}function PlaneGeometry(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).vertexFormat,VertexFormat.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}PlaneGeometry.packedLength=VertexFormat.packedLength,PlaneGeometry.pack=function(e,t,i){return i=defaultValue(i,0),VertexFormat.pack(e._vertexFormat,t,i),t};var scratchVertexFormat$7=new VertexFormat,scratchOptions$e={vertexFormat:scratchVertexFormat$7};PlaneGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=VertexFormat.unpack(e,t,scratchVertexFormat$7);return defined(i)?(i._vertexFormat=VertexFormat.clone(r,i._vertexFormat),i):new PlaneGeometry(scratchOptions$e)};var min=new Cartesian3(-.5,-.5,0),max=new Cartesian3(.5,.5,0);function PlaneOutlineGeometry(){this._workerName="createPlaneOutlineGeometry"}PlaneGeometry.createGeometry=function(e){var t,i,r=e._vertexFormat,n=new GeometryAttributes;if(r.position){if((i=new Float64Array(12))[0]=min.x,i[1]=min.y,i[2]=0,i[3]=max.x,i[4]=min.y,i[5]=0,i[6]=max.x,i[7]=max.y,i[8]=0,i[9]=min.x,i[10]=max.y,i[11]=0,n.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),r.normal){var a=new Float32Array(12);a[0]=0,a[1]=0,a[2]=1,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=1,a[9]=0,a[10]=0,a[11]=1,n.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:a})}if(r.st){var o=new Float32Array(8);o[0]=0,o[1]=0,o[2]=1,o[3]=0,o[4]=1,o[5]=1,o[6]=0,o[7]=1,n.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:o})}if(r.tangent){var s=new Float32Array(12);s[0]=1,s[1]=0,s[2]=0,s[3]=1,s[4]=0,s[5]=0,s[6]=1,s[7]=0,s[8]=0,s[9]=1,s[10]=0,s[11]=0,n.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:s})}if(r.bitangent){var l=new Float32Array(12);l[0]=0,l[1]=1,l[2]=0,l[3]=0,l[4]=1,l[5]=0,l[6]=0,l[7]=1,l[8]=0,l[9]=0,l[10]=1,l[11]=0,n.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:l})}(t=new Uint16Array(6))[0]=0,t[1]=1,t[2]=2,t[3]=0,t[4]=2,t[5]=3}return new Geometry({attributes:n,indices:t,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})},PlaneOutlineGeometry.packedLength=0,PlaneOutlineGeometry.pack=function(e,t){return t},PlaneOutlineGeometry.unpack=function(e,t,i){return defined(i)?i:new PlaneOutlineGeometry};var min$1=new Cartesian3(-.5,-.5,0),max$1=new Cartesian3(.5,.5,0);PlaneOutlineGeometry.createGeometry=function(){var e=new GeometryAttributes,t=new Uint16Array(8),i=new Float64Array(12);return i[0]=min$1.x,i[1]=min$1.y,i[2]=min$1.z,i[3]=max$1.x,i[4]=min$1.y,i[5]=min$1.z,i[6]=max$1.x,i[7]=max$1.y,i[8]=min$1.z,i[9]=min$1.x,i[10]=max$1.y,i[11]=min$1.z,e.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),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 Geometry({attributes:e,indices:t,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere(Cartesian3.ZERO,Math.sqrt(2))})};var coords=new Cartesian3;function pointInsideTriangle(e,t,i,r){return barycentricCoordinates(e,t,i,r,coords),0<coords.x&&0<coords.y&&0<coords.z}var scratchCarto1=new Cartographic,scratchCarto2=new Cartographic;function adjustPosHeightsForNormal(e,t,i,r){var n=r.cartesianToCartographic(e,scratchCarto1).height,a=r.cartesianToCartographic(t,scratchCarto2);a.height=n,r.cartographicToCartesian(a,t);var o=r.cartesianToCartographic(i,scratchCarto2);o.height=n-100,r.cartographicToCartesian(o,i)}var scratchBoundingRectangle=new BoundingRectangle,scratchPosition$3=new Cartesian3,scratchNormal$5=new Cartesian3,scratchTangent$3=new Cartesian3,scratchBitangent$3=new Cartesian3,p1Scratch$2=new Cartesian3,p2Scratch$2=new Cartesian3,scratchPerPosNormal=new Cartesian3,scratchPerPosTangent=new Cartesian3,scratchPerPosBitangent=new Cartesian3,appendTextureCoordinatesOrigin=new Cartesian2,appendTextureCoordinatesCartesian2=new Cartesian2,appendTextureCoordinatesCartesian3=new Cartesian3,appendTextureCoordinatesQuaternion=new Quaternion,appendTextureCoordinatesMatrix3=new Matrix3,tangentMatrixScratch$1=new Matrix3;function computeAttributes(e){var t=e.vertexFormat,i=e.geometry,r=e.shadowVolume,n=i.attributes.position.values,a=n.length,o=e.wall,s=e.top||o,l=e.bottom||o;if(t.st||t.normal||t.tangent||t.bitangent||r){var c=e.boundingRectangle,u=e.tangentPlane,d=e.ellipsoid,h=e.stRotation,p=e.perPositionHeight,m=appendTextureCoordinatesOrigin;m.x=c.x,m.y=c.y;var f,g=t.st?new Float32Array(a/3*2):void 0;t.normal&&(f=p&&s&&!o?i.attributes.normal.values:new Float32Array(a));var _=t.tangent?new Float32Array(a):void 0,y=t.bitangent?new Float32Array(a):void 0,v=r?new Float32Array(a):void 0,C=0,S=0,x=scratchNormal$5,T=scratchTangent$3,b=scratchBitangent$3,E=!0,P=appendTextureCoordinatesMatrix3,A=tangentMatrixScratch$1;if(0!==h){var w=Quaternion.fromAxisAngle(u._plane.normal,h,appendTextureCoordinatesQuaternion);P=Matrix3.fromQuaternion(w,P),w=Quaternion.fromAxisAngle(u._plane.normal,-h,appendTextureCoordinatesQuaternion),A=Matrix3.fromQuaternion(w,A)}else P=Matrix3.clone(Matrix3.IDENTITY,P),A=Matrix3.clone(Matrix3.IDENTITY,A);var D=0,M=0;s&&l&&(D=a/2,M=a/3,a/=2);for(var I=0;I<a;I+=3){var R=Cartesian3.fromArray(n,I,appendTextureCoordinatesCartesian3);if(t.st){var O=Matrix3.multiplyByVector(P,R,scratchPosition$3);O=d.scaleToGeodeticSurface(O,O);var L=u.projectPointOntoPlane(O,appendTextureCoordinatesCartesian2);Cartesian2.subtract(L,m,L);var F=CesiumMath.clamp(L.x/c.width,0,1),N=CesiumMath.clamp(L.y/c.height,0,1);l&&(g[C+M]=F,g[C+1+M]=N),s&&(g[C]=F,g[C+1]=N),C+=2}if(t.normal||t.tangent||t.bitangent||r){var B=S+1,V=S+2;if(o){if(I+3<a){var k=Cartesian3.fromArray(n,I+3,p1Scratch$2);if(E){var $=Cartesian3.fromArray(n,I+a,p2Scratch$2);p&&adjustPosHeightsForNormal(R,k,$,d),Cartesian3.subtract(k,R,k),Cartesian3.subtract($,R,$),x=Cartesian3.normalize(Cartesian3.cross($,k,x),x),E=!1}Cartesian3.equalsEpsilon(k,R,CesiumMath.EPSILON10)&&(E=!0)}(t.tangent||t.bitangent)&&(b=d.geodeticSurfaceNormal(R,b),t.tangent&&(T=Cartesian3.normalize(Cartesian3.cross(b,x,T),T)))}else x=d.geodeticSurfaceNormal(R,x),(t.tangent||t.bitangent)&&(p&&(scratchPerPosNormal=Cartesian3.fromArray(f,S,scratchPerPosNormal),scratchPerPosTangent=Cartesian3.cross(Cartesian3.UNIT_Z,scratchPerPosNormal,scratchPerPosTangent),scratchPerPosTangent=Cartesian3.normalize(Matrix3.multiplyByVector(A,scratchPerPosTangent,scratchPerPosTangent),scratchPerPosTangent),t.bitangent&&(scratchPerPosBitangent=Cartesian3.normalize(Cartesian3.cross(scratchPerPosNormal,scratchPerPosTangent,scratchPerPosBitangent),scratchPerPosBitangent))),T=Cartesian3.cross(Cartesian3.UNIT_Z,x,T),T=Cartesian3.normalize(Matrix3.multiplyByVector(A,T,T),T),t.bitangent&&(b=Cartesian3.normalize(Cartesian3.cross(x,T,b),b)));t.normal&&(e.wall?(f[S+D]=x.x,f[B+D]=x.y,f[V+D]=x.z):l&&(f[S+D]=-x.x,f[B+D]=-x.y,f[V+D]=-x.z),(s&&!p||o)&&(f[S]=x.x,f[B]=x.y,f[V]=x.z)),r&&(o&&(x=d.geodeticSurfaceNormal(R,x)),v[S+D]=-x.x,v[B+D]=-x.y,v[V+D]=-x.z),t.tangent&&(e.wall?(_[S+D]=T.x,_[B+D]=T.y,_[V+D]=T.z):l&&(_[S+D]=-T.x,_[B+D]=-T.y,_[V+D]=-T.z),s&&(p?(_[S]=scratchPerPosTangent.x,_[B]=scratchPerPosTangent.y,_[V]=scratchPerPosTangent.z):(_[S]=T.x,_[B]=T.y,_[V]=T.z))),t.bitangent&&(l&&(y[S+D]=b.x,y[B+D]=b.y,y[V+D]=b.z),s&&(p?(y[S]=scratchPerPosBitangent.x,y[B]=scratchPerPosBitangent.y,y[V]=scratchPerPosBitangent.z):(y[S]=b.x,y[B]=b.y,y[V]=b.z))),S+=3}}t.st&&(i.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:g})),t.normal&&(i.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),t.tangent&&(i.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),t.bitangent&&(i.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:y})),r&&(i.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:v}))}if(e.extrude&&defined(e.offsetAttribute)){var z=n.length/3,U=new Uint8Array(z);if(e.offsetAttribute===GeometryOffsetAttribute$1.TOP)s&&l||o?U=arrayFill(U,1,0,z/2):s&&(U=arrayFill(U,1));else U=arrayFill(U,e.offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1);i.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:U})}return i}var startCartographicScratch$1=new Cartographic,endCartographicScratch$1=new Cartographic,idlCross={westOverIDL:0,eastOverIDL:0},ellipsoidGeodesic$1=new EllipsoidGeodesic;function computeRectangle$2(e,t,i,r,n){if(n=defaultValue(n,new Rectangle),!defined(e)||e.length<3)return n.west=0,n.north=0,n.south=0,n.east=0,n;if(i===ArcType$1.RHUMB)return Rectangle.fromCartesianArray(e,t,n);ellipsoidGeodesic$1.ellipsoid.equals(t)||(ellipsoidGeodesic$1=new EllipsoidGeodesic(void 0,void 0,t)),n.west=Number.POSITIVE_INFINITY,n.east=Number.NEGATIVE_INFINITY,n.south=Number.POSITIVE_INFINITY,n.north=Number.NEGATIVE_INFINITY,idlCross.westOverIDL=Number.POSITIVE_INFINITY,idlCross.eastOverIDL=Number.NEGATIVE_INFINITY;for(var a,o=1/CesiumMath.chordLength(r,t.maximumRadius),s=e.length,l=t.cartesianToCartographic(e[0],endCartographicScratch$1),c=startCartographicScratch$1,u=1;u<s;u++)a=c,c=l,l=t.cartesianToCartographic(e[u],a),ellipsoidGeodesic$1.setEndPoints(c,l),interpolateAndGrowRectangle(ellipsoidGeodesic$1,o,n,idlCross);return a=c,c=l,l=t.cartesianToCartographic(e[0],a),ellipsoidGeodesic$1.setEndPoints(c,l),interpolateAndGrowRectangle(ellipsoidGeodesic$1,o,n,idlCross),n.east-n.west>idlCross.eastOverIDL-idlCross.westOverIDL&&(n.west=idlCross.westOverIDL,n.east=idlCross.eastOverIDL,n.east>CesiumMath.PI&&(n.east=n.east-CesiumMath.TWO_PI),n.west>CesiumMath.PI&&(n.west=n.west-CesiumMath.TWO_PI)),n}var interpolatedCartographicScratch$1=new Cartographic;function interpolateAndGrowRectangle(e,t,i,r){for(var n=e.surfaceDistance,a=Math.ceil(n*t),o=0<a?n/(a-1):Number.POSITIVE_INFINITY,s=0,l=0;l<a;l++){var c=e.interpolateUsingSurfaceDistance(s,interpolatedCartographicScratch$1);s+=o;var u=c.longitude,d=c.latitude;i.west=Math.min(i.west,u),i.east=Math.max(i.east,u),i.south=Math.min(i.south,d),i.north=Math.max(i.north,d);var h=0<=u?u:u+CesiumMath.TWO_PI;r.westOverIDL=Math.min(r.westOverIDL,h),r.eastOverIDL=Math.max(r.eastOverIDL,h)}}var createGeometryFromPositionsExtrudedPositions=[];function createGeometryFromPositionsExtruded(e,t,i,r,n,a,o,s,l){var c,u={walls:[]};if(a||o){var d,h,p=PolygonGeometryLibrary.createGeometryFromPositions(e,t,i,n,s,l),m=p.attributes.position.values,f=p.indices;if(a&&o){var g=m.concat(m);d=g.length/3,(h=IndexDatatype$1.createTypedArray(d,2*f.length)).set(f);var _=f.length,y=d/2;for(c=0;c<_;c+=3){var v=h[c]+y,C=h[c+1]+y,S=h[c+2]+y;h[c+_]=S,h[c+1+_]=C,h[c+2+_]=v}if(p.attributes.position.values=g,n&&s.normal){var x=p.attributes.normal.values;p.attributes.normal.values=new Float32Array(g.length),p.attributes.normal.values.set(x)}p.indices=h}else if(o){for(d=m.length/3,h=IndexDatatype$1.createTypedArray(d,f.length),c=0;c<f.length;c+=3)h[c]=f[c+2],h[c+1]=f[c+1],h[c+2]=f[c];p.indices=h}u.topAndBottom=new GeometryInstance({geometry:p})}var T=r.outerRing,b=EllipsoidTangentPlane.fromPoints(T,e),E=b.projectPointsOntoPlane(T,createGeometryFromPositionsExtrudedPositions),P=PolygonPipeline.computeWindingOrder2D(E);P===WindingOrder$1.CLOCKWISE&&(T=T.slice().reverse());var A=PolygonGeometryLibrary.computeWallGeometry(T,e,i,n,l);u.walls.push(new GeometryInstance({geometry:A}));var w=r.holes;for(c=0;c<w.length;c++){var D=w[c];E=(b=EllipsoidTangentPlane.fromPoints(D,e)).projectPointsOntoPlane(D,createGeometryFromPositionsExtrudedPositions),(P=PolygonPipeline.computeWindingOrder2D(E))===WindingOrder$1.COUNTER_CLOCKWISE&&(D=D.slice().reverse()),A=PolygonGeometryLibrary.computeWallGeometry(D,e,i,n,l),u.walls.push(new GeometryInstance({geometry:A}))}return u}function PolygonGeometry(e){var t=e.polygonHierarchy,i=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.stRotation,0),o=defaultValue(e.perPositionHeight,!1),s=o&&defined(e.extrudedHeight),l=defaultValue(e.height,0),c=defaultValue(e.extrudedHeight,l);if(!s){var u=Math.max(l,c);c=Math.min(l,c),l=u}this._vertexFormat=VertexFormat.clone(i),this._ellipsoid=Ellipsoid.clone(r),this._granularity=n,this._stRotation=a,this._height=l,this._extrudedHeight=c,this._closeTop=defaultValue(e.closeTop,!0),this._closeBottom=defaultValue(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=s,this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+VertexFormat.packedLength+12}PolygonGeometry.fromPositions=function(e){return new PolygonGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).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})},PolygonGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._stRotation,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._closeTop?1:0,t[i++]=e._closeBottom?1:0,t[i++]=e._shadowVolume?1:0,t[i++]=defaultValue(e._offsetAttribute,-1),t[i++]=e._arcType,t[i]=e.packedLength,t};var scratchEllipsoid$5=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$8=new VertexFormat,dummyOptions={polygonHierarchy:{}};function textureCoordinateRotationPoints$1(e){var t=-e._stRotation;if(0==t)return[0,0,0,1,1,0];var i=e._ellipsoid,r=e._polygonHierarchy.positions,n=e.rectangle;return Geometry._textureCoordinateRotationPoints(r,t,i,n)}function PolygonHierarchy(e,t){this.positions=defined(e)?e:[],this.holes=defined(t)?t:[]}PolygonGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$5);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$8);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=1===e[t++],d=1===e[t++],h=1===e[t++],p=1===e[t++],m=1===e[t++],f=e[t++],g=e[t++],_=e[t];return defined(i)||(i=new PolygonGeometry(dummyOptions)),i._polygonHierarchy=r,i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._height=o,i._extrudedHeight=s,i._granularity=l,i._stRotation=c,i._perPositionHeightExtrude=u,i._perPositionHeight=d,i._closeTop=h,i._closeBottom=p,i._shadowVolume=m,i._offsetAttribute=-1===f?void 0:f,i._arcType=g,i.packedLength=_,i},PolygonGeometry.computeRectangle=function(e,t){var i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.arcType,ArcType$1.GEODESIC),n=e.polygonHierarchy,a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle$2(n.positions,a,r,i,t)},PolygonGeometry.createGeometry=function(e){var t=e._vertexFormat,i=e._ellipsoid,r=e._granularity,n=e._stRotation,a=e._polygonHierarchy,o=e._perPositionHeight,s=e._closeTop,l=e._closeBottom,c=e._arcType,u=a.positions;if(!(u.length<3)){var d=EllipsoidTangentPlane.fromPoints(u,i),h=PolygonGeometryLibrary.polygonsFromHierarchy(a,d.projectPointsOntoPlane.bind(d),!o,i),p=h.hierarchy,m=h.polygons;if(0!==p.length){u=p[0].outerRing;var f,g=PolygonGeometryLibrary.computeBoundingRectangle(d.plane.normal,d.projectPointOntoPlane.bind(d),u,n,scratchBoundingRectangle),_=[],y=e._height,v=e._extrudedHeight,C={perPositionHeight:o,vertexFormat:t,geometry:void 0,tangentPlane:d,boundingRectangle:g,ellipsoid:i,stRotation:n,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:c};if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(y,v,0,CesiumMath.EPSILON2))for(C.extrude=!0,C.top=s,C.bottom=l,C.shadowVolume=e._shadowVolume,C.offsetAttribute=e._offsetAttribute,f=0;f<m.length;f++){var S,x=createGeometryFromPositionsExtruded(i,m[f],r,p[f],o,s,l,t,c);s&&l?(S=x.topAndBottom,C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(S.geometry,y,v,i,o)):s?((S=x.topAndBottom).geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(S.geometry.attributes.position.values,y,i,!o),C.geometry=S.geometry):l&&((S=x.topAndBottom).geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(S.geometry.attributes.position.values,v,i,!0),C.geometry=S.geometry),(s||l)&&(C.wall=!1,S.geometry=computeAttributes(C),_.push(S));var T=x.walls;C.wall=!0;for(var b=0;b<T.length;b++){var E=T[b];C.geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(E.geometry,y,v,i,o),E.geometry=computeAttributes(C),_.push(E)}}else for(f=0;f<m.length;f++){var P=new GeometryInstance({geometry:PolygonGeometryLibrary.createGeometryFromPositions(i,m[f],r,o,t,c)});if(P.geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(P.geometry.attributes.position.values,y,i,!o),C.geometry=P.geometry,P.geometry=computeAttributes(C),defined(e._offsetAttribute)){var A=P.geometry.attributes.position.values.length,w=new Uint8Array(A/3);arrayFill(w,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),P.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}_.push(P)}var D=GeometryPipeline.combineInstances(_)[0];D.attributes.position.values=new Float64Array(D.attributes.position.values),D.indices=IndexDatatype$1.createTypedArray(D.attributes.position.values.length/3,D.indices);var M=D.attributes,I=BoundingSphere.fromVertices(M.position.values);return t.position||delete M.position,new Geometry({attributes:M,indices:D.indices,primitiveType:D.primitiveType,boundingSphere:I,offsetAttribute:e._offsetAttribute})}}},PolygonGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new PolygonGeometry({polygonHierarchy:e._polygonHierarchy,ellipsoid:n,stRotation:e._stRotation,granularity:r,perPositionHeight:!1,extrudedHeight:a,height:o,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})},defineProperties$1(PolygonGeometry.prototype,{rectangle:{get:function(){if(!defined(this._rectangle)){var e=this._polygonHierarchy.positions;this._rectangle=computeRectangle$2(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$1(this)),this._textureCoordinateRotationPoints}}});var createGeometryFromPositionsPositions=[],createGeometryFromPositionsSubdivided=[];function createGeometryFromPositions$1(e,t,i,r,n){var a,o,s=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);PolygonPipeline.computeWindingOrder2D(s)===WindingOrder$1.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());var l=t.length,c=0;if(r)for(a=new Float64Array(2*l*3),o=0;o<l;o++){var u=t[o],d=t[(o+1)%l];a[c++]=u.x,a[c++]=u.y,a[c++]=u.z,a[c++]=d.x,a[c++]=d.y,a[c++]=d.z}else{var h=0;if(n===ArcType$1.GEODESIC)for(o=0;o<l;o++)h+=PolygonGeometryLibrary.subdivideLineCount(t[o],t[(o+1)%l],i);else if(n===ArcType$1.RHUMB)for(o=0;o<l;o++)h+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[o],t[(o+1)%l],i);for(a=new Float64Array(3*h),o=0;o<l;o++){var p;n===ArcType$1.GEODESIC?p=PolygonGeometryLibrary.subdivideLine(t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided):n===ArcType$1.RHUMB&&(p=PolygonGeometryLibrary.subdivideRhumbLine(e,t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided));for(var m=p.length,f=0;f<m;++f)a[c++]=p[f]}}var g=2*(l=a.length/3),_=IndexDatatype$1.createTypedArray(l,g);for(o=c=0;o<l-1;o++)_[c++]=o,_[c++]=o+1;return _[c++]=l-1,_[c++]=0,new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:_,primitiveType:PrimitiveType$1.LINES})})}function createGeometryFromPositionsExtruded$1(e,t,i,r,n){var a,o,s=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,createGeometryFromPositionsPositions);PolygonPipeline.computeWindingOrder2D(s)===WindingOrder$1.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());var l=t.length,c=new Array(l),u=0;if(r)for(a=new Float64Array(2*l*3*2),o=0;o<l;++o){c[o]=u/3;var d=t[o],h=t[(o+1)%l];a[u++]=d.x,a[u++]=d.y,a[u++]=d.z,a[u++]=h.x,a[u++]=h.y,a[u++]=h.z}else{var p=0;if(n===ArcType$1.GEODESIC)for(o=0;o<l;o++)p+=PolygonGeometryLibrary.subdivideLineCount(t[o],t[(o+1)%l],i);else if(n===ArcType$1.RHUMB)for(o=0;o<l;o++)p+=PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[o],t[(o+1)%l],i);for(a=new Float64Array(3*p*2),o=0;o<l;++o){var m;c[o]=u/3,n===ArcType$1.GEODESIC?m=PolygonGeometryLibrary.subdivideLine(t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided):n===ArcType$1.RHUMB&&(m=PolygonGeometryLibrary.subdivideRhumbLine(e,t[o],t[(o+1)%l],i,createGeometryFromPositionsSubdivided));for(var f=m.length,g=0;g<f;++g)a[u++]=m[g]}}l=a.length/6;var _=c.length,y=2*(2*l+_),v=IndexDatatype$1.createTypedArray(l+_,y);for(o=u=0;o<l;++o)v[u++]=o,v[u++]=(o+1)%l,v[u++]=o+l,v[u++]=(o+1)%l+l;for(o=0;o<_;o++){var C=c[o];v[u++]=C,v[u++]=C+l}return new GeometryInstance({geometry:new Geometry({attributes:new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:a})}),indices:v,primitiveType:PrimitiveType$1.LINES})})}function PolygonOutlineGeometry(e){var t=e.polygonHierarchy,i=defaultValue(e.ellipsoid,Ellipsoid.WGS84),r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),n=defaultValue(e.perPositionHeight,!1),a=n&&defined(e.extrudedHeight),o=defaultValue(e.arcType,ArcType$1.GEODESIC),s=defaultValue(e.height,0),l=defaultValue(e.extrudedHeight,s);if(!a){var c=Math.max(s,l);l=Math.min(s,l),s=c}this._ellipsoid=Ellipsoid.clone(i),this._granularity=r,this._height=s,this._extrudedHeight=l,this._arcType=o,this._polygonHierarchy=t,this._perPositionHeight=n,this._perPositionHeightExtrude=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=PolygonGeometryLibrary.computeHierarchyPackedLength(t)+Ellipsoid.packedLength+8}PolygonOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),i=PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._arcType,t[i++]=defaultValue(e._offsetAttribute,-1),t[i]=e.packedLength,t};var scratchEllipsoid$6=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),dummyOptions$1={polygonHierarchy:{}};PolygonOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$6);t+=Ellipsoid.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=1===e[t++],c=1===e[t++],u=e[t++],d=e[t++],h=e[t];return defined(i)||(i=new PolygonOutlineGeometry(dummyOptions$1)),i._polygonHierarchy=r,i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._height=a,i._extrudedHeight=o,i._granularity=s,i._perPositionHeight=c,i._perPositionHeightExtrude=l,i._arcType=u,i._offsetAttribute=-1===d?void 0:d,i.packedLength=h,i},PolygonOutlineGeometry.fromPositions=function(e){return new PolygonOutlineGeometry({polygonHierarchy:{positions:(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},PolygonOutlineGeometry.createGeometry=function(e){var t=e._ellipsoid,i=e._granularity,r=e._polygonHierarchy,n=e._perPositionHeight,a=e._arcType,o=PolygonGeometryLibrary.polygonOutlinesFromHierarchy(r,!n,t);if(0!==o.length){var s,l,c=[],u=CesiumMath.chordLength(i,t.maximumRadius),d=e._height,h=e._extrudedHeight;if(e._perPositionHeightExtrude||!CesiumMath.equalsEpsilon(d,h,0,CesiumMath.EPSILON2))for(l=0;l<o.length;l++){if((s=createGeometryFromPositionsExtruded$1(t,o[l],u,n,a)).geometry=PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(s.geometry,d,h,t,n),defined(e._offsetAttribute)){var p=s.geometry.attributes.position.values.length/3,m=new Uint8Array(p);m=e._offsetAttribute===GeometryOffsetAttribute$1.TOP?arrayFill(m,1,0,p/2):arrayFill(m,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}c.push(s)}else for(l=0;l<o.length;l++){if((s=createGeometryFromPositions$1(t,o[l],u,n,a)).geometry.attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(s.geometry.attributes.position.values,d,t,!n),defined(e._offsetAttribute)){var f=s.geometry.attributes.position.values.length,g=new Uint8Array(f/3);arrayFill(g,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),s.geometry.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}c.push(s)}var _=GeometryPipeline.combineInstances(c)[0],y=BoundingSphere.fromVertices(_.attributes.position.values);return new Geometry({attributes:_.attributes,indices:_.indices,primitiveType:_.primitiveType,boundingSphere:y,offsetAttribute:e._offsetAttribute})}};var scratchInterpolateColorsArray=[];function interpolateColors(e,t,i,r,n){var a,o=scratchInterpolateColorsArray;o.length=n;var s=i.red,l=i.green,c=i.blue,u=i.alpha,d=r.red,h=r.green,p=r.blue,m=r.alpha;if(Color.equals(i,r)){for(a=0;a<n;a++)o[a]=Color.clone(i);return o}var f=(d-s)/n,g=(h-l)/n,_=(p-c)/n,y=(m-u)/n;for(a=0;a<n;a++)o[a]=new Color(s+a*f,l+a*g,c+a*_,u+a*y);return o}function PolylineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.colors,r=defaultValue(e.width,1),n=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=i,this._width=r,this._colorsPerVertex=n,this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";var a=1+t.length*Cartesian3.packedLength;a+=defined(i)?1+i.length*Color.packedLength:1,this.packedLength=a+Ellipsoid.packedLength+VertexFormat.packedLength+4}PolylineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._colors;for(a=defined(o)?o.length:0,t[i++]=a,r=0;r<a;++r,i+=Color.packedLength)Color.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._width,t[i++]=e._colorsPerVertex?1:0,t[i++]=e._arcType,t[i]=e._granularity,t};var scratchEllipsoid$7=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$9=new VertexFormat,scratchOptions$f={positions:void 0,colors:void 0,ellipsoid:scratchEllipsoid$7,vertexFormat:scratchVertexFormat$9,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};PolylineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);var o=0<(n=e[t++])?new Array(n):void 0;for(r=0;r<n;++r,t+=Color.packedLength)o[r]=Color.unpack(e,t);var s=Ellipsoid.unpack(e,t,scratchEllipsoid$7);t+=Ellipsoid.packedLength;var l=VertexFormat.unpack(e,t,scratchVertexFormat$9);t+=VertexFormat.packedLength;var c=e[t++],u=1===e[t++],d=e[t++],h=e[t];return defined(i)?(i._positions=a,i._colors=o,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=VertexFormat.clone(l,i._vertexFormat),i._width=c,i._colorsPerVertex=u,i._arcType=d,i._granularity=h,i):(scratchOptions$f.positions=a,scratchOptions$f.colors=o,scratchOptions$f.width=c,scratchOptions$f.colorsPerVertex=u,scratchOptions$f.arcType=d,scratchOptions$f.granularity=h,new PolylineGeometry(scratchOptions$f))};var scratchCartesian3$8=new Cartesian3,scratchPosition$4=new Cartesian3,scratchPrevPosition=new Cartesian3,scratchNextPosition=new Cartesian3;function computeAttributes$1(e,t,i,r){var n=new GeometryAttributes;r.position&&(n.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e}));var a,o,s,l,c,u,d=t.length,h=e.length/3,p=(h-2*d)/(2*d),m=PolygonPipeline.triangulate(t),f=(p-1)*d*6+2*m.length,g=IndexDatatype$1.createTypedArray(h,f),_=2*d,y=0;for(a=0;a<p-1;a++){for(o=0;o<d-1;o++)u=(s=2*o+a*d*2)+_,c=(l=s+1)+_,g[y++]=l,g[y++]=s,g[y++]=c,g[y++]=c,g[y++]=s,g[y++]=u;c=(l=(s=2*d-2+a*d*2)+1)+_,u=s+_,g[y++]=l,g[y++]=s,g[y++]=c,g[y++]=c,g[y++]=s,g[y++]=u}if(r.st||r.tangent||r.bitangent){var v,C,S=new Float32Array(2*h),x=1/(p-1),T=1/i.height,b=i.height/2,E=0;for(a=0;a<p;a++){for(v=a*x,C=T*(t[0].y+b),S[E++]=v,S[E++]=C,o=1;o<d;o++)C=T*(t[o].y+b),S[E++]=v,S[E++]=C,S[E++]=v,S[E++]=C;C=T*(t[0].y+b),S[E++]=v,S[E++]=C}for(o=0;o<d;o++)v=0,C=T*(t[o].y+b),S[E++]=v,S[E++]=C;for(o=0;o<d;o++)v=(p-1)*x,C=T*(t[o].y+b),S[E++]=v,S[E++]=C;n.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:new Float32Array(S)})}var P=h-2*d;for(a=0;a<m.length;a+=3){var A=m[a]+P,w=m[a+1]+P,D=m[a+2]+P;g[y++]=A,g[y++]=w,g[y++]=D,g[y++]=D+d,g[y++]=w+d,g[y++]=A+d}var M=new Geometry({attributes:n,indices:g,boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.TRIANGLES});if(r.normal&&(M=GeometryPipeline.computeNormal(M)),r.tangent||r.bitangent){try{M=GeometryPipeline.computeTangentAndBitangent(M)}catch(e){oneTimeWarning("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}r.tangent||(M.attributes.tangent=void 0),r.bitangent||(M.attributes.bitangent=void 0),r.st||(M.attributes.st=void 0)}return M}function PolylineVolumeGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,i=e.shapePositions;this._positions=t,this._shape=i,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";var r=1+t.length*Cartesian3.packedLength;r+=1+i.length*Cartesian2.packedLength,this.packedLength=r+Ellipsoid.packedLength+VertexFormat.packedLength+2}PolylineGeometry.createGeometry=function(e){var t,i,r,n=e._width,a=e._vertexFormat,o=e._colors,s=e._colorsPerVertex,l=e._arcType,c=e._granularity,u=e._ellipsoid,d=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon),h=d.length;if(!(h<2||n<=0)){if(l===ArcType$1.GEODESIC||l===ArcType$1.RHUMB){var p,m;m=l===ArcType$1.GEODESIC?(p=CesiumMath.chordLength(c,u.maximumRadius),PolylinePipeline.numberOfPoints):(p=c,PolylinePipeline.numberOfPointsRhumbLine);var f=PolylinePipeline.extractHeights(d,u);if(defined(o)){var g=1;for(t=0;t<h-1;++t)g+=m(d[t],d[t+1],p);var _=new Array(g),y=0;for(t=0;t<h-1;++t){var v=d[t],C=d[t+1],S=o[t],x=m(v,C,p);if(s&&t<g){var T=interpolateColors(v,C,S,o[t+1],x),b=T.length;for(i=0;i<b;++i)_[y++]=T[i]}else for(i=0;i<x;++i)_[y++]=Color.clone(S)}_[y]=Color.clone(o[o.length-1]),o=_,scratchInterpolateColorsArray.length=0}d=l===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc({positions:d,minDistance:p,ellipsoid:u,height:f}):PolylinePipeline.generateCartesianRhumbArc({positions:d,granularity:p,ellipsoid:u,height:f})}var E,P=4*(h=d.length)-4,A=new Float64Array(3*P),w=new Float64Array(3*P),D=new Float64Array(3*P),M=new Float32Array(2*P),I=a.st?new Float32Array(2*P):void 0,R=defined(o)?new Uint8Array(4*P):void 0,O=0,L=0,F=0,N=0;for(i=0;i<h;++i){var B,V;0===i?(E=scratchCartesian3$8,Cartesian3.subtract(d[0],d[1],E),Cartesian3.add(d[0],E,E)):E=d[i-1],Cartesian3.clone(E,scratchPrevPosition),Cartesian3.clone(d[i],scratchPosition$4),i===h-1?(E=scratchCartesian3$8,Cartesian3.subtract(d[h-1],d[h-2],E),Cartesian3.add(d[h-1],E,E)):E=d[i+1],Cartesian3.clone(E,scratchNextPosition),defined(R)&&(B=0===i||s?o[i]:o[i-1],i!==h-1&&(V=o[i]));var k=i===h-1?2:4;for(r=0===i?2:0;r<k;++r){Cartesian3.pack(scratchPosition$4,A,O),Cartesian3.pack(scratchPrevPosition,w,O),Cartesian3.pack(scratchNextPosition,D,O),O+=3;var $=r-2<0?-1:1;if(M[L++]=r%2*2-1,M[L++]=$*n,a.st&&(I[F++]=i/(h-1),I[F++]=Math.max(M[L-2],0)),defined(R)){var z=r<2?B:V;R[N++]=Color.floatToByte(z.red),R[N++]=Color.floatToByte(z.green),R[N++]=Color.floatToByte(z.blue),R[N++]=Color.floatToByte(z.alpha)}}}var U=new GeometryAttributes;U.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:A}),U.prevPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:w}),U.nextPosition=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:D}),U.expandAndWidth=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:M}),a.st&&(U.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:I})),defined(R)&&(U.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:R,normalize:!0}));var G=IndexDatatype$1.createTypedArray(P,6*h-6),H=0,W=0,q=h-1;for(i=0;i<q;++i)G[W++]=H,G[W++]=H+2,G[W++]=H+1,G[W++]=H+1,G[W++]=H+2,G[W++]=H+3,H+=4;return new Geometry({attributes:U,indices:G,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:BoundingSphere.fromPoints(d),geometryType:GeometryType$1.POLYLINES})}},PolylineVolumeGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._shape;for(a=o.length,t[i++]=a,r=0;r<a;++r,i+=Cartesian2.packedLength)Cartesian2.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._cornerType,t[i]=e._granularity,t};var scratchEllipsoid$8=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$a=new VertexFormat,scratchOptions$g={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$8,vertexFormat:scratchVertexFormat$a,cornerType:void 0,granularity:void 0};PolylineVolumeGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);n=e[t++];var o=new Array(n);for(r=0;r<n;++r,t+=Cartesian2.packedLength)o[r]=Cartesian2.unpack(e,t);var s=Ellipsoid.unpack(e,t,scratchEllipsoid$8);t+=Ellipsoid.packedLength;var l=VertexFormat.unpack(e,t,scratchVertexFormat$a);t+=VertexFormat.packedLength;var c=e[t++],u=e[t];return defined(i)?(i._positions=a,i._shape=o,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=VertexFormat.clone(l,i._vertexFormat),i._cornerType=c,i._granularity=u,i):(scratchOptions$g.polylinePositions=a,scratchOptions$g.shapePositions=o,scratchOptions$g.cornerType=c,scratchOptions$g.granularity=u,new PolylineVolumeGeometry(scratchOptions$g))};var brScratch=new BoundingRectangle;function computeAttributes$2(e,t){var i=new GeometryAttributes;i.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:e});var r,n,a=t.length,o=i.position.values.length/3,s=e.length/3/a,l=IndexDatatype$1.createTypedArray(o,2*a*(1+s)),c=0,u=(r=0)*a;for(n=0;n<a-1;n++)l[c++]=n+u,l[c++]=n+u+1;for(l[c++]=a-1+u,l[c++]=u,u=(r=s-1)*a,n=0;n<a-1;n++)l[c++]=n+u,l[c++]=n+u+1;for(l[c++]=a-1+u,l[c++]=u,r=0;r<s-1;r++){var d=a*r,h=d+a;for(n=0;n<a;n++)l[c++]=n+d,l[c++]=n+h}return new Geometry({attributes:i,indices:IndexDatatype$1.createTypedArray(o,l),boundingSphere:BoundingSphere.fromVertices(e),primitiveType:PrimitiveType$1.LINES})}function PolylineVolumeOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).polylinePositions,i=e.shapePositions;this._positions=t,this._shape=i,this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._cornerType=defaultValue(e.cornerType,CornerType$1.ROUNDED),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var r=1+t.length*Cartesian3.packedLength;r+=1+i.length*Cartesian2.packedLength,this.packedLength=r+Ellipsoid.packedLength+2}PolylineVolumeGeometry.createGeometry=function(e){var t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon),i=e._shape;if(i=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i),!(t.length<2||i.length<3)){PolygonPipeline.computeWindingOrder2D(i)===WindingOrder$1.CLOCKWISE&&i.reverse();var r=BoundingRectangle.fromPoints(i,brScratch);return computeAttributes$1(PolylineVolumeGeometryLibrary.computePositions(t,i,r,e,!0),i,r,e._vertexFormat)}},PolylineVolumeOutlineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._shape;for(a=o.length,t[i++]=a,r=0;r<a;++r,i+=Cartesian2.packedLength)Cartesian2.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._cornerType,t[i]=e._granularity,t};var scratchEllipsoid$9=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$h={polylinePositions:void 0,shapePositions:void 0,ellipsoid:scratchEllipsoid$9,height:void 0,cornerType:void 0,granularity:void 0};PolylineVolumeOutlineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);n=e[t++];var o=new Array(n);for(r=0;r<n;++r,t+=Cartesian2.packedLength)o[r]=Cartesian2.unpack(e,t);var s=Ellipsoid.unpack(e,t,scratchEllipsoid$9);t+=Ellipsoid.packedLength;var l=e[t++],c=e[t];return defined(i)?(i._positions=a,i._shape=o,i._ellipsoid=Ellipsoid.clone(s,i._ellipsoid),i._cornerType=l,i._granularity=c,i):(scratchOptions$h.polylinePositions=a,scratchOptions$h.shapePositions=o,scratchOptions$h.cornerType=l,scratchOptions$h.granularity=c,new PolylineVolumeOutlineGeometry(scratchOptions$h))};var brScratch$1=new BoundingRectangle;function createEvaluateFunction$1(o){var s=o.points,l=o.times;return function(e,t){defined(t)||(t=new Quaternion);var i=o._lastTimeIndex=o.findTimeInterval(e,o._lastTimeIndex),r=(e-l[i])/(l[i+1]-l[i]),n=s[i],a=s[i+1];return Quaternion.fastSlerp(n,a,r,t)}}function QuaternionSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).points,i=e.times;this._times=i,this._points=t,this._evaluateFunction=createEvaluateFunction$1(this),this._lastTimeIndex=0}function quickselect(e,t,i,r,n){quickselectStep(e,t,i||0,r||e.length-1,n||defaultCompare)}function quickselectStep(e,t,i,r,n){for(;i<r;){if(600<r-i){var a=r-i+1,o=t-i+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);quickselectStep(e,t,Math.max(i,Math.floor(t-o*l/a+c)),Math.min(r,Math.floor(t+(a-o)*l/a+c)),n)}var u=e[t],d=i,h=r;for(swap$1(e,i,t),0<n(e[r],u)&&swap$1(e,i,r);d<h;){for(swap$1(e,d,h),d++,h--;n(e[d],u)<0;)d++;for(;0<n(e[h],u);)h--}0===n(e[i],u)?swap$1(e,i,h):swap$1(e,++h,r),h<=t&&(i=h+1),t<=h&&(r=h-1)}}function swap$1(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function defaultCompare(e,t){return e<t?-1:t<e?1:0}function rbush(e,t){if(!(this instanceof rbush))return new rbush(e,t);this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&this._initFormat(t),this.clear()}function findItem(e,t,i){if(!i)return t.indexOf(e);for(var r=0;r<t.length;r++)if(i(e,t[r]))return r;return-1}function calcBBox(e,t){distBBox(e,0,e.children.length,t,e)}function distBBox(e,t,i,r,n){(n=n||createNode(null)).minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var a,o=t;o<i;o++)a=e.children[o],extend(n,e.leaf?r(a):a);return n}function extend(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function compareNodeMinX(e,t){return e.minX-t.minX}function compareNodeMinY(e,t){return e.minY-t.minY}function bboxArea(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function bboxMargin(e){return e.maxX-e.minX+(e.maxY-e.minY)}function enlargedArea(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function intersectionArea(e,t){var i=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),n=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,n-i)*Math.max(0,a-r)}function contains(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function intersects$1(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function createNode(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(e,t,i,r,n){for(var a,o=[t,i];o.length;)(i=o.pop())-(t=o.pop())<=r||(quickselect(e,a=t+Math.ceil((i-t)/r/2)*r,t,i,n),o.push(t,a,a,i))}function RectangleCollisionChecker(){this._tree=rbush()}function RectangleWithId(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}function idCompare(e,t){return e.id===t.id}PolylineVolumeOutlineGeometry.createGeometry=function(e){var t=arrayRemoveDuplicates(e._positions,Cartesian3.equalsEpsilon),i=e._shape;if(i=PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i),!(t.length<2||i.length<3)){PolygonPipeline.computeWindingOrder2D(i)===WindingOrder$1.CLOCKWISE&&i.reverse();var r=BoundingRectangle.fromPoints(i,brScratch$1);return computeAttributes$2(PolylineVolumeGeometryLibrary.computePositions(t,i,r,e,!1),i)}},defineProperties$1(QuaternionSpline.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),QuaternionSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,QuaternionSpline.prototype.wrapTime=Spline.prototype.wrapTime,QuaternionSpline.prototype.clampTime=Spline.prototype.clampTime,QuaternionSpline.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)},rbush.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,i=[],r=this.toBBox;if(!intersects$1(e,t))return i;for(var n,a,o,s,l=[];t;){for(n=0,a=t.children.length;n<a;n++)o=t.children[n],intersects$1(e,s=t.leaf?r(o):o)&&(t.leaf?i.push(o):contains(e,s)?this._all(o,i):l.push(o));t=l.pop()}return i},collides:function(e){var t=this.data,i=this.toBBox;if(!intersects$1(e,t))return!1;for(var r,n,a,o,s=[];t;){for(r=0,n=t.children.length;r<n;r++)if(a=t.children[r],intersects$1(e,o=t.leaf?i(a):a)){if(t.leaf||contains(e,o))return!0;s.push(a)}t=s.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0,i=e.length;t<i;t++)this.insert(e[t]);return this}var r=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var n=this.data;this.data=r,r=n}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(e){return e&&this._insert(e,this.data.height-1),this},clear:function(){return this.data=createNode([]),this},remove:function(e,t){if(!e)return this;for(var i,r,n,a,o=this.data,s=this.toBBox(e),l=[],c=[];o||l.length;){if(o||(o=l.pop(),r=l[l.length-1],i=c.pop(),a=!0),o.leaf&&-1!==(n=findItem(e,o.children,t)))return o.children.splice(n,1),l.push(o),this._condense(l),this;a||o.leaf||!contains(o,s)?r?(i++,o=r.children[i],a=!1):o=null:(l.push(o),c.push(i),i=0,o=(r=o).children[0])}return this},toBBox:function(e){return e},compareMinX:compareNodeMinX,compareMinY:compareNodeMinY,toJSON:function(){return this.data},fromJSON:function(e){return this.data=e,this},_all:function(e,t){for(var i=[];e;)e.leaf?t.push.apply(t,e.children):i.push.apply(i,e.children),e=i.pop();return t},_build:function(e,t,i,r){var n,a=i-t+1,o=this._maxEntries;if(a<=o)return calcBBox(n=createNode(e.slice(t,i+1)),this.toBBox),n;r||(r=Math.ceil(Math.log(a)/Math.log(o)),o=Math.ceil(a/Math.pow(o,r-1))),(n=createNode([])).leaf=!1,n.height=r;var s,l,c,u,d=Math.ceil(a/o),h=d*Math.ceil(Math.sqrt(o));for(multiSelect(e,t,i,h,this.compareMinX),s=t;s<=i;s+=h)for(multiSelect(e,s,c=Math.min(s+h-1,i),d,this.compareMinY),l=s;l<=c;l+=d)u=Math.min(l+d-1,c),n.children.push(this._build(e,l,u,r-1));return calcBBox(n,this.toBBox),n},_chooseSubtree:function(e,t,i,r){for(var n,a,o,s,l,c,u,d;r.push(t),!t.leaf&&r.length-1!==i;){for(u=d=1/0,n=0,a=t.children.length;n<a;n++)l=bboxArea(o=t.children[n]),(c=enlargedArea(e,o)-l)<d?(d=c,u=l<u?l:u,s=o):c===d&&l<u&&(u=l,s=o);t=s||t.children[0]}return t},_insert:function(e,t,i){var r=this.toBBox,n=i?e:r(e),a=[],o=this._chooseSubtree(n,this.data,t,a);for(o.children.push(e),extend(o,n);0<=t&&a[t].children.length>this._maxEntries;)this._split(a,t),t--;this._adjustParentBBoxes(n,a,t)},_split:function(e,t){var i=e[t],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var a=this._chooseSplitIndex(i,n,r),o=createNode(i.children.splice(a,i.children.length-a));o.height=i.height,o.leaf=i.leaf,calcBBox(i,this.toBBox),calcBBox(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(i,o)},_splitRoot:function(e,t){this.data=createNode([e,t]),this.data.height=e.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,i){var r,n,a,o,s,l,c,u;for(l=c=1/0,r=t;r<=i-t;r++)o=intersectionArea(n=distBBox(e,0,r,this.toBBox),a=distBBox(e,r,i,this.toBBox)),s=bboxArea(n)+bboxArea(a),o<l?(l=o,u=r,c=s<c?s:c):o===l&&s<c&&(c=s,u=r);return u},_chooseSplitAxis:function(e,t,i){var r=e.leaf?this.compareMinX:compareNodeMinX,n=e.leaf?this.compareMinY:compareNodeMinY;this._allDistMargin(e,t,i,r)<this._allDistMargin(e,t,i,n)&&e.children.sort(r)},_allDistMargin:function(e,t,i,r){e.children.sort(r);var n,a,o=this.toBBox,s=distBBox(e,0,t,o),l=distBBox(e,i-t,i,o),c=bboxMargin(s)+bboxMargin(l);for(n=t;n<i-t;n++)a=e.children[n],extend(s,e.leaf?o(a):a),c+=bboxMargin(s);for(n=i-t-1;t<=n;n--)a=e.children[n],extend(l,e.leaf?o(a):a),c+=bboxMargin(l);return c},_adjustParentBBoxes:function(e,t,i){for(var r=i;0<=r;r--)extend(t[r],e)},_condense:function(e){for(var t,i=e.length-1;0<=i;i--)0===e[i].children.length?0<i?(t=e[i-1].children).splice(t.indexOf(e[i]),1):this.clear():calcBBox(e[i],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}},RectangleWithId.fromRectangleAndId=function(e,t,i){return i.minX=t.west,i.minY=t.south,i.maxX=t.east,i.maxY=t.north,i.id=e,i},RectangleCollisionChecker.prototype.insert=function(e,t){var i=RectangleWithId.fromRectangleAndId(e,t,new RectangleWithId);this._tree.insert(i)};var removalScratch=new RectangleWithId;RectangleCollisionChecker.prototype.remove=function(e,t){var i=RectangleWithId.fromRectangleAndId(e,t,removalScratch);this._tree.remove(i,idCompare)};var collisionScratch=new RectangleWithId;RectangleCollisionChecker.prototype.collides=function(e){var t=RectangleWithId.fromRectangleAndId("",e,collisionScratch);return this._tree.collides(t)};var cos$2=Math.cos,sin$2=Math.sin,sqrt=Math.sqrt,RectangleGeometryLibrary={computePosition:function(e,t,i,r,n,a,o){var s=t.radiiSquared,l=e.nwCorner,c=e.boundingRectangle,u=l.latitude-e.granYCos*r+n*e.granXSin,d=cos$2(u),h=sin$2(u),p=s.z*h,m=l.longitude+r*e.granYSin+n*e.granXCos,f=d*cos$2(m),g=d*sin$2(m),_=s.x*f,y=s.y*g,v=sqrt(_*f+y*g+p*h);if(a.x=_/v,a.y=y/v,a.z=p/v,i){var C=e.stNwCorner;defined(C)?(u=C.latitude-e.stGranYCos*r+n*e.stGranXSin,m=C.longitude+r*e.stGranYSin+n*e.stGranXCos,o.x=(m-e.stWest)*e.lonScalar,o.y=(u-e.stSouth)*e.latScalar):(o.x=(m-c.west)*e.lonScalar,o.y=(u-c.south)*e.latScalar)}}},rotationMatrixScratch=new Matrix2,nwCartesian=new Cartesian3,centerScratch$2=new Cartographic,centerCartesian=new Cartesian3,proj=new GeographicProjection;function getRotationOptions(e,t,i,r,n,a,o){var s=Math.cos(t),l=r*s,c=i*s,u=Math.sin(t),d=r*u,h=i*u;nwCartesian=proj.project(e,nwCartesian),nwCartesian=Cartesian3.subtract(nwCartesian,centerCartesian,nwCartesian);var p=Matrix2.fromRotation(t,rotationMatrixScratch);nwCartesian=Matrix2.multiplyByVector(p,nwCartesian,nwCartesian),nwCartesian=Cartesian3.add(nwCartesian,centerCartesian,nwCartesian),a-=1,o-=1;var m=(e=proj.unproject(nwCartesian,e)).latitude,f=m+a*h,g=m-l*o,_=m-l*o+a*h,y=Math.max(m,f,g,_),v=Math.min(m,f,g,_),C=e.longitude,S=C+a*c,x=C+o*d,T=C+o*d+a*c;return{north:y,south:v,east:Math.max(C,S,x,T),west:Math.min(C,S,x,T),granYCos:l,granYSin:d,granXCos:c,granXSin:h,nwCorner:e}}RectangleGeometryLibrary.computeOptions=function(e,t,i,r,n,a,o){var s,l,c,u,d,h=e.east,p=e.west,m=e.north,f=e.south,g=!1,_=!1;m===CesiumMath.PI_OVER_TWO&&(g=!0),f===-CesiumMath.PI_OVER_TWO&&(_=!0);var y=m-f;c=(d=h<p?CesiumMath.TWO_PI-p+h:h-p)/((s=Math.ceil(d/t)+1)-1),u=y/((l=Math.ceil(y/t)+1)-1);var v=Rectangle.northwest(e,a),C=Rectangle.center(e,centerScratch$2);0===i&&0===r||(C.longitude<v.longitude&&(C.longitude+=CesiumMath.TWO_PI),centerCartesian=proj.project(C,centerCartesian));var S=u,x=c,T=Rectangle.clone(e,n),b={granYCos:S,granYSin:0,granXCos:x,granXSin:0,nwCorner:v,boundingRectangle:T,width:s,height:l,northCap:g,southCap:_};if(0!==i){var E=getRotationOptions(v,i,c,u,C,s,l);m=E.north,f=E.south,h=E.east,p=E.west,b.granYCos=E.granYCos,b.granYSin=E.granYSin,b.granXCos=E.granXCos,b.granXSin=E.granXSin,T.north=m,T.south=f,T.east=h,T.west=p}if(0!==r){i-=r;var P=Rectangle.northwest(T,o),A=getRotationOptions(P,i,c,u,C,s,l);b.stGranYCos=A.granYCos,b.stGranXCos=A.granXCos,b.stGranYSin=A.granYSin,b.stGranXSin=A.granXSin,b.stNwCorner=P,b.stWest=A.west,b.stSouth=A.south}return b};var positionScratch$2=new Cartesian3,normalScratch$3=new Cartesian3,tangentScratch$1=new Cartesian3,bitangentScratch$1=new Cartesian3,rectangleScratch$2=new Rectangle,stScratch$1=new Cartesian2,bottomBoundingSphere$2=new BoundingSphere,topBoundingSphere$2=new BoundingSphere;function createAttributes(e,t){var i=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.TRIANGLES});return i.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(i.attributes.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(i.attributes.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(i.attributes.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:t.bitangents})),i}function calculateAttributes(e,t,i,r){var n=e.length,a=t.normal?new Float32Array(n):void 0,o=t.tangent?new Float32Array(n):void 0,s=t.bitangent?new Float32Array(n):void 0,l=0,c=bitangentScratch$1,u=tangentScratch$1,d=normalScratch$3;if(t.normal||t.tangent||t.bitangent)for(var h=0;h<n;h+=3){var p=Cartesian3.fromArray(e,h,positionScratch$2),m=l+1,f=l+2;d=i.geodeticSurfaceNormal(p,d),(t.tangent||t.bitangent)&&(Cartesian3.cross(Cartesian3.UNIT_Z,d,u),Matrix3.multiplyByVector(r,u,u),Cartesian3.normalize(u,u),t.bitangent&&Cartesian3.normalize(Cartesian3.cross(d,u,c),c)),t.normal&&(a[l]=d.x,a[m]=d.y,a[f]=d.z),t.tangent&&(o[l]=u.x,o[m]=u.y,o[f]=u.z),t.bitangent&&(s[l]=c.x,s[m]=c.y,s[f]=c.z),l+=3}return createAttributes(t,{positions:e,normals:a,tangents:o,bitangents:s})}var v1Scratch=new Cartesian3,v2Scratch=new Cartesian3;function calculateAttributesWall(e,t,i){var r=e.length,n=t.normal?new Float32Array(r):void 0,a=t.tangent?new Float32Array(r):void 0,o=t.bitangent?new Float32Array(r):void 0,s=0,l=0,c=0,u=!0,d=bitangentScratch$1,h=tangentScratch$1,p=normalScratch$3;if(t.normal||t.tangent||t.bitangent)for(var m=0;m<r;m+=6){var f=Cartesian3.fromArray(e,m,positionScratch$2),g=Cartesian3.fromArray(e,(m+6)%r,v1Scratch);if(u){var _=Cartesian3.fromArray(e,(m+3)%r,v2Scratch);Cartesian3.subtract(g,f,g),Cartesian3.subtract(_,f,_),p=Cartesian3.normalize(Cartesian3.cross(_,g,p),p),u=!1}Cartesian3.equalsEpsilon(g,f,CesiumMath.EPSILON10)&&(u=!0),(t.tangent||t.bitangent)&&(d=i.geodeticSurfaceNormal(f,d),t.tangent&&(h=Cartesian3.normalize(Cartesian3.cross(d,p,h),h))),t.normal&&(n[s++]=p.x,n[s++]=p.y,n[s++]=p.z,n[s++]=p.x,n[s++]=p.y,n[s++]=p.z),t.tangent&&(a[l++]=h.x,a[l++]=h.y,a[l++]=h.z,a[l++]=h.x,a[l++]=h.y,a[l++]=h.z),t.bitangent&&(o[c++]=d.x,o[c++]=d.y,o[c++]=d.z,o[c++]=d.x,o[c++]=d.y,o[c++]=d.z)}return createAttributes(t,{positions:e,normals:n,tangents:a,bitangents:o})}function constructRectangle(e,t){var i=e._vertexFormat,r=e._ellipsoid,n=t.height,a=t.width,o=t.northCap,s=t.southCap,l=0,c=n,u=n,d=0;o&&(u-=l=1,d+=1),s&&(c-=1,u-=1,d+=1),d+=a*u;for(var h=i.position?new Float64Array(3*d):void 0,p=i.st?new Float32Array(2*d):void 0,m=0,f=0,g=positionScratch$2,_=stScratch$1,y=Number.MAX_VALUE,v=Number.MAX_VALUE,C=-Number.MAX_VALUE,S=-Number.MAX_VALUE,x=l;x<c;++x)for(var T=0;T<a;++T)RectangleGeometryLibrary.computePosition(t,r,i.st,x,T,g,_),h[m++]=g.x,h[m++]=g.y,h[m++]=g.z,i.st&&(p[f++]=_.x,p[f++]=_.y,y=Math.min(y,_.x),v=Math.min(v,_.y),C=Math.max(C,_.x),S=Math.max(S,_.y));if(o&&(RectangleGeometryLibrary.computePosition(t,r,i.st,0,0,g,_),h[m++]=g.x,h[m++]=g.y,h[m++]=g.z,i.st&&(p[f++]=_.x,p[f++]=_.y,y=_.x,v=_.y,C=_.x,S=_.y)),s&&(RectangleGeometryLibrary.computePosition(t,r,i.st,n-1,0,g,_),h[m++]=g.x,h[m++]=g.y,h[m]=g.z,i.st&&(p[f++]=_.x,p[f]=_.y,y=Math.min(y,_.x),v=Math.min(v,_.y),C=Math.max(C,_.x),S=Math.max(S,_.y))),i.st&&(y<0||v<0||1<C||1<S))for(var b=0;b<p.length;b+=2)p[b]=(p[b]-y)/(C-y),p[b+1]=(p[b+1]-v)/(S-v);var E=calculateAttributes(h,i,r,t.tangentRotationMatrix),P=6*(a-1)*(u-1);o&&(P+=3*(a-1)),s&&(P+=3*(a-1));var A,w=IndexDatatype$1.createTypedArray(d,P),D=0,M=0;for(A=0;A<u-1;++A){for(var I=0;I<a-1;++I){var R=D,O=R+a,L=O+1,F=R+1;w[M++]=R,w[M++]=O,w[M++]=F,w[M++]=F,w[M++]=O,w[M++]=L,++D}++D}if(o||s){var N,B,V=d-1,k=d-1;if(o&&s&&(V=d-2),D=0,o)for(A=0;A<a-1;A++)B=(N=D)+1,w[M++]=V,w[M++]=N,w[M++]=B,++D;if(s)for(D=(u-1)*a,A=0;A<a-1;A++)B=(N=D)+1,w[M++]=N,w[M++]=k,w[M++]=B,++D}return E.indices=w,i.st&&(E.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:p})),E}function addWallPositions$1(e,t,i,r,n){return e[t++]=r[i],e[t++]=r[i+1],e[t++]=r[i+2],e[t++]=n[i],e[t++]=n[i+1],e[t]=n[i+2],e}function addWallTextureCoordinates(e,t,i,r){return e[t++]=r[i],e[t++]=r[i+1],e[t++]=r[i],e[t]=r[i+1],e}var scratchVertexFormat$b=new VertexFormat;function constructExtrudedRectangle(e,t){var i,r=e._shadowVolume,n=e._offsetAttribute,a=e._vertexFormat,o=e._extrudedHeight,s=e._surfaceHeight,l=e._ellipsoid,c=t.height,u=t.width;if(r){var d=VertexFormat.clone(a,scratchVertexFormat$b);d.normal=!0,e._vertexFormat=d}var h=constructRectangle(e,t);r&&(e._vertexFormat=a);var p=PolygonPipeline.scaleToGeodeticHeight(h.attributes.position.values,s,l,!1),m=(p=new Float64Array(p)).length,f=2*m,g=new Float64Array(f);g.set(p);var _=PolygonPipeline.scaleToGeodeticHeight(h.attributes.position.values,o,l);g.set(_,m),h.attributes.position.values=g;var y,v,C=a.normal?new Float32Array(f):void 0,S=a.tangent?new Float32Array(f):void 0,x=a.bitangent?new Float32Array(f):void 0,T=a.st?new Float32Array(f/3*2):void 0;if(a.normal){for(v=h.attributes.normal.values,C.set(v),i=0;i<m;i++)v[i]=-v[i];C.set(v,m),h.attributes.normal.values=C}if(r){v=h.attributes.normal.values,a.normal||(h.attributes.normal=void 0);var b=new Float32Array(f);for(i=0;i<m;i++)v[i]=-v[i];b.set(v,m),h.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:b})}var E=defined(n);if(E){var P=m/3*2,A=new Uint8Array(P);A=n===GeometryOffsetAttribute$1.TOP?arrayFill(A,1,0,P/2):arrayFill(A,n===GeometryOffsetAttribute$1.NONE?0:1),h.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:A})}if(a.tangent){var w=h.attributes.tangent.values;for(S.set(w),i=0;i<m;i++)w[i]=-w[i];S.set(w,m),h.attributes.tangent.values=S}if(a.bitangent){var D=h.attributes.bitangent.values;x.set(D),x.set(D,m),h.attributes.bitangent.values=x}a.st&&(y=h.attributes.st.values,T.set(y),T.set(y,m/3*2),h.attributes.st.values=T);var M=h.indices,I=M.length,R=m/3,O=IndexDatatype$1.createTypedArray(f/3,2*I);for(O.set(M),i=0;i<I;i+=3)O[i+I]=M[i+2]+R,O[i+1+I]=M[i+1]+R,O[i+2+I]=M[i]+R;h.indices=O;var L=t.northCap,F=t.southCap,N=c,B=2,V=0,k=4,$=4;L&&(B-=1,N-=1,V+=1,k-=2,$-=1),F&&(B-=1,N-=1,V+=1,k-=2,$-=1);var z=2*((V+=B*u+2*N-k)+$),U=new Float64Array(3*z),G=r?new Float32Array(3*z):void 0,H=E?new Uint8Array(z):void 0,W=a.st?new Float32Array(2*z):void 0,q=n===GeometryOffsetAttribute$1.TOP;E&&!q&&(H=arrayFill(H,n===GeometryOffsetAttribute$1.ALL?1:0));var j,Y=0,X=0,Q=0,J=0,Z=u*N;for(i=0;i<Z;i+=u)U=addWallPositions$1(U,Y,j=3*i,p,_),Y+=6,a.st&&(W=addWallTextureCoordinates(W,X,2*i,y),X+=4),r&&(Q+=3,G[Q++]=v[j],G[Q++]=v[j+1],G[Q++]=v[j+2]),q&&(H[J++]=1,J+=1);if(F){var K=L?1+Z:Z;for(j=3*K,i=0;i<2;i++)U=addWallPositions$1(U,Y,j,p,_),Y+=6,a.st&&(W=addWallTextureCoordinates(W,X,2*K,y),X+=4),r&&(Q+=3,G[Q++]=v[j],G[Q++]=v[j+1],G[Q++]=v[j+2]),q&&(H[J++]=1,J+=1)}else for(i=Z-u;i<Z;i++)U=addWallPositions$1(U,Y,j=3*i,p,_),Y+=6,a.st&&(W=addWallTextureCoordinates(W,X,2*i,y),X+=4),r&&(Q+=3,G[Q++]=v[j],G[Q++]=v[j+1],G[Q++]=v[j+2]),q&&(H[J++]=1,J+=1);for(i=Z-1;0<i;i-=u)U=addWallPositions$1(U,Y,j=3*i,p,_),Y+=6,a.st&&(W=addWallTextureCoordinates(W,X,2*i,y),X+=4),r&&(Q+=3,G[Q++]=v[j],G[Q++]=v[j+1],G[Q++]=v[j+2]),q&&(H[J++]=1,J+=1);if(L){var ee=Z;for(j=3*ee,i=0;i<2;i++)U=addWallPositions$1(U,Y,j,p,_),Y+=6,a.st&&(W=addWallTextureCoordinates(W,X,2*ee,y),X+=4),r&&(Q+=3,G[Q++]=v[j],G[Q++]=v[j+1],G[Q++]=v[j+2]),q&&(H[J++]=1,J+=1)}else for(i=u-1;0<=i;i--)U=addWallPositions$1(U,Y,j=3*i,p,_),Y+=6,a.st&&(W=addWallTextureCoordinates(W,X,2*i,y),X+=4),r&&(Q+=3,G[Q++]=v[j],G[Q++]=v[j+1],G[Q++]=v[j+2]),q&&(H[J++]=1,J+=1);var te=calculateAttributesWall(U,a,l);a.st&&(te.attributes.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:W})),r&&(te.attributes.extrudeDirection=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:G})),E&&(te.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:H}));var ie,re,ne,ae,oe=IndexDatatype$1.createTypedArray(z,6*V);m=U.length/3;var se=0;for(i=0;i<m-1;i+=2){ae=((ie=i)+2)%m;var le=Cartesian3.fromArray(U,3*ie,v1Scratch),ce=Cartesian3.fromArray(U,3*ae,v2Scratch);Cartesian3.equalsEpsilon(le,ce,CesiumMath.EPSILON10)||(ne=(2+(re=(ie+1)%m))%m,oe[se++]=ie,oe[se++]=re,oe[se++]=ae,oe[se++]=ae,oe[se++]=re,oe[se++]=ne)}return te.indices=oe,(te=GeometryPipeline.combineInstances([new GeometryInstance({geometry:h}),new GeometryInstance({geometry:te})]))[0]}var scratchRectanglePoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3],nwScratch=new Cartographic,stNwScratch=new Cartographic;function computeRectangle$3(e,t,i,r,n){if(0===i)return Rectangle.clone(e,n);var a=RectangleGeometryLibrary.computeOptions(e,t,i,0,rectangleScratch$2,nwScratch),o=a.height,s=a.width,l=scratchRectanglePoints;return RectangleGeometryLibrary.computePosition(a,r,!1,0,0,l[0]),RectangleGeometryLibrary.computePosition(a,r,!1,0,s-1,l[1]),RectangleGeometryLibrary.computePosition(a,r,!1,o-1,0,l[2]),RectangleGeometryLibrary.computePosition(a,r,!1,o-1,s-1,l[3]),Rectangle.fromCartesianArray(l,r,n)}function RectangleGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.height,0),r=defaultValue(e.extrudedHeight,i);this._rectangle=Rectangle.clone(t),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=Ellipsoid.clone(defaultValue(e.ellipsoid,Ellipsoid.WGS84)),this._surfaceHeight=Math.max(i,r),this._rotation=defaultValue(e.rotation,0),this._stRotation=defaultValue(e.stRotation,0),this._vertexFormat=VertexFormat.clone(defaultValue(e.vertexFormat,VertexFormat.DEFAULT)),this._extrudedHeight=Math.min(i,r),this._shadowVolume=defaultValue(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}RectangleGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+VertexFormat.packedLength+7,RectangleGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Rectangle.pack(e._rectangle,t,i),i+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),i+=VertexFormat.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._stRotation,t[i++]=e._extrudedHeight,t[i++]=e._shadowVolume?1:0,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRectangle=new Rectangle,scratchEllipsoid$a=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$i={rectangle:scratchRectangle,ellipsoid:scratchEllipsoid$a,vertexFormat:scratchVertexFormat$b,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};RectangleGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Rectangle.unpack(e,t,scratchRectangle);t+=Rectangle.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$a);t+=Ellipsoid.packedLength;var a=VertexFormat.unpack(e,t,scratchVertexFormat$b);t+=VertexFormat.packedLength;var o=e[t++],s=e[t++],l=e[t++],c=e[t++],u=e[t++],d=1===e[t++],h=e[t];return defined(i)?(i._rectangle=Rectangle.clone(r,i._rectangle),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._vertexFormat=VertexFormat.clone(a,i._vertexFormat),i._granularity=o,i._surfaceHeight=s,i._rotation=l,i._stRotation=c,i._extrudedHeight=u,i._shadowVolume=d,i._offsetAttribute=-1===h?void 0:h,i):(scratchOptions$i.granularity=o,scratchOptions$i.height=s,scratchOptions$i.rotation=l,scratchOptions$i.stRotation=c,scratchOptions$i.extrudedHeight=u,scratchOptions$i.shadowVolume=d,scratchOptions$i.offsetAttribute=-1===h?void 0:h,new RectangleGeometry(scratchOptions$i))},RectangleGeometry.computeRectangle=function(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,r=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),n=defaultValue(e.ellipsoid,Ellipsoid.WGS84);return computeRectangle$3(i,r,defaultValue(e.rotation,0),n,t)};var tangentRotationMatrixScratch=new Matrix3,quaternionScratch$3=new Quaternion,centerScratch$3=new Cartographic;RectangleGeometry.createGeometry=function(e){if(!CesiumMath.equalsEpsilon(e._rectangle.north,e._rectangle.south,CesiumMath.EPSILON10)&&!CesiumMath.equalsEpsilon(e._rectangle.east,e._rectangle.west,CesiumMath.EPSILON10)){var t=e._rectangle,i=e._ellipsoid,r=e._rotation,n=e._stRotation,a=e._vertexFormat,o=RectangleGeometryLibrary.computeOptions(t,e._granularity,r,n,rectangleScratch$2,nwScratch,stNwScratch),s=tangentRotationMatrixScratch;if(0!==n||0!==r){var l=Rectangle.center(t,centerScratch$3),c=i.geodeticSurfaceNormalCartographic(l,v1Scratch);Quaternion.fromAxisAngle(c,-n,quaternionScratch$3),Matrix3.fromQuaternion(quaternionScratch$3,s)}else Matrix3.clone(Matrix3.IDENTITY,s);var u,d,h=e._surfaceHeight,p=e._extrudedHeight,m=!CesiumMath.equalsEpsilon(h,p,0,CesiumMath.EPSILON2);if(o.lonScalar=1/e._rectangle.width,o.latScalar=1/e._rectangle.height,o.tangentRotationMatrix=s,t=e._rectangle,m){u=constructExtrudedRectangle(e,o);var f=BoundingSphere.fromRectangle3D(t,i,h,topBoundingSphere$2),g=BoundingSphere.fromRectangle3D(t,i,p,bottomBoundingSphere$2);d=BoundingSphere.union(f,g)}else{if((u=constructRectangle(e,o)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(u.attributes.position.values,h,i,!1),defined(e._offsetAttribute)){var _=u.attributes.position.values.length,y=new Uint8Array(_/3);arrayFill(y,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),u.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}d=BoundingSphere.fromRectangle3D(t,i,h)}return a.position||delete u.attributes.position,new Geometry({attributes:u.attributes,indices:u.indices,primitiveType:u.primitiveType,boundingSphere:d,offsetAttribute:e._offsetAttribute})}},RectangleGeometry.createShadowVolume=function(e,t,i){var r=e._granularity,n=e._ellipsoid,a=t(r,n),o=i(r,n);return new RectangleGeometry({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:n,stRotation:e._stRotation,granularity:r,extrudedHeight:o,height:a,vertexFormat:VertexFormat.POSITION_ONLY,shadowVolume:!0})};var unrotatedTextureRectangleScratch=new Rectangle,points2DScratch$1=[new Cartesian2,new Cartesian2,new Cartesian2],rotation2DScratch$1=new Matrix2,rectangleCenterScratch$1=new Cartographic;function textureCoordinateRotationPoints$2(e){if(0===e._stRotation)return[0,0,0,1,1,0];var t=Rectangle.clone(e._rectangle,unrotatedTextureRectangleScratch),i=e._granularity,r=e._ellipsoid,n=computeRectangle$3(t,i,e._rotation-e._stRotation,r,unrotatedTextureRectangleScratch),a=points2DScratch$1;a[0].x=n.west,a[0].y=n.south,a[1].x=n.west,a[1].y=n.north,a[2].x=n.east,a[2].y=n.south;for(var o=e.rectangle,s=Matrix2.fromRotation(e._stRotation,rotation2DScratch$1),l=Rectangle.center(o,rectangleCenterScratch$1),c=0;c<3;++c){var u=a[c];u.x-=l.longitude,u.y-=l.latitude,Matrix2.multiplyByVector(s,u,u),u.x+=l.longitude,u.y+=l.latitude,u.x=(u.x-o.west)/o.width,u.y=(u.y-o.south)/o.height}var d=a[0],h=a[1],p=a[2],m=new Array(6);return Cartesian2.pack(d,m),Cartesian2.pack(h,m,2),Cartesian2.pack(p,m,4),m}defineProperties$1(RectangleGeometry.prototype,{rectangle:{get:function(){return defined(this._rotatedRectangle)||(this._rotatedRectangle=computeRectangle$3(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=textureCoordinateRotationPoints$2(this)),this._textureCoordinateRotationPoints}}});var bottomBoundingSphere$3=new BoundingSphere,topBoundingSphere$3=new BoundingSphere,positionScratch$3=new Cartesian3,rectangleScratch$3=new Rectangle;function constructRectangle$1(e,t){var i=e._ellipsoid,r=t.height,n=t.width,a=t.northCap,o=t.southCap,s=r,l=2,c=0,u=4;a&&(l-=1,s-=1,c+=1,u-=2),o&&(l-=1,s-=1,c+=1,u-=2),c+=l*n+2*s-u;var d,h=new Float64Array(3*c),p=0,m=0,f=positionScratch$3;if(a)RectangleGeometryLibrary.computePosition(t,i,!1,m,0,f),h[p++]=f.x,h[p++]=f.y,h[p++]=f.z;else for(d=0;d<n;d++)RectangleGeometryLibrary.computePosition(t,i,!1,m,d,f),h[p++]=f.x,h[p++]=f.y,h[p++]=f.z;for(d=n-1,m=1;m<r;m++)RectangleGeometryLibrary.computePosition(t,i,!1,m,d,f),h[p++]=f.x,h[p++]=f.y,h[p++]=f.z;if(m=r-1,!o)for(d=n-2;0<=d;d--)RectangleGeometryLibrary.computePosition(t,i,!1,m,d,f),h[p++]=f.x,h[p++]=f.y,h[p++]=f.z;for(d=0,m=r-2;0<m;m--)RectangleGeometryLibrary.computePosition(t,i,!1,m,d,f),h[p++]=f.x,h[p++]=f.y,h[p++]=f.z;for(var g=h.length/3*2,_=IndexDatatype$1.createTypedArray(h.length/3,g),y=0,v=0;v<h.length/3-1;v++)_[y++]=v,_[y++]=v+1;_[y++]=h.length/3-1,_[y++]=0;var C=new Geometry({attributes:new GeometryAttributes,primitiveType:PrimitiveType$1.LINES});return C.attributes.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:h}),C.indices=_,C}function constructExtrudedRectangle$1(e,t){var i=e._surfaceHeight,r=e._extrudedHeight,n=e._ellipsoid,a=r,o=i,s=constructRectangle$1(e,t),l=t.height,c=t.width,u=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,o,n,!1),d=u.length,h=new Float64Array(2*d);h.set(u);var p=PolygonPipeline.scaleToGeodeticHeight(s.attributes.position.values,a,n);h.set(p,d),s.attributes.position.values=h;var m=t.northCap,f=t.southCap,g=4;m&&(g-=1),f&&(g-=1);var _=2*(h.length/3+g),y=IndexDatatype$1.createTypedArray(h.length/3,_);d=h.length/6;for(var v,C=0,S=0;S<d-1;S++)y[C++]=S,y[C++]=S+1,y[C++]=S+d,y[C++]=S+d+1;if(y[C++]=d-1,y[C++]=0,y[C++]=d+d-1,y[C++]=d,y[C++]=0,y[C++]=d,m)v=l-1;else{var x=c-1;y[C++]=x,y[C++]=x+d,v=c+l-2}if(y[C++]=v,y[C++]=v+d,!f){var T=c+v-1;y[C++]=T,y[C]=T+d}return s.indices=y,s}function RectangleOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).rectangle,i=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),r=defaultValue(e.ellipsoid,Ellipsoid.WGS84),n=defaultValue(e.rotation,0),a=defaultValue(e.height,0),o=defaultValue(e.extrudedHeight,a);this._rectangle=Rectangle.clone(t),this._granularity=i,this._ellipsoid=r,this._surfaceHeight=Math.max(a,o),this._rotation=n,this._extrudedHeight=Math.min(a,o),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}RectangleOutlineGeometry.packedLength=Rectangle.packedLength+Ellipsoid.packedLength+5,RectangleOutlineGeometry.pack=function(e,t,i){return i=defaultValue(i,0),Rectangle.pack(e._rectangle,t,i),i+=Rectangle.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._extrudedHeight,t[i]=defaultValue(e._offsetAttribute,-1),t};var scratchRectangle$1=new Rectangle,scratchEllipsoid$b=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$j={rectangle:scratchRectangle$1,ellipsoid:scratchEllipsoid$b,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};RectangleOutlineGeometry.unpack=function(e,t,i){t=defaultValue(t,0);var r=Rectangle.unpack(e,t,scratchRectangle$1);t+=Rectangle.packedLength;var n=Ellipsoid.unpack(e,t,scratchEllipsoid$b);t+=Ellipsoid.packedLength;var a=e[t++],o=e[t++],s=e[t++],l=e[t++],c=e[t];return defined(i)?(i._rectangle=Rectangle.clone(r,i._rectangle),i._ellipsoid=Ellipsoid.clone(n,i._ellipsoid),i._surfaceHeight=o,i._rotation=s,i._extrudedHeight=l,i._offsetAttribute=-1===c?void 0:c,i):(scratchOptions$j.granularity=a,scratchOptions$j.height=o,scratchOptions$j.rotation=s,scratchOptions$j.extrudedHeight=l,scratchOptions$j.offsetAttribute=-1===c?void 0:c,new RectangleOutlineGeometry(scratchOptions$j))};var nwScratch$1=new Cartographic;RectangleOutlineGeometry.createGeometry=function(e){var t,i,r=e._rectangle,n=e._ellipsoid,a=RectangleGeometryLibrary.computeOptions(r,e._granularity,e._rotation,0,rectangleScratch$3,nwScratch$1);if(!CesiumMath.equalsEpsilon(r.north,r.south,CesiumMath.EPSILON10)&&!CesiumMath.equalsEpsilon(r.east,r.west,CesiumMath.EPSILON10)){var o=e._surfaceHeight,s=e._extrudedHeight;if(!CesiumMath.equalsEpsilon(o,s,0,CesiumMath.EPSILON2)){if(t=constructExtrudedRectangle$1(e,a),defined(e._offsetAttribute)){var l=t.attributes.position.values.length/3,c=new Uint8Array(l);c=e._offsetAttribute===GeometryOffsetAttribute$1.TOP?arrayFill(c,1,0,l/2):arrayFill(c,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),t.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}var u=BoundingSphere.fromRectangle3D(r,n,o,topBoundingSphere$3),d=BoundingSphere.fromRectangle3D(r,n,s,bottomBoundingSphere$3);i=BoundingSphere.union(u,d)}else{if((t=constructRectangle$1(e,a)).attributes.position.values=PolygonPipeline.scaleToGeodeticHeight(t.attributes.position.values,o,n,!1),defined(e._offsetAttribute)){var h=t.attributes.position.values.length,p=new Uint8Array(h/3);arrayFill(p,e._offsetAttribute===GeometryOffsetAttribute$1.NONE?0:1),t.attributes.applyOffset=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}i=BoundingSphere.fromRectangle3D(r,n,o)}return new Geometry({attributes:t.attributes,indices:t.indices,primitiveType:PrimitiveType$1.LINES,boundingSphere:i,offsetAttribute:e._offsetAttribute})}};var ReferenceFrame={FIXED:0,INERTIAL:1},ReferenceFrame$1=freezeObject$1(ReferenceFrame),implementation$2;function requestAnimationFramePolyFill(e){return implementation$2(e)}function sampleTerrain(e,t,i){return e.readyPromise.then(function(){return doSampling(e,t,i)})}function doSampling(e,t,i){var r,n=e.tilingScheme,a=[],o={};for(r=0;r<i.length;++r){var s=n.positionToTileXY(i[r],t),l=s.toString();if(!o.hasOwnProperty(l)){var c={x:s.x,y:s.y,level:t,tilingScheme:n,terrainProvider:e,positions:[]};o[l]=c,a.push(c)}o[l].positions.push(i[r])}var u=[];for(r=0;r<a.length;++r){var d=a[r],h=d.terrainProvider.requestTileGeometry(d.x,d.y,d.level).then(createInterpolateFunction(d)).otherwise(createMarkFailedFunction(d));u.push(h)}return when.all(u,function(){return i})}function createInterpolateFunction(e){var r=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(e){for(var t=0;t<r.length;++t){var i=r[t];i.height=e.interpolateHeight(n,i.longitude,i.latitude)}}}function createMarkFailedFunction(e){var t=e.positions;return function(){for(var e=0;e<t.length;++e){t[e].height=void 0}}}"undefined"!=typeof requestAnimationFrame&&(implementation$2=requestAnimationFrame),function(){if(!defined(implementation$2)&&"undefined"!=typeof window)for(var e=["webkit","moz","ms","o"],t=0,i=e.length;t<i&&!defined(implementation$2);)implementation$2=window[e[t]+"RequestAnimationFrame"],++t;if(!defined(implementation$2)){var r=0;implementation$2=function(e){var t=getTimestamp$1(),i=Math.max(1e3/60-(t-r),0);return r=t+i,setTimeout(function(){e(r)},i)}}}();var scratchCartesian2$7=new Cartesian2;function sampleTerrainMostDetailed(c,u){return c.readyPromise.then(function(){for(var e=[],r=[],n=c.availability,t=[],i=0;i<u.length;++i){var a=u[i],o=n.computeMaximumLevelAtPosition(a);if(0===(r[i]=o)){c.tilingScheme.positionToTileXY(a,1,scratchCartesian2$7);var s=c.loadTileDataAvailability(scratchCartesian2$7.x,scratchCartesian2$7.y,1);defined(s)&&t.push(s)}var l=e[o];defined(l)||(e[o]=l=[]),l.push(a)}return when.all(t).then(function(){return when.all(e.map(function(e,t){if(defined(e))return sampleTerrain(c,t,e)}))}).then(function(){for(var e=[],t=0;t<u.length;++t){var i=u[t];n.computeMaximumLevelAtPosition(i)!==r[t]&&e.push(i)}if(0<e.length)return sampleTerrainMostDetailed(c,e)}).then(function(){return u})})}var ScreenSpaceEventType={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},ScreenSpaceEventType$1=freezeObject$1(ScreenSpaceEventType);function getPosition$1(e,t,i){var r=e._element;if(r===document)return i.x=t.clientX,i.y=t.clientY,i;var n=r.getBoundingClientRect();return i.x=t.clientX-n.left,i.y=t.clientY-n.top,i}function getInputEventKey(e,t){var i=e;return defined(t)&&(i+="+"+t),i}function getModifier(e){return e.shiftKey?KeyboardEventModifier$1.SHIFT:e.ctrlKey?KeyboardEventModifier$1.CTRL:e.altKey?KeyboardEventModifier$1.ALT:void 0}var MouseButton={LEFT:0,MIDDLE:1,RIGHT:2};function registerListener(t,e,i,r){function n(e){r(t,e)}i.addEventListener(e,n,!1),t._removalFunctions.push(function(){i.removeEventListener(e,n,!1)})}function registerListeners(e){var t=e._element,i=defined(t.disableRootEvents)?t:document;FeatureDetection.supportsPointerEvents()?(registerListener(e,"pointerdown",t,handlePointerDown),registerListener(e,"pointerup",t,handlePointerUp),registerListener(e,"pointermove",t,handlePointerMove),registerListener(e,"pointercancel",t,handlePointerUp)):(registerListener(e,"mousedown",t,handleMouseDown),registerListener(e,"mouseup",i,handleMouseUp),registerListener(e,"mousemove",i,handleMouseMove),registerListener(e,"touchstart",t,handleTouchStart),registerListener(e,"touchend",i,handleTouchEnd),registerListener(e,"touchmove",i,handleTouchMove),registerListener(e,"touchcancel",i,handleTouchEnd)),registerListener(e,"dblclick",t,handleDblClick),registerListener(e,"onwheel"in t?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",t,handleWheel)}function unregisterListeners(e){for(var t=e._removalFunctions,i=0;i<t.length;++i)t[i]()}var mouseDownEvent={position:new Cartesian2};function gotTouchEvent(e){e._lastSeenTouchEvent=getTimestamp$1()}function canProcessMouseEvent(e){return getTimestamp$1()-e._lastSeenTouchEvent>ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds}function checkPixelTolerance(e,t,i){var r=e.x-t.x,n=e.y-t.y;return Math.sqrt(r*r+n*n)<i}function handleMouseDown(e,t){if(canProcessMouseEvent(e)){var i,r=t.button;if(e._buttonDown[r]=!0,r===MouseButton.LEFT)i=ScreenSpaceEventType$1.LEFT_DOWN;else if(r===MouseButton.MIDDLE)i=ScreenSpaceEventType$1.MIDDLE_DOWN;else{if(r!==MouseButton.RIGHT)return;i=ScreenSpaceEventType$1.RIGHT_DOWN}var n=getPosition$1(e,t,e._primaryPosition);Cartesian2.clone(n,e._primaryStartPosition),Cartesian2.clone(n,e._primaryPreviousPosition);var a=getModifier(t),o=e.getInputAction(i,a);defined(o)&&(Cartesian2.clone(n,mouseDownEvent.position),o(mouseDownEvent),t.preventDefault())}}var mouseUpEvent={position:new Cartesian2},mouseClickEvent={position:new Cartesian2};function cancelMouseEvent(e,t,i,r){var n=getModifier(r),a=e.getInputAction(t,n),o=e.getInputAction(i,n);if(defined(a)||defined(o)){var s=getPosition$1(e,r,e._primaryPosition);if(defined(a)&&(Cartesian2.clone(s,mouseUpEvent.position),a(mouseUpEvent)),defined(o))checkPixelTolerance(e._primaryStartPosition,s,e._clickPixelTolerance)&&(Cartesian2.clone(s,mouseClickEvent.position),o(mouseClickEvent))}}function handleMouseUp(e,t){if(canProcessMouseEvent(e)){var i=t.button;i!==MouseButton.LEFT&&i!==MouseButton.MIDDLE&&i!==MouseButton.RIGHT||(e._buttonDown[MouseButton.LEFT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.LEFT_UP,ScreenSpaceEventType$1.LEFT_CLICK,t),e._buttonDown[MouseButton.LEFT]=!1),e._buttonDown[MouseButton.MIDDLE]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.MIDDLE_UP,ScreenSpaceEventType$1.MIDDLE_CLICK,t),e._buttonDown[MouseButton.MIDDLE]=!1),e._buttonDown[MouseButton.RIGHT]&&(cancelMouseEvent(e,ScreenSpaceEventType$1.RIGHT_UP,ScreenSpaceEventType$1.RIGHT_CLICK,t),e._buttonDown[MouseButton.RIGHT]=!1))}}var mouseMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2};function handleMouseMove(e,t){if(canProcessMouseEvent(e)){var i=getModifier(t),r=getPosition$1(e,t,e._primaryPosition),n=e._primaryPreviousPosition,a=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,i);defined(a)&&(Cartesian2.clone(n,mouseMoveEvent.startPosition),Cartesian2.clone(r,mouseMoveEvent.endPosition),a(mouseMoveEvent)),Cartesian2.clone(r,n),(e._buttonDown[MouseButton.LEFT]||e._buttonDown[MouseButton.MIDDLE]||e._buttonDown[MouseButton.RIGHT])&&t.preventDefault()}}var mouseDblClickEvent={position:new Cartesian2};function handleDblClick(e,t){var i;if(t.button===MouseButton.LEFT){i=ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK;var r=getModifier(t),n=e.getInputAction(i,r);defined(n)&&(getPosition$1(e,t,mouseDblClickEvent.position),n(mouseDblClickEvent))}}function handleWheel(e,t){var i;if(defined(t.deltaY)){var r=t.deltaMode;i=r===t.DOM_DELTA_PIXEL?-t.deltaY:r===t.DOM_DELTA_LINE?40*-t.deltaY:120*-t.deltaY}else i=0<t.detail?-120*t.detail:t.wheelDelta;if(defined(i)){var n=getModifier(t),a=e.getInputAction(ScreenSpaceEventType$1.WHEEL,n);defined(a)&&(a(i),t.preventDefault())}}function handleTouchStart(e,t){gotTouchEvent(e);var i,r,n,a=t.changedTouches,o=a.length,s=e._positions;for(i=0;i<o;++i)n=(r=a[i]).identifier,s.set(n,getPosition$1(e,r,new Cartesian2));fireTouchEvents(e,t);var l=e._previousPositions;for(i=0;i<o;++i)n=(r=a[i]).identifier,l.set(n,Cartesian2.clone(s.get(n)))}function handleTouchEnd(e,t){gotTouchEvent(e);var i,r,n=t.changedTouches,a=n.length,o=e._positions;for(i=0;i<a;++i)r=n[i].identifier,o.remove(r);fireTouchEvents(e,t);var s=e._previousPositions;for(i=0;i<a;++i)r=n[i].identifier,s.remove(r)}var touchStartEvent={position:new Cartesian2},touch2StartEvent={position1:new Cartesian2,position2:new Cartesian2},touchEndEvent={position:new Cartesian2},touchClickEvent={position:new Cartesian2},touchHoldEvent={position:new Cartesian2};function fireTouchEvents(e,t){var i,r,n=getModifier(t),a=e._positions,o=a.length,s=e._isPinching;if(1!==o&&e._buttonDown[MouseButton.LEFT]){if(e._buttonDown[MouseButton.LEFT]=!1,defined(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),defined(i=e.getInputAction(ScreenSpaceEventType$1.LEFT_UP,n))&&(Cartesian2.clone(e._primaryPosition,touchEndEvent.position),i(touchEndEvent)),0===o&&!e._isTouchHolding)if(defined(r=e.getInputAction(ScreenSpaceEventType$1.LEFT_CLICK,n)))checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._clickPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchClickEvent.position),r(touchClickEvent));e._isTouchHolding=!1}if(0===o&&s&&(e._isPinching=!1,defined(i=e.getInputAction(ScreenSpaceEventType$1.PINCH_END,n))&&i()),1===o&&!s){var l=a.values[0];Cartesian2.clone(l,e._primaryPosition),Cartesian2.clone(l,e._primaryStartPosition),Cartesian2.clone(l,e._primaryPreviousPosition),e._buttonDown[MouseButton.LEFT]=!0,defined(i=e.getInputAction(ScreenSpaceEventType$1.LEFT_DOWN,n))&&(Cartesian2.clone(l,touchStartEvent.position),i(touchStartEvent)),e._touchHoldTimer=setTimeout(function(){e.isDestroyed()||(e._touchHoldTimer=void 0,e._isTouchHolding=!0,!defined(r=e.getInputAction(ScreenSpaceEventType$1.RIGHT_CLICK,n))||checkPixelTolerance(e._primaryStartPosition,e._previousPositions.values[0],e._holdPixelTolerance)&&(Cartesian2.clone(e._primaryPosition,touchHoldEvent.position),r(touchHoldEvent)))},ScreenSpaceEventHandler.touchHoldDelayMilliseconds),t.preventDefault()}2!==o||s||(e._isPinching=!0,defined(i=e.getInputAction(ScreenSpaceEventType$1.PINCH_START,n))&&(Cartesian2.clone(a.values[0],touch2StartEvent.position1),Cartesian2.clone(a.values[1],touch2StartEvent.position2),i(touch2StartEvent),t.preventDefault()))}function handleTouchMove(e,t){gotTouchEvent(e);var i,r,n,a=t.changedTouches,o=a.length,s=e._positions;for(i=0;i<o;++i){n=(r=a[i]).identifier;var l=s.get(n);defined(l)&&getPosition$1(e,r,l)}fireTouchMoveEvents(e,t);var c=e._previousPositions;for(i=0;i<o;++i)n=(r=a[i]).identifier,Cartesian2.clone(s.get(n),c.get(n))}var touchMoveEvent={startPosition:new Cartesian2,endPosition:new Cartesian2},touchPinchMovementEvent={distance:{startPosition:new Cartesian2,endPosition:new Cartesian2},angleAndHeight:{startPosition:new Cartesian2,endPosition:new Cartesian2}};function fireTouchMoveEvents(e,t){var i,r=getModifier(t),n=e._positions,a=e._previousPositions,o=n.length;if(1===o&&e._buttonDown[MouseButton.LEFT]){var s=n.values[0];Cartesian2.clone(s,e._primaryPosition);var l=e._primaryPreviousPosition;defined(i=e.getInputAction(ScreenSpaceEventType$1.MOUSE_MOVE,r))&&(Cartesian2.clone(l,touchMoveEvent.startPosition),Cartesian2.clone(s,touchMoveEvent.endPosition),i(touchMoveEvent)),Cartesian2.clone(s,l),t.preventDefault()}else if(2===o&&e._isPinching&&defined(i=e.getInputAction(ScreenSpaceEventType$1.PINCH_MOVE,r))){var c=n.values[0],u=n.values[1],d=a.values[0],h=a.values[1],p=u.x-c.x,m=u.y-c.y,f=.25*Math.sqrt(p*p+m*m),g=h.x-d.x,_=h.y-d.y,y=.25*Math.sqrt(g*g+_*_),v=.125*(u.y+c.y),C=.125*(h.y+d.y),S=Math.atan2(m,p),x=Math.atan2(_,g);Cartesian2.fromElements(0,y,touchPinchMovementEvent.distance.startPosition),Cartesian2.fromElements(0,f,touchPinchMovementEvent.distance.endPosition),Cartesian2.fromElements(x,C,touchPinchMovementEvent.angleAndHeight.startPosition),Cartesian2.fromElements(S,v,touchPinchMovementEvent.angleAndHeight.endPosition),i(touchPinchMovementEvent)}}function handlePointerDown(e,t){if(t.target.setPointerCapture(t.pointerId),"touch"===t.pointerType){var i=e._positions,r=t.pointerId;i.set(r,getPosition$1(e,t,new Cartesian2)),fireTouchEvents(e,t),e._previousPositions.set(r,Cartesian2.clone(i.get(r)))}else handleMouseDown(e,t)}function handlePointerUp(e,t){if("touch"===t.pointerType){var i=e._positions,r=t.pointerId;i.remove(r),fireTouchEvents(e,t),e._previousPositions.remove(r)}else handleMouseUp(e,t)}function handlePointerMove(e,t){if("touch"===t.pointerType){var i=e._positions,r=t.pointerId,n=i.get(r);if(!defined(n))return;getPosition$1(e,t,n),fireTouchMoveEvents(e,t);var a=e._previousPositions;Cartesian2.clone(i.get(r),a.get(r))}else handleMouseMove(e,t)}function ScreenSpaceEventHandler(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new Cartesian2,this._primaryPosition=new Cartesian2,this._primaryPreviousPosition=new Cartesian2,this._positions=new AssociativeArray,this._previousPositions=new AssociativeArray,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=defaultValue(e,document),registerListeners(this)}function ShowGeometryInstanceAttribute(e){e=defaultValue(e,!0),this.value=ShowGeometryInstanceAttribute.toValue(e)}ScreenSpaceEventHandler.prototype.setInputAction=function(e,t,i){var r=getInputEventKey(t,i);this._inputEvents[r]=e},ScreenSpaceEventHandler.prototype.getInputAction=function(e,t){var i=getInputEventKey(e,t);return this._inputEvents[i]},ScreenSpaceEventHandler.prototype.removeInputAction=function(e,t){var i=getInputEventKey(e,t);delete this._inputEvents[i]},ScreenSpaceEventHandler.prototype.isDestroyed=function(){return!1},ScreenSpaceEventHandler.prototype.destroy=function(){return unregisterListeners(this),destroyObject(this)},ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds=800,ScreenSpaceEventHandler.touchHoldDelayMilliseconds=1500,defineProperties$1(ShowGeometryInstanceAttribute.prototype,{componentDatatype:{get:function(){return ComponentDatatype$1.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}}),ShowGeometryInstanceAttribute.toValue=function(e,t){return defined(t)?(t[0]=e,t):new Uint8Array([e])};var Simon1994PlanetaryPositions={};function computeTdbMinusTtSpice(e){var t=6.239996+.0172019696544*e;return.001657*Math.sin(t+.01671*Math.sin(t))}var TdtMinusTai$1=32.184,J2000d$1=2451545;function taiToTdb(e,t){t=JulianDate.addSeconds(e,TdtMinusTai$1,t);var i=JulianDate.totalDays(t)-J2000d$1;return t=JulianDate.addSeconds(t,computeTdbMinusTtSpice(i),t)}var epoch=new JulianDate(2451545,0,TimeStandard$1.TAI),MetersPerKilometer=1e3,RadiansPerDegree=CesiumMath.RADIANS_PER_DEGREE,RadiansPerArcSecond=CesiumMath.RADIANS_PER_ARCSECOND,MetersPerAstronomicalUnit=14959787e4,perifocalToEquatorial=new Matrix3;function elementsToCartesian(e,t,i,r,n,a,o){i<0&&(i=-i,n+=CesiumMath.PI);var s=e*(1-t),l=r-n,c=n,u=meanAnomalyToTrueAnomaly(a-r,t);perifocalToCartesianMatrix(l,i,c,perifocalToEquatorial);var d=s*(1+t),h=Math.cos(u),p=Math.sin(u),m=d/(1+t*h);return defined(o)?(o.x=m*h,o.y=m*p,o.z=0):o=new Cartesian3(m*h,m*p,0),Matrix3.multiplyByVector(perifocalToEquatorial,o,o)}function meanAnomalyToTrueAnomaly(e,t){return eccentricAnomalyToTrueAnomaly(meanAnomalyToEccentricAnomaly(e,t),t)}var maxIterationCount=50,keplerEqConvergence=CesiumMath.EPSILON8;function meanAnomalyToEccentricAnomaly(e,t){var i,r=Math.floor(e/CesiumMath.TWO_PI),n=(e-=r*CesiumMath.TWO_PI)+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),a=Number.MAX_VALUE;for(i=0;i<maxIterationCount&&Math.abs(a-n)>keplerEqConvergence;++i){n=(a=n)-(a-t*Math.sin(a)-e)/(1-t*Math.cos(a))}return a=n+r*CesiumMath.TWO_PI}function eccentricAnomalyToTrueAnomaly(e,t){var i=Math.floor(e/CesiumMath.TWO_PI);e-=i*CesiumMath.TWO_PI;var r=Math.cos(e)-t,n=Math.sin(e)*Math.sqrt(1-t*t),a=Math.atan2(n,r);return a=CesiumMath.zeroToTwoPi(a),e<0&&(a-=CesiumMath.TWO_PI),a+=i*CesiumMath.TWO_PI}function perifocalToCartesianMatrix(e,t,i,r){var n=Math.cos(e),a=Math.sin(e),o=Math.cos(t),s=Math.sin(t),l=Math.cos(i),c=Math.sin(i);return defined(r)?(r[0]=l*n-c*a*o,r[1]=c*n+l*a*o,r[2]=a*s,r[3]=-l*a-c*n*o,r[4]=-c*a+l*n*o,r[5]=n*s,r[6]=c*s,r[7]=-l*s,r[8]=o):r=new Matrix3(l*n-c*a*o,-l*a-c*n*o,c*s,c*n+l*a*o,-c*a+l*n*o,-l*s,a*s,n*s,o),r}var semiMajorAxis0=1.0000010178*MetersPerAstronomicalUnit,meanLongitude0=100.46645683*RadiansPerDegree,meanLongitude1=1295977422.83429*RadiansPerArcSecond,p1u=16002,p2u=21863,p3u=32004,p4u=10931,p5u=14529,p6u=16368,p7u=15318,p8u=32794,Ca1=64e-7*MetersPerAstronomicalUnit,Ca2=-152e-7*MetersPerAstronomicalUnit,Ca3=62e-7*MetersPerAstronomicalUnit,Ca4=-8e-7*MetersPerAstronomicalUnit,Ca5=32e-7*MetersPerAstronomicalUnit,Ca6=-41e-7*MetersPerAstronomicalUnit,Ca7=19e-7*MetersPerAstronomicalUnit,Ca8=-11e-7*MetersPerAstronomicalUnit,Sa1=1e-7*-150*MetersPerAstronomicalUnit,Sa2=-46e-7*MetersPerAstronomicalUnit,Sa3=68*1e-7*MetersPerAstronomicalUnit,Sa4=54e-7*MetersPerAstronomicalUnit,Sa5=14e-7*MetersPerAstronomicalUnit,Sa6=24e-7*MetersPerAstronomicalUnit,Sa7=-28e-7*MetersPerAstronomicalUnit,Sa8=22e-7*MetersPerAstronomicalUnit,q1u=10,q2u=16002,q3u=21863,q4u=10931,q5u=1473,q6u=32004,q7u=4387,q8u=73,Cl1=-325e-7,Cl2=-322e-7,Cl3=1e-7*-79,Cl4=232*1e-7,Cl5=1e-7*-52,Cl6=97e-7,Cl7=55e-7,Cl8=-41e-7,Sl1=-105e-7,Sl2=-137e-7,Sl3=258e-7,Sl4=35e-7,Sl5=1e-7*-116,Sl6=-88e-7,Sl7=-112e-7,Sl8=-8e-6,scratchDate=new JulianDate(0,0,TimeStandard$1.TAI);function computeSimonEarthMoonBarycenter(e,t){taiToTdb(e,scratchDate);var i=(scratchDate.dayNumber-epoch.dayNumber+(scratchDate.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/(10*TimeConstants$1.DAYS_PER_JULIAN_CENTURY),r=.3595362*i,n=semiMajorAxis0+Ca1*Math.cos(p1u*r)+Sa1*Math.sin(p1u*r)+Ca2*Math.cos(p2u*r)+Sa2*Math.sin(p2u*r)+Ca3*Math.cos(p3u*r)+Sa3*Math.sin(p3u*r)+Ca4*Math.cos(p4u*r)+Sa4*Math.sin(p4u*r)+Ca5*Math.cos(p5u*r)+Sa5*Math.sin(p5u*r)+Ca6*Math.cos(p6u*r)+Sa6*Math.sin(p6u*r)+Ca7*Math.cos(p7u*r)+Sa7*Math.sin(p7u*r)+Ca8*Math.cos(p8u*r)+Sa8*Math.sin(p8u*r),a=meanLongitude0+meanLongitude1*i+Cl1*Math.cos(q1u*r)+Sl1*Math.sin(q1u*r)+Cl2*Math.cos(q2u*r)+Sl2*Math.sin(q2u*r)+Cl3*Math.cos(q3u*r)+Sl3*Math.sin(q3u*r)+Cl4*Math.cos(q4u*r)+Sl4*Math.sin(q4u*r)+Cl5*Math.cos(q5u*r)+Sl5*Math.sin(q5u*r)+Cl6*Math.cos(q6u*r)+Sl6*Math.sin(q6u*r)+Cl7*Math.cos(q7u*r)+Sl7*Math.sin(q7u*r)+Cl8*Math.cos(q8u*r)+Sl8*Math.sin(q8u*r);return elementsToCartesian(n,.0167086342-.0004203654*i,469.97289*RadiansPerArcSecond*i,102.93734808*RadiansPerDegree+11612.3529*RadiansPerArcSecond*i,174.87317577*RadiansPerDegree-8679.27034*RadiansPerArcSecond*i,a,t)}function computeSimonMoon(e,t){taiToTdb(e,scratchDate);var i=(scratchDate.dayNumber-epoch.dayNumber+(scratchDate.secondsOfDay-epoch.secondsOfDay)/TimeConstants$1.SECONDS_PER_DAY)/TimeConstants$1.DAYS_PER_JULIAN_CENTURY,r=i*i,n=r*i,a=n*i,o=383397.7725+.004*i,s=.055545526-16e-9*i,l=5.15668983*RadiansPerDegree,c=-8e-5*i+.02966*r-42e-6*n-13e-8*a,u=83.35324312*RadiansPerDegree,d=14643420.2669*i-38.2702*r-.045047*n+21301e-8*a,h=125.04455501*RadiansPerDegree,p=-6967919.3631*i+6.3602*r+.007625*n-3586e-8*a,m=218.31664563*RadiansPerDegree,f=1732559343.4847*i-6.391*r+.006588*n-3169e-8*a,g=297.85019547*RadiansPerDegree+RadiansPerArcSecond*(1602961601.209*i-6.3706*r+.006593*n-3169e-8*a),_=134.96340251*RadiansPerDegree+RadiansPerArcSecond*(1717915923.2178*i+31.8792*r+.051635*n-2447e-7*a),y=357.52910918*RadiansPerDegree+RadiansPerArcSecond*(129596581.0481*i-.5532*r+136e-6*n-1149e-8*a),v=310.17137918*RadiansPerDegree-RadiansPerArcSecond*(6967051.436*i+6.2068*r+.007618*n-3219e-8*a),C=2*g,S=4*g,x=6*g,T=2*_,b=3*_,E=4*_,P=2*(93.27209062*RadiansPerDegree+RadiansPerArcSecond*(1739527262.8478*i-12.7512*r-.001037*n+417e-8*a));o+=3400.4*Math.cos(C)-635.6*Math.cos(C-_)-235.6*Math.cos(_)+218.1*Math.cos(C-y)+181*Math.cos(C+_),s+=.014216*Math.cos(C-_)+.008551*Math.cos(C-T)-.001383*Math.cos(_)+.001356*Math.cos(C+_)-.001147*Math.cos(S-b)-914e-6*Math.cos(S-T)+869e-6*Math.cos(C-y-_)-627e-6*Math.cos(C)-394e-6*Math.cos(S-E)+282e-6*Math.cos(C-y-T)-279e-6*Math.cos(g-_)-236e-6*Math.cos(T)+231e-6*Math.cos(S)+229e-6*Math.cos(x-E)-201e-6*Math.cos(T-P),c+=486.26*Math.cos(C-P)-40.13*Math.cos(C)+37.51*Math.cos(P)+25.73*Math.cos(T-P)+19.97*Math.cos(C-y-P),d+=-55609*Math.sin(C-_)-34711*Math.sin(C-T)-9792*Math.sin(_)+9385*Math.sin(S-b)+7505*Math.sin(S-T)+5318*Math.sin(C+_)+3484*Math.sin(S-E)-3417*Math.sin(C-y-_)-2530*Math.sin(x-E)-2376*Math.sin(C)-2075*Math.sin(C-b)-1883*Math.sin(T)-1736*Math.sin(x-5*_)+1626*Math.sin(y)-1370*Math.sin(x-b),p+=-5392*Math.sin(C-P)-540*Math.sin(y)-441*Math.sin(C)+423*Math.sin(P)-288*Math.sin(T-P),f+=-3332.9*Math.sin(C)+1197.4*Math.sin(C-_)-662.5*Math.sin(y)+396.3*Math.sin(_)-218*Math.sin(C-y);var A=2*v,w=3*v;c+=46.997*Math.cos(v)*i-.614*Math.cos(C-P+v)*i+.614*Math.cos(C-P-v)*i-.0297*Math.cos(A)*r-.0335*Math.cos(v)*r+.0012*Math.cos(C-P+A)*r-16e-5*Math.cos(v)*n+4e-5*Math.cos(w)*n+4e-5*Math.cos(A)*n;var D=2.116*Math.sin(v)*i-.111*Math.sin(C-P-v)*i-.0015*Math.sin(v)*r;return d+=D,f+=D,p+=-520.77*Math.sin(v)*i+13.66*Math.sin(C-P+v)*i+1.12*Math.sin(C-v)*i-1.06*Math.sin(P-v)*i+.66*Math.sin(A)*r+.371*Math.sin(v)*r-.035*Math.sin(C-P+A)*r-.015*Math.sin(C-P+v)*r+.0014*Math.sin(v)*n-.0011*Math.sin(w)*n-9e-4*Math.sin(A)*n,elementsToCartesian(o*=MetersPerKilometer,s,l+c*RadiansPerArcSecond,u+d*RadiansPerArcSecond,h+p*RadiansPerArcSecond,m+f*RadiansPerArcSecond,t)}var moonEarthMassRatio=.012300034,factor=moonEarthMassRatio/(moonEarthMassRatio+1)*-1;function computeSimonEarth(e,t){return t=computeSimonMoon(e,t),Cartesian3.multiplyByScalar(t,factor,t)}var axesTransformation=new Matrix3(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819),translation$1=new Cartesian3;function interpolateColors$1(e,t,i,r,n,a,o){var s,l=PolylinePipeline.numberOfPoints(e,t,n),c=i.red,u=i.green,d=i.blue,h=i.alpha,p=r.red,m=r.green,f=r.blue,g=r.alpha;if(Color.equals(i,r)){for(s=0;s<l;s++)a[o++]=Color.floatToByte(c),a[o++]=Color.floatToByte(u),a[o++]=Color.floatToByte(d),a[o++]=Color.floatToByte(h);return o}var _=(p-c)/l,y=(m-u)/l,v=(f-d)/l,C=(g-h)/l,S=o;for(s=0;s<l;s++)a[S++]=Color.floatToByte(c+s*_),a[S++]=Color.floatToByte(u+s*y),a[S++]=Color.floatToByte(d+s*v),a[S++]=Color.floatToByte(h+s*C);return S}function SimplePolylineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.colors,r=defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=i,this._colorsPerVertex=r,this._arcType=defaultValue(e.arcType,ArcType$1.GEODESIC),this._granularity=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";var n=1+t.length*Cartesian3.packedLength;n+=defined(i)?1+i.length*Color.packedLength:1,this.packedLength=n+Ellipsoid.packedLength+3}Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),defined(t)||(t=new Cartesian3),translation$1=computeSimonEarthMoonBarycenter(e,translation$1),t=Cartesian3.negate(translation$1,t),computeSimonEarth(e,translation$1),Cartesian3.subtract(t,translation$1,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame=function(e,t){return defined(e)||(e=JulianDate.now()),t=computeSimonMoon(e,t),Matrix3.multiplyByVector(axesTransformation,t,t),t},SimplePolylineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._colors;for(a=defined(o)?o.length:0,t[i++]=a,r=0;r<a;++r,i+=Color.packedLength)Color.pack(o[r],t,i);return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,t[i++]=e._colorsPerVertex?1:0,t[i++]=e._arcType,t[i]=e._granularity,t},SimplePolylineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n=e[t++],a=new Array(n);for(r=0;r<n;++r,t+=Cartesian3.packedLength)a[r]=Cartesian3.unpack(e,t);var o=0<(n=e[t++])?new Array(n):void 0;for(r=0;r<n;++r,t+=Color.packedLength)o[r]=Color.unpack(e,t);var s=Ellipsoid.unpack(e,t);t+=Ellipsoid.packedLength;var l=1===e[t++],c=e[t++],u=e[t];return defined(i)?(i._positions=a,i._colors=o,i._ellipsoid=s,i._colorsPerVertex=l,i._arcType=c,i._granularity=u,i):new SimplePolylineGeometry({positions:a,colors:o,ellipsoid:s,colorsPerVertex:l,arcType:c,granularity:u})};var scratchArray1=new Array(2),scratchArray2=new Array(2),generateArcOptionsScratch={positions:scratchArray1,height:scratchArray2,ellipsoid:void 0,minDistance:void 0,granularity:void 0};function SphereGeometry(e){var t=defaultValue(e.radius,1),i={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,vertexFormat:e.vertexFormat};this._ellipsoidGeometry=new EllipsoidGeometry(i),this._workerName="createSphereGeometry"}SimplePolylineGeometry.createGeometry=function(e){var t,i,r,n,a,o=e._positions,s=e._colors,l=e._colorsPerVertex,c=e._arcType,u=e._granularity,d=e._ellipsoid,h=CesiumMath.chordLength(u,d.maximumRadius),p=defined(s)&&!l,m=o.length,f=0;if(c===ArcType$1.GEODESIC||c===ArcType$1.RHUMB){var g,_,y;y=c===ArcType$1.GEODESIC?(g=CesiumMath.chordLength(u,d.maximumRadius),_=PolylinePipeline.numberOfPoints,PolylinePipeline.generateArc):(g=u,_=PolylinePipeline.numberOfPointsRhumbLine,PolylinePipeline.generateRhumbArc);var v=PolylinePipeline.extractHeights(o,d),C=generateArcOptionsScratch;if(c===ArcType$1.GEODESIC?C.minDistance=h:C.granularity=u,C.ellipsoid=d,p){var S=0;for(t=0;t<m-1;t++)S+=_(o[t],o[t+1],g)+1;i=new Float64Array(3*S),n=new Uint8Array(4*S),C.positions=scratchArray1,C.height=scratchArray2;var x=0;for(t=0;t<m-1;++t){scratchArray1[0]=o[t],scratchArray1[1]=o[t+1],scratchArray2[0]=v[t],scratchArray2[1]=v[t+1];var T=y(C);if(defined(s)){var b=T.length/3;a=s[t];for(var E=0;E<b;++E)n[x++]=Color.floatToByte(a.red),n[x++]=Color.floatToByte(a.green),n[x++]=Color.floatToByte(a.blue),n[x++]=Color.floatToByte(a.alpha)}i.set(T,f),f+=T.length}}else if(C.positions=o,C.height=v,i=new Float64Array(y(C)),defined(s)){for(n=new Uint8Array(i.length/3*4),t=0;t<m-1;++t){f=interpolateColors$1(o[t],o[t+1],s[t],s[t+1],h,n,f)}var P=s[m-1];n[f++]=Color.floatToByte(P.red),n[f++]=Color.floatToByte(P.green),n[f++]=Color.floatToByte(P.blue),n[f++]=Color.floatToByte(P.alpha)}}else{r=p?2*m-2:m,i=new Float64Array(3*r),n=defined(s)?new Uint8Array(4*r):void 0;var A=0,w=0;for(t=0;t<m;++t){var D=o[t];if(p&&0<t&&(Cartesian3.pack(D,i,A),A+=3,a=s[t-1],n[w++]=Color.floatToByte(a.red),n[w++]=Color.floatToByte(a.green),n[w++]=Color.floatToByte(a.blue),n[w++]=Color.floatToByte(a.alpha)),p&&t===m-1)break;Cartesian3.pack(D,i,A),A+=3,defined(s)&&(a=s[t],n[w++]=Color.floatToByte(a.red),n[w++]=Color.floatToByte(a.green),n[w++]=Color.floatToByte(a.blue),n[w++]=Color.floatToByte(a.alpha))}}var M=new GeometryAttributes;M.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:i}),defined(s)&&(M.color=new GeometryAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,values:n,normalize:!0}));var I=2*((r=i.length/3)-1),R=IndexDatatype$1.createTypedArray(r,I),O=0;for(t=0;t<r-1;++t)R[O++]=t,R[O++]=t+1;return new Geometry({attributes:M,indices:R,primitiveType:PrimitiveType$1.LINES,boundingSphere:BoundingSphere.fromPoints(o)})},SphereGeometry.packedLength=EllipsoidGeometry.packedLength,SphereGeometry.pack=function(e,t,i){return EllipsoidGeometry.pack(e._ellipsoidGeometry,t,i)};var scratchEllipsoidGeometry=new EllipsoidGeometry,scratchOptions$k={radius:void 0,radii:new Cartesian3,vertexFormat:new VertexFormat,stackPartitions:void 0,slicePartitions:void 0};function SphereOutlineGeometry(e){var t=defaultValue(e.radius,1),i={radii:new Cartesian3(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new EllipsoidOutlineGeometry(i),this._workerName="createSphereOutlineGeometry"}SphereGeometry.unpack=function(e,t,i){var r=EllipsoidGeometry.unpack(e,t,scratchEllipsoidGeometry);return scratchOptions$k.vertexFormat=VertexFormat.clone(r._vertexFormat,scratchOptions$k.vertexFormat),scratchOptions$k.stackPartitions=r._stackPartitions,scratchOptions$k.slicePartitions=r._slicePartitions,defined(i)?(Cartesian3.clone(r._radii,scratchOptions$k.radii),i._ellipsoidGeometry=new EllipsoidGeometry(scratchOptions$k),i):(scratchOptions$k.radius=r._radii.x,new SphereGeometry(scratchOptions$k))},SphereGeometry.createGeometry=function(e){return EllipsoidGeometry.createGeometry(e._ellipsoidGeometry)},SphereOutlineGeometry.packedLength=EllipsoidOutlineGeometry.packedLength,SphereOutlineGeometry.pack=function(e,t,i){return EllipsoidOutlineGeometry.pack(e._ellipsoidGeometry,t,i)};var scratchEllipsoidGeometry$1=new EllipsoidOutlineGeometry,scratchOptions$l={radius:void 0,radii:new Cartesian3,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};function Spherical(e,t,i){this.clock=defaultValue(e,0),this.cone=defaultValue(t,0),this.magnitude=defaultValue(i,1)}function subdivideArray(e,t){for(var i=[],r=e.length,n=0;n<r;){var a=Math.ceil((r-n)/t--);i.push(e.slice(n,n+a)),n+=a}return i}function TerrainData(){DeveloperError.throwInstantiationError()}SphereOutlineGeometry.unpack=function(e,t,i){var r=EllipsoidOutlineGeometry.unpack(e,t,scratchEllipsoidGeometry$1);return scratchOptions$l.stackPartitions=r._stackPartitions,scratchOptions$l.slicePartitions=r._slicePartitions,scratchOptions$l.subdivisions=r._subdivisions,defined(i)?(Cartesian3.clone(r._radii,scratchOptions$l.radii),i._ellipsoidGeometry=new EllipsoidOutlineGeometry(scratchOptions$l),i):(scratchOptions$l.radius=r._radii.x,new SphereOutlineGeometry(scratchOptions$l))},SphereOutlineGeometry.createGeometry=function(e){return EllipsoidOutlineGeometry.createGeometry(e._ellipsoidGeometry)},Spherical.fromCartesian3=function(e,t){var i=e.x,r=e.y,n=e.z,a=i*i+r*r;return defined(t)||(t=new Spherical),t.clock=Math.atan2(r,i),t.cone=Math.atan2(Math.sqrt(a),n),t.magnitude=Math.sqrt(a+n*n),t},Spherical.clone=function(e,t){if(defined(e))return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=e.magnitude,t):new Spherical(e.clock,e.cone,e.magnitude)},Spherical.normalize=function(e,t){return defined(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=1,t):new Spherical(e.clock,e.cone,1)},Spherical.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.clock===t.clock&&e.cone===t.cone&&e.magnitude===t.magnitude},Spherical.equalsEpsilon=function(e,t,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e.clock-t.clock)<=i&&Math.abs(e.cone-t.cone)<=i&&Math.abs(e.magnitude-t.magnitude)<=i},Spherical.prototype.equals=function(e){return Spherical.equals(this,e)},Spherical.prototype.clone=function(e){return Spherical.clone(this,e)},Spherical.prototype.equalsEpsilon=function(e,t){return Spherical.equalsEpsilon(this,e,t)},Spherical.prototype.toString=function(){return"("+this.clock+", "+this.cone+", "+this.magnitude+")"},defineProperties$1(TerrainData.prototype,{credits:{get:DeveloperError.throwInstantiationError},waterMask:{get:DeveloperError.throwInstantiationError}}),TerrainData.prototype.interpolateHeight=DeveloperError.throwInstantiationError,TerrainData.prototype.isChildAvailable=DeveloperError.throwInstantiationError,TerrainData.prototype.createMesh=DeveloperError.throwInstantiationError,TerrainData.prototype.upsample=DeveloperError.throwInstantiationError,TerrainData.prototype.wasCreatedByUpsampling=DeveloperError.throwInstantiationError;var TileEdge={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7};function TilingScheme(e){}function compareIntervalStartTimes(e,t){return JulianDate.compare(e.start,t.start)}function TimeIntervalCollection(e){if(this._intervals=[],this._changedEvent=new Event,defined(e))for(var t=e.length,i=0;i<t;i++)this.addInterval(e[i])}defineProperties$1(TilingScheme.prototype,{ellipsoid:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},projection:{get:DeveloperError.throwInstantiationError}}),TilingScheme.prototype.getNumberOfXTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.getNumberOfYTilesAtLevel=DeveloperError.throwInstantiationError,TilingScheme.prototype.rectangleToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToNativeRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.tileXYToRectangle=DeveloperError.throwInstantiationError,TilingScheme.prototype.positionToTileXY=DeveloperError.throwInstantiationError,defineProperties$1(TimeIntervalCollection.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){var e=this._intervals;return 0===e.length?void 0:e[0].start}},isStartIncluded:{get:function(){var e=this._intervals;return 0!==e.length&&e[0].isStartIncluded}},stop:{get:function(){var e=this._intervals,t=e.length;return 0===t?void 0:e[t-1].stop}},isStopIncluded:{get:function(){var e=this._intervals,t=e.length;return 0!==t&&e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return 0===this._intervals.length}}}),TimeIntervalCollection.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof TimeIntervalCollection))return!1;var i=this._intervals,r=e._intervals,n=i.length;if(n!==r.length)return!1;for(var a=0;a<n;a++)if(!TimeInterval.equals(i[a],r[a],t))return!1;return!0},TimeIntervalCollection.prototype.get=function(e){return this._intervals[e]},TimeIntervalCollection.prototype.removeAll=function(){0<this._intervals.length&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))},TimeIntervalCollection.prototype.findIntervalContainingDate=function(e){var t=this.indexOf(e);return 0<=t?this._intervals[t]:void 0},TimeIntervalCollection.prototype.findDataForIntervalContainingDate=function(e){var t=this.indexOf(e);return 0<=t?this._intervals[t].data:void 0},TimeIntervalCollection.prototype.contains=function(e){return 0<=this.indexOf(e)};var indexOfScratch=new TimeInterval;TimeIntervalCollection.prototype.indexOf=function(e){var t=this._intervals;indexOfScratch.start=e,indexOfScratch.stop=e;var i=binarySearch(t,indexOfScratch,compareIntervalStartTimes);return 0<=i?t[i].isStartIncluded?i:0<i&&t[i-1].stop.equals(e)&&t[i-1].isStopIncluded?i-1:~i:0<(i=~i)&&i-1<t.length&&TimeInterval.contains(t[i-1],e)?i-1:~i},TimeIntervalCollection.prototype.findInterval=function(e){for(var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).start,i=e.stop,r=e.isStartIncluded,n=e.isStopIncluded,a=this._intervals,o=0,s=a.length;o<s;o++){var l=a[o];if((!defined(t)||l.start.equals(t))&&(!defined(i)||l.stop.equals(i))&&(!defined(r)||l.isStartIncluded===r)&&(!defined(n)||l.isStopIncluded===n))return a[o]}},TimeIntervalCollection.prototype.addInterval=function(e,t){if(!e.isEmpty){var i=this._intervals;if(0===i.length||JulianDate.greaterThan(e.start,i[i.length-1].stop))return i.push(e),void this._changedEvent.raiseEvent(this);var r,n=binarySearch(i,e,compareIntervalStartTimes);for(n<0?n=~n:0<n&&e.isStartIncluded&&i[n-1].isStartIncluded&&i[n-1].start.equals(e.start)?--n:n<i.length&&!e.isStartIncluded&&i[n].isStartIncluded&&i[n].start.equals(e.start)&&++n,0<n&&(0<(r=JulianDate.compare(i[n-1].stop,e.start))||0===r&&(i[n-1].isStopIncluded||e.isStartIncluded))&&((defined(t)?t(i[n-1].data,e.data):i[n-1].data===e.data)?(e=JulianDate.greaterThan(e.stop,i[n-1].stop)?new TimeInterval({start:i[n-1].start,stop:e.stop,isStartIncluded:i[n-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):new TimeInterval({start:i[n-1].start,stop:i[n-1].stop,isStartIncluded:i[n-1].isStartIncluded,isStopIncluded:i[n-1].isStopIncluded||e.stop.equals(i[n-1].stop)&&e.isStopIncluded,data:e.data}),i.splice(n-1,1),--n):((0<(r=JulianDate.compare(i[n-1].stop,e.stop))||0===r&&i[n-1].isStopIncluded&&!e.isStopIncluded)&&i.splice(n,0,new TimeInterval({start:e.stop,stop:i[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:i[n-1].isStopIncluded,data:i[n-1].data})),i[n-1]=new TimeInterval({start:i[n-1].start,stop:e.start,isStartIncluded:i[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:i[n-1].data})));n<i.length&&(0<(r=JulianDate.compare(e.stop,i[n].start))||0===r&&(e.isStopIncluded||i[n].isStartIncluded));)if(defined(t)?t(i[n].data,e.data):i[n].data===e.data)e=new TimeInterval({start:e.start,stop:JulianDate.greaterThan(i[n].stop,e.stop)?i[n].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:JulianDate.greaterThan(i[n].stop,e.stop)?i[n].isStopIncluded:e.isStopIncluded,data:e.data}),i.splice(n,1);else{if(i[n]=new TimeInterval({start:e.stop,stop:i[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:i[n].isStopIncluded,data:i[n].data}),!i[n].isEmpty)break;i.splice(n,1)}i.splice(n,0,e),this._changedEvent.raiseEvent(this)}},TimeIntervalCollection.prototype.removeInterval=function(e){if(e.isEmpty)return!1;var t=this._intervals,i=binarySearch(t,e,compareIntervalStartTimes);i<0&&(i=~i);var r=!1;for(0<i&&(JulianDate.greaterThan(t[i-1].stop,e.start)||t[i-1].stop.equals(e.start)&&t[i-1].isStopIncluded&&e.isStartIncluded)&&(r=!0,(JulianDate.greaterThan(t[i-1].stop,e.stop)||t[i-1].isStopIncluded&&!e.isStopIncluded&&t[i-1].stop.equals(e.stop))&&t.splice(i,0,new TimeInterval({start:e.stop,stop:t[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[i-1].isStopIncluded,data:t[i-1].data})),t[i-1]=new TimeInterval({start:t[i-1].start,stop:e.start,isStartIncluded:t[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[i-1].data})),i<t.length&&!e.isStartIncluded&&t[i].isStartIncluded&&e.start.equals(t[i].start)&&(r=!0,t.splice(i,0,new TimeInterval({start:t[i].start,stop:t[i].start,isStartIncluded:!0,isStopIncluded:!0,data:t[i].data})),++i);i<t.length&&JulianDate.greaterThan(e.stop,t[i].stop);)r=!0,t.splice(i,1);return i<t.length&&e.stop.equals(t[i].stop)&&(r=!0,!e.isStopIncluded&&t[i].isStopIncluded?i+1<t.length&&t[i+1].start.equals(e.stop)&&t[i].data===t[i+1].data?(t.splice(i,1),t[i]=new TimeInterval({start:t[i].start,stop:t[i].stop,isStartIncluded:!0,isStopIncluded:t[i].isStopIncluded,data:t[i].data})):t[i]=new TimeInterval({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[i].data}):t.splice(i,1)),i<t.length&&(JulianDate.greaterThan(e.stop,t[i].start)||e.stop.equals(t[i].start)&&e.isStopIncluded&&t[i].isStartIncluded)&&(r=!0,t[i]=new TimeInterval({start:e.stop,stop:t[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[i].isStopIncluded,data:t[i].data})),r&&this._changedEvent.raiseEvent(this),r},TimeIntervalCollection.prototype.intersect=function(e,t,i){for(var r=new TimeIntervalCollection,n=0,a=0,o=this._intervals,s=e._intervals;n<o.length&&a<s.length;){var l=o[n],c=s[a];if(JulianDate.lessThan(l.stop,c.start))++n;else if(JulianDate.lessThan(c.stop,l.start))++a;else{if(defined(i)||defined(t)&&t(l.data,c.data)||!defined(t)&&c.data===l.data){var u=TimeInterval.intersect(l,c,new TimeInterval,i);u.isEmpty||r.addInterval(u,t)}JulianDate.lessThan(l.stop,c.stop)||l.stop.equals(c.stop)&&!l.isStopIncluded&&c.isStopIncluded?++n:++a}}return r},TimeIntervalCollection.fromJulianDateArray=function(e,t){defined(t)||(t=new TimeIntervalCollection);var i,r=e.julianDates,n=r.length,a=e.dataCallback,o=defaultValue(e.isStartIncluded,!0),s=defaultValue(e.isStopIncluded,!0),l=defaultValue(e.leadingInterval,!1),c=defaultValue(e.trailingInterval,!1),u=0;l&&(++u,(i=new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:r[0],isStartIncluded:!0,isStopIncluded:!o})).data=defined(a)?a(i,t.length):t.length,t.addInterval(i));for(var d=0;d<n-1;++d){var h=r[d],p=r[d+1];(i=new TimeInterval({start:h,stop:p,isStartIncluded:t.length!==u||o,isStopIncluded:d===n-2&&s})).data=defined(a)?a(i,t.length):t.length,t.addInterval(i),h=p}return c&&((i=new TimeInterval({start:r[n-1],stop:Iso8601.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0})).data=defined(a)?a(i,t.length):t.length,t.addInterval(i)),t};var scratchGregorianDate=new GregorianDate,monthLengths=[0,31,28,31,30,31,30,31,31,30,31,30,31];function addToDate(e,t,i){defined(i)||(i=new JulianDate),JulianDate.toGregorianDate(e,scratchGregorianDate);var r=scratchGregorianDate.millisecond+t.millisecond,n=scratchGregorianDate.second+t.second,a=scratchGregorianDate.minute+t.minute,o=scratchGregorianDate.hour+t.hour,s=scratchGregorianDate.day+t.day,l=scratchGregorianDate.month+t.month,c=scratchGregorianDate.year+t.year;for(1e3<=r&&(n+=Math.floor(r/1e3),r%=1e3),60<=n&&(a+=Math.floor(n/60),n%=60),60<=a&&(o+=Math.floor(a/60),a%=60),24<=o&&(s+=Math.floor(o/24),o%=24),monthLengths[2]=isLeapYear(c)?29:28;s>monthLengths[l]||13<=l;)s>monthLengths[l]&&(s-=monthLengths[l],++l),13<=l&&(--l,c+=Math.floor(l/12),l%=12,++l),monthLengths[2]=isLeapYear(c)?29:28;return scratchGregorianDate.millisecond=r,scratchGregorianDate.second=n,scratchGregorianDate.minute=a,scratchGregorianDate.hour=o,scratchGregorianDate.day=s,scratchGregorianDate.month=l,scratchGregorianDate.year=c,JulianDate.fromGregorianDate(scratchGregorianDate,i)}var scratchJulianDate=new JulianDate,durationRegex=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function parseDuration(e,t){if(!defined(e)||0===e.length)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,"P"===e[t.millisecond=0]){var i=e.match(durationRegex);if(!defined(i))return!1;if(defined(i[1])&&(t.year=Number(i[1].replace(",","."))),defined(i[2])&&(t.month=Number(i[2].replace(",","."))),defined(i[3])&&(t.day=7*Number(i[3].replace(",","."))),defined(i[4])&&(t.day+=Number(i[4].replace(",","."))),defined(i[5])&&(t.hour=Number(i[5].replace(",","."))),defined(i[6])&&(t.minute=Number(i[6].replace(",","."))),defined(i[7])){var r=Number(i[7].replace(",","."));t.second=Math.floor(r),t.millisecond=r%1*1e3}}else"Z"!==e[e.length-1]&&(e+="Z"),JulianDate.toGregorianDate(JulianDate.fromIso8601(e,scratchJulianDate),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}var scratchDuration=new GregorianDate;TimeIntervalCollection.fromIso8601=function(e,t){var i=e.iso8601.split("/"),r=JulianDate.fromIso8601(i[0]),n=JulianDate.fromIso8601(i[1]),a=[];if(parseDuration(i[2],scratchDuration)){var o=JulianDate.clone(r);for(a.push(o);JulianDate.compare(o,n)<0;){o=addToDate(o,scratchDuration),JulianDate.compare(n,o)<=0&&JulianDate.clone(n,o),a.push(o)}}else a.push(r,n);return TimeIntervalCollection.fromJulianDateArray({julianDates:a,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DateArray=function(e,t){return TimeIntervalCollection.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(e){return JulianDate.fromIso8601(e)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},TimeIntervalCollection.fromIso8601DurationArray=function(e,t){for(var i,r,n=e.epoch,a=e.iso8601Durations,o=defaultValue(e.relativeToPrevious,!1),s=[],l=a.length,c=0;c<l;++c)!parseDuration(a[c],scratchDuration)&&0!==c||(i=o&&defined(r)?addToDate(r,scratchDuration):addToDate(n,scratchDuration),s.push(i),r=i);return TimeIntervalCollection.fromJulianDateArray({julianDates:s,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};var defaultScale=new Cartesian3(1,1,1),defaultTranslation=Cartesian3.ZERO,defaultRotation=Quaternion.IDENTITY,TranslationRotationScale=function(e,t,i){this.translation=Cartesian3.clone(defaultValue(e,defaultTranslation)),this.rotation=Quaternion.clone(defaultValue(t,defaultRotation)),this.scale=Cartesian3.clone(defaultValue(i,defaultScale))};function VideoSynchronizer(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._clock=void 0,this._element=void 0,this._clockSubscription=void 0,this._seekFunction=void 0,this._lastPlaybackRate=void 0,this.clock=e.clock,this.element=e.element,this.epoch=defaultValue(e.epoch,Iso8601.MINIMUM_VALUE),this.tolerance=defaultValue(e.tolerance,1),this._seeking=!1,this._seekFunction=void 0,this._firstTickAfterSeek=!1}function createSeekFunction(e){return function(){e._seeking=!1,e._firstTickAfterSeek=!0}}function DataRectangle(e,t){this.rectangle=e,this.maxLevel=t}function VRTheWorldTerrainProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=Resource.createIfNeeded(e.url);this._resource=t,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer(),this._terrainDataStructure={heightScale:.001,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0,lowestEncodedHeight:0,highestEncodedHeight:16777215};var i=e.credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i,this._tilingScheme=void 0,this._rectangles=[];var r,d=this,h=defaultValue(e.ellipsoid,Ellipsoid.WGS84);function n(e){var t=e.getElementsByTagName("SRS")[0].textContent;if("EPSG:4326"===t){d._tilingScheme=new GeographicTilingScheme({ellipsoid:h});var i=e.getElementsByTagName("TileFormat")[0];d._heightmapWidth=parseInt(i.getAttribute("width"),10),d._heightmapHeight=parseInt(i.getAttribute("height"),10),d._levelZeroMaximumGeometricError=TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(h,Math.min(d._heightmapWidth,d._heightmapHeight),d._tilingScheme.getNumberOfXTilesAtLevel(0));for(var r=e.getElementsByTagName("DataExtent"),n=0;n<r.length;++n){var a=r[n],o=CesiumMath.toRadians(parseFloat(a.getAttribute("minx"))),s=CesiumMath.toRadians(parseFloat(a.getAttribute("miny"))),l=CesiumMath.toRadians(parseFloat(a.getAttribute("maxx"))),c=CesiumMath.toRadians(parseFloat(a.getAttribute("maxy"))),u=parseInt(a.getAttribute("maxlevel"),10);d._rectangles.push(new DataRectangle(new Rectangle(o,s,l,c),u))}d._ready=!0,d._readyPromise.resolve(!0)}else p("SRS "+t+" is not supported.")}function p(e){var t=defaultValue(e,"An error occurred while accessing "+d._resource.url+".");r=TileProviderError.handleError(r,d,d._errorEvent,t,void 0,void 0,void 0,a)}function a(){when(d._resource.fetchXML(),n,p)}a()}TranslationRotationScale.prototype.equals=function(e){return this===e||defined(e)&&Cartesian3.equals(this.translation,e.translation)&&Quaternion.equals(this.rotation,e.rotation)&&Cartesian3.equals(this.scale,e.scale)},defineProperties$1(VideoSynchronizer.prototype,{clock:{get:function(){return this._clock},set:function(e){var t=this._clock;t!==e&&(defined(t)&&(this._clockSubscription(),this._clockSubscription=void 0),defined(e)&&(this._clockSubscription=e.onTick.addEventListener(VideoSynchronizer.prototype._onTick,this)),this._clock=e)}},element:{get:function(){return this._element},set:function(e){var t=this._element;t!==e&&(defined(t)&&t.removeEventListener("seeked",this._seekFunction,!1),defined(e)&&(this._seeking=!1,this._seekFunction=createSeekFunction(this),e.addEventListener("seeked",this._seekFunction,!1)),this._element=e,this._seeking=!1,this._firstTickAfterSeek=!1)}}}),VideoSynchronizer.prototype.destroy=function(){return this.element=void 0,this.clock=void 0,destroyObject(this)},VideoSynchronizer.prototype.isDestroyed=function(){return!1},VideoSynchronizer.prototype._trySetPlaybackRate=function(e){if(this._lastPlaybackRate!==e.multiplier){var t=this._element;try{t.playbackRate=e.multiplier}catch(e){t.playbackRate=0}this._lastPlaybackRate=e.multiplier}},VideoSynchronizer.prototype._onTick=function(e){var t=this._element;if(defined(t)&&!(t.readyState<2)){var i=t.paused,r=e.shouldAnimate;if(r===i&&(r?t.play():t.pause()),this._seeking||this._firstTickAfterSeek)this._firstTickAfterSeek=!1;else{this._trySetPlaybackRate(e);var n,a=e.currentTime,o=defaultValue(this.epoch,Iso8601.MINIMUM_VALUE),s=JulianDate.secondsDifference(a,o),l=t.duration,c=t.currentTime;n=t.loop?((s%=l)<0&&(s=l-s),s):l<s?l:s<0?0:s;var u=r?defaultValue(this.tolerance,1):.001;Math.abs(n-c)>u&&(this._seeking=!0,t.currentTime=n)}}},defineProperties$1(VRTheWorldTerrainProvider.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}}}),VRTheWorldTerrainProvider.prototype.requestTileGeometry=function(t,i,r,e){var n=this._tilingScheme.getNumberOfYTilesAtLevel(r),a=this._resource.getDerivedResource({url:r+"/"+t+"/"+(n-i-1)+".tif",queryParameters:{cesium:!0},request:e}).fetchImage({preferImageBitmap:!0});if(defined(a)){var o=this;return when(a).then(function(e){return new HeightmapTerrainData({buffer:getImagePixels(e),width:o._heightmapWidth,height:o._heightmapHeight,childTileMask:getChildMask(o,t,i,r),structure:o._terrainDataStructure})})}},VRTheWorldTerrainProvider.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};var rectangleScratch$4=new Rectangle;function getChildMask(e,t,i,r){for(var n=e._tilingScheme,a=e._rectangles,o=n.tileXYToRectangle(t,i,r),s=0,l=0;l<a.length&&15!==s;++l){var c=a[l];if(!(c.maxLevel<=r)){var u=c.rectangle;defined(Rectangle.intersection(u,o,rectangleScratch$4))&&(isTileInRectangle(n,u,2*t,2*i,r+1)&&(s|=4),isTileInRectangle(n,u,2*t+1,2*i,r+1)&&(s|=8),isTileInRectangle(n,u,2*t,2*i+1,r+1)&&(s|=1),isTileInRectangle(n,u,2*t+1,2*i+1,r+1)&&(s|=2))}}return s}function isTileInRectangle(e,t,i,r,n){var a=e.tileXYToRectangle(i,r,n);return defined(Rectangle.intersection(a,t,rectangleScratch$4))}VRTheWorldTerrainProvider.prototype.getTileDataAvailable=function(e,t,i){},VRTheWorldTerrainProvider.prototype.loadTileDataAvailability=function(e,t,i){};var WallGeometryLibrary={};function latLonEquals(e,t){return CesiumMath.equalsEpsilon(e.latitude,t.latitude,CesiumMath.EPSILON14)&&CesiumMath.equalsEpsilon(e.longitude,t.longitude,CesiumMath.EPSILON14)}var scratchCartographic1$2=new Cartographic,scratchCartographic2$1=new Cartographic;function removeDuplicates(e,t,i,r){var n=t.length;if(!(n<2)){var a=defined(r),o=defined(i),s=!0,l=new Array(n),c=new Array(n),u=new Array(n),d=t[0];l[0]=d;var h=e.cartesianToCartographic(d,scratchCartographic1$2);o&&(h.height=i[0]),s=s&&h.height<=0,c[0]=h.height,u[0]=a?r[0]:0;for(var p=1,m=1;m<n;++m){var f=t[m],g=e.cartesianToCartographic(f,scratchCartographic2$1);o&&(g.height=i[m]),s=s&&g.height<=0,latLonEquals(h,g)?h.height<g.height&&(c[p-1]=g.height):(l[p]=f,c[p]=g.height,u[p]=a?r[m]:0,Cartographic.clone(g,h),++p)}if(!(s||p<2))return l.length=p,c.length=p,u.length=p,{positions:l,topHeights:c,bottomHeights:u}}}var positionsArrayScratch=new Array(2),heightsArrayScratch=new Array(2),generateArcOptionsScratch$1={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};WallGeometryLibrary.computePositions=function(e,t,i,r,n,a){var o=removeDuplicates(e,t,i,r);if(defined(o)){if(t=o.positions,i=o.topHeights,r=o.bottomHeights,3<=t.length){var s=EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t);PolygonPipeline.computeWindingOrder2D(s)===WindingOrder$1.CLOCKWISE&&(t.reverse(),i.reverse(),r.reverse())}var l,c,u=t.length,d=u-2,h=CesiumMath.chordLength(n,e.maximumRadius),p=generateArcOptionsScratch$1;if(p.minDistance=h,p.ellipsoid=e,a){var m,f=0;for(m=0;m<u-1;m++)f+=PolylinePipeline.numberOfPoints(t[m],t[m+1],h)+1;l=new Float64Array(3*f),c=new Float64Array(3*f);var g=positionsArrayScratch,_=heightsArrayScratch;p.positions=g,p.height=_;var y=0;for(m=0;m<u-1;m++){g[0]=t[m],g[1]=t[m+1],_[0]=i[m],_[1]=i[m+1];var v=PolylinePipeline.generateArc(p);l.set(v,y),_[0]=r[m],_[1]=r[m+1],c.set(PolylinePipeline.generateArc(p),y),y+=v.length}}else p.positions=t,p.height=i,l=new Float64Array(PolylinePipeline.generateArc(p)),p.height=r,c=new Float64Array(PolylinePipeline.generateArc(p));return{bottomPositions:c,topPositions:l,numCorners:d}}};var scratchCartesian3Position1=new Cartesian3,scratchCartesian3Position2=new Cartesian3,scratchCartesian3Position3=new Cartesian3,scratchCartesian3Position4=new Cartesian3,scratchCartesian3Position5=new Cartesian3,scratchBitangent$4=new Cartesian3,scratchTangent$4=new Cartesian3,scratchNormal$6=new Cartesian3;function WallGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,r=e.minimumHeights,n=defaultValue(e.vertexFormat,VertexFormat.DEFAULT),a=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),o=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=r,this._maximumHeights=i,this._vertexFormat=VertexFormat.clone(n),this._granularity=a,this._ellipsoid=Ellipsoid.clone(o),this._workerName="createWallGeometry";var s=1+t.length*Cartesian3.packedLength+2;defined(r)&&(s+=r.length),defined(i)&&(s+=i.length),this.packedLength=s+Ellipsoid.packedLength+VertexFormat.packedLength+1}WallGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._minimumHeights;if(a=defined(o)?o.length:0,t[i++]=a,defined(o))for(r=0;r<a;++r)t[i++]=o[r];var s=e._maximumHeights;if(a=defined(s)?s.length:0,t[i++]=a,defined(s))for(r=0;r<a;++r)t[i++]=s[r];return Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,VertexFormat.pack(e._vertexFormat,t,i),t[i+=VertexFormat.packedLength]=e._granularity,t};var scratchEllipsoid$c=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchVertexFormat$c=new VertexFormat,scratchOptions$m={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$c,vertexFormat:scratchVertexFormat$c,granularity:void 0};WallGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n,a,o=e[t++],s=new Array(o);for(r=0;r<o;++r,t+=Cartesian3.packedLength)s[r]=Cartesian3.unpack(e,t);if(0<(o=e[t++]))for(n=new Array(o),r=0;r<o;++r)n[r]=e[t++];if(0<(o=e[t++]))for(a=new Array(o),r=0;r<o;++r)a[r]=e[t++];var l=Ellipsoid.unpack(e,t,scratchEllipsoid$c);t+=Ellipsoid.packedLength;var c=VertexFormat.unpack(e,t,scratchVertexFormat$c),u=e[t+=VertexFormat.packedLength];return defined(i)?(i._positions=s,i._minimumHeights=n,i._maximumHeights=a,i._ellipsoid=Ellipsoid.clone(l,i._ellipsoid),i._vertexFormat=VertexFormat.clone(c,i._vertexFormat),i._granularity=u,i):(scratchOptions$m.positions=s,scratchOptions$m.minimumHeights=n,scratchOptions$m.maximumHeights=a,scratchOptions$m.granularity=u,new WallGeometry(scratchOptions$m))},WallGeometry.fromConstantHeights=function(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.minimumHeight,a=e.maximumHeight,o=defined(n),s=defined(a);if(o||s){var l=r.length;t=o?new Array(l):void 0,i=s?new Array(l):void 0;for(var c=0;c<l;++c)o&&(t[c]=n),s&&(i[c]=a)}return new WallGeometry({positions:r,maximumHeights:i,minimumHeights:t,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},WallGeometry.createGeometry=function(e){var t=e._positions,i=e._minimumHeights,r=e._maximumHeights,n=e._vertexFormat,a=e._granularity,o=e._ellipsoid,s=WallGeometryLibrary.computePositions(o,t,r,i,a,!0);if(defined(s)){var l,c=s.bottomPositions,u=s.topPositions,d=s.numCorners,h=u.length,p=2*h,m=n.position?new Float64Array(p):void 0,f=n.normal?new Float32Array(p):void 0,g=n.tangent?new Float32Array(p):void 0,_=n.bitangent?new Float32Array(p):void 0,y=n.st?new Float32Array(p/3*2):void 0,v=0,C=0,S=0,x=0,T=0,b=scratchNormal$6,E=scratchTangent$4,P=scratchBitangent$4,A=!0,w=0,D=1/((h/=3)-t.length+1);for(l=0;l<h;++l){var M=3*l,I=Cartesian3.fromArray(u,M,scratchCartesian3Position1),R=Cartesian3.fromArray(c,M,scratchCartesian3Position2);if(n.position&&(m[v++]=R.x,m[v++]=R.y,m[v++]=R.z,m[v++]=I.x,m[v++]=I.y,m[v++]=I.z),n.st&&(y[T++]=w,y[T++]=0,y[T++]=w,y[T++]=1),n.normal||n.tangent||n.bitangent){var O,L=Cartesian3.clone(Cartesian3.ZERO,scratchCartesian3Position5),F=o.scaleToGeodeticSurface(Cartesian3.fromArray(u,M,scratchCartesian3Position2),scratchCartesian3Position2);if(l+1<h&&(O=o.scaleToGeodeticSurface(Cartesian3.fromArray(u,3+M,scratchCartesian3Position3),scratchCartesian3Position3),L=Cartesian3.fromArray(u,3+M,scratchCartesian3Position5)),A){var N=Cartesian3.subtract(L,I,scratchCartesian3Position4),B=Cartesian3.subtract(F,I,scratchCartesian3Position1);b=Cartesian3.normalize(Cartesian3.cross(B,N,b),b),A=!1}Cartesian3.equalsEpsilon(O,F,CesiumMath.EPSILON10)?A=!0:(w+=D,n.tangent&&(E=Cartesian3.normalize(Cartesian3.subtract(O,F,E),E)),n.bitangent&&(P=Cartesian3.normalize(Cartesian3.cross(b,E,P),P))),n.normal&&(f[C++]=b.x,f[C++]=b.y,f[C++]=b.z,f[C++]=b.x,f[C++]=b.y,f[C++]=b.z),n.tangent&&(g[x++]=E.x,g[x++]=E.y,g[x++]=E.z,g[x++]=E.x,g[x++]=E.y,g[x++]=E.z),n.bitangent&&(_[S++]=P.x,_[S++]=P.y,_[S++]=P.z,_[S++]=P.x,_[S++]=P.y,_[S++]=P.z)}}var V=new GeometryAttributes;n.position&&(V.position=new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:m})),n.normal&&(V.normal=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:f})),n.tangent&&(V.tangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:g})),n.bitangent&&(V.bitangent=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:_})),n.st&&(V.st=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:y}));var k=p/3;p-=6*(d+1);var $=IndexDatatype$1.createTypedArray(k,p),z=0;for(l=0;l<k-2;l+=2){var U=l,G=l+2,H=Cartesian3.fromArray(m,3*U,scratchCartesian3Position1),W=Cartesian3.fromArray(m,3*G,scratchCartesian3Position2);if(!Cartesian3.equalsEpsilon(H,W,CesiumMath.EPSILON10)){var q=l+1,j=l+3;$[z++]=q,$[z++]=U,$[z++]=j,$[z++]=j,$[z++]=U,$[z++]=G}}return new Geometry({attributes:V,indices:$,primitiveType:PrimitiveType$1.TRIANGLES,boundingSphere:new BoundingSphere.fromVertices(m)})}};var scratchCartesian3Position1$1=new Cartesian3,scratchCartesian3Position2$1=new Cartesian3;function WallOutlineGeometry(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,r=e.minimumHeights,n=defaultValue(e.granularity,CesiumMath.RADIANS_PER_DEGREE),a=defaultValue(e.ellipsoid,Ellipsoid.WGS84);this._positions=t,this._minimumHeights=r,this._maximumHeights=i,this._granularity=n,this._ellipsoid=Ellipsoid.clone(a),this._workerName="createWallOutlineGeometry";var o=1+t.length*Cartesian3.packedLength+2;defined(r)&&(o+=r.length),defined(i)&&(o+=i.length),this.packedLength=o+Ellipsoid.packedLength+1}WallOutlineGeometry.pack=function(e,t,i){var r;i=defaultValue(i,0);var n=e._positions,a=n.length;for(t[i++]=a,r=0;r<a;++r,i+=Cartesian3.packedLength)Cartesian3.pack(n[r],t,i);var o=e._minimumHeights;if(a=defined(o)?o.length:0,t[i++]=a,defined(o))for(r=0;r<a;++r)t[i++]=o[r];var s=e._maximumHeights;if(a=defined(s)?s.length:0,t[i++]=a,defined(s))for(r=0;r<a;++r)t[i++]=s[r];return Ellipsoid.pack(e._ellipsoid,t,i),t[i+=Ellipsoid.packedLength]=e._granularity,t};var scratchEllipsoid$d=Ellipsoid.clone(Ellipsoid.UNIT_SPHERE),scratchOptions$n={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:scratchEllipsoid$d,granularity:void 0};function webGLConstantToGlslType(e){switch(e){case WebGLConstants$1.FLOAT:return"float";case WebGLConstants$1.FLOAT_VEC2:return"vec2";case WebGLConstants$1.FLOAT_VEC3:return"vec3";case WebGLConstants$1.FLOAT_VEC4:return"vec4";case WebGLConstants$1.FLOAT_MAT2:return"mat2";case WebGLConstants$1.FLOAT_MAT3:return"mat3";case WebGLConstants$1.FLOAT_MAT4:return"mat4";case WebGLConstants$1.SAMPLER_2D:return"sampler2D";case WebGLConstants$1.BOOL:return"bool"}}function WeightSpline(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).weights,i=e.times;this._times=i,this._weights=t,this._count=t.length/i.length,this._lastTimeIndex=0}function wrapFunction(e,t,i){return function(){i.apply(e,arguments),t.apply(e,arguments)}}function ConstantProperty(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Event,this.setValue(e)}function createProperty(r,n,a,e,o){return{configurable:e,get:function(){return this[n]},set:function(e){var t=this[n],i=this[a];defined(i)&&(i(),this[a]=void 0),!(void 0!==e)||defined(e)&&defined(e.getValue)||!defined(o)||(e=o(e)),t!==e&&(this[n]=e,this._definitionChanged.raiseEvent(this,r,e,t)),defined(e)&&defined(e.definitionChanged)&&(this[a]=e.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,r,e,e)},this))}}}function createConstantProperty(e){return new ConstantProperty(e)}function createPropertyDescriptor(e,t,i){return createProperty(e,"_"+e.toString(),"_"+e.toString()+"Subscription",defaultValue(t,!1),defaultValue(i,createConstantProperty))}function BillboardGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}WallOutlineGeometry.unpack=function(e,t,i){var r;t=defaultValue(t,0);var n,a,o=e[t++],s=new Array(o);for(r=0;r<o;++r,t+=Cartesian3.packedLength)s[r]=Cartesian3.unpack(e,t);if(0<(o=e[t++]))for(n=new Array(o),r=0;r<o;++r)n[r]=e[t++];if(0<(o=e[t++]))for(a=new Array(o),r=0;r<o;++r)a[r]=e[t++];var l=Ellipsoid.unpack(e,t,scratchEllipsoid$d),c=e[t+=Ellipsoid.packedLength];return defined(i)?(i._positions=s,i._minimumHeights=n,i._maximumHeights=a,i._ellipsoid=Ellipsoid.clone(l,i._ellipsoid),i._granularity=c,i):(scratchOptions$n.positions=s,scratchOptions$n.minimumHeights=n,scratchOptions$n.maximumHeights=a,scratchOptions$n.granularity=c,new WallOutlineGeometry(scratchOptions$n))},WallOutlineGeometry.fromConstantHeights=function(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).positions,n=e.minimumHeight,a=e.maximumHeight,o=defined(n),s=defined(a);if(o||s){var l=r.length;t=o?new Array(l):void 0,i=s?new Array(l):void 0;for(var c=0;c<l;++c)o&&(t[c]=n),s&&(i[c]=a)}return new WallOutlineGeometry({positions:r,maximumHeights:i,minimumHeights:t,ellipsoid:e.ellipsoid})},WallOutlineGeometry.createGeometry=function(e){var t=e._positions,i=e._minimumHeights,r=e._maximumHeights,n=e._granularity,a=e._ellipsoid,o=WallGeometryLibrary.computePositions(a,t,r,i,n,!1);if(defined(o)){var s,l=o.bottomPositions,c=o.topPositions,u=c.length,d=2*u,h=new Float64Array(d),p=0;for(u/=3,s=0;s<u;++s){var m=3*s,f=Cartesian3.fromArray(c,m,scratchCartesian3Position1$1),g=Cartesian3.fromArray(l,m,scratchCartesian3Position2$1);h[p++]=g.x,h[p++]=g.y,h[p++]=g.z,h[p++]=f.x,h[p++]=f.y,h[p++]=f.z}var _=new GeometryAttributes({position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.DOUBLE,componentsPerAttribute:3,values:h})}),y=d/3;d=2*y-4+y;var v=IndexDatatype$1.createTypedArray(y,d),C=0;for(s=0;s<y-2;s+=2){var S=s,x=s+2,T=Cartesian3.fromArray(h,3*S,scratchCartesian3Position1$1),b=Cartesian3.fromArray(h,3*x,scratchCartesian3Position2$1);if(!Cartesian3.equalsEpsilon(T,b,CesiumMath.EPSILON10)){var E=s+1,P=s+3;v[C++]=E,v[C++]=S,v[C++]=E,v[C++]=P,v[C++]=S,v[C++]=x}}return v[C++]=y-2,v[C++]=y-1,new Geometry({attributes:_,indices:v,primitiveType:PrimitiveType$1.LINES,boundingSphere:new BoundingSphere.fromVertices(h)})}},defineProperties$1(WeightSpline.prototype,{times:{get:function(){return this._times}},weights:{get:function(){return this._weights}}}),WeightSpline.prototype.findTimeInterval=Spline.prototype.findTimeInterval,WeightSpline.prototype.wrapTime=Spline.prototype.wrapTime,WeightSpline.prototype.clampTime=Spline.prototype.clampTime,WeightSpline.prototype.evaluate=function(e,t){var i=this.weights,r=this.times,n=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),a=(e-r[n])/(r[n+1]-r[n]);defined(t)||(t=new Array(this._count));for(var o=0;o<this._count;o++){var s=n*this._count+o;t[o]=i[s]*(1-a)+i[s+this._count]*a}return t},defineProperties$1(ConstantProperty.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),ConstantProperty.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},ConstantProperty.prototype.setValue=function(e){var t=this._value;if(t!==e){var i=defined(e),r=i&&"function"==typeof e.clone,n=i&&"function"==typeof e.equals;(!n||!e.equals(t))&&(this._hasClone=r,this._hasEquals=n,this._value=r?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}},ConstantProperty.prototype.equals=function(e){return this===e||e instanceof ConstantProperty&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},ConstantProperty.prototype.valueOf=function(){return this._value},ConstantProperty.prototype.toString=function(){return String(this._value)},defineProperties$1(BillboardGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),image:createPropertyDescriptor("image"),scale:createPropertyDescriptor("scale"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),rotation:createPropertyDescriptor("rotation"),alignedAxis:createPropertyDescriptor("alignedAxis"),sizeInMeters:createPropertyDescriptor("sizeInMeters"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),imageSubRegion:createPropertyDescriptor("imageSubRegion"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),BillboardGraphics.prototype.clone=function(e){return defined(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 BillboardGraphics(this)},BillboardGraphics.prototype.merge=function(e){this.show=defaultValue(this._show,e.show),this.image=defaultValue(this._image,e.image),this.scale=defaultValue(this._scale,e.scale),this.pixelOffset=defaultValue(this._pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this._verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this._heightReference,e.heightReference),this.color=defaultValue(this._color,e.color),this.rotation=defaultValue(this._rotation,e.rotation),this.alignedAxis=defaultValue(this._alignedAxis,e.alignedAxis),this.sizeInMeters=defaultValue(this._sizeInMeters,e.sizeInMeters),this.width=defaultValue(this._width,e.width),this.height=defaultValue(this._height,e.height),this.scaleByDistance=defaultValue(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=defaultValue(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=defaultValue(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this._disableDepthTestDistance,e.disableDepthTestDistance)};var HeightReference={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2},HeightReference$1=freezeObject$1(HeightReference),HorizontalOrigin={CENTER:0,LEFT:1,RIGHT:-1},HorizontalOrigin$1=freezeObject$1(HorizontalOrigin),VerticalOrigin={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},VerticalOrigin$1=freezeObject$1(VerticalOrigin),BoundingSphereState={DONE:0,PENDING:1,FAILED:2},BoundingSphereState$1=freezeObject$1(BoundingSphereState);function Property(){DeveloperError.throwInstantiationError()}defineProperties$1(Property.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),Property.prototype.getValue=DeveloperError.throwInstantiationError,Property.prototype.equals=DeveloperError.throwInstantiationError,Property.equals=function(e,t){return e===t||defined(e)&&e.equals(t)},Property.arrayEquals=function(e,t){if(e===t)return!0;if(!defined(e)||!defined(t)||e.length!==t.length)return!1;for(var i=e.length,r=0;r<i;r++)if(!Property.equals(e[r],t[r]))return!1;return!0},Property.isConstant=function(e){return!defined(e)||e.isConstant},Property.getValueOrUndefined=function(e,t,i){return defined(e)?e.getValue(t,i):void 0},Property.getValueOrDefault=function(e,t,i,r){return defined(e)?defaultValue(e.getValue(t,r),i):i},Property.getValueOrClonedDefault=function(e,t,i,r){var n;return defined(e)&&(n=e.getValue(t,r)),defined(n)||(n=i.clone(n)),n};var defaultColor=Color.WHITE,defaultEyeOffset=Cartesian3.ZERO,defaultHeightReference=HeightReference$1.NONE,defaultPixelOffset=Cartesian2.ZERO,defaultScale$1=1,defaultRotation$1=0,defaultAlignedAxis=Cartesian3.ZERO,defaultHorizontalOrigin=HorizontalOrigin$1.CENTER,defaultVerticalOrigin=VerticalOrigin$1.CENTER,defaultSizeInMeters=!1,positionScratch$4=new Cartesian3,colorScratch$1=new Color,eyeOffsetScratch=new Cartesian3,pixelOffsetScratch=new Cartesian2,scaleByDistanceScratch=new NearFarScalar,translucencyByDistanceScratch=new NearFarScalar,pixelOffsetScaleByDistanceScratch=new NearFarScalar,boundingRectangleScratch=new BoundingRectangle,distanceDisplayConditionScratch=new DistanceDisplayCondition;function EntityData(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function BillboardVisualizer(e,t){t.collectionChanged.addEventListener(BillboardVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive(e,t,i){defined(e)&&(e.billboard=void 0,i.removeBillboard(t))}BillboardVisualizer.prototype.update=function(e){for(var t=this._items.values,i=this._cluster,r=0,n=t.length;r<n;r++){var a,o,s=t[r],l=s.entity,c=l._billboard,u=s.billboard,d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(o=Property.getValueOrUndefined(l._position,e,positionScratch$4),a=Property.getValueOrUndefined(c._image,e),d=defined(o)&&defined(a)),d){Property.isConstant(l._position)||(i._clusterDirty=!0),defined(u)||((u=i.getBillboard(l)).id=l,u.image=void 0,s.billboard=u),u.show=d,defined(u.image)&&s.textureValue===a||(u.image=a,s.textureValue=a),u.position=o,u.color=Property.getValueOrDefault(c._color,e,defaultColor,colorScratch$1),u.eyeOffset=Property.getValueOrDefault(c._eyeOffset,e,defaultEyeOffset,eyeOffsetScratch),u.heightReference=Property.getValueOrDefault(c._heightReference,e,defaultHeightReference),u.pixelOffset=Property.getValueOrDefault(c._pixelOffset,e,defaultPixelOffset,pixelOffsetScratch),u.scale=Property.getValueOrDefault(c._scale,e,defaultScale$1),u.rotation=Property.getValueOrDefault(c._rotation,e,defaultRotation$1),u.alignedAxis=Property.getValueOrDefault(c._alignedAxis,e,defaultAlignedAxis),u.horizontalOrigin=Property.getValueOrDefault(c._horizontalOrigin,e,defaultHorizontalOrigin),u.verticalOrigin=Property.getValueOrDefault(c._verticalOrigin,e,defaultVerticalOrigin),u.width=Property.getValueOrUndefined(c._width,e),u.height=Property.getValueOrUndefined(c._height,e),u.scaleByDistance=Property.getValueOrUndefined(c._scaleByDistance,e,scaleByDistanceScratch),u.translucencyByDistance=Property.getValueOrUndefined(c._translucencyByDistance,e,translucencyByDistanceScratch),u.pixelOffsetScaleByDistance=Property.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch),u.sizeInMeters=Property.getValueOrDefault(c._sizeInMeters,e,defaultSizeInMeters),u.distanceDisplayCondition=Property.getValueOrUndefined(c._distanceDisplayCondition,e,distanceDisplayConditionScratch),u.disableDepthTestDistance=Property.getValueOrUndefined(c._disableDepthTestDistance,e);var h=Property.getValueOrUndefined(c._imageSubRegion,e,boundingRectangleScratch);defined(h)&&u.setImageSubRegion(u._imageId,h)}else returnPrimitive(s,l,i)}return!0},BillboardVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);if(!defined(i)||!defined(i.billboard))return BoundingSphereState$1.FAILED;var r=i.billboard;if(r.heightReference===HeightReference$1.NONE)t.center=Cartesian3.clone(r.position,t.center);else{if(!defined(r._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(r._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},BillboardVisualizer.prototype.isDestroyed=function(){return!1},BillboardVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(BillboardVisualizer.prototype._onCollectionChanged,this);for(var e=this._entityCollection.values,t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return destroyObject(this)},BillboardVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._items,s=this._cluster;for(n=t.length-1;-1<n;n--)defined((a=t[n])._billboard)&&defined(a._position)&&o.set(a.id,new EntityData(a));for(n=r.length-1;-1<n;n--)defined((a=r[n])._billboard)&&defined(a._position)?o.contains(a.id)||o.set(a.id,new EntityData(a)):(returnPrimitive(o.get(a.id),a,s),o.remove(a.id));for(n=i.length-1;-1<n;n--)a=i[n],returnPrimitive(o.get(a.id),a,s),o.remove(a.id)};var AllMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nmat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = tangentToEyeMatrix;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n",AllMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 bitangent;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_tangentEC = czm_normal * tangent;\nv_bitangentEC = czm_normal * bitangent;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",BasicMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n",BasicMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",TexturedMaterialAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nmaterialInput.st = v_st;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n",TexturedMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",BlendEquation={ADD:WebGLConstants$1.FUNC_ADD,SUBTRACT:WebGLConstants$1.FUNC_SUBTRACT,REVERSE_SUBTRACT:WebGLConstants$1.FUNC_REVERSE_SUBTRACT,MIN:WebGLConstants$1.MIN,MAX:WebGLConstants$1.MAX},BlendEquation$1=freezeObject$1(BlendEquation),BlendFunction={ZERO:WebGLConstants$1.ZERO,ONE:WebGLConstants$1.ONE,SOURCE_COLOR:WebGLConstants$1.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:WebGLConstants$1.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:WebGLConstants$1.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:WebGLConstants$1.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:WebGLConstants$1.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:WebGLConstants$1.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:WebGLConstants$1.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:WebGLConstants$1.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:WebGLConstants$1.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:WebGLConstants$1.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:WebGLConstants$1.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:WebGLConstants$1.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:WebGLConstants$1.SRC_ALPHA_SATURATE},BlendFunction$1=freezeObject$1(BlendFunction),BlendingState={DISABLED:freezeObject$1({enabled:!1}),ALPHA_BLEND:freezeObject$1({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:freezeObject$1({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:freezeObject$1({enabled:!0,equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE})},BlendingState$1=freezeObject$1(BlendingState),CullFace={FRONT:WebGLConstants$1.FRONT,BACK:WebGLConstants$1.BACK,FRONT_AND_BACK:WebGLConstants$1.FRONT_AND_BACK},CullFace$1=freezeObject$1(CullFace);function Appearance(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.material=e.material,this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=defaultValue(e.closed,!1)}defineProperties$1(Appearance.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}}}),Appearance.prototype.getFragmentShaderSource=function(){var e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),defined(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},Appearance.prototype.isTranslucent=function(){return defined(this.material)&&this.material.isTranslucent()||!defined(this.material)&&this.translucent},Appearance.prototype.getRenderState=function(){var e=this.isTranslucent(),t=clone(this.renderState,!1);return e?(t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND):t.depthMask=!0,t},Appearance.getDefaultRenderState=function(e,t,i){var r={depthTest:{enabled:!0}};return e&&(r.depthMask=!1,r.blending=BlendingState$1.ALPHA_BLEND),t&&(r.cull={enabled:!0,face:CullFace$1.BACK}),defined(i)&&(r=combine(i,r,!0)),r};var ContextLimits={_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,_highpFloatSupported:!1,_highpIntSupported:!1};function CubeMapFace(e,t,i,r,n,a,o,s,l,c){this._gl=e,this._texture=t,this._textureTarget=i,this._targetFace=r,this._pixelFormat=n,this._pixelDatatype=a,this._size=o,this._preMultiplyAlpha=s,this._flipY=l,this._initialized=c}defineProperties$1(ContextLimits,{maximumCombinedTextureImageUnits:{get:function(){return ContextLimits._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return ContextLimits._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return ContextLimits._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return ContextLimits._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return ContextLimits._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return ContextLimits._maximumTextureSize}},maximumVaryingVectors:{get:function(){return ContextLimits._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return ContextLimits._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return ContextLimits._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return ContextLimits._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return ContextLimits._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return ContextLimits._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return ContextLimits._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return ContextLimits._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return ContextLimits._maximumViewportWidth}},maximumViewportHeight:{get:function(){return ContextLimits._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return ContextLimits._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return ContextLimits._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return ContextLimits._maximumColorAttachments}},highpFloatSupported:{get:function(){return ContextLimits._highpFloatSupported}},highpIntSupported:{get:function(){return ContextLimits._highpIntSupported}}}),defineProperties$1(CubeMapFace.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}}),CubeMapFace.prototype.copyFrom=function(e,t,i){t=defaultValue(t,0),i=defaultValue(i,0);var r=this._gl,n=this._textureTarget,a=this._targetFace;r.activeTexture(r.TEXTURE0),r.bindTexture(n,this._texture);var o=e.width,s=e.height,l=e.arrayBufferView,c=this._size,u=this._pixelFormat,d=this._pixelDatatype,h=this._preMultiplyAlpha,p=this._flipY,m=4;defined(l)&&(m=PixelFormat$1.alignmentInBytes(u,d,o)),r.pixelStorei(r.UNPACK_ALIGNMENT,m);var f=!1;if(!this._initialized){if(0===t&&0===i&&o===c&&s===c)defined(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),p&&(l=PixelFormat$1.flipY(l,u,d,c,c)),r.texImage2D(a,0,u,c,c,0,u,d,l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,p),r.texImage2D(a,0,u,u,d,e)),f=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);var g=PixelFormat$1.createTypedArray(u,d,c,c);r.texImage2D(a,0,u,c,c,0,u,d,g)}this._initialized=!0}f||(defined(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),p&&(l=PixelFormat$1.flipY(l,u,d,o,s)),r.texSubImage2D(a,0,t,i,o,s,u,d,l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,p),r.texSubImage2D(a,0,t,i,u,d,e))),r.bindTexture(n,null)},CubeMapFace.prototype.copyFromFramebuffer=function(e,t,i,r,n,a){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,0),n=defaultValue(n,this._size),a=defaultValue(a,this._size);var o=this._gl,s=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(s,this._texture),o.copyTexSubImage2D(this._targetFace,0,e,t,i,r,n,a),o.bindTexture(s,null),this._initialized=!0};var MipmapHint={DONT_CARE:WebGLConstants$1.DONT_CARE,FASTEST:WebGLConstants$1.FASTEST,NICEST:WebGLConstants$1.NICEST,validate:function(e){return e===MipmapHint.DONT_CARE||e===MipmapHint.FASTEST||e===MipmapHint.NICEST}},MipmapHint$1=freezeObject$1(MipmapHint),TextureMagnificationFilter={NEAREST:WebGLConstants$1.NEAREST,LINEAR:WebGLConstants$1.LINEAR,validate:function(e){return e===TextureMagnificationFilter.NEAREST||e===TextureMagnificationFilter.LINEAR}},TextureMagnificationFilter$1=freezeObject$1(TextureMagnificationFilter),TextureMinificationFilter={NEAREST:WebGLConstants$1.NEAREST,LINEAR:WebGLConstants$1.LINEAR,NEAREST_MIPMAP_NEAREST:WebGLConstants$1.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:WebGLConstants$1.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:WebGLConstants$1.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:WebGLConstants$1.LINEAR_MIPMAP_LINEAR,validate:function(e){return e===TextureMinificationFilter.NEAREST||e===TextureMinificationFilter.LINEAR||e===TextureMinificationFilter.NEAREST_MIPMAP_NEAREST||e===TextureMinificationFilter.LINEAR_MIPMAP_NEAREST||e===TextureMinificationFilter.NEAREST_MIPMAP_LINEAR||e===TextureMinificationFilter.LINEAR_MIPMAP_LINEAR}},TextureMinificationFilter$1=freezeObject$1(TextureMinificationFilter),TextureWrap={CLAMP_TO_EDGE:WebGLConstants$1.CLAMP_TO_EDGE,REPEAT:WebGLConstants$1.REPEAT,MIRRORED_REPEAT:WebGLConstants$1.MIRRORED_REPEAT,validate:function(e){return e===TextureWrap.CLAMP_TO_EDGE||e===TextureWrap.REPEAT||e===TextureWrap.MIRRORED_REPEAT}},TextureWrap$1=freezeObject$1(TextureWrap);function Sampler(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).wrapS,TextureWrap$1.CLAMP_TO_EDGE),i=defaultValue(e.wrapT,TextureWrap$1.CLAMP_TO_EDGE),r=defaultValue(e.minificationFilter,TextureMinificationFilter$1.LINEAR),n=defaultValue(e.magnificationFilter,TextureMagnificationFilter$1.LINEAR),a=defined(e.maximumAnisotropy)?e.maximumAnisotropy:1;this._wrapS=t,this._wrapT=i,this._minificationFilter=r,this._magnificationFilter=n,this._maximumAnisotropy=a}function CubeMap(e){var o,t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=e.source;if(defined(i)){var r=[i.positiveX,i.negativeX,i.positiveY,i.negativeY,i.positiveZ,i.negativeZ];o=r[0].width,r[0].height}else o=e.width,e.height;var s=o,l=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),c=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),n=6*PixelFormat$1.textureSizeInBytes(l,c,s,s),a=e.preMultiplyAlpha||l===PixelFormat$1.RGB||l===PixelFormat$1.LUMINANCE,u=defaultValue(e.flipY,!0),d=t._gl,h=d.TEXTURE_CUBE_MAP,p=d.createTexture();function m(e,t,i,r){var n=t.arrayBufferView;defined(n)||(n=t.bufferView);var a=4;defined(n)&&(a=PixelFormat$1.alignmentInBytes(l,c,o)),d.pixelStorei(d.UNPACK_ALIGNMENT,a),defined(n)?(d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,!1),r&&(n=PixelFormat$1.flipY(n,l,c,s,s)),d.texImage2D(e,0,l,s,s,0,l,c,n)):(d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,r),d.texImage2D(e,0,l,l,c,t))}d.activeTexture(d.TEXTURE0),d.bindTexture(h,p),defined(i)?(m(d.TEXTURE_CUBE_MAP_POSITIVE_X,i.positiveX,a,u),m(d.TEXTURE_CUBE_MAP_NEGATIVE_X,i.negativeX,a,u),m(d.TEXTURE_CUBE_MAP_POSITIVE_Y,i.positiveY,a,u),m(d.TEXTURE_CUBE_MAP_NEGATIVE_Y,i.negativeY,a,u),m(d.TEXTURE_CUBE_MAP_POSITIVE_Z,i.positiveZ,a,u),m(d.TEXTURE_CUBE_MAP_NEGATIVE_Z,i.negativeZ,a,u)):(d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X,0,l,s,s,0,l,c,null),d.texImage2D(d.TEXTURE_CUBE_MAP_NEGATIVE_X,0,l,s,s,0,l,c,null),d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_Y,0,l,s,s,0,l,c,null),d.texImage2D(d.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,l,s,s,0,l,c,null),d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_Z,0,l,s,s,0,l,c,null),d.texImage2D(d.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,l,s,s,0,l,c,null)),d.bindTexture(h,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=h,this._texture=p,this._pixelFormat=l,this._pixelDatatype=c,this._size=s,this._hasMipmap=!1,this._sizeInBytes=n,this._preMultiplyAlpha=a,this._flipY=u,this._sampler=void 0;var f=defined(i);this._positiveX=new CubeMapFace(d,p,h,d.TEXTURE_CUBE_MAP_POSITIVE_X,l,c,s,a,u,f),this._negativeX=new CubeMapFace(d,p,h,d.TEXTURE_CUBE_MAP_NEGATIVE_X,l,c,s,a,u,f),this._positiveY=new CubeMapFace(d,p,h,d.TEXTURE_CUBE_MAP_POSITIVE_Y,l,c,s,a,u,f),this._negativeY=new CubeMapFace(d,p,h,d.TEXTURE_CUBE_MAP_NEGATIVE_Y,l,c,s,a,u,f),this._positiveZ=new CubeMapFace(d,p,h,d.TEXTURE_CUBE_MAP_POSITIVE_Z,l,c,s,a,u,f),this._negativeZ=new CubeMapFace(d,p,h,d.TEXTURE_CUBE_MAP_NEGATIVE_Z,l,c,s,a,u,f),this.sampler=defined(e.sampler)?e.sampler:new Sampler}function Texture(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=e.width,r=e.height,n=e.source;defined(n)&&(defined(i)||(i=defaultValue(n.videoWidth,n.width)),defined(r)||(r=defaultValue(n.videoHeight,n.height)));var a=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),o=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),s=a,l=PixelFormat$1.isCompressedFormat(s);if(t.webgl2)if(a===PixelFormat$1.DEPTH_STENCIL?s=WebGLConstants$1.DEPTH24_STENCIL8:a===PixelFormat$1.DEPTH_COMPONENT&&(o===PixelDatatype$1.UNSIGNED_SHORT?s=WebGLConstants$1.DEPTH_COMPONENT16:o===PixelDatatype$1.UNSIGNED_INT&&(s=WebGLConstants$1.DEPTH_COMPONENT24)),o===PixelDatatype$1.FLOAT)switch(a){case PixelFormat$1.RGBA:s=WebGLConstants$1.RGBA32F;break;case PixelFormat$1.RGB:s=WebGLConstants$1.RGB32F;break;case PixelFormat$1.RG:s=WebGLConstants$1.RG32F;break;case PixelFormat$1.R:s=WebGLConstants$1.R32F}else if(o===PixelDatatype$1.HALF_FLOAT)switch(a){case PixelFormat$1.RGBA:s=WebGLConstants$1.RGBA16F;break;case PixelFormat$1.RGB:s=WebGLConstants$1.RGB16F;break;case PixelFormat$1.RG:s=WebGLConstants$1.RG16F;break;case PixelFormat$1.R:s=WebGLConstants$1.R16F}var c=e.preMultiplyAlpha||a===PixelFormat$1.RGB||a===PixelFormat$1.LUMINANCE,u=defaultValue(e.flipY,!0),d=!0,h=t._gl,p=h.TEXTURE_2D,m=h.createTexture();h.activeTexture(h.TEXTURE0),h.bindTexture(p,m);var f,g=4;if(defined(n)&&defined(n.arrayBufferView)&&!l&&(g=PixelFormat$1.alignmentInBytes(a,o,i)),h.pixelStorei(h.UNPACK_ALIGNMENT,g),defined(n))if(defined(n.arrayBufferView)){h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,!1);var _=n.arrayBufferView;l?h.compressedTexImage2D(p,0,s,i,r,0,_):(u&&(_=PixelFormat$1.flipY(_,a,o,i,r)),h.texImage2D(p,0,s,i,r,0,a,o,_))}else defined(n.framebuffer)?(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,!1),n.framebuffer!==t.defaultFramebuffer&&n.framebuffer._bind(),h.copyTexImage2D(p,0,s,n.xOffset,n.yOffset,i,r,0),n.framebuffer!==t.defaultFramebuffer&&n.framebuffer._unBind()):(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,c),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,u),h.texImage2D(p,0,s,a,o,n));else h.texImage2D(p,0,s,i,r,0,a,o,null),d=!1;h.bindTexture(p,null),f=l?PixelFormat$1.compressedTextureSizeInBytes(a,i,r):PixelFormat$1.textureSizeInBytes(a,o,i,r),this._id=createGuid(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=m,this._pixelFormat=a,this._pixelDatatype=o,this._width=i,this._height=r,this._dimensions=new Cartesian2(i,r),this._hasMipmap=!1,this._sizeInBytes=f,this._preMultiplyAlpha=c,this._flipY=u,this._initialized=d,this._sampler=void 0,this.sampler=defined(e.sampler)?e.sampler:new Sampler}defineProperties$1(Sampler.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}}}),Sampler.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy},defineProperties$1(CubeMap.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){var t=e.minificationFilter,i=e.magnificationFilter,r=t===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||t===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||t===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||t===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,n=this._context,a=this._pixelDatatype;(a===PixelDatatype$1.FLOAT&&!n.textureFloatLinear||a===PixelDatatype$1.HALF_FLOAT&&!n.textureHalfFloatLinear)&&(t=r?TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST:TextureMinificationFilter$1.NEAREST,i=TextureMagnificationFilter$1.NEAREST);var o=n._gl,s=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(s,this._texture),o.texParameteri(s,o.TEXTURE_MIN_FILTER,t),o.texParameteri(s,o.TEXTURE_MAG_FILTER,i),o.texParameteri(s,o.TEXTURE_WRAP_S,e.wrapS),o.texParameteri(s,o.TEXTURE_WRAP_T,e.wrapT),defined(this._textureFilterAnisotropic)&&o.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),o.bindTexture(s,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(4*this._sizeInBytes/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}}),CubeMap.prototype.generateMipmap=function(e){e=defaultValue(e,MipmapHint$1.DONT_CARE),this._hasMipmap=!0;var t=this._context._gl,i=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(i,this._texture),t.generateMipmap(i),t.bindTexture(i,null)},CubeMap.prototype.isDestroyed=function(){return!1},CubeMap.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=destroyObject(this._positiveX),this._negativeX=destroyObject(this._negativeX),this._positiveY=destroyObject(this._positiveY),this._negativeY=destroyObject(this._negativeY),this._positiveZ=destroyObject(this._positiveZ),this._negativeZ=destroyObject(this._negativeZ),destroyObject(this)},Texture.create=function(e){return new Texture(e)},Texture.fromFramebuffer=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,i=t._gl,r=defaultValue(e.pixelFormat,PixelFormat$1.RGB),n=defaultValue(e.framebufferXOffset,0),a=defaultValue(e.framebufferYOffset,0),o=defaultValue(e.width,i.drawingBufferWidth),s=defaultValue(e.height,i.drawingBufferHeight),l=e.framebuffer;return new Texture({context:t,width:o,height:s,pixelFormat:r,source:{framebuffer:defined(l)?l:t.defaultFramebuffer,xOffset:n,yOffset:a,width:o,height:s}})},defineProperties$1(Texture.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){var t=e.minificationFilter,i=e.magnificationFilter,r=t===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||t===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR||t===TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST||t===TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR,n=this._context,a=this._pixelDatatype;(a===PixelDatatype$1.FLOAT&&!n.textureFloatLinear||a===PixelDatatype$1.HALF_FLOAT&&!n.textureHalfFloatLinear)&&(t=r?TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST:TextureMinificationFilter$1.NEAREST,i=TextureMagnificationFilter$1.NEAREST);var o=n._gl,s=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(s,this._texture),o.texParameteri(s,o.TEXTURE_MIN_FILTER,t),o.texParameteri(s,o.TEXTURE_MAG_FILTER,i),o.texParameteri(s,o.TEXTURE_WRAP_S,e.wrapS),o.texParameteri(s,o.TEXTURE_WRAP_T,e.wrapT),defined(this._textureFilterAnisotropic)&&o.texParameteri(s,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),o.bindTexture(s,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(4*this._sizeInBytes/3):this._sizeInBytes}},_target:{get:function(){return this._textureTarget}}}),Texture.prototype.copyFrom=function(e,t,i){t=defaultValue(t,0),i=defaultValue(i,0);var r=this._context._gl,n=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(n,this._texture);var a=e.width,o=e.height,s=e.arrayBufferView,l=this._width,c=this._height,u=this._pixelFormat,d=this._pixelDatatype,h=this._preMultiplyAlpha,p=this._flipY,m=4;defined(s)&&(m=PixelFormat$1.alignmentInBytes(u,d,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,m);var f=!1;if(!this._initialized){if(0===t&&0===i&&a===l&&o===c)defined(s)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),p&&(s=PixelFormat$1.flipY(s,u,d,l,c)),r.texImage2D(n,0,u,l,c,0,u,d,s)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,p),r.texImage2D(n,0,u,u,d,e)),f=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);var g=PixelFormat$1.createTypedArray(u,d,l,c);r.texImage2D(n,0,u,l,c,0,u,d,g)}this._initialized=!0}f||(defined(s)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),p&&(s=PixelFormat$1.flipY(s,u,d,a,o)),r.texSubImage2D(n,0,t,i,a,o,u,d,s)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,p),r.texSubImage2D(n,0,t,i,u,d,e))),r.bindTexture(n,null)},Texture.prototype.copyFromFramebuffer=function(e,t,i,r,n,a){e=defaultValue(e,0),t=defaultValue(t,0),i=defaultValue(i,0),r=defaultValue(r,0),n=defaultValue(n,this._width),a=defaultValue(a,this._height);var o=this._context._gl,s=this._textureTarget;o.activeTexture(o.TEXTURE0),o.bindTexture(s,this._texture),o.copyTexSubImage2D(s,0,e,t,i,r,n,a),o.bindTexture(s,null),this._initialized=!0},Texture.prototype.generateMipmap=function(e){e=defaultValue(e,MipmapHint$1.DONT_CARE),this._hasMipmap=!0;var t=this._context._gl,i=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(i,this._texture),t.generateMipmap(i),t.bindTexture(i,null)},Texture.prototype.isDestroyed=function(){return!1},Texture.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),destroyObject(this)};var AspectRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",BumpMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n",CheckerboardMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",DotMaterial="uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",ElevationContourMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float spacing;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat distanceToContour = mod(materialInput.height, spacing);\n#ifdef GL_OES_standard_derivatives\nfloat dxc = abs(dFdx(materialInput.height));\nfloat dyc = abs(dFdy(materialInput.height));\nfloat dF = max(dxc, dyc) * czm_pixelRatio * width;\nfloat alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\nfloat alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\nvec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha));\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",ElevationRampMaterial="uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\nvec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",FadeMaterial="uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q  = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\ncolor = czm_gammaCorrect(color);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",GridMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec4 halfColor;\nhalfColor.rgb = color.rgb * 0.5;\nhalfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nhalfColor = czm_gammaCorrect(halfColor);\nmaterial.diffuse = halfColor.rgb;\nmaterial.emission = halfColor.rgb;\nmaterial.alpha = halfColor.a;\nreturn material;\n}\n",NormalMapMaterial="uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n",PolylineArrowMaterial="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nvarying float v_width;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\n#ifdef GL_OES_standard_derivatives\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\nfloat base = 0.975;\n#endif\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",PolylineDashMaterial="uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nvarying float v_polylineAngle;\nconst float maskLength = 16.0;\nmat2 rotate(float rad) {\nfloat c = cos(rad);\nfloat s = sin(rad);\nreturn mat2(\nc, s,\n-s, c\n);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\nfloat dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\nfloat maskIndex = floor(dashPosition * maskLength);\nfloat maskTest = floor(dashPattern / pow(2.0, maskIndex));\nvec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\nif (fragColor.a < 0.005) {\ndiscard;\n}\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineGlowMaterial="uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\nif (taperPower <= 0.99999) {\nglow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n}\nvec4 fragColor;\nfragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nfragColor.a = clamp(0.0, 1.0, glow) * color.a;\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n",PolylineOutlineMaterial="uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth =  0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n",RimLightingMaterial="uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nvec4 outColor = czm_gammaCorrect(color);\nvec4 outRimColor = czm_gammaCorrect(rimColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.emission = outRimColor.rgb * s;\nmaterial.alpha = mix(outColor.a, outRimColor.a, s);\nreturn material;\n}\n",SlopeRampMaterial="uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n",StripeMaterial="uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\nvec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n",WaterMaterial="uniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.diffuse = material.diffuse;\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n",YanMoMaterial="uniform vec4 floodVar;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.alpha = (materialInput.height < floodVar.y) ? 0.3 : 0.0;\nfloat rr = (materialInput.height < floodVar.y)?(materialInput.height-floodVar.x)/floodVar.w/2.0:0.0;\nmaterial.diffuse = vec3(1.0-rr,rr,0.0);\nreturn material;\n}\n",WaJueMaterial="czm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nreturn material;\n}\n";function Material(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._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,initializeMaterial(e,this),defineProperties$1(this,{type:{value:this.type,writable:!1}}),defined(Material._uniformList[this.type])||(Material._uniformList[this.type]=Object.keys(this._uniforms))}function initializeMaterial(e,t){var i;e=defaultValue(e,defaultValue.EMPTY_OBJECT),t._strict=defaultValue(e.strict,!1),t._count=defaultValue(e.count,0),t._template=clone(defaultValue(e.fabric,defaultValue.EMPTY_OBJECT)),t._template.uniforms=clone(defaultValue(t._template.uniforms,defaultValue.EMPTY_OBJECT)),t._template.materials=clone(defaultValue(t._template.materials,defaultValue.EMPTY_OBJECT)),t.type=defined(t._template.type)?t._template.type:createGuid(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];var r=Material._materialCache.getMaterial(t.type);if(defined(r)){var n=clone(r.fabric,!0);t._template=combine(t._template,n,!0),i=r.translucent}checkForTemplateErrors(t),defined(r)||Material._materialCache.addMaterial(t.type,t),createMethodDefinition(t),createUniforms(t),createSubMaterials(t);var a=0===t._translucentFunctions.length||void 0;if(i=defaultValue(i,a),defined(i=defaultValue(e.translucent,i)))if("function"==typeof i){t._translucentFunctions.push(function(){return i(t)})}else t._translucentFunctions.push(i)}function checkForValidProperties(e,t,i,r){if(defined(e))for(var n in e)if(e.hasOwnProperty(n)){var a=-1!==t.indexOf(n);(r&&!a||!r&&a)&&i(n,t)}}function invalidNameError(e,t){}function duplicateNameError(e,t){}Material._uniformList={},Material.fromType=function(e,t){var i=new Material({fabric:{type:e}});if(defined(t))for(var r in t)t.hasOwnProperty(r)&&(i.uniforms[r]=t[r]);return i},Material.prototype.isTranslucent=function(){if(defined(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;for(var e=!0,t=this._translucentFunctions,i=t.length,r=0;r<i;++r){var n=t[r];if(!(e="function"==typeof n?e&&n():e&&n))break}return e},Material.prototype.update=function(e){var t,i,r=this._loadedImages,n=r.length;for(t=0;t<n;++t){var a=r[t];i=a.id;var o,s=a.image;o=defined(s.internalFormat)?new Texture({context:e,pixelFormat:s.internalFormat,width:s.width,height:s.height,source:{arrayBufferView:s.bufferView}}):new Texture({context:e,source:s}),this._textures[i]=o;var l=i+"Dimensions";if(this.uniforms.hasOwnProperty(l)){var c=this.uniforms[l];c.x=o._width,c.y=o._height}}r.length=0;var u=this._loadedCubeMaps;for(n=u.length,t=0;t<n;++t){var d=u[t];i=d.id;var h=d.images,p=new CubeMap({context:e,source:{positiveX:h[0],negativeX:h[1],positiveY:h[2],negativeY:h[3],positiveZ:h[4],negativeZ:h[5]}});this._textures[i]=p}u.length=0;var m=this._updateFunctions;for(n=m.length,t=0;t<n;++t)m[t](this,e);var f=this.materials;for(var g in f)f.hasOwnProperty(g)&&f[g].update(e)},Material.prototype.isDestroyed=function(){return!1},Material.prototype.destroy=function(){var e=this._textures;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];i!==this._defaultTexture&&i.destroy()}var r=this.materials;for(var n in r)r.hasOwnProperty(n)&&r[n].destroy();return destroyObject(this)};var templateProperties=["type","materials","uniforms","components","source"],componentProperties=["diffuse","specular","shininess","normal","emission","alpha"];function checkForTemplateErrors(e){var t=e._template,i=t.uniforms,r=t.materials,n=t.components;checkForValidProperties(t,templateProperties,invalidNameError,!0),checkForValidProperties(n,componentProperties,invalidNameError,!0);var a=[];for(var o in r)r.hasOwnProperty(o)&&a.push(o);checkForValidProperties(i,a,duplicateNameError,!1)}function isMaterialFused(e,t){var i=t._template.materials;for(var r in i)if(i.hasOwnProperty(r)&&-1<e.indexOf(r))return!0;return!1}function createMethodDefinition(e){var t=e._template.components,i=e._template.source;if(defined(i))e.shaderSource+=i+"\n";else{if(e.shaderSource+="czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n",e.shaderSource+="czm_material material = czm_getDefaultMaterial(materialInput);\n",defined(t)){var r=0<Object.keys(e._template.materials).length;for(var n in t)if(t.hasOwnProperty(n))if("diffuse"===n||"emission"===n){var a=r&&isMaterialFused(t[n],e)?t[n]:"czm_gammaCorrect("+t[n]+")";e.shaderSource+="material."+n+" = "+a+"; \n"}else e.shaderSource+="alpha"===n?"material.alpha = "+t.alpha+"; \n":"material."+n+" = "+t[n]+";\n"}e.shaderSource+="return material;\n}\n"}}var matrixMap={mat2:Matrix2,mat3:Matrix3,mat4:Matrix4},ktxRegex=/\.ktx$/i,crnRegex=/\.crn$/i;function createTexture2DUpdateFunction(d){var h;return function(t,e){var i=t.uniforms,r=i[d],n=h!==r;h=r;var a,o,s=t._textures[d];if(r instanceof HTMLVideoElement)if(2<=r.readyState){if(n&&defined(s)&&(s!==e.defaultTexture&&s.destroy(),s=void 0),!defined(s)||s===e.defaultTexture)return s=new Texture({context:e,source:r}),void(t._textures[d]=s);s.copyFrom(r)}else defined(s)||(t._textures[d]=e.defaultTexture);else{if(r instanceof Texture&&r!==s){t._texturePaths[d]=void 0;var l=t._textures[d];return l!==t._defaultTexture&&l.destroy(),t._textures[d]=r,a=d+"Dimensions",void(i.hasOwnProperty(a)&&((o=i[a]).x=r._width,o.y=r._height))}if(defined(s)||(t._texturePaths[d]=void 0,defined(t._defaultTexture)||(t._defaultTexture=e.defaultTexture),s=t._textures[d]=t._defaultTexture,a=d+"Dimensions",i.hasOwnProperty(a)&&((o=i[a]).x=s._width,o.y=s._height)),r!==Material.DefaultImageId){var c=r instanceof Resource;if(!defined(t._texturePaths[d])||c&&r.url!==t._texturePaths[d].url||!c&&r!==t._texturePaths[d]){if("string"==typeof r||c){var u=c?r:Resource.createIfNeeded(r);when(ktxRegex.test(u.url)?loadKTX(u):crnRegex.test(u.url)?loadCRN(u):u.fetchImage(),function(e){t._loadedImages.push({id:d,image:e})})}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&t._loadedImages.push({id:d,image:r});t._texturePaths[d]=r}}}}}function createCubeMapUpdateFunction(o){return function(t,e){var i=t.uniforms[o];if(i instanceof CubeMap){var r=t._textures[o];return r!==t._defaultTexture&&r.destroy(),t._texturePaths[o]=void 0,void(t._textures[o]=i)}if(defined(t._textures[o])||(t._texturePaths[o]=void 0,t._textures[o]=e.defaultCubeMap),i!==Material.DefaultCubeMapId){var n=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(n!==t._texturePaths[o]){var a=[Resource.createIfNeeded(i.positiveX).fetchImage(),Resource.createIfNeeded(i.negativeX).fetchImage(),Resource.createIfNeeded(i.positiveY).fetchImage(),Resource.createIfNeeded(i.negativeY).fetchImage(),Resource.createIfNeeded(i.positiveZ).fetchImage(),Resource.createIfNeeded(i.negativeZ).fetchImage()];when.all(a).then(function(e){t._loadedCubeMaps.push({id:o,images:e})}),t._texturePaths[o]=n}}}}function createUniforms(e){var t=e._template.uniforms;for(var i in t)t.hasOwnProperty(i)&&createUniform(e,i)}function createUniform(e,t){e._strict;var i=e._template.uniforms,r=i[t],n=getUniformType(r);if("channels"===n)replaceToken(e,t,r,!1);else{if("sampler2D"===n){var a=t+"Dimensions";0<getNumberOfTokens(e,a)&&(i[a]={type:"ivec3",x:1,y:1},createUniform(e,a))}if(!new RegExp("uniform\\s+"+n+"\\s+"+t+"\\s*;").test(e.shaderSource)){var o="uniform "+n+" "+t+";";e.shaderSource=o+e.shaderSource}var s=t+"_"+e._count++;if(replaceToken(e,t,s),e.uniforms[t]=r,"sampler2D"===n)e._uniforms[s]=function(){return e._textures[t]},e._updateFunctions.push(createTexture2DUpdateFunction(t));else if("samplerCube"===n)e._uniforms[s]=function(){return e._textures[t]},e._updateFunctions.push(createCubeMapUpdateFunction(t));else if(-1!==n.indexOf("mat")){var l=new matrixMap[n];e._uniforms[s]=function(){return matrixMap[n].fromColumnMajorArray(e.uniforms[t],l)}}else e._uniforms[s]=function(){return e.uniforms[t]}}}function getUniformType(e){var t=e.type;if(!defined(t)){var i=typeof e;if("number"==i)t="float";else if("boolean"==i)t="bool";else if("string"==i||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===Material.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"==i)if(isArray$1(e))4!==e.length&&9!==e.length&&16!==e.length||(t="mat"+Math.sqrt(e.length));else{var r=0;for(var n in e)e.hasOwnProperty(n)&&(r+=1);2<=r&&r<=4?t="vec"+r:6===r&&(t="samplerCube")}}return t}function createSubMaterials(e){var t=e._strict,i=e._template.materials;for(var r in i)if(i.hasOwnProperty(r)){var n=new Material({strict:t,fabric:i[r],count:e._count});e._count=n._count,e._uniforms=combine(e._uniforms,n._uniforms,!0),e.materials[r]=n,e._translucentFunctions=e._translucentFunctions.concat(n._translucentFunctions);var a="czm_getMaterial",o=a+"_"+e._count++;replaceToken(n,a,o),e.shaderSource=n.shaderSource+e.shaderSource;replaceToken(e,r,o+"(materialInput)")}}function replaceToken(e,t,r,i){i=defaultValue(i,!0);var n=0,a=new RegExp("([\\w"+(i?".":"")+"])?"+t+"([\\w])?","g");return e.shaderSource=e.shaderSource.replace(a,function(e,t,i){return t||i?e:(n+=1,r)}),n}function getNumberOfTokens(e,t,i){return replaceToken(e,t,t,i)}function MaterialAppearance(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucent,!0),i=defaultValue(e.closed,!1),r=defaultValue(e.materialSupport,MaterialAppearance.MaterialSupport.TEXTURED);this.material=defined(e.material)?e.material:Material.fromType(Material.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,r.vertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,r.fragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,i,e.renderState),this._closed=i,this._materialSupport=r,this._vertexFormat=r.vertexFormat,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,!i)}Material._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},Material.DefaultImageId="czm_defaultImage",Material.DefaultCubeMapId="czm_defaultCubeMap",Material.ColorType="Color",Material._materialCache.addMaterial(Material.ColorType,{fabric:{type:Material.ColorType,uniforms:{color:new Color(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material.ImageType="Image",Material._materialCache.addMaterial(Material.ImageType,{fabric:{type:Material.ImageType,uniforms:{image:Material.DefaultImageId,repeat:new Cartesian2(1,1),color:new Color(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Material.DiffuseMapType="DiffuseMap",Material._materialCache.addMaterial(Material.DiffuseMapType,{fabric:{type:Material.DiffuseMapType,uniforms:{image:Material.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material.AlphaMapType="AlphaMap",Material._materialCache.addMaterial(Material.AlphaMapType,{fabric:{type:Material.AlphaMapType,uniforms:{image:Material.DefaultImageId,channel:"a",repeat:new Cartesian2(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),Material.SpecularMapType="SpecularMap",Material._materialCache.addMaterial(Material.SpecularMapType,{fabric:{type:Material.SpecularMapType,uniforms:{image:Material.DefaultImageId,channel:"r",repeat:new Cartesian2(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),Material.EmissionMapType="EmissionMap",Material._materialCache.addMaterial(Material.EmissionMapType,{fabric:{type:Material.EmissionMapType,uniforms:{image:Material.DefaultImageId,channels:"rgb",repeat:new Cartesian2(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Material.BumpMapType="BumpMap",Material._materialCache.addMaterial(Material.BumpMapType,{fabric:{type:Material.BumpMapType,uniforms:{image:Material.DefaultImageId,channel:"r",strength:.8,repeat:new Cartesian2(1,1)},source:BumpMapMaterial},translucent:!1}),Material.NormalMapType="NormalMap",Material._materialCache.addMaterial(Material.NormalMapType,{fabric:{type:Material.NormalMapType,uniforms:{image:Material.DefaultImageId,channels:"rgb",strength:.8,repeat:new Cartesian2(1,1)},source:NormalMapMaterial},translucent:!1}),Material.GridType="Grid",Material._materialCache.addMaterial(Material.GridType,{fabric:{type:Material.GridType,uniforms:{color:new Color(0,1,0,1),cellAlpha:.1,lineCount:new Cartesian2(8,8),lineThickness:new Cartesian2(1,1),lineOffset:new Cartesian2(0,0)},source:GridMaterial},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),Material.StripeType="Stripe",Material._materialCache.addMaterial(Material.StripeType,{fabric:{type:Material.StripeType,uniforms:{horizontal:!0,evenColor:new Color(1,1,1,.5),oddColor:new Color(0,0,1,.5),offset:0,repeat:5},source:StripeMaterial},translucent:function(e){var t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}}),Material.CheckerboardType="Checkerboard",Material._materialCache.addMaterial(Material.CheckerboardType,{fabric:{type:Material.CheckerboardType,uniforms:{lightColor:new Color(1,1,1,.5),darkColor:new Color(0,0,0,.5),repeat:new Cartesian2(5,5)},source:CheckerboardMaterial},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material.DotType="Dot",Material._materialCache.addMaterial(Material.DotType,{fabric:{type:Material.DotType,uniforms:{lightColor:new Color(1,1,0,.75),darkColor:new Color(0,1,1,.75),repeat:new Cartesian2(5,5)},source:DotMaterial},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Material.WaterType="Water",Material._materialCache.addMaterial(Material.WaterType,{fabric:{type:Material.WaterType,uniforms:{baseWaterColor:new Color(.2,.3,.6,1),blendColor:new Color(0,1,.699,1),specularMap:Material.DefaultImageId,normalMap:Material.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:WaterMaterial},translucent:function(e){var t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}}),Material.RimLightingType="RimLighting",Material._materialCache.addMaterial(Material.RimLightingType,{fabric:{type:Material.RimLightingType,uniforms:{color:new Color(1,0,0,.7),rimColor:new Color(1,1,1,.4),width:.3},source:RimLightingMaterial},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}}),Material.FadeType="Fade",Material._materialCache.addMaterial(Material.FadeType,{fabric:{type:Material.FadeType,uniforms:{fadeInColor:new Color(1,0,0,1),fadeOutColor:new Color(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new Cartesian2(.5,.5)},source:FadeMaterial},translucent:function(e){var t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}}),Material.PolylineArrowType="PolylineArrow",Material._materialCache.addMaterial(Material.PolylineArrowType,{fabric:{type:Material.PolylineArrowType,uniforms:{color:new Color(1,1,1,1)},source:PolylineArrowMaterial},translucent:!0}),Material.PolylineDashType="PolylineDash",Material._materialCache.addMaterial(Material.PolylineDashType,{fabric:{type:Material.PolylineDashType,uniforms:{color:new Color(1,0,1,1),gapColor:new Color(0,0,0,0),dashLength:16,dashPattern:255},source:PolylineDashMaterial},translucent:!0}),Material.PolylineGlowType="PolylineGlow",Material._materialCache.addMaterial(Material.PolylineGlowType,{fabric:{type:Material.PolylineGlowType,uniforms:{color:new Color(0,.5,1,1),glowPower:.25,taperPower:1},source:PolylineGlowMaterial},translucent:!0}),Material.PolylineOutlineType="PolylineOutline",Material._materialCache.addMaterial(Material.PolylineOutlineType,{fabric:{type:Material.PolylineOutlineType,uniforms:{color:new Color(1,1,1,1),outlineColor:new Color(1,0,0,1),outlineWidth:1},source:PolylineOutlineMaterial},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),Material.ElevationContourType="ElevationContour",Material._materialCache.addMaterial(Material.ElevationContourType,{fabric:{type:Material.ElevationContourType,uniforms:{spacing:100,color:new Color(1,0,0,1),width:1},source:ElevationContourMaterial},translucent:!1}),Material.ElevationRampType="ElevationRamp",Material._materialCache.addMaterial(Material.ElevationRampType,{fabric:{type:Material.ElevationRampType,uniforms:{image:Material.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:ElevationRampMaterial},translucent:!1}),Material.YanMoType="YanMo",Material._materialCache.addMaterial(Material.YanMoType,{fabric:{type:Material.YanMoType,source:YanMoMaterial},translucent:!1}),Material.YanMoType="WaJue",Material._materialCache.addMaterial(Material.YanMoType,{fabric:{type:Material.YanMoType,source:WaJueMaterial},translucent:!1}),Material.SlopeRampMaterialType="SlopeRamp",Material._materialCache.addMaterial(Material.SlopeRampMaterialType,{fabric:{type:Material.SlopeRampMaterialType,uniforms:{image:Material.DefaultImageId},source:SlopeRampMaterial},translucent:!1}),Material.AspectRampMaterialType="AspectRamp",Material._materialCache.addMaterial(Material.AspectRampMaterialType,{fabric:{type:Material.AspectRampMaterialType,uniforms:{image:Material.DefaultImageId},source:AspectRampMaterial},translucent:!1}),defineProperties$1(MaterialAppearance.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}}}),MaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,MaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,MaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,MaterialAppearance.MaterialSupport={BASIC:freezeObject$1({vertexFormat:VertexFormat.POSITION_AND_NORMAL,vertexShaderSource:BasicMaterialAppearanceVS,fragmentShaderSource:BasicMaterialAppearanceFS}),TEXTURED:freezeObject$1({vertexFormat:VertexFormat.POSITION_NORMAL_AND_ST,vertexShaderSource:TexturedMaterialAppearanceVS,fragmentShaderSource:TexturedMaterialAppearanceFS}),ALL:freezeObject$1({vertexFormat:VertexFormat.ALL,vertexShaderSource:AllMaterialAppearanceVS,fragmentShaderSource:AllMaterialAppearanceFS})};var PerInstanceColorAppearanceFS="varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nvec4 color = czm_gammaCorrect(v_color);\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n}\n",PerInstanceColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",PerInstanceFlatColorAppearanceFS="varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = czm_gammaCorrect(v_color);\n}\n",PerInstanceFlatColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function PerInstanceColorAppearance(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucent,!0),i=defaultValue(e.closed,!1),r=defaultValue(e.flat,!1),n=r?PerInstanceFlatColorAppearanceVS:PerInstanceColorAppearanceVS,a=r?PerInstanceFlatColorAppearanceFS:PerInstanceColorAppearanceFS,o=r?PerInstanceColorAppearance.FLAT_VERTEX_FORMAT:PerInstanceColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,n),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,a),this._renderState=Appearance.getDefaultRenderState(t,i,e.renderState),this._closed=i,this._vertexFormat=o,this._flat=r,this._faceForward=defaultValue(e.faceForward,!i)}function ColorMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}function DrawCommand(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._cull=defaultValue(e.cull,!0),this._occlude=defaultValue(e.occlude,!0),this._modelMatrix=e.modelMatrix,this._primitiveType=defaultValue(e.primitiveType,PrimitiveType$1.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=defaultValue(e.offset,0),this._instanceCount=defaultValue(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._executeInClosestFrustum=defaultValue(e.executeInClosestFrustum,!1),this._owner=e.owner,this._debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugOverlappingFrustums=0,this._castShadows=defaultValue(e.castShadows,!1),this._receiveShadows=defaultValue(e.receiveShadows,!1),this._pickId=e.pickId,this._pickOnly=defaultValue(e.pickOnly,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}defineProperties$1(PerInstanceColorAppearance.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}}}),PerInstanceColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_NORMAL,PerInstanceColorAppearance.FLAT_VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PerInstanceColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PerInstanceColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PerInstanceColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,defineProperties$1(ColorMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),ColorMaterialProperty.prototype.getType=function(e){return"Color"},ColorMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},ColorMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ColorMaterialProperty&&Property.equals(this._color,e._color)},defineProperties$1(DrawCommand.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 this._cull},set:function(e){this._cull!==e&&(this._cull=e,this.dirty=!0)}},occlude:{get:function(){return this._occlude},set:function(e){this._occlude!==e&&(this._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 this._castShadows},set:function(e){this._castShadows!==e&&(this._castShadows=e,this.dirty=!0)}},receiveShadows:{get:function(){return this._receiveShadows},set:function(e){this._receiveShadows!==e&&(this._receiveShadows=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 this._executeInClosestFrustum},set:function(e){this._executeInClosestFrustum!==e&&(this._executeInClosestFrustum=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 this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=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 this._pickOnly},set:function(e){this._pickOnly!==e&&(this._pickOnly=e,this.dirty=!0)}}}),DrawCommand.shallowClone=function(e,t){if(defined(e))return defined(t)||(t=new DrawCommand),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._cull=e._cull,t._occlude=e._occlude,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._executeInClosestFrustum=e._executeInClosestFrustum,t._owner=e._owner,t._debugShowBoundingVolume=e._debugShowBoundingVolume,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._castShadows=e._castShadows,t._receiveShadows=e._receiveShadows,t._pickId=e._pickId,t._pickOnly=e._pickOnly,t.dirty=!0,t.lastDirtyTime=0,t},DrawCommand.prototype.execute=function(e,t){if(4==this.pass&&ExpandByMars.tilesFbo&&ExpandByMars.ableTilesFbo)return this.renderState.blending.enabled=!1,this.renderState.cull.enabled=!0,this.framebuffer=ExpandByMars.tilesFbo,void ExpandByMars.tilesCD.push(this);this._owner&&this._owner.ableBright&&ExpandByMars.ableBright?ExpandByMars.brightCD.push(this):e.draw(this,t)};var Pass={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,OVERLAY:9,NUMBER_OF_PASSES:10},Pass$1=freezeObject$1(Pass);function freezeRenderState(e){if("object"!=typeof e||null===e)return e;for(var t,i=Object.keys(e),r=0;r<i.length;r++)t=i[r],e.hasOwnProperty(t)&&"_applyFunctions"!==t&&(e[t]=freezeRenderState(e[t]));return freezeObject$1(e)}function RenderState(e){var t=defaultValue(e,defaultValue.EMPTY_OBJECT),i=defaultValue(t.cull,defaultValue.EMPTY_OBJECT),r=defaultValue(t.polygonOffset,defaultValue.EMPTY_OBJECT),n=defaultValue(t.scissorTest,defaultValue.EMPTY_OBJECT),a=defaultValue(n.rectangle,defaultValue.EMPTY_OBJECT),o=defaultValue(t.depthRange,defaultValue.EMPTY_OBJECT),s=defaultValue(t.depthTest,defaultValue.EMPTY_OBJECT),l=defaultValue(t.colorMask,defaultValue.EMPTY_OBJECT),c=defaultValue(t.blending,defaultValue.EMPTY_OBJECT),u=defaultValue(c.color,defaultValue.EMPTY_OBJECT),d=defaultValue(t.stencilTest,defaultValue.EMPTY_OBJECT),h=defaultValue(d.frontOperation,defaultValue.EMPTY_OBJECT),p=defaultValue(d.backOperation,defaultValue.EMPTY_OBJECT),m=defaultValue(t.sampleCoverage,defaultValue.EMPTY_OBJECT),f=t.viewport;this.frontFace=defaultValue(t.frontFace,WindingOrder$1.COUNTER_CLOCKWISE),this.cull={enabled:defaultValue(i.enabled,!1),face:defaultValue(i.face,WebGLConstants$1.BACK)},this.lineWidth=defaultValue(t.lineWidth,1),this.polygonOffset={enabled:defaultValue(r.enabled,!1),factor:defaultValue(r.factor,0),units:defaultValue(r.units,0)},this.scissorTest={enabled:defaultValue(n.enabled,!1),rectangle:BoundingRectangle.clone(a)},this.depthRange={near:defaultValue(o.near,0),far:defaultValue(o.far,1)},this.depthTest={enabled:defaultValue(s.enabled,!1),func:defaultValue(s.func,WebGLConstants$1.LESS)},this.colorMask={red:defaultValue(l.red,!0),green:defaultValue(l.green,!0),blue:defaultValue(l.blue,!0),alpha:defaultValue(l.alpha,!0)},this.depthMask=defaultValue(t.depthMask,!0),this.stencilMask=defaultValue(t.stencilMask,-1),this.blending={enabled:defaultValue(c.enabled,!1),color:new Color(defaultValue(u.red,0),defaultValue(u.green,0),defaultValue(u.blue,0),defaultValue(u.alpha,0)),equationRgb:defaultValue(c.equationRgb,WebGLConstants$1.FUNC_ADD),equationAlpha:defaultValue(c.equationAlpha,WebGLConstants$1.FUNC_ADD),functionSourceRgb:defaultValue(c.functionSourceRgb,WebGLConstants$1.ONE),functionSourceAlpha:defaultValue(c.functionSourceAlpha,WebGLConstants$1.ONE),functionDestinationRgb:defaultValue(c.functionDestinationRgb,WebGLConstants$1.ZERO),functionDestinationAlpha:defaultValue(c.functionDestinationAlpha,WebGLConstants$1.ZERO)},this.stencilTest={enabled:defaultValue(d.enabled,!1),frontFunction:defaultValue(d.frontFunction,WebGLConstants$1.ALWAYS),backFunction:defaultValue(d.backFunction,WebGLConstants$1.ALWAYS),reference:defaultValue(d.reference,0),mask:defaultValue(d.mask,-1),frontOperation:{fail:defaultValue(h.fail,WebGLConstants$1.KEEP),zFail:defaultValue(h.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(h.zPass,WebGLConstants$1.KEEP)},backOperation:{fail:defaultValue(p.fail,WebGLConstants$1.KEEP),zFail:defaultValue(p.zFail,WebGLConstants$1.KEEP),zPass:defaultValue(p.zPass,WebGLConstants$1.KEEP)}},this.sampleCoverage={enabled:defaultValue(m.enabled,!1),value:defaultValue(m.value,1),invert:defaultValue(m.invert,!1)},this.viewport=defined(f)?new BoundingRectangle(f.x,f.y,f.width,f.height):void 0,this.id=0,this._applyFunctions=[]}var nextRenderStateId=0,renderStateCache={};function enableOrDisable(e,t,i){i?e.enable(t):e.disable(t)}function applyFrontFace(e,t){e.frontFace(t.frontFace)}function applyCull(e,t){var i=t.cull,r=defaultValue(ExpandByMars.underEarth.cullFace,i.enabled);enableOrDisable(e,e.CULL_FACE,r),r&&e.cullFace(i.face)}function applyLineWidth(e,t){e.lineWidth(t.lineWidth)}function applyPolygonOffset(e,t){var i=t.polygonOffset,r=i.enabled;enableOrDisable(e,e.POLYGON_OFFSET_FILL,r),r&&e.polygonOffset(i.factor,i.units)}function applyScissorTest(e,t,i){var r=t.scissorTest,n=defined(i.scissorTest)?i.scissorTest.enabled:r.enabled;if(enableOrDisable(e,e.SCISSOR_TEST,n),n){var a=defined(i.scissorTest)?i.scissorTest.rectangle:r.rectangle;e.scissor(a.x,a.y,a.width,a.height)}}function applyDepthRange(e,t){var i=t.depthRange;e.depthRange(i.near,i.far)}function applyDepthTest(e,t){var i=t.depthTest,r=i.enabled;enableOrDisable(e,e.DEPTH_TEST,r),r&&e.depthFunc(i.func)}function applyColorMask(e,t){var i=t.colorMask;e.colorMask(i.red,i.green,i.blue,i.alpha)}function applyDepthMask(e,t){e.depthMask(t.depthMask)}function applyStencilMask(e,t){e.stencilMask(t.stencilMask)}function applyBlendingColor(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function applyBlending(e,t,i){var r=t.blending,n=defined(i.blendingEnabled)?i.blendingEnabled:r.enabled;enableOrDisable(e,e.BLEND,n),n&&(applyBlendingColor(e,r.color),e.blendEquationSeparate(r.equationRgb,r.equationAlpha),e.blendFuncSeparate(r.functionSourceRgb,r.functionDestinationRgb,r.functionSourceAlpha,r.functionDestinationAlpha))}function applyStencilTest(e,t){var i=t.stencilTest,r=i.enabled;if(enableOrDisable(e,e.STENCIL_TEST,r),r){var n=i.frontFunction,a=i.backFunction,o=i.reference,s=i.mask;e.stencilFunc(n,o,s),e.stencilFuncSeparate(e.BACK,a,o,s),e.stencilFuncSeparate(e.FRONT,n,o,s);var l=i.frontOperation,c=l.fail,u=l.zFail,d=l.zPass;e.stencilOpSeparate(e.FRONT,c,u,d);var h=i.backOperation,p=h.fail,m=h.zFail,f=h.zPass;e.stencilOpSeparate(e.BACK,p,m,f)}}function applySampleCoverage(e,t){var i=t.sampleCoverage,r=i.enabled;enableOrDisable(e,e.SAMPLE_COVERAGE,r),r&&e.sampleCoverage(i.value,i.invert)}RenderState.fromCache=function(e){var t=JSON.stringify(e),i=renderStateCache[t];if(defined(i))return++i.referenceCount,i.state;var r=new RenderState(e),n=JSON.stringify(r);return defined(i=renderStateCache[n])||(r.id=nextRenderStateId++,i={referenceCount:0,state:r},renderStateCache[n]=i),++i.referenceCount,renderStateCache[t]={referenceCount:1,state:i.state},i.state},RenderState.removeFromCache=function(e){var t=new RenderState(e),i=JSON.stringify(t),r=renderStateCache[i],n=JSON.stringify(e),a=renderStateCache[n];defined(a)&&(--a.referenceCount,0===a.referenceCount&&(delete renderStateCache[n],defined(r)&&--r.referenceCount)),defined(r)&&0===r.referenceCount&&delete renderStateCache[i]},RenderState.getCache=function(){return renderStateCache},RenderState.clearCache=function(){renderStateCache={}};var scratchViewport=new BoundingRectangle;function applyViewport(e,t,i){var r=defaultValue(t.viewport,i.viewport);defined(r)||((r=scratchViewport).width=i.context.drawingBufferWidth,r.height=i.context.drawingBufferHeight),i.context.uniformState.viewport=r,e.viewport(r.x,r.y,r.width,r.height)}function createFuncs(e,t){var i=[];return e.frontFace!==t.frontFace&&i.push(applyFrontFace),e.cull.enabled===t.cull.enabled&&e.cull.face===t.cull.face||i.push(applyCull),e.lineWidth!==t.lineWidth&&i.push(applyLineWidth),e.polygonOffset.enabled===t.polygonOffset.enabled&&e.polygonOffset.factor===t.polygonOffset.factor&&e.polygonOffset.units===t.polygonOffset.units||i.push(applyPolygonOffset),e.depthRange.near===t.depthRange.near&&e.depthRange.far===t.depthRange.far||i.push(applyDepthRange),e.depthTest.enabled===t.depthTest.enabled&&e.depthTest.func===t.depthTest.func||i.push(applyDepthTest),e.colorMask.red===t.colorMask.red&&e.colorMask.green===t.colorMask.green&&e.colorMask.blue===t.colorMask.blue&&e.colorMask.alpha===t.colorMask.alpha||i.push(applyColorMask),e.depthMask!==t.depthMask&&i.push(applyDepthMask),e.stencilMask!==t.stencilMask&&i.push(applyStencilMask),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||i.push(applyStencilTest),e.sampleCoverage.enabled===t.sampleCoverage.enabled&&e.sampleCoverage.value===t.sampleCoverage.value&&e.sampleCoverage.invert===t.sampleCoverage.invert||i.push(applySampleCoverage),i}RenderState.apply=function(e,t,i){applyFrontFace(e,t),applyCull(e,t),applyLineWidth(e,t),applyPolygonOffset(e,t),applyDepthRange(e,t),applyDepthTest(e,t),applyColorMask(e,t),applyDepthMask(e,t),applyStencilMask(e,t),applyStencilTest(e,t),applySampleCoverage(e,t),applyScissorTest(e,t,i),applyBlending(e,t,i),applyViewport(e,t,i)},RenderState.partialApply=function(e,t,i,r,n,a){if(t!==i){var o=i._applyFunctions[t.id];defined(o)||(o=createFuncs(t,i),i._applyFunctions[t.id]=o);for(var s=o.length,l=0;l<s;++l)o[l](e,i)}(defined(r.scissorTest)?r.scissorTest:t.scissorTest)===(defined(n.scissorTest)?n.scissorTest:i.scissorTest)&&!a||applyScissorTest(e,i,n);var c=defined(r.blendingEnabled)?r.blendingEnabled:t.blending.enabled,u=defined(n.blendingEnabled)?n.blendingEnabled:i.blending.enabled;(c!==u||u&&t.blending!==i.blending)&&applyBlending(e,i,n),t===i&&r===n&&r.context===n.context||applyViewport(e,i,n)},RenderState.getState=function(e){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:BoundingRectangle.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:Color.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:defined(e.viewport)?BoundingRectangle.clone(e.viewport):void 0}};var viewerPositionWCScratch=new Cartesian3;function AutomaticUniform(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}var datatypeToGlsl={};datatypeToGlsl[WebGLConstants$1.FLOAT]="float",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC2]="vec2",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC3]="vec3",datatypeToGlsl[WebGLConstants$1.FLOAT_VEC4]="vec4",datatypeToGlsl[WebGLConstants$1.INT]="int",datatypeToGlsl[WebGLConstants$1.INT_VEC2]="ivec2",datatypeToGlsl[WebGLConstants$1.INT_VEC3]="ivec3",datatypeToGlsl[WebGLConstants$1.INT_VEC4]="ivec4",datatypeToGlsl[WebGLConstants$1.BOOL]="bool",datatypeToGlsl[WebGLConstants$1.BOOL_VEC2]="bvec2",datatypeToGlsl[WebGLConstants$1.BOOL_VEC3]="bvec3",datatypeToGlsl[WebGLConstants$1.BOOL_VEC4]="bvec4",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT2]="mat2",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT3]="mat3",datatypeToGlsl[WebGLConstants$1.FLOAT_MAT4]="mat4",datatypeToGlsl[WebGLConstants$1.SAMPLER_2D]="sampler2D",datatypeToGlsl[WebGLConstants$1.SAMPLER_CUBE]="samplerCube",AutomaticUniform.prototype.getDeclaration=function(e){var t="uniform "+datatypeToGlsl[this._datatype]+" "+e,i=this._size;return t+=1===i?";":"["+i.toString()+"];"};var AutomaticUniforms={yp_black_texture:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e._yp_black_texture}}),czm_viewport:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight2D:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_log2FarDistance:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.log2FarDistance}}),czm_log2FarPlusOne:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.log2FarPlusOne}}),czm_log2NearDistance:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.log2NearDistance}}),czm_sunPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_encodedCameraPositionMCHigh:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return Matrix4.getTranslation(e.inverseView,viewerPositionWCScratch)}}),czm_frameNumber:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new AutomaticUniform({size:1,datatype:WebGLConstants$1.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new AutomaticUniform({size:9,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.fogDensity}}),czm_imagerySplitPosition:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.imagerySplitPosition}}),czm_geometricToleranceOverMeter:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT,getValue:function(e){return e.gamma}}),czm_sunColor:new AutomaticUniform({size:1,datatype:WebGLConstants$1.FLOAT_VEC3,getValue:function(e){return e.sunColor}})};function createUniform$1(e,t,i,r){switch(t.type){case e.FLOAT:return new UniformFloat(e,t,i,r);case e.FLOAT_VEC2:return new UniformFloatVec2(e,t,i,r);case e.FLOAT_VEC3:return new UniformFloatVec3(e,t,i,r);case e.FLOAT_VEC4:return new UniformFloatVec4(e,t,i,r);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformSampler(e,t,i,r);case e.INT:case e.BOOL:return new UniformInt(e,t,i,r);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformIntVec2(e,t,i,r);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformIntVec3(e,t,i,r);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformIntVec4(e,t,i,r);case e.FLOAT_MAT2:return new UniformMat2(e,t,i,r);case e.FLOAT_MAT3:return new UniformMat3(e,t,i,r);case e.FLOAT_MAT4:return new UniformMat4(e,t,i,r);default:throw new RuntimeError("Unrecognized uniform type: "+t.type+' for uniform "'+i+'".')}}function UniformFloat(e,t,i,r){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=r}function UniformFloatVec2(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=r}function UniformFloatVec3(e,t,i,r){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=r}function UniformFloatVec4(e,t,i,r){this.name=i,this.value=void 0,this._value=void 0,this._gl=e,this._location=r}function UniformSampler(e,t,i,r){this.name=i,this.value=void 0,this._gl=e,this._location=r,this.textureUnitIndex=void 0}function UniformInt(e,t,i,r){this.name=i,this.value=void 0,this._value=0,this._gl=e,this._location=r}function UniformIntVec2(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian2,this._gl=e,this._location=r}function UniformIntVec3(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian3,this._gl=e,this._location=r}function UniformIntVec4(e,t,i,r){this.name=i,this.value=void 0,this._value=new Cartesian4,this._gl=e,this._location=r}UniformFloat.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))},UniformFloatVec2.prototype.set=function(){var e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))},UniformFloatVec3.prototype.set=function(){var e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue)):defined(e.x)&&(Cartesian3.equals(e,this._value)||(this._value=Cartesian3.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z)))},UniformFloatVec4.prototype.set=function(){var e=this.value;defined(e.red)?Color.equals(e,this._value)||(this._value=Color.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha)):defined(e.x)&&(Cartesian4.equals(e,this._value)||(this._value=Cartesian4.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w)))},UniformSampler.prototype.set=function(){var e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);var t=this.value;e.bindTexture(t._target,t._texture)},UniformSampler.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1},UniformInt.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))},UniformIntVec2.prototype.set=function(){var e=this.value;Cartesian2.equals(e,this._value)||(Cartesian2.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))},UniformIntVec3.prototype.set=function(){var e=this.value;Cartesian3.equals(e,this._value)||(Cartesian3.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))},UniformIntVec4.prototype.set=function(){var e=this.value;Cartesian4.equals(e,this._value)||(Cartesian4.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};var scratchUniformArray=new Float32Array(4);function UniformMat2(e,t,i,r){this.name=i,this.value=void 0,this._value=new Matrix2,this._gl=e,this._location=r}UniformMat2.prototype.set=function(){if(!Matrix2.equalsArray(this.value,this._value,0)){Matrix2.clone(this.value,this._value);var e=Matrix2.toArray(this.value,scratchUniformArray);this._gl.uniformMatrix2fv(this._location,!1,e)}};var scratchMat3Array=new Float32Array(9);function UniformMat3(e,t,i,r){this.name=i,this.value=void 0,this._value=new Matrix3,this._gl=e,this._location=r}UniformMat3.prototype.set=function(){if(!Matrix3.equalsArray(this.value,this._value,0)){Matrix3.clone(this.value,this._value);var e=Matrix3.toArray(this.value,scratchMat3Array);this._gl.uniformMatrix3fv(this._location,!1,e)}};var scratchMat4Array=new Float32Array(16);function UniformMat4(e,t,i,r){this.name=i,this.value=void 0,this._value=new Matrix4,this._gl=e,this._location=r}function createUniformArray(e,t,i,r){switch(t.type){case e.FLOAT:return new UniformArrayFloat(e,t,i,r);case e.FLOAT_VEC2:return new UniformArrayFloatVec2(e,t,i,r);case e.FLOAT_VEC3:return new UniformArrayFloatVec3(e,t,i,r);case e.FLOAT_VEC4:return new UniformArrayFloatVec4(e,t,i,r);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new UniformArraySampler(e,t,i,r);case e.INT:case e.BOOL:return new UniformArrayInt(e,t,i,r);case e.INT_VEC2:case e.BOOL_VEC2:return new UniformArrayIntVec2(e,t,i,r);case e.INT_VEC3:case e.BOOL_VEC3:return new UniformArrayIntVec3(e,t,i,r);case e.INT_VEC4:case e.BOOL_VEC4:return new UniformArrayIntVec4(e,t,i,r);case e.FLOAT_MAT2:return new UniformArrayMat2(e,t,i,r);case e.FLOAT_MAT3:return new UniformArrayMat3(e,t,i,r);case e.FLOAT_MAT4:return new UniformArrayMat4(e,t,i,r);default:throw new RuntimeError("Unrecognized uniform type: "+t.type+' for uniform "'+i+'".')}}function UniformArrayFloat(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(n),this._gl=e,this._location=r[0]}function UniformArrayFloatVec2(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(2*n),this._gl=e,this._location=r[0]}function UniformArrayFloatVec3(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(3*n),this._gl=e,this._location=r[0]}function UniformArrayFloatVec4(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(4*n),this._gl=e,this._location=r[0]}function UniformArraySampler(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(n),this._gl=e,this._locations=r,this.textureUnitIndex=void 0}function UniformArrayInt(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(n),this._gl=e,this._location=r[0]}function UniformArrayIntVec2(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(2*n),this._gl=e,this._location=r[0]}function UniformArrayIntVec3(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(3*n),this._gl=e,this._location=r[0]}function UniformArrayIntVec4(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Int32Array(4*n),this._gl=e,this._location=r[0]}function UniformArrayMat2(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(4*n),this._gl=e,this._location=r[0]}function UniformArrayMat3(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(9*n),this._gl=e,this._location=r[0]}function UniformArrayMat4(e,t,i,r){var n=r.length;this.name=i,this.value=new Array(n),this._value=new Float32Array(16*n),this._gl=e,this._location=r[0]}UniformMat4.prototype.set=function(){if(!Matrix4.equalsArray(this.value,this._value,0)){Matrix4.clone(this.value,this._value);var e=Matrix4.toArray(this.value,scratchMat4Array);this._gl.uniformMatrix4fv(this._location,!1,e)}},UniformArrayFloat.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0;n<t;++n){var a=e[n];a!==i[n]&&(i[n]=a,r=!0)}r&&this._gl.uniform1fv(this._location,i)},UniformArrayFloatVec2.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian2.equalsArray(o,i,n)||(Cartesian2.pack(o,i,n),r=!0),n+=2}r&&this._gl.uniform2fv(this._location,i)},UniformArrayFloatVec3.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];defined(o.red)?o.red===i[n]&&o.green===i[n+1]&&o.blue===i[n+2]||(i[n]=o.red,i[n+1]=o.green,i[n+2]=o.blue,r=!0):defined(o.x)&&(Cartesian3.equalsArray(o,i,n)||(Cartesian3.pack(o,i,n),r=!0)),n+=3}r&&this._gl.uniform3fv(this._location,i)},UniformArrayFloatVec4.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];defined(o.red)?Color.equalsArray(o,i,n)||(Color.pack(o,i,n),r=!0):defined(o.x)&&(Cartesian4.equalsArray(o,i,n)||(Cartesian4.pack(o,i,n),r=!0)),n+=4}r&&this._gl.uniform4fv(this._location,i)},UniformArraySampler.prototype.set=function(){for(var e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,i=this.value,r=i.length,n=0;n<r;++n){var a=i[n];e.activeTexture(t+n),e.bindTexture(a._target,a._texture)}},UniformArraySampler.prototype._setSampler=function(e){this.textureUnitIndex=e;for(var t=this._locations,i=t.length,r=0;r<i;++r){var n=e+r;this._gl.uniform1i(t[r],n)}return e+i},UniformArrayInt.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0;n<t;++n){var a=e[n];a!==i[n]&&(i[n]=a,r=!0)}r&&this._gl.uniform1iv(this._location,i)},UniformArrayIntVec2.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian2.equalsArray(o,i,n)||(Cartesian2.pack(o,i,n),r=!0),n+=2}r&&this._gl.uniform2iv(this._location,i)},UniformArrayIntVec3.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian3.equalsArray(o,i,n)||(Cartesian3.pack(o,i,n),r=!0),n+=3}r&&this._gl.uniform3iv(this._location,i)},UniformArrayIntVec4.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Cartesian4.equalsArray(o,i,n)||(Cartesian4.pack(o,i,n),r=!0),n+=4}r&&this._gl.uniform4iv(this._location,i)},UniformArrayMat2.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Matrix2.equalsArray(o,i,n)||(Matrix2.pack(o,i,n),r=!0),n+=4}r&&this._gl.uniformMatrix2fv(this._location,!1,i)},UniformArrayMat3.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Matrix3.equalsArray(o,i,n)||(Matrix3.pack(o,i,n),r=!0),n+=9}r&&this._gl.uniformMatrix3fv(this._location,!1,i)},UniformArrayMat4.prototype.set=function(){for(var e=this.value,t=e.length,i=this._value,r=!1,n=0,a=0;a<t;++a){var o=e[a];Matrix4.equalsArray(o,i,n)||(Matrix4.pack(o,i,n),r=!0),n+=16}r&&this._gl.uniformMatrix4fv(this._location,!1,i)};var nextShaderProgramId=0;function ShaderProgram(e){var t=handleUniformPrecisionMismatches(e.vertexShaderText,e.fragmentShaderText);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=t.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=t.fragmentShaderText,this.id=nextShaderProgramId++}function extractUniforms(e){var t=[],i=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(defined(i))for(var r=i.length,n=0;n<r;n++){var a=i[n].trim(),o=a.slice(a.lastIndexOf(" ")+1);t.push(o)}return t}function handleUniformPrecisionMismatches(e,t){var i={};if(!ContextLimits.highpFloatSupported||!ContextLimits.highpIntSupported){var r,n,a,o,s=extractUniforms(e),l=extractUniforms(t),c=s.length,u=l.length;for(r=0;r<c;r++)for(n=0;n<u;n++)if(s[r]===l[n]){o="czm_mediump_"+(a=s[r]);var d=new RegExp(a+"\\b","g");t=t.replace(d,o),i[o]=a}}return{fragmentShaderText:t,duplicateUniformNames:i}}ShaderProgram.fromCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.getShaderProgram(e)},ShaderProgram.replaceCache=function(e){return(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context.shaderCache.replaceShaderProgram(e)},defineProperties$1(ShaderProgram.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return initialize$1(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return initialize$1(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return initialize$1(this),this._uniformsByName}}});var consolePrefix="[Cesium WebGL] ";function createAndLinkProgram(e,t){var i=t._vertexShaderText,r=t._fragmentShaderText,n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,i),e.compileShader(n);var a=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(a,r),e.compileShader(a);var o=e.createProgram();e.attachShader(o,n),e.attachShader(o,a),e.deleteShader(n),e.deleteShader(a);var s,l=t._attributeLocations;if(defined(l))for(var c in l)l.hasOwnProperty(c)&&e.bindAttribLocation(o,l[c],c);if(e.linkProgram(o),!e.getProgramParameter(o,e.LINK_STATUS)){var u=t._debugShaders;if(!e.getShaderParameter(a,e.COMPILE_STATUS)){if(s=e.getShaderInfoLog(a),console.error(consolePrefix+"Fragment shader compile log: "+s),defined(u)){var d=u.getTranslatedShaderSource(a);""!==d?console.error(consolePrefix+"Translated fragment shader source:\n"+d):console.error(consolePrefix+"Fragment shader translation failed.")}throw e.deleteProgram(o),new RuntimeError("Fragment shader failed to compile.  Compile log: "+s)}if(e.getShaderParameter(n,e.COMPILE_STATUS))throw s=e.getProgramInfoLog(o),console.error(consolePrefix+"Shader program link log: "+s),defined(u)&&(console.error(consolePrefix+"Translated vertex shader source:\n"+u.getTranslatedShaderSource(n)),console.error(consolePrefix+"Translated fragment shader source:\n"+u.getTranslatedShaderSource(a))),e.deleteProgram(o),new RuntimeError("Program failed to link.  Link log: "+s);if(s=e.getShaderInfoLog(n),console.error(consolePrefix+"Vertex shader compile log: "+s),defined(u)){var h=u.getTranslatedShaderSource(n);""!==h?console.error(consolePrefix+"Translated vertex shader source:\n"+h):console.error(consolePrefix+"Vertex shader translation failed.")}throw e.deleteProgram(o),new RuntimeError("Vertex shader failed to compile.  Compile log: "+s)}var p=t._logShaderCompilation;return p&&defined(s=e.getShaderInfoLog(n))&&0<s.length&&console.log(consolePrefix+"Vertex shader compile log: "+s),p&&defined(s=e.getShaderInfoLog(a))&&0<s.length&&console.log(consolePrefix+"Fragment shader compile log: "+s),p&&defined(s=e.getProgramInfoLog(o))&&0<s.length&&console.log(consolePrefix+"Shader program link log: "+s),o}function findVertexAttributes(e,t,i){for(var r={},n=0;n<i;++n){var a=e.getActiveAttrib(t,n),o=e.getAttribLocation(t,a.name);r[a.name]={name:a.name,type:a.type,index:o}}return r}function findUniforms(e,t){for(var i={},r=[],n=[],a=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;o<a;++o){var s=e.getActiveUniform(t,o),l=-1!==s.name.indexOf("[0]",s.name.length-"[0]".length)?s.name.slice(0,s.name.length-3):s.name;if(0!==l.indexOf("gl_"))if(s.name.indexOf("[")<0){var c=e.getUniformLocation(t,l);if(null!==c){var u=createUniform$1(e,s,l,c);i[l]=u,r.push(u),u._setSampler&&n.push(u)}}else{var d,h,p,m,f=l.indexOf("[");if(0<=f){if(!defined(d=i[l.slice(0,f)]))continue;(h=d._locations).length<=1&&(p=d.value,null!==(m=e.getUniformLocation(t,l))&&(h.push(m),p.push(e.getUniform(t,m))))}else{h=[];for(var g=0;g<s.size;++g)null!==(m=e.getUniformLocation(t,l+"["+g+"]"))&&h.push(m);d=createUniformArray(e,s,l,h),i[l]=d,r.push(d),d._setSampler&&n.push(d)}}}return{uniformsByName:i,uniforms:r,samplerUniforms:n}}function partitionUniforms(e,t){var i=[],r=[];for(var n in t)if(t.hasOwnProperty(n)){var a=t[n],o=n,s=e._duplicateUniformNames[o];defined(s)&&(o=a.name=s);var l=AutomaticUniforms[o];defined(l)?i.push({uniform:a,automaticUniform:l}):r.push(a)}return{automaticUniforms:i,manualUniforms:r}}function setSamplerUniforms(e,t,i){e.useProgram(t);for(var r=0,n=i.length,a=0;a<n;++a)r=i[a]._setSampler(r);return e.useProgram(null),r}function initialize$1(e){if(!defined(e._program)){var t=e._gl,i=createAndLinkProgram(t,e,e._debugShaders),r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES),n=findUniforms(t,i),a=partitionUniforms(e,n.uniformsByName);e._program=i,e._numberOfVertexAttributes=r,e._vertexAttributes=findVertexAttributes(t,i,r),e._uniformsByName=n.uniformsByName,e._uniforms=n.uniforms,e._automaticUniforms=a.automaticUniforms,e._manualUniforms=a.manualUniforms,e.maximumTextureUnitIndex=setSamplerUniforms(t,i,n.samplerUniforms)}}function modernizeShader(e,t){var i=/#define OUTPUT_DECLARATION/,r=e.split("\n");if(/#version 300 es/g.test(e))return e;var n,a,o=-1;for(n=0;n<r.length;++n)if(a=r[n],i.test(a)){o=n;break}if(-1===o)throw new DeveloperError("Could not find a #define OUTPUT_DECLARATION!");var s=[];for(n=0;n<10;n++){var l="gl_FragData\\["+n+"\\]",c="czm_out"+n;new RegExp(l,"g").test(e)&&(setAdd(c,s),replaceInSourceString(l,c,r),r.splice(o,0,"layout(location = "+n+") out vec4 "+c+";"),o+=1)}var u="czm_fragColor";findInSource("gl_FragColor",r)&&(setAdd(u,s),replaceInSourceString("gl_FragColor",u,r),r.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);var d=getVariablePreprocessorBranch(s,r),h={};for(n=0;n<r.length;n++)for(var p in a=r[n],d){if(d.hasOwnProperty(p))new RegExp("(layout)[^]+(out)[^]+("+p+")[^]+","g").test(a)&&(h[a]=p)}for(var m in h)if(h.hasOwnProperty(m)){var f,g=h[m],_=r.indexOf(m),y=d[g],v=y.length;for(f=0;f<v;f++)r.splice(_,0,y[f]);for(_+=v+1,f=v-1;0<=f;f--)r.splice(_,0,"#endif //"+y[f])}var C="#version 300 es",S=!1;for(n=0;n<r.length;n++)/#version/.test(r[n])&&(r[n]=C,S=!0);return S||r.splice(0,0,C),removeExtension("EXT_draw_buffers",r),removeExtension("EXT_frag_depth",r),replaceInSourceString("texture2D","texture",r),replaceInSourceString("texture3D","texture",r),replaceInSourceString("textureCube","texture",r),replaceInSourceString("gl_FragDepthEXT","gl_FragDepth",r),t?replaceInSourceString("varying","in",r):(replaceInSourceString("attribute","in",r),replaceInSourceString("varying","out",r)),compileSource(r)}function replaceInSourceString(e,t,i){for(var r=new RegExp("(^|[^\\w])("+e+")($|[^\\w])","g"),n=i.length,a=0;a<n;++a){var o=i[a];i[a]=o.replace(r,"$1"+t+"$3")}}function replaceInSourceRegex(e,t,i){for(var r=i.length,n=0;n<r;++n){var a=i[n];i[n]=a.replace(e,t)}}function findInSource(e,t){for(var i=new RegExp("(^|[^\\w])("+e+")($|[^\\w])","g"),r=t.length,n=0;n<r;++n){var a=t[n];if(i.test(a))return!0}return!1}function compileSource(e){for(var t="",i=e.length,r=0;r<i;++r)t+=e[r]+"\n";return t}function setAdd(e,t){-1===t.indexOf(e)&&t.push(e)}function getVariablePreprocessorBranch(e,t){for(var i={},r=e.length,n=[],a=0;a<t.length;++a){var o=t[a],s=/(#ifdef|#if)/g.test(o),l=/#else/g.test(o),c=/#endif/g.test(o);if(s)n.push(o);else if(l){var u=n[n.length-1].replace("ifdef","ifndef");/if/g.test(u)&&(u=u.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),n.pop(),n.push(u)}else if(c)n.pop();else if(!/layout/g.test(o))for(var d=0;d<r;++d){var h=e[d];-1!==o.indexOf(h)&&(defined(i[h])?i[h]=i[h].filter(function(e){return 0<=n.indexOf(e)}):i[h]=n.slice())}}return i}function removeExtension(e,t){replaceInSourceRegex(new RegExp("#extension\\s+GL_"+e+"\\s+:\\s+[a-zA-Z0-9]+\\s*$","g"),"",t)}ShaderProgram.prototype._bind=function(){initialize$1(this),this._gl.useProgram(this._program)},ShaderProgram.prototype._setUniforms=function(e,t,i){var r,n;if(defined(e)){var a=this._manualUniforms;for(r=a.length,n=0;n<r;++n){var o=a[n];o.value=e[o.name]()}}var s=this._automaticUniforms;for(r=s.length,n=0;n<r;++n){var l=s[n];l.uniform.value=l.automaticUniform.getValue(t)}var c=this._uniforms;for(r=c.length,n=0;n<r;++n)c[n].set();if(i){var u=this._gl,d=this._program;u.validateProgram(d)}},ShaderProgram.prototype.isDestroyed=function(){return!1},ShaderProgram.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)},ShaderProgram.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),destroyObject(this)};var czm_degreesPerRadian="const float czm_degreesPerRadian = 57.29577951308232;\n",czm_depthRange="const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n",czm_ellipsoidInverseRadii="const vec3 czm_ellipsoidInverseRadii = vec3(1.0 / 6378137.0, 1.0 / 6378137.0, 1.0 / 6356752.314245);\n",czm_ellipsoidRadii="const vec3 czm_ellipsoidRadii = vec3(6378137.0, 6378137.0, 6356752.314245);\n",czm_epsilon1="const float czm_epsilon1 = 0.1;\n",czm_epsilon2="const float czm_epsilon2 = 0.01;\n",czm_epsilon3="const float czm_epsilon3 = 0.001;\n",czm_epsilon4="const float czm_epsilon4 = 0.0001;\n",czm_epsilon5="const float czm_epsilon5 = 0.00001;\n",czm_epsilon6="const float czm_epsilon6 = 0.000001;\n",czm_epsilon7="const float czm_epsilon7 = 0.0000001;\n",czm_infinity="const float czm_infinity = 5906376272000.0;\n",czm_oneOverPi="const float czm_oneOverPi = 0.3183098861837907;\n",czm_oneOverTwoPi="const float czm_oneOverTwoPi = 0.15915494309189535;\n",czm_passCesium3DTile="const float czm_passCesium3DTile = 4.0;\n",czm_passCesium3DTileClassification="const float czm_passCesium3DTileClassification = 5.0;\n",czm_passCesium3DTileClassificationIgnoreShow="const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;\n",czm_passClassification="const float czm_passClassification = 7.0;\n",czm_passCompute="const float czm_passCompute = 1.0;\n",czm_passEnvironment="const float czm_passEnvironment = 0.0;\n",czm_passGlobe="const float czm_passGlobe = 2.0;\n",czm_passOpaque="const float czm_passOpaque = 7.0;\n",czm_passOverlay="const float czm_passOverlay = 9.0;\n",czm_passTerrainClassification="const float czm_passTerrainClassification = 3.0;\n",czm_passTranslucent="const float czm_passTranslucent = 8.0;\n",czm_pi="const float czm_pi = 3.141592653589793;\n",czm_piOverFour="const float czm_piOverFour = 0.7853981633974483;\n",czm_piOverSix="const float czm_piOverSix = 0.5235987755982988;\n",czm_piOverThree="const float czm_piOverThree = 1.0471975511965976;\n",czm_piOverTwo="const float czm_piOverTwo = 1.5707963267948966;\n",czm_radiansPerDegree="const float czm_radiansPerDegree = 0.017453292519943295;\n",czm_sceneMode2D="const float czm_sceneMode2D = 2.0;\n",czm_sceneMode3D="const float czm_sceneMode3D = 3.0;\n",czm_sceneModeColumbusView="const float czm_sceneModeColumbusView = 1.0;\n",czm_sceneModeMorphing="const float czm_sceneModeMorphing = 0.0;\n",czm_solarRadius="const float czm_solarRadius = 695500000.0;\n",czm_threePiOver2="const float czm_threePiOver2 = 4.71238898038469;\n",czm_twoPi="const float czm_twoPi = 6.283185307179586;\n",czm_webMercatorMaxLatitude="const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n",czm_depthRangeStruct="struct czm_depthRangeStruct\n{\nfloat near;\nfloat far;\n};\n",czm_ellipsoid="struct czm_ellipsoid\n{\nvec3 center;\nvec3 radii;\nvec3 inverseRadii;\nvec3 inverseRadiiSquared;\n};\n",czm_material="struct czm_material\n{\nvec3 diffuse;\nfloat specular;\nfloat shininess;\nvec3 normal;\nvec3 emission;\nfloat alpha;\n};\n",czm_materialInput="struct czm_materialInput\n{\nfloat s;\nvec2 st;\nvec3 str;\nvec3 normalEC;\nmat3 tangentToEyeMatrix;\nvec3 positionToEyeEC;\nfloat height;\nfloat slope;\nfloat aspect;\n};\n",czm_ray="struct czm_ray\n{\nvec3 origin;\nvec3 direction;\n};\n",czm_raySegment="struct czm_raySegment\n{\nfloat start;\nfloat stop;\n};\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n",czm_shadowParameters="struct czm_shadowParameters\n{\n#ifdef USE_CUBE_MAP_SHADOW\nvec3 texCoords;\n#else\nvec2 texCoords;\n#endif\nfloat depthBias;\nfloat depth;\nfloat nDotL;\nvec2 texelStepSize;\nfloat normalShadingSmooth;\nfloat darkness;\n};\n",czm_stcParameters="struct czm_stcParameters\n{\nvec3 texCoords;\nfloat depthBias;\nfloat depth;\nfloat nDotL;\nvec2 texelStepSize;\nfloat normalShadingSmooth;\nfloat darkness;\n};\n",czm_acesTonemapping="vec3 czm_acesTonemapping(vec3 color) {\nfloat g = 0.985;\nfloat a = 0.065;\nfloat b = 0.0001;\nfloat c = 0.433;\nfloat d = 0.238;\ncolor = (color * (color + a) - b) / (color * (g * color + c) + d);\ncolor = clamp(color, 0.0, 1.0);\nreturn color;\n}\n",czm_alphaWeight="float czm_alphaWeight(float a)\n{\nfloat z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nreturn pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n}\n",czm_antialias="vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\nfloat val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\nfloat val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\nval1 = val1 * (1.0 - val2);\nval1 = val1 * val1 * (3.0 - (2.0 * val1));\nval1 = pow(val1, 0.5);\nvec4 midColor = (color1 + color2) * 0.5;\nreturn mix(midColor, currentColor, val1);\n}\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\nreturn czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n",czm_approximateSphericalCoordinates="vec2 czm_approximateSphericalCoordinates(vec3 normal) {\nfloat latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\nfloat longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\nreturn vec2(latitudeApproximation, longitudeApproximation);\n}\n",czm_branchFreeTernary="float czm_branchFreeTernary(bool comparison, float a, float b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\nvec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {\nfloat useA = float(comparison);\nreturn a * useA + b * (1.0 - useA);\n}\n",czm_cascadeColor="vec4 czm_cascadeColor(vec4 weights)\n{\nreturn vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\nvec4(0.0, 1.0, 0.0, 1.0) * weights.y +\nvec4(0.0, 0.0, 1.0, 1.0) * weights.z +\nvec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n}\n",czm_cascadeDistance="uniform vec4 shadowMap_cascadeDistances;\nfloat czm_cascadeDistance(vec4 weights)\n{\nreturn dot(shadowMap_cascadeDistances, weights);\n}\n",czm_cascadeMatrix="uniform mat4 shadowMap_cascadeMatrices[4];\nmat4 czm_cascadeMatrix(vec4 weights)\n{\nreturn shadowMap_cascadeMatrices[0] * weights.x +\nshadowMap_cascadeMatrices[1] * weights.y +\nshadowMap_cascadeMatrices[2] * weights.z +\nshadowMap_cascadeMatrices[3] * weights.w;\n}\n",czm_cascadeWeights="uniform vec4 shadowMap_cascadeSplits[2];\nvec4 czm_cascadeWeights(float depthEye)\n{\nvec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\nvec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\nreturn near * far;\n}\n",czm_columbusViewMorph="vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\nvec3 p = mix(position2D.xyz, position3D.xyz, time);\nreturn vec4(p, 1.0);\n}\n",czm_computePosition="vec4 czm_computePosition();\n",czm_cosineAndSine="vec2 cordic(float angle)\n{\nvec2 vector = vec2(6.0725293500888267e-1, 0.0);\nfloat sense = (angle < 0.0) ? -1.0 : 1.0;\nmat2 rotation = mat2(1.0, sense, -sense, 1.0);\nvector = rotation * vector;\nangle -= sense * 7.8539816339744828e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfloat factor = sense * 5.0e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.6364760900080609e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.5e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4497866312686414e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.25e-1;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2435499454676144e-1;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.25e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.2418809995957350e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.125e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.1239833430268277e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.5625e-2;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5623728620476831e-2;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.8125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.8123410601011111e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.90625e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.9062301319669718e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.953125e-3;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9531225164788188e-3;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.765625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.7656218955931946e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.8828125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.8828121119489829e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.44140625e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.4414062014936177e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.220703125e-4;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.2207031189367021e-4;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 6.103515625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 6.1035156174208773e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.0517578125e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.0517578115526096e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.52587890625e-5;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.5258789061315762e-5;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 7.62939453125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 7.6293945311019700e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 3.814697265625e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 3.8146972656064961e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.9073486328125e-6;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 1.9073486328101870e-6;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 9.5367431640625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 9.5367431640596084e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 4.76837158203125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 4.7683715820308884e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 2.384185791015625e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nangle -= sense * 2.3841857910155797e-7;\nsense = (angle < 0.0) ? -1.0 : 1.0;\nfactor = sense * 1.1920928955078125e-7;\nrotation[0][1] = factor;\nrotation[1][0] = -factor;\nvector = rotation * vector;\nreturn vector;\n}\nvec2 czm_cosineAndSine(float angle)\n{\nif (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n{\nif (angle < 0.0)\n{\nreturn -cordic(angle + czm_pi);\n}\nelse\n{\nreturn -cordic(angle - czm_pi);\n}\n}\nelse\n{\nreturn cordic(angle);\n}\n}\n",czm_decompressTextureCoordinates="vec2 czm_decompressTextureCoordinates(float encoded)\n{\nfloat temp = encoded / 4096.0;\nfloat xZeroTo4095 = floor(temp);\nfloat stx = xZeroTo4095 / 4095.0;\nfloat sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\nreturn vec2(stx, sty);\n}\n",czm_depthClampFarPlane="#ifndef LOG_DEPTH\nvarying float v_WindowZ;\n#endif\nvec4 czm_depthClampFarPlane(vec4 coords)\n{\n#ifndef LOG_DEPTH\nv_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\ncoords.z = min(coords.z, coords.w);\n#endif\nreturn coords;\n}\n",czm_eastNorthUpToEyeCoordinates="mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\nvec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));\nvec3 tangentEC = normalize(czm_normal3D * tangentMC);\nvec3 bitangentEC = normalize(cross(normalEC, tangentEC));\nreturn mat3(\ntangentEC.x,   tangentEC.y,   tangentEC.z,\nbitangentEC.x, bitangentEC.y, bitangentEC.z,\nnormalEC.x,    normalEC.y,    normalEC.z);\n}\n",czm_ellipsoidContainsPoint="bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)\n{\nvec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\nreturn (dot(scaled, scaled) <= 1.0);\n}\n",czm_ellipsoidNew="czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)\n{\nvec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\nvec3 inverseRadiiSquared = inverseRadii * inverseRadii;\nczm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\nreturn temp;\n}\n",czm_ellipsoidWgs84TextureCoordinates="vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\nreturn vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n",czm_equalsEpsilon="bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\nreturn all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\nreturn (abs(left - right) <= epsilon);\n}\n",czm_eyeOffset="vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\nvec4 p = positionEC;\nvec4 zEyeOffset = normalize(p) * eyeOffset.z;\np.xy += eyeOffset.xy + zEyeOffset.xy;\np.z += zEyeOffset.z;\nreturn p;\n}\n",czm_eyeToWindowCoordinates="vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\nvec4 q = czm_projection * positionEC;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_fastApproximateAtan="float czm_fastApproximateAtan(float x) {\nreturn x * (-0.1784 * x - 0.0663 * x * x + 1.0301);\n}\nfloat czm_fastApproximateAtan(float x, float y) {\nfloat t = abs(x);\nfloat opposite = abs(y);\nfloat adjacent = max(t, opposite);\nopposite = min(t, opposite);\nt = czm_fastApproximateAtan(opposite / adjacent);\nt = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);\nt = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);\nt = czm_branchFreeTernary(y < 0.0, -t, t);\nreturn t;\n}\n",czm_fog="vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-(scalar * scalar));\nreturn mix(color, fogColor, fog);\n}\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n{\nfloat scalar = distanceToCamera * czm_fogDensity;\nfloat fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\nreturn mix(color, fogColor, fog);\n}\n",czm_gammaCorrect="vec3 czm_gammaCorrect(vec3 color) {\n#ifdef HDR\ncolor = pow(color, vec3(czm_gamma));\n#endif\nreturn color;\n}\nvec4 czm_gammaCorrect(vec4 color) {\n#ifdef HDR\ncolor.rgb = pow(color.rgb, vec3(czm_gamma));\n#endif\nreturn color;\n}\n",czm_geodeticSurfaceNormal="vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\nreturn normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n",czm_getDefaultMaterial="czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\nczm_material material;\nmaterial.diffuse = vec3(0.0);\nmaterial.specular = 0.0;\nmaterial.shininess = 1.0;\nmaterial.normal = materialInput.normalEC;\nmaterial.emission = vec3(0.0);\nmaterial.alpha = 1.0;\nreturn material;\n}\n",czm_getLambertDiffuse="float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\nreturn max(dot(lightDirectionEC, normalEC), 0.0);\n}\n",czm_getSpecular="float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\nvec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\nfloat specular = max(dot(toReflectedLight, toEyeEC), 0.0);\nreturn pow(specular, max(shininess, czm_epsilon2));\n}\n",czm_getWaterNoise="vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\nfloat cosAngle = cos(angleInRadians);\nfloat sinAngle = sin(angleInRadians);\nvec2 s0 = vec2(1.0/17.0, 0.0);\nvec2 s1 = vec2(-1.0/29.0, 0.0);\nvec2 s2 = vec2(1.0/101.0, 1.0/59.0);\nvec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\ns0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\ns1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\ns2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\ns3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\nvec2 uv0 = (uv/103.0) + (time * s0);\nvec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\nvec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\nvec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\nuv0 = fract(uv0);\nuv1 = fract(uv1);\nuv2 = fract(uv2);\nuv3 = fract(uv3);\nvec4 noise = (texture2D(normalMap, uv0)) +\n(texture2D(normalMap, uv1)) +\n(texture2D(normalMap, uv2)) +\n(texture2D(normalMap, uv3));\nreturn ((noise / 4.0) - 0.5) * 2.0;\n}\n",czm_getWgs84EllipsoidEC="czm_ellipsoid czm_getWgs84EllipsoidEC()\n{\nvec3 radii = vec3(6378137.0, 6378137.0, 6356752.314245);\nvec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\nvec3 inverseRadiiSquared = inverseRadii * inverseRadii;\nczm_ellipsoid temp = czm_ellipsoid(czm_view[3].xyz, radii, inverseRadii, inverseRadiiSquared);\nreturn temp;\n}\n",czm_HSBToRGB="const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 czm_HSBToRGB(vec3 hsb)\n{\nvec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\nreturn hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n}\n",czm_HSLToRGB="vec3 hueToRGB(float hue)\n{\nfloat r = abs(hue * 6.0 - 3.0) - 1.0;\nfloat g = 2.0 - abs(hue * 6.0 - 2.0);\nfloat b = 2.0 - abs(hue * 6.0 - 4.0);\nreturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 czm_HSLToRGB(vec3 hsl)\n{\nvec3 rgb = hueToRGB(hsl.x);\nfloat c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\nreturn (rgb - 0.5) * c + hsl.z;\n}\n",czm_hue="vec3 czm_hue(vec3 rgb, float adjustment)\n{\nconst mat3 toYIQ = mat3(0.299,     0.587,     0.114,\n0.595716, -0.274453, -0.321263,\n0.211456, -0.522591,  0.311135);\nconst mat3 toRGB = mat3(1.0,  0.9563,  0.6210,\n1.0, -0.2721, -0.6474,\n1.0, -1.107,   1.7046);\nvec3 yiq = toYIQ * rgb;\nfloat hue = atan(yiq.z, yiq.y) + adjustment;\nfloat chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\nvec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\nreturn toRGB * color;\n}\n",czm_inverseGamma="vec3 czm_inverseGamma(vec3 color) {\nreturn pow(color, vec3(1.0 / czm_gamma));\n}\n",czm_isEmpty="bool czm_isEmpty(czm_raySegment interval)\n{\nreturn (interval.stop < 0.0);\n}\n",czm_isFull="bool czm_isFull(czm_raySegment interval)\n{\nreturn (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n",czm_latitudeToWebMercatorFraction="float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n{\nfloat sinLatitude = sin(latitude);\nfloat mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\nreturn (mercatorY - southMercatorY) * oneOverMercatorHeight;\n}\n",czm_lineDistance="float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {\nreturn abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);\n}\n",czm_luminance="float czm_luminance(vec3 rgb)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nreturn dot(rgb, W);\n}\n",czm_metersPerPixel="float czm_metersPerPixel(vec4 positionEC, float pixelRatio)\n{\nfloat width = czm_viewport.z;\nfloat height = czm_viewport.w;\nfloat pixelWidth;\nfloat pixelHeight;\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nif (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n{\nfloat frustumWidth = right - left;\nfloat frustumHeight = top - bottom;\npixelWidth = frustumWidth / width;\npixelHeight = frustumHeight / height;\n}\nelse\n{\nfloat distanceToPixel = -positionEC.z;\nfloat inverseNear = 1.0 / czm_currentFrustum.x;\nfloat tanTheta = top * inverseNear;\npixelHeight = 2.0 * distanceToPixel * tanTheta / height;\ntanTheta = right * inverseNear;\npixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n}\nreturn max(pixelWidth, pixelHeight) * pixelRatio;\n}\nfloat czm_metersPerPixel(vec4 positionEC)\n{\nreturn czm_metersPerPixel(positionEC, czm_pixelRatio);\n}\n",czm_modelToWindowCoordinates="vec4 czm_modelToWindowCoordinates(vec4 position)\n{\nvec4 q = czm_modelViewProjection * position;\nq.xyz /= q.w;\nq.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;\nreturn q;\n}\n",czm_multiplyWithColorBalance="vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 target = left * right;\nfloat leftLuminance = dot(left, W);\nfloat rightLuminance = dot(right, W);\nfloat targetLuminance = dot(target, W);\nreturn ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n",czm_nearFarScalar="float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\nfloat valueAtMin = nearFarScalar.y;\nfloat valueAtMax = nearFarScalar.w;\nfloat nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\nfloat farDistanceSq = nearFarScalar.z * nearFarScalar.z;\nfloat t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\nt = pow(clamp(t, 0.0, 1.0), 0.2);\nreturn mix(valueAtMin, valueAtMax, t);\n}\n",czm_octDecode="vec3 czm_octDecode(vec2 encoded, float range)\n{\nif (encoded.x == 0.0 && encoded.y == 0.0) {\nreturn vec3(0.0, 0.0, 0.0);\n}\nencoded = encoded / range * 2.0 - 1.0;\nvec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\nif (v.z < 0.0)\n{\nv.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n}\nreturn normalize(v);\n}\nvec3 czm_octDecode(vec2 encoded)\n{\nreturn czm_octDecode(encoded, 255.0);\n}\nvec3 czm_octDecode(float encoded)\n{\nfloat temp = encoded / 256.0;\nfloat x = floor(temp);\nfloat y = (temp - x) * 256.0;\nreturn czm_octDecode(vec2(x, y));\n}\nvoid czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n{\nfloat temp = encoded.x / 65536.0;\nfloat x = floor(temp);\nfloat encodedFloat1 = (temp - x) * 65536.0;\ntemp = encoded.y / 65536.0;\nfloat y = floor(temp);\nfloat encodedFloat2 = (temp - y) * 65536.0;\nvector1 = czm_octDecode(encodedFloat1);\nvector2 = czm_octDecode(encodedFloat2);\nvector3 = czm_octDecode(vec2(x, y));\n}\n",czm_packDepth="vec4 czm_packDepth(float depth)\n{\nvec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\nenc = fract(enc);\nenc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\nreturn enc;\n}\n",czm_phong="float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\nreturn czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\nreturn czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\nvec4 czm_phong(vec3 toEye, czm_material material)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n}\nfloat specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + czm_private_getSpecularOfMaterial(czm_moonDirectionEC, toEye, material);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse;\ncolor += material.specular * specular;\n#ifdef HDR\nfloat sunDiffuse = czm_private_getLambertDiffuseOfMaterial(czm_sunDirectionEC, material);\ncolor += materialDiffuse * sunDiffuse * czm_sunColor;\n#endif\nreturn vec4(color, material.alpha);\n}\nvec4 czm_private_phong(vec3 toEye, czm_material material)\n{\nfloat diffuse = czm_private_getLambertDiffuseOfMaterial(czm_sunDirectionEC, material);\nfloat specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material);\nvec3 ambient = vec3(0.0);\nvec3 color = ambient + material.emission;\ncolor += material.diffuse * diffuse;\ncolor += material.specular * specular;\nreturn vec4(color, material.alpha);\n}\n",czm_planeDistance="float czm_planeDistance(vec4 plane, vec3 point) {\nreturn (dot(plane.xyz, point) + plane.w);\n}\nfloat czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {\nreturn (dot(planeNormal, point) + planeDistance);\n}\n",czm_pointAlongRay="vec3 czm_pointAlongRay(czm_ray ray, float time)\n{\nreturn ray.origin + (time * ray.direction);\n}\n",czm_rayEllipsoidIntersectionInterval="czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)\n{\nvec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\nvec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\nq = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;\nfloat q2 = dot(q, q);\nfloat qw = dot(q, w);\nif (q2 > 1.0)\n{\nif (qw >= 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nelse\n{\nfloat qw2 = qw * qw;\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nif (qw2 < product)\n{\nreturn czm_emptyRaySegment;\n}\nelse if (qw2 > product)\n{\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nfloat root0 = temp / w2;\nfloat root1 = difference / temp;\nif (root0 < root1)\n{\nczm_raySegment i = czm_raySegment(root0, root1);\nreturn i;\n}\nelse\n{\nczm_raySegment i = czm_raySegment(root1, root0);\nreturn i;\n}\n}\nelse\n{\nfloat root = sqrt(difference / w2);\nczm_raySegment i = czm_raySegment(root, root);\nreturn i;\n}\n}\n}\nelse if (q2 < 1.0)\n{\nfloat difference = q2 - 1.0;\nfloat w2 = dot(w, w);\nfloat product = w2 * difference;\nfloat discriminant = qw * qw - product;\nfloat temp = -qw + sqrt(discriminant);\nczm_raySegment i = czm_raySegment(0.0, temp / w2);\nreturn i;\n}\nelse\n{\nif (qw < 0.0)\n{\nfloat w2 = dot(w, w);\nczm_raySegment i = czm_raySegment(0.0, -qw / w2);\nreturn i;\n}\nelse\n{\nreturn czm_emptyRaySegment;\n}\n}\n}\n",czm_readDepth="float czm_readDepth(sampler2D depthTexture, vec2 texCoords)\n{\nreturn czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);\n}\n",czm_reverseLogDepth="float czm_reverseLogDepth(float logZ)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nlogZ = pow(2.0, logZ * czm_log2FarPlusOne) - 1.0;\nlogZ = far * (1.0 - near / logZ) / (far - near);\n#endif\nreturn logZ;\n}\n",czm_RGBToHSB="const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec3 czm_RGBToHSB(vec3 rgb)\n{\nvec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\nvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\nfloat d = q.x - min(q.w, q.y);\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n}\n",czm_RGBToHSL="vec3 RGBtoHCV(vec3 rgb)\n{\nvec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\nvec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\nfloat c = q.x - min(q.w, q.y);\nfloat h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\nreturn vec3(h, c, q.x);\n}\nvec3 czm_RGBToHSL(vec3 rgb)\n{\nvec3 hcv = RGBtoHCV(rgb);\nfloat l = hcv.z - hcv.y * 0.5;\nfloat s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\nreturn vec3(hcv.x, s, l);\n}\n",czm_RGBToXYZ="vec3 czm_RGBToXYZ(vec3 rgb)\n{\nconst mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n0.3576, 0.7152, 0.1192,\n0.1805, 0.0722, 0.9505);\nvec3 xyz = RGB2XYZ * rgb;\nvec3 Yxy;\nYxy.r = xyz.g;\nfloat temp = dot(vec3(1.0), xyz);\nYxy.gb = xyz.rg / temp;\nreturn Yxy;\n}\n",czm_sampleOctahedralProjection="vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)\n{\ndirection /= dot(vec3(1.0), abs(direction));\nvec2 rev = abs(direction.zx) - vec2(1.0);\nvec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,\ndirection.z < 0.0 ? rev.y : -rev.y);\nvec2 uv = direction.y < 0.0 ? neg : direction.xz;\nvec2 coord = 0.5 * uv + vec2(0.5);\nvec2 pixel = 1.0 / textureSize;\nif (lod > 0.0)\n{\nfloat scale = 1.0 / pow(2.0, lod);\nfloat offset = ((textureSize.y + 1.0) / textureSize.x);\ncoord.x *= offset;\ncoord *= scale;\ncoord.x += offset + pixel.x;\ncoord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;\n}\nelse\n{\ncoord.x *= (textureSize.y / textureSize.x);\n}\n#ifndef OES_texture_float_linear\nvec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;\nvec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;\nvec3 color3 = texture2D(projectedMap, coord + pixel).rgb;\nvec3 color4 = texture2D(projectedMap, coord).rgb;\nvec2 texturePosition = coord * textureSize;\nfloat fu = fract(texturePosition.x);\nfloat fv = fract(texturePosition.y);\nvec3 average1 = mix(color4, color2, fu);\nvec3 average2 = mix(color1, color3, fu);\nvec3 color = mix(average1, average2, fv);\n#else\nvec3 color = texture2D(projectedMap, coord).rgb;\n#endif\nreturn color;\n}\nvec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\nfloat currentLod = floor(lod + 0.5);\nfloat nextLod = min(currentLod + 1.0, maxLod);\nvec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\nvec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);\nreturn mix(colorNextLod, colorCurrentLod, nextLod - lod);\n}\n",czm_saturation="vec3 czm_saturation(vec3 rgb, float adjustment)\n{\nconst vec3 W = vec3(0.2125, 0.7154, 0.0721);\nvec3 intensity = vec3(dot(rgb, W));\nreturn mix(intensity, rgb, adjustment);\n}\n",czm_shadowDepthCompare="float czm_sampleShadowMap(samplerCube shadowMap, vec3 d)\n{\nreturn czm_unpackDepth(textureCube(shadowMap, d));\n}\nfloat czm_sampleShadowMap(sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\nreturn texture2D(shadowMap, uv).r;\n#else\nreturn czm_unpackDepth(texture2D(shadowMap, uv));\n#endif\n}\nfloat czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\nfloat czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\nreturn step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n",czm_shadowVisibility="float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n{\n#ifdef USE_NORMAL_SHADING\n#ifdef USE_NORMAL_SHADING_SMOOTH\nfloat strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n#else\nfloat strength = step(0.0, nDotL);\n#endif\nvisibility *= strength;\n#endif\nvisibility = max(visibility, darkness);\nreturn visibility;\n}\n#ifdef USE_CUBE_MAP_SHADOW\nfloat czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec3 uvw = shadowParameters.texCoords;\ndepth -= depthBias;\nfloat visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#else\nfloat czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n{\nfloat depthBias = shadowParameters.depthBias;\nfloat depth = shadowParameters.depth;\nfloat nDotL = shadowParameters.nDotL;\nfloat normalShadingSmooth = shadowParameters.normalShadingSmooth;\nfloat darkness = shadowParameters.darkness;\nvec2 uv = shadowParameters.texCoords;\ndepth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\nvec2 texelStepSize = shadowParameters.texelStepSize;\nfloat radius = 1.0;\nfloat dx0 = -texelStepSize.x * radius;\nfloat dy0 = -texelStepSize.y * radius;\nfloat dx1 = texelStepSize.x * radius;\nfloat dy1 = texelStepSize.y * radius;\nfloat visibility = (\nczm_shadowDepthCompare(shadowMap, uv, depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\nczm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n) * (1.0 / 9.0);\n#else\nfloat visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n#endif\nreturn czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#endif\n",czm_signNotZero="float czm_signNotZero(float value)\n{\nreturn value >= 0.0 ? 1.0 : -1.0;\n}\nvec2 czm_signNotZero(vec2 value)\n{\nreturn vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\nvec3 czm_signNotZero(vec3 value)\n{\nreturn vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\nvec4 czm_signNotZero(vec4 value)\n{\nreturn vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n",czm_sphericalHarmonics="vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])\n{\nconst float c1 = 0.429043;\nconst float c2 = 0.511664;\nconst float c3 = 0.743125;\nconst float c4 = 0.886227;\nconst float c5 = 0.247708;\nvec3 L00 = coefficients[0];\nvec3 L1_1 = coefficients[1];\nvec3 L10 = coefficients[2];\nvec3 L11 = coefficients[3];\nvec3 L2_2 = coefficients[4];\nvec3 L2_1 = coefficients[5];\nvec3 L20 = coefficients[6];\nvec3 L21 = coefficients[7];\nvec3 L22 = coefficients[8];\nfloat x = normal.x;\nfloat y = normal.y;\nfloat z = normal.z;\nreturn c1 * L22 * (x * x - y * y) + c3 * L20 * z * z + c4 * L00 - c5 * L20 +\n2.0 * c1 * (L2_2 * x * y + L21 * x * z + L2_1 * y * z) +\n2.0 * c2 * (L11 * x + L1_1 * y + L10 * z);\n}\n",czm_tangentToEyeSpaceMatrix="mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n{\nvec3 normal = normalize(normalEC);\nvec3 tangent = normalize(tangentEC);\nvec3 bitangent = normalize(bitangentEC);\nreturn mat3(tangent.x  , tangent.y  , tangent.z,\nbitangent.x, bitangent.y, bitangent.z,\nnormal.x   , normal.y   , normal.z);\n}\n",czm_transformPlane="vec4 czm_transformPlane(vec4 clippingPlane, mat4 transform) {\nvec3 transformedDirection = normalize((transform * vec4(clippingPlane.xyz, 0.0)).xyz);\nvec3 transformedPosition = (transform * vec4(clippingPlane.xyz * -clippingPlane.w, 1.0)).xyz;\nvec4 transformedPlane;\ntransformedPlane.xyz = transformedDirection;\ntransformedPlane.w = -dot(transformedDirection, transformedPosition);\nreturn transformedPlane;\n}\n",czm_translateRelativeToEye="vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\nvec3 highDifference = high - czm_encodedCameraPositionMCHigh;\nvec3 lowDifference = low - czm_encodedCameraPositionMCLow;\nreturn vec4(highDifference + lowDifference, 1.0);\n}\n",czm_translucentPhong="vec4 czm_translucentPhong(vec3 toEye, czm_material material)\n{\nfloat diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\nif (czm_sceneMode == czm_sceneMode3D) {\ndiffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n}\ndiffuse = clamp(diffuse, 0.0, 1.0);\nfloat specular = czm_getSpecular(czm_sunDirectionEC, toEye, material.normal, material.shininess);\nspecular += czm_getSpecular(czm_moonDirectionEC, toEye, material.normal, material.shininess);\nvec3 materialDiffuse = material.diffuse * 0.5;\nvec3 ambient = materialDiffuse;\nvec3 color = ambient + material.emission;\ncolor += materialDiffuse * diffuse;\ncolor += material.specular * specular;\nreturn vec4(color, material.alpha);\n}\n",czm_transpose="mat2 czm_transpose(mat2 matrix)\n{\nreturn mat2(\nmatrix[0][0], matrix[1][0],\nmatrix[0][1], matrix[1][1]);\n}\nmat3 czm_transpose(mat3 matrix)\n{\nreturn mat3(\nmatrix[0][0], matrix[1][0], matrix[2][0],\nmatrix[0][1], matrix[1][1], matrix[2][1],\nmatrix[0][2], matrix[1][2], matrix[2][2]);\n}\nmat4 czm_transpose(mat4 matrix)\n{\nreturn mat4(\nmatrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\nmatrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\nmatrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\nmatrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n",czm_unpackDepth="float czm_unpackDepth(vec4 packedDepth)\n{\nreturn dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n}\n",czm_unpackFloat="#define SHIFT_RIGHT_8 0.00390625 //1.0 / 256.0\n#define SHIFT_RIGHT_16 0.00001525878 //1.0 / 65536.0\n#define SHIFT_RIGHT_24 5.960464477539063e-8//1.0 / 16777216.0\n#define BIAS 38.0\nfloat czm_unpackFloat(vec4 packedFloat)\n{\npackedFloat *= 255.0;\nfloat temp = packedFloat.w / 2.0;\nfloat exponent = floor(temp);\nfloat sign = (temp - exponent) * 2.0;\nexponent = exponent - float(BIAS);\nsign = sign * 2.0 - 1.0;\nsign = -sign;\nfloat unpacked = sign * packedFloat.x * float(SHIFT_RIGHT_8);\nunpacked += sign * packedFloat.y * float(SHIFT_RIGHT_16);\nunpacked += sign * packedFloat.z * float(SHIFT_RIGHT_24);\nreturn unpacked * pow(10.0, exponent);\n}\n",czm_vertexLogDepth="#ifdef LOG_DEPTH\nvarying float v_logZ;\n#ifdef SHADOW_MAP\nvarying vec3 v_logPositionEC;\n#endif\n#endif\nvoid czm_updatePositionDepth() {\n#if defined(LOG_DEPTH) && !defined(DISABLE_GL_POSITION_LOG_DEPTH)\nvec3 logPositionEC = (czm_inverseProjection * gl_Position).xyz;\n#ifdef SHADOW_MAP\nv_logPositionEC = logPositionEC;\n#endif\n#ifdef ENABLE_GL_POSITION_LOG_DEPTH_AT_HEIGHT\nif (length(logPositionEC) < 2.0e6)\n{\nreturn;\n}\n#endif\ngl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_log2FarDistance - 1.0;\ngl_Position.z *= gl_Position.w;\n#endif\n}\nvoid czm_vertexLogDepth()\n{\n#ifdef LOG_DEPTH\nv_logZ = 1.0 + gl_Position.w;\nczm_updatePositionDepth();\n#endif\n}\nvoid czm_vertexLogDepth(vec4 clipCoords)\n{\n#ifdef LOG_DEPTH\nv_logZ = 1.0 + clipCoords.w;\nczm_updatePositionDepth();\n#endif\n}\n",czm_windowToEyeCoordinates="vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\nfloat x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\nfloat y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\nfloat z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\nvec4 q = vec4(x, y, z, 1.0);\nq /= fragmentCoordinate.w;\nif (!(czm_inverseProjection == mat4(0.0)))\n{\nq = czm_inverseProjection * q;\n}\nelse\n{\nfloat top = czm_frustumPlanes.x;\nfloat bottom = czm_frustumPlanes.y;\nfloat left = czm_frustumPlanes.z;\nfloat right = czm_frustumPlanes.w;\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nq.x = (q.x * (right - left) + left + right) * 0.5;\nq.y = (q.y * (top - bottom) + bottom + top) * 0.5;\nq.z = (q.z * (near - far) - near - far) * 0.5;\nq.w = 1.0;\n}\nreturn q;\n}\nvec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n{\n#ifdef LOG_DEPTH\nfloat near = czm_currentFrustum.x;\nfloat far = czm_currentFrustum.y;\nfloat unscaledDepth = pow(2.0, depthOrLogDepth * czm_log2FarPlusOne) - 1.0;\nvec4 windowCoord = vec4(fragmentCoordinateXY, far * (1.0 - near / unscaledDepth) / (far - near), 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\neyeCoordinate.w = 1.0 / unscaledDepth;\n#else\nvec4 windowCoord = vec4(fragmentCoordinateXY, depthOrLogDepth, 1.0);\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\n#endif\nreturn eyeCoordinate;\n}\n",czm_writeDepthClampedToFarPlane="#ifndef LOG_DEPTH\nvarying float v_WindowZ;\n#endif\nvoid czm_writeDepthClampedToFarPlane()\n{\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\ngl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n#endif\n}\n",czm_writeLogDepth="#ifdef LOG_DEPTH\nvarying float v_logZ;\n#endif\nvoid czm_writeLogDepth(float logZ)\n{\n#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE)\nfloat halfLogFarDistance = czm_log2FarDistance * 0.5;\nfloat depth = log2(logZ);\nif (depth < czm_log2NearDistance) {\ndiscard;\n}\ngl_FragDepthEXT = depth * halfLogFarDistance;\n#endif\n}\nvoid czm_writeLogDepth() {\n#ifdef LOG_DEPTH\nczm_writeLogDepth(v_logZ);\n#endif\n}\n",czm_XYZToRGB="vec3 czm_XYZToRGB(vec3 Yxy)\n{\nconst mat3 XYZ2RGB = mat3( 3.2405, -0.9693,  0.0556,\n-1.5371,  1.8760, -0.2040,\n-0.4985,  0.0416,  1.0572);\nvec3 xyz;\nxyz.r = Yxy.r * Yxy.g / Yxy.b;\nxyz.g = Yxy.r;\nxyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\nreturn XYZ2RGB * xyz;\n}\n",czm_fromCartesian="vec3 czm_fromCartesian(vec3 position) {\nvec3 wgs84OneOverRadii = vec3(0.0000001567855942887398, 0.0000001567855942887398, 0.0000001573130351105623);\nvec3 wgs84OneOverRadiiSquared = vec3(0.00000000000002458172257647332, 0.00000000000002458172257647332, 0.000000000000024747391015697002);\nfloat centerToleranceSquared = 0.1;\nvec3 p = czm_scaleToGeodeticSurface(position, wgs84OneOverRadii, wgs84OneOverRadiiSquared);\nvec3 n = czm_multiplyComponents(p,wgs84OneOverRadiiSquared);\nn = normalize(n);\nvec3 h = p - position;\nfloat longitude = atan(n.y, n.x);\nfloat latitude = asin(n.z);\nfloat dotNum = dot(h, position);\nfloat height = czm_magnitude(h);\nvec3 result;\nresult.x = longitude;\nresult.y = latitude;\nresult.z = height;\nreturn result;\n}\n",czm_getFloodRect="mat3 czm_getFloodRect(mat4 ypx,mat4 ypy,mat4 ypz,float minx,float miny,float minz,float maxx,float maxy,float maxz,int yp_max_index){\nfor(int i=0;i<=16;i++){\nmat3 xyxy =  czm_getIndexMat(i,ypx,ypy,ypz,yp_max_index);\nif(xyxy[0][0]!=0.0&&xyxy[0][1]!=0.0){\nif(xyxy[0][0]<minx){\nminx = xyxy[0][0];\n}\nif(xyxy[0][0]>maxx){\nmaxx = xyxy[0][0];\n}\nif(xyxy[0][1]<miny){\nminy = xyxy[0][1];\n}\nif(xyxy[0][1]>maxy){\nmaxy = xyxy[0][1];\n}\nif(xyxy[0][2]<minz){\nminz = xyxy[0][2];\n}\nif(xyxy[0][2]>maxz){\nmaxz = xyxy[0][2];\n}\n}\n}\nreturn mat3(minx-999.0,miny-999.0,minz-999.0,maxx+999.0,maxy+999.0,maxz+999.0,0.0,0.0,0.0);\n}\n",czm_getIndexMat="mat3 czm_getIndexMat(int index,mat4 ypx,mat4 ypy,mat4 ypz,int yp_max_index){\nvec3 val = czm_getMaxIndexVal (ypx,ypy,ypz,yp_max_index-1);\nif(index==0){\nreturn mat3(ypx[0][0],ypy[0][0],ypz[0][0],val.x,val.y,val.z,0.0,0.0,0.0);\n}\nif(index==1){\nreturn mat3(ypx[0][1],ypy[0][1],ypz[0][1], ypx[0][0],ypy[0][0],ypz[0][0],0.0,0.0,0.0);\n}\nif(index==2){\nreturn mat3(ypx[0][2],ypy[0][2],ypz[0][2], ypx[0][1],ypy[0][1],ypz[0][1],0.0,0.0,0.0);\n}\nif(index==3){\nreturn mat3(ypx[0][3],ypy[0][3],ypz[0][3], ypx[0][2],ypy[0][2],ypz[0][2],0.0,0.0,0.0);\n}\nif(index==4){\nreturn mat3(ypx[1][0],ypy[1][0],ypz[1][0], ypx[0][3],ypy[0][3],ypz[0][3],0.0,0.0,0.0);\n}\nif(index==5){\nreturn mat3(ypx[1][1],ypy[1][1],ypz[1][1], ypx[1][0],ypy[1][0],ypz[1][0],0.0,0.0,0.0);\n}\nif(index==6){\nreturn mat3(ypx[1][2],ypy[1][2],ypz[1][2], ypx[1][1],ypy[1][1],ypz[1][1],0.0,0.0,0.0);\n}\nif(index==7){\nreturn mat3(ypx[1][3],ypy[1][3],ypz[1][3], ypx[1][2],ypy[1][2],ypz[1][2],0.0,0.0,0.0);\n}\nif(index==8){\nreturn mat3(ypx[2][0],ypy[2][0],ypz[2][0], ypx[1][3],ypy[1][3],ypz[1][3],0.0,0.0,0.0);\n}\nif(index==9){\nreturn mat3(ypx[2][1],ypy[2][1],ypz[2][1], ypx[2][0],ypy[2][0],ypz[2][0],0.0,0.0,0.0);\n}\nif(index==10){\nreturn mat3(ypx[2][2],ypy[2][2],ypz[2][2], ypx[2][1],ypy[2][1],ypz[2][1],0.0,0.0,0.0);\n}\nif(index==11){\nreturn mat3(ypx[2][3],ypy[2][3],ypz[2][3], ypx[2][2],ypy[2][2],ypz[2][2],0.0,0.0,0.0);\n}\nif(index==12){\nreturn mat3(ypx[3][0],ypy[3][0],ypz[3][0], ypx[2][3],ypy[2][3],ypz[2][3],0.0,0.0,0.0);\n}\nif(index==13){\nreturn mat3(ypx[3][1],ypy[3][1],ypz[3][1], ypx[3][0],ypy[3][0],ypz[3][0],0.0,0.0,0.0);\n}\nif(index==14){\nreturn mat3(ypx[3][2],ypy[3][2],ypz[3][2], ypx[3][1],ypy[3][1],ypz[3][1],0.0,0.0,0.0);\n}\nif(index==15){\nreturn mat3(ypx[3][3],ypy[3][3],ypz[3][3], ypx[3][2],ypy[3][2],ypz[3][2],0.0,0.0,0.0);\n}\n}\n",czm_getMaxIndex="int czm_getMaxIndex(mat4 yp_mat_x){\nif(yp_mat_x[3][3]!=0.0){\nreturn 16;\n}\nif(yp_mat_x[3][2]!=0.0){\nreturn 15;\n}\nif(yp_mat_x[3][1]!=0.0){\nreturn 14;\n}\nif(yp_mat_x[3][0]!=0.0){\nreturn 15;\n}\nif(yp_mat_x[2][3]!=0.0){\nreturn 12;\n}\nif(yp_mat_x[2][2]!=0.0){\nreturn 11;\n}\nif(yp_mat_x[2][1]!=0.0){\nreturn 10;\n}\nif(yp_mat_x[2][0]!=0.0){\nreturn 9;\n}\nif(yp_mat_x[1][3]!=0.0){\nreturn 8;\n}\nif(yp_mat_x[1][2]!=0.0){\nreturn 7;\n}\nif(yp_mat_x[1][1]!=0.0){\nreturn 6;\n}\nif(yp_mat_x[1][0]!=0.0){\nreturn 5;\n}\nif(yp_mat_x[0][3]!=0.0){\nreturn 4;\n}\nif(yp_mat_x[0][2]!=0.0){\nreturn 3;\n}\nif(yp_mat_x[0][1]!=0.0){\nreturn 2;\n}\nif(yp_mat_x[0][0]!=0.0){\nreturn 1;\n}\n}\n",czm_getMaxIndexVal="vec3 czm_getMaxIndexVal(mat4 ypx,mat4 ypy,mat4 ypz,int yp_max_index){\nif(yp_max_index==0){\nreturn vec3(ypx[0][0],ypy[0][0],ypz[0][0]);\n}\nif(yp_max_index==1){\nreturn vec3(ypx[0][1],ypy[0][1],ypz[0][1]);\n}\nif(yp_max_index==2){\nreturn vec3(ypx[0][2],ypy[0][2],ypz[0][2]);\n}\nif(yp_max_index==3){\nreturn vec3(ypx[0][3],ypy[0][3],ypz[0][3]);\n}\nif(yp_max_index==4){\nreturn vec3(ypx[1][0],ypy[1][0],ypz[1][0]);\n}\nif(yp_max_index==5){\nreturn vec3(ypx[1][1],ypy[1][1],ypz[1][1]);\n}\nif(yp_max_index==6){\nreturn vec3(ypx[1][2],ypy[1][2],ypz[1][2]);\n}\nif(yp_max_index==7){\nreturn vec3(ypx[1][3],ypy[1][3],ypz[1][3]);\n}\nif(yp_max_index==8){\nreturn vec3(ypx[2][0],ypy[2][0],ypz[2][0]);\n}\nif(yp_max_index==9){\nreturn vec3(ypx[2][1],ypy[2][1],ypz[2][1]);\n}\nif(yp_max_index==10){\nreturn vec3(ypx[2][2],ypy[2][2],ypz[2][2]);\n}\nif(yp_max_index==11){\nreturn vec3(ypx[2][3],ypy[2][3],ypz[2][3]);\n}\nif(yp_max_index==12){\nreturn vec3(ypx[3][0],ypy[3][0],ypz[3][0]);\n}\nif(yp_max_index==13){\nreturn vec3(ypx[3][1],ypy[3][1],ypz[3][1]);\n}\nif(yp_max_index==14){\nreturn vec3(ypx[3][2],ypy[3][2],ypz[3][2]);\n}\nif(yp_max_index==15){\nreturn vec3(ypx[3][3],ypy[3][3],ypz[3][3]);\n}\n}\n",czm_isInEllipsoid="bool czm_isInEllipsoid (vec3 position,mat4 ypx,mat4 ypy,mat4 ypz,mat3 rect,int yp_max_index) {\nbool isIn = false;\nfloat px = position.x;\nfloat py = position.y;\nfloat pz = position.z;\nif(px>=rect[0][0] && py>=rect[0][1] && pz>=rect[0][2] && px<=rect[1][0] && py<=rect[1][1] && pz<=rect[1][2]){\nvec3 lonlat = czm_fromCartesian(position);\npx = lonlat.x;\npy = lonlat.y;\nfor(int i = 0;i <= 16; i++){\nvec3 currVal = czm_getMaxIndexVal(ypx,ypy,ypz,i);\nmat3 xyzxyz =  czm_getIndexMat(i,ypx,ypy,ypz,yp_max_index);\nvec3 pos1 = vec3(xyzxyz[0][0],xyzxyz[0][1],xyzxyz[0][2]);\nvec3 pos2 = vec3(xyzxyz[1][0],xyzxyz[1][1],xyzxyz[1][2]);\nvec3 llh1 = czm_fromCartesian(pos1);\nvec3 llh2 = czm_fromCartesian(pos2);\nfloat sx = llh1.x;\nfloat sy = llh1.y;\nfloat tx = llh2.x;\nfloat ty = llh2.y;\nif(sx!=0.0&&sy!=0.0&&tx!=0.0&&ty!=0.0){\nif((sx == px && sy == py) || (tx == px && ty == py)) {\nreturn true;\n}\nif((sy < py && ty >= py) || (sy >= py && ty < py)) {\nfloat x = sx + (py - sy) * (tx - sx) / (ty - sy);\nif(x == px) {\nreturn true;\n}\nif(x > px) {\nisIn = !isIn;\n}\n}\n}\n}\n}\nreturn isIn ? true : false;\n}\n",czm_isInObliq="bool czm_isInObliq(vec3 position,mat4 ypx,mat4 ypy,mat4 ypz,mat3 rect,int yp_max_index) {\nbool isIn = false;\nfloat px = position.x;\nfloat py = position.y;\nif(px>=rect[0][0]&&py>=rect[0][1]&&px<=rect[1][0]&&py<=rect[1][1]){\nfor(int i = 0;i <= 16; i++){\nvec3 currVal = czm_getMaxIndexVal(ypx,ypy,ypz,i);\nif(currVal.x!=0.0&&currVal.y!=0.0){\nmat3 xyxy =  czm_getIndexMat(i,ypx,ypy,ypz,yp_max_index);\nfloat sx = xyxy[0][0];\nfloat sy = xyxy[0][1];\nfloat tx = xyxy[1][0];\nfloat ty = xyxy[1][1];\nif(sx!=0.0&&sy!=0.0&&tx!=0.0&&ty!=0.0){\nif((sx == px && sy == py) || (tx == px && ty == py)) {\nreturn true;\n}\nif((sy < py && ty >= py) || (sy >= py && ty < py)) {\nfloat x = sx + (py - sy) * (tx - sx) / (ty - sy);\nif(x == px) {\nreturn true;\n}\nif(x > px) {\nisIn = !isIn;\n}\n}\n}\n}\n}\n}\nreturn isIn ? true : false;\n}\n",czm_magnitude="float czm_magnitude(vec3 cartesian3) {\nreturn sqrt(czm_magnitudeSquared(cartesian3));\n}\n",czm_magnitudeSquared="float czm_magnitudeSquared (vec3 cartesian4) {\nreturn cartesian4.x * cartesian4.x + cartesian4.y * cartesian4.y + cartesian4.z * cartesian4.z;\n}\n",czm_multiplyComponents="vec3 czm_multiplyComponents(vec3 left, vec3 right) {\nvec3 result;\nresult.x = left.x * right.x;\nresult.y = left.y * right.y;\nresult.z = left.z * right.z;\nreturn result;\n}\n",czm_scaleToGeodeticSurface="vec3 czm_scaleToGeodeticSurface(vec3 cartesian1, vec3 oneOverRadii, vec3 oneOverRadiiSquared) {\nfloat positionX = cartesian1.x;\nfloat positionY = cartesian1.y;\nfloat positionZ = cartesian1.z;\nfloat oneOverRadiiX = oneOverRadii.x;\nfloat oneOverRadiiY = oneOverRadii.y;\nfloat oneOverRadiiZ = oneOverRadii.z;\nfloat x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;\nfloat y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;\nfloat z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;\nfloat squaredNorm = x2 + y2 + z2;\nfloat ratio = sqrt(1.0 / squaredNorm);\nvec3 intersection = cartesian1*ratio;\nfloat oneOverRadiiSquaredX = oneOverRadiiSquared.x;\nfloat oneOverRadiiSquaredY = oneOverRadiiSquared.y;\nfloat oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\nvec3 gradient;\ngradient.x = intersection.x * oneOverRadiiSquaredX * 2.0;\ngradient.y = intersection.y * oneOverRadiiSquaredY * 2.0;\ngradient.z = intersection.z * oneOverRadiiSquaredZ * 2.0;\nfloat lambda = (1.0 - ratio) * czm_magnitude(cartesian1) / (0.5 * czm_magnitude(gradient));\nfloat correction = 0.0;\nfloat func;\nfloat denominator;\nfloat xMultiplier;\nfloat yMultiplier;\nfloat zMultiplier;\nfloat xMultiplier2;\nfloat yMultiplier2;\nfloat zMultiplier2;\nfloat xMultiplier3;\nfloat yMultiplier3;\nfloat zMultiplier3;\nfunc = 1.0;\nfor(int i=0;i<9;i++){\nif(abs(func) > 0.000000000001){\nlambda -= correction;\nxMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\nyMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\nzMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\nxMultiplier2 = xMultiplier * xMultiplier;\nyMultiplier2 = yMultiplier * yMultiplier;\nzMultiplier2 = zMultiplier * zMultiplier;\nxMultiplier3 = xMultiplier2 * xMultiplier;\nyMultiplier3 = yMultiplier2 * yMultiplier;\nzMultiplier3 = zMultiplier2 * zMultiplier;\nfunc = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\ndenominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;\nfloat derivative = -2.0 * denominator;\ncorrection = func / derivative;\n}else{\nbreak;\n}\n}\nvec3 result;\nresult.x = positionX * xMultiplier;\nresult.y = positionY * yMultiplier;\nresult.z = positionZ * zMultiplier;\nreturn result;\n}\n",CzmBuiltins={czm_degreesPerRadian:czm_degreesPerRadian,czm_depthRange:czm_depthRange,czm_ellipsoidInverseRadii:czm_ellipsoidInverseRadii,czm_ellipsoidRadii:czm_ellipsoidRadii,czm_epsilon1:czm_epsilon1,czm_epsilon2:czm_epsilon2,czm_epsilon3:czm_epsilon3,czm_epsilon4:czm_epsilon4,czm_epsilon5:czm_epsilon5,czm_epsilon6:czm_epsilon6,czm_epsilon7:czm_epsilon7,czm_infinity:czm_infinity,czm_oneOverPi:czm_oneOverPi,czm_oneOverTwoPi:czm_oneOverTwoPi,czm_passCesium3DTile:czm_passCesium3DTile,czm_passCesium3DTileClassification:czm_passCesium3DTileClassification,czm_passCesium3DTileClassificationIgnoreShow:czm_passCesium3DTileClassificationIgnoreShow,czm_passClassification:czm_passClassification,czm_passCompute:czm_passCompute,czm_passEnvironment:czm_passEnvironment,czm_passGlobe:czm_passGlobe,czm_passOpaque:czm_passOpaque,czm_passOverlay:czm_passOverlay,czm_passTerrainClassification:czm_passTerrainClassification,czm_passTranslucent:czm_passTranslucent,czm_pi:czm_pi,czm_piOverFour:czm_piOverFour,czm_piOverSix:czm_piOverSix,czm_piOverThree:czm_piOverThree,czm_piOverTwo:czm_piOverTwo,czm_radiansPerDegree:czm_radiansPerDegree,czm_sceneMode2D:czm_sceneMode2D,czm_sceneMode3D:czm_sceneMode3D,czm_sceneModeColumbusView:czm_sceneModeColumbusView,czm_sceneModeMorphing:czm_sceneModeMorphing,czm_solarRadius:czm_solarRadius,czm_threePiOver2:czm_threePiOver2,czm_twoPi:czm_twoPi,czm_webMercatorMaxLatitude:czm_webMercatorMaxLatitude,czm_depthRangeStruct:czm_depthRangeStruct,czm_ellipsoid:czm_ellipsoid,czm_material:czm_material,czm_materialInput:czm_materialInput,czm_ray:czm_ray,czm_raySegment:czm_raySegment,czm_shadowParameters:czm_shadowParameters,czm_stcParameters:czm_stcParameters,czm_acesTonemapping:czm_acesTonemapping,czm_alphaWeight:czm_alphaWeight,czm_antialias:czm_antialias,czm_approximateSphericalCoordinates:czm_approximateSphericalCoordinates,czm_branchFreeTernary:czm_branchFreeTernary,czm_cascadeColor:czm_cascadeColor,czm_cascadeDistance:czm_cascadeDistance,czm_cascadeMatrix:czm_cascadeMatrix,czm_cascadeWeights:czm_cascadeWeights,czm_columbusViewMorph:czm_columbusViewMorph,czm_computePosition:czm_computePosition,czm_cosineAndSine:czm_cosineAndSine,czm_decompressTextureCoordinates:czm_decompressTextureCoordinates,czm_depthClampFarPlane:czm_depthClampFarPlane,czm_eastNorthUpToEyeCoordinates:czm_eastNorthUpToEyeCoordinates,czm_ellipsoidContainsPoint:czm_ellipsoidContainsPoint,czm_ellipsoidNew:czm_ellipsoidNew,czm_ellipsoidWgs84TextureCoordinates:czm_ellipsoidWgs84TextureCoordinates,czm_equalsEpsilon:czm_equalsEpsilon,czm_eyeOffset:czm_eyeOffset,czm_eyeToWindowCoordinates:czm_eyeToWindowCoordinates,czm_fastApproximateAtan:czm_fastApproximateAtan,czm_fog:czm_fog,czm_gammaCorrect:czm_gammaCorrect,czm_geodeticSurfaceNormal:czm_geodeticSurfaceNormal,czm_getDefaultMaterial:czm_getDefaultMaterial,czm_getLambertDiffuse:czm_getLambertDiffuse,czm_getSpecular:czm_getSpecular,czm_getWaterNoise:czm_getWaterNoise,czm_getWgs84EllipsoidEC:czm_getWgs84EllipsoidEC,czm_HSBToRGB:czm_HSBToRGB,czm_HSLToRGB:czm_HSLToRGB,czm_hue:czm_hue,czm_inverseGamma:czm_inverseGamma,czm_isEmpty:czm_isEmpty,czm_isFull:czm_isFull,czm_latitudeToWebMercatorFraction:czm_latitudeToWebMercatorFraction,czm_lineDistance:czm_lineDistance,czm_luminance:czm_luminance,czm_metersPerPixel:czm_metersPerPixel,czm_modelToWindowCoordinates:czm_modelToWindowCoordinates,czm_multiplyWithColorBalance:czm_multiplyWithColorBalance,czm_nearFarScalar:czm_nearFarScalar,czm_octDecode:czm_octDecode,czm_packDepth:czm_packDepth,czm_phong:czm_phong,czm_planeDistance:czm_planeDistance,czm_pointAlongRay:czm_pointAlongRay,czm_rayEllipsoidIntersectionInterval:czm_rayEllipsoidIntersectionInterval,czm_readDepth:czm_readDepth,czm_reverseLogDepth:czm_reverseLogDepth,czm_RGBToHSB:czm_RGBToHSB,czm_RGBToHSL:czm_RGBToHSL,czm_RGBToXYZ:czm_RGBToXYZ,czm_sampleOctahedralProjection:czm_sampleOctahedralProjection,czm_saturation:czm_saturation,czm_shadowDepthCompare:czm_shadowDepthCompare,czm_shadowVisibility:czm_shadowVisibility,czm_signNotZero:czm_signNotZero,czm_sphericalHarmonics:czm_sphericalHarmonics,czm_tangentToEyeSpaceMatrix:czm_tangentToEyeSpaceMatrix,czm_transformPlane:czm_transformPlane,czm_translateRelativeToEye:czm_translateRelativeToEye,czm_translucentPhong:czm_translucentPhong,czm_transpose:czm_transpose,czm_unpackDepth:czm_unpackDepth,czm_unpackFloat:czm_unpackFloat,czm_vertexLogDepth:czm_vertexLogDepth,czm_windowToEyeCoordinates:czm_windowToEyeCoordinates,czm_writeDepthClampedToFarPlane:czm_writeDepthClampedToFarPlane,czm_writeLogDepth:czm_writeLogDepth,czm_XYZToRGB:czm_XYZToRGB,czm_fromCartesian:czm_fromCartesian,czm_getFloodRect:czm_getFloodRect,czm_getIndexMat:czm_getIndexMat,czm_getMaxIndex:czm_getMaxIndex,czm_getMaxIndexVal:czm_getMaxIndexVal,czm_isInEllipsoid:czm_isInEllipsoid,czm_isInObliq:czm_isInObliq,czm_magnitude:czm_magnitude,czm_magnitudeSquared:czm_magnitudeSquared,czm_multiplyComponents:czm_multiplyComponents,czm_scaleToGeodeticSurface:czm_scaleToGeodeticSurface};function removeComments(e){return(e=e.replace(/\/\/.*/g,"")).replace(/\/\*\*[\s\S]*?\*\//gm,function(e){for(var t=e.match(/\n/gm).length,i="",r=0;r<t;++r)i+="\n";return i})}function getDependencyNode(e,t,i){for(var r,n=0;n<i.length;++n)i[n].name===e&&(r=i[n]);return defined(r)||(r={name:e,glslSource:t=removeComments(t),dependsOn:[],requiredBy:[],evaluated:!1},i.push(r)),r}function generateDependencies(i,r){if(!i.evaluated){i.evaluated=!0;var n=i.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);defined(n)&&null!==n&&(n=n.filter(function(e,t){return n.indexOf(e)===t})).forEach(function(e){if(e!==i.name&&ShaderSource._czmBuiltinsAndUniforms.hasOwnProperty(e)){var t=getDependencyNode(e,ShaderSource._czmBuiltinsAndUniforms[e],r);i.dependsOn.push(t),t.requiredBy.push(i),generateDependencies(t,r)}})}}function sortDependencies(e){for(var t=[],i=[];0<e.length;){var r=e.pop();i.push(r),0===r.requiredBy.length&&t.push(r)}for(;0<t.length;){var n=t.shift();e.push(n);for(var a=0;a<n.dependsOn.length;++a){var o=n.dependsOn[a],s=o.requiredBy.indexOf(n);o.requiredBy.splice(s,1),0===o.requiredBy.length&&t.push(o)}}for(var l=0;l<i.length;++l)i[l].requiredBy.length}function getBuiltinsAndAutomaticUniforms(e){var t=[],i=getDependencyNode("main",e,t);generateDependencies(i,t),sortDependencies(t);for(var r="",n=t.length-1;0<=n;--n)r=r+t[n].glslSource+"\n";return r.replace(i.glslSource,"")}function combineShader(e,t,i){var r,n,a,o="",s=e.sources;if(defined(s))for(r=0,n=s.length;r<n;++r)o+="\n#line 0\n"+s[r];o=(o=removeComments(o)).replace(/#version\s+(.*?)\n/gm,function(e,t){return a=t,"\n"});var l=[];o=(o=o.replace(/#extension.*\n/gm,function(e){return l.push(e),"\n"})).replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");var c=e.pickColorQualifier;defined(c)&&(o=ShaderSource.createPickFragmentShaderSource(o,c));var u="";defined(a)&&(u="#version "+a+"\n");var d=l.length;for(r=0;r<d;r++)u+=l[r];t&&(u+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n    precision highp float;\n#else\n    precision mediump float;\n#endif\n\n");var h=e.defines;if(defined(h))for(r=0,n=h.length;r<n;++r){var p=h[r];0!==p.length&&(u+="#define "+p+"\n")}return i.webgl2&&(u+="#define OUTPUT_DECLARATION\n\n"),i.textureFloatLinear&&(u+="#define OES_texture_float_linear\n\n"),e.includeBuiltIns&&(u+=getBuiltinsAndAutomaticUniforms(o)),u+="\n#line 0\n",u+=o,i.webgl2&&(u=modernizeShader(u,t)),u}function ShaderSource(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).pickColorQualifier;this.defines=defined(e.defines)?e.defines.slice(0):[],this.sources=defined(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=defaultValue(e.includeBuiltIns,!0)}for(var builtinName in ShaderSource.prototype.clone=function(){return new ShaderSource({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})},ShaderSource.replaceMain=function(e,t){return t="void "+t+"()",e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)},ShaderSource.prototype.createCombinedVertexShader=function(e){return combineShader(this,!1,e)},ShaderSource.prototype.createCombinedFragmentShader=function(e){return combineShader(this,!0,e)},ShaderSource._czmBuiltinsAndUniforms={},CzmBuiltins)CzmBuiltins.hasOwnProperty(builtinName)&&(ShaderSource._czmBuiltinsAndUniforms[builtinName]=CzmBuiltins[builtinName]);for(var uniformName in AutomaticUniforms)if(AutomaticUniforms.hasOwnProperty(uniformName)){var uniform=AutomaticUniforms[uniformName];"function"==typeof uniform.getDeclaration&&(ShaderSource._czmBuiltinsAndUniforms[uniformName]=uniform.getDeclaration(uniformName))}ShaderSource.createPickVertexShaderSource=function(e){return ShaderSource.replaceMain(e,"czm_old_main")+"\nattribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n    czm_old_main(); \n    czm_pickColor = pickColor; \n}"},ShaderSource.createPickFragmentShaderSource=function(e,t){return ShaderSource.replaceMain(e,"czm_old_main")+"\n"+(t+" vec4 czm_pickColor; \nvoid main() \n{ \n    czm_old_main(); \n    if (gl_FragColor.a == 0.0) { \n       discard; \n    } \n    gl_FragColor = czm_pickColor; \n}")},ShaderSource.findVarying=function(e,t){for(var i=e.sources,r=t.length,n=0;n<r;++n)for(var a=t[n],o=i.length,s=0;s<o;++s)if(-1!==i[s].indexOf(a))return a};var normalVaryingNames=["v_normalEC","v_normal"];ShaderSource.findNormalVarying=function(e){return ShaderSource.findVarying(e,normalVaryingNames)};var positionVaryingNames=["v_positionEC"];ShaderSource.findPositionVarying=function(e){return ShaderSource.findVarying(e,positionVaryingNames)};var ShadowVolumeAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n#ifdef EXTRUDED_GEOMETRY\nattribute vec3 extrudeDirection;\nuniform float u_globeMinimumAltitude;\n#endif // EXTRUDED_GEOMETRY\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif // PER_INSTANCE_COLOR\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n#if defined(TEXTURE_COORDINATES) && !defined(SPHERICAL) && defined(UINT8_PACKING)\nvec4 clampAndMagnitude(vec4 sd)\n{\nvec4 d = sd;\nd.x = czm_branchFreeTernary(sd.x < 128.0, d.x, (255.0 - sd.x));\nd.x = floor(0.5 + d.x);\nd.y = floor(0.5 + d.y);\nd.z = floor(0.5 + d.z);\nd.w = floor(0.5 + d.w);\nreturn d;\n}\nfloat unpackLowLessThan100k(vec4 sd)\n{\nvec4 d = clampAndMagnitude(sd);\nreturn (1000.0 * d.x + 10.0 * d.y + 0.1 * d.z + 0.001 * d.w) * czm_branchFreeTernary(sd.x < 128.0, 1.0, -1.0);\n}\nvec3 southwest_LOW(vec4 x, vec4 y, vec4 z)\n{\nvec3 value;\nvalue.x = unpackLowLessThan100k(x);\nvalue.y = unpackLowLessThan100k(y);\nvalue.z = unpackLowLessThan100k(z);\nreturn value;\n}\nfloat unpackHighMagLessThan100Million(vec4 sd)\n{\nvec4 d = clampAndMagnitude(sd);\nreturn (1000000.0 * d.x + 10000.0 * d.y + 100.0 * d.z + d.w) * czm_branchFreeTernary(sd.x < 128.0, 1.0, -1.0);\n}\nvec3 southwest_HIGH(vec4 x, vec4 y, vec4 z)\n{\nvec3 value;\nvalue.x = unpackHighMagLessThan100Million(x);\nvalue.y = unpackHighMagLessThan100Million(y);\nvalue.z = unpackHighMagLessThan100Million(z);\nreturn value;\n}\n#ifdef COLUMBUS_VIEW_2D\nvec4 unpackPlanes2D_HIGH(vec4 x, vec4 y, vec4 z, vec4 w)\n{\nvec4 value;\nvalue.x = unpackHighMagLessThan100Million(x);\nvalue.y = unpackHighMagLessThan100Million(y);\nvalue.z = unpackHighMagLessThan100Million(z);\nvalue.w = unpackHighMagLessThan100Million(w);\nreturn value;\n}\nvec4 unpackPlanes2D_LOW(vec4 x, vec4 y, vec4 z, vec4 w)\n{\nvec4 value;\nvalue.x = unpackLowLessThan100k(x);\nvalue.y = unpackLowLessThan100k(y);\nvalue.z = unpackLowLessThan100k(z);\nvalue.w = unpackLowLessThan100k(w);\nreturn value;\n}\n#else\nfloat unpackLowLessThan1000k(vec4 sd)\n{\nvec4 d = clampAndMagnitude(sd);\nreturn (10000.0 * d.x + 100.0 * d.y + d.z + 0.01 * d.w) * czm_branchFreeTernary(sd.x < 128.0, 1.0, -1.0);\n}\nvec3 unpackExtent(vec4 x, vec4 y, vec4 z)\n{\nvec3 value;\nvalue.x = unpackLowLessThan1000k(x);\nvalue.y = unpackLowLessThan1000k(y);\nvalue.z = unpackLowLessThan1000k(z);\nreturn value;\n}\n#endif\n#endif\nvoid main()\n{\nvec4 position = czm_computePosition();\n#ifdef EXTRUDED_GEOMETRY\nfloat delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\ndelta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\nposition = position + vec4(extrudeDirection * delta, 0.0);\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nv_sphericalExtents = czm_batchTable_sphericalExtents(batchId);\nv_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);\n#else // SPHERICAL\n#ifdef COLUMBUS_VIEW_2D\n#ifdef UINT8_PACKING\nvec4 planes2D_high = unpackPlanes2D_HIGH(czm_batchTable_planes2D_HIGH_x(batchId),\nczm_batchTable_planes2D_HIGH_y(batchId),\nczm_batchTable_planes2D_HIGH_z(batchId),\nczm_batchTable_planes2D_HIGH_w(batchId));\nvec4 planes2D_low = unpackPlanes2D_LOW(czm_batchTable_planes2D_LOW_x(batchId),\nczm_batchTable_planes2D_LOW_y(batchId),\nczm_batchTable_planes2D_LOW_z(batchId),\nczm_batchTable_planes2D_LOW_w(batchId));\n#else // UINT8_PACKING\nvec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);\nvec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);\n#endif // UINT8_PACKING\nvec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));\nbool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;\nplanes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);\nplanes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);\nidlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;\nidlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));\nplanes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);\nplanes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;\nvec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;\nvec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;\n#else // COLUMBUS_VIEW_2D\n#ifdef UINT8_PACKING\nvec3 low = southwest_LOW(czm_batchTable_southWest_LOW_x(batchId), czm_batchTable_southWest_LOW_y(batchId), czm_batchTable_southWest_LOW_z(batchId));\nvec3 high = southwest_HIGH(czm_batchTable_southWest_HIGH_x(batchId), czm_batchTable_southWest_HIGH_y(batchId), czm_batchTable_southWest_HIGH_z(batchId));\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(high, low)).xyz;\nvec3 northWestCorner = czm_normal * unpackExtent(\nczm_batchTable_northward_x(batchId),\nczm_batchTable_northward_y(batchId),\nczm_batchTable_northward_z(batchId)) + southWestCorner;\nvec3 southEastCorner = czm_normal * unpackExtent(\nczm_batchTable_eastward_x(batchId),\nczm_batchTable_eastward_y(batchId),\nczm_batchTable_eastward_z(batchId)) + southWestCorner;\n#else // UINT8_PACKING\nvec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;\nvec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;\nvec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;\n#endif // UINT8_PACKING\n#endif // COLUMBUS_VIEW_2D\nvec3 eastWard = southEastCorner - southWestCorner;\nfloat eastExtent = length(eastWard);\neastWard /= eastExtent;\nvec3 northWard = northWestCorner - southWestCorner;\nfloat northExtent = length(northWard);\nnorthWard /= northExtent;\nv_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));\nv_southPlane = vec4(northWard, -dot(northWard, southWestCorner));\nv_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);\n#endif // SPHERICAL\nvec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);\nvec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);\nv_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);\nv_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);\nv_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif\ngl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n}\n",ShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvoid main(void)\n{\n#ifdef VECTOR_TILE\ngl_FragColor = czm_gammaCorrect(u_highlightColor);\n#else\ngl_FragColor = vec4(1.0);\n#endif\nczm_writeDepthClampedToFarPlane();\n}\n",ClassificationType={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2,NUMBER_OF_CLASSIFICATION_TYPES:3},ClassificationType$1=freezeObject$1(ClassificationType),DepthFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS},DepthFunction$1=freezeObject$1(DepthFunction),BufferUsage={STREAM_DRAW:WebGLConstants$1.STREAM_DRAW,STATIC_DRAW:WebGLConstants$1.STATIC_DRAW,DYNAMIC_DRAW:WebGLConstants$1.DYNAMIC_DRAW,validate:function(e){return e===BufferUsage.STREAM_DRAW||e===BufferUsage.STATIC_DRAW||e===BufferUsage.DYNAMIC_DRAW}},BufferUsage$1=freezeObject$1(BufferUsage);function Buffer$1(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl,i=e.bufferTarget,r=e.typedArray,n=e.sizeInBytes,a=e.usage,o=defined(r);o&&(n=r.byteLength);var s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,o?r:n,a),t.bindBuffer(i,null),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=i,this._sizeInBytes=n,this._usage=a,this._buffer=s,this.vertexArrayDestroyable=!0}function addAttribute(e,t,i,r){var n=defined(t.vertexBuffer),a=defined(t.value),o=t.value?t.value.length:t.componentsPerAttribute,s={index:defaultValue(t.index,i),enabled:defaultValue(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:a?t.value.slice(0):void 0,componentsPerAttribute:o,componentDatatype:defaultValue(t.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(t.normalize,!1),offsetInBytes:defaultValue(t.offsetInBytes,0),strideInBytes:defaultValue(t.strideInBytes,0),instanceDivisor:defaultValue(t.instanceDivisor,0)};if(n)s.vertexAttrib=function(e){var t=this.index;e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),e.vertexAttribPointer(t,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),e.enableVertexAttribArray(t),0<this.instanceDivisor&&(r.glVertexAttribDivisor(t,this.instanceDivisor),r._vertexAttribDivisors[t]=this.instanceDivisor,r._previousDrawInstanced=!0)},s.disableVertexAttribArray=function(e){e.disableVertexAttribArray(this.index),0<this.instanceDivisor&&r.glVertexAttribDivisor(i,0)};else{switch(s.componentsPerAttribute){case 1:s.vertexAttrib=function(e){e.vertexAttrib1fv(this.index,this.value)};break;case 2:s.vertexAttrib=function(e){e.vertexAttrib2fv(this.index,this.value)};break;case 3:s.vertexAttrib=function(e){e.vertexAttrib3fv(this.index,this.value)};break;case 4:s.vertexAttrib=function(e){e.vertexAttrib4fv(this.index,this.value)}}s.disableVertexAttribArray=function(e){}}e.push(s)}function bind(e,t,i){for(var r=0;r<t.length;++r){var n=t[r];n.enabled&&n.vertexAttrib(e)}defined(i)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i._getBuffer())}function VertexArray(e){var t,i,r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,n=r._gl,a=e.attributes,o=e.indexBuffer,s=[],l=1,c=!1,u=!1,d=a.length;for(t=0;t<d;++t)addAttribute(s,a[t],t,r);for(d=s.length,t=0;t<d;++t){var h=s[t];if(defined(h.vertexBuffer)&&0===h.instanceDivisor){var p=h.strideInBytes||h.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(h.componentDatatype);l=h.vertexBuffer.sizeInBytes/p;break}}for(t=0;t<d;++t)0<s[t].instanceDivisor&&(c=!0),defined(s[t].value)&&(u=!0);r.vertexArrayObject&&(i=r.glCreateVertexArray(),r.glBindVertexArray(i),bind(n,s,o),r.glBindVertexArray(null)),this._numberOfVertices=l,this._hasInstancedAttributes=c,this._hasConstantAttributes=u,this._context=r,this._gl=n,this._vao=i,this._attributes=s,this._indexBuffer=o}function computeNumberOfVertices(e){return e.values.length/e.componentsPerAttribute}function computeAttributeSizeInBytes(e){return ComponentDatatype$1.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function interleaveAttributes(i){var e,t,r,n,a=[];for(t in i)i.hasOwnProperty(t)&&defined(i[t])&&defined(i[t].values)&&(a.push(t),i[t].componentDatatype===ComponentDatatype$1.DOUBLE&&(i[t].componentDatatype=ComponentDatatype$1.FLOAT,i[t].values=ComponentDatatype$1.createTypedArray(ComponentDatatype$1.FLOAT,i[t].values)));var o=a.length;if(0<o)for(n=computeNumberOfVertices(i[a[0]]),e=1;e<o;++e){var s=computeNumberOfVertices(i[a[e]]);if(s!==n)throw new RuntimeError("Each attribute list must have the same number of vertices.  Attribute "+a[e]+" has a different number of vertices ("+s.toString()+") than attribute "+a[0]+" ("+n.toString()+").")}a.sort(function(e,t){return ComponentDatatype$1.getSizeInBytes(i[t].componentDatatype)-ComponentDatatype$1.getSizeInBytes(i[e].componentDatatype)});var l=0,c={};for(e=0;e<o;++e)t=a[e],r=i[t],c[t]=l,l+=computeAttributeSizeInBytes(r);if(0<l){var u=ComponentDatatype$1.getSizeInBytes(i[a[0]].componentDatatype),d=l%u;0!=d&&(l+=u-d);var h=new ArrayBuffer(n*l),p={};for(e=0;e<o;++e){t=a[e];var m=ComponentDatatype$1.getSizeInBytes(i[t].componentDatatype);p[t]={pointer:ComponentDatatype$1.createTypedArray(i[t].componentDatatype,h),index:c[t]/m,strideInComponentType:l/m}}for(e=0;e<n;++e)for(var f=0;f<o;++f){t=a[f];for(var g=(r=i[t]).values,_=p[t],y=_.pointer,v=r.componentsPerAttribute,C=0;C<v;++C)y[_.index+C]=g[e*v+C];_.index+=_.strideInComponentType}return{buffer:h,offsetsInBytes:c,vertexSizeInBytes:l}}}function setVertexAttribDivisor(e){var t=e._context,i=e._hasInstancedAttributes;if(i||t._previousDrawInstanced){t._previousDrawInstanced=i;var r,n=t._vertexAttribDivisors,a=e._attributes,o=ContextLimits.maximumVertexAttributes;if(i){var s=a.length;for(r=0;r<s;++r){var l=a[r];if(l.enabled){var c=l.instanceDivisor,u=l.index;c!==n[u]&&(t.glVertexAttribDivisor(u,c),n[u]=c)}}}else for(r=0;r<o;++r)0<n[r]&&(t.glVertexAttribDivisor(r,0),n[r]=0)}}function setConstantAttributes(e,t){for(var i=e._attributes,r=i.length,n=0;n<r;++n){var a=i[n];a.enabled&&defined(a.value)&&a.vertexAttrib(t)}}function BatchTable(e,t,i){if(this._attributes=t,this._numberOfInstances=i,0!==t.length){var r=getDatatype(t),n=e.floatingPointTexture,a=r===PixelDatatype$1.FLOAT&&!n,o=createOffsets(t,a),s=getStride(o,t,a),l=Math.floor(ContextLimits.maximumTextureSize/s),c=Math.min(i,l),u=s*c,d=Math.ceil(i/c),h=1/u,p=.5*h,m=1/d,f=.5*m;this._textureDimensions=new Cartesian2(u,d),this._textureStep=new Cartesian4(h,p,m,f),this._pixelDatatype=a?PixelDatatype$1.UNSIGNED_BYTE:r,this._packFloats=a,this._offsets=o,this._stride=s,this._texture=void 0;var g=4*u*d;this._batchValues=r!==PixelDatatype$1.FLOAT||a?new Uint8Array(g):new Float32Array(g),this._batchValuesDirty=!1}}function getDatatype(e){for(var t=!1,i=e.length,r=0;r<i;++r)if(e[r].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE){t=!0;break}return t?PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE}function getAttributeType(e,t){var i=e[t].componentsPerAttribute;return 2===i?Cartesian2:3===i?Cartesian3:4===i?Cartesian4:Number}function createOffsets(e,t){for(var i=new Array(e.length),r=0,n=e.length,a=0;a<n;++a){var o=e[a].componentDatatype;i[a]=r,o!==ComponentDatatype$1.UNSIGNED_BYTE&&t?r+=4:++r}return i}function getStride(e,t,i){var r=e.length,n=e[r-1];return t[r-1].componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE&&i?n+4:n+1}Buffer$1.createVertexBuffer=function(e){return new Buffer$1({context:e.context,bufferTarget:WebGLConstants$1.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})},Buffer$1.createIndexBuffer=function(e){var t=e.context,i=e.indexDatatype,r=IndexDatatype$1.getSizeInBytes(i),n=new Buffer$1({context:t,bufferTarget:WebGLConstants$1.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),a=n.sizeInBytes/r;return defineProperties$1(n,{indexDatatype:{get:function(){return i}},bytesPerIndex:{get:function(){return r}},numberOfIndices:{get:function(){return a}}}),n},defineProperties$1(Buffer$1.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),Buffer$1.prototype._getBuffer=function(){return this._buffer},Buffer$1.prototype.copyFromArrayView=function(e,t){t=defaultValue(t,0);var i=this._gl,r=this._bufferTarget;i.bindBuffer(r,this._buffer),i.bufferSubData(r,t,e),i.bindBuffer(r,null)},Buffer$1.prototype.copyFromBuffer=function(e,t,i,r){var n=WebGLConstants$1.COPY_READ_BUFFER,a=WebGLConstants$1.COPY_WRITE_BUFFER,o=this._gl;o.bindBuffer(a,this._buffer),o.bindBuffer(n,e._buffer),o.copyBufferSubData(n,a,t,i,r),o.bindBuffer(a,null),o.bindBuffer(n,null)},Buffer$1.prototype.getBufferData=function(e,t,i,r){t=defaultValue(t,0),i=defaultValue(i,0);var n=this._gl,a=WebGLConstants$1.COPY_READ_BUFFER;n.bindBuffer(a,this._buffer),n.getBufferSubData(a,t,e,i,r),n.bindBuffer(a,null)},Buffer$1.prototype.isDestroyed=function(){return!1},Buffer$1.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),destroyObject(this)},VertexArray.fromGeometry=function(e){var t,i,r,n,a=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context,o=defaultValue(e.geometry,defaultValue.EMPTY_OBJECT),s=defaultValue(e.bufferUsage,BufferUsage$1.DYNAMIC_DRAW),l=defaultValue(e.attributeLocations,defaultValue.EMPTY_OBJECT),c=defaultValue(e.interleave,!1),u=e.vertexArrayAttributes,d=defined(u)?u:[],h=o.attributes;if(c){var p=interleaveAttributes(h);if(defined(p)){r=Buffer$1.createVertexBuffer({context:a,typedArray:p.buffer,usage:s});var m=p.offsetsInBytes,f=p.vertexSizeInBytes;for(t in h)h.hasOwnProperty(t)&&defined(h[t])&&(defined((i=h[t]).values)?d.push({index:l[t],vertexBuffer:r,componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,offsetInBytes:m[t],strideInBytes:f}):d.push({index:l[t],value:i.value,componentDatatype:i.componentDatatype,normalize:i.normalize}))}}else for(t in h)if(h.hasOwnProperty(t)&&defined(h[t])){var g=(i=h[t]).componentDatatype;g===ComponentDatatype$1.DOUBLE&&(g=ComponentDatatype$1.FLOAT),r=void 0,defined(i.values)&&(r=Buffer$1.createVertexBuffer({context:a,typedArray:ComponentDatatype$1.createTypedArray(g,i.values),usage:s})),d.push({index:l[t],vertexBuffer:r,value:i.value,componentDatatype:g,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize})}var _=o.indices;return defined(_)&&(n=Geometry.computeNumberOfVertices(o)>=CesiumMath.SIXTY_FOUR_KILOBYTES&&a.elementIndexUint?Buffer$1.createIndexBuffer({context:a,typedArray:new Uint32Array(_),usage:s,indexDatatype:IndexDatatype$1.UNSIGNED_INT}):Buffer$1.createIndexBuffer({context:a,typedArray:new Uint16Array(_),usage:s,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})),new VertexArray({context:a,attributes:d,indexBuffer:n})},defineProperties$1(VertexArray.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}}),VertexArray.prototype.getAttribute=function(e){return this._attributes[e]},VertexArray.prototype._bind=function(){defined(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&setVertexAttribDivisor(this),this._hasConstantAttributes&&setConstantAttributes(this,this._gl)):bind(this._gl,this._attributes,this._indexBuffer)},VertexArray.prototype._unBind=function(){if(defined(this._vao))this._context.glBindVertexArray(null);else{for(var e=this._attributes,t=this._gl,i=0;i<e.length;++i){var r=e[i];r.enabled&&r.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}},VertexArray.prototype.isDestroyed=function(){return!1},VertexArray.prototype.destroy=function(){for(var e=this._attributes,t=0;t<e.length;++t){var i=e[t].vertexBuffer;defined(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}var r=this._indexBuffer;return defined(r)&&!r.isDestroyed()&&r.vertexArrayDestroyable&&r.destroy(),defined(this._vao)&&this._context.glDeleteVertexArray(this._vao),destroyObject(this)},defineProperties$1(BatchTable.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});var scratchPackedFloatCartesian4=new Cartesian4;function getPackedFloat(e,t,i){var r=Cartesian4.unpack(e,t,scratchPackedFloatCartesian4),n=Cartesian4.unpackFloat(r);r=Cartesian4.unpack(e,t+4,scratchPackedFloatCartesian4);var a=Cartesian4.unpackFloat(r);r=Cartesian4.unpack(e,t+8,scratchPackedFloatCartesian4);var o=Cartesian4.unpackFloat(r);r=Cartesian4.unpack(e,t+12,scratchPackedFloatCartesian4);var s=Cartesian4.unpackFloat(r);return Cartesian4.fromElements(n,a,o,s,i)}function setPackedAttribute(e,t,i){var r=Cartesian4.packFloat(e.x,scratchPackedFloatCartesian4);Cartesian4.pack(r,t,i),r=Cartesian4.packFloat(e.y,r),Cartesian4.pack(r,t,i+4),r=Cartesian4.packFloat(e.z,r),Cartesian4.pack(r,t,i+8),r=Cartesian4.packFloat(e.w,r),Cartesian4.pack(r,t,i+12)}var scratchGetAttributeCartesian4=new Cartesian4;BatchTable.prototype.getBatchedAttribute=function(e,t,i){var r,n=this._attributes,a=this._offsets[t],o=4*this._stride*e+4*a;r=this._packFloats&&n[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?getPackedFloat(this._batchValues,o,scratchGetAttributeCartesian4):Cartesian4.unpack(this._batchValues,o,scratchGetAttributeCartesian4);var s=getAttributeType(n,t);return defined(s.fromCartesian4)?s.fromCartesian4(r,i):defined(s.clone)?s.clone(r,i):r.x};var setAttributeScratchValues=[void 0,void 0,new Cartesian2,new Cartesian3,new Cartesian4],setAttributeScratchCartesian4=new Cartesian4;function createTexture(e,t){var i=e._textureDimensions;e._texture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:e._pixelDatatype,width:i.x,height:i.y,sampler:new Sampler({minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST}),flipY:!1})}function updateTexture(e){var t=e._textureDimensions;e._texture.copyFrom({width:t.x,height:t.y,arrayBufferView:e._batchValues})}function getGlslComputeSt(e){var t=e._stride;return 1===e._textureDimensions.y?"uniform vec4 batchTextureStep; \nvec2 computeSt(float batchId) \n{ \n    float stepX = batchTextureStep.x; \n    float centerX = batchTextureStep.y; \n    float numberOfAttributes = float("+t+"); \n    return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5); \n} \n":"uniform vec4 batchTextureStep; \nuniform vec2 batchTextureDimensions; \nvec2 computeSt(float batchId) \n{ \n    float stepX = batchTextureStep.x; \n    float centerX = batchTextureStep.y; \n    float stepY = batchTextureStep.z; \n    float centerY = batchTextureStep.w; \n    float numberOfAttributes = float("+t+"); \n    float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x); \n    float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x); \n    return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getComponentType(e){return 1===e?"float":"vec"+e}function getComponentSwizzle(e){return 1===e?".x":2===e?".xy":3===e?".xyz":""}function getGlslAttributeFunction(e,t){var i=e._attributes[t],r=i.componentsPerAttribute,n=i.functionName,a=getComponentType(r),o=getComponentSwizzle(r),s=a+" "+n+"(float batchId) \n{ \n    vec2 st = computeSt(batchId); \n    st.x += batchTextureStep.x * float("+e._offsets[t]+"); \n";return e._packFloats&&i.componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?s+="vec4 textureValue; \ntextureValue.x = czm_unpackFloat(texture2D(batchTexture, st)); \ntextureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \ntextureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \ntextureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n":s+="    vec4 textureValue = texture2D(batchTexture, st); \n",s+="    "+a+" value = textureValue"+o+"; \n",e._pixelDatatype!==PixelDatatype$1.UNSIGNED_BYTE||i.componentDatatype!==ComponentDatatype$1.UNSIGNED_BYTE||i.normalize?e._pixelDatatype===PixelDatatype$1.FLOAT&&i.componentDatatype===ComponentDatatype$1.UNSIGNED_BYTE&&i.normalize&&(s+="value /= 255.0; \n"):s+="value *= 255.0; \n",s+="    return value; \n} \n"}function transformToWorldCoordinates(e,t,i){var r,n=!i,a=e.length;if(!n&&1<a){var o=e[0].modelMatrix;for(r=1;r<a;++r)if(!Matrix4.equals(o,e[r].modelMatrix)){n=!0;break}}if(n)for(r=0;r<a;++r)defined(e[r].geometry)&&GeometryPipeline.transformToWorldCoordinates(e[r]);else Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}function addGeometryBatchId(e,t){var i=e.attributes,r=i.position,n=r.values.length/r.componentsPerAttribute;i.batchId=new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,values:new Float32Array(n)});for(var a=i.batchId.values,o=0;o<n;++o)a[o]=t}function addBatchIds(e){for(var t=e.length,i=0;i<t;++i){var r=e[i];defined(r.geometry)?addGeometryBatchId(r.geometry,i):defined(r.westHemisphereGeometry)&&defined(r.eastHemisphereGeometry)&&(addGeometryBatchId(r.westHemisphereGeometry,i),addGeometryBatchId(r.eastHemisphereGeometry,i))}}function geometryPipeline(e){var t,i,r=e.instances,n=e.projection,a=e.elementIndexUintSupported,o=e.scene3DOnly,s=e.vertexCacheOptimize,l=e.compressVertices,c=e.modelMatrix,u=r.length;for(t=0;t<u;++t)if(defined(r[t].geometry)){r[t].geometry.primitiveType;break}if(transformToWorldCoordinates(r,c,o),!o)for(t=0;t<u;++t)defined(r[t].geometry)&&GeometryPipeline.splitLongitude(r[t]);if(addBatchIds(r),s)for(t=0;t<u;++t){var d=r[t];defined(d.geometry)?(GeometryPipeline.reorderForPostVertexCache(d.geometry),GeometryPipeline.reorderForPreVertexCache(d.geometry)):defined(d.westHemisphereGeometry)&&defined(d.eastHemisphereGeometry)&&(GeometryPipeline.reorderForPostVertexCache(d.westHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(d.westHemisphereGeometry),GeometryPipeline.reorderForPostVertexCache(d.eastHemisphereGeometry),GeometryPipeline.reorderForPreVertexCache(d.eastHemisphereGeometry))}var h=GeometryPipeline.combineInstances(r);for(u=h.length,t=0;t<u;++t){var p,m=(i=h[t]).attributes;if(o)for(p in m)m.hasOwnProperty(p)&&m[p].componentDatatype===ComponentDatatype$1.DOUBLE&&GeometryPipeline.encodeAttribute(i,p,p+"3DHigh",p+"3DLow");else for(p in m)if(m.hasOwnProperty(p)&&m[p].componentDatatype===ComponentDatatype$1.DOUBLE){var f=p+"3D",g=p+"2D";GeometryPipeline.projectTo2D(i,p,f,g,n),defined(i.boundingSphere)&&"position"===p&&(i.boundingSphereCV=BoundingSphere.fromVertices(i.attributes.position2D.values)),GeometryPipeline.encodeAttribute(i,f,f+"High",f+"Low"),GeometryPipeline.encodeAttribute(i,g,g+"High",g+"Low")}l&&GeometryPipeline.compressVertices(i)}if(!a){var _=[];for(u=h.length,t=0;t<u;++t)i=h[t],_=_.concat(GeometryPipeline.fitToUnsignedShortIndices(i));h=_}return h}function createPickOffsets(e,t,i,r){var n,a,o,s=r.length-1;if(0<=s){var l=r[s];n=l.offset+l.count,a=i[o=l.index].indices.length}else a=i[o=n=0].indices.length;for(var c=e.length,u=0;u<c;++u){var d=e[u][t];if(defined(d)){var h=d.indices.length;a<n+h&&(n=0,a=i[++o].indices.length),r.push({index:o,offset:n,count:h}),n+=h}}}function createInstancePickOffsets(e,t){var i=[];return createPickOffsets(e,"geometry",t,i),createPickOffsets(e,"westHemisphereGeometry",t,i),createPickOffsets(e,"eastHemisphereGeometry",t,i),i}BatchTable.prototype.setBatchedAttribute=function(e,t,i){var r=this._attributes,n=setAttributeScratchValues[r[t].componentsPerAttribute],a=this.getBatchedAttribute(e,t,n),o=getAttributeType(this._attributes,t);if(!(defined(o.equals)?o.equals(a,i):a===i)){var s=setAttributeScratchCartesian4;s.x=defined(i.x)?i.x:i,s.y=defined(i.y)?i.y:0,s.z=defined(i.z)?i.z:0,s.w=defined(i.w)?i.w:0;var l=this._offsets[t],c=4*this._stride*e+4*l;this._packFloats&&r[t].componentDatatype!==PixelDatatype$1.UNSIGNED_BYTE?setPackedAttribute(s,this._batchValues,c):Cartesian4.pack(s,this._batchValues,c),this._batchValuesDirty=!0}},BatchTable.prototype.update=function(e){defined(this._texture)&&!this._batchValuesDirty||0===this._attributes.length||(this._batchValuesDirty=!1,defined(this._texture)||createTexture(this,e.context),updateTexture(this))},BatchTable.prototype.getUniformMapCallback=function(){var t=this;return function(e){return 0===t._attributes.length?e:combine(e,{batchTexture:function(){return t._texture},batchTextureDimensions:function(){return t._textureDimensions},batchTextureStep:function(){return t._textureStep}})}},BatchTable.prototype.getVertexShaderCallback=function(){var e=this._attributes;if(0===e.length)return function(e){return e};var n="uniform sampler2D batchTexture; \n";n+=getGlslComputeSt(this)+"\n";for(var t=e.length,i=0;i<t;++i)n+=getGlslAttributeFunction(this,i);return function(e){var t=e.indexOf("void main"),i=e.substring(0,t),r=e.substring(t);return i+"\n"+n+"\n"+r}},BatchTable.prototype.isDestroyed=function(){return!1},BatchTable.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};var PrimitivePipeline={};function transferGeometry(e,t){var i=e.attributes;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];defined(n)&&defined(n.values)&&t.push(n.values.buffer)}defined(e.indices)&&t.push(e.indices.buffer)}function transferGeometries(e,t){for(var i=e.length,r=0;r<i;++r)transferGeometry(e[r],t)}function countCreateGeometryResults(e){for(var t=1,i=e.length,r=0;r<i;r++){var n=e[r];if(++t,defined(n)){var a=n.attributes;for(var o in t+=7+2*BoundingSphere.packedLength+(defined(n.indices)?n.indices.length:0),a){if(a.hasOwnProperty(o)&&defined(a[o]))t+=5+a[o].values.length}}}return t}function packInstancesForCombine(e,t){var i=e.length,r=new Float64Array(1+19*i),n=0;r[n++]=i;for(var a=0;a<i;a++){var o=e[a];if(Matrix4.pack(o.modelMatrix,r,n),n+=Matrix4.packedLength,defined(o.attributes)&&defined(o.attributes.offset)){var s=o.attributes.offset.value;r[n]=s[0],r[n+1]=s[1],r[n+2]=s[2]}n+=3}return t.push(r.buffer),r}function unpackInstancesForCombine(e){for(var t=e,i=new Array(t[0]),r=0,n=1;n<t.length;){var a,o=Matrix4.unpack(t,n);defined(t[n+=Matrix4.packedLength])&&(a={offset:new OffsetGeometryInstanceAttribute(t[n],t[n+1],t[n+2])}),n+=3,i[r++]={modelMatrix:o,attributes:a}}return i}function packBoundingSpheres(e){var t=e.length,i=1+(BoundingSphere.packedLength+1)*t,r=new Float32Array(i),n=0;r[n++]=t;for(var a=0;a<t;++a){defined(e[a])?(r[n++]=1,BoundingSphere.pack(e[a],r,n)):r[n++]=0,n+=BoundingSphere.packedLength}return r}function unpackBoundingSpheres(e){for(var t=new Array(e[0]),i=0,r=1;r<e.length;)1===e[r++]&&(t[i]=BoundingSphere.unpack(e,r)),++i,r+=BoundingSphere.packedLength;return t}PrimitivePipeline.combineGeometry=function(e){var t,i,r,n,a=e.instances,o=a.length,s=!1;0<o&&(0<(t=geometryPipeline(e)).length&&(i=GeometryPipeline.createAttributeLocations(t[0]),e.createPickOffsets&&(r=createInstancePickOffsets(a,t))),defined(a[0].attributes)&&defined(a[0].attributes.offset)&&(n=new Array(o),s=!0));for(var l=new Array(o),c=new Array(o),u=0;u<o;++u){var d=a[u],h=d.geometry;defined(h)&&(l[u]=h.boundingSphere,c[u]=h.boundingSphereCV,s&&(n[u]=d.geometry.offsetAttribute));var p=d.eastHemisphereGeometry,m=d.westHemisphereGeometry;defined(p)&&defined(m)&&(defined(p.boundingSphere)&&defined(m.boundingSphere)&&(l[u]=BoundingSphere.union(p.boundingSphere,m.boundingSphere)),defined(p.boundingSphereCV)&&defined(m.boundingSphereCV)&&(c[u]=BoundingSphere.union(p.boundingSphereCV,m.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:i,pickOffsets:r,offsetInstanceExtend:n,boundingSpheres:l,boundingSpheresCV:c}},PrimitivePipeline.packCreateGeometryResults=function(e,t){var i=new Float64Array(countCreateGeometryResults(e)),r=[],n={},a=e.length,o=0;i[o++]=a;for(var s=0;s<a;s++){var l=e[s],c=defined(l);if(i[o++]=c?1:0,c){i[o++]=l.primitiveType,i[o++]=l.geometryType,i[o++]=defaultValue(l.offsetAttribute,-1);var u=defined(l.boundingSphere)?1:0;(i[o++]=u)&&BoundingSphere.pack(l.boundingSphere,i,o),o+=BoundingSphere.packedLength;var d=defined(l.boundingSphereCV)?1:0;(i[o++]=d)&&BoundingSphere.pack(l.boundingSphereCV,i,o),o+=BoundingSphere.packedLength;var h=l.attributes,p=[];for(var m in h)h.hasOwnProperty(m)&&defined(h[m])&&(p.push(m),defined(n[m])||(n[m]=r.length,r.push(m)));i[o++]=p.length;for(var f=0;f<p.length;f++){var g=p[f],_=h[g];i[o++]=n[g],i[o++]=_.componentDatatype,i[o++]=_.componentsPerAttribute,i[o++]=_.normalize?1:0,i[o++]=_.values.length,i.set(_.values,o),o+=_.values.length}var y=defined(l.indices)?l.indices.length:0;0<(i[o++]=y)&&(i.set(l.indices,o),o+=y)}}return t.push(i.buffer),{stringTable:r,packedData:i}},PrimitivePipeline.unpackCreateGeometryResults=function(e){for(var t,i=e.stringTable,r=e.packedData,n=new Array(r[0]),a=0,o=1;o<r.length;){if(1===r[o++]){var s,l,c,u,d,h=r[o++],p=r[o++],m=r[o++];-1===m&&(m=void 0),1===r[o++]&&(s=BoundingSphere.unpack(r,o)),o+=BoundingSphere.packedLength,1===r[o++]&&(l=BoundingSphere.unpack(r,o)),o+=BoundingSphere.packedLength;var f,g=new GeometryAttributes,_=r[o++];for(t=0;t<_;t++){var y=i[r[o++]],v=r[o++];d=r[o++];var C=0!==r[o++];c=r[o++],u=ComponentDatatype$1.createTypedArray(v,c);for(var S=0;S<c;S++)u[S]=r[o++];g[y]=new GeometryAttribute({componentDatatype:v,componentsPerAttribute:d,normalize:C,values:u})}if(0<(c=r[o++])){var x=u.length/d;for(f=IndexDatatype$1.createTypedArray(x,c),t=0;t<c;t++)f[t]=r[o++]}n[a++]=new Geometry({primitiveType:h,geometryType:p,boundingSphere:s,boundingSphereCV:l,indices:f,attributes:g,offsetAttribute:m})}else n[a++]=void 0}return n},PrimitivePipeline.packCombineGeometryParameters=function(e,t){for(var i=e.createGeometryResults,r=i.length,n=0;n<r;n++)t.push(i[n].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:packInstancesForCombine(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof GeographicProjection,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}},PrimitivePipeline.unpackCombineGeometryParameters=function(e){for(var t=unpackInstancesForCombine(e.packedInstances),i=e.createGeometryResults,r=i.length,n=0,a=0;a<r;a++)for(var o=PrimitivePipeline.unpackCreateGeometryResults(i[a]),s=o.length,l=0;l<s;l++){var c=o[l];t[n].geometry=c,++n}var u=Ellipsoid.clone(e.ellipsoid);return{instances:t,ellipsoid:u,projection:e.isGeographic?new GeographicProjection(u):new WebMercatorProjection(u),elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:Matrix4.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}},PrimitivePipeline.packCombineGeometryResults=function(e,t){defined(e.geometries)&&transferGeometries(e.geometries,t);var i=packBoundingSpheres(e.boundingSpheres),r=packBoundingSpheres(e.boundingSpheresCV);return t.push(i.buffer,r.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:i,boundingSpheresCV:r}},PrimitivePipeline.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:unpackBoundingSpheres(e.boundingSpheres),boundingSpheresCV:unpackBoundingSpheres(e.boundingSpheresCV)}};var PrimitiveState={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},PrimitiveState$1=freezeObject$1(PrimitiveState),SceneMode={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3,getMorphTime:function(e){return e===SceneMode.SCENE3D?1:e!==SceneMode.MORPHING?0:void 0}},SceneMode$1=freezeObject$1(SceneMode),ShadowMode={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3,NUMBER_OF_SHADOW_MODES:4,castShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.CAST_ONLY},receiveShadows:function(e){return e===ShadowMode.ENABLED||e===ShadowMode.RECEIVE_ONLY},fromCastReceive:function(e,t){return e&&t?ShadowMode.ENABLED:e?ShadowMode.CAST_ONLY:t?ShadowMode.RECEIVE_ONLY:ShadowMode.DISABLED}},ShadowMode$1=freezeObject$1(ShadowMode);function Primitive(e){e=defaultValue(e,defaultValue.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=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this._vertexCacheOptimize=defaultValue(e.vertexCacheOptimize,!1),this._interleave=defaultValue(e.interleave,!1),this._releaseGeometryInstances=defaultValue(e.releaseGeometryInstances,!0),this._allowPicking=defaultValue(e.allowPicking,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this._compressVertices=defaultValue(e.compressVertices,!0),this.cull=defaultValue(e.cull,!0),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,this.shadows=defaultValue(e.shadows,ShadowMode$1.DISABLED),this._translucent=void 0,this._state=PrimitiveState$1.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=[],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._readOnlyInstanceAttributes=e._readOnlyInstanceAttributes,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._readyPromise=when.defer(),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}function getCommonPerInstanceAttributeNames(e){var t,i=e.length,r=[],n=e[0].attributes;for(t in n)if(n.hasOwnProperty(t)&&defined(n[t])){for(var a=n[t],o=!0,s=1;s<i;++s){var l=e[s].attributes[t];if(!defined(l)||a.componentDatatype!==l.componentDatatype||a.componentsPerAttribute!==l.componentsPerAttribute||a.normalize!==l.normalize){o=!1;break}}o&&r.push(t)}return r}defineProperties$1(Primitive.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}},readyPromise:{get:function(){return this._readyPromise.promise}}});var scratchGetAttributeCartesian2=new Cartesian2,scratchGetAttributeCartesian3=new Cartesian3,scratchGetAttributeCartesian4$1=new Cartesian4;function getAttributeValue(e){var t=e.length;return 1===t?e[0]:2===t?Cartesian2.unpack(e,0,scratchGetAttributeCartesian2):3===t?Cartesian3.unpack(e,0,scratchGetAttributeCartesian3):4===t?Cartesian4.unpack(e,0,scratchGetAttributeCartesian4$1):void 0}function createBatchTable(e,t){var i=e.geometryInstances,r=isArray$1(i)?i:[i],n=r.length;if(0!==n){var a,o,s,l,c=getCommonPerInstanceAttributeNames(r),u=c.length,d=[],h={},p={},m=r[0].attributes;for(o=0;o<u;++o)l=m[s=c[o]],h[s]=o,d.push({functionName:"czm_batchTable_"+s,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize});-1!==c.indexOf("distanceDisplayCondition")&&(d.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1}),p.center3DHigh=d.length-5,p.center3DLow=d.length-4,p.center2DHigh=d.length-3,p.center2DLow=d.length-2,p.radius=d.length-1),-1!==c.indexOf("offset")&&(d.push({functionName:"czm_batchTable_offset2D",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3}),a=d.length-1),d.push({functionName:"czm_batchTable_pickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});var f=d.length,g=new BatchTable(t,d,n);for(o=0;o<n;++o){var _=r[o];m=_.attributes;for(var y=0;y<u;++y){var v=getAttributeValue((l=m[s=c[y]]).value),C=h[s];g.setBatchedAttribute(o,C,v)}var S={primitive:defaultValue(_.pickPrimitive,e)};defined(_.id)&&(S.id=_.id);var x=t.createPickId(S);e._pickIds.push(x);var T=x.color,b=scratchGetAttributeCartesian4$1;b.x=Color.floatToByte(T.red),b.y=Color.floatToByte(T.green),b.z=Color.floatToByte(T.blue),b.w=Color.floatToByte(T.alpha),g.setBatchedAttribute(o,f-1,b)}e._batchTable=g,e._batchTableAttributeIndices=h,e._batchTableBoundingSphereAttributeIndices=p,e._batchTableOffsetAttribute2DIndex=a}}function cloneAttribute(e){var t;return t=isArray$1(e.values)?e.values.slice(0):new e.values.constructor(e.values),new GeometryAttribute({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function cloneGeometry(e){var t,i=e.attributes,r=new GeometryAttributes;for(var n in i)i.hasOwnProperty(n)&&defined(i[n])&&(r[n]=cloneAttribute(i[n]));if(defined(e.indices)){var a=e.indices;t=isArray$1(a)?a.slice(0):new a.constructor(a)}return new Geometry({attributes:r,indices:t,primitiveType:e.primitiveType,boundingSphere:BoundingSphere.clone(e.boundingSphere)})}function cloneInstance(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:Matrix4.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}var positionRegex=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;function appendPickToVertexShader(e){return ShaderSource.replaceMain(e,"czm_non_pick_main")+"\nvarying vec4 v_pickColor; \nvoid main() \n{ \n    czm_non_pick_main(); \n    v_pickColor = czm_batchTable_pickColor(batchId); \n}"}function appendPickToFragmentShader(e){return"varying vec4 v_pickColor;\n"+e}function modifyForEncodedNormals(e,t){if(!e.compressVertices)return t;var i=-1!==t.search(/attribute\s+vec3\s+normal;/g),r=-1!==t.search(/attribute\s+vec2\s+st;/g);if(!i&&!r)return t;var n=-1!==t.search(/attribute\s+vec3\s+tangent;/g),a=-1!==t.search(/attribute\s+vec3\s+bitangent;/g),o=r&&i?2:1,s="compressedAttributes",l="attribute "+(1<(o+=n||a?1:0)?"vec"+o:"float")+" "+s+";",c="",u="";r&&(c+="vec2 st;\n",u+="    st = czm_decompressTextureCoordinates("+(1<o?s+".x":s)+");\n");i&&n&&a?(c+="vec3 normal;\nvec3 tangent;\nvec3 bitangent;\n",u+="    czm_octDecode("+s+"."+(r?"yz":"xy")+", normal, tangent, bitangent);\n"):(i&&(c+="vec3 normal;\n",u+="    normal = czm_octDecode("+s+(1<o?"."+(r?"y":"x"):"")+");\n"),n&&(c+="vec3 tangent;\n",u+="    tangent = czm_octDecode("+s+"."+(r&&i?"z":"y")+");\n"),a&&(c+="vec3 bitangent;\n",u+="    bitangent = czm_octDecode("+s+"."+(r&&i?"z":"y")+");\n"));var d=t;return d=(d=(d=(d=d.replace(/attribute\s+vec3\s+normal;/g,"")).replace(/attribute\s+vec2\s+st;/g,"")).replace(/attribute\s+vec3\s+tangent;/g,"")).replace(/attribute\s+vec3\s+bitangent;/g,""),[l,c,d=ShaderSource.replaceMain(d,"czm_non_compressed_main"),"void main() \n{ \n"+u+"    czm_non_compressed_main(); \n}"].join("\n")}function depthClampVS(e){var t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t+="varying float v_WindowZ;\nvoid main() {\n    czm_non_depth_clamp_main();\n    vec4 position = gl_Position;\n    v_WindowZ = (0.5 * (position.z / position.w) + 0.5) * position.w;\n    position.z = min(position.z, position.w);\n    gl_Position = position;\n}\n"}function depthClampFS(e){var t=ShaderSource.replaceMain(e,"czm_non_depth_clamp_main");return t="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n"+(t+="varying float v_WindowZ;\nvoid main() {\n    czm_non_depth_clamp_main();\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n    gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n#endif\n}\n")}function validateShaderMatching(e,t){e.vertexAttributes}function getUniformFunction(e,t){return function(){return e[t]}}Primitive._modifyShaderPosition=function(e,t,i){for(var r,n="",a="",o="";null!==(r=positionRegex.exec(t));){var s=r[1],l="vec4 czm_compute"+s[0].toUpperCase()+s.substr(1)+"()";"vec4 czm_computePosition()"!=l&&(n+=l+";\n"),defined(e.rtcCenter)?(n+="uniform mat4 u_modifiedModelView;\n",a+="attribute vec4 position;\n",o+=l+"\n{\n    return u_modifiedModelView * position;\n}\n\n",t=(t=(t=(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,"")).replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,"")).replace(/czm_modelViewRelativeToEye\s+\*\s+/g,"")).replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):i?o+=l+"\n{\n    return czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n}\n\n":(a+="attribute vec3 "+s+"2DHigh;\nattribute vec3 "+s+"2DLow;\n",o+=l+"\n{\n    vec4 p;\n    if (czm_morphTime == 1.0)\n    {\n        p = czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow);\n    }\n    else if (czm_morphTime == 0.0)\n    {\n        p = czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy);\n    }\n    else\n    {\n        p = czm_columbusViewMorph(\n                czm_translateRelativeToEye("+s+"2DHigh.zxy, "+s+"2DLow.zxy),\n                czm_translateRelativeToEye("+s+"3DHigh, "+s+"3DLow),\n                czm_morphTime);\n    }\n    return p;\n}\n\n")}return[n,a,t,o].join("\n")},Primitive._appendShowToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.show))return t;return ShaderSource.replaceMain(t,"czm_non_show_main")+"\nvoid main() \n{ \n    czm_non_show_main(); \n    gl_Position *= czm_batchTable_show(batchId); \n}"},Primitive._updateColorAttribute=function(e,t,i){if(!defined(e._batchTableAttributeIndices.color)&&!defined(e._batchTableAttributeIndices.depthFailColor))return t;if(-1===t.search(/attribute\s+vec4\s+color;/g))return t;var r=t;return r=r.replace(/attribute\s+vec4\s+color;/g,""),r=i?r.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):r.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2")},Primitive._updatePickColorAttribute=function(e){var t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2")},Primitive._appendOffsetToShader=function(e,t){if(!defined(e._batchTableAttributeIndices.offset))return t;var i=t.replace(/attribute\s+float\s+batchId;/g,"attribute float batchId;\nattribute float applyOffset;");return"    if (czm_sceneMode == czm_sceneMode3D)\n","    {\n","        $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);","    }\n","    else\n","    {\n","        $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);","    }\n",i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,"vec4 $1 = czm_computePosition();\n    if (czm_sceneMode == czm_sceneMode3D)\n    {\n        $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);    }\n    else\n    {\n        $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);    }\n")},Primitive._appendDistanceDisplayConditionToShader=function(e,t,i){if(!defined(e._batchTableAttributeIndices.distanceDisplayCondition))return t;var r="void main() \n{ \n    czm_non_distanceDisplayCondition_main(); \n    vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);\n    vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);\n    vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);\n    float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);\n";return r+=i?"    vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n":"    vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);\n    vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);\n    vec4 centerRTE;\n    if (czm_morphTime == 1.0)\n    {\n        centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n    }\n    else if (czm_morphTime == 0.0)\n    {\n        centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);\n    }\n    else\n    {\n        centerRTE = czm_columbusViewMorph(\n                czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),\n                czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),\n                czm_morphTime);\n    }\n",ShaderSource.replaceMain(t,"czm_non_distanceDisplayCondition_main")+"\n"+(r+="    float radiusSq = boundingSphereRadius * boundingSphereRadius; \n    float distanceSq; \n    if (czm_sceneMode == czm_sceneMode2D) \n    { \n        distanceSq = czm_eyeHeight2D.y - radiusSq; \n    } \n    else \n    { \n        distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq; \n    } \n    distanceSq = max(distanceSq, 0.0); \n    float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; \n    float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; \n    float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; \n    gl_Position *= show; \n}")};var numberOfCreationWorkers=Math.max(FeatureDetection.hardwareConcurrency-1,1),createGeometryTaskProcessors,combineGeometryTaskProcessor=new TaskProcessor("combineGeometry",Number.POSITIVE_INFINITY);function loadAsynchronous(i,r){var e,t,n,a,o=i._instanceIds;if(i._state===PrimitiveState$1.READY){e=isArray$1(i.geometryInstances)?i.geometryInstances:[i.geometryInstances];var s,l=i._numberOfInstances=e.length,c=[],u=[];for(n=0;n<l;++n)t=e[n].geometry,o.push(e[n].id),u.push({moduleName:t._workerName,geometry:t});if(!defined(createGeometryTaskProcessors))for(createGeometryTaskProcessors=new Array(numberOfCreationWorkers),n=0;n<numberOfCreationWorkers;n++)createGeometryTaskProcessors[n]=new TaskProcessor("createGeometry",Number.POSITIVE_INFINITY);for(u=subdivideArray(u,numberOfCreationWorkers),n=0;n<u.length;n++){var d,h=0,p=u[n],m=p.length;for(a=0;a<m;++a)defined((t=(s=p[a]).geometry).constructor.pack)&&(s.offset=h,h+=defaultValue(t.constructor.packedLength,t.packedLength));if(0<h){var f=new Float64Array(h);for(d=[f.buffer],a=0;a<m;++a)defined((t=(s=p[a]).geometry).constructor.pack)&&(t.constructor.pack(t,f,s.offset),s.geometry=f)}c.push(createGeometryTaskProcessors[n].scheduleTask({subTasks:u[n]},d))}i._state=PrimitiveState$1.CREATING,when.all(c,function(e){i._createGeometryResults=e,i._state=PrimitiveState$1.CREATED}).otherwise(function(e){setReady(i,r,PrimitiveState$1.FAILED,e)})}else if(i._state===PrimitiveState$1.CREATED){var g=[];e=isArray$1(i.geometryInstances)?i.geometryInstances:[i.geometryInstances];var _=r.scene3DOnly,y=r.mapProjection,v=combineGeometryTaskProcessor.scheduleTask(PrimitivePipeline.packCombineGeometryParameters({createGeometryResults:i._createGeometryResults,instances:e,ellipsoid:y.ellipsoid,projection:y,elementIndexUintSupported:r.context.elementIndexUint,scene3DOnly:_,vertexCacheOptimize:i.vertexCacheOptimize,compressVertices:i.compressVertices,modelMatrix:i.modelMatrix,createPickOffsets:i._createPickOffsets},g),g);i._createGeometryResults=void 0,i._state=PrimitiveState$1.COMBINING,when(v,function(e){var t=PrimitivePipeline.unpackCombineGeometryResults(e);i._geometries=t.geometries,i._attributeLocations=t.attributeLocations,i.modelMatrix=Matrix4.clone(t.modelMatrix,i.modelMatrix),i._pickOffsets=t.pickOffsets,i._offsetInstanceExtend=t.offsetInstanceExtend,i._instanceBoundingSpheres=t.boundingSpheres,i._instanceBoundingSpheresCV=t.boundingSpheresCV,defined(i._geometries)&&0<i._geometries.length?(i._recomputeBoundingSpheres=!0,i._state=PrimitiveState$1.COMBINED):setReady(i,r,PrimitiveState$1.FAILED,void 0)}).otherwise(function(e){setReady(i,r,PrimitiveState$1.FAILED,e)})}}function loadSynchronous(e,t){var i,r,n=isArray$1(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],a=e._numberOfInstances=n.length,o=new Array(a),s=e._instanceIds,l=0;for(r=0;r<a;r++){var c,u=(i=n[r]).geometry;c=defined(u.attributes)&&defined(u.primitiveType)?cloneGeometry(u):u.constructor.createGeometry(u),o[l++]=cloneInstance(i,c),s.push(i.id)}o.length=l;var d=t.scene3DOnly,h=t.mapProjection,p=PrimitivePipeline.combineGeometry({instances:o,ellipsoid:h.ellipsoid,projection:h,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:d,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=p.geometries,e._attributeLocations=p.attributeLocations,e.modelMatrix=Matrix4.clone(p.modelMatrix,e.modelMatrix),e._pickOffsets=p.pickOffsets,e._offsetInstanceExtend=p.offsetInstanceExtend,e._instanceBoundingSpheres=p.boundingSpheres,e._instanceBoundingSpheresCV=p.boundingSpheresCV,defined(e._geometries)&&0<e._geometries.length?(e._recomputeBoundingSpheres=!0,e._state=PrimitiveState$1.COMBINED):setReady(e,t,PrimitiveState$1.FAILED,void 0)}function recomputeBoundingSpheres(e,t){var i=e._batchTableAttributeIndices.offset;if(e._recomputeBoundingSpheres&&defined(i)){var r,n=e._offsetInstanceExtend,a=e._instanceBoundingSpheres,o=a.length,s=e._tempBoundingSpheres;if(!defined(s)){for(s=new Array(o),r=0;r<o;r++)s[r]=new BoundingSphere;e._tempBoundingSpheres=s}for(r=0;r<o;++r){var l=s[r],c=e._batchTable.getBatchedAttribute(r,i,new Cartesian3);transformBoundingSphere(l=a[r].clone(l),c,n[r])}var u=[],d=[],h=[];for(r=0;r<o;++r){var p=s[r];0<p.center.x-p.radius||BoundingSphere.intersectPlane(p,Plane.ORIGIN_ZX_PLANE)!==Intersect$1.INTERSECTING?u.push(p):(d.push(p),h.push(p))}var m=u[0],f=h[0],g=d[0];for(r=1;r<u.length;r++)m=BoundingSphere.union(m,u[r]);for(r=1;r<h.length;r++)f=BoundingSphere.union(f,h[r]);for(r=1;r<d.length;r++)g=BoundingSphere.union(g,d[r]);var _=[];for(defined(m)&&_.push(m),defined(f)&&_.push(f),defined(g)&&_.push(g),r=0;r<_.length;r++){var y=_[r].clone(e._boundingSpheres[r]);e._boundingSpheres[r]=y,e._boundingSphereCV[r]=BoundingSphere.projectTo2D(y,t.mapProjection,e._boundingSphereCV[r])}Primitive._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}else e._recomputeBoundingSpheres=!1}var scratchBoundingSphereCenterEncoded=new EncodedCartesian3,scratchBoundingSphereCartographic=new Cartographic,scratchBoundingSphereCenter2D=new Cartesian3,scratchBoundingSphere$2=new BoundingSphere;function updateBatchTableBoundingSpheres(e,t){if(defined(e._batchTableAttributeIndices.distanceDisplayCondition)&&!e._batchTableBoundingSpheresUpdated){for(var i=e._batchTableBoundingSphereAttributeIndices,r=i.center3DHigh,n=i.center3DLow,a=i.center2DHigh,o=i.center2DLow,s=i.radius,l=t.mapProjection,c=l.ellipsoid,u=e._batchTable,d=e._instanceBoundingSpheres,h=d.length,p=0;p<h;++p){var m=d[p];if(defined(m)){var f=e.modelMatrix;defined(f)&&(m=BoundingSphere.transform(m,f,scratchBoundingSphere$2));var g=m.center,_=m.radius,y=EncodedCartesian3.fromCartesian(g,scratchBoundingSphereCenterEncoded);if(u.setBatchedAttribute(p,r,y.high),u.setBatchedAttribute(p,n,y.low),!t.scene3DOnly){var v=c.cartesianToCartographic(g,scratchBoundingSphereCartographic),C=l.project(v,scratchBoundingSphereCenter2D);y=EncodedCartesian3.fromCartesian(C,scratchBoundingSphereCenterEncoded),u.setBatchedAttribute(p,a,y.high),u.setBatchedAttribute(p,o,y.low)}u.setBatchedAttribute(p,s,_)}}e._batchTableBoundingSpheresUpdated=!0}}var offsetScratchCartesian=new Cartesian3,offsetCenterScratch=new Cartesian3;function updateBatchTableOffsets(e,t){if(defined(e._batchTableAttributeIndices.offset)&&!e._batchTableOffsetsUpdated&&!t.scene3DOnly){for(var i=e._batchTableOffsetAttribute2DIndex,r=t.mapProjection,n=r.ellipsoid,a=e._batchTable,o=e._instanceBoundingSpheres,s=o.length,l=0;l<s;++l){var c=o[l];if(defined(c)){var u=a.getBatchedAttribute(l,e._batchTableAttributeIndices.offset);if(Cartesian3.equals(u,Cartesian3.ZERO))a.setBatchedAttribute(l,i,Cartesian3.ZERO);else{var d=e.modelMatrix;defined(d)&&(c=BoundingSphere.transform(c,d,scratchBoundingSphere$2));var h=c.center;h=n.scaleToGeodeticSurface(h,offsetCenterScratch);var p=n.cartesianToCartographic(h,scratchBoundingSphereCartographic),m=r.project(p,scratchBoundingSphereCenter2D),f=Cartesian3.add(u,h,offsetScratchCartesian);p=n.cartesianToCartographic(f,p);var g=r.project(p,offsetScratchCartesian),_=Cartesian3.subtract(g,m,offsetScratchCartesian),y=_.x;_.x=_.z,_.z=_.y,_.y=y,a.setBatchedAttribute(l,i,_)}}}e._batchTableOffsetsUpdated=!0}}function createVertexArray(e,t){for(var i=e._attributeLocations,r=e._geometries,n=t.scene3DOnly,a=t.context,o=[],s=r.length,l=0;l<s;++l){var c=r[l];if(o.push(VertexArray.fromGeometry({context:a,geometry:c,attributeLocations:i,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:e._interleave})),defined(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,c);else if(e._boundingSpheres.push(BoundingSphere.clone(c.boundingSphere)),e._boundingSphereWC.push(new BoundingSphere),!n){var u=c.boundingSphereCV.center,d=u.x,h=u.y,p=u.z;u.x=p,u.y=d,u.z=h,e._boundingSphereCV.push(BoundingSphere.clone(c.boundingSphereCV)),e._boundingSphere2D.push(new BoundingSphere),e._boundingSphereMorph.push(new BoundingSphere)}}e._va=o,e._primitiveType=r[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,setReady(e,t,PrimitiveState$1.COMPLETE,void 0)}function createRenderStates(e,t,i,r){var n,a=i.getRenderState();r?((n=clone(a,!1)).cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceRS=RenderState.fromCache(n),n.cull.face=CullFace$1.FRONT,e._backFaceRS=RenderState.fromCache(n)):(e._frontFaceRS=RenderState.fromCache(a),e._backFaceRS=e._frontFaceRS),n=clone(a,!1),defined(e._depthFailAppearance)&&(n.depthTest.enabled=!1),defined(e._depthFailAppearance)&&((n=clone(a=e._depthFailAppearance.getRenderState(),!1)).depthTest.func=DepthFunction$1.GREATER,r?(n.cull={enabled:!0,face:CullFace$1.BACK},e._frontFaceDepthFailRS=RenderState.fromCache(n),n.cull.face=CullFace$1.FRONT,e._backFaceDepthFailRS=RenderState.fromCache(n)):(e._frontFaceDepthFailRS=RenderState.fromCache(n),e._backFaceDepthFailRS=e._frontFaceRS))}function createShaderProgram(e,t,i){var r=t.context,n=e._attributeLocations,a=e._batchTable.getVertexShaderCallback()(i.vertexShaderSource);a=Primitive._appendOffsetToShader(e,a),a=Primitive._appendShowToShader(e,a),a=appendPickToVertexShader(a=Primitive._appendDistanceDisplayConditionToShader(e,a,t.scene3DOnly)),a=modifyForEncodedNormals(e,a=Primitive._updateColorAttribute(e,a,!1)),a=Primitive._modifyShaderPosition(e,a,t.scene3DOnly);var o=i.getFragmentShaderSource();o=appendPickToFragmentShader(o),e._sp=ShaderProgram.replaceCache({context:r,shaderProgram:e._sp,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:n}),validateShaderMatching(e._sp),defined(e._depthFailAppearance)&&(a=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),a=Primitive._appendShowToShader(e,a),a=appendPickToVertexShader(a=Primitive._appendDistanceDisplayConditionToShader(e,a,t.scene3DOnly)),a=modifyForEncodedNormals(e,a=Primitive._updateColorAttribute(e,a,!0)),a=depthClampVS(a=Primitive._modifyShaderPosition(e,a,t.scene3DOnly)),o=depthClampFS(o=appendPickToFragmentShader(o=e._depthFailAppearance.getFragmentShaderSource())),e._spDepthFail=ShaderProgram.replaceCache({context:r,shaderProgram:e._spDepthFail,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:n}),validateShaderMatching(e._spDepthFail))}var modifiedModelViewScratch=new Matrix4,rtcScratch=new Cartesian3;function getUniforms(t,e,i,r){var n=defined(i)?i._uniforms:void 0,a={},o=e.uniforms;if(defined(o))for(var s in o)o.hasOwnProperty(s)&&(a[s]=getUniformFunction(o,s));var l=combine(a,n);return l=t._batchTable.getUniformMapCallback()(l),defined(t.rtcCenter)&&(l.u_modifiedModelView=function(){var e=r.context.uniformState.view;return Matrix4.multiply(e,t._modelMatrix,modifiedModelViewScratch),Matrix4.multiplyByPoint(modifiedModelViewScratch,t.rtcCenter,rtcScratch),Matrix4.setTranslation(modifiedModelViewScratch,rtcScratch,modifiedModelViewScratch),modifiedModelViewScratch}),l}function createCommands(e,t,i,r,n,a,o,s){var l,c=getUniforms(e,t,i,s);defined(e._depthFailAppearance)&&(l=getUniforms(e,e._depthFailAppearance,e._depthFailAppearance.material,s));var u=r?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,d=n?2:1;d*=defined(e._depthFailAppearance)?2:1,a.length=e._va.length*d;for(var h=a.length,p=0,m=0;m<h;++m){var f;n&&(defined(f=a[m])||(f=a[m]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),f.vertexArray=e._va[p],f.renderState=e._backFaceRS,f.shaderProgram=e._sp,f.uniformMap=c,f.pass=u,++m),defined(f=a[m])||(f=a[m]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),f.vertexArray=e._va[p],f.renderState=e._frontFaceRS,f.shaderProgram=e._sp,f.uniformMap=c,f.pass=u,defined(e._depthFailAppearance)&&(n&&(defined(f=a[++m])||(f=a[m]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),f.vertexArray=e._va[p],f.renderState=e._backFaceDepthFailRS,f.shaderProgram=e._spDepthFail,f.uniformMap=l,f.pass=u),defined(f=a[++m])||(f=a[m]=new DrawCommand({owner:e,primitiveType:e._primitiveType})),f.vertexArray=e._va[p],f.renderState=e._frontFaceDepthFailRS,f.shaderProgram=e._spDepthFail,f.uniformMap=l,f.pass=u),++p}}function updateAndQueueCommands(e,t,i,r,n,a,o,s){var l;Primitive._updateBoundingVolumes(e,t,n),t.mode===SceneMode$1.SCENE3D?l=e._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?l=e._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(e._boundingSphere2D)?l=e._boundingSphere2D:defined(e._boundingSphereMorph)&&(l=e._boundingSphereMorph);var c=t.commandList,u=t.passes;if(u.render||u.pick){var d=e.allowPicking,h=ShadowMode$1.castShadows(e.shadows),p=ShadowMode$1.receiveShadows(e.shadows),m=i.length,f=s?2:1;f*=defined(e._depthFailAppearance)?2:1;for(var g=0;g<m;++g){var _=Math.floor(g/f),y=i[g];y.modelMatrix=n,y.boundingVolume=l[_],y.cull=a,y.debugShowBoundingVolume=o,y.castShadows=h,y.receiveShadows=p,y.pickId=d?"v_pickColor":void 0,c.push(y)}}}Primitive._updateBoundingVolumes=function(e,t,i,r){var n,a,o;if(r||!Matrix4.equals(i,e._modelMatrix))for(Matrix4.clone(i,e._modelMatrix),a=e._boundingSpheres.length,n=0;n<a;++n)defined(o=e._boundingSpheres[n])&&(e._boundingSphereWC[n]=BoundingSphere.transform(o,i,e._boundingSphereWC[n]),t.scene3DOnly||(e._boundingSphere2D[n]=BoundingSphere.clone(e._boundingSphereCV[n],e._boundingSphere2D[n]),e._boundingSphere2D[n].center.x=0,e._boundingSphereMorph[n]=BoundingSphere.union(e._boundingSphereWC[n],e._boundingSphereCV[n])));var s=e.appearance.pixelSize;if(defined(s))for(a=e._boundingSpheres.length,n=0;n<a;++n){o=e._boundingSpheres[n];var l=e._boundingSphereWC[n],c=t.camera.getPixelSize(o,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*s;l.radius=o.radius+c}},Primitive.prototype.update=function(e){if(!(!defined(this.geometryInstances)&&0===this._va.length||defined(this.geometryInstances)&&isArray$1(this.geometryInstances)&&0===this.geometryInstances.length||!defined(this.appearance)||e.mode!==SceneMode$1.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)){if(defined(this._error))throw this._error;if(this._state!==PrimitiveState$1.FAILED){var t=e.context;if(defined(this._batchTable)||createBatchTable(this,t),0<this._batchTable.attributes.length){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("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!==PrimitiveState$1.COMPLETE&&this._state!==PrimitiveState$1.COMBINED&&(this.asynchronous?loadAsynchronous(this,e):loadSynchronous(this,e)),this._state===PrimitiveState$1.COMBINED&&(updateBatchTableBoundingSpheres(this,e),updateBatchTableOffsets(this,e),createVertexArray(this,e)),this.show&&this._state===PrimitiveState$1.COMPLETE){this._batchTableOffsetsUpdated||updateBatchTableOffsets(this,e),this._recomputeBoundingSpheres&&recomputeBoundingSpheres(this,e);var i=this.appearance,r=i.material,n=!1,a=!1;this._appearance!==i?(this._appearance=i,this._material=r,a=n=!0):this._material!==r&&(this._material=r,a=!0);var o=this.depthFailAppearance,s=defined(o)?o.material:void 0;this._depthFailAppearance!==o?(this._depthFailAppearance=o,this._depthFailMaterial=s,a=n=!0):this._depthFailMaterial!==s&&(this._depthFailMaterial=s,a=!0);var l=this._appearance.isTranslucent();this._translucent!==l&&(this._translucent=l,n=!0),defined(this._material)&&this._material.update(t);var c=i.closed&&l;if(n)defaultValue(this._createRenderStatesFunction,createRenderStates)(this,t,i,c);if(a)defaultValue(this._createShaderProgramFunction,createShaderProgram)(this,e,i);if(n||a)defaultValue(this._createCommandsFunction,createCommands)(this,i,r,l,c,this._colorCommands,this._pickCommands,e);defaultValue(this._updateAndQueueCommandsFunction,updateAndQueueCommands)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,c)}}}};var offsetBoundingSphereScratch1=new BoundingSphere,offsetBoundingSphereScratch2=new BoundingSphere;function transformBoundingSphere(e,t,i){if(i===GeometryOffsetAttribute$1.TOP){var r=BoundingSphere.clone(e,offsetBoundingSphereScratch1),n=BoundingSphere.clone(e,offsetBoundingSphereScratch2);n.center=Cartesian3.add(n.center,t,n.center),e=BoundingSphere.union(r,n,e)}else i===GeometryOffsetAttribute$1.ALL&&(e.center=Cartesian3.add(e.center,t,e.center));return e}function createGetFunction(n,a,o){return function(){var e=n.getBatchedAttribute(a,o),t=n.attributes[o],i=t.componentsPerAttribute,r=ComponentDatatype$1.createTypedArray(t.componentDatatype,i);return defined(e.constructor.pack)?e.constructor.pack(e,r,0):r[0]=e,r}}function createSetFunction(i,r,n,a,o){return function(e){var t=getAttributeValue(e);i.setBatchedAttribute(r,n,t),"offset"===o&&(a._recomputeBoundingSpheres=!0,a._batchTableOffsetsUpdated=!1)}}var offsetScratch$2=new Cartesian3;function createBoundingSphereProperties(r,n,a){n.boundingSphere={get:function(){var e=r._instanceBoundingSpheres[a];if(defined(e)){e=e.clone();var t=r.modelMatrix,i=n.offset;defined(i)&&transformBoundingSphere(e,Cartesian3.fromArray(i.get(),0,offsetScratch$2),r._offsetInstanceExtend[a]),defined(t)&&(e=BoundingSphere.transform(e,t))}return e}},n.boundingSphereCV={get:function(){return r._instanceBoundingSpheresCV[a]}}}function createPickIdProperty(e,t,i){t.pickId={get:function(){return e._pickIds[i]}}}function setReady(e,t,i,r){e._error=r,e._state=i,t.afterRender.push(function(){e._ready=e._state===PrimitiveState$1.COMPLETE||e._state===PrimitiveState$1.FAILED,defined(r)?e._readyPromise.reject(r):e._readyPromise.resolve(e)})}Primitive.prototype.getGeometryInstanceAttributes=function(e){for(var t=-1,i=this._lastPerInstanceAttributeIndex,r=this._instanceIds,n=r.length,a=0;a<n;++a){var o=(i+a)%n;if(e===r[o]){t=o;break}}if(-1!==t){var s=this._perInstanceAttributeCache[t];if(defined(s))return s;var l=this._batchTable,c=this._batchTableAttributeIndices;s={};var u={};for(var d in c)if(c.hasOwnProperty(d)){var h=c[d];u[d]={get:createGetFunction(l,t,h)};var p=!0,m=this._readOnlyInstanceAttributes;if(p&&defined(m)){n=m.length;for(var f=0;f<n;++f)if(d===m[f]){p=!1;break}}p&&(u[d].set=createSetFunction(l,t,h,this,d))}return createBoundingSphereProperties(this,u,t),createPickIdProperty(this,u,t),defineProperties$1(s,u),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=s}},Primitive.prototype.isDestroyed=function(){return!1},Primitive.prototype.destroy=function(){var e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();var i=this._va;for(e=i.length,t=0;t<e;++t)i[t].destroy();this._va=void 0;var r=this._pickIds;for(e=r.length,t=0;t<e;++t)r[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,destroyObject(this)};var ShadowVolumeAppearanceFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n#ifdef NORMAL_EC\nvec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth)\n{\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\nreturn eyeCoordinate.xyz / eyeCoordinate.w;\n}\nvec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset)\n{\nvec2 glFragCoordXY = gl_FragCoord.xy;\nfloat upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\nfloat downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\nbvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\nfloat useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\nfloat useDownOrLeft = float(useUpOrRight == 0.0);\nvec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\nvec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\nreturn (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n}\n#endif // NORMAL_EC\nvoid main(void)\n{\n#ifdef REQUIRES_EC\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n#endif\n#ifdef REQUIRES_WC\nvec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\nvec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n#endif\n#ifdef TEXTURE_COORDINATES\nvec2 uv;\n#ifdef SPHERICAL\nvec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);\nsphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;\nsphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\nuv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;\nuv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;\n#else // SPHERICAL\nuv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;\nuv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;\n#endif // SPHERICAL\n#endif // TEXTURE_COORDINATES\n#ifdef PICK\n#ifdef CULL_FRAGMENTS\nif (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0)\n{\ngl_FragColor.a = 1.0;\nczm_writeDepthClampedToFarPlane();\n}\n#else // CULL_FRAGMENTS\ngl_FragColor.a = 1.0;\n#endif // CULL_FRAGMENTS\n#else // PICK\n#ifdef CULL_FRAGMENTS\nif (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y)\n{\ndiscard;\n}\n#endif\n#ifdef NORMAL_EC\nvec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));\nvec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));\nvec3 normalEC = normalize(cross(leftRight, downUp));\n#endif\n#ifdef PER_INSTANCE_COLOR\nvec4 color = czm_gammaCorrect(v_color);\n#ifdef FLAT\ngl_FragColor = color;\n#else // FLAT\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material);\n#endif // FLAT\n#else // PER_INSTANCE_COLOR\nczm_materialInput materialInput;\n#ifdef USES_NORMAL_EC\nmaterialInput.normalEC = normalEC;\n#endif\n#ifdef USES_POSITION_TO_EYE_EC\nmaterialInput.positionToEyeEC = -eyeCoordinate.xyz;\n#endif\n#ifdef USES_TANGENT_TO_EYE\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);\n#endif\n#ifdef USES_ST\nmaterialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;\nmaterialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;\n#endif\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else // FLAT\ngl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material);\n#endif // FLAT\n#endif // PER_INSTANCE_COLOR\nczm_writeDepthClampedToFarPlane();\n#endif // PICK\n}\n";function ShadowVolumeAppearance(e,t,i,r){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""},this._useFloatBatchTable=r;var n=new ShaderDependencies;n.requiresTextureCoordinates=e,n.requiresEC=!i.flat;var a=new ShaderDependencies;if(a.requiresTextureCoordinates=e,i instanceof PerInstanceColorAppearance)n.requiresNormalEC=!i.flat;else{var o=i.material.shaderSource+"\n"+i.fragmentShaderSource;n.normalEC=-1!==o.indexOf("materialInput.normalEC")||-1!==o.indexOf("czm_getDefaultMaterial"),n.positionToEyeEC=-1!==o.indexOf("materialInput.positionToEyeEC"),n.tangentToEyeMatrix=-1!==o.indexOf("materialInput.tangentToEyeMatrix"),n.st=-1!==o.indexOf("materialInput.st")}this._colorShaderDependencies=n,this._pickShaderDependencies=a,this._appearance=i,this._extentsCulling=e,this._planarExtents=t}ShadowVolumeAppearance.prototype.createFragmentShader=function(e){var t=this._appearance,i=this._colorShaderDependencies,r=[];e||this._planarExtents||r.push("SPHERICAL"),i.requiresEC&&r.push("REQUIRES_EC"),i.requiresWC&&r.push("REQUIRES_WC"),i.requiresTextureCoordinates&&r.push("TEXTURE_COORDINATES"),this._extentsCulling&&r.push("CULL_FRAGMENTS"),i.requiresNormalEC&&r.push("NORMAL_EC"),t instanceof PerInstanceColorAppearance&&r.push("PER_INSTANCE_COLOR"),i.normalEC&&r.push("USES_NORMAL_EC"),i.positionToEyeEC&&r.push("USES_POSITION_TO_EYE_EC"),i.tangentToEyeMatrix&&r.push("USES_TANGENT_TO_EYE"),i.st&&r.push("USES_ST"),t.flat&&r.push("FLAT");var n="";return t instanceof PerInstanceColorAppearance||(n=t.material.shaderSource),new ShaderSource({defines:r,sources:[n,ShadowVolumeAppearanceFS]})},ShadowVolumeAppearance.prototype.createPickFragmentShader=function(e){var t=this._pickShaderDependencies,i=["PICK"];return e||this._planarExtents||i.push("SPHERICAL"),t.requiresEC&&i.push("REQUIRES_EC"),t.requiresWC&&i.push("REQUIRES_WC"),t.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),new ShaderSource({defines:i,sources:[ShadowVolumeAppearanceFS],pickColorQualifier:"varying"})},ShadowVolumeAppearance.prototype.createVertexShader=function(e,t,i,r){return createShadowVolumeAppearanceVS(this._colorShaderDependencies,this._planarExtents,i,e,t,this._appearance,r,this._useFloatBatchTable,this._projectionExtentDefines)},ShadowVolumeAppearance.prototype.createPickVertexShader=function(e,t,i,r){return createShadowVolumeAppearanceVS(this._pickShaderDependencies,this._planarExtents,i,e,t,void 0,r,this._useFloatBatchTable,this._projectionExtentDefines)};var longitudeExtentsCartesianScratch=new Cartesian3,longitudeExtentsCartographicScratch=new Cartographic,longitudeExtentsEncodeScratch={high:0,low:0};function createShadowVolumeAppearanceVS(e,t,i,r,n,a,o,s,l){var c=r.slice();if(""===l.eastMostYhighDefine){var u=longitudeExtentsCartographicScratch;u.longitude=CesiumMath.PI,u.latitude=0,u.height=0;var d=o.project(u,longitudeExtentsCartesianScratch),h=EncodedCartesian3.encode(d.x,longitudeExtentsEncodeScratch);l.eastMostYhighDefine="EAST_MOST_X_HIGH "+h.high.toFixed((h.high+"").length+1),l.eastMostYlowDefine="EAST_MOST_X_LOW "+h.low.toFixed((h.low+"").length+1);var p=longitudeExtentsCartographicScratch;p.longitude=-CesiumMath.PI,p.latitude=0,p.height=0;var m=o.project(p,longitudeExtentsCartesianScratch);h=EncodedCartesian3.encode(m.x,longitudeExtentsEncodeScratch),l.westMostYhighDefine="WEST_MOST_X_HIGH "+h.high.toFixed((h.high+"").length+1),l.westMostYlowDefine="WEST_MOST_X_LOW "+h.low.toFixed((h.low+"").length+1)}return i&&(c.push(l.eastMostYhighDefine),c.push(l.eastMostYlowDefine),c.push(l.westMostYhighDefine),c.push(l.westMostYlowDefine)),defined(a)&&a instanceof PerInstanceColorAppearance&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||i||c.push("SPHERICAL"),i&&c.push("COLUMBUS_VIEW_2D")),s||c.push("UINT8_PACKING"),new ShaderSource({defines:c,sources:[n]})}function ShaderDependencies(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}function pointLineDistance(e,t,i){return Math.abs((t.y-e.y)*i.x-(t.x-e.x)*i.y+t.x*e.y-t.y*e.x)/Cartesian2.distance(t,e)}defineProperties$1(ShaderDependencies.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}}});var points2DScratch$2=[new Cartesian2,new Cartesian2,new Cartesian2,new Cartesian2];function addTextureCoordinateRotationAttributes(e,t){var i=points2DScratch$2,r=Cartesian2.unpack(t,0,i[0]),n=Cartesian2.unpack(t,2,i[1]),a=Cartesian2.unpack(t,4,i[2]);e.uMaxVmax=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[n.x,n.y,a.x,a.y]});var o=1/pointLineDistance(r,n,a),s=1/pointLineDistance(r,a,n);e.uvMinAndExtents=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r.x,r.y,o,s]})}function encodeLowLessThan100k(e,t,i){var r=Math.abs(e),n=Math.floor(r/1e3);r-=1e3*n;var a=Math.floor(r/10);r-=10*a;var o=Math.floor(10*r);r-=.1*o;var s=Math.floor(1e3*r);e<0&&(n=255-n),i[t]=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!1,value:[n,a,o,s]})}function encodeHighLessThan100Million(e,t,i){var r=Math.abs(e),n=Math.floor(r/1e6);r-=1e6*n;var a=Math.floor(r/1e4);r-=1e4*a;var o=Math.floor(r/100);r-=100*o;var s=Math.floor(r);e<0&&(n=255-n),i[t]=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!1,value:[n,a,o,s]})}function encodeLessThan1000k(e,t,i){var r=Math.abs(e),n=Math.floor(r/1e4);r-=1e4*n;var a=Math.floor(r/100);r-=100*a;var o=Math.floor(r);r-=o;var s=Math.floor(r/.001);e<0&&(n=255-n),i[t]=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!1,value:[n,a,o,s]})}var cartographicScratch$1=new Cartographic,cornerScratch=new Cartesian3,northWestScratch=new Cartesian3,southEastScratch=new Cartesian3,highLowScratch={high:0,low:0};function add2DTextureCoordinateAttributes(e,t,i,r){var n=cartographicScratch$1;n.height=0,n.longitude=e.west,n.latitude=e.south;var a=t.project(n,cornerScratch);n.latitude=e.north;var o=t.project(n,northWestScratch);n.longitude=e.east,n.latitude=e.south;var s,l=t.project(n,southEastScratch);if(!r)return encodeHighLessThan100Million((s=EncodedCartesian3.encode(a.x,highLowScratch)).high,"planes2D_HIGH_x",i),encodeLowLessThan100k(s.low,"planes2D_LOW_x",i),encodeHighLessThan100Million((s=EncodedCartesian3.encode(a.y,highLowScratch)).high,"planes2D_HIGH_y",i),encodeLowLessThan100k(s.low,"planes2D_LOW_y",i),encodeHighLessThan100Million((s=EncodedCartesian3.encode(o.y,highLowScratch)).high,"planes2D_HIGH_z",i),encodeLowLessThan100k(s.low,"planes2D_LOW_z",i),encodeHighLessThan100Million((s=EncodedCartesian3.encode(l.x,highLowScratch)).high,"planes2D_HIGH_w",i),void encodeLowLessThan100k(s.low,"planes2D_LOW_w",i);var c=[0,0,0,0],u=[0,0,0,0];s=EncodedCartesian3.encode(a.x,highLowScratch),c[0]=s.high,u[0]=s.low,s=EncodedCartesian3.encode(a.y,highLowScratch),c[1]=s.high,u[1]=s.low,s=EncodedCartesian3.encode(o.y,highLowScratch),c[2]=s.high,u[2]=s.low,s=EncodedCartesian3.encode(l.x,highLowScratch),c[3]=s.high,u[3]=s.low,i.planes2D_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:c}),i.planes2D_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:u})}var enuMatrixScratch=new Matrix4,inverseEnuScratch=new Matrix4,rectanglePointCartesianScratch=new Cartesian3,rectangleCenterScratch$2=new Cartographic,pointsCartographicScratch=[new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic,new Cartographic];function computeRectangleBounds(e,t,i,r,n,a){var o=Rectangle.center(e,rectangleCenterScratch$2);o.height=i;var s=Cartographic.toCartesian(o,t,rectanglePointCartesianScratch),l=Transforms.eastNorthUpToFixedFrame(s,t,enuMatrixScratch),c=Matrix4.inverse(l,inverseEnuScratch),u=e.west,d=e.east,h=e.north,p=e.south,m=pointsCartographicScratch;m[0].latitude=p,m[0].longitude=u,m[1].latitude=h,m[1].longitude=u,m[2].latitude=h,m[2].longitude=d,m[3].latitude=p;var f=.5*(u+(m[3].longitude=d)),g=.5*(h+p);m[4].latitude=p,m[4].longitude=f,m[5].latitude=h,m[5].longitude=f,m[6].latitude=g,m[6].longitude=u,m[7].latitude=g,m[7].longitude=d;for(var _=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,S=0;S<8;S++){m[S].height=i;var x=Cartographic.toCartesian(m[S],t,rectanglePointCartesianScratch);Matrix4.multiplyByPoint(c,x,x),x.z=0,_=Math.min(_,x.x),y=Math.max(y,x.x),v=Math.min(v,x.y),C=Math.max(C,x.y)}var T=r;T.x=_,T.y=v,T.z=0,Matrix4.multiplyByPoint(l,T,T);var b=n;b.x=y,b.y=v,b.z=0,Matrix4.multiplyByPoint(l,b,b),Cartesian3.subtract(b,T,n);var E=a;E.x=_,E.y=C,E.z=0,Matrix4.multiplyByPoint(l,E,E),Cartesian3.subtract(E,T,a)}var eastwardScratch=new Cartesian3,northwardScratch=new Cartesian3,encodeScratch$1=new EncodedCartesian3;ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes=function(e,t,i,r,n,a){var o=cornerScratch,s=eastwardScratch,l=northwardScratch;computeRectangleBounds(e,i,defaultValue(a,0),o,s,l);var c={};addTextureCoordinateRotationAttributes(c,t);var u=EncodedCartesian3.fromCartesian(o,encodeScratch$1);if(n)return c.southWest_HIGH=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(u.high,[0,0,0])}),c.southWest_LOW=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(u.low,[0,0,0])}),c.eastward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(s,[0,0,0])}),c.northward=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,normalize:!1,value:Cartesian3.pack(l,[0,0,0])}),add2DTextureCoordinateAttributes(e,r,c,!0),c;var d=u.high;encodeHighLessThan100Million(d.x,"southWest_HIGH_x",c),encodeHighLessThan100Million(d.y,"southWest_HIGH_y",c),encodeHighLessThan100Million(d.z,"southWest_HIGH_z",c);var h=u.low;return encodeLowLessThan100k(h.x,"southWest_LOW_x",c),encodeLowLessThan100k(h.y,"southWest_LOW_y",c),encodeLowLessThan100k(h.z,"southWest_LOW_z",c),encodeLessThan1000k(s.x,"eastward_x",c),encodeLessThan1000k(s.y,"eastward_y",c),encodeLessThan1000k(s.z,"eastward_z",c),encodeLessThan1000k(l.x,"northward_x",c),encodeLessThan1000k(l.y,"northward_y",c),encodeLessThan1000k(l.z,"northward_z",c),add2DTextureCoordinateAttributes(e,r,c,!1),c};var spherePointScratch=new Cartesian3;function latLongToSpherical(e,t,i,r){var n=cartographicScratch$1;n.latitude=e,n.longitude=t,n.height=0;var a=Cartographic.toCartesian(n,i,spherePointScratch),o=Math.sqrt(a.x*a.x+a.y*a.y),s=CesiumMath.fastApproximateAtan2(o,a.z),l=CesiumMath.fastApproximateAtan2(a.x,a.y);return r.x=s,r.y=l,r}var sphericalScratch=new Cartesian2;function shouldUseSpherical(e){return Math.max(e.width,e.height)>ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS}ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes=function(e,t,i,r,n){var a=latLongToSpherical(e.south,e.west,i,sphericalScratch),o=a.x,s=a.y,l=latLongToSpherical(e.north,e.east,i,sphericalScratch),c=l.x,u=l.y,d=0;u<s&&(d=CesiumMath.PI-s,s=-CesiumMath.PI,u+=d),o-=CesiumMath.EPSILON5,s-=CesiumMath.EPSILON5,c+=CesiumMath.EPSILON5;var h=1/((u+=CesiumMath.EPSILON5)-s),p=1/(c-o),m={sphericalExtents:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o,s,p,h]}),longitudeRotation:new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:1,normalize:!1,value:[d]})};return addTextureCoordinateRotationAttributes(m,t),add2DTextureCoordinateAttributes(e,r,m,n),m},ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes=function(e){var t=defined(e.southWest_HIGH)&&defined(e.southWest_LOW)&&defined(e.northward)&&defined(e.eastward)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents),i=defined(e.southWest_HIGH_x)&&defined(e.southWest_LOW_x)&&defined(e.southWest_HIGH_y)&&defined(e.southWest_LOW_y)&&defined(e.southWest_HIGH_z)&&defined(e.southWest_LOW_z)&&defined(e.northward_x)&&defined(e.eastward_x)&&defined(e.northward_y)&&defined(e.eastward_y)&&defined(e.northward_z)&&defined(e.eastward_z)&&defined(e.planes2D_HIGH_x)&&defined(e.planes2D_LOW_x)&&defined(e.planes2D_HIGH_y)&&defined(e.planes2D_LOW_y)&&defined(e.planes2D_HIGH_z)&&defined(e.planes2D_LOW_z)&&defined(e.planes2D_HIGH_w)&&defined(e.planes2D_LOW_w)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents);return t||i},ShadowVolumeAppearance.hasAttributesForSphericalExtents=function(e){var t=defined(e.sphericalExtents)&&defined(e.longitudeRotation)&&defined(e.planes2D_HIGH)&&defined(e.planes2D_LOW)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents),i=defined(e.sphericalExtents)&&defined(e.longitudeRotation)&&defined(e.planes2D_HIGH_x)&&defined(e.planes2D_LOW_x)&&defined(e.planes2D_HIGH_y)&&defined(e.planes2D_LOW_y)&&defined(e.planes2D_HIGH_z)&&defined(e.planes2D_LOW_z)&&defined(e.planes2D_HIGH_w)&&defined(e.planes2D_LOW_w)&&defined(e.uMaxVmax)&&defined(e.uvMinAndExtents);return t||i},ShadowVolumeAppearance.shouldUseSphericalCoordinates=function(e){return shouldUseSpherical(e)},ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS=CesiumMath.toRadians(1);var StencilFunction={NEVER:WebGLConstants$1.NEVER,LESS:WebGLConstants$1.LESS,EQUAL:WebGLConstants$1.EQUAL,LESS_OR_EQUAL:WebGLConstants$1.LEQUAL,GREATER:WebGLConstants$1.GREATER,NOT_EQUAL:WebGLConstants$1.NOTEQUAL,GREATER_OR_EQUAL:WebGLConstants$1.GEQUAL,ALWAYS:WebGLConstants$1.ALWAYS},StencilFunction$1=freezeObject$1(StencilFunction),StencilOperation={ZERO:WebGLConstants$1.ZERO,KEEP:WebGLConstants$1.KEEP,REPLACE:WebGLConstants$1.REPLACE,INCREMENT:WebGLConstants$1.INCR,DECREMENT:WebGLConstants$1.DECR,INVERT:WebGLConstants$1.INVERT,INCREMENT_WRAP:WebGLConstants$1.INCR_WRAP,DECREMENT_WRAP:WebGLConstants$1.DECR_WRAP},StencilOperation$1=freezeObject$1(StencilOperation),StencilConstants={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15,setCesium3DTileBit:function(){return{enabled:!0,frontFunction:StencilFunction$1.ALWAYS,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},backFunction:StencilFunction$1.ALWAYS,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.REPLACE},reference:StencilConstants.CESIUM_3D_TILE_MASK,mask:StencilConstants.CESIUM_3D_TILE_MASK}}},StencilConstants$1=freezeObject$1(StencilConstants),ClassificationPrimitiveReadOnlyInstanceAttributes=["color"];function ClassificationPrimitive(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometryInstances;this.geometryInstances=i,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=defaultValue(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._rsStencilPreloadPass=void 0,this._rsStencilPreloadPass3DTiles=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,defined(i)&&isArray$1(i)&&1<i.length&&(t=ClassificationPrimitiveReadOnlyInstanceAttributes),this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_readOnlyInstanceAttributes:t,_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}function getStencilPreloadRenderState(e,t){var i=t?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:i,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.DECREMENT_WRAP},backFunction:i,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.INCREMENT_WRAP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1}}function getStencilDepthRenderState(e,t){var i=t?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:i,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.INCREMENT_WRAP},backFunction:i,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}function getColorRenderState(e){return{stencilTest:{enabled:e,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}}defineProperties$1(ClassificationPrimitive.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}},readyPromise:{get:function(){return this._readyPromise.promise}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}}),ClassificationPrimitive.isSupported=function(e){return e.context.stencilBuffer};var pickRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$1(e,t,i,r){if(!defined(e._rsStencilPreloadPass)){var n=!e.debugShowShadowVolume;e._rsStencilPreloadPass=RenderState.fromCache(getStencilPreloadRenderState(n,!1)),e._rsStencilPreloadPass3DTiles=RenderState.fromCache(getStencilPreloadRenderState(n,!0)),e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState(n,!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState(n,!0)),e._rsColorPass=RenderState.fromCache(getColorRenderState(n)),e._rsPickPass=RenderState.fromCache(pickRenderState)}}function modifyForEncodedNormals$1(e,t){if(!e.compressVertices)return t;if(-1!==t.search(/attribute\s+vec3\s+extrudeDirection;/g)){var i="compressedAttributes",r="attribute vec2 "+i+";",n=t;return n=n.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),[r,"vec3 extrudeDirection;\n",n=ShaderSource.replaceMain(n,"czm_non_compressed_main"),"void main() \n{ \n    extrudeDirection = czm_octDecode(compressedAttributes, 65535.0);\n    czm_non_compressed_main(); \n}"].join("\n")}}function createShaderProgram$1(e,t){var i=t.context,r=e._primitive,n=ShadowVolumeAppearanceVS;n=e._primitive._batchTable.getVertexShaderCallback()(n),n=Primitive._appendDistanceDisplayConditionToShader(r,n),n=Primitive._modifyShaderPosition(e,n,t.scene3DOnly),n=Primitive._updateColorAttribute(r,n);var a=e._hasPlanarExtentsAttributes,o=a||e._hasSphericalExtentsAttribute;e._extruded&&(n=modifyForEncodedNormals$1(r,n));var s=e._extruded?"EXTRUDED_GEOMETRY":"",l="ENABLE_GL_POSITION_LOG_DEPTH_AT_HEIGHT",c=new ShaderSource({defines:[s,l],sources:[n]}),u=new ShaderSource({sources:[ShadowVolumeFS]}),d=e._primitive._attributeLocations,h=new ShadowVolumeAppearance(o,a,e.appearance,i.floatTextureSixPlaces);if(e._spStencil=ShaderProgram.replaceCache({context:i,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:d}),e._primitive.allowPicking){var p=ShaderSource.createPickVertexShaderSource(n);p=Primitive._appendShowToShader(r,p),p=Primitive._updatePickColorAttribute(p);var m=h.createPickFragmentShader(!1),f=h.createPickVertexShader([s,l],p,!1,t.mapProjection);if(e._spPick=ShaderProgram.replaceCache({context:i,shaderProgram:e._spPick,vertexShaderSource:f,fragmentShaderSource:m,attributeLocations:d}),o){var g=i.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!defined(g)){var _=h.createPickFragmentShader(!0),y=h.createPickVertexShader([s,l],p,!0,t.mapProjection);g=i.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:y,fragmentShaderSource:_,attributeLocations:d})}e._spPick2D=g}}else e._spPick=ShaderProgram.fromCache({context:i,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:d});c=new ShaderSource({defines:[s,l],sources:[n=Primitive._appendShowToShader(r,n)]}),e._sp=ShaderProgram.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:d});var v=h.createFragmentShader(!1),C=h.createVertexShader([s,l],n,!1,t.mapProjection);if(e._spColor=ShaderProgram.replaceCache({context:i,shaderProgram:e._spColor,vertexShaderSource:C,fragmentShaderSource:v,attributeLocations:d}),o){var S=i.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!defined(S)){var x=h.createFragmentShader(!0),T=h.createVertexShader([s,l],n,!0,t.mapProjection);S=i.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:T,fragmentShaderSource:x,attributeLocations:d})}e._spColor2D=S}}function createColorCommands(e,t){var i,r,n,a=e._primitive,o=3*a._va.length;t.length=o;var s=0,l=a._batchTable.getUniformMapCallback()(e._uniformMap),c=e._needs2DShader;for(i=0;i<o;i+=3){var u=a._va[s++];defined(r=t[i])||(r=t[i]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),r.vertexArray=u,r.renderState=e._rsStencilPreloadPass,r.shaderProgram=e._sp,r.uniformMap=l,r.pass=Pass$1.TERRAIN_CLASSIFICATION,(n=DrawCommand.shallowClone(r,r.derivedCommands.tileset)).renderState=e._rsStencilPreloadPass3DTiles,n.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=n,defined(r=t[i+1])||(r=t[i+1]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),r.vertexArray=u,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=l,r.pass=Pass$1.TERRAIN_CLASSIFICATION,(n=DrawCommand.shallowClone(r,r.derivedCommands.tileset)).renderState=e._rsStencilDepthPass3DTiles,n.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=n,defined(r=t[i+2])||(r=t[i+2]=new DrawCommand({owner:e,primitiveType:a._primitiveType})),r.vertexArray=u,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Pass$1.TERRAIN_CLASSIFICATION;var d=e.appearance.material;if(defined(d)&&(l=combine(l,d._uniforms)),r.uniformMap=l,(n=DrawCommand.shallowClone(r,r.derivedCommands.tileset)).pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=n,c){var h=DrawCommand.shallowClone(r,r.derivedCommands.appearance2D);h.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=h,(h=DrawCommand.shallowClone(n,n.derivedCommands.appearance2D)).shaderProgram=e._spColor2D,n.derivedCommands.appearance2D=h}}var p=e._commandsIgnoreShow,m=e._spStencil,f=0;o=p.length=o/3*2;for(var g=0;g<o;g+=2){var _=p[g]=DrawCommand.shallowClone(t[f],p[g]);_.shaderProgram=m,_.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,(_=p[g+1]=DrawCommand.shallowClone(t[f+1],p[g+1])).shaderProgram=m,_.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,f+=3}}function createPickCommands(e,t){var i,r,n,a,o,s=e._usePickOffsets,l=e._primitive,c=3*l._va.length,u=0;s&&(c=3*(i=l._pickOffsets).length),t.length=c;var d=0,h=l._batchTable.getUniformMapCallback()(e._uniformMap),p=e._needs2DShader;for(n=0;n<c;n+=3){var m=l._va[d++];if(s&&(r=i[u++],m=l._va[r.index]),defined(a=t[n])||(a=t[n]=new DrawCommand({owner:e,primitiveType:l._primitiveType,pickOnly:!0})),a.vertexArray=m,a.renderState=e._rsStencilPreloadPass,a.shaderProgram=e._sp,a.uniformMap=h,a.pass=Pass$1.TERRAIN_CLASSIFICATION,s&&(a.offset=r.offset,a.count=r.count),(o=DrawCommand.shallowClone(a,a.derivedCommands.tileset)).renderState=e._rsStencilPreloadPass3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=o,defined(a=t[n+1])||(a=t[n+1]=new DrawCommand({owner:e,primitiveType:l._primitiveType,pickOnly:!0})),a.vertexArray=m,a.renderState=e._rsStencilDepthPass,a.shaderProgram=e._sp,a.uniformMap=h,a.pass=Pass$1.TERRAIN_CLASSIFICATION,s&&(a.offset=r.offset,a.count=r.count),(o=DrawCommand.shallowClone(a,a.derivedCommands.tileset)).renderState=e._rsStencilDepthPass3DTiles,o.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=o,defined(a=t[n+2])||(a=t[n+2]=new DrawCommand({owner:e,primitiveType:l._primitiveType,pickOnly:!0})),a.vertexArray=m,a.renderState=e._rsPickPass,a.shaderProgram=e._spPick,a.uniformMap=h,a.pass=Pass$1.TERRAIN_CLASSIFICATION,s&&(a.offset=r.offset,a.count=r.count),(o=DrawCommand.shallowClone(a,a.derivedCommands.tileset)).pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=o,p){var f=DrawCommand.shallowClone(a,a.derivedCommands.pick2D);f.shaderProgram=e._spPick2D,a.derivedCommands.pick2D=f,(f=DrawCommand.shallowClone(o,o.derivedCommands.pick2D)).shaderProgram=e._spPick2D,o.derivedCommands.pick2D=f}}}function createCommands$1(e,t,i,r,n,a,o){createColorCommands(e,a),createPickCommands(e,o)}function boundingVolumeIndex(e,t){return Math.floor(e%t/3)}function updateAndQueueRenderCommand(e,t,i,r,n,a){e.modelMatrix=i,e.boundingVolume=n,e.cull=r,e.debugShowBoundingVolume=a,t.commandList.push(e)}function updateAndQueuePickCommand(e,t,i,r,n){e.modelMatrix=i,e.boundingVolume=n,e.cull=r,t.commandList.push(e)}function updateAndQueueCommands$1(e,t,i,r,n,a,o,s){var l,c=e._primitive;Primitive._updateBoundingVolumes(c,t,n),t.mode===SceneMode$1.SCENE3D?l=c._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?l=c._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(c._boundingSphere2D)?l=c._boundingSphere2D:defined(c._boundingSphereMorph)&&(l=c._boundingSphereMorph);var u,d,h=e.classificationType,p=h!==ClassificationType$1.CESIUM_3D_TILE,m=h!==ClassificationType$1.TERRAIN,f=t.passes;if(f.render){var g=i.length;for(u=0;u<g;++u)d=l[boundingVolumeIndex(u,g)],p&&updateAndQueueRenderCommand(i[u],t,n,a,d,o),m&&updateAndQueueRenderCommand(i[u].derivedCommands.tileset,t,n,a,d,o);if(t.invertClassification){var _=e._commandsIgnoreShow,y=_.length;for(u=0;u<y;++u)d=l[Math.floor(u/2)],updateAndQueueRenderCommand(_[u],t,n,a,d,o)}}if(f.pick){var v=r.length,C=c._pickOffsets;for(u=0;u<v;++u){d=l[C[boundingVolumeIndex(u,v)].index],p&&updateAndQueuePickCommand(r[u],t,n,a,d),m&&updateAndQueuePickCommand(r[u].derivedCommands.tileset,t,n,a,d)}}}ClassificationPrimitive.prototype.update=function(e){if(defined(this._primitive)||defined(this.geometryInstances)){var t=this.appearance;defined(t)&&defined(t.material)&&t.material.update(e.context);var l=this,i=this._primitiveOptions;if(!defined(this._primitive)){var r,n,a,o,s=isArray$1(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=s.length,u=!1,d=!0,h=!1,p=!1;for(0<c&&(a=s[0].attributes,h=ShadowVolumeAppearance.hasAttributesForSphericalExtents(a),p=ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes(a),o=a.color),r=0;r<c;r++){var m=(n=s[r]).attributes.color;defined(m)&&(u=!0),d=d&&defined(m)&&ColorGeometryInstanceAttribute.equals(o,m)}if(!d&&!h&&!p)throw new DeveloperError("All GeometryInstances must have the same color attribute except via GroundPrimitives");u&&!defined(t)&&(t=new PerInstanceColorAppearance({flat:!0}),this.appearance=t),this._usePickOffsets=!h&&!p,this._hasSphericalExtentsAttribute=h,this._hasPlanarExtentsAttributes=p,this._hasPerColorAttribute=u;var f=new Array(c);for(r=0;r<c;++r)n=s[r],f[r]=new GeometryInstance({geometry:n.geometry,attributes:n.attributes,modelMatrix:n.modelMatrix,id:n.id,pickPrimitive:defaultValue(this._pickPrimitive,l)});i.appearance=t,i.geometryInstances=f,defined(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(e,t){l._createBoundingVolumeFunction(e,t)}),i._createRenderStatesFunction=function(e,t,i,r){createRenderStates$1(l)},i._createShaderProgramFunction=function(e,t,i){createShaderProgram$1(l,t)},i._createCommandsFunction=function(e,t,i,r,n,a,o){createCommands$1(l,void 0,void 0,!0,!1,a,o)},defined(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(e,t,i,r,n,a,o,s){l._updateAndQueueCommandsFunction(e,t,i,r,n,a,o,s)}:i._updateAndQueueCommandsFunction=function(e,t,i,r,n,a,o,s){updateAndQueueCommands$1(l,t,i,r,n,a,o)},this._primitive=new Primitive(i),this._primitive.readyPromise.then(function(e){l._ready=!0,l.releaseGeometryInstances&&(l.geometryInstances=void 0);var t=e._error;defined(t)?l._readyPromise.reject(t):l._readyPromise.resolve(l)})}this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilPreloadPass=RenderState.fromCache(getStencilPreloadRenderState(!1,!1)),this._rsStencilPreloadPass3DTiles=RenderState.fromCache(getStencilPreloadRenderState(!1,!0)),this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState(!1,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState(!1,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilPreloadPass=RenderState.fromCache(getStencilPreloadRenderState(!0,!1)),this._rsStencilPreloadPass3DTiles=RenderState.fromCache(getStencilPreloadRenderState(!0,!0)),this._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState(!0,!1)),this._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState(!0,!0)),this._rsColorPass=RenderState.fromCache(getColorRenderState(!0))),this._primitive.appearance!==t&&(this._primitive.appearance=t),this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}},ClassificationPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},ClassificationPrimitive.prototype.isDestroyed=function(){return!1},ClassificationPrimitive.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,destroyObject(this)};var GroundPrimitiveUniformMap={u_globeMinimumAltitude:function(){return 55e3}};function GroundPrimitive(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).appearance,i=e.geometryInstances;if(!defined(t)&&defined(i))for(var r=isArray$1(i)?i:[i],n=r.length,a=0;a<n;a++){var o=r[a].attributes;if(defined(o)&&defined(o.color)){t=new PerInstanceColorAppearance({flat:!0});break}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=ApproximateTerrainHeights._defaultMaxTerrainHeight,this._minTerrainHeight=ApproximateTerrainHeights._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:defaultValue(e.vertexCacheOptimize,!1),interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:defaultValue(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:this,_extruded:!0,_uniformMap:GroundPrimitiveUniformMap}}function getComputeMaximumHeightFunction(n){return function(e,t){var i=t.maximumRadius,r=i/Math.cos(.5*e)-i;return n._maxHeight+r}}function getComputeMinimumHeightFunction(i){return function(e,t){return i._minHeight}}defineProperties$1(GroundPrimitive.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}},readyPromise:{get:function(){return this._readyPromise.promise}}}),GroundPrimitive.isSupported=ClassificationPrimitive.isSupported;var scratchBVCartesianHigh=new Cartesian3,scratchBVCartesianLow=new Cartesian3,scratchBVCartesian=new Cartesian3,scratchBVCartographic=new Cartographic,scratchBVRectangle=new Rectangle;function getRectangle(e,t){var i=e.mapProjection.ellipsoid;if(!defined(t.attributes)||!defined(t.attributes.position3DHigh))return defined(t.rectangle)?t.rectangle:void 0;for(var r=t.attributes.position3DHigh.values,n=t.attributes.position3DLow.values,a=r.length,o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=0;u<a;u+=3){var d=Cartesian3.unpack(r,u,scratchBVCartesianHigh),h=Cartesian3.unpack(n,u,scratchBVCartesianLow),p=Cartesian3.add(d,h,scratchBVCartesian),m=i.cartesianToCartographic(p,scratchBVCartographic),f=m.latitude,g=m.longitude;o=Math.min(o,f),s=Math.min(s,g),l=Math.max(l,f),c=Math.max(c,g)}var _=scratchBVRectangle;return _.north=l,_.south=o,_.east=c,_.west=s,_}function setMinMaxTerrainHeights(e,t,i){var r=ApproximateTerrainHeights.getMinimumMaximumHeights(t,i);e._minTerrainHeight=r.minimumTerrainHeight,e._maxTerrainHeight=r.maximumTerrainHeight}function createBoundingVolume(e,t,i){var r=t.mapProjection.ellipsoid,n=getRectangle(t,i);if(n.width<CesiumMath.PI){var a=OrientedBoundingBox.fromRectangle(n,e._maxHeight,e._minHeight,r);e._boundingVolumes.push(a)}else{var o=i.attributes.position3DHigh.values,s=i.attributes.position3DLow.values;e._boundingVolumes.push(BoundingSphere.fromEncodedCartesianVertices(o,s))}if(!t.scene3DOnly){var l=t.mapProjection,c=BoundingSphere.fromRectangleWithHeights2D(n,l,e._maxHeight,e._minHeight);Cartesian3.fromElements(c.center.z,c.center.x,c.center.y,c.center),e._boundingVolumes2D.push(c)}}function boundingVolumeIndex$1(e,t){return Math.floor(e%t/3)}function updateAndQueueRenderCommand$1(e,t,i,r,n,a,o){var s=e._primitive;i.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===s._spColor&&s._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=r,t.boundingVolume=a,t.cull=n,t.debugShowBoundingVolume=o,i.commandList.push(t)}function updateAndQueuePickCommand$1(e,t,i,r,n,a){var o=e._primitive;i.mode!==SceneMode$1.SCENE3D&&t.shaderProgram===o._spPick&&o._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=r,t.boundingVolume=a,t.cull=n,i.commandList.push(t)}function updateAndQueueCommands$2(e,t,i,r,n,a,o,s){var l;l=t.mode===SceneMode$1.SCENE3D?e._boundingVolumes:e._boundingVolumes2D;var c,u,d=e.classificationType,h=d!==ClassificationType$1.CESIUM_3D_TILE,p=d!==ClassificationType$1.TERRAIN,m=t.passes,f=e._primitive;if(m.render){var g=i.length;for(c=0;c<g;++c)u=l[boundingVolumeIndex$1(c,g)],h&&updateAndQueueRenderCommand$1(e,i[c],t,n,a,u,o),p&&updateAndQueueRenderCommand$1(e,i[c].derivedCommands.tileset,t,n,a,u,o);if(t.invertClassification){var _=f._commandsIgnoreShow,y=_.length;for(c=0;c<y;++c)u=l[Math.floor(c/2)],updateAndQueueRenderCommand$1(e,_[c],t,n,a,u,o)}}if(m.pick){var v,C=r.length;for(e._useFragmentCulling||(v=f._primitive._pickOffsets),c=0;c<C;++c){if(u=l[boundingVolumeIndex$1(c,C)],!e._useFragmentCulling)u=l[v[boundingVolumeIndex$1(c,C)].index];h&&updateAndQueuePickCommand$1(e,r[c],t,n,a,u),p&&updateAndQueuePickCommand$1(e,r[c].derivedCommands.tileset,t,n,a,u)}}}function MaterialProperty(){DeveloperError.throwInstantiationError()}function DynamicGeometryUpdater(e,t,i){this._primitives=t,this._orderedGroundPrimitives=i,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}GroundPrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPrimitive.prototype.update=function(e){if(defined(this._primitive)||defined(this.geometryInstances))if(ApproximateTerrainHeights.initialized){var l=this,t=this._classificationPrimitiveOptions;if(!defined(this._primitive)){var i,r,n,a,o,s=e.mapProjection.ellipsoid,c=isArray$1(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],u=c.length,d=new Array(u);for(a=0;a<u;++a){var h=getRectangle(e,r=(i=c[a]).geometry);defined(o)?defined(h)&&Rectangle.union(o,h,o):o=Rectangle.clone(h);var p=i.id;if(defined(p)&&defined(h)){var m=ApproximateTerrainHeights.getBoundingSphere(h,s);this._boundingSpheresKeys.push(p),this._boundingSpheres.push(m)}defined(n=r.constructor)&&defined(n.createShadowVolume)}setMinMaxTerrainHeights(this,o,s);var f=e.terrainExaggeration;this._minHeight=this._minTerrainHeight*f,this._maxHeight=this._maxTerrainHeight*f;var g=GroundPrimitive._supportsMaterials(e.context);if(this._useFragmentCulling=g){var _,y=!0;for(a=0;a<u;++a)if(o=getRectangle(e,r=(i=c[a]).geometry),ShadowVolumeAppearance.shouldUseSphericalCoordinates(o)){y=!1;break}for(a=0;a<u;++a){n=(r=(i=c[a]).geometry).constructor;var v=getRectangle(e,r),C=r.textureCoordinateRotationPoints,S=e.context.floatTextureSixPlaces;_=y?ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes(v,C,s,e.mapProjection,S,this._maxHeight):ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes(v,C,s,e.mapProjection,S);var x=i.attributes;for(var T in x)x.hasOwnProperty(T)&&(_[T]=x[T]);d[a]=new GeometryInstance({geometry:n.createShadowVolume(r,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:_,id:i.id})}}else for(a=0;a<u;++a)n=(r=(i=c[a]).geometry).constructor,d[a]=new GeometryInstance({geometry:n.createShadowVolume(r,getComputeMinimumHeightFunction(this),getComputeMaximumHeightFunction(this)),attributes:i.attributes,id:i.id});t.geometryInstances=d,t.appearance=this.appearance,t._createBoundingVolumeFunction=function(e,t){createBoundingVolume(l,e,t)},t._updateAndQueueCommandsFunction=function(e,t,i,r,n,a,o,s){updateAndQueueCommands$2(l,t,i,r,n,a,o)},this._primitive=new ClassificationPrimitive(t),this._primitive.readyPromise.then(function(e){l._ready=!0,l.releaseGeometryInstances&&(l.geometryInstances=void 0);var t=e._error;defined(t)?l._readyPromise.reject(t):l._readyPromise.resolve(l)})}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}else GroundPrimitive.initializeTerrainHeights()},GroundPrimitive.prototype.getBoundingSphere=function(e){var t=this._boundingSpheresKeys.indexOf(e);if(-1!==t)return this._boundingSpheres[t]},GroundPrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPrimitive.prototype.isDestroyed=function(){return!1},GroundPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},GroundPrimitive._supportsMaterials=function(e){return e.depthTexture},GroundPrimitive.supportsMaterials=function(e){return GroundPrimitive._supportsMaterials(e.frameState.context)},defineProperties$1(MaterialProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError}}),MaterialProperty.prototype.getType=DeveloperError.throwInstantiationError,MaterialProperty.prototype.getValue=DeveloperError.throwInstantiationError,MaterialProperty.prototype.equals=DeveloperError.throwInstantiationError,MaterialProperty.getValue=function(e,t,i){var r;return defined(t)&&defined(r=t.getType(e))?(defined(i)&&i.type===r||(i=Material.fromType(r)),t.getValue(e,i.uniforms)):(defined(i)&&i.type===Material.ColorType||(i=Material.fromType(Material.ColorType)),Color.clone(Color.WHITE,i.uniforms.color)),i},DynamicGeometryUpdater.prototype._isHidden=function(e,t,i){return!e.isShowing||!e.isAvailable(i)||!Property.getValueOrDefault(t.show,i,!0)},DynamicGeometryUpdater.prototype._setOptions=DeveloperError.throwInstantiationError,DynamicGeometryUpdater.prototype.update=function(e){var t=this._geometryUpdater,i=t._onTerrain,r=this._primitives,n=this._orderedGroundPrimitives;i?n.remove(this._primitive):(r.removeAndDestroy(this._primitive),r.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;var a=this._entity,o=a[this._geometryUpdater._geometryPropertyName];if(this._setOptions(a,o,e),!this._isHidden(a,o,e)){var s=this._geometryUpdater.shadowsProperty.getValue(e),l=this._options;if(!defined(o.fill)||o.fill.getValue(e)){var c,u=t.fillMaterialProperty,d=u instanceof ColorMaterialProperty,h=t._getIsClosed(l);if(d)c=new PerInstanceColorAppearance({closed:h,flat:i&&!t._supportsMaterialsforEntitiesOnTerrain});else{var p=MaterialProperty.getValue(e,u,this._material);c=new MaterialAppearance({material:this._material=p,translucent:p.isTranslucent(),closed:h})}if(i)l.vertexFormat=PerInstanceColorAppearance.VERTEX_FORMAT,this._primitive=n.add(new GroundPrimitive({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:c,asynchronous:!1,shadows:s,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Property.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{l.vertexFormat=c.vertexFormat;var m=this._geometryUpdater.createFillGeometryInstance(e);d&&(c.translucent=255!==m.attributes.color.value[3]),this._primitive=r.add(new Primitive({geometryInstances:m,appearance:c,asynchronous:!1,shadows:s}))}}if(!i&&defined(o.outline)&&o.outline.getValue(e)){var f=this._geometryUpdater.createOutlineGeometryInstance(e),g=Property.getValueOrDefault(o.outlineWidth,e,1);this._outlinePrimitive=r.add(new Primitive({geometryInstances:f,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==f.attributes.color.value[3],renderState:{lineWidth:t._scene.clampLineWidth(g)}}),asynchronous:!1,shadows:s}))}}},DynamicGeometryUpdater.prototype.getBoundingSphere=function(e){var t,i=this._entity,r=this._primitive,n=this._outlinePrimitive;return defined(r)&&r.show&&r.ready&&defined(t=r.getGeometryInstanceAttributes(i))&&defined(t.boundingSphere)?(BoundingSphere.clone(t.boundingSphere,e),BoundingSphereState$1.DONE):defined(n)&&n.show&&n.ready&&defined(t=n.getGeometryInstanceAttributes(i))&&defined(t.boundingSphere)?(BoundingSphere.clone(t.boundingSphere,e),BoundingSphereState$1.DONE):defined(r)&&!r.ready||defined(n)&&!n.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.FAILED},DynamicGeometryUpdater.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater.prototype.destroy=function(){var e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),destroyObject(this)};var PolylineShadowVolumeFS="#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main(void)\n{\nfloat logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\nvec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);\nif (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);\nfloat widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\nfloat distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);\nfloat distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);\nif (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\nreturn;\n#else // DEBUG_SHOW_VOLUME\ndiscard;\n#endif // DEBUG_SHOW_VOLUME\n}\nvec3 alignedPlaneNormal;\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);\nalignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);\nalignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\ndistanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);\ns = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;\nfloat t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, t);\nmaterialInput.str = vec3(s, t, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\nczm_writeDepthClampedToFarPlane();\n}\n",PolylineShadowVolumeMorphFS="varying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nfloat rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {\nreturn (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);\n}\nvoid main(void)\n{\nvec4 eyeCoordinate = gl_FragCoord;\neyeCoordinate /= eyeCoordinate.w;\n#ifdef PER_INSTANCE_COLOR\ngl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\nfloat distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);\nfloat distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);\ndistanceFromStart = max(0.0, distanceFromStart);\ndistanceFromEnd = max(0.0, distanceFromEnd);\nfloat s = distanceFromStart / (distanceFromStart + distanceFromEnd);\ns = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;\nczm_materialInput materialInput;\nmaterialInput.s = s;\nmaterialInput.st = vec2(s, v_texcoordT);\nmaterialInput.str = vec3(s, v_texcoordT, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n}\n",PolylineShadowVolumeMorphVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\nattribute float batchId;\nvarying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\nvoid main()\n{\nv_batchId = batchId;\nvec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));\nvec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);\nvec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nvec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nvec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec4 startPlane2D;\nvec4 startPlane3D;\nstartPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlane2D.w = -dot(startPlane2D.xyz, posEc2D);\nstartPlane3D.w = -dot(startPlane3D.xyz, posEc3D);\nvec4 rightPlane2D;\nvec4 rightPlane3D;\nrightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nrightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nrightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);\nrightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);\nposRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);\nposRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);\nposRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\nposEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\nposEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\nvec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\nvec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));\nvec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));\nvec4 endPlane2D;\nvec4 endPlane3D;\nendPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlane2D.w = -dot(endPlane2D.xyz, posEc2D);\nendPlane3D.w = -dot(endPlane3D.xyz, posEc3D);\nv_forwardDirectionEC = normalize(endEC - startEC);\nvec2 cleanTexcoordNormalization2D;\ncleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);\ncleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));\nvec2 cleanTexcoordNormalization3D;\ncleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\ncleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;\ncleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));\nv_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#else // PER_INSTANCE_COLOR\nv_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);\nv_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);\n#endif // PER_INSTANCE_COLOR\n#ifdef WIDTH_VARYING\nfloat width = czm_batchTable_width(batchId);\nfloat halfWidth = width * 0.5;\nv_width = width;\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#else\nfloat halfWidth = 0.5 * czm_batchTable_width(batchId);\nv_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#endif\nvec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);\nvec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nvec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));\ngeodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc3D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\npositionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC;\nvec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nabsStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));\nabsEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));\nplaneDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);\nupOrDown = normalize(cross(rightPlane2D.xyz, planeDirection));\nnormalEC = normalize(cross(planeDirection, upOrDown));\ngeodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));\ngeodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);\ngeodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\npositionEc2D.xyz += geodeticSurfaceNormal;\nnormalEC *= sign(texcoordNormalization2D.x);\n#ifndef PER_INSTANCE_COLOR\nv_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);\n#endif\npositionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC;\ngl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineShadowVolumeVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\n#ifndef COLUMBUS_VIEW_2D\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\n#else\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\n#endif\nattribute float batchId;\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\nvoid main()\n{\n#ifdef COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;\nvec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);\nvec3 ecEnd = forwardDirectionEC + ecStart;\nforwardDirectionEC = normalize(forwardDirectionEC);\nv_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nvec4 startPlaneEC;\nstartPlaneEC.xyz =  czm_normal * vec3(0.0, startEndNormals2D.xy);\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz =  czm_normal * vec3(0.0, startEndNormals2D.zw);\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);\nv_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;\n#else // COLUMBUS_VIEW_2D\nvec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;\nvec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);\nvec3 ecEnd = ecStart + offset;\nvec3 forwardDirectionEC = normalize(offset);\nvec4 startPlaneEC;\nstartPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\nstartPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\nvec4 endPlaneEC;\nendPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\nendPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\nv_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\nv_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\nv_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\nv_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;\n#endif // COLUMBUS_VIEW_2D\nv_endEcAndStartEcX.xyz = ecEnd;\nv_endEcAndStartEcX.w = ecStart.x;\nv_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;\n#ifdef PER_INSTANCE_COLOR\nv_color = czm_batchTable_color(batchId);\n#endif // PER_INSTANCE_COLOR\nvec4 positionRelativeToEye = czm_computePosition();\nvec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye;\nfloat absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));\nfloat absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));\nvec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);\nvec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection));\nvec3 normalEC = normalize(cross(planeDirection, upOrDown));\nupOrDown = cross(forwardDirectionEC, normalEC);\nupOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;\nupOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;\nupOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;\npositionEC.xyz += upOrDown;\nv_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));\nfloat width = czm_batchTable_width(batchId);\n#ifdef WIDTH_VARYING\nv_width = width;\n#endif\nv_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;\nv_startPlaneNormalEcAndHalfWidth.w = width * 0.5;\nv_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;\nv_endPlaneNormalEcAndBatchId.w = batchId;\nwidth = width * max(0.0, czm_metersPerPixel(positionEC));\nwidth = width / dot(normalEC, v_rightPlaneEC.xyz);\n#ifdef COLUMBUS_VIEW_2D\nnormalEC *= sign(texcoordNormalization2D.x);\n#else\nnormalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n#endif\npositionEC.xyz += width * normalEC;\ngl_Position = czm_depthClampFarPlane(czm_projection * positionEC);\n#ifdef ANGLE_VARYING\nvec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));\napproxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\nv_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n",PolylineColorAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_color = color;\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n#endif\n}\n",PolylineCommon="void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance =  -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n{\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\n#ifdef POLYLINE_DASH\nvec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\nvec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\nvec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\nvec2 lineDir;\nif (usePrevious) {\nlineDir = normalize(positionWindow.xy - previousWindow.xy);\n}\nelse {\nlineDir = normalize(nextWindow.xy - positionWindow.xy);\n}\nangle = atan(lineDir.x, lineDir.y) - 1.570796327;\nangle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n#endif\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\n#ifdef CLIP_POLYLINE\nif (clipped)\n{\nif (prevEC.z - positionEC.z < 0.0)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\ndirection = vec2(-prevWC.y, prevWC.x);\n}\n}\nelse\n#endif\nif (czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDirection * expandWidth * czm_pixelRatio;\nreturn vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n{\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nreturn getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n}\n",defaultVertexShaderSource=PolylineCommon+"\n"+PolylineColorAppearanceVS,defaultFragmentShaderSource=PerInstanceFlatColorAppearanceFS;function PolylineColorAppearance(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucent,!0),i=PolylineColorAppearance.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource),this._renderState=Appearance.getDefaultRenderState(t,!1,e.renderState),this._closed=!1,this._vertexFormat=i}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource="#define CLIP_POLYLINE \n"+defaultVertexShaderSource),defineProperties$1(PolylineColorAppearance.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}}}),PolylineColorAppearance.VERTEX_FORMAT=VertexFormat.POSITION_ONLY,PolylineColorAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineColorAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineColorAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;var PolylineMaterialAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nattribute float batchId;\nvarying float v_width;\nvarying vec2 v_st;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_width = width;\nv_st = st;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);\ngl_Position = czm_viewportOrthographic * positionWC;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n#endif\n}\n",PolylineFS="#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#ifdef VECTOR_TILE\ngl_FragColor *= u_highlightColor;\n#endif\nczm_writeLogDepth();\n}\n",defaultVertexShaderSource$1=PolylineCommon+"\n"+PolylineMaterialAppearanceVS,defaultFragmentShaderSource$1=PolylineFS;function PolylineMaterialAppearance(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucent,!0),i=PolylineMaterialAppearance.VERTEX_FORMAT;this.material=defined(e.material)?e.material:Material.fromType(Material.ColorType),this.translucent=t,this._vertexShaderSource=defaultValue(e.vertexShaderSource,defaultVertexShaderSource$1),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,defaultFragmentShaderSource$1),this._renderState=Appearance.getDefaultRenderState(t,!1,e.renderState),this._closed=!1,this._vertexFormat=i}function GroundPolylinePrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;var t=e.appearance;defined(t)||(t=new PolylineMaterialAppearance),this.appearance=t,this.show=defaultValue(e.show,!0),this.classificationType=defaultValue(e.classificationType,ClassificationType$1.BOTH),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=defaultValue(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:defaultValue(e.interleave,!1),releaseGeometryInstances:defaultValue(e.releaseGeometryInstances,!0),allowPicking:defaultValue(e.allowPicking,!0),asynchronous:defaultValue(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._readyPromise=when.defer(),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=getRenderState(!1),this._renderState3DTiles=getRenderState(!0),this._renderStateMorph=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:!0},blending:BlendingState$1.ALPHA_BLEND,depthMask:!1})}function createShaderProgram$2(e,t,i){var r=t.context,n=e._primitive,a=n._attributeLocations,o=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeVS);o=Primitive._appendShowToShader(n,o),o=Primitive._appendDistanceDisplayConditionToShader(n,o),o=Primitive._modifyShaderPosition(e,o,t.scene3DOnly);var s=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphVS);s=Primitive._appendShowToShader(n,s),s=Primitive._appendDistanceDisplayConditionToShader(n,s),s=Primitive._modifyShaderPosition(e,s,t.scene3DOnly);var l=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeFS),c=["ENABLE_GL_POSITION_LOG_DEPTH_AT_HEIGHT","GLOBE_MINIMUM_ALTITUDE "+t.mapProjection.ellipsoid.minimumRadius.toFixed(1)],u="",d="";defined(i.material)?(-1!==(d=defined(i.material)?i.material.shaderSource:"").search(/varying\s+float\s+v_polylineAngle;/g)&&c.push("ANGLE_VARYING"),-1!==d.search(/varying\s+float\s+v_width;/g)&&c.push("WIDTH_VARYING")):u="PER_INSTANCE_COLOR",c.push(u);var h=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",u]:[u],p=new ShaderSource({defines:c,sources:[o]}),m=new ShaderSource({defines:h,sources:[d,l]});e._sp=ShaderProgram.replaceCache({context:r,shaderProgram:n._sp,vertexShaderSource:p,fragmentShaderSource:m,attributeLocations:a});var f=r.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!defined(f)){var g=new ShaderSource({defines:c.concat(["COLUMBUS_VIEW_2D"]),sources:[o]});f=r.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:r,shaderProgram:e._sp2D,vertexShaderSource:g,fragmentShaderSource:m,attributeLocations:a})}e._sp2D=f;var _=r.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!defined(_)){var y=new ShaderSource({defines:c.concat(["MAX_TERRAIN_HEIGHT "+ApproximateTerrainHeights._defaultMaxTerrainHeight.toFixed(1)]),sources:[s]}),v=new ShaderSource({defines:h,sources:[d,l=n._batchTable.getVertexShaderCallback()(PolylineShadowVolumeMorphFS)]});_=r.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:r,shaderProgram:e._spMorph,vertexShaderSource:y,fragmentShaderSource:v,attributeLocations:a})}e._spMorph=_}function getRenderState(e){return RenderState.fromCache({cull:{enabled:!0},blending:BlendingState$1.ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})}function createCommands$2(e,t,i,r,n,a){var o=e._primitive,s=o._va.length;n.length=s,a.length=s;for(var l=t instanceof PolylineColorAppearance?{}:i._uniforms,c=o._batchTable.getUniformMapCallback()(l),u=0;u<s;u++){var d=o._va[u],h=n[u];defined(h)||(h=n[u]=new DrawCommand({owner:e,primitiveType:o._primitiveType})),h.vertexArray=d,h.renderState=e._renderState,h.shaderProgram=e._sp,h.uniformMap=c,h.pass=Pass$1.TERRAIN_CLASSIFICATION,h.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";var p=DrawCommand.shallowClone(h,h.derivedCommands.tileset);p.renderState=e._renderState3DTiles,p.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,h.derivedCommands.tileset=p;var m=DrawCommand.shallowClone(h,h.derivedCommands.color2D);m.shaderProgram=e._sp2D,h.derivedCommands.color2D=m;var f=DrawCommand.shallowClone(p,p.derivedCommands.color2D);f.shaderProgram=e._sp2D,p.derivedCommands.color2D=f;var g=DrawCommand.shallowClone(h,h.derivedCommands.colorMorph);g.renderState=e._renderStateMorph,g.shaderProgram=e._spMorph,g.pickId="czm_batchTable_pickColor(v_batchId)",h.derivedCommands.colorMorph=g}}function updateAndQueueCommand(e,t,i,r,n,a,o){i.mode===SceneMode$1.MORPHING?t=t.derivedCommands.colorMorph:i.mode!==SceneMode$1.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=r,t.boundingVolume=a,t.cull=n,t.debugShowBoundingVolume=o,i.commandList.push(t)}function updateAndQueueCommands$3(e,t,i,r,n,a,o){var s,l=e._primitive;Primitive._updateBoundingVolumes(l,t,n),t.mode===SceneMode$1.SCENE3D?s=l._boundingSphereWC:t.mode===SceneMode$1.COLUMBUS_VIEW?s=l._boundingSphereCV:t.mode===SceneMode$1.SCENE2D&&defined(l._boundingSphere2D)?s=l._boundingSphere2D:defined(l._boundingSphereMorph)&&(s=l._boundingSphereMorph);var c=t.mode===SceneMode$1.MORPHING,u=e.classificationType,d=u!==ClassificationType$1.CESIUM_3D_TILE,h=u!==ClassificationType$1.TERRAIN&&!c,p=t.passes;if(p.render||p.pick&&l.allowPicking)for(var m=i.length,f=0;f<m;++f){var g=s[f];d&&updateAndQueueCommand(e,i[f],t,n,a,g,o),h&&updateAndQueueCommand(e,i[f].derivedCommands.tileset,t,n,a,g,o)}}FeatureDetection.isInternetExplorer()||(defaultVertexShaderSource$1="#define CLIP_POLYLINE \n"+defaultVertexShaderSource$1),defineProperties$1(PolylineMaterialAppearance.prototype,{vertexShaderSource:{get:function(){var e=this._vertexShaderSource;return-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&(e="#define POLYLINE_DASH\n"+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}}}),PolylineMaterialAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,PolylineMaterialAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,PolylineMaterialAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,PolylineMaterialAppearance.prototype.getRenderState=Appearance.prototype.getRenderState,defineProperties$1(GroundPolylinePrimitive.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}},readyPromise:{get:function(){return this._readyPromise.promise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}}),GroundPolylinePrimitive.initializeTerrainHeights=function(){return ApproximateTerrainHeights.initialize()},GroundPolylinePrimitive.prototype.update=function(e){if(defined(this._primitive)||defined(this.geometryInstances))if(ApproximateTerrainHeights.initialized){var t,l=this,i=this._primitiveOptions;if(!defined(this._primitive)){var r,n=isArray$1(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],a=n.length,o=new Array(a);for(t=0;t<a;++t)if(!defined(r=n[t].attributes)||!defined(r.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<a;++t){var s=n[t];r={};var c=s.attributes;for(var u in c)c.hasOwnProperty(u)&&(r[u]=c[u]);defined(r.width)||(r.width=new GeometryInstanceAttribute({componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:1,value:[s.geometry.width]})),s.geometry._scene3DOnly=e.scene3DOnly,GroundPolylineGeometry.setProjectionAndEllipsoid(s.geometry,e.mapProjection),o[t]=new GeometryInstance({geometry:s.geometry,attributes:r,id:s.id,pickPrimitive:l})}i.geometryInstances=o,i.appearance=this.appearance,i._createShaderProgramFunction=function(e,t,i){createShaderProgram$2(l,t,i)},i._createCommandsFunction=function(e,t,i,r,n,a,o){createCommands$2(l,t,i,r,a,o)},i._updateAndQueueCommandsFunction=function(e,t,i,r,n,a,o,s){updateAndQueueCommands$3(l,t,i,r,n,a,o)},this._primitive=new Primitive(i),this._primitive.readyPromise.then(function(e){l._ready=!0,l.releaseGeometryInstances&&(l.geometryInstances=void 0);var t=e._error;defined(t)?l._readyPromise.reject(t):l._readyPromise.resolve(l)})}if(this.appearance instanceof PolylineColorAppearance&&!this._hasPerInstanceColors)throw new DeveloperError("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)}else GroundPolylinePrimitive.initializeTerrainHeights()},GroundPolylinePrimitive.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},GroundPolylinePrimitive.isSupported=function(e){return e.frameState.context.depthTexture},GroundPolylinePrimitive.prototype.isDestroyed=function(){return!1},GroundPolylinePrimitive.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,destroyObject(this)};var defaultRepeat=new Cartesian2(1,1),defaultTransparent=!1,defaultColor$1=Color.WHITE;function ImageMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,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}function createMaterialProperty(e){if(e instanceof Color)return new ColorMaterialProperty(e);if("string"==typeof e||e instanceof Resource||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){var t=new ImageMaterialProperty;return t.image=e,t}}function createMaterialPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createMaterialProperty)}function BoxGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PositionProperty(){DeveloperError.throwInstantiationError()}defineProperties$1(ImageMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._image)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:createPropertyDescriptor("image"),repeat:createPropertyDescriptor("repeat"),color:createPropertyDescriptor("color"),transparent:createPropertyDescriptor("transparent")}),ImageMaterialProperty.prototype.getType=function(e){return"Image"},ImageMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.image=Property.getValueOrUndefined(this._image,e),t.repeat=Property.getValueOrClonedDefault(this._repeat,e,defaultRepeat,t.repeat),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$1,t.color),Property.getValueOrDefault(this._transparent,e,defaultTransparent)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t},ImageMaterialProperty.prototype.equals=function(e){return this===e||e instanceof ImageMaterialProperty&&Property.equals(this._image,e._image)&&Property.equals(this._repeat,e._repeat)&&Property.equals(this._color,e._color)&&Property.equals(this._transparent,e._transparent)},defineProperties$1(BoxGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),dimensions:createPropertyDescriptor("dimensions"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),BoxGraphics.prototype.clone=function(e){return defined(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 BoxGraphics(this)},BoxGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},defineProperties$1(PositionProperty.prototype,{isConstant:{get:DeveloperError.throwInstantiationError},definitionChanged:{get:DeveloperError.throwInstantiationError},referenceFrame:{get:DeveloperError.throwInstantiationError}}),PositionProperty.prototype.getValue=DeveloperError.throwInstantiationError,PositionProperty.prototype.getValueInReferenceFrame=DeveloperError.throwInstantiationError,PositionProperty.prototype.equals=DeveloperError.throwInstantiationError;var scratchMatrix3=new Matrix3;function ConstantPositionProperty(e,t){this._definitionChanged=new Event,this._value=Cartesian3.clone(e),this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED)}function CorridorGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createRawProperty(e){return e}function createRawPropertyDescriptor(e,t){return createPropertyDescriptor(e,t,createRawProperty)}function CylinderGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipseGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function EllipsoidGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function LabelGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}PositionProperty.convertToReferenceFrame=function(e,t,i,r,n){if(!defined(t))return t;if(defined(n)||(n=new Cartesian3),i===r)return Cartesian3.clone(t,n);var a=Transforms.computeIcrfToFixedMatrix(e,scratchMatrix3);return defined(a)||(a=Transforms.computeTemeToPseudoFixedMatrix(e,scratchMatrix3)),i===ReferenceFrame$1.INERTIAL?Matrix3.multiplyByVector(a,t,n):i===ReferenceFrame$1.FIXED?Matrix3.multiplyByVector(Matrix3.transpose(a,scratchMatrix3),t,n):void 0},defineProperties$1(ConstantPositionProperty.prototype,{isConstant:{get:function(){return!defined(this._value)||this._referenceFrame===ReferenceFrame$1.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),ConstantPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ConstantPositionProperty.prototype.setValue=function(e,t){var i=!1;Cartesian3.equals(this._value,e)||(i=!0,this._value=Cartesian3.clone(e)),defined(t)&&this._referenceFrame!==t&&(i=!0,this._referenceFrame=t),i&&this._definitionChanged.raiseEvent(this)},ConstantPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){return PositionProperty.convertToReferenceFrame(e,this._value,this._referenceFrame,t,i)},ConstantPositionProperty.prototype.equals=function(e){return this===e||e instanceof ConstantPositionProperty&&Cartesian3.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame},defineProperties$1(CorridorGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),CorridorGraphics.prototype.clone=function(e){return defined(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 CorridorGraphics(this)},CorridorGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},defineProperties$1(CylinderGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),length:createPropertyDescriptor("length"),topRadius:createPropertyDescriptor("topRadius"),bottomRadius:createPropertyDescriptor("bottomRadius"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),slices:createPropertyDescriptor("slices"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),CylinderGraphics.prototype.clone=function(e){return defined(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 CylinderGraphics(this)},CylinderGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.length=defaultValue(this.length,e.length),this.topRadius=defaultValue(this.topRadius,e.topRadius),this.bottomRadius=defaultValue(this.bottomRadius,e.bottomRadius),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=defaultValue(this.slices,e.slices),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},defineProperties$1(EllipseGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),semiMajorAxis:createPropertyDescriptor("semiMajorAxis"),semiMinorAxis:createPropertyDescriptor("semiMinorAxis"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),numberOfVerticalLines:createPropertyDescriptor("numberOfVerticalLines"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),EllipseGraphics.prototype.clone=function(e){return defined(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 EllipseGraphics(this)},EllipseGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.semiMajorAxis=defaultValue(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=defaultValue(this.semiMinorAxis,e.semiMinorAxis),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=defaultValue(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},defineProperties$1(EllipsoidGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),radii:createPropertyDescriptor("radii"),innerRadii:createPropertyDescriptor("innerRadii"),minimumClock:createPropertyDescriptor("minimumClock"),maximumClock:createPropertyDescriptor("maximumClock"),minimumCone:createPropertyDescriptor("minimumCone"),maximumCone:createPropertyDescriptor("maximumCone"),heightReference:createPropertyDescriptor("heightReference"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),stackPartitions:createPropertyDescriptor("stackPartitions"),slicePartitions:createPropertyDescriptor("slicePartitions"),subdivisions:createPropertyDescriptor("subdivisions"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),EllipsoidGraphics.prototype.clone=function(e){return defined(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 EllipsoidGraphics(this)},EllipsoidGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.radii=defaultValue(this.radii,e.radii),this.innerRadii=defaultValue(this.innerRadii,e.innerRadii),this.minimumClock=defaultValue(this.minimumClock,e.minimumClock),this.maximumClock=defaultValue(this.maximumClock,e.maximumClock),this.minimumCone=defaultValue(this.minimumCone,e.minimumCone),this.maximumCone=defaultValue(this.maximumCone,e.maximumCone),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.stackPartitions=defaultValue(this.stackPartitions,e.stackPartitions),this.slicePartitions=defaultValue(this.slicePartitions,e.slicePartitions),this.subdivisions=defaultValue(this.subdivisions,e.subdivisions),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},defineProperties$1(LabelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),text:createPropertyDescriptor("text"),font:createPropertyDescriptor("font"),style:createPropertyDescriptor("style"),scale:createPropertyDescriptor("scale"),showBackground:createPropertyDescriptor("showBackground"),backgroundColor:createPropertyDescriptor("backgroundColor"),backgroundPadding:createPropertyDescriptor("backgroundPadding"),pixelOffset:createPropertyDescriptor("pixelOffset"),eyeOffset:createPropertyDescriptor("eyeOffset"),horizontalOrigin:createPropertyDescriptor("horizontalOrigin"),verticalOrigin:createPropertyDescriptor("verticalOrigin"),heightReference:createPropertyDescriptor("heightReference"),fillColor:createPropertyDescriptor("fillColor"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),pixelOffsetScaleByDistance:createPropertyDescriptor("pixelOffsetScaleByDistance"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),LabelGraphics.prototype.clone=function(e){return defined(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 LabelGraphics(this)},LabelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.text=defaultValue(this.text,e.text),this.font=defaultValue(this.font,e.font),this.style=defaultValue(this.style,e.style),this.scale=defaultValue(this.scale,e.scale),this.showBackground=defaultValue(this.showBackground,e.showBackground),this.backgroundColor=defaultValue(this.backgroundColor,e.backgroundColor),this.backgroundPadding=defaultValue(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=defaultValue(this.pixelOffset,e.pixelOffset),this.eyeOffset=defaultValue(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=defaultValue(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=defaultValue(this.verticalOrigin,e.verticalOrigin),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.fillColor=defaultValue(this.fillColor,e.fillColor),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=defaultValue(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=defaultValue(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)};var defaultNodeTransformation=new TranslationRotationScale,NodeTransformationProperty=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,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};defineProperties$1(NodeTransformationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._translation)&&Property.isConstant(this._rotation)&&Property.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:createPropertyDescriptor("translation"),rotation:createPropertyDescriptor("rotation"),scale:createPropertyDescriptor("scale")}),NodeTransformationProperty.prototype.getValue=function(e,t){return defined(t)||(t=new TranslationRotationScale),t.translation=Property.getValueOrClonedDefault(this._translation,e,defaultNodeTransformation.translation,t.translation),t.rotation=Property.getValueOrClonedDefault(this._rotation,e,defaultNodeTransformation.rotation,t.rotation),t.scale=Property.getValueOrClonedDefault(this._scale,e,defaultNodeTransformation.scale,t.scale),t},NodeTransformationProperty.prototype.equals=function(e){return this===e||e instanceof NodeTransformationProperty&&Property.equals(this._translation,e._translation)&&Property.equals(this._rotation,e._rotation)&&Property.equals(this._scale,e._scale)};var PropertyBag=function(e,t){this._propertyNames=[],this._definitionChanged=new Event,defined(e)&&this.merge(e,t)};function createConstantProperty$1(e){return new ConstantProperty(e)}function propertiesEqual(e,t){var i=e._propertyNames,r=t._propertyNames,n=i.length;if(n!==r.length)return!1;for(var a=0;a<n;++a){var o=i[a];if(-1===r.indexOf(o))return!1;if(!Property.equals(e[o],t[o]))return!1}return!0}function createNodeTransformationProperty(e){return new NodeTransformationProperty(e)}function createNodeTransformationPropertyBag(e){return new PropertyBag(e,createNodeTransformationProperty)}function createArticulationStagePropertyBag(e){return new PropertyBag(e)}function ModelGraphics(e){this._definitionChanged=new Event,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.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PathGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PlaneGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PointGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function createPolygonHierarchyProperty(e){return isArray$1(e)&&(e=new PolygonHierarchy(e)),new ConstantProperty(e)}function PolygonGraphics(e){this._definitionChanged=new Event,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.merge(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function PolylineVolumeGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function RectangleGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}function WallGraphics(e){this._definitionChanged=new Event,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(defaultValue(e,defaultValue.EMPTY_OBJECT))}defineProperties$1(PropertyBag.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){for(var e=this._propertyNames,t=0,i=e.length;t<i;t++)if(!Property.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyBag.prototype.hasProperty=function(e){return-1!==this._propertyNames.indexOf(e)},PropertyBag.prototype.addProperty=function(e,t,i){this._propertyNames.push(e),Object.defineProperty(this,e,createPropertyDescriptor(e,!0,defaultValue(i,createConstantProperty$1))),defined(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.removeProperty=function(e){var t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e],this._definitionChanged.raiseEvent(this)},PropertyBag.prototype.getValue=function(e,t){defined(t)||(t={});for(var i=this._propertyNames,r=0,n=i.length;r<n;r++){var a=i[r];t[a]=Property.getValueOrUndefined(this[a],e,t[a])}return t},PropertyBag.prototype.merge=function(e,t){for(var i=this._propertyNames,r=defined(e._propertyNames)?e._propertyNames:Object.keys(e),n=0,a=r.length;n<a;n++){var o=r[n],s=this[o],l=e[o];void 0===s&&-1===i.indexOf(o)&&this.addProperty(o,void 0,t),void 0!==l&&(void 0!==s?defined(s)&&defined(s.merge)&&s.merge(l):defined(l)&&defined(l.merge)&&defined(l.clone)?this[o]=l.clone():this[o]=l)}},PropertyBag.prototype.equals=function(e){return this===e||e instanceof PropertyBag&&propertiesEqual(this,e)},defineProperties$1(ModelGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),uri:createPropertyDescriptor("uri"),scale:createPropertyDescriptor("scale"),minimumPixelSize:createPropertyDescriptor("minimumPixelSize"),maximumScale:createPropertyDescriptor("maximumScale"),incrementallyLoadTextures:createPropertyDescriptor("incrementallyLoadTextures"),runAnimations:createPropertyDescriptor("runAnimations"),clampAnimations:createPropertyDescriptor("clampAnimations"),shadows:createPropertyDescriptor("shadows"),heightReference:createPropertyDescriptor("heightReference"),silhouetteColor:createPropertyDescriptor("silhouetteColor"),silhouetteSize:createPropertyDescriptor("silhouetteSize"),color:createPropertyDescriptor("color"),colorBlendMode:createPropertyDescriptor("colorBlendMode"),colorBlendAmount:createPropertyDescriptor("colorBlendAmount"),imageBasedLightingFactor:createPropertyDescriptor("imageBasedLightingFactor"),lightColor:createPropertyDescriptor("lightColor"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),nodeTransformations:createPropertyDescriptor("nodeTransformations",void 0,createNodeTransformationPropertyBag),articulations:createPropertyDescriptor("articulations",void 0,createArticulationStagePropertyBag),clippingPlanes:createPropertyDescriptor("clippingPlanes")}),ModelGraphics.prototype.clone=function(e){return defined(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):new ModelGraphics(this)},ModelGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.uri=defaultValue(this.uri,e.uri),this.scale=defaultValue(this.scale,e.scale),this.minimumPixelSize=defaultValue(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=defaultValue(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=defaultValue(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=defaultValue(this.runAnimations,e.runAnimations),this.clampAnimations=defaultValue(this.clampAnimations,e.clampAnimations),this.shadows=defaultValue(this.shadows,e.shadows),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.silhouetteColor=defaultValue(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=defaultValue(this.silhouetteSize,e.silhouetteSize),this.color=defaultValue(this.color,e.color),this.colorBlendMode=defaultValue(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=defaultValue(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=defaultValue(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=defaultValue(this.lightColor,e.lightColor),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=defaultValue(this.clippingPlanes,e.clippingPlanes);var t=e.nodeTransformations;if(defined(t)){var i=this.nodeTransformations;defined(i)?i.merge(t):this.nodeTransformations=new PropertyBag(t,createNodeTransformationProperty)}var r=e.articulations;if(defined(r)){var n=this.articulations;defined(n)?n.merge(r):this.articulations=new PropertyBag(r)}},defineProperties$1(PathGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),leadTime:createPropertyDescriptor("leadTime"),trailTime:createPropertyDescriptor("trailTime"),width:createPropertyDescriptor("width"),resolution:createPropertyDescriptor("resolution"),material:createMaterialPropertyDescriptor("material"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PathGraphics.prototype.clone=function(e){return defined(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 PathGraphics(this)},PathGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.leadTime=defaultValue(this.leadTime,e.leadTime),this.trailTime=defaultValue(this.trailTime,e.trailTime),this.width=defaultValue(this.width,e.width),this.resolution=defaultValue(this.resolution,e.resolution),this.material=defaultValue(this.material,e.material),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},defineProperties$1(PlaneGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),plane:createPropertyDescriptor("plane"),dimensions:createPropertyDescriptor("dimensions"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PlaneGraphics.prototype.clone=function(e){return defined(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 PlaneGraphics(this)},PlaneGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.plane=defaultValue(this.plane,e.plane),this.dimensions=defaultValue(this.dimensions,e.dimensions),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},defineProperties$1(PointGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),pixelSize:createPropertyDescriptor("pixelSize"),heightReference:createPropertyDescriptor("heightReference"),color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),scaleByDistance:createPropertyDescriptor("scaleByDistance"),translucencyByDistance:createPropertyDescriptor("translucencyByDistance"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),disableDepthTestDistance:createPropertyDescriptor("disableDepthTestDistance")}),PointGraphics.prototype.clone=function(e){return defined(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 PointGraphics(this)},PointGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.pixelSize=defaultValue(this.pixelSize,e.pixelSize),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.color=defaultValue(this.color,e.color),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.scaleByDistance=defaultValue(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=defaultValue(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=defaultValue(this.disableDepthTestDistance,e.disableDepthTestDistance)},defineProperties$1(PolygonGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),hierarchy:createPropertyDescriptor("hierarchy",void 0,createPolygonHierarchyProperty),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),perPositionHeight:createPropertyDescriptor("perPositionHeight"),closeTop:createPropertyDescriptor("closeTop"),closeBottom:createPropertyDescriptor("closeBottom"),arcType:createPropertyDescriptor("arcType"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolygonGraphics.prototype.clone=function(e){return defined(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):new PolygonGraphics(this)},PolygonGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.hierarchy=defaultValue(this.hierarchy,e.hierarchy),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.perPositionHeight=defaultValue(this.perPositionHeight,e.perPositionHeight),this.closeTop=defaultValue(this.closeTop,e.closeTop),this.closeBottom=defaultValue(this.closeBottom,e.closeBottom),this.arcType=defaultValue(this.arcType,e.arcType),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},defineProperties$1(PolylineGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),width:createPropertyDescriptor("width"),granularity:createPropertyDescriptor("granularity"),material:createMaterialPropertyDescriptor("material"),depthFailMaterial:createMaterialPropertyDescriptor("depthFailMaterial"),arcType:createPropertyDescriptor("arcType"),clampToGround:createPropertyDescriptor("clampToGround"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),PolylineGraphics.prototype.clone=function(e){return defined(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 PolylineGraphics(this)},PolylineGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.width=defaultValue(this.width,e.width),this.granularity=defaultValue(this.granularity,e.granularity),this.material=defaultValue(this.material,e.material),this.depthFailMaterial=defaultValue(this.depthFailMaterial,e.depthFailMaterial),this.arcType=defaultValue(this.arcType,e.arcType),this.clampToGround=defaultValue(this.clampToGround,e.clampToGround),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},defineProperties$1(PolylineVolumeGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),shape:createPropertyDescriptor("shape"),cornerType:createPropertyDescriptor("cornerType"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),PolylineVolumeGraphics.prototype.clone=function(e){return defined(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 PolylineVolumeGraphics(this)},PolylineVolumeGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.shape=defaultValue(this.shape,e.shape),this.cornerType=defaultValue(this.cornerType,e.cornerType),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)},defineProperties$1(RectangleGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),coordinates:createPropertyDescriptor("coordinates"),height:createPropertyDescriptor("height"),heightReference:createPropertyDescriptor("heightReference"),extrudedHeight:createPropertyDescriptor("extrudedHeight"),extrudedHeightReference:createPropertyDescriptor("extrudedHeightReference"),rotation:createPropertyDescriptor("rotation"),stRotation:createPropertyDescriptor("stRotation"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition"),classificationType:createPropertyDescriptor("classificationType"),zIndex:createPropertyDescriptor("zIndex")}),RectangleGraphics.prototype.clone=function(e){return defined(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 RectangleGraphics(this)},RectangleGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.coordinates=defaultValue(this.coordinates,e.coordinates),this.height=defaultValue(this.height,e.height),this.heightReference=defaultValue(this.heightReference,e.heightReference),this.extrudedHeight=defaultValue(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=defaultValue(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=defaultValue(this.rotation,e.rotation),this.stRotation=defaultValue(this.stRotation,e.stRotation),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=defaultValue(this.classificationType,e.classificationType),this.zIndex=defaultValue(this.zIndex,e.zIndex)},defineProperties$1(WallGraphics.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:createPropertyDescriptor("show"),positions:createPropertyDescriptor("positions"),minimumHeights:createPropertyDescriptor("minimumHeights"),maximumHeights:createPropertyDescriptor("maximumHeights"),granularity:createPropertyDescriptor("granularity"),fill:createPropertyDescriptor("fill"),material:createMaterialPropertyDescriptor("material"),outline:createPropertyDescriptor("outline"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth"),shadows:createPropertyDescriptor("shadows"),distanceDisplayCondition:createPropertyDescriptor("distanceDisplayCondition")}),WallGraphics.prototype.clone=function(e){return defined(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 WallGraphics(this)},WallGraphics.prototype.merge=function(e){this.show=defaultValue(this.show,e.show),this.positions=defaultValue(this.positions,e.positions),this.minimumHeights=defaultValue(this.minimumHeights,e.minimumHeights),this.maximumHeights=defaultValue(this.maximumHeights,e.maximumHeights),this.granularity=defaultValue(this.granularity,e.granularity),this.fill=defaultValue(this.fill,e.fill),this.material=defaultValue(this.material,e.material),this.outline=defaultValue(this.outline,e.outline),this.outlineColor=defaultValue(this.outlineColor,e.outlineColor),this.outlineWidth=defaultValue(this.outlineWidth,e.outlineWidth),this.shadows=defaultValue(this.shadows,e.shadows),this.distanceDisplayCondition=defaultValue(this.distanceDisplayCondition,e.distanceDisplayCondition)};var cartoScratch$1=new Cartographic;function createConstantPositionProperty(e){return new ConstantPositionProperty(e)}function createPositionPropertyDescriptor(e){return createPropertyDescriptor(e,void 0,createConstantPositionProperty)}function createPropertyTypeDescriptor(e,t){return createPropertyDescriptor(e,void 0,function(e){return e instanceof t?e:new t(e)})}function Entity(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).id;defined(t)||(t=createGuid()),this._availability=void 0,this._id=t,this._definitionChanged=new Event,this._name=e.name,this._show=defaultValue(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall"],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._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 updateShow(e,t,i){for(var r=t.length,n=0;n<r;n++){var a=t[n],o=a._show;(!i&&o)!==(i&&o)&&updateShow(a,a._children,i)}e._definitionChanged.raiseEvent(e,"isShowing",i,!i)}defineProperties$1(Entity.prototype,{availability:createRawPropertyDescriptor("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:createRawPropertyDescriptor("name"),show:{get:function(){return this._show},set:function(e){if(e!==this._show){var t=this.isShowing;this._show=e;var i=this.isShowing;t!==i&&updateShow(this,this._children,i),this._definitionChanged.raiseEvent(this,"show",e,!e)}}},isShowing:{get:function(){return this._show&&(!defined(this.entityCollection)||this.entityCollection.show)&&(!defined(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){var t=this._parent;if(t!==e){var i=this.isShowing;if(defined(t)){var r=t._children.indexOf(this);t._children.splice(r,1)}defined(this._parent=e)&&e._children.push(this);var n=this.isShowing;i!==n&&updateShow(this,this._children,n),this._definitionChanged.raiseEvent(this,"parent",e,t)}}},propertyNames:{get:function(){return this._propertyNames}},billboard:createPropertyTypeDescriptor("billboard",BillboardGraphics),box:createPropertyTypeDescriptor("box",BoxGraphics),corridor:createPropertyTypeDescriptor("corridor",CorridorGraphics),cylinder:createPropertyTypeDescriptor("cylinder",CylinderGraphics),description:createPropertyDescriptor("description"),ellipse:createPropertyTypeDescriptor("ellipse",EllipseGraphics),ellipsoid:createPropertyTypeDescriptor("ellipsoid",EllipsoidGraphics),label:createPropertyTypeDescriptor("label",LabelGraphics),model:createPropertyTypeDescriptor("model",ModelGraphics),orientation:createPropertyDescriptor("orientation"),path:createPropertyTypeDescriptor("path",PathGraphics),plane:createPropertyTypeDescriptor("plane",PlaneGraphics),point:createPropertyTypeDescriptor("point",PointGraphics),polygon:createPropertyTypeDescriptor("polygon",PolygonGraphics),polyline:createPropertyTypeDescriptor("polyline",PolylineGraphics),polylineVolume:createPropertyTypeDescriptor("polylineVolume",PolylineVolumeGraphics),properties:createPropertyTypeDescriptor("properties",PropertyBag),position:createPositionPropertyDescriptor("position"),rectangle:createPropertyTypeDescriptor("rectangle",RectangleGraphics),viewFrom:createPropertyDescriptor("viewFrom"),wall:createPropertyTypeDescriptor("wall",WallGraphics)}),Entity.prototype.isAvailable=function(e){var t=this._availability;return!defined(t)||t.contains(e)},Entity.prototype.addProperty=function(e){this._propertyNames.push(e),Object.defineProperty(this,e,createRawPropertyDescriptor(e,!0))},Entity.prototype.removeProperty=function(e){var t=this._propertyNames.indexOf(e);this._propertyNames.splice(t,1),delete this[e]},Entity.prototype.merge=function(e){this.name=defaultValue(this.name,e.name),this.availability=defaultValue(this.availability,e.availability);for(var t=this._propertyNames,i=defined(e._propertyNames)?e._propertyNames:Object.keys(e),r=i.length,n=0;n<r;n++){var a=i[n];if("parent"!==a){var o=this[a],s=e[a];defined(o)||-1!==t.indexOf(a)||this.addProperty(a),defined(s)&&(defined(o)?defined(o.merge)&&o.merge(s):defined(s.merge)&&defined(s.clone)?this[a]=s.clone():this[a]=s)}}};var matrix3Scratch$1=new Matrix3,positionScratch$5=new Cartesian3,orientationScratch=new Quaternion;Entity.prototype.computeModelMatrix=function(e,t){var i=Property.getValueOrUndefined(this._position,e,positionScratch$5);if(defined(i)){var r=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return t=defined(r)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(r,matrix3Scratch$1),i,t):Transforms.eastNorthUpToFixedFrame(i,void 0,t)}},Entity.prototype.computeModelMatrixForHeightReference=function(e,t,i,r,n){var a=Property.getValueOrDefault(t,e,HeightReference$1.NONE),o=Property.getValueOrUndefined(this._position,e,positionScratch$5);if(a===HeightReference$1.NONE||!defined(o)||Cartesian3.equalsEpsilon(o,Cartesian3.ZERO,CesiumMath.EPSILON8))return this.computeModelMatrix(e,n);var s=r.cartesianToCartographic(o,cartoScratch$1);a===HeightReference$1.CLAMP_TO_GROUND?s.height=i:s.height+=i,o=r.cartographicToCartesian(s,o);var l=Property.getValueOrUndefined(this._orientation,e,orientationScratch);return n=defined(l)?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(l,matrix3Scratch$1),o,n):Transforms.eastNorthUpToFixedFrame(o,void 0,n)},Entity.supportsMaterialsforEntitiesOnTerrain=function(e){return GroundPrimitive.supportsMaterials(e)},Entity.supportsPolylinesOnTerrain=function(e){return GroundPolylinePrimitive.isSupported(e)};var defaultMaterial=new ColorMaterialProperty(Color.WHITE),defaultShow=new ConstantProperty(!0),defaultFill=new ConstantProperty(!0),defaultOutline=new ConstantProperty(!1),defaultOutlineColor=new ConstantProperty(Color.BLACK),defaultShadows=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType=new ConstantProperty(ClassificationType$1.BOTH);function GeometryUpdater(e){var t=e.entity,i=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 Event,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=i,this._id=i+"-"+t.id,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=Entity.supportsMaterialsforEntitiesOnTerrain(e.scene)}function CallbackProperty(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Event,this.setCallback(e,t)}defineProperties$1(GeometryUpdater.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||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!defined(this._entity.availability)&&Property.isConstant(this._showProperty)&&Property.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}}}),GeometryUpdater.prototype.isOutlineVisible=function(e){var t=this._entity;return defaultValue(this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e),!1)},GeometryUpdater.prototype.isFilled=function(e){var t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e),!1)},GeometryUpdater.prototype.createFillGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.createOutlineGeometryInstance=DeveloperError.throwInstantiationError,GeometryUpdater.prototype.isDestroyed=function(){return!1},GeometryUpdater.prototype.destroy=function(){destroyObject(this)},GeometryUpdater.prototype._isHidden=function(e,t){var i=t.show;return defined(i)&&i.isConstant&&!i.getValue(Iso8601.MINIMUM_VALUE)},GeometryUpdater.prototype._isOnTerrain=function(e,t){return!1},GeometryUpdater.prototype._getIsClosed=function(e){return!0},GeometryUpdater.prototype._isDynamic=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._setStaticOptions=DeveloperError.throwInstantiationError,GeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,r){if(-1!==this._observedPropertyNames.indexOf(t)){var n=this._entity[this._geometryPropertyName];if(defined(n)){var a=n.fill,o=!defined(a)||!a.isConstant||a.getValue(Iso8601.MINIMUM_VALUE),s=n.outline,l=defined(s);if(l&&s.isConstant&&(l=s.getValue(Iso8601.MINIMUM_VALUE)),o||l){var c=n.show;if(this._isHidden(e,n))(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));else{this._materialProperty=defaultValue(n.material,defaultMaterial),this._fillProperty=defaultValue(a,defaultFill),this._showProperty=defaultValue(c,defaultShow),this._showOutlineProperty=defaultValue(n.outline,defaultOutline),this._outlineColorProperty=l?defaultValue(n.outlineColor,defaultOutlineColor):void 0,this._shadowsProperty=defaultValue(n.shadows,defaultShadows),this._distanceDisplayConditionProperty=defaultValue(n.distanceDisplayCondition,defaultDistanceDisplayCondition),this._classificationTypeProperty=defaultValue(n.classificationType,defaultClassificationType),this._fillEnabled=o;var u=this._isOnTerrain(e,n)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof ColorMaterialProperty);if(l&&u&&(oneTimeWarning(oneTimeWarning.geometryOutlines),l=!1),this._onTerrain=u,this._outlineEnabled=l,this._isDynamic(e,n))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,n),this._isClosed=this._getIsClosed(this._options);var d=n.outlineWidth;this._outlineWidth=defined(d)?d.getValue(Iso8601.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}}}else(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this))}else(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this))}},GeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new this.constructor.DynamicGeometryUpdater(this,e,t)},defineProperties$1(CallbackProperty.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}}),CallbackProperty.prototype.getValue=function(e,t){return this._callback(e,t)},CallbackProperty.prototype.setCallback=function(e,t){var i=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,i&&this._definitionChanged.raiseEvent(this)},CallbackProperty.prototype.equals=function(e){return this===e||e instanceof CallbackProperty&&this._callback===e._callback&&this._isConstant===e._isConstant};var scratchPosition$5=new Cartesian3,scratchCarto=new Cartographic;function TerrainOffsetProperty(e,t,i,r){this._scene=e,this._heightReference=i,this._extrudedHeightReference=r,this._positionProperty=t,this._position=new Cartesian3,this._cartographicPosition=new Cartographic,this._normal=new Cartesian3,this._definitionChanged=new Event,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;var n=this;if(defined(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener(function(){n._updateClamping()}),this._removeModeListener=e.morphComplete.addEventListener(function(){n._updateClamping()})),t.isConstant){var a=t.getValue(Iso8601.MINIMUM_VALUE,scratchPosition$5);if(!defined(a)||Cartesian3.equals(a,Cartesian3.ZERO)||!defined(e.globe))return;this._position=Cartesian3.clone(a,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(a,this._normal)}}function heightReferenceOnEntityPropertyChanged(e,t,i,r){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,i,r),-1!==this._observedPropertyNames.indexOf(t)){var n=this._entity[this._geometryPropertyName];if(defined(n)){defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);var a=n.heightReference;if(defined(a)){var o=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,o,a)}}}}defineProperties$1(TerrainOffsetProperty.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),TerrainOffsetProperty.prototype._updateClamping=function(){defined(this._removeCallbackFunc)&&this._removeCallbackFunc();var i=this._scene,e=i.globe,t=this._position;if(defined(e)&&!Cartesian3.equals(t,Cartesian3.ZERO)){var r=e.ellipsoid,n=e._surface,a=this,o=r.cartesianToCartographic(t,this._cartographicPosition),s=e.getHeight(o);defined(s)?this._terrainHeight=s:this._terrainHeight=0,this._removeCallbackFunc=n.updateHeight(o,function(e){if(i.mode===SceneMode$1.SCENE3D){var t=r.cartesianToCartographic(e,scratchCarto);a._terrainHeight=t.height}else a._terrainHeight=e.x;a.definitionChanged.raiseEvent()})}else this._terrainHeight=0},TerrainOffsetProperty.prototype.getValue=function(e,t){var i=Property.getValueOrDefault(this._heightReference,e,HeightReference$1.NONE),r=Property.getValueOrDefault(this._extrudedHeightReference,e,HeightReference$1.NONE);if(i===HeightReference$1.NONE&&r!==HeightReference$1.RELATIVE_TO_GROUND)return this._position=Cartesian3.clone(Cartesian3.ZERO,this._position),Cartesian3.clone(Cartesian3.ZERO,t);if(this._positionProperty.isConstant)return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);var n=this._scene,a=this._positionProperty.getValue(e,scratchPosition$5);if(!defined(a)||Cartesian3.equals(a,Cartesian3.ZERO)||!defined(n.globe))return Cartesian3.clone(Cartesian3.ZERO,t);if(Cartesian3.equalsEpsilon(this._position,a,CesiumMath.EPSILON10))return Cartesian3.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=Cartesian3.clone(a,this._position),this._updateClamping();var o=n.globe.ellipsoid.geodeticSurfaceNormal(a,this._normal);return Cartesian3.multiplyByScalar(o,this._terrainHeight,t)},TerrainOffsetProperty.prototype.isDestroyed=function(){return!1},TerrainOffsetProperty.prototype.destroy=function(){return defined(this._removeEventListener)&&this._removeEventListener(),defined(this._removeModeListener)&&this._removeModeListener(),defined(this._removeCallbackFunc)&&this._removeCallbackFunc(),destroyObject(this)};var defaultOffset=Cartesian3.ZERO,offsetScratch$3=new Cartesian3,positionScratch$6=new Cartesian3,scratchColor=new Color;function BoxGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function BoxGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new BoxGeometryOptions(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}function DynamicBoxGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(BoxGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),BoxGeometryUpdater.prototype.constructor=BoxGeometryUpdater),defineProperties$1(BoxGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),BoxGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),color:void 0,offset:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset,offsetScratch$3))),new GeometryInstance({id:i,geometry:BoxGeometry.fromDimensions(this._options),modelMatrix:i.computeModelMatrixForHeightReference(e,i.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:o})},BoxGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset,offsetScratch$3))),new GeometryInstance({id:t,geometry:BoxOutlineGeometry.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:a})},BoxGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},BoxGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},BoxGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},BoxGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),r=this._options;r.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,r.dimensions),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},BoxGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,BoxGeometryUpdater.DynamicGeometryUpdater=DynamicBoxGeometryUpdater,defined(Object.create)&&(DynamicBoxGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicBoxGeometryUpdater.prototype.constructor=DynamicBoxGeometryUpdater),DynamicBoxGeometryUpdater.prototype._isHidden=function(e,t,i){var r=Property.getValueOrUndefined(e.position,i,positionScratch$6),n=this._options.dimensions;return!defined(r)||!defined(n)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicBoxGeometryUpdater.prototype._setOptions=function(e,t,i){var r=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),n=this._options;n.dimensions=Property.getValueOrUndefined(t.dimensions,i,n.dimensions),n.offsetAttribute=r!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0};var defaultEvenColor=Color.WHITE,defaultOddColor=Color.BLACK,defaultRepeat$1=new Cartesian2(2,2);function CheckerboardMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.repeat=e.repeat}defineProperties$1(CheckerboardMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),repeat:createPropertyDescriptor("repeat")}),CheckerboardMaterialProperty.prototype.getType=function(e){return"Checkerboard"},CheckerboardMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.lightColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor,t.lightColor),t.darkColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor,t.darkColor),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat$1),t},CheckerboardMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CheckerboardMaterialProperty&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._repeat,e._repeat)};var entityOptionsScratch={id:void 0};function fireChangedEvent(e){if(e._firing)e._refire=!0;else if(0===e._suspendCount){var t=e._addedEntities,i=e._removedEntities,r=e._changedEntities;if(0!==r.length||0!==t.length||0!==i.length){e._firing=!0;do{e._refire=!1;var n=t.values.slice(0),a=i.values.slice(0),o=r.values.slice(0);t.removeAll(),i.removeAll(),r.removeAll(),e._collectionChanged.raiseEvent(e,n,a,o)}while(e._refire);e._firing=!1}}}function EntityCollection(e){this._owner=e,this._entities=new AssociativeArray,this._addedEntities=new AssociativeArray,this._removedEntities=new AssociativeArray,this._changedEntities=new AssociativeArray,this._suspendCount=0,this._collectionChanged=new Event,this._id=createGuid(),this._show=!0,this._firing=!1,this._refire=!1}EntityCollection.prototype.suspendEvents=function(){this._suspendCount++},EntityCollection.prototype.resumeEvents=function(){this._suspendCount--,fireChangedEvent(this)},EntityCollection.collectionChangedEventCallback=void 0,defineProperties$1(EntityCollection.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(e!==this._show){var t;this.suspendEvents();var i=[],r=this._entities.values,n=r.length;for(t=0;t<n;t++)i.push(r[t].isShowing);for(this._show=e,t=0;t<n;t++){var a=i[t],o=r[t];a!==o.isShowing&&o.definitionChanged.raiseEvent(o,"isShowing",o.isShowing,a)}this.resumeEvents()}}},owner:{get:function(){return this._owner}}}),EntityCollection.prototype.computeAvailability=function(){for(var e=Iso8601.MAXIMUM_VALUE,t=Iso8601.MINIMUM_VALUE,i=this._entities.values,r=0,n=i.length;r<n;r++){var a=i[r].availability;if(defined(a)){var o=a.start,s=a.stop;JulianDate.lessThan(o,e)&&!o.equals(Iso8601.MINIMUM_VALUE)&&(e=o),JulianDate.greaterThan(s,t)&&!s.equals(Iso8601.MAXIMUM_VALUE)&&(t=s)}}return Iso8601.MAXIMUM_VALUE.equals(e)&&(e=Iso8601.MINIMUM_VALUE),Iso8601.MINIMUM_VALUE.equals(t)&&(t=Iso8601.MAXIMUM_VALUE),new TimeInterval({start:e,stop:t})},EntityCollection.prototype.add=function(e){e instanceof Entity||(e=new Entity(e));var t=e.id,i=this._entities;if(i.contains(t))throw new RuntimeError("An entity with id "+t+" already exists in this collection.");return e.entityCollection=this,i.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),e},EntityCollection.prototype.remove=function(e){return!!defined(e)&&this.removeById(e.id)},EntityCollection.prototype.contains=function(e){return this._entities.get(e.id)===e},EntityCollection.prototype.removeById=function(e){if(!defined(e))return!1;var t=this._entities.get(e);return!!this._entities.remove(e)&&(this._addedEntities.remove(e)||(this._removedEntities.set(e,t),this._changedEntities.remove(e)),this._entities.remove(e),t.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),fireChangedEvent(this),!0)},EntityCollection.prototype.removeAll=function(){for(var e=this._entities,t=e.length,i=e.values,r=this._addedEntities,n=this._removedEntities,a=0;a<t;a++){var o=i[a],s=o.id;defined(r.get(s))||(o.definitionChanged.removeEventListener(EntityCollection.prototype._onEntityDefinitionChanged,this),n.set(s,o))}e.removeAll(),r.removeAll(),this._changedEntities.removeAll(),fireChangedEvent(this)},EntityCollection.prototype.getById=function(e){return this._entities.get(e)},EntityCollection.prototype.getOrCreateEntity=function(e){var t=this._entities.get(e);return defined(t)||(entityOptionsScratch.id=e,t=new Entity(entityOptionsScratch),this.add(t)),t},EntityCollection.prototype._onEntityDefinitionChanged=function(e){var t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),fireChangedEvent(this)};var entityOptionsScratch$1={id:void 0},entityIdScratch=new Array(2);function clean(e){for(var t=e.propertyNames,i=t.length,r=0;r<i;r++)e[t[r]]=void 0;e._name=void 0,e._availability=void 0}function subscribeToEntity(e,t,i,r){entityIdScratch[0]=i,entityIdScratch[1]=r.id,t[JSON.stringify(entityIdScratch)]=r.definitionChanged.addEventListener(CompositeEntityCollection.prototype._onDefinitionChanged,e)}function unsubscribeFromEntity(e,t,i,r){entityIdScratch[0]=i,entityIdScratch[1]=r.id;var n=JSON.stringify(entityIdScratch);t[n](),t[n]=void 0}function recomposite(e){if(e._shouldRecomposite=!0,0===e._suspendCount){var t,i,r,n,a,o,s=e._collections,l=s.length,c=e._collectionsCopy,u=c.length,d=e._composite,h=new EntityCollection(e),p=e._eventHash;for(t=0;t<u;t++)for((a=c[t]).collectionChanged.removeEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),r=a.values,o=a.id,n=r.length-1;-1<n;n--)unsubscribeFromEntity(e,p,o,i=r[n]);for(t=l-1;0<=t;t--)for((a=s[t]).collectionChanged.addEventListener(CompositeEntityCollection.prototype._onCollectionChanged,e),r=a.values,o=a.id,n=r.length-1;-1<n;n--){subscribeToEntity(e,p,o,i=r[n]);var m=h.getById(i.id);defined(m)||(defined(m=d.getById(i.id))?clean(m):(entityOptionsScratch$1.id=i.id,m=new Entity(entityOptionsScratch$1)),h.add(m)),m.merge(i)}e._collectionsCopy=s.slice(0),d.suspendEvents(),d.removeAll();var f=h.values;for(t=0;t<f.length;t++)d.add(f[t]);d.resumeEvents()}}function CompositeEntityCollection(e,t){this._owner=t,this._composite=new EntityCollection(this),this._suspendCount=0,this._collections=defined(e)?e.slice():[],this._collectionsCopy=[],this._id=createGuid(),this._eventHash={},recomposite(this),this._shouldRecomposite=!1}function getCollectionIndex(e,t){return e.indexOf(t)}function swapCollections(e,t,i){var r=e._collections;if((t=CesiumMath.clamp(t,0,r.length-1))!==(i=CesiumMath.clamp(i,0,r.length-1))){var n=r[t];r[t]=r[i],r[i]=n,recomposite(e)}}function subscribeAll(e,t,i,r){function n(){i.raiseEvent(e)}var a=[];t.removeAll();for(var o=r.length,s=0;s<o;s++){var l=r.get(s);defined(l.data)&&-1===a.indexOf(l.data)&&t.add(l.data.definitionChanged,n)}}function CompositeProperty(){this._eventHelper=new EventHelper,this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(CompositeProperty.prototype._intervalsChanged,this)}function CompositeMaterialProperty(){this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositeMaterialProperty.prototype._raiseDefinitionChanged,this)}function CompositePositionProperty(e){this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._definitionChanged=new Event,this._composite=new CompositeProperty,this._composite.definitionChanged.addEventListener(CompositePositionProperty.prototype._raiseDefinitionChanged,this)}defineProperties$1(CompositeEntityCollection.prototype,{collectionChanged:{get:function(){return this._composite._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._composite.values}},owner:{get:function(){return this._owner}}}),CompositeEntityCollection.prototype.addCollection=function(e,t){defined(t)?this._collections.splice(t,0,e):(t=this._collections.length,this._collections.push(e)),recomposite(this)},CompositeEntityCollection.prototype.removeCollection=function(e){var t=this._collections.indexOf(e);return-1!==t&&(this._collections.splice(t,1),recomposite(this),!0)},CompositeEntityCollection.prototype.removeAllCollections=function(){this._collections.length=0,recomposite(this)},CompositeEntityCollection.prototype.containsCollection=function(e){return-1!==this._collections.indexOf(e)},CompositeEntityCollection.prototype.contains=function(e){return this._composite.contains(e)},CompositeEntityCollection.prototype.indexOfCollection=function(e){return this._collections.indexOf(e)},CompositeEntityCollection.prototype.getCollection=function(e){return this._collections[e]},CompositeEntityCollection.prototype.getCollectionsLength=function(){return this._collections.length},CompositeEntityCollection.prototype.raiseCollection=function(e){var t=getCollectionIndex(this._collections,e);swapCollections(this,t,t+1)},CompositeEntityCollection.prototype.lowerCollection=function(e){var t=getCollectionIndex(this._collections,e);swapCollections(this,t,t-1)},CompositeEntityCollection.prototype.raiseCollectionToTop=function(e){var t=getCollectionIndex(this._collections,e);t!==this._collections.length-1&&(this._collections.splice(t,1),this._collections.push(e),recomposite(this))},CompositeEntityCollection.prototype.lowerCollectionToBottom=function(e){var t=getCollectionIndex(this._collections,e);0!==t&&(this._collections.splice(t,1),this._collections.splice(0,0,e),recomposite(this))},CompositeEntityCollection.prototype.suspendEvents=function(){this._suspendCount++,this._composite.suspendEvents()},CompositeEntityCollection.prototype.resumeEvents=function(){this._suspendCount--,this._shouldRecomposite&&0===this._suspendCount&&(recomposite(this),this._shouldRecomposite=!1),this._composite.resumeEvents()},CompositeEntityCollection.prototype.computeAvailability=function(){return this._composite.computeAvailability()},CompositeEntityCollection.prototype.getById=function(e){return this._composite.getById(e)},CompositeEntityCollection.prototype._onCollectionChanged=function(e,t,i){var r,n,a,o,s=this._collectionsCopy,l=s.length,c=this._composite;c.suspendEvents();var u=i.length,d=this._eventHash,h=e.id;for(r=0;r<u;r++){var p=i[r];unsubscribeFromEntity(this,d,h,p);var m=p.id;for(n=l-1;0<=n;n--)defined(a=s[n].getById(m))&&(defined(o)||clean(o=c.getById(m)),o.merge(a));defined(o)||c.removeById(m),o=void 0}var f=t.length;for(r=0;r<f;r++){var g=t[r];subscribeToEntity(this,d,h,g);var _=g.id;for(n=l-1;0<=n;n--)defined(a=s[n].getById(_))&&(defined(o)||(defined(o=c.getById(_))?clean(o):(entityOptionsScratch$1.id=_,o=new Entity(entityOptionsScratch$1),c.add(o))),o.merge(a));o=void 0}c.resumeEvents()},CompositeEntityCollection.prototype._onDefinitionChanged=function(e,t,i,r){for(var n=this._collections,a=this._composite,o=n.length,s=e.id,l=a.getById(s),c=l[t],u=!defined(c),d=!0,h=o-1;0<=h;h--){var p=n[h].getById(e.id);if(defined(p)){var m=p[t];if(defined(m)){if(d){if(d=!1,!defined(m.merge)||!defined(m.clone)){c=m;break}c=m.clone(c)}c.merge(m)}}}u&&-1===l.propertyNames.indexOf(t)&&l.addProperty(t),l[t]=c},defineProperties$1(CompositeProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),CompositeProperty.prototype.getValue=function(e,t){var i=this._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValue(e,t)},CompositeProperty.prototype.equals=function(e){return this===e||e instanceof CompositeProperty&&this._intervals.equals(e._intervals,Property.equals)},CompositeProperty.prototype._intervalsChanged=function(){subscribeAll(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)},defineProperties$1(CompositeMaterialProperty.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}}),CompositeMaterialProperty.prototype.getType=function(e){var t=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(t))return t.getType(e)},CompositeMaterialProperty.prototype.getValue=function(e,t){var i=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(i))return i.getValue(e,t)},CompositeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof CompositeMaterialProperty&&this._composite.equals(e._composite,Property.equals)},CompositeMaterialProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},defineProperties$1(CompositePositionProperty.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}}}),CompositePositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},CompositePositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){var r=this._composite._intervals.findDataForIntervalContainingDate(e);if(defined(r))return r.getValueInReferenceFrame(e,t,i)},CompositePositionProperty.prototype.equals=function(e){return this===e||e instanceof CompositePositionProperty&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Property.equals)},CompositePositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var defaultZIndex=new ConstantProperty(0);function GroundGeometryUpdater(e){GeometryUpdater.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}defined(Object.create)&&(GroundGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),GroundGeometryUpdater.prototype.constructor=GroundGeometryUpdater),defineProperties$1(GroundGeometryUpdater.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),GroundGeometryUpdater.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!defined(t.height)&&!defined(t.extrudedHeight)&&GroundPrimitive.isSupported(this._scene)},GroundGeometryUpdater.prototype._getIsClosed=function(e){var t=e.height,i=e.extrudedHeight;return 0===t||defined(i)&&i!==t},GroundGeometryUpdater.prototype._computeCenter=DeveloperError.throwInstantiationError,GroundGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,r){if(GeometryUpdater.prototype._onEntityPropertyChanged.call(this,e,t,i,r),-1!==this._observedPropertyNames.indexOf(t)){var n=this._entity[this._geometryPropertyName];if(defined(n)){defined(n.zIndex)&&(defined(n.height)||defined(n.extrudedHeight))&&oneTimeWarning(oneTimeWarning.geometryZIndex),this._zIndex=defaultValue(n.zIndex,defaultZIndex),defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);var a=n.heightReference,o=n.extrudedHeightReference;if(defined(a)||defined(o)){var s=new CallbackProperty(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new TerrainOffsetProperty(this._scene,s,a,o)}}}},GroundGeometryUpdater.prototype.destroy=function(){defined(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),GeometryUpdater.prototype.destroy.call(this)},GroundGeometryUpdater.getGeometryHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:0;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryHeightReference)},GroundGeometryUpdater.getGeometryExtrudedHeight=function(e,t){if(defined(e))return t!==HeightReference$1.CLAMP_TO_GROUND?e:GroundGeometryUpdater.CLAMP_TO_GROUND;t!==HeightReference$1.NONE&&oneTimeWarning(oneTimeWarning.geometryExtrudedHeightReference)},GroundGeometryUpdater.CLAMP_TO_GROUND="clamp",GroundGeometryUpdater.computeGeometryOffsetAttribute=function(e,t,i,r){defined(e)&&defined(t)||(t=HeightReference$1.NONE),defined(i)&&defined(r)||(r=HeightReference$1.NONE);var n=0;return t!==HeightReference$1.NONE&&n++,r===HeightReference$1.RELATIVE_TO_GROUND&&n++,2===n?GeometryOffsetAttribute$1.ALL:1===n?GeometryOffsetAttribute$1.TOP:void 0};var scratchColor$1=new Color,defaultOffset$1=Cartesian3.ZERO,offsetScratch$4=new Cartesian3,scratchRectangle$2=new Rectangle;function CorridorGeometryOptions(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 CorridorGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CorridorGeometryOptions(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}function DynamicCorridorGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}function DataSource(){DeveloperError.throwInstantiationError()}defined(Object.create)&&(CorridorGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),CorridorGeometryUpdater.prototype.constructor=CorridorGeometryUpdater),CorridorGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$1)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$1,offsetScratch$4))),new GeometryInstance({id:i,geometry:new CorridorGeometry(this._options),attributes:n})},CorridorGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$1),n={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$1,offsetScratch$4))),new GeometryInstance({id:t,geometry:new CorridorOutlineGeometry(this._options),attributes:n})},CorridorGeometryUpdater.prototype._computeCenter=function(e,t){var i=Property.getValueOrUndefined(this._entity.corridor.positions,e);if(defined(i)&&0!==i.length)return Cartesian3.clone(i[Math.floor(i.length/2)],t)},CorridorGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.width)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CorridorGeometryUpdater.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.width)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.cornerType)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)},CorridorGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),r=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),a=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(n)&&!defined(i)&&(i=0);var o=this._options;o.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,o.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,o.positions),o.width=t.width.getValue(Iso8601.MINIMUM_VALUE),o.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),o.cornerType=Property.getValueOrUndefined(t.cornerType,Iso8601.MINIMUM_VALUE),o.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,r,n,a),o.height=GroundGeometryUpdater.getGeometryHeight(i,r),(n=GroundGeometryUpdater.getGeometryExtrudedHeight(n,a))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(n=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(o,scratchRectangle$2)).minimumTerrainHeight),o.extrudedHeight=n},CorridorGeometryUpdater.DynamicGeometryUpdater=DynamicCorridorGeometryUpdater,defined(Object.create)&&(DynamicCorridorGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicCorridorGeometryUpdater.prototype.constructor=DynamicCorridorGeometryUpdater),DynamicCorridorGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(r.positions)||!defined(r.width)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicCorridorGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options,n=Property.getValueOrUndefined(t.height,i),a=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),o=Property.getValueOrUndefined(t.extrudedHeight,i),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0),r.positions=Property.getValueOrUndefined(t.positions,i),r.width=Property.getValueOrUndefined(t.width,i),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.cornerType=Property.getValueOrUndefined(t.cornerType,i),r.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,a,o,s),r.height=GroundGeometryUpdater.getGeometryHeight(n,a),(o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(r,scratchRectangle$2)).minimumTerrainHeight),r.extrudedHeight=o},defineProperties$1(DataSource.prototype,{name:{get:DeveloperError.throwInstantiationError},clock:{get:DeveloperError.throwInstantiationError},entities:{get:DeveloperError.throwInstantiationError},isLoading:{get:DeveloperError.throwInstantiationError},changedEvent:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},loadingEvent:{get:DeveloperError.throwInstantiationError},show:{get:DeveloperError.throwInstantiationError},clustering:{get:DeveloperError.throwInstantiationError}}),DataSource.prototype.update=DeveloperError.throwInstantiationError,DataSource.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};var SceneTransforms={},actualPositionScratch=new Cartesian4(0,0,0,1),positionCC=new Cartesian4,scratchViewport$1=new BoundingRectangle,scratchWindowCoord0=new Cartesian2,scratchWindowCoord1=new Cartesian2;SceneTransforms.wgs84ToWindowCoordinates=function(e,t,i){return SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(e,t,Cartesian3.ZERO,i)};var scratchCartesian4$3=new Cartesian4,scratchEyeOffset=new Cartesian3;function worldToClip(e,t,i,r){var n=i.viewMatrix,a=Matrix4.multiplyByVector(n,Cartesian4.fromElements(e.x,e.y,e.z,1,scratchCartesian4$3),scratchCartesian4$3),o=Cartesian3.multiplyComponents(t,Cartesian3.normalize(a,scratchEyeOffset),scratchEyeOffset);return a.x+=t.x+o.x,a.y+=t.y+o.y,a.z+=o.z,Matrix4.multiplyByVector(i.frustum.projectionMatrix,a,r)}var scratchMaxCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratchProjectedCartesian=new Cartesian3,scratchCameraPosition=new Cartesian3;SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,i,r){var n=e.frameState,a=SceneTransforms.computeActualWgs84Position(n,t,actualPositionScratch);if(defined(a)){var o=e.canvas,s=scratchViewport$1;s.x=0,s.y=0,s.width=o.clientWidth,s.height=o.clientHeight;var l=e.camera,c=!1;if(n.mode===SceneMode$1.SCENE2D){var u=e.mapProjection,d=scratchMaxCartographic,h=u.project(d,scratchProjectedCartesian),p=Cartesian3.clone(l.position,scratchCameraPosition),m=l.frustum.clone(),f=Matrix4.computeViewportTransformation(s,0,1,new Matrix4),g=l.frustum.projectionMatrix,_=l.positionWC.y,y=Cartesian3.fromElements(CesiumMath.sign(_)*h.x-_,0,-l.positionWC.x),v=Transforms.pointToGLWindowCoordinates(g,f,y);if(0===_||v.x<=0||v.x>=o.clientWidth)c=!0;else{if(v.x>.5*o.clientWidth){s.width=v.x,l.frustum.right=h.x-_,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x+=v.x,l.position.x=-l.position.x;var C=l.frustum.right;l.frustum.right=-l.frustum.left,l.frustum.left=-C,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}else{s.x+=v.x,s.width-=v.x,l.frustum.left=-h.x-_,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord0),s.x=s.x-s.width,l.position.x=-l.position.x;var S=l.frustum.left;l.frustum.left=-l.frustum.right,l.frustum.right=-S,positionCC=worldToClip(a,i,l,positionCC),SceneTransforms.clipToGLWindowCoordinates(s,positionCC,scratchWindowCoord1)}Cartesian3.clone(p,l.position),l.frustum=m.clone(),((r=Cartesian2.clone(scratchWindowCoord0,r)).x<0||r.x>o.clientWidth)&&(r.x=scratchWindowCoord1.x)}}if(n.mode!==SceneMode$1.SCENE2D||c){if((positionCC=worldToClip(a,i,l,positionCC)).z<0&&!(l.frustum instanceof OrthographicFrustum)&&!(l.frustum instanceof OrthographicOffCenterFrustum))return;r=SceneTransforms.clipToGLWindowCoordinates(s,positionCC,r)}return r.y=o.clientHeight-r.y,r}},SceneTransforms.wgs84ToDrawingBufferCoordinates=function(e,t,i){if(defined(i=SceneTransforms.wgs84ToWindowCoordinates(e,t,i)))return SceneTransforms.transformWindowToDrawingBuffer(e,i,i)};var projectedPosition=new Cartesian3,positionInCartographic=new Cartographic;SceneTransforms.computeActualWgs84Position=function(e,t,i){var r=e.mode;if(r===SceneMode$1.SCENE3D)return Cartesian3.clone(t,i);var n=e.mapProjection,a=n.ellipsoid.cartesianToCartographic(t,positionInCartographic);if(defined(a)){if(n.project(a,projectedPosition),r===SceneMode$1.COLUMBUS_VIEW)return Cartesian3.fromElements(projectedPosition.z,projectedPosition.x,projectedPosition.y,i);if(r===SceneMode$1.SCENE2D)return Cartesian3.fromElements(0,projectedPosition.x,projectedPosition.y,i);var o=e.morphTime;return Cartesian3.fromElements(CesiumMath.lerp(projectedPosition.z,t.x,o),CesiumMath.lerp(projectedPosition.x,t.y,o),CesiumMath.lerp(projectedPosition.y,t.z,o),i)}};var positionNDC=new Cartesian3,positionWC=new Cartesian3,viewportTransform=new Matrix4;SceneTransforms.clipToGLWindowCoordinates=function(e,t,i){return Cartesian3.divideByScalar(t,t.w,positionNDC),Matrix4.computeViewportTransformation(e,0,1,viewportTransform),Matrix4.multiplyByPoint(viewportTransform,positionNDC,positionWC),Cartesian2.fromCartesian3(positionWC,i)},SceneTransforms.transformWindowToDrawingBuffer=function(e,t,i){var r=e.canvas,n=e.drawingBufferWidth/r.clientWidth,a=e.drawingBufferHeight/r.clientHeight;return Cartesian2.fromElements(t.x*n,t.y*a,i)};var scratchNDC=new Cartesian4,scratchWorldCoords=new Cartesian4;function Billboard(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,r=e.pixelOffsetScaleByDistance,n=e.scaleByDistance,a=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(n)&&(n=NearFarScalar.clone(n)),defined(a)&&(a=DistanceDisplayCondition.clone(a)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._translate=new Cartesian2(0,0),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.CENTER),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.CENTER),this._scale=defaultValue(e.scale,1),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._rotation=defaultValue(e.rotation,0),this._alignedAxis=Cartesian3.clone(defaultValue(e.alignedAxis,Cartesian3.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=n,this._translucencyByDistance=i,this._pixelOffsetScaleByDistance=r,this._sizeInMeters=defaultValue(e.sizeInMeters,!1),this._distanceDisplayCondition=a,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=defaultValue(e.collection,t),this._pickId=void 0,this._pickPrimitive=defaultValue(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;var o=e.image,s=e.imageId;defined(o)&&(defined(s)||(s="string"==typeof o?o:defined(o.src)?o.src:createGuid()),this._imageId=s,this._image=o),defined(e.imageSubRegion)&&(this._imageId=s,this._imageSubRegion=e.imageSubRegion),defined(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=SceneMode$1.SCENE3D,this._clusterShow=!0,this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._updateClamping()}SceneTransforms.drawingBufferToWgs84Coordinates=function(e,t,i,r){var n=e.context.uniformState,a=n.currentFrustum,o=a.x,s=a.y;e.frameState.useLogDepth&&(i=s*(1-o/(i=Math.pow(2,i*CesiumMath.log2(s+1))-1))/(s-o));var l,c=e.view.passState.viewport,u=Cartesian4.clone(Cartesian4.UNIT_W,scratchNDC);u.x=(t.x-c.x)/c.width*2-1,u.y=(t.y-c.y)/c.height*2-1,u.z=2*i-1,u.w=1;var d=e.camera.frustum;if(defined(d.fovy)){var h=1/(l=Matrix4.multiplyByVector(n.inverseViewProjection,u,scratchWorldCoords)).w;Cartesian3.multiplyByScalar(l,h,l)}else defined(d._offCenterFrustum)&&(d=d._offCenterFrustum),(l=scratchWorldCoords).x=.5*(u.x*(d.right-d.left)+d.left+d.right),l.y=.5*(u.y*(d.top-d.bottom)+d.bottom+d.top),l.z=.5*(u.z*(o-s)-o-s),l.w=1,l=Matrix4.multiplyByVector(n.inverseView,l,l);return Cartesian3.fromCartesian4(l,r)};var SHOW_INDEX=Billboard.SHOW_INDEX=0,POSITION_INDEX=Billboard.POSITION_INDEX=1,PIXEL_OFFSET_INDEX=Billboard.PIXEL_OFFSET_INDEX=2,EYE_OFFSET_INDEX=Billboard.EYE_OFFSET_INDEX=3,HORIZONTAL_ORIGIN_INDEX=Billboard.HORIZONTAL_ORIGIN_INDEX=4,VERTICAL_ORIGIN_INDEX=Billboard.VERTICAL_ORIGIN_INDEX=5,SCALE_INDEX=Billboard.SCALE_INDEX=6,IMAGE_INDEX_INDEX=Billboard.IMAGE_INDEX_INDEX=7,COLOR_INDEX=Billboard.COLOR_INDEX=8,ROTATION_INDEX=Billboard.ROTATION_INDEX=9,ALIGNED_AXIS_INDEX=Billboard.ALIGNED_AXIS_INDEX=10,SCALE_BY_DISTANCE_INDEX=Billboard.SCALE_BY_DISTANCE_INDEX=11,TRANSLUCENCY_BY_DISTANCE_INDEX=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX=12,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,DISTANCE_DISPLAY_CONDITION=Billboard.DISTANCE_DISPLAY_CONDITION=14,DISABLE_DEPTH_DISTANCE=Billboard.DISABLE_DEPTH_DISTANCE=15;Billboard.TEXTURE_COORDINATE_BOUNDS=16;var SDF_INDEX=Billboard.SDF_INDEX=17;function makeDirty(e,t){var i=e._billboardCollection;defined(i)&&(i._updateBillboard(e,t),e._dirty=!0)}Billboard.NUMBER_OF_PROPERTIES=18,defineProperties$1(Billboard.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty(this,SHOW_INDEX))}},position:{get:function(){return this._position},set:function(e){var t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),this._updateClamping(),makeDirty(this,POSITION_INDEX))}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping(),makeDirty(this,POSITION_INDEX))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){var t=this._pixelOffset;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty(this,PIXEL_OFFSET_INDEX))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty(this,SCALE_BY_DISTANCE_INDEX))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty(this,TRANSLUCENCY_BY_DISTANCE_INDEX))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;NearFarScalar.equals(t,e)||(this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t),makeDirty(this,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var t=this._eyeOffset;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,EYE_OFFSET_INDEX))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,makeDirty(this,HORIZONTAL_ORIGIN_INDEX))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin!==e&&(this._verticalOrigin=e,makeDirty(this,VERTICAL_ORIGIN_INDEX))}},scale:{get:function(){return this._scale},set:function(e){this._scale!==e&&(this._scale=e,makeDirty(this,SCALE_INDEX))}},color:{get:function(){return this._color},set:function(e){var t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty(this,COLOR_INDEX))}},rotation:{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,makeDirty(this,ROTATION_INDEX))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){var t=this._alignedAxis;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),makeDirty(this,ALIGNED_AXIS_INDEX))}},width:{get:function(){return defaultValue(this._width,this._imageWidth)},set:function(e){this._width!==e&&(this._width=e,makeDirty(this,IMAGE_INDEX_INDEX))}},height:{get:function(){return defaultValue(this._height,this._imageHeight)},set:function(e){this._height!==e&&(this._height=e,makeDirty(this,IMAGE_INDEX_INDEX))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters!==e&&(this._sizeInMeters=e,makeDirty(this,COLOR_INDEX))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty(this,DISTANCE_DISPLAY_CONDITION))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty(this,DISABLE_DEPTH_DISTANCE))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,defined(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){defined(e)?"string"==typeof e?this.setImage(e,e):e instanceof Resource?this.setImage(e.url,e):defined(e.src)?this.setImage(e.src,e):this.setImage(createGuid(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,makeDirty(this,IMAGE_INDEX_INDEX))}},ready:{get:function(){return-1!==this._imageIndex}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition),makeDirty(this,POSITION_INDEX)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,makeDirty(this,SHOW_INDEX))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty(this,SDF_INDEX))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty(this,SDF_INDEX))}}}),Billboard.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId},Billboard.prototype._updateClamping=function(){Billboard._updateClamping(this._billboardCollection,this)};var scratchCartographic$3=new Cartographic,scratchPosition$6=new Cartesian3;Billboard._updateClamping=function(e,i){var t=e._scene;if(defined(t)&&defined(t.globe)){var r=t.globe,n=r.ellipsoid,a=r._surface,o=t.frameState.mode,s=o!==i._mode;if(i._mode=o,(i._heightReference===HeightReference$1.NONE||s)&&defined(i._removeCallbackFunc)&&(i._removeCallbackFunc(),i._removeCallbackFunc=void 0,i._clampedPosition=void 0),i._heightReference!==HeightReference$1.NONE&&defined(i._position)){var l=n.cartesianToCartographic(i._position);if(defined(l)){defined(i._removeCallbackFunc)&&i._removeCallbackFunc(),i._removeCallbackFunc=a.updateHeight(l,u),Cartographic.clone(l,scratchCartographic$3);var c=r.getHeight(l);defined(c)&&(scratchCartographic$3.height=c),n.cartographicToCartesian(scratchCartographic$3,scratchPosition$6),u(scratchPosition$6)}else i._actualClampedPosition=void 0}}function u(e){if(i._heightReference===HeightReference$1.RELATIVE_TO_GROUND)if(i._mode===SceneMode$1.SCENE3D){var t=n.cartesianToCartographic(e,scratchCartographic$3);t.height+=l.height,n.cartographicToCartesian(t,e)}else e.x+=l.height;i._clampedPosition=Cartesian3.clone(e,i._clampedPosition)}},Billboard.prototype._loadImage=function(){var e,i=this._billboardCollection._textureAtlas,r=this._imageId,n=this._image,a=this._imageSubRegion;if(defined(n)&&(e=i.addImage(r,n)),defined(a)&&(e=i.addSubRegion(r,a)),defined(this._imageIndexPromise=e)){var o=this;e.then(function(e){if(o._imageId===r&&o._image===n&&BoundingRectangle.equals(o._imageSubRegion,a)){var t=i.textureCoordinates[e];o._imageWidth=i.texture.width*t.width,o._imageHeight=i.texture.height*t.height,o._imageIndex=e,o._ready=!0,o._image=void 0,o._imageIndexPromise=void 0,makeDirty(o,IMAGE_INDEX_INDEX)}}).otherwise(function(e){console.error("Error loading image for billboard: "+e),o._imageIndexPromise=void 0})}},Billboard.prototype.setImage=function(e,t){this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype.setImageSubRegion=function(e,t){this._imageId===e&&BoundingRectangle.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=BoundingRectangle.clone(t),defined(this._billboardCollection._textureAtlas)&&this._loadImage())},Billboard.prototype._setTranslate=function(e){var t=this._translate;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),makeDirty(this,PIXEL_OFFSET_INDEX))},Billboard.prototype._getActualPosition=function(){return defined(this._clampedPosition)?this._clampedPosition:this._actualPosition},Billboard.prototype._setActualPosition=function(e){defined(this._clampedPosition)||Cartesian3.clone(e,this._actualPosition),makeDirty(this,POSITION_INDEX)};var tempCartesian3=new Cartesian4;Billboard._computeActualPosition=function(e,t,i,r){return defined(e._clampedPosition)?(i.mode!==e._mode&&e._updateClamping(),e._clampedPosition):i.mode===SceneMode$1.SCENE3D?t:(Matrix4.multiplyByPoint(r,t,tempCartesian3),SceneTransforms.computeActualWgs84Position(i,tempCartesian3))};var scratchCartesian3$9=new Cartesian3;Billboard._computeScreenSpacePosition=function(e,t,i,r,n,a){var o=Matrix4.multiplyByPoint(e,t,scratchCartesian3$9),s=SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(n,o,i,a);if(defined(s))return Cartesian2.add(s,r,s),s};var scratchPixelOffset=new Cartesian2(0,0);function VertexArrayFacade(e,t,i,r){var n=VertexArrayFacade._verifyAttributes(t);i=defaultValue(i,0);for(var a,o,s=[],l={},c=n.length,u=0;u<c;++u){var d=n[u];d.vertexBuffer?s.push(d):(defined(a=l[o=d.usage])||(a=l[o]=[]),a.push(d))}function h(e,t){return ComponentDatatype$1.getSizeInBytes(t.componentDatatype)-ComponentDatatype$1.getSizeInBytes(e.componentDatatype)}for(o in this._allBuffers=[],l)if(l.hasOwnProperty(o)){(a=l[o]).sort(h);var p=VertexArrayFacade._vertexSizeInBytes(a),m={vertexSizeInBytes:p,vertexBuffer:void 0,usage:a[0].usage,needsCommit:!1,arrayBuffer:void 0,arrayViews:VertexArrayFacade._createArrayViews(a,p)};this._allBuffers.push(m)}this._size=0,this._instanced=defaultValue(r,!1),this._precreated=s,this._context=e,this.writers=void 0,this.va=void 0,this.resize(i)}Billboard.prototype.computeScreenSpacePosition=function(e,t){var i=this._billboardCollection;defined(t)||(t=new Cartesian2),Cartesian2.clone(this._pixelOffset,scratchPixelOffset),Cartesian2.add(scratchPixelOffset,this._translate,scratchPixelOffset);var r=i.modelMatrix,n=this._position;if(defined(this._clampedPosition)&&(n=this._clampedPosition,e.mode!==SceneMode$1.SCENE3D)){var a=e.mapProjection,o=a.ellipsoid,s=a.unproject(n,scratchCartographic$3);n=o.cartographicToCartesian(s,scratchCartesian3$9),r=Matrix4.IDENTITY}return Billboard._computeScreenSpacePosition(r,n,this._eyeOffset,scratchPixelOffset,e,t)},Billboard.getScreenSpaceBoundingBox=function(e,t,i){var r=e.width,n=e.height,a=e.scale;r*=a,n*=a;var o=t.x;e.horizontalOrigin===HorizontalOrigin$1.RIGHT?o-=r:e.horizontalOrigin===HorizontalOrigin$1.CENTER&&(o-=.5*r);var s=t.y;return e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?s-=n:e.verticalOrigin===VerticalOrigin$1.CENTER&&(s-=.5*n),defined(i)||(i=new BoundingRectangle),i.x=o,i.y=s,i.width=r,i.height=n,i},Billboard.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.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&&BoundingRectangle.equals(this._imageSubRegion,e._imageSubRegion)&&Color.equals(this._color,e._color)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian2.equals(this._translate,e._translate)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},Billboard.prototype._destroy=function(){defined(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),defined(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0},VertexArrayFacade._verifyAttributes=function(e){for(var t=[],i=0;i<e.length;++i){var r=e[i],n={index:defaultValue(r.index,i),enabled:defaultValue(r.enabled,!0),componentsPerAttribute:r.componentsPerAttribute,componentDatatype:defaultValue(r.componentDatatype,ComponentDatatype$1.FLOAT),normalize:defaultValue(r.normalize,!1),vertexBuffer:r.vertexBuffer,usage:defaultValue(r.usage,BufferUsage$1.STATIC_DRAW)};t.push(n)}for(var a=new Array(t.length),o=0;o<t.length;++o){a[t[o].index]=!0}return t},VertexArrayFacade._vertexSizeInBytes=function(e){for(var t=0,i=e.length,r=0;r<i;++r){var n=e[r];t+=n.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(n.componentDatatype)}var a=0<i?ComponentDatatype$1.getSizeInBytes(e[0].componentDatatype):0,o=0<a?t%a:0;return t+=0==o?0:a-o},VertexArrayFacade._createArrayViews=function(e,t){for(var i=[],r=0,n=e.length,a=0;a<n;++a){var o=e[a],s=o.componentDatatype;i.push({index:o.index,enabled:o.enabled,componentsPerAttribute:o.componentsPerAttribute,componentDatatype:s,normalize:o.normalize,offsetInBytes:r,vertexSizeInComponentType:t/ComponentDatatype$1.getSizeInBytes(s),view:void 0}),r+=o.componentsPerAttribute*ComponentDatatype$1.getSizeInBytes(s)}return i},VertexArrayFacade.prototype.resize=function(e){this._size=e;var t=this._allBuffers;this.writers=[];for(var i=0,r=t.length;i<r;++i){var n=t[i];VertexArrayFacade._resize(n,this._size),VertexArrayFacade._appendWriters(this.writers,n)}destroyVA(this)},VertexArrayFacade._resize=function(e,t){if(0<e.vertexSizeInBytes){var i=new ArrayBuffer(t*e.vertexSizeInBytes);if(defined(e.arrayBuffer))for(var r=new Uint8Array(i),n=new Uint8Array(e.arrayBuffer),a=n.length,o=0;o<a;++o)r[o]=n[o];for(var s=e.arrayViews,l=s.length,c=0;c<l;++c){var u=s[c];u.view=ComponentDatatype$1.createArrayBufferView(u.componentDatatype,i,u.offsetInBytes)}e.arrayBuffer=i}};var createWriters=[function(i,r,n){return function(e,t){r[e*n]=t,i.needsCommit=!0}},function(n,a,o){return function(e,t,i){var r=e*o;a[r]=t,a[1+r]=i,n.needsCommit=!0}},function(a,o,s){return function(e,t,i,r){var n=e*s;o[n]=t,o[1+n]=i,o[2+n]=r,a.needsCommit=!0}},function(o,s,l){return function(e,t,i,r,n){var a=e*l;s[a]=t,s[1+a]=i,s[2+a]=r,s[3+a]=n,o.needsCommit=!0}}];function commit(e,t){if(t.needsCommit&&0<t.vertexSizeInBytes){t.needsCommit=!1;var i=t.vertexBuffer,r=e._size*t.vertexSizeInBytes,n=defined(i);if(!n||i.sizeInBytes<r)return n&&i.destroy(),t.vertexBuffer=Buffer$1.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),!(t.vertexBuffer.vertexArrayDestroyable=!1);t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}function subCommit(e,t,i){if(e.needsCommit&&0<e.vertexSizeInBytes){var r=e.vertexSizeInBytes*t,n=e.vertexSizeInBytes*i;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,r,n),r)}}function destroyVA(e){var t=e.va;if(defined(t)){for(var i=t.length,r=0;r<i;++r)t[r].va.destroy();e.va=void 0}}VertexArrayFacade._appendWriters=function(e,t){for(var i=t.arrayViews,r=i.length,n=0;n<r;++n){var a=i[n];e[a.index]=createWriters[a.componentsPerAttribute-1](t,a.view,a.vertexSizeInComponentType)}},VertexArrayFacade.prototype.commit=function(e){var t,i,r,n=!1,a=this._allBuffers;for(i=0,r=a.length;i<r;++i)n=commit(this,t=a[i])||n;if(n||!defined(this.va)){destroyVA(this);for(var o=this.va=[],s=CesiumMath.SIXTY_FOUR_KILOBYTES-4,l=defined(e)&&!this._instanced?Math.ceil(this._size/s):1,c=0;c<l;++c){var u=[];for(i=0,r=a.length;i<r;++i){var d=c*((t=a[i]).vertexSizeInBytes*s);VertexArrayFacade._appendAttributes(u,t,d,this._instanced)}u=u.concat(this._precreated),o.push({va:new VertexArray({context:this._context,attributes:u,indexBuffer:e}),indicesCount:1.5*(c!==l-1?s:this._size%s)})}}},VertexArrayFacade._appendAttributes=function(e,t,i,r){for(var n=t.arrayViews,a=n.length,o=0;o<a;++o){var s=n[o];e.push({index:s.index,enabled:s.enabled,componentsPerAttribute:s.componentsPerAttribute,componentDatatype:s.componentDatatype,normalize:s.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:i+s.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:r?1:0})}},VertexArrayFacade.prototype.subCommit=function(e,t){for(var i=this._allBuffers,r=0,n=i.length;r<n;++r)subCommit(i[r],e,t)},VertexArrayFacade.prototype.endSubCommits=function(){for(var e=this._allBuffers,t=0,i=e.length;t<i;++t)e[t].needsCommit=!1},VertexArrayFacade.prototype.isDestroyed=function(){return!1},VertexArrayFacade.prototype.destroy=function(){for(var e=this._allBuffers,t=0,i=e.length;t<i;++t){var r=e[t];r.vertexBuffer=r.vertexBuffer&&r.vertexBuffer.destroy()}return destroyVA(this),destroyObject(this)};var BillboardCollectionFS="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform sampler2D u_atlas;\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\nvarying vec2 v_textureCoordinates;\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nfloat getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)\n{\nvec2 lookupVector = imageSize * (depthLookupST - adjustedST);\nlookupVector = v_rotationMatrix * lookupVector;\nvec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y));\nvec2 translation = v_originTextureCoordinateAndTranslate.zw;\nif (applyTranslate)\n{\ntranslation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));\n}\nvec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;\nfloat logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));\nif (logDepthOrDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\n#ifdef SDF\nfloat getDistance(vec2 position)\n{\nreturn texture2D(u_atlas, position).r;\n}\nvec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)\n{\nfloat distance = getDistance(position);\nif (outlineWidth > 0.0)\n{\nfloat outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);\nfloat outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nvec4 sdfColor = mix(outlineColor, v_color, outlineFactor);\nfloat alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);\nreturn vec4(sdfColor.rgb, sdfColor.a * alpha);\n}\nelse\n{\nfloat alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\nreturn vec4(v_color.rgb, v_color.a * alpha);\n}\n}\n#endif\nvoid main()\n{\nvec4 color = texture2D(u_atlas, v_textureCoordinates);\n#ifdef SDF\nfloat outlineWidth = v_outlineWidth;\nvec4 outlineColor = v_outlineColor;\nfloat distance = getDistance(v_textureCoordinates);\n#ifdef GL_OES_standard_derivatives\nfloat smoothing = fwidth(distance);\nvec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));\nvec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\nvec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\nvec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\ncolor = (center + color1 + color2 + color3 + color4)/5.0;\n#else\nfloat smoothing = 1.0/32.0;\ncolor = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n#endif\ncolor = czm_gammaCorrect(color);\n#else\ncolor = czm_gammaCorrect(color);\ncolor *= czm_gammaCorrect(v_color);\n#endif\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\n#ifdef VECTOR_TILE\ncolor *= u_highlightColor;\n#endif\ngl_FragColor = color;\nczm_writeLogDepth();\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat temp = v_compressed.y;\ntemp = temp * SHIFT_RIGHT1;\nfloat temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\nbool enableDepthTest = temp2 != 0.0;\nbool applyTranslate = floor(temp) != 0.0;\nif (enableDepthTest) {\ntemp = v_compressed.z;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\ntemp = v_compressed.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 imageSize;\nimageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;\nimageSize.x = floor(temp);\nvec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;\nadjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);\nfloat epsilonEyeDepth = v_compressed.x + czm_epsilon1;\nfloat globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);\nif (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)\n{\nfloat globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)\n{\nfloat globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize);\nif (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)\n{\ndiscard;\n}\n}\n}\n}\n#endif\n}\n",BillboardCollectionVS="#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScale;\nattribute vec4 positionLowAndRotation;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 compressedAttribute2;\nattribute vec4 eyeOffset;\nattribute vec4 scaleByDistance;\nattribute vec4 pixelOffsetScaleByDistance;\nattribute vec4 compressedAttribute3;\nattribute vec2 sdf;\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\nattribute vec4 textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef VECTOR_TILE\nattribute float a_batchId;\n#endif\nvarying vec2 v_textureCoordinates;\n#ifdef FRAGMENT_DEPTH_CHECK\nvarying vec4 v_textureCoordinateBounds;\nvarying vec4 v_originTextureCoordinateAndTranslate;\nvarying vec4 v_compressed;\nvarying mat2 v_rotationMatrix;\n#endif\nvarying vec4 v_pickColor;\nvarying vec4 v_color;\n#ifdef SDF\nvarying vec4 v_outlineColor;\nvarying float v_outlineWidth;\n#endif\nconst float UPPER_BOUND = 32768.0;\nconst float SHIFT_LEFT16 = 65536.0;\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_LEFT7 = 128.0;\nconst float SHIFT_LEFT5 = 32.0;\nconst float SHIFT_LEFT3 = 8.0;\nconst float SHIFT_LEFT2 = 4.0;\nconst float SHIFT_LEFT1 = 2.0;\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nconst float SHIFT_RIGHT7 = 1.0 / 128.0;\nconst float SHIFT_RIGHT5 = 1.0 / 32.0;\nconst float SHIFT_RIGHT3 = 1.0 / 8.0;\nconst float SHIFT_RIGHT2 = 1.0 / 4.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\nvec4 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)\n{\nvec2 halfSize = imageSize * scale * 0.5;\nhalfSize *= ((direction * 2.0) - 1.0);\nvec2 originTranslate = origin * abs(halfSize);\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nif (validAlignedAxis || rotation != 0.0)\n{\nfloat angle = rotation;\nif (validAlignedAxis)\n{\nvec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);\nangle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /\n(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));\n}\nfloat cosTheta = cos(angle);\nfloat sinTheta = sin(angle);\nrotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\nhalfSize = rotationMatrix * halfSize;\n}\nelse\n{\nrotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n}\n#endif\nmpp = czm_metersPerPixel(positionEC);\npositionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);\npositionEC.xy += (translate + pixelOffset) * mpp;\nreturn positionEC;\n}\n#ifdef VERTEX_DEPTH_CHECK\nfloat getGlobeDepth(vec4 positionEC)\n{\nvec4 posWC = czm_eyeToWindowCoordinates(positionEC);\nfloat globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));\nif (globeDepth == 0.0)\n{\nreturn 0.0;\n}\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);\nreturn eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\nvoid main()\n{\nvec3 positionHigh = positionHighAndScale.xyz;\nvec3 positionLow = positionLowAndRotation.xyz;\nfloat scale = positionHighAndScale.w;\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nfloat rotation = positionLowAndRotation.w;\n#else\nfloat rotation = 0.0;\n#endif\nfloat compressed = compressedAttribute0.x;\nvec2 pixelOffset;\npixelOffset.x = floor(compressed * SHIFT_RIGHT7);\ncompressed -= pixelOffset.x * SHIFT_LEFT7;\npixelOffset.x -= UPPER_BOUND;\nvec2 origin;\norigin.x = floor(compressed * SHIFT_RIGHT5);\ncompressed -= origin.x * SHIFT_LEFT5;\norigin.y = floor(compressed * SHIFT_RIGHT3);\ncompressed -= origin.y * SHIFT_LEFT3;\n#ifdef FRAGMENT_DEPTH_CHECK\nvec2 depthOrigin = origin.xy;\n#endif\norigin -= vec2(1.0);\nfloat show = floor(compressed * SHIFT_RIGHT2);\ncompressed -= show * SHIFT_LEFT2;\n#ifdef INSTANCED\nvec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\nvec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\nvec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n#else\nvec2 direction;\ndirection.x = floor(compressed * SHIFT_RIGHT1);\ndirection.y = compressed - direction.x * SHIFT_LEFT1;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n#endif\nfloat temp = compressedAttribute0.y  * SHIFT_RIGHT8;\npixelOffset.y = -(floor(temp) - UPPER_BOUND);\nvec2 translate;\ntranslate.y = (temp - floor(temp)) * SHIFT_LEFT16;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\ntranslate.x = floor(temp) - UPPER_BOUND;\ntranslate.y += (temp - floor(temp)) * SHIFT_LEFT8;\ntranslate.y -= UPPER_BOUND;\ntemp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\nvec2 imageSize = vec2(floor(temp), temp2);\n#ifdef FRAGMENT_DEPTH_CHECK\nfloat labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\nfloat applyTranslate = 0.0;\nif (labelHorizontalOrigin != 0.0)\n{\napplyTranslate = 1.0;\nlabelHorizontalOrigin -= 2.0;\ndepthOrigin.x = labelHorizontalOrigin + 1.0;\n}\ndepthOrigin = vec2(1.0) - (depthOrigin * 0.5);\n#endif\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\ntemp = compressedAttribute3.w;\ntemp = temp * SHIFT_RIGHT12;\nvec2 dimensions;\ndimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\ndimensions.x = floor(temp);\n#endif\n#ifdef ALIGNED_AXIS\nvec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\ntemp = compressedAttribute2.z * SHIFT_RIGHT5;\nbool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;\n#else\nvec3 alignedAxis = vec3(0.0);\nbool validAlignedAxis = false;\n#endif\nvec4 pickColor;\nvec4 color;\ntemp = compressedAttribute2.y;\ntemp = temp * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\ntemp = compressedAttribute2.x;\ntemp = temp * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute2.z * SHIFT_RIGHT8;\nbool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)\nfloat eyeDepth = positionEC.z;\n#endif\npositionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\nfloat distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);\nscale *= distanceScale;\ntranslate *= distanceScale;\nif (scale == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency == 0.0)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef EYE_DISTANCE_PIXEL_OFFSET\nfloat pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\npixelOffset *= pixelOffsetScale;\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = compressedAttribute3.x;\nfloat farSq = compressedAttribute3.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nmat2 rotationMatrix;\nfloat mpp;\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = compressedAttribute3.z;\n#endif\n#ifdef VERTEX_DEPTH_CHECK\nif (lengthSq < disableDepthTestDistance) {\nfloat depthsilon = 10.0;\nvec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;\nvec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth1 = getGlobeDepth(pEC1);\nif (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)\n{\nvec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth2 = getGlobeDepth(pEC2);\nif (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)\n{\nvec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\nfloat globeDepth3 = getGlobeDepth(pEC3);\nif (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)\n{\npositionEC.xyz = vec3(0.0);\n}\n}\n}\n}\n#endif\npositionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\ngl_Position = czm_projection * positionEC;\nv_textureCoordinates = textureCoordinates;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth();\n#endif\n#ifdef DISABLE_DEPTH_DISTANCE\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(vec4(czm_currentFrustum.x));\n#endif\n}\n}\n#endif\n#ifdef FRAGMENT_DEPTH_CHECK\nif (sizeInMeters) {\ntranslate /= mpp;\ndimensions /= mpp;\nimageSize /= mpp;\n}\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\nv_rotationMatrix = rotationMatrix;\n#else\nv_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n#endif\nfloat enableDepthCheck = 0.0;\nif (lengthSq < disableDepthTestDistance)\n{\nenableDepthCheck = 1.0;\n}\nfloat dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));\nfloat dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));\nfloat iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));\nfloat ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));\nv_compressed.x = eyeDepth;\nv_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;\nv_compressed.z = dw * SHIFT_LEFT12 + dh;\nv_compressed.w = iw * SHIFT_LEFT12 + ih;\nv_originTextureCoordinateAndTranslate.xy = depthOrigin;\nv_originTextureCoordinateAndTranslate.zw = translate;\nv_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;\n#endif\n#ifdef SDF\nvec4 outlineColor;\nfloat outlineWidth;\ntemp = sdf.x;\ntemp = temp * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\ntemp = sdf.y;\ntemp = temp * SHIFT_RIGHT8;\nfloat temp3 = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.a = floor(temp);\noutlineColor /= 255.0;\nv_outlineWidth = outlineWidth / 255.0;\nv_outlineColor = outlineColor;\n#endif\nv_pickColor = pickColor;\nv_color = color;\nv_color.a *= translucency;\n}\n",BlendOption={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},BlendOption$1=freezeObject$1(BlendOption),SDFSettings={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},SDFSettings$1=freezeObject$1(SDFSettings);function attachTexture(e,t,i){var r=e._gl;r.framebufferTexture2D(r.FRAMEBUFFER,t,i._target,i._texture,0)}function attachRenderbuffer(e,t,i){var r=e._gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,t,r.RENDERBUFFER,i._getRenderbuffer())}function Framebuffer(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl;this._gl=t,this._framebuffer=t.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=defaultValue(e.destroyAttachments,!0);var i,r,n,a,o;defined(e.depthTexture)||defined(e.depthRenderbuffer),defined(e.depthStencilTexture)||defined(e.depthStencilRenderbuffer);if(this._bind(),defined(e.colorTextures)){var s=e.colorTextures;for(a=this._colorTextures.length=this._activeColorAttachments.length=s.length,n=0;n<a;++n)i=s[n],attachTexture(this,o=this._gl.COLOR_ATTACHMENT0+n,i),this._activeColorAttachments[n]=o,this._colorTextures[n]=i}if(defined(e.colorRenderbuffers)){var l=e.colorRenderbuffers;for(a=this._colorRenderbuffers.length=this._activeColorAttachments.length=l.length,n=0;n<a;++n)r=l[n],attachRenderbuffer(this,o=this._gl.COLOR_ATTACHMENT0+n,r),this._activeColorAttachments[n]=o,this._colorRenderbuffers[n]=r}defined(e.depthTexture)&&(i=e.depthTexture,attachTexture(this,this._gl.DEPTH_ATTACHMENT,i),this._depthTexture=i),defined(e.depthRenderbuffer)&&(r=e.depthRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_ATTACHMENT,r),this._depthRenderbuffer=r),defined(e.stencilRenderbuffer)&&(r=e.stencilRenderbuffer,attachRenderbuffer(this,this._gl.STENCIL_ATTACHMENT,r),this._stencilRenderbuffer=r),defined(e.depthStencilTexture)&&(i=e.depthStencilTexture,attachTexture(this,this._gl.DEPTH_STENCIL_ATTACHMENT,i),this._depthStencilTexture=i),defined(e.depthStencilRenderbuffer)&&(r=e.depthStencilRenderbuffer,attachRenderbuffer(this,this._gl.DEPTH_STENCIL_ATTACHMENT,r),this._depthStencilRenderbuffer=r),this._unBind()}function TextureAtlasNode(e,t,i,r,n){this.bottomLeft=defaultValue(e,Cartesian2.ZERO),this.topRight=defaultValue(t,Cartesian2.ZERO),this.childNode1=i,this.childNode2=r,this.imageIndex=n}defineProperties$1(Framebuffer.prototype,{status:{get:function(){this._bind();var 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)}}}),Framebuffer.prototype._bind=function(){var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)},Framebuffer.prototype._unBind=function(){var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},Framebuffer.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments},Framebuffer.prototype.getColorTexture=function(e){return this._colorTextures[e]},Framebuffer.prototype.getColorRenderbuffer=function(e){return this._colorRenderbuffers[e]},Framebuffer.prototype.isDestroyed=function(){return!1},Framebuffer.prototype.destroy=function(){if(this.destroyAttachments){for(var e=0,t=this._colorTextures,i=t.length;e<i;++e){var r=t[e];defined(r)&&r.destroy()}var n=this._colorRenderbuffers;for(i=n.length,e=0;e<i;++e){var a=n[e];defined(a)&&a.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),destroyObject(this)};var defaultInitialSize=new Cartesian2(16,16);function TextureAtlas(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).borderWidthInPixels,1),i=defaultValue(e.initialSize,defaultInitialSize);this._context=e.context,this._pixelFormat=defaultValue(e.pixelFormat,PixelFormat$1.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=createGuid(),this._idHash={},this._initialSize=i,this._root=void 0}function resizeAtlas(e,t){var i=e._context,r=e.numberOfImages,n=e._borderWidthInPixels;if(0<r&&e._texture.width<2e3&&e._texture.height<2e3){for(var a=e._texture.width,o=e._texture.height,s=2*(a+t.width+n),l=2*(o+t.height+n),c=a/s,u=o/l,d=new TextureAtlasNode(new Cartesian2(a+n,n),new Cartesian2(s,o)),h=new TextureAtlasNode(new Cartesian2,new Cartesian2(s,o),e._root,d),p=new TextureAtlasNode(new Cartesian2(n,o+n),new Cartesian2(s,l)),m=new TextureAtlasNode(new Cartesian2,new Cartesian2(s,l),h,p),f=0;f<e._textureCoordinates.length;f++){var g=e._textureCoordinates[f];defined(g)&&(g.x*=c,g.y*=u,g.width*=c,g.height*=u)}var _=new Texture({context:e._context,width:s,height:l,pixelFormat:e._pixelFormat}),y=new Framebuffer({context:i,colorTextures:[e._texture],destroyAttachments:!1});y._bind(),_.copyFromFramebuffer(0,0,0,0,s,l),y._unBind(),y.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=_,e._root=m}else{var v=2*(t.width+2*n),C=2*(t.height+2*n);v<e._initialSize.x&&(v=e._initialSize.x),C<e._initialSize.y&&(C=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new Texture({context:e._context,width:v,height:C,pixelFormat:e._pixelFormat}),e._root=new TextureAtlasNode(new Cartesian2(n,n),new Cartesian2(v,C))}}function findNode$1(e,t,i){if(defined(t)){if(defined(t.childNode1)||defined(t.childNode2))return findNode$1(e,t.childNode1,i)||findNode$1(e,t.childNode2,i);if(defined(t.imageIndex))return;var r=t.topRight.x-t.bottomLeft.x,n=t.topRight.y-t.bottomLeft.y,a=r-i.width,o=n-i.height;if(a<0||o<0)return;if(0==a&&0==o)return t;if(o<a){t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.bottomLeft.x+i.width,t.topRight.y));var s=t.bottomLeft.x+i.width+e._borderWidthInPixels;s<t.topRight.x&&(t.childNode2=new TextureAtlasNode(new Cartesian2(s,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.topRight.y)))}else{t.childNode1=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,t.bottomLeft.y),new Cartesian2(t.topRight.x,t.bottomLeft.y+i.height));var l=t.bottomLeft.y+i.height+e._borderWidthInPixels;l<t.topRight.y&&(t.childNode2=new TextureAtlasNode(new Cartesian2(t.bottomLeft.x,l),new Cartesian2(t.topRight.x,t.topRight.y)))}return findNode$1(e,t.childNode1,i)}}function addImage(e,t,i){var r=findNode$1(e,e._root,t);if(defined(r)){r.imageIndex=i;var n=e._texture.width,a=e._texture.height,o=r.topRight.x-r.bottomLeft.x,s=r.topRight.y-r.bottomLeft.y,l=r.bottomLeft.x/n,c=r.bottomLeft.y/a,u=o/n,d=s/a;e._textureCoordinates[i]=new BoundingRectangle(l,c,u,d),e._texture.copyFrom(t,r.bottomLeft.x,r.bottomLeft.y)}else resizeAtlas(e,t),addImage(e,t,i);e._guid=createGuid()}defineProperties$1(TextureAtlas.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return defined(this._texture)||(this._texture=new Texture({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}}}),TextureAtlas.prototype.addImage=function(e,t){var i=this._idHash[e];if(defined(i))return i;if("function"==typeof t)t=t(e);else if("string"==typeof t||t instanceof Resource){t=Resource.createIfNeeded(t).fetchImage()}var r=this;return i=when(t,function(e){if(r.isDestroyed())return-1;var t=r.numberOfImages;return addImage(r,e,t),t}),this._idHash[e]=i},TextureAtlas.prototype.addSubRegion=function(e,c){var t=this._idHash[e];if(!defined(t))throw new RuntimeError('image with id "'+e+'" not found in the atlas.');var u=this;return when(t,function(e){if(-1===e)return-1;var t=u._texture.width,i=u._texture.height,r=u.numberOfImages,n=u._textureCoordinates[e],a=n.x+c.x/t,o=n.y+c.y/i,s=c.width/t,l=c.height/i;return u._textureCoordinates.push(new BoundingRectangle(a,o,s,l)),u._guid=createGuid(),r})},TextureAtlas.prototype.isDestroyed=function(){return!1},TextureAtlas.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};var SHOW_INDEX$1=Billboard.SHOW_INDEX,POSITION_INDEX$1=Billboard.POSITION_INDEX,PIXEL_OFFSET_INDEX$1=Billboard.PIXEL_OFFSET_INDEX,EYE_OFFSET_INDEX$1=Billboard.EYE_OFFSET_INDEX,HORIZONTAL_ORIGIN_INDEX$1=Billboard.HORIZONTAL_ORIGIN_INDEX,VERTICAL_ORIGIN_INDEX$1=Billboard.VERTICAL_ORIGIN_INDEX,SCALE_INDEX$1=Billboard.SCALE_INDEX,IMAGE_INDEX_INDEX$1=Billboard.IMAGE_INDEX_INDEX,COLOR_INDEX$1=Billboard.COLOR_INDEX,ROTATION_INDEX$1=Billboard.ROTATION_INDEX,ALIGNED_AXIS_INDEX$1=Billboard.ALIGNED_AXIS_INDEX,SCALE_BY_DISTANCE_INDEX$1=Billboard.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX$1=Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX,PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1=Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX=Billboard.DISTANCE_DISPLAY_CONDITION,DISABLE_DEPTH_DISTANCE$1=Billboard.DISABLE_DEPTH_DISTANCE,TEXTURE_COORDINATE_BOUNDS=Billboard.TEXTURE_COORDINATE_BOUNDS,SDF_INDEX$1=Billboard.SDF_INDEX,NUMBER_OF_PROPERTIES=Billboard.NUMBER_OF_PROPERTIES,attributeLocations,attributeLocationsBatched={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},attributeLocationsInstanced={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},getIndexBuffer;function BillboardCollection(e){e=defaultValue(e,defaultValue.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(NUMBER_OF_PROPERTIES),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=defaultValue(e.debugShowTextureAtlas,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW],this._highlightColor=Color.clone(Color.WHITE);var t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};var i=this._scene;defined(i)&&defined(i.terrainProviderChanged)&&(this._removeCallbackFunc=i.terrainProviderChanged.addEventListener(function(){for(var e=this._billboards,t=e.length,i=0;i<t;++i)e[i]._updateClamping()},this))}function destroyBillboards(e){for(var t=e.length,i=0;i<t;++i)e[i]&&e[i]._destroy()}function removeBillboards(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;for(var t=[],i=e._billboards,r=i.length,n=0,a=0;n<r;++n){var o=i[n];o&&(o._index=a++,t.push(o))}e._billboards=t}}function getIndexBufferBatched(e){var t=e.cache.billboardCollection_indexBufferBatched;if(defined(t))return t;for(var i=new Uint16Array(98298),r=0,n=0;r<98298;r+=6,n+=4)i[r]=n,i[r+1]=n+1,i[r+2]=n+2,i[r+3]=n+0,i[r+4]=n+2,i[r+5]=n+3;return(t=Buffer$1.createIndexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})).vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=t}function getIndexBufferInstanced(e){var t=e.cache.billboardCollection_indexBufferInstanced;return defined(t)?t:((t=Buffer$1.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT})).vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t)}function getVertexBufferInstanced(e){var t=e.cache.billboardCollection_vertexBufferInstanced;return defined(t)?t:((t=Buffer$1.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:BufferUsage$1.STATIC_DRAW})).vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t)}function createVAF(e,t,i,r,n,a){var o=[{index:attributeLocations.positionHighAndScale,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$1]},{index:attributeLocations.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$1]},{index:attributeLocations.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[PIXEL_OFFSET_INDEX$1]},{index:attributeLocations.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TRANSLUCENCY_BY_DISTANCE_INDEX$1]},{index:attributeLocations.compressedAttribute2,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[COLOR_INDEX$1]},{index:attributeLocations.eyeOffset,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[EYE_OFFSET_INDEX$1]},{index:attributeLocations.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SCALE_BY_DISTANCE_INDEX$1]},{index:attributeLocations.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1]},{index:attributeLocations.compressedAttribute3,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[DISTANCE_DISPLAY_CONDITION_INDEX]},{index:attributeLocations.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TEXTURE_COORDINATE_BOUNDS]}];return r&&o.push({index:attributeLocations.direction,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:getVertexBufferInstanced(e)}),defined(n)&&o.push({index:attributeLocations.a_batchId,componentsPerAttribute:1,componentDatatyps:ComponentDatatype$1.FLOAT,bufferUsage:BufferUsage$1.STATIC_DRAW}),a&&o.push({index:attributeLocations.sdf,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SDF_INDEX$1]}),new VertexArrayFacade(e,o,r?t:4*t,r)}defineProperties$1(BillboardCollection.prototype,{length:{get:function(){return removeBillboards(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}}}),BillboardCollection.prototype.add=function(e){var t=new Billboard(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t},BillboardCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._billboards[e._index]=null,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},BillboardCollection.prototype.removeAll=function(){destroyBillboards(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0},BillboardCollection.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]},BillboardCollection.prototype.contains=function(e){return defined(e)&&e._billboardCollection===this},BillboardCollection.prototype.get=function(e){return removeBillboards(this),this._billboards[e]},BillboardCollection.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;r<NUMBER_OF_PROPERTIES;++r){var n=0===i[r]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var writePositionScratch=new EncodedCartesian3;function writePositionScaleAndRotation(e,t,i,r,n){var a,o=r[attributeLocations.positionHighAndScale],s=r[attributeLocations.positionLowAndRotation],l=n._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,l,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(l,writePositionScratch);var c=n.scale,u=n.rotation;0!==u&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,c);var d=writePositionScratch.high,h=writePositionScratch.low;e._instanced?(o(a=n._index,d.x,d.y,d.z,c),s(a,h.x,h.y,h.z,u)):(o((a=4*n._index)+0,d.x,d.y,d.z,c),o(a+1,d.x,d.y,d.z,c),o(a+2,d.x,d.y,d.z,c),o(a+3,d.x,d.y,d.z,c),s(a+0,h.x,h.y,h.z,u),s(a+1,h.x,h.y,h.z,u),s(a+2,h.x,h.y,h.z,u),s(a+3,h.x,h.y,h.z,u))}var scratchCartesian2$8=new Cartesian2,UPPER_BOUND=32768,LEFT_SHIFT16=65536,LEFT_SHIFT12=4096,LEFT_SHIFT8=256,LEFT_SHIFT7=128,LEFT_SHIFT5=32,LEFT_SHIFT3=8,LEFT_SHIFT2=4,RIGHT_SHIFT8=1/256,LOWER_LEFT=0,LOWER_RIGHT=2,UPPER_RIGHT=3,UPPER_LEFT=1;function writeCompressedAttrib0(e,t,i,r,n){var a,o=r[attributeLocations.compressedAttribute0],s=n.pixelOffset,l=s.x,c=s.y,u=n._translate,d=u.x,h=u.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(l+d),Math.abs(-c+h));var p=n.horizontalOrigin,m=n._verticalOrigin,f=n.show&&n.clusterShow;0===n.color.alpha&&(f=!1),m===VerticalOrigin$1.BASELINE&&(m=VerticalOrigin$1.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&p===HorizontalOrigin$1.CENTER,e._allVerticalCenter=e._allVerticalCenter&&m===VerticalOrigin$1.CENTER;var g=0,_=0,y=0,v=0,C=n._imageIndex;if(-1!==C){var S=i[C];g=S.x,_=S.y,y=S.width,v=S.height}var x=g+y,T=_+v,b=Math.floor(CesiumMath.clamp(l,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT7;b+=(p+1)*LEFT_SHIFT5,b+=(m+1)*LEFT_SHIFT3,b+=(f?1:0)*LEFT_SHIFT2;var E=Math.floor(CesiumMath.clamp(c,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8,P=Math.floor(CesiumMath.clamp(d,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*LEFT_SHIFT8,A=(CesiumMath.clamp(h,-UPPER_BOUND,UPPER_BOUND)+UPPER_BOUND)*RIGHT_SHIFT8,w=Math.floor(A);E+=w,P+=Math.floor((A-w)*LEFT_SHIFT8),scratchCartesian2$8.x=g,scratchCartesian2$8.y=_;var D=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8);scratchCartesian2$8.x=x;var M=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8);scratchCartesian2$8.y=T;var I=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8);scratchCartesian2$8.x=g;var R=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8);e._instanced?o(a=n._index,b,E,P,D):(o((a=4*n._index)+0,b+LOWER_LEFT,E,P,D),o(a+1,b+LOWER_RIGHT,E,P,M),o(a+2,b+UPPER_RIGHT,E,P,I),o(a+3,b+UPPER_LEFT,E,P,R))}function writeCompressedAttrib1(e,t,i,r,n){var a,o=r[attributeLocations.compressedAttribute1],s=n.alignedAxis;Cartesian3.equals(s,Cartesian3.ZERO)||(e._shaderAlignedAxis=!0);var l=0,c=1,u=1,d=1,h=n.translucencyByDistance;defined(h)&&(l=h.near,c=h.nearValue,u=h.far,d=h.farValue,1===c&&1===d||(e._shaderTranslucencyByDistance=!0));var p=0,m=n._imageIndex;-1!==m&&(p=i[m].width);var f=e._textureAtlas.texture.width,g=Math.round(defaultValue(n.width,f*p));e._maxSize=Math.max(e._maxSize,g);var _=CesiumMath.clamp(g,0,LEFT_SHIFT16),y=0;Math.abs(Cartesian3.magnitudeSquared(s)-1)<CesiumMath.EPSILON6&&(y=AttributeCompression.octEncodeFloat(s)),c=CesiumMath.clamp(c,0,1),_=_*LEFT_SHIFT8+(c=1===c?255:255*c|0),d=CesiumMath.clamp(d,0,1),y=y*LEFT_SHIFT8+(d=1===d?255:255*d|0),e._instanced?o(a=n._index,_,y,l,u):(o((a=4*n._index)+0,_,y,l,u),o(a+1,_,y,l,u),o(a+2,_,y,l,u),o(a+3,_,y,l,u))}function writeCompressedAttrib2(e,t,i,r,n){var a,o=r[attributeLocations.compressedAttribute2],s=n.color,l=defined(e._batchTable)?Color.WHITE:n.getPickId(t).color,c=n.sizeInMeters?1:0,u=Math.abs(Cartesian3.magnitudeSquared(n.alignedAxis)-1)<CesiumMath.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&1==c;var d=0,h=n._imageIndex;-1!==h&&(d=i[h].height);var p=e._textureAtlas.texture.dimensions,m=Math.round(defaultValue(n.height,p.y*d));e._maxSize=Math.max(e._maxSize,m);var f=defaultValue(n._labelHorizontalOrigin,-2),g=m*LEFT_SHIFT2+(f+=2),_=Color.floatToByte(s.red),y=Color.floatToByte(s.green),v=Color.floatToByte(s.blue),C=_*LEFT_SHIFT16+y*LEFT_SHIFT8+v;_=Color.floatToByte(l.red),y=Color.floatToByte(l.green),v=Color.floatToByte(l.blue);var S=_*LEFT_SHIFT16+y*LEFT_SHIFT8+v,x=Color.floatToByte(s.alpha)*LEFT_SHIFT16+Color.floatToByte(l.alpha)*LEFT_SHIFT8;x+=2*c+u,e._instanced?o(a=n._index,C,S,x,g):(o((a=4*n._index)+0,C,S,x,g),o(a+1,C,S,x,g),o(a+2,C,S,x,g),o(a+3,C,S,x,g))}function writeEyeOffset(e,t,i,r,n){var a,o=r[attributeLocations.eyeOffset],s=n.eyeOffset,l=s.z;if(n._heightReference!==HeightReference$1.NONE&&(l*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(s.x),Math.abs(s.y),Math.abs(l)),e._instanced){var c=0,u=0,d=n._imageIndex;if(-1!==d){var h=i[d];c=h.width,u=h.height}scratchCartesian2$8.x=c,scratchCartesian2$8.y=u;var p=AttributeCompression.compressTextureCoordinates(scratchCartesian2$8);o(a=n._index,s.x,s.y,l,p)}else o((a=4*n._index)+0,s.x,s.y,l,0),o(a+1,s.x,s.y,l,0),o(a+2,s.x,s.y,l,0),o(a+3,s.x,s.y,l,0)}function writeScaleByDistance(e,t,i,r,n){var a,o=r[attributeLocations.scaleByDistance],s=0,l=1,c=1,u=1,d=n.scaleByDistance;defined(d)&&(s=d.near,l=d.nearValue,c=d.far,u=d.farValue,1===l&&1===u||(e._shaderScaleByDistance=!0)),e._instanced?o(a=n._index,s,l,c,u):(o((a=4*n._index)+0,s,l,c,u),o(a+1,s,l,c,u),o(a+2,s,l,c,u),o(a+3,s,l,c,u))}function writePixelOffsetScaleByDistance(e,t,i,r,n){var a,o=r[attributeLocations.pixelOffsetScaleByDistance],s=0,l=1,c=1,u=1,d=n.pixelOffsetScaleByDistance;defined(d)&&(s=d.near,l=d.nearValue,c=d.far,u=d.farValue,1===l&&1===u||(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?o(a=n._index,s,l,c,u):(o((a=4*n._index)+0,s,l,c,u),o(a+1,s,l,c,u),o(a+2,s,l,c,u),o(a+3,s,l,c,u))}function writeCompressedAttribute3(e,t,i,r,n){var a,o=r[attributeLocations.compressedAttribute3],s=0,l=Number.MAX_VALUE,c=n.distanceDisplayCondition;defined(c)&&(s=c.near,l=c.far,s*=s,l*=l,e._shaderDistanceDisplayCondition=!0);var u,d,h=n.disableDepthTestDistance,p=n.heightReference===HeightReference$1.CLAMP_TO_GROUND&&e._scene.context.depthTexture;if(defined(h)||(h=p?5e3:0),h*=h,(p||0<h)&&(e._shaderDisableDepthDistance=!0,h===Number.POSITIVE_INFINITY&&(h=-1)),defined(n._labelDimensions))d=n._labelDimensions.x,u=n._labelDimensions.y;else{var m=0,f=0,g=n._imageIndex;if(-1!==g){var _=i[g];m=_.height,f=_.width}u=Math.round(defaultValue(n.height,e._textureAtlas.texture.dimensions.y*m));var y=e._textureAtlas.texture.width;d=Math.round(defaultValue(n.width,y*f))}var v=Math.floor(CesiumMath.clamp(d,0,LEFT_SHIFT12)),C=Math.floor(CesiumMath.clamp(u,0,LEFT_SHIFT12)),S=v*LEFT_SHIFT12+C;e._instanced?o(a=n._index,s,l,h,S):(o((a=4*n._index)+0,s,l,h,S),o(a+1,s,l,h,S),o(a+2,s,l,h,S),o(a+3,s,l,h,S))}function writeTextureCoordinateBoundsOrLabelTranslate(e,t,i,r,n){var a;n.heightReference===HeightReference$1.CLAMP_TO_GROUND&&(e._shaderClampToGround=e._scene.context.depthTexture);var o=r[attributeLocations.textureCoordinateBoundsOrLabelTranslate];if(0<ContextLimits.maximumVertexTextureImageUnits){var s=0,l=0;return defined(n._labelTranslate)&&(s=n._labelTranslate.x,l=n._labelTranslate.y),void(e._instanced?o(a=n._index,s,l,0,0):(o((a=4*n._index)+0,s,l,0,0),o(a+1,s,l,0,0),o(a+2,s,l,0,0),o(a+3,s,l,0,0)))}var c=0,u=0,d=0,h=0,p=n._imageIndex;if(-1!==p){var m=i[p];c=m.x,u=m.y,d=m.width,h=m.height}var f=c+d,g=u+h;e._instanced?o(a=n._index,c,u,f,g):(o((a=4*n._index)+0,c,u,f,g),o(a+1,c,u,f,g),o(a+2,c,u,f,g),o(a+3,c,u,f,g))}function writeBatchId(e,t,i,r,n){if(defined(e._batchTable)){var a,o=r[attributeLocations.a_batchId],s=n._batchIndex;e._instanced?o(a=n._index,s):(o((a=4*n._index)+0,s),o(a+1,s),o(a+2,s),o(a+3,s))}}function writeSDF(e,t,i,r,n){if(e._sdf){var a,o=r[attributeLocations.sdf],s=n.outlineColor,l=n.outlineWidth,c=Color.floatToByte(s.red),u=Color.floatToByte(s.green),d=Color.floatToByte(s.blue),h=c*LEFT_SHIFT16+u*LEFT_SHIFT8+d,p=l/SDFSettings$1.RADIUS,m=Color.floatToByte(s.alpha)*LEFT_SHIFT16+Color.floatToByte(p)*LEFT_SHIFT8;e._instanced?o(a=n._index,h,m):(o((a=4*n._index)+0,h+LOWER_LEFT,m),o(a+1,h+LOWER_RIGHT,m),o(a+2,h+UPPER_RIGHT,m),o(a+3,h+UPPER_LEFT,m))}}function writeBillboard(e,t,i,r,n){writePositionScaleAndRotation(e,t,i,r,n),writeCompressedAttrib0(e,t,i,r,n),writeCompressedAttrib1(e,t,i,r,n),writeCompressedAttrib2(e,t,i,r,n),writeEyeOffset(e,t,i,r,n),writeScaleByDistance(e,t,i,r,n),writePixelOffsetScaleByDistance(e,t,i,r,n),writeCompressedAttribute3(e,t,i,r,n),writeTextureCoordinateBoundsOrLabelTranslate(e,t,i,r,n),writeBatchId(e,t,i,r,n),writeSDF(e,t,i,r,n)}function recomputeActualPositions(e,t,i,r,n,a){var o;r.mode===SceneMode$1.SCENE3D?(o=e._baseVolume,e._boundingVolumeDirty=!0):o=e._baseVolume2D;for(var s=[],l=0;l<i;++l){var c=t[l],u=c.position,d=Billboard._computeActualPosition(c,u,r,n);defined(d)&&(c._setActualPosition(d),a?s.push(d):BoundingSphere.expand(o,d,o))}a&&BoundingSphere.fromPoints(s,o)}function updateMode(e,t){var i=t.mode,r=e._billboards,n=e._billboardsToUpdate,a=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==SceneMode$1.SCENE3D&&!Matrix4.equals(a,e.modelMatrix)?(e._mode=i,Matrix4.clone(e.modelMatrix,a),e._createVertexArray=!0,i!==SceneMode$1.SCENE3D&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,r,r.length,t,a,!0)):i===SceneMode$1.MORPHING?recomputeActualPositions(e,r,r.length,t,a,!0):i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions(e,n,e._billboardsToUpdateIndex,t,a,!1)}function updateBoundingVolume(e,t,i){var r=1;e._allSizedInMeters&&0===e._maxPixelOffset||(r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight));var n=r*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(n*=.5);var a=r*e._maxPixelOffset+e._maxEyeOffset;i.radius+=n+a}function createDebugCommand(e,t){var i=t.createViewportQuadCommand("uniform sampler2D billboard_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n    gl_FragColor = texture2D(billboard_texture, v_textureCoordinates); \n} \n",{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=Pass$1.OVERLAY,i}var scratchWriterArray=[];BillboardCollection.prototype.update=function(e){removeBillboards(this);var t=this._billboards,i=t.length,r=e.context;this._instanced=r.instancedArrays,attributeLocations=this._instanced?attributeLocationsInstanced:attributeLocationsBatched,getIndexBuffer=this._instanced?getIndexBufferInstanced:getIndexBufferBatched;var n=this._textureAtlas;if(!defined(n)){n=this._textureAtlas=new TextureAtlas({context:r});for(var a=0;a<i;++a)t[a]._loadImage()}var o=n.textureCoordinates;if(0!==o.length){updateMode(this,e),i=(t=this._billboards).length;var s,l=this._billboardsToUpdate,c=this._billboardsToUpdateIndex,u=this._propertiesChanged,d=n.guid,h=this._createVertexArray||this._textureAtlasGUID!==d;this._textureAtlasGUID=d;var p=e.passes,m=p.pick;if(h||!m&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var f=0;f<NUMBER_OF_PROPERTIES;++f)u[f]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),0<i){this._vaf=createVAF(r,i,this._buffersUsage,this._instanced,this._batchTable,this._sdf),s=this._vaf.writers;for(var g=0;g<i;++g){var _=this._billboards[g];_._dirty=!1,writeBillboard(this,r,o,s,_)}this._vaf.commit(getIndexBuffer(r))}this._billboardsToUpdateIndex=0}else if(0<c){var y=scratchWriterArray;y.length=0,(u[POSITION_INDEX$1]||u[ROTATION_INDEX$1]||u[SCALE_INDEX$1])&&y.push(writePositionScaleAndRotation),(u[IMAGE_INDEX_INDEX$1]||u[PIXEL_OFFSET_INDEX$1]||u[HORIZONTAL_ORIGIN_INDEX$1]||u[VERTICAL_ORIGIN_INDEX$1]||u[SHOW_INDEX$1])&&(y.push(writeCompressedAttrib0),this._instanced&&y.push(writeEyeOffset)),(u[IMAGE_INDEX_INDEX$1]||u[ALIGNED_AXIS_INDEX$1]||u[TRANSLUCENCY_BY_DISTANCE_INDEX$1])&&(y.push(writeCompressedAttrib1),y.push(writeCompressedAttrib2)),(u[IMAGE_INDEX_INDEX$1]||u[COLOR_INDEX$1])&&y.push(writeCompressedAttrib2),u[EYE_OFFSET_INDEX$1]&&y.push(writeEyeOffset),u[SCALE_BY_DISTANCE_INDEX$1]&&y.push(writeScaleByDistance),u[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX$1]&&y.push(writePixelOffsetScaleByDistance),(u[DISTANCE_DISPLAY_CONDITION_INDEX]||u[DISABLE_DEPTH_DISTANCE$1]||u[IMAGE_INDEX_INDEX$1]||u[POSITION_INDEX$1])&&y.push(writeCompressedAttribute3),(u[IMAGE_INDEX_INDEX$1]||u[POSITION_INDEX$1])&&y.push(writeTextureCoordinateBoundsOrLabelTranslate),u[SDF_INDEX$1]&&y.push(writeSDF);var v=y.length;if(s=this._vaf.writers,.1<c/i){for(var C=0;C<c;++C){var S=l[C];S._dirty=!1;for(var x=0;x<v;++x)y[x](this,r,o,s,S)}this._vaf.commit(getIndexBuffer(r))}else{for(var T=0;T<c;++T){var b=l[T];b._dirty=!1;for(var E=0;E<v;++E)y[E](this,r,o,s,b);this._instanced?this._vaf.subCommit(b._index,1):this._vaf.subCommit(4*b._index,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(1.5*i<c&&(l.length=i),defined(this._vaf)&&defined(this._vaf.va)){var P;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var A=Matrix4.IDENTITY;updateBoundingVolume(this,e,P=e.mode===SceneMode$1.SCENE3D?(A=this.modelMatrix,BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):BoundingSphere.clone(this._baseVolume2D,this._boundingVolume));var w,D,M,I,R,O=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,O){this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LESS},depthMask:!0}):this._rsOpaque=void 0;var L=this._blendOption===BlendOption$1.TRANSLUCENT;this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:L?WebGLConstants$1.LEQUAL:WebGLConstants$1.LESS},depthMask:L,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance;var F=0<ContextLimits.maximumVertexTextureImageUnits;if(O||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){w=BillboardCollectionVS,D=BillboardCollectionFS,R=[],defined(this._batchTable)&&(R.push("VECTOR_TILE"),w=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(w),D=this._batchTable.getFragmentShaderCallback(!1,void 0)(D)),M=new ShaderSource({defines:R,sources:[w]}),this._instanced&&M.defines.push("INSTANCED"),this._shaderRotation&&M.defines.push("ROTATION"),this._shaderAlignedAxis&&M.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&M.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&M.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&M.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&M.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&M.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(F?M.defines.push("VERTEX_DEPTH_CHECK"):M.defines.push("FRAGMENT_DEPTH_CHECK"));var N=1-SDFSettings$1.CUTOFF;this._sdf&&M.defines.push("SDF");var B=defined(this._batchTable)?"VECTOR_TILE":"";this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(I=new ShaderSource({defines:["OPAQUE",B],sources:[D]}),this._shaderClampToGround&&(F?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+N)),this._sp=ShaderProgram.replaceCache({context:r,shaderProgram:this._sp,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations}),I=new ShaderSource({defines:["TRANSLUCENT",B],sources:[D]}),this._shaderClampToGround&&(F?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+N)),this._spTranslucent=ShaderProgram.replaceCache({context:r,shaderProgram:this._spTranslucent,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations})),this._blendOption===BlendOption$1.OPAQUE&&(I=new ShaderSource({defines:[B],sources:[D]}),this._shaderClampToGround&&(F?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+N)),this._sp=ShaderProgram.replaceCache({context:r,shaderProgram:this._sp,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations})),this._blendOption===BlendOption$1.TRANSLUCENT&&(I=new ShaderSource({defines:[B],sources:[D]}),this._shaderClampToGround&&(F?I.defines.push("VERTEX_DEPTH_CHECK"):I.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(I.defines.push("SDF"),I.defines.push("SDF_EDGE "+N)),this._spTranslucent=ShaderProgram.replaceCache({context:r,shaderProgram:this._spTranslucent,vertexShaderSource:M,fragmentShaderSource:I,attributeLocations:attributeLocations})),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}var V=e.commandList;if(p.render||p.pick){var k,$=this._colorCommands,z=this._blendOption===BlendOption$1.OPAQUE,U=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT,G=this._vaf.va,H=G.length,W=this._uniforms;k=defined(this._batchTable)?(W=this._batchTable.getUniformMapCallback()(W),this._batchTable.getPickId()):"v_pickColor",$.length=H;for(var q=U?2*H:H,j=0;j<q;++j){var Y=$[j];defined(Y)||(Y=$[j]=new DrawCommand);var X=z||U&&j%2==0;Y.pass=X||!U?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,Y.owner=this;var Q=U?Math.floor(j/2):j;Y.boundingVolume=P,Y.modelMatrix=A,Y.count=G[Q].indicesCount,Y.shaderProgram=X?this._sp:this._spTranslucent,Y.uniformMap=W,Y.vertexArray=G[Q].va,Y.renderState=X?this._rsOpaque:this._rsTranslucent,Y.debugShowBoundingVolume=this.debugShowBoundingVolume,Y.pickId=k,this._instanced&&(Y.count=6,Y.instanceCount=i),V.push(Y)}this.debugShowTextureAtlas&&(defined(this.debugCommand)||(this.debugCommand=createDebugCommand(this,e.context)),V.push(this.debugCommand))}}}},BillboardCollection.prototype.isDestroyed=function(){return!1},BillboardCollection.prototype.destroy=function(){return defined(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(),destroyBillboards(this._billboards),destroyObject(this)};var LabelStyle={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},LabelStyle$1=freezeObject$1(LabelStyle),textTypes=freezeObject$1({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function rebindAllGlyphs(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function repositionAllGlyphs(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function getCSSValue$1(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function parseFont(e){var t=document.createElement("div");t.style.position="absolute",t.style.opacity=0,t.style.font=e._font,document.body.appendChild(t),e._fontFamily=getCSSValue$1(t,"font-family"),e._fontSize=getCSSValue$1(t,"font-size").replace("px",""),e._fontStyle=getCSSValue$1(t,"font-style"),e._fontWeight=getCSSValue$1(t,"font-weight"),document.body.removeChild(t)}function Label(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,r=e.pixelOffsetScaleByDistance,n=e.scaleByDistance,a=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(n)&&(n=NearFarScalar.clone(n)),defined(a)&&(a=DistanceDisplayCondition.clone(a)),this._renderedText=void 0,this._text=void 0,this._show=defaultValue(e.show,!0),this._font=defaultValue(e.font,"30px sans-serif"),this._fillColor=Color.clone(defaultValue(e.fillColor,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.BLACK)),this._outlineWidth=defaultValue(e.outlineWidth,1),this._showBackground=defaultValue(e.showBackground,!1),this._backgroundColor=defaultValue(e.backgroundColor,new Color(.165,.165,.165,.8)),this._backgroundPadding=defaultValue(e.backgroundPadding,new Cartesian2(7,5)),this._style=defaultValue(e.style,LabelStyle$1.FILL),this._verticalOrigin=defaultValue(e.verticalOrigin,VerticalOrigin$1.BASELINE),this._horizontalOrigin=defaultValue(e.horizontalOrigin,HorizontalOrigin$1.LEFT),this._pixelOffset=Cartesian2.clone(defaultValue(e.pixelOffset,Cartesian2.ZERO)),this._eyeOffset=Cartesian3.clone(defaultValue(e.eyeOffset,Cartesian3.ZERO)),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._scale=defaultValue(e.scale,1),this._id=e.id,this._translucencyByDistance=i,this._pixelOffsetScaleByDistance=r,this._scaleByDistance=n,this._heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._distanceDisplayCondition=a,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=defaultValue(e.text,""),this._relativeSize=1,parseFont(this),this._updateClamping()}function convertTextToTypes(e,t){for(var i=/[a-zA-Z0-9]/,r=/[()[\]{}<>]/,n=[],a="",o=textTypes.LTR,s="",l=e.length,c=0;c<l;++c){var u=e.charAt(c);s=t.test(u)?textTypes.RTL:i.test(u)?textTypes.LTR:r.test(u)?textTypes.BRACKETS:textTypes.WEAK,0===c&&(o=s),o===s&&s!==textTypes.BRACKETS?a+=u:(""!==a&&n.push({Type:o,Word:a}),o=s,a=u)}return n.push({Type:s,Word:a}),n}function reverseWord(e){return e.split("").reverse().join("")}function spliceWord(e,t,i){return e.slice(0,t)+i+e.slice(t)}function reverseBrackets(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}defineProperties$1(Label.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i].billboard;defined(n)&&(n.show=e)}var a=this._backgroundBillboard;defined(a)&&(a.show=e)}}},position:{get:function(){return this._position},set:function(e){var t=this._position;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r].billboard;defined(a)&&(a.position=e)}var o=this._backgroundBillboard;defined(o)&&(o.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(e!==this._heightReference){this._heightReference=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i].billboard;defined(n)&&(n.heightReference=e)}var a=this._backgroundBillboard;defined(a)&&(a.heightReference=e),repositionAllGlyphs(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,this._renderedText=Label.enableRightToLeftDetection?reverseRtl(e):e,rebindAllGlyphs(this))}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,rebindAllGlyphs(this),parseFont(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){var t=this._fillColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),rebindAllGlyphs(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,rebindAllGlyphs(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){this._showBackground!==e&&(this._showBackground=e,rebindAllGlyphs(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){var t=this._backgroundColor;if(!Color.equals(t,e)){Color.clone(e,t);var i=this._backgroundBillboard;defined(i)&&(i.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){var t=this._backgroundPadding;Cartesian2.equals(t,e)||(Cartesian2.clone(e,t),repositionAllGlyphs(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,rebindAllGlyphs(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){var t=this._pixelOffset;if(!Cartesian2.equals(t,e)){Cartesian2.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.pixelOffset=e)}var o=this._backgroundBillboard;defined(o)&&(o.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;if(!NearFarScalar.equals(t,e)){this._translucencyByDistance=NearFarScalar.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.translucencyByDistance=e)}var o=this._backgroundBillboard;defined(o)&&(o.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;if(!NearFarScalar.equals(t,e)){this._pixelOffsetScaleByDistance=NearFarScalar.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.pixelOffsetScaleByDistance=e)}var o=this._backgroundBillboard;defined(o)&&(o.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;if(!NearFarScalar.equals(t,e)){this._scaleByDistance=NearFarScalar.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.scaleByDistance=e)}var o=this._backgroundBillboard;defined(o)&&(o.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var t=this._eyeOffset;if(!Cartesian3.equals(t,e)){Cartesian3.clone(e,t);for(var i=this._glyphs,r=0,n=i.length;r<n;r++){var a=i[r];defined(a.billboard)&&(a.billboard.eyeOffset=e)}var o=this._backgroundBillboard;defined(o)&&(o.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,repositionAllGlyphs(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.verticalOrigin=e)}var a=this._backgroundBillboard;defined(a)&&(a.verticalOrigin=e),repositionAllGlyphs(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.scale=e*this._relativeSize)}var a=this._backgroundBillboard;defined(a)&&(a.scale=e*this._relativeSize),repositionAllGlyphs(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition);for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.distanceDisplayCondition=e)}var a=this._backgroundBillboard;defined(a)&&(a.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){this._disableDepthTestDistance=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.disableDepthTestDistance=e)}var a=this._backgroundBillboard;defined(a)&&(a.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.id=e)}var a=this._backgroundBillboard;defined(a)&&(a.id=e)}}},pickId:{get:function(){if(0!==this._glyphs.length&&defined(this._glyphs[0].billboard))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=Cartesian3.clone(e,this._actualClampedPosition);for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard._clampedPosition=e)}var a=this._backgroundBillboard;defined(a)&&(a._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;for(var t=this._glyphs,i=0,r=t.length;i<r;i++){var n=t[i];defined(n.billboard)&&(n.billboard.clusterShow=e)}var a=this._backgroundBillboard;defined(a)&&(a.clusterShow=e)}}}}),Label.prototype._updateClamping=function(){Billboard._updateClamping(this._labelCollection,this)},Label.prototype.computeScreenSpacePosition=function(e,t){defined(t)||(t=new Cartesian2);var i=this._labelCollection.modelMatrix,r=defined(this._actualClampedPosition)?this._actualClampedPosition:this._position;return Billboard._computeScreenSpacePosition(i,r,this._eyeOffset,this._pixelOffset,e,t)},Label.getScreenSpaceBoundingBox=function(e,t,i){var r=0,n=0,a=0,o=0,s=e.totalScale,l=e._backgroundBillboard;if(defined(l))r=t.x+l._translate.x,n=t.y-l._translate.y,a=l.width*s,o=l.height*s,e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?n-=o:e.verticalOrigin===VerticalOrigin$1.CENTER&&(n-=.5*o);else{r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;for(var c=0,u=0,d=e._glyphs,h=d.length,p=0;p<h;++p){var m=d[p],f=m.billboard;if(defined(f)){var g=t.x+f._translate.x,_=t.y-f._translate.y,y=m.dimensions.width*s,v=m.dimensions.height*s;e.verticalOrigin===VerticalOrigin$1.BOTTOM||e.verticalOrigin===VerticalOrigin$1.BASELINE?_-=v:e.verticalOrigin===VerticalOrigin$1.CENTER&&(_-=.5*v),e._verticalOrigin===VerticalOrigin$1.TOP?_+=SDFSettings$1.PADDING*s:e._verticalOrigin!==VerticalOrigin$1.BOTTOM&&e._verticalOrigin!==VerticalOrigin$1.BASELINE||(_-=SDFSettings$1.PADDING*s),r=Math.min(r,g),n=Math.min(n,_),c=Math.max(c,g+y),u=Math.max(u,_+v)}}a=c-r,o=u-n}return defined(i)||(i=new BoundingRectangle),i.x=r,i.y=n,i.width=a,i.height=o,i},Label.prototype.equals=function(e){return this===e||defined(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&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._fillColor,e._fillColor)&&Color.equals(this._outlineColor,e._outlineColor)&&Color.equals(this._backgroundColor,e._backgroundColor)&&Cartesian2.equals(this._backgroundPadding,e._backgroundPadding)&&Cartesian2.equals(this._pixelOffset,e._pixelOffset)&&Cartesian3.equals(this._eyeOffset,e._eyeOffset)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&NearFarScalar.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id},Label.prototype.isDestroyed=function(){return!1},Label.enableRightToLeftDetection=!1;var hebrew="א-ת",arabic="؀-ۿݐ-ݿࢠ-ࣿ",rtlChars=new RegExp("["+hebrew+arabic+"]");function reverseRtl(e){for(var t=e.split("\n"),i="",r=0;r<t.length;r++){for(var n=t[r],a=rtlChars.test(n.charAt(0)),o=convertTextToTypes(n,rtlChars),s=0,l="",c=0;c<o.length;++c){var u=o[c],d=u.Type===textTypes.BRACKETS?reverseBrackets(u.Word):reverseWord(u.Word);a?u.Type===textTypes.RTL?(l=d+l,s=0):u.Type===textTypes.LTR?(l=spliceWord(l,s,u.Word),s+=u.Word.length):u.Type!==textTypes.WEAK&&u.Type!==textTypes.BRACKETS||(u.Type===textTypes.WEAK&&o[c-1].Type===textTypes.BRACKETS?l=d+l:o[c-1].Type===textTypes.RTL?(l=d+l,s=0):o.length>c+1?o[c+1].Type===textTypes.RTL?(l=d+l,s=0):(l=spliceWord(l,s,u.Word),s+=u.Word.length):l=spliceWord(l,0,d)):u.Type===textTypes.RTL?l=spliceWord(l,s,d):u.Type===textTypes.LTR?s=(l+=u.Word).length:u.Type!==textTypes.WEAK&&u.Type!==textTypes.BRACKETS||(0<c&&o[c-1].Type===textTypes.RTL?o.length>c+1?o[c+1].Type===textTypes.RTL?l=spliceWord(l,s,d):s=(l+=u.Word).length:l+=u.Word:s=(l+=u.Word).length)}i+=l,r<t.length-1&&(i+="\n")}return i}var INF=1e20;function clamp(e,t,i){return t<i?e<t?t:i<e?i:e:e<i?i:t<e?t:e}function calcSDF(e,t){var i,r,n,a,o,s,l,c,u,d,h,p=null==(t=t||{}).cutoff?.25:t.cutoff,m=null==t.radius?8:t.radius,f=t.channel||0;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");i=t.width,r=t.height,a=e,s=t.stride?t.stride:Math.floor(e.length/i/r)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(l=(c=e).getContext("2d"),i=c.width,r=c.height,a=(u=l.getImageData(0,0,i,r)).data,s=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(i=(c=(l=e).canvas).width,r=c.height,a=(u=l.getImageData(0,0,i,r)).data,s=4):window.ImageData&&e instanceof window.ImageData&&(i=(u=e).width,r=e.height,a=u.data,s=4);if(n=Math.max(i,r),window.Uint8ClampedArray&&a instanceof window.Uint8ClampedArray||window.Uint8Array&&a instanceof window.Uint8Array)for(o=a,a=Array(i*r),d=0,h=o.length;d<h;d++)a[d]=o[d*s+f]/255;else if(1!==s)throw Error("Raw data can have only 1 value per pixel");var g=Array(i*r),_=Array(i*r),y=Array(n),v=Array(n),C=Array(n+1),S=Array(n);for(d=0,h=i*r;d<h;d++){var x=a[d];g[d]=1===x?0:0===x?INF:Math.pow(Math.max(0,.5-x),2),_[d]=1===x?INF:0===x?0:Math.pow(Math.max(0,x-.5),2)}edt(g,i,r,y,v,S,C),edt(_,i,r,y,v,S,C);var T=window.Float32Array?new Float32Array(i*r):new Array(i*r);for(d=0,h=i*r;d<h;d++)T[d]=clamp(1-((g[d]-_[d])/m+p),0,1);return T}function edt(e,t,i,r,n,a,o){for(var s=0;s<t;s++){for(var l=0;l<i;l++)r[l]=e[l*t+s];for(edt1d(r,n,a,o,i),l=0;l<i;l++)e[l*t+s]=n[l]}for(l=0;l<i;l++){for(s=0;s<t;s++)r[s]=e[l*t+s];for(edt1d(r,n,a,o,t),s=0;s<t;s++)e[l*t+s]=Math.sqrt(n[s])}}function edt1d(e,t,i,r,n){r[i[0]=0]=-INF,r[1]=+INF;for(var a=1,o=0;a<n;a++){for(var s=(e[a]+a*a-(e[i[o]]+i[o]*i[o]))/(2*a-2*i[o]);s<=r[o];)o--,s=(e[a]+a*a-(e[i[o]]+i[o]*i[o]))/(2*a-2*i[o]);i[++o]=a,r[o]=s,r[o+1]=+INF}for(o=a=0;a<n;a++){for(;r[o+1]<a;)o++;t[a]=(a-i[o])*(a-i[o])+e[i[o]]}}function GraphemeSplitter(){var c=0,u=1,d=2,h=3,p=4,m=5,f=6,g=7,_=8,y=9,v=10,C=12,S=13,x=14,T=15,b=16,E=17,P=0,A=1,w=2,D=3,M=4;function l(e,t){void 0===t&&(t=0);var i=e.charCodeAt(t);if(55296<=i&&i<=56319&&t<e.length-1){var r=i;return 56320<=(n=e.charCodeAt(t+1))&&n<=57343?1024*(r-55296)+(n-56320)+65536:r}if(56320<=i&&i<=57343&&1<=t){var n=i;return 55296<=(r=e.charCodeAt(t-1))&&r<=56319?1024*(r-55296)+(n-56320)+65536:n}return i}function I(e,t,i){var r=[e].concat(t).concat([i]),n=r[r.length-2],a=i,o=r.lastIndexOf(x);if(1<o&&r.slice(1,o).every(function(e){return e==h})&&-1==[h,S,E].indexOf(e))return w;var s=r.lastIndexOf(p);if(0<s&&r.slice(1,s).every(function(e){return e==p})&&-1==[C,p].indexOf(n))return r.filter(function(e){return e==p}).length%2==1?D:M;if(n==c&&a==u)return P;if(n==d||n==c||n==u)return a==x&&t.every(function(e){return e==h})?w:A;if(a==d||a==c||a==u)return A;if(n==f&&(a==f||a==g||a==y||a==v))return P;if(!(n!=y&&n!=g||a!=g&&a!=_))return P;if((n==v||n==_)&&a==_)return P;if(a==h||a==T)return P;if(a==m)return P;if(n==C)return P;var l=-1!=r.indexOf(h)?r.lastIndexOf(h)-1:r.length-2;return-1!=[S,E].indexOf(r[l])&&r.slice(1+l,-1).every(function(e){return e==h})&&a==x?P:n==T&&-1!=[b,E].indexOf(a)?P:-1!=t.indexOf(p)?w:n==p&&a==p?P:A}function R(e){return 1536<=e&&e<=1541||1757==e||1807==e||2274==e||3406==e||69821==e||70082<=e&&e<=70083||72250==e||72326<=e&&e<=72329||73030==e?C:13==e?c:10==e?u:0<=e&&e<=9||11<=e&&e<=12||14<=e&&e<=31||127<=e&&e<=159||173==e||1564==e||6158==e||8203==e||8206<=e&&e<=8207||8232==e||8233==e||8234<=e&&e<=8238||8288<=e&&e<=8292||8293==e||8294<=e&&e<=8303||55296<=e&&e<=57343||65279==e||65520<=e&&e<=65528||65529<=e&&e<=65531||113824<=e&&e<=113827||119155<=e&&e<=119162||917504==e||917505==e||917506<=e&&e<=917535||917632<=e&&e<=917759||918e3<=e&&e<=921599?d:768<=e&&e<=879||1155<=e&&e<=1159||1160<=e&&e<=1161||1425<=e&&e<=1469||1471==e||1473<=e&&e<=1474||1476<=e&&e<=1477||1479==e||1552<=e&&e<=1562||1611<=e&&e<=1631||1648==e||1750<=e&&e<=1756||1759<=e&&e<=1764||1767<=e&&e<=1768||1770<=e&&e<=1773||1809==e||1840<=e&&e<=1866||1958<=e&&e<=1968||2027<=e&&e<=2035||2070<=e&&e<=2073||2075<=e&&e<=2083||2085<=e&&e<=2087||2089<=e&&e<=2093||2137<=e&&e<=2139||2260<=e&&e<=2273||2275<=e&&e<=2306||2362==e||2364==e||2369<=e&&e<=2376||2381==e||2385<=e&&e<=2391||2402<=e&&e<=2403||2433==e||2492==e||2494==e||2497<=e&&e<=2500||2509==e||2519==e||2530<=e&&e<=2531||2561<=e&&e<=2562||2620==e||2625<=e&&e<=2626||2631<=e&&e<=2632||2635<=e&&e<=2637||2641==e||2672<=e&&e<=2673||2677==e||2689<=e&&e<=2690||2748==e||2753<=e&&e<=2757||2759<=e&&e<=2760||2765==e||2786<=e&&e<=2787||2810<=e&&e<=2815||2817==e||2876==e||2878==e||2879==e||2881<=e&&e<=2884||2893==e||2902==e||2903==e||2914<=e&&e<=2915||2946==e||3006==e||3008==e||3021==e||3031==e||3072==e||3134<=e&&e<=3136||3142<=e&&e<=3144||3146<=e&&e<=3149||3157<=e&&e<=3158||3170<=e&&e<=3171||3201==e||3260==e||3263==e||3266==e||3270==e||3276<=e&&e<=3277||3285<=e&&e<=3286||3298<=e&&e<=3299||3328<=e&&e<=3329||3387<=e&&e<=3388||3390==e||3393<=e&&e<=3396||3405==e||3415==e||3426<=e&&e<=3427||3530==e||3535==e||3538<=e&&e<=3540||3542==e||3551==e||3633==e||3636<=e&&e<=3642||3655<=e&&e<=3662||3761==e||3764<=e&&e<=3769||3771<=e&&e<=3772||3784<=e&&e<=3789||3864<=e&&e<=3865||3893==e||3895==e||3897==e||3953<=e&&e<=3966||3968<=e&&e<=3972||3974<=e&&e<=3975||3981<=e&&e<=3991||3993<=e&&e<=4028||4038==e||4141<=e&&e<=4144||4146<=e&&e<=4151||4153<=e&&e<=4154||4157<=e&&e<=4158||4184<=e&&e<=4185||4190<=e&&e<=4192||4209<=e&&e<=4212||4226==e||4229<=e&&e<=4230||4237==e||4253==e||4957<=e&&e<=4959||5906<=e&&e<=5908||5938<=e&&e<=5940||5970<=e&&e<=5971||6002<=e&&e<=6003||6068<=e&&e<=6069||6071<=e&&e<=6077||6086==e||6089<=e&&e<=6099||6109==e||6155<=e&&e<=6157||6277<=e&&e<=6278||6313==e||6432<=e&&e<=6434||6439<=e&&e<=6440||6450==e||6457<=e&&e<=6459||6679<=e&&e<=6680||6683==e||6742==e||6744<=e&&e<=6750||6752==e||6754==e||6757<=e&&e<=6764||6771<=e&&e<=6780||6783==e||6832<=e&&e<=6845||6846==e||6912<=e&&e<=6915||6964==e||6966<=e&&e<=6970||6972==e||6978==e||7019<=e&&e<=7027||7040<=e&&e<=7041||7074<=e&&e<=7077||7080<=e&&e<=7081||7083<=e&&e<=7085||7142==e||7144<=e&&e<=7145||7149==e||7151<=e&&e<=7153||7212<=e&&e<=7219||7222<=e&&e<=7223||7376<=e&&e<=7378||7380<=e&&e<=7392||7394<=e&&e<=7400||7405==e||7412==e||7416<=e&&e<=7417||7616<=e&&e<=7673||7675<=e&&e<=7679||8204==e||8400<=e&&e<=8412||8413<=e&&e<=8416||8417==e||8418<=e&&e<=8420||8421<=e&&e<=8432||11503<=e&&e<=11505||11647==e||11744<=e&&e<=11775||12330<=e&&e<=12333||12334<=e&&e<=12335||12441<=e&&e<=12442||42607==e||42608<=e&&e<=42610||42612<=e&&e<=42621||42654<=e&&e<=42655||42736<=e&&e<=42737||43010==e||43014==e||43019==e||43045<=e&&e<=43046||43204<=e&&e<=43205||43232<=e&&e<=43249||43302<=e&&e<=43309||43335<=e&&e<=43345||43392<=e&&e<=43394||43443==e||43446<=e&&e<=43449||43452==e||43493==e||43561<=e&&e<=43566||43569<=e&&e<=43570||43573<=e&&e<=43574||43587==e||43596==e||43644==e||43696==e||43698<=e&&e<=43700||43703<=e&&e<=43704||43710<=e&&e<=43711||43713==e||43756<=e&&e<=43757||43766==e||44005==e||44008==e||44013==e||64286==e||65024<=e&&e<=65039||65056<=e&&e<=65071||65438<=e&&e<=65439||66045==e||66272==e||66422<=e&&e<=66426||68097<=e&&e<=68099||68101<=e&&e<=68102||68108<=e&&e<=68111||68152<=e&&e<=68154||68159==e||68325<=e&&e<=68326||69633==e||69688<=e&&e<=69702||69759<=e&&e<=69761||69811<=e&&e<=69814||69817<=e&&e<=69818||69888<=e&&e<=69890||69927<=e&&e<=69931||69933<=e&&e<=69940||70003==e||70016<=e&&e<=70017||70070<=e&&e<=70078||70090<=e&&e<=70092||70191<=e&&e<=70193||70196==e||70198<=e&&e<=70199||70206==e||70367==e||70371<=e&&e<=70378||70400<=e&&e<=70401||70460==e||70462==e||70464==e||70487==e||70502<=e&&e<=70508||70512<=e&&e<=70516||70712<=e&&e<=70719||70722<=e&&e<=70724||70726==e||70832==e||70835<=e&&e<=70840||70842==e||70845==e||70847<=e&&e<=70848||70850<=e&&e<=70851||71087==e||71090<=e&&e<=71093||71100<=e&&e<=71101||71103<=e&&e<=71104||71132<=e&&e<=71133||71219<=e&&e<=71226||71229==e||71231<=e&&e<=71232||71339==e||71341==e||71344<=e&&e<=71349||71351==e||71453<=e&&e<=71455||71458<=e&&e<=71461||71463<=e&&e<=71467||72193<=e&&e<=72198||72201<=e&&e<=72202||72243<=e&&e<=72248||72251<=e&&e<=72254||72263==e||72273<=e&&e<=72278||72281<=e&&e<=72283||72330<=e&&e<=72342||72344<=e&&e<=72345||72752<=e&&e<=72758||72760<=e&&e<=72765||72767==e||72850<=e&&e<=72871||72874<=e&&e<=72880||72882<=e&&e<=72883||72885<=e&&e<=72886||73009<=e&&e<=73014||73018==e||73020<=e&&e<=73021||73023<=e&&e<=73029||73031==e||92912<=e&&e<=92916||92976<=e&&e<=92982||94095<=e&&e<=94098||113821<=e&&e<=113822||119141==e||119143<=e&&e<=119145||119150<=e&&e<=119154||119163<=e&&e<=119170||119173<=e&&e<=119179||119210<=e&&e<=119213||119362<=e&&e<=119364||121344<=e&&e<=121398||121403<=e&&e<=121452||121461==e||121476==e||121499<=e&&e<=121503||121505<=e&&e<=121519||122880<=e&&e<=122886||122888<=e&&e<=122904||122907<=e&&e<=122913||122915<=e&&e<=122916||122918<=e&&e<=122922||125136<=e&&e<=125142||125252<=e&&e<=125258||917536<=e&&e<=917631||917760<=e&&e<=917999?h:127462<=e&&e<=127487?p:2307==e||2363==e||2366<=e&&e<=2368||2377<=e&&e<=2380||2382<=e&&e<=2383||2434<=e&&e<=2435||2495<=e&&e<=2496||2503<=e&&e<=2504||2507<=e&&e<=2508||2563==e||2622<=e&&e<=2624||2691==e||2750<=e&&e<=2752||2761==e||2763<=e&&e<=2764||2818<=e&&e<=2819||2880==e||2887<=e&&e<=2888||2891<=e&&e<=2892||3007==e||3009<=e&&e<=3010||3014<=e&&e<=3016||3018<=e&&e<=3020||3073<=e&&e<=3075||3137<=e&&e<=3140||3202<=e&&e<=3203||3262==e||3264<=e&&e<=3265||3267<=e&&e<=3268||3271<=e&&e<=3272||3274<=e&&e<=3275||3330<=e&&e<=3331||3391<=e&&e<=3392||3398<=e&&e<=3400||3402<=e&&e<=3404||3458<=e&&e<=3459||3536<=e&&e<=3537||3544<=e&&e<=3550||3570<=e&&e<=3571||3635==e||3763==e||3902<=e&&e<=3903||3967==e||4145==e||4155<=e&&e<=4156||4182<=e&&e<=4183||4228==e||6070==e||6078<=e&&e<=6085||6087<=e&&e<=6088||6435<=e&&e<=6438||6441<=e&&e<=6443||6448<=e&&e<=6449||6451<=e&&e<=6456||6681<=e&&e<=6682||6741==e||6743==e||6765<=e&&e<=6770||6916==e||6965==e||6971==e||6973<=e&&e<=6977||6979<=e&&e<=6980||7042==e||7073==e||7078<=e&&e<=7079||7082==e||7143==e||7146<=e&&e<=7148||7150==e||7154<=e&&e<=7155||7204<=e&&e<=7211||7220<=e&&e<=7221||7393==e||7410<=e&&e<=7411||7415==e||43043<=e&&e<=43044||43047==e||43136<=e&&e<=43137||43188<=e&&e<=43203||43346<=e&&e<=43347||43395==e||43444<=e&&e<=43445||43450<=e&&e<=43451||43453<=e&&e<=43456||43567<=e&&e<=43568||43571<=e&&e<=43572||43597==e||43755==e||43758<=e&&e<=43759||43765==e||44003<=e&&e<=44004||44006<=e&&e<=44007||44009<=e&&e<=44010||44012==e||69632==e||69634==e||69762==e||69808<=e&&e<=69810||69815<=e&&e<=69816||69932==e||70018==e||70067<=e&&e<=70069||70079<=e&&e<=70080||70188<=e&&e<=70190||70194<=e&&e<=70195||70197==e||70368<=e&&e<=70370||70402<=e&&e<=70403||70463==e||70465<=e&&e<=70468||70471<=e&&e<=70472||70475<=e&&e<=70477||70498<=e&&e<=70499||70709<=e&&e<=70711||70720<=e&&e<=70721||70725==e||70833<=e&&e<=70834||70841==e||70843<=e&&e<=70844||70846==e||70849==e||71088<=e&&e<=71089||71096<=e&&e<=71099||71102==e||71216<=e&&e<=71218||71227<=e&&e<=71228||71230==e||71340==e||71342<=e&&e<=71343||71350==e||71456<=e&&e<=71457||71462==e||72199<=e&&e<=72200||72249==e||72279<=e&&e<=72280||72343==e||72751==e||72766==e||72873==e||72881==e||72884==e||94033<=e&&e<=94078||119142==e||119149==e?m:4352<=e&&e<=4447||43360<=e&&e<=43388?f:4448<=e&&e<=4519||55216<=e&&e<=55238?g:4520<=e&&e<=4607||55243<=e&&e<=55291?_:44032==e||44060==e||44088==e||44116==e||44144==e||44172==e||44200==e||44228==e||44256==e||44284==e||44312==e||44340==e||44368==e||44396==e||44424==e||44452==e||44480==e||44508==e||44536==e||44564==e||44592==e||44620==e||44648==e||44676==e||44704==e||44732==e||44760==e||44788==e||44816==e||44844==e||44872==e||44900==e||44928==e||44956==e||44984==e||45012==e||45040==e||45068==e||45096==e||45124==e||45152==e||45180==e||45208==e||45236==e||45264==e||45292==e||45320==e||45348==e||45376==e||45404==e||45432==e||45460==e||45488==e||45516==e||45544==e||45572==e||45600==e||45628==e||45656==e||45684==e||45712==e||45740==e||45768==e||45796==e||45824==e||45852==e||45880==e||45908==e||45936==e||45964==e||45992==e||46020==e||46048==e||46076==e||46104==e||46132==e||46160==e||46188==e||46216==e||46244==e||46272==e||46300==e||46328==e||46356==e||46384==e||46412==e||46440==e||46468==e||46496==e||46524==e||46552==e||46580==e||46608==e||46636==e||46664==e||46692==e||46720==e||46748==e||46776==e||46804==e||46832==e||46860==e||46888==e||46916==e||46944==e||46972==e||47e3==e||47028==e||47056==e||47084==e||47112==e||47140==e||47168==e||47196==e||47224==e||47252==e||47280==e||47308==e||47336==e||47364==e||47392==e||47420==e||47448==e||47476==e||47504==e||47532==e||47560==e||47588==e||47616==e||47644==e||47672==e||47700==e||47728==e||47756==e||47784==e||47812==e||47840==e||47868==e||47896==e||47924==e||47952==e||47980==e||48008==e||48036==e||48064==e||48092==e||48120==e||48148==e||48176==e||48204==e||48232==e||48260==e||48288==e||48316==e||48344==e||48372==e||48400==e||48428==e||48456==e||48484==e||48512==e||48540==e||48568==e||48596==e||48624==e||48652==e||48680==e||48708==e||48736==e||48764==e||48792==e||48820==e||48848==e||48876==e||48904==e||48932==e||48960==e||48988==e||49016==e||49044==e||49072==e||49100==e||49128==e||49156==e||49184==e||49212==e||49240==e||49268==e||49296==e||49324==e||49352==e||49380==e||49408==e||49436==e||49464==e||49492==e||49520==e||49548==e||49576==e||49604==e||49632==e||49660==e||49688==e||49716==e||49744==e||49772==e||49800==e||49828==e||49856==e||49884==e||49912==e||49940==e||49968==e||49996==e||50024==e||50052==e||50080==e||50108==e||50136==e||50164==e||50192==e||50220==e||50248==e||50276==e||50304==e||50332==e||50360==e||50388==e||50416==e||50444==e||50472==e||50500==e||50528==e||50556==e||50584==e||50612==e||50640==e||50668==e||50696==e||50724==e||50752==e||50780==e||50808==e||50836==e||50864==e||50892==e||50920==e||50948==e||50976==e||51004==e||51032==e||51060==e||51088==e||51116==e||51144==e||51172==e||51200==e||51228==e||51256==e||51284==e||51312==e||51340==e||51368==e||51396==e||51424==e||51452==e||51480==e||51508==e||51536==e||51564==e||51592==e||51620==e||51648==e||51676==e||51704==e||51732==e||51760==e||51788==e||51816==e||51844==e||51872==e||51900==e||51928==e||51956==e||51984==e||52012==e||52040==e||52068==e||52096==e||52124==e||52152==e||52180==e||52208==e||52236==e||52264==e||52292==e||52320==e||52348==e||52376==e||52404==e||52432==e||52460==e||52488==e||52516==e||52544==e||52572==e||52600==e||52628==e||52656==e||52684==e||52712==e||52740==e||52768==e||52796==e||52824==e||52852==e||52880==e||52908==e||52936==e||52964==e||52992==e||53020==e||53048==e||53076==e||53104==e||53132==e||53160==e||53188==e||53216==e||53244==e||53272==e||53300==e||53328==e||53356==e||53384==e||53412==e||53440==e||53468==e||53496==e||53524==e||53552==e||53580==e||53608==e||53636==e||53664==e||53692==e||53720==e||53748==e||53776==e||53804==e||53832==e||53860==e||53888==e||53916==e||53944==e||53972==e||54e3==e||54028==e||54056==e||54084==e||54112==e||54140==e||54168==e||54196==e||54224==e||54252==e||54280==e||54308==e||54336==e||54364==e||54392==e||54420==e||54448==e||54476==e||54504==e||54532==e||54560==e||54588==e||54616==e||54644==e||54672==e||54700==e||54728==e||54756==e||54784==e||54812==e||54840==e||54868==e||54896==e||54924==e||54952==e||54980==e||55008==e||55036==e||55064==e||55092==e||55120==e||55148==e||55176==e?y:44033<=e&&e<=44059||44061<=e&&e<=44087||44089<=e&&e<=44115||44117<=e&&e<=44143||44145<=e&&e<=44171||44173<=e&&e<=44199||44201<=e&&e<=44227||44229<=e&&e<=44255||44257<=e&&e<=44283||44285<=e&&e<=44311||44313<=e&&e<=44339||44341<=e&&e<=44367||44369<=e&&e<=44395||44397<=e&&e<=44423||44425<=e&&e<=44451||44453<=e&&e<=44479||44481<=e&&e<=44507||44509<=e&&e<=44535||44537<=e&&e<=44563||44565<=e&&e<=44591||44593<=e&&e<=44619||44621<=e&&e<=44647||44649<=e&&e<=44675||44677<=e&&e<=44703||44705<=e&&e<=44731||44733<=e&&e<=44759||44761<=e&&e<=44787||44789<=e&&e<=44815||44817<=e&&e<=44843||44845<=e&&e<=44871||44873<=e&&e<=44899||44901<=e&&e<=44927||44929<=e&&e<=44955||44957<=e&&e<=44983||44985<=e&&e<=45011||45013<=e&&e<=45039||45041<=e&&e<=45067||45069<=e&&e<=45095||45097<=e&&e<=45123||45125<=e&&e<=45151||45153<=e&&e<=45179||45181<=e&&e<=45207||45209<=e&&e<=45235||45237<=e&&e<=45263||45265<=e&&e<=45291||45293<=e&&e<=45319||45321<=e&&e<=45347||45349<=e&&e<=45375||45377<=e&&e<=45403||45405<=e&&e<=45431||45433<=e&&e<=45459||45461<=e&&e<=45487||45489<=e&&e<=45515||45517<=e&&e<=45543||45545<=e&&e<=45571||45573<=e&&e<=45599||45601<=e&&e<=45627||45629<=e&&e<=45655||45657<=e&&e<=45683||45685<=e&&e<=45711||45713<=e&&e<=45739||45741<=e&&e<=45767||45769<=e&&e<=45795||45797<=e&&e<=45823||45825<=e&&e<=45851||45853<=e&&e<=45879||45881<=e&&e<=45907||45909<=e&&e<=45935||45937<=e&&e<=45963||45965<=e&&e<=45991||45993<=e&&e<=46019||46021<=e&&e<=46047||46049<=e&&e<=46075||46077<=e&&e<=46103||46105<=e&&e<=46131||46133<=e&&e<=46159||46161<=e&&e<=46187||46189<=e&&e<=46215||46217<=e&&e<=46243||46245<=e&&e<=46271||46273<=e&&e<=46299||46301<=e&&e<=46327||46329<=e&&e<=46355||46357<=e&&e<=46383||46385<=e&&e<=46411||46413<=e&&e<=46439||46441<=e&&e<=46467||46469<=e&&e<=46495||46497<=e&&e<=46523||46525<=e&&e<=46551||46553<=e&&e<=46579||46581<=e&&e<=46607||46609<=e&&e<=46635||46637<=e&&e<=46663||46665<=e&&e<=46691||46693<=e&&e<=46719||46721<=e&&e<=46747||46749<=e&&e<=46775||46777<=e&&e<=46803||46805<=e&&e<=46831||46833<=e&&e<=46859||46861<=e&&e<=46887||46889<=e&&e<=46915||46917<=e&&e<=46943||46945<=e&&e<=46971||46973<=e&&e<=46999||47001<=e&&e<=47027||47029<=e&&e<=47055||47057<=e&&e<=47083||47085<=e&&e<=47111||47113<=e&&e<=47139||47141<=e&&e<=47167||47169<=e&&e<=47195||47197<=e&&e<=47223||47225<=e&&e<=47251||47253<=e&&e<=47279||47281<=e&&e<=47307||47309<=e&&e<=47335||47337<=e&&e<=47363||47365<=e&&e<=47391||47393<=e&&e<=47419||47421<=e&&e<=47447||47449<=e&&e<=47475||47477<=e&&e<=47503||47505<=e&&e<=47531||47533<=e&&e<=47559||47561<=e&&e<=47587||47589<=e&&e<=47615||47617<=e&&e<=47643||47645<=e&&e<=47671||47673<=e&&e<=47699||47701<=e&&e<=47727||47729<=e&&e<=47755||47757<=e&&e<=47783||47785<=e&&e<=47811||47813<=e&&e<=47839||47841<=e&&e<=47867||47869<=e&&e<=47895||47897<=e&&e<=47923||47925<=e&&e<=47951||47953<=e&&e<=47979||47981<=e&&e<=48007||48009<=e&&e<=48035||48037<=e&&e<=48063||48065<=e&&e<=48091||48093<=e&&e<=48119||48121<=e&&e<=48147||48149<=e&&e<=48175||48177<=e&&e<=48203||48205<=e&&e<=48231||48233<=e&&e<=48259||48261<=e&&e<=48287||48289<=e&&e<=48315||48317<=e&&e<=48343||48345<=e&&e<=48371||48373<=e&&e<=48399||48401<=e&&e<=48427||48429<=e&&e<=48455||48457<=e&&e<=48483||48485<=e&&e<=48511||48513<=e&&e<=48539||48541<=e&&e<=48567||48569<=e&&e<=48595||48597<=e&&e<=48623||48625<=e&&e<=48651||48653<=e&&e<=48679||48681<=e&&e<=48707||48709<=e&&e<=48735||48737<=e&&e<=48763||48765<=e&&e<=48791||48793<=e&&e<=48819||48821<=e&&e<=48847||48849<=e&&e<=48875||48877<=e&&e<=48903||48905<=e&&e<=48931||48933<=e&&e<=48959||48961<=e&&e<=48987||48989<=e&&e<=49015||49017<=e&&e<=49043||49045<=e&&e<=49071||49073<=e&&e<=49099||49101<=e&&e<=49127||49129<=e&&e<=49155||49157<=e&&e<=49183||49185<=e&&e<=49211||49213<=e&&e<=49239||49241<=e&&e<=49267||49269<=e&&e<=49295||49297<=e&&e<=49323||49325<=e&&e<=49351||49353<=e&&e<=49379||49381<=e&&e<=49407||49409<=e&&e<=49435||49437<=e&&e<=49463||49465<=e&&e<=49491||49493<=e&&e<=49519||49521<=e&&e<=49547||49549<=e&&e<=49575||49577<=e&&e<=49603||49605<=e&&e<=49631||49633<=e&&e<=49659||49661<=e&&e<=49687||49689<=e&&e<=49715||49717<=e&&e<=49743||49745<=e&&e<=49771||49773<=e&&e<=49799||49801<=e&&e<=49827||49829<=e&&e<=49855||49857<=e&&e<=49883||49885<=e&&e<=49911||49913<=e&&e<=49939||49941<=e&&e<=49967||49969<=e&&e<=49995||49997<=e&&e<=50023||50025<=e&&e<=50051||50053<=e&&e<=50079||50081<=e&&e<=50107||50109<=e&&e<=50135||50137<=e&&e<=50163||50165<=e&&e<=50191||50193<=e&&e<=50219||50221<=e&&e<=50247||50249<=e&&e<=50275||50277<=e&&e<=50303||50305<=e&&e<=50331||50333<=e&&e<=50359||50361<=e&&e<=50387||50389<=e&&e<=50415||50417<=e&&e<=50443||50445<=e&&e<=50471||50473<=e&&e<=50499||50501<=e&&e<=50527||50529<=e&&e<=50555||50557<=e&&e<=50583||50585<=e&&e<=50611||50613<=e&&e<=50639||50641<=e&&e<=50667||50669<=e&&e<=50695||50697<=e&&e<=50723||50725<=e&&e<=50751||50753<=e&&e<=50779||50781<=e&&e<=50807||50809<=e&&e<=50835||50837<=e&&e<=50863||50865<=e&&e<=50891||50893<=e&&e<=50919||50921<=e&&e<=50947||50949<=e&&e<=50975||50977<=e&&e<=51003||51005<=e&&e<=51031||51033<=e&&e<=51059||51061<=e&&e<=51087||51089<=e&&e<=51115||51117<=e&&e<=51143||51145<=e&&e<=51171||51173<=e&&e<=51199||51201<=e&&e<=51227||51229<=e&&e<=51255||51257<=e&&e<=51283||51285<=e&&e<=51311||51313<=e&&e<=51339||51341<=e&&e<=51367||51369<=e&&e<=51395||51397<=e&&e<=51423||51425<=e&&e<=51451||51453<=e&&e<=51479||51481<=e&&e<=51507||51509<=e&&e<=51535||51537<=e&&e<=51563||51565<=e&&e<=51591||51593<=e&&e<=51619||51621<=e&&e<=51647||51649<=e&&e<=51675||51677<=e&&e<=51703||51705<=e&&e<=51731||51733<=e&&e<=51759||51761<=e&&e<=51787||51789<=e&&e<=51815||51817<=e&&e<=51843||51845<=e&&e<=51871||51873<=e&&e<=51899||51901<=e&&e<=51927||51929<=e&&e<=51955||51957<=e&&e<=51983||51985<=e&&e<=52011||52013<=e&&e<=52039||52041<=e&&e<=52067||52069<=e&&e<=52095||52097<=e&&e<=52123||52125<=e&&e<=52151||52153<=e&&e<=52179||52181<=e&&e<=52207||52209<=e&&e<=52235||52237<=e&&e<=52263||52265<=e&&e<=52291||52293<=e&&e<=52319||52321<=e&&e<=52347||52349<=e&&e<=52375||52377<=e&&e<=52403||52405<=e&&e<=52431||52433<=e&&e<=52459||52461<=e&&e<=52487||52489<=e&&e<=52515||52517<=e&&e<=52543||52545<=e&&e<=52571||52573<=e&&e<=52599||52601<=e&&e<=52627||52629<=e&&e<=52655||52657<=e&&e<=52683||52685<=e&&e<=52711||52713<=e&&e<=52739||52741<=e&&e<=52767||52769<=e&&e<=52795||52797<=e&&e<=52823||52825<=e&&e<=52851||52853<=e&&e<=52879||52881<=e&&e<=52907||52909<=e&&e<=52935||52937<=e&&e<=52963||52965<=e&&e<=52991||52993<=e&&e<=53019||53021<=e&&e<=53047||53049<=e&&e<=53075||53077<=e&&e<=53103||53105<=e&&e<=53131||53133<=e&&e<=53159||53161<=e&&e<=53187||53189<=e&&e<=53215||53217<=e&&e<=53243||53245<=e&&e<=53271||53273<=e&&e<=53299||53301<=e&&e<=53327||53329<=e&&e<=53355||53357<=e&&e<=53383||53385<=e&&e<=53411||53413<=e&&e<=53439||53441<=e&&e<=53467||53469<=e&&e<=53495||53497<=e&&e<=53523||53525<=e&&e<=53551||53553<=e&&e<=53579||53581<=e&&e<=53607||53609<=e&&e<=53635||53637<=e&&e<=53663||53665<=e&&e<=53691||53693<=e&&e<=53719||53721<=e&&e<=53747||53749<=e&&e<=53775||53777<=e&&e<=53803||53805<=e&&e<=53831||53833<=e&&e<=53859||53861<=e&&e<=53887||53889<=e&&e<=53915||53917<=e&&e<=53943||53945<=e&&e<=53971||53973<=e&&e<=53999||54001<=e&&e<=54027||54029<=e&&e<=54055||54057<=e&&e<=54083||54085<=e&&e<=54111||54113<=e&&e<=54139||54141<=e&&e<=54167||54169<=e&&e<=54195||54197<=e&&e<=54223||54225<=e&&e<=54251||54253<=e&&e<=54279||54281<=e&&e<=54307||54309<=e&&e<=54335||54337<=e&&e<=54363||54365<=e&&e<=54391||54393<=e&&e<=54419||54421<=e&&e<=54447||54449<=e&&e<=54475||54477<=e&&e<=54503||54505<=e&&e<=54531||54533<=e&&e<=54559||54561<=e&&e<=54587||54589<=e&&e<=54615||54617<=e&&e<=54643||54645<=e&&e<=54671||54673<=e&&e<=54699||54701<=e&&e<=54727||54729<=e&&e<=54755||54757<=e&&e<=54783||54785<=e&&e<=54811||54813<=e&&e<=54839||54841<=e&&e<=54867||54869<=e&&e<=54895||54897<=e&&e<=54923||54925<=e&&e<=54951||54953<=e&&e<=54979||54981<=e&&e<=55007||55009<=e&&e<=55035||55037<=e&&e<=55063||55065<=e&&e<=55091||55093<=e&&e<=55119||55121<=e&&e<=55147||55149<=e&&e<=55175||55177<=e&&e<=55203?v:9757==e||9977==e||9994<=e&&e<=9997||127877==e||127938<=e&&e<=127940||127943==e||127946<=e&&e<=127948||128066<=e&&e<=128067||128070<=e&&e<=128080||128110==e||128112<=e&&e<=128120||128124==e||128129<=e&&e<=128131||128133<=e&&e<=128135||128170==e||128372<=e&&e<=128373||128378==e||128400==e||128405<=e&&e<=128406||128581<=e&&e<=128583||128587<=e&&e<=128591||128675==e||128692<=e&&e<=128694||128704==e||128716==e||129304<=e&&e<=129308||129310<=e&&e<=129311||129318==e||129328<=e&&e<=129337||129341<=e&&e<=129342||129489<=e&&e<=129501?S:127995<=e&&e<=127999?x:8205==e?T:9792==e||9794==e||9877<=e&&e<=9878||9992==e||10084==e||127752==e||127806==e||127859==e||127891==e||127908==e||127912==e||127979==e||127981==e||128139==e||128187<=e&&e<=128188||128295==e||128300==e||128488==e||128640==e||128658==e?b:128102<=e&&e<=128105?E:11}return this.nextBreak=function(e,t){if(void 0===t&&(t=0),t<0)return 0;if(t>=e.length-1)return e.length;for(var i,r,n=R(l(e,t)),a=[],o=t+1;o<e.length;o++)if(r=o-1,!(55296<=(i=e).charCodeAt(r)&&i.charCodeAt(r)<=56319&&56320<=i.charCodeAt(r+1)&&i.charCodeAt(r+1)<=57343)){var s=R(l(e,o));if(I(n,a,s))return o;a.push(s)}return e.length},this.splitGraphemes=function(e){for(var t,i=[],r=0;(t=this.nextBreak(e,r))<e.length;)i.push(e.slice(r,t)),r=t;return r<e.length&&i.push(e.slice(r)),i},this.iterateGraphemes=function(i){var r=0,e={next:function(){var e,t;return(t=this.nextBreak(i,r))<i.length?(e=i.slice(r,t),r=t,{value:e,done:!1}):r<i.length?(e=i.slice(r),r=i.length,{value:e,done:!1}):{value:void 0,done:!0}}.bind(this)};return"undefined"!=typeof Symbol&&Symbol.iterator&&(e[Symbol.iterator]=function(){return e}),e},this.countGraphemes=function(e){for(var t,i=0,r=0;(t=this.nextBreak(e,r))<e.length;)r=t,i++;return r<e.length&&i++,i},this}function Glyph(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function GlyphTextureInfo(e,t,i){this.labelCollection=e,this.index=t,this.dimensions=i}var defaultLineSpacingPercent=1.2,whitePixelCanvasId="ID_WHITE_PIXEL",whitePixelSize=new Cartesian2(4,4),whitePixelBoundingRegion=new BoundingRectangle(1,1,1,1);function addWhitePixelCanvas(e,t){var i=document.createElement("canvas");i.width=whitePixelSize.x,i.height=whitePixelSize.y;var r=i.getContext("2d");r.fillStyle="#fff",r.fillRect(0,0,i.width,i.height),e.addImage(whitePixelCanvasId,i).then(function(e){t._whitePixelIndex=e})}var writeTextToCanvasParameters={};function createGlyphCanvas(e,t,i,r,n,a,o){return writeTextToCanvasParameters.font=t,writeTextToCanvasParameters.fillColor=i,writeTextToCanvasParameters.strokeColor=r,writeTextToCanvasParameters.strokeWidth=n,writeTextToCanvasParameters.padding=SDFSettings$1.PADDING,o===VerticalOrigin$1.CENTER?writeTextToCanvasParameters.textBaseline="middle":o===VerticalOrigin$1.TOP?writeTextToCanvasParameters.textBaseline="top":writeTextToCanvasParameters.textBaseline="bottom",writeTextToCanvasParameters.fill=a===LabelStyle$1.FILL||a===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.stroke=a===LabelStyle$1.OUTLINE||a===LabelStyle$1.FILL_AND_OUTLINE,writeTextToCanvasParameters.backgroundColor=Color.BLACK,writeTextToCanvas(e,writeTextToCanvasParameters)}function unbindGlyph(e,t){t.textureInfo=void 0,t.dimensions=void 0;var i=t.billboard;defined(i)&&(i.show=!1,i.image=void 0,defined(i._removeCallbackFunc)&&(i._removeCallbackFunc(),i._removeCallbackFunc=void 0),e._spareBillboards.push(i),t.billboard=void 0)}function addGlyphToTextureAtlas(e,t,i,r){e.addImage(t,i).then(function(e){r.index=e})}var splitter=new GraphemeSplitter;function rebindAllGlyphs$1(e,t){var i,r,n,a=t._renderedText,o=splitter.splitGraphemes(a),s=o.length,l=t._glyphs,c=l.length;if(t._relativeSize=t._fontSize/SDFSettings$1.FONT_SIZE,s<c)for(r=s;r<c;++r)unbindGlyph(e,l[r]);l.length=s;var u=t._showBackground&&0<a.split("\n").join("").length,d=t._backgroundBillboard,h=e._backgroundBillboardCollection;u?(defined(d)||(d=h.add({collection:e,image:whitePixelCanvasId,imageSubRegion:whitePixelBoundingRegion}),t._backgroundBillboard=d),d.color=t._backgroundColor,d.show=t._show,d.position=t._position,d.eyeOffset=t._eyeOffset,d.pixelOffset=t._pixelOffset,d.horizontalOrigin=HorizontalOrigin$1.LEFT,d.verticalOrigin=t._verticalOrigin,d.heightReference=t._heightReference,d.scale=t.totalScale,d.pickPrimitive=t,d.id=t._id,d.translucencyByDistance=t._translucencyByDistance,d.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,d.scaleByDistance=t._scaleByDistance,d.distanceDisplayCondition=t._distanceDisplayCondition,d.disableDepthTestDistance=t._disableDepthTestDistance):defined(d)&&(h.remove(d),t._backgroundBillboard=d=void 0);var p=e._glyphTextureCache;for(n=0;n<s;++n){var m=o[n],f=t._verticalOrigin,g=JSON.stringify([m,t._fontFamily,t._fontStyle,t._fontWeight,+f]),_=p[g];if(!defined(_)){var y=createGlyphCanvas(m,t._fontStyle+" "+t._fontWeight+" "+SDFSettings$1.FONT_SIZE+"px "+t._fontFamily,Color.WHITE,Color.WHITE,0,LabelStyle$1.FILL,f);if(_=new GlyphTextureInfo(e,-1,y.dimensions),p[g]=_,0<y.width&&0<y.height){for(var v=calcSDF(y,{cutoff:SDFSettings$1.CUTOFF,radius:SDFSettings$1.RADIUS}),C=y.getContext("2d"),S=y.width,x=y.height,T=C.getImageData(0,0,S,x),b=0;b<S;b++)for(var E=0;E<x;E++){var P=E*S+b,A=255*v[P],w=4*P;T.data[0+w]=A,T.data[1+w]=A,T.data[2+w]=A,T.data[3+w]=A}C.putImageData(T,0,0)," "!==m&&addGlyphToTextureAtlas(e._textureAtlas,g,y,_)}}if(defined(i=l[n])?-1===_.index?unbindGlyph(e,i):defined(i.textureInfo)&&(i.textureInfo=void 0):(i=new Glyph,l[n]=i),i.textureInfo=_,i.dimensions=_.dimensions,-1!==_.index){var D=i.billboard,M=e._spareBillboards;defined(D)||(0<M.length?D=M.pop():((D=e._billboardCollection.add({collection:e}))._labelDimensions=new Cartesian2,D._labelTranslate=new Cartesian2),i.billboard=D),D.show=t._show,D.position=t._position,D.eyeOffset=t._eyeOffset,D.pixelOffset=t._pixelOffset,D.horizontalOrigin=HorizontalOrigin$1.LEFT,D.verticalOrigin=t._verticalOrigin,D.heightReference=t._heightReference,D.scale=t.totalScale,D.pickPrimitive=t,D.id=t._id,D.image=g,D.translucencyByDistance=t._translucencyByDistance,D.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,D.scaleByDistance=t._scaleByDistance,D.distanceDisplayCondition=t._distanceDisplayCondition,D.disableDepthTestDistance=t._disableDepthTestDistance,D._batchIndex=t._batchIndex,D.outlineColor=t.outlineColor,t.style===LabelStyle$1.FILL_AND_OUTLINE?(D.color=t._fillColor,D.outlineWidth=t.outlineWidth):t.style===LabelStyle$1.FILL?(D.color=t._fillColor,D.outlineWidth=0):t.style===LabelStyle$1.OUTLINE&&(D.color=Color.TRANSPARENT,D.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function calculateWidthOffset(e,t,i){return t===HorizontalOrigin$1.CENTER?-e/2:t===HorizontalOrigin$1.RIGHT?-(e+i.x):i.x}var glyphPixelOffset=new Cartesian2,scratchBackgroundPadding=new Cartesian2;function repositionAllGlyphs$1(e){var t,i,r,n=e._glyphs,a=e._renderedText,o=0,s=0,l=[],c=Number.NEGATIVE_INFINITY,u=0,d=1,h=n.length,p=e._backgroundBillboard,m=Cartesian2.clone(defined(p)?e._backgroundPadding:Cartesian2.ZERO,scratchBackgroundPadding);for(m.x/=e._relativeSize,m.y/=e._relativeSize,r=0;r<h;++r)"\n"===a.charAt(r)?(l.push(o),++d,o=0):(i=(t=n[r]).dimensions,u=Math.max(u,i.height-i.descent),c=Math.max(c,i.descent),o+=i.width-i.bounds.minx,r<h-1&&(o+=n[r+1].dimensions.bounds.minx),s=Math.max(s,o));l.push(o);var f=u+c,g=e.totalScale,_=e._horizontalOrigin,y=e._verticalOrigin,v=0,C=l[v],S=calculateWidthOffset(C,_,m),x=defaultLineSpacingPercent*f,T=x*(d-1),b=s,E=f+T;defined(p)&&(b+=2*m.x,E+=2*m.y,p._labelHorizontalOrigin=_),glyphPixelOffset.x=S*g;var P=!(glyphPixelOffset.y=0),A=0;for(r=0;r<h;++r)if("\n"===a.charAt(r))A+=x,S=calculateWidthOffset(C=l[++v],_,m),glyphPixelOffset.x=S*g,P=!0;else if(i=(t=n[r]).dimensions,y===VerticalOrigin$1.TOP?(glyphPixelOffset.y=i.height-u-m.y,glyphPixelOffset.y+=SDFSettings$1.PADDING):y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(T+i.height-u)/2:(y===VerticalOrigin$1.BASELINE?glyphPixelOffset.y=T:glyphPixelOffset.y=T+c+m.y,glyphPixelOffset.y-=SDFSettings$1.PADDING),glyphPixelOffset.y=(glyphPixelOffset.y-i.descent-A)*g,P&&(glyphPixelOffset.x-=SDFSettings$1.PADDING*g,P=!1),defined(t.billboard)&&(t.billboard._setTranslate(glyphPixelOffset),t.billboard._labelDimensions.x=b,t.billboard._labelDimensions.y=E,t.billboard._labelHorizontalOrigin=_),r<h-1){var w=n[r+1];glyphPixelOffset.x+=(i.width-i.bounds.minx+w.dimensions.bounds.minx)*g}if(defined(p)&&0<a.split("\n").join("").length&&(S=_===HorizontalOrigin$1.CENTER?-s/2-m.x:_===HorizontalOrigin$1.RIGHT?-(s+2*m.x):0,glyphPixelOffset.x=S*g,y===VerticalOrigin$1.TOP?glyphPixelOffset.y=f-u-c:y===VerticalOrigin$1.CENTER?glyphPixelOffset.y=(f-u)/2-c:y===VerticalOrigin$1.BASELINE?glyphPixelOffset.y=-m.y-c:glyphPixelOffset.y=0,glyphPixelOffset.y=glyphPixelOffset.y*g,p.width=b,p.height=E,p._setTranslate(glyphPixelOffset),p._labelTranslate=Cartesian2.clone(glyphPixelOffset,p._labelTranslate)),e.heightReference===HeightReference$1.CLAMP_TO_GROUND)for(r=0;r<h;++r){var D=(t=n[r]).billboard;defined(D)&&(D._labelTranslate=Cartesian2.clone(glyphPixelOffset,D._labelTranslate))}}function destroyLabel(e,t){for(var i=t._glyphs,r=0,n=i.length;r<n;++r)unbindGlyph(e,i[r]);defined(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,defined(t._removeCallbackFunc)&&t._removeCallbackFunc(),destroyObject(t)}function LabelCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._whitePixelIndex=void 0,this._backgroundBillboardCollection=new BillboardCollection({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new BillboardCollection({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=Color.clone(Color.WHITE),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT)}function PointPrimitive(e,t){var i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucencyByDistance,r=e.scaleByDistance,n=e.distanceDisplayCondition;defined(i)&&(i=NearFarScalar.clone(i)),defined(r)&&(r=NearFarScalar.clone(r)),defined(n)&&(n=DistanceDisplayCondition.clone(n)),this._show=defaultValue(e.show,!0),this._position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this._actualPosition=Cartesian3.clone(this._position),this._color=Color.clone(defaultValue(e.color,Color.WHITE)),this._outlineColor=Color.clone(defaultValue(e.outlineColor,Color.TRANSPARENT)),this._outlineWidth=defaultValue(e.outlineWidth,0),this._pixelSize=defaultValue(e.pixelSize,10),this._scaleByDistance=r,this._translucencyByDistance=i,this._distanceDisplayCondition=n,this._disableDepthTestDistance=defaultValue(e.disableDepthTestDistance,0),this._id=e.id,this._collection=defaultValue(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}defineProperties$1(LabelCollection.prototype,{length:{get:function(){return this._labels.length}}}),LabelCollection.prototype.add=function(e){var t=new Label(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},LabelCollection.prototype.remove=function(e){if(defined(e)&&e._labelCollection===this){var t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),destroyLabel(this,e),!0}return!1},LabelCollection.prototype.removeAll=function(){for(var e=this._labels,t=0,i=e.length;t<i;++t)destroyLabel(this,e[t]);e.length=0},LabelCollection.prototype.contains=function(e){return defined(e)&&e._labelCollection===this},LabelCollection.prototype.get=function(e){return this._labels[e]},LabelCollection.prototype.update=function(e){var t=this._billboardCollection,i=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,i.modelMatrix=this.modelMatrix,i.debugShowBoundingVolume=this.debugShowBoundingVolume;var r=e.context;defined(this._textureAtlas)||(this._textureAtlas=new TextureAtlas({context:r}),t.textureAtlas=this._textureAtlas),defined(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new TextureAtlas({context:r,initialSize:whitePixelSize}),i.textureAtlas=this._backgroundTextureAtlas,addWhitePixelCanvas(this._backgroundTextureAtlas,this));for(var n=this._labelsToUpdate.length,a=0;a<n;++a){var o=this._labelsToUpdate[a];if(!o.isDestroyed()){var s=o._glyphs.length;o._rebindAllGlyphs&&(rebindAllGlyphs$1(this,o),o._rebindAllGlyphs=!1),o._repositionAllGlyphs&&(repositionAllGlyphs$1(o),o._repositionAllGlyphs=!1);var l=o._glyphs.length-s;this._totalGlyphCount+=l}}var c=0<i.length?BlendOption$1.TRANSLUCENT:this.blendOption;t.blendOption=c,i.blendOption=c,t._highlightColor=this._highlightColor,i._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,i.update(e),t.update(e)},LabelCollection.prototype.isDestroyed=function(){return!1},LabelCollection.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(),destroyObject(this)};var SHOW_INDEX$2=PointPrimitive.SHOW_INDEX=0,POSITION_INDEX$2=PointPrimitive.POSITION_INDEX=1,COLOR_INDEX$2=PointPrimitive.COLOR_INDEX=2,OUTLINE_COLOR_INDEX=PointPrimitive.OUTLINE_COLOR_INDEX=3,OUTLINE_WIDTH_INDEX=PointPrimitive.OUTLINE_WIDTH_INDEX=4,PIXEL_SIZE_INDEX=PointPrimitive.PIXEL_SIZE_INDEX=5,SCALE_BY_DISTANCE_INDEX$2=PointPrimitive.SCALE_BY_DISTANCE_INDEX=6,TRANSLUCENCY_BY_DISTANCE_INDEX$2=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX=7,DISTANCE_DISPLAY_CONDITION_INDEX$1=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX=8,DISABLE_DEPTH_DISTANCE_INDEX=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX=9;function makeDirty$1(e,t){var i=e._pointPrimitiveCollection;defined(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}PointPrimitive.NUMBER_OF_PROPERTIES=10,defineProperties$1(PointPrimitive.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,makeDirty$1(this,SHOW_INDEX$2))}},position:{get:function(){return this._position},set:function(e){var t=this._position;Cartesian3.equals(t,e)||(Cartesian3.clone(e,t),Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$2))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;NearFarScalar.equals(t,e)||(this._scaleByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,SCALE_BY_DISTANCE_INDEX$2))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;NearFarScalar.equals(t,e)||(this._translucencyByDistance=NearFarScalar.clone(e,t),makeDirty$1(this,TRANSLUCENCY_BY_DISTANCE_INDEX$2))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,makeDirty$1(this,PIXEL_SIZE_INDEX))}},color:{get:function(){return this._color},set:function(e){var t=this._color;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,COLOR_INDEX$2))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;Color.equals(t,e)||(Color.clone(e,t),makeDirty$1(this,OUTLINE_COLOR_INDEX))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,makeDirty$1(this,OUTLINE_WIDTH_INDEX))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$1(this,DISTANCE_DISPLAY_CONDITION_INDEX$1))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,makeDirty$1(this,DISABLE_DEPTH_DISTANCE_INDEX))}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(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,makeDirty$1(this,SHOW_INDEX$2))}}}),PointPrimitive.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},PointPrimitive.prototype._getActualPosition=function(){return this._actualPosition},PointPrimitive.prototype._setActualPosition=function(e){Cartesian3.clone(e,this._actualPosition),makeDirty$1(this,POSITION_INDEX$2)};var tempCartesian3$1=new Cartesian4;PointPrimitive._computeActualPosition=function(e,t,i){return t.mode===SceneMode$1.SCENE3D?e:(Matrix4.multiplyByPoint(i,e,tempCartesian3$1),SceneTransforms.computeActualWgs84Position(t,tempCartesian3$1))};var scratchCartesian4$4=new Cartesian4;PointPrimitive._computeScreenSpacePosition=function(e,t,i,r){var n=Matrix4.multiplyByVector(e,Cartesian4.fromElements(t.x,t.y,t.z,1,scratchCartesian4$4),scratchCartesian4$4);return SceneTransforms.wgs84ToWindowCoordinates(i,n,r)},PointPrimitive.prototype.computeScreenSpacePosition=function(e,t){var i=this._pointPrimitiveCollection;defined(t)||(t=new Cartesian2);var r=i.modelMatrix,n=PointPrimitive._computeScreenSpacePosition(r,this._actualPosition,e,t);if(defined(n))return n.y=e.canvas.clientHeight-n.y,n},PointPrimitive.getScreenSpaceBoundingBox=function(e,t,i){var r=e.pixelSize,n=.5*r,a=t.x-n,o=t.y-n,s=r,l=r;return defined(i)||(i=new BoundingRectangle),i.x=a,i.y=o,i.width=s,i.height=l,i},PointPrimitive.prototype.equals=function(e){return this===e||defined(e)&&this._id===e._id&&Cartesian3.equals(this._position,e._position)&&Color.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&Color.equals(this._outlineColor,e._outlineColor)&&NearFarScalar.equals(this._scaleByDistance,e._scaleByDistance)&&NearFarScalar.equals(this._translucencyByDistance,e._translucencyByDistance)&&DistanceDisplayCondition.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},PointPrimitive.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};var PointPrimitiveCollectionFS="varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\nif (color.a < 0.005)\n{\ndiscard;\n}\n#else\n#ifdef OPAQUE\nif (color.a < 0.995)\n{\ndiscard;\n}\n#else\nif (color.a >= 0.995)\n{\ndiscard;\n}\n#endif\n#endif\ngl_FragColor = czm_gammaCorrect(color);\nczm_writeLogDepth();\n}\n",PointPrimitiveCollectionVS="uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nattribute vec3 distanceDisplayConditionAndDisableDepth;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_pixelRatio;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\n#ifdef DISTANCE_DISPLAY_CONDITION\nfloat nearSq = distanceDisplayConditionAndDisableDepth.x;\nfloat farSq = distanceDisplayConditionAndDisableDepth.y;\nif (lengthSq < nearSq || lengthSq > farSq) {\npositionEC.xyz = vec3(0.0);\n}\n#endif\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n#ifdef DISABLE_DEPTH_DISTANCE\nfloat disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\nif (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n{\ndisableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n}\nif (disableDepthTestDistance != 0.0)\n{\nfloat zclip = gl_Position.z / gl_Position.w;\nbool clipped = (zclip < -1.0 || zclip > 1.0);\nif (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n{\ngl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(vec4(czm_currentFrustum.x));\n#endif\n}\n}\n#endif\nv_color = color;\nv_color.a *= translucency * show;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency * show;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize * show;\ngl_Position *= show;\nv_pickColor = pickColor;\n}\n",SHOW_INDEX$3=PointPrimitive.SHOW_INDEX,POSITION_INDEX$3=PointPrimitive.POSITION_INDEX,COLOR_INDEX$3=PointPrimitive.COLOR_INDEX,OUTLINE_COLOR_INDEX$1=PointPrimitive.OUTLINE_COLOR_INDEX,OUTLINE_WIDTH_INDEX$1=PointPrimitive.OUTLINE_WIDTH_INDEX,PIXEL_SIZE_INDEX$1=PointPrimitive.PIXEL_SIZE_INDEX,SCALE_BY_DISTANCE_INDEX$3=PointPrimitive.SCALE_BY_DISTANCE_INDEX,TRANSLUCENCY_BY_DISTANCE_INDEX$3=PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX,DISTANCE_DISPLAY_CONDITION_INDEX$2=PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX,DISABLE_DEPTH_DISTANCE_INDEX$1=PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX,NUMBER_OF_PROPERTIES$1=PointPrimitive.NUMBER_OF_PROPERTIES,attributeLocations$1={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function PointPrimitiveCollection(e){e=defaultValue(e,defaultValue.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(NUMBER_OF_PROPERTIES$1),this._maxPixelSize=1,this._baseVolume=new BoundingSphere,this._baseVolumeWC=new BoundingSphere,this._baseVolume2D=new BoundingSphere,this._boundingVolume=new BoundingSphere,this._boundingVolumeDirty=!1,this._colorCommands=[],this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.blendOption=defaultValue(e.blendOption,BlendOption$1.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=SceneMode$1.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW,BufferUsage$1.STATIC_DRAW];var t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}function destroyPointPrimitives(e){for(var t=e.length,i=0;i<t;++i)e[i]&&e[i]._destroy()}function removePointPrimitives(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,a=0;n<r;++n){var o=i[n];o&&(o._index=a++,t.push(o))}e._pointPrimitives=t}}function createVAF$1(e,t,i){return new VertexArrayFacade(e,[{index:attributeLocations$1.positionHighAndSize,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$3]},{index:attributeLocations$1.positionLowAndShow,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[POSITION_INDEX$3]},{index:attributeLocations$1.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[COLOR_INDEX$3]},{index:attributeLocations$1.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[TRANSLUCENCY_BY_DISTANCE_INDEX$3]},{index:attributeLocations$1.scaleByDistance,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[SCALE_BY_DISTANCE_INDEX$3]},{index:attributeLocations$1.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,usage:i[DISTANCE_DISPLAY_CONDITION_INDEX$2]}],t)}defineProperties$1(PointPrimitiveCollection.prototype,{length:{get:function(){return removePointPrimitives(this),this._pointPrimitives.length}}}),PointPrimitiveCollection.prototype.add=function(e){var t=new PointPrimitive(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},PointPrimitiveCollection.prototype.remove=function(e){return!!this.contains(e)&&(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},PointPrimitiveCollection.prototype.removeAll=function(){destroyPointPrimitives(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},PointPrimitiveCollection.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},PointPrimitiveCollection.prototype.contains=function(e){return defined(e)&&e._pointPrimitiveCollection===this},PointPrimitiveCollection.prototype.get=function(e){return removePointPrimitives(this),this._pointPrimitives[e]},PointPrimitiveCollection.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;r<NUMBER_OF_PROPERTIES$1;++r){var n=0===i[r]?BufferUsage$1.STATIC_DRAW:BufferUsage$1.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var writePositionScratch$1=new EncodedCartesian3;function writePositionSizeAndOutline(e,t,i,r){var n=r._index,a=r._getActualPosition();e._mode===SceneMode$1.SCENE3D&&(BoundingSphere.expand(e._baseVolume,a,e._baseVolume),e._boundingVolumeDirty=!0),EncodedCartesian3.fromCartesian(a,writePositionScratch$1);var o=r.pixelSize,s=r.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,o+s);var l=i[attributeLocations$1.positionHighAndSize],c=writePositionScratch$1.high;l(n,c.x,c.y,c.z,o);var u=i[attributeLocations$1.positionLowAndOutline],d=writePositionScratch$1.low;u(n,d.x,d.y,d.z,s)}var LEFT_SHIFT16$1=65536,LEFT_SHIFT8$1=256;function writeCompressedAttrib0$1(e,t,i,r){var n=r._index,a=r.color,o=r.getPickId(t).color,s=r.outlineColor,l=Color.floatToByte(a.red),c=Color.floatToByte(a.green),u=Color.floatToByte(a.blue),d=l*LEFT_SHIFT16$1+c*LEFT_SHIFT8$1+u;l=Color.floatToByte(s.red),c=Color.floatToByte(s.green),u=Color.floatToByte(s.blue);var h=l*LEFT_SHIFT16$1+c*LEFT_SHIFT8$1+u;l=Color.floatToByte(o.red),c=Color.floatToByte(o.green),u=Color.floatToByte(o.blue);var p=l*LEFT_SHIFT16$1+c*LEFT_SHIFT8$1+u,m=Color.floatToByte(a.alpha)*LEFT_SHIFT16$1+Color.floatToByte(s.alpha)*LEFT_SHIFT8$1+Color.floatToByte(o.alpha);(0,i[attributeLocations$1.compressedAttribute0])(n,d,h,p,m)}function writeCompressedAttrib1$1(e,t,i,r){var n=r._index,a=0,o=1,s=1,l=1,c=r.translucencyByDistance;defined(c)&&(a=c.near,o=c.nearValue,s=c.far,l=c.farValue,1===o&&1===l||(e._shaderTranslucencyByDistance=!0));var u=r.show&&r.clusterShow;0===r.color.alpha&&0===r.outlineColor.alpha&&(u=!1),o=CesiumMath.clamp(o,0,1);var d=(u?1:0)*LEFT_SHIFT8$1+(o=1===o?255:255*o|0),h=l=1===(l=CesiumMath.clamp(l,0,1))?255:255*l|0;(0,i[attributeLocations$1.compressedAttribute1])(n,d,h,a,s)}function writeScaleByDistance$1(e,t,i,r){var n=r._index,a=i[attributeLocations$1.scaleByDistance],o=0,s=1,l=1,c=1,u=r.scaleByDistance;defined(u)&&(o=u.near,s=u.nearValue,l=u.far,c=u.farValue,1===s&&1===c||(e._shaderScaleByDistance=!0)),a(n,o,s,l,c)}function writeDistanceDisplayConditionAndDepthDisable(e,t,i,r){var n=r._index,a=i[attributeLocations$1.distanceDisplayConditionAndDisableDepth],o=0,s=Number.MAX_VALUE,l=r.distanceDisplayCondition;defined(l)&&(o=l.near,s=l.far,o*=o,s*=s,e._shaderDistanceDisplayCondition=!0);var c=r.disableDepthTestDistance;0<(c*=c)&&(e._shaderDisableDepthDistance=!0,c===Number.POSITIVE_INFINITY&&(c=-1)),a(n,o,s,c)}function writePointPrimitive(e,t,i,r){writePositionSizeAndOutline(e,t,i,r),writeCompressedAttrib0$1(e,t,i,r),writeCompressedAttrib1$1(e,t,i,r),writeScaleByDistance$1(e,t,i,r),writeDistanceDisplayConditionAndDepthDisable(e,t,i,r)}function recomputeActualPositions$1(e,t,i,r,n,a){var o;r.mode===SceneMode$1.SCENE3D?(o=e._baseVolume,e._boundingVolumeDirty=!0):o=e._baseVolume2D;for(var s=[],l=0;l<i;++l){var c=t[l],u=c.position,d=PointPrimitive._computeActualPosition(u,r,n);defined(d)&&(c._setActualPosition(d),a?s.push(d):BoundingSphere.expand(o,d,o))}a&&BoundingSphere.fromPoints(s,o)}function updateMode$1(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,a=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==SceneMode$1.SCENE3D&&!Matrix4.equals(a,e.modelMatrix)?(e._mode=i,Matrix4.clone(e.modelMatrix,a),e._createVertexArray=!0,i!==SceneMode$1.SCENE3D&&i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,r,r.length,t,a,!0)):i===SceneMode$1.MORPHING?recomputeActualPositions$1(e,r,r.length,t,a,!0):i!==SceneMode$1.SCENE2D&&i!==SceneMode$1.COLUMBUS_VIEW||recomputeActualPositions$1(e,n,e._pointPrimitivesToUpdateIndex,t,a,!1)}function updateBoundingVolume$1(e,t,i){var r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;i.radius+=r}var scratchWriterArray$1=[];function kdbush(e,t,i,r,n){return new KDBush(e,t,i,r,n)}function KDBush(e,t,i,r,n){t=t||defaultGetX,i=i||defaultGetY,n=n||Array,this.nodeSize=r||64,this.points=e,this.ids=new n(e.length),this.coords=new n(2*e.length);for(var a=0;a<e.length;a++)this.ids[a]=a,this.coords[2*a]=t(e[a]),this.coords[2*a+1]=i(e[a]);sort$1(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}function defaultGetX(e){return e[0]}function defaultGetY(e){return e[1]}function range(e,t,i,r,n,a,o){for(var s,l,c=[0,e.length-1,0],u=[];c.length;){var d=c.pop(),h=c.pop(),p=c.pop();if(h-p<=o)for(var m=p;m<=h;m++)s=t[2*m],l=t[2*m+1],i<=s&&s<=n&&r<=l&&l<=a&&u.push(e[m]);else{var f=Math.floor((p+h)/2);s=t[2*f],l=t[2*f+1],i<=s&&s<=n&&r<=l&&l<=a&&u.push(e[f]);var g=(d+1)%2;(0===d?i<=s:r<=l)&&(c.push(p),c.push(f-1),c.push(g)),(0===d?s<=n:l<=a)&&(c.push(f+1),c.push(h),c.push(g))}}return u}function sort$1(e,t,i,r,n,a){if(!(n-r<=i)){var o=Math.floor((r+n)/2);select(e,t,o,r,n,a%2),sort$1(e,t,i,r,o-1,a+1),sort$1(e,t,i,o+1,n,a+1)}}function select(e,t,i,r,n,a){for(;r<n;){if(600<n-r){var o=n-r+1,s=i-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);select(e,t,i,Math.max(r,Math.floor(i-s*c/o+u)),Math.min(n,Math.floor(i+(o-s)*c/o+u)),a)}var d=t[2*i+a],h=r,p=n;for(swapItem(e,t,r,i),t[2*n+a]>d&&swapItem(e,t,r,n);h<p;){for(swapItem(e,t,h,p),h++,p--;t[2*h+a]<d;)h++;for(;t[2*p+a]>d;)p--}t[2*r+a]===d?swapItem(e,t,r,p):swapItem(e,t,++p,n),p<=i&&(r=p+1),i<=p&&(n=p-1)}}function swapItem(e,t,i,r){swap$2(e,i,r),swap$2(t,2*i,2*r),swap$2(t,2*i+1,2*r+1)}function swap$2(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function within(e,t,i,r,n,a){for(var o=[0,e.length-1,0],s=[],l=n*n;o.length;){var c=o.pop(),u=o.pop(),d=o.pop();if(u-d<=a)for(var h=d;h<=u;h++)sqDist(t[2*h],t[2*h+1],i,r)<=l&&s.push(e[h]);else{var p=Math.floor((d+u)/2),m=t[2*p],f=t[2*p+1];sqDist(m,f,i,r)<=l&&s.push(e[p]);var g=(c+1)%2;(0===c?i-n<=m:r-n<=f)&&(o.push(d),o.push(p-1),o.push(g)),(0===c?m<=i+n:f<=r+n)&&(o.push(p+1),o.push(u),o.push(g))}}return s}function sqDist(e,t,i,r){var n=e-i,a=t-r;return n*n+a*a}function EntityCluster(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._enabled=defaultValue(e.enabled,!1),this._pixelRange=defaultValue(e.pixelRange,80),this._minimumClusterSize=defaultValue(e.minimumClusterSize,2),this._clusterBillboards=defaultValue(e.clusterBillboards,!0),this._clusterLabels=defaultValue(e.clusterLabels,!0),this._clusterPoints=defaultValue(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 Event}function getX(e){return e.coord.x}function getY(e){return e.coord.y}function expandBoundingBox(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}PointPrimitiveCollection.prototype.update=function(e){removePointPrimitives(this),this._maxTotalPointSize=ContextLimits.maximumAliasedPointSize,updateMode$1(this,e);var t,i=this._pointPrimitives.length,r=this._pointPrimitivesToUpdate,n=this._pointPrimitivesToUpdateIndex,a=this._propertiesChanged,o=this._createVertexArray,s=e.context,l=e.passes,c=l.pick;if(o||!c&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var u=0;u<NUMBER_OF_PROPERTIES$1;++u)a[u]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),0<i){this._vaf=createVAF$1(s,i,this._buffersUsage),t=this._vaf.writers;for(var d=0;d<i;++d){var h=this._pointPrimitives[d];h._dirty=!1,writePointPrimitive(this,s,t,h)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(0<n){var p=scratchWriterArray$1;p.length=0,(a[POSITION_INDEX$3]||a[OUTLINE_WIDTH_INDEX$1]||a[PIXEL_SIZE_INDEX$1])&&p.push(writePositionSizeAndOutline),(a[COLOR_INDEX$3]||a[OUTLINE_COLOR_INDEX$1])&&p.push(writeCompressedAttrib0$1),(a[SHOW_INDEX$3]||a[TRANSLUCENCY_BY_DISTANCE_INDEX$3])&&p.push(writeCompressedAttrib1$1),a[SCALE_BY_DISTANCE_INDEX$3]&&p.push(writeScaleByDistance$1),(a[DISTANCE_DISPLAY_CONDITION_INDEX$2]||a[DISABLE_DEPTH_DISTANCE_INDEX$1])&&p.push(writeDistanceDisplayConditionAndDepthDisable);var m=p.length;if(t=this._vaf.writers,.1<n/i){for(var f=0;f<n;++f){var g=r[f];g._dirty=!1;for(var _=0;_<m;++_)p[_](this,s,t,g)}this._vaf.commit()}else{for(var y=0;y<n;++y){var v=r[y];v._dirty=!1;for(var C=0;C<m;++C)p[C](this,s,t,v);this._vaf.subCommit(v._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(1.5*i<n&&(r.length=i),defined(this._vaf)&&defined(this._vaf.va)){var S;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,BoundingSphere.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var x=Matrix4.IDENTITY;updateBoundingVolume$1(this,e,S=e.mode===SceneMode$1.SCENE3D?(x=this.modelMatrix,BoundingSphere.clone(this._baseVolumeWC,this._boundingVolume)):BoundingSphere.clone(this._baseVolume2D,this._boundingVolume));var T,b,E,P,A,w,D=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,D&&(this._blendOption===BlendOption$1.OPAQUE||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===BlendOption$1.TRANSLUCENT||this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=RenderState.fromCache({depthTest:{enabled:!0,func:WebGLConstants$1.LEQUAL},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance,(D||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(T=new ShaderSource({sources:[PointPrimitiveCollectionVS]}),this._shaderScaleByDistance&&T.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&T.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&T.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&T.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT&&(b=new ShaderSource({defines:["OPAQUE"],sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:attributeLocations$1}),b=new ShaderSource({defines:["TRANSLUCENT"],sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:attributeLocations$1})),this._blendOption===BlendOption$1.OPAQUE&&(b=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._sp=ShaderProgram.replaceCache({context:s,shaderProgram:this._sp,vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:attributeLocations$1})),this._blendOption===BlendOption$1.TRANSLUCENT&&(b=new ShaderSource({sources:[PointPrimitiveCollectionFS]}),this._spTranslucent=ShaderProgram.replaceCache({context:s,shaderProgram:this._spTranslucent,vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:attributeLocations$1})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);var M=e.commandList;if(l.render||c){var I=this._colorCommands,R=this._blendOption===BlendOption$1.OPAQUE,O=this._blendOption===BlendOption$1.OPAQUE_AND_TRANSLUCENT;P=(E=this._vaf.va).length,I.length=P;var L=O?2*P:P;for(w=0;w<L;++w){var F=R||O&&w%2==0;defined(A=I[w])||(A=I[w]=new DrawCommand),A.primitiveType=PrimitiveType$1.POINTS,A.pass=F||!O?Pass$1.OPAQUE:Pass$1.TRANSLUCENT,A.owner=this;var N=O?Math.floor(w/2):w;A.boundingVolume=S,A.modelMatrix=x,A.shaderProgram=F?this._sp:this._spTranslucent,A.uniformMap=this._uniforms,A.vertexArray=E[N].va,A.renderState=F?this._rsOpaque:this._rsTranslucent,A.debugShowBoundingVolume=this.debugShowBoundingVolume,A.pickId="v_pickColor",M.push(A)}}}},PointPrimitiveCollection.prototype.isDestroyed=function(){return!1},PointPrimitiveCollection.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(),destroyPointPrimitives(this._pointPrimitives),destroyObject(this)},KDBush.prototype={range:function(e,t,i,r){return range(this.ids,this.coords,e,t,i,r,this.nodeSize)},within:function(e,t,i){return within(this.ids,this.coords,e,t,i,this.nodeSize)}};var labelBoundingBoxScratch=new BoundingRectangle;function getBoundingBox(e,t,i,r,n){if(defined(e._labelCollection)&&r._clusterLabels?n=Label.getScreenSpaceBoundingBox(e,t,n):defined(e._billboardCollection)&&r._clusterBillboards?n=Billboard.getScreenSpaceBoundingBox(e,t,n):defined(e._pointPrimitiveCollection)&&r._clusterPoints&&(n=PointPrimitive.getScreenSpaceBoundingBox(e,t,n)),expandBoundingBox(n,i),r._clusterLabels&&!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(r,e.id.id)&&defined(e.id._label)){var a=r._collectionIndicesByEntity[e.id.id].labelIndex,o=r._labelCollection.get(a),s=Label.getScreenSpaceBoundingBox(o,t,labelBoundingBoxScratch);expandBoundingBox(s,i),n=BoundingRectangle.union(n,s,n)}return n}function addNonClusteredItem(e,t){if(e.clusterShow=!0,!defined(e._labelCollection)&&defined(e.id)&&hasLabelIndex(t,e.id.id)&&defined(e.id._label)){var i=t._collectionIndicesByEntity[e.id.id].labelIndex;t._labelCollection.get(i).clusterShow=!0}}function addCluster(e,t,i,r){var n={billboard:r._clusterBillboardCollection.add(),label:r._clusterLabelCollection.add(),point:r._clusterPointCollection.add()};n.billboard.show=!1,n.point.show=!1,n.label.show=!0,n.label.text=t.toLocaleString(),n.label.id=i,n.billboard.position=n.label.position=n.point.position=e,r._clusterEvent.raiseEvent(i,n)}function hasLabelIndex(e,t){return defined(e)&&defined(e._collectionIndicesByEntity[t])&&defined(e._collectionIndicesByEntity[t].labelIndex)}function getScreenSpacePositions(e,t,i,r,n){if(defined(e))for(var a=e.length,o=0;o<a;++o){var s=e.get(o);if(s.clusterShow=!1,s.show&&(n._scene.mode!==SceneMode$1.SCENE3D||r.isPointVisible(s.position))){var l=n._clusterLabels&&defined(s._labelCollection),c=n._clusterBillboards&&defined(s.id._billboard),u=n._clusterPoints&&defined(s.id._point);if(!l||!u&&!c){var d=s.computeScreenSpacePosition(i);defined(d)&&t.push({index:o,collection:e,clustered:!1,coord:d})}}}}var pointBoundinRectangleScratch=new BoundingRectangle,totalBoundingRectangleScratch=new BoundingRectangle,neighborBoundingRectangleScratch=new BoundingRectangle;function createDeclutterCallback(H){return function(e){if(!(defined(e)&&e<.05)&&H.enabled){var t=H._scene,i=H._labelCollection,r=H._billboardCollection,n=H._pointCollection;if((defined(i)||defined(r)||defined(n))&&(H._clusterBillboards||H._clusterLabels||H._clusterPoints)){var a=H._clusterLabelCollection,o=H._clusterBillboardCollection,s=H._clusterPointCollection;defined(a)?a.removeAll():a=H._clusterLabelCollection=new LabelCollection({scene:t}),defined(o)?o.removeAll():o=H._clusterBillboardCollection=new BillboardCollection({scene:t}),defined(s)?s.removeAll():s=H._clusterPointCollection=new PointPrimitiveCollection;var l,c,u,d,h,p,m,f,g,_,y,v=H._pixelRange,C=H._minimumClusterSize,S=H._previousClusters,x=[],T=H._previousHeight,b=t.camera.positionCartographic.height,E=new EllipsoidalOccluder(t.mapProjection.ellipsoid,t.camera.positionWC),P=[];H._clusterLabels&&getScreenSpacePositions(i,P,t,E,H),H._clusterBillboards&&getScreenSpacePositions(r,P,t,E,H),H._clusterPoints&&getScreenSpacePositions(n,P,t,E,H);var A=kdbush(P,getX,getY,64,Int32Array);if(b<T)for(u=S.length,l=0;l<u;++l){var w=S[l];if(E.isPointVisible(w.position)){var D=Billboard._computeScreenSpacePosition(Matrix4.IDENTITY,w.position,Cartesian3.ZERO,Cartesian2.ZERO,t);if(defined(D)){var M=1-b/T,I=w.width=w.width*M,R=w.height=w.height*M;I=Math.max(I,w.minimumWidth),R=Math.max(R,w.minimumHeight);var O=D.x-.5*I,L=D.y-.5*R,F=D.x+I,N=D.y+R;for(p=(h=A.range(O,L,F,N)).length,f=[],c=g=0;c<p;++c)(m=P[h[c]]).clustered||(++g,_=m.collection,y=m.index,f.push(_.get(y).id));if(C<=g)for(addCluster(w.position,g,f,H),x.push(w),c=0;c<p;++c)P[h[c]].clustered=!0}}}for(u=P.length,l=0;l<u;++l){var B=P[l];if(!B.clustered){B.clustered=!0,_=B.collection,y=B.index;var V=_.get(y);d=getBoundingBox(V,B.coord,v,H,pointBoundinRectangleScratch);var k=BoundingRectangle.clone(d,totalBoundingRectangleScratch);p=(h=A.range(d.x,d.y,d.x+d.width,d.y+d.height)).length;var $=Cartesian3.clone(V.position);for(g=1,f=[V.id],c=0;c<p;++c)if(!(m=P[h[c]]).clustered){var z=m.collection.get(m.index),U=getBoundingBox(z,m.coord,v,H,neighborBoundingRectangleScratch);Cartesian3.add(z.position,$,$),BoundingRectangle.union(k,U,k),++g,f.push(z.id)}if(C<=g){var G=Cartesian3.multiplyByScalar($,1/g,$);for(addCluster(G,g,f,H),x.push({position:G,width:k.width,height:k.height,minimumWidth:d.width,minimumHeight:d.height}),c=0;c<p;++c)P[h[c]].clustered=!0}else addNonClusteredItem(V,H)}}0===a.length&&(a.destroy(),H._clusterLabelCollection=void 0),0===o.length&&(o.destroy(),H._clusterBillboardCollection=void 0),0===s.length&&(s.destroy(),H._clusterPointCollection=void 0),H._previousClusters=x,H._previousHeight=b}}}}function createGetEntity(o,s,l,c){return function(e){var t=this[o];defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});var i,r,n=this._collectionIndicesByEntity[e.id];if(defined(n)||(n=this._collectionIndicesByEntity[e.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),defined(t)&&defined(n[c]))return t.get(n[c]);defined(t)||(t=this[o]=new s({scene:this._scene}));var a=this[l];return 0<a.length?(i=a.pop(),r=t.get(i)):(r=t.add(),i=t.length-1),n[c]=i,this._clusterDirty=!0,r}}function removeEntityIndicesIfUnused(e,t){var i=e._collectionIndicesByEntity[t];defined(i.billboardIndex)||defined(i.labelIndex)||defined(i.pointIndex)||delete e._collectionIndicesByEntity[t]}function disableCollectionClustering(e){if(defined(e))for(var t=e.length,i=0;i<t;++i)e.get(i).clusterShow=!0}function updateEnable(e){e.enabled||(defined(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),defined(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),defined(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,disableCollectionClustering(e._labelCollection),disableCollectionClustering(e._billboardCollection),disableCollectionClustering(e._pointCollection))}function CustomDataSource(e){this._name=e,this._clock=void 0,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster}EntityCluster.prototype._initialize=function(e){this._scene=e;var t=createDeclutterCallback(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)},defineProperties$1(EntityCluster.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}}}),EntityCluster.prototype.getLabel=createGetEntity("_labelCollection",LabelCollection,"_unusedLabelIndices","labelIndex"),EntityCluster.prototype.removeLabel=function(e){var t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(defined(this._labelCollection)&&defined(t)&&defined(t.labelIndex)){var i=t.labelIndex;t.labelIndex=void 0,removeEntityIndicesIfUnused(this,e.id);var r=this._labelCollection.get(i);r.show=!1,r.text="",r.id=void 0,this._unusedLabelIndices.push(i),this._clusterDirty=!0}},EntityCluster.prototype.getBillboard=createGetEntity("_billboardCollection",BillboardCollection,"_unusedBillboardIndices","billboardIndex"),EntityCluster.prototype.removeBillboard=function(e){var t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(defined(this._billboardCollection)&&defined(t)&&defined(t.billboardIndex)){var i=t.billboardIndex;t.billboardIndex=void 0,removeEntityIndicesIfUnused(this,e.id);var r=this._billboardCollection.get(i);r.id=void 0,r.show=!1,r.image=void 0,this._unusedBillboardIndices.push(i),this._clusterDirty=!0}},EntityCluster.prototype.getPoint=createGetEntity("_pointCollection",PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),EntityCluster.prototype.removePoint=function(e){var t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(defined(this._pointCollection)&&defined(t)&&defined(t.pointIndex)){var i=t.pointIndex;t.pointIndex=void 0,removeEntityIndicesIfUnused(this,e.id);var r=this._pointCollection.get(i);r.show=!1,r.id=void 0,this._unusedPointIndices.push(i),this._clusterDirty=!0}},EntityCluster.prototype.update=function(e){var t;defined(this._labelCollection)&&0<this._labelCollection.length&&0===this._labelCollection.get(0)._glyphs.length&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),defined(this._billboardCollection)&&0<this._billboardCollection.length&&!defined(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,updateEnable(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),defined(this._clusterPointCollection)&&this._clusterPointCollection.update(e),defined(this._labelCollection)&&this._labelCollection.update(e),defined(this._billboardCollection)&&this._billboardCollection.update(e),defined(this._pointCollection)&&this._pointCollection.update(e)},EntityCluster.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(),defined(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},defineProperties$1(CustomDataSource.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){DataSource.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){this._entityCluster=e}}});var defaultOffset$2=Cartesian3.ZERO,offsetScratch$5=new Cartesian3,positionScratch$7=new Cartesian3,scratchColor$2=new Color;function CylinderGeometryOptions(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 CylinderGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new CylinderGeometryOptions(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}function DynamicCylinderGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(CylinderGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),CylinderGeometryUpdater.prototype.constructor=CylinderGeometryUpdater),defineProperties$1(CylinderGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),CylinderGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),color:void 0,offset:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$2)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$2,offsetScratch$5))),new GeometryInstance({id:i,geometry:new CylinderGeometry(this._options),modelMatrix:i.computeModelMatrixForHeightReference(e,i.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:o})},CylinderGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$2),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$2,offsetScratch$5))),new GeometryInstance({id:t,geometry:new CylinderOutlineGeometry(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:a})},CylinderGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},CylinderGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.length)||!defined(t.topRadius)||!defined(t.bottomRadius)||GeometryUpdater.prototype._isHidden.call(this,e,t)},CylinderGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.length.isConstant&&t.topRadius.isConstant&&t.bottomRadius.isConstant&&Property.isConstant(t.slices)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.numberOfVerticalLines))},CylinderGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),r=this._options;r.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.length=t.length.getValue(Iso8601.MINIMUM_VALUE),r.topRadius=t.topRadius.getValue(Iso8601.MINIMUM_VALUE),r.bottomRadius=t.bottomRadius.getValue(Iso8601.MINIMUM_VALUE),r.slices=Property.getValueOrUndefined(t.slices,Iso8601.MINIMUM_VALUE),r.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},CylinderGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,CylinderGeometryUpdater.DynamicGeometryUpdater=DynamicCylinderGeometryUpdater,defined(Object.create)&&(DynamicCylinderGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicCylinderGeometryUpdater.prototype.constructor=DynamicCylinderGeometryUpdater),DynamicCylinderGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(Property.getValueOrUndefined(e.position,i,positionScratch$7))||!defined(r.length)||!defined(r.topRadius)||!defined(r.bottomRadius)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicCylinderGeometryUpdater.prototype._setOptions=function(e,t,i){var r=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),n=this._options;n.length=Property.getValueOrUndefined(t.length,i),n.topRadius=Property.getValueOrUndefined(t.topRadius,i),n.bottomRadius=Property.getValueOrUndefined(t.bottomRadius,i),n.slices=Property.getValueOrUndefined(t.slices,i),n.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,i),n.offsetAttribute=r!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0};var ColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2,getColorBlend:function(e,t){return e===ColorBlendMode.HIGHLIGHT?0:e===ColorBlendMode.REPLACE?1:e===ColorBlendMode.MIX?CesiumMath.clamp(t,CesiumMath.EPSILON4,1):void 0}},ColorBlendMode$1=freezeObject$1(ColorBlendMode);function DataSourceClock(){this._definitionChanged=new Event,this._startTime=void 0,this._stopTime=void 0,this._currentTime=void 0,this._clockRange=void 0,this._clockStep=void 0,this._multiplier=void 0}defineProperties$1(DataSourceClock.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:createRawPropertyDescriptor("startTime"),stopTime:createRawPropertyDescriptor("stopTime"),currentTime:createRawPropertyDescriptor("currentTime"),clockRange:createRawPropertyDescriptor("clockRange"),clockStep:createRawPropertyDescriptor("clockStep"),multiplier:createRawPropertyDescriptor("multiplier")}),DataSourceClock.prototype.clone=function(e){return defined(e)||(e=new DataSourceClock),e.startTime=this.startTime,e.stopTime=this.stopTime,e.currentTime=this.currentTime,e.clockRange=this.clockRange,e.clockStep=this.clockStep,e.multiplier=this.multiplier,e},DataSourceClock.prototype.equals=function(e){return this===e||defined(e)&&JulianDate.equals(this.startTime,e.startTime)&&JulianDate.equals(this.stopTime,e.stopTime)&&JulianDate.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier},DataSourceClock.prototype.merge=function(e){this.startTime=defaultValue(this.startTime,e.startTime),this.stopTime=defaultValue(this.stopTime,e.stopTime),this.currentTime=defaultValue(this.currentTime,e.currentTime),this.clockRange=defaultValue(this.clockRange,e.clockRange),this.clockStep=defaultValue(this.clockStep,e.clockStep),this.multiplier=defaultValue(this.multiplier,e.multiplier)},DataSourceClock.prototype.getValue=function(e){return defined(e)||(e=new Clock),e.startTime=defaultValue(this.startTime,e.startTime),e.stopTime=defaultValue(this.stopTime,e.stopTime),e.currentTime=defaultValue(this.currentTime,e.currentTime),e.clockRange=defaultValue(this.clockRange,e.clockRange),e.multiplier=defaultValue(this.multiplier,e.multiplier),e.clockStep=defaultValue(this.clockStep,e.clockStep),e};var defaultColor$2=Color.WHITE,defaultCellAlpha=.1,defaultLineCount=new Cartesian2(8,8),defaultLineOffset=new Cartesian2(0,0),defaultLineThickness=new Cartesian2(1,1);function GridMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._cellAlpha=void 0,this._cellAlphaSubscription=void 0,this._lineCount=void 0,this._lineCountSubscription=void 0,this._lineThickness=void 0,this._lineThicknessSubscription=void 0,this._lineOffset=void 0,this._lineOffsetSubscription=void 0,this.color=e.color,this.cellAlpha=e.cellAlpha,this.lineCount=e.lineCount,this.lineThickness=e.lineThickness,this.lineOffset=e.lineOffset}function PolylineArrowMaterialProperty(e){this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this.color=e}defineProperties$1(GridMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._cellAlpha)&&Property.isConstant(this._lineCount)&&Property.isConstant(this._lineThickness)&&Property.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),cellAlpha:createPropertyDescriptor("cellAlpha"),lineCount:createPropertyDescriptor("lineCount"),lineThickness:createPropertyDescriptor("lineThickness"),lineOffset:createPropertyDescriptor("lineOffset")}),GridMaterialProperty.prototype.getType=function(e){return"Grid"},GridMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$2,t.color),t.cellAlpha=Property.getValueOrDefault(this._cellAlpha,e,defaultCellAlpha),t.lineCount=Property.getValueOrClonedDefault(this._lineCount,e,defaultLineCount,t.lineCount),t.lineThickness=Property.getValueOrClonedDefault(this._lineThickness,e,defaultLineThickness,t.lineThickness),t.lineOffset=Property.getValueOrClonedDefault(this._lineOffset,e,defaultLineOffset,t.lineOffset),t},GridMaterialProperty.prototype.equals=function(e){return this===e||e instanceof GridMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._cellAlpha,e._cellAlpha)&&Property.equals(this._lineCount,e._lineCount)&&Property.equals(this._lineThickness,e._lineThickness)&&Property.equals(this._lineOffset,e._lineOffset)},defineProperties$1(PolylineArrowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color")}),PolylineArrowMaterialProperty.prototype.getType=function(e){return"PolylineArrow"},PolylineArrowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,Color.WHITE,t.color),t},PolylineArrowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineArrowMaterialProperty&&Property.equals(this._color,e._color)};var defaultColor$3=Color.WHITE,defaultGapColor=Color.TRANSPARENT,defaultDashLength=16,defaultDashPattern=255;function PolylineDashMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._gapColor=void 0,this._gapColorSubscription=void 0,this._dashLength=void 0,this._dashLengthSubscription=void 0,this._dashPattern=void 0,this._dashPatternSubscription=void 0,this.color=e.color,this.gapColor=e.gapColor,this.dashLength=e.dashLength,this.dashPattern=e.dashPattern}defineProperties$1(PolylineDashMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._gapColor)&&Property.isConstant(this._dashLength)&&Property.isConstant(this._dashPattern)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),gapColor:createPropertyDescriptor("gapColor"),dashLength:createPropertyDescriptor("dashLength"),dashPattern:createPropertyDescriptor("dashPattern")}),PolylineDashMaterialProperty.prototype.getType=function(e){return"PolylineDash"},PolylineDashMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$3,t.color),t.gapColor=Property.getValueOrClonedDefault(this._gapColor,e,defaultGapColor,t.gapColor),t.dashLength=Property.getValueOrDefault(this._dashLength,e,defaultDashLength,t.dashLength),t.dashPattern=Property.getValueOrDefault(this._dashPattern,e,defaultDashPattern,t.dashPattern),t},PolylineDashMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineDashMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._gapColor,e._gapColor)&&Property.equals(this._dashLength,e._dashLength)&&Property.equals(this._dashPattern,e._dashPattern)};var defaultColor$4=Color.WHITE,defaultGlowPower=.25,defaultTaperPower=1;function PolylineGlowMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._color=void 0,this._colorSubscription=void 0,this._glowPower=void 0,this._glowPowerSubscription=void 0,this._taperPower=void 0,this._taperPowerSubscription=void 0,this.color=e.color,this.glowPower=e.glowPower,this.taperPower=e.taperPower}defineProperties$1(PolylineGlowMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),glowPower:createPropertyDescriptor("glowPower"),taperPower:createPropertyDescriptor("taperPower")}),PolylineGlowMaterialProperty.prototype.getType=function(e){return"PolylineGlow"},PolylineGlowMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$4,t.color),t.glowPower=Property.getValueOrDefault(this._glowPower,e,defaultGlowPower,t.glowPower),t.taperPower=Property.getValueOrDefault(this._taperPower,e,defaultTaperPower,t.taperPower),t},PolylineGlowMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineGlowMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._glowPower,e._glowPower)&&Property.equals(this._taperPower,e._taperPower)};var defaultColor$5=Color.WHITE,defaultOutlineColor$1=Color.BLACK,defaultOutlineWidth=1;function PolylineOutlineMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,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.color=e.color,this.outlineColor=e.outlineColor,this.outlineWidth=e.outlineWidth}function PositionPropertyArray(e,t){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this._referenceFrame=defaultValue(t,ReferenceFrame$1.FIXED),this.setValue(e)}function PropertyArray(e){this._value=void 0,this._definitionChanged=new Event,this._eventHelper=new EventHelper,this.setValue(e)}function resolveEntity(e){var t=!0;if(e._resolveEntity){var i=e._targetCollection.getById(e._targetId);if(defined(i)?(i.definitionChanged.addEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=i,e._resolveEntity=!1):(i=e._targetEntity,t=!1),!defined(i))throw new RuntimeError('target entity "'+e._targetId+'" could not be resolved.')}return t}function resolve$1(e){var t=e._targetProperty;if(e._resolveProperty){var i=resolveEntity(e),r=e._targetPropertyNames;t=e._targetEntity;for(var n=r.length,a=0;a<n&&defined(t);a++)t=t[r[a]];if(defined(t))e._targetProperty=t,e._resolveProperty=!i;else if(!defined(e._targetProperty))throw new RuntimeError('targetProperty "'+e._targetId+"."+r.join(".")+'" could not be resolved.')}return t}function ReferenceProperty(e,t,i){this._targetCollection=e,this._targetId=t,this._targetPropertyNames=i,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Event,this._resolveEntity=!0,this._resolveProperty=!0,e.collectionChanged.addEventListener(ReferenceProperty.prototype._onCollectionChanged,this)}defineProperties$1(PolylineOutlineMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._color)&&Property.isConstant(this._outlineColor)&&Property.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:createPropertyDescriptor("color"),outlineColor:createPropertyDescriptor("outlineColor"),outlineWidth:createPropertyDescriptor("outlineWidth")}),PolylineOutlineMaterialProperty.prototype.getType=function(e){return"PolylineOutline"},PolylineOutlineMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.color=Property.getValueOrClonedDefault(this._color,e,defaultColor$5,t.color),t.outlineColor=Property.getValueOrClonedDefault(this._outlineColor,e,defaultOutlineColor$1,t.outlineColor),t.outlineWidth=Property.getValueOrDefault(this._outlineWidth,e,defaultOutlineWidth),t},PolylineOutlineMaterialProperty.prototype.equals=function(e){return this===e||e instanceof PolylineOutlineMaterialProperty&&Property.equals(this._color,e._color)&&Property.equals(this._outlineColor,e._outlineColor)&&Property.equals(this._outlineWidth,e._outlineWidth)},defineProperties$1(PositionPropertyArray.prototype,{isConstant:{get:function(){var e=this._value;if(!defined(e))return!0;for(var t=e.length,i=0;i<t;i++)if(!Property.isConstant(e[i]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),PositionPropertyArray.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},PositionPropertyArray.prototype.getValueInReferenceFrame=function(e,t,i){var r=this._value;if(defined(r)){var n=r.length;defined(i)||(i=new Array(n));for(var a=0,o=0;a<n;){var s=r[a].getValueInReferenceFrame(e,t,i[a]);defined(s)&&(i[o]=s,o++),a++}return i.length=o,i}},PositionPropertyArray.prototype.setValue=function(e){var t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();for(var i=e.length,r=0;r<i;r++){var n=e[r];defined(n)&&t.add(n.definitionChanged,PositionPropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PositionPropertyArray.prototype.equals=function(e){return this===e||e instanceof PositionPropertyArray&&this._referenceFrame===e._referenceFrame&&Property.arrayEquals(this._value,e._value)},PositionPropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},defineProperties$1(PropertyArray.prototype,{isConstant:{get:function(){var e=this._value;if(!defined(e))return!0;for(var t=e.length,i=0;i<t;i++)if(!Property.isConstant(e[i]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),PropertyArray.prototype.getValue=function(e,t){var i=this._value;if(defined(i)){var r=i.length;defined(t)||(t=new Array(r));for(var n=0,a=0;n<r;){var o=this._value[n].getValue(e,t[n]);defined(o)&&(t[a]=o,a++),n++}return t.length=a,t}},PropertyArray.prototype.setValue=function(e){var t=this._eventHelper;if(t.removeAll(),defined(e)){this._value=e.slice();for(var i=e.length,r=0;r<i;r++){var n=e[r];defined(n)&&t.add(n.definitionChanged,PropertyArray.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)},PropertyArray.prototype.equals=function(e){return this===e||e instanceof PropertyArray&&Property.arrayEquals(this._value,e._value)},PropertyArray.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},defineProperties$1(ReferenceProperty.prototype,{isConstant:{get:function(){return Property.isConstant(resolve$1(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return resolve$1(this).referenceFrame}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return resolve$1(this)}}}),ReferenceProperty.fromString=function(e,t){for(var i,r=[],n=!0,a=!1,o="",s=0;s<t.length;++s){var l=t.charAt(s);a?(o+=l,a=!1):"\\"===l?a=!0:n&&"#"===l?(i=o,n=!1,o=""):n||"."!==l?o+=l:(r.push(o),o="")}return r.push(o),new ReferenceProperty(e,i,r)},ReferenceProperty.prototype.getValue=function(e,t){return resolve$1(this).getValue(e,t)},ReferenceProperty.prototype.getValueInReferenceFrame=function(e,t,i){return resolve$1(this).getValueInReferenceFrame(e,t,i)},ReferenceProperty.prototype.getType=function(e){return resolve$1(this).getType(e)},ReferenceProperty.prototype.equals=function(e){if(this===e)return!0;var t=this._targetPropertyNames,i=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==i.length)return!1;for(var r=this._targetPropertyNames.length,n=0;n<r;n++)if(t[n]!==i[n])return!1;return!0},ReferenceProperty.prototype._onTargetEntityDefinitionChanged=function(e,t,i,r){this._targetPropertyNames[0]===t&&(this._resolveProperty=!0,this._definitionChanged.raiseEvent(this))},ReferenceProperty.prototype._onCollectionChanged=function(e,t,i){var r=this._targetEntity;defined(r)&&(-1!==i.indexOf(r)?(r.definitionChanged.removeEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged,this),this._resolveEntity=!0,this._resolveProperty=!0):this._resolveEntity&&(resolve$1(this),this._resolveEntity||this._definitionChanged.raiseEvent(this)))};var Rotation={packedLength:1,pack:function(e,t,i){return t[i=defaultValue(i,0)]=e,t},unpack:function(e,t,i){return e[t=defaultValue(t,0)]},convertPackedArrayForInterpolation:function(e,t,i,r){var n;t=defaultValue(t,0);for(var a=0,o=(i=defaultValue(i,e.length))-t+1;a<o;a++){var s=e[t+a];0===a||Math.abs(n-s)<Math.PI?r[a]=s:r[a]=s-CesiumMath.TWO_PI,n=s}},unpackInterpolationResult:function(e,t,i,r,n){return(n=e[0])<0?n+CesiumMath.TWO_PI:n}},PackableNumber={packedLength:1,pack:function(e,t,i){t[i=defaultValue(i,0)]=e},unpack:function(e,t,i){return e[t=defaultValue(t,0)]}};function arrayInsert(e,t,i){var r,n=e.length,a=i.length,o=n+a;if(e.length=o,n!==t){var s=n-1;for(r=o-1;t<=r;r--)e[r]=e[s--]}for(r=0;r<a;r++)e[t++]=i[r]}function convertDate(e,t){return e instanceof JulianDate?e:"string"==typeof e?JulianDate.fromIso8601(e):JulianDate.addSeconds(t,e,new JulianDate)}var timesSpliceArgs=[],valuesSpliceArgs=[];function mergeNewSamples(e,t,i,r,n){for(var a,o,s,l,c,u,d=0;d<r.length;){var h=0,p=0;if((s=binarySearch(t,c=convertDate(r[d],e),JulianDate.compare))<0){for(l=(s=~s)*n,o=void 0,u=t[s];d<r.length&&(c=convertDate(r[d],e),!(defined(o)&&0<=JulianDate.compare(o,c)||defined(u)&&0<=JulianDate.compare(c,u)));){for(timesSpliceArgs[h++]=c,d+=1,a=0;a<n;a++)valuesSpliceArgs[p++]=r[d],d+=1;o=c}0<h&&(valuesSpliceArgs.length=p,arrayInsert(i,l,valuesSpliceArgs),timesSpliceArgs.length=h,arrayInsert(t,s,timesSpliceArgs))}else{for(a=0;a<n;a++)d++,i[s*n+a]=r[d];d++}}}function SampledProperty(e,t){var i=e;i===Number&&(i=PackableNumber);var r,n=i.packedLength,a=defaultValue(i.packedInterpolationLength,n),o=0;if(defined(t)){var s=t.length;r=new Array(s);for(var l=0;l<s;l++){var c=t[l];c===Number&&(c=PackableNumber);var u=c.packedLength;n+=u,a+=defaultValue(c.packedInterpolationLength,u),r[l]=c}o=s}this._type=e,this._innerType=i,this._interpolationDegree=1,this._interpolationAlgorithm=LinearApproximation,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=n,this._packedInterpolationLength=a,this._updateTableLength=!0,this._interpolationResult=new Array(a),this._definitionChanged=new Event,this._derivativeTypes=t,this._innerDerivativeTypes=r,this._inputOrder=o,this._forwardExtrapolationType=ExtrapolationType$1.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=ExtrapolationType$1.NONE,this._backwardExtrapolationDuration=0}function removeSamples(e,t,i){var r=e._packedLength;e._times.splice(t,i),e._values.splice(t*r,i*r),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}function SampledPositionProperty(e,t){var i;if(0<(t=defaultValue(t,0))){i=new Array(t);for(var r=0;r<t;r++)i[r]=Cartesian3}this._numberOfDerivatives=t,this._property=new SampledProperty(Cartesian3,i),this._definitionChanged=new Event,this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}defineProperties$1(SampledProperty.prototype,{isConstant:{get:function(){return 0===this._values.length}},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))}}}),SampledProperty.prototype.getValue=function(e,t){var i=this._times,r=i.length;if(0!==r){var n,a=this._innerType,o=this._values,s=binarySearch(i,e,JulianDate.compare);if(s<0){if(0===(s=~s)){var l=i[s];if(n=this._backwardExtrapolationDuration,this._backwardExtrapolationType===ExtrapolationType$1.NONE||0!==n&&JulianDate.secondsDifference(l,e)>n)return;if(this._backwardExtrapolationType===ExtrapolationType$1.HOLD)return a.unpack(o,0,t)}if(r<=s){var c=i[s=r-1];if(n=this._forwardExtrapolationDuration,this._forwardExtrapolationType===ExtrapolationType$1.NONE||0!==n&&JulianDate.secondsDifference(e,c)>n)return;if(this._forwardExtrapolationType===ExtrapolationType$1.HOLD)return s=r-1,a.unpack(o,s*a.packedLength,t)}var u=this._xTable,d=this._yTable,h=this._interpolationAlgorithm,p=this._packedInterpolationLength,m=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;var f=Math.min(h.getRequiredDataPoints(this._interpolationDegree,m),r);f!==this._numberOfPoints&&(this._numberOfPoints=f,u.length=f,d.length=f*p)}var g=this._numberOfPoints-1;if(g<1)return;var _=0,y=r-1;if(1+g<=y-_+1){var v=s-(g/2|0)-1;v<_&&(v=_);var C=v+g;y<C&&(v=(C=y)-g)<_&&(v=_),_=v,y=C}for(var S=y-_+1,x=0;x<S;++x)u[x]=JulianDate.secondsDifference(i[_+x],i[y]);if(defined(a.convertPackedArrayForInterpolation))a.convertPackedArrayForInterpolation(o,_,y,d);else for(var T=0,b=this._packedLength,E=_*b,P=(y+1)*b;E<P;)d[T]=o[E],E++,T++;var A,w=JulianDate.secondsDifference(e,i[y]);if(0!==m&&defined(h.interpolate)){var D=Math.floor(p/(m+1));A=h.interpolate(w,u,d,D,m,m,this._interpolationResult)}else A=h.interpolateOrderZero(w,u,d,p,this._interpolationResult);return defined(a.unpackInterpolationResult)?a.unpackInterpolationResult(A,o,_,y,t):a.unpack(A,0,t)}return a.unpack(o,s*this._packedLength,t)}},SampledProperty.prototype.setInterpolationOptions=function(e){if(defined(e)){var t=!1,i=e.interpolationAlgorithm,r=e.interpolationDegree;defined(i)&&this._interpolationAlgorithm!==i&&(this._interpolationAlgorithm=i,t=!0),defined(r)&&this._interpolationDegree!==r&&(this._interpolationDegree=r,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))}},SampledProperty.prototype.addSample=function(e,t,i){var r=this._innerDerivativeTypes,n=defined(r),a=this._innerType,o=[];if(o.push(e),a.pack(t,o,o.length),n)for(var s=r.length,l=0;l<s;l++)r[l].pack(i[l],o,o.length);mergeNewSamples(void 0,this._times,this._values,o,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamples=function(e,t,i){for(var r=this._innerDerivativeTypes,n=defined(r),a=this._innerType,o=e.length,s=[],l=0;l<o;l++)if(s.push(e[l]),a.pack(t[l],s,s.length),n)for(var c=i[l],u=r.length,d=0;d<u;d++)r[d].pack(c[d],s,s.length);mergeNewSamples(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.addSamplesPackedArray=function(e,t){mergeNewSamples(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},SampledProperty.prototype.removeSample=function(e){var t=binarySearch(this._times,e,JulianDate.compare);return!(t<0)&&(removeSamples(this,t,1),!0)},SampledProperty.prototype.removeSamples=function(e){var t=this._times,i=binarySearch(t,e.start,JulianDate.compare);i<0?i=~i:e.isStartIncluded||++i;var r=binarySearch(t,e.stop,JulianDate.compare);r<0?r=~r:e.isStopIncluded&&++r,removeSamples(this,i,r-i)},SampledProperty.prototype.equals=function(e){if(this===e)return!0;if(!defined(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;var t,i,r=this._derivativeTypes,n=defined(r),a=e._derivativeTypes;if(n!==defined(a))return!1;if(n){if((i=r.length)!==a.length)return!1;for(t=0;t<i;t++)if(r[t]!==a[t])return!1}var o=this._times,s=e._times;if((i=o.length)!==s.length)return!1;for(t=0;t<i;t++)if(!JulianDate.equals(o[t],s[t]))return!1;var l=this._values,c=e._values;for(t=0;t<i;t++)if(l[t]!==c[t])return!1;return!0},SampledProperty._mergeNewSamples=mergeNewSamples,defineProperties$1(SampledPositionProperty.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}}}),SampledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},SampledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){if(defined(i=this._property.getValue(e,i)))return PositionProperty.convertToReferenceFrame(e,i,this._referenceFrame,t,i)},SampledPositionProperty.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},SampledPositionProperty.prototype.addSample=function(e,t,i){this._numberOfDerivatives;this._property.addSample(e,t,i)},SampledPositionProperty.prototype.addSamples=function(e,t,i){this._property.addSamples(e,t,i)},SampledPositionProperty.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},SampledPositionProperty.prototype.removeSample=function(e){this._property.removeSample(e)},SampledPositionProperty.prototype.removeSamples=function(e){this._property.removeSamples(e)},SampledPositionProperty.prototype.equals=function(e){return this===e||e instanceof SampledPositionProperty&&Property.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};var StripeOrientation={HORIZONTAL:0,VERTICAL:1},StripeOrientation$1=freezeObject$1(StripeOrientation),defaultOrientation=StripeOrientation$1.HORIZONTAL,defaultEvenColor$1=Color.WHITE,defaultOddColor$1=Color.BLACK,defaultOffset$3=0,defaultRepeat$2=1;function StripeMaterialProperty(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._definitionChanged=new Event,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat}function TimeIntervalCollectionPositionProperty(e){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionPositionProperty.prototype._intervalsChanged,this),this._referenceFrame=defaultValue(e,ReferenceFrame$1.FIXED)}function TimeIntervalCollectionProperty(){this._definitionChanged=new Event,this._intervals=new TimeIntervalCollection,this._intervals.changedEvent.addEventListener(TimeIntervalCollectionProperty.prototype._intervalsChanged,this)}function VelocityVectorProperty(e,t){this._position=void 0,this._subscription=void 0,this._definitionChanged=new Event,this._normalize=defaultValue(t,!0),this.position=e}defineProperties$1(StripeMaterialProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._orientation)&&Property.isConstant(this._evenColor)&&Property.isConstant(this._oddColor)&&Property.isConstant(this._offset)&&Property.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:createPropertyDescriptor("orientation"),evenColor:createPropertyDescriptor("evenColor"),oddColor:createPropertyDescriptor("oddColor"),offset:createPropertyDescriptor("offset"),repeat:createPropertyDescriptor("repeat")}),StripeMaterialProperty.prototype.getType=function(e){return"Stripe"},StripeMaterialProperty.prototype.getValue=function(e,t){return defined(t)||(t={}),t.horizontal=Property.getValueOrDefault(this._orientation,e,defaultOrientation)===StripeOrientation$1.HORIZONTAL,t.evenColor=Property.getValueOrClonedDefault(this._evenColor,e,defaultEvenColor$1,t.evenColor),t.oddColor=Property.getValueOrClonedDefault(this._oddColor,e,defaultOddColor$1,t.oddColor),t.offset=Property.getValueOrDefault(this._offset,e,defaultOffset$3),t.repeat=Property.getValueOrDefault(this._repeat,e,defaultRepeat$2),t},StripeMaterialProperty.prototype.equals=function(e){return this===e||e instanceof StripeMaterialProperty&&Property.equals(this._orientation,e._orientation)&&Property.equals(this._evenColor,e._evenColor)&&Property.equals(this._oddColor,e._oddColor)&&Property.equals(this._offset,e._offset)&&Property.equals(this._repeat,e._repeat)},defineProperties$1(TimeIntervalCollectionPositionProperty.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}}}),TimeIntervalCollectionPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){var r=this._intervals.findDataForIntervalContainingDate(e);if(defined(r))return PositionProperty.convertToReferenceFrame(e,r,this._referenceFrame,t,i)},TimeIntervalCollectionPositionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionPositionProperty&&this._intervals.equals(e._intervals,Property.equals)&&this._referenceFrame===e._referenceFrame},TimeIntervalCollectionPositionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},defineProperties$1(TimeIntervalCollectionProperty.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),TimeIntervalCollectionProperty.prototype.getValue=function(e,t){var i=this._intervals.findDataForIntervalContainingDate(e);return defined(i)&&"function"==typeof i.clone?i.clone(t):i},TimeIntervalCollectionProperty.prototype.equals=function(e){return this===e||e instanceof TimeIntervalCollectionProperty&&this._intervals.equals(e._intervals,Property.equals)},TimeIntervalCollectionProperty.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},defineProperties$1(VelocityVectorProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){var t=this._position;t!==e&&(defined(t)&&this._subscription(),defined(this._position=e)&&(this._subscription=e._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)),this._definitionChanged.raiseEvent(this))}},normalize:{get:function(){return this._normalize},set:function(e){this._normalize!==e&&(this._normalize=e,this._definitionChanged.raiseEvent(this))}}});var position1Scratch=new Cartesian3,position2Scratch=new Cartesian3,timeScratch=new JulianDate,step=1/60;function VelocityOrientationProperty(e,t){this._velocityVectorProperty=new VelocityVectorProperty(e,!0),this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new Event,this.ellipsoid=defaultValue(t,Ellipsoid.WGS84);var i=this;this._velocityVectorProperty.definitionChanged.addEventListener(function(){i._definitionChanged.raiseEvent(i)})}VelocityVectorProperty.prototype.getValue=function(e,t){return this._getValue(e,t)},VelocityVectorProperty.prototype._getValue=function(e,t,i){defined(t)||(t=new Cartesian3);var r=this._position;if(Property.isConstant(r))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);var n=r.getValue(e,position1Scratch),a=r.getValue(JulianDate.addSeconds(e,step,timeScratch),position2Scratch);if(defined(n)&&(defined(a)||(a=n,defined(n=r.getValue(JulianDate.addSeconds(e,-step,timeScratch),position2Scratch))))){if(Cartesian3.equals(n,a))return this._normalize?void 0:Cartesian3.clone(Cartesian3.ZERO,t);defined(i)&&n.clone(i);var o=Cartesian3.subtract(a,n,t);return this._normalize?Cartesian3.normalize(o,t):Cartesian3.divideByScalar(o,step,t)}},VelocityVectorProperty.prototype.equals=function(e){return this===e||e instanceof VelocityVectorProperty&&Property.equals(this._position,e._position)},defineProperties$1(VelocityOrientationProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._velocityVectorProperty)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._velocityVectorProperty.position},set:function(e){this._velocityVectorProperty.position=e}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){this._ellipsoid!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});var positionScratch$8=new Cartesian3,velocityScratch=new Cartesian3,rotationScratch=new Matrix3,currentId;function UnitCartesian3(){}function createReferenceProperty(e,t){return"#"===t[0]&&(t=currentId+t),ReferenceProperty.fromString(e,t)}function createSpecializedProperty(e,t,i){if(defined(i.reference))return createReferenceProperty(t,i.reference);if(defined(i.velocityReference)){var r=createReferenceProperty(t,i.velocityReference);switch(e){case Cartesian3:case UnitCartesian3:return new VelocityVectorProperty(r,e===UnitCartesian3);case Quaternion:return new VelocityOrientationProperty(r)}}throw new RuntimeError(JSON.stringify(i)+" is not valid CZML.")}function createAdapterProperty(i,r){return new CallbackProperty(function(e,t){return r(i.getValue(e,t))},i.isConstant)}VelocityOrientationProperty.prototype.getValue=function(e,t){var i=this._velocityVectorProperty._getValue(e,velocityScratch,positionScratch$8);if(defined(i))return Transforms.rotationMatrixFromPositionVelocity(positionScratch$8,i,this._ellipsoid,rotationScratch),Quaternion.fromRotationMatrix(rotationScratch,t)},VelocityOrientationProperty.prototype.equals=function(e){return this===e||e instanceof VelocityOrientationProperty&&Property.equals(this._velocityVectorProperty,e._velocityVectorProperty)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))},UnitCartesian3.packedLength=Cartesian3.packedLength,UnitCartesian3.unpack=Cartesian3.unpack,UnitCartesian3.pack=Cartesian3.pack;var scratchCartesian$2=new Cartesian3,scratchSpherical=new Spherical,scratchCartographic$4=new Cartographic,scratchTimeInterval=new TimeInterval,scratchQuaternion=new Quaternion;function unwrapColorInterval(e){var t=e.rgbaf;if(defined(t))return t;var i=e.rgba;if(defined(i)){var r=i.length;if(r===Color.packedLength)return[Color.byteToFloat(i[0]),Color.byteToFloat(i[1]),Color.byteToFloat(i[2]),Color.byteToFloat(i[3])];t=new Array(r);for(var n=0;n<r;n+=5)t[n]=i[n],t[n+1]=Color.byteToFloat(i[n+1]),t[n+2]=Color.byteToFloat(i[n+2]),t[n+3]=Color.byteToFloat(i[n+3]),t[n+4]=Color.byteToFloat(i[n+4]);return t}}function unwrapUriInterval(e,t){var i=defaultValue(e.uri,e);return defined(t)?t.getDerivedResource({url:i}):Resource.createIfNeeded(i)}function unwrapRectangleInterval(e){var t=e.wsen;if(defined(t))return t;var i=e.wsenDegrees;if(defined(i)){var r=i.length;if(r===Rectangle.packedLength)return[CesiumMath.toRadians(i[0]),CesiumMath.toRadians(i[1]),CesiumMath.toRadians(i[2]),CesiumMath.toRadians(i[3])];t=new Array(r);for(var n=0;n<r;n+=5)t[n]=i[n],t[n+1]=CesiumMath.toRadians(i[n+1]),t[n+2]=CesiumMath.toRadians(i[n+2]),t[n+3]=CesiumMath.toRadians(i[n+3]),t[n+4]=CesiumMath.toRadians(i[n+4]);return t}}function convertUnitSphericalToCartesian(e){var t=e.length;if(scratchSpherical.magnitude=1,2===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$2),[scratchCartesian$2.x,scratchCartesian$2.y,scratchCartesian$2.z];for(var i=new Array(t/3*4),r=0,n=0;r<t;r+=3,n+=4)i[n]=e[r],scratchSpherical.clock=e[r+1],scratchSpherical.cone=e[r+2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$2),i[n+1]=scratchCartesian$2.x,i[n+2]=scratchCartesian$2.y,i[n+3]=scratchCartesian$2.z;return i}function convertSphericalToCartesian(e){var t=e.length;if(3===t)return scratchSpherical.clock=e[0],scratchSpherical.cone=e[1],scratchSpherical.magnitude=e[2],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$2),[scratchCartesian$2.x,scratchCartesian$2.y,scratchCartesian$2.z];for(var i=new Array(t),r=0;r<t;r+=4)i[r]=e[r],scratchSpherical.clock=e[r+1],scratchSpherical.cone=e[r+2],scratchSpherical.magnitude=e[r+3],Cartesian3.fromSpherical(scratchSpherical,scratchCartesian$2),i[r+1]=scratchCartesian$2.x,i[r+2]=scratchCartesian$2.y,i[r+3]=scratchCartesian$2.z;return i}function convertCartographicRadiansToCartesian(e){var t=e.length;if(3===t)return scratchCartographic$4.longitude=e[0],scratchCartographic$4.latitude=e[1],scratchCartographic$4.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$4,scratchCartesian$2),[scratchCartesian$2.x,scratchCartesian$2.y,scratchCartesian$2.z];for(var i=new Array(t),r=0;r<t;r+=4)i[r]=e[r],scratchCartographic$4.longitude=e[r+1],scratchCartographic$4.latitude=e[r+2],scratchCartographic$4.height=e[r+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$4,scratchCartesian$2),i[r+1]=scratchCartesian$2.x,i[r+2]=scratchCartesian$2.y,i[r+3]=scratchCartesian$2.z;return i}function convertCartographicDegreesToCartesian(e){var t=e.length;if(3===t)return scratchCartographic$4.longitude=CesiumMath.toRadians(e[0]),scratchCartographic$4.latitude=CesiumMath.toRadians(e[1]),scratchCartographic$4.height=e[2],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$4,scratchCartesian$2),[scratchCartesian$2.x,scratchCartesian$2.y,scratchCartesian$2.z];for(var i=new Array(t),r=0;r<t;r+=4)i[r]=e[r],scratchCartographic$4.longitude=CesiumMath.toRadians(e[r+1]),scratchCartographic$4.latitude=CesiumMath.toRadians(e[r+2]),scratchCartographic$4.height=e[r+3],Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic$4,scratchCartesian$2),i[r+1]=scratchCartesian$2.x,i[r+2]=scratchCartesian$2.y,i[r+3]=scratchCartesian$2.z;return i}function unwrapCartesianInterval(e){var t=e.cartesian;if(defined(t))return t;var i=e.cartesianVelocity;if(defined(i))return i;var r=e.unitCartesian;if(defined(r))return r;var n=e.unitSpherical;if(defined(n))return convertUnitSphericalToCartesian(n);var a=e.spherical;if(defined(a))return convertSphericalToCartesian(a);var o=e.cartographicRadians;if(defined(o))return convertCartographicRadiansToCartesian(o);var s=e.cartographicDegrees;if(defined(s))return convertCartographicDegreesToCartesian(s);throw new RuntimeError(JSON.stringify(e)+" is not a valid CZML interval.")}function normalizePackedCartesianArray(e,t){Cartesian3.unpack(e,t,scratchCartesian$2),Cartesian3.normalize(scratchCartesian$2,scratchCartesian$2),Cartesian3.pack(scratchCartesian$2,e,t)}function unwrapUnitCartesianInterval(e){var t=unwrapCartesianInterval(e);if(3===t.length)return normalizePackedCartesianArray(t,0),t;for(var i=1;i<t.length;i+=4)normalizePackedCartesianArray(t,i);return t}function normalizePackedQuaternionArray(e,t){Quaternion.unpack(e,t,scratchQuaternion),Quaternion.normalize(scratchQuaternion,scratchQuaternion),Quaternion.pack(scratchQuaternion,e,t)}function unwrapQuaternionInterval(e){var t=e.unitQuaternion;if(defined(t)){if(4===t.length)return normalizePackedQuaternionArray(t,0),t;for(var i=1;i<t.length;i+=5)normalizePackedQuaternionArray(t,i)}return t}function getPropertyType(e){return"boolean"==typeof e?Boolean:"number"==typeof e?Number:"string"==typeof e?String:e.hasOwnProperty("array")?Array:e.hasOwnProperty("boolean")?Boolean:e.hasOwnProperty("boundingRectangle")?BoundingRectangle:e.hasOwnProperty("cartesian2")?Cartesian2:e.hasOwnProperty("cartesian")||e.hasOwnProperty("spherical")||e.hasOwnProperty("cartographicRadians")||e.hasOwnProperty("cartographicDegrees")?Cartesian3:e.hasOwnProperty("unitCartesian")||e.hasOwnProperty("unitSpherical")?UnitCartesian3:e.hasOwnProperty("rgba")||e.hasOwnProperty("rgbaf")?Color:e.hasOwnProperty("arcType")?ArcType$1:e.hasOwnProperty("classificationType")?ClassificationType$1:e.hasOwnProperty("colorBlendMode")?ColorBlendMode$1:e.hasOwnProperty("cornerType")?CornerType$1:e.hasOwnProperty("heightReference")?HeightReference$1:e.hasOwnProperty("horizontalOrigin")?HorizontalOrigin$1:e.hasOwnProperty("date")?JulianDate:e.hasOwnProperty("labelStyle")?LabelStyle$1:e.hasOwnProperty("number")?Number:e.hasOwnProperty("nearFarScalar")?NearFarScalar:e.hasOwnProperty("distanceDisplayCondition")?DistanceDisplayCondition:e.hasOwnProperty("object")||e.hasOwnProperty("value")?Object:e.hasOwnProperty("unitQuaternion")?Quaternion:e.hasOwnProperty("shadowMode")?ShadowMode$1:e.hasOwnProperty("string")?String:e.hasOwnProperty("stripeOrientation")?StripeOrientation$1:e.hasOwnProperty("wsen")||e.hasOwnProperty("wsenDegrees")?Rectangle:e.hasOwnProperty("uri")?URI:e.hasOwnProperty("verticalOrigin")?VerticalOrigin$1:Object}function unwrapInterval(e,t,i){switch(e){case ArcType$1:return ArcType$1[defaultValue(t.arcType,t)];case Array:return t.array;case Boolean:return defaultValue(t.boolean,t);case BoundingRectangle:return t.boundingRectangle;case Cartesian2:return t.cartesian2;case Cartesian3:return unwrapCartesianInterval(t);case UnitCartesian3:return unwrapUnitCartesianInterval(t);case Color:return unwrapColorInterval(t);case ClassificationType$1:return ClassificationType$1[defaultValue(t.classificationType,t)];case ColorBlendMode$1:return ColorBlendMode$1[defaultValue(t.colorBlendMode,t)];case CornerType$1:return CornerType$1[defaultValue(t.cornerType,t)];case HeightReference$1:return HeightReference$1[defaultValue(t.heightReference,t)];case HorizontalOrigin$1:return HorizontalOrigin$1[defaultValue(t.horizontalOrigin,t)];case Image:return unwrapUriInterval(t,i);case JulianDate:return JulianDate.fromIso8601(defaultValue(t.date,t));case LabelStyle$1:return LabelStyle$1[defaultValue(t.labelStyle,t)];case Number:return defaultValue(t.number,t);case NearFarScalar:return t.nearFarScalar;case DistanceDisplayCondition:return t.distanceDisplayCondition;case Object:return defaultValue(defaultValue(t.object,t.value),t);case Quaternion:return unwrapQuaternionInterval(t);case Rotation:return defaultValue(t.number,t);case ShadowMode$1:return ShadowMode$1[defaultValue(defaultValue(t.shadowMode,t.shadows),t)];case String:return defaultValue(t.string,t);case StripeOrientation$1:return StripeOrientation$1[defaultValue(t.stripeOrientation,t)];case Rectangle:return unwrapRectangleInterval(t);case URI:return unwrapUriInterval(t,i);case VerticalOrigin$1:return VerticalOrigin$1[defaultValue(t.verticalOrigin,t)];default:throw new RuntimeError(e)}}var interpolators={HERMITE:HermitePolynomialApproximation,LAGRANGE:LagrangePolynomialApproximation,LINEAR:LinearApproximation};function updateInterpolationSettings(e,t){var i=e.interpolationAlgorithm,r=e.interpolationDegree;(defined(i)||defined(r))&&t.setInterpolationOptions({interpolationAlgorithm:interpolators[i],interpolationDegree:r});var n=e.forwardExtrapolationType;defined(n)&&(t.forwardExtrapolationType=ExtrapolationType$1[n]);var a=e.forwardExtrapolationDuration;defined(a)&&(t.forwardExtrapolationDuration=a);var o=e.backwardExtrapolationType;defined(o)&&(t.backwardExtrapolationType=ExtrapolationType$1[o]);var s=e.backwardExtrapolationDuration;defined(s)&&(t.backwardExtrapolationDuration=s)}var iso8601Scratch={iso8601:void 0};function intervalFromString(e){if(defined(e))return iso8601Scratch.iso8601=e,TimeInterval.fromIso8601(iso8601Scratch)}function wrapPropertyInInfiniteInterval(e){var t=Iso8601.MAXIMUM_INTERVAL.clone();return t.data=e,t}function convertPropertyToComposite(e){var t=new CompositeProperty;return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function convertPositionPropertyToComposite(e){var t=new CompositePositionProperty(e.referenceFrame);return t.intervals.addInterval(wrapPropertyInInfiniteInterval(e)),t}function processProperty(e,t,i,r,n,a,o){var s,l,c,u=intervalFromString(r.interval);defined(n)&&(u=defined(u)?TimeInterval.intersect(u,n,scratchTimeInterval):n);var d=!defined(r.reference)&&!defined(r.velocityReference),h=defined(u)&&!u.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===r.delete)return h?removePropertyData(t[i],u):void(t[i]=void 0);var p=!1;if(d){if(!defined(l=unwrapInterval(e,r,a)))return;s=defaultValue(e.packedLength,1),c=defaultValue(l.length,1),p=!defined(r.array)&&"string"!=typeof l&&s<c&&e!==Object}var m="function"==typeof e.unpack&&e!==Rotation;if(p||h){var f,g,_=t[i],y=r.epoch;if(defined(y)&&(f=JulianDate.fromIso8601(y)),p&&!h)return _ instanceof SampledProperty||(t[i]=_=new SampledProperty(e)),_.addSamplesPackedArray(l,f),void updateInterpolationSettings(r,_);if(!p&&h)return(u=u.clone()).data=d?m?e.unpack(l,0):l:createSpecializedProperty(e,o,r),defined(_)||(t[i]=_=d?new TimeIntervalCollectionProperty:new CompositeProperty),d&&_ instanceof TimeIntervalCollectionProperty||(_ instanceof CompositeProperty||(t[i]=_=convertPropertyToComposite(_)),d&&(u.data=new ConstantProperty(u.data))),void _.intervals.addInterval(u);defined(_)||(t[i]=_=new CompositeProperty),_ instanceof CompositeProperty||(t[i]=_=convertPropertyToComposite(_));var v=_.intervals;defined(g=v.findInterval(u))&&g.data instanceof SampledProperty||((g=u.clone()).data=new SampledProperty(e),v.addInterval(g)),g.data.addSamplesPackedArray(l,f),updateInterpolationSettings(r,g.data)}else t[i]=d?new ConstantProperty(m?e.unpack(l,0):l):createSpecializedProperty(e,o,r)}function removePropertyData(e,t){if(e instanceof SampledProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositeProperty){for(var i=e.intervals,r=0;r<i.length;++r){var n=TimeInterval.intersect(i.get(r),t,scratchTimeInterval);n.isEmpty||removePropertyData(n.data,t)}i.removeInterval(t)}else;}function processPacketData(e,t,i,r,n,a,o){if(defined(r))if(isArray$1(r))for(var s=0,l=r.length;s<l;++s)processProperty(e,t,i,r[s],n,a,o);else processProperty(e,t,i,r,n,a,o)}function processPositionProperty(e,t,i,r,n,a){var o=intervalFromString(i.interval);defined(r)&&(o=defined(o)?TimeInterval.intersect(o,r,scratchTimeInterval):r);var s,l,c=defined(i.cartesianVelocity)?1:0,u=Cartesian3.packedLength*(1+c),d=!defined(i.reference),h=defined(o)&&!o.equals(Iso8601.MAXIMUM_INTERVAL);if(!0===i.delete)return h?removePositionPropertyData(e[t],o):void(e[t]=void 0);var p=!1;if(d&&(defined(i.referenceFrame)&&(l=ReferenceFrame$1[i.referenceFrame]),l=defaultValue(l,ReferenceFrame$1.FIXED),p=u<defaultValue((s=unwrapCartesianInterval(i)).length,1)),p||h){var m,f,g=e[t],_=i.epoch;if(defined(_)&&(m=JulianDate.fromIso8601(_)),p&&!h)return g instanceof SampledPositionProperty&&(!defined(l)||g.referenceFrame===l)||(e[t]=g=new SampledPositionProperty(l,c)),g.addSamplesPackedArray(s,m),void updateInterpolationSettings(i,g);if(!p&&h)return(o=o.clone()).data=d?Cartesian3.unpack(s):createReferenceProperty(a,i.reference),defined(g)||(g=d?new TimeIntervalCollectionPositionProperty(l):new CompositePositionProperty(l),e[t]=g),d&&g instanceof TimeIntervalCollectionPositionProperty&&defined(l)&&g.referenceFrame===l||(g instanceof CompositePositionProperty||(e[t]=g=convertPositionPropertyToComposite(g)),d&&(o.data=new ConstantPositionProperty(o.data,l))),void g.intervals.addInterval(o);defined(g)?g instanceof CompositePositionProperty||(e[t]=g=convertPositionPropertyToComposite(g)):e[t]=g=new CompositePositionProperty(l);var y=g.intervals;defined(f=y.findInterval(o))&&f.data instanceof SampledPositionProperty&&(!defined(l)||f.data.referenceFrame===l)||((f=o.clone()).data=new SampledPositionProperty(l,c),y.addInterval(f)),f.data.addSamplesPackedArray(s,m),updateInterpolationSettings(i,f.data)}else e[t]=d?new ConstantPositionProperty(Cartesian3.unpack(s),l):createReferenceProperty(a,i.reference)}function removePositionPropertyData(e,t){if(e instanceof SampledPositionProperty)e.removeSamples(t);else if(e instanceof TimeIntervalCollectionPositionProperty)e.intervals.removeInterval(t);else if(e instanceof CompositePositionProperty){for(var i=e.intervals,r=0;r<i.length;++r){var n=TimeInterval.intersect(i.get(r),t,scratchTimeInterval);n.isEmpty||removePositionPropertyData(n.data,t)}i.removeInterval(t)}else;}function processPositionPacketData(e,t,i,r,n,a){if(defined(i))if(isArray$1(i))for(var o=0,s=i.length;o<s;++o)processPositionProperty(e,t,i[o],r,n,a);else processPositionProperty(e,t,i,r,n,a)}function processMaterialProperty(e,t,i,r,n,a){var o=intervalFromString(i.interval);defined(r)&&(o=defined(o)?TimeInterval.intersect(o,r,scratchTimeInterval):r);var s,l,c,u=e[t];if(defined(o)){u instanceof CompositeMaterialProperty||(u=new CompositeMaterialProperty,e[t]=u);var d=u.intervals;defined(l=d.findInterval({start:o.start,stop:o.stop}))?s=l.data:(l=o.clone(),d.addInterval(l))}else s=u;defined(i.solidColor)?(s instanceof ColorMaterialProperty||(s=new ColorMaterialProperty),processPacketData(Color,s,"color",(c=i.solidColor).color,void 0,void 0,a)):defined(i.grid)?(s instanceof GridMaterialProperty||(s=new GridMaterialProperty),processPacketData(Color,s,"color",(c=i.grid).color,void 0,n,a),processPacketData(Number,s,"cellAlpha",c.cellAlpha,void 0,n,a),processPacketData(Cartesian2,s,"lineCount",c.lineCount,void 0,n,a),processPacketData(Cartesian2,s,"lineThickness",c.lineThickness,void 0,n,a),processPacketData(Cartesian2,s,"lineOffset",c.lineOffset,void 0,n,a)):defined(i.image)?(s instanceof ImageMaterialProperty||(s=new ImageMaterialProperty),c=i.image,processPacketData(Image,s,"image",c.image,void 0,n,a),processPacketData(Cartesian2,s,"repeat",c.repeat,void 0,n,a),processPacketData(Color,s,"color",c.color,void 0,n,a),processPacketData(Boolean,s,"transparent",c.transparent,void 0,n,a)):defined(i.stripe)?(s instanceof StripeMaterialProperty||(s=new StripeMaterialProperty),c=i.stripe,processPacketData(StripeOrientation$1,s,"orientation",c.orientation,void 0,n,a),processPacketData(Color,s,"evenColor",c.evenColor,void 0,n,a),processPacketData(Color,s,"oddColor",c.oddColor,void 0,n,a),processPacketData(Number,s,"offset",c.offset,void 0,n,a),processPacketData(Number,s,"repeat",c.repeat,void 0,n,a)):defined(i.polylineOutline)?(s instanceof PolylineOutlineMaterialProperty||(s=new PolylineOutlineMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineOutline).color,void 0,n,a),processPacketData(Color,s,"outlineColor",c.outlineColor,void 0,n,a),processPacketData(Number,s,"outlineWidth",c.outlineWidth,void 0,n,a)):defined(i.polylineGlow)?(s instanceof PolylineGlowMaterialProperty||(s=new PolylineGlowMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineGlow).color,void 0,n,a),processPacketData(Number,s,"glowPower",c.glowPower,void 0,n,a),processPacketData(Number,s,"taperPower",c.taperPower,void 0,n,a)):defined(i.polylineArrow)?(s instanceof PolylineArrowMaterialProperty||(s=new PolylineArrowMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineArrow).color,void 0,void 0,a)):defined(i.polylineDash)?(s instanceof PolylineDashMaterialProperty||(s=new PolylineDashMaterialProperty),processPacketData(Color,s,"color",(c=i.polylineDash).color,void 0,void 0,a),processPacketData(Color,s,"gapColor",c.gapColor,void 0,void 0,a),processPacketData(Number,s,"dashLength",c.dashLength,void 0,n,a),processPacketData(Number,s,"dashPattern",c.dashPattern,void 0,n,a)):defined(i.checkerboard)&&(s instanceof CheckerboardMaterialProperty||(s=new CheckerboardMaterialProperty),processPacketData(Color,s,"evenColor",(c=i.checkerboard).evenColor,void 0,n,a),processPacketData(Color,s,"oddColor",c.oddColor,void 0,n,a),processPacketData(Cartesian2,s,"repeat",c.repeat,void 0,n,a)),defined(l)?l.data=s:e[t]=s}function processMaterialPacketData(e,t,i,r,n,a){if(defined(i))if(isArray$1(i))for(var o=0,s=i.length;o<s;++o)processMaterialProperty(e,t,i[o],r,n,a);else processMaterialProperty(e,t,i,r,n,a)}function processName(e,t,i,r){defined(t.name)&&(e.name=t.name)}function processDescription(e,t,i,r){var n=t.description;defined(n)&&processPacketData(String,e,"description",n,void 0,r,i)}function processPosition(e,t,i,r){var n=t.position;defined(n)&&processPositionPacketData(e,"position",n,void 0,r,i)}function processViewFrom(e,t,i,r){var n=t.viewFrom;defined(n)&&processPacketData(Cartesian3,e,"viewFrom",n,void 0,r,i)}function processOrientation(e,t,i,r){var n=t.orientation;defined(n)&&processPacketData(Quaternion,e,"orientation",n,void 0,r,i)}function processProperties(e,t,i,r){var n=t.properties;if(defined(n))for(var a in defined(e.properties)||(e.properties=new PropertyBag),n)if(n.hasOwnProperty(a)){e.properties.hasProperty(a)||e.properties.addProperty(a);var o=n[a];if(isArray$1(o))for(var s=0,l=o.length;s<l;++s)processProperty(getPropertyType(o[s]),e.properties,a,o[s],void 0,r,i);else processProperty(getPropertyType(o),e.properties,a,o,void 0,r,i)}}function processReferencesArrayPacketData(e,t,i,r,n,a,o){var s=i.map(function(e){return createReferenceProperty(n,e)});if(defined(r)){r=intervalFromString(r);var l=e[t];if(!(l instanceof o)){var c=new o;c.intervals.addInterval(wrapPropertyInInfiniteInterval(l)),e[t]=l=c}r.data=new a(s),l.intervals.addInterval(r)}else e[t]=new a(s)}function processArrayPacketData(e,t,i,r){var n=i.references;defined(n)?processReferencesArrayPacketData(e,t,n,i.interval,r,PropertyArray,CompositeProperty):processPacketData(Array,e,t,i,void 0,void 0,r)}function processArray(e,t,i,r){if(defined(i))if(isArray$1(i))for(var n=0,a=i.length;n<a;++n)processArrayPacketData(e,t,i[n],r);else processArrayPacketData(e,t,i,r)}function processPositionArrayPacketData(e,t,i,r){var n=i.references;defined(n)?processReferencesArrayPacketData(e,t,n,i.interval,r,PositionPropertyArray,CompositePositionProperty):(defined(i.cartesian)?i.array=Cartesian3.unpackArray(i.cartesian):defined(i.cartographicRadians)?i.array=Cartesian3.fromRadiansArrayHeights(i.cartographicRadians):defined(i.cartographicDegrees)&&(i.array=Cartesian3.fromDegreesArrayHeights(i.cartographicDegrees)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,r))}function processPositionArray(e,t,i,r){if(defined(i))if(isArray$1(i))for(var n=0,a=i.length;n<a;++n)processPositionArrayPacketData(e,t,i[n],r);else processPositionArrayPacketData(e,t,i,r)}function unpackCartesianArray(e){return Cartesian3.unpackArray(e)}function unpackCartographicRadiansArray(e){return Cartesian3.fromRadiansArrayHeights(e)}function unpackCartographicDegreesArray(e){return Cartesian3.fromDegreesArrayHeights(e)}function processPositionArrayOfArraysPacketData(e,t,i,r){var n=i.references;if(defined(n)){var a=n.map(function(e){var t={};return processReferencesArrayPacketData(t,"positions",e,i.interval,r,PositionPropertyArray,CompositePositionProperty),t.positions});e[t]=new PositionPropertyArray(a)}else defined(i.cartesian)?i.array=i.cartesian.map(unpackCartesianArray):defined(i.cartographicRadians)?i.array=i.cartographicRadians.map(unpackCartographicRadiansArray):defined(i.cartographicDegrees)&&(i.array=i.cartographicDegrees.map(unpackCartographicDegreesArray)),defined(i.array)&&processPacketData(Array,e,t,i,void 0,void 0,r)}function processPositionArrayOfArrays(e,t,i,r){if(defined(i))if(isArray$1(i))for(var n=0,a=i.length;n<a;++n)processPositionArrayOfArraysPacketData(e,t,i[n],r);else processPositionArrayOfArraysPacketData(e,t,i,r)}function processAvailability(e,t,i,r){var n=t.availability;if(defined(n)){var a;if(isArray$1(n))for(var o=0,s=n.length;o<s;++o)defined(a)||(a=new TimeIntervalCollection),a.addInterval(intervalFromString(n[o]));else(a=new TimeIntervalCollection).addInterval(intervalFromString(n));e.availability=a}}function processAlignedAxis(e,t,i,r,n){defined(t)&&processPacketData(UnitCartesian3,e,"alignedAxis",t,i,r,n)}function processBillboard(e,t,i,r){var n=t.billboard;if(defined(n)){var a=intervalFromString(n.interval),o=e.billboard;defined(o)||(e.billboard=o=new BillboardGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Image,o,"image",n.image,a,r,i),processPacketData(Number,o,"scale",n.scale,a,r,i),processPacketData(Cartesian2,o,"pixelOffset",n.pixelOffset,a,r,i),processPacketData(Cartesian3,o,"eyeOffset",n.eyeOffset,a,r,i),processPacketData(HorizontalOrigin$1,o,"horizontalOrigin",n.horizontalOrigin,a,r,i),processPacketData(VerticalOrigin$1,o,"verticalOrigin",n.verticalOrigin,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Color,o,"color",n.color,a,r,i),processPacketData(Rotation,o,"rotation",n.rotation,a,r,i),processAlignedAxis(o,n.alignedAxis,a,r,i),processPacketData(Boolean,o,"sizeInMeters",n.sizeInMeters,a,r,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(NearFarScalar,o,"scaleByDistance",n.scaleByDistance,a,r,i),processPacketData(NearFarScalar,o,"translucencyByDistance",n.translucencyByDistance,a,r,i),processPacketData(NearFarScalar,o,"pixelOffsetScaleByDistance",n.pixelOffsetScaleByDistance,a,r,i),processPacketData(BoundingRectangle,o,"imageSubRegion",n.imageSubRegion,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(Number,o,"disableDepthTestDistance",n.disableDepthTestDistance,a,r,i)}}function processBox(e,t,i,r){var n=t.box;if(defined(n)){var a=intervalFromString(n.interval),o=e.box;defined(o)||(e.box=o=new BoxGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Cartesian3,o,"dimensions",n.dimensions,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processCorridor(e,t,i,r){var n=t.corridor;if(defined(n)){var a=intervalFromString(n.interval),o=e.corridor;defined(o)||(e.corridor=o=new CorridorGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"positions",n.positions,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(CornerType$1,o,"cornerType",n.cornerType,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function processCylinder(e,t,i,r){var n=t.cylinder;if(defined(n)){var a=intervalFromString(n.interval),o=e.cylinder;defined(o)||(e.cylinder=o=new CylinderGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"length",n.length,a,r,i),processPacketData(Number,o,"topRadius",n.topRadius,a,r,i),processPacketData(Number,o,"bottomRadius",n.bottomRadius,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i),processPacketData(Number,o,"slices",n.slices,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processDocument(e,t){var i=e.version;if(defined(i)&&"string"==typeof i){var r=i.split(".");if(2===r.length){if("1"!==r[0])throw new RuntimeError("Cesium only supports CZML version 1.");t._version=i}}if(!defined(t._version))throw new RuntimeError("CZML version information invalid.  It is expected to be a property on the document object in the <Major>.<Minor> version format.");var n=t._documentPacket;defined(e.name)&&(n.name=e.name);var a=e.clock;if(defined(a)){var o=n.clock;defined(o)?(o.interval=defaultValue(a.interval,o.interval),o.currentTime=defaultValue(a.currentTime,o.currentTime),o.range=defaultValue(a.range,o.range),o.step=defaultValue(a.step,o.step),o.multiplier=defaultValue(a.multiplier,o.multiplier)):n.clock={interval:a.interval,currentTime:a.currentTime,range:a.range,step:a.step,multiplier:a.multiplier}}}function processEllipse(e,t,i,r){var n=t.ellipse;if(defined(n)){var a=intervalFromString(n.interval),o=e.ellipse;defined(o)||(e.ellipse=o=new EllipseGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"semiMajorAxis",n.semiMajorAxis,a,r,i),processPacketData(Number,o,"semiMinorAxis",n.semiMinorAxis,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(Rotation,o,"rotation",n.rotation,a,r,i),processPacketData(Rotation,o,"stRotation",n.stRotation,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function processEllipsoid(e,t,i,r){var n=t.ellipsoid;if(defined(n)){var a=intervalFromString(n.interval),o=e.ellipsoid;defined(o)||(e.ellipsoid=o=new EllipsoidGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Cartesian3,o,"radii",n.radii,a,r,i),processPacketData(Cartesian3,o,"innerRadii",n.innerRadii,a,r,i),processPacketData(Number,o,"minimumClock",n.minimumClock,a,r,i),processPacketData(Number,o,"maximumClock",n.maximumClock,a,r,i),processPacketData(Number,o,"minimumCone",n.minimumCone,a,r,i),processPacketData(Number,o,"maximumCone",n.maximumCone,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Number,o,"stackPartitions",n.stackPartitions,a,r,i),processPacketData(Number,o,"slicePartitions",n.slicePartitions,a,r,i),processPacketData(Number,o,"subdivisions",n.subdivisions,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processLabel(e,t,i,r){var n=t.label;if(defined(n)){var a=intervalFromString(n.interval),o=e.label;defined(o)||(e.label=o=new LabelGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(String,o,"text",n.text,a,r,i),processPacketData(String,o,"font",n.font,a,r,i),processPacketData(LabelStyle$1,o,"style",n.style,a,r,i),processPacketData(Number,o,"scale",n.scale,a,r,i),processPacketData(Boolean,o,"showBackground",n.showBackground,a,r,i),processPacketData(Color,o,"backgroundColor",n.backgroundColor,a,r,i),processPacketData(Cartesian2,o,"backgroundPadding",n.backgroundPadding,a,r,i),processPacketData(Cartesian2,o,"pixelOffset",n.pixelOffset,a,r,i),processPacketData(Cartesian3,o,"eyeOffset",n.eyeOffset,a,r,i),processPacketData(HorizontalOrigin$1,o,"horizontalOrigin",n.horizontalOrigin,a,r,i),processPacketData(VerticalOrigin$1,o,"verticalOrigin",n.verticalOrigin,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Color,o,"fillColor",n.fillColor,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(NearFarScalar,o,"translucencyByDistance",n.translucencyByDistance,a,r,i),processPacketData(NearFarScalar,o,"pixelOffsetScaleByDistance",n.pixelOffsetScaleByDistance,a,r,i),processPacketData(NearFarScalar,o,"scaleByDistance",n.scaleByDistance,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(Number,o,"disableDepthTestDistance",n.disableDepthTestDistance,a,r,i)}}function processModel(e,t,i,r){var n=t.model;if(defined(n)){var a,o,s=intervalFromString(n.interval),l=e.model;defined(l)||(e.model=l=new ModelGraphics),processPacketData(Boolean,l,"show",n.show,s,r,i),processPacketData(URI,l,"uri",n.gltf,s,r,i),processPacketData(Number,l,"scale",n.scale,s,r,i),processPacketData(Number,l,"minimumPixelSize",n.minimumPixelSize,s,r,i),processPacketData(Number,l,"maximumScale",n.maximumScale,s,r,i),processPacketData(Boolean,l,"incrementallyLoadTextures",n.incrementallyLoadTextures,s,r,i),processPacketData(Boolean,l,"runAnimations",n.runAnimations,s,r,i),processPacketData(Boolean,l,"clampAnimations",n.clampAnimations,s,r,i),processPacketData(ShadowMode$1,l,"shadows",n.shadows,s,r,i),processPacketData(HeightReference$1,l,"heightReference",n.heightReference,s,r,i),processPacketData(Color,l,"silhouetteColor",n.silhouetteColor,s,r,i),processPacketData(Number,l,"silhouetteSize",n.silhouetteSize,s,r,i),processPacketData(Color,l,"color",n.color,s,r,i),processPacketData(ColorBlendMode$1,l,"colorBlendMode",n.colorBlendMode,s,r,i),processPacketData(Number,l,"colorBlendAmount",n.colorBlendAmount,s,r,i),processPacketData(DistanceDisplayCondition,l,"distanceDisplayCondition",n.distanceDisplayCondition,s,r,i);var c=n.nodeTransformations;if(defined(c))if(isArray$1(c))for(a=0,o=c.length;a<o;++a)processNodeTransformations(l,c[a],s,r,i);else processNodeTransformations(l,c,s,r,i);var u=n.articulations;if(defined(u))if(isArray$1(u))for(a=0,o=u.length;a<o;++a)processArticulations(l,u[a],s,r,i);else processArticulations(l,u,s,r,i)}}function processNodeTransformations(e,t,i,r,n){var a=intervalFromString(t.interval);defined(i)&&(a=defined(a)?TimeInterval.intersect(a,i,scratchTimeInterval):i);for(var o=e.nodeTransformations,s=Object.keys(t),l=0,c=s.length;l<c;++l){var u=s[l];if("interval"!==u){var d=t[u];if(defined(d)){defined(o)||(e.nodeTransformations=o=new PropertyBag),o.hasProperty(u)||o.addProperty(u);var h=o[u];defined(h)||(o[u]=h=new NodeTransformationProperty),processPacketData(Cartesian3,h,"translation",d.translation,a,r,n),processPacketData(Quaternion,h,"rotation",d.rotation,a,r,n),processPacketData(Cartesian3,h,"scale",d.scale,a,r,n)}}}}function processArticulations(e,t,i,r,n){var a=intervalFromString(t.interval);defined(i)&&(a=defined(a)?TimeInterval.intersect(a,i,scratchTimeInterval):i);for(var o=e.articulations,s=Object.keys(t),l=0,c=s.length;l<c;++l){var u=s[l];if("interval"!==u){var d=t[u];defined(d)&&(defined(o)||(e.articulations=o=new PropertyBag),o.hasProperty(u)||o.addProperty(u),processPacketData(Number,o,u,d,a,r,n))}}}function processPath(e,t,i,r){var n=t.path;if(defined(n)){var a=intervalFromString(n.interval),o=e.path;defined(o)||(e.path=o=new PathGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"leadTime",n.leadTime,a,r,i),processPacketData(Number,o,"trailTime",n.trailTime,a,r,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"resolution",n.resolution,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processPoint(e,t,i,r){var n=t.point;if(defined(n)){var a=intervalFromString(n.interval),o=e.point;defined(o)||(e.point=o=new PointGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Number,o,"pixelSize",n.pixelSize,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Color,o,"color",n.color,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(NearFarScalar,o,"scaleByDistance",n.scaleByDistance,a,r,i),processPacketData(NearFarScalar,o,"translucencyByDistance",n.translucencyByDistance,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(Number,o,"disableDepthTestDistance",n.disableDepthTestDistance,a,r,i)}}function PolygonHierarchyProperty(e){this.polygon=e,this._definitionChanged=new Event}function processPolygon(e,t,i,r){var n=t.polygon;if(defined(n)){var a=intervalFromString(n.interval),o=e.polygon;defined(o)||(e.polygon=o=new PolygonGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"_positions",n.positions,i),processPositionArrayOfArrays(o,"_holes",n.holes,i),(defined(o._positions)||defined(o._holes))&&(o.hierarchy=new PolygonHierarchyProperty(o)),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(Rotation,o,"stRotation",n.stRotation,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(Boolean,o,"perPositionHeight",n.perPositionHeight,a,r,i),processPacketData(Boolean,o,"closeTop",n.closeTop,a,r,i),processPacketData(Boolean,o,"closeBottom",n.closeBottom,a,r,i),processPacketData(ArcType$1,o,"arcType",n.arcType,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function adaptFollowSurfaceToArcType(e){return e?ArcType$1.GEODESIC:ArcType$1.NONE}function processPolyline(e,t,i,r){var n=t.polyline;if(defined(n)){var a=intervalFromString(n.interval),o=e.polyline;if(defined(o)||(e.polyline=o=new PolylineGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"positions",n.positions,i),processPacketData(Number,o,"width",n.width,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processMaterialPacketData(o,"depthFailMaterial",n.depthFailMaterial,a,r,i),processPacketData(ArcType$1,o,"arcType",n.arcType,a,r,i),processPacketData(Boolean,o,"clampToGround",n.clampToGround,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i),defined(n.followSurface)&&!defined(n.arcType)){var s={};processPacketData(Boolean,s,"followSurface",n.followSurface,a,r,i),o.arcType=createAdapterProperty(s.followSurface,adaptFollowSurfaceToArcType)}}}function processRectangle(e,t,i,r){var n=t.rectangle;if(defined(n)){var a=intervalFromString(n.interval),o=e.rectangle;defined(o)||(e.rectangle=o=new RectangleGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPacketData(Rectangle,o,"coordinates",n.coordinates,a,r,i),processPacketData(Number,o,"height",n.height,a,r,i),processPacketData(HeightReference$1,o,"heightReference",n.heightReference,a,r,i),processPacketData(Number,o,"extrudedHeight",n.extrudedHeight,a,r,i),processPacketData(HeightReference$1,o,"extrudedHeightReference",n.extrudedHeightReference,a,r,i),processPacketData(Rotation,o,"rotation",n.rotation,a,r,i),processPacketData(Rotation,o,"stRotation",n.stRotation,a,r,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i),processPacketData(ClassificationType$1,o,"classificationType",n.classificationType,a,r,i),processPacketData(Number,o,"zIndex",n.zIndex,a,r,i)}}function processWall(e,t,i,r){var n=t.wall;if(defined(n)){var a=intervalFromString(n.interval),o=e.wall;defined(o)||(e.wall=o=new WallGraphics),processPacketData(Boolean,o,"show",n.show,a,r,i),processPositionArray(o,"positions",n.positions,i),processArray(o,"minimumHeights",n.minimumHeights,i),processArray(o,"maximumHeights",n.maximumHeights,i),processPacketData(Number,o,"granularity",n.granularity,a,r,i),processPacketData(Boolean,o,"fill",n.fill,a,r,i),processMaterialPacketData(o,"material",n.material,a,r,i),processPacketData(Boolean,o,"outline",n.outline,a,r,i),processPacketData(Color,o,"outlineColor",n.outlineColor,a,r,i),processPacketData(Number,o,"outlineWidth",n.outlineWidth,a,r,i),processPacketData(ShadowMode$1,o,"shadows",n.shadows,a,r,i),processPacketData(DistanceDisplayCondition,o,"distanceDisplayCondition",n.distanceDisplayCondition,a,r,i)}}function processCzmlPacket(e,t,i,r,n){var a=e.id;if(defined(a)||(a=createGuid()),currentId=a,!defined(n._version)&&"document"!==a)throw new RuntimeError("The first CZML packet is required to be the document object.");if(!0===e.delete)t.removeById(a);else if("document"===a)processDocument(e,n);else{var o=t.getOrCreateEntity(a),s=e.parent;defined(s)&&(o.parent=t.getOrCreateEntity(s));for(var l=i.length-1;-1<l;l--)i[l](o,e,t,r)}currentId=void 0}function updateClock(e){var t,i=e._documentPacket.clock;if(!defined(i)){if(!defined(e._clock)){var r=e._entityCollection.computeAvailability();if(!r.start.equals(Iso8601.MINIMUM_VALUE)){var n=r.start,a=r.stop,o=JulianDate.secondsDifference(a,n),s=Math.round(o/120);return(t=new DataSourceClock).startTime=JulianDate.clone(n),t.stopTime=JulianDate.clone(a),t.clockRange=ClockRange$1.LOOP_STOP,t.multiplier=s,t.currentTime=JulianDate.clone(n),t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}defined(e._clock)?t=e._clock.clone():((t=new DataSourceClock).startTime=Iso8601.MINIMUM_VALUE.clone(),t.stopTime=Iso8601.MAXIMUM_VALUE.clone(),t.currentTime=Iso8601.MINIMUM_VALUE.clone(),t.clockRange=ClockRange$1.LOOP_STOP,t.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1);var l=intervalFromString(i.interval);return defined(l)&&(t.startTime=l.start,t.stopTime=l.stop),defined(i.currentTime)&&(t.currentTime=JulianDate.fromIso8601(i.currentTime)),defined(i.range)&&(t.clockRange=defaultValue(ClockRange$1[i.range],ClockRange$1.LOOP_STOP)),defined(i.step)&&(t.clockStep=defaultValue(ClockStep$1[i.step],ClockStep$1.SYSTEM_CLOCK_MULTIPLIER)),defined(i.multiplier)&&(t.multiplier=i.multiplier),!t.equals(e._clock)&&(e._clock=t.clone(e._clock),!0)}function load(t,e,i,r){var n=e,a=(i=defaultValue(i,defaultValue.EMPTY_OBJECT)).sourceUri,o=i.credit;if("string"==typeof o&&(o=new Credit(o)),t._credit=o,"string"==typeof e||e instanceof Resource){n=(e=Resource.createIfNeeded(e)).fetchJson(),a=defaultValue(a,e.clone());var s=t._resourceCredits,l=e.credits;if(defined(l))for(var c=l.length,u=0;u<c;u++)s.push(l[u])}return a=Resource.createIfNeeded(a),DataSource.setLoading(t,!0),when(n,function(e){return loadCzml(t,e,a,r)}).otherwise(function(e){return DataSource.setLoading(t,!1),t._error.raiseEvent(t,e),console.log(e),when.reject(e)})}function loadCzml(e,t,i,r){DataSource.setLoading(e,!0);var n=e._entityCollection;r&&(e._version=void 0,e._documentPacket=new DocumentPacket,n.removeAll()),CzmlDataSource._processCzml(t,n,i,void 0,e);var a=updateClock(e),o=e._documentPacket;return defined(o.name)&&e._name!==o.name?(e._name=o.name,a=!0):!defined(e._name)&&defined(i)&&(e._name=getFilenameFromUri(i.getUrlComponent()),a=!0),DataSource.setLoading(e,!1),a&&e._changed.raiseEvent(e),e}function DocumentPacket(){this.name=void 0,this.clock=void 0}function CzmlDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._clock=void 0,this._documentPacket=new DocumentPacket,this._version=void 0,this._entityCollection=new EntityCollection(this),this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function DataSourceCollection(){this._dataSources=[],this._dataSourceAdded=new Event,this._dataSourceRemoved=new Event,this._dataSourceMoved=new Event}function getIndex(e,t){return e.indexOf(t)}function swapDataSources(e,t,i){var r=e._dataSources,n=r.length-1;if((t=CesiumMath.clamp(t,0,n))!==(i=CesiumMath.clamp(i,0,n))){var a=r[t];r[t]=r[i],r[i]=a,e.dataSourceMoved.raiseEvent(a,i,t)}}function PrimitiveCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._primitives=[],this._guid=createGuid(),this._zIndex=void 0,this.show=defaultValue(e.show,!0),this.destroyPrimitives=defaultValue(e.destroyPrimitives,!0)}function getPrimitiveIndex(e,t){return e._primitives.indexOf(t)}function OrderedGroundPrimitiveCollection(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}function DynamicGeometryBatch(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new AssociativeArray}defineProperties$1(PolygonHierarchyProperty.prototype,{isConstant:{get:function(){var e=this.polygon._positions,t=this.polygon._holes;return(!defined(e)||e.isConstant)&&(!defined(t)||t.isConstant)}},definitionChanged:{get:function(){return this._definitionChanged}}}),PolygonHierarchyProperty.prototype.getValue=function(e,t){var i,r;return defined(this.polygon._positions)&&(i=this.polygon._positions.getValue(e)),defined(this.polygon._holes)&&defined(r=this.polygon._holes.getValue(e))&&(r=r.map(function(e){return new PolygonHierarchy(e)})),defined(t)?(t.positions=i,t.holes=r,t):new PolygonHierarchy(i,r)},PolygonHierarchyProperty.prototype.equals=function(e){return this===e||e instanceof PolygonHierarchyProperty&&Property.equals(this.polygon._positions,e.polygon._positions)&&Property.equals(this.polygon._holes,e.polygon._holes)},CzmlDataSource.load=function(e,t){return(new CzmlDataSource).load(e,t)},defineProperties$1(CzmlDataSource.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},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){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),CzmlDataSource.updaters=[processBillboard,processBox,processCorridor,processCylinder,processEllipse,processEllipsoid,processLabel,processModel,processName,processDescription,processPath,processPoint,processPolygon,processPolyline,processProperties,processRectangle,processPosition,processViewFrom,processWall,processOrientation,processAvailability],CzmlDataSource.prototype.process=function(e,t){return load(this,e,t,!1)},CzmlDataSource.prototype.load=function(e,t){return load(this,e,t,!0)},CzmlDataSource.processPacketData=processPacketData,CzmlDataSource.processPositionPacketData=processPositionPacketData,CzmlDataSource.processMaterialPacketData=processMaterialPacketData,CzmlDataSource._processCzml=function(e,t,i,r,n){if(r=defaultValue(r,CzmlDataSource.updaters),isArray$1(e))for(var a=0,o=e.length;a<o;++a)processCzmlPacket(e[a],t,r,i,n);else processCzmlPacket(e,t,r,i,n)},defineProperties$1(DataSourceCollection.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}}}),DataSourceCollection.prototype.add=function(e){var t=this,i=this._dataSources;return when(e,function(e){return i===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e})},DataSourceCollection.prototype.remove=function(e,t){t=defaultValue(t,!1);var i=this._dataSources.indexOf(e);return-1!==i&&(this._dataSources.splice(i,1),this._dataSourceRemoved.raiseEvent(this,e),t&&"function"==typeof e.destroy&&e.destroy(),!0)},DataSourceCollection.prototype.removeAll=function(e){e=defaultValue(e,!1);for(var t=this._dataSources,i=0,r=t.length;i<r;++i){var n=t[i];this._dataSourceRemoved.raiseEvent(this,n),e&&"function"==typeof n.destroy&&n.destroy()}this._dataSources=[]},DataSourceCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},DataSourceCollection.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},DataSourceCollection.prototype.get=function(e){return this._dataSources[e]},DataSourceCollection.prototype.getByName=function(t){return this._dataSources.filter(function(e){return e.name===t})},DataSourceCollection.prototype.raise=function(e){var t=getIndex(this._dataSources,e);swapDataSources(this,t,t+1)},DataSourceCollection.prototype.lower=function(e){var t=getIndex(this._dataSources,e);swapDataSources(this,t,t-1)},DataSourceCollection.prototype.raiseToTop=function(e){var t=getIndex(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))},DataSourceCollection.prototype.lowerToBottom=function(e){var t=getIndex(this._dataSources,e);0!==t&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))},DataSourceCollection.prototype.isDestroyed=function(){return!1},DataSourceCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},defineProperties$1(PrimitiveCollection.prototype,{length:{get:function(){return this._primitives.length}}}),PrimitiveCollection.prototype.add=function(e,t){var i=defined(t),r=e._external=e._external||{};return(r._composites=r._composites||{})[this._guid]={collection:this},i?this._primitives.splice(t,0,e):this._primitives.push(e),e},PrimitiveCollection.prototype.remove=function(e){if(this.contains(e)){var t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1},PrimitiveCollection.prototype.removeAndDestroy=function(e){var t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},PrimitiveCollection.prototype.removeAll=function(){for(var e=this._primitives,t=e.length,i=0;i<t;++i)delete e[i]._external._composites[this._guid],this.destroyPrimitives&&e[i].destroy();this._primitives=[]},PrimitiveCollection.prototype.contains=function(e){return!!(defined(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},PrimitiveCollection.prototype.raise=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;if(t!==i.length-1){var r=i[t];i[t]=i[t+1],i[t+1]=r}}},PrimitiveCollection.prototype.raiseToTop=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;t!==i.length-1&&(i.splice(t,1),i.push(e))}},PrimitiveCollection.prototype.lower=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;if(0!==t){var r=i[t];i[t]=i[t-1],i[t-1]=r}}},PrimitiveCollection.prototype.lowerToBottom=function(e){if(defined(e)){var t=getPrimitiveIndex(this,e),i=this._primitives;0!==t&&(i.splice(t,1),i.unshift(e))}},PrimitiveCollection.prototype.get=function(e){return this._primitives[e]},PrimitiveCollection.prototype.update=function(e){if(this.show)for(var t=this._primitives,i=0;i<t.length;++i)t[i].update(e)},PrimitiveCollection.prototype.prePassesUpdate=function(e){for(var t=this._primitives,i=0;i<t.length;++i){var r=t[i];defined(r.prePassesUpdate)&&r.prePassesUpdate(e)}},PrimitiveCollection.prototype.updateForPass=function(e,t){for(var i=this._primitives,r=0;r<i.length;++r){var n=i[r];defined(n.updateForPass)&&n.updateForPass(e,t)}},PrimitiveCollection.prototype.postPassesUpdate=function(e){for(var t=this._primitives,i=0;i<t.length;++i){var r=t[i];defined(r.postPassesUpdate)&&r.postPassesUpdate(e)}},PrimitiveCollection.prototype.isDestroyed=function(){return!1},PrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},defineProperties$1(OrderedGroundPrimitiveCollection.prototype,{length:{get:function(){return this._length}}}),OrderedGroundPrimitiveCollection.prototype.add=function(e,t){t=defaultValue(t,0);var i=this._collections[t];if(!defined(i)){(i=new PrimitiveCollection({destroyPrimitives:!1}))._zIndex=t,this._collections[t]=i;for(var r=this._collectionsArray,n=0;n<r.length&&r[n]._zIndex<t;)n++;r.splice(n,0,i)}return i.add(e),this._length++,e._zIndex=t,e},OrderedGroundPrimitiveCollection.prototype.set=function(e,t){return t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e},OrderedGroundPrimitiveCollection.prototype.remove=function(e,t){if(this.contains(e)){var i,r=e._zIndex,n=this._collections[r];return(i=t?n.remove(e):n.removeAndDestroy(e))&&this._length--,0===n.length&&(this._collectionsArray.splice(this._collectionsArray.indexOf(n),1),this._collections[r]=void 0,n.destroy()),i}return!1},OrderedGroundPrimitiveCollection.prototype.removeAll=function(){for(var e=this._collectionsArray,t=0;t<e.length;t++){var i=e[t];i.destroyPrimitives=!0,i.destroy()}this._collections={},this._collectionsArray=[],this._length=0},OrderedGroundPrimitiveCollection.prototype.contains=function(e){if(!defined(e))return!1;var t=this._collections[e._zIndex];return defined(t)&&t.contains(e)},OrderedGroundPrimitiveCollection.prototype.update=function(e){if(this.show)for(var t=this._collectionsArray,i=0;i<t.length;i++)t[i].update(e)},OrderedGroundPrimitiveCollection.prototype.isDestroyed=function(){return!1},OrderedGroundPrimitiveCollection.prototype.destroy=function(){return this.removeAll(),destroyObject(this)},DynamicGeometryBatch.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))},DynamicGeometryBatch.prototype.remove=function(e){var t=e.id,i=this._dynamicUpdaters.get(t);defined(i)&&(this._dynamicUpdaters.remove(t),i.destroy())},DynamicGeometryBatch.prototype.update=function(e){for(var t=this._dynamicUpdaters.values,i=0,r=t.length;i<r;i++)t[i].update(e);return!0},DynamicGeometryBatch.prototype.removeAllPrimitives=function(){for(var e=this._dynamicUpdaters.values,t=0,i=e.length;t<i;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},DynamicGeometryBatch.prototype.getBoundingSphere=function(e,t){return defined(e=this._dynamicUpdaters.get(e.id))&&defined(e.getBoundingSphere)?e.getBoundingSphere(t):BoundingSphereState$1.FAILED};var scratchColor$3=new Color,defaultOffset$4=Cartesian3.ZERO,offsetScratch$6=new Cartesian3,scratchRectangle$3=new Rectangle;function EllipseGeometryOptions(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 EllipseGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipseGeometryOptions(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function DynamicEllipseGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(EllipseGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),EllipseGeometryUpdater.prototype.constructor=EllipseGeometryUpdater),EllipseGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$3)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$6))),new GeometryInstance({id:i,geometry:new EllipseGeometry(this._options),attributes:n})},EllipseGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$3),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$4,offsetScratch$6))),new GeometryInstance({id:t,geometry:new EllipseOutlineGeometry(this._options),attributes:a})},EllipseGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipseGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.semiMajorAxis)||!defined(t.semiMinorAxis)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipseGeometryUpdater.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Property.isConstant(t.rotation)||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.numberOfVerticalLines)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)},EllipseGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),r=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),n=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),a=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(n)&&!defined(i)&&(i=0);var o=this._options;o.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,o.center=e.position.getValue(Iso8601.MINIMUM_VALUE,o.center),o.semiMajorAxis=t.semiMajorAxis.getValue(Iso8601.MINIMUM_VALUE,o.semiMajorAxis),o.semiMinorAxis=t.semiMinorAxis.getValue(Iso8601.MINIMUM_VALUE,o.semiMinorAxis),o.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),o.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),o.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),o.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,Iso8601.MINIMUM_VALUE),o.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(i,r,n,a),o.height=GroundGeometryUpdater.getGeometryHeight(i,r),(n=GroundGeometryUpdater.getGeometryExtrudedHeight(n,a))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(n=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(o,scratchRectangle$3)).minimumTerrainHeight),o.extrudedHeight=n},EllipseGeometryUpdater.DynamicGeometryUpdater=DynamicEllipseGeometryUpdater,defined(Object.create)&&(DynamicEllipseGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicEllipseGeometryUpdater.prototype.constructor=DynamicEllipseGeometryUpdater),DynamicEllipseGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(r.center)||!defined(r.semiMajorAxis)||!defined(r.semiMinorAxis)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicEllipseGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options,n=Property.getValueOrUndefined(t.height,i),a=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),o=Property.getValueOrUndefined(t.extrudedHeight,i),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0),r.center=Property.getValueOrUndefined(e.position,i,r.center),r.semiMajorAxis=Property.getValueOrUndefined(t.semiMajorAxis,i),r.semiMinorAxis=Property.getValueOrUndefined(t.semiMinorAxis,i),r.rotation=Property.getValueOrUndefined(t.rotation,i),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.stRotation=Property.getValueOrUndefined(t.stRotation,i),r.numberOfVerticalLines=Property.getValueOrUndefined(t.numberOfVerticalLines,i),r.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,a,o,s),r.height=GroundGeometryUpdater.getGeometryHeight(n,a),(o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(r,scratchRectangle$3)).minimumTerrainHeight),r.extrudedHeight=o};var defaultMaterial$1=new ColorMaterialProperty(Color.WHITE),defaultOffset$5=Cartesian3.ZERO,offsetScratch$7=new Cartesian3,radiiScratch=new Cartesian3,innerRadiiScratch=new Cartesian3,scratchColor$4=new Color,unitSphere=new Cartesian3(1,1,1);function EllipsoidGeometryOptions(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 EllipsoidGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new EllipsoidGeometryOptions(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function DynamicEllipsoidGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i),this._scene=e._scene,this._modelMatrix=new Matrix4,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 Cartesian3,this._material={}}defined(Object.create)&&(EllipsoidGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),EllipsoidGeometryUpdater.prototype.constructor=EllipsoidGeometryUpdater),defineProperties$1(EllipsoidGeometryUpdater.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),EllipsoidGeometryUpdater.prototype.createFillGeometryInstance=function(e,t,i){var r,n,a=this._entity,o=a.isAvailable(e),s=new ShowGeometryInstanceAttribute(o&&a.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),l=this._distanceDisplayConditionProperty.getValue(e),c={show:s,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(l),color:void 0,offset:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(n=this._materialProperty.color.getValue(e,scratchColor$4)),defined(n)||(n=Color.WHITE),r=ColorGeometryInstanceAttribute.fromColor(n),c.color=r);return defined(this._options.offsetAttribute)&&(c.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$7))),new GeometryInstance({id:a,geometry:new EllipsoidGeometry(this._options),modelMatrix:t?void 0:a.computeModelMatrixForHeightReference(e,a.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,i),attributes:c})},EllipsoidGeometryUpdater.prototype.createOutlineGeometryInstance=function(e,t,i){var r=this._entity,n=r.isAvailable(e),a=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$4),o=this._distanceDisplayConditionProperty.getValue(e),s={show:new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(a),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o),offset:void 0};return defined(this._options.offsetAttribute)&&(s.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$5,offsetScratch$7))),new GeometryInstance({id:r,geometry:new EllipsoidOutlineGeometry(this._options),modelMatrix:t?void 0:r.computeModelMatrixForHeightReference(e,r.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,i),attributes:s})},EllipsoidGeometryUpdater.prototype._computeCenter=function(e,t){return Property.getValueOrUndefined(this._entity.position,e,t)},EllipsoidGeometryUpdater.prototype._isHidden=function(e,t){return!defined(e.position)||!defined(t.radii)||GeometryUpdater.prototype._isHidden.call(this,e,t)},EllipsoidGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.radii.isConstant&&Property.isConstant(t.innerRadii)&&Property.isConstant(t.stackPartitions)&&Property.isConstant(t.slicePartitions)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.minimumClock)&&Property.isConstant(t.maximumClock)&&Property.isConstant(t.minimumCone)&&Property.isConstant(t.maximumCone)&&Property.isConstant(t.subdivisions))},EllipsoidGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),r=this._options;r.vertexFormat=this._materialProperty instanceof ColorMaterialProperty?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.radii=t.radii.getValue(Iso8601.MINIMUM_VALUE,r.radii),r.innerRadii=Property.getValueOrUndefined(t.innerRadii,r.radii),r.minimumClock=Property.getValueOrUndefined(t.minimumClock,Iso8601.MINIMUM_VALUE),r.maximumClock=Property.getValueOrUndefined(t.maximumClock,Iso8601.MINIMUM_VALUE),r.minimumCone=Property.getValueOrUndefined(t.minimumCone,Iso8601.MINIMUM_VALUE),r.maximumCone=Property.getValueOrUndefined(t.maximumCone,Iso8601.MINIMUM_VALUE),r.stackPartitions=Property.getValueOrUndefined(t.stackPartitions,Iso8601.MINIMUM_VALUE),r.slicePartitions=Property.getValueOrUndefined(t.slicePartitions,Iso8601.MINIMUM_VALUE),r.subdivisions=Property.getValueOrUndefined(t.subdivisions,Iso8601.MINIMUM_VALUE),r.offsetAttribute=i!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0},EllipsoidGeometryUpdater.prototype._onEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,EllipsoidGeometryUpdater.DynamicGeometryUpdater=DynamicEllipsoidGeometryUpdater,defined(Object.create)&&(DynamicEllipsoidGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicEllipsoidGeometryUpdater.prototype.constructor=DynamicEllipsoidGeometryUpdater),DynamicEllipsoidGeometryUpdater.prototype.update=function(e){var t=this._entity,i=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Property.getValueOrDefault(i.show,e,!0))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var r=Property.getValueOrUndefined(i.radii,e,radiiScratch),n=defined(r)?t.computeModelMatrixForHeightReference(e,i.heightReference,.5*r.z,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!defined(n)||!defined(r))return defined(this._primitive)&&(this._primitive.show=!1),void(defined(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var a=Property.getValueOrDefault(i.fill,e,!0),o=Property.getValueOrDefault(i.outline,e,!1),s=Property.getValueOrClonedDefault(i.outlineColor,e,Color.BLACK,scratchColor$4),l=MaterialProperty.getValue(e,defaultValue(i.material,defaultMaterial$1),this._material),c=Property.getValueOrUndefined(i.innerRadii,e,innerRadiiScratch),u=Property.getValueOrUndefined(i.minimumClock,e),d=Property.getValueOrUndefined(i.maximumClock,e),h=Property.getValueOrUndefined(i.minimumCone,e),p=Property.getValueOrUndefined(i.maximumCone,e),m=Property.getValueOrUndefined(i.stackPartitions,e),f=Property.getValueOrUndefined(i.slicePartitions,e),g=Property.getValueOrUndefined(i.subdivisions,e),_=Property.getValueOrDefault(i.outlineWidth,e,1),y=Property.getValueOrDefault(i.heightReference,e,HeightReference$1.NONE),v=y!==HeightReference$1.NONE?GeometryOffsetAttribute$1.ALL:void 0,C=this._scene.mode,S=C===SceneMode$1.SCENE3D&&y===HeightReference$1.NONE,x=this._options,T=this._geometryUpdater.shadowsProperty.getValue(e),b=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),E=Property.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,defaultOffset$5,offsetScratch$7);if(!S||this._lastSceneMode!==C||!defined(this._primitive)||x.stackPartitions!==m||x.slicePartitions!==f||defined(c)&&!Cartesian3.equals(x.innerRadii!==c)||x.minimumClock!==u||x.maximumClock!==d||x.minimumCone!==h||x.maximumCone!==p||x.subdivisions!==g||this._lastOutlineWidth!==_||x.offsetAttribute!==v){var P=this._primitives;if(P.removeAndDestroy(this._primitive),P.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=C,this._lastOutlineWidth=_,x.stackPartitions=m,x.slicePartitions=f,x.subdivisions=g,x.offsetAttribute=v,x.radii=Cartesian3.clone(S?unitSphere:r,x.radii),defined(c))if(S){var A=Cartesian3.magnitude(r);x.innerRadii=Cartesian3.fromElements(c.x/A,c.y/A,c.z/A,x.innerRadii)}else x.innerRadii=Cartesian3.clone(c,x.innerRadii);else x.innerRadii=void 0;x.minimumClock=u,x.maximumClock=d,x.minimumCone=h,x.maximumCone=p;var w=new MaterialAppearance({material:l,translucent:l.isTranslucent(),closed:!0});x.vertexFormat=w.vertexFormat;var D=this._geometryUpdater.createFillGeometryInstance(e,S,this._modelMatrix);this._primitive=P.add(new Primitive({geometryInstances:D,appearance:w,asynchronous:!1,shadows:T}));var M=this._geometryUpdater.createOutlineGeometryInstance(e,S,this._modelMatrix);this._outlinePrimitive=P.add(new Primitive({geometryInstances:M,appearance:new PerInstanceColorAppearance({flat:!0,translucent:255!==M.attributes.color.value[3],renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(_)}}),asynchronous:!1,shadows:T})),this._lastShow=a,this._lastOutlineShow=o,this._lastOutlineColor=Color.clone(s,this._lastOutlineColor),this._lastDistanceDisplayCondition=b,this._lastOffset=Cartesian3.clone(E,this._lastOffset)}else if(this._primitive.ready){var I=this._primitive,R=this._outlinePrimitive;I.show=!0,R.show=!0,I.appearance.material=l;var O=this._attributes;defined(O)||(O=I.getGeometryInstanceAttributes(t),this._attributes=O),a!==this._lastShow&&(O.show=ShowGeometryInstanceAttribute.toValue(a,O.show),this._lastShow=a);var L=this._outlineAttributes;defined(L)||(L=R.getGeometryInstanceAttributes(t),this._outlineAttributes=L),o!==this._lastOutlineShow&&(L.show=ShowGeometryInstanceAttribute.toValue(o,L.show),this._lastOutlineShow=o),Color.equals(s,this._lastOutlineColor)||(L.color=ColorGeometryInstanceAttribute.toValue(s,L.color),Color.clone(s,this._lastOutlineColor)),DistanceDisplayCondition.equals(b,this._lastDistanceDisplayCondition)||(O.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(b,O.distanceDisplayCondition),L.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(b,L.distanceDisplayCondition),DistanceDisplayCondition.clone(b,this._lastDistanceDisplayCondition)),Cartesian3.equals(E,this._lastOffset)||(O.offset=OffsetGeometryInstanceAttribute.toValue(E,O.offset),L.offset=OffsetGeometryInstanceAttribute.toValue(E,O.offset),Cartesian3.clone(E,this._lastOffset))}S&&(r.x=Math.max(r.x,.001),r.y=Math.max(r.y,.001),r.z=Math.max(r.z,.001),n=Matrix4.multiplyByScale(n,r,n),this._primitive.modelMatrix=n,this._outlinePrimitive.modelMatrix=n)};var positionScratch$9=new Cartesian3,scratchColor$5=new Color;function PlaneGeometryOptions(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function PlaneGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PlaneGeometryOptions(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}function DynamicPlaneGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(PlaneGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PlaneGeometryUpdater.prototype.constructor=PlaneGeometryUpdater),PlaneGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i,r=this._entity,n=r.isAvailable(e),a=new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o);this._materialProperty instanceof ColorMaterialProperty?(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(i=this._materialProperty.color.getValue(e,scratchColor$5)),defined(i)||(i=Color.WHITE),t={show:a,distanceDisplayCondition:s,color:ColorGeometryInstanceAttribute.fromColor(i)}):t={show:a,distanceDisplayCondition:s};var l=r.plane,c=this._options,u=r.computeModelMatrix(e),d=Property.getValueOrDefault(l.plane,e,c.plane),h=Property.getValueOrUndefined(l.dimensions,e,c.dimensions);return u=createPrimitiveMatrix(c.plane=d,c.dimensions=h,u,this._scene.mapProjection.ellipsoid,u),new GeometryInstance({id:r,geometry:new PlaneGeometry(this._options),modelMatrix:u,attributes:t})},PlaneGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$5),n=this._distanceDisplayConditionProperty.getValue(e),a=t.plane,o=this._options,s=t.computeModelMatrix(e),l=Property.getValueOrDefault(a.plane,e,o.plane),c=Property.getValueOrUndefined(a.dimensions,e,o.dimensions);return s=createPrimitiveMatrix(o.plane=l,o.dimensions=c,s,this._scene.mapProjection.ellipsoid,s),new GeometryInstance({id:t,geometry:new PlaneOutlineGeometry,modelMatrix:s,attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n)}})},PlaneGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.plane)||!defined(t.dimensions)||!defined(e.position)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PlaneGeometryUpdater.prototype._getIsClosed=function(e){return!1},PlaneGeometryUpdater.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Property.isConstant(e.orientation)&&t.plane.isConstant&&t.dimensions.isConstant&&Property.isConstant(t.outlineWidth))},PlaneGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=this._materialProperty instanceof ColorMaterialProperty,r=this._options;r.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,r.plane=t.plane.getValue(Iso8601.MINIMUM_VALUE,r.plane),r.dimensions=t.dimensions.getValue(Iso8601.MINIMUM_VALUE,r.dimensions)},PlaneGeometryUpdater.DynamicGeometryUpdater=DynamicPlaneGeometryUpdater,defined(Object.create)&&(DynamicPlaneGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicPlaneGeometryUpdater.prototype.constructor=DynamicPlaneGeometryUpdater),DynamicPlaneGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(Property.getValueOrUndefined(e.position,i,positionScratch$9))||!defined(r.plane)||!defined(r.dimensions)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicPlaneGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.plane=Property.getValueOrDefault(t.plane,i,r.plane),r.dimensions=Property.getValueOrUndefined(t.dimensions,i,r.dimensions)};var scratchAxis=new Cartesian3,scratchAxis2=new Cartesian3,scratchTranslation=new Cartesian3,scratchNormal$7=new Cartesian3,scratchScale$5=new Cartesian3,scratchQuaternion$1=new Quaternion,scratchMatrix3$1=new Matrix3;function createPrimitiveMatrix(e,t,i,r,n){var a=e.normal,o=e.distance,s=Cartesian3.multiplyByScalar(a,-o,scratchTranslation);s=Matrix4.multiplyByPoint(i,s,s);var l=Matrix4.multiplyByPointAsVector(i,a,scratchNormal$7);Cartesian3.normalize(l,l);var c=r.geodeticSurfaceNormal(s,scratchAxis2);CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(c,l)),1,CesiumMath.EPSILON8)&&(c=Cartesian3.clone(Cartesian3.UNIT_Z,c));var u=Cartesian3.cross(c,l,scratchAxis);c=Cartesian3.cross(l,u,c),Cartesian3.normalize(u,u),Cartesian3.normalize(c,c);var d=scratchMatrix3$1;Matrix3.setColumn(d,0,u,d),Matrix3.setColumn(d,1,c,d),Matrix3.setColumn(d,2,l,d);var h=Quaternion.fromRotationMatrix(d,scratchQuaternion$1),p=Cartesian2.clone(t,scratchScale$5);return p.z=1,Matrix4.fromTranslationQuaternionRotationScale(s,h,p,n)}PlaneGeometryUpdater.createPrimitiveMatrix=createPrimitiveMatrix;var heightAndPerPositionHeightWarning="Entity polygons cannot have both height and perPositionHeight.  height will be ignored",heightReferenceAndPerPositionHeightWarning="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",scratchColor$6=new Color,defaultOffset$6=Cartesian3.ZERO,offsetScratch$8=new Cartesian3,scratchRectangle$4=new Rectangle,scratch2DPositions=[],cart2Scratch=new Cartesian2;function PolygonGeometryOptions(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}function PolygonGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolygonGeometryOptions(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function DyanmicPolygonGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(PolygonGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),PolygonGeometryUpdater.prototype.constructor=PolygonGeometryUpdater),PolygonGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=this._options,a={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$6)),defined(t)||(t=Color.WHITE),a.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(n.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$8))),new GeometryInstance({id:i,geometry:n.perPositionHeight&&!defined(n.extrudedHeight)?new CoplanarPolygonGeometry(n):new PolygonGeometry(n),attributes:a})},PolygonGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=this._options,n=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$6),a=this._distanceDisplayConditionProperty.getValue(e),o={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(n),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a),offset:void 0};return defined(r.offsetAttribute)&&(o.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$6,offsetScratch$8))),new GeometryInstance({id:t,geometry:r.perPositionHeight&&!defined(r.extrudedHeight)?new CoplanarPolygonOutlineGeometry(r):new PolygonOutlineGeometry(r),attributes:o})},PolygonGeometryUpdater.prototype._computeCenter=function(e,t){var i=Property.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(defined(i)){var r=i.positions;if(0!==r.length){for(var n=this._scene.mapProjection.ellipsoid,a=EllipsoidTangentPlane.fromPoints(r,n),o=a.projectPointsOntoPlane(r,scratch2DPositions),s=o.length,l=0,c=s-1,u=new Cartesian2,d=0;d<s;c=d++){var h=o[d],p=o[c],m=h.x*p.y-p.x*h.y,f=Cartesian2.add(h,p,cart2Scratch);f=Cartesian2.multiplyByScalar(f,m,f),u=Cartesian2.add(u,f,u),l+=m}var g=1/(3*l);return u=Cartesian2.multiplyByScalar(u,g,u),a.projectPointOntoEllipsoid(u,t)}}},PolygonGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.hierarchy)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolygonGeometryUpdater.prototype._isOnTerrain=function(e,t){var i=GroundGeometryUpdater.prototype._isOnTerrain.call(this,e,t),r=t.perPositionHeight,n=defined(r)&&(!r.isConstant||r.getValue(Iso8601.MINIMUM_VALUE));return i&&!n},PolygonGeometryUpdater.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.perPositionHeight)||!Property.isConstant(t.closeTop)||!Property.isConstant(t.closeBottom)||!Property.isConstant(t.zIndex)||!Property.isConstant(t.arcType)||this._onTerrain&&!Property.isConstant(this._materialProperty)},PolygonGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=this._materialProperty instanceof ColorMaterialProperty,r=this._options;r.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat;var n,a=t.hierarchy.getValue(Iso8601.MINIMUM_VALUE),o=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),s=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),l=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),c=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),u=Property.getValueOrDefault(t.perPositionHeight,Iso8601.MINIMUM_VALUE,!1);o=GroundGeometryUpdater.getGeometryHeight(o,s),u?(defined(o)&&(o=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),s!==HeightReference$1.NONE&&u&&(o=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(l)&&!defined(o)&&(o=0),n=GroundGeometryUpdater.computeGeometryOffsetAttribute(o,s,l,c)),r.polygonHierarchy=a,r.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),r.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),r.perPositionHeight=u,r.closeTop=Property.getValueOrDefault(t.closeTop,Iso8601.MINIMUM_VALUE,!0),r.closeBottom=Property.getValueOrDefault(t.closeBottom,Iso8601.MINIMUM_VALUE,!0),r.offsetAttribute=n,r.height=o,r.arcType=Property.getValueOrDefault(t.arcType,Iso8601.MINIMUM_VALUE,ArcType$1.GEODESIC),(l=GroundGeometryUpdater.getGeometryExtrudedHeight(l,c))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(l=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(r,scratchRectangle$4)).minimumTerrainHeight),r.extrudedHeight=l},PolygonGeometryUpdater.prototype._getIsClosed=function(e){var t=e.height,i=e.extrudedHeight,r=defined(i)&&i!==t;return!e.perPositionHeight&&(!r&&0===t||r&&e.closeTop&&e.closeBottom)},PolygonGeometryUpdater.DynamicGeometryUpdater=DyanmicPolygonGeometryUpdater,defined(Object.create)&&(DyanmicPolygonGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DyanmicPolygonGeometryUpdater.prototype.constructor=DyanmicPolygonGeometryUpdater),DyanmicPolygonGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.polygonHierarchy)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DyanmicPolygonGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.polygonHierarchy=Property.getValueOrUndefined(t.hierarchy,i);var n,a=Property.getValueOrUndefined(t.height,i),o=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE),l=Property.getValueOrUndefined(t.extrudedHeight,i),c=Property.getValueOrUndefined(t.perPositionHeight,i);a=GroundGeometryUpdater.getGeometryHeight(a,s),c?(defined(a)&&(a=void 0,oneTimeWarning(heightAndPerPositionHeightWarning)),o!==HeightReference$1.NONE&&c&&(a=void 0,oneTimeWarning(heightReferenceAndPerPositionHeightWarning))):(defined(l)&&!defined(a)&&(a=0),n=GroundGeometryUpdater.computeGeometryOffsetAttribute(a,o,l,s)),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.stRotation=Property.getValueOrUndefined(t.stRotation,i),r.perPositionHeight=Property.getValueOrUndefined(t.perPositionHeight,i),r.closeTop=Property.getValueOrDefault(t.closeTop,i,!0),r.closeBottom=Property.getValueOrDefault(t.closeBottom,i,!0),r.offsetAttribute=n,r.height=a,r.arcType=Property.getValueOrDefault(t.arcType,i,ArcType$1.GEODESIC),(l=GroundGeometryUpdater.getGeometryExtrudedHeight(l,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(l=ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(r,scratchRectangle$4)).minimumTerrainHeight),r.extrudedHeight=l};var scratchColor$7=new Color;function PolylineVolumeGeometryOptions(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 PolylineVolumeGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new PolylineVolumeGeometryOptions(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function DynamicPolylineVolumeGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(PolylineVolumeGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),PolylineVolumeGeometryUpdater.prototype.constructor=PolylineVolumeGeometryUpdater),PolylineVolumeGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i,r=this._entity,n=r.isAvailable(e),a=new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o);this._materialProperty instanceof ColorMaterialProperty?(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(i=this._materialProperty.color.getValue(e,scratchColor$7)),defined(i)||(i=Color.WHITE),t={show:a,distanceDisplayCondition:s,color:ColorGeometryInstanceAttribute.fromColor(i)}):t={show:a,distanceDisplayCondition:s};return new GeometryInstance({id:r,geometry:new PolylineVolumeGeometry(this._options),attributes:t})},PolylineVolumeGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$7),n=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new PolylineVolumeOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n)}})},PolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||!defined(t.shape)||GeometryUpdater.prototype._isHidden.call(this,e,t)},PolylineVolumeGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&t.shape.isConstant&&Property.isConstant(t.granularity)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.cornerType))},PolylineVolumeGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=t.granularity,r=t.cornerType,n=this._options,a=this._materialProperty instanceof ColorMaterialProperty;n.vertexFormat=a?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,n.polylinePositions=t.positions.getValue(Iso8601.MINIMUM_VALUE,n.polylinePositions),n.shapePositions=t.shape.getValue(Iso8601.MINIMUM_VALUE,n.shape),n.granularity=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE):void 0,n.cornerType=defined(r)?r.getValue(Iso8601.MINIMUM_VALUE):void 0},PolylineVolumeGeometryUpdater.DynamicGeometryUpdater=DynamicPolylineVolumeGeometryUpdater,defined(Object.create)&&(DynamicPolylineVolumeGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicPolylineVolumeGeometryUpdater.prototype.constructor=DynamicPolylineVolumeGeometryUpdater),DynamicPolylineVolumeGeometryUpdater.prototype._isHidden=function(e,t,i){var r=this._options;return!defined(r.polylinePositions)||!defined(r.shapePositions)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicPolylineVolumeGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.polylinePositions=Property.getValueOrUndefined(t.positions,i,r.polylinePositions),r.shapePositions=Property.getValueOrUndefined(t.shape,i),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.cornerType=Property.getValueOrUndefined(t.cornerType,i)};var scratchColor$8=new Color,defaultOffset$7=Cartesian3.ZERO,offsetScratch$9=new Cartesian3,scratchRectangle$5=new Rectangle,scratchCenterRect=new Rectangle,scratchCarto$1=new Cartographic;function RectangleGeometryOptions(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 RectangleGeometryUpdater(e,t){GroundGeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new RectangleGeometryOptions(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function DynamicRectangleGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(RectangleGeometryUpdater.prototype=Object.create(GroundGeometryUpdater.prototype),RectangleGeometryUpdater.prototype.constructor=RectangleGeometryUpdater),RectangleGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n={show:new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$8)),defined(t)||(t=Color.WHITE),n.color=ColorGeometryInstanceAttribute.fromColor(t));return defined(this._options.offsetAttribute)&&(n.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$7,offsetScratch$9))),new GeometryInstance({id:i,geometry:new RectangleGeometry(this._options),attributes:n})},RectangleGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$8),n=this._distanceDisplayConditionProperty.getValue(e),a={show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n),offset:void 0};return defined(this._options.offsetAttribute)&&(a.offset=OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty,e,defaultOffset$7,offsetScratch$9))),new GeometryInstance({id:t,geometry:new RectangleOutlineGeometry(this._options),attributes:a})},RectangleGeometryUpdater.prototype._computeCenter=function(e,t){var i=Property.getValueOrUndefined(this._entity.rectangle.coordinates,e,scratchCenterRect);if(defined(i)){var r=Rectangle.center(i,scratchCarto$1);return Cartographic.toCartesian(r,Ellipsoid.WGS84,t)}},RectangleGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.coordinates)||GeometryUpdater.prototype._isHidden.call(this,e,t)},RectangleGeometryUpdater.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Property.isConstant(t.height)||!Property.isConstant(t.extrudedHeight)||!Property.isConstant(t.granularity)||!Property.isConstant(t.stRotation)||!Property.isConstant(t.rotation)||!Property.isConstant(t.outlineWidth)||!Property.isConstant(t.zIndex)||this._onTerrain&&!Property.isConstant(this._materialProperty)},RectangleGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=this._materialProperty instanceof ColorMaterialProperty,r=Property.getValueOrUndefined(t.height,Iso8601.MINIMUM_VALUE),n=Property.getValueOrDefault(t.heightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE),a=Property.getValueOrUndefined(t.extrudedHeight,Iso8601.MINIMUM_VALUE),o=Property.getValueOrDefault(t.extrudedHeightReference,Iso8601.MINIMUM_VALUE,HeightReference$1.NONE);defined(a)&&!defined(r)&&(r=0);var s=this._options;s.vertexFormat=i?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,s.rectangle=t.coordinates.getValue(Iso8601.MINIMUM_VALUE,s.rectangle),s.granularity=Property.getValueOrUndefined(t.granularity,Iso8601.MINIMUM_VALUE),s.stRotation=Property.getValueOrUndefined(t.stRotation,Iso8601.MINIMUM_VALUE),s.rotation=Property.getValueOrUndefined(t.rotation,Iso8601.MINIMUM_VALUE),s.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(r,n,a,o),s.height=GroundGeometryUpdater.getGeometryHeight(r,n),(a=GroundGeometryUpdater.getGeometryExtrudedHeight(a,o))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(a=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(s,scratchRectangle$5)).minimumTerrainHeight),s.extrudedHeight=a},RectangleGeometryUpdater.DynamicGeometryUpdater=DynamicRectangleGeometryUpdater,defined(Object.create)&&(DynamicRectangleGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicRectangleGeometryUpdater.prototype.constructor=DynamicRectangleGeometryUpdater),DynamicRectangleGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.rectangle)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicRectangleGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options,n=Property.getValueOrUndefined(t.height,i),a=Property.getValueOrDefault(t.heightReference,i,HeightReference$1.NONE),o=Property.getValueOrUndefined(t.extrudedHeight,i),s=Property.getValueOrDefault(t.extrudedHeightReference,i,HeightReference$1.NONE);defined(o)&&!defined(n)&&(n=0),r.rectangle=Property.getValueOrUndefined(t.coordinates,i,r.rectangle),r.granularity=Property.getValueOrUndefined(t.granularity,i),r.stRotation=Property.getValueOrUndefined(t.stRotation,i),r.rotation=Property.getValueOrUndefined(t.rotation,i),r.offsetAttribute=GroundGeometryUpdater.computeGeometryOffsetAttribute(n,a,o,s),r.height=GroundGeometryUpdater.getGeometryHeight(n,a),(o=GroundGeometryUpdater.getGeometryExtrudedHeight(o,s))===GroundGeometryUpdater.CLAMP_TO_GROUND&&(o=ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(r,scratchRectangle$5)).minimumTerrainHeight),r.extrudedHeight=o};var colorScratch$2=new Color,distanceDisplayConditionScratch$1=new DistanceDisplayCondition,defaultDistanceDisplayCondition$1=new DistanceDisplayCondition,defaultOffset$8=Cartesian3.ZERO,offsetScratch$a=new Cartesian3;function Batch(e,t,i,r,n,a,o){var s;this.translucent=t,this.appearanceType=i,this.depthFailAppearanceType=r,this.depthFailMaterialProperty=n,this.depthFailMaterial=void 0,this.closed=a,this.shadows=o,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.invalidated=!1,defined(n)&&(s=n.definitionChanged.addEventListener(Batch.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=s}function StaticGeometryColorBatch(e,t,i,r,n){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=i,this._closed=r,this._shadows=n}function removeItem(e,t){for(var i=e.length-1;0<=i;i--){var r=e[i];if(r.remove(t))return 0===r.updaters.length&&(e.splice(i,1),r.destroy()),!0}return!1}function moveItems(e,t,i){for(var r=!1,n=t.length,a=0;a<n;++a){var o=t[a],s=o.itemsToRemove,l=s.length;if(0<l)for(a=0;a<l;a++){var c=s[a];o.remove(c),e.add(i,c),r=!0}}return r}function updateItems(e,t,i,r){var n,a=t.length;for(n=a-1;0<=n;n--){var o=t[n];if(o.invalidated){t.splice(n,1);for(var s=o.updaters.values,l=s.length,c=0;c<l;c++)e.add(i,s[c]);o.destroy()}}for(a=t.length,n=0;n<a;++n)r=t[n].update(i)&&r;return r}function getBoundingSphere(e,t,i){for(var r=e.length,n=0;n<r;n++){var a=e[n];if(a.contains(t))return a.getBoundingSphere(t,i)}return BoundingSphereState$1.FAILED}function removeAllPrimitives(e){for(var t=e.length,i=0;i<t;i++)e[i].destroy();e.length=0}Batch.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch.prototype.isMaterial=function(e){var t=this.depthFailMaterialProperty,i=e.depthFailMaterialProperty;return i===t||!!defined(t)&&t.equals(i)},Batch.prototype.add=function(n,e){var t=n.id;if(this.createPrimitive=!0,this.geometry.set(t,e),this.updaters.set(t,n),n.hasConstantFill&&n.fillMaterialProperty.isConstant&&Property.isConstant(n.distanceDisplayConditionProperty)&&Property.isConstant(n.terrainOffsetProperty)){var a=this;this.subscriptions.set(t,n.entity.definitionChanged.addEventListener(function(e,t,i,r){"isShowing"===t&&a.showsUpdated.set(n.id,n)}))}else this.updatersWithAttributes.set(t,n)},Batch.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch.prototype.update=function(e){var t,i=!0,r=0,n=this.primitive,a=this.primitives;if(this.createPrimitive){var o=this.geometry.values;if(0<o.length){var s;defined(n)&&(defined(this.oldPrimitive)?a.remove(n):this.oldPrimitive=n),defined(this.depthFailAppearanceType)&&(defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),s=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),n=new Primitive({show:!1,asynchronous:!0,geometryInstances:o,appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:s,shadows:this.shadows}),a.add(n),i=!1}else{defined(n)&&(a.remove(n),n=void 0);var l=this.oldPrimitive;defined(l)&&(a.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(a.remove(this.oldPrimitive),this.oldPrimitive=void 0),!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);var c=this.updatersWithAttributes.values,u=c.length,d=this.waitingOnCreate;for(t=0;t<u;t++){var h=c[t],p=this.geometry.get(h.id),m=this.attributes.get(p.id.id);if(defined(m)||(m=n.getGeometryInstanceAttributes(p.id),this.attributes.set(p.id.id,m)),!h.fillMaterialProperty.isConstant||d){var f=h.fillMaterialProperty.color,g=Property.getValueOrDefault(f,e,Color.WHITE,colorScratch$2);Color.equals(m._lastColor,g)||(m._lastColor=Color.clone(g,m._lastColor),m.color=ColorGeometryInstanceAttribute.toValue(g,m.color),(this.translucent&&255===m.color[3]||!this.translucent&&255!==m.color[3])&&(this.itemsToRemove[r++]=h))}if(defined(this.depthFailAppearanceType)&&h.depthFailMaterialProperty instanceof ColorMaterialProperty&&(!h.depthFailMaterialProperty.isConstant||d)){var _=h.depthFailMaterialProperty.color,y=Property.getValueOrDefault(_,e,Color.WHITE,colorScratch$2);Color.equals(m._lastDepthFailColor,y)||(m._lastDepthFailColor=Color.clone(y,m._lastDepthFailColor),m.depthFailColor=ColorGeometryInstanceAttribute.toValue(y,m.depthFailColor))}var v=h.entity.isShowing&&(h.hasConstantFill||h.isFilled(e));v!==(1===m.show[0])&&(m.show=ShowGeometryInstanceAttribute.toValue(v,m.show));var C=h.distanceDisplayConditionProperty;if(!Property.isConstant(C)){var S=Property.getValueOrDefault(C,e,defaultDistanceDisplayCondition$1,distanceDisplayConditionScratch$1);DistanceDisplayCondition.equals(S,m._lastDistanceDisplayCondition)||(m._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(S,m._lastDistanceDisplayCondition),m.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(S,m.distanceDisplayCondition))}var x=h.terrainOffsetProperty;if(!Property.isConstant(x)){var T=Property.getValueOrDefault(x,e,defaultOffset$8,offsetScratch$a);Cartesian3.equals(T,m._lastOffset)||(m._lastOffset=Cartesian3.clone(T,m._lastOffset),m.offset=OffsetGeometryInstanceAttribute.toValue(T,m.offset))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(i=!1);return this.itemsToRemove.length=r,i},Batch.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=this.geometry.get(n.id),o=this.attributes.get(a.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,o));var s=n.entity.isShowing;s!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(s,o.show),a.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch.prototype.destroy=function(){var e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),defined(this.removeMaterialSubscription)&&this.removeMaterialSubscription()},StaticGeometryColorBatch.prototype.add=function(e,t){var i,r,n=t.createFillGeometryInstance(e);r=255===n.attributes.color.value[3]?(i=this._solidItems,!1):(i=this._translucentItems,!0);for(var a=i.length,o=0;o<a;o++){var s=i[o];if(s.isMaterial(t))return void s.add(t,n)}var l=new Batch(this._primitives,r,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);l.add(t,n),i.push(l)},StaticGeometryColorBatch.prototype.remove=function(e){removeItem(this._solidItems,e)||removeItem(this._translucentItems,e)},StaticGeometryColorBatch.prototype.update=function(e){var t=updateItems(this,this._solidItems,e,!0);t=updateItems(this,this._translucentItems,e,t)&&t;var i=moveItems(this,this._solidItems,e),r=moveItems(this,this._translucentItems,e);return(i||r)&&(t=updateItems(this,this._solidItems,e,t)&&t,t=updateItems(this,this._translucentItems,e,t)&&t),t},StaticGeometryColorBatch.prototype.getBoundingSphere=function(e,t){var i=getBoundingSphere(this._solidItems,e,t);return i===BoundingSphereState$1.FAILED?getBoundingSphere(this._translucentItems,e,t):i},StaticGeometryColorBatch.prototype.removeAllPrimitives=function(){removeAllPrimitives(this._solidItems),removeAllPrimitives(this._translucentItems)};var distanceDisplayConditionScratch$2=new DistanceDisplayCondition,defaultDistanceDisplayCondition$2=new DistanceDisplayCondition,defaultOffset$9=Cartesian3.ZERO,offsetScratch$b=new Cartesian3;function Batch$1(e,t,i,r,n,a,o){this.primitives=e,this.appearanceType=t,this.materialProperty=i,this.depthFailAppearanceType=r,this.depthFailMaterialProperty=n,this.closed=a,this.shadows=o,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch$1.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}Batch$1.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$1.prototype.isMaterial=function(e){var t=this.materialProperty,i=e.fillMaterialProperty,r=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;if(i===t&&n===r)return!0;var a=defined(t)&&t.equals(i);return a=(!defined(r)&&!defined(n)||defined(r)&&r.equals(n))&&a},Batch$1.prototype.add=function(e,n){var t=n.id;if(this.updaters.set(t,n),this.geometry.set(t,n.createFillGeometryInstance(e)),n.hasConstantFill&&n.fillMaterialProperty.isConstant&&Property.isConstant(n.distanceDisplayConditionProperty)&&Property.isConstant(n.terrainOffsetProperty)){var a=this;this.subscriptions.set(t,n.entity.definitionChanged.addEventListener(function(e,t,i,r){"isShowing"===t&&a.showsUpdated.set(n.id,n)}))}else this.updatersWithAttributes.set(t,n);this.createPrimitive=!0},Batch$1.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};var colorScratch$3=new Color;function StaticGeometryPerMaterialBatch(e,t,i,r,n){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=i,this._closed=r,this._shadows=n}Batch$1.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.primitives,a=this.geometry.values;if(this.createPrimitive){if(0<a.length){var o;defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),defined(this.depthFailMaterialProperty)&&(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),o=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),r=new Primitive({show:!1,asynchronous:!0,geometryInstances:a,appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:o,shadows:this.shadows}),n.add(r),i=!1}else{defined(r)&&(n.remove(r),r=void 0);var s=this.oldPrimitive;defined(s)&&(n.remove(s),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,!defined(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof ColorMaterialProperty||(this.depthFailMaterial=MaterialProperty.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);var l=this.updatersWithAttributes.values,c=l.length;for(t=0;t<c;t++){var u=l[t],d=u.entity,h=this.geometry.get(u.id),p=this.attributes.get(h.id.id);if(defined(p)||(p=r.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,p)),defined(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof ColorMaterialProperty&&!u.depthFailMaterialProperty.isConstant){var m=u.depthFailMaterialProperty.color,f=Property.getValueOrDefault(m,e,Color.WHITE,colorScratch$3);Color.equals(p._lastDepthFailColor,f)||(p._lastDepthFailColor=Color.clone(f,p._lastDepthFailColor),p.depthFailColor=ColorGeometryInstanceAttribute.toValue(f,p.depthFailColor))}var g=d.isShowing&&(u.hasConstantFill||u.isFilled(e));g!==(1===p.show[0])&&(p.show=ShowGeometryInstanceAttribute.toValue(g,p.show));var _=u.distanceDisplayConditionProperty;if(!Property.isConstant(_)){var y=Property.getValueOrDefault(_,e,defaultDistanceDisplayCondition$2,distanceDisplayConditionScratch$2);DistanceDisplayCondition.equals(y,p._lastDistanceDisplayCondition)||(p._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(y,p._lastDistanceDisplayCondition),p.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(y,p.distanceDisplayCondition))}var v=u.terrainOffsetProperty;if(!Property.isConstant(v)){var C=Property.getValueOrDefault(v,e,defaultOffset$9,offsetScratch$b);Cartesian3.equals(C,p._lastOffset)||(p._lastOffset=Cartesian3.clone(C,p._lastOffset),p.offset=OffsetGeometryInstanceAttribute.toValue(C,p.offset))}}this.updateShows(r)}else defined(r)&&!r.ready&&(i=!1);return i},Batch$1.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=n.entity,o=this.geometry.get(n.id),s=this.attributes.get(o.id.id);defined(s)||(s=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s));var l=a.isShowing;l!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(l,s.show),o.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Batch$1.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$1.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$1.prototype.destroy=function(){var e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGeometryPerMaterialBatch.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.isMaterial(t))return void a.add(e,t)}var o=new Batch$1(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),i.push(o)},StaticGeometryPerMaterialBatch.prototype.remove=function(e){for(var t=this._items,i=t.length-1;0<=i;i--){var r=t[i];if(r.remove(e)){0===r.updaters.length&&(t.splice(i,1),r.destroy());break}}},StaticGeometryPerMaterialBatch.prototype.update=function(e){var t,i=this._items;for(t=i.length-1;0<=t;t--){var r=i[t];if(r.invalidated){i.splice(t,1);for(var n=r.updaters.values,a=n.length,o=0;o<a;o++)this.add(e,n[o]);r.destroy()}}var s=!0;for(t=0;t<i.length;t++)s=i[t].update(e)&&s;return s},StaticGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;i<t;i++)e[i].destroy();this._items.length=0};var colorScratch$4=new Color,distanceDisplayConditionScratch$3=new DistanceDisplayCondition,defaultDistanceDisplayCondition$3=new DistanceDisplayCondition;function Batch$2(e,t,i,r,n){this.primitives=e,this.zIndex=n,this.classificationType=t,this.color=i,this.key=r,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.itemsToRemove=[],this.isDirty=!1}Batch$2.prototype.add=function(n,e){var t=n.id;if(this.createPrimitive=!0,this.geometry.set(t,e),this.updaters.set(t,n),n.hasConstantFill&&n.fillMaterialProperty.isConstant&&Property.isConstant(n.distanceDisplayConditionProperty)){var a=this;this.subscriptions.set(t,n.entity.definitionChanged.addEventListener(function(e,t,i,r){"isShowing"===t&&a.showsUpdated.set(n.id,n)}))}else this.updatersWithAttributes.set(t,n)},Batch$2.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};var scratchArray=new Array(4);function StaticGroundGeometryColorBatch(e,t){this._batches=new AssociativeArray,this._primitives=e,this._classificationType=t}Batch$2.prototype.update=function(e){var t,i=!0,r=0,n=this.primitive,a=this.primitives;if(this.createPrimitive){var o=this.geometry.values;if(0<o.length)defined(n)&&(defined(this.oldPrimitive)?a.remove(n):this.oldPrimitive=n),n=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:o,classificationType:this.classificationType}),a.add(n,this.zIndex),i=!1;else{defined(n)&&(a.remove(n),n=void 0);var s=this.oldPrimitive;defined(s)&&(a.remove(s),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(a.remove(this.oldPrimitive),this.oldPrimitive=void 0);var l=this.updatersWithAttributes.values,c=l.length,u=this.waitingOnCreate;for(t=0;t<c;t++){var d=l[t],h=this.geometry.get(d.id),p=this.attributes.get(h.id.id);if(defined(p)||(p=n.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,p)),!d.fillMaterialProperty.isConstant||u){var m=d.fillMaterialProperty.color,f=Property.getValueOrDefault(m,e,Color.WHITE,colorScratch$4);if(!Color.equals(p._lastColor,f)){p._lastColor=Color.clone(f,p._lastColor);var g=this.color,_=f.toBytes(scratchArray);g[0]===_[0]&&g[1]===_[1]&&g[2]===_[2]&&g[3]===_[3]||(this.itemsToRemove[r++]=d)}}var y=d.entity.isShowing&&(d.hasConstantFill||d.isFilled(e));y!==(1===p.show[0])&&(p.show=ShowGeometryInstanceAttribute.toValue(y,p.show));var v=d.distanceDisplayConditionProperty;if(!Property.isConstant(v)){var C=Property.getValueOrDefault(v,e,defaultDistanceDisplayCondition$3,distanceDisplayConditionScratch$3);DistanceDisplayCondition.equals(C,p._lastDistanceDisplayCondition)||(p._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(C,p._lastDistanceDisplayCondition),p.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(C,p.distanceDisplayCondition))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(i=!1);return this.itemsToRemove.length=r,i},Batch$2.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=this.geometry.get(n.id),o=this.attributes.get(a.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,o));var s=n.entity.isShowing;s!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(s,o.show),a.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$2.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$2.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getBoundingSphere(e.entity);return defined(r)?(r.clone(t),BoundingSphereState$1.DONE):BoundingSphereState$1.FAILED},Batch$2.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;defined(i)&&(e.remove(i),this.oldPrimitive=void 0)},StaticGroundGeometryColorBatch.prototype.add=function(e,t){var i,r=t.createFillGeometryInstance(e),n=this._batches,a=Property.getValueOrDefault(t.zIndex,0),o=new Uint32Array(r.attributes.color.value.buffer)[0]+":"+a;return n.contains(o)?i=n.get(o):(i=new Batch$2(this._primitives,this._classificationType,r.attributes.color.value,o,a),n.set(o,i)),i.add(t,r),i},StaticGroundGeometryColorBatch.prototype.remove=function(e){for(var t=this._batches.values,i=t.length,r=0;r<i;++r)if(t[r].remove(e))return},StaticGroundGeometryColorBatch.prototype.update=function(e){var t,i,r=!0,n=this._batches,a=n.values,o=a.length;for(t=0;t<o;++t)r=a[t].update(e)&&r;for(t=0;t<o;++t)for(var s=a[t],l=s.itemsToRemove,c=l.length,u=0;u<c;u++){i=l[u],s.remove(i);var d=this.add(e,i);s.isDirty=!0,d.isDirty=!0}var h=a.slice(),p=h.length;for(t=0;t<p;++t){var m=h[t];m.isDirty&&(r=h[t].update(e)&&r,m.isDirty=!1),0===m.geometry.length&&n.remove(m.key)}return r},StaticGroundGeometryColorBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._batches.values,r=i.length,n=0;n<r;++n){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryColorBatch.prototype.removeAllPrimitives=function(){for(var e=this._batches.values,t=e.length,i=0;i<t;++i)e[i].removeAllPrimitives()};var distanceDisplayConditionScratch$4=new DistanceDisplayCondition,defaultDistanceDisplayCondition$4=new DistanceDisplayCondition;function Batch$3(e,t,i,r,n,a){this.primitives=e,this.classificationType=t,this.appearanceType=i,this.materialProperty=r,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=r.definitionChanged.addEventListener(Batch$3.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.usingSphericalTextureCoordinates=n,this.zIndex=a,this.rectangleCollisionCheck=new RectangleCollisionChecker}function StaticGroundGeometryPerMaterialBatch(e,t,i){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=i}Batch$3.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$3.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},Batch$3.prototype.isMaterial=function(e){var t=this.materialProperty,i=e.fillMaterialProperty;return i===t||i instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(i)},Batch$3.prototype.add=function(e,n,t){var i=n.id;if(this.updaters.set(i,n),this.geometry.set(i,t),this.rectangleCollisionCheck.insert(i,t.geometry.rectangle),n.hasConstantFill&&n.fillMaterialProperty.isConstant&&Property.isConstant(n.distanceDisplayConditionProperty)){var a=this;this.subscriptions.set(i,n.entity.definitionChanged.addEventListener(function(e,t,i,r){"isShowing"===t&&a.showsUpdated.set(n.id,n)}))}else this.updatersWithAttributes.set(i,n);this.createPrimitive=!0},Batch$3.prototype.remove=function(e){var t=e.id,i=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,i.geometry.rectangle),this.updatersWithAttributes.remove(t);var r=this.subscriptions.get(t);return defined(r)&&(r(),this.subscriptions.remove(t)),!0}return!1},Batch$3.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.primitives,a=this.geometry.values;if(this.createPrimitive){if(0<a.length)defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),r=new GroundPrimitive({show:!1,asynchronous:!0,geometryInstances:a,appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),n.add(r,this.zIndex),i=!1;else{defined(r)&&(n.remove(r),r=void 0);var o=this.oldPrimitive;defined(o)&&(n.remove(o),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;var s=this.updatersWithAttributes.values,l=s.length;for(t=0;t<l;t++){var c=s[t],u=c.entity,d=this.geometry.get(c.id),h=this.attributes.get(d.id.id);defined(h)||(h=r.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h));var p=u.isShowing&&(c.hasConstantFill||c.isFilled(e));p!==(1===h.show[0])&&(h.show=ShowGeometryInstanceAttribute.toValue(p,h.show));var m=c.distanceDisplayConditionProperty;if(!Property.isConstant(m)){var f=Property.getValueOrDefault(m,e,defaultDistanceDisplayCondition$4,distanceDisplayConditionScratch$4);DistanceDisplayCondition.equals(f,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(f,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(f,h.distanceDisplayCondition))}}this.updateShows(r)}else defined(r)&&!r.ready&&(i=!1);return i},Batch$3.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=n.entity,o=this.geometry.get(n.id),s=this.attributes.get(o.id.id);defined(s)||(s=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s));var l=a.isShowing;l!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(l,s.show),o.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Batch$3.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$3.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$3.prototype.destroy=function(){var e=this.primitive,t=this.primitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGroundGeometryPerMaterialBatch.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=t.createFillGeometryInstance(e),a=ShadowVolumeAppearance.shouldUseSphericalCoordinates(n.geometry.rectangle),o=Property.getValueOrDefault(t.zIndex,0),s=0;s<r;++s){var l=i[s];if(l.isMaterial(t)&&l.usingSphericalTextureCoordinates===a&&l.zIndex===o&&!l.overlapping(n.geometry.rectangle))return void l.add(e,t,n)}var c=new Batch$3(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,a,o);c.add(e,t,n),i.push(c)},StaticGroundGeometryPerMaterialBatch.prototype.remove=function(e){for(var t=this._items,i=t.length-1;0<=i;i--){var r=t[i];if(r.remove(e)){0===r.updaters.length&&(t.splice(i,1),r.destroy());break}}},StaticGroundGeometryPerMaterialBatch.prototype.update=function(e){var t,i=this._items;for(t=i.length-1;0<=t;t--){var r=i[t];if(r.invalidated){i.splice(t,1);for(var n=r.updaters.values,a=n.length,o=0;o<a;o++)this.add(e,n[o]);r.destroy()}}var s=!0;for(t=0;t<i.length;t++)s=i[t].update(e)&&s;return s},StaticGroundGeometryPerMaterialBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundGeometryPerMaterialBatch.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;i<t;i++)e[i].destroy();this._items.length=0};var colorScratch$5=new Color,distanceDisplayConditionScratch$5=new DistanceDisplayCondition,defaultDistanceDisplayCondition$5=new DistanceDisplayCondition,defaultOffset$a=Cartesian3.ZERO,offsetScratch$c=new Cartesian3;function Batch$4(e,t,i,r){this.translucent=t,this.width=i,this.shadows=r,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.updaters=new AssociativeArray,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.itemsToRemove=[],this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray}function StaticOutlineGeometryBatch(e,t,i){this._primitives=e,this._scene=t,this._shadows=i,this._solidBatches=new AssociativeArray,this._translucentBatches=new AssociativeArray}Batch$4.prototype.add=function(n,e){var t=n.id;if(this.createPrimitive=!0,this.geometry.set(t,e),this.updaters.set(t,n),n.hasConstantOutline&&n.outlineColorProperty.isConstant&&Property.isConstant(n.distanceDisplayConditionProperty)&&Property.isConstant(n.terrainOffsetProperty)){var a=this;this.subscriptions.set(t,n.entity.definitionChanged.addEventListener(function(e,t,i,r){"isShowing"===t&&a.showsUpdated.set(n.id,n)}))}else this.updatersWithAttributes.set(t,n)},Batch$4.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},Batch$4.prototype.update=function(e){var t,i=!0,r=0,n=this.primitive,a=this.primitives;if(this.createPrimitive){var o=this.geometry.values;if(0<o.length)defined(n)&&(defined(this.oldPrimitive)?a.remove(n):this.oldPrimitive=n),n=new Primitive({show:!1,asynchronous:!0,geometryInstances:o,appearance:new PerInstanceColorAppearance({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),a.add(n),i=!1;else{defined(n)&&(a.remove(n),n=void 0);var s=this.oldPrimitive;defined(s)&&(a.remove(s),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(defined(n)&&n.ready){n.show=!0,defined(this.oldPrimitive)&&(a.remove(this.oldPrimitive),this.oldPrimitive=void 0);var l=this.updatersWithAttributes.values,c=l.length,u=this.waitingOnCreate;for(t=0;t<c;t++){var d=l[t],h=this.geometry.get(d.id),p=this.attributes.get(h.id.id);if(defined(p)||(p=n.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,p)),!d.outlineColorProperty.isConstant||u){var m=d.outlineColorProperty,f=Property.getValueOrDefault(m,e,Color.WHITE,colorScratch$5);Color.equals(p._lastColor,f)||(p._lastColor=Color.clone(f,p._lastColor),p.color=ColorGeometryInstanceAttribute.toValue(f,p.color),(this.translucent&&255===p.color[3]||!this.translucent&&255!==p.color[3])&&(this.itemsToRemove[r++]=d))}var g=d.entity.isShowing&&(d.hasConstantOutline||d.isOutlineVisible(e));g!==(1===p.show[0])&&(p.show=ShowGeometryInstanceAttribute.toValue(g,p.show));var _=d.distanceDisplayConditionProperty;if(!Property.isConstant(_)){var y=Property.getValueOrDefault(_,e,defaultDistanceDisplayCondition$5,distanceDisplayConditionScratch$5);DistanceDisplayCondition.equals(y,p._lastDistanceDisplayCondition)||(p._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(y,p._lastDistanceDisplayCondition),p.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(y,p.distanceDisplayCondition))}var v=d.terrainOffsetProperty;if(!Property.isConstant(v)){var C=Property.getValueOrDefault(v,e,defaultOffset$a,offsetScratch$c);Cartesian3.equals(C,p._lastOffset)||(p._lastOffset=Cartesian3.clone(C,p._lastOffset),p.offset=OffsetGeometryInstanceAttribute.toValue(C,p.offset))}}this.updateShows(n),this.waitingOnCreate=!1}else defined(n)&&!n.ready&&(i=!1);return this.itemsToRemove.length=r,i},Batch$4.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=this.geometry.get(n.id),o=this.attributes.get(a.id.id);defined(o)||(o=e.getGeometryInstanceAttributes(a.id),this.attributes.set(a.id.id,o));var s=n.entity.isShowing;s!==(1===o.show[0])&&(o.show=ShowGeometryInstanceAttribute.toValue(s,o.show),a.attributes.show.value[0]=o.show[0])}this.showsUpdated.removeAll()},Batch$4.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$4.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$4.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;defined(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;defined(i)&&(e.remove(i),this.oldPrimitive=void 0)},StaticOutlineGeometryBatch.prototype.add=function(e,t){var i,r,n=t.createOutlineGeometryInstance(e),a=this._scene.clampLineWidth(t.outlineWidth);255===n.attributes.color.value[3]?defined(r=(i=this._solidBatches).get(a))||(r=new Batch$4(this._primitives,!1,a,this._shadows),i.set(a,r)):defined(r=(i=this._translucentBatches).get(a))||(r=new Batch$4(this._primitives,!0,a,this._shadows),i.set(a,r)),r.add(t,n)},StaticOutlineGeometryBatch.prototype.remove=function(e){var t,i=this._solidBatches.values,r=i.length;for(t=0;t<r;t++)if(i[t].remove(e))return;var n=this._translucentBatches.values,a=n.length;for(t=0;t<a;t++)if(n[t].remove(e))return},StaticOutlineGeometryBatch.prototype.update=function(e){var t,i,r,n,a,o=this._solidBatches.values,s=o.length,l=this._translucentBatches.values,c=l.length,u=!0,d=!1;do{for(d=!1,i=0;i<s;i++){u=(n=o[i]).update(e);var h=(a=n.itemsToRemove).length;if(0<h)for(d=!0,t=0;t<h;t++)r=a[t],n.remove(r),this.add(e,r)}for(i=0;i<c;i++){u=(n=l[i]).update(e);var p=(a=n.itemsToRemove).length;if(0<p)for(d=!0,t=0;t<p;t++)r=a[t],n.remove(r),this.add(e,r)}}while(d);return u},StaticOutlineGeometryBatch.prototype.getBoundingSphere=function(e,t){var i,r=this._solidBatches.values,n=r.length;for(i=0;i<n;i++){var a=r[i];if(a.contains(e))return a.getBoundingSphere(e,t)}var o=this._translucentBatches.values,s=o.length;for(i=0;i<s;i++){var l=o[i];if(l.contains(e))return l.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticOutlineGeometryBatch.prototype.removeAllPrimitives=function(){var e,t=this._solidBatches.values,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();var r=this._translucentBatches.values,n=r.length;for(e=0;e<n;e++)r[e].removeAllPrimitives()};var scratchColor$9=new Color;function WallGeometryOptions(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 WallGeometryUpdater(e,t){GeometryUpdater.call(this,{entity:e,scene:t,geometryOptions:new WallGeometryOptions(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function DynamicWallGeometryUpdater(e,t,i){DynamicGeometryUpdater.call(this,e,t,i)}defined(Object.create)&&(WallGeometryUpdater.prototype=Object.create(GeometryUpdater.prototype),WallGeometryUpdater.prototype.constructor=WallGeometryUpdater),WallGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i,r=this._entity,n=r.isAvailable(e),a=new ShowGeometryInstanceAttribute(n&&r.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),s=DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(o);this._materialProperty instanceof ColorMaterialProperty?(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(i=this._materialProperty.color.getValue(e,scratchColor$9)),defined(i)||(i=Color.WHITE),t={show:a,distanceDisplayCondition:s,color:ColorGeometryInstanceAttribute.fromColor(i)}):t={show:a,distanceDisplayCondition:s};return new GeometryInstance({id:r,geometry:new WallGeometry(this._options),attributes:t})},WallGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){var t=this._entity,i=t.isAvailable(e),r=Property.getValueOrDefault(this._outlineColorProperty,e,Color.BLACK,scratchColor$9),n=this._distanceDisplayConditionProperty.getValue(e);return new GeometryInstance({id:t,geometry:new WallOutlineGeometry(this._options),attributes:{show:new ShowGeometryInstanceAttribute(i&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:ColorGeometryInstanceAttribute.fromColor(r),distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(n)}})},WallGeometryUpdater.prototype._isHidden=function(e,t){return!defined(t.positions)||GeometryUpdater.prototype._isHidden.call(this,e,t)},WallGeometryUpdater.prototype._getIsClosed=function(e){return!1},WallGeometryUpdater.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&Property.isConstant(t.minimumHeights)&&Property.isConstant(t.maximumHeights)&&Property.isConstant(t.outlineWidth)&&Property.isConstant(t.granularity))},WallGeometryUpdater.prototype._setStaticOptions=function(e,t){var i=t.minimumHeights,r=t.maximumHeights,n=t.granularity,a=this._materialProperty instanceof ColorMaterialProperty,o=this._options;o.vertexFormat=a?PerInstanceColorAppearance.VERTEX_FORMAT:MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,o.positions=t.positions.getValue(Iso8601.MINIMUM_VALUE,o.positions),o.minimumHeights=defined(i)?i.getValue(Iso8601.MINIMUM_VALUE,o.minimumHeights):void 0,o.maximumHeights=defined(r)?r.getValue(Iso8601.MINIMUM_VALUE,o.maximumHeights):void 0,o.granularity=defined(n)?n.getValue(Iso8601.MINIMUM_VALUE):void 0},WallGeometryUpdater.DynamicGeometryUpdater=DynamicWallGeometryUpdater,defined(Object.create)&&(DynamicWallGeometryUpdater.prototype=Object.create(DynamicGeometryUpdater.prototype),DynamicWallGeometryUpdater.prototype.constructor=DynamicWallGeometryUpdater),DynamicWallGeometryUpdater.prototype._isHidden=function(e,t,i){return!defined(this._options.positions)||DynamicGeometryUpdater.prototype._isHidden.call(this,e,t,i)},DynamicWallGeometryUpdater.prototype._setOptions=function(e,t,i){var r=this._options;r.positions=Property.getValueOrUndefined(t.positions,i,r.positions),r.minimumHeights=Property.getValueOrUndefined(t.minimumHeights,i,r.minimumHeights),r.maximumHeights=Property.getValueOrUndefined(t.maximumHeights,i,r.maximumHeights),r.granularity=Property.getValueOrUndefined(t.granularity,i)};var emptyArray=[],geometryUpdaters=[BoxGeometryUpdater,CylinderGeometryUpdater,CorridorGeometryUpdater,EllipseGeometryUpdater,EllipsoidGeometryUpdater,PlaneGeometryUpdater,PolygonGeometryUpdater,PolylineVolumeGeometryUpdater,RectangleGeometryUpdater,WallGeometryUpdater];function GeometryUpdaterSet(e,t){this.entity=e,this.scene=t;var i=new Array(geometryUpdaters.length),r=new Event;function n(e){r.raiseEvent(e)}for(var a=new EventHelper,o=0;o<i.length;o++){var s=new geometryUpdaters[o](e,t);a.add(s.geometryChanged,n),i[o]=s}this.updaters=i,this.geometryChanged=r,this.eventHelper=a,this._removeEntitySubscription=e.definitionChanged.addEventListener(GeometryUpdaterSet.prototype._onEntityPropertyChanged,this)}function GeometryVisualizer(e,t,i,r){i=defaultValue(i,e.primitives),r=defaultValue(r,e.groundPrimitives),this._scene=e,this._primitives=i,this._groundPrimitives=r,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;var n=ShadowMode$1.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(2*n),this._closedColorBatches=new Array(2*n),this._closedMaterialBatches=new Array(2*n),this._openColorBatches=new Array(2*n),this._openMaterialBatches=new Array(2*n);var a,o=Entity.supportsMaterialsforEntitiesOnTerrain(e);for(this._supportsMaterialsforEntitiesOnTerrain=o,a=0;a<n;++a)this._outlineBatches[a]=new StaticOutlineGeometryBatch(i,e,a,!1),this._outlineBatches[n+a]=new StaticOutlineGeometryBatch(i,e,a,!0),this._closedColorBatches[a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!0,a,!0),this._closedColorBatches[n+a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!0,a,!1),this._closedMaterialBatches[a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!0,a,!0),this._closedMaterialBatches[n+a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!0,a,!1),this._openColorBatches[a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!1,a,!0),this._openColorBatches[n+a]=new StaticGeometryColorBatch(i,PerInstanceColorAppearance,void 0,!1,a,!1),this._openMaterialBatches[a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!1,a,!0),this._openMaterialBatches[n+a]=new StaticGeometryPerMaterialBatch(i,MaterialAppearance,void 0,!1,a,!1);var s=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES,l=new Array(s),c=[];if(o)for(a=0;a<s;++a)c.push(new StaticGroundGeometryPerMaterialBatch(r,a,MaterialAppearance)),l[a]=new StaticGroundGeometryPerMaterialBatch(r,a,PerInstanceColorAppearance);else for(a=0;a<s;++a)l[a]=new StaticGroundGeometryColorBatch(r,a);this._groundColorBatches=l,this._groundMaterialBatches=c,this._dynamicBatch=new DynamicGeometryBatch(i,r),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new AssociativeArray,this._updaterSets=new AssociativeArray,(this._entityCollection=t).collectionChanged.addEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray)}GeometryUpdaterSet.prototype._onEntityPropertyChanged=function(e,t,i,r){for(var n=this.updaters,a=0;a<n.length;a++)n[a]._onEntityPropertyChanged(e,t,i,r)},GeometryUpdaterSet.prototype.forEach=function(e){for(var t=this.updaters,i=0;i<t.length;i++)e(t[i])},GeometryUpdaterSet.prototype.destroy=function(){this.eventHelper.removeAll();for(var e=this.updaters,t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),destroyObject(this)},GeometryVisualizer.prototype.update=function(t){var e,i,r,n,a=this._addedObjects,o=a.values,s=this._removedObjects,l=s.values,c=this._changedObjects,u=c.values,d=this;for(e=u.length-1;-1<e;e--)r=(i=u[e]).id,(n=this._updaterSets.get(r)).entity===i?n.forEach(function(e){d._removeUpdater(e),d._insertUpdaterIntoBatch(t,e)}):(l.push(i),o.push(i));for(e=l.length-1;-1<e;e--)r=(i=l[e]).id,(n=this._updaterSets.get(r)).forEach(this._removeUpdater.bind(this)),n.destroy(),this._updaterSets.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(e=o.length-1;-1<e;e--)r=(i=o[e]).id,n=new GeometryUpdaterSet(i,this._scene),this._updaterSets.set(r,n),n.forEach(function(e){d._insertUpdaterIntoBatch(t,e)}),this._subscriptions.set(r,n.geometryChanged.addEventListener(GeometryVisualizer._onGeometryChanged,this));a.removeAll(),s.removeAll(),c.removeAll();var h=!0,p=this._batches,m=p.length;for(e=0;e<m;e++)h=p[e].update(t)&&h;return h};var getBoundingSphereArrayScratch=[],getBoundingSphereBoundingSphereScratch=new BoundingSphere;GeometryVisualizer.prototype.getBoundingSphere=function(e,t){for(var i=getBoundingSphereArrayScratch,r=getBoundingSphereBoundingSphereScratch,n=0,a=BoundingSphereState$1.DONE,o=this._batches,s=o.length,l=e.id,c=this._updaterSets.get(l).updaters,u=0;u<c.length;u++)for(var d=c[u],h=0;h<s;h++){if((a=o[h].getBoundingSphere(d,r))===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;a===BoundingSphereState$1.DONE&&(i[n]=BoundingSphere.clone(r,i[n]),n++)}return 0===n?BoundingSphereState$1.FAILED:(i.length=n,BoundingSphere.fromBoundingSpheres(i,t),BoundingSphereState$1.DONE)},GeometryVisualizer.prototype.isDestroyed=function(){return!1},GeometryVisualizer.prototype.destroy=function(){var e;this._entityCollection.collectionChanged.removeEventListener(GeometryVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var t=this._batches,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();var r=this._subscriptions.values;for(i=r.length,e=0;e<i;e++)r[e]();this._subscriptions.removeAll();var n=this._updaterSets.values;for(i=n.length,e=0;e<i;e++)n[e].destroy();return this._updaterSets.removeAll(),destroyObject(this)},GeometryVisualizer.prototype._removeUpdater=function(e){for(var t=this._batches,i=t.length,r=0;r<i;r++)t[r].remove(e)},GeometryVisualizer.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic)this._dynamicBatch.add(e,t);else{var i;(t.outlineEnabled||t.fillEnabled)&&(i=t.shadowsProperty.getValue(e));var r=ShadowMode$1.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(defined(t.terrainOffsetProperty)?this._outlineBatches[r+i].add(e,t):this._outlineBatches[i].add(e,t)),t.fillEnabled)if(t.onTerrain){var n=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof ColorMaterialProperty?this._groundColorBatches[n].add(e,t):this._groundMaterialBatches[n].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._closedColorBatches[r+i].add(e,t):this._closedColorBatches[i].add(e,t):defined(t.terrainOffsetProperty)?this._closedMaterialBatches[r+i].add(e,t):this._closedMaterialBatches[i].add(e,t):t.fillMaterialProperty instanceof ColorMaterialProperty?defined(t.terrainOffsetProperty)?this._openColorBatches[r+i].add(e,t):this._openColorBatches[i].add(e,t):defined(t.terrainOffsetProperty)?this._openMaterialBatches[r+i].add(e,t):this._openMaterialBatches[i].add(e,t)}},GeometryVisualizer._onGeometryChanged=function(e){var t=this._removedObjects,i=this._changedObjects,r=e.entity,n=r.id;defined(t.get(n))||defined(i.get(n))||i.set(n,r)},GeometryVisualizer.prototype._onCollectionChanged=function(e,t,i){var r,n,a,o=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;-1<r;r--)n=(a=i[r]).id,o.remove(n)||(s.set(n,a),l.remove(n));for(r=t.length-1;-1<r;r--)n=(a=t[r]).id,s.remove(n)?l.set(n,a):o.set(n,a)};var defaultScale$2=1,defaultFont="30px sans-serif",defaultStyle=LabelStyle$1.FILL,defaultFillColor=Color.WHITE,defaultOutlineColor$2=Color.BLACK,defaultOutlineWidth$1=1,defaultShowBackground=!1,defaultBackgroundColor=new Color(.165,.165,.165,.8),defaultBackgroundPadding=new Cartesian2(7,5),defaultPixelOffset$1=Cartesian2.ZERO,defaultEyeOffset$1=Cartesian3.ZERO,defaultHeightReference$1=HeightReference$1.NONE,defaultHorizontalOrigin$1=HorizontalOrigin$1.CENTER,defaultVerticalOrigin$1=VerticalOrigin$1.CENTER,positionScratch$a=new Cartesian3,fillColorScratch=new Color,outlineColorScratch=new Color,backgroundColorScratch=new Color,backgroundPaddingScratch=new Cartesian2,eyeOffsetScratch$1=new Cartesian3,pixelOffsetScratch$1=new Cartesian2,translucencyByDistanceScratch$1=new NearFarScalar,pixelOffsetScaleByDistanceScratch$1=new NearFarScalar,scaleByDistanceScratch$1=new NearFarScalar,distanceDisplayConditionScratch$6=new DistanceDisplayCondition;function EntityData$1(e){this.entity=e,this.label=void 0,this.index=void 0}function LabelVisualizer(e,t){t.collectionChanged.addEventListener(LabelVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$1(e,t,i){defined(e)&&(e.label=void 0,i.removeLabel(t))}function addToArray(e,t,i){if(i=defaultValue(i,!1)){var r=e.indexOf(t);if(-1<r)return r}return e.push(t),e.length-1}function hasExtension(e,t){return defined(e.extensionsUsed)&&0<=e.extensionsUsed.indexOf(t)}function ForEach(){}function numberOfComponentsForType(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 getAccessorByteStride(e,t){var i=t.bufferView;if(defined(i)){var r=e.bufferViews[i];if(defined(r.byteStride)&&0<r.byteStride)return r.byteStride}return ComponentDatatype$1.getSizeInBytes(t.componentType)*numberOfComponentsForType(t.type)}function addDefaults(n){ForEach.accessor(n,function(e){defined(e.bufferView)&&(e.byteOffset=defaultValue(e.byteOffset,0))}),ForEach.bufferView(n,function(e){defined(e.buffer)&&(e.byteOffset=defaultValue(e.byteOffset,0))}),ForEach.mesh(n,function(e){ForEach.meshPrimitive(e,function(e){if(e.mode=defaultValue(e.mode,WebGLConstants$1.TRIANGLES),!defined(e.material)){defined(n.materials)||(n.materials=[]);e.material=addToArray(n.materials,{name:"default"})}})}),ForEach.accessorContainingVertexAttributeData(n,function(e){var t=n.accessors[e],i=t.bufferView;if(t.normalized=defaultValue(t.normalized,!1),defined(i)){var r=n.bufferViews[i];r.byteStride=getAccessorByteStride(n,t),r.target=WebGLConstants$1.ARRAY_BUFFER}}),ForEach.accessorContainingIndexData(n,function(e){var t=n.accessors[e].bufferView;defined(t)&&(n.bufferViews[t].target=WebGLConstants$1.ELEMENT_ARRAY_BUFFER)}),ForEach.material(n,function(e){var t=defaultValue(e.extensions,defaultValue.EMPTY_OBJECT),i=t.KHR_materials_common;if(defined(i)){var r=i.technique,n=defined(i.values)?i.values:{};return(i.values=n).ambient=defined(n.ambient)?n.ambient:[0,0,0,1],n.emission=defined(n.emission)?n.emission:[0,0,0,1],n.transparency=defaultValue(n.transparency,1),n.transparent=defaultValue(n.transparent,!1),n.doubleSided=defaultValue(n.doubleSided,!1),void("CONSTANT"!==r&&(n.diffuse=defined(n.diffuse)?n.diffuse:[0,0,0,1],"LAMBERT"!==r&&(n.specular=defined(n.specular)?n.specular:[0,0,0,1],n.shininess=defaultValue(n.shininess,0))))}e.emissiveFactor=defaultValue(e.emissiveFactor,[0,0,0]),e.alphaMode=defaultValue(e.alphaMode,"OPAQUE"),e.doubleSided=defaultValue(e.doubleSided,!1),"MASK"===e.alphaMode&&(e.alphaCutoff=defaultValue(e.alphaCutoff,.5)),defined(t.KHR_techniques_webgl)&&ForEach.materialValue(e,function(e){defined(e.index)&&addTextureDefaults(e)}),addTextureDefaults(e.emissiveTexture),addTextureDefaults(e.normalTexture),addTextureDefaults(e.occlusionTexture);var a=e.pbrMetallicRoughness;defined(a)&&(a.baseColorFactor=defaultValue(a.baseColorFactor,[1,1,1,1]),a.metallicFactor=defaultValue(a.metallicFactor,1),a.roughnessFactor=defaultValue(a.roughnessFactor,1),addTextureDefaults(a.baseColorTexture),addTextureDefaults(a.metallicRoughnessTexture));var o=t.pbrSpecularGlossiness;defined(o)&&(o.diffuseFactor=defaultValue(o.diffuseFactor,[1,1,1,1]),o.specularFactor=defaultValue(o.specularFactor,[1,1,1]),o.glossinessFactor=defaultValue(o.glossinessFactor,1),addTextureDefaults(o.specularGlossinessTexture))}),ForEach.animation(n,function(e){ForEach.animationSampler(e,function(e){e.interpolation=defaultValue(e.interpolation,"LINEAR")})});var i=getAnimatedNodes(n);return ForEach.node(n,function(e,t){defined(i[t])||defined(e.translation)||defined(e.rotation)||defined(e.scale)?(e.translation=defaultValue(e.translation,[0,0,0]),e.rotation=defaultValue(e.rotation,[0,0,0,1]),e.scale=defaultValue(e.scale,[1,1,1])):e.matrix=defaultValue(e.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}),ForEach.sampler(n,function(e){e.wrapS=defaultValue(e.wrapS,WebGLConstants$1.REPEAT),e.wrapT=defaultValue(e.wrapT,WebGLConstants$1.REPEAT)}),defined(n.scenes)&&!defined(n.scene)&&(n.scene=0),n}function getAnimatedNodes(e){var n={};return ForEach.animation(e,function(e){ForEach.animationChannel(e,function(e){var t=e.target,i=t.node,r=t.path;"translation"!==r&&"rotation"!==r&&"scale"!==r||(n[i]=!0)})}),n}function addTextureDefaults(e){defined(e)&&(e.texCoord=defaultValue(e.texCoord,0))}function addPipelineExtras(e){return ForEach.shader(e,function(e){addExtras(e)}),ForEach.buffer(e,function(e){addExtras(e)}),ForEach.image(e,function(e){addExtras(e),ForEach.compressedImage(e,function(e){addExtras(e)})}),addExtras(e),e}function addExtras(e){e.extras=defined(e.extras)?e.extras:{},e.extras._pipeline=defined(e.extras._pipeline)?e.extras._pipeline:{}}function removeExtensionsRequired(e,t){var i=e.extensionsRequired;if(defined(i)){var r=i.indexOf(t);0<=r&&i.splice(r,1),0===i.length&&delete e.extensionsRequired}}function removeExtensionsUsed(e,t){var i=e.extensionsUsed;if(defined(i)){var r=i.indexOf(t);0<=r&&i.splice(r,1),removeExtensionsRequired(e,t),0===i.length&&delete e.extensionsUsed}}LabelVisualizer.prototype.update=function(e){for(var t=this._items.values,i=this._cluster,r=0,n=t.length;r<n;r++){var a,o,s=t[r],l=s.entity,c=l._label,u=s.label,d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(o=Property.getValueOrUndefined(l._position,e,positionScratch$a),a=Property.getValueOrUndefined(c._text,e),d=defined(o)&&defined(a)),d){Property.isConstant(l._position)||(i._clusterDirty=!0);var h=!1,p=Property.getValueOrDefault(c._heightReference,e,defaultHeightReference$1);defined(u)||((u=i.getLabel(l)).id=l,s.label=u,h=Cartesian3.equals(u.position,o)&&u.heightReference===p),u.show=!0,u.position=o,u.text=a,u.scale=Property.getValueOrDefault(c._scale,e,defaultScale$2),u.font=Property.getValueOrDefault(c._font,e,defaultFont),u.style=Property.getValueOrDefault(c._style,e,defaultStyle),u.fillColor=Property.getValueOrDefault(c._fillColor,e,defaultFillColor,fillColorScratch),u.outlineColor=Property.getValueOrDefault(c._outlineColor,e,defaultOutlineColor$2,outlineColorScratch),u.outlineWidth=Property.getValueOrDefault(c._outlineWidth,e,defaultOutlineWidth$1),u.showBackground=Property.getValueOrDefault(c._showBackground,e,defaultShowBackground),u.backgroundColor=Property.getValueOrDefault(c._backgroundColor,e,defaultBackgroundColor,backgroundColorScratch),u.backgroundPadding=Property.getValueOrDefault(c._backgroundPadding,e,defaultBackgroundPadding,backgroundPaddingScratch),u.pixelOffset=Property.getValueOrDefault(c._pixelOffset,e,defaultPixelOffset$1,pixelOffsetScratch$1),u.eyeOffset=Property.getValueOrDefault(c._eyeOffset,e,defaultEyeOffset$1,eyeOffsetScratch$1),u.heightReference=p,u.horizontalOrigin=Property.getValueOrDefault(c._horizontalOrigin,e,defaultHorizontalOrigin$1),u.verticalOrigin=Property.getValueOrDefault(c._verticalOrigin,e,defaultVerticalOrigin$1),u.translucencyByDistance=Property.getValueOrUndefined(c._translucencyByDistance,e,translucencyByDistanceScratch$1),u.pixelOffsetScaleByDistance=Property.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,pixelOffsetScaleByDistanceScratch$1),u.scaleByDistance=Property.getValueOrUndefined(c._scaleByDistance,e,scaleByDistanceScratch$1),u.distanceDisplayCondition=Property.getValueOrUndefined(c._distanceDisplayCondition,e,distanceDisplayConditionScratch$6),u.disableDepthTestDistance=Property.getValueOrUndefined(c._disableDepthTestDistance,e),h&&u._updateClamping()}else returnPrimitive$1(s,l,i)}return!0},LabelVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);if(!defined(i)||!defined(i.label))return BoundingSphereState$1.FAILED;var r=i.label;return t.center=Cartesian3.clone(defaultValue(r._clampedPosition,r.position),t.center),t.radius=0,BoundingSphereState$1.DONE},LabelVisualizer.prototype.isDestroyed=function(){return!1},LabelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(LabelVisualizer.prototype._onCollectionChanged,this);for(var e=this._entityCollection.values,t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return destroyObject(this)},LabelVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._items,s=this._cluster;for(n=t.length-1;-1<n;n--)defined((a=t[n])._label)&&defined(a._position)&&o.set(a.id,new EntityData$1(a));for(n=r.length-1;-1<n;n--)defined((a=r[n])._label)&&defined(a._position)?o.contains(a.id)||o.set(a.id,new EntityData$1(a)):(returnPrimitive$1(o.get(a.id),a,s),o.remove(a.id));for(n=i.length-1;-1<n;n--)a=i[n],returnPrimitive$1(o.get(a.id),a,s),o.remove(a.id)},ForEach.objectLegacy=function(e,t){if(defined(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=t(e[i],i);if(defined(r))return r}},ForEach.object=function(e,t){if(defined(e))for(var i=e.length,r=0;r<i;r++){var n=t(e[r],r);if(defined(n))return n}},ForEach.topLevel=function(e,t,i){var r=e[t];return defined(r)&&!isArray$1(r)?ForEach.objectLegacy(r,i):ForEach.object(r,i)},ForEach.accessor=function(e,t){return ForEach.topLevel(e,"accessors",t)},ForEach.accessorWithSemantic=function(e,r,n){var a={};return ForEach.mesh(e,function(e){return ForEach.meshPrimitive(e,function(e){var t=ForEach.meshPrimitiveAttribute(e,function(e,t){if(0===t.indexOf(r)&&!defined(a[e])){a[e]=!0;var i=n(e);if(defined(i))return i}});return defined(t)?t:ForEach.meshPrimitiveTarget(e,function(e){return ForEach.meshPrimitiveTargetAttribute(e,function(e,t){if(0===t.indexOf(r)&&!defined(a[e])){a[e]=!0;var i=n(e);if(defined(i))return i}})})})})},ForEach.accessorContainingVertexAttributeData=function(e,i){var r={};return ForEach.mesh(e,function(e){return ForEach.meshPrimitive(e,function(e){var t=ForEach.meshPrimitiveAttribute(e,function(e){if(!defined(r[e])){r[e]=!0;var t=i(e);if(defined(t))return t}});return defined(t)?t:ForEach.meshPrimitiveTarget(e,function(e){return ForEach.meshPrimitiveTargetAttribute(e,function(e){if(!defined(r[e])){r[e]=!0;var t=i(e);if(defined(t))return t}})})})})},ForEach.accessorContainingIndexData=function(e,r){var n={};return ForEach.mesh(e,function(e){return ForEach.meshPrimitive(e,function(e){var t=e.indices;if(defined(t)&&!defined(n[t])){n[t]=!0;var i=r(t);if(defined(i))return i}})})},ForEach.animation=function(e,t){return ForEach.topLevel(e,"animations",t)},ForEach.animationChannel=function(e,t){var i=e.channels;return ForEach.object(i,t)},ForEach.animationSampler=function(e,t){var i=e.samplers;return ForEach.object(i,t)},ForEach.buffer=function(e,t){return ForEach.topLevel(e,"buffers",t)},ForEach.bufferView=function(e,t){return ForEach.topLevel(e,"bufferViews",t)},ForEach.camera=function(e,t){return ForEach.topLevel(e,"cameras",t)},ForEach.image=function(e,t){return ForEach.topLevel(e,"images",t)},ForEach.compressedImage=function(e,t){if(defined(e.extras)){var i=e.extras.compressedImage3DTiles;for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){var n=t(i[r],r);if(defined(n))return n}}},ForEach.material=function(e,t){return ForEach.topLevel(e,"materials",t)},ForEach.materialValue=function(e,t){var i=e.values;for(var r in defined(e.extensions)&&defined(e.extensions.KHR_techniques_webgl)&&(i=e.extensions.KHR_techniques_webgl.values),i)if(Object.prototype.hasOwnProperty.call(i,r)){var n=t(i[r],r);if(defined(n))return n}},ForEach.mesh=function(e,t){return ForEach.topLevel(e,"meshes",t)},ForEach.meshPrimitive=function(e,t){var i=e.primitives;if(defined(i))for(var r=i.length,n=0;n<r;n++){var a=t(i[n],n);if(defined(a))return a}},ForEach.meshPrimitiveAttribute=function(e,t){var i=e.attributes;for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){var n=t(i[r],r);if(defined(n))return n}},ForEach.meshPrimitiveTarget=function(e,t){var i=e.targets;if(defined(i))for(var r=i.length,n=0;n<r;++n){var a=t(i[n],n);if(defined(a))return a}},ForEach.meshPrimitiveTargetAttribute=function(e,t){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=t(e[i],i);if(defined(r))return r}},ForEach.node=function(e,t){return ForEach.topLevel(e,"nodes",t)},ForEach.nodeInTree=function(e,t,i){var r=e.nodes;if(defined(r))for(var n=t.length,a=0;a<n;a++){var o=t[a],s=r[o];if(defined(s)){var l=i(s,o);if(defined(l))return l;var c=s.children;if(defined(c)&&defined(l=ForEach.nodeInTree(e,c,i)))return l}}},ForEach.nodeInScene=function(e,t,i){var r=t.nodes;if(defined(r))return ForEach.nodeInTree(e,r,i)},ForEach.program=function(e,t){return hasExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.programs,t):ForEach.topLevel(e,"programs",t)},ForEach.sampler=function(e,t){return ForEach.topLevel(e,"samplers",t)},ForEach.scene=function(e,t){return ForEach.topLevel(e,"scenes",t)},ForEach.shader=function(e,t){return hasExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.shaders,t):ForEach.topLevel(e,"shaders",t)},ForEach.skin=function(e,t){return ForEach.topLevel(e,"skins",t)},ForEach.skinJoint=function(e,t){var i=e.joints;if(defined(i))for(var r=i.length,n=0;n<r;n++){var a=t(i[n]);if(defined(a))return a}},ForEach.techniqueAttribute=function(e,t){var i=e.attributes;for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){var n=t(i[r],r);if(defined(n))return n}},ForEach.techniqueUniform=function(e,t){var i=e.uniforms;for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){var n=t(i[r],r);if(defined(n))return n}},ForEach.techniqueParameter=function(e,t){var i=e.parameters;for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){var n=t(i[r],r);if(defined(n))return n}},ForEach.technique=function(e,t){return hasExtension(e,"KHR_techniques_webgl")?ForEach.object(e.extensions.KHR_techniques_webgl.techniques,t):ForEach.topLevel(e,"techniques",t)},ForEach.texture=function(e,t){return ForEach.topLevel(e,"textures",t)};var sizeOfUint32$2=4;function parseGlb(e){if("glTF"!==getMagic(e))throw new RuntimeError("File is not valid binary glTF");var t=readHeader(e,0,5),i=t[1];if(1!==i&&2!==i)throw new RuntimeError("Binary glTF version is not 1 or 2");return 1===i?parseGlbVersion1(e,t):parseGlbVersion2(e,t)}function readHeader(e,t,i){for(var r=new DataView(e.buffer),n=new Array(i),a=0;a<i;++a)n[a]=r.getUint32(e.byteOffset+t+a*sizeOfUint32$2,!0);return n}function parseGlbVersion1(e,t){var i=t[2],r=t[3];if(0!==t[4])throw new RuntimeError("Binary glTF scene format is not JSON");var n=20+r,a=getStringFromTypedArray(e,20,r),o=JSON.parse(a);addPipelineExtras(o);var s=e.subarray(n,i),l=o.buffers;if(defined(l)&&0<Object.keys(l).length){var c=defaultValue(l.binary_glTF,l.KHR_binary_glTF);defined(c)&&(c.extras._pipeline.source=s)}return removeExtensionsUsed(o,"KHR_binary_glTF"),o}function parseGlbVersion2(e,t){for(var i,r,n=t[2],a=12;a<n;){var o=readHeader(e,a,2),s=o[0],l=o[1];a+=8;var c=e.subarray(a,a+s);if(a+=s,1313821514===l){var u=getStringFromTypedArray(c);addPipelineExtras(i=JSON.parse(u))}else 5130562===l&&(r=c)}if(defined(i)&&defined(r)){var d=i.buffers;if(defined(d)&&0<d.length)d[0].extras._pipeline.source=r}return i}function addExtensionsUsed(e,t){var i=e.extensionsUsed;defined(i)||(i=[],e.extensionsUsed=i),addToArray(i,t,!0)}function getComponentReader(e){switch(e){case ComponentDatatype$1.BYTE:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getInt8(t+a*r)};case ComponentDatatype$1.UNSIGNED_BYTE:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getUint8(t+a*r)};case ComponentDatatype$1.SHORT:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getInt16(t+a*r,!0)};case ComponentDatatype$1.UNSIGNED_SHORT:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getUint16(t+a*r,!0)};case ComponentDatatype$1.INT:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getInt32(t+a*r,!0)};case ComponentDatatype$1.UNSIGNED_INT:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getUint32(t+a*r,!0)};case ComponentDatatype$1.FLOAT:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getFloat32(t+a*r,!0)};case ComponentDatatype$1.DOUBLE:return function(e,t,i,r,n){for(var a=0;a<i;++a)n[a]=e.getFloat64(t+a*r,!0)}}}function findAccessorMinMax(e,t){var i=e.bufferViews,r=e.buffers,n=t.bufferView,a=numberOfComponentsForType(t.type);if(!defined(t.bufferView))return{min:arrayFill(new Array(a),0),max:arrayFill(new Array(a),0)};for(var o=arrayFill(new Array(a),Number.POSITIVE_INFINITY),s=arrayFill(new Array(a),Number.NEGATIVE_INFINITY),l=i[n],c=r[l.buffer].extras._pipeline.source,u=t.count,d=getAccessorByteStride(e,t),h=t.byteOffset+l.byteOffset+c.byteOffset,p=t.componentType,m=ComponentDatatype$1.getSizeInBytes(p),f=new DataView(c.buffer),g=new Array(a),_=getComponentReader(p),y=0;y<u;y++){_(f,h,a,m,g);for(var v=0;v<a;v++){var C=g[v];o[v]=Math.min(o[v],C),s[v]=Math.max(s[v],C)}h+=d}return{min:o,max:s}}var defaultBlendEquation=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],defaultBlendFactors=[WebGLConstants$1.ONE,WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.ZERO];function isStateEnabled(e,t){var i=e.enable;return!!defined(i)&&-1<i.indexOf(t)}var supportedBlendFactors=[WebGLConstants$1.ZERO,WebGLConstants$1.ONE,WebGLConstants$1.SRC_COLOR,WebGLConstants$1.ONE_MINUS_SRC_COLOR,WebGLConstants$1.SRC_ALPHA,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.DST_ALPHA,WebGLConstants$1.ONE_MINUS_DST_ALPHA,WebGLConstants$1.DST_COLOR,WebGLConstants$1.ONE_MINUS_DST_COLOR];function getSupportedBlendFactors(e,t){if(!defined(e))return t;for(var i=0;i<4;i++)if(-1===supportedBlendFactors.indexOf(e[i]))return t;return e}function moveTechniqueRenderStates(e){var a={},o={};return defined(e.techniques)&&(ForEach.technique(e,function(e,t){var i=e.states;if(defined(i)){var r=o[t]={};if(isStateEnabled(i,WebGLConstants$1.BLEND)){r.alphaMode="BLEND";var n=i.functions;defined(n)&&(defined(n.blendEquationSeparate)||defined(n.blendFuncSeparate))&&(a[t]={blendEquation:defaultValue(n.blendEquationSeparate,defaultBlendEquation),blendFactors:getSupportedBlendFactors(n.blendFuncSeparate,defaultBlendFactors)})}isStateEnabled(i,WebGLConstants$1.CULL_FACE)||(r.doubleSided=!0),delete e.states}}),0<Object.keys(a).length&&(defined(e.extensions)||(e.extensions={}),addExtensionsUsed(e,"KHR_blend")),ForEach.material(e,function(i){if(defined(i.technique)){var e=o[i.technique];ForEach.objectLegacy(e,function(e,t){i[t]=e});var t=a[i.technique];defined(t)&&(defined(i.extensions)||(i.extensions={}),i.extensions.KHR_blend=t)}})),e}function addExtensionsRequired(e,t){var i=e.extensionsRequired;defined(i)||(i=[],e.extensionsRequired=i),addToArray(i,t,!0),addExtensionsUsed(e,t)}function moveTechniquesToExtension(l){var e=l.techniques,c={},u={};if(defined(e)){var d={programs:[],shaders:[],techniques:[]},h=l.glExtensionsUsed;delete l.glExtensionsUsed,ForEach.technique(l,function(i,e){var r,n={name:i.name,program:void 0,attributes:{},uniforms:{}};ForEach.techniqueAttribute(i,function(e,t){r=i.parameters[e],n.attributes[t]={semantic:r.semantic}}),ForEach.techniqueUniform(i,function(e,t){r=i.parameters[e],n.uniforms[t]={count:r.count,node:r.node,type:r.type,semantic:r.semantic,value:r.value},c[e]=t});var t=l.programs[i.program],a={name:t.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:h},o=l.shaders[t.fragmentShader];a.fragmentShader=addToArray(d.shaders,o,!0);var s=l.shaders[t.vertexShader];a.vertexShader=addToArray(d.shaders,s,!0),n.program=addToArray(d.programs,a),u[e]=addToArray(d.techniques,n)}),0<d.techniques.length&&(defined(l.extensions)||(l.extensions={}),l.extensions.KHR_techniques_webgl=d,addExtensionsUsed(l,"KHR_techniques_webgl"),addExtensionsRequired(l,"KHR_techniques_webgl"))}return ForEach.material(l,function(e){if(defined(e.technique)){var r={technique:u[e.technique]};ForEach.objectLegacy(e.values,function(e,t){defined(r.values)||(r.values={});var i=c[t];r.values[i]=e}),defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r}delete e.technique,delete e.values}),delete l.techniques,delete l.programs,delete l.shaders,l}var allElementTypes=["mesh","node","material","accessor","bufferView","buffer"];function removeUnusedElements(t,i){return i=defaultValue(i,allElementTypes),allElementTypes.forEach(function(e){-1<i.indexOf(e)&&removeUnusedElementsByType(t,e)}),t}var TypeToGltfElementName={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",node:"nodes",material:"materials",mesh:"meshes"};function removeUnusedElementsByType(e,t){var i=e[TypeToGltfElementName[t]];if(defined(i))for(var r=0,n=getListOfElementsIdsInUse[t](e),a=i.length,o=0;o<a;++o)n[o]||(Remove[t](e,o-r),r++)}function Remove(){}function getListOfElementsIdsInUse(){}function nodeIsEmpty(t,e){return!(defined(e.mesh)||defined(e.camera)||defined(e.skin)||defined(e.weights)||defined(e.extras)||defined(e.extensions)&&0!==e.extensions.length)&&(!defined(e.children)||0===e.children.filter(function(e){return!nodeIsEmpty(t,t.nodes[e])}).length)}function addBuffer(e,t){var i={byteLength:t.length,extras:{_pipeline:{source:t}}},r={buffer:addToArray(e.buffers,i),byteOffset:0,byteLength:t.length};return addToArray(e.bufferViews,r)}function readAccessorPacked(e,t){var i=getAccessorByteStride(e,t),r=ComponentDatatype$1.getSizeInBytes(t.componentType),n=numberOfComponentsForType(t.type),a=t.count,o=new Array(n*a);if(!defined(t.bufferView))return arrayFill(o,0),o;for(var s=e.bufferViews[t.bufferView],l=e.buffers[s.buffer].extras._pipeline.source,c=t.byteOffset+s.byteOffset+l.byteOffset,u=new DataView(l.buffer),d=new Array(n),h=getComponentReader(t.componentType),p=0;p<a;++p){h(u,c,n,r,d);for(var m=0;m<n;++m)o[p*n+m]=d[m];c+=i}return o}function updateAccessorComponentTypes(i){var r;return ForEach.accessorWithSemantic(i,"JOINTS_0",function(e){var t=i.accessors[e];(r=t.componentType)===WebGLConstants$1.BYTE?convertType(i,t,ComponentDatatype$1.UNSIGNED_BYTE):r!==WebGLConstants$1.UNSIGNED_BYTE&&r!==WebGLConstants$1.UNSIGNED_SHORT&&convertType(i,t,ComponentDatatype$1.UNSIGNED_SHORT)}),ForEach.accessorWithSemantic(i,"WEIGHTS_0",function(e){var t=i.accessors[e];(r=t.componentType)===WebGLConstants$1.BYTE?convertType(i,t,ComponentDatatype$1.UNSIGNED_BYTE):r===WebGLConstants$1.SHORT&&convertType(i,t,ComponentDatatype$1.UNSIGNED_SHORT)}),i}function convertType(e,t,i){var r=ComponentDatatype$1.createTypedArray(i,readAccessorPacked(e,t)),n=new Uint8Array(r.buffer);t.bufferView=addBuffer(e,n),t.componentType=i,t.byteOffset=0}Remove.accessor=function(e,r){e.accessors.splice(r,1),ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(i){ForEach.meshPrimitiveAttribute(i,function(e,t){r<e&&i.attributes[t]--}),ForEach.meshPrimitiveTarget(i,function(i){ForEach.meshPrimitiveTargetAttribute(i,function(e,t){r<e&&i[t]--})});var e=i.indices;defined(e)&&r<e&&i.indices--})}),ForEach.skin(e,function(e){defined(e.inverseBindMatrices)&&e.inverseBindMatrices>r&&e.inverseBindMatrices--}),ForEach.animation(e,function(e){ForEach.animationSampler(e,function(e){defined(e.input)&&e.input>r&&e.input--,defined(e.output)&&e.output>r&&e.output--})})},Remove.buffer=function(e,t){e.buffers.splice(t,1),ForEach.bufferView(e,function(e){defined(e.buffer)&&e.buffer>t&&e.buffer--})},Remove.bufferView=function(e,i){e.bufferViews.splice(i,1),ForEach.accessor(e,function(e){defined(e.bufferView)&&e.bufferView>i&&e.bufferView--}),ForEach.shader(e,function(e){defined(e.bufferView)&&e.bufferView>i&&e.bufferView--}),ForEach.image(e,function(e){defined(e.bufferView)&&e.bufferView>i&&e.bufferView--,ForEach.compressedImage(e,function(e){var t=e.bufferView;defined(t)&&i<t&&e.bufferView--})}),hasExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&e.extensions.KHR_draco_mesh_compression.bufferView>i&&e.extensions.KHR_draco_mesh_compression.bufferView--})})},Remove.mesh=function(e,t){e.meshes.splice(t,1),ForEach.node(e,function(e){defined(e.mesh)&&(e.mesh>t?e.mesh--:e.mesh===t&&delete e.mesh)})},Remove.node=function(e,t){e.nodes.splice(t,1),ForEach.skin(e,function(e){defined(e.skeleton)&&e.skeleton>t&&e.skeleton--,e.joints=e.joints.map(function(e){return t<e?e-1:e})}),ForEach.animation(e,function(e){ForEach.animationChannel(e,function(e){defined(e.target)&&defined(e.target.node)&&e.target.node>t&&e.target.node--})}),ForEach.technique(e,function(e){ForEach.techniqueUniform(e,function(e){defined(e.node)&&e.node>t&&e.node--})}),ForEach.node(e,function(e){defined(e.children)&&(e.children=e.children.filter(function(e){return e!==t}).map(function(e){return t<e?e-1:e}))}),ForEach.scene(e,function(e){e.nodes=e.nodes.filter(function(e){return e!==t}).map(function(e){return t<e?e-1:e})})},Remove.material=function(e,t){e.materials.splice(t,1),ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){defined(e.material)&&e.material>t&&e.material--})})},getListOfElementsIdsInUse.accessor=function(e){var i={};return ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){ForEach.meshPrimitiveAttribute(e,function(e){i[e]=!0}),ForEach.meshPrimitiveTarget(e,function(e){ForEach.meshPrimitiveTargetAttribute(e,function(e){i[e]=!0})});var t=e.indices;defined(t)&&(i[t]=!0)})}),ForEach.skin(e,function(e){defined(e.inverseBindMatrices)&&(i[e.inverseBindMatrices]=!0)}),ForEach.animation(e,function(e){ForEach.animationSampler(e,function(e){defined(e.input)&&(i[e.input]=!0),defined(e.output)&&(i[e.output]=!0)})}),i},getListOfElementsIdsInUse.buffer=function(e){var t={};return ForEach.bufferView(e,function(e){defined(e.buffer)&&(t[e.buffer]=!0)}),t},getListOfElementsIdsInUse.bufferView=function(e){var t={};return ForEach.accessor(e,function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)}),ForEach.shader(e,function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)}),ForEach.image(e,function(e){defined(e.bufferView)&&(t[e.bufferView]=!0),ForEach.compressedImage(e,function(e){defined(e.bufferView)&&(t[e.bufferView]=!0)})}),hasExtension(e,"KHR_draco_mesh_compression")&&ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){defined(e.extensions)&&defined(e.extensions.KHR_draco_mesh_compression)&&(t[e.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),t},getListOfElementsIdsInUse.mesh=function(i){var r={};return ForEach.node(i,function(e){if(defined(e.mesh&&defined(i.meshes))){var t=i.meshes[e.mesh];defined(t)&&defined(t.primitives)&&0<t.primitives.length&&(r[e.mesh]=!0)}}),r},getListOfElementsIdsInUse.node=function(i){var r={};return ForEach.node(i,function(e,t){nodeIsEmpty(i,e)||(r[t]=!0)}),ForEach.skin(i,function(e){defined(e.skeleton)&&(r[e.skeleton]=!0),ForEach.skinJoint(e,function(e){r[e]=!0})}),ForEach.animation(i,function(e){ForEach.animationChannel(e,function(e){defined(e.target)&&defined(e.target.node)&&(r[e.target.node]=!0)})}),ForEach.technique(i,function(e){ForEach.techniqueUniform(e,function(e){defined(e.node)&&(r[e.node]=!0)})}),r},getListOfElementsIdsInUse.material=function(e){var t={};return ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){defined(e.material)&&(t[e.material]=!0)})}),t};var updateFunctions={.8:glTF08to10,"1.0":glTF10to20,"2.0":void 0};function updateVersion(e,t){var i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).targetVersion,r=e.version;e.asset=defaultValue(e.asset,{version:"1.0"}),e.asset.version=defaultValue(e.asset.version,"1.0"),r=defaultValue(r,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(updateFunctions,r)||(defined(r)&&(r=r.substring(0,3)),Object.prototype.hasOwnProperty.call(updateFunctions,r)||(r="1.0"));for(var n=updateFunctions[r];defined(n)&&r!==i;)n(e,t),r=e.asset.version,n=updateFunctions[r];return e}function updateInstanceTechniques(e){var t=e.materials;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i],n=r.instanceTechnique;defined(n)&&(r.technique=n.technique,r.values=n.values,delete r.instanceTechnique)}}function setPrimitiveModes(e){var t=e.meshes;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i].primitives;if(defined(r))for(var n=r.length,a=0;a<n;++a){var o=r[a],s=defaultValue(o.primitive,WebGLConstants$1.TRIANGLES);o.mode=defaultValue(o.mode,s),delete o.primitive}}}function updateNodes(e){var t=e.nodes,i=new Cartesian3,r=new Quaternion;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];if(defined(a.rotation)){var o=a.rotation;Cartesian3.fromArray(o,0,i),Quaternion.fromAxisAngle(i,o[3],r),a.rotation=[r.x,r.y,r.z,r.w]}var s=a.instanceSkin;defined(s)&&(a.skeletons=s.skeletons,a.skin=s.skin,a.meshes=s.meshes,delete a.instanceSkin)}}function updateAnimations(e){var t=e.animations,i=e.accessors,r=e.bufferViews,n=e.buffers,a={},o=new Cartesian3,s=new Quaternion;for(var l in t)if(Object.prototype.hasOwnProperty.call(t,l)){var c=t[l],u=c.channels,d=c.parameters,h=c.samplers;if(defined(u))for(var p=u.length,m=0;m<p;++m){var f=u[m];if("rotation"===f.target.path){var g=d[h[f.sampler].output];if(defined(a[g]))continue;a[g]=!0;for(var _=i[g],y=r[_.bufferView],v=n[y.buffer].extras._pipeline.source,C=v.byteOffset+y.byteOffset+_.byteOffset,S=_.componentType,x=_.count,T=numberOfComponentsForType(_.type),b=_.count*T,E=ComponentDatatype$1.createArrayBufferView(S,v.buffer,C,b),P=0;P<x;P++){var A=P*T;Cartesian3.unpack(E,A,o);var w=E[3+A];Quaternion.fromAxisAngle(o,w,s),Quaternion.pack(s,E,A)}}}}}function removeTechniquePasses(e){var t=e.techniques;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i],n=r.passes;if(defined(n)){var a=defaultValue(r.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(n,a)){var o=n[a],s=o.instanceProgram;r.attributes=defaultValue(r.attributes,s.attributes),r.program=defaultValue(r.program,s.program),r.uniforms=defaultValue(r.uniforms,s.uniforms),r.states=defaultValue(r.states,o.states)}delete r.passes,delete r.pass}}}function glTF08to10(e){defined(e.asset)||(e.asset={});var t=e.asset;if(t.version="1.0","string"==typeof t.profile){var i=t.profile.split(" ");t.profile={api:i[0],version:i[1]}}else t.profile={};if(defined(e.version)&&delete e.version,updateInstanceTechniques(e),setPrimitiveModes(e),updateNodes(e),updateAnimations(e),removeTechniquePasses(e),defined(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),defined(e.lights)){var r=defaultValue(e.extensions,{}),n=defaultValue((e.extensions=r).KHR_materials_common,{});(r.KHR_materials_common=n).lights=e.lights,delete e.lights,addExtensionsUsed(e,"KHR_materials_common")}}function removeAnimationSamplersIndirection(e){var t=e.animations;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i],n=r.parameters;if(defined(n)){var a=r.samplers;for(var o in a)if(Object.prototype.hasOwnProperty.call(a,o)){var s=a[o];s.input=n[s.input],s.output=n[s.output]}delete r.parameters}}}function objectToArray(e,t){var i=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];t[r]=i.length,i.push(n),defined(n.name)||(n.name=r)}return i}function objectsToArrays(l){var c,e,u={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}},n={},t=l.nodes;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&defined(e=t[i].jointName)&&(n[e]=i);for(var r in l)if(Object.prototype.hasOwnProperty.call(l,r)&&defined(u[r])){var a={},o=l[r];l[r]=objectToArray(o,a),u[r]=a}for(e in n)Object.prototype.hasOwnProperty.call(n,e)&&(n[e]=u.nodes[n[e]]);defined(l.scene)&&(l.scene=u.scenes[l.scene]),ForEach.bufferView(l,function(e){defined(e.buffer)&&(e.buffer=u.buffers[e.buffer])}),ForEach.accessor(l,function(e){defined(e.bufferView)&&(e.bufferView=u.bufferViews[e.bufferView])}),ForEach.shader(l,function(e){var t=e.extensions;if(defined(t)){var i=t.KHR_binary_glTF;defined(i)&&(e.bufferView=u.bufferViews[i.bufferView],delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}}),ForEach.program(l,function(e){defined(e.vertexShader)&&(e.vertexShader=u.shaders[e.vertexShader]),defined(e.fragmentShader)&&(e.fragmentShader=u.shaders[e.fragmentShader])}),ForEach.technique(l,function(e){defined(e.program)&&(e.program=u.programs[e.program]),ForEach.techniqueParameter(e,function(e){defined(e.node)&&(e.node=u.nodes[e.node]);var t=e.value;"string"==typeof t&&(e.value={index:u.textures[t]})})}),ForEach.mesh(l,function(e){ForEach.meshPrimitive(e,function(i){defined(i.indices)&&(i.indices=u.accessors[i.indices]),ForEach.meshPrimitiveAttribute(i,function(e,t){i.attributes[t]=u.accessors[e]}),defined(i.material)&&(i.material=u.materials[i.material])})}),ForEach.node(l,function(e){var t=e.children;if(defined(t)){var i=t.length;for(c=0;c<i;++c)t[c]=u.nodes[t[c]]}if(defined(e.meshes)){var r=e.meshes,n=r.length;if(0<n)for(e.mesh=u.meshes[r[0]],c=1;c<n;++c){var a={mesh:u.meshes[r[c]]},o=addToArray(l.nodes,a);defined(t)||(t=[],e.children=t),t.push(o)}delete e.meshes}if(defined(e.camera)&&(e.camera=u.cameras[e.camera]),defined(e.skin)&&(e.skin=u.skins[e.skin]),defined(e.skeletons)){var s=e.skeletons;if(0<s.length&&defined(e.skin))l.skins[e.skin].skeleton=u.nodes[s[0]];delete e.skeletons}defined(e.jointName)&&delete e.jointName}),ForEach.skin(l,function(e){defined(e.inverseBindMatrices)&&(e.inverseBindMatrices=u.accessors[e.inverseBindMatrices]);var t=e.jointNames;if(defined(t)){var i=[],r=t.length;for(c=0;c<r;++c)i[c]=n[t[c]];e.joints=i,delete e.jointNames}}),ForEach.scene(l,function(e){var t=e.nodes;if(defined(t)){var i=t.length;for(c=0;c<i;++c)t[c]=u.nodes[t[c]]}}),ForEach.animation(l,function(e){var i={};e.samplers=objectToArray(e.samplers,i),ForEach.animationSampler(e,function(e){e.input=u.accessors[e.input],e.output=u.accessors[e.output]}),ForEach.animationChannel(e,function(e){e.sampler=i[e.sampler];var t=e.target;defined(t)&&(t.node=u.nodes[t.id],delete t.id)})}),ForEach.material(l,function(i){defined(i.technique)&&(i.technique=u.techniques[i.technique]),ForEach.materialValue(i,function(e,t){"string"==typeof e&&(i.values[t]={index:u.textures[e]})});var e=i.extensions;if(defined(e)){var r=e.KHR_materials_common;defined(r)&&ForEach.materialValue(r,function(e,t){"string"==typeof e&&(r.values[t]={index:u.textures[e]})})}}),ForEach.image(l,function(e){var r=e.extensions;if(defined(r)){var t=r.KHR_binary_glTF;defined(t)&&(e.bufferView=u.bufferViews[t.bufferView],e.mimeType=t.mimeType,delete r.KHR_binary_glTF),0===Object.keys(r).length&&delete e.extensions}ForEach.compressedImage(e,function(e){var t=e.extensions;if(defined(t)){var i=t.KHR_binary_glTF;defined(i)&&(e.bufferView=u.bufferViews[i.bufferView],e.mimeType=i.mimeType,delete t.KHR_binary_glTF),0===Object.keys(r).length&&delete e.extensions}})}),ForEach.texture(l,function(e){defined(e.sampler)&&(e.sampler=u.samplers[e.sampler]),defined(e.source)&&(e.source=u.images[e.source])})}function removeAnimationSamplerNames(e){ForEach.animation(e,function(e){ForEach.animationSampler(e,function(e){delete e.name})})}function removeEmptyArrays(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];isArray$1(i)&&0===i.length&&delete e[t]}ForEach.node(e,function(e){defined(e.children)&&0===e.children.length&&delete e.children})}function stripAsset(e){var t=e.asset;delete t.profile,delete t.premultipliedAlpha}var knownExtensions={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function requireKnownExtensions(e){var t=e.extensionsUsed;if(e.extensionsRequired=defaultValue(e.extensionsRequired,[]),defined(t))for(var i=t.length,r=0;r<i;++r){var n=t[r];defined(knownExtensions[n])&&e.extensionsRequired.push(n)}}function removeBufferType(e){ForEach.buffer(e,function(e){delete e.type})}function removeTextureProperties(e){ForEach.texture(e,function(e){delete e.format,delete e.internalFormat,delete e.target,delete e.type})}function requireAttributeSetIndex(e){ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(i){ForEach.meshPrimitiveAttribute(i,function(e,t){"TEXCOORD"===t?i.attributes.TEXCOORD_0=e:"COLOR"===t&&(i.attributes.COLOR_0=e)}),delete i.attributes.TEXCOORD,delete i.attributes.COLOR})}),ForEach.technique(e,function(e){ForEach.techniqueParameter(e,function(e){var t=e.semantic;defined(t)&&("TEXCOORD"===t?e.semantic="TEXCOORD_0":"COLOR"===t&&(e.semantic="COLOR_0"))})})}var knownSemantics={POSITION:!0,NORMAL:!0,TANGENT:!0},indexedSemantics={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function underscoreApplicationSpecificSemantics(e){var s={};ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){for(var t in ForEach.meshPrimitiveAttribute(e,function(e,t){if("_"!==t.charAt(0)){var i,r=t.search(/_[0-9]+/g),n=t,a="_0";0<=r&&(n=t.substring(0,r),a=t.substring(r));var o=indexedSemantics[n];defined(o)?(i=o+a,s[t]=i):defined(knownSemantics[n])||(i="_"+t,s[t]=i)}}),s)if(Object.prototype.hasOwnProperty.call(s,t)){var i=s[t],r=e.attributes[t];defined(r)&&(delete e.attributes[t],e.attributes[i]=r)}})}),ForEach.technique(e,function(e){ForEach.techniqueParameter(e,function(e){var t=s[e.semantic];defined(t)&&(e.semantic=t)})})}function clampCameraParameters(e){ForEach.camera(e,function(e){var t=e.perspective;if(defined(t)){var i=t.aspectRatio;defined(i)&&0===i&&delete t.aspectRatio;var r=t.yfov;defined(r)&&0===r&&(t.yfov=1)}})}function computeAccessorByteStride(e,t){return defined(t.byteStride)&&0!==t.byteStride?t.byteStride:getAccessorByteStride(e,t)}function requireByteLength(a){ForEach.buffer(a,function(e){defined(e.byteLength)||(e.byteLength=e.extras._pipeline.source.length)}),ForEach.accessor(a,function(e){var t=e.bufferView;if(defined(t)){var i=a.bufferViews[t],r=computeAccessorByteStride(a,e),n=e.byteOffset+e.count*r;i.byteLength=Math.max(defaultValue(i.byteLength,0),n)}})}function moveByteStrideToBufferView(i){var e,t,r,n=i.bufferViews,a={};ForEach.accessorContainingVertexAttributeData(i,function(e){var t=i.accessors[e];defined(t.bufferView)&&(a[t.bufferView]=!0)});var o={};for(var s in ForEach.accessor(i,function(e){defined(e.bufferView)&&(o[e.bufferView]=defaultValue(o[e.bufferView],[]),o[e.bufferView].push(e))}),o)if(Object.prototype.hasOwnProperty.call(o,s)){r=n[s];var l=o[s];l.sort(function(e,t){return e.byteOffset-t.byteOffset});var c=0,u=0,d=l.length;for(e=0;e<d;++e){var h=l[e],p=computeAccessorByteStride(i,h),m=h.byteOffset,f=h.count*p;delete h.byteStride;var g=e<d-1;if(p!==(g?computeAccessorByteStride(i,l[e+1]):void 0)){var _=clone(r,!0);a[s]&&(_.byteStride=p),_.byteOffset+=c,_.byteLength=m+f-c;var y=addToArray(n,_);for(t=u;t<=e;++t)(h=l[t]).bufferView=y,h.byteOffset=h.byteOffset-c;c=g?l[e+1].byteOffset:void 0,u=e+1}}}removeUnusedElements(i,["accessor","bufferView","buffer"])}function requirePositionAccessorMinMax(r){ForEach.accessorWithSemantic(r,"POSITION",function(e){var t=r.accessors[e];if(!defined(t.min)||!defined(t.max)){var i=findAccessorMinMax(r,t);t.min=i.min,t.max=i.max}})}function isNodeEmpty(e){return(!defined(e.children)||0===e.children.length)&&(!defined(e.meshes)||0===e.meshes.length)&&!defined(e.camera)&&!defined(e.skin)&&!defined(e.skeletons)&&!defined(e.jointName)&&(!defined(e.translation)||Cartesian3.fromArray(e.translation).equals(Cartesian3.ZERO))&&(!defined(e.scale)||Cartesian3.fromArray(e.scale).equals(new Cartesian3(1,1,1)))&&(!defined(e.rotation)||Cartesian4.fromArray(e.rotation).equals(new Cartesian4(0,0,0,1)))&&(!defined(e.matrix)||Matrix4.fromColumnMajorArray(e.matrix).equals(Matrix4.IDENTITY))&&!defined(e.extensions)&&!defined(e.extras)}function deleteNode(r,n){ForEach.scene(r,function(e){var t=e.nodes;if(defined(t))for(var i=t.length;0<=i;--i)if(t[i]===n)return void t.splice(i,1)}),ForEach.node(r,function(e,t){if(defined(e.children)){var i=e.children.indexOf(n);-1<i&&(e.children.splice(i,1),isNodeEmpty(e)&&deleteNode(r,t))}}),delete r.nodes[n]}function removeEmptyNodes(i){return ForEach.node(i,function(e,t){isNodeEmpty(e)&&deleteNode(i,t)}),i}function requireAnimationAccessorMinMax(r){ForEach.animation(r,function(e){ForEach.animationSampler(e,function(e){var t=r.accessors[e.input];if(!defined(t.min)||!defined(t.max)){var i=findAccessorMinMax(r,t);t.min=i.min,t.max=i.max}})})}function glTF10to20(e){e.asset=defaultValue(e.asset,{}),e.asset.version="2.0",updateInstanceTechniques(e),removeAnimationSamplersIndirection(e),removeEmptyNodes(e),objectsToArrays(e),removeAnimationSamplerNames(e),stripAsset(e),requireKnownExtensions(e),requireByteLength(e),moveByteStrideToBufferView(e),requirePositionAccessorMinMax(e),requireAnimationAccessorMinMax(e),removeBufferType(e),removeTextureProperties(e),requireAttributeSetIndex(e),underscoreApplicationSpecificSemantics(e),updateAccessorComponentTypes(e),clampCameraParameters(e),moveTechniqueRenderStates(e),moveTechniquesToExtension(e),removeEmptyArrays(e)}var Axis={X:0,Y:1,Z:2,Y_UP_TO_Z_UP:Matrix4.fromRotationTranslation(Matrix3.fromRotationX(CesiumMath.PI_OVER_TWO)),Z_UP_TO_Y_UP:Matrix4.fromRotationTranslation(Matrix3.fromRotationX(-CesiumMath.PI_OVER_TWO)),X_UP_TO_Z_UP:Matrix4.fromRotationTranslation(Matrix3.fromRotationY(-CesiumMath.PI_OVER_TWO)),Z_UP_TO_X_UP:Matrix4.fromRotationTranslation(Matrix3.fromRotationY(CesiumMath.PI_OVER_TWO)),X_UP_TO_Y_UP:Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(CesiumMath.PI_OVER_TWO)),Y_UP_TO_X_UP:Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(-CesiumMath.PI_OVER_TWO)),fromName:function(e){return Axis[e]}},Axis$1=freezeObject$1(Axis);function ClippingPlane(e,t){this._distance=t,this._normal=new UpdateChangedCartesian3(e,this),this.onChangeCallback=void 0,this.index=-1}function UpdateChangedCartesian3(e,t){this._clippingPlane=t,this._cartesian3=Cartesian3.clone(e)}function ClippingPlaneCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=defaultValue(e.enabled,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.edgeColor=Color.clone(defaultValue(e.edgeColor,Color.WHITE)),this.edgeWidth=defaultValue(e.edgeWidth,0),this.planeAdded=new Event,this.planeRemoved=new Event,this._owner=void 0;var t=defaultValue(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?unionIntersectFunction:defaultIntersectFunction,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;var i=e.planes;if(defined(i))for(var r=i.length,n=0;n<r;++n)this.add(i[n])}function unionIntersectFunction(e){return e===Intersect$1.OUTSIDE}function defaultIntersectFunction(e){return e===Intersect$1.INSIDE}function setIndexDirty(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||-1!==e._dirtyIndex&&e._dirtyIndex!==t,e._dirtyIndex=t}function indexOf(e,t){for(var i=e.length,r=0;r<i;++r)if(Plane.equals(e[r],t))return r;return-1}defineProperties$1(ClippingPlane.prototype,{distance:{get:function(){return this._distance},set:function(e){defined(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){defined(this.onChangeCallback)&&!Cartesian3.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),Cartesian3.clone(e,this._normal._cartesian3)}}}),ClippingPlane.fromPlane=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance):t=new ClippingPlane(e.normal,e.distance),t},ClippingPlane.clone=function(e,t){return defined(t)?(t.normal=e.normal,t.distance=e.distance,t):new ClippingPlane(e.normal,e.distance)},defineProperties$1(UpdateChangedCartesian3.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){defined(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){defined(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){defined(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}}),defineProperties$1(ClippingPlaneCollection.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?unionIntersectFunction:defaultIntersectFunction)}},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}}}),ClippingPlaneCollection.prototype.add=function(e){var t=this._planes.length,i=this;e.onChangeCallback=function(e){setIndexDirty(i,e)},setIndexDirty(this,e.index=t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)},ClippingPlaneCollection.prototype.get=function(e){return this._planes[e]},ClippingPlaneCollection.prototype.contains=function(e){return-1!==indexOf(this._planes,e)},ClippingPlaneCollection.prototype.remove=function(e){var t=this._planes,i=indexOf(t,e);if(-1===i)return!1;e instanceof ClippingPlane&&(e.onChangeCallback=void 0,e.index=-1);for(var r=t.length-1,n=i;n<r;++n){var a=t[n+1];(t[n]=a)instanceof ClippingPlane&&(a.index=n)}return this._multipleDirtyPlanes=!0,t.length=r,this.planeRemoved.raiseEvent(e,i),!0},ClippingPlaneCollection.prototype.removeAll=function(){for(var e=this._planes,t=e.length,i=0;i<t;++i){var r=e[i];r instanceof ClippingPlane&&(r.onChangeCallback=void 0,r.index=-1),this.planeRemoved.raiseEvent(r,i)}this._multipleDirtyPlanes=!0,this._planes=[]};var distanceEncodeScratch=new Cartesian4,oct32EncodeScratch=new Cartesian4;function packPlanesAsUint8(e,t,i){for(var r=e._uint8View,n=e._planes,a=0,o=t;o<i;++o){var s=n[o],l=AttributeCompression.octEncodeToCartesian4(s.normal,oct32EncodeScratch);r[a]=l.x,r[a+1]=l.y,r[a+2]=l.z,r[a+3]=l.w;var c=Cartesian4.packFloat(s.distance,distanceEncodeScratch);r[a+4]=c.x,r[a+5]=c.y,r[a+6]=c.z,r[a+7]=c.w,a+=8}}function packPlanesAsFloats(e,t,i){for(var r=e._float32View,n=e._planes,a=0,o=t;o<i;++o){var s=n[o],l=s.normal;r[a]=l.x,r[a+1]=l.y,r[a+2]=l.z,r[a+3]=s.distance,a+=4}}function computeTextureResolution(e,t){var i=ContextLimits.maximumTextureSize;return t.x=Math.min(e,i),t.y=Math.ceil(e/t.x),t}var textureResolutionScratch=new Cartesian2;ClippingPlaneCollection.prototype.update=function(e){var t=this._clippingPlanesTexture,i=e.context,r=ClippingPlaneCollection.useFloatTexture(i),n=r?this.length:2*this.length;if(defined(t)){var a=t.width*t.height;(a<n||n<.25*a)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(0!==this.length){if(!defined(t)){var o=computeTextureResolution(n,textureResolutionScratch);o.y*=2;var s=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST});r?(t=new Texture({context:i,width:o.x,height:o.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,sampler:s,flipY:!1}),this._float32View=new Float32Array(o.x*o.y*4)):(t=new Texture({context:i,width:o.x,height:o.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:s,flipY:!1}),this._uint8View=new Uint8Array(o.x*o.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}var l=this._dirtyIndex;if(this._multipleDirtyPlanes||-1!==l){if(this._multipleDirtyPlanes)r?(packPlanesAsFloats(this,0,this._planes.length),t.copyFrom({width:t.width,height:t.height,arrayBufferView:this._float32View})):(packPlanesAsUint8(this,0,this._planes.length),t.copyFrom({width:t.width,height:t.height,arrayBufferView:this._uint8View}));else{var c=0,u=0;r?(u=Math.floor(l/t.width),c=Math.floor(l-u*t.width),packPlanesAsFloats(this,l,l+1),t.copyFrom({width:1,height:1,arrayBufferView:this._float32View},c,u)):(u=Math.floor(2*l/t.width),c=Math.floor(2*l-u*t.width),packPlanesAsUint8(this,l,l+1),t.copyFrom({width:2,height:1,arrayBufferView:this._uint8View},c,u))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}}};var scratchMatrix=new Matrix4,scratchPlane$1=new Plane(Cartesian3.UNIT_X,0);function DracoLoader(){}function addBufferToLoadResources(e,t){var i="runtime."+Object.keys(e.createdBufferViews).length,r=e.buffers,n=Object.keys(r).length;return r[n]=t,e.createdBufferViews[i]={buffer:n,byteOffset:0,byteLength:t.byteLength},i}function addNewVertexBuffer(e,t,i){var r=t._loadResources,n=addBufferToLoadResources(r,e);return r.vertexBuffersToCreate.enqueue(n),n}function addNewIndexBuffer(e,t,i){var r=e.typedArray,n=t._loadResources,a=addBufferToLoadResources(n,r);return n.indexBuffersToCreate.enqueue({id:a,componentType:ComponentDatatype$1.fromTypedArray(r)}),{bufferViewId:a,numberOfIndices:e.numberOfIndices}}function scheduleDecodingTask(e,l,c,t){if(DracoLoader._taskProcessorReady){var u=c.primitivesToDecode.peek();if(defined(u)){var i=e.scheduleTask(u,[u.array.buffer]);if(defined(i))return c.activeDecodingTasks++,c.primitivesToDecode.dequeue(),i.then(function(e){c.activeDecodingTasks--;var t=addNewIndexBuffer(e.indexArray,l),i={},r=e.attributeData;for(var n in r)if(r.hasOwnProperty(n)){var a=r[n],o=addNewVertexBuffer(a.array,l),s=a.data;s.bufferView=o,i[n]=s}l._decodedData[u.mesh+".primitive."+u.primitive]={bufferView:t.bufferViewId,numberOfIndices:t.numberOfIndices,attributes:i}})}}}function getClipAndStyleCode(e,t,i){return"    float clipDistance = clip(gl_FragCoord, "+e+", "+t+"); \n    vec4 clippingPlanesEdgeColor = vec4(1.0); \n    clippingPlanesEdgeColor.rgb = "+i+".rgb; \n    float clippingPlanesEdgeWidth = "+i+".a; \n    if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) \n    { \n        gl_FragColor = clippingPlanesEdgeColor;\n    } \n"}ClippingPlaneCollection.prototype.computeIntersectionWithBoundingVolume=function(e,t){var i=this._planes,r=i.length,n=this.modelMatrix;defined(t)&&(n=Matrix4.multiply(t,n,scratchMatrix));var a=Intersect$1.INSIDE;!this.unionClippingRegions&&0<r&&(a=Intersect$1.OUTSIDE);for(var o=0;o<r;++o){var s=i[o];Plane.transform(s,n,scratchPlane$1);var l=e.intersectPlane(scratchPlane$1);if(l===Intersect$1.INTERSECTING)a=l;else if(this._testIntersection(l))return l}return a},ClippingPlaneCollection.setOwner=function(e,t,i){e!==t[i]&&(t[i]=t[i]&&t[i].destroy(),defined(e)&&((e._owner=t)[i]=e))},ClippingPlaneCollection.useFloatTexture=function(e){return e.floatingPointTexture},ClippingPlaneCollection.getTextureResolution=function(e,t,i){var r=e.texture;if(defined(r))return i.x=r.width,i.y=r.height,i;var n=computeTextureResolution(ClippingPlaneCollection.useFloatTexture(t)?e.length:2*e.length,i);return n.y*=2,n},ClippingPlaneCollection.prototype.isDestroyed=function(){return!1},ClippingPlaneCollection.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),destroyObject(this)},DracoLoader._maxDecodingConcurrency=Math.max(FeatureDetection.hardwareConcurrency-1,1),DracoLoader._decoderTaskProcessor=void 0,DracoLoader._taskProcessorReady=!1,DracoLoader._getDecoderTaskProcessor=function(){if(!defined(DracoLoader._decoderTaskProcessor)){var e=new TaskProcessor("decodeDraco",DracoLoader._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_wasm_wrapper.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm",fallbackModulePath:"ThirdParty/Workers/draco_decoder.js"}).then(function(){DracoLoader._taskProcessorReady=!0}),DracoLoader._decoderTaskProcessor=e}return DracoLoader._decoderTaskProcessor},DracoLoader.hasExtension=function(e){return defined(e.extensionsRequired.KHR_draco_mesh_compression)||defined(e.extensionsUsed.KHR_draco_mesh_compression)},DracoLoader._decodedModelResourceCache=void 0,DracoLoader.parse=function(e,t){if(DracoLoader.hasExtension(e)){var o=e._loadResources,i=e.cacheKey;if(defined(i)){defined(DracoLoader._decodedModelResourceCache)||(defined(t.cache.modelDecodingCache)||(t.cache.modelDecodingCache={}),DracoLoader._decodedModelResourceCache=t.cache.modelDecodingCache);var r=DracoLoader._decodedModelResourceCache[i];if(defined(r))return r.count++,void(o.pendingDecodingCache=!0)}var s=e._dequantizeInShader,l=e.gltf;ForEach.mesh(l,function(e,a){ForEach.meshPrimitive(e,function(e,t){if(defined(e.extensions)){var i=e.extensions.KHR_draco_mesh_compression;if(defined(i)){var r=l.bufferViews[i.bufferView],n=arraySlice(l.buffers[r.buffer].extras._pipeline.source,r.byteOffset,r.byteOffset+r.byteLength);o.primitivesToDecode.enqueue({mesh:a,primitive:t,array:n,bufferView:r,compressedAttributes:i.attributes,dequantizeInShader:s})}}})})}},DracoLoader.decodeModel=function(e,t){if(!DracoLoader.hasExtension(e))return when.resolve();var i=e._loadResources,r=e.cacheKey;if(defined(r)&&defined(DracoLoader._decodedModelResourceCache)){var n=DracoLoader._decodedModelResourceCache[r];if(defined(n)&&i.pendingDecodingCache)return when(n.ready,function(){e._decodedData=n.data,i.pendingDecodingCache=!1});DracoLoader._decodedModelResourceCache[r]={ready:!1,count:1,data:void 0}}if(0===i.primitivesToDecode.length)return when.resolve();for(var a=DracoLoader._getDecoderTaskProcessor(),o=[],s=scheduleDecodingTask(a,e,i);defined(s);)o.push(s),s=scheduleDecodingTask(a,e,i);return when.all(o)},DracoLoader.decodePointCloud=function(e){var t=DracoLoader._getDecoderTaskProcessor();if(DracoLoader._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])},DracoLoader.cacheDataForModel=function(e){var t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){var i=DracoLoader._decodedModelResourceCache[t];defined(i)&&(i.ready=!0,i.data=e._decodedData)}},DracoLoader.destroyCachedDataForModel=function(e){var t=e.cacheKey;if(defined(t)&&defined(DracoLoader._decodedModelResourceCache)){var i=DracoLoader._decodedModelResourceCache[t];defined(i)&&0==--i.count&&delete DracoLoader._decodedModelResourceCache[t]}};var textureResolutionScratch$1=new Cartesian2;function getClippingFunction(e,t){var i=e.unionClippingRegions,r=e.length,n=ClippingPlaneCollection.useFloatTexture(t),a=ClippingPlaneCollection.getTextureResolution(e,t,textureResolutionScratch$1),o=a.x,s=a.y,l=n?getClippingPlaneFloat(o,s):getClippingPlaneUint8(o,s);return l+="\n",l+=i?clippingFunctionUnion(r):clippingFunctionIntersect(r)}function clippingFunctionUnion(e){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n    vec4 position = czm_windowToEyeCoordinates(fragCoord);\n    vec3 clipNormal = vec3(0.0);\n    vec3 clipPosition = vec3(0.0);\n    float clipAmount;\n    float pixelWidth = czm_metersPerPixel(position);\n    bool breakAndDiscard = false;\n    for (int i = 0; i < "+e+"; ++i)\n    {\n        vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n        clipNormal = clippingPlane.xyz;\n        clipPosition = -clippingPlane.w * clipNormal;\n        float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n        clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));\n        if (amount <= 0.0)\n        {\n           breakAndDiscard = true;\n           break;\n        }\n    }\n    if (breakAndDiscard) {\n        discard;\n    }\n    return clipAmount;\n}\n"}function clippingFunctionIntersect(e){return"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n    bool clipped = true;\n    vec4 position = czm_windowToEyeCoordinates(fragCoord);\n    vec3 clipNormal = vec3(0.0);\n    vec3 clipPosition = vec3(0.0);\n    float clipAmount = 0.0;\n    float pixelWidth = czm_metersPerPixel(position);\n    for (int i = 0; i < "+e+"; ++i)\n    {\n        vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n        clipNormal = clippingPlane.xyz;\n        clipPosition = -clippingPlane.w * clipNormal;\n        float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n        clipAmount = max(amount, clipAmount);\n        clipped = clipped && (amount <= 0.0);\n    }\n    if (clipped)\n    {\n        discard;\n    }\n    return clipAmount;\n}\n"}function getClippingPlaneFloat(e,t){var i=1/t,r=1/e+"";-1===r.indexOf(".")&&(r+=".0");var n=i+"";return-1===n.indexOf(".")&&(n+=".0"),"vec4 getClippingPlane(sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n    int pixY = clippingPlaneNumber / "+e+";\n    int pixX = clippingPlaneNumber - (pixY * "+e+");\n    float u = (float(pixX) + 0.5) * "+r+";\n    float v = (float(pixY) + 0.5) * "+n+";\n    vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n    return czm_transformPlane(plane, transform);\n}\n"}function getClippingPlaneUint8(e,t){var i=1/t,r=1/e+"";-1===r.indexOf(".")&&(r+=".0");var n=i+"";return-1===n.indexOf(".")&&(n+=".0"),"vec4 getClippingPlane(sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n    int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n    int pixY = clippingPlaneStartIndex / "+e+";\n    int pixX = clippingPlaneStartIndex - (pixY * "+e+");\n    float u = (float(pixX) + 0.5) * "+r+";\n    float v = (float(pixY) + 0.5) * "+n+";\n    vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n    vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n    vec4 plane;\n    plane.xyz = czm_octDecode(oct, 65535.0);\n    plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + "+r+", v)));\n    return czm_transformPlane(plane, transform);\n}\n"}var JobType={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},JobType$1=freezeObject$1(JobType),AttributeType={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"},AttributeType$1=freezeObject$1(AttributeType);function ModelAnimationCache(){}var dataUriRegex$2=/^data\:/i;function getAccessorKey(e,t){var i=e.gltf,r=i.buffers,n=i.bufferViews[t.bufferView],a=r[n.buffer],o=n.byteOffset+t.byteOffset,s=t.count*numberOfComponentsForType(t.type),l=dataUriRegex$2.test(a.uri)?"":a.uri;return e.cacheKey+"//"+l+"/"+o+"/"+s}var cachedAnimationParameters={};ModelAnimationCache.getAnimationParameterValues=function(e,t){var i=getAccessorKey(e,t),r=cachedAnimationParameters[i];if(!defined(r)){var n=e.gltf,a=n.buffers,o=n.bufferViews[t.bufferView],s=a[o.buffer].extras._pipeline.source,l=t.componentType,c=t.type,u=numberOfComponentsForType(c),d=t.count,h=getAccessorByteStride(n,t);r=new Array(d);for(var p=defaultValue(t.byteOffset,0),m=o.byteOffset+p,f=0;f<d;f++){var g=ComponentDatatype$1.createArrayBufferView(l,s.buffer,s.byteOffset+m,u);"SCALAR"===c?r[f]=g[0]:"VEC3"===c?r[f]=Cartesian3.fromArray(g):"VEC4"===c&&(r[f]=Quaternion.unpack(g)),m+=h}defined(e.cacheKey)&&(cachedAnimationParameters[i]=r)}return r};var cachedAnimationSplines={};function getAnimationSplineKey(e,t,i){return e.cacheKey+"//"+t+"/"+i}function ConstantSpline(e){this._value=e}ConstantSpline.prototype.evaluate=function(e,t){return this._value},ConstantSpline.prototype.wrapTime=function(e){return 0},ConstantSpline.prototype.clampTime=function(e){return 0},ModelAnimationCache.getAnimationSpline=function(e,t,i,r,n,a,o,s){var l=getAnimationSplineKey(e,t,r),c=cachedAnimationSplines[l];if(!defined(c)){var u=a,d=s;1===u.length&&1===d.length?c=new ConstantSpline(d[0]):"LINEAR"===n.interpolation&&("translation"===o||"scale"===o?c=new LinearSpline({times:u,points:d}):"rotation"===o?c=new QuaternionSpline({times:u,points:d}):"weights"===o&&(c=new WeightSpline({times:u,weights:d}))),defined(e.cacheKey)&&(cachedAnimationSplines[l]=c)}return c};var cachedSkinInverseBindMatrices={};ModelAnimationCache.getSkinInverseBindMatrices=function(e,t){var i=getAccessorKey(e,t),r=cachedSkinInverseBindMatrices[i];if(!defined(r)){var n=e.gltf,a=n.buffers,o=n.bufferViews[t.bufferView],s=a[o.buffer].extras._pipeline.source,l=t.componentType,c=t.type,u=t.count,d=getAccessorByteStride(n,t),h=o.byteOffset+t.byteOffset,p=numberOfComponentsForType(c);if(r=new Array(u),l===WebGLConstants$1.FLOAT&&c===AttributeType$1.MAT4)for(var m=0;m<u;++m){var f=ComponentDatatype$1.createArrayBufferView(l,s.buffer,s.byteOffset+h,p);r[m]=Matrix4.fromArray(f),h+=d}cachedSkinInverseBindMatrices[i]=r}return r};var ModelAnimationLoop={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},ModelAnimationLoop$1=freezeObject$1(ModelAnimationLoop),ModelAnimationState=freezeObject$1({STOPPED:0,ANIMATING:1});function ModelAnimation(e,t,i){this._name=i.name,this._startTime=JulianDate.clone(e.startTime),this._delay=defaultValue(e.delay,0),this._stopTime=e.stopTime,this.removeOnStop=defaultValue(e.removeOnStop,!1),this._multiplier=defaultValue(e.multiplier,1),this._reverse=defaultValue(e.reverse,!1),this._loop=defaultValue(e.loop,ModelAnimationLoop$1.NONE),this.start=new Event,this.update=new Event,this.stop=new Event,this._state=ModelAnimationState.STOPPED,this._runtimeAnimation=i,this._computedStartTime=void 0,this._duration=void 0;var r=this;this._raiseStartEvent=function(){r.start.raiseEvent(t,r)},this._updateEventTime=0,this._raiseUpdateEvent=function(){r.update.raiseEvent(t,r,r._updateEventTime)},this._raiseStopEvent=function(){r.stop.raiseEvent(t,r)}}function ModelAnimationCollection(e){this.animationAdded=new Event,this.animationRemoved=new Event,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}function add(e,t,i){var r=e._model,n=new ModelAnimation(i,r,r._runtime.animations[t]);return e._scheduledAnimations.push(n),e.animationAdded.raiseEvent(r,n),n}function animateChannels(e,t){for(var i=e.channelEvaluators,r=i.length,n=0;n<r;++n)i[n](t)}defineProperties$1(ModelAnimation.prototype,{name:{get:function(){return this._name}},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}}}),defineProperties$1(ModelAnimationCollection.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),ModelAnimationCollection.prototype.add=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t,i=this._model._runtime.animations;if(defined(e.index))return add(this,e.index,e);for(var r=i.length,n=0;n<r;++n)if(i[n].name===e.name){t=n;break}return add(this,t,e)},ModelAnimationCollection.prototype.addAll=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);for(var t=[],i=this._model._runtime.animations.length,r=0;r<i;++r)t.push(add(this,r,e));return t},ModelAnimationCollection.prototype.remove=function(e){if(defined(e)){var t=this._scheduledAnimations,i=t.indexOf(e);if(-1!==i)return t.splice(i,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},ModelAnimationCollection.prototype.removeAll=function(){var e=this._model,t=this._scheduledAnimations,i=t.length;this._scheduledAnimations=[];for(var r=0;r<i;++r)this.animationRemoved.raiseEvent(e,t[r])},ModelAnimationCollection.prototype.contains=function(e){return!!defined(e)&&-1!==this._scheduledAnimations.indexOf(e)},ModelAnimationCollection.prototype.get=function(e){return this._scheduledAnimations[e]};var animationsToRemove=[];function createAnimationRemovedFunction(e,t,i){return function(){e.animationRemoved.raiseEvent(t,i)}}function ModelLoadResources(){this.initialized=!1,this.resourcesParsed=!1,this.vertexBuffersToCreate=new Queue,this.indexBuffersToCreate=new Queue,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new Queue,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new Queue,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new Queue,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.createdBufferViews={},this.primitivesToDecode=new Queue,this.activeDecodingTasks=0,this.pendingDecodingCache=!1,this.skinnedNodesIds=[]}function getSubarray(e,t,i){return e.subarray(t,t+i)}function ModelMaterial(e,t,i){this._name=t.name,this._id=i,this._uniformMap=e._uniformMaps[i],this._technique=void 0,this._program=void 0,this._values=void 0}function ModelMesh(e,t,i){for(var r=[],n=e.primitives,a=n.length,o=0;o<a;++o){var s=n[o];r[o]=t[s.material]}this._name=e.name,this._materials=r,this._id=i}function ModelNode(e,t,i,r,n){this._model=e,this._runtimeNode=i,this._name=t.name,this._id=r,this.useMatrix=!1,this._show=!0,this._matrix=Matrix4.clone(n),this._originalMatrix=Matrix4.clone(n)}ModelAnimationCollection.prototype.update=function(e){var t=this._scheduledAnimations,i=t.length;if(0===i)return this._previousTime=void 0,!1;if(JulianDate.equals(e.time,this._previousTime))return!1;this._previousTime=JulianDate.clone(e.time,this._previousTime);for(var r=!1,n=e.time,a=this._model,o=0;o<i;++o){var s=t[o],l=s._runtimeAnimation;defined(s._computedStartTime)||(s._computedStartTime=JulianDate.addSeconds(defaultValue(s.startTime,n),s.delay,new JulianDate)),defined(s._duration)||(s._duration=l.stopTime*(1/s.multiplier));var c=s._computedStartTime,u=s._duration,d=s.stopTime,h=0!==u?JulianDate.secondsDifference(n,c)/u:0,p=0<=h,m=s.loop===ModelAnimationLoop$1.REPEAT||s.loop===ModelAnimationLoop$1.MIRRORED_REPEAT;if((p||m&&!defined(s.startTime))&&(h<=1||m)&&(!defined(d)||JulianDate.lessThanOrEquals(n,d))){if(s._state===ModelAnimationState.STOPPED&&(s._state=ModelAnimationState.ANIMATING,0<s.start.numberOfListeners&&e.afterRender.push(s._raiseStartEvent)),s.loop===ModelAnimationLoop$1.REPEAT)h-=Math.floor(h);else if(s.loop===ModelAnimationLoop$1.MIRRORED_REPEAT){var f=Math.floor(h),g=h-f;h=f%2==1?1-g:g}s.reverse&&(h=1-h);var _=h*u*s.multiplier;animateChannels(l,_=CesiumMath.clamp(_,l.startTime,l.stopTime)),0<s.update.numberOfListeners&&(s._updateEventTime=_,e.afterRender.push(s._raiseUpdateEvent)),r=!0}else p&&s._state===ModelAnimationState.ANIMATING&&(s._state=ModelAnimationState.STOPPED,0<s.stop.numberOfListeners&&e.afterRender.push(s._raiseStopEvent),s.removeOnStop&&animationsToRemove.push(s))}i=animationsToRemove.length;for(var y=0;y<i;++y){var v=animationsToRemove[y];t.splice(t.indexOf(v),1),e.afterRender.push(createAnimationRemovedFunction(this,a,v))}return animationsToRemove.length=0,r},ModelLoadResources.prototype.getBuffer=function(e){return getSubarray(this.buffers[e.buffer],e.byteOffset,e.byteLength)},ModelLoadResources.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},ModelLoadResources.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length},ModelLoadResources.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},ModelLoadResources.prototype.finishedTextureCreation=function(){var e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},ModelLoadResources.prototype.finishedEverythingButTextureCreation=function(){var e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.vertexBuffersToCreate.length&&0===this.indexBuffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return this.finishedDecoding()&&e&&t},ModelLoadResources.prototype.finishedDecoding=function(){return 0===this.primitivesToDecode.length&&0===this.activeDecodingTasks&&!this.pendingDecodingCache},ModelLoadResources.prototype.finished=function(){return this.finishedDecoding()&&this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()},defineProperties$1(ModelMaterial.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),ModelMaterial.prototype.setValue=function(e,t){var i="u_"+e,r=this._uniformMap.values[i];r.value=r.clone(t,r.value)},ModelMaterial.prototype.getValue=function(e){var t="u_"+e,i=this._uniformMap.values[t];if(defined(i))return i.value},defineProperties$1(ModelMesh.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),defineProperties$1(ModelNode.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=Matrix4.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}},originalMatrix:{get:function(){return this._originalMatrix}}}),ModelNode.prototype.setMatrix=function(e){Matrix4.clone(e,this._matrix)};var ModelUtility={updateForwardAxis:function(e){var t=e.gltf.extras.sourceVersion;(defined(t)&&"2.0"!==t||"2.0"!==ModelUtility.getAssetVersion(e.gltf))&&(e._gltfForwardAxis=Axis$1.X)},getAssetVersion:function(e){return defined(e.asset)&&defined(e.asset.version)?e.asset.version:"1.0"},splitIncompatibleMaterials:function(e){var f=e.accessors,g=e.materials,_={};return ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){var t,i,r=e.material,n=g[r],a=e.attributes.JOINTS_0;if(defined(a)){var o=f[a];t=o.componentType,i=o.type}var s=defined(a),l=defined(e.attributes.COLOR_0),c=defined(e.targets),u=defined(e.attributes.NORMAL),d=defined(e.attributes.TANGENT),h=defined(e.attributes.TEXCOORD_0),p=_[r];if(defined(p)){if(p.skinning.skinned!==s||p.skinning.type!==i||p.hasVertexColors!==l||p.hasMorphTargets!==c||p.hasNormals!==u||p.hasTangents!==d||p.hasTexCoords!==h){var m=clone(n,!0);r=addToArray(g,m),e.material=r,_[r]={skinning:{skinned:s,componentType:t,type:i},hasVertexColors:l,hasMorphTargets:c,hasNormals:u,hasTangents:d,hasTexCoords:h}}}else _[r]={skinning:{skinned:s,componentType:t,type:i},hasVertexColors:l,hasMorphTargets:c,hasNormals:u,hasTangents:d,hasTexCoords:h}})}),_},getShaderVariable:function(e){return"SCALAR"===e?"float":e.toLowerCase()},ModelState:{NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},getFailedLoadFunction:function(i,r,n){return function(e){i._state=ModelUtility.ModelState.FAILED;var t="Failed to load "+r+": "+n;defined(e)&&(t+="\n"+e.message),i._readyPromise.reject(new RuntimeError(t))}},parseBuffers:function(r,n){var a=r._loadResources;ForEach.buffer(r.gltf,function(e,t){if(defined(e.extras._pipeline.source))a.buffers[t]=e.extras._pipeline.source;else if(defined(n)){var i=r._resource.getDerivedResource({url:e.uri});++a.pendingBufferLoads,i.fetchArrayBuffer().then(n(r,t)).otherwise(ModelUtility.getFailedLoadFunction(r,"buffer",i.url))}})}},aMinScratch=new Cartesian3,aMaxScratch=new Cartesian3;function techniqueAttributeForSemantic(e,i){return ForEach.techniqueAttribute(e,function(e,t){if(e.semantic===i)return t})}function ensureSemanticExistenceForPrimitive(e,t){var i=e.accessors,r=e.materials,n=e.extensions.KHR_techniques_webgl,a=n.techniques,o=n.programs,s=n.shaders,l=t.targets,c=t.attributes;for(var u in l)if(l.hasOwnProperty(u)){var d=l[u];for(var h in d)"extras"!==h&&(c[h+"_"+u]=d[h])}var p=a[r[t.material].extensions.KHR_techniques_webgl.technique],m=s[o[p.program].vertexShader];for(var f in c)if(c.hasOwnProperty(f)&&!defined(techniqueAttributeForSemantic(p,f))){var g=i[c[f]],_=f.toLowerCase();"_"===_.charAt(0)&&(_=_.slice(1));var y="a_"+_;p.attributes[y]={semantic:f,type:g.componentType};var v=m.extras._pipeline,C=v.source;C="attribute "+ModelUtility.getShaderVariable(g.type)+" "+y+";\n"+C,v.source=C}}function getTechniqueAttributeOrUniformFunction(e,r,n,a){return hasExtension(e,"KHR_techniques_webgl")?function(e,t){if(!(e.semantic!==n||a&&defined(e.node)))return t}:function(e,t){var i=r.parameters[e];if(!(i.semantic!==n||a&&defined(i.node)))return t}}ModelUtility.computeBoundingSphere=function(e){for(var t=e.gltf,i=t.nodes,r=t.meshes,n=t.scenes[t.scene].nodes,a=n.length,o=[],s=new Cartesian3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),l=new Cartesian3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=0;c<a;++c){var u=i[n[c]];for(u._transformToRoot=ModelUtility.getTransform(u),o.push(u);0<o.length;){var d=(u=o.pop())._transformToRoot,h=u.mesh;if(defined(h))for(var p=r[h].primitives,m=p.length,f=0;f<m;++f){var g=p[f].attributes.POSITION;if(defined(g)){var _=ModelUtility.getAccessorMinMax(t,g),y=Cartesian3.fromArray(_.min,0,aMinScratch),v=Cartesian3.fromArray(_.max,0,aMaxScratch);defined(s)&&defined(l)&&(Matrix4.multiplyByPoint(d,y,y),Matrix4.multiplyByPoint(d,v,v),Cartesian3.minimumByComponent(s,y,s),Cartesian3.maximumByComponent(l,v,l))}}var C=u.children;if(defined(C))for(var S=C.length,x=0;x<S;++x){var T=i[C[x]];T._transformToRoot=ModelUtility.getTransform(T),Matrix4.multiplyTransformation(d,T._transformToRoot,T._transformToRoot),o.push(T)}delete u._transformToRoot}}var b=BoundingSphere.fromCornerPoints(s,l);return e._forwardAxis===Axis$1.Z&&BoundingSphere.transformWithoutScale(b,Axis$1.Z_UP_TO_X_UP,b),e._upAxis===Axis$1.Y?BoundingSphere.transformWithoutScale(b,Axis$1.Y_UP_TO_Z_UP,b):e._upAxis===Axis$1.X&&BoundingSphere.transformWithoutScale(b,Axis$1.X_UP_TO_Z_UP,b),b},ModelUtility.ensureSemanticExistence=function(t){return ForEach.mesh(t,function(e){ForEach.meshPrimitive(e,function(e){ensureSemanticExistenceForPrimitive(t,e)})}),t},ModelUtility.createAttributeLocations=function(e,t){var i={},r=!1,n=1;if(ForEach.techniqueAttribute(e,function(e,t){/pos/i.test(t)&&!r?(i[t]=0,r=!0):i[t]=n++}),defined(t))for(var a in t)t.hasOwnProperty(a)&&(i[a]=n++);return i},ModelUtility.getAccessorMinMax=function(e,t){var i=e.accessors[t],r=i.extensions,n=i.min,a=i.max;if(defined(r)){var o=r.WEB3D_quantized_attributes;defined(o)&&(n=o.decodedMin,a=o.decodedMax)}return{min:n,max:a}},ModelUtility.getAttributeOrUniformBySemantic=function(i,r,n,a){return ForEach.technique(i,function(e){if(!defined(n)||e.program===n){var t=ForEach.techniqueAttribute(e,getTechniqueAttributeOrUniformFunction(i,e,r,a));return defined(t)?t:ForEach.techniqueUniform(e,getTechniqueAttributeOrUniformFunction(i,e,r,a))}})},ModelUtility.getDiffuseAttributeOrUniform=function(e,t){var i=ModelUtility.getAttributeOrUniformBySemantic(e,"COLOR_0",t);return defined(i)||(i=ModelUtility.getAttributeOrUniformBySemantic(e,"_3DTILESDIFFUSE",t)),i};var nodeTranslationScratch=new Cartesian3,nodeQuaternionScratch=new Quaternion,nodeScaleScratch=new Cartesian3;function replaceAllButFirstInString(e,t,i){t+="(?!\\w)",t=new RegExp(t,"g");var r=e.search(t);return e.replace(t,function(e,t){return r===t?e:i})}function getQuantizedAttributes(e,t){var i=e.accessors[t].extensions;if(defined(i))return i.WEB3D_quantized_attributes}function getAttributeVariableName(e,t,i){var r=t.material,n=e.materials[r];if(hasExtension(e,"KHR_techniques_webgl")&&defined(n.extensions)&&defined(n.extensions.KHR_techniques_webgl)){var a=n.extensions.KHR_techniques_webgl.technique,o=e.extensions.KHR_techniques_webgl.techniques[a];return ForEach.techniqueAttribute(o,function(e,t){if(e.semantic===i)return t})}}function getScalarUniformFunction(e){var t={value:e,clone:function(e,t){return e},func:function(){return t.value}};return t}function getVec2UniformFunction(e){var t={value:Cartesian2.fromArray(e),clone:Cartesian2.clone,func:function(){return t.value}};return t}function getVec3UniformFunction(e){var t={value:Cartesian3.fromArray(e),clone:Cartesian3.clone,func:function(){return t.value}};return t}function getVec4UniformFunction(e){var t={value:Cartesian4.fromArray(e),clone:Cartesian4.clone,func:function(){return t.value}};return t}function getMat2UniformFunction(e){var t={value:Matrix2.fromColumnMajorArray(e),clone:Matrix2.clone,func:function(){return t.value}};return t}function getMat3UniformFunction(e){var t={value:Matrix3.fromColumnMajorArray(e),clone:Matrix3.clone,func:function(){return t.value}};return t}function getMat4UniformFunction(e){var t={value:Matrix4.fromColumnMajorArray(e),clone:Matrix4.clone,func:function(){return t.value}};return t}function DelayLoadedTextureUniform(e,t,i){this._value=void 0,this._textureId=e.index,this._textures=t,this._defaultTexture=i}function getTextureUniformFunction(e,t,i){var r=new DelayLoadedTextureUniform(e,t,i);return r.func=function(){return r.value},r}ModelUtility.getTransform=function(e,t){return defined(e.matrix)?Matrix4.fromColumnMajorArray(e.matrix,t):Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.fromArray(e.translation,0,nodeTranslationScratch),Quaternion.unpack(e.rotation,0,nodeQuaternionScratch),Cartesian3.fromArray(e.scale,0,nodeScaleScratch),t)},ModelUtility.getUsedExtensions=function(e){var t=e.extensionsUsed,i={};if(defined(t))for(var r=t.length,n=0;n<r;n++){i[t[n]]=!0}return i},ModelUtility.getRequiredExtensions=function(e){var t=e.extensionsRequired,i={};if(defined(t))for(var r=t.length,n=0;n<r;n++){i[t[n]]=!0}return i},ModelUtility.supportedExtensions={AGI_articulations:!0,CESIUM_RTC:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_binary_glTF:!0,KHR_draco_mesh_compression:!0,KHR_materials_common:!0,KHR_techniques_webgl:!0,KHR_materials_unlit:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0},ModelUtility.checkSupportedExtensions=function(e,t){for(var i in e)if(e.hasOwnProperty(i)){if(!ModelUtility.supportedExtensions[i])throw new RuntimeError("Unsupported glTF Extension: "+i);if("EXT_texture_webp"===i&&!1===t)throw new RuntimeError("Loaded model requires WebP but browser does not support it.")}},ModelUtility.checkSupportedGlExtensions=function(e,t){if(defined(e))for(var i=e.length,r=0;r<i;r++){var n=e[r];if("OES_element_index_uint"!==n)throw new RuntimeError("Unsupported WebGL Extension: "+n);if(!t.elementIndexUint)throw new RuntimeError("OES_element_index_uint WebGL extension is not enabled.")}},ModelUtility.modifyShaderForDracoQuantizedAttributes=function(e,t,i,r){var n={};for(var a in r)if(r.hasOwnProperty(a)){var o=r[a],s=o.quantization;if(!defined(s))continue;var l=getAttributeVariableName(e,t,a);"_"===a.charAt(0)&&(a=a.substring(1));var c="gltf_u_dec_"+a.toLowerCase();if(!defined(n[c])){var u,d="gltf_decoded_"+a,h=l.replace("a_","gltf_a_dec_"),p=o.componentsPerAttribute;i=replaceAllButFirstInString(i,l,h),i=(u=s.octEncoded?"vec3":1<p?"vec"+p:"float")+" "+h+";\n"+i;var m=3===p&&"COLOR_0"===a;m&&(i=replaceAllButFirstInString(i,h,"vec4("+h+", 1.0)"));var f="";if(s.octEncoded){var g=c+"_rangeConstant";i="uniform float "+g+";\n"+i,f="\nvoid main() {\n    "+h+" = czm_octDecode("+l+".xy, "+g+").zxy;\n    "+d+"();\n}\n"}else{var _=c+"_normConstant",y=c+"_min";i="uniform float "+_+";\nuniform "+u+" "+y+";\n"+i,f="\nvoid main() {\n    "+h+" = "+y+" + "+l+(m?".xyz":"")+" * "+_+";\n    "+d+"();\n}\n"}i=ShaderSource.replaceMain(i,d),i+=f}}return{shader:i}},ModelUtility.modifyShaderForQuantizedAttributes=function(e,t,i){var r={},n=t.attributes;for(var a in n)if(n.hasOwnProperty(a)){var o=getAttributeVariableName(e,t,a),s=t.attributes[a];"_"===a.charAt(0)&&(a=a.substring(1));var l="gltf_u_dec_"+a.toLowerCase(),c=l+"_scale",u=l+"_translate";if(!defined(r[l])&&!defined(r[c])){var d=getQuantizedAttributes(e,s);if(defined(d)){var h,p=d.decodeMatrix,m="gltf_decoded_"+a,f=o.replace("a_","gltf_a_dec_"),g=Math.floor(Math.sqrt(p.length));i=(h=2<g?"vec"+(g-1):"float")+" "+f+";\n"+(i=replaceAllButFirstInString(i,o,f));var _="";5===g?(i="uniform vec4 "+u+";\n"+(i="uniform mat4 "+c+";\n"+i),_="\nvoid main() {\n    "+f+" = "+c+" * "+o+" + "+u+";\n    "+m+"();\n}\n",r[c]={mat:4},r[u]={vec:4}):(i="uniform mat"+g+" "+l+";\n"+i,_="\nvoid main() {\n    "+f+" = "+h+"("+l+" * vec"+g+"("+o+",1.0));\n    "+m+"();\n}\n",r[l]={mat:g}),i=ShaderSource.replaceMain(i,m),i+=_}}}return{shader:i,uniforms:r}},ModelUtility.toClipCoordinatesGLSL=function(e,t){var i=ModelUtility.getAttributeOrUniformBySemantic(e,"POSITION"),r=i.replace("a_","gltf_a_dec_");-1!==t.indexOf(r)&&(i=r);var n=ModelUtility.getAttributeOrUniformBySemantic(e,"MODELVIEWPROJECTION",void 0,!0);if(!defined(n)||-1===t.indexOf(n)){var a=ModelUtility.getAttributeOrUniformBySemantic(e,"PROJECTION",void 0,!0),o=ModelUtility.getAttributeOrUniformBySemantic(e,"MODELVIEW",void 0,!0);-1!==t.indexOf("czm_instanced_modelView ")?o="czm_instanced_modelView":defined(o)||(o=ModelUtility.getAttributeOrUniformBySemantic(e,"CESIUM_RTC_MODELVIEW",void 0,!0)),n=a+" * "+o}return n+" * vec4("+i+".xyz, 1.0)"},ModelUtility.modifyFragmentShaderForLogDepth=function(e){return e=ShaderSource.replaceMain(e,"czm_depth_main"),e+="\nvoid main() \n{ \n    czm_depth_main(); \n    czm_writeLogDepth(); \n} \n"},ModelUtility.modifyVertexShaderForLogDepth=function(e,t){return e=ShaderSource.replaceMain(e,"czm_depth_main"),e+="\nvoid main() \n{ \n    czm_depth_main(); \n    czm_vertexLogDepth("+t+"); \n} \n"},defineProperties$1(DelayLoadedTextureUniform.prototype,{value:{get:function(){if(!defined(this._value)){var e=this._textures[this._textureId];if(!defined(e))return this._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),DelayLoadedTextureUniform.prototype.clone=function(e){return e},DelayLoadedTextureUniform.prototype.func=void 0;var gltfUniformFunctions={};function scaleFromMatrix5Array(e){return[e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]]}function translateFromMatrix5Array(e){return[e[20],e[21],e[22],e[23]]}gltfUniformFunctions[WebGLConstants$1.FLOAT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.INT_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL]=getScalarUniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC2]=getVec2UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC3]=getVec3UniformFunction,gltfUniformFunctions[WebGLConstants$1.BOOL_VEC4]=getVec4UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT2]=getMat2UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT3]=getMat3UniformFunction,gltfUniformFunctions[WebGLConstants$1.FLOAT_MAT4]=getMat4UniformFunction,gltfUniformFunctions[WebGLConstants$1.SAMPLER_2D]=getTextureUniformFunction,ModelUtility.createUniformFunction=function(e,t,i,r){return gltfUniformFunctions[e](t,i,r)},ModelUtility.createUniformsForDracoQuantizedAttributes=function(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],n=r.quantization;if(!defined(n))continue;"_"===i.charAt(0)&&(i=i.substring(1));var a="gltf_u_dec_"+i.toLowerCase();if(n.octEncoded){var o=a+"_rangeConstant",s=(1<<n.quantizationBits)-1;t[o]=getScalarUniformFunction(s).func;continue}var l=a+"_normConstant",c=n.range/(1<<n.quantizationBits);t[l]=getScalarUniformFunction(c).func;var u=a+"_min";switch(r.componentsPerAttribute){case 1:t[u]=getScalarUniformFunction(n.minValues).func;break;case 2:t[u]=getVec2UniformFunction(n.minValues).func;break;case 3:t[u]=getVec3UniformFunction(n.minValues).func;break;case 4:t[u]=getVec4UniformFunction(n.minValues).func}}return t},ModelUtility.createUniformsForQuantizedAttributes=function(e,t,i){var r=e.accessors,n={},a={},o=t.attributes;for(var s in o)if(o.hasOwnProperty(s)){var l=r[o[s]],c=l.extensions;if("_"===s.charAt(0)&&(s=s.substring(1)),defined(c)){var u=c.WEB3D_quantized_attributes;if(defined(u)){var d=u.decodeMatrix,h="gltf_u_dec_"+s.toLowerCase();switch(l.type){case AttributeType$1.SCALAR:a[h]=getMat2UniformFunction(d).func,n[h]=!0;break;case AttributeType$1.VEC2:a[h]=getMat3UniformFunction(d).func,n[h]=!0;break;case AttributeType$1.VEC3:a[h]=getMat4UniformFunction(d).func,n[h]=!0;break;case AttributeType$1.VEC4:var p=h+"_scale",m=h+"_translate";a[p]=getMat4UniformFunction(scaleFromMatrix5Array(d)).func,a[m]=getVec4UniformFunction(translateFromMatrix5Array(d)).func,n[p]=!0,n[m]=!0}}}}for(var f in i)if(i.hasOwnProperty(f)&&!n[f]){var g=i[f];defined(g.mat)&&(2===g.mat?a[f]=getMat2UniformFunction(Matrix2.IDENTITY).func:3===g.mat?a[f]=getMat3UniformFunction(Matrix3.IDENTITY).func:4===g.mat&&(a[f]=getMat4UniformFunction(Matrix4.IDENTITY).func)),defined(g.vec)&&4===g.vec&&(a[f]=getVec4UniformFunction([0,0,0,0]).func)}return a};var scratchTranslationRtc=new Cartesian3,gltfSemanticUniforms={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var i=new Matrix4;return function(){return defined(t._rtcCenter)?(Matrix4.getTranslation(e.model,scratchTranslationRtc),Cartesian3.add(scratchTranslationRtc,t._rtcCenter,scratchTranslationRtc),Matrix4.multiplyByPoint(e.view,scratchTranslationRtc,scratchTranslationRtc),Matrix4.setTranslation(e.modelView,scratchTranslationRtc,i)):e.modelView}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTransposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};function ComputeCommand(e){e=defaultValue(e,defaultValue.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.persists=defaultValue(e.persists,!1),this.pass=Pass$1.COMPUTE,this.owner=e.owner}ModelUtility.getGltfSemanticUniforms=function(){return gltfSemanticUniforms},ComputeCommand.prototype.execute=function(e){e.execute(this)};var OctahedralProjectionAtlasFS="varying vec2 v_textureCoordinates;\nuniform float originalSize;\nuniform sampler2D texture0;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nconst float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));\nconst float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));\nconst float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));\nconst float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));\nvoid main()\n{\nvec2 uv = v_textureCoordinates;\nvec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);\nvec2 pixel = 1.0 / textureSize;\nfloat mipLevel = 0.0;\nif (uv.x - pixel.x > (textureSize.y / textureSize.x))\n{\nmipLevel = 1.0;\nif (uv.y - pixel.y > yMipLevel1)\n{\nmipLevel = 2.0;\nif (uv.y - pixel.y * 3.0 > yMipLevel2)\n{\nmipLevel = 3.0;\nif (uv.y - pixel.y * 5.0 > yMipLevel3)\n{\nmipLevel = 4.0;\nif (uv.y - pixel.y * 7.0 > yMipLevel4)\n{\nmipLevel = 5.0;\n}\n}\n}\n}\n}\nif (mipLevel > 0.0)\n{\nfloat scale = pow(2.0, mipLevel);\nuv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);\nuv.x *= ((textureSize.x - 2.0) / textureSize.y);\nuv.x -= 1.0 + pixel.x;\nuv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));\nuv *= scale;\n}\nelse\n{\nuv.x *= (textureSize.x / textureSize.y);\n}\nif(mipLevel == 0.0)\n{\ngl_FragColor = texture2D(texture0, uv);\n}\nelse if(mipLevel == 1.0)\n{\ngl_FragColor = texture2D(texture1, uv);\n}\nelse if(mipLevel == 2.0)\n{\ngl_FragColor = texture2D(texture2, uv);\n}\nelse if(mipLevel == 3.0)\n{\ngl_FragColor = texture2D(texture3, uv);\n}\nelse if(mipLevel == 4.0)\n{\ngl_FragColor = texture2D(texture4, uv);\n}\nelse if(mipLevel == 5.0)\n{\ngl_FragColor = texture2D(texture5, uv);\n}\nelse\n{\ngl_FragColor = vec4(0.0);\n}\n}\n",OctahedralProjectionFS="varying vec3 v_cubeMapCoordinates;\nuniform samplerCube cubeMap;\nvoid main()\n{\nvec4 rgbm = textureCube(cubeMap, v_cubeMapCoordinates);\nfloat m = rgbm.a * 16.0;\nvec3 r = rgbm.rgb * m;\ngl_FragColor = vec4(r * r, 1.0);\n}\n",OctahedralProjectionVS="attribute vec4 position;\nattribute vec3 cubeMapCoordinates;\nvarying vec3 v_cubeMapCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_cubeMapCoordinates = cubeMapCoordinates;\n}\n";function OctahedralProjectedCubeMap(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._readyPromise=when.defer()}defineProperties$1(OctahedralProjectedCubeMap.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),OctahedralProjectedCubeMap.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};for(var v1$1=new Cartesian3(1,0,0),v2$1=new Cartesian3(0,0,1),v3=new Cartesian3(-1,0,0),v4=new Cartesian3(0,0,-1),v5=new Cartesian3(0,1,0),v6=new Cartesian3(0,-1,0),cubeMapCoordinates=[v5,v3,v2$1,v6,v1$1,v5,v4,v5,v5],length=cubeMapCoordinates.length,flatCubeMapCoordinates=new Float32Array(3*length),offset=0,i$2=0;i$2<length;++i$2,offset+=3)Cartesian3.pack(cubeMapCoordinates[i$2],flatCubeMapCoordinates,offset);var flatPositions=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),indices=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 createVertexArray$1(e){var t=Buffer$1.createVertexBuffer({context:e,typedArray:flatPositions,usage:BufferUsage$1.STATIC_DRAW}),i=Buffer$1.createVertexBuffer({context:e,typedArray:flatCubeMapCoordinates,usage:BufferUsage$1.STATIC_DRAW}),r=Buffer$1.createIndexBuffer({context:e,typedArray:indices,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});return new VertexArray({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ComponentDatatype$1.FLOAT},{index:1,vertexBuffer:i,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT}],indexBuffer:r})}function createUniformTexture(e){return function(){return e}}function cleanupResources(e){var t,i;e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();var r=e._cubeMaps;if(defined(r))for(i=r.length,t=0;t<i;++t)r[t].destroy();var n=e._mipTextures;if(defined(n))for(i=n.length,t=0;t<i;++t)n[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}function processModelMaterialsCommon(c,u){if(u=defaultValue(u,defaultValue.EMPTY_OBJECT),defined(c)&&hasExtension(c,"KHR_materials_common")){hasExtension(c,"KHR_techniques_webgl")||(defined(c.extensions)||(c.extensions={}),c.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},c.extensionsUsed.push("KHR_techniques_webgl"),c.extensionsRequired.push("KHR_techniques_webgl"));var d=c.extensions.KHR_techniques_webgl;lightDefaults(c);var h=generateLightParameters(c),p=ModelUtility.splitIncompatibleMaterials(c),m={},f=!1;return ForEach.material(c,function(e,t){if(defined(e.extensions)&&defined(e.extensions.KHR_materials_common)){var i=e.extensions.KHR_materials_common,r=p[t],n=getTechniqueKey(i,r),a=m[n];defined(a)||(a=generateTechnique(c,d,r,i,h,u.addBatchIdToGeneratedShaders),m[n]=a,f=!0);var o={},s=i.values;for(var l in s)s.hasOwnProperty(l)&&"transparent"!==l&&"doubleSided"!==l&&(o["u_"+l.toLowerCase()]=s[l]);e.extensions.KHR_techniques_webgl={technique:a,values:o},e.alphaMode="OPAQUE",i.transparent&&(e.alphaMode="BLEND"),i.doubleSided&&(e.doubleSided=!0)}}),f?(ModelUtility.ensureSemanticExistence(c),c):c}}function generateLightParameters(e){var t,i={};if(defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(t=e.extensions.KHR_materials_common.lights),defined(t)){var r=e.nodes;for(var n in r)if(r.hasOwnProperty(n)){var a=r[n];if(defined(a.extensions)&&defined(a.extensions.KHR_materials_common)){var o=a.extensions.KHR_materials_common.light;defined(o)&&defined(t[o])&&(t[o].node=n),delete a.extensions.KHR_materials_common}}var s=0;for(var l in t)if(t.hasOwnProperty(l)){var c=t[l],u=c.type;if("ambient"!==u&&!defined(c.node)){delete t[l];continue}var d="light"+s.toString();switch(c.baseName=d,u){case"ambient":var h=c.ambient;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:h.color};break;case"directional":var p=c.directional;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:p.color},defined(c.node)&&(i[d+"Transform"]={node:c.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4});break;case"point":var m=c.point;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:m.color},defined(c.node)&&(i[d+"Transform"]={node:c.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4}),i[d+"Attenuation"]={type:WebGLConstants$1.FLOAT_VEC3,value:[m.constantAttenuation,m.linearAttenuation,m.quadraticAttenuation]};break;case"spot":var f=c.spot;i[d+"Color"]={type:WebGLConstants$1.FLOAT_VEC3,value:f.color},defined(c.node)&&(i[d+"Transform"]={node:c.node,semantic:"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},i[d+"InverseTransform"]={node:c.node,semantic:"MODELVIEWINVERSE",type:WebGLConstants$1.FLOAT_MAT4,useInFragment:!0}),i[d+"Attenuation"]={type:WebGLConstants$1.FLOAT_VEC3,value:[f.constantAttenuation,f.linearAttenuation,f.quadraticAttenuation]},i[d+"FallOff"]={type:WebGLConstants$1.FLOAT_VEC2,value:[f.fallOffAngle,f.fallOffExponent]}}++s}}return i}function generateTechnique(e,t,i,r,n,a){defined(r)||(r={}),a=defaultValue(a,!1);var o,s=t.techniques,l=t.shaders,c=t.programs,u=r.technique.toUpperCase();defined(e.extensions)&&defined(e.extensions.KHR_materials_common)&&(o=e.extensions.KHR_materials_common.lights);var d,h=r.values,p=defaultValue(r.jointCount,0),m=!1,f=!1;defined(i)&&(m=(d=i.skinning).skinned,f=i.hasVertexColors);var g,_="precision highp float;\n",y="precision highp float;\n",v="CONSTANT"!==u,C={u_modelViewMatrix:{semantic:hasExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};v&&(C.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),m&&(C.u_jointMatrix={count:p,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4});var S=!1;for(var x in h)if(h.hasOwnProperty(x)&&"transparent"!==x&&"doubleSided"!==x){var T=getKHRMaterialsCommonValueType(x,h[x]);g="u_"+x.toLowerCase(),S||T!==WebGLConstants$1.SAMPLER_2D||(S=!0),C[g]={type:T}}if(defined(C.u_diffuse)&&(C.u_diffuse.semantic="_3DTILESDIFFUSE"),defined(n))for(var b in n)n.hasOwnProperty(b)&&(C[g="u_"+b]=n[b]);for(g in C)if(C.hasOwnProperty(g)){var E=C[g],P=defined(E.count)?"["+E.count+"]":"";E.type!==WebGLConstants$1.FLOAT_MAT3&&E.type!==WebGLConstants$1.FLOAT_MAT4||E.useInFragment?(y+="uniform "+webGLConstantToGlslType(E.type)+" "+g+P+";\n",delete E.useInFragment):_+="uniform "+webGLConstantToGlslType(E.type)+" "+g+P+";\n"}var A="";if(m){var w,D,M=numberOfComponentsForType(d.type),I=!1;if(0===d.type.indexOf("MAT")&&(I=!0,M=Math.sqrt(M)),I)for(w=0;w<M;w++)for(D=0;D<M;D++)A+=0===w&&0===D?"  mat4 skinMat = ":"  skinMat += ",A+="a_weight["+w+"]["+D+"] * u_jointMatrix[int(a_joint["+w+"]["+D+"])];\n";else for(w=0;w<M;w++)A+=0===w?"  mat4 skinMat = ":"  skinMat += ",A+="a_weight["+w+"] * u_jointMatrix[int(a_joint["+w+"])];\n"}var R,O={a_position:{semantic:"POSITION"}};if(_+="attribute vec3 a_position;\n",_+="varying vec3 v_positionEC;\n",A+=m?"  vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);\n":"  vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",A+="  v_positionEC = pos.xyz;\n",A+="  gl_Position = u_projectionMatrix * pos;\n",y+="varying vec3 v_positionEC;\n",v&&(O.a_normal={semantic:"NORMAL"},_+="attribute vec3 a_normal;\n",_+="varying vec3 v_normal;\n",A+=m?"  v_normal = u_normalMatrix * mat3(skinMat) * a_normal;\n":"  v_normal = u_normalMatrix * a_normal;\n",y+="varying vec3 v_normal;\n"),S&&(O.a_texcoord_0={semantic:"TEXCOORD_0"},_+="attribute vec2 a_texcoord_0;\n",_+="varying vec2 "+(R="v_texcoord_0")+";\n",A+="  "+R+" = a_texcoord_0;\n",y+="varying vec2 "+R+";\n"),m){var L=ModelUtility.getShaderVariable(d.type);O.a_joint={semantic:"JOINT"},O.a_weight={semantic:"WEIGHT"},_+="attribute "+L+" a_joint;\n",_+="attribute "+L+" a_weight;\n"}f&&(O.a_vertexColor={semantic:"COLOR_0"},_+="attribute vec4 a_vertexColor;\n",_+="varying vec4 v_vertexColor;\n",A+="  v_vertexColor = a_vertexColor;\n",y+="varying vec4 v_vertexColor;\n"),a&&(O.a_batchId={semantic:"_BATCHID"},_+="attribute float a_batchId;\n");var F=v&&("BLINN"===u||"PHONG"===u)&&defined(C.u_specular)&&defined(C.u_shininess)&&0<C.u_shininess,N=!1,B=!1,V="";for(var k in o)if(o.hasOwnProperty(k)){var $=o[k],z=$.type.toLowerCase(),U=$.baseName;V+="  {\n";var G,H,W="u_"+U+"Color";"ambient"===z?(B=!0,V+="    ambientLight += "+W+";\n"):v&&(N=!0,G="v_"+U+"Direction",H="v_"+U+"Position","point"!==z&&(_+="varying vec3 "+G+";\n",y+="varying vec3 "+G+";\n",A+="  "+G+" = mat3(u_"+U+"Transform) * vec3(0.,0.,1.);\n","directional"===z&&(V+="    vec3 l = normalize("+G+");\n")),"directional"!==z?(_+="varying vec3 "+H+";\n",y+="varying vec3 "+H+";\n",A+="  "+H+" = u_"+U+"Transform[3].xyz;\n",V+="    vec3 VP = "+H+" - v_positionEC;\n",V+="    vec3 l = normalize(VP);\n",V+="    float range = length(VP);\n",V+="    float attenuation = 1.0 / (u_"+U+"Attenuation.x + ",V+="(u_"+U+"Attenuation.y * range) + ",V+="(u_"+U+"Attenuation.z * range * range));\n"):V+="    float attenuation = 1.0;\n","spot"===z&&(V+="    float spotDot = dot(l, normalize("+G+"));\n",V+="    if (spotDot < cos(u_"+U+"FallOff.x * 0.5))\n",V+="    {\n",V+="      attenuation = 0.0;\n",V+="    }\n",V+="    else\n",V+="    {\n",V+="        attenuation *= max(0.0, pow(spotDot, u_"+U+"FallOff.y));\n",V+="    }\n"),V+="    diffuseLight += "+W+"* max(dot(normal,l), 0.) * attenuation;\n",F&&("BLINN"===u?(V+="    vec3 h = normalize(l + viewDir);\n",V+="    float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(V+="    vec3 reflectDir = reflect(-l, normal);\n",V+="    float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),V+="    specularLight += "+W+" * specularIntensity;\n")),V+="  }\n"}if(B||(V+="  ambientLight += vec3(0.2, 0.2, 0.2);\n"),!N&&"CONSTANT"!==u){V+="  vec3 l = normalize(czm_sunDirectionEC);\n";V+="  diffuseLight += vec3(1.0, 1.0, 1.0) * max(dot(normal,l), 0.2);\n",F&&("BLINN"===u?(V+="  vec3 h = normalize(l + viewDir);\n",V+="  float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(V+="  vec3 reflectDir = reflect(-l, normal);\n",V+="  float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),V+="  specularLight += vec3(1.0, 1.0, 1.0) * specularIntensity;\n")}_+="void main(void) {\n",_+=A,_+="}\n",y+="void main(void) {\n";var q,j="  vec3 color = vec3(0.0, 0.0, 0.0);\n";v&&(y+="  vec3 normal = normalize(v_normal);\n",r.doubleSided&&(y+="  if (gl_FrontFacing == false)\n",y+="  {\n",y+="    normal = -normal;\n",y+="  }\n")),q="CONSTANT"!==u?(defined(C.u_diffuse)&&(C.u_diffuse.type===WebGLConstants$1.SAMPLER_2D?y+="  vec4 diffuse = texture2D(u_diffuse, "+R+");\n":y+="  vec4 diffuse = u_diffuse;\n",y+="  vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",j+="  color += diffuse.rgb * diffuseLight;\n"),F&&(C.u_specular.type===WebGLConstants$1.SAMPLER_2D?y+="  vec3 specular = texture2D(u_specular, "+R+").rgb;\n":y+="  vec3 specular = u_specular.rgb;\n",y+="  vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",j+="  color += specular * specularLight;\n"),defined(C.u_transparency)?"  gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);\n":"  gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):defined(C.u_transparency)?"  gl_FragColor = vec4(color * u_transparency, u_transparency);\n":"  gl_FragColor = vec4(color, 1.0);\n",f&&(j+="  color *= v_vertexColor.rgb;\n"),defined(C.u_emission)&&(C.u_emission.type===WebGLConstants$1.SAMPLER_2D?y+="  vec3 emission = texture2D(u_emission, "+R+").rgb;\n":y+="  vec3 emission = u_emission.rgb;\n",j+="  color += emission;\n"),!defined(C.u_ambient)&&"CONSTANT"===u||(defined(C.u_ambient)?C.u_ambient.type===WebGLConstants$1.SAMPLER_2D?y+="  vec3 ambient = texture2D(u_ambient, "+R+").rgb;\n":y+="  vec3 ambient = u_ambient.rgb;\n":y+="  vec3 ambient = diffuse.rgb;\n",j+="  color += ambient * ambientLight;\n"),y+="  vec3 viewDir = -normalize(v_positionEC);\n",y+="  vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",y+=V,y+=j,y+=q,y+="}\n";var Y=addToArray(l,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:_,extension:".glsl"}}});return addToArray(s,{attributes:O,program:addToArray(c,{fragmentShader:addToArray(l,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:y,extension:".glsl"}}}),vertexShader:Y}),uniforms:C})}function getKHRMaterialsCommonValueType(e,t){var i;switch(i=defined(t.value)?t.value:defined(t.index)?[t.index]:t,e){case"ambient":case"diffuse":case"emission":case"specular":return 1===i.length?WebGLConstants$1.SAMPLER_2D:WebGLConstants$1.FLOAT_VEC4;case"shininess":case"transparency":return WebGLConstants$1.FLOAT;case"transparent":case"doubleSided":return WebGLConstants$1.BOOL}}function getTechniqueKey(e,t){var i="";i+="technique:"+e.technique+";";for(var r=e.values,n=Object.keys(r).sort(),a=n.length,o=0;o<a;++o){var s=n[o];r.hasOwnProperty(s)&&(i+=s+":"+getKHRMaterialsCommonValueType(s,r[s]),i+=";")}var l=defaultValue(e.jointCount,0);if(i+=l.toString()+";",defined(t)){var c=t.skinning;0<l&&(i+=c.type+";"),i+=t.hasVertexColors}return i}function lightDefaults(e){var t=e.extensions.KHR_materials_common;if(defined(t)&&defined(t.lights))for(var i=t.lights,r=i.length,n=0;n<r;n++){var a=i[n];if("ambient"===a.type){defined(a.ambient)||(a.ambient={});var o=a.ambient;defined(o.color)||(o.color=[1,1,1])}else if("directional"===a.type){defined(a.directional)||(a.directional={});var s=a.directional;defined(s.color)||(s.color=[1,1,1])}else if("point"===a.type){defined(a.point)||(a.point={});var l=a.point;defined(l.color)||(l.color=[1,1,1]),l.constantAttenuation=defaultValue(l.constantAttenuation,1),l.linearAttenuation=defaultValue(l.linearAttenuation,0),l.quadraticAttenuation=defaultValue(l.quadraticAttenuation,0)}else if("spot"===a.type){defined(a.spot)||(a.spot={});var c=a.spot;defined(c.color)||(c.color=[1,1,1]),c.constantAttenuation=defaultValue(c.constantAttenuation,1),c.fallOffAngle=defaultValue(c.fallOffAngle,3.14159265),c.fallOffExponent=defaultValue(c.fallOffExponent,0),c.linearAttenuation=defaultValue(c.linearAttenuation,0),c.quadraticAttenuation=defaultValue(c.quadraticAttenuation,0)}}}function processPbrMaterials(n,a){if(a=defaultValue(a,defaultValue.EMPTY_OBJECT),hasExtension(n,"KHR_techniques_webgl"))return n;if(!defined(n.materials)||0===n.materials.length)return n;defined(n.extensions)||(n.extensions={}),defined(n.extensionsUsed)||(n.extensionsUsed=[]),defined(n.extensionsRequired)||(n.extensionsRequired=[]),n.extensions.KHR_techniques_webgl={programs:[],shaders:[],techniques:[]},n.extensionsUsed.push("KHR_techniques_webgl"),n.extensionsRequired.push("KHR_techniques_webgl");var o=ModelUtility.splitIncompatibleMaterials(n);return ForEach.material(n,function(e,t){var i={},r=generateTechnique$1(n,e,t,i,o,a);defined(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl={values:i,technique:r}}),ModelUtility.ensureSemanticExistence(n),n}function isSpecularGlossinessMaterial(e){return defined(e.extensions)&&defined(e.extensions.KHR_materials_pbrSpecularGlossiness)}function addTextureCoordinates(e,t,i,r,n){var a;return defined(i[t+"Offset"])?(a=t+"Coord",n.fragmentShaderMain+="    vec2 "+a+" = computeTexCoord("+r+", "+t+"Offset, "+t+"Rotation, "+t+"Scale);\n"):a=r,a}OctahedralProjectedCubeMap.prototype.update=function(e){var t=e.context;if(OctahedralProjectedCubeMap.isSupported(t)&&(defined(this._texture)&&defined(this._va)&&cleanupResources(this),!defined(this._texture))){if(!defined(this._texture)&&!this._loading){var i=t.textureCache.getTexture(this._url);if(defined(i))return cleanupResources(this),this._texture=i,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,void this._readyPromise.resolve()}var r=this._cubeMapBuffers;if(!defined(r)&&!this._loading){var n=this;loadKTX(this._url).then(function(e){n._cubeMapBuffers=e,n._loading=!1}),this._loading=!0}if(defined(this._cubeMapBuffers)){this._va=createVertexArray$1(t),this._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:OctahedralProjectionVS,fragmentShaderSource:OctahedralProjectionFS,attributeLocations:{position:0,cubeMapCoordinates:1}});var a=Math.min(r.length,6);this._maximumMipmapLevel=a-1;for(var o=this._cubeMaps=new Array(a),s=this._mipTextures=new Array(a),l=2*r[0].positiveX.width,c={originalSize:function(){return l}},u=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT,d=PixelFormat$1.RGBA,h=0;h<a;++h){var p=r[h].positiveY;r[h].positiveY=r[h].negativeY,r[h].negativeY=p;var m=o[h]=new CubeMap({context:t,source:r[h]}),f=2*o[h].width,g=s[h]=new Texture({context:t,width:f,height:f,pixelDatatype:u,pixelFormat:d}),_=new ComputeCommand({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:createUniformTexture(m)},outputTexture:g,persists:!0,owner:this});e.commandList.push(_),c["texture"+h]=createUniformTexture(g)}this._texture=new Texture({context:t,width:1.5*l+2,height:l,pixelDatatype:u,pixelFormat:d}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);var y=new ComputeCommand({fragmentShaderSource:OctahedralProjectionAtlasFS,uniformMap:c,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(y),this._ready=!0,this._readyPromise.resolve()}}},OctahedralProjectedCubeMap.prototype.isDestroyed=function(){return!1},OctahedralProjectedCubeMap.prototype.destroy=function(){return cleanupResources(this),this._texture=this._texture&&this._texture.destroy(),destroyObject(this)};var DEFAULT_TEXTURE_OFFSET=[0,0],DEFAULT_TEXTURE_ROTATION=[0],DEFAULT_TEXTURE_SCALE=[1,1];function handleKHRTextureTransform(e,t,i){if(-1!==e.indexOf("Texture")&&defined(t.extensions)&&defined(t.extensions.KHR_texture_transform)){var r="u_"+e,n=t.extensions.KHR_texture_transform;i[r+"Offset"]=defaultValue(n.offset,DEFAULT_TEXTURE_OFFSET),i[r+"Rotation"]=defaultValue(n.rotation,DEFAULT_TEXTURE_ROTATION),i[r+"Scale"]=defaultValue(n.scale,DEFAULT_TEXTURE_SCALE),defined(t.texCoord)&&defined(n.texCoord)&&(i[r].texCoord=n.texCoord)}}function generateTechnique$1(e,t,i,r,n,a){var o,s,l,c=defaultValue(a.addBatchIdToGeneratedShaders,!1),u=e.extensions.KHR_techniques_webgl,d=u.techniques,h=u.shaders,p=u.programs,m=isSpecularGlossinessMaterial(t),f=t.pbrMetallicRoughness;if(defined(f)&&!m)for(s in f)f.hasOwnProperty(s)&&(l=f[s],handleKHRTextureTransform(s,r[o="u_"+s]=l,r));if(m){var g=t.extensions.KHR_materials_pbrSpecularGlossiness;for(s in g)g.hasOwnProperty(s)&&(l=g[s],handleKHRTextureTransform(s,r[o="u_"+s]=l,r))}for(var _ in t)t.hasOwnProperty(_)&&(0<=_.indexOf("Texture")||0<=_.indexOf("Factor"))&&(l=t[_],handleKHRTextureTransform(_,r[o="u_"+_]=l,r));var y,v="precision highp float;\n",C="precision highp float;\n";defined(e.skins)&&(y=e.skins[0]);var S,x,T=defined(y)?y.joints:[],b=T.length,E=n[i],P=!1,A=!1,w=!1,D=!1,M=!1,I=!1,R=!1;defined(E)&&(P=(S=E.skinning).skinned&&0<T.length,A=E.hasVertexColors,w=E.hasMorphTargets,D=E.hasNormals,M=E.hasTangents,I=E.hasTexCoords),w&&ForEach.mesh(e,function(e){ForEach.meshPrimitive(e,function(e){if(e.material===i){var t=e.targets;defined(t)&&(x=t)}})});var O={u_modelViewMatrix:{semantic:hasExtension(e,"CESIUM_RTC")?"CESIUM_RTC_MODELVIEW":"MODELVIEW",type:WebGLConstants$1.FLOAT_MAT4},u_projectionMatrix:{semantic:"PROJECTION",type:WebGLConstants$1.FLOAT_MAT4}};defined(t.extensions)&&defined(t.extensions.KHR_materials_unlit)&&(M=D=!(R=!0)),D&&(O.u_normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:WebGLConstants$1.FLOAT_MAT3}),P&&(O.u_jointMatrix={count:b,semantic:"JOINTMATRIX",type:WebGLConstants$1.FLOAT_MAT4}),w&&(O.u_morphWeights={count:x.length,semantic:"MORPHWEIGHTS",type:WebGLConstants$1.FLOAT});var L=t.alphaMode;for(o in defined(L)&&"MASK"===L&&(O.u_alphaCutoff={semantic:"ALPHACUTOFF",type:WebGLConstants$1.FLOAT}),r)r.hasOwnProperty(o)&&(O[o]={type:getPBRValueType(o)});var F=defaultValue(O.u_baseColorTexture,O.u_baseColorFactor);for(o in defined(F)&&(F.semantic="_3DTILESDIFFUSE"),O)if(O.hasOwnProperty(o)){var N=O[o],B=defined(N.count)?"["+N.count+"]":"";N.type!==WebGLConstants$1.FLOAT_MAT3&&N.type!==WebGLConstants$1.FLOAT_MAT4&&"u_morphWeights"!==o||N.useInFragment?(C+="uniform "+webGLConstantToGlslType(N.type)+" "+o+B+";\n",delete N.useInFragment):v+="uniform "+webGLConstantToGlslType(N.type)+" "+o+B+";\n"}e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)&&(C+="uniform sampler2D yp_black_texture;\n",C+="uniform vec4 hm_dh_attr;\n",C+="uniform mat3 flatRect;\n",C+="uniform vec4 floodVar;\n",C+="uniform vec4 floodColor;\n"),C+="uniform float modelLight;\n";var V="";if(P){var k,$,z=numberOfComponentsForType(S.type),U=!1;if(0===S.type.indexOf("MAT")&&(U=!0,z=Math.sqrt(z)),U)for(k=0;k<z;k++)for($=0;$<z;$++)V+=0===k&&0===$?"    mat4 skinMatrix = ":"    skinMatrix += ",V+="a_weight["+k+"]["+$+"] * u_jointMatrix[int(a_joint["+k+"]["+$+"])];\n";else for(k=0;k<z;k++)V+=0===k?"    mat4 skinMatrix = ":"    skinMatrix += ",V+="a_weight["+k+"] * u_jointMatrix[int(a_joint["+k+"])];\n"}var G={a_position:{semantic:"POSITION"}};if(v+="attribute vec3 a_position;\n",D&&(v+="varying vec3 v_positionEC;\n"),e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)?(V+="    vec3 weightedPosition;\n",V+="    bool stc_isIn = czm_isInObliq(a_position,yp_mat_x,yp_mat_y,yp_mat_z,flatRect,yp_max_index);\n",V+="    if(stc_isIn){\n",V+="       Cut_Num = -10.0;\n",V+="    }else{\n",V+="       Cut_Num = 10.0;\n",V+="    }\n",V+="    if(IsYaPing[0]&&stc_isIn){;\n",V+="       vec3 stc_3Dvs =  a_position;\n",V+="       stc_3Dvs.z = model_min_height;\n",V+="       weightedPosition = stc_3Dvs;\n",V+="    }else{\n",V+="       weightedPosition = a_position;\n",V+="    }\n"):V+="    vec3 weightedPosition = a_position;\n",D&&(V+="    vec3 weightedNormal = a_normal;\n"),M&&(V+="    vec4 weightedTangent = a_tangent;\n"),w)for(var H=0;H<x.length;H++){var W=x[H];for(var q in W)if(W.hasOwnProperty(q)&&"extras"!==q){var j="a_"+q+"_"+H;G[j]={semantic:q+"_"+H},v+="attribute vec3 "+j+";\n","POSITION"===q?V+="    weightedPosition += u_morphWeights["+H+"] * "+j+";\n":"NORMAL"===q?V+="    weightedNormal += u_morphWeights["+H+"] * "+j+";\n":M&&"TANGENT"===q&&(V+="    weightedTangent.xyz += u_morphWeights["+H+"] * "+j+";\n")}}V+=P?"    vec4 position = skinMatrix * vec4(weightedPosition, 1.0);\n":"    vec4 position = vec4(weightedPosition, 1.0);\n",V+="    position = u_modelViewMatrix * position;\n",D&&(V+="    v_positionEC = position.xyz;\n"),V+="    gl_Position = u_projectionMatrix * position;\n",D&&(G.a_normal={semantic:"NORMAL"},v+="attribute vec3 a_normal;\n",v+="varying vec3 v_normal;\n",V+=P?"    v_normal = u_normalMatrix * mat3(skinMatrix) * weightedNormal;\n":"    v_normal = u_normalMatrix * weightedNormal;\n",C+="varying vec3 v_normal;\n",C+="varying vec3 v_positionEC;\n",e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)&&(C+="varying float Cut_Num;\n",C+="uniform bvec4 yp_show_InOrOut;\n",C+="uniform bvec4 IsYaPing;\n")),M&&(G.a_tangent={semantic:"TANGENT"},v+="attribute vec4 a_tangent;\n",v+="varying vec4 v_tangent;\n",V+="    v_tangent.xyz = u_normalMatrix * weightedTangent.xyz;\n",V+="    v_tangent.w = weightedTangent.w;\n",C+="varying vec4 v_tangent;\n");var Y,X,Q,J,Z,K,ee,te,ie="";if(I){G.a_texcoord_0={semantic:"TEXCOORD_0"},v+="attribute vec2 a_texcoord_0;\n",v+="varying vec2 "+(Y="v_texcoord_0")+";\n",e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)?V+="if(yp_show_InOrOut[3]){   if(Cut_Num<0.0){       vec2 new_texcoord = vec2((a_position.x-flatRect[0][0])/(flatRect[1][0]-flatRect[0][0]),(a_position.y-flatRect[0][1])/(flatRect[1][1]-flatRect[0][1]));       v_texcoord_0 = new_texcoord;   }else{       v_texcoord_0 = a_texcoord_0;   }}else{   v_texcoord_0 = a_texcoord_0;}":V+="    "+Y+" = a_texcoord_0;\n",C+="varying vec2 "+Y+";\n";var re={fragmentShaderMain:ie};X=addTextureCoordinates(e,"u_normalTexture",r,Y,re),Q=addTextureCoordinates(e,"u_baseColorTexture",r,Y,re),J=addTextureCoordinates(e,"u_specularGlossinessTexture",r,Y,re),Z=addTextureCoordinates(e,"u_diffuseTexture",r,Y,re),K=addTextureCoordinates(e,"u_metallicRoughnessTexture",r,Y,re),ee=addTextureCoordinates(e,"u_occlusionTexture",r,Y,re),te=addTextureCoordinates(e,"u_emmissiveTexture",r,Y,re),ie=re.fragmentShaderMain}if(P){var ne=ModelUtility.getShaderVariable(S.type);G.a_joint={semantic:"JOINTS_0"},G.a_weight={semantic:"WEIGHTS_0"},v+="attribute "+ne+" a_joint;\n",v+="attribute "+ne+" a_weight;\n"}A&&(G.a_vertexColor={semantic:"COLOR_0"},v+="attribute vec4 a_vertexColor;\n",v+="varying vec4 v_vertexColor;\n",V+="  v_vertexColor = a_vertexColor;\n",C+="varying vec4 v_vertexColor;\n"),c&&(G.a_batchId={semantic:"_BATCHID"},v+="attribute float a_batchId;\n"),e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)&&(v+="uniform mat4 yp_mat_x;\n",v+="uniform mat4 yp_mat_y;\n",v+="uniform mat4 yp_mat_z;\n",v+="uniform float model_min_height;\n",v+="uniform float model_add_height;\n",v+="uniform bvec4 IsYaPing;\n",v+="uniform float modelLight;\n",v+="uniform bvec4 yp_show_InOrOut;\n",v+="uniform vec4 hm_dh_attr;\n",v+="uniform mat3 flatRect;\n",v+="uniform int yp_max_index;\n",v+="varying float Cut_Num;\n"),v+="void main(void) \n{\n",v+=V,v+="}\n",D&&(C+="const float M_PI = 3.141592653589793;\n",C+="vec3 lambertianDiffuse(vec3 diffuseColor) \n{\n    return diffuseColor / M_PI;\n}\n\n",C+="vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) \n{\n    return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\n\n",C+="vec3 fresnelSchlick(float metalness, float VdotH) \n{\n    return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n}\n\n",C+="float smithVisibilityG1(float NdotV, float roughness) \n{\n    float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n    return NdotV / (NdotV * (1.0 - k) + k);\n}\n\n",C+="float smithVisibilityGGX(float roughness, float NdotL, float NdotV) \n{\n    return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n}\n\n",C+="float GGX(float roughness, float NdotH) \n{\n    float roughnessSquared = roughness * roughness;\n    float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n    return roughnessSquared / (M_PI * f * f);\n}\n\n"),C+="vec3 SRGBtoLINEAR3(vec3 srgbIn) \n{\n    return pow(srgbIn, vec3(2.2));\n}\n\n",C+="vec4 SRGBtoLINEAR4(vec4 srgbIn) \n{\n    vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n    return vec4(linearOut, srgbIn.a);\n}\n\n",C+="vec3 applyTonemapping(vec3 linearIn) \n{\n#ifndef HDR \n    return czm_acesTonemapping(linearIn);\n#else \n    return linearIn;\n#endif \n}\n\n",C+="vec3 LINEARtoSRGB(vec3 linearIn) \n{\n#ifndef HDR \n    return pow(linearIn, vec3(1.0/2.2));\n#else \n    return linearIn;\n#endif \n}\n\n",C+="vec2 computeTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale) \n{\n    rotation = -rotation; \n    mat3 transform = mat3(\n        cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0, \n       -sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0, \n        offset.x, offset.y, 1.0); \n    vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy; \n    return transformedTexCoords; \n}\n\n",C+="#ifdef USE_IBL_LIGHTING \n",C+="uniform vec2 gltf_iblFactor; \n",C+="#endif \n",C+="#ifdef USE_CUSTOM_LIGHT_COLOR \n",C+="uniform vec3 gltf_lightColor; \n",C+="#endif \n",e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)&&(C+="vec4 _SRGBtoLINEAR4(vec4 srgbIn) \n{\n    vec3 linearOut = pow(srgbIn.rgb, vec3(modelLight));\n    return vec4(linearOut, srgbIn.a);\n}\n\n",C+="vec4 hm_donghua(vec2 texcoord,vec4 hm_dh_attr,bool ableDH){   if(ableDH){       float r = sqrt((texcoord.x-0.8)*(texcoord.x-0.8) + (texcoord.y-0.8)*(texcoord.y-0.8));       float r2 = sqrt((texcoord.x-0.2)*(texcoord.x-0.2) + (texcoord.y-0.2)*(texcoord.y-0.2));       float z = cos(hm_dh_attr.x*r + hm_dh_attr.w*hm_dh_attr.y)/hm_dh_attr.z;       float z2 = cos(hm_dh_attr.x*r2 + hm_dh_attr.w*hm_dh_attr.y)/hm_dh_attr.z;       texcoord += sqrt(z*z+z2*z2);   }   vec4 cor = texture2D(yp_black_texture,texcoord);   return cor;}\n"),C+="void main(void) \n{\n",C+=ie,D&&(C+="    vec3 ng = normalize(v_normal);\n",C+="    vec3 positionWC = vec3(czm_inverseView * vec4(v_positionEC, 1.0));\n",defined(r.u_normalTexture)?M?(C+="    vec3 t = normalize(v_tangent.xyz);\n",C+="    vec3 b = normalize(cross(ng, t) * v_tangent.w);\n",C+="    mat3 tbn = mat3(t, b, ng);\n",C+="    vec3 n = texture2D(u_normalTexture, "+X+").rgb;\n",C+="    n = normalize(tbn * (2.0 * n - 1.0));\n"):(C="#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"+C,C+="#ifdef GL_OES_standard_derivatives\n",C+="    vec3 pos_dx = dFdx(v_positionEC);\n",C+="    vec3 pos_dy = dFdy(v_positionEC);\n",C+="    vec3 tex_dx = dFdx(vec3("+X+",0.0));\n",C+="    vec3 tex_dy = dFdy(vec3("+X+",0.0));\n",C+="    vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n",C+="    t = normalize(t - ng * dot(ng, t));\n",C+="    vec3 b = normalize(cross(ng, t));\n",C+="    mat3 tbn = mat3(t, b, ng);\n",C+="    vec3 n = texture2D(u_normalTexture, "+X+").rgb;\n",C+="    n = normalize(tbn * (2.0 * n - 1.0));\n",C+="#else\n",C+="    vec3 n = ng;\n",C+="#endif\n"):C+="    vec3 n = ng;\n",t.doubleSided&&(C+="    if (!gl_FrontFacing)\n",C+="    {\n",C+="        n = -n;\n",C+="    }\n")),defined(r.u_baseColorTexture)?(C+="    vec4 baseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, "+Q+"));\n",e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)&&(C+="vec4 new_color = baseColorWithAlpha;if(Cut_Num<0.0&&IsYaPing[0]&&yp_show_InOrOut[3]){   new_color = hm_donghua(v_texcoord_0,hm_dh_attr,IsYaPing[1]);}baseColorWithAlpha = _SRGBtoLINEAR4(new_color);if(yp_show_InOrOut[0]){   if(Cut_Num>0.0){       if(!yp_show_InOrOut[1]){           discard;       }   }else{       if(!yp_show_InOrOut[2]){           discard;       }   }}"),defined(r.u_baseColorFactor)&&(C+="    baseColorWithAlpha *= u_baseColorFactor;\n")):defined(r.u_baseColorFactor)?C+="    vec4 baseColorWithAlpha = u_baseColorFactor;\n":C+="    vec4 baseColorWithAlpha = vec4(1.0);\n",A&&(C+="    baseColorWithAlpha *= v_vertexColor;\n"),C+="    vec3 baseColor = baseColorWithAlpha.rgb;\n",D?(m?(defined(r.u_specularGlossinessTexture)?(C+="    vec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, "+J+"));\n",C+="    vec3 specular = specularGlossiness.rgb;\n",C+="    float glossiness = specularGlossiness.a;\n",defined(r.u_specularFactor)&&(C+="    specular *= u_specularFactor;\n"),defined(r.u_glossinessFactor)&&(C+="    glossiness *= u_glossinessFactor;\n")):(defined(r.u_specularFactor)?C+="    vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n":C+="    vec3 specular = vec3(1.0);\n",defined(r.u_glossinessFactor)?C+="    float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n":C+="    float glossiness = 1.0;\n"),defined(r.u_diffuseTexture)?(C+="    vec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, "+Z+"));\n",defined(r.u_diffuseFactor)&&(C+="    diffuse *= u_diffuseFactor;\n")):defined(r.u_diffuseFactor)?C+="    vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n":C+="    vec4 diffuse = vec4(1.0);\n"):defined(r.u_metallicRoughnessTexture)?(C+="    vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, "+K+").rgb;\n",C+="    float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n",C+="    float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n",defined(r.u_metallicFactor)&&(C+="    metalness *= u_metallicFactor;\n"),defined(r.u_roughnessFactor)&&(C+="    roughness *= u_roughnessFactor;\n")):(defined(r.u_metallicFactor)?C+="    float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n":C+="    float metalness = 1.0;\n",defined(r.u_roughnessFactor)?C+="    float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n":C+="    float roughness = 1.0;\n"),C+="    vec3 v = -normalize(v_positionEC);\n",C+="#ifndef USE_CUSTOM_LIGHT_COLOR \n",C+="    vec3 lightColor = vec3(1.5, 1.4, 1.2);\n",C+="#else \n",C+="    vec3 lightColor = gltf_lightColor;\n",C+="#endif \n",C+="    vec3 l = normalize(czm_sunDirectionEC);\n",C+="    vec3 h = normalize(v + l);\n",C+="    float NdotL = clamp(dot(n, l), 0.001, 1.0);\n",C+="    float NdotV = abs(dot(n, v)) + 0.001;\n",C+="    float NdotH = clamp(dot(n, h), 0.0, 1.0);\n",C+="    float LdotH = clamp(dot(l, h), 0.0, 1.0);\n",C+="    float VdotH = clamp(dot(v, h), 0.0, 1.0);\n",C+="    vec3 f0 = vec3(0.04);\n",m?(C+="    float roughness = 1.0 - glossiness;\n",C+="    vec3 diffuseColor = diffuse.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n",C+="    vec3 specularColor = specular;\n"):(C+="    vec3 diffuseColor = baseColor * (1.0 - metalness) * (1.0 - f0);\n",C+="    vec3 specularColor = mix(f0, baseColor, metalness);\n"),C+="    float alpha = roughness * roughness;\n",C+="    float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n",C+="    vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n",C+="    vec3 r0 = specularColor.rgb;\n",C+="    vec3 F = fresnelSchlick2(r0, r90, VdotH);\n",C+="    float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n",C+="    float D = GGX(alpha, NdotH);\n",C+="    vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n",C+="    vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n",C+="    vec3 color = NdotL * lightColor * (diffuseContribution + specularContribution);\n",C+="#if defined(USE_IBL_LIGHTING) && !defined(DIFFUSE_IBL) && !defined(SPECULAR_IBL) \n",C+="    vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n",C+="    float vertexRadius = length(positionWC);\n",C+="    float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n",C+="    float reflectionDotNadir = dot(r, normalize(positionWC));\n",C+="    r.x = -r.x;\n",C+="    r = -normalize(czm_temeToPseudoFixed * r);\n",C+="    r.x = -r.x;\n",C+="    float inverseRoughness = 1.04 - roughness;\n",C+="    inverseRoughness *= inverseRoughness;\n",C+="    vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n",C+="    float atmosphereHeight = 0.05;\n",C+="    float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n",C+="    float blendRegionOffset = roughness * -1.0;\n",C+="    float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n",C+="    float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n",C+="    float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n",C+="    float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n",C+="    vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n",C+="    vec3 nadirColor = belowHorizonColor * 0.5;\n",C+="    vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n",C+="    vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n",C+="    vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n",C+="    vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);\n",C+="    float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;\n",C+="    float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n",C+="    vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n",C+="    float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n",C+="    vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n",C+="    specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n",C+="    specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n",C+="#ifdef USE_SUN_LUMINANCE \n",C+="    float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), normalize(positionWC * -1.0)), 0.001, 1.0);\n",C+="    float S = acos(LdotZenith);\n",C+="    float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), normalize(positionWC * -1.0)), 0.001, 1.0);\n",C+="    float gamma = acos(NdotL);\n",C+="    float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n",C+="    float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n",C+="    float luminance = gltf_luminanceAtZenith * (numerator / denominator);\n",C+="#endif \n",C+="    vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",C+="    vec3 IBLColor = (diffuseIrradiance * diffuseColor * gltf_iblFactor.x) + (specularIrradiance * SRGBtoLINEAR3(specularColor * brdfLut.x + brdfLut.y) * gltf_iblFactor.y);\n",C+="#ifdef USE_SUN_LUMINANCE \n",C+="    color += IBLColor * luminance;\n",C+="#else \n",C+="    color += IBLColor; \n",C+="#endif \n",C+="#elif defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) \n",C+="    mat3 fixedToENU = mat3(gltf_clippingPlanesMatrix[0][0], gltf_clippingPlanesMatrix[1][0], gltf_clippingPlanesMatrix[2][0], \n",C+="                           gltf_clippingPlanesMatrix[0][1], gltf_clippingPlanesMatrix[1][1], gltf_clippingPlanesMatrix[2][1], \n",C+="                           gltf_clippingPlanesMatrix[0][2], gltf_clippingPlanesMatrix[1][2], gltf_clippingPlanesMatrix[2][2]); \n",C+="    const mat3 yUpToZUp = mat3(-1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0); \n",C+="    vec3 cubeDir = normalize(yUpToZUp * fixedToENU * normalize(reflect(-v, n))); \n",C+="#ifdef DIFFUSE_IBL \n",C+="#ifdef CUSTOM_SPHERICAL_HARMONICS \n",C+="    vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, gltf_sphericalHarmonicCoefficients); \n",C+="#else \n",C+="    vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n",C+="#endif \n",C+="#else \n",C+="    vec3 diffuseIrradiance = vec3(0.0); \n",C+="#endif \n",C+="#ifdef SPECULAR_IBL \n",C+="    vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n",C+="#ifdef CUSTOM_SPECULAR_IBL \n",C+="    vec3 specularIBL = czm_sampleOctahedralProjection(gltf_specularMap, gltf_specularMapSize, cubeDir,  roughness * gltf_maxSpecularLOD, gltf_maxSpecularLOD);\n",C+="#else \n",C+="    vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir,  roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n",C+="#endif \n",C+="    specularIBL *= F * brdfLut.x + brdfLut.y;\n",C+="#else \n",C+="    vec3 specularIBL = vec3(0.0); \n",C+="#endif \n",C+="    color += diffuseIrradiance * diffuseColor + specularColor * specularIBL;\n",C+="#endif \n"):C+="    vec3 color = baseColor;\n",R||(defined(r.u_occlusionTexture)&&ExpandByMars.occlusionOpen&&(C+="    color *= texture2D(u_occlusionTexture, "+ee+").r;\n"),defined(r.u_emissiveTexture)?(C+="    vec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, "+te+").rgb);\n",defined(r.u_emissiveFactor)&&(C+="    emissive *= u_emissiveFactor;\n"),C+="    color += emissive;\n"):defined(r.u_emissiveFactor)&&(C+="    color += u_emissiveFactor;\n")),R||(C+="    color = applyTonemapping(color);\n"),C+="    color = LINEARtoSRGB(color);\n",defined(L)?"MASK"===L?(C+="    if (baseColorWithAlpha.a < u_alphaCutoff) {\n",C+="        discard;\n",C+="    }\n",C+="    gl_FragColor = vec4(color, 1.0);\n"):C+="BLEND"===L?"    gl_FragColor = vec4(color, baseColorWithAlpha.a);\n":"    gl_FragColor = vec4(color, 1.0);\n":C+="    gl_FragColor = vec4(color, 1.0);\n",e&&e.asset&&e.asset.generator&&0<=ExpandByMars.trustGenerator.indexOf(e.asset.generator)&&(C+="if(IsYaPing[2]){\n",C+="     float posHeight = czm_fromCartesian(positionWC).z;\n",C+="     if(posHeight<floodVar[1]&&posHeight>=floodVar[0]){\n",C+="         float r;\n",C+="         float g;\n",C+="         float b = 0.0;\n",C+="         if(length(floodColor.rgb)>0.01){\n",C+="             r = floodColor.r;\n",C+="             g = floodColor.g;\n",C+="             b = floodColor.b;\n",C+="         }else{\n",C+="             g = (posHeight - floodVar[0])/floodVar[3];\n",C+="             r = 1.0 - g;\n",C+="         }\n",C+="         gl_FragColor.xyz = mix(gl_FragColor.xyz,vec3(r,g,b),floodColor.a);\n",C+="     }\n",C+="}\n"),C+="}\n";var ae=addToArray(h,{type:WebGLConstants$1.VERTEX_SHADER,extras:{_pipeline:{source:v,extension:".glsl"}}});return addToArray(d,{attributes:G,program:addToArray(p,{fragmentShader:addToArray(h,{type:WebGLConstants$1.FRAGMENT_SHADER,extras:{_pipeline:{source:C,extension:".glsl"}}}),vertexShader:ae}),uniforms:O})}function getPBRValueType(e){if(-1!==e.indexOf("Offset"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Rotation"))return WebGLConstants$1.FLOAT;if(-1!==e.indexOf("Scale"))return WebGLConstants$1.FLOAT_VEC2;if(-1!==e.indexOf("Texture"))return WebGLConstants$1.SAMPLER_2D;switch(e){case"u_baseColorFactor":return WebGLConstants$1.FLOAT_VEC4;case"u_metallicFactor":case"u_roughnessFactor":return WebGLConstants$1.FLOAT;case"u_emissiveFactor":return WebGLConstants$1.FLOAT_VEC3;case"u_diffuseFactor":return WebGLConstants$1.FLOAT_VEC4;case"u_specularFactor":return WebGLConstants$1.FLOAT_VEC3;case"u_glossinessFactor":return WebGLConstants$1.FLOAT}}var boundingSphereCartesian3Scratch=new Cartesian3,ModelState=ModelUtility.ModelState,defaultModelAccept="model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01",articulationEpsilon=CesiumMath.EPSILON16;function setCachedGltf(e,t){e._cachedGltf=t}function CachedGltf(e){this._gltf=e.gltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}defineProperties$1(CachedGltf.prototype,{gltf:{set:function(e){this._gltf=e},get:function(){return this._gltf}}}),CachedGltf.prototype.makeReady=function(e){this.gltf=e;for(var t=this.modelsToLoad,i=t.length,r=0;r<i;++r){var n=t[r];n.isDestroyed()||setCachedGltf(n,this)}this.modelsToLoad=void 0,this.ready=!0};var gltfCache={},uriToGuid={};function Model(e){var t,i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).cacheKey;if(this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=defaultValue(e.releaseGltfJson,!1),defined(i)&&defined(gltfCache[i])&&gltfCache[i].ready)++(t=gltfCache[i]).count;else{var r=e.gltf;if(defined(r)){if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),r instanceof Uint8Array)t=new CachedGltf({gltf:parseGlb(r),ready:!0});else t=new CachedGltf({gltf:e.gltf,ready:!0});t.count=1,defined(i)&&(gltfCache[i]=t)}}setCachedGltf(this,t);var n=defaultValue(e.basePath,"");this._resource=Resource.createIfNeeded(n);var a=e.credit;"string"==typeof a&&(a=new Credit(a)),this._credit=a,this._resourceCredits=[],this.show=defaultValue(e.show,!0),this.silhouetteColor=defaultValue(e.silhouetteColor,Color.RED),this._silhouetteColor=new Color,this._silhouetteColorPreviousAlpha=1,this._normalAttributeName=void 0,this.silhouetteSize=defaultValue(e.silhouetteSize,0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._clampedModelMatrix=void 0,this.scale=defaultValue(e.scale,1),this._scale=this.scale,this.minimumPixelSize=defaultValue(e.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=e.maximumScale,this._maximumScale=this.maximumScale,this.id=e.id,this._id=e.id,this.heightReference=defaultValue(e.heightReference,HeightReference$1.NONE),this._heightReference=this.heightReference,this._heightChanged=!1,this._removeUpdateHeightCallback=void 0;var o=e.scene;defined(this._scene=o)&&defined(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(function(){this._heightChanged=!0},this)),this._pickObject=e.pickObject,this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=when.defer(),this.activeAnimations=new ModelAnimationCollection(this),this.clampAnimations=defaultValue(e.clampAnimations,!0),this._defaultTexture=void 0,this._incrementallyLoadTextures=defaultValue(e.incrementallyLoadTextures,!0),this._asynchronous=defaultValue(e.asynchronous,!0),this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this.color=Color.clone(defaultValue(e.color,Color.WHITE)),this._colorPreviousAlpha=1,this.colorBlendMode=defaultValue(e.colorBlendMode,ColorBlendMode$1.HIGHLIGHT),this.colorBlendAmount=defaultValue(e.colorBlendAmount,.5),this._colorShadingEnabled=!1,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._clippingPlanesState=0,this.clippingPlanesOriginMatrix=void 0,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._distanceDisplayCondition=e.distanceDisplayCondition,this._addBatchIdToGeneratedShaders=e.addBatchIdToGeneratedShaders,this._precreatedAttributes=e.precreatedAttributes,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._requestType=e.requestType,this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._gltfForwardAxis=Axis$1.Z,this._forwardAxis=e.forwardAxis,this.cull=defaultValue(e.cull,!0),this.opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._computedModelMatrix=new Matrix4,this._clippingPlaneModelViewMatrix=Matrix4.clone(Matrix4.IDENTITY),this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,articulationsByName:void 0,articulationsByStageKey:void 0,stagesByKey:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms={},this._programPrimitives={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},sourceShaders:{},silhouettePrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._dequantizeInShader=defaultValue(e.dequantizeInShader,!0),this._decodedData={},this._cachedGeometryByteLength=0,this._cachedTexturesByteLength=0,this._geometryByteLength=0,this._texturesByteLength=0,this._trianglesLength=0,this._sourceTechniques={},this._sourcePrograms={},this._quantizedVertexShaders={},this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0,this._sourceVersion=void 0,this._sourceKHRTechniquesWebGL=void 0,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this._lightColor=Cartesian3.clone(e.lightColor),this._luminanceAtZenith=void 0,this.luminanceAtZenith=defaultValue(e.luminanceAtZenith,.2),this._sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._shouldUpdateSpecularMapAtlas=!0,this._specularEnvironmentMapAtlas=void 0,this._useDefaultSphericalHarmonics=!1,this._useDefaultSpecularMaps=!1,this._shouldRegenerateShaders=!1}function silhouetteSupported(e){return e.stencilBuffer}function isColorShadingEnabled(e){return!Color.equals(e.color,Color.WHITE)||e.colorBlendMode!==ColorBlendMode$1.HIGHLIGHT}function isClippingEnabled(e){var t=e._clippingPlanes;return defined(t)&&t.enabled&&0!==t.length}function containsGltfMagic(e){return"glTF"===getMagic(e)}function getRuntime(e,t,i){return e._runtime[t][i]}defineProperties$1(Model.prototype,{gltf:{get:function(){return defined(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._resource.url}},boundingSphere:{get:function(){var e=this.modelMatrix;this.heightReference!==HeightReference$1.NONE&&this._clampedModelMatrix&&(e=this._clampedModelMatrix);var t=Matrix4.getScale(e,boundingSphereCartesian3Scratch),i=defined(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;Cartesian3.multiplyByScalar(t,i,t);var r=this._scaledBoundingSphere;return r.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,r.center),r.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,r.center,r.center),r}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return defined(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition)}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},forwardAxis:{get:function(){return defined(this._forwardAxis)?this._forwardAxis:this._gltfForwardAxis}},trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return this._texturesByteLength}},cachedGeometryByteLength:{get:function(){return this._cachedGeometryByteLength}},cachedTexturesByteLength:{get:function(){return this._cachedTexturesByteLength}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},pickIds:{get:function(){return this._pickIds}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){var t=this._imageBasedLightingFactor;e===t||Cartesian2.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||0<this._imageBasedLightingFactor.x&&0===e.x||0===this._imageBasedLightingFactor.x&&0<e.x,this._shouldRegenerateShaders=this._shouldRegenerateShaders||0<this._imageBasedLightingFactor.y&&0===e.y||0===this._imageBasedLightingFactor.y&&0<e.y,Cartesian2.clone(e,this._imageBasedLightingFactor))}},lightColor:{get:function(){return this._lightColor},set:function(e){var t=this._lightColor;e===t||Cartesian3.equals(e,t)||(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._lightColor=Cartesian3.clone(e,t))}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){var t=this._luminanceAtZenith;e!==t&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||defined(t)&&!defined(e)||defined(e)&&!defined(t),this._luminanceAtZenith=e)}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){e!==this._sphericalHarmonicCoefficients&&(this._sphericalHarmonicCoefficients=e,this._shouldRegenerateShaders=!0)}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){this._shouldUpdateSpecularMapAtlas=this._shouldUpdateSpecularMapAtlas||e!==this._specularEnvironmentMaps,this._specularEnvironmentMaps=e}},credit:{get:function(){return this._credit}}}),Model.silhouetteSupported=function(e){return silhouetteSupported(e.context)},Model.fromGltf=function(e){var t=e.url;e=clone(e);var l=Resource.createIfNeeded(t),i=defaultValue(e.basePath,l.clone()),r=Resource.createIfNeeded(i),n=defaultValue(e.cacheKey,uriToGuid[getAbsoluteUri(l.url)]);defined(n)||(n=createGuid(),uriToGuid[getAbsoluteUri(l.url)]=n),defined(e.basePath)&&!defined(e.cacheKey)&&(n+=r.url),e.cacheKey=n,e.basePath=r;var c=new Model(e),u=gltfCache[n];return defined(u)?u.ready||(++u.count,u.modelsToLoad.push(c)):((u=new CachedGltf({ready:!1})).count=1,u.modelsToLoad.push(c),setCachedGltf(c,u),gltfCache[n]=u,defined(l.headers.Accept)||(l.headers.Accept=defaultModelAccept),l.fetchArrayBuffer().then(function(e){var t=new Uint8Array(e);if(containsGltfMagic(t)){var i=parseGlb(t);u.makeReady(i)}else{var r=getStringFromTypedArray(t);u.makeReady(JSON.parse(r))}var n=c._resourceCredits,a=l.credits;if(defined(a))for(var o=a.length,s=0;s<o;s++)n.push(a[s])}).otherwise(ModelUtility.getFailedLoadFunction(c,"model",l.url))),c},Model._gltfCache=gltfCache,Model.prototype.getNode=function(e){var t=getRuntime(this,"nodesByName",e);return defined(t)?t.publicNode:void 0},Model.prototype.getMesh=function(e){return getRuntime(this,"meshesByName",e)},Model.prototype.getMaterial=function(e){return getRuntime(this,"materialsByName",e)},Model.prototype.setArticulationStage=function(e,t){var i=getRuntime(this,"stagesByKey",e),r=getRuntime(this,"articulationsByStageKey",e);defined(i)&&defined(r)&&(t=CesiumMath.clamp(t,i.minimumValue,i.maximumValue),CesiumMath.equalsEpsilon(i.currentValue,t,articulationEpsilon)||(i.currentValue=t,r.isDirty=!0))};var scratchArticulationCartesian=new Cartesian3,scratchArticulationRotation=new Matrix3;function applyArticulationStageMatrix(e,t){var i,r=e.currentValue,n=scratchArticulationCartesian;switch(e.type){case"xRotate":i=Matrix3.fromRotationX(CesiumMath.toRadians(r),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,i,t);break;case"yRotate":i=Matrix3.fromRotationY(CesiumMath.toRadians(r),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,i,t);break;case"zRotate":i=Matrix3.fromRotationZ(CesiumMath.toRadians(r),scratchArticulationRotation),Matrix4.multiplyByMatrix3(t,i,t);break;case"xTranslate":n.x=r,n.y=0,n.z=0,Matrix4.multiplyByTranslation(t,n,t);break;case"yTranslate":n.x=0,n.y=r,n.z=0,Matrix4.multiplyByTranslation(t,n,t);break;case"zTranslate":n.x=0,n.y=0,n.z=r,Matrix4.multiplyByTranslation(t,n,t);break;case"xScale":n.x=r,n.y=1,n.z=1,Matrix4.multiplyByScale(t,n,t);break;case"yScale":n.x=1,n.y=r,n.z=1,Matrix4.multiplyByScale(t,n,t);break;case"zScale":n.x=1,n.y=1,n.z=r,Matrix4.multiplyByScale(t,n,t);break;case"uniformScale":Matrix4.multiplyByUniformScale(t,r,t)}return t}var scratchApplyArticulationTransform=new Matrix4;function addBuffersToLoadResources(e){var t=e.gltf,i=e._loadResources;ForEach.buffer(t,function(e,t){i.buffers[t]=e.extras._pipeline.source})}function bufferLoad(r,n){return function(e){var t=r._loadResources,i=new Uint8Array(e);--t.pendingBufferLoads,r.gltf.buffers[n].extras._pipeline.source=i}}function parseBufferViews(e){var i=e.gltf.bufferViews,r=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&r.enqueue(t)});var n=e._loadResources.indexBuffersToCreate,a={};ForEach.accessor(e.gltf,function(e){var t=e.bufferView;defined(t)&&(i[t].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(a[t])||(a[t]=!0,n.enqueue({id:t,componentType:e.componentType})))})}function parseTechniques(e){var t=e.gltf;if(hasExtension(t,"KHR_techniques_webgl")){var r=e._sourcePrograms,n=e._sourceTechniques,a=t.extensions.KHR_techniques_webgl.programs;ForEach.technique(t,function(e,t){n[t]=clone(e);var i=e.program;defined(r[i])||(r[i]=clone(a[i]))})}}function shaderLoad(i,r,n){return function(e){var t=i._loadResources;t.shaders[n]={source:e,type:r,bufferView:void 0},--t.pendingShaderLoads,i._rendererResources.sourceShaders[n]=e}}function parseShaders(s){var e=s.gltf,l=e.buffers,c=e.bufferViews,u=s._rendererResources.sourceShaders;ForEach.shader(e,function(e,t){if(defined(e.bufferView)){var i=e.bufferView,r=c[i],n=r.buffer,a=getStringFromTypedArray(l[n].extras._pipeline.source,r.byteOffset,r.byteLength);u[t]=a}else if(defined(e.extras._pipeline.source))u[t]=e.extras._pipeline.source;else{++s._loadResources.pendingShaderLoads;var o=s._resource.getDerivedResource({url:e.uri});o.fetchText().then(shaderLoad(s,e.type,t)).otherwise(ModelUtility.getFailedLoadFunction(s,"shader",o.url))}})}function parsePrograms(e){var t=e._sourceTechniques;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];e._loadResources.programsToCreate.enqueue({programId:r.program,techniqueId:i})}}function parseArticulations(e){var t={},i={},r={};e._runtime.articulationsByName=t,e._runtime.articulationsByStageKey=i,e._runtime.stagesByKey=r;var n=e.gltf;if(hasExtension(n,"AGI_articulations")&&defined(n.extensions)&&defined(n.extensions.AGI_articulations)){var a=n.extensions.AGI_articulations.articulations;if(defined(a))for(var o=a.length,s=0;s<o;++s){var l=clone(a[s]);l.nodes=[],l.isDirty=!0;for(var c=(t[l.name]=l).stages.length,u=0;u<c;++u){var d=l.stages[u];d.currentValue=d.initialValue;var h=l.name+" "+d.name;i[h]=l,r[h]=d}}}}function imageLoad(i,r){return function(e){var t=i._loadResources;--t.pendingTextureLoads,t.texturesToCreate.enqueue({id:r,image:e,bufferView:e.bufferView,width:e.width,height:e.height,internalFormat:e.internalFormat})}}Model.prototype.applyArticulations=function(){var e=this._runtime.articulationsByName;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];if(i.isDirty){i.isDirty=!1;for(var r=i.nodes.length,n=0;n<r;++n){for(var a=i.nodes[n],o=Matrix4.clone(a.originalMatrix,scratchApplyArticulationTransform),s=i.stages.length,l=0;l<s;++l){o=applyArticulationStageMatrix(i.stages[l],o)}a.matrix=o}}}};var ktxRegex$1=/(^data:image\/ktx)|(\.ktx$)/i,crnRegex$1=/(^data:image\/crn)|(\.crn$)/i;function parseTextures(h,p,m){var f,e=h.gltf,g=e.images;ForEach.texture(e,function(e,t){var i=e.source;defined(e.extensions)&&defined(e.extensions.EXT_texture_webp)&&m&&(i=e.extensions.EXT_texture_webp.source);var r=g[i],n=r.extras,a=r.bufferView,o=r.mimeType;if(f=r.uri,defined(n)&&defined(n.compressedImage3DTiles)){var s=n.compressedImage3DTiles.crunch,l=n.compressedImage3DTiles.s3tc,c=n.compressedImage3DTiles.pvrtc1,u=n.compressedImage3DTiles.etc1;p.s3tc&&defined(s)?(o=s.mimeType,defined(s.bufferView)?a=s.bufferView:f=s.uri):p.s3tc&&defined(l)?(o=l.mimeType,defined(l.bufferView)?a=l.bufferView:f=l.uri):p.pvrtc&&defined(c)?(o=c.mimeType,defined(c.bufferView)?a=c.bufferView:f=c.uri):p.etc1&&defined(u)&&(o=u.mimeType,defined(u.bufferView)?a=u.bufferView:f=u.uri)}if(defined(a))h._loadResources.texturesToCreateFromBufferView.enqueue({id:t,image:void 0,bufferView:a,mimeType:o});else{++h._loadResources.pendingTextureLoads;var d=h._resource.getDerivedResource({url:f});(ktxRegex$1.test(f)?loadKTX(d):crnRegex$1.test(f)?loadCRN(d):d.fetchImage()).then(imageLoad(h,t)).otherwise(ModelUtility.getFailedLoadFunction(h,"image",d.url))}})}var scratchArticulationStageInitialTransform=new Matrix4;function parseNodes(l){var c={},u={},d=[],h=l._loadResources.skinnedNodesIds,p=l._runtime.articulationsByName;ForEach.node(l.gltf,function(e,t){var i={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new Matrix4,computedMatrix:new Matrix4,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:e.jointName,weights:[],children:[],parents:[],publicNode:void 0};if(i.publicNode=new ModelNode(l,e,i,t,ModelUtility.getTransform(e)),c[t]=i,u[e.name]=i,defined(e.skin)&&(h.push(t),d.push(i)),defined(e.extensions)&&defined(e.extensions.AGI_articulations)){var r=e.extensions.AGI_articulations.articulationName;if(defined(r)){var n=Matrix4.clone(i.publicNode.originalMatrix,scratchArticulationStageInitialTransform),a=p[r];a.nodes.push(i.publicNode);for(var o=a.stages.length,s=0;s<o;++s){n=applyArticulationStageMatrix(a.stages[s],n)}i.publicNode.matrix=n}}}),l._runtime.nodes=c,l._runtime.nodesByName=u,l._runtime.skinnedNodes=d}function parseMaterials(n){var e=n.gltf,a=n._sourceTechniques,o={},s={},l=n._uniformMaps;ForEach.material(e,function(e,t){l[t]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0,morphWeightsUniformName:void 0};var i=new ModelMaterial(n,e,t);if(defined(e.extensions)&&defined(e.extensions.KHR_techniques_webgl)){var r=e.extensions.KHR_techniques_webgl.technique;i._technique=r,i._program=a[r].program,ForEach.materialValue(e,function(e,t){defined(i._values)||(i._values={}),i._values[t]=clone(e)})}o[e.name]=i,s[t]=i}),n._runtime.materialsByName=o,n._runtime.materialsById=s}function parseMeshes(a){var t={},i=a._runtime.materialsById;ForEach.mesh(a.gltf,function(e,n){t[e.name]=new ModelMesh(e,i,n),(defined(a.extensionsUsed.WEB3D_quantized_attributes)||a._dequantizeInShader)&&ForEach.meshPrimitive(e,function(e,t){var i=getProgramForPrimitive(a,e),r=a._programPrimitives[i];defined(r)||(r={},a._programPrimitives[i]=r),r[n+".primitive."+t]=e})}),a._runtime.meshesByName=t}var CreateVertexBufferJob=function(){this.id=void 0,this.model=void 0,this.context=void 0};function createVertexBuffer(e,t,i){var r=t._loadResources,n=t.gltf.bufferViews[e];defined(n)||(n=r.createdBufferViews[e]);var a=Buffer$1.createVertexBuffer({context:i,typedArray:r.getBuffer(n),usage:BufferUsage$1.STATIC_DRAW});a.vertexArrayDestroyable=!1,t._rendererResources.buffers[e]=a,t._geometryByteLength+=a.sizeInBytes}CreateVertexBufferJob.prototype.set=function(e,t,i){this.id=e,this.model=t,this.context=i},CreateVertexBufferJob.prototype.execute=function(){createVertexBuffer(this.id,this.model,this.context)};var CreateIndexBufferJob=function(){this.id=void 0,this.componentType=void 0,this.model=void 0,this.context=void 0};function createIndexBuffer(e,t,i,r){var n=i._loadResources,a=i.gltf.bufferViews[e];defined(a)||(a=n.createdBufferViews[e]);var o=Buffer$1.createIndexBuffer({context:r,typedArray:n.getBuffer(a),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:t});o.vertexArrayDestroyable=!1,i._rendererResources.buffers[e]=o,i._geometryByteLength+=o.sizeInBytes}CreateIndexBufferJob.prototype.set=function(e,t,i,r){this.id=e,this.componentType=t,this.model=i,this.context=r},CreateIndexBufferJob.prototype.execute=function(){createIndexBuffer(this.id,this.componentType,this.model,this.context)};var scratchVertexBufferJob=new CreateVertexBufferJob,scratchIndexBufferJob=new CreateIndexBufferJob;function createBuffers(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){var r,n=t.context,a=i.vertexBuffersToCreate,o=i.indexBuffersToCreate;if(e.asynchronous){for(;0<a.length&&(scratchVertexBufferJob.set(a.peek(),e,n),t.jobScheduler.execute(scratchVertexBufferJob,JobType$1.BUFFER));)a.dequeue();for(;0<o.length&&(r=o.peek(),scratchIndexBufferJob.set(r.id,r.componentType,e,n),t.jobScheduler.execute(scratchIndexBufferJob,JobType$1.BUFFER));)o.dequeue()}else{for(;0<a.length;)createVertexBuffer(a.dequeue(),e,n);for(;0<o.length;)createIndexBuffer((r=o.dequeue()).id,r.componentType,e,n)}}}function getProgramForPrimitive(e,t){var i=e._runtime.materialsById[t.material];if(defined(i))return i._program}function modifyShaderForQuantizedAttributes(e,t,i){var r,n,a,o=i._programPrimitives[t];if(!defined(o))return e;for(n in o)if(o.hasOwnProperty(n)&&getProgramForPrimitive(i,r=o[n])===t)break;if(i._programPrimitives[t]=void 0,i.extensionsUsed.WEB3D_quantized_attributes)a=ModelUtility.modifyShaderForQuantizedAttributes(i.gltf,r,e),i._quantizedUniforms[t]=a.uniforms;else{var s=i._decodedData[n];if(!defined(s))return e;a=ModelUtility.modifyShaderForDracoQuantizedAttributes(i.gltf,r,e,s.attributes)}return a.shader}function modifyShaderForColor(e){return e=ShaderSource.replaceMain(e,"gltf_blend_main"),e+="uniform vec4 gltf_color; \nuniform float gltf_colorBlend; \nvoid main() \n{ \n    gltf_blend_main(); \n    gl_FragColor.rgb = mix(gl_FragColor.rgb, gltf_color.rgb, gltf_colorBlend); \n    float highlight = ceil(gltf_colorBlend); \n    gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n    gl_FragColor.a *= gltf_color.a; \n} \n"}function modifyShader(e,t,i){return defined(i)&&(e=i(e,t)),e}var CreateProgramJob=function(){this.programToCreate=void 0,this.model=void 0,this.context=void 0};function createProgram(e,t,i){var r=e.programId,n=e.techniqueId,a=t._sourcePrograms[r],o=t._rendererResources.sourceShaders,s=o[a.vertexShader],l=o[a.fragmentShader],c=t._quantizedVertexShaders,u=t._toClipCoordinatesGLSL[r];if(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader){var d=c[r];defined(d)||(d=modifyShaderForQuantizedAttributes(s,r,t),c[r]=d),s=d}var h=modifyShader(s,r,t._vertexShaderLoaded),p=modifyShader(l,r,t._fragmentShaderLoaded);FeatureDetection.isInternetExplorer()||(h=ModelUtility.modifyVertexShaderForLogDepth(h,u),p=ModelUtility.modifyFragmentShaderForLogDepth(p)),defined(t._uniformMapLoaded)||(p="uniform vec4 czm_pickColor;\n"+p);var m=0<t._imageBasedLightingFactor.x||0<t._imageBasedLightingFactor.y;if(m&&(p="#define USE_IBL_LIGHTING \n\n"+p),defined(t._lightColor)&&(p="#define USE_CUSTOM_LIGHT_COLOR \n\n"+p),"2.0"===t._sourceVersion&&!t._sourceKHRTechniquesWebGL||(p=ShaderSource.replaceMain(p,"non_gamma_corrected_main"),p+="\nvoid main() { \n    non_gamma_corrected_main(); \n    gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n"),OctahedralProjectedCubeMap.isSupported(i)){var f=defined(t._sphericalHarmonicCoefficients)||t._useDefaultSphericalHarmonics,g=defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready||t._useDefaultSpecularMaps;(f||g||m)&&(p="uniform mat4 gltf_clippingPlanesMatrix; \n"+p),defined(t._sphericalHarmonicCoefficients)?p="#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"+p:t._useDefaultSphericalHarmonics&&(p="#define DIFFUSE_IBL \n"+p),defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready?p="#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"+p:t._useDefaultSpecularMaps&&(p="#define SPECULAR_IBL \n"+p)}defined(t._luminanceAtZenith)&&(p="#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"+p),createAttributesAndProgram(r,n,p,h,t,i)}function recreateProgram(e,t,i){var r=e.programId,n=e.techniqueId,a=t._sourcePrograms[r],o=t._rendererResources.sourceShaders,s=t._quantizedVertexShaders,l=t._toClipCoordinatesGLSL[r],c=t.clippingPlanes,u=isClippingEnabled(t),d=o[a.vertexShader],h=o[a.fragmentShader];(t.extensionsUsed.WEB3D_quantized_attributes||t._dequantizeInShader)&&(d=s[r]);var p=h;isColorShadingEnabled(t)&&(p=Model._modifyShaderForColor(p)),u&&(p=modifyShaderForClippingPlanes(p,c,i));var m=modifyShader(d,r,t._vertexShaderLoaded),f=modifyShader(p,r,t._fragmentShaderLoaded);FeatureDetection.isInternetExplorer()||(m=ModelUtility.modifyVertexShaderForLogDepth(m,l),f=ModelUtility.modifyFragmentShaderForLogDepth(f)),defined(t._uniformMapLoaded)||(f="uniform vec4 czm_pickColor;\n"+f);var g=0<t._imageBasedLightingFactor.x||0<t._imageBasedLightingFactor.y;if(g&&(f="#define USE_IBL_LIGHTING \n\n"+f),defined(t._lightColor)&&(f="#define USE_CUSTOM_LIGHT_COLOR \n\n"+f),"2.0"===t._sourceVersion&&!t._sourceKHRTechniquesWebGL||(f=ShaderSource.replaceMain(f,"non_gamma_corrected_main"),f+="\nvoid main() { \n    non_gamma_corrected_main(); \n    gl_FragColor = czm_gammaCorrect(gl_FragColor); \n} \n"),OctahedralProjectedCubeMap.isSupported(i)){var _=defined(t._sphericalHarmonicCoefficients)||t._useDefaultSphericalHarmonics,y=defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready||t._useDefaultSpecularMaps;!u&&(_||y||g)&&(f="uniform mat4 gltf_clippingPlanesMatrix; \n"+f),defined(t._sphericalHarmonicCoefficients)?f="#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"+f:t._useDefaultSphericalHarmonics&&(f="#define DIFFUSE_IBL \n"+f),defined(t._specularEnvironmentMapAtlas)&&t._specularEnvironmentMapAtlas.ready?f="#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"+f:t._useDefaultSpecularMaps&&(f="#define SPECULAR_IBL \n"+f)}defined(t._luminanceAtZenith)&&(f="#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"+f),createAttributesAndProgram(r,n,f,m,t,i)}function createAttributesAndProgram(e,t,i,r,n,a){var o=n._sourceTechniques[t],s=ModelUtility.createAttributeLocations(o,n._precreatedAttributes);n._rendererResources.programs[e]=ShaderProgram.fromCache({context:a,vertexShaderSource:r,fragmentShaderSource:i,attributeLocations:s})}CreateProgramJob.prototype.set=function(e,t,i){this.programToCreate=e,this.model=t,this.context=i},CreateProgramJob.prototype.execute=function(){createProgram(this.programToCreate,this.model,this.context)};var scratchCreateProgramJob=new CreateProgramJob;function createPrograms(e,t){var i=e._loadResources,r=i.programsToCreate;if(0===i.pendingShaderLoads&&0===i.pendingBufferLoads){var n=t.context;if(e.asynchronous)for(;0<r.length&&(scratchCreateProgramJob.set(r.peek(),e,n),t.jobScheduler.execute(scratchCreateProgramJob,JobType$1.PROGRAM));)r.dequeue();else for(;0<r.length;)createProgram(r.dequeue(),e,n)}}function getOnImageCreatedFromTypedArray(t,i){return function(e){t.texturesToCreate.enqueue({id:i.id,image:e,bufferView:void 0}),--t.pendingBufferViewToImage}}function loadTexturesFromBufferViews(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;0<t.texturesToCreateFromBufferView.length;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView],a=(r.textures[i.id].source,ModelUtility.getFailedLoadFunction(e,"image","id: "+i.id+", bufferView: "+i.bufferView));if("image/ktx"===i.mimeType)loadKTX(t.getBuffer(n)).then(imageLoad(e,i.id)).otherwise(a),++e._loadResources.pendingTextureLoads;else if("image/crn"===i.mimeType)loadCRN(t.getBuffer(n)).then(imageLoad(e,i.id)).otherwise(a),++e._loadResources.pendingTextureLoads;else{var o=getOnImageCreatedFromTypedArray(t,i);loadImageFromTypedArray({uint8Array:t.getBuffer(n),format:i.mimeType,flipY:!1}).then(o).otherwise(a),++t.pendingBufferViewToImage}}}function createSamplers(e){var t=e._loadResources;if(t.createSamplers){t.createSamplers=!1;var i=e._rendererResources.samplers;ForEach.sampler(e.gltf,function(e,t){i[t]=new Sampler({wrapS:e.wrapS,wrapT:e.wrapT,minificationFilter:e.minFilter,magnificationFilter:e.magFilter})})}}var CreateTextureJob=function(){this.gltfTexture=void 0,this.model=void 0,this.context=void 0};function createTexture$1(e,t,i){var r=t.gltf.textures[e.id],n=t._rendererResources.samplers[r.sampler];defined(n)||(n=new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT}));for(var a=!1,o=t.gltf.materials,s=o.length,l=0;l<s;++l){var c=o[l];if(defined(c.extensions)&&defined(c.extensions.KHR_techniques_webgl)){var u=c.extensions.KHR_techniques_webgl.values;for(var d in u)if(u.hasOwnProperty(d)&&-1!==d.indexOf("Texture")){var h=u[d];if(h.index===e.id&&defined(h.extensions)&&defined(h.extensions.KHR_texture_transform)){a=!0;break}}}if(a)break}var p=n.wrapS,m=n.wrapT,f=n.minificationFilter;a&&f!==TextureMinificationFilter$1.LINEAR&&f!==TextureMinificationFilter$1.NEAREST&&(f=f===TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST||f===TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR?TextureMinificationFilter$1.NEAREST:TextureMinificationFilter$1.LINEAR,n=new Sampler({wrapS:n.wrapS,wrapT:n.wrapT,textureMinificationFilter:f,textureMagnificationFilter:n.magnificationFilter}));var g,_=e.internalFormat,y=!(defined(_)&&PixelFormat$1.isCompressedFormat(_)||f!==TextureMinificationFilter$1.NEAREST_MIPMAP_NEAREST&&f!==TextureMinificationFilter$1.NEAREST_MIPMAP_LINEAR&&f!==TextureMinificationFilter$1.LINEAR_MIPMAP_NEAREST&&f!==TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR),v=y||p===TextureWrap$1.REPEAT||p===TextureWrap$1.MIRRORED_REPEAT||m===TextureWrap$1.REPEAT||m===TextureWrap$1.MIRRORED_REPEAT,C=e.image;if(defined(_))g=new Texture({context:i,source:{arrayBufferView:e.bufferView},width:e.width,height:e.height,pixelFormat:_,sampler:n});else if(defined(C)){var S=!CesiumMath.isPowerOfTwo(C.width)||!CesiumMath.isPowerOfTwo(C.height);if(v&&S){var x=document.createElement("canvas");x.width=CesiumMath.nextPowerOfTwo(C.width),x.height=CesiumMath.nextPowerOfTwo(C.height),x.getContext("2d").drawImage(C,0,0,C.width,C.height,0,0,x.width,x.height),C=x}g=new Texture({context:i,source:C,pixelFormat:r.internalFormat,pixelDatatype:r.type,sampler:n,flipY:!1}),y&&g.generateMipmap()}defined(g)&&(t._rendererResources.textures[e.id]=g,t._texturesByteLength+=g.sizeInBytes)}CreateTextureJob.prototype.set=function(e,t,i){this.gltfTexture=e,this.model=t,this.context=i},CreateTextureJob.prototype.execute=function(){createTexture$1(this.gltfTexture,this.model,this.context)};var scratchCreateTextureJob=new CreateTextureJob;function createTextures(e,t){var i=t.context,r=e._loadResources.texturesToCreate;if(e.asynchronous)for(;0<r.length&&(scratchCreateTextureJob.set(r.peek(),e,i),t.jobScheduler.execute(scratchCreateTextureJob,JobType$1.TEXTURE));)r.dequeue();else for(;0<r.length;)createTexture$1(r.dequeue(),e,i)}function getAttributeLocations(e,t){var i,r,n=e._sourceTechniques,a={},o=e._runtime.materialsById[t.material];if(!defined(o))return a;var s=n[o._technique];if(!defined(s))return a;var l=s.attributes,c=e._rendererResources.programs[s.program],u=c.vertexAttributes,d=c._attributeLocations;for(i in u)if(u.hasOwnProperty(i)){var h=l[i];defined(h)&&(r=d[i],a[h.semantic]=r)}var p=e._precreatedAttributes;if(defined(p))for(i in p)p.hasOwnProperty(i)&&(r=d[i],a[i]=r);return a}function mapJointNames(e,t){for(var i=e.length,r={},n=0;n<i;++n)for(var a=[e[n]];0<a.length;){var o=a.pop(),s=t[o];defined(s)&&(r[o]=o);var l=s.children;if(defined(l))for(var c=l.length,u=0;u<c;++u)a.push(l[u])}return r}function createJoints(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,a=e._runtime.nodes,o=e._loadResources.skinnedNodesIds,s=o.length,l=0;l<s;++l){var c=o[l],u=a[c],d=n[c],h=t[d.skin];u.inverseBindMatrices=h.inverseBindMatrices,u.bindShapeMatrix=h.bindShapeMatrix;var p=[],m=r[d.skin];defined(m.skeleton)&&p.push(m.skeleton);for(var f=mapJointNames(p,n),g=r[d.skin].joints,_=g.length,y=0;y<_;++y){var v=a[f[g[y]]];u.joints.push(v)}}}function createSkins(n){var e=n._loadResources;if(0===e.pendingBufferLoads&&e.createSkins){e.createSkins=!1;var t=n.gltf,a=t.accessors,o={};ForEach.skin(t,function(e,t){var i,r=a[e.inverseBindMatrices];Matrix4.equals(e.bindShapeMatrix,Matrix4.IDENTITY)||(i=Matrix4.clone(e.bindShapeMatrix)),o[t]={inverseBindMatrices:ModelAnimationCache.getSkinInverseBindMatrices(n,r),bindShapeMatrix:i}}),createJoints(n,o)}}function getChannelEvaluator(t,i,r,n){return function(e){defined(n)&&(e=t.clampAnimations?n.clampTime(e):n.wrapTime(e),i[r]=n.evaluate(e,i[r]),i.dirtyNumber=t._maxDirtyNumber)}}function createRuntimeAnimations(g){var e=g._loadResources;if(e.finishedPendingBufferLoads()&&e.createRuntimeAnimations){e.createRuntimeAnimations=!1,g._runtime.animations=[];var _=g._runtime.nodes,y=g.gltf.accessors;ForEach.animation(g.gltf,function(e,t){for(var i=e.channels,r=e.samplers,n=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=i.length,s=new Array(o),l=0;l<o;++l){var c=i[l],u=c.target,d=u.path,h=r[c.sampler],p=ModelAnimationCache.getAnimationParameterValues(g,y[h.input]),m=ModelAnimationCache.getAnimationParameterValues(g,y[h.output]);n=Math.min(n,p[0]),a=Math.max(a,p[p.length-1]);var f=ModelAnimationCache.getAnimationSpline(g,t,e,c.sampler,h,p,d,m);s[l]=getChannelEvaluator(g,_[u.node],u.path,f)}g._runtime.animations[t]={name:e.name,startTime:n,stopTime:a,channelEvaluators:s}})}}function createVertexArrays(h,p){var e=h._loadResources;if(e.finishedBuffersCreation()&&e.finishedProgramCreation()&&e.createVertexArrays){e.createVertexArrays=!1;var m=h._rendererResources.buffers,f=h._rendererResources.vertexArrays,g=h.gltf,_=g.accessors;ForEach.mesh(g,function(e,d){ForEach.meshPrimitive(e,function(e,t){var o,i,r,s=[],l=getAttributeLocations(h,e),c=h._decodedData[d+".primitive."+t];ForEach.meshPrimitiveAttribute(e,function(e,t){if(defined(o=l[t])){if(defined(c)){var i=c.attributes;if(i.hasOwnProperty(t)){var r=i[t];return void s.push({index:o,vertexBuffer:m[r.bufferView],componentsPerAttribute:r.componentsPerAttribute,componentDatatype:r.componentDatatype,normalize:r.normalized,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride})}}var n=_[e],a=defined(n.normalized)&&n.normalized;s.push({index:o,vertexBuffer:m[n.bufferView],componentsPerAttribute:numberOfComponentsForType(n.type),componentDatatype:n.componentType,normalize:a,offsetInBytes:n.byteOffset,strideInBytes:getAccessorByteStride(g,n)})}});var n,a=h._precreatedAttributes;if(defined(a))for(r in a)a.hasOwnProperty(r)&&defined(o=l[r])&&((i=a[r]).index=o,s.push(i));if(defined(e.indices)){var u=_[e.indices].bufferView;defined(c)&&(u=c.bufferView),n=m[u]}f[d+".primitive."+t]=new VertexArray({context:p,attributes:s,indexBuffer:n})})})}}function createRenderStates$2(i){var e=i._loadResources;e.createRenderStates&&(e.createRenderStates=!1,ForEach.material(i.gltf,function(e,t){createRenderStateForMaterial(i,e,t)}))}function createRenderStateForMaterial(e,t,i){var r=e._rendererResources.renderStates,n=[WebGLConstants$1.FUNC_ADD,WebGLConstants$1.FUNC_ADD],a=[WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA,WebGLConstants$1.ONE,WebGLConstants$1.ONE_MINUS_SRC_ALPHA];defined(t.extensions)&&defined(t.extensions.KHR_blend)&&(n=t.extensions.KHR_blend.blendEquation,a=t.extensions.KHR_blend.blendFactors);var o=!t.doubleSided,s="BLEND"===t.alphaMode;r[i]=RenderState.fromCache({cull:{enabled:o},depthTest:{enabled:!0},depthMask:!s,blending:{enabled:s,equationRgb:n[0],equationAlpha:n[1],functionSourceRgb:a[0],functionDestinationRgb:a[1],functionSourceAlpha:a[2],functionDestinationAlpha:a[3]}})}var gltfUniformsFromNode={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r)}},CESIUM_RTC_MODELVIEW:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.setTranslation(r,t._rtcCenterEye,r)}},MODELVIEWPROJECTION:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.multiply(e._projection,r,r)}},MODELINVERSE:function(e,t,i){var r=new Matrix4;return function(){return Matrix4.inverse(i.computedMatrix,r)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){var r=new Matrix4,n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.inverse(r,n)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){var r=new Matrix4,n=new Matrix4;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.multiply(e._projection,r,r),Matrix4.inverse(r,n)}},MODELINVERSETRANSPOSE:function(e,t,i){var r=new Matrix4,n=new Matrix3;return function(){return Matrix4.inverse(i.computedMatrix,r),Matrix4.getMatrix3(r,n),Matrix3.transpose(n,n)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){var r=new Matrix4,n=new Matrix4,a=new Matrix3;return function(){return Matrix4.multiplyTransformation(e.view,i.computedMatrix,r),Matrix4.inverse(r,n),Matrix4.getMatrix3(n,a),Matrix3.transpose(a,a)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}};function getUniformFunctionFromSource(e,t,i,r){var n=t._runtime.nodes[e];return gltfUniformsFromNode[i](r,t,n)}function createUniformsForMaterial(o,s,e,l,c,u,d){var h,p,m={},f={};return ForEach.techniqueUniform(e,function(e,t){var i;if(defined(l)&&defined(l[t]))i=ModelUtility.createUniformFunction(e.type,l[t],u,d),m[t]=i.func,f[t]=i;else if(defined(e.node))m[t]=getUniformFunctionFromSource(e.node,o,e.semantic,c.uniformState);else if(defined(e.semantic))if("JOINTMATRIX"===e.semantic)h=t;else if("MORPHWEIGHTS"===e.semantic)p=t;else if("ALPHACUTOFF"===e.semantic){var r=s.alphaMode;if(defined(r)&&"MASK"===r){var n=defaultValue(s.alphaCutoff,.5);i=ModelUtility.createUniformFunction(e.type,n,u,d),m[t]=i.func,f[t]=i}}else m[t]=ModelUtility.getGltfSemanticUniforms()[e.semantic](c.uniformState,o);else if(defined(e.value)){var a=ModelUtility.createUniformFunction(e.type,e.value,u,d);m[t]=a.func,f[t]=a}}),{map:m,values:f,jointMatrixUniformName:h,morphWeightsUniformName:p}}function createUniformMaps(s,l){var e=s._loadResources;if(e.finishedProgramCreation()&&e.createUniformMaps){e.createUniformMaps=!1;var t=s.gltf,c=s._sourceTechniques,u=s._uniformMaps,d=s._rendererResources.textures,h=s._defaultTexture;ForEach.material(t,function(e,t){var i=s._runtime.materialsById[t],r=c[i._technique],n=i._values,a=createUniformsForMaterial(s,e,r,n,l,d,h),o=u[t];o.uniformMap=a.map,o.values=a.values,o.jointMatrixUniformName=a.jointMatrixUniformName,o.morphWeightsUniformName=a.morphWeightsUniformName})}}function createUniformsForDracoQuantizedAttributes(e){return ModelUtility.createUniformsForDracoQuantizedAttributes(e.attributes)}function createUniformsForQuantizedAttributes(e,t){var i=getProgramForPrimitive(e,t),r=e._quantizedUniforms[i];return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,r)}function createPickColorFunction(e){return function(){return e}}function createJointMatricesFunction(e){return function(){return e.computedJointMatrices}}function createMorphWeightsFunction(e){return function(){return e.weights}}function createSilhouetteColorFunction(e){return function(){return e.silhouetteColor}}function createSilhouetteSizeFunction(e){return function(){return e.silhouetteSize}}function createColorFunction(e){return function(){return e.color}}var scratchClippingPlaneMatrix=new Matrix4;function createClippingPlanesMatrixFunction(i){return function(){var e=i.clippingPlanes;if(!defined(e)&&!defined(i._sphericalHarmonicCoefficients)&&!defined(i._specularEnvironmentMaps))return Matrix4.IDENTITY;var t=defined(e)?e.modelMatrix:Matrix4.IDENTITY;return Matrix4.multiply(i._clippingPlaneModelViewMatrix,t,scratchClippingPlaneMatrix)}}function createClippingPlanesFunction(t){return function(){var e=t.clippingPlanes;return defined(e)&&e.enabled?e.texture:t._defaultTexture}}function createClippingPlanesEdgeStyleFunction(i){return function(){var e=i.clippingPlanes;if(!defined(e))return Color.WHITE.withAlpha(0);var t=Color.clone(e.edgeColor);return t.alpha=e.edgeWidth,t}}function createColorBlendFunction(e){return function(){return ColorBlendMode$1.getColorBlend(e.colorBlendMode,e.colorBlendAmount)}}function createIBLFactorFunction(e){return function(){return e._imageBasedLightingFactor}}function createLightColorFunction(e){return function(){return e._lightColor}}function createLuminanceAtZenithFunction(e){return function(){return e.luminanceAtZenith}}function createSphericalHarmonicCoefficientsFunction(e){return function(){return e._sphericalHarmonicCoefficients}}function createSpecularEnvironmentMapFunction(e){return function(){return e._specularEnvironmentMapAtlas.texture}}function createSpecularEnvironmentMapSizeFunction(e){return function(){return e._specularEnvironmentMapAtlas.texture.dimensions}}function createSpecularEnvironmentMapLOD(e){return function(){return e._specularEnvironmentMapAtlas.maximumMipmapLevel}}function triangleCountFromPrimitiveIndices(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createCommand(e,t,i,r,n){for(var a=e._nodeCommands,o=e._pickIds,s=e.allowPicking,l=e._runtime.meshesByName,c=e._rendererResources,u=c.vertexArrays,d=c.programs,h=c.renderStates,p=e._uniformMaps,m=e.gltf,f=m.accessors,g=m.meshes,_=t.mesh,y=g[_],v=y.primitives,C=v.length,S=0;S<C;++S){var x,T=v[S],b=f[T.indices],E=e._runtime.materialsById[T.material]._program,P=e._decodedData[_+".primitive."+S],A=T.attributes.POSITION;if(defined(A)){var w=ModelUtility.getAccessorMinMax(m,A);x=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(w.min),Cartesian3.fromArray(w.max))}var D,M,I=u[_+".primitive."+S];if(defined(P))M=P.numberOfIndices,D=0;else if(defined(b))M=b.count,D=b.byteOffset/IndexDatatype$1.getSizeInBytes(b.componentType);else{M=f[T.attributes.POSITION].count,D=0}e._trianglesLength+=triangleCountFromPrimitiveIndices(T,M);var R=p[T.material],O=R.uniformMap;if(defined(R.jointMatrixUniformName)){var L={};L[R.jointMatrixUniformName]=createJointMatricesFunction(i),O=combine(O,L)}if(defined(R.morphWeightsUniformName)){var F={};F[R.morphWeightsUniformName]=createMorphWeightsFunction(i),O=combine(O,F)}O=combine(O,{gltf_color:createColorFunction(e),gltf_colorBlend:createColorBlendFunction(e),gltf_clippingPlanes:createClippingPlanesFunction(e),gltf_clippingPlanesEdgeStyle:createClippingPlanesEdgeStyleFunction(e),gltf_clippingPlanesMatrix:createClippingPlanesMatrixFunction(e),gltf_iblFactor:createIBLFactorFunction(e),gltf_lightColor:createLightColorFunction(e),gltf_sphericalHarmonicCoefficients:createSphericalHarmonicCoefficientsFunction(e),gltf_specularMap:createSpecularEnvironmentMapFunction(e),gltf_specularMapSize:createSpecularEnvironmentMapSizeFunction(e),gltf_maxSpecularLOD:createSpecularEnvironmentMapLOD(e),gltf_luminanceAtZenith:createLuminanceAtZenithFunction(e),yp_mat_x:function(){return ExpandByMars.tilesEditor.yp_mat_x[0]&&ExpandByMars.tilesEditor.yp_mat_x[1]?Matrix4.fromArray(ExpandByMars.tilesEditor.yp_mat_x):new Matrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},yp_mat_y:function(){return ExpandByMars.tilesEditor.yp_mat_y[0]?Matrix4.fromArray(ExpandByMars.tilesEditor.yp_mat_y):new Matrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},yp_mat_z:function(){return ExpandByMars.tilesEditor.yp_mat_z[0]?Matrix4.fromArray(ExpandByMars.tilesEditor.yp_mat_z):new Matrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},yp_max_index:function(){return ExpandByMars.tilesEditor.yp_max_index},flatRect:function(){return ExpandByMars.tilesEditor.flatRect[0]?Matrix3.fromArray(ExpandByMars.tilesEditor.flatRect):new Matrix3(0,0,0,0,0,0,0,0,0)},hm_dh_attr:function(){return new Cartesian4(ExpandByMars.tilesEditor.hm_dh_attr[0],ExpandByMars.tilesEditor.hm_dh_attr[1],ExpandByMars.tilesEditor.hm_dh_attr[2],.001*((new Date).getTime()-ExpandByMars.tilesEditor.times))},model_min_height:function(){return ExpandByMars.tilesEditor.model_min_height?ExpandByMars.tilesEditor.model_min_height:0},model_add_height:function(){return ExpandByMars.tilesEditor.model_add_height?ExpandByMars.tilesEditor.model_add_height:0},yp_show_InOrOut:function(){return new Cartesian4(ExpandByMars.tilesEditor.yp_show_InOrOut[0],ExpandByMars.tilesEditor.yp_show_InOrOut[1],ExpandByMars.tilesEditor.yp_show_InOrOut[2],ExpandByMars.tilesEditor.yp_show_InOrOut[3])},IsYaPing:function(){return new Cartesian4(ExpandByMars.tilesEditor.IsYaPing[0],ExpandByMars.tilesEditor.IsYaPing[1],ExpandByMars.tilesEditor.IsYaPing[2],ExpandByMars.tilesEditor.IsYaPing[3])},modelLight:function(){return ExpandByMars.tilesEditor.modelLight},floodVar:function(){return new Cartesian4(ExpandByMars.tilesEditor.floodVar[0],ExpandByMars.tilesEditor.floodVar[1],ExpandByMars.tilesEditor.floodVar[2],ExpandByMars.tilesEditor.floodVar[3])},floodColor:function(){return new Cartesian4(ExpandByMars.tilesEditor.floodColor[0],ExpandByMars.tilesEditor.floodColor[1],ExpandByMars.tilesEditor.floodColor[2],ExpandByMars.tilesEditor.floodColor[3])}}),defined(e._uniformMapLoaded)&&(O=e._uniformMapLoaded(O,E,i));var N={};e.extensionsUsed.WEB3D_quantized_attributes?N=createUniformsForQuantizedAttributes(e,T):e._dequantizeInShader&&defined(P)&&(N=createUniformsForDracoQuantizedAttributes(P)),O=combine(O,N);var B=h[T.material],V=B.blending.enabled,k=e._pickObject;defined(k)||(k={primitive:e,id:e.id,node:i.publicNode,mesh:l[y.name]});var $,z=ShadowMode$1.castShadows(e._shadows),U=ShadowMode$1.receiveShadows(e._shadows);if(s&&!defined(e._uniformMapLoaded))$=r.createPickId(k),o.push($),O=combine(O,{czm_pickColor:createPickColorFunction($.color)});s&&($=defined(e._pickIdLoaded)&&defined(e._uniformMapLoaded)?e._pickIdLoaded():"czm_pickColor");var G,H=new DrawCommand({boundingVolume:new BoundingSphere,cull:e.cull,modelMatrix:new Matrix4,primitiveType:T.mode,vertexArray:I,count:M,offset:D,shaderProgram:d[E],castShadows:z,receiveShadows:U,uniformMap:O,renderState:B,owner:k,pass:V?Pass$1.TRANSLUCENT:e.opaquePass,pickId:$});n||((G=DrawCommand.shallowClone(H)).boundingVolume=new BoundingSphere,G.modelMatrix=new Matrix4);var W={show:!0,boundingSphere:x,command:H,command2D:G,silhouetteModelCommand:void 0,silhouetteModelCommand2D:void 0,silhouetteColorCommand:void 0,silhouetteColorCommand2D:void 0,translucentCommand:void 0,translucentCommand2D:void 0,programId:E};i.commands.push(W),a.push(W)}}function createRuntimeNodes(e,t,i){var r=e._loadResources;if(r.finishedEverythingButTextureCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],a=e._runtime.nodes,o=e.gltf,s=o.nodes,l=o.skins,c=o.scenes[o.scene].nodes,u=c.length,d=[],h={},p=0;p<u;++p){d.push({parentRuntimeNode:void 0,gltfNode:s[c[p]],id:c[p]});for(var m=[];0<d.length;){var f=d.pop();h[f.id]=!0;var g=f.parentRuntimeNode,_=f.gltfNode,y=a[f.id];if(0===y.parents.length)if(defined(_.matrix))y.matrix=Matrix4.fromColumnMajorArray(_.matrix);else{var v=_.rotation;y.translation=Cartesian3.fromArray(_.translation),y.rotation=Quaternion.unpack(v),y.scale=Cartesian3.fromArray(_.scale)}defined(g)?(g.children.push(y),y.parents.push(g)):n.push(y),defined(_.mesh)&&createCommand(e,_,y,t,i);var C=_.children;if(defined(C))for(var S=C.length,x=0;x<S;x++){var T=C[x];h[T]||d.push({parentRuntimeNode:y,gltfNode:s[T],id:C[x]})}var b=_.skin;if(defined(b)&&m.push(l[b].skeleton),0===d.length)for(var E=0;E<m.length;E++){var P=m[E];h[P]||d.push({parentRuntimeNode:void 0,gltfNode:s[P],id:P})}}}e._runtime.rootNodes=n,e._runtime.nodes=a}}function getGeometryByteLength(e){var t=0;for(var i in e)e.hasOwnProperty(i)&&(t+=e[i].sizeInBytes);return t}function getTexturesByteLength(e){var t=0;for(var i in e)e.hasOwnProperty(i)&&(t+=e[i].sizeInBytes);return t}function createResources(e,t){var i=t.context,r=t.scene3DOnly,n=e._quantizedVertexShaders,a=e._toClipCoordinatesGLSL={},o=e._sourceTechniques,s=e._sourcePrograms,l=e._rendererResources,c=l.sourceShaders;for(var u in e._loadRendererResourcesFromCache&&(c=l.sourceShaders=e._cachedRendererResources.sourceShaders),o)if(o.hasOwnProperty(u)){var d=o[u].program,h=s[d],p=c[h.vertexShader];if(ModelUtility.checkSupportedGlExtensions(h.glExtensions,i),e.extensionsUsed.WEB3D_quantized_attributes||e._dequantizeInShader){var m=n[d];defined(m)||(m=modifyShaderForQuantizedAttributes(p,d,e),n[d]=m),p=m}p=modifyShader(p,d,e._vertexShaderLoaded),a[d]=ModelUtility.toClipCoordinatesGLSL(e.gltf,p)}if(e._loadRendererResourcesFromCache){var f=e._cachedRendererResources;l.buffers=f.buffers,l.vertexArrays=f.vertexArrays,l.programs=f.programs,l.silhouettePrograms=f.silhouettePrograms,l.textures=f.textures,l.samplers=f.samplers,l.renderStates=f.renderStates,defined(e._precreatedAttributes)&&createVertexArrays(e,i),e._cachedGeometryByteLength+=getGeometryByteLength(f.buffers),e._cachedTexturesByteLength+=getTexturesByteLength(f.textures)}else createBuffers(e,t),createPrograms(e,t),createSamplers(e),loadTexturesFromBufferViews(e),createTextures(e,t);createSkins(e),createRuntimeAnimations(e),e._loadRendererResourcesFromCache||(createVertexArrays(e,i),createRenderStates$2(e)),createUniformMaps(e,i),createRuntimeNodes(e,i,r)}function getNodeMatrix(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&defined(r)?Matrix4.clone(r,t):defined(e.matrix)?Matrix4.clone(e.matrix,t):(Matrix4.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t),i.setMatrix(t))}var scratchNodeStack=[],scratchComputedTranslation=new Cartesian4,scratchComputedMatrixIn2D=new Matrix4;function updateNodeHierarchyModelMatrix(e,t,i,r){var n=e._maxDirtyNumber,a=e._runtime.rootNodes,o=a.length,s=scratchNodeStack,l=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){var c=Matrix4.getColumn(l,3,scratchComputedTranslation);if(Cartesian4.equals(c,Cartesian4.UNIT_W)){var u=e.boundingSphere.center,d=Transforms.wgs84To2DModelMatrix(r,u,scratchComputedMatrixIn2D);l=Matrix4.multiply(d,l,scratchComputedMatrixIn2D),defined(e._rtcCenter)&&(Matrix4.setTranslation(l,Cartesian4.UNIT_W,l),e._rtcCenter=e._rtcCenter2D)}else l=Transforms.basisTo2D(r,l,scratchComputedMatrixIn2D),e._rtcCenter=e._rtcCenter3D}for(var h=0;h<o;++h){var p=a[h];for(getNodeMatrix(p,p.transformToRoot),s.push(p);0<s.length;){var m=(p=s.pop()).transformToRoot,f=p.commands;if(p.dirtyNumber===n||t||i){var g=Matrix4.multiplyTransformation(l,m,p.computedMatrix),_=f.length;if(0<_)for(var y=0;y<_;++y){var v=f[y],C=v.command;Matrix4.clone(g,C.modelMatrix),BoundingSphere.transform(v.boundingSphere,C.modelMatrix,C.boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,C.boundingVolume.center,C.boundingVolume.center),defined(C=v.command2D)&&e._mode===SceneMode$1.SCENE2D&&(Matrix4.clone(g,C.modelMatrix),C.modelMatrix[13]-=2*CesiumMath.sign(C.modelMatrix[13])*CesiumMath.PI*r.ellipsoid.maximumRadius,BoundingSphere.transform(v.boundingSphere,C.modelMatrix,C.boundingVolume))}}var S=p.children;if(defined(S))for(var x=S.length,T=0;T<x;++T){var b=S[T];b.dirtyNumber=Math.max(b.dirtyNumber,p.dirtyNumber),b.dirtyNumber!==n&&!i||(getNodeMatrix(b,b.transformToRoot),Matrix4.multiplyTransformation(m,b.transformToRoot,b.transformToRoot)),s.push(b)}}}++e._maxDirtyNumber}var scratchObjectSpace=new Matrix4;function applySkins(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;r<i;++r){var n=t[r];scratchObjectSpace=Matrix4.inverseTransformation(n.transformToRoot,scratchObjectSpace);for(var a=n.computedJointMatrices,o=n.joints,s=n.bindShapeMatrix,l=n.inverseBindMatrices,c=l.length,u=0;u<c;++u)defined(a[u])||(a[u]=new Matrix4),a[u]=Matrix4.multiplyTransformation(scratchObjectSpace,o[u].transformToRoot,a[u]),a[u]=Matrix4.multiplyTransformation(a[u],l[u],a[u]),defined(s)&&(a[u]=Matrix4.multiplyTransformation(a[u],s,a[u]))}}function updatePerNodeShow(e){for(var t=e._runtime.rootNodes,i=t.length,r=scratchNodeStack,n=0;n<i;++n){var a=t[n];for(a.computedShow=a.publicNode.show,r.push(a);0<r.length;){for(var o=(a=r.pop()).computedShow,s=a.commands,l=s.length,c=0;c<l;++c)s[c].show=o;var u=a.children;if(defined(u))for(var d=u.length,h=0;h<d;++h){var p=u[h];p.computedShow=o&&p.publicNode.show,r.push(p)}}}}function updatePickIds(e,t){var i=e.id;if(e._id!==i){e._id=i;for(var r=e._pickIds,n=r.length,a=0;a<n;++a)r[a].object.id=i}}function updateWireframe(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;n<r;++n)i[n].command.primitiveType=t}}function updateShowBoundingVolume(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;n<r;++n)i[n].command.debugShowBoundingVolume=t}}function updateShadows(e){if(e.shadows!==e._shadows){e._shadows=e.shadows;for(var t=ShadowMode$1.castShadows(e.shadows),i=ShadowMode$1.receiveShadows(e.shadows),r=e._nodeCommands,n=r.length,a=0;a<n;a++){var o=r[a];o.command.castShadows=t,o.command.receiveShadows=i}}}function getTranslucentRenderState(e){var t=clone(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND,RenderState.fromCache(t)}function deriveTranslucentCommand(e){var t=DrawCommand.shallowClone(e);return t.pass=Pass$1.TRANSLUCENT,t.renderState=getTranslucentRenderState(e.renderState),t}function updateColor(e,t,i){var r=t.scene3DOnly,n=e.color.alpha;if(0<n&&n<1){var a=e._nodeCommands,o=a.length;if(!defined(a[0].translucentCommand)||i)for(var s=0;s<o;++s){var l=a[s],c=l.command;if(l.translucentCommand=deriveTranslucentCommand(c),!r){var u=l.command2D;l.translucentCommand2D=deriveTranslucentCommand(u)}}}}function getProgramId(e,t){var i=e._rendererResources.programs;for(var r in i)if(i.hasOwnProperty(r)&&i[r]===t)return r}function createSilhouetteProgram(e,t,i){var r=t.vertexShaderSource.sources[0],n=t._attributeLocations,a=e._normalAttributeName;r=ShaderSource.replaceMain(r,"gltf_silhouette_main"),r+="uniform float gltf_silhouetteSize; \nvoid main() \n{ \n    gltf_silhouette_main(); \n    vec3 n = normalize(czm_normal3D * "+a+"); \n    n.x *= czm_projection[0][0]; \n    n.y *= czm_projection[1][1]; \n    vec4 clip = gl_Position; \n    clip.xy += n.xy * clip.w * gltf_silhouetteSize * czm_pixelRatio / czm_viewport.z; \n    gl_Position = clip; \n}";return ShaderProgram.fromCache({context:i.context,vertexShaderSource:r,fragmentShaderSource:"uniform vec4 gltf_silhouetteColor; \nvoid main() \n{ \n    gl_FragColor = czm_gammaCorrect(gltf_silhouetteColor); \n}",attributeLocations:n})}function hasSilhouette(e,t){return silhouetteSupported(t.context)&&0<e.silhouetteSize&&0<e.silhouetteColor.alpha&&defined(e._normalAttributeName)}function hasTranslucentCommands(e){for(var t=e._nodeCommands,i=t.length,r=0;r<i;++r){if(t[r].command.pass===Pass$1.TRANSLUCENT)return!0}return!1}function isTranslucent(e){return 0<e.color.alpha&&e.color.alpha<1}function isInvisible(e){return 0===e.color.alpha}function alphaDirty(e,t){return Math.floor(e)!==Math.floor(t)||Math.ceil(e)!==Math.ceil(t)}var silhouettesLength=0;function createSilhouetteCommands(e,t){for(var i=++silhouettesLength%255,r=hasTranslucentCommands(e)||isTranslucent(e)||e.silhouetteColor.alpha<1,n=e._rendererResources.silhouettePrograms,a=t.scene3DOnly,o=e._nodeCommands,s=o.length,l=0;l<s;++l){var c=o[l],u=c.command,d=isTranslucent(e)?c.translucentCommand:u,h=DrawCommand.shallowClone(d),p=clone(d.renderState);p.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.ALWAYS,backFunction:WebGLConstants$1.ALWAYS,reference:i,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.REPLACE}},isInvisible(e)&&(p.colorMask={red:!1,green:!1,blue:!1,alpha:!1},p.depthMask=!1),p=RenderState.fromCache(p),h.renderState=p,c.silhouetteModelCommand=h;var m=DrawCommand.shallowClone(u);(p=clone(u.renderState,!0)).depthTest.enabled=!0,p.cull.enabled=!1,r&&(m.pass=Pass$1.TRANSLUCENT,p.depthMask=!1,p.blending=BlendingState$1.ALPHA_BLEND),p.stencilTest={enabled:!0,frontFunction:WebGLConstants$1.NOTEQUAL,backFunction:WebGLConstants$1.NOTEQUAL,reference:i,mask:-1,frontOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP},backOperation:{fail:WebGLConstants$1.KEEP,zFail:WebGLConstants$1.KEEP,zPass:WebGLConstants$1.KEEP}},p=RenderState.fromCache(p);var f=u.shaderProgram,g=getProgramId(e,f),_=n[g];defined(_)||(_=createSilhouetteProgram(e,f,t),n[g]=_);var y=combine(u.uniformMap,{gltf_silhouetteColor:createSilhouetteColorFunction(e),gltf_silhouetteSize:createSilhouetteSizeFunction(e)});if(m.renderState=p,m.shaderProgram=_,m.uniformMap=y,m.castShadows=!1,m.receiveShadows=!1,c.silhouetteColorCommand=m,!a){var v=c.command2D,C=DrawCommand.shallowClone(h);C.boundingVolume=v.boundingVolume,C.modelMatrix=v.modelMatrix,c.silhouetteModelCommand2D=C;var S=DrawCommand.shallowClone(m);C.boundingVolume=v.boundingVolume,C.modelMatrix=v.modelMatrix,c.silhouetteColorCommand2D=S}}}function modifyShaderForClippingPlanes(e,t,i){return e=ShaderSource.replaceMain(e,"gltf_clip_main"),e+=Model._getClippingFunction(t,i)+"\n",e+="uniform sampler2D gltf_clippingPlanes; \nuniform mat4 gltf_clippingPlanesMatrix; \nuniform vec4 gltf_clippingPlanesEdgeStyle; \nvoid main() \n{ \n    gltf_clip_main(); \n"+getClipAndStyleCode("gltf_clippingPlanes","gltf_clippingPlanesMatrix","gltf_clippingPlanesEdgeStyle")+"} \n"}function updateSilhouette(e,t,i){if(hasSilhouette(e,t)){var r=e._nodeCommands,n=alphaDirty(e.color.alpha,e._colorPreviousAlpha)||alphaDirty(e.silhouetteColor.alpha,e._silhouetteColorPreviousAlpha)||!defined(r[0].silhouetteModelCommand);e._colorPreviousAlpha=e.color.alpha,e._silhouetteColorPreviousAlpha=e.silhouetteColor.alpha,(n||i)&&createSilhouetteCommands(e,t)}}function updateClippingPlanes(e,t){var i=e._clippingPlanes;defined(i)&&i.owner===e&&i.enabled&&i.update(t)}var scratchBoundingSphere$3=new BoundingSphere;function scaleInPixels(e,t,i){return scratchBoundingSphere$3.center=e,scratchBoundingSphere$3.radius=t,i.camera.getPixelSize(scratchBoundingSphere$3,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}var scratchPosition$7=new Cartesian3,scratchCartographic$5=new Cartographic;function getScale(e,t){var i=e.scale;if(0!==e.minimumPixelSize){var r=t.context,n=Math.max(r.drawingBufferWidth,r.drawingBufferHeight),a=defined(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;if(scratchPosition$7.x=a[12],scratchPosition$7.y=a[13],scratchPosition$7.z=a[14],defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,scratchPosition$7,scratchPosition$7),e._mode!==SceneMode$1.SCENE3D){var o=t.mapProjection,s=o.ellipsoid.cartesianToCartographic(scratchPosition$7,scratchCartographic$5);o.project(s,scratchPosition$7),Cartesian3.fromElements(scratchPosition$7.z,scratchPosition$7.x,scratchPosition$7.y,scratchPosition$7)}var l=e.boundingSphere.radius,c=scaleInPixels(scratchPosition$7,l,t),u=1/c;Math.min(2*l*u,n)<e.minimumPixelSize&&(i=e.minimumPixelSize*c/(2*e._initialRadius))}return defined(e.maximumScale)?Math.min(e.maximumScale,i):i}function releaseCachedGltf(e){defined(e._cacheKey)&&defined(e._cachedGltf)&&0==--e._cachedGltf.count&&delete gltfCache[e._cacheKey],e._cachedGltf=void 0}function CachedRendererResources(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.sourceShaders=void 0,this.silhouettePrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function destroy(e){for(var t in e)e.hasOwnProperty(t)&&e[t].destroy()}function destroyCachedRendererResources(e){destroy(e.buffers),destroy(e.vertexArrays),destroy(e.programs),destroy(e.silhouettePrograms),destroy(e.textures)}function getUpdateHeightCallback(r,n,a){return function(e){if(r.heightReference===HeightReference$1.RELATIVE_TO_GROUND){var t=n.cartesianToCartographic(e,scratchCartographic$5);t.height+=a.height,n.cartographicToCartesian(t,e)}var i=r._clampedModelMatrix;Matrix4.clone(r.modelMatrix,i),i[12]=e.x,i[13]=e.y,i[14]=e.z,r._heightChanged=!0}}function updateClamping(e){defined(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);var t=e._scene;if(defined(t)&&defined(t.globe)&&e.heightReference!==HeightReference$1.NONE){var i=t.globe,r=i.ellipsoid,n=e.modelMatrix;scratchPosition$7.x=n[12],scratchPosition$7.y=n[13],scratchPosition$7.z=n[14];var a=r.cartesianToCartographic(scratchPosition$7);defined(e._clampedModelMatrix)||(e._clampedModelMatrix=Matrix4.clone(n,new Matrix4));var o=i._surface;e._removeUpdateHeightCallback=o.updateHeight(a,getUpdateHeightCallback(e,r,a));var s=i.getHeight(a);if(defined(s)){var l=getUpdateHeightCallback(e,r,a);Cartographic.clone(a,scratchCartographic$5),scratchCartographic$5.height=s,r.cartographicToCartesian(scratchCartographic$5,scratchPosition$7),l(scratchPosition$7)}}else e._clampedModelMatrix=void 0}CachedRendererResources.prototype.release=function(){if(0==--this.count)return defined(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],destroyCachedRendererResources(this),destroyObject(this)};var scratchDisplayConditionCartesian=new Cartesian3,scratchDistanceDisplayConditionCartographic=new Cartographic;function distanceDisplayConditionVisible(e,t){var i,r=e.distanceDisplayCondition,n=r.near*r.near,a=r.far*r.far;if(t.mode===SceneMode$1.SCENE2D){i=.5*(t.camera.frustum.right-t.camera.frustum.left),i*=i}else{var o=Matrix4.getTranslation(e.modelMatrix,scratchDisplayConditionCartesian);if(t.mode===SceneMode$1.COLUMBUS_VIEW){var s=t.mapProjection,l=s.ellipsoid.cartesianToCartographic(o,scratchDistanceDisplayConditionCartographic);o=s.project(l,o),Cartesian3.fromElements(o.z,o.x,o.y,o)}i=Cartesian3.distanceSquared(o,t.camera.positionWC)}return n<=i&&i<=a}function destroyIfNotCached(e,t){e.programs!==t.programs&&destroy(e.programs),e.silhouettePrograms!==t.silhouettePrograms&&destroy(e.silhouettePrograms)}function regenerateShaders(e,t){var i,r=e._rendererResources,n=e._cachedRendererResources;if(destroyIfNotCached(r,n),isClippingEnabled(e)||isColorShadingEnabled(e)||e._shouldRegenerateShaders){e._shouldRegenerateShaders=!1,r.programs={},r.silhouettePrograms={};var a={},o=e._sourceTechniques;for(var s in o)o.hasOwnProperty(s)&&(a[i=o[s].program]||(a[i]=!0,recreateProgram({programId:i,techniqueId:s},e,t.context)))}else r.programs=n.programs,r.silhouettePrograms=n.silhouettePrograms;for(var l=r.programs,c=e._nodeCommands,u=c.length,d=0;d<u;++d){var h=c[d],p=l[i=h.programId];h.command.shaderProgram=p,defined(h.command2D)&&(h.command2D.shaderProgram=p)}updateColor(e,t,!0),updateSilhouette(e,t,!0)}Model.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING)if(FeatureDetection.supportsWebP.initialized){var t=FeatureDetection.supportsWebP(),i=e.context;if(this._defaultTexture=i.defaultTexture,this._state===ModelState.NEEDS_LOAD&&defined(this.gltf)){var r,n=this.cacheKey;if(defined(n)){i.cache.modelRendererResourceCache=defaultValue(i.cache.modelRendererResourceCache,{});var a=i.cache.modelRendererResourceCache;if(defined(r=a[this.cacheKey])){if(!r.ready)return;++r.count,this._loadRendererResourcesFromCache=!0}else(r=new CachedRendererResources(i,n)).count=1,a[this.cacheKey]=r;this._cachedRendererResources=r}else(r=new CachedRendererResources(i)).count=1,this._cachedRendererResources=r;if(this._state=ModelState.LOADING,this._state!==ModelState.FAILED){var o=this.gltf.extensions;if(defined(o)&&defined(o.CESIUM_RTC)){var s=Cartesian3.fromArray(o.CESIUM_RTC.center);if(!Cartesian3.equals(s,Cartesian3.ZERO)){this._rtcCenter3D=s;var l=e.mapProjection,c=l.ellipsoid.cartesianToCartographic(this._rtcCenter3D),u=l.project(c);Cartesian3.fromElements(u.z,u.x,u.y,u),this._rtcCenter2D=u,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}addPipelineExtras(this.gltf),this._loadResources=new ModelLoadResources,this._loadRendererResourcesFromCache||ModelUtility.parseBuffers(this,bufferLoad)}}var d=this._loadResources,h=this._incrementallyLoadTextures,p=!1;if(this._state===ModelState.LOADING){if(0===d.pendingBufferLoads){if(!d.initialized){if(e.brdfLutGenerator.update(e),ModelUtility.checkSupportedExtensions(this.extensionsRequired,t),ModelUtility.updateForwardAxis(this),!defined(this.gltf.extras.sourceVersion)){var m=this.gltf;m.extras.sourceVersion=ModelUtility.getAssetVersion(m),m.extras.sourceKHRTechniquesWebGL=defined(ModelUtility.getUsedExtensions(m).KHR_techniques_webgl),this._sourceVersion=m.extras.sourceVersion,this._sourceKHRTechniquesWebGL=m.extras.sourceKHRTechniquesWebGL,updateVersion(m),addDefaults(m);var f={addBatchIdToGeneratedShaders:this._addBatchIdToGeneratedShaders};processModelMaterialsCommon(m,f),processPbrMaterials(m,f)}this._sourceVersion=this.gltf.extras.sourceVersion,this._sourceKHRTechniquesWebGL=this.gltf.extras.sourceKHRTechniquesWebGL,this._dequantizeInShader=this._dequantizeInShader&&DracoLoader.hasExtension(this),addBuffersToLoadResources(this),parseArticulations(this),parseTechniques(this),this._loadRendererResourcesFromCache||(parseBufferViews(this),parseShaders(this),parsePrograms(this),parseTextures(this,i,t)),parseMaterials(this),parseMeshes(this),parseNodes(this),DracoLoader.parse(this,i),d.initialized=!0}d.finishedDecoding()||DracoLoader.decodeModel(this,i).otherwise(ModelUtility.getFailedLoadFunction(this,"model",this.basePath)),d.finishedDecoding()&&!d.resourcesParsed&&(this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,DracoLoader.cacheDataForModel(this),d.resourcesParsed=!0),d.resourcesParsed&&0===d.pendingShaderLoads&&createResources(this,e)}(d.finished()||h&&d.finishedEverythingButTextureCreation())&&(this._state=ModelState.LOADED,p=!0)}if(defined(d)&&this._state===ModelState.LOADED&&(h&&!p&&createResources(this,e),d.finished())){this._loadResources=void 0;var g=this._rendererResources,_=this._cachedRendererResources;_.buffers=g.buffers,_.vertexArrays=g.vertexArrays,_.programs=g.programs,_.sourceShaders=g.sourceShaders,_.silhouettePrograms=g.silhouettePrograms,_.textures=g.textures,_.samplers=g.samplers,_.renderStates=g.renderStates,_.ready=!0,this._normalAttributeName=ModelUtility.getAttributeOrUniformBySemantic(this.gltf,"NORMAL"),defined(this._precreatedAttributes)&&(_.vertexArrays={}),this.releaseGltfJson&&releaseCachedGltf(this)}var y=OctahedralProjectedCubeMap.isSupported(i);if(this._shouldUpdateSpecularMapAtlas&&y){if(this._shouldUpdateSpecularMapAtlas=!1,this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),this._specularEnvironmentMapAtlas=void 0,defined(this._specularEnvironmentMaps)){this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(this._specularEnvironmentMaps);var v=this;this._specularEnvironmentMapAtlas.readyPromise.then(function(){v._shouldRegenerateShaders=!0})}this._shouldRegenerateShaders=!0}defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);var C=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,S=!defined(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,x=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,T=!defined(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||C||S||x||T,this._useDefaultSpecularMaps=!defined(this._specularEnvironmentMapAtlas)&&defined(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!defined(this._sphericalHarmonicCoefficients)&&defined(e.sphericalHarmonicCoefficients);var b=hasSilhouette(this,e),E=isTranslucent(this),P=isInvisible(this),A=!defined(this.distanceDisplayCondition)||distanceDisplayConditionVisible(this,e),w=this.show&&A&&0!==this.scale&&(!P||b);if(w&&this._state===ModelState.LOADED||p){var D=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;var M=this.modelMatrix,I=e.mode!==this._mode;this._mode=e.mode;var R=!Matrix4.equals(this._modelMatrix,M)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale||this._heightReference!==this.heightReference||this._heightChanged||I;if(R||p){Matrix4.clone(M,this._modelMatrix),updateClamping(this),defined(this._clampedModelMatrix)&&(M=this._clampedModelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale,this._heightReference=this.heightReference,this._heightChanged=!1;var O=getScale(this,e),L=this._computedModelMatrix;Matrix4.multiplyByUniformScale(M,O,L),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(L,Axis$1.Y_UP_TO_Z_UP,L):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(L,Axis$1.X_UP_TO_Z_UP,L),this.forwardAxis===Axis$1.Z&&Matrix4.multiplyTransformation(L,Axis$1.Z_UP_TO_X_UP,L)}(D||R||p)&&(updateNodeHierarchyModelMatrix(this,R,p,e.mapProjection),this._dirty=!0,(D||p)&&applySkins(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,updatePerNodeShow(this)),updatePickIds(this),updateWireframe(this),updateShowBoundingVolume(this),updateShadows(this),updateClippingPlanes(this,e);var F=this._clippingPlanes,N=0,B=defined(F)&&F.enabled&&0<F.length,V=defined(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics,k=defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps;if(B||V||k){var $=defaultValue(this.clippingPlanesOriginMatrix,M);Matrix4.multiply(i.uniformState.view3D,$,this._clippingPlaneModelViewMatrix)}B&&(N=F.clippingPlanesState);var z=this._shouldRegenerateShaders;z=z||this._clippingPlanesState!==N,this._clippingPlanesState=N;var U=isColorShadingEnabled(this);U!==this._colorShadingEnabled&&(this._colorShadingEnabled=U,z=!0),z?regenerateShaders(this,e):(updateColor(this,e,!1),updateSilhouette(this,e,!1))}if(p){var G=this;e.afterRender.push(function(){G._ready=!0,G._readyPromise.resolve(G)})}else{if(w&&!this._ignoreCommands){var H,W,q,j=e.commandList,Y=e.passes,X=this._nodeCommands,Q=X.length,J=e.mapProjection.ellipsoid.maximumRadius*CesiumMath.PI;if(Y.render||Y.pick&&this.allowPicking){for(H=0;H<Q;++H)if((W=X[H]).show){var Z=E?W.translucentCommand:W.command;if(Z=b?W.silhouetteModelCommand:Z,j.push(Z),q=W.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(q.center.y+q.radius>J||q.center.y-q.radius<J)){var K=E?W.translucentCommand2D:W.command2D;K=b?W.silhouetteModelCommand2D:K,j.push(K)}}if(b&&!Y.pick)for(H=0;H<Q;++H)(W=X[H]).show&&(j.push(W.silhouetteColorCommand),q=W.command.boundingVolume,e.mode===SceneMode$1.SCENE2D&&(q.center.y+q.radius>J||q.center.y-q.radius<J)&&j.push(W.silhouetteColorCommand2D))}}var ee=this._credit;defined(ee)&&e.creditDisplay.addCredit(ee);for(var te=this._resourceCredits,ie=te.length,re=0;re<ie;re++)e.creditDisplay.addCredit(te[re])}}else FeatureDetection.supportsWebP.initialize()},Model.prototype.isDestroyed=function(){return!1},Model.prototype.destroy=function(){defined(this._precreatedAttributes)&&destroy(this._rendererResources.vertexArrays),defined(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),defined(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0),defined(this._cachedRendererResources)&&destroyIfNotCached(this._rendererResources,this._cachedRendererResources),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release(),DracoLoader.destroyCachedDataForModel(this);for(var e=this._pickIds,t=e.length,i=0;i<t;++i)e[i].destroy();releaseCachedGltf(this),this._quantizedVertexShaders=void 0;var r=this._clippingPlanes;return defined(r)&&!r.isDestroyed()&&r.owner===this&&r.destroy(),this._clippingPlanes=void 0,this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),destroyObject(this)},Model._getClippingFunction=getClippingFunction,Model._modifyShaderForColor=modifyShaderForColor;var defaultScale$3=1,defaultMinimumPixelSize=0,defaultIncrementallyLoadTextures=!0,defaultClampAnimations=!0,defaultShadows$1=ShadowMode$1.ENABLED,defaultHeightReference$2=HeightReference$1.NONE,defaultSilhouetteColor=Color.RED,defaultSilhouetteSize=0,defaultColor$6=Color.WHITE,defaultColorBlendMode=ColorBlendMode$1.HIGHLIGHT,defaultColorBlendAmount=.5,defaultImageBasedLightingFactor=new Cartesian2(1,1),modelMatrixScratch=new Matrix4,nodeMatrixScratch=new Matrix4;function ModelVisualizer(e,t){t.collectionChanged.addEventListener(ModelVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function removeModel(e,t,i,r){var n=i[t.id];defined(n)&&(r.removeAndDestroy(n.modelPrimitive),delete i[t.id])}function clearNodeTransformationsArticulationsScratch(e,t){var i=t[e.id];defined(i)&&(i.nodeTransformationsScratch={},i.articulationsScratch={})}function checkModelLoad(e,t,i){e.readyPromise.otherwise(function(e){console.error(e),i[t.id].loadFail=!0})}ModelVisualizer.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,i=this._modelHash,r=this._primitives,n=0,a=t.length;n<a;n++){var o,s,l=t[n],c=l._model,u=i[l.id],d=l.isShowing&&l.isAvailable(e)&&Property.getValueOrDefault(c._show,e,!0);if(d&&(s=l.computeModelMatrix(e,modelMatrixScratch),o=Resource.createIfNeeded(Property.getValueOrUndefined(c._uri,e)),d=defined(s)&&defined(o)),d){var h=defined(u)?u.modelPrimitive:void 0;if(defined(h)&&o.url===u.url||(defined(h)&&(r.removeAndDestroy(h),delete i[l.id]),(h=Model.fromGltf({url:o,incrementallyLoadTextures:Property.getValueOrDefault(c._incrementallyLoadTextures,e,defaultIncrementallyLoadTextures),scene:this._scene})).id=l,r.add(h),u={modelPrimitive:h,url:o.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1},i[l.id]=u,checkModelLoad(h,l,i)),h.show=!0,h.scale=Property.getValueOrDefault(c._scale,e,defaultScale$3),h.minimumPixelSize=Property.getValueOrDefault(c._minimumPixelSize,e,defaultMinimumPixelSize),h.maximumScale=Property.getValueOrUndefined(c._maximumScale,e),h.modelMatrix=Matrix4.clone(s,h.modelMatrix),h.shadows=Property.getValueOrDefault(c._shadows,e,defaultShadows$1),h.heightReference=Property.getValueOrDefault(c._heightReference,e,defaultHeightReference$2),h.distanceDisplayCondition=Property.getValueOrUndefined(c._distanceDisplayCondition,e),h.silhouetteColor=Property.getValueOrDefault(c._silhouetteColor,e,defaultSilhouetteColor,h._silhouetteColor),h.silhouetteSize=Property.getValueOrDefault(c._silhouetteSize,e,defaultSilhouetteSize),h.color=Property.getValueOrDefault(c._color,e,defaultColor$6,h._color),h.colorBlendMode=Property.getValueOrDefault(c._colorBlendMode,e,defaultColorBlendMode),h.colorBlendAmount=Property.getValueOrDefault(c._colorBlendAmount,e,defaultColorBlendAmount),h.clippingPlanes=Property.getValueOrUndefined(c._clippingPlanes,e),h.clampAnimations=Property.getValueOrDefault(c._clampAnimations,e,defaultClampAnimations),h.imageBasedLightingFactor=Property.getValueOrDefault(c._imageBasedLightingFactor,e,defaultImageBasedLightingFactor),h.lightColor=Property.getValueOrUndefined(c._lightColor,e),h.ready){var p=Property.getValueOrDefault(c._runAnimations,e,!0);u.animationsRunning!==p&&(p?h.activeAnimations.addAll({loop:ModelAnimationLoop$1.REPEAT}):h.activeAnimations.removeAll(),u.animationsRunning=p);var m=Property.getValueOrUndefined(c._nodeTransformations,e,u.nodeTransformationsScratch);if(defined(m))for(var f=Object.keys(m),g=0,_=f.length;g<_;++g){var y=f[g],v=m[y];if(defined(v)){var C=h.getNode(y);if(defined(C)){var S=Matrix4.fromTranslationRotationScale(v,nodeMatrixScratch);C.matrix=Matrix4.multiply(C.originalMatrix,S,S)}}}var x=!1,T=Property.getValueOrUndefined(c._articulations,e,u.articulationsScratch);if(defined(T))for(var b=Object.keys(T),E=0,P=b.length;E<P;++E){var A=b[E],w=T[A];defined(w)&&(x=!0,h.setArticulationStage(A,w))}x&&h.applyArticulations()}}else defined(u)&&(u.modelPrimitive.show=!1)}return!0},ModelVisualizer.prototype.isDestroyed=function(){return!1},ModelVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(ModelVisualizer.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,r=e.length-1;-1<r;r--)removeModel(this,e[r],t,i);return destroyObject(this)},ModelVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._modelHash[e.id];if(!defined(i)||i.loadFail)return BoundingSphereState$1.FAILED;var r=i.modelPrimitive;if(!defined(r)||!r.show)return BoundingSphereState$1.FAILED;if(!r.ready)return BoundingSphereState$1.PENDING;if(r.heightReference===HeightReference$1.NONE)BoundingSphere.transform(r.boundingSphere,r.modelMatrix,t);else{if(!defined(r._clampedModelMatrix))return BoundingSphereState$1.PENDING;BoundingSphere.transform(r.boundingSphere,r._clampedModelMatrix,t)}return BoundingSphereState$1.DONE},ModelVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._entitiesToVisualize,s=this._modelHash,l=this._primitives;for(n=t.length-1;-1<n;n--)defined((a=t[n])._model)&&defined(a._position)&&o.set(a.id,a);for(n=r.length-1;-1<n;n--)defined((a=r[n])._model)&&defined(a._position)?(clearNodeTransformationsArticulationsScratch(a,s),o.set(a.id,a)):(removeModel(this,a,s,l),o.remove(a.id));for(n=i.length-1;-1<n;n--)removeModel(this,a=i[n],s,l),o.remove(a.id)};var PolylineVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandAndBatchIndex;\nvarying vec2  v_st;\nvarying float v_width;\nvarying vec4 v_pickColor;\nvarying float v_polylineAngle;\nvoid main()\n{\nfloat texCoord = texCoordExpandAndBatchIndex.x;\nfloat expandDir = texCoordExpandAndBatchIndex.y;\nbool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\nfloat batchTableIndex = texCoordExpandAndBatchIndex.w;\nvec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\nfloat width = widthAndShow.x + 0.5;\nfloat show = widthAndShow.y;\nif (width < 1.0)\n{\nshow = 0.0;\n}\nvec4 pickColor = batchTable_getPickColor(batchTableIndex);\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\n#ifdef DISTANCE_DISPLAY_CONDITION\nvec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\nvec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\nvec3 centerLow = centerLowAndRadius.xyz;\nfloat radius = centerLowAndRadius.w;\nvec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nvec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\nlengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n}\nfloat nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\nfloat farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\nif (lengthSq < nearSq || lengthSq > farSq)\n{\nshow = 0.0;\n}\n#endif\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nv_pickColor = pickColor;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n#endif\n}\n";function Polyline(e,t){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._show=defaultValue(e.show,!0),this._width=defaultValue(e.width,1),this._loop=defaultValue(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,defined(this._material)||(this._material=Material.fromType(Material.ColorType,{color:new Color(1,1,1,1)}));var i,r=e.positions;defined(r)||(r=[]),this._positions=r,this._actualPositions=arrayRemoveDuplicates(r,Cartesian3.equalsEpsilon),this._loop&&2<this._actualPositions.length&&(this._actualPositions===this._positions&&(this._actualPositions=r.slice()),this._actualPositions.push(Cartesian3.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id,defined(t)&&(i=Matrix4.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(NUMBER_OF_PROPERTIES$2),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new BoundingSphere}var POSITION_INDEX$4=Polyline.POSITION_INDEX=0,SHOW_INDEX$4=Polyline.SHOW_INDEX=1,WIDTH_INDEX=Polyline.WIDTH_INDEX=2,MATERIAL_INDEX=Polyline.MATERIAL_INDEX=3,POSITION_SIZE_INDEX=Polyline.POSITION_SIZE_INDEX=4,DISTANCE_DISPLAY_CONDITION$1=Polyline.DISTANCE_DISPLAY_CONDITION=5,NUMBER_OF_PROPERTIES$2=Polyline.NUMBER_OF_PROPERTIES=6;function makeDirty$2(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;defined(i)&&(i._updatePolyline(e,t),e._dirty=!0)}defineProperties$1(Polyline.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,makeDirty$2(this,SHOW_INDEX$4))}},positions:{get:function(){return this._positions},set:function(e){var t=arrayRemoveDuplicates(e,Cartesian3.equalsEpsilon);this._loop&&2<t.length&&(t===e&&(t=e.slice()),t.push(Cartesian3.clone(t[0]))),this._actualPositions.length===t.length&&this._actualPositions.length===this._length||makeDirty$2(this,POSITION_SIZE_INDEX),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=BoundingSphere.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),makeDirty$2(this,POSITION_INDEX$4),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,makeDirty$2(this,MATERIAL_INDEX))}},width:{get:function(){return this._width},set:function(e){e!==this._width&&(this._width=e,makeDirty$2(this,WIDTH_INDEX))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var t=this._actualPositions;e?2<t.length&&!Cartesian3.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(Cartesian3.clone(t[0]))):2<t.length&&Cartesian3.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,makeDirty$2(this,POSITION_SIZE_INDEX)}}},id:{get:function(){return this._id},set:function(e){this._id=e,defined(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){DistanceDisplayCondition.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=DistanceDisplayCondition.clone(e,this._distanceDisplayCondition),makeDirty$2(this,DISTANCE_DISPLAY_CONDITION$1))}}}),Polyline.prototype.update=function(){var e=Matrix4.IDENTITY;defined(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);var t=this._segments.positions.length,i=this._segments.lengths,r=0<this._propertiesChanged[POSITION_INDEX$4]||0<this._propertiesChanged[POSITION_SIZE_INDEX];if(Matrix4.equals(e,this._modelMatrix)&&!r||(this._segments=PolylinePipeline.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=BoundingSphere.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=Matrix4.clone(e,this._modelMatrix),this._segments.positions.length!==t)makeDirty$2(this,POSITION_SIZE_INDEX);else for(var n=i.length,a=0;a<n;++a)if(i[a]!==this._segments.lengths[a]){makeDirty$2(this,POSITION_SIZE_INDEX);break}},Polyline.prototype.getPickId=function(e){return defined(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},Polyline.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;t<NUMBER_OF_PROPERTIES$2-1;++t)e[t]=0},Polyline.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};var SHOW_INDEX$5=Polyline.SHOW_INDEX,WIDTH_INDEX$1=Polyline.WIDTH_INDEX,POSITION_INDEX$5=Polyline.POSITION_INDEX,MATERIAL_INDEX$1=Polyline.MATERIAL_INDEX,POSITION_SIZE_INDEX$1=Polyline.POSITION_SIZE_INDEX,DISTANCE_DISPLAY_CONDITION$2=Polyline.DISTANCE_DISPLAY_CONDITION,NUMBER_OF_PROPERTIES$3=Polyline.NUMBER_OF_PROPERTIES,attributeLocations$2={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 PolylineCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.debugShowBoundingVolume=defaultValue(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(NUMBER_OF_PROPERTIES$3),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:BufferUsage$1.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=Color.clone(Color.WHITE);var t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}function createBatchTable$1(e,t){defined(e._batchTable)&&e._batchTable.destroy();var i=[{functionName:"batchTable_getWidthAndShow",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2}];e._batchTable=new BatchTable(t,i,e._polylines.length)}defineProperties$1(PolylineCollection.prototype,{length:{get:function(){return removePolylines(this),this._polylines.length}}}),PolylineCollection.prototype.add=function(e){var t=new Polyline(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t},PolylineCollection.prototype.remove=function(e){if(this.contains(e)){this._polylines[e._index]=void 0;var t=this._polylinesToUpdate.indexOf(e);if(-1!==t&&this._polylinesToUpdate.splice(t,1),this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,defined(e._bucket)){var i=e._bucket;i.shaderProgram=i.shaderProgram&&i.shaderProgram.destroy()}return e._destroy(),!0}return!1},PolylineCollection.prototype.removeAll=function(){releaseShaders(this),destroyPolylines(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},PolylineCollection.prototype.contains=function(e){return defined(e)&&e._polylineCollection===this},PolylineCollection.prototype.get=function(e){return removePolylines(this),this._polylines[e]};var scratchUpdatePolylineEncodedCartesian=new EncodedCartesian3,scratchUpdatePolylineCartesian4=new Cartesian4,scratchNearFarCartesian2=new Cartesian2;PolylineCollection.prototype.update=function(e){if(removePolylines(this),0!==this._polylines.length){updateMode$2(this,e);var t,i=e.context,r=e.mapProjection,n=this._propertiesChanged;if(this._createBatchTable){if(0===ContextLimits.maximumVertexTextureImageUnits)throw new RuntimeError("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");createBatchTable$1(this,i),this._createBatchTable=!1}if(this._createVertexArray||computeNewBuffersUsage(this))createVertexArrays$1(this,i,r);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==SceneMode$1.SCENE3D)for(var o=a.length,s=0;s<o;++s)(t=a[s]).update();if(n[POSITION_SIZE_INDEX$1]||n[MATERIAL_INDEX$1])createVertexArrays$1(this,i,r);else for(var l=a.length,c=this._polylineBuckets,u=0;u<l;++u){n=(t=a[u])._propertiesChanged;var d=t._bucket,h=0;for(var p in c)if(c.hasOwnProperty(p)){if(c[p]===d){n[POSITION_INDEX$5]&&d.writeUpdate(h,t,this._positionBuffer,r);break}h+=c[p].lengthOfPositions}if((n[SHOW_INDEX$5]||n[WIDTH_INDEX$1])&&this._batchTable.setBatchedAttribute(t._index,0,new Cartesian2(t._width,t._show)),2<this._batchTable.attributes.length){if(n[POSITION_INDEX$5]||n[POSITION_SIZE_INDEX$1]){var m=e.mode===SceneMode$1.SCENE2D?t._boundingVolume2D:t._boundingVolumeWC,f=EncodedCartesian3.fromCartesian(m.center,scratchUpdatePolylineEncodedCartesian),g=Cartesian4.fromElements(f.low.x,f.low.y,f.low.z,m.radius,scratchUpdatePolylineCartesian4);this._batchTable.setBatchedAttribute(t._index,2,f.high),this._batchTable.setBatchedAttribute(t._index,3,g)}if(n[DISTANCE_DISPLAY_CONDITION$2]){var _=scratchNearFarCartesian2;_.x=0,_.y=Number.MAX_VALUE;var y=t.distanceDisplayCondition;defined(y)&&(_.x=y.near,_.y=y.far),this._batchTable.setBatchedAttribute(t._index,4,_)}}t._clean()}a.length=0,this._polylinesUpdated=!1}n=this._propertiesChanged;for(var v=0;v<NUMBER_OF_PROPERTIES$3;++v)n[v]=0;var C=Matrix4.IDENTITY;e.mode===SceneMode$1.SCENE3D&&(C=this.modelMatrix);var S=e.passes,x=0!==e.morphTime;if(defined(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===x||(this._opaqueRS=RenderState.fromCache({depthMask:x,depthTest:{enabled:x}})),defined(this._translucentRS)&&this._translucentRS.depthTest.enabled===x||(this._translucentRS=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!x,depthTest:{enabled:x}})),this._batchTable.update(e),S.render||S.pick)createCommandLists(this,e,this._colorCommands,C)}};var boundingSphereScratch=new BoundingSphere,boundingSphereScratch2=new BoundingSphere;function createCommandLists(e,t,i,r){for(var n=t.context,a=t.commandList,o=i.length,s=0,l=!0,c=e._vertexArrays,u=e.debugShowBoundingVolume,d=e._batchTable.getUniformMapCallback(),h=c.length,p=0;p<h;++p)for(var m=c[p],f=m.buckets,g=f.length,_=0;_<g;++_){for(var y,v,C,S,x=f[_],T=x.offset,b=x.bucket.shaderProgram,E=x.bucket.polylines,P=E.length,A=0,w=0;w<P;++w){var D=E[w],M=createMaterialId(D._material);if(M!==y){if(defined(y)&&0<A){var I=v.isTranslucent();o<=s?(C=new DrawCommand({owner:e}),i.push(C)):C=i[s],++s,S=combine(d(v._uniforms),e._uniformMap),C.boundingVolume=BoundingSphere.clone(boundingSphereScratch,C.boundingVolume),C.modelMatrix=r,C.shaderProgram=b,C.vertexArray=m.va,C.renderState=I?e._translucentRS:e._opaqueRS,C.pass=I?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,C.debugShowBoundingVolume=u,C.pickId="v_pickColor",C.uniformMap=S,C.count=A,C.offset=T,T+=A,l=!(A=0),a.push(C)}(v=D._material).update(n),y=M}for(var R,O=D._locatorBuckets,L=O.length,F=0;F<L;++F){var N=O[F];N.locator===x&&(A+=N.count)}t.mode===SceneMode$1.SCENE3D?R=D._boundingVolumeWC:t.mode===SceneMode$1.COLUMBUS_VIEW?R=D._boundingVolume2D:t.mode===SceneMode$1.SCENE2D?defined(D._boundingVolume2D)&&((R=BoundingSphere.clone(D._boundingVolume2D,boundingSphereScratch2)).center.x=0):defined(D._boundingVolumeWC)&&defined(D._boundingVolume2D)&&(R=BoundingSphere.union(D._boundingVolumeWC,D._boundingVolume2D,boundingSphereScratch2)),l?(l=!1,BoundingSphere.clone(R,boundingSphereScratch)):BoundingSphere.union(R,boundingSphereScratch,boundingSphereScratch)}defined(y)&&0<A&&(o<=s?(C=new DrawCommand({owner:e}),i.push(C)):C=i[s],++s,S=combine(d(v._uniforms),e._uniformMap),C.boundingVolume=BoundingSphere.clone(boundingSphereScratch,C.boundingVolume),C.modelMatrix=r,C.shaderProgram=b,C.vertexArray=m.va,C.renderState=v.isTranslucent()?e._translucentRS:e._opaqueRS,C.pass=v.isTranslucent()?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,C.debugShowBoundingVolume=u,C.pickId="v_pickColor",C.uniformMap=S,C.count=A,C.offset=T,l=!0,a.push(C)),y=void 0}i.length=s}function computeNewBuffersUsage(e){var t=!1,i=e._propertiesChanged,r=e._positionBufferUsage;return i[POSITION_INDEX$5]?(r.bufferUsage!==BufferUsage$1.STREAM_DRAW&&(t=!0,r.bufferUsage=BufferUsage$1.STREAM_DRAW),r.frameCount=100):r.bufferUsage!==BufferUsage$1.STATIC_DRAW&&(0===r.frameCount?(t=!0,r.bufferUsage=BufferUsage$1.STATIC_DRAW):r.frameCount--),t}PolylineCollection.prototype.isDestroyed=function(){return!1},PolylineCollection.prototype.destroy=function(){return destroyVertexArrays(this),releaseShaders(this),destroyPolylines(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};var emptyVertexBuffer=[0,0,0];function createVertexArrays$1(e,t,i){e._createVertexArray=!1,releaseShaders(e),destroyVertexArrays(e),sortPolylinesIntoBuckets(e);var r,n,a=[[]],o=a[0],s=e._batchTable,l=e._useHighlightColor,c=[0],u=0,d=[[]],h=0,p=e._polylineBuckets;for(r in p)p.hasOwnProperty(r)&&((n=p[r]).updateShader(t,s,l),h+=n.lengthOfPositions);if(0<h){var m,f=e._mode,g=new Float32Array(6*h*3),_=new Float32Array(4*h),y=0,v=0,C=0;for(r in p)if(p.hasOwnProperty(r)){(n=p[r]).write(g,_,y,v,C,s,t,i),f===SceneMode$1.MORPHING&&(defined(m)||(m=new Float32Array(6*h*3)),n.writeForMorph(m,y));var S=n.lengthOfPositions;y+=6*S*3,v+=4*S,C+=4*S,u=n.updateIndices(a,c,d,u)}var x,T=e._positionBufferUsage.bufferUsage,b=BufferUsage$1.STATIC_DRAW;e._positionBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:g,usage:T}),defined(m)&&(x=Buffer$1.createVertexBuffer({context:t,typedArray:m,usage:T})),e._texCoordExpandAndBatchIndexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:_,usage:b});for(var E=3*Float32Array.BYTES_PER_ELEMENT,P=4*Float32Array.BYTES_PER_ELEMENT,A=0,w=a.length,D=0;D<w;++D)if(0<(o=a[D]).length){var M=new Uint16Array(o),I=Buffer$1.createIndexBuffer({context:t,typedArray:M,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});A+=c[D];var R,O,L,F,N=6*(D*(E*CesiumMath.SIXTY_FOUR_KILOBYTES)-A*E),B=E+N,V=E+B,k=E+V,$=E+k,z=E+$,U=D*(P*CesiumMath.SIXTY_FOUR_KILOBYTES)-A*P,G=[{index:attributeLocations$2.position3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:N,strideInBytes:6*E},{index:attributeLocations$2.position3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:B,strideInBytes:6*E},{index:attributeLocations$2.position2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:N,strideInBytes:6*E},{index:attributeLocations$2.position2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:B,strideInBytes:6*E},{index:attributeLocations$2.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:V,strideInBytes:6*E},{index:attributeLocations$2.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:k,strideInBytes:6*E},{index:attributeLocations$2.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:V,strideInBytes:6*E},{index:attributeLocations$2.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:k,strideInBytes:6*E},{index:attributeLocations$2.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:$,strideInBytes:6*E},{index:attributeLocations$2.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:z,strideInBytes:6*E},{index:attributeLocations$2.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:$,strideInBytes:6*E},{index:attributeLocations$2.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:ComponentDatatype$1.FLOAT,offsetInBytes:z,strideInBytes:6*E},{index:attributeLocations$2.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:U}];F=f===SceneMode$1.SCENE3D?(R=e._positionBuffer,O="vertexBuffer",L=emptyVertexBuffer,"value"):(L=(O=f===SceneMode$1.SCENE2D||f===SceneMode$1.COLUMBUS_VIEW?(R=emptyVertexBuffer,"value"):(R=x,"vertexBuffer"),e._positionBuffer),"vertexBuffer"),G[0][O]=R,G[1][O]=R,G[2][F]=L,G[3][F]=L,G[4][O]=R,G[5][O]=R,G[6][F]=L,G[7][F]=L,G[8][O]=R,G[9][O]=R,G[10][F]=L,G[11][F]=L;var H=new VertexArray({context:t,attributes:G,indexBuffer:I});e._vertexArrays.push({va:H,buckets:d[D]})}}}function replacer(e,t){return t instanceof Texture?t.id:t}var scratchUniformArray$1=[];function createMaterialId(e){var t=Material._uniformList[e.type],i=t.length;scratchUniformArray$1.length=2*i;for(var r=0,n=0;n<i;++n){var a=t[n];scratchUniformArray$1[r]=a,scratchUniformArray$1[r+1]=e._uniforms[a](),r+=2}return e.type+":"+JSON.stringify(scratchUniformArray$1,replacer)}function sortPolylinesIntoBuckets(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,a=n.length,o=0;o<a;++o){var s=n[o];if(1<s._actualPositions.length){s.update();var l=s.material,c=r[l.type];defined(c)||(c=r[l.type]=new PolylineBucket(l,t,i)),c.addPolyline(s)}}}function updateMode$2(e,t){var i=t.mode;e._mode===i&&Matrix4.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=Matrix4.clone(e.modelMatrix),e._createVertexArray=!0)}function removePolylines(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t=[],i=e._polylines.length,r=0,n=0;r<i;++r){var a=e._polylines[r];defined(a)&&(a._index=n++,t.push(a))}e._polylines=t}}function releaseShaders(e){for(var t=e._polylines,i=t.length,r=0;r<i;++r)if(defined(t[r])){var n=t[r]._bucket;defined(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function destroyVertexArrays(e){for(var t=e._vertexArrays.length,i=0;i<t;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function destroyPolylines(e){for(var t=e._polylines,i=t.length,r=0;r<i;++r)defined(t[r])&&t[r]._destroy()}function VertexArrayBucketLocator(e,t,i){this.count=e,this.offset=t,this.bucket=i}function PolylineBucket(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=i}function intersectsIDL(e){return Cartesian3.dot(Cartesian3.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Plane.ORIGIN_ZX_PLANE)===Intersect$1.INTERSECTING}PolylineCollection.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},PolylineBucket.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},PolylineBucket.prototype.updateShader=function(e,t,i){if(!defined(this.shaderProgram)){var r=["DISTANCE_DISPLAY_CONDITION"];i&&r.push("VECTOR_TILE"),-1!==this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)&&r.push("POLYLINE_DASH"),FeatureDetection.isInternetExplorer()||r.push("CLIP_POLYLINE");var n=new ShaderSource({defines:r,sources:["varying vec4 v_pickColor;\n",this.material.shaderSource,PolylineFS]}),a=t.getVertexShaderCallback()(PolylineVS),o=new ShaderSource({defines:r,sources:[PolylineCommon,a]});this.shaderProgram=ShaderProgram.fromCache({context:e,vertexShaderSource:o,fragmentShaderSource:n,attributeLocations:attributeLocations$2})}},PolylineBucket.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===SceneMode$1.SCENE3D||!intersectsIDL(e))return 4*(t=e._actualPositions.length)-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;n<t;++n)i+=4*r[n]-4;return i};var scratchWritePosition=new Cartesian3,scratchWritePrevPosition=new Cartesian3,scratchWriteNextPosition=new Cartesian3,scratchWriteVector=new Cartesian3,scratchPickColorCartesian=new Cartesian4,scratchWidthShowCartesian=new Cartesian2;PolylineBucket.prototype.write=function(e,t,i,r,n,a,o,s){for(var l=this.mode,c=s.ellipsoid.maximumRadius*CesiumMath.PI,u=this.polylines,d=u.length,h=0;h<d;++h){for(var p,m=u[h],f=m.width,g=m.show&&0<f,_=m._index,y=this.getSegments(m,s),v=y.positions,C=y.lengths,S=v.length,x=m.getPickId(o).color,T=0,b=0,E=0;E<S;++E){0===E?m._loop?p=v[S-2]:(p=scratchWriteVector,Cartesian3.subtract(v[0],v[1],p),Cartesian3.add(v[0],p,p)):p=v[E-1],Cartesian3.clone(p,scratchWritePrevPosition),Cartesian3.clone(v[E],scratchWritePosition),E===S-1?m._loop?p=v[1]:(p=scratchWriteVector,Cartesian3.subtract(v[S-1],v[S-2],p),Cartesian3.add(v[S-1],p,p)):p=v[E+1],Cartesian3.clone(p,scratchWriteNextPosition);var P=C[T];E===b+P&&(b+=P,++T);var A=E-b==0,w=E===b+C[T]-1;l===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),l!==SceneMode$1.SCENE2D&&l!==SceneMode$1.MORPHING||(A||w)&&c-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&0<scratchWritePrevPosition.x||0<scratchWritePosition.x&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&0<scratchWriteNextPosition.x||0<scratchWritePosition.x&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));for(var D=w?2:4,M=A?2:0;M<D;++M){EncodedCartesian3.writeElements(scratchWritePosition,e,i),EncodedCartesian3.writeElements(scratchWritePrevPosition,e,i+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,e,i+12);var I=M-2<0?-1:1;t[n]=E/(S-1),t[n+1]=M%2*2-1,t[n+2]=I,t[n+3]=_,i+=18,n+=4}}var R=scratchPickColorCartesian;R.x=Color.floatToByte(x.red),R.y=Color.floatToByte(x.green),R.z=Color.floatToByte(x.blue),R.w=Color.floatToByte(x.alpha);var O=scratchWidthShowCartesian;O.x=f,O.y=g?1:0;var L=l===SceneMode$1.SCENE2D?m._boundingVolume2D:m._boundingVolumeWC,F=EncodedCartesian3.fromCartesian(L.center,scratchUpdatePolylineEncodedCartesian),N=F.high,B=Cartesian4.fromElements(F.low.x,F.low.y,F.low.z,L.radius,scratchUpdatePolylineCartesian4),V=scratchNearFarCartesian2;V.x=0,V.y=Number.MAX_VALUE;var k=m.distanceDisplayCondition;defined(k)&&(V.x=k.near,V.y=k.far),a.setBatchedAttribute(_,0,O),a.setBatchedAttribute(_,1,R),2<a.attributes.length&&(a.setBatchedAttribute(_,2,N),a.setBatchedAttribute(_,3,B),a.setBatchedAttribute(_,4,V))}};var morphPositionScratch=new Cartesian3,morphPrevPositionScratch=new Cartesian3,morphNextPositionScratch=new Cartesian3,morphVectorScratch=new Cartesian3;PolylineBucket.prototype.writeForMorph=function(e,t){for(var i=this.modelMatrix,r=this.polylines,n=r.length,a=0;a<n;++a)for(var o=r[a],s=o._segments.positions,l=o._segments.lengths,c=s.length,u=0,d=0,h=0;h<c;++h){var p;0===h?o._loop?p=s[c-2]:(p=morphVectorScratch,Cartesian3.subtract(s[0],s[1],p),Cartesian3.add(s[0],p,p)):p=s[h-1],p=Matrix4.multiplyByPoint(i,p,morphPrevPositionScratch);var m,f=Matrix4.multiplyByPoint(i,s[h],morphPositionScratch);h===c-1?o._loop?m=s[1]:(m=morphVectorScratch,Cartesian3.subtract(s[c-1],s[c-2],m),Cartesian3.add(s[c-1],m,m)):m=s[h+1],m=Matrix4.multiplyByPoint(i,m,morphNextPositionScratch);var g=l[u];h===d+g&&(d+=g,++u);for(var _=h-d==0,y=h===d+l[u]-1?2:4,v=_?2:0;v<y;++v)EncodedCartesian3.writeElements(f,e,t),EncodedCartesian3.writeElements(p,e,t+6),EncodedCartesian3.writeElements(m,e,t+12),t+=18}};var scratchSegmentLengths=new Array(1);PolylineBucket.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,a=new VertexArrayBucketLocator(0,r,this);i[n].push(a);var o=0,s=e[e.length-1],l=0;0<s.length&&(l=s[s.length-1]+1);for(var c=this.polylines,u=c.length,d=0;d<u;++d){var h,p=c[d];if(p._locatorBuckets=[],this.mode===SceneMode$1.SCENE3D){h=scratchSegmentLengths;var m=p._actualPositions.length;if(!(0<m))continue;h[0]=m}else h=p._segments.lengths;var f=h.length;if(0<f){for(var g=0,_=0;_<f;++_)for(var y=h[_]-1,v=0;v<y;++v)l+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(p._locatorBuckets.push({locator:a,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,a.count=o,a=new VertexArrayBucketLocator(r=o=0,0,this),i[++n]=[a]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,o+=6,r+=6,l+=4;p._locatorBuckets.push({locator:a,count:g}),l+4>CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(0),s=[],e.push(s),l=0,a.count=o,a=new VertexArrayBucketLocator(o=r=0,0,this),i[++n]=[a])}p._clean()}return a.count=o,r},PolylineBucket.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;n<r;++n){var a=t[n];if(a===e)break;i+=a._actualLength}return i};var scratchSegments={positions:void 0,lengths:void 0},scratchLengths=new Array(1),pscratch=new Cartesian3,scratchCartographic$6=new Cartographic,scratchPositionsArray;function ScaledPositionProperty(e){this._definitionChanged=new Event,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}PolylineBucket.prototype.getSegments=function(e,t){var i=e._actualPositions;if(this.mode===SceneMode$1.SCENE3D)return scratchLengths[0]=i.length,scratchSegments.positions=i,scratchSegments.lengths=scratchLengths,scratchSegments;intersectsIDL(e)&&(i=e._segments.positions);for(var r,n=t.ellipsoid,a=[],o=this.modelMatrix,s=i.length,l=pscratch,c=0;c<s;++c)r=i[c],l=Matrix4.multiplyByPoint(o,r,l),a.push(t.project(n.cartesianToCartographic(l,scratchCartographic$6)));if(0<a.length){e._boundingVolume2D=BoundingSphere.fromPoints(a,e._boundingVolume2D);var u=e._boundingVolume2D.center;e._boundingVolume2D.center=new Cartesian3(u.z,u.x,u.y)}return scratchSegments.positions=a,scratchSegments.lengths=e._segments.lengths,scratchSegments},PolylineBucket.prototype.writeUpdate=function(e,t,i,r){var n=this.mode,a=r.ellipsoid.maximumRadius*CesiumMath.PI,o=t._actualLength;if(o){e+=this.getPolylineStartIndex(t);var s=scratchPositionsArray,l=6*o*3;!defined(s)||s.length<l?s=scratchPositionsArray=new Float32Array(l):s.length>l&&(s=new Float32Array(s.buffer,0,l));var c,u=this.getSegments(t,r),d=u.positions,h=u.lengths,p=0,m=0,f=0;o=d.length;for(var g=0;g<o;++g){0===g?t._loop?c=d[o-2]:(c=scratchWriteVector,Cartesian3.subtract(d[0],d[1],c),Cartesian3.add(d[0],c,c)):c=d[g-1],Cartesian3.clone(c,scratchWritePrevPosition),Cartesian3.clone(d[g],scratchWritePosition),g===o-1?t._loop?c=d[1]:(c=scratchWriteVector,Cartesian3.subtract(d[o-1],d[o-2],c),Cartesian3.add(d[o-1],c,c)):c=d[g+1],Cartesian3.clone(c,scratchWriteNextPosition);var _=h[m];g===f+_&&(f+=_,++m);var y=g-f==0,v=g===f+h[m]-1;n===SceneMode$1.SCENE2D&&(scratchWritePrevPosition.z=0,scratchWritePosition.z=0,scratchWriteNextPosition.z=0),n!==SceneMode$1.SCENE2D&&n!==SceneMode$1.MORPHING||(y||v)&&a-Math.abs(scratchWritePosition.x)<1&&((scratchWritePosition.x<0&&0<scratchWritePrevPosition.x||0<scratchWritePosition.x&&scratchWritePrevPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWritePrevPosition),(scratchWritePosition.x<0&&0<scratchWriteNextPosition.x||0<scratchWritePosition.x&&scratchWriteNextPosition.x<0)&&Cartesian3.clone(scratchWritePosition,scratchWriteNextPosition));for(var C=v?2:4,S=y?2:0;S<C;++S)EncodedCartesian3.writeElements(scratchWritePosition,s,p),EncodedCartesian3.writeElements(scratchWritePrevPosition,s,p+6),EncodedCartesian3.writeElements(scratchWriteNextPosition,s,p+12),p+=18}i.copyFromArrayView(s,18*Float32Array.BYTES_PER_ELEMENT*e)}},defineProperties$1(ScaledPositionProperty.prototype,{isConstant:{get:function(){return Property.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return defined(this._value)?this._value.referenceFrame:ReferenceFrame$1.FIXED}}}),ScaledPositionProperty.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ReferenceFrame$1.FIXED,t)},ScaledPositionProperty.prototype.setValue=function(e){this._value!==e&&(this._value=e,defined(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),defined(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},ScaledPositionProperty.prototype.getValueInReferenceFrame=function(e,t,i){if(defined(this._value))return defined(i=this._value.getValueInReferenceFrame(e,t,i))?Ellipsoid.WGS84.scaleToGeodeticSurface(i,i):void 0},ScaledPositionProperty.prototype.equals=function(e){return this===e||e instanceof ScaledPositionProperty&&this._value===e._value},ScaledPositionProperty.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var defaultResolution=60,defaultWidth=1,scratchTimeInterval$1=new TimeInterval,subSampleCompositePropertyScratch=new TimeInterval,subSampleIntervalPropertyScratch=new TimeInterval;function EntityData$2(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function subSampleSampledProperty(e,t,i,r,n,a,o,s,l){var c,u=s;defined(c=e.getValueInReferenceFrame(t,a,l[u]))&&(l[u++]=c);for(var d,h,p,m=!defined(n)||JulianDate.lessThanOrEquals(n,t)||JulianDate.greaterThanOrEquals(n,i),f=0,g=r.length,_=r[f],y=i,v=!1;f<g;){if(!m&&JulianDate.greaterThanOrEquals(_,n)&&(defined(c=e.getValueInReferenceFrame(n,a,l[u]))&&(l[u++]=c),m=!0),JulianDate.greaterThan(_,t)&&JulianDate.lessThan(_,y)&&!_.equals(n)&&defined(c=e.getValueInReferenceFrame(_,a,l[u]))&&(l[u++]=c),f<g-1){if(0<o&&!v){var C=r[f+1],S=JulianDate.secondsDifference(C,_);(v=o<S)&&(d=Math.ceil(S/o),h=0,p=S/Math.max(d,2),d=Math.max(d-1,1))}if(v&&h<d){_=JulianDate.addSeconds(_,p,new JulianDate),h++;continue}}v=!1,_=r[++f]}return defined(c=e.getValueInReferenceFrame(i,a,l[u]))&&(l[u++]=c),u}function subSampleGenericProperty(e,t,i,r,n,a,o,s){for(var l,c=0,u=o,d=t,h=Math.max(a,60),p=!defined(r)||JulianDate.lessThanOrEquals(r,t)||JulianDate.greaterThanOrEquals(r,i);JulianDate.lessThan(d,i);)!p&&JulianDate.greaterThanOrEquals(d,r)&&(p=!0,defined(l=e.getValueInReferenceFrame(r,n,s[u]))&&(s[u]=l,u++)),defined(l=e.getValueInReferenceFrame(d,n,s[u]))&&(s[u]=l,u++),c++,d=JulianDate.addSeconds(t,h*c,new JulianDate);return defined(l=e.getValueInReferenceFrame(i,n,s[u]))&&(s[u]=l,u++),u}function subSampleIntervalProperty(e,t,i,r,n,a,o,s){subSampleIntervalPropertyScratch.start=t,subSampleIntervalPropertyScratch.stop=i;for(var l=o,c=e.intervals,u=0;u<c.length;u++){var d=c.get(u);if(!TimeInterval.intersect(d,subSampleIntervalPropertyScratch,scratchTimeInterval$1).isEmpty){var h=d.start;d.isStartIncluded||(h=d.isStopIncluded?d.stop:JulianDate.addSeconds(d.start,JulianDate.secondsDifference(d.stop,d.start)/2,new JulianDate));var p=e.getValueInReferenceFrame(h,n,s[l]);defined(p)&&(s[l]=p,l++)}}return l}function subSampleConstantProperty(e,t,i,r,n,a,o,s){var l=e.getValueInReferenceFrame(t,n,s[o]);return defined(l)&&(s[o++]=l),o}function subSampleCompositeProperty(e,t,i,r,n,a,o,s){subSampleCompositePropertyScratch.start=t,subSampleCompositePropertyScratch.stop=i;for(var l=o,c=e.intervals,u=0;u<c.length;u++){var d=c.get(u);if(!TimeInterval.intersect(d,subSampleCompositePropertyScratch,scratchTimeInterval$1).isEmpty){var h=d.start,p=d.stop,m=t;JulianDate.greaterThan(h,m)&&(m=h);var f=i;JulianDate.lessThan(p,f)&&(f=p),l=reallySubSample(d.data,m,f,r,n,a,l,s)}}return l}function reallySubSample(e,t,i,r,n,a,o,s){for(;e instanceof ReferenceProperty;)e=e.resolvedProperty;e instanceof SampledPositionProperty?o=subSampleSampledProperty(e,t,i,e._property._times,r,n,a,o,s):o=e instanceof CompositePositionProperty?subSampleCompositeProperty(e,t,i,r,n,a,o,s):e instanceof TimeIntervalCollectionPositionProperty?subSampleIntervalProperty(e,t,i,r,n,a,o,s):e instanceof ConstantPositionProperty||e instanceof ScaledPositionProperty&&Property.isConstant(e)?subSampleConstantProperty(e,t,i,r,n,a,o,s):subSampleGenericProperty(e,t,i,r,n,a,o,s);return o}function subSample(e,t,i,r,n,a,o){defined(o)||(o=[]);var s=reallySubSample(e,t,i,r,n,a,0,o);return o.length=s,o}var toFixedScratch=new Matrix3;function PolylineUpdater(e,t){this._unusedIndexes=[],this._polylineCollection=new PolylineCollection,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}function PathVisualizer(e,t){t.collectionChanged.addEventListener(PathVisualizer.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function createBillboardPointCallback(r,n,a,o,s){return function(){var e=document.createElement("canvas"),t=s+2*o;e.height=e.width=t;var i=e.getContext("2d");return i.clearRect(0,0,t,t),0!==o&&(i.beginPath(),i.arc(t/2,t/2,t/2,0,2*Math.PI,!0),i.closePath(),i.fillStyle=a,i.fill(),r<1&&(i.save(),i.globalCompositeOperation="destination-out",i.beginPath(),i.arc(t/2,t/2,s/2,0,2*Math.PI,!0),i.closePath(),i.fillStyle="black",i.fill(),i.restore())),i.beginPath(),i.arc(t/2,t/2,s/2,0,2*Math.PI,!0),i.closePath(),i.fillStyle=n,i.fill(),e}}PolylineUpdater.prototype.update=function(e){if(this._referenceFrame===ReferenceFrame$1.INERTIAL){var t=Transforms.computeIcrfToFixedMatrix(e,toFixedScratch);defined(t)||(t=Transforms.computeTemeToPseudoFixedMatrix(e,toFixedScratch)),Matrix4.fromRotationTranslation(t,Cartesian3.ZERO,this._polylineCollection.modelMatrix)}},PolylineUpdater.prototype.updateObject=function(e,t){var i,r,n=t.entity,a=n._path,o=n._position,s=a._show,l=t.polyline,c=n.isShowing&&(!defined(s)||s.getValue(e));if(c){var u=Property.getValueOrUndefined(a._leadTime,e),d=Property.getValueOrUndefined(a._trailTime,e),h=n._availability,p=defined(h),m=defined(u),f=defined(d);if(c=p||m&&f){if(f&&(i=JulianDate.addSeconds(e,-d,new JulianDate)),m&&(r=JulianDate.addSeconds(e,u,new JulianDate)),p){var g=h.start,_=h.stop;f&&!JulianDate.greaterThan(g,i)||(i=g),m&&!JulianDate.lessThan(_,r)||(r=_)}c=JulianDate.lessThan(i,r)}}if(c){if(!defined(l)){var y=this._unusedIndexes;if(0<y.length){var v=y.pop();l=this._polylineCollection.get(v),t.index=v}else t.index=this._polylineCollection.length,l=this._polylineCollection.add();l.id=n,t.polyline=l}var C=Property.getValueOrDefault(a._resolution,e,defaultResolution);l.show=!0,l.positions=subSample(o,i,r,e,this._referenceFrame,C,l.positions.slice()),l.material=MaterialProperty.getValue(e,a._material,l.material),l.width=Property.getValueOrDefault(a._width,e,defaultWidth),l.distanceDisplayCondition=Property.getValueOrUndefined(a._distanceDisplayCondition,e,l.distanceDisplayCondition)}else defined(l)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,l.show=!1,t.index=void 0)},PolylineUpdater.prototype.removeObject=function(e){var t=e.polyline;defined(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)},PolylineUpdater.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),destroyObject(this)},PathVisualizer.prototype.update=function(e){var t=this._updaters;for(var i in t)t.hasOwnProperty(i)&&t[i].update(e);var r=this._items.values;if(0===r.length&&defined(this._updaters)&&0<Object.keys(this._updaters).length){for(var n in t)t.hasOwnProperty(n)&&t[n].destroy();this._updaters={}}for(var a=0,o=r.length;a<o;a++){var s=r[a],l=s.entity._position,c=s.updater,u=ReferenceFrame$1.FIXED;this._scene.mode===SceneMode$1.SCENE3D&&(u=l.referenceFrame);var d=this._updaters[u];c===d&&defined(d)?d.updateObject(e,s):(defined(c)&&c.removeObject(s),defined(d)||((d=new PolylineUpdater(this._scene,u)).update(e),this._updaters[u]=d),defined(s.updater=d)&&d.updateObject(e,s))}return!0},PathVisualizer.prototype.isDestroyed=function(){return!1},PathVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PathVisualizer.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return destroyObject(this)},PathVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o,s=this._items;for(n=t.length-1;-1<n;n--)defined((a=t[n])._path)&&defined(a._position)&&s.set(a.id,new EntityData$2(a));for(n=r.length-1;-1<n;n--)defined((a=r[n])._path)&&defined(a._position)?s.contains(a.id)||s.set(a.id,new EntityData$2(a)):defined(o=s.get(a.id))&&(defined(o.updater)&&o.updater.removeObject(o),s.remove(a.id));for(n=i.length-1;-1<n;n--)a=i[n],defined(o=s.get(a.id))&&(defined(o.updater)&&o.updater.removeObject(o),s.remove(a.id))},PathVisualizer._subSample=subSample;var defaultColor$7=Color.WHITE,defaultOutlineColor$3=Color.BLACK,defaultOutlineWidth$2=0,defaultPixelSize=1,defaultDisableDepthTestDistance=0,colorScratch$6=new Color,positionScratch$b=new Cartesian3,outlineColorScratch$1=new Color,scaleByDistanceScratch$2=new NearFarScalar,translucencyByDistanceScratch$2=new NearFarScalar,distanceDisplayConditionScratch$7=new DistanceDisplayCondition;function EntityData$3(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 PointVisualizer(e,t){t.collectionChanged.addEventListener(PointVisualizer.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new AssociativeArray,this._onCollectionChanged(t,t.values,[],[])}function returnPrimitive$2(e,t,i){if(defined(e)){if(defined(e.pointPrimitive))return e.pointPrimitive=void 0,void i.removePoint(t);defined(e.billboard)&&(e.billboard=void 0,i.removeBillboard(t))}}PointVisualizer.prototype.update=function(e){for(var t=this._items.values,i=this._cluster,r=0,n=t.length;r<n;r++){var a,o=t[r],s=o.entity,l=s._point,c=o.pointPrimitive,u=o.billboard,d=Property.getValueOrDefault(l._heightReference,e,HeightReference$1.NONE),h=s.isShowing&&s.isAvailable(e)&&Property.getValueOrDefault(l._show,e,!0);if(h=h&&defined(a=Property.getValueOrUndefined(s._position,e,positionScratch$b))){Property.isConstant(s._position)||(i._clusterDirty=!0);var p=!1,m=!1;if(d===HeightReference$1.NONE||defined(u)?d!==HeightReference$1.NONE||defined(c)||(defined(u)&&(returnPrimitive$2(o,s,i),u=void 0),(c=i.getPoint(s)).id=s,o.pointPrimitive=c):(defined(c)&&(returnPrimitive$2(o,s,i),c=void 0),(u=i.getBillboard(s)).id=s,u.image=void 0,o.billboard=u,p=!0,m=Cartesian3.equals(u.position,a)&&u.heightReference===d),defined(c))c.show=!0,c.position=a,c.scaleByDistance=Property.getValueOrUndefined(l._scaleByDistance,e,scaleByDistanceScratch$2),c.translucencyByDistance=Property.getValueOrUndefined(l._translucencyByDistance,e,translucencyByDistanceScratch$2),c.color=Property.getValueOrDefault(l._color,e,defaultColor$7,colorScratch$6),c.outlineColor=Property.getValueOrDefault(l._outlineColor,e,defaultOutlineColor$3,outlineColorScratch$1),c.outlineWidth=Property.getValueOrDefault(l._outlineWidth,e,defaultOutlineWidth$2),c.pixelSize=Property.getValueOrDefault(l._pixelSize,e,defaultPixelSize),c.distanceDisplayCondition=Property.getValueOrUndefined(l._distanceDisplayCondition,e,distanceDisplayConditionScratch$7),c.disableDepthTestDistance=Property.getValueOrDefault(l._disableDepthTestDistance,e,defaultDisableDepthTestDistance);else if(defined(u)){u.show=!0,u.position=a,u.scaleByDistance=Property.getValueOrUndefined(l._scaleByDistance,e,scaleByDistanceScratch$2),u.translucencyByDistance=Property.getValueOrUndefined(l._translucencyByDistance,e,translucencyByDistanceScratch$2),u.distanceDisplayCondition=Property.getValueOrUndefined(l._distanceDisplayCondition,e,distanceDisplayConditionScratch$7),u.disableDepthTestDistance=Property.getValueOrDefault(l._disableDepthTestDistance,e,defaultDisableDepthTestDistance),u.heightReference=d;var f=Property.getValueOrDefault(l._color,e,defaultColor$7,colorScratch$6),g=Property.getValueOrDefault(l._outlineColor,e,defaultOutlineColor$3,outlineColorScratch$1),_=Math.round(Property.getValueOrDefault(l._outlineWidth,e,defaultOutlineWidth$2)),y=Math.max(1,Math.round(Property.getValueOrDefault(l._pixelSize,e,defaultPixelSize)));if(p=0<_?(u.scale=1,p||_!==o.outlineWidth||y!==o.pixelSize||!Color.equals(f,o.color)||!Color.equals(g,o.outlineColor)):(u.scale=y/50,y=50,p||_!==o.outlineWidth||!Color.equals(f,o.color)||!Color.equals(g,o.outlineColor))){o.color=Color.clone(f,o.color),o.outlineColor=Color.clone(g,o.outlineColor),o.pixelSize=y,o.outlineWidth=_;var v=f.alpha,C=f.toCssColorString(),S=g.toCssColorString(),x=JSON.stringify([C,y,S,_]);u.setImage(x,createBillboardPointCallback(v,C,S,_,y))}m&&u._updateClamping()}}else returnPrimitive$2(o,s,i)}return!0},PointVisualizer.prototype.getBoundingSphere=function(e,t){var i=this._items.get(e.id);if(!defined(i)||!defined(i.pointPrimitive)&&!defined(i.billboard))return BoundingSphereState$1.FAILED;if(defined(i.pointPrimitive))t.center=Cartesian3.clone(i.pointPrimitive.position,t.center);else{var r=i.billboard;if(!defined(r._clampedPosition))return BoundingSphereState$1.PENDING;t.center=Cartesian3.clone(r._clampedPosition,t.center)}return t.radius=0,BoundingSphereState$1.DONE},PointVisualizer.prototype.isDestroyed=function(){return!1},PointVisualizer.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(PointVisualizer.prototype._onCollectionChanged,this);for(var e=this._entityCollection.values,t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return destroyObject(this)},PointVisualizer.prototype._onCollectionChanged=function(e,t,i,r){var n,a,o=this._items,s=this._cluster;for(n=t.length-1;-1<n;n--)defined((a=t[n])._point)&&defined(a._position)&&o.set(a.id,new EntityData$3(a));for(n=r.length-1;-1<n;n--)defined((a=r[n])._point)&&defined(a._position)?o.contains(a.id)||o.set(a.id,new EntityData$3(a)):(returnPrimitive$2(o.get(a.id),a,s),o.remove(a.id));for(n=i.length-1;-1<n;n--)a=i[n],returnPrimitive$2(o.get(a.id),a,s),o.remove(a.id)};var defaultZIndex$1=new ConstantProperty(0),polylineCollections={},scratchColor$a=new Color,defaultMaterial$2=new ColorMaterialProperty(Color.WHITE),defaultShow$1=new ConstantProperty(!0),defaultShadows$2=new ConstantProperty(ShadowMode$1.DISABLED),defaultDistanceDisplayCondition$6=new ConstantProperty(new DistanceDisplayCondition),defaultClassificationType$1=new ConstantProperty(ClassificationType$1.BOTH);function GeometryOptions(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function GroundGeometryOptions(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function PolylineGeometryUpdater(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(PolylineGeometryUpdater.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Event,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 GeometryOptions,this._groundGeometryOptions=new GroundGeometryOptions,this._id="polyline-"+e.id,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Entity.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}defineProperties$1(PolylineGeometryUpdater.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||!defined(this._entity.availability)&&Property.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}}}),PolylineGeometryUpdater.prototype.isOutlineVisible=function(e){return!1},PolylineGeometryUpdater.prototype.isFilled=function(e){var t=this._entity;return defaultValue(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e),!1)},PolylineGeometryUpdater.prototype.createFillGeometryInstance=function(e){var t,i=this._entity,r=i.isAvailable(e),n=new ShowGeometryInstanceAttribute(r&&i.isShowing&&this._showProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),o={show:n,distanceDisplayCondition:DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(a)};return this._materialProperty instanceof ColorMaterialProperty&&(defined(this._materialProperty.color)&&(this._materialProperty.color.isConstant||r)&&(t=this._materialProperty.color.getValue(e,scratchColor$a)),defined(t)||(t=Color.WHITE),o.color=ColorGeometryInstanceAttribute.fromColor(t)),this.clampToGround?new GeometryInstance({id:i,geometry:new GroundPolylineGeometry(this._groundGeometryOptions),attributes:o}):(defined(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof ColorMaterialProperty&&(defined(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||r)&&(t=this._depthFailMaterialProperty.color.getValue(e,scratchColor$a)),defined(t)||(t=Color.WHITE),o.depthFailColor=ColorGeometryInstanceAttribute.fromColor(t)),new GeometryInstance({id:i,geometry:new PolylineGeometry(this._geometryOptions),attributes:o}))},PolylineGeometryUpdater.prototype.createOutlineGeometryInstance=function(e){},PolylineGeometryUpdater.prototype.isDestroyed=function(){return!1},PolylineGeometryUpdater.prototype.destroy=function(){this._entitySubscription(),destroyObject(this)},PolylineGeometryUpdater.prototype._onEntityPropertyChanged=function(e,t,i,r){if("availability"===t||"polyline"===t){var n=this._entity.polyline;if(defined(n)){var a=n.positions,o=n.show;if(defined(o)&&o.isConstant&&!o.getValue(Iso8601.MINIMUM_VALUE)||!defined(a))this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));else{var s=n.zIndex,l=defaultValue(n.material,defaultMaterial$2),c=l instanceof ColorMaterialProperty;this._materialProperty=l,this._depthFailMaterialProperty=n.depthFailMaterial,this._showProperty=defaultValue(o,defaultShow$1),this._shadowsProperty=defaultValue(n.shadows,defaultShadows$2),this._distanceDisplayConditionProperty=defaultValue(n.distanceDisplayCondition,defaultDistanceDisplayCondition$6),this._classificationTypeProperty=defaultValue(n.classificationType,defaultClassificationType$1),this._fillEnabled=!0,this._zIndex=defaultValue(s,defaultZIndex$1);var u=n.width,d=n.arcType,h=n.clampToGround,p=n.granularity;if(a.isConstant&&Property.isConstant(u)&&Property.isConstant(d)&&Property.isConstant(p)&&Property.isConstant(h)&&Property.isConstant(s)){var m,f=this._geometryOptions,g=a.getValue(Iso8601.MINIMUM_VALUE,f.positions);if(!defined(g)||g.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));m=c&&(!defined(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof ColorMaterialProperty)?PolylineColorAppearance.VERTEX_FORMAT:PolylineMaterialAppearance.VERTEX_FORMAT,f.vertexFormat=m,f.positions=g,f.width=defined(u)?u.getValue(Iso8601.MINIMUM_VALUE):void 0,f.arcType=defined(d)?d.getValue(Iso8601.MINIMUM_VALUE):void 0,f.granularity=defined(p)?p.getValue(Iso8601.MINIMUM_VALUE):void 0;var _=this._groundGeometryOptions;_.positions=g,_.width=f.width,_.arcType=f.arcType,_.granularity=f.granularity,this._clampToGround=!!defined(h)&&h.getValue(Iso8601.MINIMUM_VALUE),!this._clampToGround&&defined(s)&&oneTimeWarning("Entity polylines must have clampToGround: true when using zIndex.  zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}}else this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this))}},PolylineGeometryUpdater.prototype.createDynamicUpdater=function(e,t){return new DynamicGeometryUpdater$1(e,t,this)};var generateCartesianArcOptions={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function DynamicGeometryUpdater$1(e,t,i){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=i,this._positions=[]}function getLine(e){if(defined(e._line))return e._line;var t=e._geometryUpdater._scene.id,i=polylineCollections[t],r=e._primitives;!defined(i)||i.isDestroyed()?(i=new PolylineCollection,polylineCollections[t]=i,r.add(i)):r.contains(i)||r.add(i);var n=i.add();return n.id=e._geometryUpdater._entity,e._line=n}DynamicGeometryUpdater$1.prototype.update=function(e){var t=this._geometryUpdater,i=t._entity,r=i.polyline,n=r.positions,a=Property.getValueOrUndefined(n,e,this._positions);t._clampToGround=Property.getValueOrDefault(r._clampToGround,e,!1),t._groundGeometryOptions.positions=a,t._groundGeometryOptions.width=Property.getValueOrDefault(r._width,e,1),t._groundGeometryOptions.arcType=Property.getValueOrDefault(r._arcType,e,ArcType$1.GEODESIC),t._groundGeometryOptions.granularity=Property.getValueOrDefault(r._granularity,e,9999);var o=this._groundPrimitives;if(defined(this._groundPolylinePrimitive)&&(o.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!i.isShowing||!i.isAvailable(e)||!Property.getValueOrDefault(r._show,e,!0))return;if(!defined(a)||a.length<2)return;var s,l=t.fillMaterialProperty;if(l instanceof ColorMaterialProperty)s=new PolylineColorAppearance;else{var c=MaterialProperty.getValue(e,l,this._material);s=new PolylineMaterialAppearance({material:c,translucent:c.isTranslucent()}),this._material=c}return this._groundPolylinePrimitive=o.add(new GroundPolylinePrimitive({geometryInstances:t.createFillGeometryInstance(e),appearance:s,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Property.getValueOrUndefined(t.zIndex,e)),void(defined(this._line)&&(this._line.show=!1))}var u=getLine(this);if(i.isShowing&&i.isAvailable(e)&&Property.getValueOrDefault(r._show,e,!0))if(!defined(a)||a.length<2)u.show=!1;else{var d=ArcType$1.GEODESIC;d=Property.getValueOrDefault(r._arcType,e,d);var h=t._scene.globe;d!==ArcType$1.NONE&&defined(h)&&(generateCartesianArcOptions.ellipsoid=h.ellipsoid,generateCartesianArcOptions.positions=a,generateCartesianArcOptions.granularity=Property.getValueOrUndefined(r._granularity,e),generateCartesianArcOptions.height=PolylinePipeline.extractHeights(a,h.ellipsoid),a=d===ArcType$1.GEODESIC?PolylinePipeline.generateCartesianArc(generateCartesianArcOptions):PolylinePipeline.generateCartesianRhumbArc(generateCartesianArcOptions)),u.show=!0,u.positions=a.slice(),u.material=MaterialProperty.getValue(e,t.fillMaterialProperty,u.material),u.width=Property.getValueOrDefault(r._width,e,1),u.distanceDisplayCondition=Property.getValueOrUndefined(r._distanceDisplayCondition,e,u.distanceDisplayCondition)}else u.show=!1},DynamicGeometryUpdater$1.prototype.getBoundingSphere=function(e){if(this._geometryUpdater.clampToGround){var t=this._groundPolylinePrimitive;if(defined(t)&&t.show&&t.ready){var i=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(defined(i)&&defined(i.boundingSphere))return BoundingSphere.clone(i.boundingSphere,e),BoundingSphereState$1.DONE}return defined(t)&&!t.ready?BoundingSphereState$1.PENDING:BoundingSphereState$1.DONE}var r=getLine(this);return r.show&&0<r.positions.length?(BoundingSphere.fromPoints(r.positions,e),BoundingSphereState$1.DONE):BoundingSphereState$1.FAILED},DynamicGeometryUpdater$1.prototype.isDestroyed=function(){return!1},DynamicGeometryUpdater$1.prototype.destroy=function(){var e=this._geometryUpdater._scene.id,t=polylineCollections[e];defined(t)&&(t.remove(this._line),0===t.length&&(this._primitives.removeAndDestroy(t),delete polylineCollections[e])),defined(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),destroyObject(this)};var scratchColor$b=new Color,distanceDisplayConditionScratch$8=new DistanceDisplayCondition,defaultDistanceDisplayCondition$7=new DistanceDisplayCondition;function Batch$5(e,t,i,r,n){var a;a=i instanceof ColorMaterialProperty?PolylineColorAppearance:PolylineMaterialAppearance,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=a,this.materialProperty=i,this.updaters=new AssociativeArray,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new AssociativeArray,this.material=void 0,this.updatersWithAttributes=new AssociativeArray,this.attributes=new AssociativeArray,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Batch$5.prototype.onMaterialChanged,this),this.subscriptions=new AssociativeArray,this.showsUpdated=new AssociativeArray,this.zIndex=r,this._asynchronous=n}function StaticGroundPolylinePerMaterialBatch(e,t,i){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=defaultValue(i,!0)}Batch$5.prototype.onMaterialChanged=function(){this.invalidated=!0},Batch$5.prototype.isMaterial=function(e){var t=this.materialProperty,i=e.fillMaterialProperty;return i===t||i instanceof ColorMaterialProperty&&t instanceof ColorMaterialProperty||defined(t)&&t.equals(i)},Batch$5.prototype.add=function(e,n,t){var i=n.id;if(this.updaters.set(i,n),this.geometry.set(i,t),n.hasConstantFill&&n.fillMaterialProperty.isConstant&&Property.isConstant(n.distanceDisplayConditionProperty)){var a=this;this.subscriptions.set(i,n.entity.definitionChanged.addEventListener(function(e,t,i,r){"isShowing"===t&&a.showsUpdated.set(n.id,n)}))}else this.updatersWithAttributes.set(i,n);this.createPrimitive=!0},Batch$5.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);return defined(i)&&(i(),this.subscriptions.remove(t)),!0}return!1},Batch$5.prototype.update=function(e){var t,i=!0,r=this.primitive,n=this.orderedGroundPrimitives,a=this.geometry.values;if(this.createPrimitive){if(0<a.length)defined(r)&&(defined(this.oldPrimitive)?n.remove(r):this.oldPrimitive=r),r=new GroundPolylinePrimitive({show:!1,asynchronous:this._asynchronous,geometryInstances:a,appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),r.appearance.material=this.material),n.add(r,this.zIndex),i=!1;else{defined(r)&&(n.remove(r),r=void 0);var o=this.oldPrimitive;defined(o)&&(n.remove(o),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1}else if(defined(r)&&r.ready){r.show=!0,defined(this.oldPrimitive)&&(n.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===PolylineMaterialAppearance&&(this.material=MaterialProperty.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);var s=this.updatersWithAttributes.values,l=s.length;for(t=0;t<l;t++){var c=s[t],u=c.entity,d=this.geometry.get(c.id),h=this.attributes.get(d.id.id);if(defined(h)||(h=r.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!c.fillMaterialProperty.isConstant){var p=c.fillMaterialProperty.color,m=Property.getValueOrDefault(p,e,Color.WHITE,scratchColor$b);Color.equals(h._lastColor,m)||(h._lastColor=Color.clone(m,h._lastColor),h.color=ColorGeometryInstanceAttribute.toValue(m,h.color))}var f=u.isShowing&&(c.hasConstantFill||c.isFilled(e));f!==(1===h.show[0])&&(h.show=ShowGeometryInstanceAttribute.toValue(f,h.show));var g=c.distanceDisplayConditionProperty;if(!Property.isConstant(g)){var _=Property.getValueOrDefault(g,e,defaultDistanceDisplayCondition$7,distanceDisplayConditionScratch$8);DistanceDisplayCondition.equals(_,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=DistanceDisplayCondition.clone(_,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=DistanceDisplayConditionGeometryInstanceAttribute.toValue(_,h.distanceDisplayCondition))}}this.updateShows(r)}else defined(r)&&!r.ready&&(i=!1);return i},Batch$5.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,r=0;r<i;r++){var n=t[r],a=n.entity,o=this.geometry.get(n.id),s=this.attributes.get(o.id.id);defined(s)||(s=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,s));var l=a.isShowing;l!==(1===s.show[0])&&(s.show=ShowGeometryInstanceAttribute.toValue(l,s.show),o.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Batch$5.prototype.contains=function(e){return this.updaters.contains(e.id)},Batch$5.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return BoundingSphereState$1.PENDING;var r=i.getGeometryInstanceAttributes(e.entity);return!defined(r)||!defined(r.boundingSphere)||defined(r.show)&&0===r.show[0]?BoundingSphereState$1.FAILED:(r.boundingSphere.clone(t),BoundingSphereState$1.DONE)},Batch$5.prototype.destroy=function(){var e=this.primitive,t=this.orderedGroundPrimitives;defined(e)&&t.remove(e);var i=this.oldPrimitive;defined(i)&&t.remove(i),this.removeMaterialSubscription()},StaticGroundPolylinePerMaterialBatch.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=t.createFillGeometryInstance(e),a=Property.getValueOrDefault(t.zIndex,0),o=0;o<r;++o){var s=i[o];if(s.isMaterial(t)&&s.zIndex===a)return void s.add(e,t,n)}var l=new Batch$5(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,a,this._asynchronous);l.add(e,t,n),i.push(l)},StaticGroundPolylinePerMaterialBatch.prototype.remove=function(e){for(var t=this._items,i=t.length-1;0<=i;i--){var r=t[i];if(r.remove(e)){0===r.updaters.length&&(t.splice(i,1),r.destroy());break}}},StaticGroundPolylinePerMaterialBatch.prototype.update=function(e){var t,i=this._items;for(t=i.length-1;0<=t;t--){var r=i[t];if(r.invalidated){i.splice(t,1);for(var n=r.updaters.values,a=n.length,o=0;o<a;o++)this.add(e,n[o]);r.destroy()}}var s=!0;for(t=0;t<i.length;t++)s=i[t].update(e)&&s;return s},StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,n=0;n<r;n++){var a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return BoundingSphereState$1.FAILED},StaticGroundPolylinePerMaterialBatch.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;i<t;i++)e[i].destroy();this._items.length=0};var emptyArray$1=[];function removeUpdater(e,t){for(var i=e._batches,r=i.length,n=0;n<r;n++)i[n].remove(t)}function insertUpdaterIntoBatch(e,t,i){if(i.isDynamic)e._dynamicBatch.add(t,i);else if(i.clampToGround&&i.fillEnabled){var r=i.classificationTypeProperty.getValue(t);e._groundBatches[r].add(t,i)}else{var n;i.fillEnabled&&(n=i.shadowsProperty.getValue(t));var a,o=0;defined(i.depthFailMaterialProperty)&&(o=i.depthFailMaterialProperty instanceof ColorMaterialProperty?1:2),defined(n)&&(a=n+o*ShadowMode$1.NUMBER_OF_SHADOW_MODES),i.fillEnabled&&(i.fillMaterialProperty instanceof ColorMaterialProperty?e._colorBatches[a].add(t,i):e._materialBatches[a].add(t,i))}}function PolylineVisualizer(e,t,i,r){var n;r=defaultValue(r,e.groundPrimitives),i=defaultValue(i,e.primitives),this._scene=e,this._primitives=i,this._entityCollection=void 0,this._addedObjects=new AssociativeArray,this._removedObjects=new AssociativeArray,this._changedObjects=new AssociativeArray;var a=ShadowMode$1.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(3*a),this._materialBatches=new Array(3*a),n=0;n<a;++n)this._colorBatches[n]=new StaticGeometryColorBatch(i,PolylineColorAppearance,void 0,!1,n),this._materialBatches[n]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,void 0,!1,n),this._colorBatches[n+a]=new StaticGeometryColorBatch(i,PolylineColorAppearance,PolylineColorAppearance,!1,n),this._materialBatches[n+a]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,PolylineColorAppearance,!1,n),this._colorBatches[n+2*a]=new StaticGeometryColorBatch(i,PolylineColorAppearance,PolylineMaterialAppearance,!1,n),this._materialBatches[n+2*a]=new StaticGeometryPerMaterialBatch(i,PolylineMaterialAppearance,PolylineMaterialAppearance,!1,n);this._dynamicBatch=new DynamicGeometryBatch(i,r);var o=ClassificationType$1.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(o),n=0;n<o;++n)this._groundBatches[n]=new StaticGroundPolylinePerMaterialBatch(r,n);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new AssociativeArray,this._updaters=new AssociativeArray,(this._entityCollection=t).collectionChanged.addEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,emptyArray$1)}PolylineVisualizer.prototype.update=function(e){var t,i,r,n,a=this._addedObjects,o=a.values,s=this._removedObjects,l=s.values,c=this._changedObjects,u=c.values;for(t=u.length-1;-1<t;t--)r=(i=u[t]).id,(n=this._updaters.get(r)).entity===i?(removeUpdater(this,n),insertUpdaterIntoBatch(this,e,n)):(l.push(i),o.push(i));for(t=l.length-1;-1<t;t--)r=(i=l[t]).id,n=this._updaters.get(r),removeUpdater(this,n),n.destroy(),this._updaters.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(t=o.length-1;-1<t;t--)r=(i=o[t]).id,n=new PolylineGeometryUpdater(i,this._scene),this._updaters.set(r,n),insertUpdaterIntoBatch(this,e,n),this._subscriptions.set(r,n.geometryChanged.addEventListener(PolylineVisualizer._onGeometryChanged,this));a.removeAll(),s.removeAll(),c.removeAll();var d=!0,h=this._batches,p=h.length;for(t=0;t<p;t++)d=h[t].update(e)&&d;return d};var getBoundingSphereArrayScratch$1=[],getBoundingSphereBoundingSphereScratch$1=new BoundingSphere;function DataSourceDisplay(e){GroundPrimitive.initializeTerrainHeights(),GroundPolylinePrimitive.initializeTerrainHeights();var t=e.scene,i=e.dataSourceCollection;this._eventHelper=new EventHelper,this._eventHelper.add(i.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(i.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(i.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=i,this._scene=t,this._visualizersCallback=defaultValue(e.visualizersCallback,DataSourceDisplay.defaultVisualizersCallback);var r=!1,n=new PrimitiveCollection,a=new PrimitiveCollection;0<i.length&&(t.primitives.add(n),t.groundPrimitives.add(a),r=!0),this._primitives=n,this._groundPrimitives=a;for(var o=0,s=i.length;o<s;o++)this._onDataSourceAdded(i,i.get(o));var l,c,u=new CustomDataSource;if(this._onDataSourceAdded(void 0,u),this._defaultDataSource=u,!r){var d=this,h=function(){t.primitives.add(n),t.groundPrimitives.add(a),l(),c(),d._removeDefaultDataSourceListener=void 0,d._removeDataSourceCollectionListener=void 0};l=u.entities.collectionChanged.addEventListener(h),c=i.dataSourceAdded.addEventListener(h)}this._removeDefaultDataSourceListener=l,this._removeDataSourceCollectionListener=c,this._ready=!1}PolylineVisualizer.prototype.getBoundingSphere=function(e,t){for(var i=getBoundingSphereArrayScratch$1,r=getBoundingSphereBoundingSphereScratch$1,n=0,a=BoundingSphereState$1.DONE,o=this._batches,s=o.length,l=this._updaters.get(e.id),c=0;c<s;c++){if((a=o[c].getBoundingSphere(l,r))===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;a===BoundingSphereState$1.DONE&&(i[n]=BoundingSphere.clone(r,i[n]),n++)}return 0===n?BoundingSphereState$1.FAILED:(i.length=n,BoundingSphere.fromBoundingSpheres(i,t),BoundingSphereState$1.DONE)},PolylineVisualizer.prototype.isDestroyed=function(){return!1},PolylineVisualizer.prototype.destroy=function(){var e;this._entityCollection.collectionChanged.removeEventListener(PolylineVisualizer.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var t=this._batches,i=t.length;for(e=0;e<i;e++)t[e].removeAllPrimitives();var r=this._subscriptions.values;for(i=r.length,e=0;e<i;e++)r[e]();return this._subscriptions.removeAll(),destroyObject(this)},PolylineVisualizer._onGeometryChanged=function(e){var t=this._removedObjects,i=this._changedObjects,r=e.entity,n=r.id;defined(t.get(n))||defined(i.get(n))||i.set(n,r)},PolylineVisualizer.prototype._onCollectionChanged=function(e,t,i){var r,n,a,o=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;-1<r;r--)n=(a=i[r]).id,o.remove(n)||(s.set(n,a),l.remove(n));for(r=t.length-1;-1<r;r--)n=(a=t[r]).id,s.remove(n)?l.set(n,a):o.set(n,a)},DataSourceDisplay.defaultVisualizersCallback=function(e,t,i){var r=i.entities;return[new BillboardVisualizer(t,r),new GeometryVisualizer(e,r,i._primitives,i._groundPrimitives),new LabelVisualizer(t,r),new ModelVisualizer(e,r),new PointVisualizer(t,r),new PathVisualizer(e,r),new PolylineVisualizer(e,r,i._primitives,i._groundPrimitives)]},defineProperties$1(DataSourceDisplay.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}}}),DataSourceDisplay.prototype.isDestroyed=function(){return!1},DataSourceDisplay.prototype.destroy=function(){this._eventHelper.removeAll();for(var e=this._dataSourceCollection,t=0,i=e.length;t<i;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),defined(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),destroyObject(this)},DataSourceDisplay.prototype.update=function(e){if(!ApproximateTerrainHeights.initialized)return this._ready=!1;var t,i,r,n,a=!0,o=this._dataSourceCollection,s=o.length;for(t=0;t<s;t++){var l=o.get(t);for(defined(l.update)&&(a=l.update(e)&&a),n=(r=l._visualizers).length,i=0;i<n;i++)a=r[i].update(e)&&a}for(n=(r=this._defaultDataSource._visualizers).length,i=0;i<n;i++)a=r[i].update(e)&&a;return this._ready=a},DataSourceDisplay.prototype._postRender=function(){for(var e=this._scene.frameState,t=this._dataSourceCollection,i=t.length,r=0;r<i;r++){var n=t.get(r),a=n.credit;defined(a)&&e.creditDisplay.addCredit(a);var o=n._resourceCredits;if(defined(o))for(var s=o.length,l=0;l<s;l++)e.creditDisplay.addCredit(o[l])}};var getBoundingSphereArrayScratch$2=[],getBoundingSphereBoundingSphereScratch$2=new BoundingSphere;DataSourceDisplay.prototype.getBoundingSphere=function(e,t,i){if(!this._ready)return BoundingSphereState$1.PENDING;var r,n,a=this._defaultDataSource;if(!a.entities.contains(e)){a=void 0;var o=this._dataSourceCollection;for(n=o.length,r=0;r<n;r++){var s=o.get(r);if(s.entities.contains(e)){a=s;break}}}if(!defined(a))return BoundingSphereState$1.FAILED;var l=getBoundingSphereArrayScratch$2,c=getBoundingSphereBoundingSphereScratch$2,u=0,d=BoundingSphereState$1.DONE,h=a._visualizers,p=h.length;for(r=0;r<p;r++){if(defined(h[r].getBoundingSphere)){if(d=h[r].getBoundingSphere(e,c),!t&&d===BoundingSphereState$1.PENDING)return BoundingSphereState$1.PENDING;d===BoundingSphereState$1.DONE&&(l[u]=BoundingSphere.clone(c,l[u]),u++)}}return 0===u?BoundingSphereState$1.FAILED:(l.length=u,BoundingSphere.fromBoundingSpheres(l,i),BoundingSphereState$1.DONE)},DataSourceDisplay.prototype._onDataSourceAdded=function(e,t){var i=this._scene,r=this._primitives,n=this._groundPrimitives,a=r.add(new PrimitiveCollection),o=n.add(new OrderedGroundPrimitiveCollection);t._primitives=a,t._groundPrimitives=o;var s=t.clustering;s._initialize(i),a.add(s),t._visualizers=this._visualizersCallback(i,s,t)},DataSourceDisplay.prototype._onDataSourceRemoved=function(e,t){var i=this._primitives,r=this._groundPrimitives,n=t._primitives,a=t._groundPrimitives,o=t.clustering;n.remove(o);for(var s=t._visualizers,l=s.length,c=0;c<l;c++)s[c].destroy();i.remove(n),r.remove(a),t._visualizers=void 0},DataSourceDisplay.prototype._onDataSourceMoved=function(e,t,i){var r=this._primitives,n=this._groundPrimitives,a=e._primitives,o=e._groundPrimitives;t===i+1?(r.raise(a),n.raise(o)):t===i-1?(r.lower(a),n.lower(o)):0===t?(r.lowerToBottom(a),n.lowerToBottom(o),r.raise(a),n.raise(o)):(r.raiseToTop(a),n.raiseToTop(o))};var updateTransformMatrix3Scratch1=new Matrix3,updateTransformMatrix3Scratch2=new Matrix3,updateTransformMatrix3Scratch3=new Matrix3,updateTransformMatrix4Scratch=new Matrix4,updateTransformCartesian3Scratch1=new Cartesian3,updateTransformCartesian3Scratch2=new Cartesian3,updateTransformCartesian3Scratch3=new Cartesian3,updateTransformCartesian3Scratch4=new Cartesian3,updateTransformCartesian3Scratch5=new Cartesian3,updateTransformCartesian3Scratch6=new Cartesian3,deltaTime=new JulianDate,northUpAxisFactor=1.25;function updateTransform(e,t,i,r,n,a,o){var s=e.scene.mode,l=n.getValue(a,e._lastCartesian);if(defined(l)){var c,u,d,h,p,m,f=!1,g=!1;if(s===SceneMode$1.SCENE3D){JulianDate.addSeconds(a,.001,deltaTime);var _=n.getValue(deltaTime,updateTransformCartesian3Scratch1);if(defined(_)||(JulianDate.addSeconds(a,-.001,deltaTime),_=n.getValue(deltaTime,updateTransformCartesian3Scratch1),g=!0),defined(_)){var y,v=Transforms.computeFixedToIcrfMatrix(a,updateTransformMatrix3Scratch1),C=Transforms.computeFixedToIcrfMatrix(deltaTime,updateTransformMatrix3Scratch2);defined(v)&&defined(C)?y=Matrix3.transpose(v,updateTransformMatrix3Scratch3):(y=Transforms.computeTemeToPseudoFixedMatrix(a,updateTransformMatrix3Scratch3),v=Matrix3.transpose(y,updateTransformMatrix3Scratch1),C=Transforms.computeTemeToPseudoFixedMatrix(deltaTime,updateTransformMatrix3Scratch2),Matrix3.transpose(C,C));var S=Matrix3.multiplyByVector(v,l,updateTransformCartesian3Scratch5),x=Matrix3.multiplyByVector(C,_,updateTransformCartesian3Scratch6);Cartesian3.subtract(S,x,updateTransformCartesian3Scratch4);var T=1e3*Cartesian3.magnitude(updateTransformCartesian3Scratch4),b=CesiumMath.GRAVITATIONALPARAMETER,E=-b/(T*T-2*b/Cartesian3.magnitude(S));E<0||E>northUpAxisFactor*o.maximumRadius?(c=updateTransformCartesian3Scratch2,Cartesian3.normalize(l,c),Cartesian3.negate(c,c),d=Cartesian3.clone(Cartesian3.UNIT_Z,updateTransformCartesian3Scratch3),u=Cartesian3.cross(d,c,updateTransformCartesian3Scratch1),Cartesian3.magnitude(u)>CesiumMath.EPSILON7&&(Cartesian3.normalize(c,c),Cartesian3.normalize(u,u),d=Cartesian3.cross(c,u,updateTransformCartesian3Scratch3),Cartesian3.normalize(d,d),f=!0)):Cartesian3.equalsEpsilon(l,_,CesiumMath.EPSILON7)||(d=updateTransformCartesian3Scratch2,Cartesian3.normalize(S,d),Cartesian3.normalize(x,x),u=Cartesian3.cross(d,x,updateTransformCartesian3Scratch3),g&&(u=Cartesian3.multiplyByScalar(u,-1,u)),Cartesian3.equalsEpsilon(u,Cartesian3.ZERO,CesiumMath.EPSILON7)||(c=Cartesian3.cross(u,d,updateTransformCartesian3Scratch1),Matrix3.multiplyByVector(y,c,c),Matrix3.multiplyByVector(y,u,u),Matrix3.multiplyByVector(y,d,d),Cartesian3.normalize(c,c),Cartesian3.normalize(u,u),Cartesian3.normalize(d,d),f=!0))}}defined(e.boundingSphere)&&(l=e.boundingSphere.center),r&&(h=Cartesian3.clone(t.position,updateTransformCartesian3Scratch4),p=Cartesian3.clone(t.direction,updateTransformCartesian3Scratch5),m=Cartesian3.clone(t.up,updateTransformCartesian3Scratch6));var P=updateTransformMatrix4Scratch;f?(P[0]=c.x,P[1]=c.y,P[2]=c.z,P[3]=0,P[4]=u.x,P[5]=u.y,P[6]=u.z,P[7]=0,P[8]=d.x,P[9]=d.y,P[10]=d.z,P[11]=0,P[12]=l.x,P[13]=l.y,P[14]=l.z,P[15]=0):Transforms.eastNorthUpToFixedFrame(l,o,P),t._setTransform(P),r&&(Cartesian3.clone(h,t.position),Cartesian3.clone(p,t.direction),Cartesian3.clone(m,t.up),Cartesian3.cross(p,m,t.right))}if(i){var A=s===SceneMode$1.SCENE2D||Cartesian3.equals(e._offset3D,Cartesian3.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,A)}}function EntityView(e,t,i){this.entity=e,this.scene=t,this.ellipsoid=defaultValue(i,Ellipsoid.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new Cartesian3,this._defaultOffset3D=void 0,this._offset3D=new Cartesian3}defineProperties$1(EntityView,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=Cartesian3.clone(e,new Cartesian3)}}}),EntityView.defaultOffset3D=new Cartesian3(-14e3,3500,3500);var scratchHeadingPitchRange=new HeadingPitchRange,scratchCartesian$3=new Cartesian3;EntityView.prototype.update=function(e,t){var i=this.scene,r=this.ellipsoid,n=i.mode;if(n!==SceneMode$1.MORPHING){var a=this.entity,o=a.position;if(defined(o)){var s=a!==this._lastEntity,l=n!==this._mode,c=i.camera,u=s||l,d=!0;if(s){var h=a.viewFrom,p=defined(h);if(!p&&defined(t)){scratchHeadingPitchRange.pitch=-CesiumMath.PI_OVER_FOUR,scratchHeadingPitchRange.range=0;var m=o.getValue(e,scratchCartesian$3);if(defined(m)){var f=2-1/Math.max(1,Cartesian3.magnitude(m)/r.maximumRadius);scratchHeadingPitchRange.pitch*=f}c.viewBoundingSphere(t,scratchHeadingPitchRange),this.boundingSphere=t,d=u=!1}else p&&defined(h.getValue(e,this._offset3D))||Cartesian3.clone(EntityView._defaultOffset3D,this._offset3D)}else l||this._mode===SceneMode$1.SCENE2D||Cartesian3.clone(c.position,this._offset3D);this._lastEntity=a,this._mode=n,updateTransform(this,c,u,d,o,e,r)}}};var tmp$2={};!function(C){var a,e,m="File format is not recognized.",o="File contains encrypted entry.",s="File is using Zip64 (4gb+ file size).",d="Error while reading zip file.",t="Error while reading file data.",g=524288,f="inflate.js",S="deflate.js",l="text/plain",x="message";try{a=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function T(){var r=-1,n=this;n.append=function(e){var t,i=n.table;for(t=0;t<e.length;t++)r=r>>>8^i[255&(r^e[t])]},n.get=function(){return~r}}function b(e,t){var i,r;return i=new ArrayBuffer(e),r=new Uint8Array(i),t&&r.set(t,0),{buffer:i,array:r,view:new DataView(i)}}function i(){}function r(r){var n,a=this;a.size=0,a.init=function(e,t){var i=new Blob([r],{type:l});(n=new c(i)).init(function(){a.size=n.size,e()},t)},a.readUint8Array=function(e,t,i,r){n.readUint8Array(e,t,i,r)}}function n(c){var u,i=this;i.size=0,i.init=function(e){for(var t=c.length;"="==c.charAt(t-1);)t--;u=c.indexOf(",")+1,i.size=Math.floor(.75*(t-u)),e()},i.readUint8Array=function(e,t,i){var r,n=b(t),a=4*Math.floor(e/3),o=4*Math.ceil((e+t)/3),s=window.atob(c.substring(a+u,o+u)),l=e-3*Math.floor(a/4);for(r=l;r<l+t;r++)n.array[r-l]=s.charCodeAt(r);i(n.array)}}function c(a){this.size=0,this.init=function(e){this.size=a.size,e()},this.readUint8Array=function(e,t,i,r){var n=new FileReader;n.onload=function(e){i(new Uint8Array(e.target.result))},n.onerror=r,n.readAsArrayBuffer(function(e,t,i){return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(a,e,t))}}function u(){}function h(r){var n;this.init=function(e){n=new Blob([],{type:l}),e()},this.writeUint8Array=function(e,t){n=new Blob([n,a?e:e.buffer],{type:l}),t()},this.getData=function(t,e){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=e,i.readAsText(n,r)}}function p(t){var a="",o="";this.init=function(e){a+="data:"+(t||"")+";base64,",e()},this.writeUint8Array=function(e,t){var i,r=o.length,n=o;for(o="",i=0;i<3*Math.floor((r+e.length)/3)-r;i++)n+=String.fromCharCode(e[i]);for(;i<e.length;i++)o+=String.fromCharCode(e[i]);2<n.length?a+=window.btoa(n):o=n,t()},this.getData=function(e){e(a+window.btoa(o))}}function _(i){var r;this.init=function(e){r=new Blob([],{type:i}),e()},this.writeUint8Array=function(e,t){r=new Blob([r,a?e:e.buffer],{type:i}),t()},this.getData=function(e){e(r)}}function E(t,e,r,i,n,a,o,s,l,c){var u,d,h=0;function p(){t.removeEventListener(x,m,!1),s(d)}function m(e){var t=e.data,i=t.data;t.onappend&&(d+=i.length,r.writeUint8Array(i,function(){a(!1,i),f()},c)),t.onflush&&(i?(d+=i.length,r.writeUint8Array(i,function(){a(!1,i),p()},c)):p()),t.progress&&o&&o(u+t.current,n)}function f(){(u=h*g)<n?e.readUint8Array(i+u,Math.min(g,n-u),function(e){t.postMessage({append:!0,data:e}),h++,o&&o(u,n),a(!0,e)},l):t.postMessage({flush:!0})}d=0,t.addEventListener(x,m,!1),f()}function P(r,t,n,a,o,s,l,c,u,d){var h,p=0,m=0;!function i(){var e;(h=p*g)<o?t.readUint8Array(a+h,Math.min(g,o-h),function(e){var t=r.append(e,function(){l&&l(a+h,o)});m+=t.length,s(!0,e),n.writeUint8Array(t,function(){s(!1,t),p++,setTimeout(i,1)},d),l&&l(h,o)},u):(e=r.flush())?(m+=e.length,n.writeUint8Array(e,function(){s(!1,e),c(m)},d)):c(m)}()}function A(e,r,n,a,o,s,l,c,u){var d=0,h=new T;!function t(){var i=d*g;i<a?e.readUint8Array(n+i,Math.min(g,a-i),function(e){o&&h.append(e),l&&l(i,a,e),r.writeUint8Array(e,function(){d++,t()},u)},c):s(a,h.get())}()}function y(e){var t,i,r="",n=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(t=0;t<e.length;t++)r+=127<(i=255&e.charCodeAt(t))?n[i-128]:String.fromCharCode(i);return r}function v(e){return decodeURIComponent(escape(e))}function w(e){var t,i="";for(t=0;t<e.length;t++)i+=String.fromCharCode(e[t]);return i}function D(e,t,i,r,n){e.version=t.view.getUint16(i,!0),e.bitFlag=t.view.getUint16(i+2,!0),e.compressionMethod=t.view.getUint16(i+4,!0),e.lastModDateRaw=t.view.getUint32(i+6,!0),e.lastModDate=function(e){var t=(4294901760&e)>>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?(!r&&8==(8&e.bitFlag)||(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):n(s)):n(o)}function M(h,p){function u(){}return u.prototype.getData=function(r,i,n,a){var o,s=this;function l(e,t){o&&o.terminate(),o=null,e&&e(t)}function c(e,t){a&&!function(e){var t=b(4);return t.view.setUint32(0,e),s.crc32==t.view.getUint32(0)}(t)?u():r.getData(function(e){l(i,e)})}function u(){l(p,t)}function d(){l(p,"Error while writing file data.")}h.readUint8Array(s.offset,30,function(e){var t,i=b(e.length,e);1347093252==i.view.getUint32(0)?(D(s,i,4,!1,p),t=s.offset+30+s.filenameLength+s.extraFieldLength,r.init(function(){0===s.compressionMethod?A(h,r,t,s.compressedSize,a,c,n,u,d):o=function(e,t,i,r,n,a,o,s,l){var c,u=new T;function d(e,t){n&&!e&&u.append(t)}function h(e){a(e,u.get())}return C.zip.useWebWorkers?E(c=new Worker(C.zip.workerScriptsPath+f),e,t,i,r,d,o,h,s,l):P(new C.zip.Inflater,e,t,i,r,d,o,h,s,l),c}(h,r,t,s.compressedSize,a,c,n,u,d)},d)):p(m)},u)},{getEntries:function(c){h.size<22?p(m):function i(r,n){h.readUint8Array(h.size-r,r,function(e){var t=b(e.length,e).view;1347093766!=t.getUint32(0)?i(r+1,n):n(t)},function(){p(d)})}(22,function(e){var t,l;t=e.getUint32(16,!0),l=e.getUint16(8,!0),h.readUint8Array(t,h.size-t,function(e){var t,i,r,n,a=0,o=[],s=b(e.length,e);for(t=0;t<l;t++){if(i=new u,1347092738!=s.view.getUint32(a))return void p(m);D(i,s,a+6,!0,p),i.commentLength=s.view.getUint16(a+32,!0),i.directory=16==(16&s.view.getUint8(a+38)),i.offset=s.view.getUint32(a+42,!0),r=w(s.array.subarray(a+46,a+46+i.filenameLength)),i.filename=2048==(2048&i.bitFlag)?v(r):y(r),i.directory||"/"!=i.filename.charAt(i.filename.length-1)||(i.directory=!0),n=w(s.array.subarray(a+46+i.filenameLength+i.extraFieldLength,a+46+i.filenameLength+i.extraFieldLength+i.commentLength)),i.comment=2048==(2048&i.bitFlag)?v(n):y(n),o.push(i),a+=46+i.filenameLength+i.extraFieldLength+i.commentLength}c(o)},function(){p(d)})})},close:function(e){e&&e()}}}function I(e){return unescape(encodeURIComponent(e))}function R(e){var t,i=[];for(t=0;t<e.length;t++)i.push(e.charCodeAt(t));return i}function O(u,d,h){var p,m={},f=[],g=0;function _(e,t){p&&p.terminate(),p=null,e&&e(t)}function y(){_(d,"Error while writing zip file.")}function v(){_(d,t)}return{add:function(i,r,n,e,a){var o,s,l;function t(e,t){var i=b(16);g+=e||0,i.view.setUint32(0,1347094280),void 0!==t&&(o.view.setUint32(10,t,!0),i.view.setUint32(4,t,!0)),r&&(i.view.setUint32(8,e,!0),o.view.setUint32(14,e,!0),i.view.setUint32(12,r.size,!0),o.view.setUint32(18,r.size,!0)),u.writeUint8Array(i.array,function(){g+=16,_(n)},y)}function c(){a=a||{},i=i.trim(),a.directory&&"/"!=i.charAt(i.length-1)&&(i+="/"),m.hasOwnProperty(i)?d("File already exists."):(s=R(I(i)),f.push(i),function(e){var t;l=a.lastModDate||new Date,o=b(26),m[i]={headerArray:o.array,directory:a.directory,filename:s,offset:g,comment:R(I(a.comment||""))},o.view.setUint32(0,335546376),a.version&&o.view.setUint8(0,a.version),h||0===a.level||a.directory||o.view.setUint16(4,2048),o.view.setUint16(6,(l.getHours()<<6|l.getMinutes())<<5|l.getSeconds()/2,!0),o.view.setUint16(8,(l.getFullYear()-1980<<4|l.getMonth()+1)<<5|l.getDate(),!0),o.view.setUint16(22,s.length,!0),(t=b(30+s.length)).view.setUint32(0,1347093252),t.array.set(o.array,4),t.array.set(s,30),g+=t.array.length,u.writeUint8Array(t.array,e,y)}(function(){r?h||0===a.level?A(r,u,0,r.size,!0,t,e,v,y):p=function(t,i,e,r,n,a,o){var s,l=new T;function c(e,t){e&&l.append(t)}function u(e){r(e,l.get())}return C.zip.useWebWorkers?((s=new Worker(C.zip.workerScriptsPath+S)).addEventListener(x,function e(){s.removeEventListener(x,e,!1),E(s,t,i,0,t.size,c,n,u,a,o)},!1),s.postMessage({init:!0,level:e})):P(new C.zip.Deflater,t,i,0,t.size,c,n,u,a,o),s}(r,u,a.level,t,e,v,y):t()}))}r?r.init(c,v):c()},close:function(e){var t,i,r,n=0,a=0;for(i=0;i<f.length;i++)n+=46+(r=m[f[i]]).filename.length+r.comment.length;for(t=b(n+22),i=0;i<f.length;i++)r=m[f[i]],t.view.setUint32(a,1347092738),t.view.setUint16(a+4,5120),t.array.set(r.headerArray,a+6),t.view.setUint16(a+32,r.comment.length,!0),r.directory&&t.view.setUint8(a+38,16),t.view.setUint32(a+42,r.offset,!0),t.array.set(r.filename,a+46),t.array.set(r.comment,a+46+r.filename.length),a+=46+r.filename.length+r.comment.length;t.view.setUint32(a,1347093766),t.view.setUint16(a+8,f.length,!0),t.view.setUint16(a+10,f.length,!0),t.view.setUint32(a+12,n,!0),t.view.setUint32(a+16,g,!0),u.writeUint8Array(t.array,function(){_(function(){u.getData(e)})},y)}}}T.prototype.table=function(){var e,t,i,r=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;r[e]=i}return r}(),(r.prototype=new i).constructor=r,(n.prototype=new i).constructor=n,(c.prototype=new i).constructor=c,u.prototype.getData=function(e){e(this.data)},(h.prototype=new u).constructor=h,(p.prototype=new u).constructor=p,(_.prototype=new u).constructor=_,C.zip={Reader:i,Writer:u,BlobReader:c,Data64URIReader:n,TextReader:r,BlobWriter:_,Data64URIWriter:p,TextWriter:h,createReader:function(e,t,i){e.init(function(){t(M(e,i))},i)},createWriter:function(e,t,i,r){e.init(function(){t(O(e,i,r))},i)},useWebWorkers:!0},defineProperties$1(C.zip,{workerScriptsPath:{get:function(){return void 0===e&&(e=buildModuleUrl("ThirdParty/Workers/")),e}}})}(tmp$2);var zip=tmp$2.zip,BILLBOARD_SIZE=32,kmlNamespace="http://www.opengis.net/kml/2.2",gxNamespace="http://www.google.com/kml/ext/2.2",xmlnsNamespace="http://www.w3.org/2000/xmlns/";function ExternalFileHandler(e){this._files={},this._promises=[],this._count=0,this._modelCallback=e}var imageTypeRegex=/^data:image\/([^,;]+)/;function getModelBlobHander(t,i){return function(e){t._files[i]=e}}function ValueGetter(e){this._time=e}function StyleCache(){this._ids={},this._styles={},this._count=0}function IdManager(){this._ids={}}function exportKml(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).entities,i=defaultValue(e.kmz,!1),r=exportKml._createState(e),n=t.values.filter(function(e){return!defined(e.parent)}),a=r.kmlDoc,o=a.documentElement;o.setAttributeNS(xmlnsNamespace,"xmlns:gx",gxNamespace);var s=a.createElement("Document");o.appendChild(s),recurseEntities(r,s,n),r.styleCache.save(s);var l=r.externalFileHandler;return l.promise.then(function(){var e=(new XMLSerializer).serializeToString(r.kmlDoc);return i?createKmz(e,l.files):{kml:e,externalFiles:l.files}})}function createKmz(e,i){var r=when.defer();return zip.createWriter(new zip.BlobWriter,function(t){addKmlToZip(t,e).then(function(){var e=Object.keys(i);return addExternalFilesToZip(t,e,i,0)}).then(function(){t.close(function(e){r.resolve({kmz:e})})})}),r.promise}function addKmlToZip(e,t){var i=when.defer();return e.add("doc.kml",new zip.TextReader(t),function(){i.resolve()}),i.promise}function addExternalFilesToZip(e,t,i,r){if(t.length!==r){var n=t[r],a=when.defer();return e.add(n,new zip.BlobReader(i[n]),function(){a.resolve()}),a.promise.then(function(){return addExternalFilesToZip(e,t,i,r+1)})}}function recurseEntities(e,t,i){for(var r,n,a,o=e.kmlDoc,s=e.styleCache,l=e.valueGetter,c=e.idManager,u=i.length,d=0;d<u;++d){var h,p=i[d];r=[],createPoint(e,p,n=[],a=[]),createLineString(e,p.polyline,n,a),createPolygon(e,p.rectangle,n,a,r),createPolygon(e,p.polygon,n,a,r),createModel(e,p,p.model,n,a);var m=p.availability;defined(m)&&(h=o.createElement("TimeSpan"),JulianDate.equals(m.start,Iso8601.MINIMUM_VALUE)||h.appendChild(createBasicElementWithText(o,"begin",JulianDate.toIso8601(m.start))),JulianDate.equals(m.stop,Iso8601.MAXIMUM_VALUE)||h.appendChild(createBasicElementWithText(o,"end",JulianDate.toIso8601(m.stop))));for(var f=0;f<r.length;++f){var g=r[f];g.setAttribute("id",c.get(p.id)),g.appendChild(createBasicElementWithText(o,"name",p.name)),g.appendChild(createBasicElementWithText(o,"visibility",p.show)),g.appendChild(createBasicElementWithText(o,"description",p.description)),defined(h)&&g.appendChild(h),t.appendChild(g)}var _=n.length;if(0<_){var y=o.createElement("Placemark");y.setAttribute("id",c.get(p.id));var v=p.name,C=p.label;if(defined(C)){var S=o.createElement("LabelStyle"),x=l.get(C.text);v=defined(x)&&0<x.length?x:v;var T=l.getColor(C.fillColor);defined(T)&&(S.appendChild(createBasicElementWithText(o,"color",T)),S.appendChild(createBasicElementWithText(o,"colorMode","normal")));var b=l.get(C.scale);defined(b)&&S.appendChild(createBasicElementWithText(o,"scale",b)),a.push(S)}y.appendChild(createBasicElementWithText(o,"name",v)),y.appendChild(createBasicElementWithText(o,"visibility",p.show)),y.appendChild(createBasicElementWithText(o,"description",p.description)),defined(h)&&y.appendChild(h),t.appendChild(y);var E=a.length;if(0<E){for(var P=o.createElement("Style"),A=0;A<E;++A)P.appendChild(a[A]);y.appendChild(createBasicElementWithText(o,"styleUrl",s.get(P)))}if(1===n.length)y.appendChild(n[0]);else if(1<n.length){for(var w=o.createElement("MultiGeometry"),D=0;D<_;++D)w.appendChild(n[D]);y.appendChild(w)}}var M=p._children;if(0<M.length){var I=o.createElement("Folder");I.setAttribute("id",c.get(p.id)),I.appendChild(createBasicElementWithText(o,"name",p.name)),I.appendChild(createBasicElementWithText(o,"visibility",p.show)),I.appendChild(createBasicElementWithText(o,"description",p.description)),t.appendChild(I),recurseEntities(e,I,M)}}}ExternalFileHandler.prototype.texture=function(e){var t,i=this;if("string"==typeof e||e instanceof Resource){if(!(e=Resource.createIfNeeded(e)).isDataUri)return e.url;var r=e.url.match(imageTypeRegex);t="texture_"+ ++this._count,defined(r)&&(t+="."+r[1]);var n=e.fetchBlob().then(function(e){i._files[t]=e});return this._promises.push(n),t}if(e instanceof HTMLCanvasElement){var a=when.defer();return this._promises.push(a.promise),t="texture_"+ ++this._count+".png",e.toBlob(function(e){i._files[t]=e,a.resolve()}),t}return""},ExternalFileHandler.prototype.model=function(e,t){var i=this._modelCallback;if(!defined(i))throw new RuntimeError("Encountered a model entity while exporting to KML, but no model callback was supplied.");var r={},n=i(e,t,r);for(var a in r)if(r.hasOwnProperty(a)){var o=when(r[a]);this._promises.push(o),o.then(getModelBlobHander(this,a))}return n},defineProperties$1(ExternalFileHandler.prototype,{promise:{get:function(){return when.all(this._promises)}},files:{get:function(){return this._files}}}),ValueGetter.prototype.get=function(e,t,i){var r;return defined(e)&&(r=defined(e.getValue)?e.getValue(this._time,i):e),defaultValue(r,t)},ValueGetter.prototype.getColor=function(e,t){var i=this.get(e,t);if(defined(i))return colorToString(i)},ValueGetter.prototype.getMaterialType=function(e){if(defined(e))return e.getType(this._time)},StyleCache.prototype.get=function(e){var t=this._ids,i=e.innerHTML;if(defined(t[i]))return t[i];var r="style-"+ ++this._count;return e.setAttribute("id",r),r="#"+r,t[i]=r,this._styles[i]=e,r},StyleCache.prototype.save=function(e){var t=this._styles,i=e.childNodes[0];for(var r in t)t.hasOwnProperty(r)&&e.insertBefore(t[r],i)},IdManager.prototype.get=function(e){if(!defined(e))return this.get(createGuid());var t=this._ids;return defined(t[e])?e.toString()+"-"+ ++t[e]:(t[e]=0,e)},exportKml._createState=function(e){var t=e.entities,i=new StyleCache,r=t.computeAvailability(),n=defined(e.time)?e.time:r.start,a=defaultValue(e.defaultAvailability,r),o=defaultValue(e.sampleDuration,60);a.start===Iso8601.MINIMUM_VALUE?a.stop===Iso8601.MAXIMUM_VALUE?a=new TimeInterval:JulianDate.addSeconds(a.stop,-10*o,a.start):a.stop===Iso8601.MAXIMUM_VALUE&&JulianDate.addSeconds(a.start,10*o,a.stop);var s=new ExternalFileHandler(e.modelCallback);return{kmlDoc:document.implementation.createDocument(kmlNamespace,"kml"),ellipsoid:defaultValue(e.ellipsoid,Ellipsoid.WGS84),idManager:new IdManager,styleCache:i,externalFileHandler:s,time:n,valueGetter:new ValueGetter(n),sampleDuration:o,defaultAvailability:new TimeIntervalCollection([a])}};var scratchCartesian3$a=new Cartesian3,scratchCartographic$7=new Cartographic,scratchJulianDate$1=new JulianDate;function createPoint(e,t,i,r){var n=e.kmlDoc,a=e.ellipsoid,o=e.valueGetter,s=defaultValue(t.billboard,t.point);if(defined(s)||defined(t.path)){var l=t.position;if(l.isConstant){o.get(l,void 0,scratchCartesian3$a);var c=createBasicElementWithText(n,"coordinates",getCoordinates(scratchCartesian3$a,a)),u=n.createElement("Point"),d=n.createElement("altitudeMode");d.appendChild(getAltitudeMode(e,s.heightReference)),u.appendChild(d),u.appendChild(c),i.push(u);var h=s instanceof BillboardGraphics?createIconStyleFromBillboard(e,s):createIconStyleFromPoint(e,s);r.push(h)}else createTracks(e,t,s,i,r)}}function createTracks(e,t,i,r,n){var a,o=e.kmlDoc,s=e.ellipsoid,l=e.valueGetter,c=t.position,u=!0;c instanceof CompositePositionProperty?(a=c.intervals,u=!1):a=defaultValue(t.availability,e.defaultAvailability);var d,h,p,m=i instanceof ModelGraphics,f=[];for(d=0;d<a.length;++d){var g=a.get(d),_=u?c:g.data,y=o.createElement("altitudeMode");_ instanceof ScaledPositionProperty?(_=_._value,y.appendChild(getAltitudeMode(e,HeightReference$1.CLAMP_TO_GROUND))):defined(i)?y.appendChild(getAltitudeMode(e,i.heightReference)):y.appendChild(getAltitudeMode(e,HeightReference$1.NONE));var v=[],C=[];if(_.isConstant){l.get(_,void 0,scratchCartesian3$a);var S=createBasicElementWithText(o,"coordinates",getCoordinates(scratchCartesian3$a,s));v.push(JulianDate.toIso8601(g.start)),C.push(S),v.push(JulianDate.toIso8601(g.stop)),C.push(S)}else if(_ instanceof SampledPositionProperty)for(p=_._property._times,h=0;h<p.length;++h)v.push(JulianDate.toIso8601(p[h])),_.getValueInReferenceFrame(p[h],ReferenceFrame$1.FIXED,scratchCartesian3$a),C.push(getCoordinates(scratchCartesian3$a,s));else if(_ instanceof SampledProperty){p=_._times;var x=_._values;for(h=0;h<p.length;++h)v.push(JulianDate.toIso8601(p[h])),Cartesian3.fromArray(x,3*h,scratchCartesian3$a),C.push(getCoordinates(scratchCartesian3$a,s))}else{var T=e.sampleDuration;g.start.clone(scratchJulianDate$1),g.isStartIncluded||JulianDate.addSeconds(scratchJulianDate$1,T,scratchJulianDate$1);for(var b=g.stop;JulianDate.lessThan(scratchJulianDate$1,b);)_.getValue(scratchJulianDate$1,scratchCartesian3$a),v.push(JulianDate.toIso8601(scratchJulianDate$1)),C.push(getCoordinates(scratchCartesian3$a,s)),JulianDate.addSeconds(scratchJulianDate$1,T,scratchJulianDate$1);g.isStopIncluded&&JulianDate.equals(scratchJulianDate$1,b)&&(_.getValue(scratchJulianDate$1,scratchCartesian3$a),v.push(JulianDate.toIso8601(scratchJulianDate$1)),C.push(getCoordinates(scratchCartesian3$a,s)))}var E=o.createElementNS(gxNamespace,"Track");E.appendChild(y);for(var P=0;P<v.length;++P){var A=createBasicElementWithText(o,"when",v[P]),w=createBasicElementWithText(o,"coord",C[P],gxNamespace);E.appendChild(A),E.appendChild(w)}m&&E.appendChild(createModelGeometry(e,i)),f.push(E)}if(1===f.length)r.push(f[0]);else if(1<f.length){var D=o.createElementNS(gxNamespace,"MultiTrack");for(d=0;d<f.length;++d)D.appendChild(f[d]);r.push(D)}if(defined(i)&&!m){var M=i instanceof BillboardGraphics?createIconStyleFromBillboard(e,i):createIconStyleFromPoint(e,i);n.push(M)}var I=t.path;if(defined(I)){var R=l.get(I.width),O=I.material;if(defined(O)||defined(R)){var L=o.createElement("LineStyle");defined(R)&&L.appendChild(createBasicElementWithText(o,"width",R)),processMaterial(e,O,L),n.push(L)}}}function createIconStyleFromPoint(e,t){var i=e.kmlDoc,r=e.valueGetter,n=i.createElement("IconStyle"),a=r.getColor(t.color);defined(a)&&(n.appendChild(createBasicElementWithText(i,"color",a)),n.appendChild(createBasicElementWithText(i,"colorMode","normal")));var o=r.get(t.pixelSize);return defined(o)&&n.appendChild(createBasicElementWithText(i,"scale",o/BILLBOARD_SIZE)),n}function createIconStyleFromBillboard(e,t){var i=e.kmlDoc,r=e.valueGetter,n=e.externalFileHandler,a=i.createElement("IconStyle"),o=r.get(t.image);if(defined(o)){o=n.texture(o);var s=i.createElement("Icon");s.appendChild(createBasicElementWithText(i,"href",o));var l=r.get(t.imageSubRegion);defined(l)&&(s.appendChild(createBasicElementWithText(i,"x",l.x,gxNamespace)),s.appendChild(createBasicElementWithText(i,"y",l.y,gxNamespace)),s.appendChild(createBasicElementWithText(i,"w",l.width,gxNamespace)),s.appendChild(createBasicElementWithText(i,"h",l.height,gxNamespace))),a.appendChild(s)}var c=r.getColor(t.color);defined(c)&&(a.appendChild(createBasicElementWithText(i,"color",c)),a.appendChild(createBasicElementWithText(i,"colorMode","normal")));var u=r.get(t.scale);defined(u)&&a.appendChild(createBasicElementWithText(i,"scale",u));var d=r.get(t.pixelOffset);if(defined(d)){u=defaultValue(u,1),Cartesian2.divideByScalar(d,u,d);var h=r.get(t.width,BILLBOARD_SIZE),p=r.get(t.height,BILLBOARD_SIZE),m=r.get(t.horizontalOrigin,HorizontalOrigin$1.CENTER);m===HorizontalOrigin$1.CENTER?d.x-=.5*h:m===HorizontalOrigin$1.RIGHT&&(d.x-=h);var f=r.get(t.verticalOrigin,VerticalOrigin$1.CENTER);f===VerticalOrigin$1.TOP?d.y+=p:f===VerticalOrigin$1.CENTER&&(d.y+=.5*p);var g=i.createElement("hotSpot");g.setAttribute("x",-d.x),g.setAttribute("y",d.y),g.setAttribute("xunits","pixels"),g.setAttribute("yunits","pixels"),a.appendChild(g)}var _=r.get(t.rotation),y=r.get(t.alignedAxis);return defined(_)&&Cartesian3.equals(Cartesian3.UNIT_Z,y)&&(0===(_=CesiumMath.toDegrees(-_))&&(_=360),a.appendChild(createBasicElementWithText(i,"heading",_))),a}function createLineString(e,t,i,r){var n=e.kmlDoc,a=e.ellipsoid,o=e.valueGetter;if(defined(t)){var s,l=n.createElement("LineString"),c=n.createElement("altitudeMode"),u=o.get(t.clampToGround,!1);s=u?(l.appendChild(createBasicElementWithText(n,"tessellate",!0)),n.createTextNode("clampToGround")):n.createTextNode("absolute"),c.appendChild(s),l.appendChild(c);var d=t.positions,h=createBasicElementWithText(n,"coordinates",getCoordinates(o.get(d),a));l.appendChild(h);var p=o.get(t.zIndex);u&&defined(p)&&l.appendChild(createBasicElementWithText(n,"drawOrder",p,gxNamespace)),i.push(l);var m=n.createElement("LineStyle"),f=o.get(t.width);defined(f)&&m.appendChild(createBasicElementWithText(n,"width",f)),processMaterial(e,t.material,m),r.push(m)}}function getRectangleBoundaries(e,t,i){var r,n=e.kmlDoc,a=e.valueGetter,o=a.get(t.height,0);0<i&&(o=i);for(var s=t.coordinates,l=a.get(s),c=[],u=[Rectangle.northeast,Rectangle.southeast,Rectangle.southwest,Rectangle.northwest],d=0;d<4;++d)u[d](l,scratchCartographic$7),c.push(CesiumMath.toDegrees(scratchCartographic$7.longitude)+","+CesiumMath.toDegrees(scratchCartographic$7.latitude)+","+o);r=createBasicElementWithText(n,"coordinates",c.join(" "));var h=n.createElement("outerBoundaryIs"),p=n.createElement("LinearRing");return p.appendChild(r),h.appendChild(p),[h]}function getLinearRing(e,t,i,r){for(var n=e.kmlDoc,a=e.ellipsoid,o=[],s=t.length,l=0;l<s;++l)Cartographic.fromCartesian(t[l],a,scratchCartographic$7),o.push(CesiumMath.toDegrees(scratchCartographic$7.longitude)+","+CesiumMath.toDegrees(scratchCartographic$7.latitude)+","+(r?scratchCartographic$7.height:i));var c=createBasicElementWithText(n,"coordinates",o.join(" ")),u=n.createElement("LinearRing");return u.appendChild(c),u}function getPolygonBoundaries(e,t,i){var r=e.kmlDoc,n=e.valueGetter,a=n.get(t.height,0),o=n.get(t.perPositionHeight,!1);!o&&0<i&&(a=i);var s=[],l=t.hierarchy,c=n.get(l),u=isArray$1(c)?c:c.positions,d=r.createElement("outerBoundaryIs");d.appendChild(getLinearRing(e,u,a,o)),s.push(d);var h=c.holes;if(defined(h))for(var p=h.length,m=0;m<p;++m){var f=r.createElement("innerBoundaryIs");f.appendChild(getLinearRing(e,h[m].positions,a,o)),s.push(f)}return s}function createPolygon(e,t,i,r,n){var a=e.kmlDoc,o=e.valueGetter;if(defined(t)){var s=t instanceof RectangleGraphics;if(s&&"Image"===o.getMaterialType(t.material))createGroundOverlay(e,t,n);else{var l=a.createElement("Polygon"),c=o.get(t.extrudedHeight,0);0<c&&l.appendChild(createBasicElementWithText(a,"extrude",!0));for(var u=s?getRectangleBoundaries(e,t,c):getPolygonBoundaries(e,t,c),d=u.length,h=0;h<d;++h)l.appendChild(u[h]);var p=a.createElement("altitudeMode");p.appendChild(getAltitudeMode(e,t.heightReference)),l.appendChild(p),i.push(l);var m=a.createElement("PolyStyle"),f=o.get(t.fill,!1);f&&m.appendChild(createBasicElementWithText(a,"fill",f)),processMaterial(e,t.material,m);var g=o.get(t.outline,!1);if(g){m.appendChild(createBasicElementWithText(a,"outline",g));var _=a.createElement("LineStyle"),y=o.get(t.outlineWidth,1);_.appendChild(createBasicElementWithText(a,"width",y));var v=o.getColor(t.outlineColor,Color.BLACK);_.appendChild(createBasicElementWithText(a,"color",v)),_.appendChild(createBasicElementWithText(a,"colorMode","normal")),r.push(_)}r.push(m)}}}function createGroundOverlay(e,t,i){var r=e.kmlDoc,n=e.valueGetter,a=e.externalFileHandler,o=r.createElement("GroundOverlay"),s=r.createElement("altitudeMode");s.appendChild(getAltitudeMode(e,t.heightReference)),o.appendChild(s);var l=n.get(t.height);defined(l)&&o.appendChild(createBasicElementWithText(r,"altitude",l));var c=n.get(t.coordinates),u=r.createElement("LatLonBox");u.appendChild(createBasicElementWithText(r,"north",CesiumMath.toDegrees(c.north))),u.appendChild(createBasicElementWithText(r,"south",CesiumMath.toDegrees(c.south))),u.appendChild(createBasicElementWithText(r,"east",CesiumMath.toDegrees(c.east))),u.appendChild(createBasicElementWithText(r,"west",CesiumMath.toDegrees(c.west))),o.appendChild(u);var d=n.get(t.material),h=a.texture(d.image),p=r.createElement("Icon");p.appendChild(createBasicElementWithText(r,"href",h)),o.appendChild(p),defined(d.color)&&o.appendChild(createBasicElementWithText(r,"color",colorToString(d.color))),i.push(o)}function createModelGeometry(e,t){var i=e.kmlDoc,r=e.valueGetter,n=e.externalFileHandler,a=i.createElement("Model"),o=r.get(t.scale);if(defined(o)){var s=i.createElement("scale");s.appendChild(createBasicElementWithText(i,"x",o)),s.appendChild(createBasicElementWithText(i,"y",o)),s.appendChild(createBasicElementWithText(i,"z",o)),a.appendChild(s)}var l=i.createElement("Link"),c=n.model(t,e.time);return l.appendChild(createBasicElementWithText(i,"href",c)),a.appendChild(l),a}function createModel(e,t,i,r,n){var a=e.kmlDoc,o=e.ellipsoid,s=e.valueGetter;if(defined(i)){var l=t.position;if(l.isConstant){var c=createModelGeometry(e,i),u=a.createElement("altitudeMode");u.appendChild(getAltitudeMode(e,i.heightReference)),c.appendChild(u),s.get(l,void 0,scratchCartesian3$a),Cartographic.fromCartesian(scratchCartesian3$a,o,scratchCartographic$7);var d=a.createElement("Location");d.appendChild(createBasicElementWithText(a,"longitude",CesiumMath.toDegrees(scratchCartographic$7.longitude))),d.appendChild(createBasicElementWithText(a,"latitude",CesiumMath.toDegrees(scratchCartographic$7.latitude))),d.appendChild(createBasicElementWithText(a,"altitude",scratchCartographic$7.height)),c.appendChild(d),r.push(c)}else createTracks(e,t,i,r,n)}}function processMaterial(e,t,i){var r=e.kmlDoc,n=e.valueGetter;if(defined(t)){var a=n.get(t);if(defined(a)){var o;switch(n.getMaterialType(t)){case"Image":o=colorToString(Color.WHITE);break;case"Color":case"Grid":case"PolylineGlow":case"PolylineArrow":case"PolylineDash":o=colorToString(a.color);break;case"PolylineOutline":o=colorToString(a.color);var s=colorToString(a.outlineColor),l=a.outlineWidth;i.appendChild(createBasicElementWithText(r,"outerColor",s,gxNamespace)),i.appendChild(createBasicElementWithText(r,"outerWidth",l,gxNamespace));break;case"Stripe":o=colorToString(a.oddColor)}defined(o)&&(i.appendChild(createBasicElementWithText(r,"color",o)),i.appendChild(createBasicElementWithText(r,"colorMode","normal")))}}}function getAltitudeMode(e,t){var i,r=e.kmlDoc;switch(e.valueGetter.get(t,HeightReference$1.NONE)){case HeightReference$1.NONE:i=r.createTextNode("absolute");break;case HeightReference$1.CLAMP_TO_GROUND:i=r.createTextNode("clampToGround");break;case HeightReference$1.RELATIVE_TO_GROUND:i=r.createTextNode("relativeToGround")}return i}function getCoordinates(e,t){isArray$1(e)||(e=[e]);for(var i=e.length,r=[],n=0;n<i;++n)Cartographic.fromCartesian(e[n],t,scratchCartographic$7),r.push(CesiumMath.toDegrees(scratchCartographic$7.longitude)+","+CesiumMath.toDegrees(scratchCartographic$7.latitude)+","+scratchCartographic$7.height);return r.join(" ")}function createBasicElementWithText(e,t,i,r){"boolean"==typeof(i=defaultValue(i,""))&&(i=i?"1":"0");var n=defined(r)?e.createElementNS(r,t):e.createElement(t),a="string"===i&&-1!==i.indexOf("<")?e.createCDATASection(i):e.createTextNode(i);return n.appendChild(a),n}function colorToString(e){for(var t="",i=e.toBytes(),r=3;0<=r;--r)t+=i[r]<16?"0"+i[r].toString(16):i[r].toString(16);return t}var tmp$3={},XPf,YPf;XPf=tmp$3,YPf=function(e){function t(e){return e}function m(e){var t,n=h(e.transform),a=1/0,o=a,s=-a,l=-a;function i(e){(e=n(e))[0]<a&&(a=e[0]),e[0]>s&&(s=e[0]),e[1]<o&&(o=e[1]),e[1]>l&&(l=e[1])}function r(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(r);break;case"Point":i(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(i)}}for(t in e.arcs.forEach(function(e){for(var t,i=-1,r=e.length;++i<r;)(t=n(e[i],i))[0]<a&&(a=t[0]),t[0]>s&&(s=t[0]),t[1]<o&&(o=t[1]),t[1]>l&&(l=t[1])}),e.objects)r(e.objects[t]);return[a,o,s,l]}function a(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map(function(e){return i(t,e)})}:i(t,e)}var h=function(e){if(null==e)return t;var a,o,s=e.scale[0],l=e.scale[1],c=e.translate[0],u=e.translate[1];return function(e,t){t||(a=o=0);var i=2,r=e.length,n=new Array(r);for(n[0]=(a+=e[0])*s+c,n[1]=(o+=e[1])*l+u;i<r;)n[i]=e[i],++i;return n}},u=function(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i};function i(e,t){var i=t.id,r=t.bbox,n=null==t.properties?{}:t.properties,a=o(e,t);return null==i&&null==r?{type:"Feature",properties:n,geometry:a}:null==r?{type:"Feature",id:i,properties:n,geometry:a}:{type:"Feature",id:i,bbox:r,properties:n,geometry:a}}function o(e,t){var a=h(e.transform),o=e.arcs;function n(e,t){t.length&&t.pop();for(var i=o[e<0?~e:e],r=0,n=i.length;r<n;++r)t.push(a(i[r],r));e<0&&u(t,n)}function s(e){return a(e)}function l(e){for(var t=[],i=0,r=e.length;i<r;++i)n(e[i],t);return t.length<2&&t.push(t[0]),t}function i(e){for(var t=l(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(i)}return function e(t){var i,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":i=s(t.coordinates);break;case"MultiPoint":i=t.coordinates.map(s);break;case"LineString":i=l(t.arcs);break;case"MultiLineString":i=t.arcs.map(l);break;case"Polygon":i=c(t.arcs);break;case"MultiPolygon":i=t.arcs.map(c);break;default:return null}return{type:r,coordinates:i}}(t)}function d(l,n){var a={},c={},u={},o=[],s=-1;function e(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){a[e<0?~e:e]=1}),o.push(r)}}return n.forEach(function(e,t){var i,r=l.arcs[e<0?~e:e];r.length<3&&!r[1][0]&&!r[1][1]&&(i=n[++s],n[s]=e,n[t]=i)}),n.forEach(function(e){var t,i,r=function(e){var t,i=l.arcs[e<0?~e:e],r=i[0];l.transform?(t=[0,0],i.forEach(function(e){t[0]+=e[0],t[1]+=e[1]})):t=i[i.length-1];return e<0?[t,r]:[r,t]}(e),n=r[0],a=r[1];if(t=u[n])if(delete u[t.end],t.push(e),t.end=a,i=c[a]){delete c[i.start];var o=i===t?t:t.concat(i);c[o.start=t.start]=u[o.end=i.end]=o}else c[t.start]=u[t.end]=t;else if(t=c[a])if(delete c[t.start],t.unshift(e),t.start=n,i=u[n]){delete u[i.end];var s=i===t?t:i.concat(t);c[s.start=i.start]=u[s.end=t.end]=s}else c[t.start]=u[t.end]=t;else c[(t=[e]).start=n]=u[t.end=a]=t}),e(u,c),e(c,u),n.forEach(function(e){a[e<0?~e:e]||o.push([e])}),o}function r(e,t,i){var r,n,a;if(1<arguments.length)r=function(e,t,i){var r,n=[],a=[];function o(e){var t=e<0?~e:e;(a[t]||(a[t]=[])).push({i:e,g:r})}function s(e){e.forEach(o)}function l(e){e.forEach(s)}return function e(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":t.arcs.forEach(l)}}(t),a.forEach(null==i?function(e){n.push(e[0].i)}:function(e){i(e[0].g,e[e.length-1].g)&&n.push(e[0].i)}),n}(0,t,i);else for(n=0,r=new Array(a=e.arcs.length);n<a;++n)r[n]=n;return{type:"MultiLineString",arcs:d(e,r)}}function n(s,e){var l={},i=[],r=[];function n(t){t.forEach(function(e){e.forEach(function(e){(l[e=e<0?~e:e]||(l[e]=[])).push(t)})}),i.push(t)}function c(e){return function(e){for(var t,i=-1,r=e.length,n=e[r-1],a=0;++i<r;)t=n,n=e[i],a+=t[0]*n[1]-t[1]*n[0];return Math.abs(a)}(o(s,{type:"Polygon",arcs:[e]}).coordinates[0])}return e.forEach(function e(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"Polygon":n(t.arcs);break;case"MultiPolygon":t.arcs.forEach(n)}}),i.forEach(function(e){if(!e._){var t=[],i=[e];for(e._=1,r.push(t);e=i.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){l[e<0?~e:e].forEach(function(e){e._||(e._=1,i.push(e))})})})}}),i.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:r.map(function(e){var t,i=[];if(e.forEach(function(e){e.forEach(function(e){e.forEach(function(e){l[e<0?~e:e].length<2&&i.push(e)})})}),1<(t=(i=d(s,i)).length))for(var r,n,a=1,o=c(i[0]);a<t;++a)(r=c(i[a]))>o&&(n=i[0],i[0]=i[a],i[a]=n,o=r);return i})}}function f(e,t){for(var i=0,r=e.length;i<r;){var n=i+r>>>1;e[n]<t?i=1+n:r=n}return i}function g(e){if(null==e)return t;var s,l,c=e.scale[0],u=e.scale[1],d=e.translate[0],h=e.translate[1];return function(e,t){t||(s=l=0);var i=2,r=e.length,n=new Array(r),a=Math.round((e[0]-d)/c),o=Math.round((e[1]-h)/u);for(n[0]=a-s,s=a,n[1]=o-l,l=o;i<r;)n[i]=e[i],++i;return n}}function E(n,a,o,e,s){3===arguments.length&&(e=Array,s=null);for(var l=new e(n=1<<Math.max(4,Math.ceil(Math.log(n)/Math.LN2))),c=n-1,t=0;t<n;++t)l[t]=s;return{add:function(e){for(var t=a(e)&c,i=l[t],r=0;i!=s;){if(o(i,e))return!0;if(++r>=n)throw new Error("full hashset");i=l[t=t+1&c]}return l[t]=e,!0},has:function(e){for(var t=a(e)&c,i=l[t],r=0;i!=s;){if(o(i,e))return!0;if(++r>=n)break;i=l[t=t+1&c]}return!1},values:function(){for(var e=[],t=0,i=l.length;t<i;++t){var r=l[t];r!=s&&e.push(r)}return e}}}function P(a,o,s,e,l,t){3===arguments.length&&(e=t=Array,l=null);for(var c=new e(a=1<<Math.max(4,Math.ceil(Math.log(a)/Math.LN2))),u=new t(a),d=a-1,i=0;i<a;++i)c[i]=l;return{set:function(e,t){for(var i=o(e)&d,r=c[i],n=0;r!=l;){if(s(r,e))return u[i]=t;if(++n>=a)throw new Error("full hashmap");r=c[i=i+1&d]}return c[i]=e,u[i]=t},maybeSet:function(e,t){for(var i=o(e)&d,r=c[i],n=0;r!=l;){if(s(r,e))return u[i];if(++n>=a)throw new Error("full hashmap");r=c[i=i+1&d]}return c[i]=e,u[i]=t},get:function(e,t){for(var i=o(e)&d,r=c[i],n=0;r!=l;){if(s(r,e))return u[i];if(++n>=a)break;r=c[i=i+1&d]}return t},keys:function(){for(var e=[],t=0,i=c.length;t<i;++t){var r=c[t];r!=l&&e.push(r)}return e}}}function A(e,t){return e[0]===t[0]&&e[1]===t[1]}function w(e){var t=l[0]^l[1];return 2147483647&(t=t<<5^t>>7^l[2]^l[3])}function _(e){var t,i,r,n,a=e.coordinates,o=e.lines,s=e.rings,l=function(){for(var e=P(1.4*a.length,S,x,Int32Array,-1,Int32Array),t=new Int32Array(a.length),i=0,r=a.length;i<r;++i)t[i]=e.maybeSet(i,i);return t}(),c=new Int32Array(a.length),u=new Int32Array(a.length),d=new Int32Array(a.length),h=new Int8Array(a.length),p=0;for(t=0,i=a.length;t<i;++t)c[t]=u[t]=d[t]=-1;for(t=0,i=o.length;t<i;++t){var m=o[t],f=m[0],g=m[1];for(r=l[f],n=l[++f],++p,h[r]=1;++f<=g;)C(t,r,r=n,n=l[f]);++p,h[n]=1}for(t=0,i=a.length;t<i;++t)c[t]=-1;for(t=0,i=s.length;t<i;++t){var _=s[t],y=_[0]+1,v=_[1];for(C(t,l[v-1],r=l[y-1],n=l[y]);++y<=v;)C(t,r,r=n,n=l[y])}function C(e,t,i,r){if(c[i]!==e){c[i]=e;var n=u[i];if(0<=n){var a=d[i];n===t&&a===r||n===r&&a===t||(++p,h[i]=1)}else u[i]=t,d[i]=r}}function S(e){return w(a[e])}function x(e,t){return A(a[e],a[t])}c=u=d=null;var T,b=E(1.4*p,w,A);for(t=0,i=a.length;t<i;++t)h[T=l[t]]&&b.add(a[T]);return b}var s=new ArrayBuffer(16),l=new Uint32Array(s);function y(e,t,i,r){c(e,t,i),c(e,t,t+r),c(e,t+r,i)}function c(e,t,i){for(var r,n=t+(i---t>>1);t<n;++t,--i)r=e[t],e[t]=e[i],e[i]=r}function p(e){var t,i,r={};for(t in e)r[t]=null==(i=e[t])?{type:null}:("FeatureCollection"===i.type?function(e){var t={type:"GeometryCollection",geometries:e.features.map(v)};null!=e.bbox&&(t.bbox=e.bbox);return t}:"Feature"===i.type?v:C)(i);return r}function v(e){var t,i=C(e.geometry);for(t in null!=e.id&&(i.id=e.id),null!=e.bbox&&(i.bbox=e.bbox),e.properties){i.properties=e.properties;break}return i}function C(e){if(null==e)return{type:null};var t="GeometryCollection"===e.type?{type:"GeometryCollection",geometries:e.geometries.map(C)}:"Point"===e.type||"MultiPoint"===e.type?{type:e.type,coordinates:e.coordinates}:{type:e.type,arcs:e.coordinates};return null!=e.bbox&&(t.bbox=e.bbox),t}function S(e){var t,i=e[0],r=e[1];return r<i&&(t=i,i=r,r=t),i+31*r}function x(e,t){var i,r=e[0],n=e[1],a=t[0],o=t[1];return n<r&&(i=r,r=n,n=i),o<a&&(i=a,a=o,o=i),r===a&&n===o}function T(){return!0}function b(e){return e}function D(e){return null!=e.type}function M(e){var t,l=new Array(e.arcs.length),c=0;function i(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(i);break;case"Polygon":r(e.arcs);break;case"MultiPolygon":e.arcs.forEach(r)}}function r(e){for(var t=0,i=e.length;t<i;++t,++c)for(var r=e[t],n=0,a=r.length;n<a;++n){var o=r[n];o<0&&(o=~o);var s=l[o];null==s?l[o]=c:s!==c&&(l[o]=-1)}}for(t in e.objects)i(e.objects[t]);return function(e){for(var t,i=0,r=e.length;i<r;++i)if(-1===l[(t=e[i])<0?~t:t])return!0;return!1}}function I(e){var t=e[0],i=e[1],r=e[2];return Math.abs((t[0]-r[0])*(i[1]-t[1])-(t[0]-i[0])*(r[1]-t[1]))/2}function R(e){for(var t,i=-1,r=e.length,n=e[r-1],a=0;++i<r;)t=n,n=e[i],a+=t[0]*n[1]-t[1]*n[0];return Math.abs(a)/2}function O(i,r,n){return r=null==r?Number.MIN_VALUE:+r,null==n&&(n=R),function(e,t){return n(a(i,{type:"Polygon",arcs:[e]}).geometry.coordinates[0],t)>=r}}function L(e,t){return e[1][2]-t[1][2]}function F(e){return[e[0],e[1],0]}function N(e,t){return t-e}var B=Math.PI,V=2*B,k=B/4,$=B/180,z=Math.abs,U=Math.atan2,G=Math.cos,H=Math.sin;function W(e,t){for(var i,r,n=0,a=e.length,o=0,s=e[t?n++:a-1],l=s[0]*$,c=s[1]*$/2+k,u=G(c),d=H(c);n<a;++n){i=l,l=(s=e[n])[0]*$,c=s[1]*$/2+k,r=u,u=G(c);var h=l-i,p=0<=h?1:-1,m=p*h,f=d*(d=H(c)),g=r*u+f*G(m),_=f*p*H(m);o+=U(_,g)}return o}e.bbox=m,e.feature=a,e.mesh=function(e){return o(e,r.apply(this,arguments))},e.meshArcs=r,e.merge=function(e){return o(e,n.apply(this,arguments))},e.mergeArcs=n,e.neighbors=function(e){var r={},t=e.map(function(){return[]});function i(e,i){e.forEach(function(e){e<0&&(e=~e);var t=r[e];t?t.push(i):r[e]=[i]})}function n(e,t){e.forEach(function(e){i(e,t)})}var a={LineString:i,MultiLineString:n,Polygon:n,MultiPolygon:function(e,t){e.forEach(function(e){n(e,t)})}};for(var o in e.forEach(function t(e,i){"GeometryCollection"===e.type?e.geometries.forEach(function(e){t(e,i)}):e.type in a&&a[e.type](e.arcs,i)}),r)for(var s=r[o],l=s.length,c=0;c<l;++c)for(var u=c+1;u<l;++u){var d,h=s[c],p=s[u];(d=t[h])[o=f(d,p)]!==p&&d.splice(o,0,p),(d=t[p])[o=f(d,h)]!==h&&d.splice(o,0,h)}return t},e.quantize=function(e,t){if(e.transform)throw new Error("already quantized");if(t&&t.scale)s=e.bbox;else{if(!(2<=(i=Math.floor(t))))throw new Error("n must be ≥2");var i,r=(s=e.bbox||m(e))[0],n=s[1],a=s[2],o=s[3];t={scale:[a-r?(a-r)/(i-1):1,o-n?(o-n)/(i-1):1],translate:[r,n]}}var s,l,c=g(t),u=e.objects,d={};function h(e){return c(e)}function p(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(p)};break;case"Point":t={type:"Point",coordinates:h(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(h)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(l in u)d[l]=p(u[l]);return{type:"Topology",bbox:s,transform:t,objects:d,arcs:e.arcs.map(function(e){var t,i=0,r=1,n=e.length,a=new Array(n);for(a[0]=c(e[0],0);++i<n;)((t=c(e[i],i))[0]||t[1])&&(a[r++]=t);return 1===r&&(a[r++]=[0,0]),a.length=r,a})}},e.transform=h,e.untransform=g,e.topology=function(e,t){var i=function(e){var r=1/0,n=1/0,a=-1/0,o=-1/0;function t(e){null!=e&&i.hasOwnProperty(e.type)&&i[e.type](e)}var i={GeometryCollection:function(e){e.geometries.forEach(t)},Point:function(e){s(e.coordinates)},MultiPoint:function(e){e.coordinates.forEach(s)},LineString:function(e){l(e.arcs)},MultiLineString:function(e){e.arcs.forEach(l)},Polygon:function(e){e.arcs.forEach(l)},MultiPolygon:function(e){e.arcs.forEach(c)}};function s(e){var t=e[0],i=e[1];t<r&&(r=t),a<t&&(a=t),i<n&&(n=i),o<i&&(o=i)}function l(e){e.forEach(s)}function c(e){e.forEach(l)}for(var u in e)t(e[u]);return r<=a&&n<=o?[r,n,a,o]:void 0}(e=p(e)),r=0<t&&i&&function(e,t,i){var d=t[0],h=t[1],r=t[2],n=t[3],p=r-d?(i-1)/(r-d):1,m=n-h?(i-1)/(n-h):1;function a(e){return[Math.round((e[0]-d)*p),Math.round((e[1]-h)*m)]}function o(e,t){for(var i,r,n,a,o,s=-1,l=0,c=e.length,u=new Array(c);++s<c;)i=e[s],a=Math.round((i[0]-d)*p),o=Math.round((i[1]-h)*m),a===r&&o===n||(u[l++]=[r=a,n=o]);for(u.length=l;l<t;)l=u.push([u[0][0],u[0][1]]);return u}function s(e){return o(e,2)}function l(e){return o(e,4)}function c(e){return e.map(l)}function u(e){null!=e&&f.hasOwnProperty(e.type)&&f[e.type](e)}var f={GeometryCollection:function(e){e.geometries.forEach(u)},Point:function(e){e.coordinates=a(e.coordinates)},MultiPoint:function(e){e.coordinates=e.coordinates.map(a)},LineString:function(e){e.arcs=s(e.arcs)},MultiLineString:function(e){e.arcs=e.arcs.map(s)},Polygon:function(e){e.arcs=c(e.arcs)},MultiPolygon:function(e){e.arcs=e.arcs.map(c)}};for(var g in e)u(e[g]);return{scale:[1/p,1/m],translate:[d,h]}}(e,i,t),n=function(e){var t,i,r,n,u=e.coordinates,a=e.lines,o=e.rings,s=a.length+o.length;for(delete e.lines,delete e.rings,r=0,n=a.length;r<n;++r)for(t=a[r];t=t.next;)++s;for(r=0,n=o.length;r<n;++r)for(i=o[r];i=i.next;)++s;var c=P(2*s*1.4,w,A),d=e.arcs=[];for(r=0,n=a.length;r<n;++r)for(t=a[r];l(t),t=t.next;);for(r=0,n=o.length;r<n;++r)if((i=o[r]).next)for(;l(i),i=i.next;);else h(i);function l(e){var t,i,r,n,a,o,s,l;if(r=c.get(t=u[e[0]]))for(s=0,l=r.length;s<l;++s)if(p(n=r[s],e))return e[0]=n[0],void(e[1]=n[1]);if(a=c.get(i=u[e[1]]))for(s=0,l=a.length;s<l;++s)if(m(o=a[s],e))return e[1]=o[0],void(e[0]=o[1]);r?r.push(e):c.set(t,[e]),a?a.push(e):c.set(i,[e]),d.push(e)}function h(e){var t,i,r,n,a;if(i=c.get(u[e[0]]))for(n=0,a=i.length;n<a;++n){if(f(r=i[n],e))return e[0]=r[0],void(e[1]=r[1]);if(g(r,e))return e[0]=r[1],void(e[1]=r[0])}if(i=c.get(t=u[e[0]+_(e)]))for(n=0,a=i.length;n<a;++n){if(f(r=i[n],e))return e[0]=r[0],void(e[1]=r[1]);if(g(r,e))return e[0]=r[1],void(e[1]=r[0])}i?i.push(e):c.set(t,[e]),d.push(e)}function p(e,t){var i=e[0],r=t[0],n=e[1];if(i-n!=r-t[1])return!1;for(;i<=n;++i,++r)if(!A(u[i],u[r]))return!1;return!0}function m(e,t){var i=e[0],r=t[0],n=e[1],a=t[1];if(i-n!=r-a)return!1;for(;i<=n;++i,--a)if(!A(u[i],u[a]))return!1;return!0}function f(e,t){var i=e[0],r=t[0],n=e[1]-i;if(n!=t[1]-r)return!1;for(var a=_(e),o=_(t),s=0;s<n;++s)if(!A(u[i+(s+a)%n],u[r+(s+o)%n]))return!1;return!0}function g(e,t){var i=e[0],r=t[0],n=e[1],a=t[1],o=n-i;if(o!=a-r)return!1;for(var s=_(e),l=o-_(t),c=0;c<o;++c)if(!A(u[i+(c+s)%o],u[a-(c+l)%o]))return!1;return!0}function _(e){for(var t=e[0],i=e[1],r=t,n=r,a=u[r];++r<i;){var o=u[r];(o[0]<a[0]||o[0]===a[0]&&o[1]<a[1])&&(n=r,a=o)}return n-t}return e}(function(e){var t,i,r,n=_(e),a=e.coordinates,o=e.lines,s=e.rings;for(i=0,r=o.length;i<r;++i)for(var l=o[i],c=l[0],u=l[1];++c<u;)n.has(a[c])&&(t={0:c,1:l[1]},l[1]=c,l=l.next=t);for(i=0,r=s.length;i<r;++i)for(var d=s[i],h=d[0],p=h,m=d[1],f=n.has(a[h]);++p<m;)n.has(a[p])&&(f?(t={0:p,1:d[1]},d[1]=p,d=d.next=t):(y(a,h,m,m-p),a[m]=a[h],f=!0,p=h));return e}(function(e){var n=-1,a=[],o=[],s=[];function t(e){e&&i.hasOwnProperty(e.type)&&i[e.type](e)}var i={GeometryCollection:function(e){e.geometries.forEach(t)},LineString:function(e){e.arcs=r(e.arcs)},MultiLineString:function(e){e.arcs=e.arcs.map(r)},Polygon:function(e){e.arcs=e.arcs.map(l)},MultiPolygon:function(e){e.arcs=e.arcs.map(c)}};function r(e){for(var t=0,i=e.length;t<i;++t)s[++n]=e[t];var r={0:n-i+1,1:n};return a.push(r),r}function l(e){for(var t=0,i=e.length;t<i;++t)s[++n]=e[t];var r={0:n-i+1,1:n};return o.push(r),r}function c(e){return e.map(l)}for(var u in e)t(e[u]);return{type:"Topology",coordinates:s,lines:a,rings:o,objects:e}}(e))),a=n.coordinates,o=P(1.4*n.arcs.length,S,x);function s(e){e&&l.hasOwnProperty(e.type)&&l[e.type](e)}e=n.objects,n.bbox=i,n.arcs=n.arcs.map(function(e,t){return o.set(e,t),a.slice(e[0],e[1]+1)}),delete n.coordinates,a=null;var l={GeometryCollection:function(e){e.geometries.forEach(s)},LineString:function(e){e.arcs=c(e.arcs)},MultiLineString:function(e){e.arcs=e.arcs.map(c)},Polygon:function(e){e.arcs=e.arcs.map(c)},MultiPolygon:function(e){e.arcs=e.arcs.map(u)}};function c(e){var t=[];do{var i=o.get(e);t.push(e[0]<e[1]?i:~i)}while(e=e.next);return t}function u(e){return e.map(c)}for(var d in e)s(e[d]);return r&&(n.transform=r,n.arcs=function(e){for(var t=-1,i=e.length;++t<i;){for(var r,n,a=e[t],o=0,s=1,l=a.length,c=a[0],u=c[0],d=c[1];++o<l;)r=(c=a[o])[0],n=c[1],r===u&&n===d||(a[s++]=[r-u,n-d],u=r,d=n);1===s&&(a[s++]=[0,0]),a.length=s}return e}(n.arcs)),n},e.filter=function(e,t){var i,r=e.objects,n={};function a(e){var t,i;switch(e.type){case"Polygon":t=(i=o(e.arcs))?{type:"Polygon",arcs:i}:{type:null};break;case"MultiPolygon":t=(i=e.arcs.map(o).filter(b)).length?{type:"MultiPolygon",arcs:i}:{type:null};break;case"GeometryCollection":t=(i=e.geometries.map(a).filter(D)).length?{type:"GeometryCollection",geometries:i}:{type:null};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}function o(e){return e.length&&function(e){return t(e,!1)}(e[0])?[e[0]].concat(e.slice(1).filter(s)):null}function s(e){return t(e,!0)}for(i in null==t&&(t=T),r)n[i]=a(r[i]);return function(e){var t,i,r=e.objects,n={},a=e.arcs,o=a.length,s=-1,l=new Array(o),c=0,u=-1;function d(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(d);break;case"LineString":p(e.arcs);break;case"MultiLineString":case"Polygon":e.arcs.forEach(p);break;case"MultiPolygon":e.arcs.forEach(m)}}function h(e){e<0&&(e=~e),l[e]||(l[e]=1,++c)}function p(e){e.forEach(h)}function m(e){e.forEach(p)}function f(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(f)};break;case"LineString":t={type:"LineString",arcs:_(e.arcs)};break;case"MultiLineString":t={type:"MultiLineString",arcs:e.arcs.map(_)};break;case"Polygon":t={type:"Polygon",arcs:e.arcs.map(_)};break;case"MultiPolygon":t={type:"MultiPolygon",arcs:e.arcs.map(y)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}function g(e){return e<0?~l[~e]:l[e]}function _(e){return e.map(g)}function y(e){return e.map(_)}for(i in r)d(r[i]);for(t=new Array(c);++s<o;)l[s]&&(l[s]=++u,t[u]=a[s]);for(i in r)n[i]=f(r[i]);return{type:"Topology",bbox:e.bbox,transform:e.transform,objects:n,arcs:t}}({type:"Topology",bbox:e.bbox,transform:e.transform,objects:n,arcs:e.arcs})},e.filterAttached=M,e.filterAttachedWeight=function(e,t,i){var r=M(e),n=O(e,t,i);return function(e,t){return r(e,t)||n(e,t)}},e.filterWeight=O,e.planarRingArea=R,e.planarTriangleArea=I,e.presimplify=function(e,l){var c=e.transform?h(e.transform):F,u=function(){var e={},o=[],s=0;function r(e,t){for(;0<t;){var i=(t+1>>1)-1,r=o[i];if(0<=L(e,r))break;o[r._=t]=r,o[e._=t=i]=e}}function n(e,t){for(;;){var i=t+1<<1,r=i-1,n=t,a=o[n];if(r<s&&L(o[r],a)<0&&(a=o[n=r]),i<s&&L(o[i],a)<0&&(a=o[n=i]),n===t)break;o[a._=t]=a,o[e._=t=n]=e}}return e.push=function(e){return r(o[e._=s]=e,s++),s},e.pop=function(){if(!(s<=0)){var e,t=o[0];return 0<--s&&(e=o[s],n(o[e._=0]=e,0)),t}},e.remove=function(e){var t,i=e._;if(o[i]===e)return i!==--s&&(L(t=o[s],e)<0?r:n)(o[t._=i]=t,i),i},e}();null==l&&(l=I);var t=e.arcs.map(function(e){var t,i,r,n=[],a=0;for(i=1,r=(e=e.map(c)).length-1;i<r;++i)(t=[e[i-1],e[i],e[i+1]])[1][2]=l(t),n.push(t),u.push(t);for(e[0][2]=e[r][2]=1/0,i=0,r=n.length;i<r;++i)(t=n[i]).previous=n[i-1],t.next=n[i+1];for(;t=u.pop();){var o=t.previous,s=t.next;t[1][2]<a?t[1][2]=a:a=t[1][2],o&&(o.next=s,o[2]=t[2],d(o)),s&&(s.previous=o,s[0]=t[0],d(s))}return e});function d(e){u.remove(e),e[1][2]=l(e),u.push(e)}return{type:"Topology",bbox:e.bbox,objects:e.objects,arcs:t}},e.quantile=function(e,t){var i=[];return e.arcs.forEach(function(e){e.forEach(function(e){isFinite(e[2])&&i.push(e[2])})}),i.length&&function(e,t){if(!(i=e.length))return;if((t=+t)<=0||i<2)return e[0];if(1<=t)return e[i-1];var i,r=(i-1)*t,n=Math.floor(r),a=e[n],o=e[n+1];return a+(o-a)*(r-n)}(i.sort(N),t)},e.simplify=function(e,o){o=null==o?Number.MIN_VALUE:+o;var t=e.arcs.map(function(e){for(var t,i=-1,r=0,n=e.length,a=new Array(n);++i<n;)(t=e[i])[2]>=o&&(a[r++]=[t[0],t[1]]);return a.length=r,a});return{type:"Topology",transform:e.transform,bbox:e.bbox,objects:e.objects,arcs:t}},e.sphericalRingArea=function(e,t){var i=W(e,!0);return t&&(i*=-1),2*(i<0?V+i:i)},e.sphericalTriangleArea=function(e){return 2*z(W(e,!1))},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?YPf(exports):YPf(XPf.topojson=XPf.topojson||{});var topojson=tmp$3.topojson;function defaultCrsFunction(e){return Cartesian3.fromDegrees(e[0],e[1],e[2])}var crsNames={"urn:ogc:def:crs:OGC:1.3:CRS84":defaultCrsFunction,"EPSG:4326":defaultCrsFunction,"urn:ogc:def:crs:EPSG::4326":defaultCrsFunction},crsLinkHrefs={},crsLinkTypes={},defaultMarkerSize=48,defaultMarkerSymbol,defaultMarkerColor=Color.ROYALBLUE,defaultStroke=Color.YELLOW,defaultStrokeWidth=2,defaultFill$1=Color.fromBytes(255,255,0,100),defaultClampToGround=!1,sizes={small:24,medium:48,large:64},simpleStyleIdentifiers=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"];function defaultDescribe(e,t){var i="";for(var r in e)if(e.hasOwnProperty(r)){if(r===t||-1!==simpleStyleIdentifiers.indexOf(r))continue;var n=e[r];defined(n)&&(i+="object"==typeof n?"<tr><th>"+r+"</th><td>"+defaultDescribe(n)+"</td></tr>":"<tr><th>"+r+"</th><td>"+n+"</td></tr>")}return 0<i.length&&(i='<table class="cesium-infoBox-defaultTable"><tbody>'+i+"</tbody></table>"),i}function createDescriptionCallback(i,r,n){var a;return function(e,t){return defined(a)||(a=i(r,n)),a}}function defaultDescribeProperty(e,t){return new CallbackProperty(createDescriptionCallback(defaultDescribe,e,t),!0)}function createObject(e,t,i){var r=e.id;if(defined(r)&&"Feature"===e.type){for(var n=2,a=r;defined(t.getById(a));)a=r+"_"+n,n++;r=a}else r=createGuid();var o=t.getOrCreateEntity(r),s=e.properties;if(defined(s)){var l,c=(o.properties=s).title;if(defined(c))o.name=c,l="title";else{var u=Number.MAX_VALUE;for(var d in s)if(s.hasOwnProperty(d)&&s[d]){var h=d.toLowerCase();if(1<u&&"title"===h){u=1,l=d;break}2<u&&"name"===h?(u=2,l=d):3<u&&/title/i.test(d)?(u=3,l=d):4<u&&/name/i.test(d)&&(u=4,l=d)}defined(l)&&(o.name=s[l])}var p=s.description;null!==p&&(o.description=defined(p)?new ConstantProperty(p):i(s,l))}return o}function coordinatesArrayToCartesianArray(e,t){for(var i=new Array(e.length),r=0;r<e.length;r++)i[r]=t(e[r]);return i}var geoJsonObjectTypes={Feature:processFeature,FeatureCollection:processFeatureCollection,GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology},geometryTypes={GeometryCollection:processGeometryCollection,LineString:processLineString,MultiLineString:processMultiLineString,MultiPoint:processMultiPoint,MultiPolygon:processMultiPolygon,Point:processPoint$1,Polygon:processPolygon$1,Topology:processTopology};function processFeature(e,t,i,r,n){if(null!==t.geometry){if(!defined(t.geometry))throw new RuntimeError("feature.geometry is required.");var a=t.geometry.type,o=geometryTypes[a];if(!defined(o))throw new RuntimeError("Unknown geometry type: "+a);o(e,t,t.geometry,r,n)}else createObject(t,e._entityCollection,n.describe)}function processFeatureCollection(e,t,i,r,n){for(var a=t.features,o=0,s=a.length;o<s;o++)processFeature(e,a[o],void 0,r,n)}function processGeometryCollection(e,t,i,r,n){for(var a=i.geometries,o=0,s=a.length;o<s;o++){var l=a[o],c=l.type,u=geometryTypes[c];if(!defined(u))throw new RuntimeError("Unknown geometry type: "+c);u(e,t,l,r,n)}}function createPoint$1(e,t,i,r,n){var a,o=n.markerSymbol,s=n.markerColor,l=n.markerSize,c=t.properties;if(defined(c)){var u=c["marker-color"];defined(u)&&(s=Color.fromCssColorString(u)),l=defaultValue(sizes[c["marker-size"]],l);var d=c["marker-symbol"];defined(d)&&(o=d)}a=defined(o)?1===o.length?e._pinBuilder.fromText(o.toUpperCase(),s,l):e._pinBuilder.fromMakiIconId(o,s,l):e._pinBuilder.fromColor(s,l);var h=new BillboardGraphics;h.verticalOrigin=new ConstantProperty(VerticalOrigin$1.BOTTOM),2===r.length&&n.clampToGround&&(h.heightReference=HeightReference$1.CLAMP_TO_GROUND);var p=createObject(t,e._entityCollection,n.describe);p.billboard=h,p.position=new ConstantPositionProperty(i(r));var m=when(a).then(function(e){h.image=new ConstantProperty(e)}).otherwise(function(){h.image=new ConstantProperty(e._pinBuilder.fromColor(s,l))});e._promises.push(m)}function processPoint$1(e,t,i,r,n){createPoint$1(e,t,r,i.coordinates,n)}function processMultiPoint(e,t,i,r,n){for(var a=i.coordinates,o=0;o<a.length;o++)createPoint$1(e,t,r,a[o],n)}function createLineString$1(e,t,i,r,n){var a=n.strokeMaterialProperty,o=n.strokeWidthProperty,s=t.properties;if(defined(s)){var l,c=s["stroke-width"];defined(c)&&(o=new ConstantProperty(c));var u=s.stroke;defined(u)&&(l=Color.fromCssColorString(u));var d=s["stroke-opacity"];defined(d)&&1!==d&&(defined(l)||(l=a.color.clone()),l.alpha=d),defined(l)&&(a=new ColorMaterialProperty(l))}var h=createObject(t,e._entityCollection,n.describe),p=new PolylineGraphics;(h.polyline=p).clampToGround=n.clampToGround,p.material=a,p.width=o,p.positions=new ConstantProperty(coordinatesArrayToCartesianArray(r,i)),p.arcType=ArcType$1.RHUMB}function processLineString(e,t,i,r,n){createLineString$1(e,t,r,i.coordinates,n)}function processMultiLineString(e,t,i,r,n){for(var a=i.coordinates,o=0;o<a.length;o++)createLineString$1(e,t,r,a[o],n)}function createPolygon$1(e,t,i,r,n){if(0!==r.length&&0!==r[0].length){var a=n.strokeMaterialProperty.color,o=n.fillMaterialProperty,s=n.strokeWidthProperty,l=t.properties;if(defined(l)){var c,u=l["stroke-width"];defined(u)&&(s=new ConstantProperty(u));var d=l.stroke;defined(d)&&(c=Color.fromCssColorString(d));var h,p=l["stroke-opacity"];defined(p)&&1!==p&&(defined(c)||(c=n.strokeMaterialProperty.color.clone()),c.alpha=p),defined(c)&&(a=new ConstantProperty(c));var m=l.fill;defined(m)&&((h=Color.fromCssColorString(m)).alpha=o.color.alpha),defined(p=l["fill-opacity"])&&p!==o.color.alpha&&(defined(h)||(h=o.color.clone()),h.alpha=p),defined(h)&&(o=new ColorMaterialProperty(h))}var f=new PolygonGraphics;f.outline=new ConstantProperty(!0),f.outlineColor=a,f.outlineWidth=s,f.material=o,f.arcType=ArcType$1.RHUMB;for(var g=[],_=1,y=r.length;_<y;_++)g.push(new PolygonHierarchy(coordinatesArrayToCartesianArray(r[_],i)));var v=r[0];f.hierarchy=new ConstantProperty(new PolygonHierarchy(coordinatesArrayToCartesianArray(v,i),g)),2<v[0].length?f.perPositionHeight=new ConstantProperty(!0):n.clampToGround||(f.height=0),createObject(t,e._entityCollection,n.describe).polygon=f}}function processPolygon$1(e,t,i,r,n){createPolygon$1(e,t,r,i.coordinates,n)}function processMultiPolygon(e,t,i,r,n){for(var a=i.coordinates,o=0;o<a.length;o++)createPolygon$1(e,t,r,a[o],n)}function processTopology(e,t,i,r,n){for(var a in i.objects)if(i.objects.hasOwnProperty(a)){var o=topojson.feature(i,i.objects[a]);(0,geoJsonObjectTypes[o.type])(e,o,o,r,n)}}function GeoJsonDataSource(e){this._name=e,this._changed=new Event,this._error=new Event,this._isLoading=!1,this._loading=new Event,this._entityCollection=new EntityCollection(this),this._promises=[],this._pinBuilder=new PinBuilder,this._entityCluster=new EntityCluster,this._credit=void 0,this._resourceCredits=[]}function load$1(t,i,r,e){var n;defined(e)&&(n=getFilenameFromUri(e)),defined(n)&&t._name!==n&&(t._name=n,t._changed.raiseEvent(t));var a=geoJsonObjectTypes[i.type];if(!defined(a))throw new RuntimeError("Unsupported GeoJSON object type: "+i.type);var o=i.crs,s=null!==o?defaultCrsFunction:null;if(defined(o)){if(!defined(o.properties))throw new RuntimeError("crs.properties is undefined.");var l=o.properties;if("name"===o.type){if(!defined(s=crsNames[l.name]))throw new RuntimeError("Unknown crs name: "+l.name)}else if("link"===o.type){var c=crsLinkHrefs[l.href];if(defined(c)||(c=crsLinkTypes[l.type]),!defined(c))throw new RuntimeError("Unable to resolve crs link: "+JSON.stringify(l));s=c(l)}else{if("EPSG"!==o.type)throw new RuntimeError("Unknown crs type: "+o.type);if(!defined(s=crsNames["EPSG:"+l.code]))throw new RuntimeError("Unknown crs EPSG code: "+l.code)}}return when(s,function(e){return t._entityCollection.removeAll(),null!==e&&a(t,i,i,e,r),when.all(t._promises,function(){return t._promises.length=0,DataSource.setLoading(t,!1),t})})}function KmlCamera(e,t){this.position=e,this.headingPitchRoll=t}GeoJsonDataSource.load=function(e,t){return(new GeoJsonDataSource).load(e,t)},defineProperties$1(GeoJsonDataSource,{markerSize:{get:function(){return defaultMarkerSize},set:function(e){defaultMarkerSize=e}},markerSymbol:{get:function(){return defaultMarkerSymbol},set:function(e){defaultMarkerSymbol=e}},markerColor:{get:function(){return defaultMarkerColor},set:function(e){defaultMarkerColor=e}},stroke:{get:function(){return defaultStroke},set:function(e){defaultStroke=e}},strokeWidth:{get:function(){return defaultStrokeWidth},set:function(e){defaultStrokeWidth=e}},fill:{get:function(){return defaultFill$1},set:function(e){defaultFill$1=e}},clampToGround:{get:function(){return defaultClampToGround},set:function(e){defaultClampToGround=e}},crsNames:{get:function(){return crsNames}},crsLinkHrefs:{get:function(){return crsLinkHrefs}},crsLinkTypes:{get:function(){return crsLinkTypes}}}),defineProperties$1(GeoJsonDataSource.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{value:void 0,writable:!1},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},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){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),GeoJsonDataSource.prototype.load=function(e,t){DataSource.setLoading(this,!0);var i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).credit;"string"==typeof i&&(i=new Credit(i)),this._credit=i;var r=e,n=t.sourceUri;if("string"==typeof e||e instanceof Resource){r=(e=Resource.createIfNeeded(e)).fetchJson(),n=defaultValue(n,e.getUrlComponent());var a=this._resourceCredits,o=e.credits;if(defined(o))for(var s=o.length,l=0;l<s;l++)a.push(o[l])}t={describe:defaultValue(t.describe,defaultDescribeProperty),markerSize:defaultValue(t.markerSize,defaultMarkerSize),markerSymbol:defaultValue(t.markerSymbol,defaultMarkerSymbol),markerColor:defaultValue(t.markerColor,defaultMarkerColor),strokeWidthProperty:new ConstantProperty(defaultValue(t.strokeWidth,defaultStrokeWidth)),strokeMaterialProperty:new ColorMaterialProperty(defaultValue(t.stroke,defaultStroke)),fillMaterialProperty:new ColorMaterialProperty(defaultValue(t.fill,defaultFill$1)),clampToGround:defaultValue(t.clampToGround,defaultClampToGround)};var c=this;return when(r,function(e){return load$1(c,e,t,n)}).otherwise(function(e){return DataSource.setLoading(c,!1),c._error.raiseEvent(c,e),console.log(e),when.reject(e)})};var tmp$4={};tmp$4.Autolinker=function(){function t(e,t){for(var i in t){if(t.hasOwnProperty(i)&&e[i]===undefined){e[i]=t[i]}}return e}function r(e,t,i){var r;if(e.length>t){if(i==null){i="&hellip;";r=3}else{r=i.length}e=e.substring(0,t-r)+i}return e}function s(e,t){if(Array.prototype.indexOf){return e.indexOf(t)}else{for(var i=0,r=e.length;i<r;i++){if(e[i]===t)return i}return-1}}function i(e,t){for(var i=e.length-1;i>=0;i--){if(t(e[i])===true){e.splice(i,1)}}}function l(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");var i=[],r=0,n;while(n=t.exec(e)){i.push(e.substring(r,n.index));i.push(n[0]);r=n.index+n[0].length}i.push(e.substring(r));return i}function z(e){throw new Error("Unhandled case for value: '"+e+"'")}var n=function(){function e(e){if(e===void 0){e={}}this.tagName="";this.attrs={};this.innerHTML="";this.whitespaceRegex=/\s+/;this.tagName=e.tagName||"";this.attrs=e.attrs||{};this.innerHTML=e.innerHtml||e.innerHTML||""}e.prototype.setTagName=function(e){this.tagName=e;return this};e.prototype.getTagName=function(){return this.tagName||""};e.prototype.setAttr=function(e,t){var i=this.getAttrs();i[e]=t;return this};e.prototype.getAttr=function(e){return this.getAttrs()[e]};e.prototype.setAttrs=function(e){Object.assign(this.getAttrs(),e);return this};e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})};e.prototype.setClass=function(e){return this.setAttr("class",e)};e.prototype.addClass=function(e){var t=this.getClass(),i=this.whitespaceRegex,r=!t?[]:t.split(i),n=e.split(i),a;while(a=n.shift()){if(s(r,a)===-1){r.push(a)}}this.getAttrs()["class"]=r.join(" ");return this};e.prototype.removeClass=function(e){var t=this.getClass(),i=this.whitespaceRegex,r=!t?[]:t.split(i),n=e.split(i),a;while(r.length&&(a=n.shift())){var o=s(r,a);if(o!==-1){r.splice(o,1)}}this.getAttrs()["class"]=r.join(" ");return this};e.prototype.getClass=function(){return this.getAttrs()["class"]||""};e.prototype.hasClass=function(e){return(" "+this.getClass()+" ").indexOf(" "+e+" ")!==-1};e.prototype.setInnerHTML=function(e){this.innerHTML=e;return this};e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)};e.prototype.getInnerHTML=function(){return this.innerHTML||""};e.prototype.getInnerHtml=function(){return this.getInnerHTML()};e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();t=t?" "+t:"";return["<",e,t,">",this.getInnerHtml(),"</",e,">"].join("")};e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e){if(e.hasOwnProperty(i)){t.push(i+'="'+e[i]+'"')}}return t.join(" ")};return e}();function a(e,t,o){var i;var r;if(o==null){o="&hellip;";r=3;i=8}else{r=o.length;i=o.length}var n=function(e){var t={};var i=e;var r=i.match(/^([a-z]+):\/\//i);if(r){t.scheme=r[1];i=i.substr(r[0].length)}r=i.match(/^(.*?)(?=(\?|#|\/|$))/i);if(r){t.host=r[1];i=i.substr(r[0].length)}r=i.match(/^\/(.*?)(?=(\?|#|$))/i);if(r){t.path=r[1];i=i.substr(r[0].length)}r=i.match(/^\?(.*?)(?=(#|$))/i);if(r){t.query=r[1];i=i.substr(r[0].length)}r=i.match(/^#(.*?)$/i);if(r){t.fragment=r[1]}return t};var a=function(e){var t="";if(e.scheme&&e.host){t+=e.scheme+"://"}if(e.host){t+=e.host}if(e.path){t+="/"+e.path}if(e.query){t+="?"+e.query}if(e.fragment){t+="#"+e.fragment}return t};var s=function(e,t){var i=t/2,r=Math.ceil(i),n=-1*Math.floor(i),a="";if(n<0){a=e.substr(n)}return e.substr(0,r)+o+a};if(e.length<=t){return e}var l=t-r;var c=n(e);if(c.query){var u=c.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);if(u){c.query=c.query.substr(0,u[1].length);e=a(c)}}if(e.length<=t){return e}if(c.host){c.host=c.host.replace(/^www\./,"");e=a(c)}if(e.length<=t){return e}var d="";if(c.host){d+=c.host}if(d.length>=l){if(c.host.length==t){return(c.host.substr(0,t-r)+o).substr(0,l+i)}return s(d,l).substr(0,l+i)}var h="";if(c.path){h+="/"+c.path}if(c.query){h+="?"+c.query}if(h){if((d+h).length>=l){if((d+h).length==t){return(d+h).substr(0,t)}var p=l-d.length;return(d+s(h,p)).substr(0,l+i)}else{d+=h}}if(c.fragment){var m="#"+c.fragment;if((d+m).length>=l){if((d+m).length==t){return(d+m).substr(0,t)}var f=l-d.length;return(d+s(m,f)).substr(0,l+i)}else{d+=m}}if(c.scheme&&c.host){var g=c.scheme+"://";if((d+g).length<l){return(g+d).substr(0,t)}}if(d.length<=t){return d}var _="";if(l>0){_=d.substr(-1*Math.floor(l/2))}return(d.substr(0,Math.ceil(l/2))+o+_).substr(0,l+i)}function o(e,t,i){if(e.length<=t){return e}var r;var n;if(i==null){i="&hellip;";r=8;n=3}else{r=i.length;n=i.length}var a=t-n;var o="";if(a>0){o=e.substr(-1*Math.floor(a/2))}return(e.substr(0,Math.ceil(a/2))+i+o).substr(0,a+r)}function c(e,t,i){return r(e,t,i)}var u=function(){function e(e){if(e===void 0){e={}}this.newWindow=false;this.truncate={};this.className="";this.newWindow=e.newWindow||false;this.truncate=e.truncate||{};this.className=e.className||""}e.prototype.build=function(e){return new n({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})};e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()};var i=this.createCssClass(e);if(i){t["class"]=i}if(this.newWindow){t["target"]="_blank";t["rel"]="noopener noreferrer"}if(this.truncate){if(this.truncate.length&&this.truncate.length<e.getAnchorText().length){t["title"]=e.getAnchorHref()}}return t};e.prototype.createCssClass=function(e){var t=this.className;if(!t){return""}else{var i=[t],r=e.getCssClassSuffixes();for(var n=0,a=r.length;n<a;n++){i.push(t+"-"+r[n])}return i.join(" ")}};e.prototype.processAnchorText=function(e){e=this.doTruncate(e);return e};e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var i=t.length,r=t.location;if(r==="smart"){return a(e,i)}else if(r==="middle"){return o(e,i)}else{return c(e,i)}};return e}(),e=function(){function e(e){this.__jsduckDummyDocProp=null;this.matchedText="";this.offset=0;this.tagBuilder=e.tagBuilder;this.matchedText=e.matchedText;this.offset=e.offset}e.prototype.getMatchedText=function(){return this.matchedText};e.prototype.setOffset=function(e){this.offset=e};e.prototype.getOffset=function(){return this.offset};e.prototype.getCssClassSuffixes=function(){return[this.getType()]};e.prototype.buildTag=function(){return this.tagBuilder.build(this)};return e}(),d=function(e,t){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)if(t.hasOwnProperty(i))e[i]=t[i]};return d(e,t)};function h(e,t){d(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var U=function(){U=Object.assign||function e(t){for(var i,r=1,n=arguments.length;r<n;r++){i=arguments[r];for(var a in i)if(Object.prototype.hasOwnProperty.call(i,a))t[a]=i[a]}return t};return U.apply(this,arguments)},T=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.email="";t.email=e.email;return t}e.prototype.getType=function(){return"email"};e.prototype.getEmail=function(){return this.email};e.prototype.getAnchorHref=function(){return"mailto:"+this.email};e.prototype.getAnchorText=function(){return this.email};return e}(e),p=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.serviceName="";t.hashtag="";t.serviceName=e.serviceName;t.hashtag=e.hashtag;return t}e.prototype.getType=function(){return"hashtag"};e.prototype.getServiceName=function(){return this.serviceName};e.prototype.getHashtag=function(){return this.hashtag};e.prototype.getAnchorHref=function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}};e.prototype.getAnchorText=function(){return"#"+this.hashtag};return e}(e),m=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.serviceName="twitter";t.mention="";t.mention=e.mention;t.serviceName=e.serviceName;return t}e.prototype.getType=function(){return"mention"};e.prototype.getMention=function(){return this.mention};e.prototype.getServiceName=function(){return this.serviceName};e.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}};e.prototype.getAnchorText=function(){return"@"+this.mention};e.prototype.getCssClassSuffixes=function(){var e=i.prototype.getCssClassSuffixes.call(this),t=this.getServiceName();if(t){e.push(t)}return e};return e}(e),f=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.number="";t.plusSign=false;t.number=e.number;t.plusSign=e.plusSign;return t}e.prototype.getType=function(){return"phone"};e.prototype.getPhoneNumber=function(){return this.number};e.prototype.getNumber=function(){return this.getPhoneNumber()};e.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number};e.prototype.getAnchorText=function(){return this.matchedText};return e}(e),S=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.url="";t.urlMatchType="scheme";t.protocolUrlMatch=false;t.protocolRelativeMatch=false;t.stripPrefix={scheme:true,www:true};t.stripTrailingSlash=true;t.decodePercentEncoding=true;t.schemePrefixRegex=/^(https?:\/\/)?/i;t.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i;t.protocolRelativeRegex=/^\/\//;t.protocolPrepended=false;t.urlMatchType=e.urlMatchType;t.url=e.url;t.protocolUrlMatch=e.protocolUrlMatch;t.protocolRelativeMatch=e.protocolRelativeMatch;t.stripPrefix=e.stripPrefix;t.stripTrailingSlash=e.stripTrailingSlash;t.decodePercentEncoding=e.decodePercentEncoding;return t}e.prototype.getType=function(){return"url"};e.prototype.getUrlMatchType=function(){return this.urlMatchType};e.prototype.getUrl=function(){var e=this.url;if(!this.protocolRelativeMatch&&!this.protocolUrlMatch&&!this.protocolPrepended){e=this.url="http://"+e;this.protocolPrepended=true}return e};e.prototype.getAnchorHref=function(){var e=this.getUrl();return e.replace(/&amp;/g,"&")};e.prototype.getAnchorText=function(){var e=this.getMatchedText();if(this.protocolRelativeMatch){e=this.stripProtocolRelativePrefix(e)}if(this.stripPrefix.scheme){e=this.stripSchemePrefix(e)}if(this.stripPrefix.www){e=this.stripWwwPrefix(e)}if(this.stripTrailingSlash){e=this.removeTrailingSlash(e)}if(this.decodePercentEncoding){e=this.removePercentEncoding(e)}return e};e.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")};e.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")};e.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")};e.prototype.removeTrailingSlash=function(e){if(e.charAt(e.length-1)==="/"){e=e.slice(0,-1)}return e};e.prototype.removePercentEncoding=function(e){var t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch(e){return t}};return e}(e),g=function(){function e(e){this.__jsduckDummyDocProp=null;this.tagBuilder=e.tagBuilder}return e}(),G=/[A-Za-z]/,H=/[0-9]/,W=/\s/,q=/['"]/,j=/[\x00-\x1F\x7F]/,_=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,y,v,C=_+/\u00a9\u00ae\u2000-\u3300\ud83c\ud000-\udfff\ud83d\ud000-\udfff\ud83e\ud000-\udfff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,x=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,b=C+x,E=C+x,P="(?:["+x+"]{1,3}\\.){3}["+x+"]{1,3}",A="["+E+"](?:["+E+"\\-]{0,61}["+E+"])?",w=function(e){return"(?=("+A+"))\\"+e},D=function(e){return"(?:"+w(e)+"(?:\\."+w(e+1)+"){0,126}|"+P+")"},M=new RegExp("["+E+"]"),I=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,R=function(t){h(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.localPartCharRegex=new RegExp("["+E+"!#$%&'*+/=?^_`{|}~-]");e.strictTldRegex=new RegExp("^"+I.source+"$");return e}e.prototype.parseMatches=function(r){var n=this.tagBuilder,i=this.localPartCharRegex,a=this.strictTldRegex,o=[],e=r.length,t=new O;var s={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"};var l=0,c=0,u=t;while(l<e){var d=r.charAt(l);switch(c){case 0:h(d);break;case 1:p(r.charAt(l-1),d);break;case 2:m(d);break;case 3:f(d);break;case 4:g(d);break;case 5:_(d);break;case 6:y(d);break;case 7:v(d);break;default:z(c)}l++}x();return o;function h(e){if(e==="m"){C(1)}else if(i.test(e)){C()}}function p(e,t){if(e===":"){if(i.test(t)){c=2;u=new O(U({},u,{hasMailtoPrefix:true}))}else{S()}}else if(s[e]===t);else if(i.test(t)){c=2}else if(t==="."){c=3}else if(t==="@"){c=4}else{S()}}function m(e){if(e==="."){c=3}else if(e==="@"){c=4}else if(i.test(e));else{S()}}function f(e){if(e==="."){S()}else if(e==="@"){S()}else if(i.test(e)){c=2}else{S()}}function g(e){if(M.test(e)){c=5}else{S()}}function _(e){if(e==="."){c=7}else if(e==="-"){c=6}else if(M.test(e));else{x()}}function y(e){if(e==="-"||e==="."){x()}else if(M.test(e)){c=5}else{x()}}function v(e){if(e==="."||e==="-"){x()}else if(M.test(e)){c=5;u=new O(U({},u,{hasDomainDot:true}))}else{x()}}function C(e){if(e===void 0){e=2}c=e;u=new O({idx:l})}function S(){c=0;u=t}function x(){if(u.hasDomainDot){var e=r.slice(u.idx,l);if(/[-.]$/.test(e)){e=e.slice(0,-1)}var t=u.hasMailtoPrefix?e.slice("mailto:".length):e;if(i(t)){o.push(new T({tagBuilder:n,matchedText:e,offset:u.idx,email:t}))}}S();function i(e){var t=e.split(".").pop()||"";var i=t.toLowerCase();var r=a.test(i);return r}}};return e}(g),O=function(){function e(e){if(e===void 0){e={}}this.idx=e.idx!==undefined?e.idx:-1;this.hasMailtoPrefix=!!e.hasMailtoPrefix;this.hasDomainDot=!!e.hasDomainDot}return e}(),L=function(){function e(){}e.isValid=function(e,t){if(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e)){return false}return true};e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);var i=e.match(t);return i!==null};e.containsMultipleDots=function(e){var t=e;if(this.hasFullProtocolRegex.test(e)){t=e.split("://")[1]}return t.split("/")[0].indexOf("..")>-1};e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),i=t&&t[0].toLowerCase();return i!=="javascript:"&&i!=="vbscript:"};e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!!e&&(!t||!this.hasFullProtocolRegex.test(t))&&e.indexOf(".")===-1};e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){if(e&&t){return!this.hasWordCharAfterProtocolRegex.test(e)}else{return false}};e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//;e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/;e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+_+"]");e.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/;return e}(),F=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.stripPrefix={scheme:true,www:true};t.stripTrailingSlash=true;t.decodePercentEncoding=true;t.matcherRegex=function(){var e=/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/,t=/(?:www\.)/,i=new RegExp("[/?#](?:["+E+"\\-+&@#/%=~_()|'$*\\[\\]?!:,.;✓]*["+E+"\\-+&@#/%=~_()|'$*\\[\\]✓])?");return new RegExp(["(?:","(",e.source,D(2),")","|","(","(//)?",t.source,D(6),")","|","(","(//)?",D(10)+"\\.",I.source,"(?![-"+b+"])",")",")","(?::[0-9]+)?","(?:"+i.source+")?"].join(""),"gi")}();t.wordCharRegExp=new RegExp("["+E+"]");t.stripPrefix=e.stripPrefix;t.stripTrailingSlash=e.stripTrailingSlash;t.decodePercentEncoding=e.decodePercentEncoding;return t}e.prototype.parseMatches=function(p){var e=this.matcherRegex,m=this.stripPrefix,f=this.stripTrailingSlash,g=this.decodePercentEncoding,_=this.tagBuilder,y=[],v;var t=function(){var e=v[0],t=v[1],i=v[4],r=v[5],n=v[9],a=v.index,o=r||n,s=p.charAt(a-1);if(!L.isValid(e,t)){return"continue"}if(a>0&&s==="@"){return"continue"}if(a>0&&o&&C.wordCharRegExp.test(s)){return"continue"}if(/\?$/.test(e)){e=e.substr(0,e.length-1)}if(C.matchHasUnbalancedClosingParen(e)){e=e.substr(0,e.length-1)}else{var l=C.matchHasInvalidCharAfterTld(e,t);if(l>-1){e=e.substr(0,l)}}var c=["http://","https://"].find(function(e){return!!t&&t.indexOf(e)!==-1});if(c){var u=e.indexOf(c);e=e.substr(u);t=t.substr(u);a=a+u}var d=t?"scheme":i?"www":"tld",h=!!t;y.push(new S({tagBuilder:_,matchedText:e,offset:a,urlMatchType:d,url:e,protocolUrlMatch:h,protocolRelativeMatch:!!o,stripPrefix:m,stripTrailingSlash:f,decodePercentEncoding:g}))};var C=this;while((v=e.exec(p))!==null){t()}return y};e.prototype.matchHasUnbalancedClosingParen=function(e){var t=e.charAt(e.length-1);var i;if(t===")"){i="("}else if(t==="]"){i="["}else{return false}var r=0;for(var n=0,a=e.length-1;n<a;n++){var o=e.charAt(n);if(o===i){r++}else if(o===t){r=Math.max(r-1,0)}}if(r===0){return true}return false};e.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e){return-1}var i=0;if(t){i=e.indexOf(":");e=e.slice(i)}var r=new RegExp("^((.?//)?[-."+E+"]*[-"+E+"]\\.[-"+E+"]+)");var n=r.exec(e);if(n===null){return-1}i+=n[1].length;e=e.slice(n[1].length);if(/^[^-.A-Za-z0-9:\/?#]/.test(e)){return i}return-1};return e}(g),N=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.serviceName="twitter";t.matcherRegex=new RegExp("#[_"+E+"]{1,139}(?![_"+E+"])","g");t.nonWordCharRegex=new RegExp("[^"+E+"]");t.serviceName=e.serviceName;return t}e.prototype.parseMatches=function(e){var t=this.matcherRegex,i=this.nonWordCharRegex,r=this.serviceName,n=this.tagBuilder,a=[],o;while((o=t.exec(e))!==null){var s=o.index,l=e.charAt(s-1);if(s===0||i.test(l)){var c=o[0],u=o[0].slice(1);a.push(new p({tagBuilder:n,matchedText:c,offset:s,serviceName:r,hashtag:u}))}}return a};return e}(g),B=function(t){h(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.matcherRegex=/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/g;return e}e.prototype.parseMatches=function(e){var t=this.matcherRegex,i=this.tagBuilder,r=[],n;while((n=t.exec(e))!==null){var a=n[0],o=a.replace(/[^0-9,;#]/g,""),s=!!(n[1]||n[2]),l=n.index==0?"":e.substr(n.index-1,1),c=e.substr(n.index+a.length,1),u=!l.match(/\d/)&&!c.match(/\d/);if(this.testMatch(n[3])&&this.testMatch(a)&&u){r.push(new f({tagBuilder:i,matchedText:a,offset:n.index,number:o,plusSign:s}))}}return r};e.prototype.testMatch=function(e){return/\D/.test(e)};return e}(g),V=function(i){h(e,i);function e(e){var t=i.call(this,e)||this;t.serviceName="twitter";t.matcherRegexes={twitter:new RegExp("@[_"+E+"]{1,50}(?![_"+E+"])","g"),instagram:new RegExp("@[_."+E+"]{1,30}(?![_"+E+"])","g"),soundcloud:new RegExp("@[-_."+E+"]{1,50}(?![-_"+E+"])","g")};t.nonWordCharRegex=new RegExp("[^"+E+"]");t.serviceName=e.serviceName;return t}e.prototype.parseMatches=function(e){var t=this.serviceName,i=this.matcherRegexes[this.serviceName],r=this.nonWordCharRegex,n=this.tagBuilder,a=[],o;if(!i){return a}while((o=i.exec(e))!==null){var s=o.index,l=e.charAt(s-1);if(s===0||r.test(l)){var c=o[0].replace(/\.+$/g,""),u=c.slice(1);a.push(new m({tagBuilder:n,matchedText:c,offset:s,serviceName:t,mention:u}))}}return a};return e}(g);function k(t,e){var i=e.onOpenTag,r=e.onCloseTag,n=e.onText,a=e.onComment,o=e.onDoctype;var s=new Y;var l=0,c=t.length,u=0,d=0,h=s;while(l<c){var p=t.charAt(l);switch(u){case 0:m(p);break;case 1:f(p);break;case 2:_(p);break;case 3:g(p);break;case 4:y(p);break;case 5:v(p);break;case 6:C(p);break;case 7:S(p);break;case 8:x(p);break;case 9:T(p);break;case 10:b(p);break;case 11:E(p);break;case 12:P(p);break;case 13:A();break;case 14:w(p);break;case 15:D(p);break;case 16:M(p);break;case 17:I(p);break;case 18:R(p);break;case 19:O(p);break;case 20:L(p);break;default:z(u)}l++}if(d<l){V()}function m(e){if(e==="<"){N()}}function f(e){if(e==="!"){u=13}else if(e==="/"){u=2;h=new Y(U({},h,{isClosing:true}))}else if(e==="<"){N()}else if(G.test(e)){u=3;h=new Y(U({},h,{isOpening:true}))}else{u=0;h=s}}function g(e){if(W.test(e)){h=new Y(U({},h,{name:k()}));u=4}else if(e==="<"){N()}else if(e==="/"){h=new Y(U({},h,{name:k()}));u=12}else if(e===">"){h=new Y(U({},h,{name:k()}));B()}else if(!G.test(e)&&!H.test(e)&&e!==":"){F()}}function _(e){if(e===">"){F()}else if(G.test(e)){u=3}else{F()}}function y(e){if(W.test(e));else if(e==="/"){u=12}else if(e===">"){B()}else if(e==="<"){N()}else if(e==="="||q.test(e)||j.test(e)){F()}else{u=5}}function v(e){if(W.test(e)){u=6}else if(e==="/"){u=12}else if(e==="="){u=7}else if(e===">"){B()}else if(e==="<"){N()}else if(q.test(e)){F()}}function C(e){if(W.test(e));else if(e==="/"){u=12}else if(e==="="){u=7}else if(e===">"){B()}else if(e==="<"){N()}else if(q.test(e)){F()}else{u=5}}function S(e){if(W.test(e));else if(e==='"'){u=8}else if(e==="'"){u=9}else if(/[>=`]/.test(e)){F()}else if(e==="<"){N()}else{u=10}}function x(e){if(e==='"'){u=11}}function T(e){if(e==="'"){u=11}}function b(e){if(W.test(e)){u=4}else if(e===">"){B()}else if(e==="<"){N()}}function E(e){if(W.test(e)){u=4}else if(e==="/"){u=12}else if(e===">"){B()}else if(e==="<"){N()}else{u=4;$()}}function P(e){if(e===">"){h=new Y(U({},h,{isClosing:true}));B()}else{u=4}}function A(e){if(t.substr(l,2)==="--"){l+=2;h=new Y(U({},h,{type:"comment"}));u=14}else if(t.substr(l,7).toUpperCase()==="DOCTYPE"){l+=7;h=new Y(U({},h,{type:"doctype"}));u=20}else{F()}}function w(e){if(e==="-"){u=15}else if(e===">"){F()}else{u=16}}function D(e){if(e==="-"){u=18}else if(e===">"){F()}else{u=16}}function M(e){if(e==="-"){u=17}}function I(e){if(e==="-"){u=18}else{u=16}}function R(e){if(e===">"){B()}else if(e==="!"){u=19}else if(e==="-");else{u=16}}function O(e){if(e==="-"){u=17}else if(e===">"){B()}else{u=16}}function L(e){if(e===">"){B()}else if(e==="<"){N()}}function F(){u=0;h=s}function N(){u=1;h=new Y({idx:l})}function B(){var e=t.slice(d,h.idx);if(e){n(e,d)}if(h.type==="comment"){a(h.idx)}else if(h.type==="doctype"){o(h.idx)}else{if(h.isOpening){i(h.name,h.idx)}if(h.isClosing){r(h.name,h.idx)}}F();d=l+1}function V(){var e=t.slice(d,l);n(e,d);d=l+1}function k(){var e=h.idx+(h.isClosing?2:1);return t.slice(e,l).toLowerCase()}function $(){l--}}var Y=function(){function e(e){if(e===void 0){e={}}this.idx=e.idx!==undefined?e.idx:-1;this.type=e.type||"tag";this.name=e.name||"";this.isOpening=!!e.isOpening;this.isClosing=!!e.isClosing}return e}(),$;return function(){function r(e){if(e===void 0){e={}}this.version=r.version;this.urls={};this.email=true;this.phone=true;this.hashtag=false;this.mention=false;this.newWindow=true;this.stripPrefix={scheme:true,www:true};this.stripTrailingSlash=true;this.decodePercentEncoding=true;this.truncate={length:0,location:"end"};this.className="";this.replaceFn=null;this.context=undefined;this.matchers=null;this.tagBuilder=null;this.urls=this.normalizeUrlsCfg(e.urls);this.email=typeof e.email==="boolean"?e.email:this.email;this.phone=typeof e.phone==="boolean"?e.phone:this.phone;this.hashtag=e.hashtag||this.hashtag;this.mention=e.mention||this.mention;this.newWindow=typeof e.newWindow==="boolean"?e.newWindow:this.newWindow;this.stripPrefix=this.normalizeStripPrefixCfg(e.stripPrefix);this.stripTrailingSlash=typeof e.stripTrailingSlash==="boolean"?e.stripTrailingSlash:this.stripTrailingSlash;this.decodePercentEncoding=typeof e.decodePercentEncoding==="boolean"?e.decodePercentEncoding:this.decodePercentEncoding;var t=this.mention;if(t!==false&&t!=="twitter"&&t!=="instagram"&&t!=="soundcloud"){throw new Error("invalid `mention` cfg - see docs")}var i=this.hashtag;if(i!==false&&i!=="twitter"&&i!=="facebook"&&i!=="instagram"){throw new Error("invalid `hashtag` cfg - see docs")}this.truncate=this.normalizeTruncateCfg(e.truncate);this.className=e.className||this.className;this.replaceFn=e.replaceFn||this.replaceFn;this.context=e.context||this}r.link=function(e,t){var i=new r(t);return i.link(e)};r.parse=function(e,t){var i=new r(t);return i.parse(e)};r.prototype.normalizeUrlsCfg=function(e){if(e==null)e=true;if(typeof e==="boolean"){return{schemeMatches:e,wwwMatches:e,tldMatches:e}}else{return{schemeMatches:typeof e.schemeMatches==="boolean"?e.schemeMatches:true,wwwMatches:typeof e.wwwMatches==="boolean"?e.wwwMatches:true,tldMatches:typeof e.tldMatches==="boolean"?e.tldMatches:true}}};r.prototype.normalizeStripPrefixCfg=function(e){if(e==null)e=true;if(typeof e==="boolean"){return{scheme:e,www:e}}else{return{scheme:typeof e.scheme==="boolean"?e.scheme:true,www:typeof e.www==="boolean"?e.www:true}}};r.prototype.normalizeTruncateCfg=function(e){if(typeof e==="number"){return{length:e,location:"end"}}else{return t(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})}};r.prototype.parse=function(e){var a=this;var t=["a","style","script"],o=0,s=[];k(e,{onOpenTag:function(e){if(t.indexOf(e)>=0){o++}},onText:function(e,t){if(o===0){var i=/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi;var r=l(e,i);var n=t;r.forEach(function(e,t){if(t%2===0){var i=a.parseText(e,n);s.push.apply(s,i)}n+=e.length})}},onCloseTag:function(e){if(t.indexOf(e)>=0){o=Math.max(o-1,0)}},onComment:function(e){},onDoctype:function(e){}});s=this.compactMatches(s);s=this.removeUnwantedMatches(s);return s};r.prototype.compactMatches=function(e){e.sort(function(e,t){return e.getOffset()-t.getOffset()});for(var t=0;t<e.length-1;t++){var i=e[t],r=i.getOffset(),n=i.getMatchedText().length,a=r+n;if(t+1<e.length){if(e[t+1].getOffset()===r){var o=e[t+1].getMatchedText().length>n?t:t+1;e.splice(o,1);continue}if(e[t+1].getOffset()<a){e.splice(t+1,1)}}}return e};r.prototype.removeUnwantedMatches=function(e){if(!this.hashtag)i(e,function(e){return e.getType()==="hashtag"});if(!this.email)i(e,function(e){return e.getType()==="email"});if(!this.phone)i(e,function(e){return e.getType()==="phone"});if(!this.mention)i(e,function(e){return e.getType()==="mention"});if(!this.urls.schemeMatches){i(e,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="scheme"})}if(!this.urls.wwwMatches){i(e,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="www"})}if(!this.urls.tldMatches){i(e,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="tld"})}return e};r.prototype.parseText=function(e,t){if(t===void 0){t=0}t=t||0;var i=this.getMatchers(),r=[];for(var n=0,a=i.length;n<a;n++){var o=i[n].parseMatches(e);for(var s=0,l=o.length;s<l;s++){o[s].setOffset(t+o[s].getOffset())}r.push.apply(r,o)}return r};r.prototype.link=function(e){if(!e){return""}var t=this.parse(e),i=[],r=0;for(var n=0,a=t.length;n<a;n++){var o=t[n];i.push(e.substring(r,o.getOffset()));i.push(this.createMatchReturnVal(o));r=o.getOffset()+o.getMatchedText().length}i.push(e.substring(r));return i.join("")};r.prototype.createMatchReturnVal=function(e){var t;if(this.replaceFn){t=this.replaceFn.call(this.context,e)}if(typeof t==="string"){return t}else if(t===false){return e.getMatchedText()}else if(t instanceof n){return t.toAnchorString()}else{var i=e.buildTag();return i.toAnchorString()}};r.prototype.getMatchers=function(){if(!this.matchers){var e=this.getTagBuilder();var t=[new N({tagBuilder:e,serviceName:this.hashtag}),new R({tagBuilder:e}),new B({tagBuilder:e}),new V({tagBuilder:e,serviceName:this.mention}),new F({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t}else{return this.matchers}};r.prototype.getTagBuilder=function(){var e=this.tagBuilder;if(!e){e=this.tagBuilder=new u({newWindow:this.newWindow,truncate:this.truncate,className:this.className})}return e};r.version="3.11.0";r.AnchorTagBuilder=u;r.HtmlTag=n;r.matcher={Email:R,Hashtag:N,Matcher:g,Mention:V,Phone:B,Url:F};r.match={Email:T,Hashtag:p,Match:e,Mention:m,Phone:f,Url:S};return r}()}();var Autolinker=tmp$4.Autolinker;function KmlLookAt(e,t){this.position=e,this.headingPitchRange=t}function KmlTour(e,t){this.id=t,this.name=e,this.playlistIndex=0,this.playlist=[],this.tourStart=new Event,this.tourEnd=new Event,this.entryStart=new Event,this.entryEnd=new Event,this._activeEntries=[]}function cancelAllEntries(e){for(var t=e.pop();void 0!==t;t=e.pop())t.stop()}function playEntry(e,t,i){var r=this.playlist[this.playlistIndex];if(r){var n=playNext.bind(this,e,t,i);if(this._activeEntries.push(r),this.entryStart.raiseEvent(r),r.blocking)r.play(n,e.scene.camera,t);else{var a=this;r.play(function(){a.entryEnd.raiseEvent(r);var e=a._activeEntries.indexOf(r);0<=e&&a._activeEntries.splice(e,1)}),n(e,t,i)}}else defined(i)&&i(!1)}function playNext(e,t,i,r){var n=this.playlist[this.playlistIndex];if(this.entryEnd.raiseEvent(n,r),r)i(r);else{var a=this._activeEntries.indexOf(n);0<=a&&this._activeEntries.splice(a,1),this.playlistIndex++,playEntry.call(this,e,t,i)}}function KmlTourFlyTo(e,t,i){this.type="KmlTourFlyTo",this.blocking=!0,this.activeCamera=null,this.activeCallback=null,this.duration=e,this.view=i,this.flyToMode=t}function KmlTourWait(e){this.type="KmlTourWait",this.blocking=!0,this.duration=e,this.timeout=null}KmlTour.prototype.addPlaylistEntry=function(e){this.playlist.push(e)},KmlTour.prototype.play=function(e,t){this.tourStart.raiseEvent();var i=this;playEntry.call(this,e,t,function(e){i.playlistIndex=0,e||cancelAllEntries(i._activeEntries),i.tourEnd.raiseEvent(e)})},KmlTour.prototype.stop=function(){cancelAllEntries(this._activeEntries)},KmlTourFlyTo.prototype.play=function(t,e,i){if(this.activeCamera=e,defined(t)&&null!==t){var r=this;this.activeCallback=function(e){delete r.activeCallback,delete r.activeCamera,t(!defined(e)&&e)}}var n=this.getCameraOptions(i);if(this.view.headingPitchRoll)e.flyTo(n);else if(this.view.headingPitchRange){var a=new BoundingSphere(this.view.position);e.flyToBoundingSphere(a,n)}},KmlTourFlyTo.prototype.stop=function(){defined(this.activeCamera)&&this.activeCamera.cancelFlight(),defined(this.activeCallback)&&this.activeCallback(!0)},KmlTourFlyTo.prototype.getCameraOptions=function(e){var t={duration:this.duration};return defined(this.activeCallback)&&(t.complete=this.activeCallback),"smooth"===this.flyToMode&&(t.easingFunction=EasingFunction$1.LINEAR_NONE),this.view.headingPitchRoll?(t.destination=this.view.position,t.orientation=this.view.headingPitchRoll):this.view.headingPitchRange&&(t.offset=this.view.headingPitchRange),defined(e)&&(t=combine(t,e)),t},KmlTourWait.prototype.play=function(e){var t=this;this.activeCallback=e,this.timeout=setTimeout(function(){delete t.activeCallback,e(!1)},1e3*this.duration)},KmlTourWait.prototype.stop=function(){clearTimeout(this.timeout),defined(this.activeCallback)&&this.activeCallback(!0)};var MimeTypes={avi:"video/x-msvideo",bmp:"image/bmp",bz2:"application/x-bzip2",chm:"application/vnd.ms-htmlhelp",css:"text/css",csv:"text/csv",doc:"application/msword",dvi:"application/x-dvi",eps:"application/postscript",flv:"video/x-flv",gif:"image/gif",gz:"application/x-gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jnlp:"application/x-java-jnlp-file",jpeg:"image/jpeg",jpg:"image/jpeg",m3u:"audio/x-mpegurl",m4v:"video/mp4",mathml:"application/mathml+xml",mid:"audio/midi",midi:"audio/midi",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",mp4v:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",ogg:"application/ogg",pdf:"application/pdf",png:"image/png",pps:"application/vnd.ms-powerpoint",ppt:"application/vnd.ms-powerpoint",ps:"application/postscript",qt:"video/quicktime",rdf:"application/rdf+xml",rss:"application/rss+xml",rtf:"application/rtf",svg:"image/svg+xml",swf:"application/x-shockwave-flash",text:"text/plain",tif:"image/tiff",tiff:"image/tiff",txt:"text/plain",wav:"audio/x-wav",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",xml:"application/xml",zip:"application/zip",detectFromFilename:function(e){var t=e.toLowerCase();return t=getExtensionFromUri(t),MimeTypes[t]}},parser;"undefined"!=typeof DOMParser&&(parser=new DOMParser);var autolinker=new Autolinker({stripPrefix:!1,email:!1,replaceFn:function(e){if(!e.protocolUrlMatch)return!1}}),BILLBOARD_SIZE$1=32,BILLBOARD_NEAR_DISTANCE=2414016,BILLBOARD_NEAR_RATIO=1,BILLBOARD_FAR_DISTANCE=16093e3,BILLBOARD_FAR_RATIO=.1,kmlNamespaces=[null,void 0,"http://www.opengis.net/kml/2.2","http://earth.google.com/kml/2.2","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.0"],gxNamespaces=["http://www.google.com/kml/ext/2.2"],atomNamespaces=["http://www.w3.org/2005/Atom"],namespaces={kml:kmlNamespaces,gx:gxNamespaces,atom:atomNamespaces,kmlgx:kmlNamespaces.concat(gxNamespaces)},featureTypes={Document:processDocument$1,Folder:processFolder,Placemark:processPlacemark,NetworkLink:processNetworkLink,GroundOverlay:processGroundOverlay,PhotoOverlay:processUnsupportedFeature,ScreenOverlay:processUnsupportedFeature,Tour:processTour};function DeferredLoading(e){this._dataSource=e,this._deferred=when.defer(),this._stack=[],this._promises=[],this._timeoutSet=!1,this._used=!1,this._started=0,this._timeThreshold=1e3}function isZipFile(e){var t=e.slice(0,Math.min(4,e.size)),i=when.defer(),r=new FileReader;return r.addEventListener("load",function(){i.resolve(1347093252===new DataView(r.result).getUint32(0,!1))}),r.addEventListener("error",function(){i.reject(r.error)}),r.readAsArrayBuffer(t),i.promise}function readBlobAsText(e){var t=when.defer(),i=new FileReader;return i.addEventListener("load",function(){t.resolve(i.result)}),i.addEventListener("error",function(){t.reject(i.error)}),i.readAsText(e),t.promise}function insertNamespaces(e){var t,i,r,n={xsi:"http://www.w3.org/2001/XMLSchema-instance"};for(var a in n)n.hasOwnProperty(a)&&(r="xmlns:"+a+"=",RegExp("[< ]"+a+":").test(e)&&-1===e.indexOf(r)&&(defined(t)||(t=e.substr(0,e.indexOf("<kml")+4),i=e.substr(t.length)),t+=" "+r+'"'+n[a]+'"'));return defined(t)&&(e=t+i),e}function removeDuplicateNamespaces(e){for(var t,i,r,n=e.indexOf("xmlns:"),a=e.indexOf(">",n);-1!==n&&n<a;)t=e.slice(n,e.indexOf('"',n)),i=n,n=-1!==(n=e.indexOf(t,n+1))?(r=e.indexOf('"',e.indexOf('"',n)+1),(e=e.slice(0,n-1)+e.slice(r+1,e.length)).indexOf("xmlns:",i-1)):e.indexOf("xmlns:",i+1);return e}function loadXmlFromZip(e,t,i){e.getData(new zip.TextWriter,function(e){e=removeDuplicateNamespaces(e=insertNamespaces(e)),t.kml=parser.parseFromString(e,"application/xml"),i.resolve()})}function loadDataUriFromZip(t,i,r){var e=defaultValue(MimeTypes.detectFromFilename(t.filename),"application/octet-stream");t.getData(new zip.Data64URIWriter(e),function(e){i[t.filename]=e,r.resolve()})}function embedDataUris(e,t,i,r){for(var n=r.keys,a=new URI("."),o=e.querySelectorAll(t),s=0;s<o.length;s++){var l=o[s],c=new URI(l.getAttribute(i)).resolve(a).toString(),u=n.indexOf(c);if(-1!==u){var d=n[u];l.setAttribute(i,r[d]),"a"===t&&null===l.getAttribute("download")&&l.setAttribute("download",d)}}}function applyBasePath(e,t,i,r){for(var n=e.querySelectorAll(t),a=0;a<n.length;a++){var o=n[a],s=resolveHref(o.getAttribute(i),r);o.setAttribute(i,s.url)}}function createEntity(e,t,i){var r=queryStringAttribute(e,"id");r=defined(r)&&0!==r.length?r:createGuid(),defined(i)&&(r=i+r);var n=t.getById(r);return defined(n)&&(r=createGuid(),defined(i)&&(r=i+r)),defined((n=t.add(new Entity({id:r}))).kml)||(n.addProperty("kml"),n.kml=new KmlFeatureData),n}function isExtrudable(e,t){return"absolute"===e||"relativeToGround"===e||"relativeToSeaFloor"===t}function readCoordinate(e,t){if(!defined(e))return Cartesian3.fromDegrees(0,0,0,t);var i=e.match(/[^\s,\n]+/g);if(!defined(i))return Cartesian3.fromDegrees(0,0,0,t);var r=parseFloat(i[0]),n=parseFloat(i[1]),a=parseFloat(i[2]);return r=isNaN(r)?0:r,n=isNaN(n)?0:n,a=isNaN(a)?0:a,Cartesian3.fromDegrees(r,n,a,t)}function readCoordinates(e,t){if(defined(e)){var i=e.textContent.match(/[^\s\n]+/g);if(defined(i)){for(var r=i.length,n=new Array(r),a=0,o=0;o<r;o++)n[a++]=readCoordinate(i[o],t);return n}}}function queryNumericAttribute(e,t){if(defined(e)){var i=e.getAttribute(t);if(null!==i){var r=parseFloat(i);return isNaN(r)?void 0:r}}}function queryStringAttribute(e,t){if(defined(e)){var i=e.getAttribute(t);return null!==i?i:void 0}}function queryFirstNode(e,t,i){if(defined(e))for(var r=e.childNodes,n=r.length,a=0;a<n;a++){var o=r[a];if(o.localName===t&&-1!==i.indexOf(o.namespaceURI))return o}}function queryNodes(e,t,i){if(defined(e)){for(var r=[],n=e.getElementsByTagNameNS("*",t),a=n.length,o=0;o<a;o++){var s=n[o];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}}function queryChildNodes(e,t,i){if(!defined(e))return[];for(var r=[],n=e.childNodes,a=n.length,o=0;o<a;o++){var s=n[o];s.localName===t&&-1!==i.indexOf(s.namespaceURI)&&r.push(s)}return r}function queryNumericValue(e,t,i){var r=queryFirstNode(e,t,i);if(defined(r)){var n=parseFloat(r.textContent);return isNaN(n)?void 0:n}}function queryStringValue(e,t,i){var r=queryFirstNode(e,t,i);if(defined(r))return r.textContent.trim()}function queryBooleanValue(e,t,i){var r=queryFirstNode(e,t,i);if(defined(r)){var n=r.textContent.trim();return"1"===n||/^true$/i.test(n)}}function resolveHref(e,t,i){if(defined(e)){var r;if(defined(i)){var n=i[e];if(defined(n))r=new Resource({url:n});else{var a=new URI(t.getUrlComponent());defined(n=i[new URI(e).resolve(a)])&&(r=new Resource({url:n}))}}return defined(r)||(r=t.getDerivedResource({url:e})),r}}defineProperties$1(DeferredLoading.prototype,{dataSource:{get:function(){return this._dataSource}}}),DeferredLoading.prototype.addNodes=function(e,t){this._stack.push({nodes:e,index:0,processingData:t}),this._used=!0},DeferredLoading.prototype.addPromise=function(e){this._promises.push(e)},DeferredLoading.prototype.wait=function(){var e=this._deferred;return this._used||e.resolve(),when.join(e.promise,when.all(this._promises))},DeferredLoading.prototype.process=function(){var e=1===this._stack.length;return e&&(this._started=KmlDataSource._getTimestamp()),this._process(e)},DeferredLoading.prototype._giveUpTime=function(){if(!this._timeoutSet){this._timeoutSet=!0,this._timeThreshold=50;var e=this;setTimeout(function(){e._timeoutSet=!1,e._started=KmlDataSource._getTimestamp(),e._process(!0)},0)}},DeferredLoading.prototype._nextNode=function(){var e=this._stack,t=e[e.length-1],i=t.index,r=t.nodes;if(i!==r.length)return++t.index,r[i]},DeferredLoading.prototype._pop=function(){var e=this._stack;return e.pop(),0!==e.length||(this._deferred.resolve(),!1)},DeferredLoading.prototype._process=function(e){for(var t=this.dataSource,i=this._stack[this._stack.length-1].processingData,r=this._nextNode();defined(r);){var n=featureTypes[r.localName];if(defined(n)&&(-1!==namespaces.kml.indexOf(r.namespaceURI)||-1!==namespaces.gx.indexOf(r.namespaceURI))&&(n(t,r,i,this),this._timeoutSet||KmlDataSource._getTimestamp()>this._started+this._timeThreshold))return void this._giveUpTime();r=this._nextNode()}this._pop()&&e&&this._process(!0)};var colorOptions={maximumRed:void 0,red:void 0,maximumGreen:void 0,green:void 0,maximumBlue:void 0,blue:void 0};function parseColorString(e,t){if(defined(e)&&!/^\s*$/gm.test(e)){"#"===e[0]&&(e=e.substring(1));var i=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255,a=parseInt(e.substring(6,8),16)/255;return t?(0<a?(colorOptions.maximumRed=a,colorOptions.red=void 0):(colorOptions.maximumRed=void 0,colorOptions.red=0),0<n?(colorOptions.maximumGreen=n,colorOptions.green=void 0):(colorOptions.maximumGreen=void 0,colorOptions.green=0),0<r?(colorOptions.maximumBlue=r,colorOptions.blue=void 0):(colorOptions.maximumBlue=void 0,colorOptions.blue=0),colorOptions.alpha=i,Color.fromRandom(colorOptions)):new Color(a,n,r,i)}}function queryColorValue(e,t,i){var r=queryStringValue(e,t,i);if(defined(r))return parseColorString(r,"random"===queryStringValue(e,"colorMode",i))}function processTimeStamp(e){var t=queryFirstNode(e,"TimeStamp",namespaces.kmlgx),i=queryStringValue(t,"when",namespaces.kmlgx);if(defined(t)&&defined(i)&&0!==i.length){var r=JulianDate.fromIso8601(i),n=new TimeIntervalCollection;return n.addInterval(new TimeInterval({start:r,stop:Iso8601.MAXIMUM_VALUE})),n}}function processTimeSpan(e){var t=queryFirstNode(e,"TimeSpan",namespaces.kmlgx);if(defined(t)){var i,r=queryFirstNode(t,"begin",namespaces.kmlgx),n=defined(r)?JulianDate.fromIso8601(r.textContent):void 0,a=queryFirstNode(t,"end",namespaces.kmlgx),o=defined(a)?JulianDate.fromIso8601(a.textContent):void 0;if(defined(n)&&defined(o)){if(JulianDate.lessThan(o,n)){var s=n;n=o,o=s}(i=new TimeIntervalCollection).addInterval(new TimeInterval({start:n,stop:o}))}else defined(n)?(i=new TimeIntervalCollection).addInterval(new TimeInterval({start:n,stop:Iso8601.MAXIMUM_VALUE})):defined(o)&&(i=new TimeIntervalCollection).addInterval(new TimeInterval({start:Iso8601.MINIMUM_VALUE,stop:o}));return i}}function createDefaultBillboard(){var e=new BillboardGraphics;return e.width=BILLBOARD_SIZE$1,e.height=BILLBOARD_SIZE$1,e.scaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e.pixelOffsetScaleByDistance=new NearFarScalar(BILLBOARD_NEAR_DISTANCE,BILLBOARD_NEAR_RATIO,BILLBOARD_FAR_DISTANCE,BILLBOARD_FAR_RATIO),e}function createDefaultPolygon(){var e=new PolygonGraphics;return e.outline=!0,e.outlineColor=Color.WHITE,e}function createDefaultLabel(){var e=new LabelGraphics;return e.translucencyByDistance=new NearFarScalar(3e6,1,5e6,0),e.pixelOffset=new Cartesian2(17,0),e.horizontalOrigin=HorizontalOrigin$1.LEFT,e.font="16px sans-serif",e.style=LabelStyle$1.FILL_AND_OUTLINE,e}function getIconHref(e,t,i,r,n){var a=queryStringValue(e,"href",namespaces.kml);if(defined(a)&&0!==a.length){if(0===a.indexOf("root://icons/palette-")){var o=a.charAt(21),s=defaultValue(queryNumericValue(e,"x",namespaces.gx),0),l=defaultValue(queryNumericValue(e,"y",namespaces.gx),0);s=Math.min(s/32,7),a="https://maps.google.com/mapfiles/kml/pal"+o+"/icon"+(8*(l=7-Math.min(l/32,7))+s)+".png"}var c=resolveHref(a,i,r);if(n){var u=queryStringValue(e,"refreshMode",namespaces.kml),d=queryStringValue(e,"viewRefreshMode",namespaces.kml);"onInterval"===u||"onExpire"===u?oneTimeWarning("kml-refreshMode-"+u,"KML - Unsupported Icon refreshMode: "+u):"onStop"!==d&&"onRegion"!==d||oneTimeWarning("kml-refreshMode-"+d,"KML - Unsupported Icon viewRefreshMode: "+d);var h=defaultValue(queryStringValue(e,"viewBoundScale",namespaces.kml),1),p="onStop"===d?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",m=defaultValue(queryStringValue(e,"viewFormat",namespaces.kml),p),f=queryStringValue(e,"httpQuery",namespaces.kml);defined(m)&&c.setQueryParameters(queryToObject(cleanupString(m))),defined(f)&&c.setQueryParameters(queryToObject(cleanupString(f)));var g=t._ellipsoid;return processNetworkLinkQueryString(c,t._camera,t._canvas,h,t._lastCameraView.bbox,g),c}return c}}function processBillboardIcon(e,t,i,r,n){var a=queryNumericValue(t,"scale",namespaces.kml),o=queryNumericValue(t,"heading",namespaces.kml),s=queryColorValue(t,"color",namespaces.kml),l=queryFirstNode(t,"Icon",namespaces.kml),c=getIconHref(l,e,r,n,!1);defined(l)&&!defined(c)&&(c=!1);var u,d,h=queryNumericValue(l,"x",namespaces.gx),p=queryNumericValue(l,"y",namespaces.gx),m=queryNumericValue(l,"w",namespaces.gx),f=queryNumericValue(l,"h",namespaces.gx),g=queryFirstNode(t,"hotSpot",namespaces.kml),_=queryNumericAttribute(g,"x"),y=queryNumericAttribute(g,"y"),v=queryStringAttribute(g,"xunits"),C=queryStringAttribute(g,"yunits"),S=i.billboard;defined(S)||(S=createDefaultBillboard(),i.billboard=S),S.image=c,S.scale=a,S.color=s,(defined(h)||defined(p)||defined(m)||defined(f))&&(S.imageSubRegion=new BoundingRectangle(h,p,m,f)),defined(o)&&0!==o&&(S.rotation=CesiumMath.toRadians(-o),S.alignedAxis=Cartesian3.UNIT_Z),a=defaultValue(a,1),defined(_)&&("pixels"===v?u=-_*a:"insetPixels"===v?u=(_-BILLBOARD_SIZE$1)*a:"fraction"===v&&(u=-_*BILLBOARD_SIZE$1*a),u+=.5*BILLBOARD_SIZE$1*a),defined(y)&&("pixels"===C?d=y*a:"insetPixels"===C?d=(-y+BILLBOARD_SIZE$1)*a:"fraction"===C&&(d=y*BILLBOARD_SIZE$1*a),d-=.5*BILLBOARD_SIZE$1*a),(defined(u)||defined(d))&&(S.pixelOffset=new Cartesian2(u,d))}function applyStyle(e,t,i,r,n){for(var a=0,o=t.childNodes.length;a<o;a++){var s=t.childNodes.item(a);if("IconStyle"===s.localName)processBillboardIcon(e,s,i,r,n);else if("LabelStyle"===s.localName){var l=i.label;defined(l)||(l=createDefaultLabel(),i.label=l),l.scale=defaultValue(queryNumericValue(s,"scale",namespaces.kml),l.scale),l.fillColor=defaultValue(queryColorValue(s,"color",namespaces.kml),l.fillColor),l.text=i.name}else if("LineStyle"===s.localName){var c=i.polyline;defined(c)||(c=new PolylineGraphics,i.polyline=c),c.width=queryNumericValue(s,"width",namespaces.kml),c.material=queryColorValue(s,"color",namespaces.kml),defined(queryColorValue(s,"outerColor",namespaces.gx))&&oneTimeWarning("kml-gx:outerColor","KML - gx:outerColor is not supported in a LineStyle"),defined(queryNumericValue(s,"outerWidth",namespaces.gx))&&oneTimeWarning("kml-gx:outerWidth","KML - gx:outerWidth is not supported in a LineStyle"),defined(queryNumericValue(s,"physicalWidth",namespaces.gx))&&oneTimeWarning("kml-gx:physicalWidth","KML - gx:physicalWidth is not supported in a LineStyle"),defined(queryBooleanValue(s,"labelVisibility",namespaces.gx))&&oneTimeWarning("kml-gx:labelVisibility","KML - gx:labelVisibility is not supported in a LineStyle")}else if("PolyStyle"===s.localName){var u=i.polygon;defined(u)||(u=createDefaultPolygon(),i.polygon=u),u.material=defaultValue(queryColorValue(s,"color",namespaces.kml),u.material),u.fill=defaultValue(queryBooleanValue(s,"fill",namespaces.kml),u.fill),u.outline=defaultValue(queryBooleanValue(s,"outline",namespaces.kml),u.outline)}else if("BalloonStyle"===s.localName){var d=defaultValue(parseColorString(queryStringValue(s,"bgColor",namespaces.kml)),Color.WHITE),h=defaultValue(parseColorString(queryStringValue(s,"textColor",namespaces.kml)),Color.BLACK),p=queryStringValue(s,"text",namespaces.kml);i.addProperty("balloonStyle"),i.balloonStyle={bgColor:d,textColor:h,text:p}}else if("ListStyle"===s.localName){var m=queryStringValue(s,"listItemType",namespaces.kml);"radioFolder"!==m&&"checkOffOnly"!==m||oneTimeWarning("kml-listStyle-"+m,"KML - Unsupported ListStyle with listItemType: "+m)}}}function computeFinalStyle(e,t,i,r,n){for(var a,o=new Entity,s=-1,l=t.childNodes,c=l.length,u=0;u<c;u++){var d=l[u];"Style"!==d.localName&&"StyleMap"!==d.localName||(s=u)}if(-1!==s){var h=l[s];if("Style"===h.localName)applyStyle(e,h,o,r,n);else for(var p=queryChildNodes(h,"Pair",namespaces.kml),m=0;m<p.length;m++){var f=p[m],g=queryStringValue(f,"key",namespaces.kml);if("normal"===g){var _=queryStringValue(f,"styleUrl",namespaces.kml);if(defined(_))defined(a=i.getById(_))||(a=i.getById("#"+_)),defined(a)&&o.merge(a);else applyStyle(e,queryFirstNode(f,"Style",namespaces.kml),o,r,n)}else oneTimeWarning("kml-styleMap-"+g,"KML - Unsupported StyleMap key: "+g)}}var y=queryStringValue(t,"styleUrl",namespaces.kml);if(defined(y)){var v=y;if("#"!==y[0]&&-1!==y.indexOf("#")){var C=y.split("#"),S=C[0];v=r.getDerivedResource({url:S}).getUrlComponent()+"#"+C[1]}defined(a=i.getById(v))||(a=i.getById("#"+v)),defined(a)&&o.merge(a)}return o}function processExternalStyles(t,i,r){return i.fetchXML().then(function(e){return processStyles(t,e,r,i,!0)})}function processStyles(e,t,i,r,n,a){var o,s,l,c,u=queryNodes(t,"Style",namespaces.kml);if(defined(u)){var d=u.length;for(o=0;o<d;o++)defined(s=queryStringAttribute(c=u[o],"id"))&&(s="#"+s,n&&defined(r)&&(s=r.getUrlComponent()+s),defined(i.getById(s))||(l=new Entity({id:s}),i.add(l),applyStyle(e,c,l,r,a)))}var h=queryNodes(t,"StyleMap",namespaces.kml);if(defined(h)){var p=h.length;for(o=0;o<p;o++){var m=h[o];if(defined(s=queryStringAttribute(m,"id")))for(var f=queryChildNodes(m,"Pair",namespaces.kml),g=0;g<f.length;g++){var _=f[g],y=queryStringValue(_,"key",namespaces.kml);if("normal"===y){if(s="#"+s,n&&defined(r)&&(s=r.getUrlComponent()+s),!defined(i.getById(s))){l=i.getOrCreateEntity(s);var v=queryStringValue(_,"styleUrl",namespaces.kml);if(defined(v)){"#"!==v[0]&&(v="#"+v),n&&defined(r)&&(v=r.getUrlComponent()+v);var C=i.getById(v);defined(C)&&l.merge(C)}else applyStyle(e,c=queryFirstNode(_,"Style",namespaces.kml),l,r,a)}}else oneTimeWarning("kml-styleMap-"+y,"KML - Unsupported StyleMap key: "+y)}}}var S=[],x=t.getElementsByTagName("styleUrl"),T=x.length;for(o=0;o<T;o++){var b=x[o].textContent;if("#"!==b[0]){var E=b.split("#");if(2===E.length){var P=E[0],A=r.getDerivedResource({url:P});S.push(processExternalStyles(e,A,i))}}}return S}function createDropLine(e,t,i){var r=new ReferenceProperty(e,t.id,["position"]),n=new ScaledPositionProperty(t.position);t.polyline=defined(i.polyline)?i.polyline.clone():new PolylineGraphics,t.polyline.positions=new PositionPropertyArray([r,n])}function heightReferenceFromAltitudeMode(e,t){return!defined(e)&&!defined(t)||"clampToGround"===e?HeightReference$1.CLAMP_TO_GROUND:"relativeToGround"===e?HeightReference$1.RELATIVE_TO_GROUND:"absolute"===e?HeightReference$1.NONE:"clampToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-clampToSeaFloor","KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."),HeightReference$1.CLAMP_TO_GROUND):"relativeToSeaFloor"===t?(oneTimeWarning("kml-gx:altitudeMode-relativeToSeaFloor","KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."),HeightReference$1.RELATIVE_TO_GROUND):(defined(e)?oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown <kml:altitudeMode>:"+e+", using <kml:altitudeMode>:CLAMP_TO_GROUND."):oneTimeWarning("kml-gx:altitudeMode-unknown","KML - Unknown <gx:altitudeMode>:"+t+", using <kml:altitudeMode>:CLAMP_TO_GROUND."),HeightReference$1.CLAMP_TO_GROUND)}function createPositionPropertyFromAltitudeMode(e,t,i){return"relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t?e:((defined(t)&&"clampToGround"!==t||defined(i)&&"clampToSeaFloor"!==i)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+defaultValue(t,i)),new ScaledPositionProperty(e))}function createPositionPropertyArrayFromAltitudeMode(e,t,i,r){if(defined(e)){if("relativeToSeaFloor"===i||"absolute"===t||"relativeToGround"===t)return e;(defined(t)&&"clampToGround"!==t||defined(i)&&"clampToSeaFloor"!==i)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+defaultValue(t,i));for(var n=e.length,a=0;a<n;a++){var o=e[a];r.scaleToGeodeticSurface(o,o)}return e}}function processPositionGraphics(e,t,i,r){var n=t.label;defined(n)||(n=defined(i.label)?i.label.clone():createDefaultLabel(),t.label=n),n.text=t.name;var a=t.billboard;defined(a)||(a=defined(i.billboard)?i.billboard.clone():createDefaultBillboard(),t.billboard=a),defined(a.image)?a.image.getValue()||(a.image=void 0):a.image=e._pinBuilder.fromColor(Color.YELLOW,64);var o=1;defined(a.scale)&&(0!==(o=a.scale.getValue())?n.pixelOffset=new Cartesian2(16*o+1,0):(n.pixelOffset=void 0,n.horizontalOrigin=void 0)),defined(r)&&e._clampToGround&&(a.heightReference=r,n.heightReference=r)}function processPathGraphics(e,t){var i=e.path;defined(i)||((i=new PathGraphics).leadTime=0,e.path=i);var r=t.polyline;defined(r)&&(i.material=r.material,i.width=r.width)}function processPoint$2(e,t,i,r,n){var a=queryStringValue(i,"coordinates",namespaces.kml),o=queryStringValue(i,"altitudeMode",namespaces.kml),s=queryStringValue(i,"altitudeMode",namespaces.gx),l=queryBooleanValue(i,"extrude",namespaces.kml),c=readCoordinate(a,e._ellipsoid);return r.position=c,processPositionGraphics(e,r,n,heightReferenceFromAltitudeMode(o,s)),l&&isExtrudable(o,s)&&createDropLine(t,r,n),!0}function processLineStringOrLinearRing(e,t,i,r,n){var a=queryFirstNode(i,"coordinates",namespaces.kml),o=queryStringValue(i,"altitudeMode",namespaces.kml),s=queryStringValue(i,"altitudeMode",namespaces.gx),l=queryBooleanValue(i,"extrude",namespaces.kml),c=queryBooleanValue(i,"tessellate",namespaces.kml),u=isExtrudable(o,s),d=queryNumericValue(i,"drawOrder",namespaces.gx),h=e._ellipsoid,p=readCoordinates(a,h),m=n.polyline;if(u&&l){var f=new WallGraphics;(r.wall=f).positions=p;var g=n.polygon;defined(g)&&(f.fill=g.fill,f.material=g.material),f.outline=!0,defined(m)?(f.outlineColor=defined(m.material)?m.material.color:Color.WHITE,f.outlineWidth=m.width):defined(g)&&(f.outlineColor=defined(g.material)?g.material.color:Color.WHITE)}else if(e._clampToGround&&!u&&c){var _=new PolylineGraphics;_.clampToGround=!0,(r.polyline=_).positions=p,defined(m)?(_.material=defined(m.material)?m.material.color.getValue(Iso8601.MINIMUM_VALUE):Color.WHITE,_.width=defaultValue(m.width,1)):(_.material=Color.WHITE,_.width=1),_.zIndex=d}else defined(d)&&oneTimeWarning("kml-gx:drawOrder","KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"),m=defined(m)?m.clone():new PolylineGraphics,(r.polyline=m).positions=createPositionPropertyArrayFromAltitudeMode(p,o,s,h),c&&!u||(m.arcType=ArcType$1.NONE);return!0}function processPolygon$2(e,t,i,r,n){var a=queryFirstNode(queryFirstNode(i,"outerBoundaryIs",namespaces.kml),"LinearRing",namespaces.kml),o=queryFirstNode(a,"coordinates",namespaces.kml),s=e._ellipsoid,l=readCoordinates(o,s),c=queryBooleanValue(i,"extrude",namespaces.kml),u=isExtrudable(queryStringValue(i,"altitudeMode",namespaces.kml),queryStringValue(i,"altitudeMode",namespaces.gx)),d=defined(n.polygon)?n.polygon.clone():createDefaultPolygon(),h=n.polyline;if(defined(h)&&(d.outlineColor=defined(h.material)?h.material.color:Color.WHITE,d.outlineWidth=h.width),r.polygon=d,u?(d.perPositionHeight=!0,d.extrudedHeight=c?0:void 0):e._clampToGround||(d.height=0),defined(l)){for(var p=new PolygonHierarchy(l),m=queryChildNodes(i,"innerBoundaryIs",namespaces.kml),f=0;f<m.length;f++){a=queryChildNodes(m[f],"LinearRing",namespaces.kml);for(var g=0;g<a.length;g++)defined(l=readCoordinates(o=queryFirstNode(a[g],"coordinates",namespaces.kml),s))&&p.holes.push(new PolygonHierarchy(l))}d.hierarchy=p}return!0}function processTrack(e,t,i,r,n){var a=queryStringValue(i,"altitudeMode",namespaces.kml),o=queryStringValue(i,"altitudeMode",namespaces.gx),s=queryChildNodes(i,"coord",namespaces.gx),l=queryChildNodes(i,"angles",namespaces.gx),c=queryChildNodes(i,"when",namespaces.kml),u=queryBooleanValue(i,"extrude",namespaces.kml),d=isExtrudable(a,o),h=e._ellipsoid;0<l.length&&oneTimeWarning("kml-gx:angles","KML - gx:angles are not supported in gx:Tracks");for(var p=Math.min(s.length,c.length),m=[],f=[],g=0;g<p;g++){var _=readCoordinate(s[g].textContent,h);m.push(_),f.push(JulianDate.fromIso8601(c[g].textContent))}var y=new SampledPositionProperty;return y.addSamples(f,m),r.position=y,processPositionGraphics(e,r,n,heightReferenceFromAltitudeMode(a,o)),processPathGraphics(r,n),r.availability=new TimeIntervalCollection,0<c.length&&r.availability.addInterval(new TimeInterval({start:f[0],stop:f[f.length-1]})),d&&u&&createDropLine(t,r,n),!0}function addToMultiTrack(e,t,i,r,n,a,o,s,l){var c=e[0],u=e[e.length-1],d=new SampledPositionProperty;d.addSamples(e,t),i.intervals.addInterval(new TimeInterval({start:c,stop:u,isStartIncluded:l,isStopIncluded:l,data:createPositionPropertyFromAltitudeMode(d,o,s)})),r.addInterval(new TimeInterval({start:c,stop:u,isStartIncluded:l,isStopIncluded:l})),n.intervals.addInterval(new TimeInterval({start:c,stop:u,isStartIncluded:l,isStopIncluded:l,data:a}))}function processMultiTrack(e,t,i,r,n){for(var a,o,s,l=queryBooleanValue(i,"interpolate",namespaces.gx),c=queryChildNodes(i,"Track",namespaces.gx),u=!1,d=new TimeIntervalCollectionProperty,h=new TimeIntervalCollection,p=new CompositePositionProperty,m=e._ellipsoid,f=0,g=c.length;f<g;f++){var _=c[f],y=queryChildNodes(_,"when",namespaces.kml),v=queryChildNodes(_,"coord",namespaces.gx),C=queryStringValue(_,"altitudeMode",namespaces.kml),S=queryStringValue(_,"altitudeMode",namespaces.gx),x=isExtrudable(C,S),T=queryBooleanValue(_,"extrude",namespaces.kml),b=Math.min(v.length,y.length),E=[];a=[];for(var P=0;P<b;P++){var A=readCoordinate(v[P].textContent,m);E.push(A),a.push(JulianDate.fromIso8601(y[P].textContent))}l&&(defined(o)&&addToMultiTrack([o,a[0]],[s,E[0]],p,h,d,!1,"absolute",void 0,!1),o=a[b-1],s=E[E.length-1]),addToMultiTrack(a,E,p,h,d,x&&T,C,S,!0),u=u||x&&T}return r.availability=h,r.position=p,processPositionGraphics(e,r,n),processPathGraphics(r,n),u&&(createDropLine(t,r,n),r.polyline.show=d),!0}var geometryTypes$1={Point:processPoint$2,LineString:processLineStringOrLinearRing,LinearRing:processLineStringOrLinearRing,Polygon:processPolygon$2,Track:processTrack,MultiTrack:processMultiTrack,MultiGeometry:processMultiGeometry,Model:processUnsupportedGeometry},scratchDiv;function processMultiGeometry(e,t,i,r,n,a){for(var o=i.childNodes,s=!1,l=0,c=o.length;l<c;l++){var u=o.item(l),d=geometryTypes$1[u.localName];if(defined(d)){var h=createEntity(u,t,a);h.parent=r,h.name=r.name,h.availability=r.availability,h.description=r.description,h.kml=r.kml,d(e,t,u,h,n)&&(s=!0)}}return s}function processUnsupportedGeometry(e,t,i,r,n){return oneTimeWarning("kml-unsupportedGeometry","KML - Unsupported geometry: "+i.localName),!1}function processExtendedData(e,t){var i=queryFirstNode(e,"ExtendedData",namespaces.kml);if(defined(i)){defined(queryFirstNode(i,"SchemaData",namespaces.kml))&&oneTimeWarning("kml-schemaData","KML - SchemaData is unsupported"),defined(queryStringAttribute(i,"xmlns:prefix"))&&oneTimeWarning("kml-extendedData","KML - ExtendedData with xmlns:prefix is unsupported");var r={},n=queryChildNodes(i,"Data",namespaces.kml);if(defined(n))for(var a=n.length,o=0;o<a;o++){var s=n[o],l=queryStringAttribute(s,"name");defined(l)&&(r[l]={displayName:queryStringValue(s,"displayName",namespaces.kml),value:queryStringValue(s,"value",namespaces.kml)})}t.kml.extendedData=r}}function processDescription$1(e,t,i,r,n){var a,o,s,l,c=t.kml,u=c.extendedData,d=queryStringValue(e,"description",namespaces.kml),h=defaultValue(t.balloonStyle,i.balloonStyle),p=Color.WHITE,m=Color.BLACK,f=d;if(defined(h)&&(p=defaultValue(h.bgColor,Color.WHITE),m=defaultValue(h.textColor,Color.BLACK),f=defaultValue(h.text,d)),defined(f)){if(f=(f=(f=(f=(f=(f=f.replace("$[name]",defaultValue(t.name,""))).replace("$[description]",defaultValue(d,""))).replace("$[address]",defaultValue(c.address,""))).replace("$[Snippet]",defaultValue(c.snippet,""))).replace("$[id]",t.id)).replace("$[geDirections]",""),defined(u)){var g=f.match(/\$\[.+?\]/g);if(null!==g)for(a=0;a<g.length;a++){var _=g[a],y=_.substr(2,_.length-3),v=/\/displayName$/.test(y);defined(l=u[y=y.replace(/\/displayName$/,"")])&&(l=v?l.displayName:l.value),defined(l)&&(f=f.replace(_,defaultValue(l,"")))}}}else if(defined(u)&&0<(s=Object.keys(u)).length){for(f='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',a=0;a<s.length;a++)f+="<tr><th>"+defaultValue((l=u[o=s[a]]).displayName,o)+"</th><td>"+defaultValue(l.value,"")+"</td></tr>";f+="</tbody></table>"}if(defined(f)){f=autolinker.link(f),scratchDiv.innerHTML=f;var C=scratchDiv.querySelectorAll("a");for(a=0;a<C.length;a++)C[a].setAttribute("target","_blank");defined(r)&&1<r.keys.length&&(embedDataUris(scratchDiv,"a","href",r),embedDataUris(scratchDiv,"img","src",r)),applyBasePath(scratchDiv,"a","href",n),applyBasePath(scratchDiv,"img","src",n);var S='<div class="cesium-infoBox-description-lighter" style="';S+="overflow:auto;",S+="word-wrap:break-word;",S+="background-color:"+p.toCssColorString()+";",S+="color:"+m.toCssColorString()+";",S+='">',S+=scratchDiv.innerHTML+"</div>",scratchDiv.innerHTML="",t.description=S}}function processFeature$1(e,t,i){var r=i.entityCollection,n=i.parentEntity,a=i.sourceResource,o=i.uriResolver,s=createEntity(t,r,i.context),l=s.kml,c=computeFinalStyle(e,t,i.styleCollection,a,o),u=queryStringValue(t,"name",namespaces.kml);s.name=u,s.parent=n;var d=processTimeSpan(t);defined(d)||(d=processTimeStamp(t)),s.availability=d,mergeAvailabilityWithParent(s);var h=queryBooleanValue(t,"visibility",namespaces.kml);s.show=function e(t){return!t||t.show&&e(t.parent)}(n)&&defaultValue(h,!0);var p=queryFirstNode(t,"author",namespaces.atom),m=l.author;m.name=queryStringValue(p,"name",namespaces.atom),m.uri=queryStringValue(p,"uri",namespaces.atom),m.email=queryStringValue(p,"email",namespaces.atom);var f=queryFirstNode(t,"link",namespaces.atom),g=l.link;g.href=queryStringAttribute(f,"href"),g.hreflang=queryStringAttribute(f,"hreflang"),g.rel=queryStringAttribute(f,"rel"),g.type=queryStringAttribute(f,"type"),g.title=queryStringAttribute(f,"title"),g.length=queryStringAttribute(f,"length"),l.address=queryStringValue(t,"address",namespaces.kml),l.phoneNumber=queryStringValue(t,"phoneNumber",namespaces.kml),l.snippet=queryStringValue(t,"Snippet",namespaces.kml),processExtendedData(t,s),processDescription$1(t,s,c,o,a);var _=e._ellipsoid;return processLookAt(t,s,_),processCamera(t,s,_),defined(queryFirstNode(t,"Region",namespaces.kml))&&oneTimeWarning("kml-region","KML - Placemark Regions are unsupported"),{entity:s,styleEntity:c}}function processDocument$1(e,t,i,r){r.addNodes(t.childNodes,i),r.process()}function processFolder(e,t,i,r){var n=processFeature$1(e,t,i),a=clone(i);a.parentEntity=n.entity,processDocument$1(e,t,a,r)}function processPlacemark(e,t,i,r){for(var n=processFeature$1(e,t,i),a=n.entity,o=n.styleEntity,s=!1,l=t.childNodes,c=0,u=l.length;c<u&&!s;c++){var d=l.item(c),h=geometryTypes$1[d.localName];defined(h)&&(h(e,i.entityCollection,d,a,o,a.id),s=!0)}s||(a.merge(o),processPositionGraphics(e,a,o))}"undefined"!=typeof document&&(scratchDiv=document.createElement("div"));var playlistNodeProcessors={FlyTo:processTourFlyTo,Wait:processTourWait,SoundCue:processTourUnsupportedNode,AnimatedUpdate:processTourUnsupportedNode,TourControl:processTourUnsupportedNode};function processTour(e,t,i,r){var n=new KmlTour(queryStringValue(t,"name",namespaces.kml),queryStringAttribute(t,"id")),a=queryFirstNode(t,"Playlist",namespaces.gx);if(a)for(var o=e._ellipsoid,s=a.childNodes,l=0;l<s.length;l++){var c=s[l];if(c.localName){var u=playlistNodeProcessors[c.localName];u?u(n,c,o):console.log("Unknown KML Tour playlist entry type "+c.localName)}}defined(e.kmlTours)||(e.kmlTours=[]),e.kmlTours.push(n)}function processTourUnsupportedNode(e,t){oneTimeWarning("KML Tour unsupported node "+t.localName)}function processTourWait(e,t){var i=queryNumericValue(t,"duration",namespaces.gx);e.addPlaylistEntry(new KmlTourWait(i))}function processTourFlyTo(e,t,i){var r=queryNumericValue(t,"duration",namespaces.gx),n=queryStringValue(t,"flyToMode",namespaces.gx),a={kml:{}};processLookAt(t,a,i),processCamera(t,a,i);var o=new KmlTourFlyTo(r,n,a.kml.lookAt||a.kml.camera);e.addPlaylistEntry(o)}function processCamera(e,t,i){var r=queryFirstNode(e,"Camera",namespaces.kml);if(defined(r)){var n=defaultValue(queryNumericValue(r,"longitude",namespaces.kml),0),a=defaultValue(queryNumericValue(r,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(r,"altitude",namespaces.kml),0),s=defaultValue(queryNumericValue(r,"heading",namespaces.kml),0),l=defaultValue(queryNumericValue(r,"tilt",namespaces.kml),0),c=defaultValue(queryNumericValue(r,"roll",namespaces.kml),0),u=Cartesian3.fromDegrees(n,a,o,i),d=HeadingPitchRoll.fromDegrees(s,l-90,c);t.kml.camera=new KmlCamera(u,d)}}function processLookAt(e,t,i){var r=queryFirstNode(e,"LookAt",namespaces.kml);if(defined(r)){var n=defaultValue(queryNumericValue(r,"longitude",namespaces.kml),0),a=defaultValue(queryNumericValue(r,"latitude",namespaces.kml),0),o=defaultValue(queryNumericValue(r,"altitude",namespaces.kml),0),s=queryNumericValue(r,"heading",namespaces.kml),l=queryNumericValue(r,"tilt",namespaces.kml),c=defaultValue(queryNumericValue(r,"range",namespaces.kml),0);l=CesiumMath.toRadians(defaultValue(l,0));var u=new HeadingPitchRange(s=CesiumMath.toRadians(defaultValue(s,0)),l-CesiumMath.PI_OVER_TWO,c),d=Cartesian3.fromDegrees(n,a,o,i);t.kml.lookAt=new KmlLookAt(d,u)}}function processGroundOverlay(e,t,i,r){var n,a=processFeature$1(e,t,i).entity,o=!1,s=e._ellipsoid,l=readCoordinates(queryFirstNode(t,"LatLonQuad",namespaces.gx),s),c=queryNumericValue(t,"drawOrder",namespaces.kml);if(defined(l))(n=createDefaultPolygon()).hierarchy=new PolygonHierarchy(l),n.zIndex=c,a.polygon=n,o=!0;else{(n=new RectangleGraphics).zIndex=c,a.rectangle=n;var u=queryFirstNode(t,"LatLonBox",namespaces.kml);if(defined(u)){var d=queryNumericValue(u,"west",namespaces.kml),h=queryNumericValue(u,"south",namespaces.kml),p=queryNumericValue(u,"east",namespaces.kml),m=queryNumericValue(u,"north",namespaces.kml);defined(d)&&(d=CesiumMath.negativePiToPi(CesiumMath.toRadians(d))),defined(h)&&(h=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(h))),defined(p)&&(p=CesiumMath.negativePiToPi(CesiumMath.toRadians(p))),defined(m)&&(m=CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(m))),n.coordinates=new Rectangle(d,h,p,m);var f=queryNumericValue(u,"rotation",namespaces.kml);if(defined(f)){var g=CesiumMath.toRadians(f);n.rotation=g,n.stRotation=g}}}var _=queryFirstNode(t,"Icon",namespaces.kml),y=getIconHref(_,e,i.sourceResource,i.uriResolver,!0);if(defined(y)){o&&oneTimeWarning("kml-gx:LatLonQuad","KML - gx:LatLonQuad Icon does not support texture projection.");var v=queryNumericValue(_,"x",namespaces.gx),C=queryNumericValue(_,"y",namespaces.gx),S=queryNumericValue(_,"w",namespaces.gx),x=queryNumericValue(_,"h",namespaces.gx);(defined(v)||defined(C)||defined(S)||defined(x))&&oneTimeWarning("kml-groundOverlay-xywh","KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"),n.material=y,n.material.color=queryColorValue(t,"color",namespaces.kml),n.material.transparent=!0}else n.material=queryColorValue(t,"color",namespaces.kml);var T=queryStringValue(t,"altitudeMode",namespaces.kml);defined(T)?"absolute"===T?(n.height=queryNumericValue(t,"altitude",namespaces.kml),n.zIndex=void 0):"clampToGround"!==T&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+T):"relativeToSeaFloor"===(T=queryStringValue(t,"altitudeMode",namespaces.gx))?(oneTimeWarning("kml-altitudeMode-relativeToSeaFloor","KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),n.height=queryNumericValue(t,"altitude",namespaces.kml),n.zIndex=void 0):"clampToSeaFloor"===T?oneTimeWarning("kml-altitudeMode-clampToSeaFloor","KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):defined(T)&&oneTimeWarning("kml-altitudeMode-unknown","KML - Unknown altitudeMode: "+T)}function processUnsupportedFeature(e,t,i,r){e._unsupportedNode.raiseEvent(e,i.parentEntity,t,i.entityCollection,i.styleCollection,i.sourceResource,i.uriResolver),oneTimeWarning("kml-unsupportedFeature-"+t.nodeName,"KML - Unsupported feature: "+t.nodeName)}var RefreshMode={INTERVAL:0,EXPIRE:1,STOP:2};function cleanupString(e){if(!defined(e)||0===e.length)return"";var t=e[0];return"&"!==t&&"?"!==t||(e=e.substring(1)),e}var zeroRectangle=new Rectangle,scratchCartographic$8=new Cartographic,scratchCartesian2$9=new Cartesian2,scratchCartesian3$b=new Cartesian3;function processNetworkLinkQueryString(e,t,i,r,n,a){function o(e){return e<-CesiumMath.PI_OVER_TWO?-CesiumMath.PI_OVER_TWO:e>CesiumMath.PI_OVER_TWO?CesiumMath.PI_OVER_TWO:e}function s(e){return e>CesiumMath.PI?e-CesiumMath.TWO_PI:e<-CesiumMath.PI?e+CesiumMath.TWO_PI:e}var l=objectToQuery(e.queryParameters);if(l=l.replace(/%5B/g,"[").replace(/%5D/g,"]"),defined(t)&&t._mode!==SceneMode$1.MORPHING){var c,u;if(n=defaultValue(n,zeroRectangle),defined(i)&&(scratchCartesian2$9.x=.5*i.clientWidth,scratchCartesian2$9.y=.5*i.clientHeight,c=t.pickEllipsoid(scratchCartesian2$9,a,scratchCartesian3$b)),defined(c)?u=a.cartesianToCartographic(c,scratchCartographic$8):(u=Rectangle.center(n,scratchCartographic$8),c=a.cartographicToCartesian(u)),defined(r)&&!CesiumMath.equalsEpsilon(r,1,CesiumMath.EPSILON9)){var d=n.width*r*.5,h=n.height*r*.5;n=new Rectangle(s(u.longitude-d),o(u.latitude-h),s(u.longitude+d),o(u.latitude+h))}l=(l=(l=(l=l.replace("[bboxWest]",CesiumMath.toDegrees(n.west).toString())).replace("[bboxSouth]",CesiumMath.toDegrees(n.south).toString())).replace("[bboxEast]",CesiumMath.toDegrees(n.east).toString())).replace("[bboxNorth]",CesiumMath.toDegrees(n.north).toString());var p=CesiumMath.toDegrees(u.longitude).toString(),m=CesiumMath.toDegrees(u.latitude).toString();l=(l=(l=(l=(l=(l=(l=(l=l.replace("[lookatLon]",p)).replace("[lookatLat]",m)).replace("[lookatTilt]",CesiumMath.toDegrees(t.pitch).toString())).replace("[lookatHeading]",CesiumMath.toDegrees(t.heading).toString())).replace("[lookatRange]",Cartesian3.distance(t.positionWC,c))).replace("[lookatTerrainLon]",p)).replace("[lookatTerrainLat]",m)).replace("[lookatTerrainAlt]",u.height.toString()),a.cartesianToCartographic(t.positionWC,scratchCartographic$8),l=(l=(l=l.replace("[cameraLon]",CesiumMath.toDegrees(scratchCartographic$8.longitude).toString())).replace("[cameraLat]",CesiumMath.toDegrees(scratchCartographic$8.latitude).toString())).replace("[cameraAlt]",CesiumMath.toDegrees(scratchCartographic$8.height).toString());var f=t.frustum,g=f.aspectRatio,_="",y="";if(defined(g)){var v=CesiumMath.toDegrees(f.fov);1<g?y=(_=v)/g:_=(y=v)*g}l=(l=l.replace("[horizFov]",_.toString())).replace("[vertFov]",y.toString())}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replace("[bboxWest]","-180")).replace("[bboxSouth]","-90")).replace("[bboxEast]","180")).replace("[bboxNorth]","90")).replace("[lookatLon]","")).replace("[lookatLat]","")).replace("[lookatRange]","")).replace("[lookatTilt]","")).replace("[lookatHeading]","")).replace("[lookatTerrainLon]","")).replace("[lookatTerrainLat]","")).replace("[lookatTerrainAlt]","")).replace("[cameraLon]","")).replace("[cameraLat]","")).replace("[cameraAlt]","")).replace("[horizFov]","")).replace("[vertFov]","");l=(l=(l=(l=(l=(l=defined(i)?(l=l.replace("[horizPixels]",i.clientWidth)).replace("[vertPixels]",i.clientHeight):(l=l.replace("[horizPixels]","")).replace("[vertPixels]","")).replace("[terrainEnabled]","1")).replace("[clientVersion]","1")).replace("[kmlVersion]","2.2")).replace("[clientName]","Cesium")).replace("[language]","English"),e.setQueryParameters(queryToObject(l))}function processNetworkLink(f,e,t,i){var g=processFeature$1(f,e,t).entity,r=t.sourceResource,n=t.uriResolver,_=queryFirstNode(e,"Link",namespaces.kml);if(defined(_)||(_=queryFirstNode(e,"Url",namespaces.kml)),defined(_)){var y,v,C=queryStringValue(_,"href",namespaces.kml);if(defined(C)){var a=C;if(C=resolveHref(C,r,t.uriResolver),/^data:/.test(C.getUrlComponent()))/\.kmz/i.test(r.getUrlComponent())||(a=r.getDerivedResource({url:a}));else{a=C.clone(),y=queryStringValue(_,"viewRefreshMode",namespaces.kml),v=defaultValue(queryStringValue(_,"viewBoundScale",namespaces.kml),1);var o="onStop"===y?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",s=defaultValue(queryStringValue(_,"viewFormat",namespaces.kml),o),l=queryStringValue(_,"httpQuery",namespaces.kml);defined(s)&&C.setQueryParameters(queryToObject(cleanupString(s))),defined(l)&&C.setQueryParameters(queryToObject(cleanupString(l)));var c=f._ellipsoid;processNetworkLinkQueryString(C,f._camera,f._canvas,v,f._lastCameraView.bbox,c)}var u={sourceUri:a,uriResolver:n,context:g.id},S=new EntityCollection,d=load$2(f,S,C,u).then(function(e){var t=f._entityCollection,i=S.values;t.suspendEvents();for(var r=0;r<i.length;r++){var n=i[r];defined(n.parent)||(n.parent=g,mergeAvailabilityWithParent(n)),t.add(n)}t.resumeEvents();var a=queryStringValue(_,"refreshMode",namespaces.kml),o=defaultValue(queryNumericValue(_,"refreshInterval",namespaces.kml),0);if("onInterval"===a&&0<o||"onExpire"===a||"onStop"===y){var s=queryFirstNode(e,"NetworkLinkControl",namespaces.kml),l=defined(s),c=JulianDate.now(),u={id:createGuid(),href:C,cookie:{},lastUpdated:c,updating:!1,entity:g,viewBoundScale:v,needsUpdate:!1,cameraUpdateTime:c},d=0;if(l&&(u.cookie=queryToObject(defaultValue(queryStringValue(s,"cookie",namespaces.kml),"")),d=defaultValue(queryNumericValue(s,"minRefreshPeriod",namespaces.kml),0)),"onInterval"===a)l&&(o=Math.max(d,o)),u.refreshMode=RefreshMode.INTERVAL,u.time=o;else if("onExpire"===a){var h;if(l&&(h=queryStringValue(s,"expires",namespaces.kml)),defined(h))try{var p=JulianDate.fromIso8601(h),m=JulianDate.secondsDifference(p,c);0<m&&m<d&&JulianDate.addSeconds(c,d,p),u.refreshMode=RefreshMode.EXPIRE,u.time=p}catch(e){oneTimeWarning("kml-refreshMode-onInterval-onExpire","KML - NetworkLinkControl expires is not a valid date")}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element")}else f._camera?(u.refreshMode=RefreshMode.STOP,u.time=defaultValue(queryNumericValue(_,"viewRefreshTime",namespaces.kml),0)):oneTimeWarning("kml-refrehMode-onStop-noCamera","A NetworkLink with viewRefreshMode=onStop requires a camera be passed in when creating the KmlDataSource");defined(u.refreshMode)&&f._networkLinks.set(u.id,u)}else"onRegion"===y&&oneTimeWarning("kml-refrehMode-onRegion","KML - Unsupported viewRefreshMode: onRegion")}).otherwise(function(e){oneTimeWarning("An error occured during loading "+C.url),f._error.raiseEvent(f,e)});i.addPromise(d)}}}function processFeatureNode(e,t,i,r){var n=featureTypes[t.localName];return defined(n)?n(e,t,i,r):processUnsupportedFeature(e,t,i)}function loadKml(a,o,s,l,c,u){o.removeAll();var e=s.documentElement,t=queryStringValue("Document"===e.localName?e:queryFirstNode(e,"Document",namespaces.kml),"name",namespaces.kml);defined(t)||(t=getFilenameFromUri(l.getUrlComponent())),defined(a._name)||(a._name=t);var d=new KmlDataSource._DeferredLoading(a),h=new EntityCollection(a);return when.all(processStyles(a,s,h,l,!1,c)).then(function(){var e=s.documentElement;if("kml"===e.localName)for(var t=e.childNodes,i=0;i<t.length;i++){var r=t[i];if(defined(featureTypes[r.localName])){e=r;break}}var n={parentEntity:void 0,entityCollection:o,styleCollection:h,sourceResource:l,uriResolver:c,context:u};return o.suspendEvents(),processFeatureNode(a,e,n,d),o.resumeEvents(),d.wait().then(function(){return s.documentElement})})}function loadKmz(c,u,e,d){var h=when.defer();return zip.createReader(new zip.BlobReader(e),function(l){l.getEntries(function(e){for(var t,i,r=[],n={},a=0;a<e.length;a++){var o=e[a];if(!o.directory){var s=when.defer();r.push(s.promise),/\.kml$/i.test(o.filename)?defined(t)&&/\//i.test(o.filename)?loadDataUriFromZip(o,n,s):(defined(t)&&loadDataUriFromZip(t,n,i),t=o,i=s):loadDataUriFromZip(o,n,s)}}defined(t)&&loadXmlFromZip(t,n,i),when.all(r).then(function(){if(l.close(),defined(n.kml))return n.keys=Object.keys(n),loadKml(c,u,n.kml,d,n);h.reject(new RuntimeError("KMZ file does not contain a KML document."))}).then(h.resolve).otherwise(h.reject)})},function(e){h.reject(e)}),h.promise}function load$2(n,a,e,t){var o=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).sourceUri,s=t.uriResolver,l=t.context,i=e;if("string"==typeof e||e instanceof Resource){i=(e=Resource.createIfNeeded(e)).fetchBlob(),o=defaultValue(o,e.clone());var r=n._resourceCredits,c=e.credits;if(defined(c))for(var u=c.length,d=0;d<u;d++)r.push(c[d])}else o=defaultValue(o,Resource.DEFAULT.clone());return o=Resource.createIfNeeded(o),when(i).then(function(t){return t instanceof Blob?isZipFile(t).then(function(e){return e?loadKmz(n,a,t,o):readBlobAsText(t).then(function(e){var t,i;e=removeDuplicateNamespaces(e=insertNamespaces(e));try{t=parser.parseFromString(e,"application/xml")}catch(e){i=e.toString()}if(defined(i)||t.body||"parsererror"===t.documentElement.tagName){var r=defined(i)?i:t.documentElement.firstChild.nodeValue;throw new RuntimeError(r=r||t.body.innerText)}return loadKml(n,a,t,o,s,l)})}):loadKml(n,a,t,o,s,l)}).otherwise(function(e){return n._error.raiseEvent(n,e),console.log(e),when.reject(e)})}function KmlDataSource(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).camera,i=e.canvas;this._changed=new Event,this._error=new Event,this._loading=new Event,this._refresh=new Event,this._unsupportedNode=new Event,this._clock=void 0,this._entityCollection=new EntityCollection(this),this._name=void 0,this._isLoading=!1,this._pinBuilder=new PinBuilder,this._networkLinks=new AssociativeArray,this._entityCluster=new EntityCluster,this._canvas=i,this._camera=t,this._lastCameraView={position:defined(t)?Cartesian3.clone(t.positionWC):void 0,direction:defined(t)?Cartesian3.clone(t.directionWC):void 0,up:defined(t)?Cartesian3.clone(t.upWC):void 0,bbox:defined(t)?t.computeViewRectangle():Rectangle.clone(Rectangle.MAX_VALUE)},this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84);var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._resourceCredits=[]}function mergeAvailabilityWithParent(e){var t=e.parent;if(defined(t)){var i=t.availability;if(defined(i)){var r=e.availability;defined(r)?r.intersect(i):e.availability=i}}}function getNetworkLinkUpdateCallback(T,b,E,P,A){return function(e){if(P.contains(b.id)){var t=!1,i=queryFirstNode(e,"NetworkLinkControl",namespaces.kml),r=0;if(defined(i)){if(defined(queryFirstNode(i,"Update",namespaces.kml)))return oneTimeWarning("kml-networkLinkControl-update","KML - NetworkLinkControl updates aren't supported."),b.updating=!1,void P.remove(b.id);b.cookie=queryToObject(defaultValue(queryStringValue(i,"cookie",namespaces.kml),"")),r=defaultValue(queryNumericValue(i,"minRefreshPeriod",namespaces.kml),0)}var n=JulianDate.now(),a=b.refreshMode;if(a===RefreshMode.INTERVAL)defined(i)&&(b.time=Math.max(r,b.time));else if(a===RefreshMode.EXPIRE){var o;if(defined(i)&&(o=queryStringValue(i,"expires",namespaces.kml)),defined(o))try{var s=JulianDate.fromIso8601(o),l=JulianDate.secondsDifference(s,n);0<l&&l<r&&JulianDate.addSeconds(n,r,s),b.time=s}catch(e){oneTimeWarning("kml-networkLinkControl-expires","KML - NetworkLinkControl expires is not a valid date"),t=!0}else oneTimeWarning("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"),t=!0}var c=b.entity,u=T._entityCollection,d=E.values;u.suspendEvents();var h,p=u.values.slice();for(h=0;h<p.length;++h){var m=p[h];m.parent===c&&(m.parent=void 0,x(m))}for(u.resumeEvents(),u.suspendEvents(),h=0;h<d.length;h++){var f=d[h];defined(f.parent)||(f.parent=c,mergeAvailabilityWithParent(f)),u.add(f)}u.resumeEvents(),t?P.remove(b.id):b.lastUpdated=n;var g=u.computeAvailability(),_=g.start,y=g.stop,v=JulianDate.equals(_,Iso8601.MINIMUM_VALUE),C=JulianDate.equals(y,Iso8601.MAXIMUM_VALUE);if(!v||!C){var S=T._clock;S.startTime===_&&S.stopTime===y||(S.startTime=_,S.stopTime=y,T._changed.raiseEvent(T))}b.updating=!1,b.needsUpdate=!1,T._refresh.raiseEvent(T,A.getUrlComponent(!0))}function x(e){u.remove(e);for(var t=e._children,i=t.length,r=0;r<i;++r)x(t[r])}}}KmlDataSource.load=function(e,t){return new KmlDataSource(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).load(e,t)},defineProperties$1(KmlDataSource.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}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},refreshEvent:{get:function(){return this._refresh}},unsupportedNodeEvent:{get:function(){return this._unsupportedNode}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){this._entityCluster=e}},credit:{get:function(){return this._credit}}}),KmlDataSource.prototype.load=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT),DataSource.setLoading(this,!0);var l=this._name;this._name=void 0,this._clampToGround=defaultValue(t.clampToGround,!1);var c=this;return load$2(this,this._entityCollection,e,t).then(function(){var e,t,i=c._entityCollection.computeAvailability(),r=i.start,n=i.stop,a=JulianDate.equals(r,Iso8601.MINIMUM_VALUE),o=JulianDate.equals(n,Iso8601.MAXIMUM_VALUE);a&&o||(a&&((t=new Date).setHours(0,0,0,0),r=JulianDate.fromDate(t)),o&&((t=new Date).setHours(24,0,0,0),n=JulianDate.fromDate(t)),(e=new DataSourceClock).startTime=r,e.stopTime=n,e.currentTime=JulianDate.clone(r),e.clockRange=ClockRange$1.LOOP_STOP,e.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,e.multiplier=Math.round(Math.min(Math.max(JulianDate.secondsDifference(n,r)/60,1),31556900)));var s=!1;return e!==c._clock&&(c._clock=e,s=!0),l!==c._name&&(s=!0),s&&c._changed.raiseEvent(c),DataSource.setLoading(c,!1),c}).otherwise(function(e){return DataSource.setLoading(c,!1),c._error.raiseEvent(c,e),console.log(e),when.reject(e)})};var entitiesToIgnore=new AssociativeArray;function KmlFeatureData(){this.author={name:void 0,uri:void 0,email:void 0},this.link={href:void 0,hreflang:void 0,rel:void 0,type:void 0,title:void 0,length:void 0},this.address=void 0,this.phoneNumber=void 0,this.snippet=void 0,this.extendedData=void 0}function Visualizer(){DeveloperError.throwInstantiationError()}KmlDataSource.prototype.update=function(e){var t=this._networkLinks;if(0===t.length)return!0;var o=JulianDate.now(),s=this;entitiesToIgnore.removeAll();var l=!1,c=this._lastCameraView,i=this._camera;!defined(i)||i.positionWC.equalsEpsilon(c.position,CesiumMath.EPSILON7)&&i.directionWC.equalsEpsilon(c.direction,CesiumMath.EPSILON7)&&i.upWC.equalsEpsilon(c.up,CesiumMath.EPSILON7)||(c.position=Cartesian3.clone(i.positionWC),c.direction=Cartesian3.clone(i.directionWC),c.up=Cartesian3.clone(i.upWC),c.bbox=i.computeViewRectangle(),l=!0);var u=new AssociativeArray,d=!1;return t.values.forEach(function(i){var e=i.entity;if(!entitiesToIgnore.contains(e.id)){if(!i.updating){var t=!1;if(i.refreshMode===RefreshMode.INTERVAL?JulianDate.secondsDifference(o,i.lastUpdated)>i.time&&(t=!0):i.refreshMode===RefreshMode.EXPIRE?JulianDate.greaterThan(o,i.time)&&(t=!0):i.refreshMode===RefreshMode.STOP&&(l&&(i.needsUpdate=!0,i.cameraUpdateTime=o),i.needsUpdate&&JulianDate.secondsDifference(o,i.cameraUpdateTime)>=i.time&&(t=!0)),t){!function e(t){for(var i=t._children,r=i.length,n=0;n<r;++n){var a=i[n];entitiesToIgnore.set(a.id,a),e(a)}}(e),i.updating=!0;var r=new EntityCollection,n=i.href.clone();n.setQueryParameters(i.cookie);var a=defaultValue(s._ellipsoid,Ellipsoid.WGS84);processNetworkLinkQueryString(n,s._camera,s._canvas,i.viewBoundScale,c.bbox,a),load$2(s,r,n,{context:e.id}).then(getNetworkLinkUpdateCallback(s,i,r,u,n)).otherwise(function(e){var t="NetworkLink "+i.href+" refresh failed: "+e;console.log(t),s._error.raiseEvent(s,t)}),d=!0}}u.set(i.id,i)}}),d&&(this._networkLinks=u,this._changed.raiseEvent(this)),!0},KmlDataSource._DeferredLoading=DeferredLoading,KmlDataSource._getTimestamp=getTimestamp$1,Visualizer.prototype.update=DeveloperError.throwInstantiationError,Visualizer.prototype.getBoundingSphere=DeveloperError.throwInstantiationError,Visualizer.prototype.isDestroyed=DeveloperError.throwInstantiationError,Visualizer.prototype.destroy=DeveloperError.throwInstantiationError;var CheckFloatTexturePrecisionFS="uniform sampler2D u_floatTexture;\nvoid main()\n{\nfloat actual = texture2D(u_floatTexture, vec2(0.5, 0.5)).r;\nfloat expected = 123456.0;\ngl_FragColor = vec4(abs(actual - expected), 0.0, 0.0, 1.0);\n}\n",ViewportQuadVS="attribute vec4 position;\nattribute vec2 textureCoordinates;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_Position = position;\nv_textureCoordinates = textureCoordinates;\n}\n",renderStateScratch;function ClearCommand(e){e=defaultValue(e,defaultValue.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}function ComputeEngine(e){this._context=e}ClearCommand.ALL=freezeObject$1(new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0})),ClearCommand.prototype.execute=function(e,t){e.clear(this,t)};var drawCommandScratch=new DrawCommand({primitiveType:PrimitiveType$1.TRIANGLES}),clearCommandScratch=new ClearCommand({color:new Color(0,0,0,0)});function createFramebuffer(e,t){return new Framebuffer({context:e,colorTextures:[t],destroyAttachments:!1})}function createViewportQuadShader(e,t){return ShaderProgram.fromCache({context:e,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function createRenderState(e,t){return defined(renderStateScratch)&&renderStateScratch.viewport.width===e&&renderStateScratch.viewport.height===t||(renderStateScratch=RenderState.fromCache({viewport:new BoundingRectangle(0,0,e,t)})),renderStateScratch}function checkFloatTexturePrecision(t){if(!t.floatingPointTexture)return!1;var e=new ComputeEngine(t),i=new Texture({context:t,width:1,height:1,pixelFormat:PixelFormat$1.RGBA}),r=new Texture({context:t,width:1,height:1,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:checkFloatTexturePrecision._getFloatPixelType(),source:{width:1,height:1,arrayBufferView:checkFloatTexturePrecision._getArray([123456,0,0,0])}}),n=new Framebuffer({context:t,colorTextures:[i],destroyAttachments:!1}),a={framebuffer:n,x:0,y:0,width:1,height:1},o=!1;return new ComputeCommand({fragmentShaderSource:CheckFloatTexturePrecisionFS,outputTexture:i,uniformMap:{u_floatTexture:function(){return r}},persists:!1,postExecute:function(){var e=t.readPixels(a);o=0===e[0]}}).execute(e),e.destroy(),n.destroy(),o}function PassState(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function ShaderCache(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}function destroyShader(e,t){for(var i=t.derivedKeywords,r=i.length,n=0;n<r;++n){var a=i[n]+t.keyword;destroyShader(e,e._shaders[a])}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}function TextureCache(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}function UniformState(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new BoundingRectangle,this._viewportCartesian4=new Cartesian4,this._viewportDirty=!1,this._viewportOrthographicMatrix=Matrix4.clone(Matrix4.IDENTITY),this._viewportTransformation=Matrix4.clone(Matrix4.IDENTITY),this._model=Matrix4.clone(Matrix4.IDENTITY),this._view=Matrix4.clone(Matrix4.IDENTITY),this._inverseView=Matrix4.clone(Matrix4.IDENTITY),this._projection=Matrix4.clone(Matrix4.IDENTITY),this._infiniteProjection=Matrix4.clone(Matrix4.IDENTITY),this._entireFrustum=new Cartesian2,this._currentFrustum=new Cartesian2,this._frustumPlanes=new Cartesian4,this._log2FarDistance=void 0,this._log2FarPlusOne=void 0,this._log2NearDistance=void 0,this._frameState=void 0,this._temeToPseudoFixed=Matrix3.clone(Matrix4.IDENTITY),this._view3DDirty=!0,this._view3D=new Matrix4,this._inverseView3DDirty=!0,this._inverseView3D=new Matrix4,this._inverseModelDirty=!0,this._inverseModel=new Matrix4,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new Matrix3,this._viewRotation=new Matrix3,this._inverseViewRotation=new Matrix3,this._viewRotation3D=new Matrix3,this._inverseViewRotation3D=new Matrix3,this._inverseProjectionDirty=!0,this._inverseProjection=new Matrix4,this._modelViewDirty=!0,this._modelView=new Matrix4,this._modelView3DDirty=!0,this._modelView3D=new Matrix4,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new Matrix4,this._inverseModelViewDirty=!0,this._inverseModelView=new Matrix4,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new Matrix4,this._viewProjectionDirty=!0,this._viewProjection=new Matrix4,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new Matrix4,this._modelViewProjectionDirty=!0,this._modelViewProjection=new Matrix4,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new Matrix4,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new Matrix4,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new Matrix4,this._normalDirty=!0,this._normal=new Matrix3,this._normal3DDirty=!0,this._normal3D=new Matrix3,this._inverseNormalDirty=!0,this._inverseNormal=new Matrix3,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new Matrix3,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new EncodedCartesian3,this._cameraPosition=new Cartesian3,this._sunPositionWC=new Cartesian3,this._sunPositionColumbusView=new Cartesian3,this._sunDirectionWC=new Cartesian3,this._sunDirectionEC=new Cartesian3,this._sunColor=new Cartesian3,this._moonDirectionEC=new Cartesian3,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._cameraDirection=new Cartesian3,this._cameraRight=new Cartesian3,this._cameraUp=new Cartesian3,this._frustum2DWidth=0,this._eyeHeight2D=new Cartesian2,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new Color,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new Cartesian2,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._invertClassificationColor=void 0,this._imagerySplitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0,this._yp_black_texture=new Sampler}function setView(e,t){Matrix4.clone(t,e._view),Matrix4.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 setInverseView(e,t){Matrix4.clone(t,e._inverseView),Matrix4.getMatrix3(t,e._inverseViewRotation)}function setProjection(e,t){Matrix4.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function setInfiniteProjection(e,t){Matrix4.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function setCamera(e,t){Cartesian3.clone(t.positionWC,e._cameraPosition),Cartesian3.clone(t.directionWC,e._cameraDirection),Cartesian3.clone(t.rightWC,e._cameraRight),Cartesian3.clone(t.upWC,e._cameraUp),e._encodedCameraPositionMCDirty=!0}ComputeEngine.prototype.execute=function(e){defined(e.preExecute)&&e.preExecute(e);var t=e.outputTexture,i=t.width,r=t.height,n=this._context,a=defined(e.vertexArray)?e.vertexArray:n.getViewportQuadVertexArray(),o=defined(e.shaderProgram)?e.shaderProgram:createViewportQuadShader(n,e.fragmentShaderSource),s=createFramebuffer(n,t),l=createRenderState(i,r),c=e.uniformMap,u=clearCommandScratch;u.framebuffer=s,u.renderState=l,u.execute(n);var d=drawCommandScratch;d.vertexArray=a,d.renderState=l,d.shaderProgram=o,d.uniformMap=c,d.framebuffer=s,d.execute(n),s.destroy(),e.persists||(o.destroy(),defined(e.vertexArray)&&a.destroy()),defined(e.postExecute)&&e.postExecute(t)},ComputeEngine.prototype.isDestroyed=function(){return!1},ComputeEngine.prototype.destroy=function(){return destroyObject(this)},checkFloatTexturePrecision._getFloatPixelType=function(){return PixelDatatype$1.FLOAT},checkFloatTexturePrecision._getArray=function(e){return new Float32Array(e)},defineProperties$1(ShaderCache.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),ShaderCache.prototype.replaceShaderProgram=function(e){return defined(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)},ShaderCache.prototype.getShaderProgram=function(e){var t=e.vertexShaderSource,i=e.fragmentShaderSource,r=e.attributeLocations;"string"==typeof t&&(t=new ShaderSource({sources:[t]})),"string"==typeof i&&(i=new ShaderSource({sources:[i]}));var n,a=t.createCombinedVertexShader(this._context),o=i.createCombinedFragmentShader(this._context),s=a+o+JSON.stringify(r);if(defined(this._shaders[s]))n=this._shaders[s],delete this._shadersToRelease[s];else{var l=this._context,c=new ShaderProgram({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:t,vertexShaderText:a,fragmentShaderSource:i,fragmentShaderText:o,attributeLocations:r});n={cache:this,shaderProgram:c,keyword:s,derivedKeywords:[],count:0},c._cachedShader=n,this._shaders[s]=n,++this._numberOfShaders}return++n.count,n.shaderProgram},ShaderCache.prototype.replaceDerivedShaderProgram=function(e,t,i){var r=e._cachedShader,n=t+r.keyword,a=this._shaders[n];if(defined(a)){destroyShader(this,a);var o=r.derivedKeywords.indexOf(t);-1<o&&r.derivedKeywords.splice(o,1)}return this.createDerivedShaderProgram(e,t,i)},ShaderCache.prototype.getDerivedShaderProgram=function(e,t){var i=t+e._cachedShader.keyword,r=this._shaders[i];if(defined(r))return r.shaderProgram},ShaderCache.prototype.createDerivedShaderProgram=function(e,t,i){var r=e._cachedShader,n=t+r.keyword,a=i.vertexShaderSource,o=i.fragmentShaderSource,s=i.attributeLocations;"string"==typeof a&&(a=new ShaderSource({sources:[a]})),"string"==typeof o&&(o=new ShaderSource({sources:[o]}));var l=this._context,c=a.createCombinedVertexShader(l),u=o.createCombinedFragmentShader(l),d=new ShaderProgram({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:a,vertexShaderText:c,fragmentShaderSource:o,fragmentShaderText:u,attributeLocations:s}),h={cache:this,shaderProgram:d,keyword:n,derivedKeywords:[],count:0};return r.derivedKeywords.push(t),d._cachedShader=h,this._shaders[n]=h,d},ShaderCache.prototype.destroyReleasedShaderPrograms=function(){var e=this._shadersToRelease;for(var t in e){if(e.hasOwnProperty(t))destroyShader(this,e[t]),--this._numberOfShaders}this._shadersToRelease={}},ShaderCache.prototype.releaseShaderProgram=function(e){if(defined(e)){var t=e._cachedShader;t&&0==--t.count&&(this._shadersToRelease[t.keyword]=t)}},ShaderCache.prototype.isDestroyed=function(){return!1},ShaderCache.prototype.destroy=function(){var e=this._shaders;for(var t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return destroyObject(this)},defineProperties$1(TextureCache.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}}),TextureCache.prototype.getTexture=function(e){var t=this._textures[e];if(defined(t))return delete this._texturesToRelease[e],++t.count,t.texture},TextureCache.prototype.addTexture=function(e,t){var i={texture:t,count:1};t.finalDestroy=t.destroy;var r=this;t.destroy=function(){0==--i.count&&(r._texturesToRelease[e]=i)},this._textures[e]=i,++this._numberOfTextures},TextureCache.prototype.destroyReleasedTextures=function(){var e=this._texturesToRelease;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];delete this._textures[t],i.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}},TextureCache.prototype.isDestroyed=function(){return!1},TextureCache.prototype.destroy=function(){var e=this._textures;for(var t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return destroyObject(this)},defineProperties$1(UniformState.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!BoundingRectangle.equals(e,this._viewport)){BoundingRectangle.clone(e,this._viewport);var t=this._viewport,i=this._viewportCartesian4;i.x=t.x,i.y=t.y,i.z=t.width,i.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return cleanViewport(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return cleanViewport(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){Matrix4.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,Matrix4.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){var e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,Matrix4.getMatrix3(this.inverseModel,e),Matrix3.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return updateView3D(this),this._view3D}},viewRotation:{get:function(){return updateView3D(this),this._viewRotation}},viewRotation3D:{get:function(){return updateView3D(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return updateInverseView3D(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return updateInverseView3D(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return cleanInverseProjection(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return cleanModelView(this),this._modelView}},modelView3D:{get:function(){return cleanModelView3D(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return cleanModelViewRelativeToEye(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return cleanInverseModelView(this),this._inverseModelView}},inverseModelView3D:{get:function(){return cleanInverseModelView3D(this),this._inverseModelView3D}},viewProjection:{get:function(){return cleanViewProjection(this),this._viewProjection}},inverseViewProjection:{get:function(){return cleanInverseViewProjection(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return cleanModelViewProjection(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return cleanInverseModelViewProjection(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return cleanModelViewProjectionRelativeToEye(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return cleanModelViewInfiniteProjection(this),this._modelViewInfiniteProjection}},normal:{get:function(){return cleanNormal(this),this._normal}},normal3D:{get:function(){return cleanNormal3D(this),this._normal3D}},inverseNormal:{get:function(){return cleanInverseNormal(this),this._inverseNormal}},inverseNormal3D:{get:function(){return cleanInverseNormal3D(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},log2FarDistance:{get:function(){return this._log2FarDistance}},log2FarPlusOne:{get:function(){return this._log2FarPlusOne}},log2NearDistance:{get:function(){return this._log2NearDistance}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},sunColor:{get:function(){return this._sunColor}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},encodedCameraPositionMCHigh:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return cleanEncodedCameraPositionMC(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},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}},imagerySplitPosition:{get:function(){return this._imagerySplitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}}});var transformMatrix=new Matrix3,sunCartographicScratch=new Cartographic;function setSunAndMoonDirections(e,t){defined(Transforms.computeIcrfToFixedMatrix(t.time,transformMatrix))||(transformMatrix=Transforms.computeTemeToPseudoFixedMatrix(t.time,transformMatrix));var i=Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);Matrix3.multiplyByVector(transformMatrix,i,i),Cartesian3.normalize(i,e._sunDirectionWC),i=Matrix3.multiplyByVector(e.viewRotation3D,i,e._sunDirectionEC),Cartesian3.normalize(i,i),i=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),Matrix3.multiplyByVector(transformMatrix,i,i),Matrix3.multiplyByVector(e.viewRotation3D,i,i),Cartesian3.normalize(i,i);var r=t.mapProjection,n=r.ellipsoid.cartesianToCartographic(e._sunPositionWC,sunCartographicScratch);r.project(n,e._sunPositionColumbusView)}UniformState.prototype.updateCamera=function(e){setView(this,e.viewMatrix),setInverseView(this,e.inverseViewMatrix),setCamera(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==SceneMode$1.SCENE2D&&e.frustum instanceof OrthographicFrustum},UniformState.prototype.updateFrustum=function(e){setProjection(this,e.projectionMatrix),defined(e.infiniteProjectionMatrix)&&setInfiniteProjection(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._log2FarDistance=2/CesiumMath.log2(e.far+1),this._log2FarPlusOne=CesiumMath.log2(e.far+1),this._log2NearDistance=CesiumMath.log2(e.near),defined(e._offCenterFrustum)&&(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},UniformState.prototype.updatePass=function(e){this._pass=e};var EMPTY_ARRAY=[];function cleanViewport(e){if(e._viewportDirty){var t=e._viewport;Matrix4.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),Matrix4.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function cleanInverseProjection(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode===SceneMode$1.SCENE2D||e._mode===SceneMode$1.MORPHING||e._orthographicIn3D?Matrix4.clone(Matrix4.ZERO,e._inverseProjection):Matrix4.inverse(e._projection,e._inverseProjection))}function cleanModelView(e){e._modelViewDirty&&(e._modelViewDirty=!1,Matrix4.multiplyTransformation(e._view,e._model,e._modelView))}function cleanModelView3D(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,Matrix4.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function cleanInverseModelView(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,Matrix4.inverse(e.modelView,e._inverseModelView))}function cleanInverseModelView3D(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,Matrix4.inverse(e.modelView3D,e._inverseModelView3D))}function cleanViewProjection(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,Matrix4.multiply(e._projection,e._view,e._viewProjection))}function cleanInverseViewProjection(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,Matrix4.inverse(e.viewProjection,e._inverseViewProjection))}function cleanModelViewProjection(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,Matrix4.multiply(e._projection,e.modelView,e._modelViewProjection))}function cleanModelViewRelativeToEye(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;var t=e.modelView,i=e._modelViewRelativeToEye;i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=0,i[13]=0,i[14]=0,i[15]=t[15]}}function cleanInverseModelViewProjection(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,Matrix4.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function cleanModelViewProjectionRelativeToEye(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,Matrix4.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function cleanModelViewInfiniteProjection(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,Matrix4.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function cleanNormal(e){if(e._normalDirty){e._normalDirty=!1;var t=e._normal;Matrix4.getMatrix3(e.inverseModelView,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanNormal3D(e){if(e._normal3DDirty){e._normal3DDirty=!1;var t=e._normal3D;Matrix4.getMatrix3(e.inverseModelView3D,t),Matrix3.getRotation(t,t),Matrix3.transpose(t,t)}}function cleanInverseNormal(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,Matrix4.getMatrix3(e.inverseModelView,e._inverseNormal),Matrix3.getRotation(e._inverseNormal,e._inverseNormal))}function cleanInverseNormal3D(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,Matrix4.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),Matrix3.getRotation(e._inverseNormal3D,e._inverseNormal3D))}UniformState.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._pixelRatio=e.pixelRatio;var t=e.camera;this.updateCamera(t),e.mode===SceneMode$1.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=.5*this._frustum2DWidth,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),setSunAndMoonDirections(this,e),this._sunColor=Cartesian3.clone(e.sunColor,this._sunColor);var i=e.brdfLutGenerator,r=defined(i)?i.colorTexture:void 0;this._brdfLut=r,this._environmentMap=defaultValue(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=defaultValue(e.sphericalHarmonicCoefficients,EMPTY_ARRAY),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,defined(this._specularEnvironmentMaps)&&Cartesian2.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Transforms.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._imagerySplitPosition=e.imagerySplitPosition*e.context.drawingBufferWidth;var n,a=t.frustum.fov,o=this._viewport;n=o.height>o.width?2*Math.tan(.5*a)/o.height:2*Math.tan(.5*a)/o.width,this._geometricToleranceOverMeter=n*e.maximumScreenSpaceError,Color.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};var cameraPositionMC=new Cartesian3;function cleanEncodedCameraPositionMC(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,Matrix4.multiplyByPoint(e.inverseModel,e._cameraPosition,cameraPositionMC),EncodedCartesian3.fromCartesian(cameraPositionMC,e._encodedCameraPositionMC))}var view2Dto3DPScratch=new Cartesian3,view2Dto3DRScratch=new Cartesian3,view2Dto3DUScratch=new Cartesian3,view2Dto3DDScratch=new Cartesian3,view2Dto3DCartographicScratch=new Cartographic,view2Dto3DCartesian3Scratch=new Cartesian3,view2Dto3DMatrix4Scratch=new Matrix4;function view2Dto3D(e,t,i,r,n,a,o,s){var l=view2Dto3DPScratch;l.x=e.y,l.y=e.z,l.z=e.x;var c=view2Dto3DRScratch;c.x=i.y,c.y=i.z,c.z=i.x;var u=view2Dto3DUScratch;u.x=r.y,u.y=r.z,u.z=r.x;var d=view2Dto3DDScratch;d.x=t.y,d.y=t.z,d.z=t.x,a===SceneMode$1.SCENE2D&&(l.z=.5*n);var h=o.unproject(l,view2Dto3DCartographicScratch);h.longitude=CesiumMath.clamp(h.longitude,-Math.PI,Math.PI),h.latitude=CesiumMath.clamp(h.latitude,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO);var p=o.ellipsoid,m=p.cartographicToCartesian(h,view2Dto3DCartesian3Scratch),f=Transforms.eastNorthUpToFixedFrame(m,p,view2Dto3DMatrix4Scratch);return Matrix4.multiplyByPointAsVector(f,c,c),Matrix4.multiplyByPointAsVector(f,u,u),Matrix4.multiplyByPointAsVector(f,d,d),defined(s)||(s=new Matrix4),s[0]=c.x,s[1]=u.x,s[2]=-d.x,s[3]=0,s[4]=c.y,s[5]=u.y,s[6]=-d.y,s[7]=0,s[8]=c.z,s[9]=u.z,s[10]=-d.z,s[11]=0,s[12]=-Cartesian3.dot(c,m),s[13]=-Cartesian3.dot(u,m),s[14]=Cartesian3.dot(d,m),s[15]=1,s}function updateView3D(e){e._view3DDirty&&(e._mode===SceneMode$1.SCENE3D?Matrix4.clone(e._view,e._view3D):view2Dto3D(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),Matrix4.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function updateInverseView3D(e){e._inverseView3DDirty&&(Matrix4.inverseTransformation(e.view3D,e._inverseView3D),Matrix4.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function errorToString(e,t){var i="WebGL Error:  ";switch(t){case e.INVALID_ENUM:i+="INVALID_ENUM";break;case e.INVALID_VALUE:i+="INVALID_VALUE";break;case e.INVALID_OPERATION:i+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:i+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:i+="CONTEXT_LOST_WEBGL lost";break;default:i+="Unknown ("+t+")"}return i}function createErrorMessage(e,t,i,r){for(var n=errorToString(e,r)+": "+t.name+"(",a=0;a<i.length;++a)0!==a&&(n+=", "),n+=i[a];return n+=");"}function throwOnError(e,t,i){var r=e.getError();if(r!==e.NO_ERROR)throw new RuntimeError(createErrorMessage(e,t,i,r))}function makeGetterSetter(t,i,r){return{get:function(){var e=t[i];return r(t,"get: "+i,e),t[i]},set:function(e){t[i]=e,r(t,"set: "+i,e)}}}function wrapGL(i,r){if(!defined(r))return i;function e(t){return function(){var e=t.apply(i,arguments);return r(i,t,arguments),e}}var t={};for(var n in i){var a=i[n];a instanceof Function?t[n]=e(a):Object.defineProperty(t,n,makeGetterSetter(i,n,r))}return t}function getExtension(e,t){for(var i=t.length,r=0;r<i;++r){var n=e.getExtension(t[r]);if(n)return n}}function Context(e,t){if("undefined"==typeof WebGLRenderingContext)throw new RuntimeError("The browser does not support WebGL.  Visit http://get.webgl.org.");this._canvas=e,(t=defaultValue(t=clone(t,!0),{})).allowTextureFilterAnisotropic=defaultValue(t.allowTextureFilterAnisotropic,!0);var i=defaultValue(t.webgl,{});i.alpha=defaultValue(i.alpha,!1),i.stencil=defaultValue(i.stencil,!0);var r,n=defaultValue(t.requestWebgl2,!1)&&"undefined"!=typeof WebGL2RenderingContext,a=!1,o=t.getWebGLStub;if(defined(o))r=o(e,i);else if(n&&defined(r=e.getContext("webgl2",i)||e.getContext("experimental-webgl2",i)||void 0)&&(a=!0),defined(r)||(r=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)||void 0),!defined(r))throw new RuntimeError("The browser supports WebGL, but initialization failed.");this._originalGLContext=r,this._gl=r,this._webgl2=a,this._id=createGuid(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new ShaderCache(this),this._textureCache=new TextureCache;var s=r;this._stencilBits=s.getParameter(s.STENCIL_BITS),ContextLimits._maximumCombinedTextureImageUnits=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ContextLimits._maximumCubeMapSize=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),ContextLimits._maximumFragmentUniformVectors=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),ContextLimits._maximumTextureImageUnits=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumRenderbufferSize=s.getParameter(s.MAX_RENDERBUFFER_SIZE),ContextLimits._maximumTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE),ContextLimits._maximumVaryingVectors=s.getParameter(s.MAX_VARYING_VECTORS),ContextLimits._maximumVertexAttributes=s.getParameter(s.MAX_VERTEX_ATTRIBS),ContextLimits._maximumVertexTextureImageUnits=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ContextLimits._maximumVertexUniformVectors=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS);var l=s.getParameter(s.ALIASED_LINE_WIDTH_RANGE);ContextLimits._minimumAliasedLineWidth=l[0],ContextLimits._maximumAliasedLineWidth=l[1];var c=s.getParameter(s.ALIASED_POINT_SIZE_RANGE);ContextLimits._minimumAliasedPointSize=c[0],ContextLimits._maximumAliasedPointSize=c[1];var u=s.getParameter(s.MAX_VIEWPORT_DIMS);ContextLimits._maximumViewportWidth=u[0],ContextLimits._maximumViewportHeight=u[1];var d=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);ContextLimits._highpFloatSupported=0!==d.precision;var h=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_INT);ContextLimits._highpIntSupported=0!==h.rangeMax,this._antialias=s.getContextAttributes().antialias,this._standardDerivatives=!!getExtension(s,["OES_standard_derivatives"]),this._blendMinmax=!!getExtension(s,["EXT_blend_minmax"]),this._elementIndexUint=!!getExtension(s,["OES_element_index_uint"]),this._depthTexture=!!getExtension(s,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!getExtension(s,["EXT_frag_depth"]),this._debugShaders=getExtension(s,["WEBGL_debug_shaders"]),this._textureFloat=!!getExtension(s,["OES_texture_float"]),this._textureHalfFloat=!!getExtension(s,["OES_texture_half_float"]),this._textureFloatLinear=!!getExtension(s,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!getExtension(s,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!getExtension(s,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._colorBufferHalfFloat=!!getExtension(s,["EXT_color_buffer_half_float"]),this._s3tc=!!getExtension(s,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!getExtension(s,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._etc1=!!getExtension(s,["WEBGL_compressed_texture_etc1"]);var p,m,f,g,_,y,v,C,S,x,T=t.allowTextureFilterAnisotropic?getExtension(s,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;if(this._textureFilterAnisotropic=T,ContextLimits._maximumTextureFilterAnisotropy=defined(T)?s.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1,a){var b=this;p=function(){return b._gl.createVertexArray()},m=function(e){b._gl.bindVertexArray(e)},f=function(e){b._gl.deleteVertexArray(e)},g=function(e,t,i,r,n){s.drawElementsInstanced(e,t,i,r,n)},_=function(e,t,i,r){s.drawArraysInstanced(e,t,i,r)},y=function(e,t){s.vertexAttribDivisor(e,t)},v=function(e){s.drawBuffers(e)}}else defined(C=getExtension(s,["OES_vertex_array_object"]))&&(p=function(){return C.createVertexArrayOES()},m=function(e){C.bindVertexArrayOES(e)},f=function(e){C.deleteVertexArrayOES(e)}),defined(S=getExtension(s,["ANGLE_instanced_arrays"]))&&(g=function(e,t,i,r,n){S.drawElementsInstancedANGLE(e,t,i,r,n)},_=function(e,t,i,r){S.drawArraysInstancedANGLE(e,t,i,r)},y=function(e,t){S.vertexAttribDivisorANGLE(e,t)}),defined(x=getExtension(s,["WEBGL_draw_buffers"]))&&(v=function(e){x.drawBuffersWEBGL(e)});this.glCreateVertexArray=p,this.glBindVertexArray=m,this.glDeleteVertexArray=f,this.glDrawElementsInstanced=g,this.glDrawArraysInstanced=_,this.glVertexAttribDivisor=y,this.glDrawBuffers=v,this._vertexArrayObject=!!C,this._instancedArrays=!!S,this._drawBuffers=!!x,ContextLimits._maximumDrawBuffers=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_DRAW_BUFFERS):1,ContextLimits._maximumColorAttachments=this.drawBuffers?s.getParameter(WebGLConstants$1.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new Color(0,0,0,0),this._clearDepth=1,this._clearStencil=0;var E=new UniformState,P=new PassState(this),A=RenderState.fromCache();this._defaultPassState=P,this._defaultRenderState=A,this._defaultTexture=void 0,this._defaultCubeMap=void 0,this._us=E,this._currentRenderState=A,this._currentPassState=P,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(var w=0;w<ContextLimits._maximumVertexAttributes;w++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options=t,this.cache={},RenderState.apply(s,A,P),this._floatTexSixPlaces=checkFloatTexturePrecision(this)}var defaultFramebufferMarker={},scratchBackBufferArray;function applyRenderState(e,t,i,r){var n=e._currentRenderState,a=e._currentPassState;e._currentRenderState=t,e._currentPassState=i,RenderState.partialApply(e._gl,n,t,a,i,r)}function bindFramebuffer(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;var i=scratchBackBufferArray;if(defined(t))t._bind(),i=t._getActiveColorAttachments();else{var r=e._gl;r.bindFramebuffer(r.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(i)}}defineProperties$1(Context.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 8<=this._stencilBits}},antialias:{get:function(){return this._antialias}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},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}},floatTextureSixPlaces:{get:function(){return this._floatTexSixPlaces}},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}},etc1:{get:function(){return this._etc1}},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=wrapGL(this._originalGLContext,e?throwOnError:void 0)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=new Texture({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){var e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new CubeMap({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 defaultFramebufferMarker}}}),"undefined"!=typeof WebGLRenderingContext&&(scratchBackBufferArray=[WebGLConstants$1.BACK]);var defaultClearCommand=new ClearCommand;function beginDraw(e,t,i,r,n){bindFramebuffer(e,t),applyRenderState(e,n,i,!1),r._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,r.maximumTextureUnitIndex)}function continueDraw(e,t,i,r){var n=t._primitiveType,a=t._vertexArray,o=t._offset,s=t._count,l=t.instanceCount;e._us.model=defaultValue(t._modelMatrix,Matrix4.IDENTITY),i._setUniforms(r,e._us,e.validateShaderProgram),a._bind();var c=a.indexBuffer;defined(c)?(o*=c.bytesPerIndex,s=defaultValue(s,c.numberOfIndices),0===l?e._gl.drawElements(n,s,c.indexDatatype,o):e.glDrawElementsInstanced(n,s,c.indexDatatype,o,l)):(s=defaultValue(s,a.numberOfVertices),0===l?e._gl.drawArrays(n,o,s):e.glDrawArraysInstanced(n,o,s,l)),a._unBind()}Context.prototype.clear=function(e,t){e=defaultValue(e,defaultClearCommand),t=defaultValue(t,this._defaultPassState);var i=this._gl,r=0,n=e.color,a=e.depth,o=e.stencil;defined(n)&&(Color.equals(this._clearColor,n)||(Color.clone(n,this._clearColor),i.clearColor(n.red,n.green,n.blue,n.alpha)),r|=i.COLOR_BUFFER_BIT),defined(a)&&(a!==this._clearDepth&&(this._clearDepth=a,i.clearDepth(a)),r|=i.DEPTH_BUFFER_BIT),defined(o)&&(o!==this._clearStencil&&(this._clearStencil=o,i.clearStencil(o)),r|=i.STENCIL_BUFFER_BIT),applyRenderState(this,defaultValue(e.renderState,this._defaultRenderState),t,!0),bindFramebuffer(this,defaultValue(e.framebuffer,t.framebuffer)),i.clear(r)},Context.prototype.draw=function(e,t,i,r){t=defaultValue(t,this._defaultPassState);var n=defaultValue(e._framebuffer,t.framebuffer),a=defaultValue(e._renderState,this._defaultRenderState);i=defaultValue(i,e._shaderProgram),r=defaultValue(r,e._uniformMap),beginDraw(this,n,t,i,a),continueDraw(this,e,i,r)},Context.prototype.endFrame=function(){var e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);var t=scratchBackBufferArray;this.drawBuffers&&this.glDrawBuffers(t);for(var i=this._maxFrameTextureUnitIndex,r=this._maxFrameTextureUnitIndex=0;r<i;++r)e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},Context.prototype.readPixels=function(e){var t=this._gl;e=defaultValue(e,defaultValue.EMPTY_OBJECT);var i=Math.max(defaultValue(e.x,0),0),r=Math.max(defaultValue(e.y,0),0),n=defaultValue(e.width,t.drawingBufferWidth),a=defaultValue(e.height,t.drawingBufferHeight),o=e.framebuffer,s=PixelDatatype$1.UNSIGNED_BYTE;defined(o)&&0<o.numberOfColorAttachments&&(s=o.getColorTexture(0).pixelDatatype);var l=PixelFormat$1.createTypedArray(PixelFormat$1.RGBA,s,n,a);return bindFramebuffer(this,o),t.readPixels(i,r,n,a,PixelFormat$1.RGBA,s,l),l};var viewportQuadAttributeLocations={position:0,textureCoordinates:1};function PickId(e,t,i){this._pickObjects=e,this.key=t,this.color=i}function loadCubeMap(t,e){var i={flipY:!0,preferImageBitmap:!0},r=[Resource.createIfNeeded(e.positiveX).fetchImage(i),Resource.createIfNeeded(e.negativeX).fetchImage(i),Resource.createIfNeeded(e.positiveY).fetchImage(i),Resource.createIfNeeded(e.negativeY).fetchImage(i),Resource.createIfNeeded(e.positiveZ).fetchImage(i),Resource.createIfNeeded(e.negativeZ).fetchImage(i)];return when.all(r,function(e){return new CubeMap({context:t,source:{positiveX:e[0],negativeX:e[1],positiveY:e[2],negativeY:e[3],positiveZ:e[4],negativeZ:e[5]}})})}Context.prototype.getViewportQuadVertexArray=function(){var e=this.cache.viewportQuad_vertexArray;if(!defined(e)){var t=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:PrimitiveType$1.TRIANGLES});e=VertexArray.fromGeometry({context:this,geometry:t,attributeLocations:viewportQuadAttributeLocations,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},Context.prototype.createViewportQuadCommand=function(e,t){return t=defaultValue(t,defaultValue.EMPTY_OBJECT),new DrawCommand({vertexArray:this.getViewportQuadVertexArray(),primitiveType:PrimitiveType$1.TRIANGLES,renderState:t.renderState,shaderProgram:ShaderProgram.fromCache({context:this,vertexShaderSource:ViewportQuadVS,fragmentShaderSource:e,attributeLocations:viewportQuadAttributeLocations}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})},Context.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]},defineProperties$1(PickId.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),PickId.prototype.destroy=function(){delete this._pickObjects[this.key]},Context.prototype.createPickId=function(e){++this._nextPickColor[0];var t=this._nextPickColor[0];if(0===t)throw new RuntimeError("Out of unique Pick IDs.");return this._pickObjects[t]=e,new PickId(this._pickObjects,t,Color.fromRgba(t))},Context.prototype.isDestroyed=function(){return!1},Context.prototype.destroy=function(){var e=this.cache;for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];defined(i.destroy)&&i.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),destroyObject(this)};var RenderbufferFormat={RGBA4:WebGLConstants$1.RGBA4,RGB5_A1:WebGLConstants$1.RGB5_A1,RGB565:WebGLConstants$1.RGB565,DEPTH_COMPONENT16:WebGLConstants$1.DEPTH_COMPONENT16,STENCIL_INDEX8:WebGLConstants$1.STENCIL_INDEX8,DEPTH_STENCIL:WebGLConstants$1.DEPTH_STENCIL,validate:function(e){return e===RenderbufferFormat.RGBA4||e===RenderbufferFormat.RGB5_A1||e===RenderbufferFormat.RGB565||e===RenderbufferFormat.DEPTH_COMPONENT16||e===RenderbufferFormat.STENCIL_INDEX8||e===RenderbufferFormat.DEPTH_STENCIL}},RenderbufferFormat$1=freezeObject$1(RenderbufferFormat);function Renderbuffer(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context._gl,i=defaultValue(e.format,RenderbufferFormat$1.RGBA4),r=defined(e.width)?e.width:t.drawingBufferWidth,n=defined(e.height)?e.height:t.drawingBufferHeight;this._gl=t,this._format=i,this._width=r,this._height=n,this._renderbuffer=this._gl.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this._renderbuffer),t.renderbufferStorage(t.RENDERBUFFER,i,r,n),t.bindRenderbuffer(t.RENDERBUFFER,null)}function DiscardMissingTileImagePolicy(l){l=defaultValue(l,defaultValue.EMPTY_OBJECT),this._pixelsToCheck=l.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;var e=Resource.createIfNeeded(l.missingImageUrl),c=this;e.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then(function(e){defined(e.blob)&&(c._missingImageByteLength=e.blob.size);var t=getImagePixels(e);if(l.disableCheckIfAllPixelsAreTransparent){for(var i=!0,r=e.width,n=l.pixelsToCheck,a=0,o=n.length;i&&a<o;++a){var s=n[a];0<t[3+(4*s.x+s.y*r)]&&(i=!1)}i&&(t=void 0)}c._missingImagePixels=t,c._isReady=!0}).otherwise(function(){c._missingImagePixels=void 0,c._isReady=!0})}function ImageryLayerFeatureInfo(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}function ImageryProvider(){this.defaultAlpha=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,DeveloperError.throwInstantiationError()}defineProperties$1(Renderbuffer.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),Renderbuffer.prototype._getRenderbuffer=function(){return this._renderbuffer},Renderbuffer.prototype.isDestroyed=function(){return!1},Renderbuffer.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),destroyObject(this)},DiscardMissingTileImagePolicy.prototype.isReady=function(){return this._isReady},DiscardMissingTileImagePolicy.prototype.shouldDiscardImage=function(e){var t=this._pixelsToCheck,i=this._missingImagePixels;if(!defined(i))return!1;if(defined(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;for(var r=getImagePixels(e),n=e.width,a=0,o=t.length;a<o;++a)for(var s=t[a],l=4*s.x+s.y*n,c=0;c<4;++c){var u=l+c;if(r[u]!==i[u])return!1}return!0},ImageryLayerFeatureInfo.prototype.configureNameFromProperties=function(e){var t,i=10;for(var r in e)if(e.hasOwnProperty(r)&&e[r]){var n=r.toLowerCase();1<i&&"name"===n?(i=1,t=r):2<i&&"title"===n?(i=2,t=r):3<i&&/name/i.test(r)?(i=3,t=r):4<i&&/title/i.test(r)&&(i=4,t=r)}defined(t)&&(this.name=e[t])},ImageryLayerFeatureInfo.prototype.configureDescriptionFromProperties=function(e){this.description=function e(t){var i='<table class="cesium-infoBox-defaultTable">';for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];defined(n)&&(i+="object"==typeof n?"<tr><td>"+r+"</td><td>"+e(n)+"</td></tr>":"<tr><td>"+r+"</td><td>"+n+"</td></tr>")}return i+="</table>"}(e)},defineProperties$1(ImageryProvider.prototype,{ready:{get:DeveloperError.throwInstantiationError},readyPromise:{get:DeveloperError.throwInstantiationError},rectangle:{get:DeveloperError.throwInstantiationError},tileWidth:{get:DeveloperError.throwInstantiationError},tileHeight:{get:DeveloperError.throwInstantiationError},maximumLevel:{get:DeveloperError.throwInstantiationError},minimumLevel:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},tileDiscardPolicy:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError},credit:{get:DeveloperError.throwInstantiationError},proxy:{get:DeveloperError.throwInstantiationError},hasAlphaChannel:{get:DeveloperError.throwInstantiationError}}),ImageryProvider.prototype.getTileCredits=DeveloperError.throwInstantiationError,ImageryProvider.prototype.requestImage=DeveloperError.throwInstantiationError,ImageryProvider.prototype.pickFeatures=DeveloperError.throwInstantiationError;var ktxRegex$2=/\.ktx$/i,crnRegex$2=/\.crn$/i;function ArcGisMapServerImageryProvider(c){c=defaultValue(c,defaultValue.EMPTY_OBJECT);var e=Resource.createIfNeeded(c.url);e.appendForwardSlash(),defined(c.token)&&e.setQueryParameters({token:c.token}),this._resource=e,this._tileDiscardPolicy=c.tileDiscardPolicy,this._tileWidth=defaultValue(c.tileWidth,256),this._tileHeight=defaultValue(c.tileHeight,256),this._maximumLevel=c.maximumLevel,this._tilingScheme=defaultValue(c.tilingScheme,new GeographicTilingScheme({ellipsoid:c.ellipsoid})),this._useTiles=defaultValue(c.usePreCachedTilesIfAvailable,!0),this._rectangle=defaultValue(c.rectangle,this._tilingScheme.rectangle),this._layers=c.layers,this._maxTileLevel=c.maxTileLevel,this._wkid=c.wkid;var t=c.credit;"string"==typeof t&&(t=new Credit(t)),this._credit=t,this.enablePickFeatures=defaultValue(c.enablePickFeatures,!0),this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var u,d=this;function i(e){var t=e.tileInfo;if(defined(t)){if(d._tileWidth=t.rows,d._tileHeight=t.cols,d._wkid=t.spatialReference.wkid,102100===t.spatialReference.wkid||102113===t.spatialReference.wkid)d._tilingScheme=new WebMercatorTilingScheme({ellipsoid:c.ellipsoid});else{if(4326!==e.tileInfo.spatialReference.wkid&&4490!==e.tileInfo.spatialReference.wkid){var i="Tile spatial reference WKID "+e.tileInfo.spatialReference.wkid+" is not supported.";return void(u=TileProviderError.handleError(u,d,d._errorEvent,i,void 0,void 0,void 0,h))}d._tilingScheme=new GeographicTilingScheme({ellipsoid:c.ellipsoid})}if(d._maximumLevel||(d._maximumLevel=e.tileInfo.lods.length-1),defined(e.fullExtent)){if(defined(e.fullExtent.spatialReference)&&defined(e.fullExtent.spatialReference.wkid))if(102100===e.fullExtent.spatialReference.wkid||102113===e.fullExtent.spatialReference.wkid){var r=new WebMercatorProjection,n=e.fullExtent,a=r.unproject(new Cartesian3(Math.max(n.xmin,-d._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(n.ymin,-d._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),o=r.unproject(new Cartesian3(Math.min(n.xmax,d._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(n.ymax,d._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));d._rectangle=new Rectangle(a.longitude,a.latitude,o.longitude,o.latitude)}else{if(4326!==e.fullExtent.spatialReference.wkid&&4490!==e.fullExtent.spatialReference.wkid){var s="fullExtent.spatialReference WKID "+e.fullExtent.spatialReference.wkid+" is not supported.";return void(u=TileProviderError.handleError(u,d,d._errorEvent,s,void 0,void 0,void 0,h))}d._rectangle=Rectangle.fromDegrees(e.fullExtent.xmin,e.fullExtent.ymin,e.fullExtent.xmax,e.fullExtent.ymax)}}else d._rectangle=d._tilingScheme.rectangle;defined(d._tileDiscardPolicy)||(d._tileDiscardPolicy=new DiscardMissingTileImagePolicy({missingImageUrl:buildImageResource(d,0,0,d._maximumLevel).url,pixelsToCheck:[new Cartesian2(0,0),new Cartesian2(200,20),new Cartesian2(20,200),new Cartesian2(80,110),new Cartesian2(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),d._useTiles=!0}else d._useTiles=!1;var l=e.fullExtent||e.initialExtent;if(defined(l)&&defined(l.spatialReference)&&defined(l.spatialReference.wkid))if(102100===l.spatialReference.wkid||102113===l.spatialReference.wkid){a=(r=new WebMercatorProjection).unproject(new Cartesian3(Math.max(l.xmin,-d._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(l.ymin,-d._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),o=r.unproject(new Cartesian3(Math.min(l.xmax,d._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(l.ymax,d._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));d._rectangle=new Rectangle(a.longitude,a.latitude,o.longitude,o.latitude)}else 4326!==l.spatialReference.wkid&&4490!==l.spatialReference.wkid||(d._rectangle=Rectangle.fromDegrees(l.xmin,l.ymin,l.xmax,l.ymax));defined(e.copyrightText)&&0<e.copyrightText.length&&(d._credit=new Credit(e.copyrightText)),d._ready=!0,d._readyPromise.resolve(!0),TileProviderError.handleSuccess(u)}function r(e){var t="An error occurred while accessing "+d._resource.url+".";u=TileProviderError.handleError(u,d,d._errorEvent,t,void 0,void 0,void 0,h),d._readyPromise.reject(new RuntimeError(t))}function h(){when(d._resource.getDerivedResource({queryParameters:{f:"json"}}).fetchJsonp(),i,r)}this._useTiles?h():(this._ready=!0,this._readyPromise.resolve(!0))}function buildImageResource(e,t,i,r,n){var a,o=e._useTiles;if(o&&defined(e._maxTileLevel)&&(o=r<e._maxTileLevel),o)a=e._resource.getDerivedResource({url:"tile/"+r+"/"+i+"/"+t,request:n});else{var s=e._tilingScheme.tileXYToNativeRectangle(t,i,r),l={bbox:s.west+","+s.south+","+s.east+","+s.north,size:e._tileWidth+","+e._tileHeight,format:"png",transparent:!0,f:"image"};e._tilingScheme.projection instanceof GeographicProjection?(l.bboxSR=e._wkid||4326,l.imageSR=e._wkid||4326):(l.bboxSR=e._wkid||3857,l.imageSR=e._wkid||3857),e.layers&&(l.layers="show:"+e.layers),a=e._resource.getDerivedResource({url:"export",request:n,queryParameters:l})}return a}function AutoExposure(){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=void 0,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new Cartesian2,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}function destroyFramebuffers(e){var t=e._framebuffers;if(defined(t)){for(var i=t.length,r=0;r<i;++r)t[r].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}}function createFramebuffers(e,t){destroyFramebuffers(e);for(var i=e._width,r=e._height,n=PixelFormat$1.RGBA,a=t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT,o=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST}),s=Math.ceil(Math.log(Math.max(i,r))/Math.log(3)),l=new Array(s),c=0;c<s;++c)i=Math.max(Math.ceil(i/3),1),r=Math.max(Math.ceil(r/3),1),l[c]=new Framebuffer({context:t,colorTextures:[new Texture({context:t,width:i,height:r,pixelFormat:n,pixelDatatype:a,sampler:o})]});var u=l[s-1].getColorTexture(0);e._previousLuminance=new Framebuffer({context:t,colorTextures:[new Texture({context:t,width:u.width,height:u.height,pixelFormat:n,pixelDatatype:a,sampler:o})]}),e._framebuffers=l}function destroyCommands(e){var t=e._commands;if(defined(t)){for(var i=t.length,r=0;r<i;++r)t[r].shaderProgram.destroy();e._commands=void 0}}function createUniformMap(e,t){var i;if(0===t)i={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{var r=e._framebuffers[t-1].getColorTexture(0);i={colorTexture:function(){return r},colorTextureDimensions:function(){return r.dimensions}}}return i.minMaxLuminance=function(){return e._minMaxLuminance},i.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},i}function getShaderSource(e,t){var i="uniform sampler2D colorTexture; \nvarying vec2 v_textureCoordinates; \nfloat sampleTexture(vec2 offset) { \n";return i+=0===e?"    vec4 color = texture2D(colorTexture, v_textureCoordinates + offset); \n    return czm_luminance(color.rgb); \n":"    return texture2D(colorTexture, v_textureCoordinates + offset).r; \n",i+="}\n\n",i+="uniform vec2 colorTextureDimensions; \nuniform vec2 minMaxLuminance; \nuniform sampler2D previousLuminance; \nvoid main() { \n    float color = 0.0; \n    float xStep = 1.0 / colorTextureDimensions.x; \n    float yStep = 1.0 / colorTextureDimensions.y; \n    int count = 0; \n    for (int i = 0; i < 3; ++i) { \n        for (int j = 0; j < 3; ++j) { \n            vec2 offset; \n            offset.x = -xStep + float(i) * xStep; \n            offset.y = -yStep + float(j) * yStep; \n            if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { \n                continue; \n            } \n            color += sampleTexture(offset); \n            ++count; \n        } \n    } \n    if (count > 0) { \n        color /= float(count); \n    } \n",e===t-1&&(i+="    float previous = texture2D(previousLuminance, vec2(0.5)).r; \n    color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n    color = previous + (color - previous) / (60.0 * 1.5); \n    color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n"),i+="    gl_FragColor = vec4(color); \n} \n"}function createCommands$3(e,t){destroyCommands(e);for(var i=e._framebuffers,r=i.length,n=new Array(r),a=0;a<r;++a)n[a]=t.createViewportQuadCommand(getShaderSource(a,r),{framebuffer:i[a],uniformMap:createUniformMap(e,a)});e._commands=n}ImageryProvider.loadImage=function(e,t){var i=Resource.createIfNeeded(t);return ktxRegex$2.test(i.url)?loadKTX(i):crnRegex$2.test(i.url)?loadCRN(i):defined(e)&&defined(e.tileDiscardPolicy)?i.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):i.fetchImage({preferImageBitmap:!0,flipY:!0})},defineProperties$1(ArcGisMapServerImageryProvider.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),ArcGisMapServerImageryProvider.prototype.getTileCredits=function(e,t,i){},ArcGisMapServerImageryProvider.prototype.requestImage=function(e,t,i,r){return ImageryProvider.loadImage(this,buildImageResource(this,e,t,i,r))},ArcGisMapServerImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){if(this.enablePickFeatures){var a,o,s,l=this._tilingScheme.tileXYToNativeRectangle(e,t,i);if(this._tilingScheme.projection instanceof GeographicProjection)a=CesiumMath.toDegrees(r),o=CesiumMath.toDegrees(n),s=this._wkid||"4326";else{var c=this._tilingScheme.projection.project(new Cartographic(r,n,0));a=c.x,o=c.y,s=this._wkid||"3857"}var u="visible";defined(this._layers)&&(u+=":"+this._layers);var d={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:a+","+o,mapExtent:l.west+","+l.south+","+l.east+","+l.north,imageDisplay:this._tileWidth+","+this._tileHeight+",96",sr:s,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:d}).fetchJson().then(function(e){var t=[],i=e.results;if(!defined(i))return t;for(var r=0;r<i.length;++r){var n=i[r],a=new ImageryLayerFeatureInfo;if(a.data=n,a.name=n.value,a.properties=n.attributes,a.configureDescriptionFromProperties(n.attributes),"esriGeometryPoint"===n.geometryType&&n.geometry){var o=n.geometry.spatialReference&&n.geometry.spatialReference.wkid?n.geometry.spatialReference.wkid:4326;if(4326===o||4283===o||4490===o)a.position=Cartographic.fromDegrees(n.geometry.x,n.geometry.y,n.geometry.z);else if(102100===o||900913===o||3857===o){var s=new WebMercatorProjection;a.position=s.unproject(new Cartesian3(n.geometry.x,n.geometry.y,n.geometry.z))}}t.push(a)}return t})}},defineProperties$1(AutoExposure.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){var e=this._framebuffers;if(defined(e))return e[e.length-1].getColorTexture(0)}}}),AutoExposure.prototype.clear=function(e){var t=this._framebuffers;if(defined(t)){var i=this._clearCommand;defined(i)||(i=this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),framebuffer:void 0}));for(var r=t.length,n=0;n<r;++n)i.framebuffer=t[n],i.execute(e)}},AutoExposure.prototype.update=function(e){var t=e.drawingBufferWidth,i=e.drawingBufferHeight;t===this._width&&i===this._height||(this._width=t,this._height=i,createFramebuffers(this,e),createCommands$3(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;var r=this._framebuffers,n=r[r.length-1];r[r.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance,this._previousLuminance=n},AutoExposure.prototype.execute=function(e,t){this._colorTexture=t;var i=this._commands;if(defined(i))for(var r=i.length,n=0;n<r;++n)i[n].execute(e)},AutoExposure.prototype.isDestroyed=function(){return!1},AutoExposure.prototype.destroy=function(){return destroyFramebuffers(this),destroyCommands(this),destroyObject(this)};var Cesium3DTileColorBlendMode={HIGHLIGHT:0,REPLACE:1,MIX:2},Cesium3DTileColorBlendMode$1=freezeObject$1(Cesium3DTileColorBlendMode),ComponentsPerAttribute={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ClassPerType={SCALAR:void 0,VEC2:Cartesian2,VEC3:Cartesian3,VEC4:Cartesian4,MAT2:Matrix2,MAT3:Matrix3,MAT4:Matrix4};function getBinaryAccessor(e){var r,t=e.componentType;r="string"==typeof t?ComponentDatatype$1.fromName(t):t;var n=ComponentsPerAttribute[e.type],i=ClassPerType[e.type];return{componentsPerAttribute:n,classType:i,createArrayBufferView:function(e,t,i){return ComponentDatatype$1.createArrayBufferView(r,e,t,n*i)}}}var DEFAULT_COLOR_VALUE=Color.WHITE,DEFAULT_SHOW_VALUE=!0;function Cesium3DTileBatchTable(e,t,i,r,n){var a;this.featuresLength=t,this._translucentFeaturesLength=0,defined(i)&&(a=i.extensions),this._extensions=defaultValue(a,{});var o,s,l=initializeProperties(i);if(this._properties=l,this._batchTableHierarchy=initializeHierarchy(this,i,r),this._batchTableBinaryProperties=getBinaryProperties(t,l,r),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=[],this._content=e,this._colorChangedCallback=n,0<t){var c=Math.min(t,ContextLimits.maximumTextureSize),u=Math.ceil(t/ContextLimits.maximumTextureSize),d=1/c,h=.5*d,p=1/u,m=.5*p;o=new Cartesian2(c,u),s=new Cartesian4(d,h,p,m)}this._textureDimensions=o,this._textureStep=s}function initializeProperties(e){var t={};if(!defined(e))return t;for(var i in e)e.hasOwnProperty(i)&&"HIERARCHY"!==i&&"extensions"!==i&&"extras"!==i&&(t[i]=clone(e[i],!0));return t}function initializeHierarchy(e,t,i){if(defined(t)){var r=e._extensions["3DTILES_batch_table_hierarchy"],n=t.HIERARCHY;if(defined(n)&&(Cesium3DTileBatchTable._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),r=e._extensions["3DTILES_batch_table_hierarchy"]=n),defined(r))return initializeHierarchyValues(r,i)}}function initializeHierarchyValues(e,t){var i,r,n,a=e.instancesLength,o=e.classes,s=e.classIds,l=e.parentCounts,c=e.parentIds,u=a;if(defined(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,ComponentDatatype$1.UNSIGNED_SHORT),s.type=AttributeType$1.SCALAR,s=getBinaryAccessor(s).createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,a)),defined(l))for(defined(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,ComponentDatatype$1.UNSIGNED_SHORT),l.type=AttributeType$1.SCALAR,l=getBinaryAccessor(l).createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,a)),n=new Uint16Array(a),i=u=0;i<a;++i)n[i]=u,u+=l[i];defined(c)&&defined(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,ComponentDatatype$1.UNSIGNED_SHORT),c.type=AttributeType$1.SCALAR,c=getBinaryAccessor(c).createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,u));var d=o.length;for(i=0;i<d;++i){var h=o[i].length,p=o[i].instances,m=getBinaryProperties(h,p,t);o[i].instances=combine(m,p)}var f=arrayFill(new Array(d),0),g=new Uint16Array(a);for(i=0;i<a;++i)r=s[i],g[i]=f[r],++f[r];return{classes:o,classIds:s,classIndexes:g,parentCounts:l,parentIndexes:n,parentIds:c}}function getBinaryProperties(e,t,i){var r;for(var n in t)if(t.hasOwnProperty(n)){var a=t[n],o=a.byteOffset;if(defined(o)){var s=a.componentType,l=a.type;if(!defined(s))throw new RuntimeError("componentType is required.");if(!defined(l))throw new RuntimeError("type is required.");if(!defined(i))throw new RuntimeError("Property "+n+" requires a batch table binary.");var c=getBinaryAccessor(a),u=c.componentsPerAttribute,d=c.classType,h=c.createArrayBufferView(i.buffer,i.byteOffset+o,e);defined(r)||(r={}),r[n]={typedArray:h,componentCount:u,type:d}}}return r}function getByteLength(e){var t=e._textureDimensions;return t.x*t.y*4}function getBatchValues(e){if(!defined(e._batchValues)){var t=getByteLength(e),i=new Uint8Array(t);arrayFill(i,255),e._batchValues=i}return e._batchValues}function getShowAlphaProperties(e){if(!defined(e._showAlphaProperties)){var t=2*e.featuresLength,i=new Uint8Array(t);arrayFill(i,255),e._showAlphaProperties=i}return e._showAlphaProperties}Cesium3DTileBatchTable._deprecationWarning=deprecationWarning,defineProperties$1(Cesium3DTileBatchTable.prototype,{memorySizeInBytes:{get:function(){var e=0;return defined(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),defined(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}}}),Cesium3DTileBatchTable.getBinaryProperties=function(e,t,i){return getBinaryProperties(e,t,i)},Cesium3DTileBatchTable.prototype.setShow=function(e,t){if(!t||defined(this._showAlphaProperties)){var i=getShowAlphaProperties(this),r=2*e,n=t?255:0;if(i[r]!==n)i[r]=n,getBatchValues(this)[4*e+3]=t?i[1+r]:0,this._batchValuesDirty=!0}},Cesium3DTileBatchTable.prototype.setAllShow=function(e){for(var t=this.featuresLength,i=0;i<t;++i)this.setShow(i,e)},Cesium3DTileBatchTable.prototype.getShow=function(e){if(!defined(this._showAlphaProperties))return!0;var t=2*e;return 255===this._showAlphaProperties[t]};var scratchColorBytes=new Array(4);Cesium3DTileBatchTable.prototype.setColor=function(e,t){if(!Color.equals(t,DEFAULT_COLOR_VALUE)||defined(this._batchValues)){var i=t.toBytes(scratchColorBytes),r=i[3],n=getBatchValues(this),a=4*e,o=getShowAlphaProperties(this),s=2*e;if(n[a]!==i[0]||n[1+a]!==i[1]||n[2+a]!==i[2]||o[1+s]!==r){n[a]=i[0],n[1+a]=i[1],n[2+a]=i[2];var l=255!==o[1+s],c=0!==o[s];n[3+a]=c?r:0;var u=255!==(o[1+s]=r);u&&!l?++this._translucentFeaturesLength:!u&&l&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,defined(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}}},Cesium3DTileBatchTable.prototype.setAllColor=function(e){for(var t=this.featuresLength,i=0;i<t;++i)this.setColor(i,e)},Cesium3DTileBatchTable.prototype.getColor=function(e,t){if(!defined(this._batchValues))return Color.clone(DEFAULT_COLOR_VALUE,t);var i=this._batchValues,r=4*e,n=this._showAlphaProperties,a=2*e;return Color.fromBytes(i[r],i[1+r],i[2+r],n[1+a],t)},Cesium3DTileBatchTable.prototype.getPickColor=function(e){return this._pickIds[e]};var scratchColor$c=new Color;function getBinaryProperty(e,t){var i=e.typedArray,r=e.componentCount;return 1===r?i[t]:e.type.unpack(i,t*r)}function setBinaryProperty(e,t,i){var r=e.typedArray,n=e.componentCount;1===n?r[t]=i:e.type.pack(i,r,t*n)}Cesium3DTileBatchTable.prototype.applyStyle=function(e){if(!defined(e))return this.setAllColor(DEFAULT_COLOR_VALUE),void this.setAllShow(DEFAULT_SHOW_VALUE);for(var t=this._content,i=this.featuresLength,r=0;r<i;++r){var n=t.getFeature(r),a=defined(e.color)?e.color.evaluateColor(n,scratchColor$c):DEFAULT_COLOR_VALUE,o=defined(e.show)?e.show.evaluate(n):DEFAULT_SHOW_VALUE;this.setColor(r,a),this.setShow(r,o)}};var scratchVisited=[],scratchStack=[],marker=0;function traverseHierarchyMultipleParents(e,t,i){var r=e.classIds,n=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=r.length,l=scratchVisited;l.length=Math.max(l.length,s);var c=++marker,u=scratchStack;for(u.length=0,u.push(t);0<u.length;)if(l[t=u.pop()]!==c){l[t]=c;var d=i(e,t);if(defined(d))return d;for(var h=n[t],p=o[t],m=0;m<h;++m){var f=a[p+m];f!==t&&u.push(f)}}}function traverseHierarchySingleParent(e,t,i){for(var r=!0;r;){var n=i(e,t);if(defined(n))return n;var a=e.parentIds[t];r=a!==t,t=a}}function traverseHierarchy(e,t,i){var r=e.parentCounts;return defined(e.parentIds)?defined(r)?traverseHierarchyMultipleParents(e,t,i):traverseHierarchySingleParent(e,t,i):i(e,t)}function hasPropertyInHierarchy(e,t,r){return defined(traverseHierarchy(e._batchTableHierarchy,t,function(e,t){var i=e.classIds[t];if(defined(e.classes[i].instances[r]))return!0}))}function getPropertyNamesInHierarchy(e,t,a){traverseHierarchy(e._batchTableHierarchy,t,function(e,t){var i=e.classIds[t],r=e.classes[i].instances;for(var n in r)r.hasOwnProperty(n)&&-1===a.indexOf(n)&&a.push(n)})}function getHierarchyProperty(e,t,o){return traverseHierarchy(e._batchTableHierarchy,t,function(e,t){var i=e.classIds[t],r=e.classes[i],n=e.classIndexes[t],a=r.instances[o];if(defined(a))return defined(a.typedArray)?getBinaryProperty(a,n):clone(a[n],!0)})}function setHierarchyProperty(e,t,o,s){return defined(traverseHierarchy(e._batchTableHierarchy,t,function(e,t){var i=e.classIds[t],r=e.classes[i],n=e.classIndexes[t],a=r.instances[o];if(defined(a))return defined(a.typedArray)?setBinaryProperty(a,n,s):a[n]=clone(s,!0),!0}))}function getGlslComputeSt$1(e){return 1===e._textureDimensions.y?"uniform vec4 tile_textureStep; \nvec2 computeSt(float batchId) \n{ \n    float stepX = tile_textureStep.x; \n    float centerX = tile_textureStep.y; \n    return vec2(centerX + (batchId * stepX), 0.5); \n} \n":"uniform vec4 tile_textureStep; \nuniform vec2 tile_textureDimensions; \nvec2 computeSt(float batchId) \n{ \n    float stepX = tile_textureStep.x; \n    float centerX = tile_textureStep.y; \n    float stepY = tile_textureStep.z; \n    float centerY = tile_textureStep.w; \n    float xId = mod(batchId, tile_textureDimensions.x); \n    float yId = floor(batchId / tile_textureDimensions.x); \n    return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n"}function getDefaultShader(e,t){return e=ShaderSource.replaceMain(e,"tile_main"),t?e+"uniform float tile_colorBlend; \nvoid tile_color(vec4 tile_featureColor) \n{ \n    tile_main(); \n    tile_featureColor = czm_gammaCorrect(tile_featureColor); \n    gl_FragColor.a *= tile_featureColor.a; \n    float highlight = ceil(tile_colorBlend); \n    gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n} \n":e+"void tile_color(vec4 tile_featureColor) \n{ \n    tile_main(); \n} \n"}function replaceDiffuseTextureCalls(e,t){for(var i,r="texture2D("+t,n=0,a=e.indexOf(r,n);-1<a;){for(var o=0,s=a;s<e.length;++s){var l=e.charAt(s);if("("===l)++o;else if(")"===l&&0===--o){i=s+1;break}}var c="tile_diffuse_final("+e.slice(a,i)+", tile_diffuse)";e=e.slice(0,a)+c+e.slice(i),n=a+c.length,a=e.indexOf(r,n)}return e}function modifyDiffuse(e,t,i){if(!defined(t))return getDefaultShader(e,i);var r=new RegExp("(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+"+t+";"),n=e.match(r);if(!defined(n))return getDefaultShader(e,i);var a=n[0],o=n[2];e=(e=ShaderSource.replaceMain(e,"tile_main")).replace(a,"");var s;if("vec3"===o||"vec4"===o){var l="vec3"===o?"vec4("+t+", 1.0)":t,c="vec3"===o?"tile_diffuse.xyz":"tile_diffuse";r=new RegExp(t,"g"),e=e.replace(r,c),s="    vec4 source = "+l+"; \n    tile_diffuse = tile_diffuse_final(source, tile_featureColor); \n    tile_main(); \n"}else"sampler2D"===o&&(e=replaceDiffuseTextureCalls(e,t),s="    tile_diffuse = tile_featureColor; \n    tile_main(); \n");return e="uniform float tile_colorBlend; \nvec4 tile_diffuse = vec4(1.0); \nbool isWhite(vec3 color) \n{ \n    return all(greaterThan(color, vec3(1.0 - czm_epsilon3))); \n} \nvec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse) \n{ \n    vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend); \n    vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse; \n    return vec4(diffuse.rgb, sourceDiffuse.a); \n} \n"+a+"\n"+e+"\nvoid tile_color(vec4 tile_featureColor) \n{ \n"+s,i&&(e+="    tile_featureColor = czm_gammaCorrect(tile_featureColor); \n    gl_FragColor.a *= tile_featureColor.a; \n    float highlight = ceil(tile_colorBlend); \n    gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n"),e+="} \n"}function getColorBlend(e){var t=e._content.tileset,i=t.colorBlendMode,r=t.colorBlendAmount;return i===Cesium3DTileColorBlendMode$1.HIGHLIGHT?0:i===Cesium3DTileColorBlendMode$1.REPLACE?1:i===Cesium3DTileColorBlendMode$1.MIX?CesiumMath.clamp(r,CesiumMath.EPSILON4,1):void 0}Cesium3DTileBatchTable.prototype.isClass=function(e,r){var t=this._batchTableHierarchy;return!!defined(t)&&defined(traverseHierarchy(t,e,function(e,t){var i=e.classIds[t];if(e.classes[i].name===r)return!0}))},Cesium3DTileBatchTable.prototype.isExactClass=function(e,t){return this.getExactClassName(e)===t},Cesium3DTileBatchTable.prototype.getExactClassName=function(e){var t=this._batchTableHierarchy;if(defined(t)){var i=t.classIds[e];return t.classes[i].name}},Cesium3DTileBatchTable.prototype.hasProperty=function(e,t){return defined(this._properties[t])||defined(this._batchTableHierarchy)&&hasPropertyInHierarchy(this,e,t)},Cesium3DTileBatchTable.prototype.getPropertyNames=function(e,t){(t=defined(t)?t:[]).length=0;var i=Object.keys(this._properties);return t.push.apply(t,i),defined(this._batchTableHierarchy)&&getPropertyNamesInHierarchy(this,e,t),t},Cesium3DTileBatchTable.prototype.getProperty=function(e,t){if(defined(this._batchTableBinaryProperties)){var i=this._batchTableBinaryProperties[t];if(defined(i))return getBinaryProperty(i,e)}var r=this._properties[t];if(defined(r))return clone(r[e],!0);if(defined(this._batchTableHierarchy)){var n=getHierarchyProperty(this,e,t);if(defined(n))return n}},Cesium3DTileBatchTable.prototype.setProperty=function(e,t,i){var r=this.featuresLength;if(defined(this._batchTableBinaryProperties)){var n=this._batchTableBinaryProperties[t];if(defined(n))return void setBinaryProperty(n,e,i)}if(!defined(this._batchTableHierarchy)||!setHierarchyProperty(this,e,t,i)){var a=this._properties[t];defined(a)||(this._properties[t]=new Array(r),a=this._properties[t]),a[e]=clone(i,!0)}},Cesium3DTileBatchTable.prototype.getVertexShaderCallback=function(r,n,a){if(0!==this.featuresLength){var o=this;return function(e){var t,i=modifyDiffuse(e,a,!1);return 0<ContextLimits.maximumVertexTextureImageUnits?(t="",r&&(t+="uniform bool tile_translucentCommand; \n"),t+="uniform sampler2D tile_batchTexture; \nvarying vec4 tile_featureColor; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n    vec2 st = computeSt("+n+"); \n    vec4 featureProperties = texture2D(tile_batchTexture, st); \n    tile_color(featureProperties); \n    float show = ceil(featureProperties.a); \n    gl_Position *= show; \n",r&&(t+="    bool isStyleTranslucent = (featureProperties.a != 1.0); \n    if (czm_pass == czm_passTranslucent) \n    { \n        if (!isStyleTranslucent && !tile_translucentCommand) \n        { \n            gl_Position *= 0.0; \n        } \n    } \n    else \n    { \n        if (isStyleTranslucent) \n        { \n            gl_Position *= 0.0; \n        } \n    } \n"),t+="    tile_featureColor = featureProperties; \n    tile_featureSt = st; \n}"):t="varying vec2 tile_featureSt; \nvoid main() \n{ \n    tile_color(vec4(1.0)); \n    tile_featureSt = computeSt("+n+"); \n}",i+"\n"+getGlslComputeSt$1(o)+t}}},Cesium3DTileBatchTable.prototype.getFragmentShaderCallback=function(t,i){if(0!==this.featuresLength)return function(e){return e=modifyDiffuse(e,i,!0),0<ContextLimits.maximumVertexTextureImageUnits?e+="uniform sampler2D tile_pickTexture; \nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n    tile_color(tile_featureColor); \n}":(t&&(e+="uniform bool tile_translucentCommand; \n"),e+="uniform sampler2D tile_pickTexture; \nuniform sampler2D tile_batchTexture; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n    vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n    if (featureProperties.a == 0.0) { \n        discard; \n    } \n",t&&(e+="    bool isStyleTranslucent = (featureProperties.a != 1.0); \n    if (czm_pass == czm_passTranslucent) \n    { \n        if (!isStyleTranslucent && !tile_translucentCommand) \n        { \n            discard; \n        } \n    } \n    else \n    { \n        if (isStyleTranslucent) \n        { \n            discard; \n        } \n    } \n"),e+="    tile_color(featureProperties); \n} \n"),e}},Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback=function(){if(0!==this.featuresLength)return function(e){return e=ShaderSource.replaceMain(e,"tile_main"),0<ContextLimits.maximumVertexTextureImageUnits?e+="uniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n    tile_main(); \n    gl_FragColor = tile_featureColor; \n}":e+="uniform sampler2D tile_batchTexture; \nuniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvoid main() \n{ \n    tile_main(); \n    vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n    if (featureProperties.a == 0.0) { \n        discard; \n    } \n    gl_FragColor = featureProperties; \n} \n",e}},Cesium3DTileBatchTable.prototype.getUniformMapCallback=function(){if(0!==this.featuresLength){var t=this;return function(e){return combine(e,{tile_batchTexture:function(){return defaultValue(t._batchTexture,t._defaultTexture)},tile_textureDimensions:function(){return t._textureDimensions},tile_textureStep:function(){return t._textureStep},tile_colorBlend:function(){return getColorBlend(t)},tile_pickTexture:function(){return t._pickTexture}})}}},Cesium3DTileBatchTable.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};var StyleCommandsNeeded={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};function getStyleCommandsNeeded(e){var t=e._translucentFeaturesLength;return 0===t?StyleCommandsNeeded.ALL_OPAQUE:t===e.featuresLength?StyleCommandsNeeded.ALL_TRANSLUCENT:StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT}function deriveCommand(e){var t=DrawCommand.shallowClone(e),i=t.pass===Pass$1.TRANSLUCENT;return t.uniformMap=defined(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return i},t}function deriveTranslucentCommand$1(e){var t=DrawCommand.shallowClone(e);return t.pass=Pass$1.TRANSLUCENT,t.renderState=getTranslucentRenderState$1(e.renderState),t}function deriveOpaqueCommand(e){var t=DrawCommand.shallowClone(e);return t.renderState=getOpaqueRenderState(e.renderState),t}function getDisableLogDepthFragmentShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!defined(i)){var r=t.fragmentShaderSource.clone();r.defines=defined(r.defines)?r.defines.slice(0):[],r.defines.push("DISABLE_LOG_DEPTH_FRAGMENT_WRITE"),i=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:t._attributeLocations})}return i}function deriveZBackfaceCommand(e,t){var i=DrawCommand.shallowClone(t),r=clone(i.renderState,!0);return r.cull.enabled=!0,r.cull.face=CullFace$1.FRONT,r.colorMask={red:!1,green:!1,blue:!1,alpha:!1},r.polygonOffset={enabled:!0,factor:5,units:5},r.stencilTest=StencilConstants$1.setCesium3DTileBit(),r.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,i.renderState=RenderState.fromCache(r),i.castShadows=!1,i.receiveShadows=!1,i.shaderProgram=getDisableLogDepthFragmentShaderProgram(e,t.shaderProgram),i}function deriveStencilCommand(e,t){var i=DrawCommand.shallowClone(e),r=clone(i.renderState,!0);return r.stencilTest.enabled=!0,r.stencilTest.mask=StencilConstants$1.SKIP_LOD_MASK,r.stencilTest.reference=StencilConstants$1.CESIUM_3D_TILE_MASK|t<<StencilConstants$1.SKIP_LOD_BIT_SHIFT,r.stencilTest.frontFunction=StencilFunction$1.GREATER_OR_EQUAL,r.stencilTest.frontOperation.zPass=StencilOperation$1.REPLACE,r.stencilTest.backFunction=StencilFunction$1.GREATER_OR_EQUAL,r.stencilTest.backOperation.zPass=StencilOperation$1.REPLACE,r.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK|StencilConstants$1.SKIP_LOD_MASK,i.renderState=RenderState.fromCache(r),i}function getLastSelectionDepth(e){return(e.renderState.stencilTest.reference&StencilConstants$1.SKIP_LOD_MASK)>>>StencilConstants$1.SKIP_LOD_BIT_SHIFT}function getTranslucentRenderState$1(e){var t=clone(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=BlendingState$1.ALPHA_BLEND,RenderState.fromCache(t)}function getOpaqueRenderState(e){var t=clone(e,!0);return t.stencilTest=StencilConstants$1.setCesium3DTileBit(),t.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK,RenderState.fromCache(t)}function createTexture$2(e,t,i){var r=e._textureDimensions;return new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:r.x,height:r.y,arrayBufferView:i},flipY:!1,sampler:new Sampler({minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}function createPickTexture(e,t){var i=e.featuresLength;if(!defined(e._pickTexture)&&0<i){for(var r=e._pickIds,n=getByteLength(e),a=new Uint8Array(n),o=e._content,s=0;s<i;++s){var l=t.createPickId(o.getFeature(s));r.push(l);var c=l.color,u=4*s;a[u]=Color.floatToByte(c.red),a[1+u]=Color.floatToByte(c.green),a[2+u]=Color.floatToByte(c.blue),a[3+u]=Color.floatToByte(c.alpha)}e._pickTexture=createTexture$2(e,t,a),o.tileset._statistics.batchTableByteLength+=e._pickTexture.sizeInBytes}}function updateBatchTexture(e){var t=e._textureDimensions;e._batchTexture.copyFrom({width:t.x,height:t.y,arrayBufferView:e._batchValues})}function Cesium3DTileFeature(e,t){this._content=e,this._batchId=t,this._color=void 0}function Cesium3DTileFeatureTable(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function getTypedArrayFromBinary(e,t,i,r,n,a){var o=e._cachedTypedArrays,s=o[t];return defined(s)||(s=ComponentDatatype$1.createArrayBufferView(i,e.buffer.buffer,e.buffer.byteOffset+a,n*r),o[t]=s),s}function getTypedArrayFromArray(e,t,i,r){var n=e._cachedTypedArrays,a=n[t];return defined(a)||(a=ComponentDatatype$1.createTypedArray(i,r),n[t]=a),a}function Vector3DTileBatch(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}Cesium3DTileBatchTable.prototype.addDerivedCommands=function(e,t){for(var i=e.commandList,r=i.length,n=this._content._tile,a=n._finalResolution,o=n.tileset,s=o._skipLevelOfDetail&&o._hasMixedContent&&e.context.stencilBuffer,l=getStyleCommandsNeeded(this),c=t;c<r;++c){var u=i[c],d=u.derivedCommands.tileset;defined(d)&&!u.dirty||(d={},(u.derivedCommands.tileset=d).originalCommand=deriveCommand(u),u.dirty=!1);var h=d.originalCommand;l!==StyleCommandsNeeded.ALL_OPAQUE&&u.pass!==Pass$1.TRANSLUCENT&&(defined(d.translucent)||(d.translucent=deriveTranslucentCommand$1(h))),l!==StyleCommandsNeeded.ALL_TRANSLUCENT&&u.pass!==Pass$1.TRANSLUCENT&&(defined(d.opaque)||(d.opaque=deriveOpaqueCommand(h)),s&&(a||(defined(d.zback)||(d.zback=deriveZBackfaceCommand(e.context,h)),o._backfaceCommands.push(d.zback)),defined(d.stencil)&&n._selectionDepth===getLastSelectionDepth(d.stencil)||(u.renderState.depthMask?d.stencil=deriveStencilCommand(h,n._selectionDepth):d.stencil=d.opaque)));var p=s?d.stencil:d.opaque,m=d.translucent;u.pass!==Pass$1.TRANSLUCENT?(l===StyleCommandsNeeded.ALL_OPAQUE&&(i[c]=p),l===StyleCommandsNeeded.ALL_TRANSLUCENT&&(i[c]=m),l===StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT&&(i[c]=p,i.push(m))):i[c]=h}},Cesium3DTileBatchTable.prototype.update=function(e,t){var i=t.context;this._defaultTexture=i.defaultTexture;var r=t.passes;(r.pick||r.postProcess)&&createPickTexture(this,i),this._batchValuesDirty&&(this._batchValuesDirty=!1,defined(this._batchTexture)||(this._batchTexture=createTexture$2(this,i,this._batchValues),e._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes),updateBatchTexture(this))},Cesium3DTileBatchTable.prototype.isDestroyed=function(){return!1},Cesium3DTileBatchTable.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();for(var e=this._pickIds,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)},defineProperties$1(Cesium3DTileFeature.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 defined(this._color)||(this._color=new Color),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}}),Cesium3DTileFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTileFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTileFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTileFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTileFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTileFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTileFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)},Cesium3DTileFeatureTable.prototype.getGlobalProperty=function(e,t,i){var r=this.json[e];if(defined(r))return defined(r.byteOffset)?getTypedArrayFromBinary(this,e,t=defaultValue(t,ComponentDatatype$1.UNSIGNED_INT),i=defaultValue(i,1),1,r.byteOffset):r},Cesium3DTileFeatureTable.prototype.getPropertyArray=function(e,t,i){var r=this.json[e];if(defined(r))return defined(r.byteOffset)?(defined(r.componentType)&&(t=ComponentDatatype$1.fromName(r.componentType)),getTypedArrayFromBinary(this,e,t,i,this.featuresLength,r.byteOffset)):getTypedArrayFromArray(this,e,t,r)},Cesium3DTileFeatureTable.prototype.getProperty=function(e,t,i,r,n){if(defined(this.json[e])){var a=this.getPropertyArray(e,t,i);if(1===i)return a[r];for(var o=0;o<i;++o)n[o]=a[i*r+o];return n}};var VectorTileVS="attribute vec3 position;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelViewProjection;\nvoid main()\n{\ngl_Position = czm_depthClampFarPlane(u_modifiedModelViewProjection * vec4(position, 1.0));\n}\n",tmp$5={},iLg,lLg,mLg,HLg,ILg,KLg,LLg,MLg;function FLg(e,t){var i=new Error(e+" at character "+t);throw i.index=t,i.description=e,i}function JLg(e){var t,i=0;for(var r in e)(t=r.length)>i&&e.hasOwnProperty(r)&&(i=t);return i}function OLg(e){return ILg[e]||0}function PLg(e,t,i){return{type:"||"===e||"&&"===e?"LogicalExpression":"BinaryExpression",operator:e,left:t,right:i}}function QLg(e){return 48<=e&&e<=57}function RLg(e){return 36===e||95===e||65<=e&&e<=90||97<=e&&e<=122||128<=e&&!ILg[String.fromCharCode(e)]}function TLg(n){for(var e,t,l=0,i=n.charAt,r=n.charCodeAt,a=function(e){return i.call(n,e)},o=function(e){return r.call(n,e)},s=n.length,c=function(){for(var e=o(l);32===e||9===e;)e=o(++l)},u=function(){var e,t,i=h();return c(),63!==o(l)?i:(l++,(e=u())||FLg("Expected expression",l),c(),58===o(l)?(l++,(t=u())||FLg("Expected expression",l),{type:"ConditionalExpression",test:i,consequent:e,alternate:t}):void FLg("Expected :",l))},d=function(){c();for(var e=n.substr(l,LLg),t=e.length;0<t;){if(ILg.hasOwnProperty(e))return l+=t,e;e=e.substr(0,--t)}return!1},h=function(){var e,t,i,r,n,a,o,s;if(a=p(),!(t=d()))return a;for(n={value:t,prec:OLg(t)},(o=p())||FLg("Expected expression after "+t,l),r=[a,n,o];(t=d())&&0!==(i=OLg(t));){for(n={value:t,prec:i};2<r.length&&i<=r[r.length-2].prec;)o=r.pop(),t=r.pop().value,a=r.pop(),e=PLg(t,a,o),r.push(e);(e=p())||FLg("Expected expression after "+t,l),r.push(n,e)}for(e=r[s=r.length-1];1<s;)e=PLg(r[s-1].value,r[s-2],e),s-=2;return e},p=function(){var e,t,i;if(c(),e=o(l),QLg(e)||46===e)return m();if(39===e||34===e)return f();if(RLg(e)||40===e)return y();if(91===e)return C();for(i=(t=n.substr(l,KLg)).length;0<i;){if(HLg.hasOwnProperty(t))return l+=i,{type:"UnaryExpression",operator:t,argument:p(),prefix:!0};t=t.substr(0,--i)}return!1},m=function(){for(var e,t,i="";QLg(o(l));)i+=a(l++);if(46===o(l))for(i+=a(l++);QLg(o(l));)i+=a(l++);if("e"===(e=a(l))||"E"===e){for(i+=a(l++),"+"!==(e=a(l))&&"-"!==e||(i+=a(l++));QLg(o(l));)i+=a(l++);QLg(o(l-1))||FLg("Expected exponent ("+i+a(l)+")",l)}return t=o(l),RLg(t)?FLg("Variable names cannot start with a number ("+i+a(l)+")",l):46===t&&FLg("Unexpected period",l),{type:mLg,value:parseFloat(i),raw:i}},f=function(){for(var e,t="",i=a(l++),r=!1;l<s;){if((e=a(l++))===i){r=!0;break}if("\\"===e)switch(e=a(l++)){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+="\\"+e}else t+=e}return r||FLg('Unclosed quote after "'+t+'"',l),{type:mLg,value:t,raw:i+t+i}},g=function(){var e,t,i=o(l),r=l;for(RLg(i)?l++:FLg("Unexpected "+a(l),l);l<s&&(i=o(l),36===(t=i)||95===t||65<=t&&t<=90||97<=t&&t<=122||48<=t&&t<=57||128<=t&&!ILg[String.fromCharCode(t)]);)l++;return e=n.slice(r,l),MLg.hasOwnProperty(e)?{type:mLg,value:MLg[e],raw:e}:"this"===e?{type:"ThisExpression"}:{type:"Identifier",name:e}},_=function(e){for(var t,i,r=[],n=!1;l<s;){if(c(),(t=o(l))===e){n=!0,l++;break}44===t?l++:((i=u())&&"Compound"!==i.type||FLg("Expected comma",l),r.push(i))}return n||FLg("Expected "+String.fromCharCode(e),l),r},y=function(){var e,t;for(t=40===(e=o(l))?v():g(),c(),e=o(l);46===e||91===e||40===e;)l++,46===e?(c(),t={type:lLg,computed:!1,object:t,property:g()}):91===e?(t={type:lLg,computed:!0,object:t,property:u()},c(),93!==(e=o(l))&&FLg("Unclosed [",l),l++):40===e&&(t={type:"CallExpression",arguments:_(41),callee:t}),c(),e=o(l);return t},v=function(){l++;var e=u();if(c(),41===o(l))return l++,e;FLg("Unclosed (",l)},C=function(){return l++,{type:"ArrayExpression",elements:_(93)}},S=[];l<s;)59===(e=o(l))||44===e?l++:(t=u())?S.push(t):l<s&&FLg('Unexpected "'+a(l)+'"',l);return 1===S.length?S[0]:{type:"Compound",body:S}}iLg=tmp$5,lLg="MemberExpression",mLg="Literal",HLg={"-":!0,"!":!0,"~":!0,"+":!0},ILg={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},KLg=JLg(HLg),LLg=JLg(ILg),MLg={true:!0,false:!1,null:null},TLg.version="0.3.1",TLg.toString=function(){return"JavaScript Expression Parser (JSEP) v"+TLg.version},TLg.addUnaryOp=function(e){return KLg=Math.max(e.length,KLg),HLg[e]=!0,this},TLg.addBinaryOp=function(e,t){return LLg=Math.max(e.length,LLg),ILg[e]=t,this},TLg.addLiteral=function(e,t){return MLg[e]=t,this},TLg.removeUnaryOp=function(e){return delete HLg[e],e.length===KLg&&(KLg=JLg(HLg)),this},TLg.removeAllUnaryOps=function(){return HLg={},KLg=0,this},TLg.removeBinaryOp=function(e){return delete ILg[e],e.length===LLg&&(LLg=JLg(ILg)),this},TLg.removeAllBinaryOps=function(){return ILg={},LLg=0,this},TLg.removeLiteral=function(e){return delete MLg[e],this},TLg.removeAllLiterals=function(){return MLg={},this},iLg.jsep=TLg;var jsep=tmp$5.jsep,ExpressionNodeType={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},ExpressionNodeType$1=freezeObject$1(ExpressionNodeType);function Expression(e,t){var i;e=replaceVariables(removeBackslashes(e=replaceDefines(this._expression=e,t))),jsep.addBinaryOp("=~",0),jsep.addBinaryOp("!~",0);try{i=jsep(e)}catch(e){throw new RuntimeError(e)}this._runtimeAst=createRuntimeAst(this,i)}defineProperties$1(Expression.prototype,{expression:{get:function(){return this._expression}}});var scratchStorage={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new Cartesian2],cartesian3Array:[new Cartesian3],cartesian4Array:[new Cartesian4],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);var e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new Cartesian2),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new Cartesian3),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new Cartesian4),this.cartesian4Array[this.cartesian4Index++]}};Expression.prototype.evaluate=function(e,t){scratchStorage.reset();var i=this._runtimeAst.evaluate(e);return t instanceof Color&&i instanceof Cartesian4?Color.fromCartesian4(i,t):i instanceof Cartesian2||i instanceof Cartesian3||i instanceof Cartesian4?i.clone(t):i},Expression.prototype.evaluateColor=function(e,t){scratchStorage.reset();var i=this._runtimeAst.evaluate(e);return Color.fromCartesian4(i,t)},Expression.prototype.getShaderFunction=function(e,t,i,r){var n=this.getShaderExpression(t,i);return n=r+" "+e+"() \n{ \n    return "+n+"; \n} \n"},Expression.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};var unaryOperators=["!","-","+"],binaryOperators=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],variableRegex=/\${(.*?)}/g,backslashRegex=/\\/g,backslashReplacement="@#%",replacementRegex=/@#%/g,scratchColor$d=new Color,unaryFunctions={abs:getEvaluateUnaryComponentwise(Math.abs),sqrt:getEvaluateUnaryComponentwise(Math.sqrt),cos:getEvaluateUnaryComponentwise(Math.cos),sin:getEvaluateUnaryComponentwise(Math.sin),tan:getEvaluateUnaryComponentwise(Math.tan),acos:getEvaluateUnaryComponentwise(Math.acos),asin:getEvaluateUnaryComponentwise(Math.asin),atan:getEvaluateUnaryComponentwise(Math.atan),radians:getEvaluateUnaryComponentwise(CesiumMath.toRadians),degrees:getEvaluateUnaryComponentwise(CesiumMath.toDegrees),sign:getEvaluateUnaryComponentwise(CesiumMath.sign),floor:getEvaluateUnaryComponentwise(Math.floor),ceil:getEvaluateUnaryComponentwise(Math.ceil),round:getEvaluateUnaryComponentwise(Math.round),exp:getEvaluateUnaryComponentwise(Math.exp),exp2:getEvaluateUnaryComponentwise(exp2),log:getEvaluateUnaryComponentwise(Math.log),log2:getEvaluateUnaryComponentwise(log2),fract:getEvaluateUnaryComponentwise(fract),length:length$1,normalize:normalize},binaryFunctions={atan2:getEvaluateBinaryComponentwise(Math.atan2,!1),pow:getEvaluateBinaryComponentwise(Math.pow,!1),min:getEvaluateBinaryComponentwise(Math.min,!0),max:getEvaluateBinaryComponentwise(Math.max,!0),distance:distance,dot:dot,cross:cross},ternaryFunctions={clamp:getEvaluateTernaryComponentwise(CesiumMath.clamp,!0),mix:getEvaluateTernaryComponentwise(CesiumMath.lerp,!0)};function fract(e){return e-Math.floor(e)}function exp2(e){return Math.pow(2,e)}function log2(e){return CesiumMath.log2(e)}function getEvaluateUnaryComponentwise(i){return function(e,t){if("number"==typeof t)return i(t);if(t instanceof Cartesian2)return Cartesian2.fromElements(i(t.x),i(t.y),scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.fromElements(i(t.x),i(t.y),i(t.z),scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.fromElements(i(t.x),i(t.y),i(t.z),i(t.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}}function getEvaluateBinaryComponentwise(r,n){return function(e,t,i){if(n&&"number"==typeof i){if("number"==typeof t)return r(t,i);if(t instanceof Cartesian2)return Cartesian2.fromElements(r(t.x,i),r(t.y,i),scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.fromElements(r(t.x,i),r(t.y,i),r(t.z,i),scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.fromElements(r(t.x,i),r(t.y,i),r(t.z,i),r(t.w,i),scratchStorage.getCartesian4())}if("number"==typeof t&&"number"==typeof i)return r(t,i);if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.fromElements(r(t.x,i.x),r(t.y,i.y),scratchStorage.getCartesian2());if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.fromElements(r(t.x,i.x),r(t.y,i.y),r(t.z,i.z),scratchStorage.getCartesian3());if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.fromElements(r(t.x,i.x),r(t.y,i.y),r(t.z,i.z),r(t.w,i.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")}}function getEvaluateTernaryComponentwise(n,a){return function(e,t,i,r){if(a&&"number"==typeof r){if("number"==typeof t&&"number"==typeof i)return n(t,i,r);if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.fromElements(n(t.x,i.x,r),n(t.y,i.y,r),scratchStorage.getCartesian2());if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.fromElements(n(t.x,i.x,r),n(t.y,i.y,r),n(t.z,i.z,r),scratchStorage.getCartesian3());if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.fromElements(n(t.x,i.x,r),n(t.y,i.y,r),n(t.z,i.z,r),n(t.w,i.w,r),scratchStorage.getCartesian4())}if("number"==typeof t&&"number"==typeof i&&"number"==typeof r)return n(t,i,r);if(t instanceof Cartesian2&&i instanceof Cartesian2&&r instanceof Cartesian2)return Cartesian2.fromElements(n(t.x,i.x,r.x),n(t.y,i.y,r.y),scratchStorage.getCartesian2());if(t instanceof Cartesian3&&i instanceof Cartesian3&&r instanceof Cartesian3)return Cartesian3.fromElements(n(t.x,i.x,r.x),n(t.y,i.y,r.y),n(t.z,i.z,r.z),scratchStorage.getCartesian3());if(t instanceof Cartesian4&&i instanceof Cartesian4&&r instanceof Cartesian4)return Cartesian4.fromElements(n(t.x,i.x,r.x),n(t.y,i.y,r.y),n(t.z,i.z,r.z),n(t.w,i.w,r.w),scratchStorage.getCartesian4());throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+", "+i+", and "+r+".")}}function length$1(e,t){if("number"==typeof t)return Math.abs(t);if(t instanceof Cartesian2)return Cartesian2.magnitude(t);if(t instanceof Cartesian3)return Cartesian3.magnitude(t);if(t instanceof Cartesian4)return Cartesian4.magnitude(t);throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}function normalize(e,t){if("number"==typeof t)return 1;if(t instanceof Cartesian2)return Cartesian2.normalize(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.normalize(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.normalize(t,scratchStorage.getCartesian4());throw new RuntimeError('Function "'+e+'" requires a vector or number argument. Argument is '+t+".")}function distance(e,t,i){if("number"==typeof t&&"number"==typeof i)return Math.abs(t-i);if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.distance(t,i);if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.distance(t,i);if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.distance(t,i);throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")}function dot(e,t,i){if("number"==typeof t&&"number"==typeof i)return t*i;if(t instanceof Cartesian2&&i instanceof Cartesian2)return Cartesian2.dot(t,i);if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.dot(t,i);if(t instanceof Cartesian4&&i instanceof Cartesian4)return Cartesian4.dot(t,i);throw new RuntimeError('Function "'+e+'" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")}function cross(e,t,i){if(t instanceof Cartesian3&&i instanceof Cartesian3)return Cartesian3.cross(t,i,scratchStorage.getCartesian3());throw new RuntimeError('Function "'+e+'" requires vec3 arguments. Arguments are '+t+" and "+i+".")}function Node$2(e,t,i,r,n){this._type=e,this._value=t,this._left=i,this._right=r,this._test=n,this.evaluate=void 0,setEvaluateFunction(this)}function replaceDefines(e,t){if(!defined(t))return e;for(var i in t)if(t.hasOwnProperty(i)){var r=new RegExp("\\$\\{"+i+"\\}","g"),n="("+t[i]+")";defined(n)&&(e=e.replace(r,n))}return e}function removeBackslashes(e){return e.replace(backslashRegex,backslashReplacement)}function replaceBackslashes(e){return e.replace(replacementRegex,"\\")}function replaceVariables(e){for(var t=e,i="",r=t.indexOf("${");0<=r;){var n,a=t.indexOf("'"),o=t.indexOf('"');if(0<=a&&a<r)n=t.indexOf("'",a+1),i+=t.substr(0,n+1),r=(t=t.substr(n+1)).indexOf("${");else if(0<=o&&o<r)n=t.indexOf('"',o+1),i+=t.substr(0,n+1),r=(t=t.substr(n+1)).indexOf("${");else{i+=t.substr(0,r);var s=t.indexOf("}");if(s<0)throw new RuntimeError("Unmatched {.");i+="czm_"+t.substr(r+2,s-(r+2)),r=(t=t.substr(s+1)).indexOf("${")}}return i+=t}function parseLiteral(e){var t=typeof e.value;return null===e.value?new Node$2(ExpressionNodeType$1.LITERAL_NULL,null):"boolean"==t?new Node$2(ExpressionNodeType$1.LITERAL_BOOLEAN,e.value):"number"==t?new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,e.value):"string"==t?0<=e.value.indexOf("${")?new Node$2(ExpressionNodeType$1.VARIABLE_IN_STRING,e.value):new Node$2(ExpressionNodeType$1.LITERAL_STRING,replaceBackslashes(e.value)):void 0}function parseCall(e,t){var i,r,n,a,o=t.arguments,s=o.length;if("MemberExpression"===t.callee.type){i=t.callee.property.name;var l=t.callee.object;if("test"===i||"exec"===i){if("regExp"!==l.callee.name)throw new RuntimeError(i+" is not a function.");return 0===s?"test"===i?new Node$2(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):new Node$2(ExpressionNodeType$1.LITERAL_NULL,null):(n=createRuntimeAst(e,l),a=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.FUNCTION_CALL,i,n,a))}if("toString"===i)return r=createRuntimeAst(e,l),new Node$2(ExpressionNodeType$1.FUNCTION_CALL,i,r);throw new RuntimeError('Unexpected function call "'+i+'".')}if("color"===(i=t.callee.name)){if(0===s)return new Node$2(ExpressionNodeType$1.LITERAL_COLOR,i);if(r=createRuntimeAst(e,o[0]),defined(o[1])){var c=createRuntimeAst(e,o[1]);return new Node$2(ExpressionNodeType$1.LITERAL_COLOR,i,[r,c])}return new Node$2(ExpressionNodeType$1.LITERAL_COLOR,i,[r])}if("rgb"===i||"hsl"===i){if(s<3)throw new RuntimeError(i+" requires three arguments.");return r=[createRuntimeAst(e,o[0]),createRuntimeAst(e,o[1]),createRuntimeAst(e,o[2])],new Node$2(ExpressionNodeType$1.LITERAL_COLOR,i,r)}if("rgba"===i||"hsla"===i){if(s<4)throw new RuntimeError(i+" requires four arguments.");return r=[createRuntimeAst(e,o[0]),createRuntimeAst(e,o[1]),createRuntimeAst(e,o[2]),createRuntimeAst(e,o[3])],new Node$2(ExpressionNodeType$1.LITERAL_COLOR,i,r)}if("vec2"===i||"vec3"===i||"vec4"===i){r=new Array(s);for(var u=0;u<s;++u)r[u]=createRuntimeAst(e,o[u]);return new Node$2(ExpressionNodeType$1.LITERAL_VECTOR,i,r)}if("isNaN"===i||"isFinite"===i)return 0===s?new Node$2(ExpressionNodeType$1.LITERAL_BOOLEAN,"isNaN"===i):(r=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.UNARY,i,r));if("isExactClass"===i||"isClass"===i){if(s<1||1<s)throw new RuntimeError(i+" requires exactly one argument.");return r=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.UNARY,i,r)}if("getExactClassName"===i){if(0<s)throw new RuntimeError(i+" does not take any argument.");return new Node$2(ExpressionNodeType$1.UNARY,i)}if(defined(unaryFunctions[i])){if(1!==s)throw new RuntimeError(i+" requires exactly one argument.");return r=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.UNARY,i,r)}if(defined(binaryFunctions[i])){if(2!==s)throw new RuntimeError(i+" requires exactly two arguments.");return n=createRuntimeAst(e,o[0]),a=createRuntimeAst(e,o[1]),new Node$2(ExpressionNodeType$1.BINARY,i,n,a)}if(defined(ternaryFunctions[i])){if(3!==s)throw new RuntimeError(i+" requires exactly three arguments.");n=createRuntimeAst(e,o[0]),a=createRuntimeAst(e,o[1]);var d=createRuntimeAst(e,o[2]);return new Node$2(ExpressionNodeType$1.TERNARY,i,n,a,d)}if("Boolean"===i)return 0===s?new Node$2(ExpressionNodeType$1.LITERAL_BOOLEAN,!1):(r=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.UNARY,i,r));if("Number"===i)return 0===s?new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,0):(r=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.UNARY,i,r));if("String"===i)return 0===s?new Node$2(ExpressionNodeType$1.LITERAL_STRING,""):(r=createRuntimeAst(e,o[0]),new Node$2(ExpressionNodeType$1.UNARY,i,r));if("regExp"===i)return parseRegex$1(e,t);throw new RuntimeError('Unexpected function call "'+i+'".')}function parseRegex$1(e,t){var i=t.arguments;if(0===i.length)return new Node$2(ExpressionNodeType$1.LITERAL_REGEX,new RegExp);var r,n=createRuntimeAst(e,i[0]);if(1<i.length){var a=createRuntimeAst(e,i[1]);if(isLiteralType(n)&&isLiteralType(a)){try{r=new RegExp(replaceBackslashes(String(n._value)),a._value)}catch(e){throw new RuntimeError(e)}return new Node$2(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$2(ExpressionNodeType$1.REGEX,n,a)}if(isLiteralType(n)){try{r=new RegExp(replaceBackslashes(String(n._value)))}catch(e){throw new RuntimeError(e)}return new Node$2(ExpressionNodeType$1.LITERAL_REGEX,r)}return new Node$2(ExpressionNodeType$1.REGEX,n)}function parseKeywordsAndVariables(e){if(isVariable(e.name)){var t=getPropertyName(e.name);return"tiles3d_"===t.substr(0,8)?new Node$2(ExpressionNodeType$1.BUILTIN_VARIABLE,t):new Node$2(ExpressionNodeType$1.VARIABLE,t)}if("NaN"===e.name)return new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,NaN);if("Infinity"===e.name)return new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,1/0);if("undefined"===e.name)return new Node$2(ExpressionNodeType$1.LITERAL_UNDEFINED,void 0);throw new RuntimeError(e.name+" is not defined.")}function parseMathConstant(e){var t=e.property.name;return"PI"===t?new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,Math.PI):"E"===t?new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,Math.E):void 0}function parseNumberConstant(e){if("POSITIVE_INFINITY"===e.property.name)return new Node$2(ExpressionNodeType$1.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function parseMemberExpression(e,t){if("Math"===t.object.name)return parseMathConstant(t);if("Number"===t.object.name)return parseNumberConstant(t);var i,r=createRuntimeAst(e,t.object);return t.computed?(i=createRuntimeAst(e,t.property),new Node$2(ExpressionNodeType$1.MEMBER,"brackets",r,i)):(i=new Node$2(ExpressionNodeType$1.LITERAL_STRING,t.property.name),new Node$2(ExpressionNodeType$1.MEMBER,"dot",r,i))}function isLiteralType(e){return e._type>=ExpressionNodeType$1.LITERAL_NULL}function isVariable(e){return"czm_"===e.substr(0,4)}function getPropertyName(e){return e.substr(4)}function createRuntimeAst(e,t){var i,r,n,a;if("Literal"===t.type)i=parseLiteral(t);else if("CallExpression"===t.type)i=parseCall(e,t);else if("Identifier"===t.type)i=parseKeywordsAndVariables(t);else if("UnaryExpression"===t.type){r=t.operator;var o=createRuntimeAst(e,t.argument);if(!(-1<unaryOperators.indexOf(r)))throw new RuntimeError('Unexpected operator "'+r+'".');i=new Node$2(ExpressionNodeType$1.UNARY,r,o)}else if("BinaryExpression"===t.type){if(r=t.operator,n=createRuntimeAst(e,t.left),a=createRuntimeAst(e,t.right),!(-1<binaryOperators.indexOf(r)))throw new RuntimeError('Unexpected operator "'+r+'".');i=new Node$2(ExpressionNodeType$1.BINARY,r,n,a)}else if("LogicalExpression"===t.type)r=t.operator,n=createRuntimeAst(e,t.left),a=createRuntimeAst(e,t.right),-1<binaryOperators.indexOf(r)&&(i=new Node$2(ExpressionNodeType$1.BINARY,r,n,a));else if("ConditionalExpression"===t.type){var s=createRuntimeAst(e,t.test);n=createRuntimeAst(e,t.consequent),a=createRuntimeAst(e,t.alternate),i=new Node$2(ExpressionNodeType$1.CONDITIONAL,"?",n,a,s)}else if("MemberExpression"===t.type)i=parseMemberExpression(e,t);else{if("ArrayExpression"!==t.type)throw"Compound"===t.type?new RuntimeError("Provide exactly one expression."):new RuntimeError("Cannot parse expression.");for(var l=[],c=0;c<t.elements.length;c++)l[c]=createRuntimeAst(e,t.elements[c]);i=new Node$2(ExpressionNodeType$1.ARRAY,l)}return i}function setEvaluateFunction(e){e._type===ExpressionNodeType$1.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===ExpressionNodeType$1.FUNCTION_CALL?"test"===e._value?e.evaluate=e._evaluateRegExpTest:"exec"===e._value?e.evaluate=e._evaluateRegExpExec:"toString"===e._value&&(e.evaluate=e._evaluateToString):e._type===ExpressionNodeType$1.UNARY?"!"===e._value?e.evaluate=e._evaluateNot:"-"===e._value?e.evaluate=e._evaluateNegative:"+"===e._value?e.evaluate=e._evaluatePositive:"isNaN"===e._value?e.evaluate=e._evaluateNaN:"isFinite"===e._value?e.evaluate=e._evaluateIsFinite:"isExactClass"===e._value?e.evaluate=e._evaluateIsExactClass:"isClass"===e._value?e.evaluate=e._evaluateIsClass:"getExactClassName"===e._value?e.evaluate=e._evaluateGetExactClassName:"Boolean"===e._value?e.evaluate=e._evaluateBooleanConversion:"Number"===e._value?e.evaluate=e._evaluateNumberConversion:"String"===e._value?e.evaluate=e._evaluateStringConversion:defined(unaryFunctions[e._value])&&(e.evaluate=getEvaluateUnaryFunction(e._value)):e._type===ExpressionNodeType$1.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:defined(binaryFunctions[e._value])&&(e.evaluate=getEvaluateBinaryFunction(e._value)):e._type===ExpressionNodeType$1.TERNARY?e.evaluate=getEvaluateTernaryFunction(e._value):e._type===ExpressionNodeType$1.MEMBER?"brackets"===e._value?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===ExpressionNodeType$1.ARRAY?e.evaluate=e._evaluateArray:e._type===ExpressionNodeType$1.VARIABLE?e.evaluate=e._evaluateVariable:e._type===ExpressionNodeType$1.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===ExpressionNodeType$1.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===ExpressionNodeType$1.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===ExpressionNodeType$1.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===ExpressionNodeType$1.REGEX?e.evaluate=e._evaluateRegExp:e._type===ExpressionNodeType$1.BUILTIN_VARIABLE?"tiles3d_tileset_time"===e._value&&(e.evaluate=evaluateTilesetTime):e.evaluate=e._evaluateLiteral}function evaluateTilesetTime(e){return defined(e)?e.content.tileset.timeSinceLoad:0}function getEvaluateUnaryFunction(i){var r=unaryFunctions[i];return function(e){var t=this._left.evaluate(e);return r(i,t)}}function getEvaluateBinaryFunction(r){var n=binaryFunctions[r];return function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);return n(r,t,i)}}function getEvaluateTernaryFunction(n){var a=ternaryFunctions[n];return function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e),r=this._test.evaluate(e);return a(n,t,i,r)}}function getFeatureProperty(e,t){if(defined(e))return e.getProperty(t)}function checkFeature(e){return"feature"===e._value}function convertHSLToRGB(e){for(var t=e._left,i=t.length,r=0;r<i;++r)if(t[r]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;var n=t[0]._value,a=t[1]._value,o=t[2]._value,s=4===i?t[3]._value:1;return Color.fromHsl(n,a,o,s,scratchColor$d)}function convertRGBToColor(e){for(var t=e._left,i=t.length,r=0;r<i;++r)if(t[r]._type!==ExpressionNodeType$1.LITERAL_NUMBER)return;var n=scratchColor$d;return n.red=t[0]._value/255,n.green=t[1]._value/255,n.blue=t[2]._value/255,n.alpha=4===i?t[3]._value:1,n}function numberToString(e){return e%1==0?e.toFixed(1):e.toString()}function colorToVec3(e){return"vec3("+numberToString(e.red)+", "+numberToString(e.green)+", "+numberToString(e.blue)+")"}function colorToVec4(e){return"vec4("+numberToString(e.red)+", "+numberToString(e.green)+", "+numberToString(e.blue)+", "+numberToString(e.alpha)+")"}function getExpressionArray(e,t,i,r){for(var n=e.length,a=new Array(n),o=0;o<n;++o)a[o]=e[o].getShaderExpression(t,i,r);return a}function Vector3DTilePrimitive(e){e=defaultValue(e,defaultValue.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=defaultValue(e.center,Cartesian3.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._rsStencilPreloadPass=void 0,this._rsStencilPreloadPass3DTiles=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=Color.clone(Color.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=defaultValue(e.classificationType,ClassificationType$1.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={};for(var t=this._batchIds.length,i=0;i<t;++i){var r=this._batchIds[i];this._batchIdLookUp[r]=i}}Node$2.prototype._evaluateLiteral=function(){return this._value},Node$2.prototype._evaluateLiteralColor=function(e){var t=scratchColor$d,i=this._left;if("color"===this._value)defined(i)?1<i.length?(Color.fromCssColorString(i[0].evaluate(e),t),t.alpha=i[1].evaluate(e)):Color.fromCssColorString(i[0].evaluate(e),t):Color.fromBytes(255,255,255,255,t);else if("rgb"===this._value)Color.fromBytes(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),255,t);else if("rgba"===this._value){var r=255*i[3].evaluate(e);Color.fromBytes(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),r,t)}else"hsl"===this._value?Color.fromHsl(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),1,t):"hsla"===this._value&&Color.fromHsl(i[0].evaluate(e),i[1].evaluate(e),i[2].evaluate(e),i[3].evaluate(e),t);return Cartesian4.fromColor(t,scratchStorage.getCartesian4())},Node$2.prototype._evaluateLiteralVector=function(e){for(var t=scratchStorage.getArray(),i=this._value,r=this._left,n=r.length,a=0;a<n;++a){var o=r[a].evaluate(e);if("number"==typeof o)t.push(o);else if(o instanceof Cartesian2)t.push(o.x,o.y);else if(o instanceof Cartesian3)t.push(o.x,o.y,o.z);else{if(!(o instanceof Cartesian4))throw new RuntimeError(i+" argument must be a vector or number. Argument is "+o+".");t.push(o.x,o.y,o.z,o.w)}}var s=t.length,l=parseInt(i.charAt(3));if(0===s)throw new RuntimeError("Invalid "+i+" constructor. No valid arguments.");if(s<l&&1<s)throw new RuntimeError("Invalid "+i+" constructor. Not enough arguments.");if(l<s&&1<n)throw new RuntimeError("Invalid "+i+" constructor. Too many arguments.");if(1===s){var c=t[0];t.push(c,c,c)}return"vec2"===i?Cartesian2.fromArray(t,0,scratchStorage.getCartesian2()):"vec3"===i?Cartesian3.fromArray(t,0,scratchStorage.getCartesian3()):"vec4"===i?Cartesian4.fromArray(t,0,scratchStorage.getCartesian4()):void 0},Node$2.prototype._evaluateLiteralString=function(){return this._value},Node$2.prototype._evaluateVariableString=function(e){for(var t=this._value,i=variableRegex.exec(t);null!==i;){var r=i[0],n=getFeatureProperty(e,i[1]);defined(n)||(n=""),t=t.replace(r,n),i=variableRegex.exec(t)}return t},Node$2.prototype._evaluateVariable=function(e){return getFeatureProperty(e,this._value)},Node$2.prototype._evaluateMemberDot=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));var t=this._left.evaluate(e);if(defined(t)){var i=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if("r"===i)return t.x;if("g"===i)return t.y;if("b"===i)return t.z;if("a"===i)return t.w}return t[i]}},Node$2.prototype._evaluateMemberBrackets=function(e){if(checkFeature(this._left))return getFeatureProperty(e,this._right.evaluate(e));var t=this._left.evaluate(e);if(defined(t)){var i=this._right.evaluate(e);if(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4){if(0===i||"r"===i)return t.x;if(1===i||"g"===i)return t.y;if(2===i||"b"===i)return t.z;if(3===i||"a"===i)return t.w}return t[i]}},Node$2.prototype._evaluateArray=function(e){for(var t=[],i=0;i<this._value.length;i++)t[i]=this._value[i].evaluate(e);return t},Node$2.prototype._evaluateNot=function(e){var t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "!" requires a boolean argument. Argument is '+t+".");return!t},Node$2.prototype._evaluateNegative=function(e){var t=this._left.evaluate(e);if(t instanceof Cartesian2)return Cartesian2.negate(t,scratchStorage.getCartesian2());if(t instanceof Cartesian3)return Cartesian3.negate(t,scratchStorage.getCartesian3());if(t instanceof Cartesian4)return Cartesian4.negate(t,scratchStorage.getCartesian4());if("number"==typeof t)return-t;throw new RuntimeError('Operator "-" requires a vector or number argument. Argument is '+t+".")},Node$2.prototype._evaluatePositive=function(e){var t=this._left.evaluate(e);if(!(t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4||"number"==typeof t))throw new RuntimeError('Operator "+" requires a vector or number argument. Argument is '+t+".");return t},Node$2.prototype._evaluateLessThan=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator "<" requires number arguments. Arguments are '+t+" and "+i+".");return t<i},Node$2.prototype._evaluateLessThanOrEquals=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator "<=" requires number arguments. Arguments are '+t+" and "+i+".");return t<=i},Node$2.prototype._evaluateGreaterThan=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator ">" requires number arguments. Arguments are '+t+" and "+i+".");return i<t},Node$2.prototype._evaluateGreaterThanOrEquals=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof i)throw new RuntimeError('Operator ">=" requires number arguments. Arguments are '+t+" and "+i+".");return i<=t},Node$2.prototype._evaluateOr=function(e){var t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "||" requires boolean arguments. First argument is '+t+".");if(t)return!0;var i=this._right.evaluate(e);if("boolean"!=typeof i)throw new RuntimeError('Operator "||" requires boolean arguments. Second argument is '+i+".");return t||i},Node$2.prototype._evaluateAnd=function(e){var t=this._left.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError('Operator "&&" requires boolean arguments. First argument is '+t+".");if(!t)return!1;var i=this._right.evaluate(e);if("boolean"!=typeof i)throw new RuntimeError('Operator "&&" requires boolean arguments. Second argument is '+i+".");return t&&i},Node$2.prototype._evaluatePlus=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.add(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.add(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.add(t,i,scratchStorage.getCartesian4());if("string"==typeof t||"string"==typeof i)return t+i;if("number"==typeof t&&"number"==typeof i)return t+i;throw new RuntimeError('Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateMinus=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.subtract(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.subtract(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.subtract(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t-i;throw new RuntimeError('Operator "-" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateTimes=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.multiplyComponents(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian2&&"number"==typeof t)return Cartesian2.multiplyByScalar(i,t,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof i)return Cartesian2.multiplyByScalar(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.multiplyComponents(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian3&&"number"==typeof t)return Cartesian3.multiplyByScalar(i,t,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof i)return Cartesian3.multiplyByScalar(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.multiplyComponents(t,i,scratchStorage.getCartesian4());if(i instanceof Cartesian4&&"number"==typeof t)return Cartesian4.multiplyByScalar(i,t,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof i)return Cartesian4.multiplyByScalar(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t*i;throw new RuntimeError('Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateDivide=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.divideComponents(t,i,scratchStorage.getCartesian2());if(t instanceof Cartesian2&&"number"==typeof i)return Cartesian2.divideByScalar(t,i,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.divideComponents(t,i,scratchStorage.getCartesian3());if(t instanceof Cartesian3&&"number"==typeof i)return Cartesian3.divideByScalar(t,i,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.divideComponents(t,i,scratchStorage.getCartesian4());if(t instanceof Cartesian4&&"number"==typeof i)return Cartesian4.divideByScalar(t,i,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t/i;throw new RuntimeError('Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateMod=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(i instanceof Cartesian2&&t instanceof Cartesian2)return Cartesian2.fromElements(t.x%i.x,t.y%i.y,scratchStorage.getCartesian2());if(i instanceof Cartesian3&&t instanceof Cartesian3)return Cartesian3.fromElements(t.x%i.x,t.y%i.y,t.z%i.z,scratchStorage.getCartesian3());if(i instanceof Cartesian4&&t instanceof Cartesian4)return Cartesian4.fromElements(t.x%i.x,t.y%i.y,t.z%i.z,t.w%i.w,scratchStorage.getCartesian4());if("number"==typeof t&&"number"==typeof i)return t%i;throw new RuntimeError('Operator "%" requires vector or number arguments of matching types. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateEqualsStrict=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);return i instanceof Cartesian2&&t instanceof Cartesian2||i instanceof Cartesian3&&t instanceof Cartesian3||i instanceof Cartesian4&&t instanceof Cartesian4?t.equals(i):t===i},Node$2.prototype._evaluateNotEqualsStrict=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);return i instanceof Cartesian2&&t instanceof Cartesian2||i instanceof Cartesian3&&t instanceof Cartesian3||i instanceof Cartesian4&&t instanceof Cartesian4?!t.equals(i):t!==i},Node$2.prototype._evaluateConditional=function(e){var t=this._test.evaluate(e);if("boolean"!=typeof t)throw new RuntimeError("Conditional argument of conditional expression must be a boolean. Argument is "+t+".");return t?this._left.evaluate(e):this._right.evaluate(e)},Node$2.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))},Node$2.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))},Node$2.prototype._evaluateIsExactClass=function(e){return!!defined(e)&&e.isExactClass(this._left.evaluate(e))},Node$2.prototype._evaluateIsClass=function(e){return!!defined(e)&&e.isClass(this._left.evaluate(e))},Node$2.prototype._evaluateGetExactClassName=function(e){if(defined(e))return e.getExactClassName()},Node$2.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))},Node$2.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))},Node$2.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))},Node$2.prototype._evaluateRegExp=function(e){var t,i=this._value.evaluate(e),r="";defined(this._left)&&(r=this._left.evaluate(e));try{t=new RegExp(i,r)}catch(e){throw new RuntimeError(e)}return t},Node$2.prototype._evaluateRegExpTest=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof i))throw new RuntimeError("RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are "+t+" and "+i+".");return t.test(i)},Node$2.prototype._evaluateRegExpMatch=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof i)return t.test(i);if(i instanceof RegExp&&"string"==typeof t)return i.test(t);throw new RuntimeError('Operator "=~" requires one RegExp argument and one string argument. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateRegExpNotMatch=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof i)return!t.test(i);if(i instanceof RegExp&&"string"==typeof t)return!i.test(t);throw new RuntimeError('Operator "!~" requires one RegExp argument and one string argument. Arguments are '+t+" and "+i+".")},Node$2.prototype._evaluateRegExpExec=function(e){var t=this._left.evaluate(e),i=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof i))throw new RuntimeError("RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are "+t+" and "+i+".");var r=t.exec(i);return defined(r)?r[1]:null},Node$2.prototype._evaluateToString=function(e){var t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof Cartesian2||t instanceof Cartesian3||t instanceof Cartesian4)return String(t);throw new RuntimeError('Unexpected function call "'+this._value+'".')},Node$2.prototype.getShaderExpression=function(e,t,i){var r,n,a,o,s=this._type,l=this._value;switch(defined(this._left)&&(n=isArray$1(this._left)?getExpressionArray(this._left,e,t,this):this._left.getShaderExpression(e,t,this)),defined(this._right)&&(a=this._right.getShaderExpression(e,t,this)),defined(this._test)&&(o=this._test.getShaderExpression(e,t,this)),isArray$1(this._value)&&(l=getExpressionArray(this._value,e,t,this)),s){case ExpressionNodeType$1.VARIABLE:return e+l;case ExpressionNodeType$1.UNARY:if("Boolean"===l)return"bool("+n+")";if("Number"===l)return"float("+n+")";if("round"===l)return"floor("+n+" + 0.5)";if(defined(unaryFunctions[l]))return l+"("+n+")";if("isNaN"===l||"isFinite"===l||"String"===l||"isExactClass"===l||"isClass"===l||"getExactClassName"===l)throw new RuntimeError('Error generating style shader: "'+l+'" is not supported.');return defined(unaryFunctions[l])?l+"("+n+")":l+n;case ExpressionNodeType$1.BINARY:return"%"===l?"mod("+n+", "+a+")":"==="===l?"("+n+" == "+a+")":"!=="===l?"("+n+" != "+a+")":"atan2"===l?"atan("+n+", "+a+")":defined(binaryFunctions[l])?l+"("+n+", "+a+")":"("+n+" "+l+" "+a+")";case ExpressionNodeType$1.TERNARY:if(defined(ternaryFunctions[l]))return l+"("+n+", "+a+", "+o+")";break;case ExpressionNodeType$1.CONDITIONAL:return"("+o+" ? "+n+" : "+a+")";case ExpressionNodeType$1.MEMBER:return"r"===a||"x"===a||"0.0"===a?n+"[0]":"g"===a||"y"===a||"1.0"===a?n+"[1]":"b"===a||"z"===a||"2.0"===a?n+"[2]":"a"===a||"w"===a||"3.0"===a?n+"[3]":n+"[int("+a+")]";case ExpressionNodeType$1.FUNCTION_CALL:throw new RuntimeError('Error generating style shader: "'+l+'" is not supported.');case ExpressionNodeType$1.ARRAY:if(4===l.length)return"vec4("+l[0]+", "+l[1]+", "+l[2]+", "+l[3]+")";if(3===l.length)return"vec3("+l[0]+", "+l[1]+", "+l[2]+")";if(2===l.length)return"vec2("+l[0]+", "+l[1]+")";throw new RuntimeError("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case ExpressionNodeType$1.REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.VARIABLE_IN_STRING:throw new RuntimeError("Error generating style shader: Converting a variable to a string is not supported.");case ExpressionNodeType$1.LITERAL_NULL:throw new RuntimeError("Error generating style shader: null is not supported.");case ExpressionNodeType$1.LITERAL_BOOLEAN:return l?"true":"false";case ExpressionNodeType$1.LITERAL_NUMBER:return numberToString(l);case ExpressionNodeType$1.LITERAL_STRING:if(defined(i)&&i._type===ExpressionNodeType$1.MEMBER&&("r"===l||"g"===l||"b"===l||"a"===l||"x"===l||"y"===l||"z"===l||"w"===l))return l;if(defined(r=Color.fromCssColorString(l,scratchColor$d)))return colorToVec3(r);throw new RuntimeError("Error generating style shader: String literals are not supported.");case ExpressionNodeType$1.LITERAL_COLOR:var c=n;if("color"===l){if(!defined(c))return"vec4(1.0)";if(1<c.length){var u=c[0],d=c[1];return"1.0"!==d&&(t.translucent=!0),"vec4("+u+", "+d+")"}return"vec4("+c[0]+", 1.0)"}if("rgb"===l)return defined(r=convertRGBToColor(this))?colorToVec4(r):"vec4("+c[0]+" / 255.0, "+c[1]+" / 255.0, "+c[2]+" / 255.0, 1.0)";if("rgba"===l)return"1.0"!==c[3]&&(t.translucent=!0),defined(r=convertRGBToColor(this))?colorToVec4(r):"vec4("+c[0]+" / 255.0, "+c[1]+" / 255.0, "+c[2]+" / 255.0, "+c[3]+")";if("hsl"===l)return defined(r=convertHSLToRGB(this))?colorToVec4(r):"vec4(czm_HSLToRGB(vec3("+c[0]+", "+c[1]+", "+c[2]+")), 1.0)";if("hsla"===l)return defined(r=convertHSLToRGB(this))?(1!==r.alpha&&(t.translucent=!0),colorToVec4(r)):("1.0"!==c[3]&&(t.translucent=!0),"vec4(czm_HSLToRGB(vec3("+c[0]+", "+c[1]+", "+c[2]+")), "+c[3]+")");break;case ExpressionNodeType$1.LITERAL_VECTOR:for(var h=n.length,p=l+"(",m=0;m<h;++m)p+=n[m],m<h-1&&(p+=", ");return p+=")";case ExpressionNodeType$1.LITERAL_REGEX:throw new RuntimeError("Error generating style shader: Regular expressions are not supported.");case ExpressionNodeType$1.LITERAL_UNDEFINED:throw new RuntimeError("Error generating style shader: undefined is not supported.");case ExpressionNodeType$1.BUILTIN_VARIABLE:if("tiles3d_tileset_time"===l)return"u_time"}},defineProperties$1(Vector3DTilePrimitive.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});var defaultAttributeLocations={position:0,a_batchId:1};function createVertexArray$2(e,t){if(!defined(e._va)){var i=Buffer$1.createVertexBuffer({context:t,typedArray:e._positions,usage:BufferUsage$1.STATIC_DRAW}),r=Buffer$1.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:BufferUsage$1.STATIC_DRAW}),n=Buffer$1.createIndexBuffer({context:t,typedArray:e._indices,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:2===e._indices.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),a=[{index:0,vertexBuffer:i,componentDatatype:ComponentDatatype$1.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:r,componentDatatype:ComponentDatatype$1.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new VertexArray({context:t,attributes:a,indexBuffer:n}),t.webgl2&&(e._vaSwap=new VertexArray({context:t,attributes:a,indexBuffer:Buffer$1.createIndexBuffer({context:t,sizeInBytes:n.sizeInBytes,usage:BufferUsage$1.DYNAMIC_DRAW,indexDatatype:n.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}}function createShaders(e,t){if(!defined(e._sp)){var i=e._batchTable,r=defaultValue(e._attributeLocations,defaultAttributeLocations),n=e._pickId,a=e._vertexShaderSource,o=e._fragmentShaderSource;if(defined(a))return e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:r}),e._spStencil=e._sp,o=(o=ShaderSource.replaceMain(o,"czm_non_pick_main"))+"void main() \n{ \n    czm_non_pick_main(); \n    gl_FragColor = "+n+"; \n} \n",void(e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:r}));var s=i.getVertexShaderCallback(!1,"a_batchId",void 0)(VectorTileVS),l=i.getFragmentShaderCallback()(ShadowVolumeFS,!1,void 0);n=i.getPickId();var c=new ShaderSource({sources:[s]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[l]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:r}),c=new ShaderSource({sources:[VectorTileVS]}),u=new ShaderSource({defines:["VECTOR_TILE"],sources:[ShadowVolumeFS]}),e._spStencil=ShaderProgram.fromCache({context:t,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:r}),l=(l=ShaderSource.replaceMain(l,"czm_non_pick_main"))+"\nvoid main() \n{ \n    czm_non_pick_main(); \n    gl_FragColor = "+n+"; \n} \n";var d=new ShaderSource({sources:[s]}),h=new ShaderSource({defines:["VECTOR_TILE"],sources:[l]});e._spPick=ShaderProgram.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:r})}}function getStencilPreloadRenderState$1(e){var t=e?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.DECREMENT_WRAP,zPass:StencilOperation$1.DECREMENT_WRAP},backFunction:t,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.INCREMENT_WRAP,zPass:StencilOperation$1.INCREMENT_WRAP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1}}function getStencilDepthRenderState$1(e){var t=e?StencilFunction$1.EQUAL:StencilFunction$1.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.INCREMENT_WRAP},backFunction:t,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},depthMask:!1}}var colorRenderState={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND},pickRenderState$1={stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},backFunction:StencilFunction$1.NOT_EQUAL,backOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.DECREMENT_WRAP},reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},stencilMask:StencilConstants$1.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function createRenderStates$3(e){defined(e._rsStencilPreloadPass)||(e._rsStencilPreloadPass=RenderState.fromCache(getStencilPreloadRenderState$1(!1)),e._rsStencilPreloadPass3DTiles=RenderState.fromCache(getStencilPreloadRenderState$1(!0)),e._rsStencilDepthPass=RenderState.fromCache(getStencilDepthRenderState$1(!1)),e._rsStencilDepthPass3DTiles=RenderState.fromCache(getStencilDepthRenderState$1(!0)),e._rsColorPass=RenderState.fromCache(colorRenderState),e._rsPickPass=RenderState.fromCache(pickRenderState$1))}var modifiedModelViewScratch$1=new Matrix4,rtcScratch$1=new Cartesian3;function createUniformMap$1(i,r){if(!defined(i._uniformMap)){var e={u_modifiedModelViewProjection:function(){var e=r.uniformState.view,t=r.uniformState.projection;return Matrix4.clone(e,modifiedModelViewScratch$1),Matrix4.multiplyByPoint(modifiedModelViewScratch$1,i._center,rtcScratch$1),Matrix4.setTranslation(modifiedModelViewScratch$1,rtcScratch$1,modifiedModelViewScratch$1),Matrix4.multiply(t,modifiedModelViewScratch$1,modifiedModelViewScratch$1),modifiedModelViewScratch$1},u_highlightColor:function(){return i._highlightColor}};i._uniformMap=i._batchTable.getUniformMapCallback()(e)}}function copyIndicesCPU(e,t,i,r,n,a,o){for(var s=e.constructor.BYTES_PER_ELEMENT,l=a.length,c=0;c<l;++c){var u=o[a[c]],d=r[u],h=n[u],p=new e.constructor(e.buffer,s*d,h);t.set(p,i),r[u]=i,i+=h}return i}function rebatchCPU(e,t){var i=e._indices,r=e._indexOffsets,n=e._indexCounts,a=e._batchIdLookUp,o=new i.constructor(i.length),s=t.pop(),l=[s],c=copyIndicesCPU(i,o,0,r,n,s.batchIds,a);for(s.offset=0,s.count=c;0<t.length;){var u=t.pop();if(Color.equals(u.color,s.color))c=copyIndicesCPU(i,o,c,r,n,u.batchIds,a),s.batchIds=s.batchIds.concat(u.batchIds),s.count=c-s.offset;else{var d=c;c=copyIndicesCPU(i,o,c,r,n,u.batchIds,a),u.offset=d,u.count=c-d,l.push(u),s=u}}e._va.indexBuffer.copyFromArrayView(o),e._indices=o,e._batchedIndices=l}function copyIndicesGPU(e,t,i,r,n,a,o){for(var s=e.bytesPerIndex,l=a.length,c=0;c<l;++c){var u=o[a[c]],d=r[u],h=n[u];t.copyFromBuffer(e,d*s,i*s,h*s),r[u]=i,i+=h}return i}function rebatchGPU(e,t){var i=e._indexOffsets,r=e._indexCounts,n=e._batchIdLookUp,a=t.pop(),o=[a],s=e._va.indexBuffer,l=e._vaSwap.indexBuffer,c=copyIndicesGPU(s,l,0,i,r,a.batchIds,n);for(a.offset=0,a.count=c;0<t.length;){var u=t.pop();if(Color.equals(u.color,a.color))c=copyIndicesGPU(s,l,c,i,r,u.batchIds,n),a.batchIds=a.batchIds.concat(u.batchIds),a.count=c-a.offset;else{var d=c;c=copyIndicesGPU(s,l,c,i,r,u.batchIds,n),u.offset=d,u.count=c-d,o.push(u),a=u}}var h=e._va;e._va=e._vaSwap,e._vaSwap=h,e._batchedIndices=o}function compareColors(e,t){return t.color.toRgba()-e.color.toRgba()}function rebatchCommands(e,t){if(!e._batchDirty)return!1;for(var i=e._batchedIndices,r=i.length,n=!1,a={},o=0;o<r;++o){var s=i[o].color.toRgba();if(defined(a[s])){n=!0;break}a[s]=!0}return n?n&&!e.forceRebatch&&e._framesSinceLastRebatch<120?void++e._framesSinceLastRebatch:(i.sort(compareColors),t.webgl2?rebatchGPU(e,i):rebatchCPU(e,i),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0):e._batchDirty=!1}function createColorCommands$1(e,t){var i=rebatchCommands(e,t),r=e._commands,n=e._batchedIndices,a=n.length,o=3*a;if(!defined(r)||i||r.length!==o){r.length=o;for(var s=e._va,l=e._sp,c=defaultValue(e._modelMatrix,Matrix4.IDENTITY),u=e._uniformMap,d=e._boundingVolume,h=0;h<a;++h){var p=n[h].offset,m=n[h].count,f=r[3*h];defined(f)||(f=r[3*h]=new DrawCommand({owner:e})),f.vertexArray=s,f.modelMatrix=c,f.offset=p,f.count=m,f.renderState=e._rsStencilPreloadPass,f.shaderProgram=l,f.uniformMap=u,f.boundingVolume=d,f.cull=!1,f.pass=Pass$1.TERRAIN_CLASSIFICATION;var g=DrawCommand.shallowClone(f,f.derivedCommands.tileset);g.renderState=e._rsStencilPreloadPass3DTiles,g.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,f.derivedCommands.tileset=g;var _=r[3*h+1];defined(_)||(_=r[3*h+1]=new DrawCommand({owner:e})),_.vertexArray=s,_.modelMatrix=c,_.offset=p,_.count=m,_.renderState=e._rsStencilDepthPass,_.shaderProgram=l,_.uniformMap=u,_.boundingVolume=d,_.cull=!1,_.pass=Pass$1.TERRAIN_CLASSIFICATION;var y=DrawCommand.shallowClone(_,_.derivedCommands.tileset);y.renderState=e._rsStencilDepthPass3DTiles,y.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,_.derivedCommands.tileset=y;var v=r[3*h+2];defined(v)||(v=r[3*h+2]=new DrawCommand({owner:e})),v.vertexArray=s,v.modelMatrix=c,v.offset=p,v.count=m,v.renderState=e._rsColorPass,v.shaderProgram=l,v.uniformMap=u,v.boundingVolume=d,v.cull=!1,v.pass=Pass$1.TERRAIN_CLASSIFICATION;var C=DrawCommand.shallowClone(v,v.derivedCommands.tileset);C.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,v.derivedCommands.tileset=C}e._commandsDirty=!0}}function createColorCommandsIgnoreShow(e,t){if(e.classificationType!==ClassificationType$1.TERRAIN&&t.invertClassification&&(!defined(e._commandsIgnoreShow)||e._commandsDirty)){for(var i=e._commands,r=e._commandsIgnoreShow,n=e._spStencil,a=i.length,o=r.length=a/3*2,s=0,l=0;l<o;l+=2){var c=r[l]=DrawCommand.shallowClone(i[s],r[l]);c.shaderProgram=n,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,(c=r[l+1]=DrawCommand.shallowClone(i[s+1],r[l+1])).shaderProgram=n,c.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,s+=3}e._commandsDirty=!1}}function createPickCommands$1(e){if(e._pickCommandsDirty){var t=e._indexOffsets.length,i=e._pickCommands;i.length=3*t;for(var r=e._va,n=e._spStencil,a=e._spPick,o=defaultValue(e._modelMatrix,Matrix4.IDENTITY),s=e._uniformMap,l=0;l<t;++l){var c=e._indexOffsets[l],u=e._indexCounts[l],d=defined(e._boundingVolumes)?e._boundingVolumes[l]:e.boundingVolume,h=i[3*l];defined(h)||(h=i[3*l]=new DrawCommand({owner:e,pickOnly:!0})),h.vertexArray=r,h.modelMatrix=o,h.offset=c,h.count=u,h.renderState=e._rsStencilPreloadPass,h.shaderProgram=n,h.uniformMap=s,h.boundingVolume=d,h.pass=Pass$1.TERRAIN_CLASSIFICATION;var p=DrawCommand.shallowClone(h,h.derivedCommands.tileset);p.renderState=e._rsStencilPreloadPass3DTiles,p.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,h.derivedCommands.tileset=p;var m=i[3*l+1];defined(m)||(m=i[3*l+1]=new DrawCommand({owner:e,pickOnly:!0})),m.vertexArray=r,m.modelMatrix=o,m.offset=c,m.count=u,m.renderState=e._rsStencilDepthPass,m.shaderProgram=n,m.uniformMap=s,m.boundingVolume=d,m.pass=Pass$1.TERRAIN_CLASSIFICATION;var f=DrawCommand.shallowClone(m,m.derivedCommands.tileset);f.renderState=e._rsStencilDepthPass3DTiles,f.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,m.derivedCommands.tileset=f;var g=i[3*l+2];defined(g)||(g=i[3*l+2]=new DrawCommand({owner:e,pickOnly:!0})),g.vertexArray=r,g.modelMatrix=o,g.offset=c,g.count=u,g.renderState=e._rsPickPass,g.shaderProgram=a,g.uniformMap=s,g.boundingVolume=d,g.pass=Pass$1.TERRAIN_CLASSIFICATION;var _=DrawCommand.shallowClone(g,g.derivedCommands.tileset);_.pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=_}e._pickCommandsDirty=!1}}function clearStyle(e,t){e._updatingAllCommands=!0;var i,r=e._batchIds,n=r.length;for(i=0;i<n;++i){var a=t[r[i]];a.show=!0,a.color=Color.WHITE}var o=e._batchedIndices;for(n=o.length,i=0;i<n;++i)o[i].color=Color.clone(Color.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}Vector3DTilePrimitive.prototype.createFeatures=function(e,t){for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=i[n];t[a]=new Cesium3DTileFeature(e,a)}},Vector3DTilePrimitive.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};var scratchColor$e=new Color,DEFAULT_COLOR_VALUE$1=Color.WHITE,DEFAULT_SHOW_VALUE$1=!0,complexExpressionReg=/\$/;function queueCommands(e,t,i,r){var n,a,o=e.classificationType,s=o!==ClassificationType$1.CESIUM_3D_TILE,l=o!==ClassificationType$1.TERRAIN,c=t.commandList,u=i.length;for(a=0;a<u;++a)s&&((n=i[a]).pass=Pass$1.TERRAIN_CLASSIFICATION,c.push(n)),l&&((n=i[a].derivedCommands.tileset).pass=Pass$1.CESIUM_3D_TILE_CLASSIFICATION,c.push(n));if(t.invertClassification&&defined(r))for(u=r.length,a=0;a<u;++a)c.push(r[a])}function queueWireframeCommands(e,t){for(var i=e.commandList,r=t.length,n=0;n<r;n+=3){var a=t[n+2];a.pass=Pass$1.OPAQUE,i.push(a)}}function updateWireframe$1(e){var t=e.debugWireframe===e._debugWireframe;if(!(t=t&&!(e.debugWireframe&&e._wireframeDirty))){var i,r;defined(e._rsWireframe)||(e._rsWireframe=RenderState.fromCache({})),r=e.debugWireframe?(i=e._rsWireframe,PrimitiveType$1.LINES):(i=e._rsColorPass,PrimitiveType$1.TRIANGLES);for(var n=e._commands,a=n.length,o=0;o<a;o+=3){var s=n[o+2];s.renderState=i,s.primitiveType=r}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}}Vector3DTilePrimitive.prototype.applyStyle=function(e,t){if(defined(e)){var i=e.color,r=i instanceof Expression&&!complexExpressionReg.test(i.expression);this._updatingAllCommands=r;var n,a=this._batchIds,o=a.length;for(n=0;n<o;++n){var s=t[a[n]];s.color=defined(e.color)?e.color.evaluateColor(s,scratchColor$e):DEFAULT_COLOR_VALUE$1,s.show=defined(e.show)?e.show.evaluate(s):DEFAULT_SHOW_VALUE$1}if(r){var l=this._batchedIndices;for(o=l.length,n=0;n<o;++n)l[n].color=Color.clone(Color.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}}else clearStyle(this,t)},Vector3DTilePrimitive.prototype.updateCommands=function(e,t){if(!this._updatingAllCommands){var i=this._batchIdLookUp,r=i[e];if(defined(r)){var n,a=this._indexOffsets,o=this._indexCounts,s=a[r],l=o[r],c=this._batchedIndices,u=c.length;for(n=0;n<u;++n){var d=c[n].offset,h=c[n].count;if(d<=s&&s<d+h)break}c.push(new Vector3DTileBatch({color:Color.clone(t),offset:s,count:l,batchIds:[e]}));for(var p=[],m=[],f=c[n].batchIds,g=f.length,_=0;_<g;++_){var y=f[_];if(y!==e)a[i[y]]<s?p.push(y):m.push(y)}0!==m.length&&c.push(new Vector3DTileBatch({color:Color.clone(c[n].color),offset:s+l,count:c[n].offset+c[n].count-(s+l),batchIds:m})),0!==p.length?(c[n].count=s-c[n].offset,c[n].batchIds=p):c.splice(n,1),this._batchDirty=!0}}},Vector3DTilePrimitive.prototype.update=function(e){var t=e.context;createVertexArray$2(this,t),createShaders(this,t),createRenderStates$3(this),createUniformMap$1(this,t);var i=e.passes;i.render&&(createColorCommands$1(this,t),createColorCommandsIgnoreShow(this,e),updateWireframe$1(this),this._debugWireframe?queueWireframeCommands(e,this._commands):queueCommands(this,e,this._commands,this._commandsIgnoreShow)),i.pick&&(createPickCommands$1(this),queueCommands(this,e,this._pickCommands))},Vector3DTilePrimitive.prototype.isDestroyed=function(){return!1},Vector3DTilePrimitive.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(),destroyObject(this)};var boundingSphereCartesian3Scratch$1=new Cartesian3,ModelState$1=ModelUtility.ModelState;function ClassificationModel(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).gltf;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t instanceof Uint8Array))throw new RuntimeError("Only binary glTF is supported as a classifier.");updateVersion(t=parseGlb(t)),addDefaults(t),processModelMaterialsCommon(t),processPbrMaterials(t),ForEach.buffer(t,function(e){if(!defined(e.extras._pipeline.source))throw new RuntimeError("Buffer data must be embedded in the binary gltf.")});var i=t.nodes,r=t.meshes,n=i[0].mesh;if(1!==i.length||!defined(n))throw new RuntimeError("Only one node is supported for classification and it must have a mesh.");if(1!==r.length)throw new RuntimeError("Only one mesh is supported when using b3dm for classification.");var a=r[0].primitives;if(1!==a.length)throw new RuntimeError("Only one primitive per mesh is supported when using b3dm for classification.");if(!defined(a[0].attributes.POSITION))throw new RuntimeError("The mesh must have a position attribute.");if(!defined(a[0].attributes._BATCHID))throw new RuntimeError("The mesh must have a batch id attribute.");this._gltf=t,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._ready=!1,this._readyPromise=when.defer(),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._classificationType=e.classificationType,this._vertexShaderLoaded=e.vertexShaderLoaded,this._classificationShaderLoaded=e.classificationShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._pickIdLoaded=e.pickIdLoaded,this._ignoreCommands=defaultValue(e.ignoreCommands,!1),this._upAxis=defaultValue(e.upAxis,Axis$1.Y),this._batchTable=e.batchTable,this._computedModelMatrix=new Matrix4,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new BoundingSphere,this._state=ModelState$1.NEEDS_LOAD,this._loadResources=void 0,this._mode=void 0,this._dirty=!1,this._nodeMatrix=new Matrix4,this._primitive=void 0,this._extensionsUsed=void 0,this._extensionsRequired=void 0,this._quantizedUniforms=void 0,this._buffers={},this._vertexArray=void 0,this._shaderProgram=void 0,this._uniformMap=void 0,this._geometryByteLength=0,this._trianglesLength=0,this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._rtcCenter3D=void 0,this._rtcCenter2D=void 0}function addBuffersToLoadResources$1(e){var t=e.gltf,i=e._loadResources;ForEach.buffer(t,function(e,t){i.buffers[t]=e.extras._pipeline.source})}function parseBufferViews$1(e){var i=e.gltf.bufferViews,r=e._loadResources.vertexBuffersToCreate;ForEach.bufferView(e.gltf,function(e,t){e.target===WebGLConstants$1.ARRAY_BUFFER&&r.enqueue(t)});var n=e._loadResources.indexBuffersToCreate,a={};ForEach.accessor(e.gltf,function(e){var t=e.bufferView;i[t].target!==WebGLConstants$1.ELEMENT_ARRAY_BUFFER||defined(a[t])||(a[t]=!0,n.enqueue({id:t,componentType:e.componentType}))})}function createVertexBuffer$1(e,t){var i=t._loadResources,r=t.gltf.bufferViews[e],n=i.getBuffer(r);t._buffers[e]=n,t._geometryByteLength+=n.byteLength}function createIndexBuffer$1(e,t,i){var r=i._loadResources,n=i.gltf.bufferViews[e],a={typedArray:r.getBuffer(n),indexDatatype:t};i._buffers[e]=a,i._geometryByteLength+=a.typedArray.byteLength}function createBuffers$1(e){var t=e._loadResources;if(0===t.pendingBufferLoads){for(var i=t.vertexBuffersToCreate,r=t.indexBuffersToCreate;0<i.length;)createVertexBuffer$1(i.dequeue(),e);for(;0<r.length;){var n=r.dequeue();createIndexBuffer$1(n.id,n.componentType,e)}}}function modifyShaderForQuantizedAttributes$1(e,t){var i=t.gltf.meshes[0].primitives[0],r=ModelUtility.modifyShaderForQuantizedAttributes(t.gltf,i,e);return t._quantizedUniforms=r.uniforms,r.shader}function modifyShader$1(e,t){return defined(t)&&(e=t(e)),e}function createProgram$1(e){var t=e.gltf,i=ModelUtility.getAttributeOrUniformBySemantic(t,"POSITION"),r=ModelUtility.getAttributeOrUniformBySemantic(t,"_BATCHID"),n={};n[i]=0,n[r]=1;var a,o,s=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEWPROJECTION");if(defined(s))a="uniform mat4 "+s+";\n",o=s+" * vec4("+i+", 1.0)";else{var l=ModelUtility.getAttributeOrUniformBySemantic(t,"PROJECTION"),c=ModelUtility.getAttributeOrUniformBySemantic(t,"MODELVIEW");defined(c)||(c=ModelUtility.getAttributeOrUniformBySemantic(t,"CESIUM_RTC_MODELVIEW")),a="uniform mat4 "+c+";\nuniform mat4 "+l+";\n",o=l+" * "+c+" * vec4("+i+", 1.0)"}var u="attribute vec3 "+i+";\nattribute float "+r+";\n"+a+"void main() {\n"+("    vec4 positionInClipCoords = "+o+";\n")+"    gl_Position = czm_depthClampFarPlane(positionInClipCoords);\n}\n";e.extensionsUsed.WEB3D_quantized_attributes&&(u=modifyShaderForQuantizedAttributes$1(u,e));var d=modifyShader$1(u,e._vertexShaderLoaded),h=modifyShader$1("#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main() \n{ \n    gl_FragColor = vec4(1.0); \n    czm_writeDepthClampedToFarPlane();\n}\n",e._classificationShaderLoaded);d=ModelUtility.modifyVertexShaderForLogDepth(d,o),h=ModelUtility.modifyFragmentShaderForLogDepth(h),e._shaderProgram={vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:n}}function getAttributeLocations$1(){return{POSITION:0,_BATCHID:1}}function createVertexArray$3(e){if(e._loadResources.finishedBuffersCreation()&&!defined(e._vertexArray)){var t,n=e._buffers,a=e.gltf,o=a.accessors,i=a.meshes[0].primitives[0],s=getAttributeLocations$1(),l={};if(ForEach.meshPrimitiveAttribute(i,function(e,t){var i=s[t];if(defined(i)){var r=o[e];l[t]={index:i,vertexBuffer:n[r.bufferView],componentsPerAttribute:numberOfComponentsForType(r.type),componentDatatype:r.componentType,offsetInBytes:r.byteOffset,strideInBytes:getAccessorByteStride(a,r)}}}),defined(i.indices)){var r=o[i.indices];t=n[r.bufferView]}e._vertexArray={attributes:l,indexBuffer:t}}}defineProperties$1(ClassificationModel.prototype,{gltf:{get:function(){return this._gltf}},boundingSphere:{get:function(){var e=this.modelMatrix,t=Matrix4.getScale(e,boundingSphereCartesian3Scratch$1),i=this._scaledBoundingSphere;return i.center=Cartesian3.multiplyComponents(this._boundingSphere.center,t,i.center),i.radius=Cartesian3.maximumComponent(t)*this._initialRadius,defined(this._rtcCenter)&&Cartesian3.add(this._rtcCenter,i.center,i.center),i}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},dirty:{get:function(){return this._dirty}},extensionsUsed:{get:function(){return defined(this._extensionsUsed)||(this._extensionsUsed=ModelUtility.getUsedExtensions(this.gltf)),this._extensionsUsed}},extensionsRequired:{get:function(){return defined(this._extensionsRequired)||(this._extensionsRequired=ModelUtility.getRequiredExtensions(this.gltf)),this._extensionsRequired}},upAxis:{get:function(){return this._upAxis}},trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},texturesByteLength:{get:function(){return 0}},classificationType:{get:function(){return this._classificationType}}});var gltfSemanticUniforms$1={PROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().PROJECTION(e,t)},MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEW(e,t)},CESIUM_RTC_MODELVIEW:function(e,t){return ModelUtility.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(e,t)},MODELVIEWPROJECTION:function(e,t){return ModelUtility.getGltfSemanticUniforms().MODELVIEWPROJECTION(e,t)}};function createUniformMap$2(i,r){if(!defined(i._uniformMap)){var n={};ForEach.technique(i.gltf,function(e){ForEach.techniqueUniform(e,function(e,t){defined(e.semantic)&&defined(gltfSemanticUniforms$1[e.semantic])&&(n[t]=gltfSemanticUniforms$1[e.semantic](r.uniformState,i))})}),i._uniformMap=n}}function createUniformsForQuantizedAttributes$1(e,t){return ModelUtility.createUniformsForQuantizedAttributes(e.gltf,t,e._quantizedUniforms)}function triangleCountFromPrimitiveIndices$1(e,t){switch(e.mode){case PrimitiveType$1.TRIANGLES:return t/3;case PrimitiveType$1.TRIANGLE_STRIP:case PrimitiveType$1.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function createPrimitive(e){var t,i,r=e._batchTable,n=e._uniformMap,a=e._vertexArray,o=e.gltf,s=o.accessors,l=o.meshes[0].primitives[0],c=s[l.indices],u=l.attributes.POSITION,d=ModelUtility.getAccessorMinMax(o,u),h=BoundingSphere.fromCornerPoints(Cartesian3.fromArray(d.min),Cartesian3.fromArray(d.max));defined(c)?(i=c.count,t=c.byteOffset/IndexDatatype$1.getSizeInBytes(c.componentType)):(i=s[l.attributes.POSITION].count,t=0);e._trianglesLength+=triangleCountFromPrimitiveIndices$1(l,i),defined(e._uniformMapLoaded)&&(n=e._uniformMapLoaded(n)),e.extensionsUsed.WEB3D_quantized_attributes&&(n=combine(n,createUniformsForQuantizedAttributes$1(e,l)));var p=a.attributes.POSITION,m=p.componentDatatype,f=p.vertexBuffer,g=f.byteOffset,_=f.byteLength/ComponentDatatype$1.getSizeInBytes(m),y=ComponentDatatype$1.createArrayBufferView(m,f.buffer,g,_);m=(p=a.attributes._BATCHID).componentDatatype,g=(f=p.vertexBuffer).byteOffset,_=f.byteLength/ComponentDatatype$1.getSizeInBytes(m);var v,C=ComponentDatatype$1.createArrayBufferView(m,f.buffer,g,_),S=a.indexBuffer.typedArray;v=a.indexBuffer.indexDatatype===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(S.buffer,S.byteOffset,S.byteLength/Uint16Array.BYTES_PER_ELEMENT):new Uint32Array(S.buffer,S.byteOffset,S.byteLength/Uint32Array.BYTES_PER_ELEMENT),y=arraySlice(y);var x,T,b,E=[],P=[],A=[],w=[],D=(C=arraySlice(C))[(v=arraySlice(v,t,t+i))[0]];E.push(D),A.push(0);for(var M=v.length,I=1;I<M;++I)(x=C[v[I]])!==D&&(b=I-(T=A[A.length-1]),E.push(x),P.push(b),A.push(I),w.push(new Vector3DTileBatch({offset:T,count:b,batchIds:[D],color:Color.WHITE})),D=x);b=M-(T=A[A.length-1]),P.push(b),w.push(new Vector3DTileBatch({offset:T,count:b,batchIds:[D],color:Color.WHITE}));var R=e._shaderProgram,O=R.vertexShaderSource,L=R.fragmentShaderSource,F=R.attributeLocations,N=defined(e._pickIdLoaded)?e._pickIdLoaded():void 0;e._primitive=new Vector3DTilePrimitive({classificationType:e._classificationType,positions:y,indices:v,indexOffsets:A,indexCounts:P,batchIds:E,vertexBatchIds:C,batchedIndices:w,batchTable:r,boundingVolume:new BoundingSphere,_vertexShaderSource:O,_fragmentShaderSource:L,_attributeLocations:F,_uniformMap:n,_pickId:N,_modelMatrix:new Matrix4,_boundingSphere:h}),e._buffers=void 0,e._vertexArray=void 0,e._shaderProgram=void 0,e._uniformMap=void 0}function createRuntimeNodes$1(e){if(e._loadResources.finished()&&!defined(e._primitive)){var t=e.gltf.nodes[0];e._nodeMatrix=ModelUtility.getTransform(t,e._nodeMatrix),createPrimitive(e)}}function createResources$1(e,t){var i=t.context;ModelUtility.checkSupportedGlExtensions(e.gltf.glExtensionsUsed,i),createBuffers$1(e),createProgram$1(e),createVertexArray$3(e),createUniformMap$2(e,i),createRuntimeNodes$1(e)}var scratchComputedTranslation$1=new Cartesian4,scratchComputedMatrixIn2D$1=new Matrix4;function updateNodeModelMatrix(e,t,i,r){var n=e._computedModelMatrix;if(e._mode!==SceneMode$1.SCENE3D&&!e._ignoreCommands){var a=Matrix4.getColumn(n,3,scratchComputedTranslation$1);if(Cartesian4.equals(a,Cartesian4.UNIT_W)){var o=e.boundingSphere.center,s=Transforms.wgs84To2DModelMatrix(r,o,scratchComputedMatrixIn2D$1);n=Matrix4.multiply(s,n,scratchComputedMatrixIn2D$1),defined(e._rtcCenter)&&(Matrix4.setTranslation(n,Cartesian4.UNIT_W,n),e._rtcCenter=e._rtcCenter2D)}else n=Transforms.basisTo2D(r,n,scratchComputedMatrixIn2D$1),e._rtcCenter=e._rtcCenter3D}var l=e._primitive;(t||i)&&(Matrix4.multiplyTransformation(n,e._nodeMatrix,l._modelMatrix),BoundingSphere.transform(l._boundingSphere,l._modelMatrix,l._boundingVolume),defined(e._rtcCenter)&&Cartesian3.add(e._rtcCenter,l._boundingVolume.center,l._boundingVolume.center))}function Batched3DModel3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._model=void 0,this._batchTable=void 0,this._features=void 0,this._batchIdAttributeName=void 0,this._diffuseAttributeOrUniformName={},this._rtcCenterTransform=void 0,this._contentModelMatrix=void 0,this.featurePropertiesDirty=!1,initialize$2(this,r,n)}ClassificationModel.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},ClassificationModel.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING)if(FeatureDetection.supportsWebP.initialized){var t=FeatureDetection.supportsWebP();if(this._state===ModelState$1.NEEDS_LOAD&&defined(this.gltf)&&(this._state=ModelState$1.LOADING,this._state!==ModelState$1.FAILED)){var i=this.gltf.extensions;if(defined(i)&&defined(i.CESIUM_RTC)){var r=Cartesian3.fromArray(i.CESIUM_RTC.center);if(!Cartesian3.equals(r,Cartesian3.ZERO)){this._rtcCenter3D=r;var n=e.mapProjection,a=n.ellipsoid.cartesianToCartographic(this._rtcCenter3D),o=n.project(a);Cartesian3.fromElements(o.z,o.x,o.y,o),this._rtcCenter2D=o,this._rtcCenterEye=new Cartesian3,this._rtcCenter=this._rtcCenter3D}}this._loadResources=new ModelLoadResources,ModelUtility.parseBuffers(this)}var s=this._loadResources,l=!1;this._state===ModelState$1.LOADING&&(0===s.pendingBufferLoads&&(ModelUtility.checkSupportedExtensions(this.extensionsRequired,t),addBuffersToLoadResources$1(this),parseBufferViews$1(this),this._boundingSphere=ModelUtility.computeBoundingSphere(this),this._initialRadius=this._boundingSphere.radius,createResources$1(this,e)),s.finished()&&(this._state=ModelState$1.LOADED,l=!0)),defined(s)&&this._state===ModelState$1.LOADED&&(l||createResources$1(this,e),s.finished()&&(this._loadResources=void 0));var c=this.show;if(c&&this._state===ModelState$1.LOADED||l){this._dirty=!1;var u=this.modelMatrix,d=e.mode!==this._mode;this._mode=e.mode;var h=!Matrix4.equals(this._modelMatrix,u)||d;if(h||l){Matrix4.clone(u,this._modelMatrix);var p=this._computedModelMatrix;Matrix4.clone(u,p),this._upAxis===Axis$1.Y?Matrix4.multiplyTransformation(p,Axis$1.Y_UP_TO_Z_UP,p):this._upAxis===Axis$1.X&&Matrix4.multiplyTransformation(p,Axis$1.X_UP_TO_Z_UP,p)}(h||l)&&(updateNodeModelMatrix(this,h,l,e.mapProjection),this._dirty=!0)}if(l){var m=this;e.afterRender.push(function(){m._ready=!0,m._readyPromise.resolve(m)})}else c&&!this._ignoreCommands&&(this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.debugWireframe=this.debugWireframe,this._primitive.update(e))}else FeatureDetection.supportsWebP.initialize()},ClassificationModel.prototype.isDestroyed=function(){return!1},ClassificationModel.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},Batched3DModel3DTileContent._deprecationWarning=deprecationWarning,defineProperties$1(Batched3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this._batchTable.featuresLength}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return this._model.trianglesLength}},geometryByteLength:{get:function(){return this._model.geometryByteLength}},texturesByteLength:{get:function(){return this._model.texturesByteLength}},batchTableByteLength:{get:function(){return this._batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._model.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}}});var sizeOfUint32$3=Uint32Array.BYTES_PER_ELEMENT;function getBatchIdAttributeName(e){var t=ModelUtility.getAttributeOrUniformBySemantic(e,"_BATCHID");return defined(t)||defined(t=ModelUtility.getAttributeOrUniformBySemantic(e,"BATCHID"))&&Batched3DModel3DTileContent._deprecationWarning("b3dm-legacy-batchid","The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`."),t}function getVertexShaderCallback(o){return function(e,t){var i=o._batchTable,r=!defined(o._tileset.classificationType),n=o._model.gltf;defined(n)&&(o._batchIdAttributeName=getBatchIdAttributeName(n),o._diffuseAttributeOrUniformName[t]=ModelUtility.getDiffuseAttributeOrUniform(n,t));var a=i.getVertexShaderCallback(r,o._batchIdAttributeName,o._diffuseAttributeOrUniformName[t]);return defined(a)?a(e):e}}function getFragmentShaderCallback(o){return function(e,t){var i=o._batchTable,r=!defined(o._tileset.classificationType),n=o._model.gltf;defined(n)&&(o._diffuseAttributeOrUniformName[t]=ModelUtility.getDiffuseAttributeOrUniform(n,t));var a=i.getFragmentShaderCallback(r,o._diffuseAttributeOrUniformName[t]);return defined(a)?a(e):e}}function getPickIdCallback(e){return function(){return e._batchTable.getPickId()}}function getClassificationFragmentShaderCallback(i){return function(e){var t=i._batchTable.getClassificationFragmentShaderCallback();return defined(t)?t(e):e}}function createColorChangedCallback(i){return function(e,t){i._model.updateCommands(e,t)}}function initialize$2(e,t,i){var r=e._tileset,n=e._tile,a=e._resource,o=defaultValue(i,0);i=o;var s=new Uint8Array(t),l=new DataView(t);i+=sizeOfUint32$3;var c=l.getUint32(i,!0);if(1!==c)throw new RuntimeError("Only Batched 3D Model version 1 is supported.  Version "+c+" is not.");i+=sizeOfUint32$3;var u=l.getUint32(i,!0);i+=sizeOfUint32$3;var d=l.getUint32(i,!0);i+=sizeOfUint32$3;var h=l.getUint32(i,!0);i+=sizeOfUint32$3;var p=l.getUint32(i,!0);i+=sizeOfUint32$3;var m,f,g=l.getUint32(i,!0);if(i+=sizeOfUint32$3,570425344<=p?(i-=2*sizeOfUint32$3,m=d,p=h,h=d=g=0,Batched3DModel3DTileContent._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/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel.")):570425344<=g&&(i-=sizeOfUint32$3,m=p,p=d,g=h,h=d=0,Batched3DModel3DTileContent._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/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel.")),0===d)f={BATCH_LENGTH:defaultValue(m,0)};else{var _=getStringFromTypedArray(s,i,d);f=JSON.parse(_),i+=d}var y=new Uint8Array(t,i,h);i+=h;var v,C,S,x=new Cesium3DTileFeatureTable(f,y);if(m=x.getGlobalProperty("BATCH_LENGTH"),x.featuresLength=m,0<p){var T=getStringFromTypedArray(s,i,p);v=JSON.parse(T),i+=p,0<g&&(C=new Uint8Array(t,i,g),C=new Uint8Array(C),i+=g)}defined(r.classificationType)&&(S=createColorChangedCallback(e));var b=new Cesium3DTileBatchTable(e,m,v,C,S);e._batchTable=b;var E,P=o+u-i;if(0==P)throw new RuntimeError("glTF byte length must be greater than 0.");E=i%4==0?new Uint8Array(t,i,P):(Batched3DModel3DTileContent._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),new Uint8Array(s.subarray(i,i+P)));var A={content:e,primitive:r};e._rtcCenterTransform=Matrix4.IDENTITY;var w=x.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(w)&&(e._rtcCenterTransform=Matrix4.fromTranslation(Cartesian3.fromArray(w))),e._contentModelMatrix=Matrix4.multiply(n.computedTransform,e._rtcCenterTransform,new Matrix4),defined(r.classificationType)?e._model=new ClassificationModel({gltf:E,cull:!1,basePath:a,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:r._gltfUpAxis,forwardAxis:Axis$1.X,debugWireframe:r.debugWireframe,vertexShaderLoaded:getVertexShaderCallback(e),classificationShaderLoaded:getClassificationFragmentShaderCallback(e),uniformMapLoaded:b.getUniformMapCallback(),pickIdLoaded:getPickIdCallback(e),classificationType:r._classificationType,batchTable:b}):e._model=new Model({gltf:E,cull:!1,releaseGltfJson:!0,opaquePass:Pass$1.CESIUM_3D_TILE,basePath:a,requestType:RequestType$1.TILES3D,modelMatrix:e._contentModelMatrix,upAxis:r._gltfUpAxis,forwardAxis:Axis$1.X,shadows:r.shadows,debugWireframe:r.debugWireframe,incrementallyLoadTextures:!1,vertexShaderLoaded:getVertexShaderCallback(e),fragmentShaderLoaded:getFragmentShaderCallback(e),uniformMapLoaded:b.getUniformMapCallback(),pickIdLoaded:getPickIdCallback(e),addBatchIdToGeneratedShaders:0<m,pickObject:A,imageBasedLightingFactor:r.imageBasedLightingFactor,lightColor:r.lightColor,luminanceAtZenith:r.luminanceAtZenith,sphericalHarmonicCoefficients:r.sphericalHarmonicCoefficients,specularEnvironmentMaps:r.specularEnvironmentMaps})}function createFeatures(e){var t=e.featuresLength;if(!defined(e._features)&&0<t){for(var i=new Array(t),r=0;r<t;++r)i[r]=new Cesium3DTileFeature(e,r);e._features=i}}Batched3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Batched3DModel3DTileContent.prototype.getFeature=function(e){return createFeatures(this),this._features[e]},Batched3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,0===this.featuresLength?this._model.color=t:this._batchTable.setAllColor(t)},Batched3DModel3DTileContent.prototype.applyStyle=function(e){if(0===this.featuresLength){var t=defined(e)&&defined(e.color),i=defined(e)&&defined(e.show);this._model.color=t?e.color.evaluateColor(void 0,this._model.color):Color.clone(Color.WHITE,this._model.color),this._model.show=!i||e.show.evaluate(void 0)}else this._batchTable.applyStyle(e)},Batched3DModel3DTileContent.prototype.update=function(e,t){var i=t.commandList.length;this._batchTable.update(e,t),this._contentModelMatrix=Matrix4.multiply(this._tile.computedTransform,this._rtcCenterTransform,this._contentModelMatrix),this._model.modelMatrix=this._contentModelMatrix,this._model.shadows=this._tileset.shadows,this._model.imageBasedLightingFactor=this._tileset.imageBasedLightingFactor,this._model.lightColor=this._tileset.lightColor,this._model.luminanceAtZenith=this._tileset.luminanceAtZenith,this._model.sphericalHarmonicCoefficients=this._tileset.sphericalHarmonicCoefficients,this._model.specularEnvironmentMaps=this._tileset.specularEnvironmentMaps,this._model.debugWireframe=this._tileset.debugWireframe;var r=this._tileset.clippingPlanes;this._model.clippingPlanesOriginMatrix=this._tileset.clippingPlanesOriginMatrix,defined(r)&&this._tile.clippingPlanesDirty&&(this._model._clippingPlanes=r.enabled&&this._tile._isClipped?r:void 0),defined(r)&&defined(this._model._clippingPlanes)&&this._model._clippingPlanes!==r&&(this._model._clippingPlanes=r),this._model.update(t),i<t.commandList.length&&(t.passes.render||t.passes.pick)&&!defined(e.classificationType)&&this._batchTable.addDerivedCommands(t,i)},Batched3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Batched3DModel3DTileContent.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};var BingMapsStyle={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"},BingMapsStyle$1=freezeObject$1(BingMapsStyle),emptyImage;function DiscardEmptyTileImagePolicy(e){}function BingMapsImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._key=BingMapsApi.getKey(e.key),this._resource=Resource.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=defaultValue(e.mapStyle,BingMapsStyle$1.AERIAL),this._culture=defaultValue(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new DiscardEmptyTileImagePolicy),this._proxy=e.proxy,this._credit=new Credit('<a href="http://www.bing.com"><img src="'+BingMapsImageryProvider.logoUrl+'" title="Bing Imagery"/></a>'),this.defaultGamma=1,this._tilingScheme=new WebMercatorTilingScheme({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._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var t=this._tileProtocol;defined(t)?0<t.length&&":"===t[t.length-1]&&(t=t.substr(0,t.length-1)):t="http:"===document.location.protocol?"http":"https";var d,i=this._resource.getDerivedResource({url:"REST/v1/Imagery/Metadata/"+this._mapStyle,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:t}}),h=this;function r(e){if(1===e.resourceSets.length){var t=e.resourceSets[0].resources[0];h._tileWidth=t.imageWidth,h._tileHeight=t.imageHeight,h._maximumLevel=t.zoomMax-1,h._imageUrlSubdomains=t.imageUrlSubdomains,h._imageUrlTemplate=t.imageUrl;for(var i=h._attributionList=t.imageryProviders,r=0,n=(i=i||(h._attributionList=[])).length;r<n;++r){var a=i[r];if(a.credit instanceof Credit)break;a.credit=new Credit(a.attribution);for(var o=a.coverageAreas,s=0,l=a.coverageAreas.length;s<l;++s){var c=o[s],u=c.bbox;c.bbox=new Rectangle(CesiumMath.toRadians(u[1]),CesiumMath.toRadians(u[0]),CesiumMath.toRadians(u[3]),CesiumMath.toRadians(u[2]))}}h._ready=!0,h._readyPromise.resolve(!0),TileProviderError.handleSuccess(d)}else p()}function p(e){var t="An error occurred while accessing "+i.url+".";d=TileProviderError.handleError(d,h,h._errorEvent,t,void 0,void 0,void 0,a),h._readyPromise.reject(new RuntimeError(t))}var n=i.url;function a(){var e=i.fetchJsonp("jsonp");(BingMapsImageryProvider._metadataCache[n]=e).then(r).otherwise(p)}var o=BingMapsImageryProvider._metadataCache[n];defined(o)?o.then(r).otherwise(p):a()}DiscardEmptyTileImagePolicy.prototype.isReady=function(){return!0},DiscardEmptyTileImagePolicy.prototype.shouldDiscardImage=function(e){return DiscardEmptyTileImagePolicy.EMPTY_IMAGE===e},defineProperties$1(DiscardEmptyTileImagePolicy,{EMPTY_IMAGE:{get:function(){return defined(emptyImage)||((emptyImage=new Image).src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),emptyImage}}}),defineProperties$1(BingMapsImageryProvider.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}},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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});var rectangleScratch$5=new Rectangle;function buildImageResource$1(e,t,i,r,n){var a=e._imageUrlTemplate,o=e._imageUrlSubdomains,s=(t+i+r)%o.length;return e._resource.getDerivedResource({url:a,request:n,templateValues:{quadkey:BingMapsImageryProvider.tileXYToQuadKey(t,i,r),subdomain:o[s],culture:e._culture},queryParameters:{n:"z"}})}BingMapsImageryProvider.prototype.getTileCredits=function(e,t,i){var r=this._tilingScheme.tileXYToRectangle(e,t,i,rectangleScratch$5);return getRectangleAttribution(this._attributionList,i,r)},BingMapsImageryProvider.prototype.requestImage=function(e,t,i,r){var n=ImageryProvider.loadImage(this,buildImageResource$1(this,e,t,i,r));if(defined(n))return n.otherwise(function(e){return defined(e.blob)&&0===e.blob.size?DiscardEmptyTileImagePolicy.EMPTY_IMAGE:when.reject(e)})},BingMapsImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){},BingMapsImageryProvider.tileXYToQuadKey=function(e,t,i){for(var r="",n=i;0<=n;--n){var a=1<<n,o=0;0!=(e&a)&&(o|=1),0!=(t&a)&&(o|=2),r+=o}return r},BingMapsImageryProvider.quadKeyToTileXY=function(e){for(var t=0,i=0,r=e.length-1,n=r;0<=n;--n){var a=1<<n,o=+e[r-n];0!=(1&o)&&(t|=a),0!=(2&o)&&(i|=a)}return{x:t,y:i,level:r}},BingMapsImageryProvider._logoUrl=void 0,defineProperties$1(BingMapsImageryProvider,{logoUrl:{get:function(){return defined(BingMapsImageryProvider._logoUrl)||(BingMapsImageryProvider._logoUrl=buildModuleUrl("Assets/Images/bing_maps_credit.png")),BingMapsImageryProvider._logoUrl},set:function(e){BingMapsImageryProvider._logoUrl=e}}});var intersectionScratch$1=new Rectangle;function getRectangleAttribution(e,t,i){++t;for(var r=[],n=0,a=e.length;n<a;++n){for(var o=e[n],s=o.coverageAreas,l=!1,c=0,u=o.coverageAreas.length;!l&&c<u;++c){var d=s[c];if(t>=d.zoomMin&&t<=d.zoomMax)defined(Rectangle.intersection(i,d.bbox,intersectionScratch$1))&&(l=!0)}l&&r.push(o.credit)}return r}BingMapsImageryProvider._metadataCache={};var defaultDimensions=new Cartesian3(1,1,1);function BoxEmitter(e){e=defaultValue(e,defaultDimensions),this._dimensions=Cartesian3.clone(e)}defineProperties$1(BoxEmitter.prototype,{dimensions:{get:function(){return this._dimensions},set:function(e){Cartesian3.clone(e,this._dimensions)}}});var scratchHalfDim=new Cartesian3;BoxEmitter.prototype.emit=function(e){var t=this._dimensions,i=Cartesian3.multiplyByScalar(t,.5,scratchHalfDim),r=CesiumMath.randomBetween(-i.x,i.x),n=CesiumMath.randomBetween(-i.y,i.y),a=CesiumMath.randomBetween(-i.z,i.z);e.position=Cartesian3.fromElements(r,n,a,e.position),e.velocity=Cartesian3.normalize(e.position,e.velocity)};var BrdfLutGeneratorFS="varying vec2 v_textureCoordinates;\nconst float M_PI = 3.141592653589793;\nfloat vdcRadicalInverse(int i)\n{\nfloat r;\nfloat base = 2.0;\nfloat value = 0.0;\nfloat invBase = 1.0 / base;\nfloat invBi = invBase;\nfor (int x = 0; x < 100; x++)\n{\nif (i <= 0)\n{\nbreak;\n}\nr = mod(float(i), base);\nvalue += r * invBi;\ninvBi *= invBase;\ni = int(float(i) * invBase);\n}\nreturn value;\n}\nvec2 hammersley2D(int i, int N)\n{\nreturn vec2(float(i) / float(N), vdcRadicalInverse(i));\n}\nvec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n{\nfloat a = roughness * roughness;\nfloat phi = 2.0 * M_PI * xi.x;\nfloat cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\nfloat sinTheta = sqrt(1.0 - cosTheta * cosTheta);\nvec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\nvec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\nvec3 tangentX = normalize(cross(upVector, N));\nvec3 tangentY = cross(N, tangentX);\nreturn tangentX * H.x + tangentY * H.y + N * H.z;\n}\nfloat G1_Smith(float NdotV, float k)\n{\nreturn NdotV / (NdotV * (1.0 - k) + k);\n}\nfloat G_Smith(float roughness, float NdotV, float NdotL)\n{\nfloat k = roughness * roughness / 2.0;\nreturn G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n}\nvec2 integrateBrdf(float roughness, float NdotV)\n{\nvec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\nfloat A = 0.0;\nfloat B = 0.0;\nconst int NumSamples = 1024;\nfor (int i = 0; i < NumSamples; i++)\n{\nvec2 xi = hammersley2D(i, NumSamples);\nvec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\nvec3 L = 2.0 * dot(V, H) * H - V;\nfloat NdotL = clamp(L.z, 0.0, 1.0);\nfloat NdotH = clamp(H.z, 0.0, 1.0);\nfloat VdotH = clamp(dot(V, H), 0.0, 1.0);\nif (NdotL > 0.0)\n{\nfloat G = G_Smith(roughness, NdotV, NdotL);\nfloat G_Vis = G * VdotH / (NdotH * NdotV);\nfloat Fc = pow(1.0 - VdotH, 5.0);\nA += (1.0 - Fc) * G_Vis;\nB += Fc * G_Vis;\n}\n}\nreturn vec2(A, B) / float(NumSamples);\n}\nvoid main()\n{\ngl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n}\n";function BrdfLutGenerator(){this._framebuffer=void 0,this._colorTexture=void 0,this._drawCommand=void 0}function createCommand$1(e,t){var i=e._framebuffer,r=t.createViewportQuadCommand(BrdfLutGeneratorFS,{framebuffer:i,renderState:RenderState.fromCache({viewport:new BoundingRectangle(0,0,256,256)})});e._drawCommand=r}function createFramebuffer$1(e,t){var i=new Texture({context:t,width:256,height:256,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),r=new Framebuffer({context:t,colorTextures:[e._colorTexture=i],destroyAttachments:!1});e._framebuffer=r}defineProperties$1(BrdfLutGenerator.prototype,{colorTexture:{get:function(){return this._colorTexture}}}),BrdfLutGenerator.prototype.update=function(e){if(!defined(this._colorTexture)){var t=e.context;createFramebuffer$1(this,t),createCommand$1(this,t),this._drawCommand.execute(t),this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}},BrdfLutGenerator.prototype.isDestroyed=function(){return!1},BrdfLutGenerator.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),destroyObject(this)};var CameraFlightPath={};function getAltitude(e,t,i){var r,n,a;if(e instanceof PerspectiveFrustum){var o=Math.tan(.5*e.fovy);return r=e.near,n=e.near*o,a=e.aspectRatio*n,Math.max(t*r/a,i*r/n)}return e instanceof PerspectiveOffCenterFrustum?(r=e.near,n=e.top,a=e.right,Math.max(t*r/a,i*r/n)):Math.max(t,i)}var scratchCart=new Cartesian3,scratchCart2$2=new Cartesian3;function createPitchFunction(n,a,o,e){if(defined(e)&&o(.5)>e){var s=o(0),l=o(1),t=o(.5),c=t-s,u=t-l;return function(e){var t=o(e);if(e<=.5){var i=(t-s)/c;return CesiumMath.lerp(n,-CesiumMath.PI_OVER_TWO,i)}var r=(t-l)/u;return CesiumMath.lerp(-CesiumMath.PI_OVER_TWO,a,1-r)}}return function(e){return CesiumMath.lerp(n,a,e)}}function createHeightFunction(e,t,i,r,n){var a=n,o=Math.max(i,r);if(!defined(a)){var s=e.position,l=t,c=e.up,u=e.right,d=e.frustum,h=Cartesian3.subtract(s,l,scratchCart),p=Cartesian3.magnitude(Cartesian3.multiplyByScalar(c,Cartesian3.dot(h,c),scratchCart2$2)),m=Cartesian3.magnitude(Cartesian3.multiplyByScalar(u,Cartesian3.dot(h,u),scratchCart2$2));a=Math.min(.2*getAltitude(d,p,m),1e9)}if(o<a){var f=-Math.pow(1e6*(a-i),1/8),g=Math.pow(1e6*(a-r),1/8);return function(e){var t=e*(g-f)+f;return-Math.pow(t,8)/1e6+a}}return function(e){return CesiumMath.lerp(i,r,e)}}function adjustAngleForLERP(e,t){return CesiumMath.equalsEpsilon(e,CesiumMath.TWO_PI,CesiumMath.EPSILON11)&&(e=0),t>e+Math.PI?e+=CesiumMath.TWO_PI:t<e-Math.PI&&(e-=CesiumMath.TWO_PI),e}var scratchStart=new Cartesian3;function createUpdateCV(e,i,r,n,a,o,t){var s=e.camera,l=Cartesian3.clone(s.position,scratchStart),c=s.pitch,u=adjustAngleForLERP(s.heading,n),d=adjustAngleForLERP(s.roll,o),h=createHeightFunction(s,r,l.z,r.z,t);return function(e){var t=e.time/i;s.setView({orientation:{heading:CesiumMath.lerp(u,n,t),pitch:CesiumMath.lerp(c,a,t),roll:CesiumMath.lerp(d,o,t)}}),Cartesian2.lerp(l,r,t,s.position),s.position.z=h(t)}}function useLongestFlight(e,t){e.longitude<t.longitude?e.longitude+=CesiumMath.TWO_PI:t.longitude+=CesiumMath.TWO_PI}function useShortestFlight(e,t){var i=e.longitude-t.longitude;i<-CesiumMath.PI?e.longitude+=CesiumMath.TWO_PI:i>CesiumMath.PI&&(t.longitude+=CesiumMath.TWO_PI)}var scratchStartCart=new Cartographic,scratchEndCart=new Cartographic;function createUpdate3D(e,r,t,n,i,a,o,s,l,c){var u=e.camera,d=e.mapProjection.ellipsoid,h=Cartographic.clone(u.positionCartographic,scratchStartCart),p=u.pitch,m=adjustAngleForLERP(u.heading,n),f=adjustAngleForLERP(u.roll,a),g=d.cartesianToCartographic(t,scratchEndCart);h.longitude=CesiumMath.zeroToTwoPi(h.longitude),g.longitude=CesiumMath.zeroToTwoPi(g.longitude);var _=!1;if(defined(s)){var y=CesiumMath.zeroToTwoPi(s),v=Math.min(h.longitude,g.longitude),C=Math.max(h.longitude,g.longitude),S=v<=y&&y<=C;if(defined(l)){var x=Math.abs(h.longitude-g.longitude),T=CesiumMath.TWO_PI-x;(S?x:T)<(S?T:x)*l&&!S&&(_=!0)}else S||(_=!0)}_?useLongestFlight(h,g):useShortestFlight(h,g);var b,E,P,A,w=createHeightFunction(u,t,h.height,g.height,o),D=createPitchFunction(p,i,w,c);return b=h.longitude,E=g.longitude,P=h.latitude,A=g.latitude,function(e){var t=e.time/r,i=Cartesian3.fromRadians(CesiumMath.lerp(b,E,t),CesiumMath.lerp(P,A,t),w(t));u.setView({destination:i,orientation:{heading:CesiumMath.lerp(m,n,t),pitch:D(t),roll:CesiumMath.lerp(f,a,t)}})}}function createUpdate2D(e,o,s,l,t,i,r){var c=e.camera,u=Cartesian3.clone(c.position,scratchStart),d=adjustAngleForLERP(c.heading,l),n=c.frustum.right-c.frustum.left,h=createHeightFunction(c,s,n,s.z,r);return function(e){var t=e.time/o;c.setView({orientation:{heading:CesiumMath.lerp(d,l,t)}}),Cartesian2.lerp(u,s,t,c.position);var i=h(t),r=c.frustum,n=r.top/r.right,a=.5*(i-(r.right-r.left));r.right+=a,r.left-=a,r.top=n*r.right,r.bottom=-r.top}}var scratchCartographic$9=new Cartographic,scratchDestination=new Cartesian3;function emptyFlight(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function wrapCallback(e,t){return function(){"function"==typeof t&&t(),e.enableInputs=!0}}CameraFlightPath.createTween=function(e,t){var i=(t=defaultValue(t,defaultValue.EMPTY_OBJECT)).destination,r=e.mode;if(r===SceneMode$1.MORPHING)return emptyFlight();var n=defaultValue(t.convert,!0),a=e.mapProjection,o=a.ellipsoid,s=t.maximumHeight,l=t.flyOverLongitude,c=t.flyOverLongitudeWeight,u=t.pitchAdjustHeight,d=t.easingFunction;n&&r!==SceneMode$1.SCENE3D&&(o.cartesianToCartographic(i,scratchCartographic$9),i=a.project(scratchCartographic$9,scratchDestination));var h=e.camera,p=t.endTransform;defined(p)&&h._setTransform(p);var m=t.duration;defined(m)||(m=Math.ceil(Cartesian3.distance(h.position,i)/1e6)+2,m=Math.min(m,3));var f=defaultValue(t.heading,0),g=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),_=defaultValue(t.roll,0),y=e.screenSpaceCameraController;y.enableInputs=!1;var v=wrapCallback(y,t.complete),C=wrapCallback(y,t.cancel),S=h.frustum,x=e.mode===SceneMode$1.SCENE2D;if(x=(x=(x=(x=x&&Cartesian2.equalsEpsilon(h.position,i,CesiumMath.EPSILON6))&&CesiumMath.equalsEpsilon(Math.max(S.right-S.left,S.top-S.bottom),i.z,CesiumMath.EPSILON6))||e.mode!==SceneMode$1.SCENE2D&&Cartesian3.equalsEpsilon(i,h.position,CesiumMath.EPSILON10))&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(f),CesiumMath.negativePiToPi(h.heading),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(g),CesiumMath.negativePiToPi(h.pitch),CesiumMath.EPSILON10)&&CesiumMath.equalsEpsilon(CesiumMath.negativePiToPi(_),CesiumMath.negativePiToPi(h.roll),CesiumMath.EPSILON10))return emptyFlight(v,C);var T=new Array(4);if(T[SceneMode$1.SCENE2D]=createUpdate2D,T[SceneMode$1.SCENE3D]=createUpdate3D,T[SceneMode$1.COLUMBUS_VIEW]=createUpdateCV,m<=0){return emptyFlight(function(){T[r](e,1,i,f,g,_,s,l,c,u)({time:1}),"function"==typeof v&&v()},C)}var b=T[r](e,m,i,f,g,_,s,l,c,u);if(!defined(d)){var E=h.positionCartographic.height;d=(r===SceneMode$1.SCENE3D?o.cartesianToCartographic(i).height:i.z)<E&&11500<E?EasingFunction$1.CUBIC_OUT:EasingFunction$1.QUINTIC_IN_OUT}return{duration:m,easingFunction:d,startObject:{time:0},stopObject:{time:m},update:b,complete:v,cancel:C}};var MapMode2D={ROTATE:0,INFINITE_SCROLL:1},MapMode2D$1=freezeObject$1(MapMode2D);function Camera(e){this._scene=e,this._transform=Matrix4.clone(Matrix4.IDENTITY),this._invTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualTransform=Matrix4.clone(Matrix4.IDENTITY),this._actualInvTransform=Matrix4.clone(Matrix4.IDENTITY),this._transformChanged=!1,this.position=new Cartesian3,this._position=new Cartesian3,this._positionWC=new Cartesian3,this._positionCartographic=new Cartographic,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new Cartesian3,this._direction=new Cartesian3,this._directionWC=new Cartesian3,this.up=new Cartesian3,this._up=new Cartesian3,this._upWC=new Cartesian3,this.right=new Cartesian3,this._right=new Cartesian3,this._rightWC=new Cartesian3,this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.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 Event,this._moveEnd=new Event,this._changed=new Event,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this.percentageChanged=.5,this._viewMatrix=new Matrix4,this._invViewMatrix=new Matrix4,updateViewMatrix(this),this._mode=SceneMode$1.SCENE3D,this._modeChanged=!0;var t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._max2Dfrustum=void 0,this._suspendTerrainAdjustment=!1,rectangleCameraPosition3D(this,Camera.DEFAULT_VIEW_RECTANGLE,this.position,!0);var i=Cartesian3.magnitude(this.position);i+=i*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(this.position,this.position),Cartesian3.multiplyByScalar(this.position,i,this.position)}function updateViewMatrix(e){Matrix4.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),Matrix4.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),Matrix4.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function updateCameraDeltas(e){if(defined(e._oldPositionWC)){e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;var t=Cartesian3.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=Cartesian3.magnitude(t),e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC),0<e.positionWCDeltaMagnitude?(e.timeSinceMoved=0,e._lastMovedTimestamp=getTimestamp$1()):e.timeSinceMoved=Math.max(getTimestamp$1()-e._lastMovedTimestamp,0)/1e3}else e._oldPositionWC=Cartesian3.clone(e.positionWC,e._oldPositionWC)}Camera.TRANSFORM_2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),Camera.TRANSFORM_2D_INVERSE=Matrix4.inverseTransformation(Camera.TRANSFORM_2D,new Matrix4),Camera.DEFAULT_VIEW_RECTANGLE=Rectangle.fromDegrees(-95,-20,-70,90),Camera.DEFAULT_VIEW_FACTOR=.5,Camera.DEFAULT_OFFSET=new HeadingPitchRange(0,-CesiumMath.PI_OVER_FOUR,0),Camera.prototype.hasCurrentFlight=function(){return defined(this._currentFlight)&&defined(this._scene.preloadFlightCamera)},Camera.prototype._updateCameraChanged=function(){var e=this;if(updateCameraDeltas(e),0!==e._changed.numberOfListeners){var t=e.percentageChanged;if(e._mode!==SceneMode$1.SCENE2D){if(!defined(e._changedDirection))return e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),void(e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection));var i,r=CesiumMath.acosClamped(Cartesian3.dot(e.directionWC,e._changedDirection));i=defined(e.frustum.fovy)?r/(.5*e.frustum.fovy):r;var n=Cartesian3.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(t<i||t<n)&&(e._changed.raiseEvent(Math.max(i,n)),e._changedPosition=Cartesian3.clone(e.positionWC,e._changedPosition),e._changedDirection=Cartesian3.clone(e.directionWC,e._changedDirection))}else{if(!defined(e._changedFrustum))return e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),void(e._changedFrustum=e.frustum.clone());var a,o=e.position,s=e._changedPosition,l=e.frustum,c=e._changedFrustum,u=o.x+l.left,d=o.x+l.right,h=s.x+c.left,p=s.x+c.right,m=o.y+l.bottom,f=o.y+l.top,g=s.y+c.bottom,_=s.y+c.top,y=Math.max(u,h),v=Math.min(d,p),C=Math.max(m,g),S=Math.min(f,_);if(v<=y||f<=C)a=1;else{var x=c;u<h&&p<d&&m<g&&_<f&&(x=l),a=1-(v-y)*(S-C)/((x.right-x.left)*(x.top-x.bottom))}t<a&&(e._changed.raiseEvent(a),e._changedPosition=Cartesian3.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum))}}};var scratchAdjustHeightTransform=new Matrix4,scratchAdjustHeightCartographic=new Cartographic;function convertTransformForColumbusView(e){Transforms.basisTo2D(e._projection,e._transform,e._actualTransform)}Camera.prototype._adjustHeightForTerrain=function(){var e=this._scene,t=e.screenSpaceCameraController,i=t.enableCollisionDetection,r=t.minimumCollisionTerrainHeight,n=t.minimumZoomDistance;if(!this._suspendTerrainAdjustment&&i){var a=this._mode,o=e.globe;if(defined(o)&&a!==SceneMode$1.SCENE2D&&a!==SceneMode$1.MORPHING){var s,l,c=o.ellipsoid,u=e.mapProjection;Matrix4.equals(this.transform,Matrix4.IDENTITY)||(s=Matrix4.clone(this.transform,scratchAdjustHeightTransform),l=Cartesian3.magnitude(this.position),this._setTransform(Matrix4.IDENTITY));var d=scratchAdjustHeightCartographic;a===SceneMode$1.SCENE3D?c.cartesianToCartographic(this.position,d):u.unproject(this.position,d);var h=!1;if(d.height<r){var p=o.getHeight(d);if(defined(p)&&(p+=n,d.height<p)){if(ExpandByMars.underEarth.enable&&d.height>p-ExpandByMars.underEarth.enableDepth)return;d.height=p,a===SceneMode$1.SCENE3D?c.cartographicToCartesian(d,this.position):u.project(d,this.position),h=!0}}defined(s)&&(this._setTransform(s),h&&(Cartesian3.normalize(this.position,this.position),Cartesian3.negate(this.position,this.direction),Cartesian3.multiplyByScalar(this.position,Math.max(l,n),this.position),Cartesian3.normalize(this.direction,this.direction),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.cross(this.right,this.direction,this.up)))}}};var scratchCartographic$a=new Cartographic,scratchCartesian3Projection$1=new Cartesian3,scratchCartesian3$c=new Cartesian3,scratchCartesian4Origin=new Cartesian4,scratchCartesian4NewOrigin=new Cartesian4,scratchCartesian4NewXAxis=new Cartesian4,scratchCartesian4NewYAxis=new Cartesian4,scratchCartesian4NewZAxis=new Cartesian4;function convertTransformFor2D(e){var t=e._projection,i=t.ellipsoid,r=Matrix4.getColumn(e._transform,3,scratchCartesian4Origin),n=i.cartesianToCartographic(r,scratchCartographic$a),a=t.project(n,scratchCartesian3Projection$1),o=scratchCartesian4NewOrigin;o.x=a.z,o.y=a.x,o.z=a.y,o.w=1;var s=Cartesian4.clone(Cartesian4.UNIT_X,scratchCartesian4NewZAxis),l=Cartesian4.add(Matrix4.getColumn(e._transform,0,scratchCartesian3$c),r,scratchCartesian3$c);i.cartesianToCartographic(l,n),t.project(n,a);var c=scratchCartesian4NewXAxis;c.x=a.z,c.y=a.x,c.z=a.y,c.w=0,Cartesian3.subtract(c,o,c),c.x=0;var u=scratchCartesian4NewYAxis;if(Cartesian3.magnitudeSquared(c)>CesiumMath.EPSILON10)Cartesian3.cross(s,c,u);else{var d=Cartesian4.add(Matrix4.getColumn(e._transform,1,scratchCartesian3$c),r,scratchCartesian3$c);i.cartesianToCartographic(d,n),t.project(n,a),u.x=a.z,u.y=a.x,u.z=a.y,u.w=0,Cartesian3.subtract(u,o,u),u.x=0,Cartesian3.magnitudeSquared(u)<CesiumMath.EPSILON10&&(Cartesian4.clone(Cartesian4.UNIT_Y,c),Cartesian4.clone(Cartesian4.UNIT_Z,u))}Cartesian3.cross(u,s,c),Cartesian3.normalize(c,c),Cartesian3.cross(s,c,u),Cartesian3.normalize(u,u),Matrix4.setColumn(e._actualTransform,0,c,e._actualTransform),Matrix4.setColumn(e._actualTransform,1,u,e._actualTransform),Matrix4.setColumn(e._actualTransform,2,s,e._actualTransform),Matrix4.setColumn(e._actualTransform,3,o,e._actualTransform)}var scratchCartesian$4=new Cartesian3;function updateMembers(e){var t=e._mode,i=!1,r=0;t===SceneMode$1.SCENE2D&&(i=(r=e.frustum.right-e.frustum.left)!==e._positionCartographic.height);var n=e._position,a=!Cartesian3.equals(n,e.position)||i;a&&(n=Cartesian3.clone(e.position,e._position));var o=e._direction,s=!Cartesian3.equals(o,e.direction);s&&(Cartesian3.normalize(e.direction,e.direction),o=Cartesian3.clone(e.direction,e._direction));var l=e._up,c=!Cartesian3.equals(l,e.up);c&&(Cartesian3.normalize(e.up,e.up),l=Cartesian3.clone(e.up,e._up));var u=e._right,d=!Cartesian3.equals(u,e.right);d&&(Cartesian3.normalize(e.right,e.right),u=Cartesian3.clone(e.right,e._right));var h=e._transformChanged||e._modeChanged;e._transformChanged=!1,h&&(Matrix4.inverseTransformation(e._transform,e._invTransform),e._mode===SceneMode$1.COLUMBUS_VIEW||e._mode===SceneMode$1.SCENE2D?Matrix4.equals(Matrix4.IDENTITY,e._transform)?Matrix4.clone(Camera.TRANSFORM_2D,e._actualTransform):e._mode===SceneMode$1.COLUMBUS_VIEW?convertTransformForColumbusView(e):convertTransformFor2D(e):Matrix4.clone(e._transform,e._actualTransform),Matrix4.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);var p=e._actualTransform;if(a||h)if(e._positionWC=Matrix4.multiplyByPoint(p,n,e._positionWC),t===SceneMode$1.SCENE3D||t===SceneMode$1.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{var m=scratchCartesian$4;m.x=e._positionWC.y,m.y=e._positionWC.z,m.z=e._positionWC.x,t===SceneMode$1.SCENE2D&&(m.z=r),e._projection.unproject(m,e._positionCartographic)}if(s||c||d){var f=Cartesian3.dot(o,Cartesian3.cross(l,u,scratchCartesian$4));if(Math.abs(1-f)>CesiumMath.EPSILON2){var g=1/Cartesian3.magnitudeSquared(l),_=Cartesian3.dot(l,o)*g,y=Cartesian3.multiplyByScalar(o,_,scratchCartesian$4);l=Cartesian3.normalize(Cartesian3.subtract(l,y,e._up),e._up),Cartesian3.clone(l,e.up),u=Cartesian3.cross(o,l,e._right),Cartesian3.clone(u,e.right)}}(s||h)&&(e._directionWC=Matrix4.multiplyByPointAsVector(p,o,e._directionWC),Cartesian3.normalize(e._directionWC,e._directionWC)),(c||h)&&(e._upWC=Matrix4.multiplyByPointAsVector(p,l,e._upWC),Cartesian3.normalize(e._upWC,e._upWC)),(d||h)&&(e._rightWC=Matrix4.multiplyByPointAsVector(p,u,e._rightWC),Cartesian3.normalize(e._rightWC,e._rightWC)),(a||s||c||d||h)&&updateViewMatrix(e)}function getHeading(e,t){var i;return i=CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)?Math.atan2(t.y,t.x)-CesiumMath.PI_OVER_TWO:Math.atan2(e.y,e.x)-CesiumMath.PI_OVER_TWO,CesiumMath.TWO_PI-CesiumMath.zeroToTwoPi(i)}function getPitch(e){return CesiumMath.PI_OVER_TWO-CesiumMath.acosClamped(e.z)}function getRoll(e,t,i){var r=0;return CesiumMath.equalsEpsilon(Math.abs(e.z),1,CesiumMath.EPSILON3)||(r=Math.atan2(-i.z,t.z),r=CesiumMath.zeroToTwoPi(r+CesiumMath.TWO_PI)),r}var scratchHPRMatrix1=new Matrix4,scratchHPRMatrix2=new Matrix4;defineProperties$1(Camera.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return updateMembers(this),this._invTransform}},viewMatrix:{get:function(){return updateMembers(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return updateMembers(this),this._invViewMatrix}},positionCartographic:{get:function(){return updateMembers(this),this._positionCartographic}},positionWC:{get:function(){return updateMembers(this),this._positionWC}},directionWC:{get:function(){return updateMembers(this),this._directionWC}},upWC:{get:function(){return updateMembers(this),this._upWC}},rightWC:{get:function(){return updateMembers(this),this._rightWC}},heading:{get:function(){if(this._mode!==SceneMode$1.MORPHING){var e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);var r=getHeading(this.direction,this.up);return this._setTransform(t),r}}},pitch:{get:function(){if(this._mode!==SceneMode$1.MORPHING){var e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);var r=getPitch(this.direction);return this._setTransform(t),r}}},roll:{get:function(){if(this._mode!==SceneMode$1.MORPHING){var e=this._projection.ellipsoid,t=Matrix4.clone(this._transform,scratchHPRMatrix1),i=Transforms.eastNorthUpToFixedFrame(this.positionWC,e,scratchHPRMatrix2);this._setTransform(i);var r=getRoll(this.direction,this.up,this.right);return this._setTransform(t),r}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}}),Camera.prototype.update=function(e){var t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==SceneMode$1.MORPHING,t=this._mode===SceneMode$1.SCENE2D),t){var i=this._max2Dfrustum=this.frustum.clone(),r=i.top/i.right;i.right=2*this._maxCoord.x,i.left=-i.right,i.top=r*i.right,i.bottom=-i.top}this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,this.position);var n=this._scene.globe,a=!defined(n)||n._surface.tileProvider.ready&&0===n._surface._tileLoadQueueHigh.length&&0===n._surface._tileLoadQueueMedium.length&&0===n._surface._tileLoadQueueLow.length&&0===n._surface._debug.tilesWaitingForChildren;this._suspendTerrainAdjustment&&(this._suspendTerrainAdjustment=!a),a&&this._adjustHeightForTerrain()};var setTransformPosition=new Cartesian3,setTransformUp=new Cartesian3,setTransformDirection=new Cartesian3;Camera.prototype._setTransform=function(e){var t=Cartesian3.clone(this.positionWC,setTransformPosition),i=Cartesian3.clone(this.upWC,setTransformUp),r=Cartesian3.clone(this.directionWC,setTransformDirection);Matrix4.clone(e,this._transform),this._transformChanged=!0,updateMembers(this);var n=this._actualInvTransform;Matrix4.multiplyByPoint(n,t,this.position),Matrix4.multiplyByPointAsVector(n,r,this.direction),Matrix4.multiplyByPointAsVector(n,i,this.up),Cartesian3.cross(this.direction,this.up,this.right),updateMembers(this)};var scratchAdjustOrtghographicFrustumMousePosition=new Cartesian2,pickGlobeScratchRay=new Ray,scratchRayIntersection=new Cartesian3,scratchDepthIntersection=new Cartesian3;Camera.prototype._adjustOrthographicFrustum=function(e){if(this.frustum instanceof OrthographicFrustum&&(e||!(this._positionCartographic.height<15e4)))if(Matrix4.equals(Matrix4.IDENTITY,this.transform)){var t,i,r=this._scene,n=r.globe;if(defined(n)){var a=scratchAdjustOrtghographicFrustumMousePosition;a.x=r.drawingBufferWidth/2,a.y=r.drawingBufferHeight/2;var o=this.getPickRay(a,pickGlobeScratchRay);if(t=n.pickWorldCoordinates(o,r,scratchRayIntersection),r.pickPositionSupported&&(i=r.pickPositionWorldCoordinates(a,scratchDepthIntersection)),defined(t)&&defined(i)){var s=defined(i)?Cartesian3.distance(i,this.positionWC):Number.POSITIVE_INFINITY,l=defined(t)?Cartesian3.distance(t,this.positionWC):Number.POSITIVE_INFINITY;this.frustum.width=Math.min(s,l)}else defined(i)?this.frustum.width=Cartesian3.distance(i,this.positionWC):defined(t)&&(this.frustum.width=Cartesian3.distance(t,this.positionWC))}if(!defined(n)||!defined(t)&&!defined(i)){var c=Math.max(this.positionCartographic.height,0);this.frustum.width=c}}else this.frustum.width=Cartesian3.magnitude(this.position)};var scratchSetViewCartesian=new Cartesian3,scratchSetViewTransform1=new Matrix4,scratchSetViewTransform2=new Matrix4,scratchSetViewQuaternion=new Quaternion,scratchSetViewMatrix3=new Matrix3,scratchSetViewCartographic=new Cartographic;function setView3D(e,t,i){var r=Matrix4.clone(e.transform,scratchSetViewTransform1),n=Transforms.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,scratchSetViewTransform2);e._setTransform(n),Cartesian3.clone(Cartesian3.ZERO,e.position),i.heading=i.heading-CesiumMath.PI_OVER_TWO;var a=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),o=Matrix3.fromQuaternion(a,scratchSetViewMatrix3);Matrix3.getColumn(o,0,e.direction),Matrix3.getColumn(o,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(r),e._adjustOrthographicFrustum(!0)}function setViewCV(e,t,i,r){var n=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(r){var a=e._projection,o=a.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=a.project(o,scratchSetViewCartesian)}Cartesian3.clone(t,e.position)}i.heading=i.heading-CesiumMath.PI_OVER_TWO;var s=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),l=Matrix3.fromQuaternion(s,scratchSetViewMatrix3);Matrix3.getColumn(l,0,e.direction),Matrix3.getColumn(l,2,e.up),Cartesian3.cross(e.direction,e.up,e.right),e._setTransform(n),e._adjustOrthographicFrustum(!0)}function setView2D(e,t,i,r){var n=Matrix4.clone(e.transform,scratchSetViewTransform1);if(e._setTransform(Matrix4.IDENTITY),!Cartesian3.equals(t,e.positionWC)){if(r){var a=e._projection,o=a.ellipsoid.cartesianToCartographic(t,scratchSetViewCartographic);t=a.project(o,scratchSetViewCartesian)}Cartesian2.clone(t,e.position);var s=.5*-t.z,l=-s,c=e.frustum;if(s<l){var u=c.top/c.right;c.right=l,c.left=s,c.top=c.right*u,c.bottom=-c.top}}if(e._scene.mapMode2D===MapMode2D$1.ROTATE){i.heading=i.heading-CesiumMath.PI_OVER_TWO,i.pitch=-CesiumMath.PI_OVER_TWO,i.roll=0;var d=Quaternion.fromHeadingPitchRoll(i,scratchSetViewQuaternion),h=Matrix3.fromQuaternion(d,scratchSetViewMatrix3);Matrix3.getColumn(h,2,e.up),Cartesian3.cross(e.direction,e.up,e.right)}e._setTransform(n)}var scratchToHPRDirection=new Cartesian3,scratchToHPRUp=new Cartesian3,scratchToHPRRight=new Cartesian3;function directionUpToHeadingPitchRoll(e,t,i,r){var n=Cartesian3.clone(i.direction,scratchToHPRDirection),a=Cartesian3.clone(i.up,scratchToHPRUp);if(e._scene.mode===SceneMode$1.SCENE3D){var o=e._projection.ellipsoid,s=Transforms.eastNorthUpToFixedFrame(t,o,scratchHPRMatrix1),l=Matrix4.inverseTransformation(s,scratchHPRMatrix2);Matrix4.multiplyByPointAsVector(l,n,n),Matrix4.multiplyByPointAsVector(l,a,a)}var c=Cartesian3.cross(n,a,scratchToHPRRight);return r.heading=getHeading(n,a),r.pitch=getPitch(n),r.roll=getRoll(n,a,c),r}var scratchSetViewOptions={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},scratchHpr=new HeadingPitchRoll;Camera.prototype.setView=function(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).orientation,defaultValue.EMPTY_OBJECT),i=this._mode;if(i!==SceneMode$1.MORPHING){defined(e.endTransform)&&this._setTransform(e.endTransform);var r=defaultValue(e.convert,!0),n=defaultValue(e.destination,Cartesian3.clone(this.positionWC,scratchSetViewCartesian));defined(n)&&defined(n.west)&&(n=this.getRectangleCameraCoordinates(n,scratchSetViewCartesian),r=!1),defined(t.direction)&&(t=directionUpToHeadingPitchRoll(this,n,t,scratchSetViewOptions.orientation)),scratchHpr.heading=defaultValue(t.heading,0),scratchHpr.pitch=defaultValue(t.pitch,-CesiumMath.PI_OVER_TWO),scratchHpr.roll=defaultValue(t.roll,0),this._suspendTerrainAdjustment=!0,i===SceneMode$1.SCENE3D?setView3D(this,n,scratchHpr):i===SceneMode$1.SCENE2D?setView2D(this,n,scratchHpr,r):setViewCV(this,n,scratchHpr,r)}};var pitchScratch=new Cartesian3;function clampMove2D(e,t){var i,r,n=e._scene.mapMode2D===MapMode2D$1.ROTATE,a=e._maxCoord.x,o=e._maxCoord.y;i=n?-(r=a):(r=t.x-2*a,t.x+2*a),t.x>a&&(t.x=r),t.x<-a&&(t.x=i),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}Camera.prototype.flyHome=function(e){var t=this._mode;if(t===SceneMode$1.MORPHING&&this._scene.completeMorph(),t===SceneMode$1.SCENE2D)this.flyTo({destination:Camera.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:Matrix4.IDENTITY});else if(t===SceneMode$1.SCENE3D){var i=this.getRectangleCameraCoordinates(Camera.DEFAULT_VIEW_RECTANGLE),r=Cartesian3.magnitude(i);r+=r*Camera.DEFAULT_VIEW_FACTOR,Cartesian3.normalize(i,i),Cartesian3.multiplyByScalar(i,r,i),this.flyTo({destination:i,duration:e,endTransform:Matrix4.IDENTITY})}else if(t===SceneMode$1.COLUMBUS_VIEW){var n=this._projection.ellipsoid.maximumRadius,a=new Cartesian3(0,-1,1);a=Cartesian3.multiplyByScalar(Cartesian3.normalize(a,a),5*n,a),this.flyTo({destination:a,duration:e,orientation:{heading:0,pitch:-Math.acos(Cartesian3.normalize(a,pitchScratch).z),roll:0},endTransform:Matrix4.IDENTITY,convert:!1})}},Camera.prototype.worldToCameraCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualInvTransform,e,t)},Camera.prototype.worldToCameraCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualInvTransform,e,t)},Camera.prototype.cameraToWorldCoordinates=function(e,t){return defined(t)||(t=new Cartesian4),updateMembers(this),Matrix4.multiplyByVector(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesPoint=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPoint(this._actualTransform,e,t)},Camera.prototype.cameraToWorldCoordinatesVector=function(e,t){return defined(t)||(t=new Cartesian3),updateMembers(this),Matrix4.multiplyByPointAsVector(this._actualTransform,e,t)};var moveScratch=new Cartesian3;Camera.prototype.move=function(e,t){var i=this.position;Cartesian3.multiplyByScalar(e,t,moveScratch),Cartesian3.add(i,moveScratch,i),this._mode===SceneMode$1.SCENE2D&&clampMove2D(this,i),this._adjustOrthographicFrustum(!0)},Camera.prototype.moveForward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D(this,e):this.move(this.direction,e)},Camera.prototype.moveBackward=function(e){e=defaultValue(e,this.defaultMoveAmount),this._mode===SceneMode$1.SCENE2D?zoom2D(this,-e):this.move(this.direction,-e)},Camera.prototype.moveUp=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,e)},Camera.prototype.moveDown=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.up,-e)},Camera.prototype.moveRight=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,e)},Camera.prototype.moveLeft=function(e){e=defaultValue(e,this.defaultMoveAmount),this.move(this.right,-e)},Camera.prototype.lookLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,-e)},Camera.prototype.lookRight=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.up,e)},Camera.prototype.lookUp=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,-e)},Camera.prototype.lookDown=function(e){e=defaultValue(e,this.defaultLookAmount),this._mode!==SceneMode$1.SCENE2D&&this.look(this.right,e)};var lookScratchQuaternion=new Quaternion,lookScratchMatrix=new Matrix3;Camera.prototype.look=function(e,t){var i=defaultValue(t,this.defaultLookAmount),r=Quaternion.fromAxisAngle(e,-i,lookScratchQuaternion),n=Matrix3.fromQuaternion(r,lookScratchMatrix),a=this.direction,o=this.up,s=this.right;Matrix3.multiplyByVector(n,a,a),Matrix3.multiplyByVector(n,o,o),Matrix3.multiplyByVector(n,s,s)},Camera.prototype.twistLeft=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,e)},Camera.prototype.twistRight=function(e){e=defaultValue(e,this.defaultLookAmount),this.look(this.direction,-e)};var rotateScratchQuaternion=new Quaternion,rotateScratchMatrix=new Matrix3;Camera.prototype.rotate=function(e,t){var i=defaultValue(t,this.defaultRotateAmount),r=Quaternion.fromAxisAngle(e,-i,rotateScratchQuaternion),n=Matrix3.fromQuaternion(r,rotateScratchMatrix);Matrix3.multiplyByVector(n,this.position,this.position),Matrix3.multiplyByVector(n,this.direction,this.direction),Matrix3.multiplyByVector(n,this.up,this.up),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)},Camera.prototype.rotateDown=function(e){rotateVertical(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.rotateUp=function(e){rotateVertical(this,-(e=defaultValue(e,this.defaultRotateAmount)))};var rotateVertScratchP=new Cartesian3,rotateVertScratchA=new Cartesian3,rotateVertScratchTan=new Cartesian3,rotateVertScratchNegate=new Cartesian3;function rotateVertical(e,t){var i=e.position;if(defined(e.constrainedAxis)&&!Cartesian3.equalsEpsilon(e.position,Cartesian3.ZERO,CesiumMath.EPSILON2)){var r=Cartesian3.normalize(i,rotateVertScratchP),n=Cartesian3.equalsEpsilon(r,e.constrainedAxis,CesiumMath.EPSILON2),a=Cartesian3.equalsEpsilon(r,Cartesian3.negate(e.constrainedAxis,rotateVertScratchNegate),CesiumMath.EPSILON2);if(n||a)(n&&t<0||a&&0<t)&&e.rotate(e.right,t);else{var o=Cartesian3.normalize(e.constrainedAxis,rotateVertScratchA),s=Cartesian3.dot(r,o),l=CesiumMath.acosClamped(s);0<t&&l<t&&(t=l-CesiumMath.EPSILON4),s=Cartesian3.dot(r,Cartesian3.negate(o,rotateVertScratchNegate)),l=CesiumMath.acosClamped(s),t<0&&l<-t&&(t=-l+CesiumMath.EPSILON4);var c=Cartesian3.cross(o,r,rotateVertScratchTan);e.rotate(c,t)}}else e.rotate(e.right,t)}function rotateHorizontal(e,t){defined(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function zoom2D(e,t){var i,r=e.frustum;if(t*=.5,Math.abs(r.top)+Math.abs(r.bottom)>Math.abs(r.left)+Math.abs(r.right)){var n=r.top-t,a=r.bottom+t,o=e._maxCoord.y;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(o*=e.maximumZoomFactor),o<a&&(n=-(a=o)),n<=a&&(a=-(n=1)),i=r.right/r.top,r.top=n,r.bottom=a,r.right=r.top*i,r.left=-r.right}else{var s=r.right-t,l=r.left+t,c=e._maxCoord.x;e._scene.mapMode2D===MapMode2D$1.ROTATE&&(c*=e.maximumZoomFactor),c<s&&(l=-(s=c)),s<=l&&(l=-(s=1)),i=r.top/r.right,r.right=s,r.left=l,r.top=r.right*i,r.bottom=-r.top}}function zoom3D(e,t){e.move(e.direction,t)}Camera.prototype.rotateRight=function(e){rotateHorizontal(this,-(e=defaultValue(e,this.defaultRotateAmount)))},Camera.prototype.rotateLeft=function(e){rotateHorizontal(this,e=defaultValue(e,this.defaultRotateAmount))},Camera.prototype.zoomIn=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D(this,e):zoom3D(this,e)},Camera.prototype.zoomOut=function(e){e=defaultValue(e,this.defaultZoomAmount),this._mode===SceneMode$1.SCENE2D?zoom2D(this,-e):zoom3D(this,-e)},Camera.prototype.getMagnitude=function(){return this._mode===SceneMode$1.SCENE3D?Cartesian3.magnitude(this.position):this._mode===SceneMode$1.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===SceneMode$1.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};var scratchLookAtMatrix4=new Matrix4;Camera.prototype.lookAt=function(e,t){var i=Transforms.eastNorthUpToFixedFrame(e,Ellipsoid.WGS84,scratchLookAtMatrix4);this.lookAtTransform(i,t)};var scratchLookAtHeadingPitchRangeOffset=new Cartesian3,scratchLookAtHeadingPitchRangeQuaternion1=new Quaternion,scratchLookAtHeadingPitchRangeQuaternion2=new Quaternion,scratchHeadingPitchRangeMatrix3=new Matrix3;function offsetFromHeadingPitchRange(e,t,i){t=CesiumMath.clamp(t,-CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO),e=CesiumMath.zeroToTwoPi(e)-CesiumMath.PI_OVER_TWO;var r=Quaternion.fromAxisAngle(Cartesian3.UNIT_Y,-t,scratchLookAtHeadingPitchRangeQuaternion1),n=Quaternion.fromAxisAngle(Cartesian3.UNIT_Z,-e,scratchLookAtHeadingPitchRangeQuaternion2),a=Quaternion.multiply(n,r,n),o=Matrix3.fromQuaternion(a,scratchHeadingPitchRangeMatrix3),s=Cartesian3.clone(Cartesian3.UNIT_X,scratchLookAtHeadingPitchRangeOffset);return Matrix3.multiplyByVector(o,s,s),Cartesian3.negate(s,s),Cartesian3.multiplyByScalar(s,i,s),s}Camera.prototype.lookAtTransform=function(e,t){if(this._setTransform(e),defined(t)){var i;if(i=defined(t.heading)?offsetFromHeadingPitchRange(t.heading,t.pitch,t.range):t,this._mode===SceneMode$1.SCENE2D){Cartesian2.clone(Cartesian2.ZERO,this.position),Cartesian3.negate(i,this.up),this.up.z=0,Cartesian3.magnitudeSquared(this.up)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_Y,this.up),Cartesian3.normalize(this.up,this.up),this._setTransform(Matrix4.IDENTITY),Cartesian3.negate(Cartesian3.UNIT_Z,this.direction),Cartesian3.cross(this.direction,this.up,this.right),Cartesian3.normalize(this.right,this.right);var r=this.frustum,n=r.top/r.right;return r.right=.5*Cartesian3.magnitude(i),r.left=-r.right,r.top=n*r.right,r.bottom=-r.top,void this._setTransform(e)}Cartesian3.clone(i,this.position),Cartesian3.negate(this.position,this.direction),Cartesian3.normalize(this.direction,this.direction),Cartesian3.cross(this.direction,Cartesian3.UNIT_Z,this.right),Cartesian3.magnitudeSquared(this.right)<CesiumMath.EPSILON10&&Cartesian3.clone(Cartesian3.UNIT_X,this.right),Cartesian3.normalize(this.right,this.right),Cartesian3.cross(this.right,this.direction,this.up),Cartesian3.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)}};var viewRectangle3DCartographic1=new Cartographic,viewRectangle3DCartographic2=new Cartographic,viewRectangle3DNorthEast=new Cartesian3,viewRectangle3DSouthWest=new Cartesian3,viewRectangle3DNorthWest=new Cartesian3,viewRectangle3DSouthEast=new Cartesian3,viewRectangle3DNorthCenter=new Cartesian3,viewRectangle3DSouthCenter=new Cartesian3,viewRectangle3DCenter=new Cartesian3,viewRectangle3DEquator=new Cartesian3,defaultRF={direction:new Cartesian3,right:new Cartesian3,up:new Cartesian3},viewRectangle3DEllipsoidGeodesic;function computeD(e,t,i,r){return Math.abs(Cartesian3.dot(t,i))/r-Cartesian3.dot(e,i)}function rectangleCameraPosition3D(e,t,i,r){var n=e._projection.ellipsoid,a=r?e:defaultRF,o=t.north,s=t.south,l=t.east,c=t.west;l<c&&(l+=CesiumMath.TWO_PI);var u,d=.5*(c+l);if(s<-CesiumMath.PI_OVER_TWO+CesiumMath.RADIANS_PER_DEGREE&&o>CesiumMath.PI_OVER_TWO-CesiumMath.RADIANS_PER_DEGREE)u=0;else{var h=viewRectangle3DCartographic1;h.longitude=d,h.latitude=o,h.height=0;var p=viewRectangle3DCartographic2;p.longitude=d,p.latitude=s,p.height=0;var m=viewRectangle3DEllipsoidGeodesic;defined(m)&&m.ellipsoid===n||(viewRectangle3DEllipsoidGeodesic=m=new EllipsoidGeodesic(void 0,void 0,n)),m.setEndPoints(h,p),u=m.interpolateUsingFraction(.5,viewRectangle3DCartographic1).latitude}var f=viewRectangle3DCartographic1;f.longitude=d,f.latitude=u,f.height=0;var g=n.cartographicToCartesian(f,viewRectangle3DCenter),_=viewRectangle3DCartographic1;_.longitude=l,_.latitude=o;var y=n.cartographicToCartesian(_,viewRectangle3DNorthEast);_.longitude=c;var v=n.cartographicToCartesian(_,viewRectangle3DNorthWest);_.longitude=d;var C=n.cartographicToCartesian(_,viewRectangle3DNorthCenter);_.latitude=s;var S=n.cartographicToCartesian(_,viewRectangle3DSouthCenter);_.longitude=l;var x=n.cartographicToCartesian(_,viewRectangle3DSouthEast);_.longitude=c;var T=n.cartographicToCartesian(_,viewRectangle3DSouthWest);Cartesian3.subtract(v,g,v),Cartesian3.subtract(x,g,x),Cartesian3.subtract(y,g,y),Cartesian3.subtract(T,g,T),Cartesian3.subtract(C,g,C),Cartesian3.subtract(S,g,S);var b=n.geodeticSurfaceNormal(g,a.direction);Cartesian3.negate(b,b);var E=Cartesian3.cross(b,Cartesian3.UNIT_Z,a.right);Cartesian3.normalize(E,E);var P,A=Cartesian3.cross(E,b,a.up);if(e.frustum instanceof OrthographicFrustum){var w,D,M=Math.max(Cartesian3.distance(y,v),Cartesian3.distance(x,T)),I=Math.max(Cartesian3.distance(y,x),Cartesian3.distance(v,T)),R=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,O=I*R;O<M?D=(w=M)/R:(D=I,w=O),P=Math.max(w,D)}else{var L=Math.tan(.5*e.frustum.fovy),F=e.frustum.aspectRatio*L;if(P=Math.max(computeD(b,A,v,L),computeD(b,A,x,L),computeD(b,A,y,L),computeD(b,A,T,L),computeD(b,A,C,L),computeD(b,A,S,L),computeD(b,E,v,F),computeD(b,E,x,F),computeD(b,E,y,F),computeD(b,E,T,F),computeD(b,E,C,F),computeD(b,E,S,F)),s<0&&0<o){var N=viewRectangle3DCartographic1;N.longitude=c,N.latitude=0,N.height=0;var B=n.cartographicToCartesian(N,viewRectangle3DEquator);Cartesian3.subtract(B,g,B),P=Math.max(P,computeD(b,A,B,L),computeD(b,E,B,F)),N.longitude=l,B=n.cartographicToCartesian(N,viewRectangle3DEquator),Cartesian3.subtract(B,g,B),P=Math.max(P,computeD(b,A,B,L),computeD(b,E,B,F))}}return Cartesian3.add(g,Cartesian3.multiplyByScalar(b,-P,viewRectangle3DEquator),i)}var viewRectangleCVCartographic=new Cartographic,viewRectangleCVNorthEast=new Cartesian3,viewRectangleCVSouthWest=new Cartesian3;function rectangleCameraPositionColumbusView(e,t,i){var r=e._projection;t.west>t.east&&(t=Rectangle.MAX_VALUE);var n=e._actualTransform,a=e._actualInvTransform,o=viewRectangleCVCartographic;o.longitude=t.east,o.latitude=t.north;var s=r.project(o,viewRectangleCVNorthEast);Matrix4.multiplyByPoint(n,s,s),Matrix4.multiplyByPoint(a,s,s),o.longitude=t.west,o.latitude=t.south;var l=r.project(o,viewRectangleCVSouthWest);if(Matrix4.multiplyByPoint(n,l,l),Matrix4.multiplyByPoint(a,l,l),i.x=.5*(s.x-l.x)+l.x,i.y=.5*(s.y-l.y)+l.y,defined(e.frustum.fovy)){var c=Math.tan(.5*e.frustum.fovy),u=e.frustum.aspectRatio*c;i.z=.5*Math.max((s.x-l.x)/u,(s.y-l.y)/c)}else{var d=s.x-l.x,h=s.y-l.y;i.z=Math.max(d,h)}return i}var viewRectangle2DCartographic=new Cartographic,viewRectangle2DNorthEast=new Cartesian3,viewRectangle2DSouthWest=new Cartesian3;function rectangleCameraPosition2D(e,t,i){var r=e._projection,n=t.east;t.west>t.east&&(e._scene.mapMode2D===MapMode2D$1.INFINITE_SCROLL?n+=CesiumMath.TWO_PI:n=(t=Rectangle.MAX_VALUE).east);var a=viewRectangle2DCartographic;a.longitude=n,a.latitude=t.north;var o=r.project(a,viewRectangle2DNorthEast);a.longitude=t.west,a.latitude=t.south;var s,l,c=r.project(a,viewRectangle2DSouthWest),u=.5*Math.abs(o.x-c.x),d=.5*Math.abs(o.y-c.y),h=e.frustum.right/e.frustum.top,p=d*h;return p<u?l=(s=u)/h:(l=d,s=p),d=Math.max(2*s,2*l),i.x=.5*(o.x-c.x)+c.x,i.y=.5*(o.y-c.y)+c.y,(a=r.unproject(i,a)).height=d,i=r.project(a,i)}Camera.prototype.getRectangleCameraCoordinates=function(e,t){var i=this._mode;return defined(t)||(t=new Cartesian3),i===SceneMode$1.SCENE3D?rectangleCameraPosition3D(this,e,t):i===SceneMode$1.COLUMBUS_VIEW?rectangleCameraPositionColumbusView(this,e,t):i===SceneMode$1.SCENE2D?rectangleCameraPosition2D(this,e,t):void 0};var pickEllipsoid3DRay=new Ray;function pickEllipsoid3D(e,t,i,r){i=defaultValue(i,Ellipsoid.WGS84);var n=e.getPickRay(t,pickEllipsoid3DRay),a=IntersectionTests.rayEllipsoid(n,i);if(a){var o=0<a.start?a.start:a.stop;return Ray.getPoint(n,o,r)}}var pickEllipsoid2DRay=new Ray;function pickMap2D(e,t,i,r){var n=e.getPickRay(t,pickEllipsoid2DRay).origin;n=Cartesian3.fromElements(n.y,n.z,0,n);var a=i.unproject(n);if(!(a.latitude<-CesiumMath.PI_OVER_TWO||a.latitude>CesiumMath.PI_OVER_TWO))return i.ellipsoid.cartographicToCartesian(a,r)}var pickEllipsoidCVRay=new Ray;function pickMapColumbusView(e,t,i,r){var n=e.getPickRay(t,pickEllipsoidCVRay),a=-n.origin.x/n.direction.x;Ray.getPoint(n,a,r);var o=i.unproject(new Cartesian3(r.y,r.z,0));if(!(o.latitude<-CesiumMath.PI_OVER_TWO||o.latitude>CesiumMath.PI_OVER_TWO||o.longitude<-Math.PI||o.longitude>Math.PI))return i.ellipsoid.cartographicToCartesian(o,r)}Camera.prototype.pickEllipsoid=function(e,t,i){var r=this._scene.canvas;if(0!==r.clientWidth&&0!==r.clientHeight){if(defined(i)||(i=new Cartesian3),t=defaultValue(t,Ellipsoid.WGS84),this._mode===SceneMode$1.SCENE3D)i=pickEllipsoid3D(this,e,t,i);else if(this._mode===SceneMode$1.SCENE2D)i=pickMap2D(this,e,this._projection,i);else{if(this._mode!==SceneMode$1.COLUMBUS_VIEW)return;i=pickMapColumbusView(this,e,this._projection,i)}return i}};var pickPerspCenter=new Cartesian3,pickPerspXDir=new Cartesian3,pickPerspYDir=new Cartesian3;function getPickRayPerspective(e,t,i){var r=e._scene.canvas,n=r.clientWidth,a=r.clientHeight,o=Math.tan(.5*e.frustum.fovy),s=e.frustum.aspectRatio*o,l=e.frustum.near,c=2/n*t.x-1,u=2/a*(a-t.y)-1,d=e.positionWC;Cartesian3.clone(d,i.origin);var h=Cartesian3.multiplyByScalar(e.directionWC,l,pickPerspCenter);Cartesian3.add(d,h,h);var p=Cartesian3.multiplyByScalar(e.rightWC,c*l*s,pickPerspXDir),m=Cartesian3.multiplyByScalar(e.upWC,u*l*o,pickPerspYDir),f=Cartesian3.add(h,p,i.direction);return Cartesian3.add(f,m,f),Cartesian3.subtract(f,d,f),Cartesian3.normalize(f,f),i}var scratchDirection=new Cartesian3;function getPickRayOrthographic(e,t,i){var r=e._scene.canvas,n=r.clientWidth,a=r.clientHeight,o=e.frustum;defined(o._offCenterFrustum)&&(o=o._offCenterFrustum);var s=2/n*t.x-1;s*=.5*(o.right-o.left);var l=2/a*(a-t.y)-1;l*=.5*(o.top-o.bottom);var c=i.origin;return Cartesian3.clone(e.position,c),Cartesian3.multiplyByScalar(e.right,s,scratchDirection),Cartesian3.add(scratchDirection,c,c),Cartesian3.multiplyByScalar(e.up,l,scratchDirection),Cartesian3.add(scratchDirection,c,c),Cartesian3.clone(e.directionWC,i.direction),e._mode!==SceneMode$1.COLUMBUS_VIEW&&e._mode!==SceneMode$1.SCENE2D||Cartesian3.fromElements(i.origin.z,i.origin.x,i.origin.y,i.origin),i}Camera.prototype.getPickRay=function(e,t){defined(t)||(t=new Ray);var i=this.frustum;return defined(i.aspectRatio)&&defined(i.fov)&&defined(i.near)?getPickRayPerspective(this,e,t):getPickRayOrthographic(this,e,t)};var scratchToCenter$1=new Cartesian3,scratchProj=new Cartesian3;Camera.prototype.distanceToBoundingSphere=function(e){var t=Cartesian3.subtract(this.positionWC,e.center,scratchToCenter$1),i=Cartesian3.multiplyByScalar(this.directionWC,Cartesian3.dot(t,this.directionWC),scratchProj);return Math.max(0,Cartesian3.magnitude(i)-e.radius)};var scratchPixelSize=new Cartesian2;function createAnimationTemplateCV(i,r,e,t,n,a){var o=Cartesian3.clone(r);return e.y>t?o.y-=e.y-t:e.y<-t&&(o.y+=-t-e.y),e.z>n?o.z-=e.z-n:e.z<-n&&(o.z+=-n-e.z),{easingFunction:EasingFunction$1.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:a,update:function(e){var t=Cartesian3.lerp(r,o,e.time,new Cartesian3);i.worldToCameraCoordinatesPoint(t,i.position)}}}Camera.prototype.getPixelSize=function(e,t,i){var r=this.distanceToBoundingSphere(e),n=this.frustum.getPixelDimensions(t,i,r,this._scene.pixelRatio,scratchPixelSize);return Math.max(n.x,n.y)};var normalScratch$4=new Cartesian3,centerScratch$4=new Cartesian3,posScratch=new Cartesian3,scratchCartesian3Subtract=new Cartesian3;function createAnimationCV(e,t){var i=e.position,r=e.direction,n=e.worldToCameraCoordinatesVector(Cartesian3.UNIT_X,normalScratch$4),a=-Cartesian3.dot(n,i)/Cartesian3.dot(n,r),o=Cartesian3.add(i,Cartesian3.multiplyByScalar(r,a,centerScratch$4),centerScratch$4);e.cameraToWorldCoordinatesPoint(o,o),i=e.cameraToWorldCoordinatesPoint(e.position,posScratch);var s=Math.tan(.5*e.frustum.fovy),l=e.frustum.aspectRatio*s,c=Cartesian3.magnitude(Cartesian3.subtract(i,o,scratchCartesian3Subtract)),u=l*c,d=s*c,h=e._maxCoord.x,p=e._maxCoord.y,m=Math.max(u-h,h),f=Math.max(d-p,p);if(i.z<-m||i.z>m||i.y<-f||i.y>f){var g=o.y<-m||o.y>m,_=o.z<-f||o.z>f;if(g||_)return createAnimationTemplateCV(e,i,o,m,f,t)}}Camera.prototype.createCorrectPositionTween=function(e){if(this._mode===SceneMode$1.COLUMBUS_VIEW)return createAnimationCV(this,e)};var scratchFlyToDestination=new Cartesian3,newOptions={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};function distanceToBoundingSphere3D(e,t){var i=e.frustum,r=Math.tan(.5*i.fovy),n=i.aspectRatio*r;return Math.max(t/n,t/r)}function distanceToBoundingSphere2D(e,t){var i,r,n=e.frustum;defined(n._offCenterFrustum)&&(n=n._offCenterFrustum);var a=n.right/n.top,o=t*a;return o<t?r=(i=t)/a:(r=t,i=o),1.5*Math.max(i,r)}Camera.prototype.cancelFlight=function(){defined(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)},Camera.prototype.flyTo=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).destination;if(this._mode!==SceneMode$1.MORPHING){this.cancelFlight();var i=defaultValue(e.orientation,defaultValue.EMPTY_OBJECT);if(defined(i.direction)&&(i=directionUpToHeadingPitchRoll(this,t,i,scratchSetViewOptions.orientation)),defined(e.duration)&&e.duration<=0){var r=scratchSetViewOptions;return r.destination=e.destination,r.orientation.heading=i.heading,r.orientation.pitch=i.pitch,r.orientation.roll=i.roll,r.convert=e.convert,r.endTransform=e.endTransform,this.setView(r),void("function"==typeof e.complete&&e.complete())}var n=defined(t.west);n&&(t=this.getRectangleCameraCoordinates(t,scratchFlyToDestination));var a,o=this;newOptions.destination=t,newOptions.heading=i.heading,newOptions.pitch=i.pitch,newOptions.roll=i.roll,newOptions.duration=e.duration,newOptions.complete=function(){a===o._currentFlight&&(o._currentFlight=void 0),defined(e.complete)&&e.complete()},newOptions.cancel=e.cancel,newOptions.endTransform=e.endTransform,newOptions.convert=!n&&e.convert,newOptions.maximumHeight=e.maximumHeight,newOptions.pitchAdjustHeight=e.pitchAdjustHeight,newOptions.flyOverLongitude=e.flyOverLongitude,newOptions.flyOverLongitudeWeight=e.flyOverLongitudeWeight,newOptions.easingFunction=e.easingFunction;var s=this._scene;a=s.tweens.add(CameraFlightPath.createTween(s,newOptions)),this._currentFlight=a;var l=this._scene.preloadFlightCamera;this._mode!==SceneMode$1.SCENE2D?(defined(l)||(l=Camera.clone(this)),l.setView({destination:t,orientation:i}),this._scene.preloadFlightCullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC)):l=void 0}};var MINIMUM_ZOOM=100;function adjustBoundingSphereOffset(e,t,i){defined(i)||(i=HeadingPitchRange.clone(Camera.DEFAULT_OFFSET));var r=e._scene.screenSpaceCameraController.minimumZoomDistance,n=e._scene.screenSpaceCameraController.maximumZoomDistance,a=i.range;if(!defined(a)||0===a){var o=t.radius;0===o?i.range=MINIMUM_ZOOM:e.frustum instanceof OrthographicFrustum||e._mode===SceneMode$1.SCENE2D?i.range=distanceToBoundingSphere2D(e,o):i.range=distanceToBoundingSphere3D(e,o),i.range=CesiumMath.clamp(i.range,r,n)}return i}Camera.prototype.viewBoundingSphere=function(e,t){t=adjustBoundingSphereOffset(this,e,t),this.lookAt(e.center,t)};var scratchflyToBoundingSphereTransform=new Matrix4,scratchflyToBoundingSphereDestination=new Cartesian3,scratchflyToBoundingSphereDirection=new Cartesian3,scratchflyToBoundingSphereUp=new Cartesian3,scratchflyToBoundingSphereRight=new Cartesian3,scratchFlyToBoundingSphereCart4=new Cartesian4,scratchFlyToBoundingSphereQuaternion=new Quaternion,scratchFlyToBoundingSphereMatrix3=new Matrix3;Camera.prototype.flyToBoundingSphere=function(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);var i=this._mode===SceneMode$1.SCENE2D||this._mode===SceneMode$1.COLUMBUS_VIEW;this._setTransform(Matrix4.IDENTITY);var r,n=adjustBoundingSphereOffset(this,e,t.offset);r=i?Cartesian3.multiplyByScalar(Cartesian3.UNIT_Z,n.range,scratchflyToBoundingSphereDestination):offsetFromHeadingPitchRange(n.heading,n.pitch,n.range);var a,o,s=Transforms.eastNorthUpToFixedFrame(e.center,Ellipsoid.WGS84,scratchflyToBoundingSphereTransform);if(Matrix4.multiplyByPoint(s,r,r),!i){if(a=Cartesian3.subtract(e.center,r,scratchflyToBoundingSphereDirection),Cartesian3.normalize(a,a),o=Matrix4.multiplyByPointAsVector(s,Cartesian3.UNIT_Z,scratchflyToBoundingSphereUp),1-Math.abs(Cartesian3.dot(a,o))<CesiumMath.EPSILON6){var l=Quaternion.fromAxisAngle(a,n.heading,scratchFlyToBoundingSphereQuaternion),c=Matrix3.fromQuaternion(l,scratchFlyToBoundingSphereMatrix3);Cartesian3.fromCartesian4(Matrix4.getColumn(s,1,scratchFlyToBoundingSphereCart4),o),Matrix3.multiplyByVector(c,o,o)}var u=Cartesian3.cross(a,o,scratchflyToBoundingSphereRight);Cartesian3.cross(u,a,o),Cartesian3.normalize(o,o)}this.flyTo({destination:r,orientation:{direction:a,up:o},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})};var scratchCartesian3_1=new Cartesian3,scratchCartesian3_2=new Cartesian3,scratchCartesian3_3=new Cartesian3,scratchCartesian3_4=new Cartesian3,horizonPoints=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeHorizonQuad(e,t){var i,r,n=t.radii,a=e.positionWC,o=Cartesian3.multiplyComponents(t.oneOverRadii,a,scratchCartesian3_1),s=Cartesian3.magnitude(o),l=Cartesian3.normalize(o,scratchCartesian3_2);r=Cartesian3.equalsEpsilon(l,Cartesian3.UNIT_Z,CesiumMath.EPSILON10)?(i=new Cartesian3(0,1,0),new Cartesian3(0,0,1)):(i=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,l,scratchCartesian3_3),scratchCartesian3_3),Cartesian3.normalize(Cartesian3.cross(l,i,scratchCartesian3_4),scratchCartesian3_4));var c=Math.sqrt(Cartesian3.magnitudeSquared(o)-1),u=Cartesian3.multiplyByScalar(l,1/s,scratchCartesian3_1),d=c/s,h=Cartesian3.multiplyByScalar(i,d,scratchCartesian3_2),p=Cartesian3.multiplyByScalar(r,d,scratchCartesian3_3),m=Cartesian3.add(u,p,horizonPoints[0]);Cartesian3.subtract(m,h,m),Cartesian3.multiplyComponents(n,m,m);var f=Cartesian3.subtract(u,p,horizonPoints[1]);Cartesian3.subtract(f,h,f),Cartesian3.multiplyComponents(n,f,f);var g=Cartesian3.subtract(u,p,horizonPoints[2]);Cartesian3.add(g,h,g),Cartesian3.multiplyComponents(n,g,g);var _=Cartesian3.add(u,p,horizonPoints[3]);return Cartesian3.add(_,h,_),Cartesian3.multiplyComponents(n,_,_),horizonPoints}var scratchPickCartesian2=new Cartesian2,scratchRectCartesian=new Cartesian3,cartoArray=[new Cartographic,new Cartographic,new Cartographic,new Cartographic];function addToResult(e,t,i,r,n,a){scratchPickCartesian2.x=e,scratchPickCartesian2.y=t;var o=r.pickEllipsoid(scratchPickCartesian2,n,scratchRectCartesian);return defined(o)?(cartoArray[i]=n.cartesianToCartographic(o,cartoArray[i]),1):(cartoArray[i]=n.cartesianToCartographic(a[i],cartoArray[i]),0)}Camera.prototype.computeViewRectangle=function(e,t){e=defaultValue(e,Ellipsoid.WGS84);var i=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),r=new BoundingSphere(Cartesian3.ZERO,e.maximumRadius);if(i.computeVisibility(r)!==Intersect$1.OUTSIDE){var n=this._scene.canvas,a=n.clientWidth,o=n.clientHeight,s=0,l=computeHorizonQuad(this,e);if(s+=addToResult(0,0,0,this,e,l),s+=addToResult(0,o,1,this,e,l),s+=addToResult(a,o,2,this,e,l),(s+=addToResult(a,0,3,this,e,l))<2)return Rectangle.MAX_VALUE;t=Rectangle.fromCartographicArray(cartoArray,t);for(var c=0,u=cartoArray[3].longitude,d=0;d<4;++d){var h=cartoArray[d].longitude,p=Math.abs(h-u);p>CesiumMath.PI?c+=CesiumMath.TWO_PI-p:c+=p,u=h}return CesiumMath.equalsEpsilon(Math.abs(c),CesiumMath.TWO_PI,CesiumMath.EPSILON9)&&(t.west=-CesiumMath.PI,t.east=CesiumMath.PI,0<=cartoArray[0].latitude?t.north=CesiumMath.PI_OVER_TWO:t.south=-CesiumMath.PI_OVER_TWO),t}},Camera.prototype.switchToPerspectiveFrustum=function(){if(!(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof PerspectiveFrustum)){var e=this._scene;this.frustum=new PerspectiveFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=CesiumMath.toRadians(60)}},Camera.prototype.switchToOrthographicFrustum=function(){if(!(this._mode===SceneMode$1.SCENE2D||this.frustum instanceof OrthographicFrustum)){var e=this._scene;this.frustum=new OrthographicFrustum,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.width=Cartesian3.magnitude(this.position),defined(this.frustum.projectionMatrix)&&this._adjustOrthographicFrustum(!0)}},Camera.clone=function(e,t){return defined(t)||(t=new Camera(e._scene)),Cartesian3.clone(e.position,t.position),Cartesian3.clone(e.direction,t.direction),Cartesian3.clone(e.up,t.up),Cartesian3.clone(e.right,t.right),Matrix4.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};var CameraEventType={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},CameraEventType$1=freezeObject$1(CameraEventType);function getKey(e,t){var i=e;return defined(t)&&(i+="+"+t),i}function clonePinchMovement(e,t){Cartesian2.clone(e.distance.startPosition,t.distance.startPosition),Cartesian2.clone(e.distance.endPosition,t.distance.endPosition),Cartesian2.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),Cartesian2.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function listenToPinch(t,e,n){var a=getKey(CameraEventType$1.PINCH,e),o=t._update,s=t._isDown,i=t._eventStartPosition,r=t._pressTime,l=t._releaseTime;o[a]=!0,s[a]=!1,i[a]=new Cartesian2;var c=t._movement[a];defined(c)||(c=t._movement[a]={}),c.distance={startPosition:new Cartesian2,endPosition:new Cartesian2},c.angleAndHeight={startPosition:new Cartesian2,endPosition:new Cartesian2},c.prevAngle=0,t._eventHandler.setInputAction(function(e){t._buttonsDown++,s[a]=!0,r[a]=new Date,Cartesian2.lerp(e.position1,e.position2,.5,i[a])},ScreenSpaceEventType$1.PINCH_START,e),t._eventHandler.setInputAction(function(){t._buttonsDown=Math.max(t._buttonsDown-1,0),s[a]=!1,l[a]=new Date},ScreenSpaceEventType$1.PINCH_END,e),t._eventHandler.setInputAction(function(e){if(s[a]){o[a]?(clonePinchMovement(e,c),o[a]=!1,c.prevAngle=c.angleAndHeight.startPosition.x):(Cartesian2.clone(e.distance.endPosition,c.distance.endPosition),Cartesian2.clone(e.angleAndHeight.endPosition,c.angleAndHeight.endPosition));for(var t=c.angleAndHeight.endPosition.x,i=c.prevAngle,r=2*Math.PI;t>=i+Math.PI;)t-=r;for(;t<i-Math.PI;)t+=r;c.angleAndHeight.endPosition.x=-t*n.clientWidth/12,c.angleAndHeight.startPosition.x=-i*n.clientWidth/12}},ScreenSpaceEventType$1.PINCH_MOVE,e)}function listenToWheel(e,t){var i=getKey(CameraEventType$1.WHEEL,t),r=e._update;r[i]=!0;var n=e._movement[i];defined(n)||(n=e._movement[i]={}),n.startPosition=new Cartesian2,n.endPosition=new Cartesian2,e._eventHandler.setInputAction(function(e){var t=15*CesiumMath.toRadians(e);r[i]?(Cartesian2.clone(Cartesian2.ZERO,n.startPosition),n.endPosition.x=0,n.endPosition.y=t,r[i]=!1):n.endPosition.y=n.endPosition.y+t},ScreenSpaceEventType$1.WHEEL,t)}function listenMouseButtonDownUp(t,e,i){var r=getKey(i,e),n=t._isDown,a=t._eventStartPosition,o=t._pressTime,s=t._releaseTime;n[r]=!1,a[r]=new Cartesian2;var l,c,u=t._lastMovement[r];defined(u)||(u=t._lastMovement[r]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),i===CameraEventType$1.LEFT_DRAG?(l=ScreenSpaceEventType$1.LEFT_DOWN,c=ScreenSpaceEventType$1.LEFT_UP):i===CameraEventType$1.RIGHT_DRAG?(l=ScreenSpaceEventType$1.RIGHT_DOWN,c=ScreenSpaceEventType$1.RIGHT_UP):i===CameraEventType$1.MIDDLE_DRAG&&(l=ScreenSpaceEventType$1.MIDDLE_DOWN,c=ScreenSpaceEventType$1.MIDDLE_UP),t._eventHandler.setInputAction(function(e){t._buttonsDown++,u.valid=!1,n[r]=!0,o[r]=new Date,Cartesian2.clone(e.position,a[r])},l,e),t._eventHandler.setInputAction(function(){t._buttonsDown=Math.max(t._buttonsDown-1,0),n[r]=!1,s[r]=new Date},c,e)}function cloneMouseMovement(e,t){Cartesian2.clone(e.startPosition,t.startPosition),Cartesian2.clone(e.endPosition,t.endPosition)}function listenMouseMove(n,a){var o=n._update,s=n._movement,l=n._lastMovement,c=n._isDown;for(var e in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(e)){var t=CameraEventType$1[e];if(defined(t)){var i=getKey(t,a);o[i]=!0,defined(n._lastMovement[i])||(n._lastMovement[i]={startPosition:new Cartesian2,endPosition:new Cartesian2,valid:!1}),defined(n._movement[i])||(n._movement[i]={startPosition:new Cartesian2,endPosition:new Cartesian2})}}n._eventHandler.setInputAction(function(e){for(var t in CameraEventType$1)if(CameraEventType$1.hasOwnProperty(t)){var i=CameraEventType$1[t];if(defined(i)){var r=getKey(i,a);c[r]&&(o[r]?(cloneMouseMovement(s[r],l[r]),l[r].valid=!0,cloneMouseMovement(e,s[r]),o[r]=!1):Cartesian2.clone(e.endPosition,s[r].endPosition))}}Cartesian2.clone(e.endPosition,n._currentMousePosition)},ScreenSpaceEventType$1.MOUSE_MOVE,a)}function CameraEventAggregator(e){for(var t in this._eventHandler=new ScreenSpaceEventHandler(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new Cartesian2,listenToWheel(this,void 0),listenToPinch(this,void 0,e),listenMouseButtonDownUp(this,void 0,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,void 0,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,void 0),KeyboardEventModifier$1)if(KeyboardEventModifier$1.hasOwnProperty(t)){var i=KeyboardEventModifier$1[t];defined(i)&&(listenToWheel(this,i),listenToPinch(this,i,e),listenMouseButtonDownUp(this,i,CameraEventType$1.LEFT_DRAG),listenMouseButtonDownUp(this,i,CameraEventType$1.RIGHT_DRAG),listenMouseButtonDownUp(this,i,CameraEventType$1.MIDDLE_DRAG),listenMouseMove(this,i))}}function Composite3DTileContent(e,t,i,r,n,a){this._tileset=e,this._tile=t,this._resource=i,this._contents=[],this._readyPromise=when.defer(),initialize$3(this,r,n,a)}defineProperties$1(CameraEventAggregator.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){var e=!(this._update[getKey(CameraEventType$1.WHEEL)]&&this._update[getKey(CameraEventType$1.WHEEL,KeyboardEventModifier$1.SHIFT)]&&this._update[getKey(CameraEventType$1.WHEEL,KeyboardEventModifier$1.CTRL)]&&this._update[getKey(CameraEventType$1.WHEEL,KeyboardEventModifier$1.ALT)]);return 0<this._buttonsDown||e}}}),CameraEventAggregator.prototype.isMoving=function(e,t){var i=getKey(e,t);return!this._update[i]},CameraEventAggregator.prototype.getMovement=function(e,t){var i=getKey(e,t);return this._movement[i]},CameraEventAggregator.prototype.getLastMovement=function(e,t){var i=getKey(e,t),r=this._lastMovement[i];if(r.valid)return r},CameraEventAggregator.prototype.isButtonDown=function(e,t){var i=getKey(e,t);return this._isDown[i]},CameraEventAggregator.prototype.getStartMousePosition=function(e,t){if(e===CameraEventType$1.WHEEL)return this._currentMousePosition;var i=getKey(e,t);return this._eventStartPosition[i]},CameraEventAggregator.prototype.getButtonPressTime=function(e,t){var i=getKey(e,t);return this._pressTime[i]},CameraEventAggregator.prototype.getButtonReleaseTime=function(e,t){var i=getKey(e,t);return this._releaseTime[i]},CameraEventAggregator.prototype.reset=function(){for(var e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},CameraEventAggregator.prototype.isDestroyed=function(){return!1},CameraEventAggregator.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),destroyObject(this)},defineProperties$1(Composite3DTileContent.prototype,{featurePropertiesDirty:{get:function(){for(var e=this._contents,t=e.length,i=0;i<t;++i)if(e[i].featurePropertiesDirty)return!0;return!1},set:function(e){for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].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}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}}});var sizeOfUint32$4=Uint32Array.BYTES_PER_ELEMENT;function initialize$3(t,e,i,r){i=defaultValue(i,0);var n=new Uint8Array(e),a=new DataView(e);i+=sizeOfUint32$4;var o=a.getUint32(i,!0);if(1!==o)throw new RuntimeError("Only Composite Tile version 1 is supported. Version "+o+" is not.");i+=sizeOfUint32$4,i+=sizeOfUint32$4;var s=a.getUint32(i,!0);i+=sizeOfUint32$4;for(var l=[],c=0;c<s;++c){var u=getMagic(n,i),d=a.getUint32(i+2*sizeOfUint32$4,!0),h=r[u];if(!defined(h))throw new RuntimeError("Unknown tile content type, "+u+", inside Composite tile");var p=h(t._tileset,t._tile,t._resource,e,i);t._contents.push(p),l.push(p.readyPromise),i+=d}when.all(l).then(function(){t._readyPromise.resolve(t)}).otherwise(function(e){t._readyPromise.reject(e)})}function Vector3DTileGeometry(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,defined(this._center)||(defined(this._boundingVolume)?this._center=Cartesian3.clone(this._boundingVolume.center):this._center=Cartesian3.clone(Cartesian3.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._readyPromise=when.defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer(e){var t=new Float64Array(Matrix4.packedLength+Cartesian3.packedLength),i=0;return Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Matrix4.pack(e._modelMatrix,t,i),t}function unpackBuffer(e,t){for(var i=0,r=t[i++],n=t[i++],a=e._boundingVolumes=new Array(n),o=0;o<n;++o)a[o]=BoundingSphere.unpack(t,i),i+=BoundingSphere.packedLength;for(var s=t[i++],l=e._batchedIndices=new Array(s),c=0;c<s;++c){var u=Color.unpack(t,i);i+=Color.packedLength;for(var d=t[i++],h=t[i++],p=t[i++],m=new Array(p),f=0;f<p;++f)m[f]=t[i++];l[c]=new Vector3DTileBatch({color:u,offset:d,count:h,batchIds:m})}return r}Composite3DTileContent.prototype.hasProperty=function(e,t){return!1},Composite3DTileContent.prototype.getFeature=function(e){},Composite3DTileContent.prototype.applyDebugSettings=function(e,t){for(var i=this._contents,r=i.length,n=0;n<r;++n)i[n].applyDebugSettings(e,t)},Composite3DTileContent.prototype.applyStyle=function(e){for(var t=this._contents,i=t.length,r=0;r<i;++r)t[r].applyStyle(e)},Composite3DTileContent.prototype.update=function(e,t){for(var i=this._contents,r=i.length,n=0;n<r;++n)i[n].update(e,t)},Composite3DTileContent.prototype.isDestroyed=function(){return!1},Composite3DTileContent.prototype.destroy=function(){for(var e=this._contents,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)},defineProperties$1(Vector3DTileGeometry.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}}),Vector3DTileGeometry.packedBoxLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedCylinderLength=Matrix4.packedLength+2,Vector3DTileGeometry.packedEllipsoidLength=Matrix4.packedLength+Cartesian3.packedLength,Vector3DTileGeometry.packedSphereLength=Cartesian3.packedLength+1;var createVerticesTaskProcessor=new TaskProcessor("createVectorTileGeometries"),scratchColor$f=new Color;function createPrimitive$1(r){if(!defined(r._primitive)){if(!defined(r._verticesPromise)){var e=r._boxes,t=r._boxBatchIds,i=r._cylinders,n=r._cylinderBatchIds,a=r._ellipsoids,o=r._ellipsoidBatchIds,s=r._spheres,l=r._sphereBatchIds,c=r._batchTableColors,u=r._packedBuffer;if(!defined(c)){var d=0;defined(r._boxes)&&(e=r._boxes=arraySlice(e),d+=(t=r._boxBatchIds=arraySlice(t)).length),defined(r._cylinders)&&(i=r._cylinders=arraySlice(i),d+=(n=r._cylinderBatchIds=arraySlice(n)).length),defined(r._ellipsoids)&&(a=r._ellipsoids=arraySlice(a),d+=(o=r._ellipsoidBatchIds=arraySlice(o)).length),defined(r._spheres)&&(s=r._sphere=arraySlice(s),d+=(l=r._sphereBatchIds=arraySlice(l)).length),c=r._batchTableColors=new Uint32Array(d);for(var h=r._batchTable,p=0;p<d;++p){var m=h.getColor(p,scratchColor$f);c[p]=m.toRgba()}u=r._packedBuffer=packBuffer(r)}var f=[];defined(e)&&f.push(e.buffer,t.buffer),defined(i)&&f.push(i.buffer,n.buffer),defined(a)&&f.push(a.buffer,o.buffer),defined(s)&&f.push(s.buffer,l.buffer),f.push(c.buffer,u.buffer);var g={boxes:defined(e)?e.buffer:void 0,boxBatchIds:defined(e)?t.buffer:void 0,cylinders:defined(i)?i.buffer:void 0,cylinderBatchIds:defined(i)?n.buffer:void 0,ellipsoids:defined(a)?a.buffer:void 0,ellipsoidBatchIds:defined(a)?o.buffer:void 0,spheres:defined(s)?s.buffer:void 0,sphereBatchIds:defined(s)?l.buffer:void 0,batchTableColors:c.buffer,packedBuffer:u.buffer},_=r._verticesPromise=createVerticesTaskProcessor.scheduleTask(g,f);if(!defined(_))return;_.then(function(e){var t=new Float64Array(e.packedBuffer),i=unpackBuffer(r,t);r._indices=2===i?new Uint16Array(e.indices):new Uint32Array(e.indices),r._indexOffsets=new Uint32Array(e.indexOffsets),r._indexCounts=new Uint32Array(e.indexCounts),r._positions=new Float32Array(e.positions),r._vertexBatchIds=new Uint16Array(e.vertexBatchIds),r._batchIds=new Uint16Array(e.batchIds),r._ready=!0})}r._ready&&!defined(r._primitive)&&(r._primitive=new Vector3DTilePrimitive({batchTable:r._batchTable,positions:r._positions,batchIds:r._batchIds,vertexBatchIds:r._vertexBatchIds,indices:r._indices,indexOffsets:r._indexOffsets,indexCounts:r._indexCounts,batchedIndices:r._batchedIndices,boundingVolume:r._boundingVolume,boundingVolumes:r._boundingVolumes,center:r._center,pickObject:defaultValue(r._pickObject,r)}),r._boxes=void 0,r._boxBatchIds=void 0,r._cylinders=void 0,r._cylinderBatchIds=void 0,r._ellipsoids=void 0,r._ellipsoidBatchIds=void 0,r._spheres=void 0,r._sphereBatchIds=void 0,r._center=void 0,r._modelMatrix=void 0,r._batchTable=void 0,r._boundingVolume=void 0,r._boundingVolumes=void 0,r._batchedIndices=void 0,r._indices=void 0,r._indexOffsets=void 0,r._indexCounts=void 0,r._positions=void 0,r._vertexBatchIds=void 0,r._batchIds=void 0,r._batchTableColors=void 0,r._packedBuffer=void 0,r._verticesPromise=void 0,r._readyPromise.resolve())}}function Geometry3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._geometries=void 0,this._contentReadyPromise=void 0,this._readyPromise=when.defer(),this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,initialize$4(this,r,n)}function createColorChangedCallback$1(i){return function(e,t){defined(i._geometries)&&i._geometries.updateCommands(e,t)}}function getBatchIds(e,t){var i,r,n,a,o,s=defaultValue(e.BOXES_LENGTH,0),l=defaultValue(e.CYLINDERS_LENGTH,0),c=defaultValue(e.ELLIPSOIDS_LENGTH,0),u=defaultValue(e.SPHERES_LENGTH,0);if(0<s&&defined(e.BOX_BATCH_IDS)){var d=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,d,s)}if(0<l&&defined(e.CYLINDER_BATCH_IDS)){var h=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,h,l)}if(0<c&&defined(e.ELLIPSOID_BATCH_IDS)){var p=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,p,c)}if(0<u&&defined(e.SPHERE_BATCH_IDS)){var m=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;a=new Uint16Array(t.buffer,m,u)}var f=defined(i)||defined(r)||defined(n)||defined(a),g=0<s&&!defined(i)||0<l&&!defined(r)||0<c&&!defined(n)||0<u&&!defined(a);if(f&&g)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!(defined(i)||defined(r)||defined(n)||defined(a))){var _=0;if(!defined(i)&&0<s)for(i=new Uint16Array(s),o=0;o<s;++o)i[o]=_++;if(!defined(r)&&0<l)for(r=new Uint16Array(l),o=0;o<l;++o)r[o]=_++;if(!defined(n)&&0<c)for(n=new Uint16Array(c),o=0;o<c;++o)n[o]=_++;if(!defined(a)&&0<u)for(a=new Uint16Array(u),o=0;o<u;++o)a[o]=_++}return{boxes:i,cylinders:r,ellipsoids:n,spheres:a}}Vector3DTileGeometry.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTileGeometry.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTileGeometry.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTileGeometry.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTileGeometry.prototype.update=function(e){createPrimitive$1(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTileGeometry.prototype.isDestroyed=function(){return!1},Vector3DTileGeometry.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)},defineProperties$1(Geometry3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return defined(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}}});var sizeOfUint32$5=Uint32Array.BYTES_PER_ELEMENT;function initialize$4(e,t,i){i=defaultValue(i,0);var r=new Uint8Array(t),n=new DataView(t);i+=sizeOfUint32$5;var a=n.getUint32(i,!0);if(1!==a)throw new RuntimeError("Only Geometry tile version 1 is supported.  Version "+a+" is not.");i+=sizeOfUint32$5;var o=n.getUint32(i,!0);if(i+=sizeOfUint32$5,0!==o){var s=n.getUint32(i,!0);if(i+=sizeOfUint32$5,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");var l=n.getUint32(i,!0);i+=sizeOfUint32$5;var c=n.getUint32(i,!0);i+=sizeOfUint32$5;var u=n.getUint32(i,!0),d=getStringFromTypedArray(r,i+=sizeOfUint32$5,s),h=JSON.parse(d);i+=s;var p,m,f=new Uint8Array(t,i,l);if(i+=l,0<c){var g=getStringFromTypedArray(r,i,c);p=JSON.parse(g),i+=c,0<u&&(m=new Uint8Array(t,i,u),m=new Uint8Array(m))}var _=defaultValue(h.BOXES_LENGTH,0),y=defaultValue(h.CYLINDERS_LENGTH,0),v=defaultValue(h.ELLIPSOIDS_LENGTH,0),C=defaultValue(h.SPHERES_LENGTH,0),S=_+y+v+C,x=new Cesium3DTileBatchTable(e,S,p,m,createColorChangedCallback$1(e));if(e._batchTable=x,0!==S){var T,b=e.tile.computedTransform;defined(h.RTC_CENTER)&&(T=Cartesian3.unpack(h.RTC_CENTER),Matrix4.multiplyByPoint(b,T,T));var E=getBatchIds(h,f);if(0<_||0<y||0<v||0<C){var P,A,w,D;if(0<_){var M=f.byteOffset+h.BOXES.byteOffset;P=new Float32Array(f.buffer,M,Vector3DTileGeometry.packedBoxLength*_)}if(0<y){var I=f.byteOffset+h.CYLINDERS.byteOffset;A=new Float32Array(f.buffer,I,Vector3DTileGeometry.packedCylinderLength*y)}if(0<v){var R=f.byteOffset+h.ELLIPSOIDS.byteOffset;w=new Float32Array(f.buffer,R,Vector3DTileGeometry.packedEllipsoidLength*v)}if(0<C){var O=f.byteOffset+h.SPHERES.byteOffset;D=new Float32Array(f.buffer,O,Vector3DTileGeometry.packedSphereLength*C)}e._geometries=new Vector3DTileGeometry({boxes:P,boxBatchIds:E.boxes,cylinders:A,cylinderBatchIds:E.cylinders,ellipsoids:w,ellipsoidBatchIds:E.ellipsoids,spheres:D,sphereBatchIds:E.spheres,center:T,modelMatrix:b,batchTable:x,boundingVolume:e.tile.boundingVolume.boundingVolume})}}}else e._readyPromise.resolve(e)}function createFeatures$1(e){var t=e.featuresLength;if(!defined(e._features)&&0<t){var i=new Array(t);defined(e._geometries)&&e._geometries.createFeatures(e,i),e._features=i}}function ModelInstance(e,t,i){this.primitive=e,this._modelMatrix=Matrix4.clone(t),this._instanceId=i}Geometry3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Geometry3DTileContent.prototype.getFeature=function(e){return createFeatures$1(this),this._features[e]},Geometry3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._geometries)&&this._geometries.applyDebugSettings(e,t)},Geometry3DTileContent.prototype.applyStyle=function(e){createFeatures$1(this),defined(this._geometries)&&this._geometries.applyStyle(e,this._features)},Geometry3DTileContent.prototype.update=function(e,t){if(defined(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),defined(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){var i=this;this._contentReadyPromise=this._geometries.readyPromise.then(function(){i._readyPromise.resolve(i)})}},Geometry3DTileContent.prototype.isDestroyed=function(){return!1},Geometry3DTileContent.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},defineProperties$1(ModelInstance.prototype,{instanceId:{get:function(){return this._instanceId}},model:{get:function(){return this.primitive._model}},modelMatrix:{get:function(){return Matrix4.clone(this._modelMatrix)},set:function(e){Matrix4.clone(e,this._modelMatrix),this.primitive.expandBoundingSphere(this._modelMatrix),this.primitive._dirty=!0}}});var LoadState={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3};function ModelInstanceCollection(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this._instancingSupported=!1,this._dynamic=defaultValue(e.dynamic,!1),this._allowPicking=defaultValue(e.allowPicking,!0),this._ready=!1,this._readyPromise=when.defer(),this._state=LoadState.NEEDS_LOAD,this._dirty=!1,this._cull=defaultValue(e.cull,!0),this._opaquePass=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._instances=createInstances(this,e.instances),this._batchTable=e.batchTable,this._model=void 0,this._vertexBufferTypedArray=void 0,this._vertexBuffer=void 0,this._batchIdBuffer=void 0,this._instancedUniformsByProgram=void 0,this._drawCommands=[],this._modelCommands=void 0,this._boundingSphere=createBoundingSphere(this),this._center=Cartesian3.clone(this._boundingSphere.center),this._rtcTransform=new Matrix4,this._rtcModelView=new Matrix4,this._mode=void 0,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(this.modelMatrix),this._url=Resource.createIfNeeded(e.url),this._requestType=e.requestType,this._gltf=e.gltf,this._basePath=Resource.createIfNeeded(e.basePath),this._asynchronous=e.asynchronous,this._incrementallyLoadTextures=e.incrementallyLoadTextures,this._upAxis=e.upAxis,this._forwardAxis=e.forwardAxis,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this._shadows=this.shadows,this._pickIdLoaded=e.pickIdLoaded,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=defaultValue(e.debugWireframe,!1),this._debugWireframe=!1,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this.lightColor=e.lightColor,this.luminanceAtZenith=e.luminanceAtZenith,this.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this.specularEnvironmentMaps=e.specularEnvironmentMaps}function createInstances(e,t){for(var i=(t=defaultValue(t,[])).length,r=new Array(i),n=0;n<i;++n){var a=t[n],o=a.modelMatrix,s=defaultValue(a.batchId,n);r[n]=new ModelInstance(e,o,s)}return r}function createBoundingSphere(e){for(var t=e.length,i=new Array(t),r=0;r<t;++r)i[r]=Matrix4.getTranslation(e._instances[r]._modelMatrix,new Cartesian3);return BoundingSphere.fromPoints(i)}defineProperties$1(ModelInstanceCollection.prototype,{allowPicking:{get:function(){return this._allowPicking}},length:{get:function(){return this._instances.length}},activeAnimations:{get:function(){return this._model.activeAnimations}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){Cartesian2.clone(e,this._imageBasedLightingFactor)}}});var scratchCartesian$5=new Cartesian3,scratchMatrix$1=new Matrix4;function getCheckUniformSemanticFunction(r,n,a,o){return function(e,t){var i=e.semantic;if(defined(i)&&-1<r.indexOf(i)){if(!(-1<n.indexOf(i)))throw new RuntimeError('Shader program cannot be optimized for instancing. Uniform "'+t+'" in program "'+a+'" uses unsupported semantic "'+i+'"');o[t]=i}}}function getInstancedUniforms(e,t){if(defined(e._instancedUniformsByProgram))return e._instancedUniformsByProgram[t];var i={};e._instancedUniformsByProgram=i;var r=["MODEL","MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELINVERSE","MODELVIEWINVERSE","MODELVIEWPROJECTIONINVERSE","MODELINVERSETRANSPOSE","MODELVIEWINVERSETRANSPOSE"],n=["MODELVIEW","CESIUM_RTC_MODELVIEW","MODELVIEWPROJECTION","MODELVIEWINVERSETRANSPOSE"],a=e._model._sourceTechniques;for(var o in a)if(a.hasOwnProperty(o)){var s=a[o],l=s.program;if(!defined(i[l])){var c={};i[l]=c,ForEach.techniqueUniform(s,getCheckUniformSemanticFunction(r,n,t,c))}}return i[t]}function getVertexShaderCallback$1(_){return function(e,t){var i=getInstancedUniforms(_,t),r=defined(_._batchTable),n=ShaderSource.replaceMain(e,"czm_instancing_main"),a="",o="";for(var s in i)if(i.hasOwnProperty(s)){var l,c=i[s];"MODELVIEW"===c||"CESIUM_RTC_MODELVIEW"===c?l="czm_instanced_modelView":"MODELVIEWPROJECTION"===c?(l="czm_instanced_modelViewProjection",a+="mat4 czm_instanced_modelViewProjection;\n",o+="czm_instanced_modelViewProjection = czm_projection * czm_instanced_modelView;\n"):"MODELVIEWINVERSETRANSPOSE"===c&&(l="czm_instanced_modelViewInverseTranspose",a+="mat3 czm_instanced_modelViewInverseTranspose;\n",o+="czm_instanced_modelViewInverseTranspose = mat3(czm_instanced_modelView);\n");var u=new RegExp("uniform.*"+s+".*");n=n.replace(u,""),u=new RegExp(s+"\\b","g"),n=n.replace(u,l)}var d,h,p;p=r?(d="attribute float a_batchId;\n",h=""):(d="",h="attribute vec4 pickColor;\nvarying vec4 v_pickColor;\n","    v_pickColor = pickColor;\n");var m="uniform mat4 czm_instanced_modifiedModelView;\nuniform mat4 czm_instanced_nodeTransform;\n"+a+"mat4 czm_instanced_modelView;\nattribute vec4 czm_modelMatrixRow0;\nattribute vec4 czm_modelMatrixRow1;\nattribute vec4 czm_modelMatrixRow2;\n"+d+h+n+"void main()\n{\n    mat4 czm_instanced_model = mat4(czm_modelMatrixRow0.x, czm_modelMatrixRow1.x, czm_modelMatrixRow2.x, 0.0, czm_modelMatrixRow0.y, czm_modelMatrixRow1.y, czm_modelMatrixRow2.y, 0.0, czm_modelMatrixRow0.z, czm_modelMatrixRow1.z, czm_modelMatrixRow2.z, 0.0, czm_modelMatrixRow0.w, czm_modelMatrixRow1.w, czm_modelMatrixRow2.w, 1.0);\n    czm_instanced_modelView = czm_instanced_modifiedModelView * czm_instanced_model * czm_instanced_nodeTransform;\n"+o+"    czm_instancing_main();\n"+p+"}\n";if(r){var f=_._model.gltf,g=ModelUtility.getDiffuseAttributeOrUniform(f,t);m=_._batchTable.getVertexShaderCallback(!0,"a_batchId",g)(m)}return m}}function getFragmentShaderCallback$1(a){return function(e,t){var i=a._batchTable;if(defined(i)){var r=a._model.gltf,n=ModelUtility.getDiffuseAttributeOrUniform(r,t);e=i.getFragmentShaderCallback(!0,n)(e)}else e="varying vec4 v_pickColor;\n"+e;return e}}function createModifiedModelView(e,t){return function(){return Matrix4.multiply(t.uniformState.view,e._rtcTransform,e._rtcModelView)}}function createNodeTransformFunction(e){return function(){return e.computedMatrix}}function getUniformMapCallback(a,o){return function(e,t,i){(e=clone(e)).czm_instanced_modifiedModelView=createModifiedModelView(a,o),e.czm_instanced_nodeTransform=createNodeTransformFunction(i);var r=getInstancedUniforms(a,t);for(var n in r)r.hasOwnProperty(n)&&delete e[n];return defined(a._batchTable)&&(e=a._batchTable.getUniformMapCallback()(e)),e}}function getVertexShaderNonInstancedCallback(n){return function(e,t){if(defined(n._batchTable)){var i=n._model.gltf,r=ModelUtility.getDiffuseAttributeOrUniform(i,t);e="uniform float a_batchId\n;"+(e=n._batchTable.getVertexShaderCallback(!0,"a_batchId",r)(e))}return e}}function getFragmentShaderNonInstancedCallback(a){return function(e,t){var i=a._batchTable;if(defined(i)){var r=a._model.gltf,n=ModelUtility.getDiffuseAttributeOrUniform(r,t);e=i.getFragmentShaderCallback(!0,n)(e)}else e="uniform vec4 czm_pickColor;\n"+e;return e}}function getUniformMapNonInstancedCallback(t){return function(e){return defined(t._batchTable)&&(e=t._batchTable.getUniformMapCallback()(e)),e}}function getVertexBufferTypedArray(e){var t=e._instances,i=e.length,r=e._center,n=e._vertexBufferTypedArray;defined(n)||(n=new Float32Array(12*i)),e._dynamic&&(e._vertexBufferTypedArray=n);for(var a=0;a<i;++a){var o=t[a]._modelMatrix,s=Matrix4.clone(o,scratchMatrix$1);s[12]-=r.x,s[13]-=r.y,s[14]-=r.z;var l=12*a;n[0+l]=s[0],n[1+l]=s[4],n[2+l]=s[8],n[3+l]=s[12],n[4+l]=s[1],n[5+l]=s[5],n[6+l]=s[9],n[7+l]=s[13],n[8+l]=s[2],n[9+l]=s[6],n[10+l]=s[10],n[11+l]=s[14]}return n}function createVertexBuffer$2(e,t){var i,r=e._instances,n=e.length,a=e._dynamic,o=defined(e._batchTable);if(o){var s=new Uint16Array(n);for(i=0;i<n;++i)s[i]=r[i]._instanceId;e._batchIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:s,usage:BufferUsage$1.STATIC_DRAW})}if(!o){var l=new Uint8Array(4*n);for(i=0;i<n;++i){var c=e._pickIds[i].color,u=4*i;l[u]=Color.floatToByte(c.red),l[1+u]=Color.floatToByte(c.green),l[2+u]=Color.floatToByte(c.blue),l[3+u]=Color.floatToByte(c.alpha)}e._pickIdBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:l,usage:BufferUsage$1.STATIC_DRAW})}var d=getVertexBufferTypedArray(e);e._vertexBuffer=Buffer$1.createVertexBuffer({context:t,typedArray:d,usage:a?BufferUsage$1.STREAM_DRAW:BufferUsage$1.STATIC_DRAW})}function updateVertexBuffer(e){var t=getVertexBufferTypedArray(e);e._vertexBuffer.copyFromArrayView(t)}function createPickIds(e,t){for(var i=e._instances,r=i.length,n=new Array(r),a=0;a<r;++a)n[a]=t.createPickId(i[a]);return n}function createModel$1(e,t){var i=e._instancingSupported,r=defined(e._batchTable),n=e._allowPicking,a={url:e._url,requestType:e._requestType,gltf:e._gltf,basePath:e._basePath,shadows:e._shadows,cacheKey:void 0,asynchronous:e._asynchronous,allowPicking:n,incrementallyLoadTextures:e._incrementallyLoadTextures,upAxis:e._upAxis,forwardAxis:e._forwardAxis,precreatedAttributes:void 0,vertexShaderLoaded:void 0,fragmentShaderLoaded:void 0,uniformMapLoaded:void 0,pickIdLoaded:e._pickIdLoaded,ignoreCommands:!0,opaquePass:e._opaquePass,imageBasedLightingFactor:e.imageBasedLightingFactor,lightColor:e.lightColor,luminanceAtZenith:e.luminanceAtZenith,sphericalHarmonicCoefficients:e.sphericalHarmonicCoefficients,specularEnvironmentMaps:e.specularEnvironmentMaps};if(r||(e._pickIds=createPickIds(e,t)),i){createVertexBuffer$2(e,t);var o=ComponentDatatype$1.getSizeInBytes(ComponentDatatype$1.FLOAT),s={czm_modelMatrixRow0:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:12*o,instanceDivisor:1},czm_modelMatrixRow1:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:4*o,strideInBytes:12*o,instanceDivisor:1},czm_modelMatrixRow2:{index:0,vertexBuffer:e._vertexBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.FLOAT,normalize:!1,offsetInBytes:8*o,strideInBytes:12*o,instanceDivisor:1}};r&&(s.a_batchId={index:0,vertexBuffer:e._batchIdBuffer,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),r||(s.pickColor={index:0,vertexBuffer:e._pickIdBuffer,componentsPerAttribute:4,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1}),a.precreatedAttributes=s,a.vertexShaderLoaded=getVertexShaderCallback$1(e),a.fragmentShaderLoaded=getFragmentShaderCallback$1(e),a.uniformMapLoaded=getUniformMapCallback(e,t),defined(e._url)&&(a.cacheKey=e._url.getUrlComponent()+"#instanced")}else a.vertexShaderLoaded=getVertexShaderNonInstancedCallback(e),a.fragmentShaderLoaded=getFragmentShaderNonInstancedCallback(e),a.uniformMapLoaded=getUniformMapNonInstancedCallback(e);defined(e._url)?e._model=Model.fromGltf(a):e._model=new Model(a)}function updateWireframe$2(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?PrimitiveType$1.LINES:PrimitiveType$1.TRIANGLES,i=e._drawCommands,r=i.length,n=0;n<r;++n)i[n].primitiveType=t}}function updateShowBoundingVolume$1(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e._drawCommands,i=t.length,r=0;r<i;++r)t[r].debugShowBoundingVolume=e.debugShowBoundingVolume}}function createCommands$4(e,t){for(var i=t.length,r=e.length,n=e._boundingSphere,a=e._cull,o=0;o<i;++o){var s=DrawCommand.shallowClone(t[o]);s.instanceCount=r,s.boundingVolume=n,s.cull=a,defined(e._batchTable)?s.pickId=e._batchTable.getPickId():s.pickId="v_pickColor",e._drawCommands.push(s)}}function createBatchIdFunction(e){return function(){return e}}function createPickColorFunction$1(e){return function(){return e}}function createCommandsNonInstanced(e,t){for(var i=e._instances,r=t.length,n=e.length,a=defined(e._batchTable),o=e._cull,s=0;s<r;++s)for(var l=0;l<n;++l){var c=DrawCommand.shallowClone(t[s]);if(c.modelMatrix=new Matrix4,c.boundingVolume=new BoundingSphere,c.cull=o,c.uniformMap=clone(c.uniformMap),a)c.uniformMap.a_batchId=createBatchIdFunction(i[l]._instanceId);else{var u=e._pickIds[l];c.uniformMap.czm_pickColor=createPickColorFunction$1(u.color)}e._drawCommands.push(c)}}function updateCommandsNonInstanced(e){for(var t=e._modelCommands,i=t.length,r=e.length,n=e._rtcTransform,a=e._center,o=0;o<i;++o)for(var s=t[o],l=0;l<r;++l){var c=o*r+l,u=e._drawCommands[c],d=Matrix4.clone(e._instances[l]._modelMatrix,scratchMatrix$1);d[12]-=a.x,d[13]-=a.y,d[14]-=a.z,d=Matrix4.multiply(n,d,scratchMatrix$1);var h=s.modelMatrix,p=u.modelMatrix;Matrix4.multiply(d,h,p);var m=s.boundingVolume,f=u.boundingVolume;BoundingSphere.transform(m,d,f)}}function getModelCommands(e){for(var t=e._nodeCommands,i=t.length,r=[],n=0;n<i;++n){var a=t[n];a.show&&r.push(a.command)}return r}function commandsDirty(e){for(var t=e._nodeCommands,i=t.length,r=0;r<i;r++){if(t[r].command.dirty)return!0}return!1}function generateModelCommands(e,t){e._drawCommands=[];var i=getModelCommands(e._model);t?createCommands$4(e,i):(createCommandsNonInstanced(e,i),updateCommandsNonInstanced(e))}function updateShadows$1(e){if(e.shadows!==e._shadows){e._shadows=e.shadows;for(var t=ShadowMode$1.castShadows(e.shadows),i=ShadowMode$1.receiveShadows(e.shadows),r=e._drawCommands,n=r.length,a=0;a<n;++a){var o=r[a];o.castShadows=t,o.receiveShadows=i}}}function Instanced3DModel3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._modelInstanceCollection=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,initialize$5(this,r,n)}function getPickIdCallback$1(e){return function(){return e._batchTable.getPickId()}}ModelInstanceCollection.prototype.expandBoundingSphere=function(e){var t=Matrix4.getTranslation(e,scratchCartesian$5);BoundingSphere.expand(this._boundingSphere,t,this._boundingSphere)},ModelInstanceCollection.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING&&this.show&&0!==this.length){var t=e.context;if(this._state===LoadState.NEEDS_LOAD){this._state=LoadState.LOADING,this._instancingSupported=t.instancedArrays,createModel$1(this,t);var i=this;this._model.readyPromise.otherwise(function(e){i._state=LoadState.FAILED,i._readyPromise.reject(e)})}var r=this._instancingSupported,n=this._model;if(n.imageBasedLightingFactor=this.imageBasedLightingFactor,n.lightColor=this.lightColor,n.luminanceAtZenith=this.luminanceAtZenith,n.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,n.specularEnvironmentMaps=this.specularEnvironmentMaps,n.update(e),n.ready&&this._state===LoadState.LOADING){this._state=LoadState.LOADED,this._ready=!0;var a=n.boundingSphere.radius+Cartesian3.magnitude(n.boundingSphere.center);return this._boundingSphere.radius+=a,this._modelCommands=getModelCommands(n),generateModelCommands(this,r),void this._readyPromise.resolve(this)}if(this._state===LoadState.LOADED){var o=e.mode!==this._mode,s=this.modelMatrix,l=!Matrix4.equals(this._modelMatrix,s);if(o||l){this._mode=e.mode,Matrix4.clone(s,this._modelMatrix);var c=Matrix4.multiplyByTranslation(this._modelMatrix,this._center,this._rtcTransform);this._mode!==SceneMode$1.SCENE3D&&(c=Transforms.basisTo2D(e.mapProjection,c,c)),Matrix4.getTranslation(c,this._boundingSphere.center)}r&&this._dirty&&(this._dynamic=!0,this._dirty=!1,updateVertexBuffer(this)),commandsDirty(n)&&generateModelCommands(this,r),!r&&(n.dirty||this._dirty||o||l)&&updateCommandsNonInstanced(this),updateShadows$1(this),updateWireframe$2(this),updateShowBoundingVolume$1(this);var u=e.passes;if(u.render||u.pick)for(var d=e.commandList,h=this._drawCommands,p=h.length,m=0;m<p;++m)d.push(h[m])}}},ModelInstanceCollection.prototype.isDestroyed=function(){return!1},ModelInstanceCollection.prototype.destroy=function(){this._model=this._model&&this._model.destroy();var e=this._pickIds;if(defined(e))for(var t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)},Instanced3DModel3DTileContent._deprecationWarning=deprecationWarning,defineProperties$1(Instanced3DModel3DTileContent.prototype,{featuresLength:{get:function(){return this._batchTable.featuresLength}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){var e=this._modelInstanceCollection._model;return defined(e)?e.trianglesLength:0}},geometryByteLength:{get:function(){var e=this._modelInstanceCollection._model;return defined(e)?e.geometryByteLength:0}},texturesByteLength:{get:function(){var e=this._modelInstanceCollection._model;return defined(e)?e.texturesByteLength:0}},batchTableByteLength:{get:function(){return this._batchTable.memorySizeInBytes}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._modelInstanceCollection.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}}});var sizeOfUint32$6=Uint32Array.BYTES_PER_ELEMENT,propertyScratch1=new Array(4),propertyScratch2=new Array(4);function initialize$5(e,t,i){var r=defaultValue(i,0);i=r;var n=new Uint8Array(t),a=new DataView(t);i+=sizeOfUint32$6;var o=a.getUint32(i,!0);if(1!==o)throw new RuntimeError("Only Instanced 3D Model version 1 is supported. Version "+o+" is not.");i+=sizeOfUint32$6;var s=a.getUint32(i,!0);i+=sizeOfUint32$6;var l=a.getUint32(i,!0);if(0===l)throw new RuntimeError("featureTableJsonByteLength is zero, the feature table must be defined.");i+=sizeOfUint32$6;var c=a.getUint32(i,!0);i+=sizeOfUint32$6;var u=a.getUint32(i,!0);i+=sizeOfUint32$6;var d=a.getUint32(i,!0);i+=sizeOfUint32$6;var h=a.getUint32(i,!0);if(1!==h&&0!==h)throw new RuntimeError("Only glTF format 0 (uri) or 1 (embedded) are supported. Format "+h+" is not.");var p=getStringFromTypedArray(n,i+=sizeOfUint32$6,l),m=JSON.parse(p);i+=l;var f=new Uint8Array(t,i,c);i+=c;var g,_,y=new Cesium3DTileFeatureTable(m,f),v=y.getGlobalProperty("INSTANCES_LENGTH");if(!defined(y.featuresLength=v))throw new RuntimeError("Feature table global property: INSTANCES_LENGTH must be defined");if(0<u){var C=getStringFromTypedArray(n,i,u);g=JSON.parse(C),i+=u,0<d&&(_=new Uint8Array(t,i,d),_=new Uint8Array(_),i+=d)}e._batchTable=new Cesium3DTileBatchTable(e,v,g,_);var S,x=r+s-i;if(0==x)throw new RuntimeError("glTF byte length is zero, i3dm must have a glTF to instance.");S=i%4==0?new Uint8Array(t,i,x):(Instanced3DModel3DTileContent._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),new Uint8Array(n.subarray(i,i+x)));var T=e._tileset,b={instances:new Array(v),batchTable:e._batchTable,cull:!1,url:void 0,requestType:RequestType$1.TILES3D,gltf:void 0,basePath:void 0,incrementallyLoadTextures:!1,upAxis:T._gltfUpAxis,forwardAxis:Axis$1.X,opaquePass:Pass$1.CESIUM_3D_TILE,pickIdLoaded:getPickIdCallback$1(e),imageBasedLightingFactor:T.imageBasedLightingFactor,lightColor:T.lightColor,luminanceAtZenith:T.luminanceAtZenith,sphericalHarmonicCoefficients:T.sphericalHarmonicCoefficients,specularEnvironmentMaps:T.specularEnvironmentMaps};if(0===h){var E=getStringFromTypedArray(S);E=E.replace(/[\s\0]+$/,""),b.url=e._resource.getDerivedResource({url:E})}else b.gltf=S,b.basePath=e._resource.clone();var P,A=y.getGlobalProperty("EAST_NORTH_UP"),w=y.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(w)&&(P=Cartesian3.unpack(w));for(var D=b.instances,M=new Cartesian3,I=new Array(3),R=new Cartesian3,O=new Cartesian3,L=new Cartesian3,F=new Matrix3,N=new Quaternion,B=new Cartesian3,V=new TranslationRotationScale,k=new Matrix4,$=0;$<v;$++){var z=y.getProperty("POSITION",ComponentDatatype$1.FLOAT,3,$,propertyScratch1);if(!defined(z)){z=I;var U=y.getProperty("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3,$,propertyScratch1);if(!defined(U))throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined for each instance.");var G=y.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(G))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");var H=y.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(H))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(var W=0;W<3;W++)z[W]=U[W]/65535*H[W]+G[W]}Cartesian3.unpack(z,0,M),defined(P)&&Cartesian3.add(M,P,M),V.translation=M;var q=y.getProperty("NORMAL_UP",ComponentDatatype$1.FLOAT,3,$,propertyScratch1),j=y.getProperty("NORMAL_RIGHT",ComponentDatatype$1.FLOAT,3,$,propertyScratch2),Y=!1;if(defined(q)){if(!defined(j))throw new RuntimeError("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");Cartesian3.unpack(q,0,O),Cartesian3.unpack(j,0,R),Y=!0}else{var X=y.getProperty("NORMAL_UP_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,$,propertyScratch1),Q=y.getProperty("NORMAL_RIGHT_OCT32P",ComponentDatatype$1.UNSIGNED_SHORT,2,$,propertyScratch2);if(defined(X)){if(!defined(Q))throw new RuntimeError("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");AttributeCompression.octDecodeInRange(X[0],X[1],65535,O),AttributeCompression.octDecodeInRange(Q[0],Q[1],65535,R),Y=!0}else A?(Transforms.eastNorthUpToFixedFrame(M,Ellipsoid.WGS84,k),Matrix4.getMatrix3(k,F)):Matrix3.clone(Matrix3.IDENTITY,F)}Y&&(Cartesian3.cross(R,O,L),Cartesian3.normalize(L,L),Matrix3.setColumn(F,0,R,F),Matrix3.setColumn(F,1,O,F),Matrix3.setColumn(F,2,L,F)),Quaternion.fromRotationMatrix(F,N),V.rotation=N,B=Cartesian3.fromElements(1,1,1,B);var J=y.getProperty("SCALE",ComponentDatatype$1.FLOAT,1,$);defined(J)&&Cartesian3.multiplyByScalar(B,J,B);var Z=y.getProperty("SCALE_NON_UNIFORM",ComponentDatatype$1.FLOAT,3,$,propertyScratch1);defined(Z)&&(B.x*=Z[0],B.y*=Z[1],B.z*=Z[2]),V.scale=B;var K=y.getProperty("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1,$);defined(K)||(K=$),Matrix4.fromTranslationRotationScale(V,k);var ee=k.clone();D[$]={modelMatrix:ee,batchId:K}}e._modelInstanceCollection=new ModelInstanceCollection(b)}function createFeatures$2(e){var t=e.featuresLength;if(!defined(e._features)&&0<t){for(var i=new Array(t),r=0;r<t;++r)i[r]=new Cesium3DTileFeature(e,r);e._features=i}}Instanced3DModel3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Instanced3DModel3DTileContent.prototype.getFeature=function(e){this.featuresLength;return createFeatures$2(this),this._features[e]},Instanced3DModel3DTileContent.prototype.applyDebugSettings=function(e,t){t=e?t:Color.WHITE,this._batchTable.setAllColor(t)},Instanced3DModel3DTileContent.prototype.applyStyle=function(e){this._batchTable.applyStyle(e)},Instanced3DModel3DTileContent.prototype.update=function(e,t){var i=t.commandList.length;this._batchTable.update(e,t),this._modelInstanceCollection.modelMatrix=this._tile.computedTransform,this._modelInstanceCollection.shadows=this._tileset.shadows,this._modelInstanceCollection.lightColor=this._tileset.lightColor,this._modelInstanceCollection.luminanceAtZenith=this._tileset.luminanceAtZenith,this._modelInstanceCollection.sphericalHarmonicCoefficients=this._tileset.sphericalHarmonicCoefficients,this._modelInstanceCollection.specularEnvironmentMaps=this._tileset.specularEnvironmentMaps,this._modelInstanceCollection.debugWireframe=this._tileset.debugWireframe;var r=this._modelInstanceCollection._model;if(defined(r)){var n=this._tileset.clippingPlanes;r.clippingPlanesOriginMatrix=this._tileset.clippingPlanesOriginMatrix,defined(n)&&this._tile.clippingPlanesDirty&&(r._clippingPlanes=n.enabled&&this._tile._isClipped?n:void 0),defined(n)&&defined(r._clippingPlanes)&&r._clippingPlanes!==n&&(r._clippingPlanes=n)}this._modelInstanceCollection.update(t),i<t.commandList.length&&(t.passes.render||t.passes.pick)&&this._batchTable.addDerivedCommands(t,i,!1)},Instanced3DModel3DTileContent.prototype.isDestroyed=function(){return!1},Instanced3DModel3DTileContent.prototype.destroy=function(){return this._modelInstanceCollection=this._modelInstanceCollection&&this._modelInstanceCollection.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)};var Cesium3DTileRefine={ADD:0,REPLACE:1},Cesium3DTileRefine$1=freezeObject$1(Cesium3DTileRefine),DecodingState={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function PointCloud(e){this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=Color.clone(Color.DARKGRAY),this._highlightColor=Color.clone(Color.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=DecodingState.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._readyPromise=when.defer(),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=defaultValue(e.opaquePass,Pass$1.OPAQUE),this._cull=defaultValue(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this._modelMatrix=Matrix4.clone(Matrix4.IDENTITY),this.time=0,this.shadows=ShadowMode$1.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,initialize$6(this,e)}defineProperties$1(PointCloud.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},color:{get:function(){return Color.clone(this._highlightColor)},set:function(e){this._highlightColor=Color.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(defined(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=BoundingSphere.clone(e)}}});var sizeOfUint32$7=Uint32Array.BYTES_PER_ELEMENT;function initialize$6(e,t){var i=t.arrayBuffer,r=defaultValue(t.byteOffset,0),n=new Uint8Array(i),a=new DataView(i);r+=sizeOfUint32$7;var o=a.getUint32(r,!0);if(1!==o)throw new RuntimeError("Only Point Cloud tile version 1 is supported.  Version "+o+" is not.");r+=sizeOfUint32$7,r+=sizeOfUint32$7;var s=a.getUint32(r,!0);if(0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");r+=sizeOfUint32$7;var l=a.getUint32(r,!0);r+=sizeOfUint32$7;var c=a.getUint32(r,!0);r+=sizeOfUint32$7;var u=a.getUint32(r,!0),d=getStringFromTypedArray(n,r+=sizeOfUint32$7,s),h=JSON.parse(d);r+=s;var p,m,f=new Uint8Array(i,r,l);if(r+=l,0<c){var g=getStringFromTypedArray(n,r,c);p=JSON.parse(g),r+=c,0<u&&(m=new Uint8Array(i,r,u),r+=u)}var _=new Cesium3DTileFeatureTable(h,f),y=_.getGlobalProperty("POINTS_LENGTH");if(!defined(_.featuresLength=y))throw new RuntimeError("Feature table global property: POINTS_LENGTH must be defined");var v,C,S,x,T=_.getGlobalProperty("RTC_CENTER",ComponentDatatype$1.FLOAT,3);defined(T)&&(e._rtcCenter=Cartesian3.unpack(T));var b,E,P,A,w,D=!1,M=!1,I=!1,R=!1,O=!1,L=!1,F=!1,N=!1,B=defined(h.extensions)?h.extensions["3DTILES_draco_point_compression"]:void 0,V=defined(p)&&defined(p.extensions)?p.extensions["3DTILES_draco_point_compression"]:void 0;if(defined(V)&&(P=V.properties),defined(B)){E=B.properties;var k=B.byteOffset,$=B.byteLength;if(!defined(E)||!defined(k)||!defined($))throw new RuntimeError("Draco properties, byteOffset, and byteLength must be defined");b=arraySlice(f,k,k+$),D=defined(E.POSITION),M=defined(E.RGB)||defined(E.RGBA),I=defined(E.NORMAL),R=defined(E.BATCH_ID),L=defined(E.RGBA),e._decodingState=DecodingState.NEEDS_DECODE}if(defined(b)&&(A={buffer:b,featureTableProperties:E,batchTableProperties:P,properties:combine(E,P),dequantizeInShader:e._dequantizeInShader}),!D)if(defined(h.POSITION))v=_.getPropertyArray("POSITION",ComponentDatatype$1.FLOAT,3),D=!0;else if(defined(h.POSITION_QUANTIZED)){v=_.getPropertyArray("POSITION_QUANTIZED",ComponentDatatype$1.UNSIGNED_SHORT,3),D=O=!0;var z=_.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ComponentDatatype$1.FLOAT,3);if(!defined(z))throw new RuntimeError("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");e._quantizedVolumeScale=Cartesian3.unpack(z),e._quantizedRange=65535;var U=_.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ComponentDatatype$1.FLOAT,3);if(!defined(U))throw new RuntimeError("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e._quantizedVolumeOffset=Cartesian3.unpack(U)}if(M||(defined(h.RGBA)?(C=_.getPropertyArray("RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4),M=L=!0):defined(h.RGB)?(C=_.getPropertyArray("RGB",ComponentDatatype$1.UNSIGNED_BYTE,3),M=!0):defined(h.RGB565)&&(C=_.getPropertyArray("RGB565",ComponentDatatype$1.UNSIGNED_SHORT,1),M=F=!0)),I||(defined(h.NORMAL)?(S=_.getPropertyArray("NORMAL",ComponentDatatype$1.FLOAT,3),I=!0):defined(h.NORMAL_OCT16P)&&(S=_.getPropertyArray("NORMAL_OCT16P",ComponentDatatype$1.UNSIGNED_BYTE,2),I=N=!0)),R||defined(h.BATCH_ID)&&(x=_.getPropertyArray("BATCH_ID",ComponentDatatype$1.UNSIGNED_SHORT,1),R=!0),!D)throw new RuntimeError("Either POSITION or POSITION_QUANTIZED must be defined.");if(defined(h.CONSTANT_RGBA)){var G=_.getGlobalProperty("CONSTANT_RGBA",ComponentDatatype$1.UNSIGNED_BYTE,4);e._constantColor=Color.fromBytes(G[0],G[1],G[2],G[3],e._constantColor)}if(R){var H=_.getGlobalProperty("BATCH_LENGTH");if(!defined(H))throw new RuntimeError("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");defined(m)&&(m=new Uint8Array(m)),defined(e._batchTableLoaded)&&e._batchTableLoaded(H,p,m)}!R&&defined(m)&&(w=Cesium3DTileBatchTable.getBinaryProperties(y,p,m)),e._parsedContent={positions:v,colors:C,normals:S,batchIds:x,styleableProperties:w,draco:A},e._pointsLength=y,e._isQuantized=O,e._isOctEncoded16P=N,e._isRGB565=F,e._isTranslucent=L,e._hasColors=M,e._hasNormals=I,e._hasBatchIds=R}var scratchMin$2=new Cartesian3,scratchMax$2=new Cartesian3,scratchPosition$8=new Cartesian3,randomValues;function getRandomValues(e){if(!defined(randomValues)){CesiumMath.setRandomNumberSeed(0),randomValues=new Array(e);for(var t=0;t<e;++t)randomValues[t]=CesiumMath.nextRandomNumber()}return randomValues}function computeApproximateBoundingSphereFromPositions(e){for(var t=e.length/3,i=Math.min(t,20),r=getRandomValues(20),n=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=Cartesian3.fromElements(n,n,n,scratchMin$2),s=Cartesian3.fromElements(a,a,a,scratchMax$2),l=0;l<i;++l){var c=Math.floor(r[l]*t),u=Cartesian3.unpack(e,3*c,scratchPosition$8);Cartesian3.minimumByComponent(o,u,o),Cartesian3.maximumByComponent(s,u,s)}var d=BoundingSphere.fromCornerPoints(o,s);return d.radius+=CesiumMath.EPSILON2,d}function prepareVertexAttribute(e,t){var i=ComponentDatatype$1.fromTypedArray(e);return i===ComponentDatatype$1.INT||i===ComponentDatatype$1.UNSIGNED_INT||i===ComponentDatatype$1.DOUBLE?(oneTimeWarning("Cast pnts property to floats",'Point cloud property "'+t+'" will be casted 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}var scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier=new Cartesian4,scratchQuantizedVolumeScaleAndOctEncodedRange=new Cartesian4,scratchColor$g=new Color,positionLocation=0,colorLocation=1,normalLocation=2,batchIdLocation=3,numberOfAttributes=4,scratchClippingPlaneMatrix$1=new Matrix4;function createResources$2(e,t){var i,r,n=t.context,a=e._parsedContent,o=e._pointsLength,s=a.positions,l=a.colors,c=a.normals,u=a.batchIds,d=a.styleableProperties,h=defined(d),p=e._isQuantized,m=e._isQuantizedDraco,f=e._isOctEncoded16P,g=e._isOctEncodedDraco,_=e._quantizedRange,y=e._octEncodedRange,v=e._isRGB565,C=e._isTranslucent,S=e._hasColors,x=e._hasNormals,T=e._hasBatchIds,b=[],E={};if(e._styleableShaderAttributes=E,h){var P=numberOfAttributes;for(var A in d)if(d.hasOwnProperty(A)){var w=d[A],D=prepareVertexAttribute(w.typedArray,A);i=w.componentCount,r=ComponentDatatype$1.fromTypedArray(D);var M=Buffer$1.createVertexBuffer({context:n,typedArray:D,usage:BufferUsage$1.STATIC_DRAW});e._geometryByteLength+=M.sizeInBytes;var I={index:P,vertexBuffer:M,componentsPerAttribute:i,componentDatatype:r,normalize:!1,offsetInBytes:0,strideInBytes:0};b.push(I),E[A]={location:P,componentCount:i},++P}}var R,O,L,F=Buffer$1.createVertexBuffer({context:n,typedArray:s,usage:BufferUsage$1.STATIC_DRAW});e._geometryByteLength+=F.sizeInBytes,S&&(R=Buffer$1.createVertexBuffer({context:n,typedArray:l,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=R.sizeInBytes),x&&(O=Buffer$1.createVertexBuffer({context:n,typedArray:c,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=O.sizeInBytes),T&&(u=prepareVertexAttribute(u,"batchIds"),L=Buffer$1.createVertexBuffer({context:n,typedArray:u,usage:BufferUsage$1.STATIC_DRAW}),e._geometryByteLength+=L.sizeInBytes);var N=[];if(r=p?ComponentDatatype$1.UNSIGNED_SHORT:m?_<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT:ComponentDatatype$1.FLOAT,N.push({index:positionLocation,vertexBuffer:F,componentsPerAttribute:3,componentDatatype:r,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(e._boundingSphere=p||m?BoundingSphere.fromCornerPoints(Cartesian3.ZERO,e._quantizedVolumeScale):computeApproximateBoundingSphereFromPositions(s)),S)if(v)N.push({index:colorLocation,vertexBuffer:R,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{var B=C?4:3;N.push({index:colorLocation,vertexBuffer:R,componentsPerAttribute:B,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}x&&(r=f?(i=2,ComponentDatatype$1.UNSIGNED_BYTE):g?(i=2,y<=255?ComponentDatatype$1.UNSIGNED_BYTE:ComponentDatatype$1.UNSIGNED_SHORT):(i=3,ComponentDatatype$1.FLOAT),N.push({index:normalLocation,vertexBuffer:O,componentsPerAttribute:i,componentDatatype:r,normalize:!1,offsetInBytes:0,strideInBytes:0})),T&&N.push({index:batchIdLocation,vertexBuffer:L,componentsPerAttribute:1,componentDatatype:ComponentDatatype$1.fromTypedArray(u),normalize:!1,offsetInBytes:0,strideInBytes:0}),h&&(N=N.concat(b));var V=new VertexArray({context:n,attributes:N}),k={depthTest:{enabled:!0}};e._opaquePass===Pass$1.CESIUM_3D_TILE&&(k.stencilTest=StencilConstants$1.setCesium3DTileBit(),k.stencilMask=StencilConstants$1.CESIUM_3D_TILE_MASK),e._opaqueRenderState=RenderState.fromCache(k),e._translucentRenderState=RenderState.fromCache({depthTest:{enabled:!0},depthMask:!1,blending:BlendingState$1.ALPHA_BLEND}),e._drawCommand=new DrawCommand({boundingVolume:new BoundingSphere,cull:e._cull,modelMatrix:new Matrix4,primitiveType:PrimitiveType$1.POINTS,vertexArray:V,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:C?e._translucentRenderState:e._opaqueRenderState,pass:C?Pass$1.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function createUniformMap$3(r,n){var a=n.context,e=r._isQuantized,t=r._isQuantizedDraco,i=r._isOctEncodedDraco,o={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){var e=scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier;if(e.x=r._attenuation?r.maximumAttenuation:r._pointSize,e.x*=n.pixelRatio,e.y=r.time,r._attenuation){var t,i=n.camera.frustum;t=n.mode===SceneMode$1.SCENE2D||i instanceof OrthographicFrustum?Number.POSITIVE_INFINITY:a.drawingBufferHeight/n.camera.frustum.sseDenominator,e.z=r.geometricError*r.geometricErrorScale,e.w=t}return e},u_highlightColor:function(){return r._highlightColor},u_constantColor:function(){return r._constantColor},u_clippingPlanes:function(){var e=r.clippingPlanes;return r.isClipped?e.texture:a.defaultTexture},u_clippingPlanesEdgeStyle:function(){var e=r.clippingPlanes;if(!defined(e))return Color.TRANSPARENT;var t=Color.clone(e.edgeColor,scratchColor$g);return t.alpha=e.edgeWidth,t},u_clippingPlanesMatrix:function(){var e=r.clippingPlanes;if(!defined(e))return Matrix4.IDENTITY;var t=defaultValue(r.clippingPlanesOriginMatrix,r._modelMatrix);return Matrix4.multiply(a.uniformState.view3D,t,scratchClippingPlaneMatrix$1),Matrix4.multiply(scratchClippingPlaneMatrix$1,e.modelMatrix,scratchClippingPlaneMatrix$1)}};(e||t||i)&&(o=combine(o,{u_quantizedVolumeScaleAndOctEncodedRange:function(){var e=scratchQuantizedVolumeScaleAndOctEncodedRange;if(defined(r._quantizedVolumeScale)){var t=Cartesian3.clone(r._quantizedVolumeScale,e);Cartesian3.divideByScalar(t,r._quantizedRange,e)}return e.w=r._octEncodedRange,e}})),defined(r._uniformMapLoaded)&&(o=r._uniformMapLoaded(o)),r._drawCommand.uniformMap=o}var defaultProperties=["POSITION","COLOR","NORMAL","POSITION_ABSOLUTE"];function getStyleableProperties(e,t){for(var i=/czm_tiles3d_style_(\w+)/g,r=i.exec(e);null!==r;){var n=r[1];-1===t.indexOf(n)&&t.push(n),r=i.exec(e)}}function getVertexAttribute(e,t){for(var i=e.numberOfAttributes,r=0;r<i;++r){var n=e.getAttribute(r);if(n.index===t)return n}}function modifyStyleFunction(e){for(var t=defaultProperties.length,i=0;i<t;++i){var r=defaultProperties[i],n="czm_tiles3d_style_"+r,a=r.toLowerCase();e=e.replace(new RegExp(n+"(\\W)","g"),a+"$1")}return e.replace("()","(vec3 position, vec3 position_absolute, vec4 color, vec3 normal)")}function createShaders$1(e,t,i){var r,n,a,o,s,l,c=t.context,u=defined(i),d=e._isQuantized,h=e._isQuantizedDraco,p=e._isOctEncoded16P,m=e._isOctEncodedDraco,f=e._isRGB565,g=e._isTranslucent,_=e._hasColors,y=e._hasNormals,v=e._hasBatchIds,C=e._backFaceCulling,S=e._normalShading,x=e._drawCommand.vertexArray,T=e.clippingPlanes,b=e._attenuation,E=g;if(u){var P={translucent:!1};o=i.getColorShaderFunction("getColorFromStyle","czm_tiles3d_style_",P),s=i.getShowShaderFunction("getShowFromStyle","czm_tiles3d_style_",P),l=i.getPointSizeShaderFunction("getPointSizeFromStyle","czm_tiles3d_style_",P),defined(o)&&P.translucent&&(E=!0)}e._styleTranslucent=E;var A=defined(o),w=defined(s),D=defined(l),M=e.isClipped,I=[];A&&(getStyleableProperties(o,I),o=modifyStyleFunction(o)),w&&(getStyleableProperties(s,I),s=modifyStyleFunction(s)),D&&(getStyleableProperties(l,I),l=modifyStyleFunction(l));var R=0<=I.indexOf("COLOR"),O=0<=I.indexOf("NORMAL"),L=I.filter(function(e){return-1===defaultProperties.indexOf(e)});if(O&&!y)throw new RuntimeError("Style references the NORMAL semantic but the point cloud does not have normals");var F=e._styleableShaderAttributes;for(n in F)if(F.hasOwnProperty(n)){a=F[n];var N=0<=L.indexOf(n);getVertexAttribute(x,a.location).enabled=N}var B=_&&(!A||R);_&&(getVertexAttribute(x,colorLocation).enabled=B);var V=y&&(S||C||O);y&&(getVertexAttribute(x,normalLocation).enabled=V);var k={a_position:positionLocation};B&&(k.a_color=colorLocation),V&&(k.a_normal=normalLocation),v&&(k.a_batchId=batchIdLocation);var $="",z=L.length;for(r=0;r<z;++r){if(!defined(a=F[n=L[r]]))throw new RuntimeError('Style references a property "'+n+'" that does not exist or is not styleable.');var U=a.componentCount,G="czm_tiles3d_style_"+n;$+="attribute "+(1===U?"float":"vec"+U)+" "+G+"; \n",k[G]=a.location}createUniformMap$3(e,t);var H="attribute vec3 a_position; \nvarying vec4 v_color; \nuniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \nuniform vec4 u_constantColor; \nuniform vec4 u_highlightColor; \n";H+="float u_pointSize; \nfloat u_time; \n",b&&(H+="float u_geometricError; \nfloat u_depthMultiplier; \n"),H+=$,B&&(H+=g?"attribute vec4 a_color; \n":f?"attribute float a_color; \nconst float SHIFT_RIGHT_11 = 1.0 / 2048.0; \nconst float SHIFT_RIGHT_5 = 1.0 / 32.0; \nconst float SHIFT_LEFT_11 = 2048.0; \nconst float SHIFT_LEFT_5 = 32.0; \nconst float NORMALIZE_6 = 1.0 / 64.0; \nconst float NORMALIZE_5 = 1.0 / 32.0; \n":"attribute vec3 a_color; \n"),V&&(H+=p||m?"attribute vec2 a_normal; \n":"attribute vec3 a_normal; \n"),v&&(H+="attribute float a_batchId; \n"),(d||h||m)&&(H+="uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; \n"),A&&(H+=o),w&&(H+=s),D&&(H+=l),H+="void main() \n{ \n    u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; \n    u_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; \n",b&&(H+="    u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; \n    u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; \n"),H+=B?g?"    vec4 color = a_color; \n":f?"    float compressed = a_color; \n    float r = floor(compressed * SHIFT_RIGHT_11); \n    compressed -= r * SHIFT_LEFT_11; \n    float g = floor(compressed * SHIFT_RIGHT_5); \n    compressed -= g * SHIFT_LEFT_5; \n    float b = compressed; \n    vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); \n    vec4 color = vec4(rgb, 1.0); \n":"    vec4 color = vec4(a_color, 1.0); \n":"    vec4 color = u_constantColor; \n",H+=d||h?"    vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; \n":"    vec3 position = a_position; \n",H+="    vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); \n",V?(H+=p?"    vec3 normal = czm_octDecode(a_normal); \n":m?"    vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; \n":"    vec3 normal = a_normal; \n",H+="    vec3 normalEC = czm_normal * normal; \n"):H+="    vec3 normal = vec3(1.0); \n",A&&(H+="    color = getColorFromStyle(position, position_absolute, color, normal); \n"),w&&(H+="    float show = float(getShowFromStyle(position, position_absolute, color, normal)); \n"),H+=D?"    gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; \n":b?"    vec4 positionEC = czm_modelView * vec4(position, 1.0); \n    float depth = -positionEC.z; \n    gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); \n":"    gl_PointSize = u_pointSize; \n",H+="    color = color * u_highlightColor; \n",V&&S&&(H+="    float diffuseStrength = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC); \n    diffuseStrength = max(diffuseStrength, 0.4); \n    color.xyz *= diffuseStrength; \n"),H+="    v_color = color; \n    gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n",V&&C&&(H+="    float visible = step(-normalEC.z, 0.0); \n    gl_Position *= visible; \n    gl_PointSize *= visible; \n"),w&&(H+="    gl_Position *= show; \n    gl_PointSize *= show; \n"),H+="} \n";var W="varying vec4 v_color; \n";M&&(W+="uniform sampler2D u_clippingPlanes; \nuniform mat4 u_clippingPlanesMatrix; \nuniform vec4 u_clippingPlanesEdgeStyle; \n",W+="\n",W+=getClippingFunction(T,c),W+="\n"),W+="void main() \n{ \n    gl_FragColor = czm_gammaCorrect(v_color); \n",M&&(W+=getClipAndStyleCode("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),W+="} \n",defined(e._vertexShaderLoaded)&&(H=e._vertexShaderLoaded(H)),defined(e._fragmentShaderLoaded)&&(W=e._fragmentShaderLoaded(W));var q=e._drawCommand;defined(q.shaderProgram)&&q.shaderProgram.destroy(),q.shaderProgram=ShaderProgram.fromCache({context:c,vertexShaderSource:H,fragmentShaderSource:W,attributeLocations:k});try{q.shaderProgram._bind()}catch(e){throw new RuntimeError("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function decodeDraco(m,e){if(m._decodingState===DecodingState.READY)return!1;if(m._decodingState===DecodingState.NEEDS_DECODE){var f=m._parsedContent,g=f.draco,t=DracoLoader.decodePointCloud(g,e);defined(t)&&(m._decodingState=DecodingState.DECODING,t.then(function(e){m._decodingState=DecodingState.READY;var t=defined(e.POSITION)?e.POSITION.array:void 0,i=defined(e.RGB)?e.RGB.array:void 0,r=defined(e.RGBA)?e.RGBA.array:void 0,n=defined(e.NORMAL)?e.NORMAL.array:void 0,a=defined(e.BATCH_ID)?e.BATCH_ID.array:void 0,o=defined(t)&&defined(e.POSITION.data.quantization),s=defined(n)&&defined(e.NORMAL.data.quantization);if(o){var l=e.POSITION.data.quantization,c=l.range;m._quantizedVolumeScale=Cartesian3.fromElements(c,c,c),m._quantizedVolumeOffset=Cartesian3.unpack(l.minValues),m._quantizedRange=(1<<l.quantizationBits)-1,m._isQuantizedDraco=!0}s&&(m._octEncodedRange=(1<<e.NORMAL.data.quantization.quantizationBits)-1,m._isOctEncodedDraco=!0);var u=f.styleableProperties,d=g.batchTableProperties;for(var h in d)if(d.hasOwnProperty(h)){var p=e[h];defined(u)||(u={}),u[h]={typedArray:p.array,componentCount:p.data.componentsPerAttribute}}f.positions=defaultValue(t,f.positions),f.colors=defaultValue(defaultValue(r,i),f.colors),f.normals=defaultValue(n,f.normals),f.batchIds=defaultValue(a,f.batchIds),f.styleableProperties=u}).otherwise(function(e){m._decodingState=DecodingState.FAILED,m._readyPromise.reject(e)}))}return!0}var scratchComputedTranslation$2=new Cartesian4,scratchScale$6=new Cartesian3;PointCloud.prototype.update=function(e){if(!decodeDraco(this,e.context)){var t=!1,i=!Matrix4.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,i=!0),defined(this._drawCommand)||(createResources$2(this,e),t=i=!0,this._ready=!0,this._readyPromise.resolve(this),this._parsedContent=void 0),i){Matrix4.clone(this.modelMatrix,this._modelMatrix);var r=this._drawCommand.modelMatrix;if(Matrix4.clone(this._modelMatrix,r),defined(this._rtcCenter)&&Matrix4.multiplyByTranslation(r,this._rtcCenter,r),defined(this._quantizedVolumeOffset)&&Matrix4.multiplyByTranslation(r,this._quantizedVolumeOffset,r),e.mode!==SceneMode$1.SCENE3D){var n=e.mapProjection,a=Matrix4.getColumn(r,3,scratchComputedTranslation$2);Cartesian4.equals(a,Cartesian4.UNIT_W)||Transforms.basisTo2D(n,r,r)}var o=this._drawCommand.boundingVolume;if(BoundingSphere.clone(this._boundingSphere,o),this._cull){var s=o.center;Matrix4.multiplyByPoint(r,s,s);var l=Matrix4.getScale(r,scratchScale$6);o.radius*=Cartesian3.maximumComponent(l)}}this.clippingPlanesDirty&&(t=!(this.clippingPlanesDirty=!1)),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,t=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,t=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,t=!0),this._style===this.style&&!this.styleDirty||(this._style=this.style,t=!(this.styleDirty=!1)),t&&createShaders$1(this,e,this._style),this._drawCommand.castShadows=ShadowMode$1.castShadows(this.shadows),this._drawCommand.receiveShadows=ShadowMode$1.receiveShadows(this.shadows);var c=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=c?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=c?Pass$1.TRANSLUCENT:this._opaquePass;var u=e.commandList,d=e.passes;(d.render||d.pick)&&u.push(this._drawCommand)}},PointCloud.prototype.isDestroyed=function(){return!1},PointCloud.prototype.destroy=function(){var e=this._drawCommand;return defined(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),destroyObject(this)};var PointCloudEyeDomeLightingShader="#extension GL_EXT_frag_depth : enable\nuniform sampler2D u_pointCloud_colorGBuffer;\nuniform sampler2D u_pointCloud_depthGBuffer;\nuniform vec2 u_distanceAndEdlStrength;\nvarying vec2 v_textureCoordinates;\nvec2 neighborContribution(float log2Depth, vec2 offset)\n{\nfloat dist = u_distanceAndEdlStrength.x;\nvec2 texCoordOrig = v_textureCoordinates + offset * dist;\nvec2 texCoord0 = v_textureCoordinates + offset * floor(dist);\nvec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);\nfloat depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));\nfloat depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));\nif (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {\nreturn vec2(0.0);\n}\nfloat depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);\nreturn vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);\n}\nvoid main()\n{\nfloat depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));\nvec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);\neyeCoordinate /= eyeCoordinate.w;\nfloat log2Depth = log2(-eyeCoordinate.z);\nif (depthOrLogDepth == 0.0)\n{\ndiscard;\n}\nvec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);\nvec2 texelSize = 1.0 / czm_viewport.zw;\nvec2 responseAndCount = vec2(0.0);\nresponseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));\nresponseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));\nfloat response = responseAndCount.x / responseAndCount.y;\nfloat strength = u_distanceAndEdlStrength.y;\nfloat shade = exp(-response * 300.0 * strength);\ncolor.rgb *= shade;\ngl_FragColor = vec4(color);\n#ifdef LOG_DEPTH\nczm_writeLogDepth(1.0 + (czm_projection * vec4(eyeCoordinate.xyz, 1.0)).w);\n#else\ngl_FragDepthEXT = czm_eyeToWindowCoordinates(vec4(eyeCoordinate.xyz, 1.0)).z;\n#endif\n}\n";function PointCloudEyeDomeLighting(){this._framebuffer=void 0,this._colorGBuffer=void 0,this._depthGBuffer=void 0,this._depthTexture=void 0,this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}function createSampler(){return new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}function destroyFramebuffer(e){var t=e._framebuffer;defined(t)&&(e._colorGBuffer.destroy(),e._depthGBuffer.destroy(),e._depthTexture.destroy(),t.destroy(),e._framebuffer=void 0,e._colorGBuffer=void 0,e._depthGBuffer=void 0,e._depthTexture=void 0,e._drawCommand=void 0,e._clearCommand=void 0)}function createFramebuffer$2(e,t){var i=t.drawingBufferWidth,r=t.drawingBufferHeight,n=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:createSampler()}),a=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:createSampler()}),o=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_COMPONENT,pixelDatatype:PixelDatatype$1.UNSIGNED_INT,sampler:createSampler()});e._framebuffer=new Framebuffer({context:t,colorTextures:[n,a],depthTexture:o,destroyAttachments:!1}),e._colorGBuffer=n,e._depthGBuffer=a,e._depthTexture=o}var distanceAndEdlStrengthScratch=new Cartesian2;function createCommands$5(e,t){var i=PointCloudEyeDomeLightingShader,r={u_pointCloud_colorGBuffer:function(){return e._colorGBuffer},u_pointCloud_depthGBuffer:function(){return e._depthGBuffer},u_distanceAndEdlStrength:function(){return distanceAndEdlStrengthScratch.x=e._radius,distanceAndEdlStrengthScratch.y=e._strength,distanceAndEdlStrengthScratch}},n=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(i,{uniformMap:r,renderState:n,pass:Pass$1.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ClearCommand({framebuffer:e._framebuffer,color:new Color(0,0,0,0),depth:1,renderState:RenderState.fromCache(),pass:Pass$1.CESIUM_3D_TILE,owner:e})}function createResources$3(e,t){var i=t.drawingBufferWidth,r=t.drawingBufferHeight,n=e._colorGBuffer,a=!1,o=defined(n)&&(n.width!==i||n.height!==r);return defined(n)&&!o||(destroyFramebuffer(e),createFramebuffer$2(e,t),createCommands$5(e,t),a=!0),a}function isSupported(e){return e.drawBuffers&&e.fragmentDepth}function getECShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!defined(i)){var r=t._attributeLocations,n=t.fragmentShaderSource.clone();n.sources=n.sources.map(function(e){return e=(e=ShaderSource.replaceMain(e,"czm_point_cloud_post_process_main")).replace(/gl_FragColor/g,"gl_FragData[0]")}),n.sources.unshift("#extension GL_EXT_draw_buffers : enable \n"),n.sources.push("void main() \n{ \n    czm_point_cloud_post_process_main(); \n    gl_FragData[1] = czm_packDepth(gl_FragCoord.z); \n}"),i=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:n,attributeLocations:r})}return i}function PointCloudShading(e){var t=defaultValue(e,{});this.attenuation=defaultValue(t.attenuation,!1),this.geometricErrorScale=defaultValue(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=defaultValue(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=defaultValue(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=defaultValue(t.eyeDomeLightingRadius,1),this.backFaceCulling=defaultValue(t.backFaceCulling,!1),this.normalShading=defaultValue(t.normalShading,!0)}function PointCloud3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._pickId=void 0,this._batchTable=void 0,this._styleDirty=!1,this._features=void 0,this.featurePropertiesDirty=!1,this._pointCloud=new PointCloud({arrayBuffer:r,byteOffset:n,cull:!1,opaquePass:Pass$1.CESIUM_3D_TILE,vertexShaderLoaded:getVertexShaderLoaded(this),fragmentShaderLoaded:getFragmentShaderLoaded(this),uniformMapLoaded:getUniformMapLoaded(this),batchTableLoaded:getBatchTableLoaded(this),pickIdLoaded:getPickIdLoaded(this)})}function getVertexShaderLoaded(t){return function(e){return defined(t._batchTable)?t._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(e):e}}function getFragmentShaderLoaded(t){return function(e){return defined(t._batchTable)?t._batchTable.getFragmentShaderCallback(!1,void 0)(e):"uniform vec4 czm_pickColor;\n"+e}}function getUniformMapLoaded(t){return function(e){return defined(t._batchTable)?t._batchTable.getUniformMapCallback()(e):combine(e,{czm_pickColor:function(){return t._pickId.color}})}}function getBatchTableLoaded(r){return function(e,t,i){r._batchTable=new Cesium3DTileBatchTable(r,e,t,i)}}function getPickIdLoaded(e){return function(){return defined(e._batchTable)?e._batchTable.getPickId():"czm_pickColor"}}function getGeometricError(e){var t=e._tileset.pointCloudShading,i=e._tile.contentBoundingVolume.boundingSphere.volume(),r=CesiumMath.cbrt(i/e.pointsLength),n=e._tile.geometricError;return 0===n&&(n=defined(t)&&defined(t.baseResolution)?t.baseResolution:r),n}function createFeatures$3(e){var t=e.featuresLength;if(!defined(e._features)&&0<t){for(var i=new Array(t),r=0;r<t;++r)i[r]=new Cesium3DTileFeature(e,r);e._features=i}}PointCloudEyeDomeLighting.isSupported=isSupported,PointCloudEyeDomeLighting.prototype.update=function(e,t,i){if(isSupported(e.context)){this._strength=i.eyeDomeLightingStrength,this._radius=i.eyeDomeLightingRadius*e.pixelRatio;var r,n=createResources$3(this,e.context),a=e.commandList,o=a.length;for(r=t;r<o;++r){var s=a[r];if(s.primitiveType===PrimitiveType$1.POINTS&&s.pass!==Pass$1.TRANSLUCENT){var l=s.derivedCommands.pointCloudProcessor;defined(l)&&!s.dirty&&!n&&l.framebuffer===this._framebuffer||(l=DrawCommand.shallowClone(s),(s.derivedCommands.pointCloudProcessor=l).framebuffer=this._framebuffer,l.shaderProgram=getECShaderProgram(e.context,s.shaderProgram),l.castShadows=!1,l.receiveShadows=!1),a[r]=l}}var c=this._clearCommand,u=this._drawCommand;a.push(u),a.push(c)}},PointCloudEyeDomeLighting.prototype.isDestroyed=function(){return!1},PointCloudEyeDomeLighting.prototype.destroy=function(){return destroyFramebuffer(this),destroyObject(this)},PointCloudShading.isSupported=function(e){return PointCloudEyeDomeLighting.isSupported(e.context)},defineProperties$1(PointCloud3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return this._pointCloud.pointsLength}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return this._pointCloud.geometryByteLength}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._pointCloud.readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}}}),PointCloud3DTileContent.prototype.hasProperty=function(e,t){return!!defined(this._batchTable)&&this._batchTable.hasProperty(e,t)},PointCloud3DTileContent.prototype.getFeature=function(e){if(defined(this._batchTable)){this.featuresLength;return createFeatures$3(this),this._features[e]}},PointCloud3DTileContent.prototype.applyDebugSettings=function(e,t){this._pointCloud.color=e?t:Color.WHITE},PointCloud3DTileContent.prototype.applyStyle=function(e){defined(this._batchTable)?this._batchTable.applyStyle(e):this._styleDirty=!0};var defaultShading=new PointCloudShading;function Tileset3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._readyPromise=when.defer(),this.featurePropertiesDirty=!1,initialize$7(this,r,n)}function initialize$7(t,e,i){i=defaultValue(i,0);var r,n=getStringFromTypedArray(new Uint8Array(e),i);try{r=JSON.parse(n)}catch(e){return void t._readyPromise.reject(new RuntimeError("Invalid tile content."))}t._tileset.loadTileset(t._resource,r,t._tile),t._readyPromise.resolve(t)}function Cesium3DTilePointFeature(e,t,i,r,n){this._content=e,this._billboard=i,this._label=r,this._polyline=n,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),setBillboardImage(this)}PointCloud3DTileContent.prototype.update=function(e,t){var i,r=this._pointCloud,n=defaultValue(e.pointCloudShading,defaultShading),a=this._tile,o=this._batchTable,s=t.mode,l=e.clippingPlanes;defined(this._pickId)||defined(o)||(this._pickId=t.context.createPickId({primitive:e,content:this})),defined(o)&&o.update(e,t),i=defined(a._contentBoundingVolume)?s===SceneMode$1.SCENE3D?a._contentBoundingVolume.boundingSphere:a._contentBoundingVolume2D.boundingSphere:s===SceneMode$1.SCENE3D?a._boundingVolume.boundingSphere:a._boundingVolume2D.boundingSphere;var c=this._styleDirty;this._styleDirty=!1,r.clippingPlanesOriginMatrix=e.clippingPlanesOriginMatrix,r.style=defined(o)?void 0:e.style,r.styleDirty=c,r.modelMatrix=a.computedTransform,r.time=e.timeSinceLoad,r.shadows=e.shadows,r.boundingSphere=i,r.clippingPlanes=l,r.isClipped=defined(l)&&l.enabled&&a._isClipped,r.clippingPlanesDirty=a.clippingPlanesDirty,r.attenuation=n.attenuation,r.backFaceCulling=n.backFaceCulling,r.normalShading=n.normalShading,r.geometricError=getGeometricError(this),r.geometricErrorScale=n.geometricErrorScale,defined(n)&&defined(n.maximumAttenuation)?r.maximumAttenuation=n.maximumAttenuation:a.refine===Cesium3DTileRefine$1.ADD?r.maximumAttenuation=5:r.maximumAttenuation=e.maximumScreenSpaceError,r.update(t)},PointCloud3DTileContent.prototype.isDestroyed=function(){return!1},PointCloud3DTileContent.prototype.destroy=function(){return this._pickId=this._pickId&&this._pickId.destroy(),this._pointCloud=this._pointCloud&&this._pointCloud.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),destroyObject(this)},defineProperties$1(Tileset3DTileContent.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(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}}}),Tileset3DTileContent.prototype.hasProperty=function(e,t){return!1},Tileset3DTileContent.prototype.getFeature=function(e){},Tileset3DTileContent.prototype.applyDebugSettings=function(e,t){},Tileset3DTileContent.prototype.applyStyle=function(e){},Tileset3DTileContent.prototype.update=function(e,t){},Tileset3DTileContent.prototype.isDestroyed=function(){return!1},Tileset3DTileContent.prototype.destroy=function(){return destroyObject(this)};var scratchCartographic$b=new Cartographic;function setBillboardImage(e){var t=e._billboard;if(defined(e._billboardImage)&&e._billboardImage!==t.image)t.image=e._billboardImage;else if(!defined(e._billboardImage)){var i=defaultValue(e._color,Cesium3DTilePointFeature.defaultColor),r=defaultValue(e._pointOutlineColor,Cesium3DTilePointFeature.defaultPointOutlineColor),n=defaultValue(e._pointOutlineWidth,Cesium3DTilePointFeature.defaultPointOutlineWidth),a=defaultValue(e._pointSize,Cesium3DTilePointFeature.defaultPointSize),o=e._billboardColor,s=e._billboardOutlineColor,l=e._billboardOutlineWidth,c=e._billboardSize;if(!Color.equals(i,o)||!Color.equals(r,s)||n!==l||a!==c){e._billboardColor=Color.clone(i,e._billboardColor),e._billboardOutlineColor=Color.clone(r,e._billboardOutlineColor),e._billboardOutlineWidth=n,e._billboardSize=a;var u=i.alpha,d=i.toCssColorString(),h=r.toCssColorString(),p=JSON.stringify([d,a,h,n]);t.setImage(p,createBillboardPointCallback(u,d,h,n,a))}}}function Vector3DTilePoints(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=void 0,this._labelCollection=void 0,this._polylineCollection=void 0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._readyPromise=when.defer(),this._resolvedPromise=!1}function packBuffer$1(e,t){var i=e._rectangle,r=e._minHeight,n=e._maxHeight,a=2+Rectangle.packedLength+Ellipsoid.packedLength,o=new Float64Array(a),s=0;return o[s++]=r,o[s++]=n,Rectangle.pack(i,o,s),s+=Rectangle.packedLength,Ellipsoid.pack(t,o,s),o}defineProperties$1(Cesium3DTilePointFeature.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=Color.clone(e,this._color),setBillboardImage(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,setBillboardImage(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Color.clone(e,this._pointOutlineColor),setBillboardImage(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,setBillboardImage(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&0<e.alpha}},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){defined(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){var t=defaultValue(this._heightOffset,0),i=this._content.tileset.ellipsoid,r=i.cartesianToCartographic(this._billboard.position,scratchCartographic$b);r.height=r.height-t+e;var n=i.cartographicToCartesian(r);this._billboard.position=n,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],n],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=Color.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){var t=this._billboardImage!==e;this._billboardImage=e,t&&setBillboardImage(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(){var e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}}),Cesium3DTilePointFeature.defaultColor=Color.WHITE,Cesium3DTilePointFeature.defaultPointOutlineColor=Color.BLACK,Cesium3DTilePointFeature.defaultPointOutlineWidth=0,Cesium3DTilePointFeature.defaultPointSize=8,Cesium3DTilePointFeature.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.getPropertyNames=function(e){return this._content.batchTable.getPropertyNames(this._batchId,e)},Cesium3DTilePointFeature.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},Cesium3DTilePointFeature.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},Cesium3DTilePointFeature.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},Cesium3DTilePointFeature.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)},defineProperties$1(Vector3DTilePoints.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){return this._billboardCollection.textureAtlas.texture.sizeInBytes+this._labelCollection._textureAtlas.texture.sizeInBytes}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor$1=new TaskProcessor("createVectorTilePoints"),scratchPosition$9=new Cartesian3;function createPoints(t,e){if(!defined(t._billboardCollection)){var i;if(!defined(t._verticesPromise)){i=t._positions;var r=t._packedBuffer;defined(r)||(i=t._positions=arraySlice(i),t._batchIds=arraySlice(t._batchIds),r=t._packedBuffer=packBuffer$1(t,e));var n=[i.buffer,r.buffer],a={positions:i.buffer,packedBuffer:r.buffer},o=t._verticesPromise=createVerticesTaskProcessor$1.scheduleTask(a,n);if(!defined(o))return;o.then(function(e){t._positions=new Float64Array(e.positions),t._ready=!0})}if(t._ready&&!defined(t._billboardCollection)){i=t._positions;var s=t._batchTable,l=t._batchIds,c=t._billboardCollection=new BillboardCollection({batchTable:s}),u=t._labelCollection=new LabelCollection({batchTable:s}),d=t._polylineCollection=new PolylineCollection;d._useHighlightColor=!0;for(var h=i.length/3,p=0;p<h;++p){var m=l[p],f=Cartesian3.unpack(i,3*p,scratchPosition$9),g=c.add();g.position=f,g._batchIndex=m;var _=u.add();_.text=" ",_.position=f,_._batchIndex=m,d.add().positions=[Cartesian3.clone(f),Cartesian3.clone(f)]}t._positions=void 0,t._packedBuffer=void 0}}}function clearStyle$1(e,t){for(var i=e._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.show=!0,a.pointSize=Cesium3DTilePointFeature.defaultPointSize,a.color=Cesium3DTilePointFeature.defaultColor,a.pointOutlineColor=Cesium3DTilePointFeature.defaultPointOutlineColor,a.pointOutlineWidth=Cesium3DTilePointFeature.defaultPointOutlineWidth,a.labelColor=Color.WHITE,a.labelOutlineColor=Color.WHITE,a.labelOutlineWidth=1,a.font="30px sans-serif",a.labelStyle=LabelStyle$1.FILL,a.labelText=void 0,a.backgroundColor=new Color(.165,.165,.165,.8),a.backgroundPadding=new Cartesian2(7,5),a.backgroundEnabled=!1,a.scaleByDistance=void 0,a.translucencyByDistance=void 0,a.distanceDisplayCondition=void 0,a.heightOffset=0,a.anchorLineEnabled=!1,a.anchorLineColor=Color.WHITE,a.image=void 0,a.disableDepthTestDistance=0,a.horizontalOrigin=HorizontalOrigin$1.CENTER,a.verticalOrigin=VerticalOrigin$1.CENTER,a.labelHorizontalOrigin=HorizontalOrigin$1.RIGHT,a.labelVerticalOrigin=VerticalOrigin$1.BASELINE}}Vector3DTilePoints.prototype.createFeatures=function(e,t){for(var i=this._billboardCollection,r=this._labelCollection,n=this._polylineCollection,a=this._batchIds,o=a.length,s=0;s<o;++s){var l=a[s],c=i.get(s),u=r.get(s),d=n.get(s);t[l]=new Cesium3DTilePointFeature(e,l,c,u,d)}},Vector3DTilePoints.prototype.applyDebugSettings=function(e,t){e?(Color.clone(t,this._billboardCollection._highlightColor),Color.clone(t,this._labelCollection._highlightColor),Color.clone(t,this._polylineCollection._highlightColor)):(Color.clone(Color.WHITE,this._billboardCollection._highlightColor),Color.clone(Color.WHITE,this._labelCollection._highlightColor),Color.clone(Color.WHITE,this._polylineCollection._highlightColor))};var scratchColor$h=new Color,scratchColor2=new Color,scratchColor3=new Color,scratchColor4=new Color,scratchColor5=new Color,scratchColor6=new Color,scratchScaleByDistance=new NearFarScalar,scratchTranslucencyByDistance=new NearFarScalar,scratchDistanceDisplayCondition=new DistanceDisplayCondition;function Vector3DTilePolygons(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=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=defaultValue(e.center,Cartesian3.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._readyPromise=when.defer(),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ClassificationType$1.BOTH}function packBuffer$2(e){var t=new Float64Array(3+Cartesian3.packedLength+Ellipsoid.packedLength+Rectangle.packedLength),i=0;return t[i++]=e._indices.BYTES_PER_ELEMENT,t[i++]=e._minimumHeight,t[i++]=e._maximumHeight,Cartesian3.pack(e._center,t,i),i+=Cartesian3.packedLength,Ellipsoid.pack(e._ellipsoid,t,i),i+=Ellipsoid.packedLength,Rectangle.pack(e._rectangle,t,i),t}function unpackBuffer$1(e,t){for(var i=1,r=t[i++],n=e._boundingVolumes=new Array(r),a=0;a<r;++a)n[a]=OrientedBoundingBox.unpack(t,i),i+=OrientedBoundingBox.packedLength;for(var o=t[i++],s=e._batchedIndices=new Array(o),l=0;l<o;++l){var c=Color.unpack(t,i);i+=Color.packedLength;for(var u=t[i++],d=t[i++],h=t[i++],p=new Array(h),m=0;m<h;++m)p[m]=t[i++];s[l]=new Vector3DTileBatch({color:c,offset:u,count:d,batchIds:p})}}Vector3DTilePoints.prototype.applyStyle=function(e,t){if(defined(e))for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];if(defined(e.show)&&(a.show=e.show.evaluate(a)),defined(e.pointSize)&&(a.pointSize=e.pointSize.evaluate(a)),defined(e.color)&&(a.color=e.color.evaluateColor(a,scratchColor$h)),defined(e.pointOutlineColor)&&(a.pointOutlineColor=e.pointOutlineColor.evaluateColor(a,scratchColor2)),defined(e.pointOutlineWidth)&&(a.pointOutlineWidth=e.pointOutlineWidth.evaluate(a)),defined(e.labelColor)&&(a.labelColor=e.labelColor.evaluateColor(a,scratchColor3)),defined(e.labelOutlineColor)&&(a.labelOutlineColor=e.labelOutlineColor.evaluateColor(a,scratchColor4)),defined(e.labelOutlineWidth)&&(a.labelOutlineWidth=e.labelOutlineWidth.evaluate(a)),defined(e.font)&&(a.font=e.font.evaluate(a)),defined(e.labelStyle)&&(a.labelStyle=e.labelStyle.evaluate(a)),defined(e.labelText)?a.labelText=e.labelText.evaluate(a):a.labelText=void 0,defined(e.backgroundColor)&&(a.backgroundColor=e.backgroundColor.evaluateColor(a,scratchColor5)),defined(e.backgroundPadding)&&(a.backgroundPadding=e.backgroundPadding.evaluate(a)),defined(e.backgroundEnabled)&&(a.backgroundEnabled=e.backgroundEnabled.evaluate(a)),defined(e.scaleByDistance)){var o=e.scaleByDistance.evaluate(a);scratchScaleByDistance.near=o.x,scratchScaleByDistance.nearValue=o.y,scratchScaleByDistance.far=o.z,scratchScaleByDistance.farValue=o.w,a.scaleByDistance=scratchScaleByDistance}else a.scaleByDistance=void 0;if(defined(e.translucencyByDistance)){var s=e.translucencyByDistance.evaluate(a);scratchTranslucencyByDistance.near=s.x,scratchTranslucencyByDistance.nearValue=s.y,scratchTranslucencyByDistance.far=s.z,scratchTranslucencyByDistance.farValue=s.w,a.translucencyByDistance=scratchTranslucencyByDistance}else a.translucencyByDistance=void 0;if(defined(e.distanceDisplayCondition)){var l=e.distanceDisplayCondition.evaluate(a);scratchDistanceDisplayCondition.near=l.x,scratchDistanceDisplayCondition.far=l.y,a.distanceDisplayCondition=scratchDistanceDisplayCondition}else a.distanceDisplayCondition=void 0;defined(e.heightOffset)&&(a.heightOffset=e.heightOffset.evaluate(a)),defined(e.anchorLineEnabled)&&(a.anchorLineEnabled=e.anchorLineEnabled.evaluate(a)),defined(e.anchorLineColor)&&(a.anchorLineColor=e.anchorLineColor.evaluateColor(a,scratchColor6)),defined(e.image)?a.image=e.image.evaluate(a):a.image=void 0,defined(e.disableDepthTestDistance)&&(a.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(a)),defined(e.horizontalOrigin)&&(a.horizontalOrigin=e.horizontalOrigin.evaluate(a)),defined(e.verticalOrigin)&&(a.verticalOrigin=e.verticalOrigin.evaluate(a)),defined(e.labelHorizontalOrigin)&&(a.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(a)),defined(e.labelVerticalOrigin)&&(a.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(a))}else clearStyle$1(this,t)},Vector3DTilePoints.prototype.update=function(e){createPoints(this,e.mapProjection.ellipsoid),this._ready&&(this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e),this._resolvedPromise||(this._readyPromise.resolve(),this._resolvedPromise=!0))},Vector3DTilePoints.prototype.isDestroyed=function(){return!1},Vector3DTilePoints.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(),destroyObject(this)},defineProperties$1(Vector3DTilePolygons.prototype,{trianglesLength:{get:function(){return defined(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return defined(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor$2=new TaskProcessor("createVectorTilePolygons"),scratchColor$i=new Color;function createPrimitive$2(r){if(!defined(r._primitive)){if(!defined(r._verticesPromise)){var e=r._positions,t=r._counts,i=r._indexCounts,n=r._indices,a=r._transferrableBatchIds,o=r._batchTableColors,s=r._packedBuffer;if(!defined(o)){e=r._positions=arraySlice(r._positions),t=r._counts=arraySlice(r._counts),i=r._indexCounts=arraySlice(r._indexCounts),n=r._indices=arraySlice(r._indices),r._center=r._ellipsoid.cartographicToCartesian(Rectangle.center(r._rectangle)),a=r._transferrableBatchIds=new Uint32Array(r._batchIds),o=r._batchTableColors=new Uint32Array(a.length);for(var l=r._batchTable,c=o.length,u=0;u<c;++u){var d=l.getColor(u,scratchColor$i);o[u]=d.toRgba()}s=r._packedBuffer=packBuffer$2(r)}var h=[e.buffer,t.buffer,i.buffer,n.buffer,a.buffer,o.buffer,s.buffer],p={packedBuffer:s.buffer,positions:e.buffer,counts:t.buffer,indexCounts:i.buffer,indices:n.buffer,batchIds:a.buffer,batchTableColors:o.buffer},m=r._polygonMinimumHeights,f=r._polygonMaximumHeights;defined(m)&&defined(f)&&(m=arraySlice(m),f=arraySlice(f),h.push(m.buffer,f.buffer),p.minimumHeights=m,p.maximumHeights=f);var g=r._verticesPromise=createVerticesTaskProcessor$2.scheduleTask(p,h);if(!defined(g))return;when(g,function(e){r._positions=void 0,r._counts=void 0,r._polygonMinimumHeights=void 0,r._polygonMaximumHeights=void 0;var t=new Float64Array(e.packedBuffer),i=t[0];unpackBuffer$1(r,t),r._indices=2===IndexDatatype$1.getSizeInBytes(i)?new Uint16Array(e.indices):new Uint32Array(e.indices),r._indexOffsets=new Uint32Array(e.indexOffsets),r._indexCounts=new Uint32Array(e.indexCounts),r._batchedPositions=new Float32Array(e.positions),r._vertexBatchIds=new Uint16Array(e.batchIds),r._ready=!0})}r._ready&&!defined(r._primitive)&&(r._primitive=new Vector3DTilePrimitive({batchTable:r._batchTable,positions:r._batchedPositions,batchIds:r._batchIds,vertexBatchIds:r._vertexBatchIds,indices:r._indices,indexOffsets:r._indexOffsets,indexCounts:r._indexCounts,batchedIndices:r._batchedIndices,boundingVolume:r._boundingVolume,boundingVolumes:r._boundingVolumes,center:r._center}),r._batchTable=void 0,r._batchIds=void 0,r._positions=void 0,r._counts=void 0,r._indices=void 0,r._indexCounts=void 0,r._indexOffsets=void 0,r._batchTableColors=void 0,r._packedBuffer=void 0,r._batchedPositions=void 0,r._transferrableBatchIds=void 0,r._vertexBatchIds=void 0,r._ellipsoid=void 0,r._minimumHeight=void 0,r._maximumHeight=void 0,r._polygonMinimumHeights=void 0,r._polygonMaximumHeights=void 0,r._center=void 0,r._rectangle=void 0,r._boundingVolume=void 0,r._boundingVolumes=void 0,r._batchedIndices=void 0,r._verticesPromise=void 0,r._readyPromise.resolve())}}Vector3DTilePolygons.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},Vector3DTilePolygons.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},Vector3DTilePolygons.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},Vector3DTilePolygons.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},Vector3DTilePolygons.prototype.update=function(e){createPrimitive$2(this),this._ready&&(this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e))},Vector3DTilePolygons.prototype.isDestroyed=function(){return!1},Vector3DTilePolygons.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var Vector3DTilePolylinesVS="attribute vec4 currentPosition;\nattribute vec4 previousPosition;\nattribute vec4 nextPosition;\nattribute vec2 expandAndWidth;\nattribute float a_batchId;\nuniform mat4 u_modifiedModelView;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = u_modifiedModelView * currentPosition;\nvec4 prev = u_modifiedModelView * previousPosition;\nvec4 next = u_modifiedModelView * nextPosition;\nfloat angle;\nvec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);\ngl_Position = czm_viewportOrthographic * positionWC;\n#ifdef LOG_DEPTH\nczm_vertexLogDepth(czm_projection * p);\n#endif\n}\n";function Vector3DTilePolylines(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.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._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=Color.clone(Color.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._readyPromise=when.defer(),this._verticesPromise=void 0}function packBuffer$3(e){var t=e._rectangle,i=e._minimumHeight,r=e._maximumHeight,n=e._ellipsoid,a=e._center,o=2+Rectangle.packedLength+Ellipsoid.packedLength+Cartesian3.packedLength,s=new Float64Array(o),l=0;return s[l++]=i,s[l++]=r,Rectangle.pack(t,s,l),l+=Rectangle.packedLength,Ellipsoid.pack(n,s,l),l+=Ellipsoid.packedLength,Cartesian3.pack(a,s,l),s}defineProperties$1(Vector3DTilePolylines.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise.promise}}});var createVerticesTaskProcessor$3=new TaskProcessor("createVectorTilePolylines"),attributeLocations$3={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function createVertexArray$4(i,e){if(!defined(i._va)){if(!defined(i._verticesPromise)){var t=i._positions,r=i._widths,n=i._counts,a=i._transferrableBatchIds,o=i._packedBuffer;defined(o)||(t=i._positions=arraySlice(t),r=i._widths=arraySlice(r),n=i._counts=arraySlice(n),a=i._transferrableBatchIds=arraySlice(i._batchIds),o=i._packedBuffer=packBuffer$3(i));var s=[t.buffer,r.buffer,n.buffer,a.buffer,o.buffer],l={positions:t.buffer,widths:r.buffer,counts:n.buffer,batchIds:a.buffer,packedBuffer:o.buffer},c=i._verticesPromise=createVerticesTaskProcessor$3.scheduleTask(l,s);if(!defined(c))return;when(c,function(e){i._currentPositions=new Float32Array(e.currentPositions),i._previousPositions=new Float32Array(e.previousPositions),i._nextPositions=new Float32Array(e.nextPositions),i._expandAndWidth=new Float32Array(e.expandAndWidth),i._vertexBatchIds=new Uint16Array(e.batchIds);var t=e.indexDatatype;i._indices=t===IndexDatatype$1.UNSIGNED_SHORT?new Uint16Array(e.indices):new Uint32Array(e.indices),i._ready=!0})}if(i._ready&&!defined(i._va)){var u=i._currentPositions,d=i._previousPositions,h=i._nextPositions,p=i._expandAndWidth,m=i._vertexBatchIds,f=i._indices,g=d.byteLength+u.byteLength+h.byteLength;g+=p.byteLength+m.byteLength+f.byteLength,i._trianglesLength=f.length/3,i._geometryByteLength=g;var _=Buffer$1.createVertexBuffer({context:e,typedArray:d,usage:BufferUsage$1.STATIC_DRAW}),y=Buffer$1.createVertexBuffer({context:e,typedArray:u,usage:BufferUsage$1.STATIC_DRAW}),v=Buffer$1.createVertexBuffer({context:e,typedArray:h,usage:BufferUsage$1.STATIC_DRAW}),C=Buffer$1.createVertexBuffer({context:e,typedArray:p,usage:BufferUsage$1.STATIC_DRAW}),S=Buffer$1.createVertexBuffer({context:e,typedArray:m,usage:BufferUsage$1.STATIC_DRAW}),x=Buffer$1.createIndexBuffer({context:e,typedArray:f,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:2===f.BYTES_PER_ELEMENT?IndexDatatype$1.UNSIGNED_SHORT:IndexDatatype$1.UNSIGNED_INT}),T=[{index:attributeLocations$3.previousPosition,vertexBuffer:_,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.currentPosition,vertexBuffer:y,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.nextPosition,vertexBuffer:v,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3},{index:attributeLocations$3.expandAndWidth,vertexBuffer:C,componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:2},{index:attributeLocations$3.a_batchId,vertexBuffer:S,componentDatatype:ComponentDatatype$1.UNSIGNED_SHORT,componentsPerAttribute:1}];i._va=new VertexArray({context:e,attributes:T,indexBuffer:x}),i._positions=void 0,i._widths=void 0,i._counts=void 0,i._ellipsoid=void 0,i._minimumHeight=void 0,i._maximumHeight=void 0,i._rectangle=void 0,i._transferrableBatchIds=void 0,i._packedBuffer=void 0,i._currentPositions=void 0,i._previousPositions=void 0,i._nextPositions=void 0,i._expandAndWidth=void 0,i._vertexBatchIds=void 0,i._indices=void 0,i._readyPromise.resolve()}}}var modifiedModelViewScratch$2=new Matrix4,rtcScratch$2=new Cartesian3;function createUniformMap$4(t,i){defined(t._uniformMap)||(t._uniformMap={u_modifiedModelView:function(){var e=i.uniformState.view;return Matrix4.clone(e,modifiedModelViewScratch$2),Matrix4.multiplyByPoint(modifiedModelViewScratch$2,t._center,rtcScratch$2),Matrix4.setTranslation(modifiedModelViewScratch$2,rtcScratch$2,modifiedModelViewScratch$2),modifiedModelViewScratch$2},u_highlightColor:function(){return t._highlightColor}})}function createRenderStates$4(e){if(!defined(e._rs)){e._rs=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:{enabled:!0,factor:-5,units:-5}})}}var PolylineFS$1="uniform vec4 u_highlightColor; \nvoid main()\n{\n    gl_FragColor = u_highlightColor;\n}\n";function createShaders$2(e,t){if(!defined(e._sp)){var i=e._batchTable,r=i.getVertexShaderCallback(!1,"a_batchId",void 0)(Vector3DTilePolylinesVS),n=i.getFragmentShaderCallback()(PolylineFS$1,!1,void 0),a=new ShaderSource({defines:["VECTOR_TILE",FeatureDetection.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[PolylineCommon,r]}),o=new ShaderSource({defines:["VECTOR_TILE"],sources:[n]});e._sp=ShaderProgram.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:attributeLocations$3})}}function queueCommands$1(e,t){if(!defined(e._command)){var i=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new DrawCommand({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:i,boundingVolume:e._boundingVolume,pass:Pass$1.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}function clearStyle$2(e,t){for(var i=e._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.show=!0,a.color=Color.WHITE}}Vector3DTilePolylines.prototype.createFeatures=function(e,t){for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=i[n];t[a]=new Cesium3DTileFeature(e,a)}},Vector3DTilePolylines.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};var scratchColor$j=new Color,DEFAULT_COLOR_VALUE$2=Color.WHITE,DEFAULT_SHOW_VALUE$2=!0;function Vector3DTileContent(e,t,i,r,n){this._tileset=e,this._tile=t,this._resource=i,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._contentReadyPromise=void 0,this._readyPromise=when.defer(),this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,initialize$8(this,r,n)}function createColorChangedCallback$2(i){return function(e,t){defined(i._polygons)&&i._polygons.updateCommands(e,t)}}function getBatchIds$1(e,t){var i,r,n,a,o=defaultValue(e.POLYGONS_LENGTH,0),s=defaultValue(e.POLYLINES_LENGTH,0),l=defaultValue(e.POINTS_LENGTH,0);if(0<o&&defined(e.POLYGON_BATCH_IDS)){var c=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,c,o)}if(0<s&&defined(e.POLYLINE_BATCH_IDS)){var u=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,u,s)}if(0<l&&defined(e.POINT_BATCH_IDS)){var d=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,d,l)}var h=defined(i)||defined(r)||defined(n),p=0<o&&!defined(i)||0<s&&!defined(r)||0<l&&!defined(n);if(h&&p)throw new RuntimeError("If one group of batch ids is defined, then all batch ids must be defined.");if(!defined(i)&&!defined(r)&&!defined(n)){var m=0;if(!defined(i)&&0<o)for(i=new Uint16Array(o),a=0;a<o;++a)i[a]=m++;if(!defined(r)&&0<s)for(r=new Uint16Array(s),a=0;a<s;++a)r[a]=m++;if(!defined(n)&&0<l)for(n=new Uint16Array(l),a=0;a<l;++a)n[a]=m++}return{polygons:i,polylines:r,points:n}}Vector3DTilePolylines.prototype.applyStyle=function(e,t){if(defined(e))for(var i=this._batchIds,r=i.length,n=0;n<r;++n){var a=t[i[n]];a.color=defined(e.color)?e.color.evaluateColor(a,scratchColor$j):DEFAULT_COLOR_VALUE$2,a.show=defined(e.show)?e.show.evaluate(a):DEFAULT_SHOW_VALUE$2}else clearStyle$2(this,t)},Vector3DTilePolylines.prototype.update=function(e){var t=e.context;if(createVertexArray$4(this,t),createUniformMap$4(this,t),createShaders$2(this,t),createRenderStates$4(this),this._ready){var i=e.passes;(i.render||i.pick)&&queueCommands$1(this,e)}},Vector3DTilePolylines.prototype.isDestroyed=function(){return!1},Vector3DTilePolylines.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),destroyObject(this)},defineProperties$1(Vector3DTileContent.prototype,{featuresLength:{get:function(){return defined(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return defined(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){var e=0;return defined(this._polygons)&&(e+=this._polygons.trianglesLength),defined(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){var e=0;return defined(this._polygons)&&(e+=this._polygons.geometryByteLength),defined(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return defined(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return defined(this._batchTable)?this._batchTable.memorySizeInBytes:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise.promise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){return this._batchTable}}});var sizeOfUint16$1=Uint16Array.BYTES_PER_ELEMENT,sizeOfUint32$8=Uint32Array.BYTES_PER_ELEMENT;function initialize$8(e,t,i){i=defaultValue(i,0);var r=new Uint8Array(t),n=new DataView(t);i+=sizeOfUint32$8;var a=n.getUint32(i,!0);if(1!==a)throw new RuntimeError("Only Vector tile version 1 is supported.  Version "+a+" is not.");i+=sizeOfUint32$8;var o=n.getUint32(i,!0);if(i+=sizeOfUint32$8,0!==o){var s=n.getUint32(i,!0);if(i+=sizeOfUint32$8,0===s)throw new RuntimeError("Feature table must have a byte length greater than zero");var l=n.getUint32(i,!0);i+=sizeOfUint32$8;var c=n.getUint32(i,!0);i+=sizeOfUint32$8;var u=n.getUint32(i,!0);i+=sizeOfUint32$8;var d=n.getUint32(i,!0);i+=sizeOfUint32$8;var h=n.getUint32(i,!0);i+=sizeOfUint32$8;var p=n.getUint32(i,!0);i+=sizeOfUint32$8;var m=n.getUint32(i,!0),f=getStringFromTypedArray(r,i+=sizeOfUint32$8,s),g=JSON.parse(f);i+=s;var _,y,v=new Uint8Array(t,i,l);if(i+=l,0<c){var C=getStringFromTypedArray(r,i,c);_=JSON.parse(C),i+=c,0<u&&(y=new Uint8Array(t,i,u),y=new Uint8Array(y),i+=u)}var S=defaultValue(g.POLYGONS_LENGTH,0),x=defaultValue(g.POLYLINES_LENGTH,0),T=defaultValue(g.POINTS_LENGTH,0),b=S+x+T,E=new Cesium3DTileBatchTable(e,b,_,y,createColorChangedCallback$2(e));if(e._batchTable=E,0!==b){var P,A,w;if(!defined(g.REGION))throw new RuntimeError("REGION is required in the feature table.");var D=g.REGION;P=Rectangle.unpack(D),A=D[4],w=D[5];var M,I=e._tile.computedTransform;defined(g.RTC_CENTER)?(M=Cartesian3.unpack(g.RTC_CENTER),Matrix4.multiplyByPoint(I,M,M)):((M=Rectangle.center(P)).height=CesiumMath.lerp(A,w,.5),M=Ellipsoid.WGS84.cartographicToCartesian(M));var R=getBatchIds$1(g,v);if(i+=i%4,0<S){var O=new Uint32Array(t,i,d/sizeOfUint32$8);i+=d;var L=new Uint16Array(t,i,h/sizeOfUint16$1);i+=h;var F,N,B=v.byteOffset+g.POLYGON_COUNT.byteOffset,V=new Uint32Array(v.buffer,B,S),k=v.byteOffset+g.POLYGON_INDEX_COUNT.byteOffset,$=new Uint32Array(v.buffer,k,S);if(defined(g.POLYGON_MINIMUM_HEIGHTS)&&defined(g.POLYGON_MAXIMUM_HEIGHTS)){var z=v.byteOffset+g.POLYGON_MINIMUM_HEIGHTS.byteOffset;F=new Float32Array(v.buffer,z,S);var U=v.byteOffset+g.POLYGON_MAXIMUM_HEIGHTS.byteOffset;N=new Float32Array(v.buffer,U,S)}e._polygons=new Vector3DTilePolygons({positions:L,counts:V,indexCounts:$,indices:O,minimumHeight:A,maximumHeight:w,polygonMinimumHeights:F,polygonMaximumHeights:N,center:M,rectangle:P,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:E,batchIds:R.polygons,modelMatrix:I})}if(0<x){var G=new Uint16Array(t,i,p/sizeOfUint16$1);i+=p;var H,W=v.byteOffset+g.POLYLINE_COUNT.byteOffset,q=new Uint32Array(v.buffer,W,x);if(defined(g.POLYLINE_WIDTHS)){var j=v.byteOffset+g.POLYLINE_WIDTHS.byteOffset;H=new Uint16Array(v.buffer,j,x)}else{H=new Uint16Array(x);for(var Y=0;Y<x;++Y)H[Y]=2}e._polylines=new Vector3DTilePolylines({positions:G,widths:H,counts:q,batchIds:R.polylines,minimumHeight:A,maximumHeight:w,center:M,rectangle:P,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:E})}if(0<T){var X=new Uint16Array(t,i,m/sizeOfUint16$1);e._points=new Vector3DTilePoints({positions:X,batchIds:R.points,minimumHeight:A,maximumHeight:w,rectangle:P,batchTable:E})}}}else e._readyPromise.resolve(e)}function createFeatures$4(e){var t=e.featuresLength;if(!defined(e._features)&&0<t){var i=new Array(t);defined(e._polygons)&&e._polygons.createFeatures(e,i),defined(e._polylines)&&e._polylines.createFeatures(e,i),defined(e._points)&&e._points.createFeatures(e,i),e._features=i}}Vector3DTileContent.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Vector3DTileContent.prototype.getFeature=function(e){return createFeatures$4(this),this._features[e]},Vector3DTileContent.prototype.applyDebugSettings=function(e,t){defined(this._polygons)&&this._polygons.applyDebugSettings(e,t),defined(this._polylines)&&this._polylines.applyDebugSettings(e,t),defined(this._points)&&this._points.applyDebugSettings(e,t)},Vector3DTileContent.prototype.applyStyle=function(e){createFeatures$4(this),defined(this._polygons)&&this._polygons.applyStyle(e,this._features),defined(this._polylines)&&this._polylines.applyStyle(e,this._features),defined(this._points)&&this._points.applyStyle(e,this._features)},Vector3DTileContent.prototype.update=function(e,t){var i=!0;if(defined(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),i=i&&this._polygons._ready),defined(this._polylines)&&(this._polylines.update(t),i=i&&this._polylines._ready),defined(this._points)&&(this._points.update(t),i=i&&this._points._ready),defined(this._batchTable)&&i&&this._batchTable.update(e,t),!defined(this._contentReadyPromise)){var r=defined(this._points)?this._points.readyPromise:void 0,n=defined(this._polygons)?this._polygons.readyPromise:void 0,a=defined(this._polylines)?this._polylines.readyPromise:void 0,o=this;this._contentReadyPromise=when.all([r,n,a]).then(function(){o._readyPromise.resolve(o)})}},Vector3DTileContent.prototype.isDestroyed=function(){return!1},Vector3DTileContent.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(),destroyObject(this)};var Cesium3DTileContentFactory={b3dm:function(e,t,i,r,n){return new Batched3DModel3DTileContent(e,t,i,r,n)},pnts:function(e,t,i,r,n){return new PointCloud3DTileContent(e,t,i,r,n)},i3dm:function(e,t,i,r,n){return new Instanced3DModel3DTileContent(e,t,i,r,n)},cmpt:function(e,t,i,r,n){return new Composite3DTileContent(e,t,i,r,n,Cesium3DTileContentFactory)},json:function(e,t,i,r,n){return new Tileset3DTileContent(e,t,i,r,n)},geom:function(e,t,i,r,n){return new Geometry3DTileContent(e,t,i,r,n)},vctr:function(e,t,i,r,n){return new Vector3DTileContent(e,t,i,r,n)}},Cesium3DTileContentState={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Cesium3DTileContentState$1=freezeObject$1(Cesium3DTileContentState),Cesium3DTileOptimizationHint={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},Cesium3DTileOptimizationHint$1=freezeObject$1(Cesium3DTileOptimizationHint);function Cesium3DTilesetMostDetailedTraversal(){}var traversal={stack:new ManagedArray,stackMaximumLength:0};function isVisible(e){return e._visible&&e._inRequestVolume}function hasEmptyContent(e){return e.hasEmptyContent||e.hasTilesetContent}function hasUnloadedContent(e){return!hasEmptyContent(e)&&e.contentUnloaded}function canTraverse(e,t){return 0!==t.children.length&&(t.hasTilesetContent?!t.contentExpired:(t.hasEmptyContent,!0))}function updateAndPushChildren(e,t,i,r){for(var n=t.children,a=n.length,o=0;o<a;++o){var s=n[o];s.updateVisibility(r),isVisible(s)&&i.push(s)}}function loadTile(e,t){(hasUnloadedContent(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function touchTile(e,t,i){t._touchedFrame!==i.frameNumber&&(e._cache.touch(t),t._touchedFrame=i.frameNumber)}function visitTile(e){++e.statistics.visited}function selectDesiredTile(e,t,i){t.contentAvailable&&t.contentVisibility(i)!==Intersect$1.OUTSIDE&&e._selectedTiles.push(t)}function Cesium3DTilesetTraversal(){}function isVisible$1(e){return e._visible&&e._inRequestVolume}Cesium3DTilesetMostDetailedTraversal.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0;var i=!(e._hasMixedContent=!1),r=e.root;if(r.updateVisibility(t),!isVisible(r))return i;var n=traversal.stack;for(n.push(e.root);0<n.length;){traversal.stackMaximumLength=Math.max(traversal.stackMaximumLength,n.length);var a=n.pop(),o=a.refine===Cesium3DTileRefine$1.ADD,s=a.refine===Cesium3DTileRefine$1.REPLACE,l=canTraverse(e,a);l&&updateAndPushChildren(e,a,n,t),(o||s&&!l)&&(loadTile(e,a),touchTile(e,a,t),selectDesiredTile(e,a,t),hasEmptyContent(a)||a.contentAvailable||(i=!1)),visitTile(e)}return traversal.stack.trim(traversal.stackMaximumLength),i};var traversal$1={stack:new ManagedArray,stackMaximumLength:0},emptyTraversal={stack:new ManagedArray,stackMaximumLength:0},descendantTraversal={stack:new ManagedArray,stackMaximumLength:0},selectionTraversal={stack:new ManagedArray,stackMaximumLength:0,ancestorStack:new ManagedArray,ancestorStackMaximumLength:0},descendantSelectionDepth=2;function executeBaseTraversal(e,t,i){executeTraversal(e,t,e._maximumScreenSpaceError,e._maximumScreenSpaceError,i)}function executeSkipTraversal(e,t,i){executeTraversal(e,t,Number.MAX_VALUE,e._maximumScreenSpaceError,i),traverseAndSelect(e,t,i)}function executeBaseAndSkipTraversal(e,t,i){executeTraversal(e,t,Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),e.maximumScreenSpaceError,i),traverseAndSelect(e,t,i)}function skipLevelOfDetail(e){return e._skipLevelOfDetail}function addEmptyTile(e,t){e._emptyTiles.push(t)}function selectTile(e,t,i){if(t.contentVisibility(i)!==Intersect$1.OUTSIDE){var r=t.content;r.featurePropertiesDirty?(r.featurePropertiesDirty=!1,t.lastStyleTime=0,e._selectedTilesToStyle.push(t)):t._selectedFrame<i.frameNumber-1&&e._selectedTilesToStyle.push(t),t._selectedFrame=i.frameNumber,e._selectedTiles.push(t)}}function selectDescendants(e,t,i){var r=descendantTraversal.stack;for(r.push(t);0<r.length;){descendantTraversal.stackMaximumLength=Math.max(descendantTraversal.stackMaximumLength,r.length);for(var n=r.pop().children,a=n.length,o=0;o<a;++o){var s=n[o];isVisible$1(s)&&(s.contentAvailable?(updateTile(e,s,i),touchTile$1(e,s,i),selectTile(e,s,i)):s._depth-t._depth<descendantSelectionDepth&&r.push(s))}}}function selectDesiredTile$1(e,t,i){if(skipLevelOfDetail(e)){var r=t.contentAvailable?t:t._ancestorWithContentAvailable;defined(r)?r._shouldSelect=!0:selectDescendants(e,t,i)}else t.contentAvailable&&selectTile(e,t,i)}function visitTile$1(e,t,i){++e._statistics.visited,t._visitedFrame=i.frameNumber}function touchTile$1(e,t,i){t._touchedFrame!==i.frameNumber&&(e._cache.touch(t),t._touchedFrame=i.frameNumber)}function updateMinimumMaximumPriority(e,t){e._maximumPriority.distance=Math.max(t._priorityHolder._distanceToCamera,e._maximumPriority.distance),e._minimumPriority.distance=Math.min(t._priorityHolder._distanceToCamera,e._minimumPriority.distance),e._maximumPriority.depth=Math.max(t._depth,e._maximumPriority.depth),e._minimumPriority.depth=Math.min(t._depth,e._minimumPriority.depth),e._maximumPriority.foveatedFactor=Math.max(t._priorityHolder._foveatedFactor,e._maximumPriority.foveatedFactor),e._minimumPriority.foveatedFactor=Math.min(t._priorityHolder._foveatedFactor,e._minimumPriority.foveatedFactor),e._maximumPriority.reverseScreenSpaceError=Math.max(t._priorityReverseScreenSpaceError,e._maximumPriority.reverseScreenSpaceError),e._minimumPriority.reverseScreenSpaceError=Math.min(t._priorityReverseScreenSpaceError,e._minimumPriority.reverseScreenSpaceError)}function isOnScreenLongEnough(e,t,i){if(!e.cullRequestsWhileMoving)return!0;var r=t.boundingSphere,n=Math.max(2*r.radius,1),a=i.camera,o=0!==a.positionWCDeltaMagnitude?a.positionWCDeltaMagnitude:a.positionWCDeltaMagnitudeLastFrame;return e.cullRequestsWhileMovingMultiplier*o/n<1}function loadTile$1(e,t,i){if(t._requestedFrame!==i.frameNumber&&(hasUnloadedContent$1(t)||t.contentExpired)&&isOnScreenLongEnough(e,t,i)){var r=i.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&r||(t._requestedFrame=i.frameNumber,e._requestedTiles.push(t))}}function updateVisibility(e,t,i){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(i),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function anyChildrenVisible(e,t,i){for(var r=!1,n=t.children,a=n.length,o=0;o<a;++o){var s=n[o];updateVisibility(e,s,i),r=r||isVisible$1(s)}return r}function meetsScreenSpaceErrorEarly(e,t,i){var r=t.parent;return!(!defined(r)||r.hasTilesetContent||r.refine!==Cesium3DTileRefine$1.ADD)&&t.getScreenSpaceError(i,!0)<=e._maximumScreenSpaceError}function updateTileVisibility(e,t,i){if(updateVisibility(e,t,i),isVisible$1(t)){var r=0<t.children.length;if(t.hasTilesetContent&&r){var n=t.children[0];return updateTileVisibility(e,n,i),void(t._visible=n._visible)}if(!meetsScreenSpaceErrorEarly(e,t,i)){var a=t.refine===Cesium3DTileRefine$1.REPLACE,o=t._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;return a&&o&&r&&!anyChildrenVisible(e,t,i)?(++e._statistics.numberOfTilesCulledWithChildrenUnion,void(t._visible=!1)):void 0}t._visible=!1}}function updateTile(e,t,i){updateTileVisibility(e,t,i),t.updateExpiration(),t._wasMinPriorityChild=!1,updateMinimumMaximumPriority(e,t._priorityHolder=t),t._shouldSelect=!1,t._finalResolution=!0}function updateTileAncestorContentLinks(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;var i=e.parent;if(defined(i)){var r=!hasUnloadedContent$1(i)||i._requestedFrame===t.frameNumber;e._ancestorWithContent=r?i:i._ancestorWithContent,e._ancestorWithContentAvailable=i.contentAvailable?i:i._ancestorWithContentAvailable}}function hasEmptyContent$1(e){return e.hasEmptyContent||e.hasTilesetContent}function hasUnloadedContent$1(e){return!hasEmptyContent$1(e)&&e.contentUnloaded}function reachedSkippingThreshold(e,t){var i=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||defined(i)&&t._screenSpaceError<i._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>i._depth+e.skipLevels)}function sortChildrenByDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function updateAndPushChildren$1(e,t,i,r){var n,a=t.refine===Cesium3DTileRefine$1.REPLACE,o=t.children,s=o.length;for(n=0;n<s;++n)updateTile(e,o[n],r);o.sort(sortChildrenByDistanceToCamera);var l,c=!skipLevelOfDetail(e)&&a&&!hasEmptyContent$1(t),u=!0,d=!1,h=-1,p=Number.MAX_VALUE;for(n=0;n<s;++n){var m;if(isVisible$1(l=o[n])?(i.push(l),l._foveatedFactor<p&&(h=n,p=l._foveatedFactor),d=!0):(c||e.loadSiblings)&&(l._foveatedFactor<p&&(h=n,p=l._foveatedFactor),loadTile$1(e,l,r),touchTile$1(e,l,r)),c)m=!!l._inRequestVolume&&(hasEmptyContent$1(l)?executeEmptyTraversal(e,l,r):l.contentAvailable),u=u&&m}if(d||(u=!1),-1!==h&&!skipLevelOfDetail(e)&&a){var f=o[h];f._wasMinPriorityChild=!0;var g=(t._wasMinPriorityChild||t===e.root)&&p<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(g._foveatedFactor=Math.min(f._foveatedFactor,g._foveatedFactor),g._distanceToCamera=Math.min(f._distanceToCamera,g._distanceToCamera),n=0;n<s;++n)(l=o[n])._priorityHolder=g}return u}function inBaseTraversal(e,t,i){return!skipLevelOfDetail(e)||!e.immediatelyLoadDesiredLevelOfDetail&&(!defined(t._ancestorWithContent)||(0===t._screenSpaceError?t.parent._screenSpaceError>i:t._screenSpaceError>i))}function canTraverse$1(e,t){return 0!==t.children.length&&(t.hasTilesetContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError)}function executeTraversal(e,t,i,r,n){var a=traversal$1.stack;for(a.push(t);0<a.length;){traversal$1.stackMaximumLength=Math.max(traversal$1.stackMaximumLength,a.length);var o=a.pop();updateTileAncestorContentLinks(o,n);var s=inBaseTraversal(e,o,i),l=o.refine===Cesium3DTileRefine$1.ADD,c=o.refine===Cesium3DTileRefine$1.REPLACE,u=o.parent,d=!defined(u)||u._refines,h=!1;canTraverse$1(e,o)&&(h=updateAndPushChildren$1(e,o,a,n)&&d);var p=!h&&d;hasEmptyContent$1(o)?(addEmptyTile(e,o),loadTile$1(e,o,n),p&&selectDesiredTile$1(e,o,n)):l?(selectDesiredTile$1(e,o,n),loadTile$1(e,o,n)):c&&(s?(loadTile$1(e,o,n),p&&selectDesiredTile$1(e,o,n)):p?(selectDesiredTile$1(e,o,n),loadTile$1(e,o,n)):reachedSkippingThreshold(e,o)&&loadTile$1(e,o,n)),visitTile$1(e,o,n),touchTile$1(e,o,n),o._refines=h}}function executeEmptyTraversal(e,t,i){var r=!0,n=emptyTraversal.stack;for(n.push(t);0<n.length;){emptyTraversal.stackMaximumLength=Math.max(emptyTraversal.stackMaximumLength,n.length);var a=n.pop(),o=a.children,s=o.length,l=hasEmptyContent$1(a)&&canTraverse$1(e,a);if(l||a.contentAvailable||(r=!1),updateTile(e,a,i),isVisible$1(a)||(loadTile$1(e,a,i),touchTile$1(e,a,i)),l)for(var c=0;c<s;++c){var u=o[c];n.push(u)}}return r}function traverseAndSelect(e,t,i){var r,n=selectionTraversal.stack,a=selectionTraversal.ancestorStack;for(n.push(t);0<n.length||0<a.length;){if(selectionTraversal.stackMaximumLength=Math.max(selectionTraversal.stackMaximumLength,n.length),selectionTraversal.ancestorStackMaximumLength=Math.max(selectionTraversal.ancestorStackMaximumLength,a.length),0<a.length){var o=a.peek();if(o._stackLength===n.length){a.pop(),o!==r&&(o._finalResolution=!1),selectTile(e,o,i);continue}}var s=n.pop();if(defined(s)){var l=s.refine===Cesium3DTileRefine$1.ADD,c=s._shouldSelect,u=s.children,d=u.length,h=canTraverse$1(e,s);if(c)if(l)selectTile(e,s,i);else{if(s._selectionDepth=a.length,0<s._selectionDepth&&(e._hasMixedContent=!0),r=s,!h){selectTile(e,s,i);continue}a.push(s),s._stackLength=n.length}if(h)for(var p=0;p<d;++p){var m=u[p];isVisible$1(m)&&n.push(m)}}}}Cesium3DTilesetTraversal.selectTiles=function(e,t){if(e._requestedTiles.length=0,!e.debugFreezeFrame){e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e._hasMixedContent=!1;var i=e.root;if(updateTile(e,i,t),isVisible$1(i)&&!(i.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)){skipLevelOfDetail(e)?e.immediatelyLoadDesiredLevelOfDetail?executeSkipTraversal(e,i,t):executeBaseAndSkipTraversal(e,i,t):executeBaseTraversal(e,i,t),traversal$1.stack.trim(traversal$1.stackMaximumLength),emptyTraversal.stack.trim(emptyTraversal.stackMaximumLength),descendantTraversal.stack.trim(descendantTraversal.stackMaximumLength),selectionTraversal.stack.trim(selectionTraversal.stackMaximumLength),selectionTraversal.ancestorStack.trim(selectionTraversal.ancestorStackMaximumLength);for(var r=e._requestedTiles,n=r.length,a=0;a<n;++a)r[a].updatePriority()}}};var Cesium3DTilePass={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},passOptions=new Array(Cesium3DTilePass.NUMBER_OF_PASSES);passOptions[Cesium3DTilePass.RENDER]=freezeObject$1({traversal:Cesium3DTilesetTraversal,isRender:!0,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PICK]=freezeObject$1({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),passOptions[Cesium3DTilePass.SHADOW]=freezeObject$1({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!1}),passOptions[Cesium3DTilePass.PRELOAD]=freezeObject$1({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.PRELOAD_FLIGHT]=freezeObject$1({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.REQUEST_RENDER_MODE_DEFER_CHECK]=freezeObject$1({traversal:Cesium3DTilesetTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PRELOAD]=freezeObject$1({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!0,ignoreCommands:!0}),passOptions[Cesium3DTilePass.MOST_DETAILED_PICK]=freezeObject$1({traversal:Cesium3DTilesetMostDetailedTraversal,isRender:!1,requestTiles:!1,ignoreCommands:!1}),Cesium3DTilePass.getPassOptions=function(e){return passOptions[e]};var Cesium3DTilePass$1=freezeObject$1(Cesium3DTilePass);function Empty3DTileContent(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}function TileBoundingRegion(e){this.rectangle=Rectangle.clone(e.rectangle),this.minimumHeight=defaultValue(e.minimumHeight,0),this.maximumHeight=defaultValue(e.maximumHeight,0),this.southwestCornerCartesian=new Cartesian3,this.northeastCornerCartesian=new Cartesian3,this.westNormal=new Cartesian3,this.southNormal=new Cartesian3,this.eastNormal=new Cartesian3,this.northNormal=new Cartesian3;var t=defaultValue(e.ellipsoid,Ellipsoid.WGS84);computeBox(this,e.rectangle,t),defaultValue(e.computeBoundingVolumes,!0)&&(this._orientedBoundingBox=OrientedBoundingBox.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,t),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox))}defineProperties$1(Empty3DTileContent.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(){}},readyPromise:{get:function(){}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},batchTable:{get:function(){}}}),Empty3DTileContent.prototype.hasProperty=function(e,t){return!1},Empty3DTileContent.prototype.getFeature=function(e){},Empty3DTileContent.prototype.applyDebugSettings=function(e,t){},Empty3DTileContent.prototype.applyStyle=function(e){},Empty3DTileContent.prototype.update=function(e,t){},Empty3DTileContent.prototype.isDestroyed=function(){return!1},Empty3DTileContent.prototype.destroy=function(){return destroyObject(this)},defineProperties$1(TileBoundingRegion.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});var cartesian3Scratch$2=new Cartesian3,cartesian3Scratch2$1=new Cartesian3,cartesian3Scratch3$1=new Cartesian3,eastWestNormalScratch=new Cartesian3,westernMidpointScratch=new Cartesian3,easternMidpointScratch=new Cartesian3,cartographicScratch$2=new Cartographic,planeScratch=new Plane(Cartesian3.UNIT_X,0),rayScratch=new Ray;function computeBox(e,t,i){i.cartographicToCartesian(Rectangle.southwest(t),e.southwestCornerCartesian),i.cartographicToCartesian(Rectangle.northeast(t),e.northeastCornerCartesian),cartographicScratch$2.longitude=t.west,cartographicScratch$2.latitude=.5*(t.south+t.north),cartographicScratch$2.height=0;var r=i.cartographicToCartesian(cartographicScratch$2,westernMidpointScratch),n=Cartesian3.cross(r,Cartesian3.UNIT_Z,cartesian3Scratch$2);Cartesian3.normalize(n,e.westNormal),cartographicScratch$2.longitude=t.east;var a=i.cartographicToCartesian(cartographicScratch$2,easternMidpointScratch),o=Cartesian3.cross(Cartesian3.UNIT_Z,a,cartesian3Scratch$2);Cartesian3.normalize(o,e.eastNormal);var s,l=Cartesian3.subtract(r,a,cartesian3Scratch$2),c=Cartesian3.normalize(l,eastWestNormalScratch),u=t.south;if(0<u){cartographicScratch$2.longitude=.5*(t.west+t.east),cartographicScratch$2.latitude=u;var d=i.cartographicToCartesian(cartographicScratch$2,rayScratch.origin);Cartesian3.clone(c,rayScratch.direction);var h=Plane.fromPointNormal(e.southwestCornerCartesian,e.westNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,h,e.southwestCornerCartesian),s=i.geodeticSurfaceNormal(d,cartesian3Scratch2$1)}else s=i.geodeticSurfaceNormalCartographic(Rectangle.southeast(t),cartesian3Scratch2$1);var p=Cartesian3.cross(s,l,cartesian3Scratch3$1);Cartesian3.normalize(p,e.southNormal);var m,f=t.north;if(f<0){cartographicScratch$2.longitude=.5*(t.west+t.east),cartographicScratch$2.latitude=f;var g=i.cartographicToCartesian(cartographicScratch$2,rayScratch.origin);Cartesian3.negate(c,rayScratch.direction);var _=Plane.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,planeScratch);IntersectionTests.rayPlane(rayScratch,_,e.northeastCornerCartesian),m=i.geodeticSurfaceNormal(g,cartesian3Scratch2$1)}else m=i.geodeticSurfaceNormalCartographic(Rectangle.northwest(t),cartesian3Scratch2$1);var y=Cartesian3.cross(l,m,cartesian3Scratch3$1);Cartesian3.normalize(y,e.northNormal)}var southwestCornerScratch=new Cartesian3,northeastCornerScratch=new Cartesian3,negativeUnitY=new Cartesian3(0,-1,0),negativeUnitZ=new Cartesian3(0,0,-1),vectorScratch=new Cartesian3;function TileBoundingSphere(e,t){0===t&&(t=CesiumMath.EPSILON7),this._boundingSphere=new BoundingSphere(e,t)}TileBoundingRegion.prototype.distanceToCamera=function(e){var t,i,r,n=e.camera,a=n.positionWC,o=n.positionCartographic,s=0;if(!Rectangle.contains(this.rectangle,o)){var l=this.southwestCornerCartesian,c=this.northeastCornerCartesian,u=this.westNormal,d=this.southNormal,h=this.eastNormal,p=this.northNormal;e.mode!==SceneMode$1.SCENE3D&&((l=e.mapProjection.project(Rectangle.southwest(this.rectangle),southwestCornerScratch)).z=l.y,l.y=l.x,l.x=0,(c=e.mapProjection.project(Rectangle.northeast(this.rectangle),northeastCornerScratch)).z=c.y,c.y=c.x,c.x=0,u=negativeUnitY,h=Cartesian3.UNIT_Y,d=negativeUnitZ,p=Cartesian3.UNIT_Z);var m=Cartesian3.subtract(a,l,vectorScratch),f=Cartesian3.dot(m,u),g=Cartesian3.dot(m,d),_=Cartesian3.subtract(a,c,vectorScratch),y=Cartesian3.dot(_,h),v=Cartesian3.dot(_,p);0<f?s+=f*f:0<y&&(s+=y*y),0<g?s+=g*g:0<v&&(s+=v*v)}if((r=e.mode===SceneMode$1.SCENE3D?(t=o.height,i=this.minimumHeight,this.maximumHeight):(t=a.x,i=0))<t){var C=t-r;s+=C*C}else if(t<i){var S=i-t;s+=S*S}return Math.sqrt(s)},TileBoundingRegion.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileBoundingRegion.prototype.createDebugVolume=function(e){var t=new Matrix4.clone(Matrix4.IDENTITY);return new Primitive({geometryInstances:new GeometryInstance({geometry:new RectangleOutlineGeometry({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),id:"outline",modelMatrix:t,attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},defineProperties$1(TileBoundingSphere.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}}}),TileBoundingSphere.prototype.distanceToCamera=function(e){var t=this._boundingSphere;return Math.max(0,Cartesian3.distance(t.center,e.camera.positionWC)-t.radius)},TileBoundingSphere.prototype.intersectPlane=function(e){return BoundingSphere.intersectPlane(this._boundingSphere,e)},TileBoundingSphere.prototype.update=function(e,t){Cartesian3.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t},TileBoundingSphere.prototype.createDebugVolume=function(e){return new Primitive({geometryInstances:new GeometryInstance({geometry:new SphereOutlineGeometry({radius:this.radius}),id:"outline",modelMatrix:Matrix4.fromTranslation(this.center,new Matrix4.clone(Matrix4.IDENTITY)),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})};var scratchU=new Cartesian3,scratchV=new Cartesian3,scratchW$1=new Cartesian3,scratchCartesian$6=new Cartesian3;function computeMissingVector(e,t,i){i=Cartesian3.cross(e,t,i);var r=Cartesian3.magnitude(i);return Cartesian3.multiplyByScalar(i,CesiumMath.EPSILON7/r,i)}function findOrthogonalVector(e,t){var i=Cartesian3.normalize(e,scratchCartesian$6);return computeMissingVector(e,Cartesian3.equalsEpsilon(i,Cartesian3.UNIT_X,CesiumMath.EPSILON6)?Cartesian3.UNIT_Y:Cartesian3.UNIT_X,t)}function checkHalfAxes(e){var t=Matrix3.getColumn(e,0,scratchU),i=Matrix3.getColumn(e,1,scratchV),r=Matrix3.getColumn(e,2,scratchW$1),n=Cartesian3.equals(t,Cartesian3.ZERO),a=Cartesian3.equals(i,Cartesian3.ZERO),o=Cartesian3.equals(r,Cartesian3.ZERO);return(n||a||o)&&(n&&a&&o?(e[0]=CesiumMath.EPSILON7,e[4]=CesiumMath.EPSILON7,e[8]=CesiumMath.EPSILON7):(!n||a||o?n||!a||o?n||a||!o?n?a?o||(i=computeMissingVector(r,t=findOrthogonalVector(r,t),i)):r=computeMissingVector(i,t=findOrthogonalVector(i,t),r):r=computeMissingVector(i=findOrthogonalVector(t,i),t,r):r=computeMissingVector(i,t,r):i=computeMissingVector(t,r,i):t=computeMissingVector(i,r,t),Matrix3.setColumn(e,0,t,e),Matrix3.setColumn(e,1,i,e),Matrix3.setColumn(e,2,r,e))),e}function TileOrientedBoundingBox(e,t){t=checkHalfAxes(t),this._orientedBoundingBox=new OrientedBoundingBox(e,t),this._boundingSphere=BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox)}function Cesium3DTile(e,t,i,r){this._tileset=e;var n=(this._header=i).content;this.transform=defined(i.transform)?Matrix4.unpack(i.transform):Matrix4.clone(Matrix4.IDENTITY);var a,o,s,l,c,u,d,h,p=defined(r)?r.computedTransform:e.modelMatrix,m=Matrix4.multiply(p,this.transform,new Matrix4),f=defined(r)?r._initialTransform:Matrix4.IDENTITY;if(this._initialTransform=Matrix4.multiply(f,this.transform,new Matrix4),this.computedTransform=m,this._boundingVolume=this.createBoundingVolume(i.boundingVolume,m),this._boundingVolume2D=void 0,defined(n)&&defined(n.boundingVolume)&&(a=this.createBoundingVolume(n.boundingVolume,m)),this._contentBoundingVolume=a,this._contentBoundingVolume2D=void 0,defined(i.viewerRequestVolume)&&(o=this.createBoundingVolume(i.viewerRequestVolume,m)),this._viewerRequestVolume=o,this.geometricError=i.geometricError,this._geometricError=i.geometricError,defined(this._geometricError)||(this._geometricError=defined(r)?r.geometricError:e._geometricError,Cesium3DTile._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale(),s=defined(i.refine)?("replace"!==i.refine&&"add"!==i.refine||Cesium3DTile._deprecationWarning("lowercase-refine",'This tile uses a lowercase refine "'+i.refine+'". Instead use "'+i.refine.toUpperCase()+'".'),"REPLACE"===i.refine.toUpperCase()?Cesium3DTileRefine$1.REPLACE:Cesium3DTileRefine$1.ADD):defined(r)?r.refine:Cesium3DTileRefine$1.REPLACE,this.refine=s,this.children=[],this.parent=r,t=Resource.createIfNeeded(t),defined(n)){var g=n.uri;defined(n.url)&&(Cesium3DTile._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),g=n.url),c=!1,u=Cesium3DTileContentState$1.UNLOADED,d=t.getDerivedResource({url:g}),h=RequestScheduler.getServerKey(d.getUrlComponent())}else l=new Empty3DTileContent(e,this),c=!0,u=Cesium3DTileContentState$1.READY;this._content=l,this._contentResource=d,this._contentState=u,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=h,this.hasEmptyContent=c,this.hasTilesetContent=!1,this.cacheNode=void 0;var _,y,v=i.expire;defined(v)&&(_=v.duration,defined(v.date)&&(y=JulianDate.fromIso8601(v.date))),this.expireDuration=_,this.expireDate=y,this.lastStyleTime=0,this._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.priorityDeferred=!1,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._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._clippingPlanesState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=Color.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,(this._priorityHolder=this)._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new JulianDate,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}defineProperties$1(TileOrientedBoundingBox.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),TileOrientedBoundingBox.prototype.distanceToCamera=function(e){return Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))},TileOrientedBoundingBox.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)},TileOrientedBoundingBox.prototype.update=function(e,t){Cartesian3.clone(e,this._orientedBoundingBox.center),t=checkHalfAxes(t),Matrix3.clone(t,this._orientedBoundingBox.halfAxes),BoundingSphere.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)},TileOrientedBoundingBox.prototype.createDebugVolume=function(e){return new Primitive({geometryInstances:new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-1,-1,-1),maximum:new Cartesian3(1,1,1)}),id:"outline",modelMatrix:Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),attributes:{color:ColorGeometryInstanceAttribute.fromColor(e)}}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})},Cesium3DTile._deprecationWarning=deprecationWarning,defineProperties$1(Cesium3DTile.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return defaultValue(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return defined(this._color)||(this._color=new Color),Color.clone(this._color)},set:function(e){this._color=Color.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent||defined(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Cesium3DTileContentState$1.READY}},contentUnloaded:{get:function(){return this._contentState===Cesium3DTileContentState$1.UNLOADED}},contentExpired:{get:function(){return this._contentState===Cesium3DTileContentState$1.EXPIRED}},contentFailed:{get:function(){return this._contentState===Cesium3DTileContentState$1.FAILED}},contentReadyToProcessPromise:{get:function(){if(defined(this._contentReadyToProcessPromise))return this._contentReadyToProcessPromise.promise}},contentReadyPromise:{get:function(){if(defined(this._contentReadyPromise))return this._contentReadyPromise.promise}},commandsLength:{get:function(){return this._commandsLength}}});var scratchCartesian$7=new Cartesian3;function isPriorityDeferred(e,t){var i=e._tileset,r=t.camera,n=e.boundingSphere,a=n.radius,o=Cartesian3.multiplyByScalar(r.directionWC,e._centerZDepth,scratchCartesian$7),s=Cartesian3.add(r.positionWC,o,scratchCartesian$7),l=Cartesian3.subtract(s,n.center,scratchCartesian$7);if(a<Cartesian3.magnitude(l)){var c=Cartesian3.normalize(l,scratchCartesian$7),u=Cartesian3.multiplyByScalar(c,a,scratchCartesian$7),d=Cartesian3.add(n.center,u,scratchCartesian$7),h=Cartesian3.subtract(d,r.positionWC,scratchCartesian$7),p=Cartesian3.normalize(h,scratchCartesian$7);e._foveatedFactor=1-Math.abs(Cartesian3.dot(r.directionWC,p))}else e._foveatedFactor=0;var m=e.refine===Cesium3DTileRefine$1.REPLACE,f=i._skipLevelOfDetail;if(m&&!f||!i.foveatedScreenSpaceError||1===i.foveatedConeSize||e._priorityProgressiveResolution&&m&&f||i._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT||i._pass===Cesium3DTilePass$1.PRELOAD)return!1;var g=1-Math.cos(.5*r.frustum.fov),_=i.foveatedConeSize*g;if(e._foveatedFactor<=_)return!1;var y=g-_,v=CesiumMath.clamp((e._foveatedFactor-_)/y,0,1),C=i.foveatedInterpolationCallback(i.foveatedMinimumScreenSpaceErrorRelaxation,i.maximumScreenSpaceError,v),S=0===e._screenSpaceError&&defined(e.parent)?.5*e.parent._screenSpaceError:e._screenSpaceError;return i.maximumScreenSpaceError-C<=S}var scratchJulianDate$2=new JulianDate;function isPriorityProgressiveResolution(e,t){if(e.progressiveResolutionHeightFraction<=0||.5<e.progressiveResolutionHeightFraction)return!1;var i=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;var r=t.parent,n=e._maximumScreenSpaceError,a=t._screenSpaceErrorProgressiveResolution<=n,o=defined(r)&&r._screenSpaceErrorProgressiveResolution>n;return a&&o&&(i=t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0),i}function getPriorityReverseScreenSpaceError(e,t){var i=t.parent,r=defined(i)&&(!e._skipLevelOfDetail||0===t._screenSpaceError||i.hasTilesetContent)?i._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-r}function updateExpireDate(e){if(defined(e.expireDuration)){var t=JulianDate.now(scratchJulianDate$2);JulianDate.addSeconds(t,e.expireDuration,t),defined(e.expireDate)?JulianDate.lessThan(e.expireDate,t)&&JulianDate.clone(t,e.expireDate):e.expireDate=JulianDate.clone(t)}}function getContentFailedFunction(t){return function(e){t._contentState=Cesium3DTileContentState$1.FAILED,t._contentReadyPromise.reject(e),t._contentReadyToProcessPromise.reject(e)}}function createPriorityFunction(e){return function(){return e._priority}}Cesium3DTile.prototype.getScreenSpaceError=function(e,t,i){var r=this._tileset,n=defaultValue(i,1),a=defined(this.parent)?this.parent.geometricError:r._geometricError,o=t?a:this.geometricError;if(0===o)return 0;var s,l=e.camera,c=l.frustum,u=e.context,d=u.drawingBufferWidth,h=u.drawingBufferHeight*n;if(e.mode===SceneMode$1.SCENE2D||c instanceof OrthographicFrustum){defined(c._offCenterFrustum)&&(c=c._offCenterFrustum),s=o/(Math.max(c.top-c.bottom,c.right-c.left)/Math.max(d,h))}else{var p=Math.max(this._distanceToCamera,CesiumMath.EPSILON7);if(s=o*h/(p*l.frustum.sseDenominator),r.dynamicScreenSpaceError){var m=r._dynamicScreenSpaceErrorComputedDensity,f=r.dynamicScreenSpaceErrorFactor;s-=CesiumMath.fog(p,m)*f}}return s/=e.pixelRatio},Cesium3DTile.prototype.updateVisibility=function(e){var t=this.parent,i=this._tileset,r=defined(t)?t.computedTransform:i.modelMatrix,n=defined(t)?t._visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.updateTransform(r),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,i.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=getPriorityReverseScreenSpaceError(i,this),this._priorityProgressiveResolution=isPriorityProgressiveResolution(i,this),this.priorityDeferred=isPriorityDeferred(this,e)},Cesium3DTile.prototype.updateExpiration=function(){if(defined(this.expireDate)&&this.contentReady&&!this.hasEmptyContent){var e=JulianDate.now(scratchJulianDate$2);JulianDate.lessThan(this.expireDate,e)&&(this._contentState=Cesium3DTileContentState$1.EXPIRED,this._expiredContent=this._content)}},Cesium3DTile.prototype.requestContent=function(){var n=this,a=this._tileset;if(this.hasEmptyContent)return!1;var e=this._contentResource.clone(),t=this.contentExpired;t&&e.setQueryParameters({expired:this.expireDate.toString()});var i=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.TILES3D,priorityFunction:createPriorityFunction(this),serverKey:this._serverKey});this._request=i,e.request=i;var r=e.fetchArrayBuffer();if(!defined(r))return!1;var o=this._contentState;this._contentState=Cesium3DTileContentState$1.LOADING,this._contentReadyToProcessPromise=when.defer(),this._contentReadyPromise=when.defer(),t&&(this.expireDate=void 0);var s=getContentFailedFunction(this);return r.then(function(e){if(!n.isDestroyed()){var t,i=getMagic(new Uint8Array(e)),r=Cesium3DTileContentFactory[i];return a._disableSkipLevelOfDetail=a._disableSkipLevelOfDetail||"vctr"===i||"geom"===i,defined(r)?t=r(a,n,n._contentResource,e,0):(t=Cesium3DTileContentFactory.json(a,n,n._contentResource,e,0),n.hasTilesetContent=!0),n._content=t,n._contentState=Cesium3DTileContentState$1.PROCESSING,n._contentReadyToProcessPromise.resolve(t),t.readyPromise.then(function(e){n.isDestroyed()?s():(updateExpireDate(n),n._selectedFrame=0,n.lastStyleTime=0,JulianDate.now(n._loadTimestamp),n._contentState=Cesium3DTileContentState$1.READY,n._contentReadyPromise.resolve(e))})}s()}).otherwise(function(e){if(i.state===RequestState$1.CANCELLED)return n._contentState=o,--a.statistics.numberOfPendingRequests,void++a.statistics.numberOfAttemptedRequests;s(e)}),!0},Cesium3DTile.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||(this._content=this._content&&this._content.destroy(),this._contentState=Cesium3DTileContentState$1.UNLOADED,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this.lastStyleTime=0,this.clippingPlanesDirty=0===this._clippingPlanesState,this._clippingPlanesState=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())};var scratchProjectedBoundingSphere=new BoundingSphere;function getBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._boundingVolume2D)){var i=e._boundingVolume.boundingSphere,r=BoundingSphere.projectTo2D(i,t.mapProjection,scratchProjectedBoundingSphere);e._boundingVolume2D=new TileBoundingSphere(r.center,r.radius)}return t.mode!==SceneMode$1.SCENE3D?e._boundingVolume2D:e._boundingVolume}function getContentBoundingVolume(e,t){if(t.mode!==SceneMode$1.SCENE3D&&!defined(e._contentBoundingVolume2D)){var i=e._contentBoundingVolume.boundingSphere,r=BoundingSphere.projectTo2D(i,t.mapProjection,scratchProjectedBoundingSphere);e._contentBoundingVolume2D=new TileBoundingSphere(r.center,r.radius)}return t.mode!==SceneMode$1.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Cesium3DTile.prototype.visibility=function(e,t){var i=e.cullingVolume,r=getBoundingVolume(this,e),n=this._tileset,a=n.clippingPlanes;if(defined(a)&&a.enabled){var o=a.computeIntersectionWithBoundingVolume(r,n.clippingPlanesOriginMatrix);if(this._isClipped=o!==Intersect$1.INSIDE,o===Intersect$1.OUTSIDE)return CullingVolume.MASK_OUTSIDE}return i.computeVisibilityWithPlaneMask(r,t)},Cesium3DTile.prototype.contentVisibility=function(e){if(!defined(this._contentBoundingVolume))return Intersect$1.INSIDE;if(this._visibilityPlaneMask===CullingVolume.MASK_INSIDE)return Intersect$1.INSIDE;var t=e.cullingVolume,i=getContentBoundingVolume(this,e),r=this._tileset,n=r.clippingPlanes;if(defined(n)&&n.enabled){var a=n.computeIntersectionWithBoundingVolume(i,r.clippingPlanesOriginMatrix);if(this._isClipped=a!==Intersect$1.INSIDE,a===Intersect$1.OUTSIDE)return Intersect$1.OUTSIDE}return t.computeVisibility(i)},Cesium3DTile.prototype.distanceToTile=function(e){return getBoundingVolume(this,e).distanceToCamera(e)};var scratchToTileCenter=new Cartesian3;Cesium3DTile.prototype.distanceToTileCenter=function(e){var t=getBoundingVolume(this,e).boundingVolume,i=Cartesian3.subtract(t.center,e.camera.positionWC,scratchToTileCenter);return Cartesian3.dot(e.camera.directionWC,i)},Cesium3DTile.prototype.insideViewerRequestVolume=function(e){var t=this._viewerRequestVolume;return!defined(t)||0===t.distanceToCamera(e)};var scratchMatrix$2=new Matrix3,scratchScale$7=new Cartesian3,scratchHalfAxes=new Matrix3,scratchCenter$3=new Cartesian3,scratchRectangle$6=new Rectangle,scratchOrientedBoundingBox=new OrientedBoundingBox,scratchTransform=new Matrix4;function createBox(e,t,i){var r=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$3),n=Matrix3.fromArray(e,3,scratchHalfAxes);r=Matrix4.multiplyByPoint(t,r,r);var a=Matrix4.getMatrix3(t,scratchMatrix$2);return n=Matrix3.multiply(a,n,n),defined(i)?(i.update(r,n),i):new TileOrientedBoundingBox(r,n)}function createBoxFromTransformedRegion(e,t,i,r){var n=Rectangle.unpack(e,0,scratchRectangle$6),a=e[4],o=e[5],s=OrientedBoundingBox.fromRectangle(n,a,o,Ellipsoid.WGS84,scratchOrientedBoundingBox),l=s.center,c=s.halfAxes;t=Matrix4.multiplyTransformation(t,Matrix4.inverseTransformation(i,scratchTransform),scratchTransform),l=Matrix4.multiplyByPoint(t,l,l);var u=Matrix4.getMatrix3(t,scratchMatrix$2);return c=Matrix3.multiply(u,c,c),defined(r)&&r instanceof TileOrientedBoundingBox?(r.update(l,c),r):new TileOrientedBoundingBox(l,c)}function createRegion(e,t,i,r){return Matrix4.equalsEpsilon(t,i,CesiumMath.EPSILON8)?defined(r)?r:new TileBoundingRegion({rectangle:Rectangle.unpack(e,0,scratchRectangle$6),minimumHeight:e[4],maximumHeight:e[5]}):createBoxFromTransformedRegion(e,t,i,r)}function createSphere(e,t,i){var r=Cartesian3.fromElements(e[0],e[1],e[2],scratchCenter$3),n=e[3];r=Matrix4.multiplyByPoint(t,r,r);var a=Matrix4.getScale(t,scratchScale$7);return n*=Cartesian3.maximumComponent(a),defined(i)?(i.update(r,n),i):new TileBoundingSphere(r,n)}function applyDebugSettings(e,t,i){if(i.passes.render){var r=defined(e._header.content)&&defined(e._header.content.boundingVolume),n=e.hasEmptyContent||e.hasTilesetContent,a=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!r;if(a){var o;o=e._finalResolution?n?Color.DARKGRAY:Color.WHITE:Color.YELLOW,defined(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(o)),e._debugBoundingVolume.update(i);var s=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");s.color=ColorGeometryInstanceAttribute.toValue(o,s.color)}else!a&&defined(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&r?(defined(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(Color.BLUE)),e._debugContentBoundingVolume.update(i)):!t.debugShowContentBoundingVolume&&defined(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&defined(e._viewerRequestVolume)?(defined(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(Color.YELLOW)),e._debugViewerRequestVolume.update(i)):!t.debugShowViewerRequestVolume&&defined(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());var l=t.debugColorizeTiles&&!e._debugColorizeTiles||defined(t._heatmap.tilePropertyName),c=!t.debugColorizeTiles&&e._debugColorizeTiles;l?(t._heatmap.colorize(e,i),e._debugColorizeTiles=!0,e.color=e._debugColor):c&&(e._debugColorizeTiles=!1,e.color=Color.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}}function updateContent(e,t,i){var r=e._content,n=e._expiredContent;if(defined(n)){if(!e.contentReady)return void n.update(t,i);e._expiredContent.destroy(),e._expiredContent=void 0}r.update(t,i)}function updateClippingPlanes$1(e,t){var i=t.clippingPlanes,r=0;defined(i)&&e._isClipped&&i.enabled&&(r=i.clippingPlanesState),r!==e._clippingPlanesState&&(e._clippingPlanesState=r,e.clippingPlanesDirty=!0)}Cesium3DTile.prototype.createBoundingVolume=function(e,t,i){if(!defined(e))throw new RuntimeError("boundingVolume must be defined");if(defined(e.box))return createBox(e.box,t,i);if(defined(e.region))return createRegion(e.region,t,this._initialTransform,i);if(defined(e.sphere))return createSphere(e.sphere,t,i);throw new RuntimeError("boundingVolume must contain a sphere, region, or box")},Cesium3DTile.prototype.updateTransform=function(e){e=defaultValue(e,Matrix4.IDENTITY);var t=Matrix4.multiply(e,this.transform,scratchTransform);if(!Matrix4.equals(t,this.computedTransform)){Matrix4.clone(t,this.computedTransform);var i=this._header,r=this._header.content;this._boundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._boundingVolume),defined(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),defined(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(i.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()}},Cesium3DTile.prototype.updateGeometricErrorScale=function(){var e=Matrix4.getScale(this.computedTransform,scratchScale$7),t=Cartesian3.maximumComponent(e);this.geometricError=this._geometricError*t},Cesium3DTile.prototype.update=function(e,t){var i=t.commandList.length;updateClippingPlanes$1(this,e),applyDebugSettings(this,e,t),updateContent(this,e,t),this._commandsLength=t.commandList.length-i,this.clippingPlanesDirty=!1};var scratchCommandList=[];function isolateDigits(e,t,i){var r=e*Math.pow(10,t);return parseInt(r)*Math.pow(10,i)}function priorityNormalizeAndClamp(e,t,i){return Math.max(CesiumMath.normalize(e,t,i)-CesiumMath.EPSILON7,0)}function Cesium3DTileContent(e,t,i,r,n){this.featurePropertiesDirty=!1}Cesium3DTile.prototype.process=function(e,t){var i=t.commandList;t.commandList=scratchCommandList,this._content.update(e,t),scratchCommandList.length=0,t.commandList=i},Cesium3DTile.prototype.updatePriority=function(){var e=this.tileset,t=e.preferLeaves,i=e._minimumPriority,r=e._maximumPriority,n=Math.pow(10,8),a=Math.pow(10,9),o=Math.pow(10,10),s=priorityNormalizeAndClamp(this._depth,i.depth,r.depth);s=t?1-s:s;var l=isolateDigits(!e._skipLevelOfDetail&&this.refine===Cesium3DTileRefine$1.REPLACE?priorityNormalizeAndClamp(this._priorityHolder._distanceToCamera,i.distance,r.distance):priorityNormalizeAndClamp(this._priorityReverseScreenSpaceError,i.reverseScreenSpaceError,r.reverseScreenSpaceError),4,0),c=this._priorityProgressiveResolution?0:n,u=isolateDigits(priorityNormalizeAndClamp(this._priorityHolder._foveatedFactor,i.foveatedFactor,r.foveatedFactor),4,4),d=this.priorityDeferred?a:0,h=e._pass===Cesium3DTilePass$1.PRELOAD_FLIGHT?0:o;this._priority=s+l+c+u+d+h},Cesium3DTile.prototype.isDestroyed=function(){return!1},Cesium3DTile.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(),destroyObject(this)},defineProperties$1(Cesium3DTileContent.prototype,{featuresLength:{get:function(){DeveloperError.throwInstantiationError()}},pointsLength:{get:function(){DeveloperError.throwInstantiationError()}},trianglesLength:{get:function(){DeveloperError.throwInstantiationError()}},geometryByteLength:{get:function(){DeveloperError.throwInstantiationError()}},texturesByteLength:{get:function(){DeveloperError.throwInstantiationError()}},batchTableByteLength:{get:function(){DeveloperError.throwInstantiationError()}},innerContents:{get:function(){DeveloperError.throwInstantiationError()}},readyPromise:{get:function(){DeveloperError.throwInstantiationError()}},tileset:{get:function(){DeveloperError.throwInstantiationError()}},tile:{get:function(){DeveloperError.throwInstantiationError()}},url:{get:function(){DeveloperError.throwInstantiationError()}},batchTable:{get:function(){DeveloperError.throwInstantiationError()}}}),Cesium3DTileContent.prototype.hasProperty=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.getFeature=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyDebugSettings=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.applyStyle=function(e){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.update=function(e,t){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.isDestroyed=function(){DeveloperError.throwInstantiationError()},Cesium3DTileContent.prototype.destroy=function(){DeveloperError.throwInstantiationError()};var Cesium3DTileOptimizations={},scratchAxis$1=new Cartesian3;function Cesium3DTilePassState(e){this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}function Cesium3DTilesetCache(){this._list=new DoublyLinkedList,this._sentinel=this._list.add(),this._trimTiles=!1}function Cesium3DTilesetHeatmap(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 getHeatmapValue(e,t){return"_loadTimestamp"===t?JulianDate.toDate(e).getTime():e}function getHeatmapValueAndUpdateMinimumMaximum(e,t){var i=e.tilePropertyName;if(defined(i)){var r=getHeatmapValue(t[i],i);return defined(r)?(e._maximum=Math.max(r,e._maximum),e._minimum=Math.min(r,e._minimum)):e.tilePropertyName=void 0,r}}Cesium3DTileOptimizations.checkChildrenWithinParent=function(e){var t=e.children,i=t.length,r=e.boundingVolume;if(r instanceof TileOrientedBoundingBox||r instanceof TileBoundingRegion){var n=r._orientedBoundingBox;e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION;for(var a=0;a<i;++a){var o=t[a].boundingVolume;if(!(o instanceof TileOrientedBoundingBox||o instanceof TileBoundingRegion)){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}var s=o._orientedBoundingBox,l=Cartesian3.subtract(s.center,n.center,scratchAxis$1),c=Cartesian3.magnitude(l);if(Cartesian3.divideByScalar(l,c,l),Math.abs(n.halfAxes[0]*l.x)+Math.abs(n.halfAxes[1]*l.y)+Math.abs(n.halfAxes[2]*l.z)+Math.abs(n.halfAxes[3]*l.x)+Math.abs(n.halfAxes[4]*l.y)+Math.abs(n.halfAxes[5]*l.z)+Math.abs(n.halfAxes[6]*l.x)+Math.abs(n.halfAxes[7]*l.y)+Math.abs(n.halfAxes[8]*l.z)<=Math.abs(s.halfAxes[0]*l.x)+Math.abs(s.halfAxes[1]*l.y)+Math.abs(s.halfAxes[2]*l.z)+Math.abs(s.halfAxes[3]*l.x)+Math.abs(s.halfAxes[4]*l.y)+Math.abs(s.halfAxes[5]*l.z)+Math.abs(s.halfAxes[6]*l.x)+Math.abs(s.halfAxes[7]*l.y)+Math.abs(s.halfAxes[8]*l.z)+c){e._optimChildrenWithinParent=Cesium3DTileOptimizationHint$1.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Cesium3DTileOptimizationHint$1.USE_OPTIMIZATION},Cesium3DTilesetCache.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)},Cesium3DTilesetCache.prototype.touch=function(e){var t=e.cacheNode;defined(t)&&this._list.splice(this._sentinel,t)},Cesium3DTilesetCache.prototype.add=function(e){defined(e.cacheNode)||(e.cacheNode=this._list.add(e))},Cesium3DTilesetCache.prototype.unloadTile=function(e,t,i){var r=t.cacheNode;defined(r)&&(this._list.remove(r),t.cacheNode=void 0,i(e,t))},Cesium3DTilesetCache.prototype.unloadTiles=function(e,t){var i=this._trimTiles;this._trimTiles=!1;for(var r=this._list,n=1024*e.maximumMemoryUsage*1024,a=this._sentinel,o=r.head;o!==a&&(e.totalMemoryUsageInBytes>n||i);){var s=o.item;o=o.next,this.unloadTile(e,s,t)}},Cesium3DTilesetCache.prototype.trim=function(){this._trimTiles=!0},Cesium3DTilesetHeatmap.prototype.setReferenceMinimumMaximum=function(e,t,i){this._referenceMinimum[i]=getHeatmapValue(e,i),this._referenceMaximum[i]=getHeatmapValue(t,i)};var heatmapColors=[new Color(.1,.1,.1,1),new Color(.153,.278,.878,1),new Color(.827,.231,.49,1),new Color(.827,.188,.22,1),new Color(1,.592,.259,1),new Color(1,.843,0,1)];function Cesium3DTilesetStatistics(){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}function updatePointAndFeatureCounts(e,t,i,r){var n=t.innerContents,a=t.pointsLength,o=t.trianglesLength,s=t.featuresLength,l=t.geometryByteLength,c=t.texturesByteLength,u=t.batchTableByteLength;if(r?(e.numberOfFeaturesLoaded+=i?-s:s,e.numberOfPointsLoaded+=i?-a:a,e.geometryByteLength+=i?-l:l,e.texturesByteLength+=i?-c:c,e.batchTableByteLength+=i?-u:u):(e.numberOfFeaturesSelected+=i?-s:s,e.numberOfPointsSelected+=i?-a:a,e.numberOfTrianglesSelected+=i?-o:o),defined(n))for(var d=n.length,h=0;h<d;++h)updatePointAndFeatureCounts(e,n[h],i,r)}function Cesium3DTileStyleEngine(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}function Cesium3DTileset(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._url=void 0,this._basePath=void 0,this._root=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._extensionsUsed=void 0,this._gltfUpAxis=void 0,this._cache=new Cesium3DTilesetCache,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._extras=void 0,this._credits=void 0,this._cullWithChildrenBounds=defaultValue(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new ManagedArray,this._maximumScreenSpaceError=defaultValue(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=defaultValue(e.maximumMemoryUsage,512),this._styleEngine=new Cesium3DTileStyleEngine,this._modelMatrix=defined(e.modelMatrix)?Matrix4.clone(e.modelMatrix):Matrix4.clone(Matrix4.IDENTITY),this._statistics=new Cesium3DTilesetStatistics,this._statisticsLast=new Cesium3DTilesetStatistics,this._statisticsPerPass=new Array(Cesium3DTilePass$1.NUMBER_OF_PASSES);for(var t=0;t<Cesium3DTilePass$1.NUMBER_OF_PASSES;++t)this._statisticsPerPass[t]=new Cesium3DTilesetStatistics;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 Cesium3DTilesetHeatmap(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=defaultValue(e.cullRequestsWhileMoving,!0),this.cullRequestsWhileMovingMultiplier=defaultValue(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=CesiumMath.clamp(defaultValue(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=defaultValue(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._readyPromise=when.defer(),this._classificationType=e.classificationType,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.WGS84),this._initialClippingPlanesOriginMatrix=Matrix4.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this.preloadWhenHidden=defaultValue(e.preloadWhenHidden,!1),this.preloadFlightDestinations=defaultValue(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=defaultValue(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=defaultValue(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=defaultValue(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=defaultValue(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=defaultValue(e.foveatedInterpolationCallback,CesiumMath.lerp),this.foveatedTimeDelay=defaultValue(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this.show=defaultValue(e.show,!0),this.colorBlendMode=Cesium3DTileColorBlendMode$1.HIGHLIGHT,this.colorBlendAmount=.5,this.pointCloudShading=new PointCloudShading(e.pointCloudShading),this._pointCloudEyeDomeLighting=new PointCloudEyeDomeLighting,this.loadProgress=new Event,this.allTilesLoaded=new Event,this.initialTilesLoaded=new Event,this.tileLoad=new Event,this.tileUnload=new Event,this.tileFailed=new Event,this.tileVisible=new Event,this.skipLevelOfDetail=defaultValue(e.skipLevelOfDetail,!0),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=defaultValue(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=defaultValue(e.skipScreenSpaceErrorFactor,16),this.skipLevels=defaultValue(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=defaultValue(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=defaultValue(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._imageBasedLightingFactor=new Cartesian2(1,1),Cartesian2.clone(e.imageBasedLightingFactor,this._imageBasedLightingFactor),this.lightColor=e.lightColor,this.luminanceAtZenith=defaultValue(e.luminanceAtZenith,.2),this.sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients,this.specularEnvironmentMaps=e.specularEnvironmentMaps,this.debugFreezeFrame=defaultValue(e.debugFreezeFrame,!1),this.debugColorizeTiles=defaultValue(e.debugColorizeTiles,!1),this.debugWireframe=defaultValue(e.debugWireframe,!1),this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=defaultValue(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=defaultValue(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=defaultValue(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=defaultValue(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=defaultValue(e.debugShowMemoryUsage,!1),this.debugShowUrl=defaultValue(e.debugShowUrl,!1);var u,d=this;when(e.url).then(function(e){var t;return u=Resource.createIfNeeded(e),d._credits=u.credits,"json"===u.extension?t=u.getBaseUri(!0):u.isDataUri&&(t=""),d._url=u.url,d._basePath=t,Cesium3DTileset.loadJson(u)}).then(function(e){d._root=d.loadTileset(u,e);var t=defined(e.asset.gltfUpAxis)?Axis$1.fromName(e.asset.gltfUpAxis):Axis$1.Y,i=e.asset;d._asset=i,d._properties=e.properties,d._geometricError=e.geometricError,d._extensionsUsed=e.extensionsUsed,d._gltfUpAxis=t,d._extras=e.extras;var r=i.extras;if(defined(r)&&defined(r.cesium)&&defined(r.cesium.credits)){var n=r.cesium.credits,a=d._credits;defined(a)||(a=[],d._credits=a);for(var o=0;o<n.length;++o){var s=n[o];a.push(new Credit(s.html,s.showOnScreen))}}var l=d._root.createBoundingVolume(e.root.boundingVolume,Matrix4.IDENTITY).boundingSphere.center,c=d._ellipsoid.cartesianToCartographic(l);defined(c)&&c.height>ApproximateTerrainHeights._defaultMinTerrainHeight&&(d._initialClippingPlanesOriginMatrix=Transforms.eastNorthUpToFixedFrame(l)),d._clippingPlanesOriginMatrix=Matrix4.clone(d._initialClippingPlanesOriginMatrix),d._readyPromise.resolve(d)}).otherwise(function(e){d._readyPromise.reject(e)})}Cesium3DTilesetHeatmap.prototype.colorize=function(e,t){if(defined(this.tilePropertyName)&&e.contentAvailable&&e._selectedFrame===t.frameNumber){var i=getHeatmapValueAndUpdateMinimumMaximum(this,e),r=this._previousMinimum,n=this._previousMaximum;if(r!==Number.MAX_VALUE&&n!==-Number.MAX_VALUE){var a=n-r+CesiumMath.EPSILON7,o=CesiumMath.clamp(i-r,0,a)/a*(heatmapColors.length-1),s=Math.floor(o),l=Math.ceil(o),c=o-s,u=heatmapColors[s],d=heatmapColors[l],h=Color.clone(Color.WHITE);h.red=CesiumMath.lerp(u.red,d.red,c),h.green=CesiumMath.lerp(u.green,d.green,c),h.blue=CesiumMath.lerp(u.blue,d.blue,c),e._debugColor=h}}},Cesium3DTilesetHeatmap.prototype.resetMinimumMaximum=function(){var e=this.tilePropertyName;if(defined(e)){var t=this._referenceMinimum[e],i=this._referenceMaximum[e],r=defined(t)&&defined(i);this._previousMinimum=r?t:this._minimum,this._previousMaximum=r?i:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}},Cesium3DTilesetStatistics.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},Cesium3DTilesetStatistics.prototype.incrementSelectionCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!1)},Cesium3DTilesetStatistics.prototype.incrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!1,!0)},Cesium3DTilesetStatistics.prototype.decrementLoadCounts=function(e){updatePointAndFeatureCounts(this,e,!0,!0)},Cesium3DTilesetStatistics.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},defineProperties$1(Cesium3DTileStyleEngine.prototype,{style:{get:function(){return this._style},set:function(e){this._style=e,this._styleDirty=!0}}}),Cesium3DTileStyleEngine.prototype.makeDirty=function(){this._styleDirty=!0},Cesium3DTileStyleEngine.prototype.applyStyle=function(e,t){if(e.ready&&(!defined(this._style)||this._style.ready)){var i=this._styleDirty;t.passes.render&&(this._styleDirty=!1),i&&++this._lastStyleTime;for(var r=this._lastStyleTime,n=e._statistics,a=i?e._selectedTiles:e._selectedTilesToStyle,o=a.length,s=0;s<o;++s){var l=a[s];if(l.lastStyleTime!==r){var c=l.content;l.lastStyleTime=r,c.applyStyle(this._style),n.numberOfFeaturesStyled+=c.featuresLength,++n.numberOfTilesStyled}}}},defineProperties$1(Cesium3DTileset.prototype,{asset:{get:function(){return this._asset}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){return this._properties}},ready:{get:function(){return defined(this._root)}},readyPromise:{get:function(){return this._readyPromise.promise}},tilesLoaded:{get:function(){return this._tilesLoaded}},url:{get:function(){return this._url}},basePath:{get:function(){return deprecationWarning("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}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){this._maximumMemoryUsage=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=Matrix4.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){var e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return defined(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(Matrix4.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):Matrix4.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){this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){Cartesian2.clone(e,this._imageBasedLightingFactor)}}}),Cesium3DTileset.loadJson=function(e){return Resource.createIfNeeded(e).fetchJson()},Cesium3DTileset.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()},Cesium3DTileset.prototype.loadTileset=function(e,t,i){var r=t.asset;if(!defined(r))throw new RuntimeError("Tileset must have an asset property.");if("0.0"!==r.version&&"1.0"!==r.version)throw new RuntimeError("The tileset must be 3D Tiles version 0.0 or 1.0.");var n=this._statistics,a=r.tilesetVersion;defined(a)&&(this._basePath+="?v="+a,e.setQueryParameters({v:a}));var o=new Cesium3DTile(this,e,t.root,i);defined(i)&&(i.children.push(o),o._depth=i._depth+1);var s=[];for(s.push(o);0<s.length;){var l=s.pop();++n.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&l.refine===Cesium3DTileRefine$1.ADD;var c=l._header.children;if(defined(c))for(var u=c.length,d=0;d<u;++d){var h=new Cesium3DTile(this,e,c[d],l);l.children.push(h),h._depth=l._depth+1,s.push(h)}this._cullWithChildrenBounds&&Cesium3DTileOptimizations.checkChildrenWithinParent(l)}return o};var scratchPositionNormal=new Cartesian3,scratchCartographic$c=new Cartographic,scratchMatrix$3=new Matrix4,scratchCenter$4=new Cartesian3,scratchPosition$a=new Cartesian3,scratchDirection$1=new Cartesian3;function updateDynamicScreenSpaceError(e,t){var i,r,n,a,o,s=t.camera,l=e._root,c=l.contentBoundingVolume;if(c instanceof TileBoundingRegion)i=Cartesian3.normalize(s.positionWC,scratchPositionNormal),r=s.directionWC,n=s.positionCartographic.height,a=c.minimumHeight,o=c.maximumHeight;else{var u=Matrix4.inverseTransformation(l.computedTransform,scratchMatrix$3),d=t.mapProjection.ellipsoid,h=c.boundingVolume,p=Matrix4.multiplyByPoint(u,h.center,scratchCenter$4);if(Cartesian3.magnitude(p)>d.minimumRadius){var m=Cartographic.fromCartesian(p,d,scratchCartographic$c);i=Cartesian3.normalize(s.positionWC,scratchPositionNormal),r=s.directionWC,n=s.positionCartographic.height,a=0,o=2*m.height}else{var f=Matrix4.multiplyByPoint(u,s.positionWC,scratchPosition$a);if(i=Cartesian3.UNIT_Z,r=Matrix4.multiplyByPointAsVector(u,s.directionWC,scratchDirection$1),r=Cartesian3.normalize(r,r),n=f.z,c instanceof TileOrientedBoundingBox){var g=l._header.boundingVolume.box[11];a=p.z-g,o=p.z+g}else if(c instanceof TileBoundingSphere){var _=h.radius;a=p.z-_,o=p.z+_}}}var y=a+(o-a)*e.dynamicScreenSpaceErrorHeightFalloff,v=o,C=CesiumMath.clamp((n-y)/(v-y),0,1),S=1-Math.abs(Cartesian3.dot(r,i));S*=1-C;var x=e.dynamicScreenSpaceErrorDensity;x*=S,e._dynamicScreenSpaceErrorComputedDensity=x}function requestContent(e,t){if(!t.hasEmptyContent){var i=e._statistics,r=t.contentExpired;t.requestContent()?(r&&(t.hasTilesetContent?destroySubtree(e,t):(i.decrementLoadCounts(t.content),--i.numberOfTilesWithContentReady)),++i.numberOfPendingRequests,e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(addToProcessingQueue(e,t)),t.contentReadyPromise.then(handleTileSuccess(e,t)).otherwise(handleTileFailure(e,t))):++i.numberOfAttemptedRequests}}function sortRequestByPriority(e,t){return e._priority-t._priority}function cancelOutOfViewRequests(e,t){for(var i=e._requestedTilesInFlight,r=0,n=i.length,a=0;a<n;++a){var o=i[a],s=1<=t.frameNumber-o._touchedFrame;o._contentState===Cesium3DTileContentState$1.LOADING?s?(o._request.cancel(),++r):0<r&&(i[a-r]=o):++r}i.length-=r}function requestTiles(e,t){var i=e._requestedTiles,r=i.length;i.sort(sortRequestByPriority);for(var n=0;n<r;++n)requestContent(e,i[n])}function addToProcessingQueue(e,t){return function(){e._processingQueue.push(t),--e._statistics.numberOfPendingRequests,++e._statistics.numberOfTilesProcessing}}function handleTileFailure(r,n){return function(e){0<=r._processingQueue.indexOf(n)?--r._statistics.numberOfTilesProcessing:--r._statistics.numberOfPendingRequests;var t=n._contentResource.url,i=defined(e.message)?e.message:e.toString();0<r.tileFailed.numberOfListeners?r.tileFailed.raiseEvent({url:t,message:i}):(console.log("A 3D tile failed to load: "+t),console.log("Error: "+i))}}function handleTileSuccess(e,t){return function(){--e._statistics.numberOfTilesProcessing,t.hasTilesetContent||(e._statistics.incrementLoadCounts(t.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(t)),e.tileLoad.raiseEvent(t)}}function filterProcessingQueue(e){for(var t=e._processingQueue,i=t.length,r=0,n=0;n<i;++n){var a=t[n];a._contentState===Cesium3DTileContentState$1.PROCESSING?0<r&&(t[n-r]=a):++r}t.length-=r}function processTiles(e,t){filterProcessingQueue(e);for(var i=e._processingQueue,r=i.length,n=0;n<r;++n)i[n].process(e,t)}Cesium3DTileset.prototype.postPassesUpdate=function(e){this.ready&&(cancelOutOfViewRequests(this,e),raiseLoadProgressEvent(this,e),this._cache.unloadTiles(this,unloadTile))},Cesium3DTileset.prototype.prePassesUpdate=function(e){if(this.ready){processTiles(this,e);var t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,defined(t)&&t.enabled&&t.update(e),defined(this._loadTimestamp)||(this._loadTimestamp=JulianDate.clone(e.time)),this._timeSinceLoad=Math.max(1e3*JulianDate.secondsDifference(e.time,this._loadTimestamp),0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!defined(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&updateDynamicScreenSpaceError(this,e),e.newFrame&&this._cache.reset()}};var scratchCartesian$8=new Cartesian3,stringOptions={maximumFractionDigits:3};function formatMemoryString(e){var t=e/1048576;return t<1?t.toLocaleString(void 0,stringOptions):Math.round(t).toLocaleString()}function computeTileLabelPosition(e){var t=e.boundingVolume.boundingVolume,i=t.halfAxes,r=t.radius,n=Cartesian3.clone(t.center,scratchCartesian$8);if(defined(i))n.x+=.75*(i[0]+i[3]+i[6]),n.y+=.75*(i[1]+i[4]+i[7]),n.z+=.75*(i[2]+i[5]+i[8]);else if(defined(r)){var a=Cartesian3.normalize(t.center,scratchCartesian$8);a=Cartesian3.multiplyByScalar(a,.75*r,scratchCartesian$8),n=Cartesian3.add(a,t.center,scratchCartesian$8)}return n}function addTileDebugLabel(e,t,i){var r="",n=0;t.debugShowGeometricError&&(r+="\nGeometric error: "+e.geometricError,n++),t.debugShowRenderingStatistics&&(r+="\nCommands: "+e.commandsLength,n++,0<e.content.pointsLength&&(r+="\nPoints: "+e.content.pointsLength,n++),0<e.content.trianglesLength&&(r+="\nTriangles: "+e.content.trianglesLength,n++),r+="\nFeatures: "+e.content.featuresLength,n++);t.debugShowMemoryUsage&&(r+="\nTexture Memory: "+formatMemoryString(e.content.texturesByteLength),r+="\nGeometry Memory: "+formatMemoryString(e.content.geometryByteLength),n+=2),t.debugShowUrl&&(r+="\nUrl: "+e._header.content.uri,n++);var a={text:r.substring(1),position:i,font:19-n+"px sans-serif",showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(a)}function updateTileDebugLabels(e,t){var i,r,n=e._selectedTiles,a=n.length,o=e._emptyTiles,s=o.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(defined(e.debugPickedTile)){var l=defined(e.debugPickPosition)?e.debugPickPosition:computeTileLabelPosition(e.debugPickedTile);addTileDebugLabel(e.debugPickedTile,e,l).pixelOffset=new Cartesian2(15,-15)}}else{for(i=0;i<a;++i)addTileDebugLabel(r=n[i],e,computeTileLabelPosition(r));for(i=0;i<s;++i)(r=o[i]).hasTilesetContent&&addTileDebugLabel(r,e,computeTileLabelPosition(r))}e._tileDebugLabels.update(t)}function updateTiles(e,t,i){e._styleEngine.applyStyle(e,t);var r,n,a=e._statistics,o=t.commandList,s=o.length,l=e._selectedTiles,c=l.length,u=e._emptyTiles,d=u.length,h=e.tileVisible,p=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&0<c;e._backfaceCommands.length=0,p&&(defined(e._stencilClearCommand)||(e._stencilClearCommand=new ClearCommand({stencil:0,pass:Pass$1.CESIUM_3D_TILE,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.SKIP_LOD_MASK})})),o.push(e._stencilClearCommand));var m=o.length;for(r=0;r<c;++r)n=l[r],i&&h.raiseEvent(n),n.update(e,t),a.incrementSelectionCounts(n.content),++a.selected;for(r=0;r<d;++r)(n=u[r]).update(e,t);var f=o.length-m;if(e._backfaceCommands.trim(),p){var g=e._backfaceCommands.values,_=g.length;for(o.length+=_,r=f-1;0<=r;--r)o[m+_+r]=o[m+r];for(r=0;r<_;++r)o[m+r]=g[r]}f=o.length-s,a.numberOfCommands=f,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&0<f&&e._pointCloudEyeDomeLighting.update(t,s,e.pointCloudShading),i&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(defined(e._tileDebugLabels)||(e._tileDebugLabels=new LabelCollection),updateTileDebugLabels(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var scratchStack$1=[];function destroySubtree(e,t){var i=t,r=scratchStack$1;for(r.push(t);0<r.length;){for(var n=(t=r.pop()).children,a=n.length,o=0;o<a;++o)r.push(n[o]);t!==i&&(destroyTile(e,t),--e._statistics.numberOfTilesTotal)}i.children=[]}function unloadTile(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function destroyTile(e,t){e._cache.unloadTile(e,t,unloadTile),t.destroy()}function raiseLoadProgressEvent(e,t){var i=e._statistics,r=e._statisticsLast,n=i.numberOfPendingRequests,a=i.numberOfTilesProcessing,o=r.numberOfPendingRequests,s=r.numberOfTilesProcessing;Cesium3DTilesetStatistics.clone(i,r);var l=n!==o||a!==s;l&&t.afterRender.push(function(){e.loadProgress.raiseEvent(n,a)}),e._tilesLoaded=0===i.numberOfPendingRequests&&0===i.numberOfTilesProcessing&&0===i.numberOfAttemptedRequests,l&&e._tilesLoaded&&(t.afterRender.push(function(){e.allTilesLoaded.raiseEvent()}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){e.initialTilesLoaded.raiseEvent()})))}function resetMinimumMaximum(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 update$4(e,t,i,r){if(t.mode===SceneMode$1.MORPHING)return!1;if(!e.ready)return!1;var n=e._statistics;n.clear();var a=r.isRender;++e._updatedVisibilityFrame,resetMinimumMaximum(e);var o=r.traversal.selectTiles(e,t);if(r.requestTiles&&requestTiles(e),updateTiles(e,t,a),Cesium3DTilesetStatistics.clone(n,i),a){var s=e._credits;if(defined(s)&&0!==n.selected)for(var l=s.length,c=0;c<l;++c)t.creditDisplay.addCredit(s[c])}return o}function ConditionsExpression(e,t){this._conditionsExpression=clone(e,!0),this._conditions=e.conditions,this._runtimeConditions=void 0,setRuntime(this,t)}function Statement(e,t){this.condition=e,this.expression=t}function setRuntime(e,t){var i=[],r=e._conditions;if(defined(r)){for(var n=r.length,a=0;a<n;++a){var o=r[a],s=String(o[0]),l=String(o[1]);i.push(new Statement(new Expression(s,t),new Expression(l,t)))}e._runtimeConditions=i}}function Cesium3DTileStyle(e){var t;(this._style={},this._ready=!1,this._show=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._labelColor=void 0,this._labelOutlineColor=void 0,this._labelOutlineWidth=void 0,this._font=void 0,this._labelStyle=void 0,this._labelText=void 0,this._backgroundColor=void 0,this._backgroundPadding=void 0,this._backgroundEnabled=void 0,this._scaleByDistance=void 0,this._translucencyByDistance=void 0,this._distanceDisplayCondition=void 0,this._heightOffset=void 0,this._anchorLineEnabled=void 0,this._anchorLineColor=void 0,this._image=void 0,this._disableDepthTestDistance=void 0,this._horizontalOrigin=void 0,this._verticalOrigin=void 0,this._labelHorizontalOrigin=void 0,this._labelVerticalOrigin=void 0,this._meta=void 0,this._colorShaderFunction=void 0,this._showShaderFunction=void 0,this._pointSizeShaderFunction=void 0,this._colorShaderFunctionReady=!1,this._showShaderFunctionReady=!1,this._pointSizeShaderFunctionReady=!1,this._colorShaderTranslucent=!1,"string"==typeof e||e instanceof Resource)?t=Resource.createIfNeeded(e).fetchJson(e):t=when.resolve(e);var i=this;this._readyPromise=t.then(function(e){return setup(i,e),i})}function setup(e,t){t=defaultValue(clone(t,!0),e._style),e._style=t,e.show=t.show,e.color=t.color,e.pointSize=t.pointSize,e.pointOutlineColor=t.pointOutlineColor,e.pointOutlineWidth=t.pointOutlineWidth,e.labelColor=t.labelColor,e.labelOutlineColor=t.labelOutlineColor,e.labelOutlineWidth=t.labelOutlineWidth,e.labelStyle=t.labelStyle,e.font=t.font,e.labelText=t.labelText,e.backgroundColor=t.backgroundColor,e.backgroundPadding=t.backgroundPadding,e.backgroundEnabled=t.backgroundEnabled,e.scaleByDistance=t.scaleByDistance,e.translucencyByDistance=t.translucencyByDistance,e.distanceDisplayCondition=t.distanceDisplayCondition,e.heightOffset=t.heightOffset,e.anchorLineEnabled=t.anchorLineEnabled,e.anchorLineColor=t.anchorLineColor,e.image=t.image,e.disableDepthTestDistance=t.disableDepthTestDistance,e.horizontalOrigin=t.horizontalOrigin,e.verticalOrigin=t.verticalOrigin,e.labelHorizontalOrigin=t.labelHorizontalOrigin,e.labelVerticalOrigin=t.labelVerticalOrigin;var i={};if(defined(t.meta)){var r=t.defines,n=defaultValue(t.meta,defaultValue.EMPTY_OBJECT);for(var a in n)n.hasOwnProperty(a)&&(i[a]=new Expression(n[a],r))}e._meta=i,e._ready=!0}function getExpression(e,t){var i=defaultValue(e._style,defaultValue.EMPTY_OBJECT).defines;if(defined(t))return"boolean"==typeof t||"number"==typeof t?new Expression(String(t)):"string"==typeof t?new Expression(t,i):defined(t.conditions)?new ConditionsExpression(t,i):t}function getJsonFromExpression(e){if(defined(e))return defined(e.expression)?e.expression:defined(e.conditionsExpression)?clone(e.conditionsExpression,!0):e}function CircleEmitter(e){e=defaultValue(e,1),this._radius=defaultValue(e,1)}function computeFlyToLocationForRectangle(t,i){var r,n=i.terrainProvider,e=i.mapProjection,a=e.ellipsoid,o=i.camera.getRectangleCameraCoordinates(t);return r=i.mode===SceneMode$1.SCENE3D?a.cartesianToCartographic(o):e.unproject(o),defined(n)?n.readyPromise.then(function(){if(!defined(n.availability)||i.mode===SceneMode$1.SCENE2D)return r;var e=[Rectangle.center(t),Rectangle.southeast(t),Rectangle.southwest(t),Rectangle.northeast(t),Rectangle.northwest(t)];return computeFlyToLocationForRectangle._sampleTerrainMostDetailed(n,e).then(function(e){var t=e.reduce(function(e,t){return Math.max(t.height,e)},-Number.MAX_VALUE),i=r;return i.height+=t,i})}):when.resolve(r)}Cesium3DTileset.prototype.trimLoadedTiles=function(){this._cache.trim()},Cesium3DTileset.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)},Cesium3DTileset.prototype.updateForPass=function(e,t){var i=t.pass;if((i!==Cesium3DTilePass$1.PRELOAD||this.preloadWhenHidden&&!this.show)&&(i!==Cesium3DTilePass$1.PRELOAD_FLIGHT||this.preloadFlightDestinations&&(this.show||this.preloadWhenHidden))&&(i!==Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK||!(!this.cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))){var r=e.commandList,n=e.camera,a=e.cullingVolume;t.ready=!1;var o=Cesium3DTilePass$1.getPassOptions(i),s=o.ignoreCommands,l=defaultValue(t.commandList,r),c=l.length;e.commandList=l,e.camera=defaultValue(t.camera,n),e.cullingVolume=defaultValue(t.cullingVolume,a);var u=this._statisticsPerPass[i];(this.show||s)&&(this._pass=i,t.ready=update$4(this,e,u,o)),s&&(l.length=c),e.commandList=r,e.camera=n,e.cullingVolume=a}},Cesium3DTileset.prototype.hasExtension=function(e){return!!defined(this._extensionsUsed)&&-1<this._extensionsUsed.indexOf(e)},Cesium3DTileset.prototype.isDestroyed=function(){return!1},Cesium3DTileset.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),defined(this._root)){var e=scratchStack$1;for(e.push(this._root);0<e.length;){var t=e.pop();t.destroy();for(var i=t.children,r=i.length,n=0;n<r;++n)e.push(i[n])}}return this._root=void 0,destroyObject(this)},defineProperties$1(ConditionsExpression.prototype,{conditionsExpression:{get:function(){return this._conditionsExpression}}}),ConditionsExpression.prototype.evaluate=function(e,t){var i=this._runtimeConditions;if(defined(i))for(var r=i.length,n=0;n<r;++n){var a=i[n];if(a.condition.evaluate(e))return a.expression.evaluate(e,t)}},ConditionsExpression.prototype.evaluateColor=function(e,t){var i=this._runtimeConditions;if(defined(i))for(var r=i.length,n=0;n<r;++n){var a=i[n];if(a.condition.evaluate(e))return a.expression.evaluateColor(e,t)}},ConditionsExpression.prototype.getShaderFunction=function(e,t,i,r){var n=this._runtimeConditions;if(defined(n)&&0!==n.length){for(var a="",o=n.length,s=0;s<o;++s){var l=n[s];a+="    "+(0===s?"if":"else if")+" ("+l.condition.getShaderExpression(t,i)+") \n    { \n        return "+l.expression.getShaderExpression(t,i)+"; \n    } \n"}return a=r+" "+e+"() \n{ \n"+a+"    return "+r+"(1.0); \n} \n"}},defineProperties$1(Cesium3DTileStyle.prototype,{style:{get:function(){return this._style}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},show:{get:function(){return this._show},set:function(e){this._show=getExpression(this,e),this._style.show=getJsonFromExpression(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=getExpression(this,e),this._style.color=getJsonFromExpression(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=getExpression(this,e),this._style.pointSize=getJsonFromExpression(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=getExpression(this,e),this._style.pointOutlineColor=getJsonFromExpression(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=getExpression(this,e),this._style.pointOutlineWidth=getJsonFromExpression(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=getExpression(this,e),this._style.labelColor=getJsonFromExpression(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=getExpression(this,e),this._style.labelOutlineColor=getJsonFromExpression(this._labelOutlineColor)}},labelOutlineWidth:{get:function(){return this._labelOutlineWidth},set:function(e){this._labelOutlineWidth=getExpression(this,e),this._style.labelOutlineWidth=getJsonFromExpression(this._labelOutlineWidth)}},font:{get:function(){return this._font},set:function(e){this._font=getExpression(this,e),this._style.font=getJsonFromExpression(this._font)}},labelStyle:{get:function(){return this._labelStyle},set:function(e){this._labelStyle=getExpression(this,e),this._style.labelStyle=getJsonFromExpression(this._labelStyle)}},labelText:{get:function(){return this._labelText},set:function(e){this._labelText=getExpression(this,e),this._style.labelText=getJsonFromExpression(this._labelText)}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=getExpression(this,e),this._style.backgroundColor=getJsonFromExpression(this._backgroundColor)}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){this._backgroundPadding=getExpression(this,e),this._style.backgroundPadding=getJsonFromExpression(this._backgroundPadding)}},backgroundEnabled:{get:function(){return this._backgroundEnabled},set:function(e){this._backgroundEnabled=getExpression(this,e),this._style.backgroundEnabled=getJsonFromExpression(this._backgroundEnabled)}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){this._scaleByDistance=getExpression(this,e),this._style.scaleByDistance=getJsonFromExpression(this._scaleByDistance)}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){this._translucencyByDistance=getExpression(this,e),this._style.translucencyByDistance=getJsonFromExpression(this._translucencyByDistance)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=getExpression(this,e),this._style.distanceDisplayCondition=getJsonFromExpression(this._distanceDisplayCondition)}},heightOffset:{get:function(){return this._heightOffset},set:function(e){this._heightOffset=getExpression(this,e),this._style.heightOffset=getJsonFromExpression(this._heightOffset)}},anchorLineEnabled:{get:function(){return this._anchorLineEnabled},set:function(e){this._anchorLineEnabled=getExpression(this,e),this._style.anchorLineEnabled=getJsonFromExpression(this._anchorLineEnabled)}},anchorLineColor:{get:function(){return this._anchorLineColor},set:function(e){this._anchorLineColor=getExpression(this,e),this._style.anchorLineColor=getJsonFromExpression(this._anchorLineColor)}},image:{get:function(){return this._image},set:function(e){this._image=getExpression(this,e),this._style.image=getJsonFromExpression(this._image)}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance=getExpression(this,e),this._style.disableDepthTestDistance=getJsonFromExpression(this._disableDepthTestDistance)}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin=getExpression(this,e),this._style.horizontalOrigin=getJsonFromExpression(this._horizontalOrigin)}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin=getExpression(this,e),this._style.verticalOrigin=getJsonFromExpression(this._verticalOrigin)}},labelHorizontalOrigin:{get:function(){return this._labelHorizontalOrigin},set:function(e){this._labelHorizontalOrigin=getExpression(this,e),this._style.labelHorizontalOrigin=getJsonFromExpression(this._labelHorizontalOrigin)}},labelVerticalOrigin:{get:function(){return this._labelVerticalOrigin},set:function(e){this._labelVerticalOrigin=getExpression(this,e),this._style.labelVerticalOrigin=getJsonFromExpression(this._labelVerticalOrigin)}},meta:{get:function(){return this._meta},set:function(e){this._meta=e}}}),Cesium3DTileStyle.prototype.getColorShaderFunction=function(e,t,i){return this._colorShaderFunctionReady?i.translucent=this._colorShaderTranslucent:(this._colorShaderFunctionReady=!0,this._colorShaderFunction=defined(this.color)?this.color.getShaderFunction(e,t,i,"vec4"):void 0,this._colorShaderTranslucent=i.translucent),this._colorShaderFunction},Cesium3DTileStyle.prototype.getShowShaderFunction=function(e,t,i){return this._showShaderFunctionReady||(this._showShaderFunctionReady=!0,this._showShaderFunction=defined(this.show)?this.show.getShaderFunction(e,t,i,"bool"):void 0),this._showShaderFunction},Cesium3DTileStyle.prototype.getPointSizeShaderFunction=function(e,t,i){return this._pointSizeShaderFunctionReady||(this._pointSizeShaderFunctionReady=!0,this._pointSizeShaderFunction=defined(this.pointSize)?this.pointSize.getShaderFunction(e,t,i,"float"):void 0),this._pointSizeShaderFunction},defineProperties$1(CircleEmitter.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}}),CircleEmitter.prototype.emit=function(e){var t=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),i=CesiumMath.randomBetween(0,this._radius),r=i*Math.cos(t),n=i*Math.sin(t);e.position=Cartesian3.fromElements(r,n,0,e.position),e.velocity=Cartesian3.clone(Cartesian3.UNIT_Z,e.velocity)},computeFlyToLocationForRectangle._sampleTerrainMostDetailed=sampleTerrainMostDetailed;var defaultAngle=CesiumMath.toRadians(30);function ConeEmitter(e){this._angle=defaultValue(e,defaultAngle)}defineProperties$1(ConeEmitter.prototype,{angle:{get:function(){return this._angle},set:function(e){this._angle=e}}}),ConeEmitter.prototype.emit=function(e){var t=Math.tan(this._angle),i=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),r=CesiumMath.randomBetween(0,t),n=r*Math.cos(i),a=r*Math.sin(i);e.velocity=Cartesian3.fromElements(n,a,1,e.velocity),Cartesian3.normalize(e.velocity,e.velocity),e.position=Cartesian3.clone(Cartesian3.ZERO,e.position)};var templateRegex=/{[^}]+}/g,tags={x:xTag,y:yTag,z:zTag,s:sTag,reverseX:reverseXTag,reverseY:reverseYTag,reverseZ:reverseZTag,westDegrees:westDegreesTag,southDegrees:southDegreesTag,eastDegrees:eastDegreesTag,northDegrees:northDegreesTag,westProjected:westProjectedTag,southProjected:southProjectedTag,eastProjected:eastProjectedTag,northProjected:northProjectedTag,width:widthTag,height:heightTag},pickFeaturesTags=combine(tags,{i:iTag,j:jTag,reverseI:reverseITag,reverseJ:reverseJTag,longitudeDegrees:longitudeDegreesTag,latitudeDegrees:latitudeDegreesTag,longitudeProjected:longitudeProjectedTag,latitudeProjected:latitudeProjectedTag,format:formatTag});function UrlTemplateImageryProvider(e){this._errorEvent=new Event,this._resource=void 0,this._urlSchemeZeroPadding=void 0,this._pickFeaturesResource=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._tags=void 0,this._pickFeaturesTags=void 0,this.enablePickFeatures=!0,this.reinitialize(e)}defineProperties$1(UrlTemplateImageryProvider.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}},ready:{get:function(){return defined(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}}),UrlTemplateImageryProvider.prototype.reinitialize=function(e){var s=this;s._readyPromise=when(e).then(function(e){var t=e.customTags,i=combine(tags,t),r=combine(pickFeaturesTags,t),n=Resource.createIfNeeded(e.url),a=Resource.createIfNeeded(e.pickFeaturesUrl);s.enablePickFeatures=defaultValue(e.enablePickFeatures,s.enablePickFeatures),s._urlSchemeZeroPadding=defaultValue(e.urlSchemeZeroPadding,s.urlSchemeZeroPadding),s._tileDiscardPolicy=e.tileDiscardPolicy,s._getFeatureInfoFormats=e.getFeatureInfoFormats,s._subdomains=e.subdomains,isArray$1(s._subdomains)?s._subdomains=s._subdomains.slice():defined(s._subdomains)&&0<s._subdomains.length?s._subdomains=s._subdomains.split(""):s._subdomains=["a","b","c"],s._tileWidth=defaultValue(e.tileWidth,256),s._tileHeight=defaultValue(e.tileHeight,256),s._minimumLevel=defaultValue(e.minimumLevel,0),s._maximumLevel=e.maximumLevel,s._tilingScheme=defaultValue(e.tilingScheme,new WebMercatorTilingScheme({ellipsoid:e.ellipsoid})),s._rectangle=defaultValue(e.rectangle,s._tilingScheme.rectangle),s._rectangle=Rectangle.intersection(s._rectangle,s._tilingScheme.rectangle),s._hasAlphaChannel=defaultValue(e.hasAlphaChannel,!0);var o=e.credit;return"string"==typeof o&&(o=new Credit(o)),s._credit=o,s._resource=n,s._tags=i,s._pickFeaturesResource=a,s._pickFeaturesTags=r,!0})},UrlTemplateImageryProvider.prototype.getTileCredits=function(e,t,i){},UrlTemplateImageryProvider.prototype.requestImage=function(e,t,i,r){return ImageryProvider.loadImage(this,buildImageResource$2(this,e,t,i,r))},UrlTemplateImageryProvider.prototype.pickFeatures=function(r,n,a,o,s){if(this.enablePickFeatures&&defined(this._pickFeaturesResource)&&0!==this._getFeatureInfoFormats.length){var l=0,c=this;return function e(){if(l>=c._getFeatureInfoFormats.length)return when([]);var t=c._getFeatureInfoFormats[l],i=buildPickFeaturesResource(c,r,n,a,o,s,t.format);return++l,"json"===t.type?i.fetchJson().then(t.callback).otherwise(e):"xml"===t.type?i.fetchXML().then(t.callback).otherwise(e):"text"===t.type||"html"===t.type?i.fetchText().then(t.callback).otherwise(e):i.fetch({responseType:t.format}).then(function(e,t){return e.callback(t)}.bind(void 0,t)).otherwise(e)}()}};var degreesScratchComputed=!1,degreesScratch=new Rectangle,projectedScratchComputed=!1,projectedScratch=new Rectangle;function buildImageResource$2(i,r,n,a,e){projectedScratchComputed=degreesScratchComputed=!1;var t=i._resource,o=t.getUrlComponent(!0),s=i._tags,l={},c=o.match(templateRegex);return defined(c)&&c.forEach(function(e){var t=e.substring(1,e.length-1);defined(s[t])&&(l[t]=s[t](i,r,n,a))}),t.getDerivedResource({request:e,templateValues:l})}var ijScratchComputed=!1,ijScratch=new Cartesian2,longitudeLatitudeProjectedScratchComputed=!1;function buildPickFeaturesResource(i,r,n,a,o,s,l){longitudeLatitudeProjectedScratchComputed=ijScratchComputed=projectedScratchComputed=degreesScratchComputed=!1;var e=i._pickFeaturesResource,t=e.getUrlComponent(!0),c=i._pickFeaturesTags,u={},d=t.match(templateRegex);return defined(d)&&d.forEach(function(e){var t=e.substring(1,e.length-1);defined(c[t])&&(u[t]=c[t](i,r,n,a,o,s,l))}),e.getDerivedResource({templateValues:u})}function padWithZerosIfNecessary(e,t,i){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){var r=e.urlSchemeZeroPadding[t];if("string"==typeof r){var n=r.length;1<n&&(i=i.length>=n?i:new Array(n-i.toString().length+1).join("0")+i)}}return i}function xTag(e,t,i,r){return padWithZerosIfNecessary(e,"{x}",t)}function reverseXTag(e,t,i,r){var n=e.tilingScheme.getNumberOfXTilesAtLevel(r)-t-1;return padWithZerosIfNecessary(e,"{reverseX}",n)}function yTag(e,t,i,r){return padWithZerosIfNecessary(e,"{y}",i)}function reverseYTag(e,t,i,r){var n=e.tilingScheme.getNumberOfYTilesAtLevel(r)-i-1;return padWithZerosIfNecessary(e,"{reverseY}",n)}function reverseZTag(e,t,i,r){var n=e.maximumLevel;return padWithZerosIfNecessary(e,"{reverseZ}",defined(n)&&r<n?n-r-1:r)}function zTag(e,t,i,r){return padWithZerosIfNecessary(e,"{z}",r)}function sTag(e,t,i,r){var n=(t+i+r)%e._subdomains.length;return e._subdomains[n]}function computeDegrees(e,t,i,r){degreesScratchComputed||(e.tilingScheme.tileXYToRectangle(t,i,r,degreesScratch),degreesScratch.west=CesiumMath.toDegrees(degreesScratch.west),degreesScratch.south=CesiumMath.toDegrees(degreesScratch.south),degreesScratch.east=CesiumMath.toDegrees(degreesScratch.east),degreesScratch.north=CesiumMath.toDegrees(degreesScratch.north),degreesScratchComputed=!0)}function westDegreesTag(e,t,i,r){return computeDegrees(e,t,i,r),degreesScratch.west}function southDegreesTag(e,t,i,r){return computeDegrees(e,t,i,r),degreesScratch.south}function eastDegreesTag(e,t,i,r){return computeDegrees(e,t,i,r),degreesScratch.east}function northDegreesTag(e,t,i,r){return computeDegrees(e,t,i,r),degreesScratch.north}function computeProjected(e,t,i,r){projectedScratchComputed||(e.tilingScheme.tileXYToNativeRectangle(t,i,r,projectedScratch),projectedScratchComputed=!0)}function westProjectedTag(e,t,i,r){return computeProjected(e,t,i,r),projectedScratch.west}function southProjectedTag(e,t,i,r){return computeProjected(e,t,i,r),projectedScratch.south}function eastProjectedTag(e,t,i,r){return computeProjected(e,t,i,r),projectedScratch.east}function northProjectedTag(e,t,i,r){return computeProjected(e,t,i,r),projectedScratch.north}function widthTag(e,t,i,r){return e.tileWidth}function heightTag(e,t,i,r){return e.tileHeight}function iTag(e,t,i,r,n,a,o){return computeIJ(e,t,i,r,n,a),ijScratch.x}function jTag(e,t,i,r,n,a,o){return computeIJ(e,t,i,r,n,a),ijScratch.y}function reverseITag(e,t,i,r,n,a,o){return computeIJ(e,t,i,r,n,a),e.tileWidth-ijScratch.x-1}function reverseJTag(e,t,i,r,n,a,o){return computeIJ(e,t,i,r,n,a),e.tileHeight-ijScratch.y-1}var rectangleScratch$6=new Rectangle,longitudeLatitudeProjectedScratch=new Cartesian3;function computeIJ(e,t,i,r,n,a,o){if(!ijScratchComputed){computeLongitudeLatitudeProjected(e,t,i,r,n,a);var s=longitudeLatitudeProjectedScratch,l=e.tilingScheme.tileXYToNativeRectangle(t,i,r,rectangleScratch$6);ijScratch.x=e.tileWidth*(s.x-l.west)/l.width|0,ijScratch.y=e.tileHeight*(l.north-s.y)/l.height|0,ijScratchComputed=!0}}function longitudeDegreesTag(e,t,i,r,n,a,o){return CesiumMath.toDegrees(n)}function latitudeDegreesTag(e,t,i,r,n,a,o){return CesiumMath.toDegrees(a)}function longitudeProjectedTag(e,t,i,r,n,a,o){return computeLongitudeLatitudeProjected(e,t,i,r,n,a),longitudeLatitudeProjectedScratch.x}function latitudeProjectedTag(e,t,i,r,n,a,o){return computeLongitudeLatitudeProjected(e,t,i,r,n,a),longitudeLatitudeProjectedScratch.y}var cartographicScratch$3=new Cartographic;function computeLongitudeLatitudeProjected(e,t,i,r,n,a,o){if(!longitudeLatitudeProjectedScratchComputed){if(e.tilingScheme.projection instanceof GeographicProjection)longitudeLatitudeProjectedScratch.x=CesiumMath.toDegrees(n),longitudeLatitudeProjectedScratch.y=CesiumMath.toDegrees(a);else{var s=cartographicScratch$3;s.longitude=n,s.latitude=a,e.tilingScheme.projection.project(s,longitudeLatitudeProjectedScratch)}longitudeLatitudeProjectedScratchComputed=!0}}function formatTag(e,t,i,r,n,a,o){return o}var defaultCredit=new Credit("MapQuest, Open Street Map and contributors, CC-BY-SA");function OpenStreetMapImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=Resource.createIfNeeded(defaultValue(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+="{z}/{x}/{y}."+defaultValue(e.fileExtension,"png");var i=new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),r=defaultValue(e.minimumLevel,0),n=e.maximumLevel,a=defaultValue(e.rectangle,i.rectangle),o=i.positionToTileXY(Rectangle.southwest(a),r),s=i.positionToTileXY(Rectangle.northeast(a),r),l=(Math.abs(s.x-o.x),Math.abs(s.y-o.y),defaultValue(e.credit,defaultCredit));"string"==typeof l&&(l=new Credit(l)),UrlTemplateImageryProvider.call(this,{url:t,credit:l,tilingScheme:i,tileWidth:256,tileHeight:256,minimumLevel:r,maximumLevel:n,rectangle:a})}function createOpenStreetMapImageryProvider(e){return deprecationWarning("createOpenStreetMapImageryProvider","createOpenStreetMapImageryProvider is deprecated and will be removed in Cesium 1.65. Please use OpenStreetMapImageryProvider instead."),new OpenStreetMapImageryProvider(e)}function createTangentSpaceDebugPrimitive(e){var t=[],i=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).geometry;defined(i.attributes)&&defined(i.primitiveType)||(i=i.constructor.createGeometry(i));var r=i.attributes,n=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),a=defaultValue(e.length,1e4);if(defined(r.normal)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"normal",a),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)},modelMatrix:n})),defined(r.tangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"tangent",a),attributes:{color:new ColorGeometryInstanceAttribute(0,1,0,1)},modelMatrix:n})),defined(r.bitangent)&&t.push(new GeometryInstance({geometry:GeometryPipeline.createLineSegmentsForVectors(i,"bitangent",a),attributes:{color:new ColorGeometryInstanceAttribute(0,0,1,1)},modelMatrix:n})),0<t.length)return new Primitive({asynchronous:!1,geometryInstances:t,appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1})})}function TileMapServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t,i=when.defer();UrlTemplateImageryProvider.call(this,i.promise),this._tmsResource=void 0,this._xmlResource=void 0,this._options=e,this._deferred=i,this._metadataError=void 0,this._metadataSuccess=this._metadataSuccess.bind(this),this._metadataFailure=this._metadataFailure.bind(this),this._requestMetadata=this._requestMetadata.bind(this);var r=this;when(e.url).then(function(e){(t=Resource.createIfNeeded(e)).appendForwardSlash(),r._tmsResource=t,r._xmlResource=t.getDerivedResource({url:"tilemapresource.xml"}),r._requestMetadata()}).otherwise(function(e){i.reject(e)})}function createTileMapServiceImageryProvider(e){return deprecationWarning("createTileMapServiceImageryProvider","createTileMapServiceImageryProvider is deprecated and will be removed in Cesium 1.65. Please use TileMapServiceImageryProvider instead."),new TileMapServiceImageryProvider(e)}function GoogleEarthEnterpriseMapsProvider(a){var e=(a=defaultValue(a,{})).url,t=defaultValue(a.path,"/default_map"),i=Resource.createIfNeeded(e).getDerivedResource({url:"/"===t[0]?t.substring(1):t});i.appendForwardSlash(),this._resource=i,this._url=e,this._path=t,this._tileDiscardPolicy=a.tileDiscardPolicy,this._channel=a.channel,this._requestType="ImageryMaps",this._credit=new Credit('<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="'+GoogleEarthEnterpriseMapsProvider.logoUrl+'" title="Google Imagery"/></a>'),this.defaultGamma=1.9,this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=a.maximumLevel,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var o,r=i.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),s=this;function n(t){var i,e,r;try{i=JSON.parse(t)}catch(e){i=JSON.parse(t.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(var n=0;n<i.layers.length;n++)if(i.layers[n].id===s._channel){e=i.layers[n];break}if(!defined(e))throw r="Could not find layer with channel (id) of "+s._channel+".",o=TileProviderError.handleError(o,s,s._errorEvent,r,void 0,void 0,void 0,c),new RuntimeError(r);if(!defined(e.version))throw r="Could not find a version in channel (id) "+s._channel+".",o=TileProviderError.handleError(o,s,s._errorEvent,r,void 0,void 0,void 0,c),new RuntimeError(r);if(s._version=e.version,defined(i.projection)&&"flat"===i.projection)s._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:a.ellipsoid});else{if(defined(i.projection)&&"mercator"!==i.projection)throw r="Unsupported projection "+i.projection+".",o=TileProviderError.handleError(o,s,s._errorEvent,r,void 0,void 0,void 0,c),new RuntimeError(r);s._tilingScheme=new WebMercatorTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:a.ellipsoid})}s._ready=!0,s._readyPromise.resolve(!0),TileProviderError.handleSuccess(o)}function l(e){var t="An error occurred while accessing "+r.url+".";o=TileProviderError.handleError(o,s,s._errorEvent,t,void 0,void 0,void 0,c),s._readyPromise.reject(new RuntimeError(t))}function c(){when(r.fetchText(),n,l)}c()}defined(Object.create)&&(OpenStreetMapImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),OpenStreetMapImageryProvider.prototype.constructor=OpenStreetMapImageryProvider),defined(Object.create)&&(TileMapServiceImageryProvider.prototype=Object.create(UrlTemplateImageryProvider.prototype),TileMapServiceImageryProvider.prototype.constructor=TileMapServiceImageryProvider),TileMapServiceImageryProvider.prototype._requestMetadata=function(){this._xmlResource.fetchXML().then(this._metadataSuccess).otherwise(this._metadataFailure)},TileMapServiceImageryProvider.prototype._metadataSuccess=function(e){for(var t,i,r,n,a=/tileformat/i,o=/tileset/i,s=/tilesets/i,l=/boundingbox/i,c=[],u=this._xmlResource,d=this._metadataError,h=this._deferred,p=this._requestMetadata,m=e.childNodes[0].childNodes,f=0;f<m.length;f++)if(a.test(m.item(f).nodeName))t=m.item(f);else if(s.test(m.item(f).nodeName)){r=m.item(f);for(var g=m.item(f).childNodes,_=0;_<g.length;_++)o.test(g.item(_).nodeName)&&c.push(g.item(_))}else l.test(m.item(f).nodeName)&&(i=m.item(f));if(!defined(r)||!defined(i))return n="Unable to find expected tilesets or bbox attributes in "+u.url+".",(d=TileProviderError.handleError(d,this,this.errorEvent,n,void 0,void 0,void 0,p)).retry||h.reject(new RuntimeError(n)),void(this._metadataError=d);var y=this._options,v=defaultValue(y.fileExtension,t.getAttribute("extension")),C=defaultValue(y.tileWidth,parseInt(t.getAttribute("width"),10)),S=defaultValue(y.tileHeight,parseInt(t.getAttribute("height"),10)),x=defaultValue(y.minimumLevel,parseInt(c[0].getAttribute("order"),10)),T=defaultValue(y.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),b=r.getAttribute("profile"),E=y.tilingScheme;if(!defined(E))if("geodetic"===b||"global-geodetic"===b)E=new GeographicTilingScheme({ellipsoid:y.ellipsoid});else{if("mercator"!==b&&"global-mercator"!==b)return n=u.url+"specifies an unsupported profile attribute, "+b+".",(d=TileProviderError.handleError(d,this,this.errorEvent,n,void 0,void 0,void 0,p)).retry||h.reject(new RuntimeError(n)),void(this._metadataError=d);E=new WebMercatorTilingScheme({ellipsoid:y.ellipsoid})}var P=Rectangle.clone(y.rectangle);if(!defined(P)){var A,w,D,M;M=defaultValue(y.flipXY,!1)?(D=new Cartesian2(parseFloat(i.getAttribute("miny")),parseFloat(i.getAttribute("minx"))),new Cartesian2(parseFloat(i.getAttribute("maxy")),parseFloat(i.getAttribute("maxx")))):(D=new Cartesian2(parseFloat(i.getAttribute("minx")),parseFloat(i.getAttribute("miny"))),new Cartesian2(parseFloat(i.getAttribute("maxx")),parseFloat(i.getAttribute("maxy"))));var I="geodetic"===b||"mercator"===b;if(E.projection instanceof GeographicProjection||I)A=Cartographic.fromDegrees(D.x,D.y),w=Cartographic.fromDegrees(M.x,M.y);else{var R=E.projection;A=R.unproject(D),w=R.unproject(M)}P=new Rectangle(A.longitude,A.latitude,w.longitude,w.latitude)}P.west<E.rectangle.west&&(P.west=E.rectangle.west),P.east>E.rectangle.east&&(P.east=E.rectangle.east),P.south<E.rectangle.south&&(P.south=E.rectangle.south),P.north>E.rectangle.north&&(P.north=E.rectangle.north);var O=E.positionToTileXY(Rectangle.southwest(P),x),L=E.positionToTileXY(Rectangle.northeast(P),x);4<(Math.abs(L.x-O.x)+1)*(Math.abs(L.y-O.y)+1)&&(x=0);var F=this._tmsResource.getDerivedResource({url:"{z}/{x}/{reverseY}."+v});h.resolve({url:F,tilingScheme:E,rectangle:P,tileWidth:C,tileHeight:S,minimumLevel:x,maximumLevel:T,tileDiscardPolicy:y.tileDiscardPolicy,credit:y.credit})},TileMapServiceImageryProvider.prototype._metadataFailure=function(e){var t=this._options,i=defaultValue(t.fileExtension,"png"),r=defaultValue(t.tileWidth,256),n=defaultValue(t.tileHeight,256),a=defaultValue(t.minimumLevel,0),o=t.maximumLevel,s=defined(t.tilingScheme)?t.tilingScheme:new WebMercatorTilingScheme({ellipsoid:t.ellipsoid}),l=defaultValue(t.rectangle,s.rectangle),c=this._tmsResource.getDerivedResource({url:"{z}/{x}/{reverseY}."+i});this._deferred.resolve({url:c,tilingScheme:s,rectangle:l,tileWidth:r,tileHeight:n,minimumLevel:a,maximumLevel:o,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit})},defineProperties$1(GoogleEarthEnterpriseMapsProvider.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),GoogleEarthEnterpriseMapsProvider.prototype.getTileCredits=function(e,t,i){},GoogleEarthEnterpriseMapsProvider.prototype.requestImage=function(e,t,i,r){var n=this._resource.getDerivedResource({url:"query",request:r,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:i+1}});return ImageryProvider.loadImage(this,n)},GoogleEarthEnterpriseMapsProvider.prototype.pickFeatures=function(e,t,i,r,n){},GoogleEarthEnterpriseMapsProvider._logoUrl=void 0,defineProperties$1(GoogleEarthEnterpriseMapsProvider,{logoUrl:{get:function(){return defined(GoogleEarthEnterpriseMapsProvider._logoUrl)||(GoogleEarthEnterpriseMapsProvider._logoUrl=buildModuleUrl("Assets/Images/google_earth_credit.png")),GoogleEarthEnterpriseMapsProvider._logoUrl},set:function(e){GoogleEarthEnterpriseMapsProvider._logoUrl=e}}});var trailingSlashRegex=/\/$/,defaultCredit$1=new Credit('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxImageryProvider(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).mapId,i=Resource.createIfNeeded(defaultValue(e.url,"https://{s}.tiles.mapbox.com/v4/")),r=MapboxApi.getAccessToken(e.accessToken);this._mapId=t,this._accessToken=r,this._accessTokenErrorCredit=Credit.clone(MapboxApi.getErrorCredit(e.accessToken));var n=defaultValue(e.format,"png");/\./.test(n)||(n="."+n),this._format=n;var a,o=i.getUrlComponent();trailingSlashRegex.test(o)||(o+="/"),o+=t+"/{z}/{x}/{y}"+this._format,i.url=o,i.setQueryParameters({access_token:r}),defined(e.credit)?"string"==typeof(a=e.credit)&&(a=new Credit(a)):a=defaultCredit$1,this._resource=i,this._imageryProvider=new UrlTemplateImageryProvider({url:i,credit:a,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function SingleTileImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var i=Resource.createIfNeeded(e.url),t=new GeographicTilingScheme({rectangle:defaultValue(e.rectangle,Rectangle.MAX_VALUE),numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=t,this._resource=i,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new Event,this._ready=!1,this._readyPromise=when.defer();var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r;var n,a=this;function o(e){a._image=e,a._tileWidth=e.width,a._tileHeight=e.height,a._ready=!0,a._readyPromise.resolve(!0),TileProviderError.handleSuccess(a._errorEvent)}function s(e){var t="Failed to load image "+i.url+".";n=TileProviderError.handleError(n,a,a._errorEvent,t,0,0,0,l,e),a._readyPromise.reject(new RuntimeError(t))}function l(){ImageryProvider.loadImage(null,i).then(o).otherwise(s)}l()}function GetFeatureInfoFormat(e,t,i){this.type=e,defined(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,defined(i)||("json"===e?i=geoJsonToFeatureInfo:"xml"===e?i=xmlToFeatureInfo:"html"===e?i=textToFeatureInfo:"text"===e&&(i=textToFeatureInfo)),this.callback=i}function geoJsonToFeatureInfo(e){for(var t=[],i=e.features,r=0;r<i.length;++r){var n=i[r],a=new ImageryLayerFeatureInfo;if(a.data=n,a.properties=n.properties,a.configureNameFromProperties(n.properties),a.configureDescriptionFromProperties(n.properties),defined(n.geometry)&&"Point"===n.geometry.type){var o=n.geometry.coordinates[0],s=n.geometry.coordinates[1];a.position=Cartographic.fromDegrees(o,s)}t.push(a)}return t}defineProperties$1(MapboxImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},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}}}),MapboxImageryProvider.prototype.getTileCredits=function(e,t,i){if(defined(this._accessTokenErrorCredit))return[this._accessTokenErrorCredit]},MapboxImageryProvider.prototype.requestImage=function(e,t,i,r){return this._imageryProvider.requestImage(e,t,i,r)},MapboxImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},MapboxImageryProvider._defaultCredit=defaultCredit$1,defineProperties$1(SingleTileImageryProvider.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),SingleTileImageryProvider.prototype.getTileCredits=function(e,t,i){},SingleTileImageryProvider.prototype.requestImage=function(e,t,i,r){return this._image},SingleTileImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){};var mapInfoMxpNamespace="http://www.mapinfo.com/mxp",esriWmsNamespace="http://www.esri.com/wms",wfsNamespace="http://www.opengis.net/wfs",gmlNamespace="http://www.opengis.net/gml";function xmlToFeatureInfo(e){var t=e.documentElement;if("MultiFeatureCollection"===t.localName&&t.namespaceURI===mapInfoMxpNamespace)return mapInfoXmlToFeatureInfo(e);if("FeatureInfoResponse"===t.localName&&t.namespaceURI===esriWmsNamespace)return esriXmlToFeatureInfo(e);if("FeatureCollection"===t.localName&&t.namespaceURI===wfsNamespace)return gmlToFeatureInfo(e);if("ServiceExceptionReport"===t.localName)throw new RuntimeError((new XMLSerializer).serializeToString(t));return"msGMLOutput"===t.localName?msGmlToFeatureInfo(e):unknownXmlToFeatureInfo(e)}function mapInfoXmlToFeatureInfo(e){for(var t=[],i=e.documentElement.getElementsByTagNameNS(mapInfoMxpNamespace,"Feature"),r=0;r<i.length;++r){for(var n=i[r],a={},o=n.getElementsByTagNameNS(mapInfoMxpNamespace,"Val"),s=0;s<o.length;++s){var l=o[s];if(l.hasAttribute("ref")){var c=l.getAttribute("ref"),u=l.textContent.trim();a[c]=u}}var d=new ImageryLayerFeatureInfo;d.data=n,d.properties=a,d.configureNameFromProperties(a),d.configureDescriptionFromProperties(a),t.push(d)}return t}function esriXmlToFeatureInfo(e){var t,i=e.documentElement,r=[],n=i.getElementsByTagNameNS("*","FIELDS");if(0<n.length)for(var a=0;a<n.length;++a){var o=n[a];t={};for(var s=o.attributes,l=0;l<s.length;++l){var c=s[l];t[c.name]=c.value}r.push(imageryLayerFeatureInfoFromDataAndProperties(o,t))}else for(var u=i.getElementsByTagNameNS("*","FeatureInfo"),d=0;d<u.length;++d){var h=u[d];t={};for(var p=h.childNodes,m=0;m<p.length;++m){var f=p[m];f.nodeType===Node.ELEMENT_NODE&&(t[f.localName]=f.textContent)}r.push(imageryLayerFeatureInfoFromDataAndProperties(h,t))}return r}function gmlToFeatureInfo(e){for(var t=[],i=e.documentElement.getElementsByTagNameNS(gmlNamespace,"featureMember"),r=0;r<i.length;++r){var n=i[r],a={};getGmlPropertiesRecursively(n,a),t.push(imageryLayerFeatureInfoFromDataAndProperties(n,a))}return t}function msGmlToFeatureInfo(e){for(var t,i=[],r=e.documentElement.childNodes,n=0;n<r.length;n++)if(r[n].nodeType===Node.ELEMENT_NODE){t=r[n];break}if(!defined(t))throw new RuntimeError("Unable to find first child of the feature info xml document");for(var a=t.childNodes,o=0;o<a.length;++o){var s=a[o];if(s.nodeType===Node.ELEMENT_NODE){var l={};getGmlPropertiesRecursively(s,l),i.push(imageryLayerFeatureInfoFromDataAndProperties(s,l))}}return i}function getGmlPropertiesRecursively(e,t){for(var i=!0,r=0;r<e.childNodes.length;++r){var n=e.childNodes[r];n.nodeType===Node.ELEMENT_NODE&&(i=!1),"Point"!==n.localName&&"LineString"!==n.localName&&"Polygon"!==n.localName&&"boundedBy"!==n.localName&&n.hasChildNodes()&&getGmlPropertiesRecursively(n,t)&&(t[n.localName]=n.textContent)}return i}function imageryLayerFeatureInfoFromDataAndProperties(e,t){var i=new ImageryLayerFeatureInfo;return i.data=e,i.properties=t,i.configureNameFromProperties(t),i.configureDescriptionFromProperties(t),i}function unknownXmlToFeatureInfo(e){var t=(new XMLSerializer).serializeToString(e),i=document.createElement("div"),r=document.createElement("pre");r.textContent=t,i.appendChild(r);var n=new ImageryLayerFeatureInfo;return n.data=e,n.description=i.innerHTML,[n]}var emptyBodyRegex=/<body>\s*<\/body>/im,wmsServiceExceptionReportRegex=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,titleRegex=/<title>([\s\S]*)<\/title>/im;function textToFeatureInfo(e){if(!emptyBodyRegex.test(e)&&!wmsServiceExceptionReportRegex.test(e)){var t,i=titleRegex.exec(e);i&&1<i.length&&(t=i[1]);var r=new ImageryLayerFeatureInfo;return r.name=t,r.description=e,r.data=e,[r]}}function TimeDynamicImagery(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tileCache={},this._tilesRequestedForInterval=[];var 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)}function getKey$1(e,t,i){return e+"-"+t+"-"+i}function getKeyElements(e){var t=e.split("-");if(3===t.length)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function getApproachingInterval(e){var t=e._times;if(defined(t)){var i=e._clock,r=i.currentTime,n=i.canAnimate&&i.shouldAnimate,a=i.multiplier;if(n||0===a){var o,s=t.indexOf(r);if(!(s<0)){var l=t.get(s);return 0<a?(o=JulianDate.secondsDifference(l.stop,r),++s):(o=JulianDate.secondsDifference(l.start,r),--s),o/=a,0<=s&&o<=5?t.get(s):void 0}}}}function addToCache(e,t,i){var r=e._times.indexOf(i.start),n=e._tileCache,a=n[r];defined(a)||(a=n[r]={});var o=t.key;if(defined(a[o]))return!0;var s=getKeyElements(o),l=new Request({throttle:!0,throttleByServer:!0,type:RequestType$1.IMAGERY,priorityFunction:t.priorityFunction}),c=e._requestImageFunction(s.x,s.y,s.level,l,i);return!!defined(c)&&(a[o]={promise:c,request:l},!0)}function WebMapServiceImageryProvider(e){if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).times)&&!defined(e.clock))throw new DeveloperError("options.times was specified, so options.clock is required.");var t=Resource.createIfNeeded(e.url),i=t.clone();t.setQueryParameters(WebMapServiceImageryProvider.DefaultParameters,!0),i.setQueryParameters(WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters,!0),defined(e.parameters)&&t.setQueryParameters(objectToLowercase(e.parameters)),defined(e.getFeatureInfoParameters)&&i.setQueryParameters(objectToLowercase(e.getFeatureInfoParameters));var a=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,i,r,n){return requestImage(a,e,t,i,r,n)},reloadFunction:function(){defined(a._reload)&&a._reload()}}));var r={};r.layers=e.layers,r.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",r.width="{width}",r.height="{height}",1.3<=parseFloat(t.queryParameters.version)?r.crs=defaultValue(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"CRS:84"):r.srs=defaultValue(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof WebMercatorProjection?"EPSG:3857":"EPSG:4326"),t.setQueryParameters(r,!0),i.setQueryParameters(r,!0);var n={query_layers:e.layers,x:"{i}",y:"{j}",info_format:"{format}"};i.setQueryParameters(n,!0),this._resource=t,this._pickFeaturesResource=i,this._layers=e.layers,this._tileProvider=new UrlTemplateImageryProvider({url:t,pickFeaturesUrl:i,tilingScheme:defaultValue(e.tilingScheme,new GeographicTilingScheme({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:defaultValue(e.getFeatureInfoFormats,WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function requestImage(e,t,i,r,n,a){var o=defined(a)?a.data:void 0,s=e._tileProvider;return defined(o)&&s._resource.setQueryParameters(o),s.requestImage(t,i,r,n)}function pickFeatures(e,t,i,r,n,a,o){var s=defined(o)?o.data:void 0,l=e._tileProvider;return defined(s)&&l._pickFeaturesResource.setQueryParameters(s),l.pickFeatures(t,i,r,n,a)}function objectToLowercase(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i.toLowerCase()]=e[i]);return t}defineProperties$1(TimeDynamicImagery.prototype,{clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}}),TimeDynamicImagery.prototype.getFromCache=function(e,t,i,r){var n,a=getKey$1(e,t,i),o=this._tileCache[this._currentIntervalIndex];if(defined(o)&&defined(o[a])){var s=o[a];n=s.promise.otherwise(function(e){throw r.state=s.request.state,e}),delete o[a]}return n},TimeDynamicImagery.prototype.checkApproachingInterval=function(e,t,i,r){var n=getKey$1(e,t,i),a=this._tilesRequestedForInterval,o=getApproachingInterval(this),s={key:n,priorityFunction:r.priorityFunction};defined(o)&&addToCache(this,s,o)||a.push(s),512<=a.length&&a.splice(0,256)},TimeDynamicImagery.prototype._clockOnTick=function(e){var t=e.currentTime,i=this._times.indexOf(t),r=this._currentIntervalIndex;if(i!==r){var n=this._tileCache[r];for(var a in n)n.hasOwnProperty(a)&&n[a].request.cancel();return delete this._tileCache[r],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,void this._reloadFunction()}var o=getApproachingInterval(this);if(defined(o))for(var s=this._tilesRequestedForInterval,l=!0;l&&0!==s.length;){var c=s.pop();(l=addToCache(this,c,o))||s.push(c)}},defineProperties$1(WebMapServiceImageryProvider.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}},ready:{get:function(){return this._tileProvider.ready}},readyPromise:{get:function(){return this._tileProvider.readyPromise}},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}}}),WebMapServiceImageryProvider.prototype.getTileCredits=function(e,t,i){return this._tileProvider.getTileCredits(e,t,i)},WebMapServiceImageryProvider.prototype.requestImage=function(e,t,i,r){var n,a,o=this._timeDynamicImagery;return defined(o)&&(a=o.currentInterval,n=o.getFromCache(e,t,i,r)),defined(n)||(n=requestImage(this,e,t,i,r,a)),defined(n)&&defined(o)&&o.checkApproachingInterval(e,t,i,r),n},WebMapServiceImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){var a=this._timeDynamicImagery;return pickFeatures(this,e,t,i,r,n,defined(a)?a.currentInterval:void 0)},WebMapServiceImageryProvider.DefaultParameters=freezeObject$1({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"}),WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters=freezeObject$1({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"}),WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats=freezeObject$1([freezeObject$1(new GetFeatureInfoFormat("json","application/json")),freezeObject$1(new GetFeatureInfoFormat("xml","text/xml")),freezeObject$1(new GetFeatureInfoFormat("text","text/html"))]);var defaultParameters=freezeObject$1({service:"WMTS",version:"1.0.0",request:"GetTile"});function WebMapTileServiceImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=Resource.createIfNeeded(e.url),i=e.style,r=e.tileMatrixSetID;if(0<=t.url.indexOf("{")){var n={style:i,Style:i,TileMatrixSet:r};t.setTemplateValues(n),this._useKvp=!1}else t.setQueryParameters(defaultParameters),this._useKvp=!0;this._resource=t,this._layer=e.layer,this._style=i,this._tileMatrixSetID=r,this._tileMatrixLabels=e.tileMatrixLabels,this._format=defaultValue(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new WebMercatorTilingScheme({ellipsoid:e.ellipsoid}),this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._minimumLevel=defaultValue(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=defaultValue(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;var a=this;this._reload=void 0,defined(e.times)&&(this._timeDynamicImagery=new TimeDynamicImagery({clock:e.clock,times:e.times,requestImageFunction:function(e,t,i,r,n){return requestImage$1(a,e,t,i,r,n)},reloadFunction:function(){defined(a._reload)&&a._reload()}})),this._readyPromise=when.resolve(!0);var o=this._tilingScheme.positionToTileXY(Rectangle.southwest(this._rectangle),this._minimumLevel),s=this._tilingScheme.positionToTileXY(Rectangle.northeast(this._rectangle),this._minimumLevel);Math.abs(s.x-o.x),Math.abs(s.y-o.y);this._errorEvent=new Event;var l=e.credit;this._credit="string"==typeof l?new Credit(l):l,this._subdomains=e.subdomains,isArray$1(this._subdomains)?this._subdomains=this._subdomains.slice():defined(this._subdomains)&&0<this._subdomains.length?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function requestImage$1(e,t,i,r,n,a){var o,s=e._tileMatrixLabels,l=defined(s)?s[r]:r.toString(),c=e._subdomains,u=e._dimensions,d=defined(a)?a.data:void 0;if(e._useKvp){var h={};h.tilematrix=l,h.layer=e._layer,h.style=e._style,h.tilerow=i,h.tilecol=t,h.tilematrixset=e._tileMatrixSetID,h.format=e._format,defined(u)&&(h=combine(h,u)),defined(d)&&(h=combine(h,d)),o=e._resource.getDerivedResource({queryParameters:h,request:n})}else{var p={TileMatrix:l,TileRow:i.toString(),TileCol:t.toString(),s:c[(t+i+r)%c.length]};(o=e._resource.getDerivedResource({request:n})).setTemplateValues(p),defined(u)&&o.setTemplateValues(u),defined(d)&&o.setTemplateValues(d)}return ImageryProvider.loadImage(e,o)}function createFactory(t){return function(e){return new t(e)}}defineProperties$1(WebMapTileServiceImageryProvider.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}},ready:{value:!0},readyPromise:{get:function(){return this._readyPromise}},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,defined(this._reload)&&this._reload())}}}),WebMapTileServiceImageryProvider.prototype.getTileCredits=function(e,t,i){},WebMapTileServiceImageryProvider.prototype.requestImage=function(e,t,i,r){var n,a,o=this._timeDynamicImagery;return defined(o)&&(a=o.currentInterval,n=o.getFromCache(e,t,i,r)),defined(n)||(n=requestImage$1(this,e,t,i,r,a)),defined(n)&&defined(o)&&o.checkApproachingInterval(e,t,i,r),n},WebMapTileServiceImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){};var ImageryProviderMapping={ARCGIS_MAPSERVER:createFactory(ArcGisMapServerImageryProvider),BING:createFactory(BingMapsImageryProvider),GOOGLE_EARTH:createFactory(GoogleEarthEnterpriseMapsProvider),MAPBOX:createFactory(MapboxImageryProvider),SINGLE_TILE:createFactory(SingleTileImageryProvider),TMS:createFactory(TileMapServiceImageryProvider),URL_TEMPLATE:createFactory(UrlTemplateImageryProvider),WMS:createFactory(WebMapServiceImageryProvider),WMTS:createFactory(WebMapTileServiceImageryProvider)};function IonImageryProvider(e){var n=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).assetId;this.defaultAlpha=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._ready=!1,this._tileCredits=void 0,this._errorEvent=new Event;var a=this,o=IonResource._createEndpointResource(n,e),t=e.assetId.toString()+e.accessToken+e.server,i=IonImageryProvider._endpointCache[t];defined(i)||(i=o.fetchJson(),IonImageryProvider._endpointCache[t]=i),this._readyPromise=i.then(function(e){if("IMAGERY"!==e.type)return when.reject(new RuntimeError("Cesium ion asset "+n+" is not an imagery asset."));var t,i=e.externalType;if(defined(i)){var r=ImageryProviderMapping[i];if(!defined(r))return when.reject(new RuntimeError("Unrecognized Cesium ion imagery type: "+i));t=r(e.options)}else t=new TileMapServiceImageryProvider({url:new IonResource(e,o)});return a._tileCredits=IonResource.getCreditsFromEndpoint(e,o),t.errorEvent.addEventListener(function(e){(e.provider=a)._errorEvent.raiseEvent(e)}),(a._imageryProvider=t).readyPromise.then(function(){return a._ready=!0})})}defineProperties$1(IonImageryProvider.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},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}}}),IonImageryProvider.prototype.getTileCredits=function(e,t,i){var r=this._imageryProvider.getTileCredits(e,t,i);return defined(r)?this._tileCredits.concat(r):this._tileCredits},IonImageryProvider.prototype.requestImage=function(e,t,i,r){return this._imageryProvider.requestImage(e,t,i,r)},IonImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},IonImageryProvider._endpointCache={};var IonWorldImageryStyle={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},IonWorldImageryStyle$1=freezeObject$1(IonWorldImageryStyle);function createWorldImagery(e){return new IonImageryProvider({assetId:defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).style,IonWorldImageryStyle$1.AERIAL)})}var mobileWidth=576,lightboxHeight=100,textColor="#ffffff",highlightColor="#48b";function contains$1(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];if(Credit.equals(n,t))return!0}return!1}function swapCesiumCredit(e){var t=e._previousCesiumCredit,i=e._currentCesiumCredit;Credit.equals(i,t)||(defined(t)&&e._cesiumCreditContainer.removeChild(t.element),defined(i)&&e._cesiumCreditContainer.appendChild(i.element),e._previousCesiumCredit=i)}var delimiterClassName="cesium-credit-delimiter",defaultCredit$2;function createDelimiterElement(e){var t=document.createElement("span");return t.textContent=e,t.className=delimiterClassName,t}function createCreditElement(e,t){if(defined(t)){var i=document.createElement(t);i._creditId=e._creditId,i.appendChild(e),e=i}return e}function displayCredits(e,t,i,r){for(var n=e.childNodes,a=-1,o=0;o<t.length;++o){var s=t[o];if(defined(s)){if(a=o,defined(i)&&(a*=2,0<o)){var l=a-1;if(n.length<=l)e.appendChild(createDelimiterElement(i));else{var c=n[l];c.className!==delimiterClassName&&e.replaceChild(createDelimiterElement(i),c)}}var u=s.element;if(n.length<=a)e.appendChild(createCreditElement(u,r));else{var d=n[a];d._creditId!==s._id&&e.replaceChild(createCreditElement(u,r),d)}}}for(++a;a<n.length;)e.removeChild(n[a])}function styleLightboxContainer(e){var t=e._lightboxCredits,i=e.viewport.clientWidth,r=e.viewport.clientHeight;i!==e._lastViewportWidth&&(i<mobileWidth?(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(.5*(r-t.clientHeight))+"px"),e._lastViewportWidth=i),mobileWidth<=i&&r!==e._lastViewportHeight&&(t.style.marginTop=Math.floor(.5*(r-t.clientHeight))+"px",e._lastViewportHeight=r)}function addStyle(e,t){var i=e+" {";for(var r in t)t.hasOwnProperty(r)&&(i+=r+": "+t[r]+"; ");return i+=" }\n"}function appendCss(){var e="";e+=addStyle(".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)"}),e+=addStyle(".cesium-credit-lightbox",{"background-color":"#303336",color:textColor,position:"relative","min-height":lightboxHeight+"px",margin:"auto"}),e+=addStyle(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:textColor}),e+=addStyle(".cesium-credit-lightbox > ul > li a:hover",{color:highlightColor}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=addStyle(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=addStyle(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:textColor}),e+=addStyle(".cesium-credit-lightbox-close:hover",{color:highlightColor}),e+=addStyle(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=addStyle(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=addStyle(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=addStyle(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:textColor}),e+=addStyle(".cesium-credit-expand-link:hover",{color:highlightColor}),e+=addStyle(".cesium-credit-text",{color:textColor}),e+=addStyle(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});var t=document.head,i=document.createElement("style");i.innerHTML=e,t.insertBefore(i,t.firstChild)}function CreditDisplay(e,t,i){var r=this;i=defaultValue(i,document.body);var n=document.createElement("div");n.className="cesium-credit-lightbox-overlay",i.appendChild(n);var a=document.createElement("div");function o(e){a.contains(e.target)||r.hideLightbox()}a.className="cesium-credit-lightbox",n.appendChild(a),n.addEventListener("click",o,!1);var s=document.createElement("div");s.className="cesium-credit-lightbox-title",s.textContent="Data provided by:",a.appendChild(s);var l=document.createElement("a");l.onclick=this.hideLightbox.bind(this),l.innerHTML="&times;",l.className="cesium-credit-lightbox-close",a.appendChild(l);var c=document.createElement("ul");a.appendChild(c);var u=document.createElement("div");u.className="cesium-credit-logoContainer",u.style.display="inline",e.appendChild(u);var d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);var h=document.createElement("a");h.className="cesium-credit-expand-link",h.onclick=this.showLightbox.bind(this),h.textContent="Data attribution",e.appendChild(h),appendCss();var p=Credit.clone(CreditDisplay.cesiumCredit);this._delimiter=defaultValue(t," • "),this._screenContainer=d,this._cesiumCreditContainer=u,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=a,this._creditList=c,this._lightbox=n,this._hideLightbox=o,this._expandLink=h,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=p,this._previousCesiumCredit=void 0,this._currentCesiumCredit=p,this._currentFrameCredits={screenCredits:new AssociativeArray,lightboxCredits:new AssociativeArray},this._defaultCredit=void 0,this.viewport=i,this.container=e}function getDefaultCredit(){if(!defined(defaultCredit$2)){var e=buildModuleUrl("Assets/Images/ion-credit.png");defaultCredit$2=new Credit('<a href="https://cesium.com/" target="_blank"><img src="'+e+'" title="Cesium ion"/></a>',!0)}return CreditDisplay._cesiumCreditInitialized||(CreditDisplay._cesiumCredit=defaultCredit$2,CreditDisplay._cesiumCreditInitialized=!0),defaultCredit$2}function DebugAppearance(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).attributeName,i=e.perInstanceAttribute;defined(i)||(i=!1);var r,n=defaultValue(e.glslDatatype,"vec3"),a="v_"+t;if("normal"===t||"tangent"===t||"bitangent"===t)r="vec4 getColor() { return vec4(("+a+" + vec3(1.0)) * 0.5, 1.0); }\n";else switch("st"===t&&(n="vec2"),n){case"float":r="vec4 getColor() { return vec4(vec3("+a+"), 1.0); }\n";break;case"vec2":r="vec4 getColor() { return vec4("+a+", 0.0, 1.0); }\n";break;case"vec3":r="vec4 getColor() { return vec4("+a+", 1.0); }\n";break;case"vec4":r="vec4 getColor() { return "+a+"; }\n"}var o="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n"+(i?"":"attribute "+n+" "+t+";\n")+"varying "+n+" "+a+";\nvoid main()\n{\nvec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);\n"+(i?a+" = czm_batchTable_"+t+"(batchId);\n":a+" = "+t+";\n")+"gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}",s="varying "+n+" "+a+";\n"+r+"\nvoid main()\n{\ngl_FragColor = getColor();\n}";this.material=void 0,this.translucent=defaultValue(e.translucent,!1),this._vertexShaderSource=defaultValue(e.vertexShaderSource,o),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,s),this._renderState=Appearance.getDefaultRenderState(!1,!1,e.renderState),this._closed=defaultValue(e.closed,!1),this._attributeName=t,this._glslDatatype=n}function DebugCameraPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._camera=e.camera,this._color=defaultValue(e.color,Color.CYAN),this._updateOnChange=defaultValue(e.updateOnChange,!0),this.show=defaultValue(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}CreditDisplay.prototype.addCredit=function(e){if(e._isIon)return defined(this._defaultCredit)||(this._defaultCredit=Credit.clone(getDefaultCredit())),void(this._currentCesiumCredit=this._defaultCredit);e.showOnScreen?this._currentFrameCredits.screenCredits.set(e.id,e):this._currentFrameCredits.lightboxCredits.set(e.id,e)},CreditDisplay.prototype.addDefaultCredit=function(e){var t=this._defaultCredits;contains$1(t,e)||t.push(e)},CreditDisplay.prototype.removeDefaultCredit=function(e){var t=this._defaultCredits,i=t.indexOf(e);-1!==i&&t.splice(i,1)},CreditDisplay.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0},CreditDisplay.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1},CreditDisplay.prototype.update=function(){this._expanded&&styleLightboxContainer(this)},CreditDisplay.prototype.beginFrame=function(){var e=this._currentFrameCredits,t=e.screenCredits;t.removeAll();for(var i=this._defaultCredits,r=0;r<i.length;++r){var n=i[r];t.set(n.id,n)}e.lightboxCredits.removeAll(),Credit.equals(CreditDisplay.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Credit.clone(CreditDisplay.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit},CreditDisplay.prototype.endFrame=function(){var e=this._currentFrameCredits.screenCredits.values;displayCredits(this._screenContainer,e,this._delimiter,void 0);var t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=0<t.length?"inline":"none",displayCredits(this._creditList,t,void 0,"li"),swapCesiumCredit(this)},CreditDisplay.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),destroyObject(this)},CreditDisplay.prototype.isDestroyed=function(){return!1},CreditDisplay._cesiumCredit=void 0,CreditDisplay._cesiumCreditInitialized=!1,defineProperties$1(CreditDisplay,{cesiumCredit:{get:function(){return getDefaultCredit(),CreditDisplay._cesiumCredit},set:function(e){CreditDisplay._cesiumCredit=e,CreditDisplay._cesiumCreditInitialized=!0}}}),defineProperties$1(DebugAppearance.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}},attributeName:{get:function(){return this._attributeName}},glslDatatype:{get:function(){return this._glslDatatype}}}),DebugAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,DebugAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,DebugAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;var scratchRight$1=new Cartesian3,scratchRotation$1=new Matrix3,scratchOrientation=new Quaternion,scratchPerspective=new PerspectiveFrustum,scratchPerspectiveOffCenter=new PerspectiveOffCenterFrustum,scratchOrthographic=new OrthographicFrustum,scratchOrthographicOffCenter=new OrthographicOffCenterFrustum,scratchColor$k=new Color,scratchSplits=[1,1e5];function DebugModelMatrixPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.length=defaultValue(e.length,1e7),this._length=void 0,this.width=defaultValue(e.width,2),this._width=void 0,this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this.id=e.id,this._id=void 0,this._primitive=void 0}DebugCameraPrimitive.prototype.update=function(e){if(this.show){var t,i,r=this._planesPrimitives,n=this._outlinePrimitives;if(this._updateOnChange){for(i=r.length,t=0;t<i;++t)n[t]=n[t]&&n[t].destroy(),r[t]=r[t]&&r[t].destroy();r.length=0,n.length=0}if(0===r.length){var a,o=this._camera,s=o.frustum;a=s instanceof PerspectiveFrustum?scratchPerspective:s instanceof PerspectiveOffCenterFrustum?scratchPerspectiveOffCenter:s instanceof OrthographicFrustum?scratchOrthographic:scratchOrthographicOffCenter,a=s.clone(a);var l=e.frustumSplits,c=l.length-1;c<=0&&((l=scratchSplits)[0]=this._camera.frustum.near,l[1]=this._camera.frustum.far,c=1);var u=o.positionWC,d=o.directionWC,h=o.upWC,p=o.rightWC;p=Cartesian3.negate(p,scratchRight$1);var m=scratchRotation$1;Matrix3.setColumn(m,0,p,m),Matrix3.setColumn(m,1,h,m),Matrix3.setColumn(m,2,d,m);var f=Quaternion.fromRotationMatrix(m,scratchOrientation);for(r.length=n.length=c,t=0;t<c;++t)a.near=l[t],a.far=l[t+1],r[t]=new Primitive({geometryInstances:new GeometryInstance({geometry:new FrustumGeometry({origin:u,orientation:f,frustum:a,_drawNearPlane:0===t}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(Color.fromAlpha(this._color,.1,scratchColor$k))},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!0,flat:!0}),asynchronous:!1}),n[t]=new Primitive({geometryInstances:new GeometryInstance({geometry:new FrustumOutlineGeometry({origin:u,orientation:f,frustum:a,_drawNearPlane:0===t}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}for(i=r.length,t=0;t<i;++t)n[t].update(e),r[t].update(e)}},DebugCameraPrimitive.prototype.isDestroyed=function(){return!1},DebugCameraPrimitive.prototype.destroy=function(){for(var e=this._planesPrimitives.length,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 destroyObject(this)},DebugModelMatrixPrimitive.prototype.update=function(e){if(this.show){if(!defined(this._primitive)||!Matrix4.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=Matrix4.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,defined(this._primitive)&&this._primitive.destroy(),0===this.modelMatrix[12]&&0===this.modelMatrix[13]&&0===this.modelMatrix[14]&&(this.modelMatrix[14]=.01);var t=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_X],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.RED,Color.RED],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),i=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Y],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.GREEN,Color.GREEN],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this}),r=new GeometryInstance({geometry:new PolylineGeometry({positions:[Cartesian3.ZERO,Cartesian3.UNIT_Z],width:this.width,vertexFormat:PolylineColorAppearance.VERTEX_FORMAT,colors:[Color.BLUE,Color.BLUE],arcType:ArcType$1.NONE}),modelMatrix:Matrix4.multiplyByUniformScale(this.modelMatrix,this.length,new Matrix4),id:this.id,pickPrimitive:this});this._primitive=new Primitive({geometryInstances:[t,i,r],appearance:new PolylineColorAppearance,asynchronous:!1})}this._primitive.update(e)}},DebugModelMatrixPrimitive.prototype.isDestroyed=function(){return!1},DebugModelMatrixPrimitive.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),destroyObject(this)};var DepthPlaneFS="varying vec4 positionEC;\nvoid main()\n{\nvec3 direction = normalize(positionEC.xyz);\nczm_ray ray = czm_ray(vec3(0.0), direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nif (!czm_isEmpty(intersection))\n{\ngl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\nelse\n{\ndiscard;\n}\nczm_writeLogDepth();\n}\n",DepthPlaneVS="attribute vec4 position;\nvarying vec4 positionEC;\nvoid main()\n{\npositionEC = czm_modelView * position;\ngl_Position = czm_projection * positionEC;\nczm_vertexLogDepth();\n}\n";function DepthPlane(){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1}var depthQuadScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(12):[],scratchCartesian1$7=new Cartesian3,scratchCartesian2$a=new Cartesian3,scratchCartesian3$d=new Cartesian3,scratchCartesian4$5=new Cartesian3;function computeDepthQuad(e,t){var i=e.radii,r=t.camera.positionWC,n=Cartesian3.multiplyComponents(e.oneOverRadii,r,scratchCartesian1$7),a=Cartesian3.magnitude(n),o=Cartesian3.normalize(n,scratchCartesian2$a),s=Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z,n,scratchCartesian3$d),scratchCartesian3$d),l=Cartesian3.normalize(Cartesian3.cross(o,s,scratchCartesian4$5),scratchCartesian4$5),c=Math.sqrt(Cartesian3.magnitudeSquared(n)-1),u=Cartesian3.multiplyByScalar(o,1/a,scratchCartesian1$7),d=c/a,h=Cartesian3.multiplyByScalar(s,d,scratchCartesian2$a),p=Cartesian3.multiplyByScalar(l,d,scratchCartesian3$d),m=Cartesian3.add(u,p,scratchCartesian4$5);Cartesian3.subtract(m,h,m),Cartesian3.multiplyComponents(i,m,m),Cartesian3.pack(m,depthQuadScratch,0);var f=Cartesian3.subtract(u,p,scratchCartesian4$5);Cartesian3.subtract(f,h,f),Cartesian3.multiplyComponents(i,f,f),Cartesian3.pack(f,depthQuadScratch,3);var g=Cartesian3.add(u,p,scratchCartesian4$5);Cartesian3.add(g,h,g),Cartesian3.multiplyComponents(i,g,g),Cartesian3.pack(g,depthQuadScratch,6);var _=Cartesian3.subtract(u,p,scratchCartesian4$5);return Cartesian3.add(_,h,_),Cartesian3.multiplyComponents(i,_,_),Cartesian3.pack(_,depthQuadScratch,9),depthQuadScratch}function DerivedCommand(){}DepthPlane.prototype.update=function(e){if(this._mode=e.mode,e.mode===SceneMode$1.SCENE3D){var t=e.context,i=e.mapProjection.ellipsoid,r=e.useLogDepth;if(defined(this._command)||(this._rs=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new DrawCommand({renderState:this._rs,boundingVolume:new BoundingSphere(Cartesian3.ZERO,i.maximumRadius),pass:Pass$1.OPAQUE,owner:this})),!defined(this._sp)||this._useLogDepth!==r){this._useLogDepth=r;var n=new ShaderSource({sources:[DepthPlaneVS]}),a=new ShaderSource({sources:[DepthPlaneFS]});if(r){a.sources.push("#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n"),a.defines.push("LOG_DEPTH"),n.defines.push("LOG_DEPTH"),n.defines.push("DISABLE_GL_POSITION_LOG_DEPTH")}this._sp=ShaderProgram.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}var o=computeDepthQuad(i,e);if(defined(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(o);else{var s=new Geometry({attributes:{position:new GeometryAttribute({componentDatatype:ComponentDatatype$1.FLOAT,componentsPerAttribute:3,values:o})},indices:[0,1,2,2,1,3],primitiveType:PrimitiveType$1.TRIANGLES});this._va=VertexArray.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:BufferUsage$1.DYNAMIC_DRAW}),this._command.vertexArray=this._va}}},DepthPlane.prototype.execute=function(e,t){this._mode===SceneMode$1.SCENE3D&&this._command.execute(e,t)},DepthPlane.prototype.isDestroyed=function(){return!1},DepthPlane.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};var fragDepthRegex=/\bgl_FragDepthEXT\b/,discardRegex=/\bdiscard\b/;function getDepthOnlyShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!defined(i)){var r,n=t._attributeLocations,a=t.fragmentShaderSource,o=!1,s=a.sources,l=s.length;for(r=0;r<l;++r)if(fragDepthRegex.test(s[r])||discardRegex.test(s[r])){o=!0;break}var c=!1,u=a.defines;for(l=u.length,r=0;r<l;++r)if("LOG_DEPTH"===u[r]){c=!0;break}o||c?!o&&c&&(a=new ShaderSource({defines:["LOG_DEPTH"],sources:["#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\nvoid main() \n{ \n    gl_FragColor = vec4(1.0); \n    czm_writeLogDepth(); \n} \n"]})):a=new ShaderSource({sources:["void main() \n{ \n    gl_FragColor = vec4(1.0); \n} \n"]}),i=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:n})}return i}function getDepthOnlyRenderState(e,t){var i=e._depthOnlyRenderStateCache,r=i[t.id];if(!defined(r)){var n=RenderState.getState(t);n.depthMask=!0,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},r=RenderState.fromCache(n),i[t.id]=r}return r}DerivedCommand.createDepthOnlyDerivedCommand=function(e,t,i,r){var n,a;return defined(r)||(r={}),defined(r.depthOnlyCommand)&&(n=r.depthOnlyCommand.shaderProgram,a=r.depthOnlyCommand.renderState),r.depthOnlyCommand=DrawCommand.shallowClone(t,r.depthOnlyCommand),defined(n)&&r.shaderProgramId===t.shaderProgram.id?(r.depthOnlyCommand.shaderProgram=n,r.depthOnlyCommand.renderState=a):(r.depthOnlyCommand.shaderProgram=getDepthOnlyShaderProgram(i,t.shaderProgram),r.depthOnlyCommand.renderState=getDepthOnlyRenderState(e,t.renderState),r.shaderProgramId=t.shaderProgram.id),r};var writeLogDepthRegex=/\s+czm_writeLogDepth\(/,vertexlogDepthRegex=/\s+czm_vertexLogDepth\(/,extensionRegex=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function getLogDepthShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!defined(i)){var r,n=t._attributeLocations,a=t.vertexShaderSource.clone(),o=t.fragmentShaderSource.clone();a.defines=defined(a.defines)?a.defines.slice(0):[],a.defines.push("LOG_DEPTH"),o.defines=defined(o.defines)?o.defines.slice(0):[],o.defines.push("LOG_DEPTH");var s=!1,l=a.sources,c=l.length;for(r=0;r<c;++r)if(vertexlogDepthRegex.test(l[r])){s=!0;break}if(!s){for(r=0;r<c;++r)l[r]=ShaderSource.replaceMain(l[r],"czm_log_depth_main");"\n\nvoid main() \n{ \n    czm_log_depth_main(); \n    czm_vertexLogDepth(); \n} \n",l.push("\n\nvoid main() \n{ \n    czm_log_depth_main(); \n    czm_vertexLogDepth(); \n} \n")}var u=!0;for(s=!1,c=(l=o.sources).length,r=0;r<c;++r)writeLogDepthRegex.test(l[r])&&(s=!0),extensionRegex.test(l[r])&&(u=!1);var d="";if(u&&(d+="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n"),!s){for(r=0;r<c;r++)l[r]=ShaderSource.replaceMain(l[r],"czm_log_depth_main");d+="\nvoid main() \n{ \n    czm_log_depth_main(); \n    czm_writeLogDepth(); \n} \n"}l.push(d),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:a,fragmentShaderSource:o,attributeLocations:n})}return i}function getPickShaderProgram(e,t,i){var r=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!defined(r)){for(var n=t._attributeLocations,a=t.fragmentShaderSource,o=a.sources,s=o.length,l="void main() \n{ \n    czm_non_pick_main(); \n    if (gl_FragColor.a == 0.0) { \n        discard; \n    } \n    gl_FragColor = "+i+"; \n} \n",c=new Array(s+1),u=0;u<s;++u)c[u]=ShaderSource.replaceMain(o[u],"czm_non_pick_main");c[s]=l,a=new ShaderSource({sources:c,defines:a.defines}),r=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:n})}return r}function getPickRenderState(e,t){var i=e.picking.pickRenderStateCache,r=i[t.id];if(!defined(r)){var n=RenderState.getState(t);n.blending.enabled=!1,n.depthMask=!0,r=RenderState.fromCache(n),i[t.id]=r}return r}function getHdrShaderProgram(e,t){var i=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!defined(i)){var r=t._attributeLocations,n=t.vertexShaderSource.clone(),a=t.fragmentShaderSource.clone();n.defines=defined(n.defines)?n.defines.slice(0):[],n.defines.push("HDR"),a.defines=defined(a.defines)?a.defines.slice(0):[],a.defines.push("HDR"),i=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:r})}return i}function DeviceOrientationCameraController(e){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;var i=this;function t(e){var t=e.alpha;if(!defined(t))return i._alpha=void 0,i._beta=void 0,void(i._gamma=void 0);i._alpha=CesiumMath.toRadians(t),i._beta=CesiumMath.toRadians(e.beta),i._gamma=CesiumMath.toRadians(e.gamma)}window.addEventListener("deviceorientation",t,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",t,!1)}}DerivedCommand.createLogDepthCommand=function(e,t,i){var r;return defined(i)||(i={}),defined(i.command)&&(r=i.command.shaderProgram),i.command=DrawCommand.shallowClone(e,i.command),defined(r)&&i.shaderProgramId===e.shaderProgram.id?i.command.shaderProgram=r:(i.command.shaderProgram=getLogDepthShaderProgram(t,e.shaderProgram),i.shaderProgramId=e.shaderProgram.id),i},DerivedCommand.createPickDerivedCommand=function(e,t,i,r){var n,a;return defined(r)||(r={}),defined(r.pickCommand)&&(n=r.pickCommand.shaderProgram,a=r.pickCommand.renderState),r.pickCommand=DrawCommand.shallowClone(t,r.pickCommand),defined(n)&&r.shaderProgramId===t.shaderProgram.id?(r.pickCommand.shaderProgram=n,r.pickCommand.renderState=a):(r.pickCommand.shaderProgram=getPickShaderProgram(i,t.shaderProgram,t.pickId),r.pickCommand.renderState=getPickRenderState(e,t.renderState),r.shaderProgramId=t.shaderProgram.id),r},DerivedCommand.createHdrCommand=function(e,t,i){var r;return defined(i)||(i={}),defined(i.command)&&(r=i.command.shaderProgram),i.command=DrawCommand.shallowClone(e,i.command),defined(r)&&i.shaderProgramId===e.shaderProgram.id?i.command.shaderProgram=r:(i.command.shaderProgram=getHdrShaderProgram(t,e.shaderProgram),i.shaderProgramId=e.shaderProgram.id),i};var scratchQuaternion1=new Quaternion,scratchQuaternion2=new Quaternion,scratchMatrix3$2=new Matrix3;function rotate(e,t,i,r){var n=e.direction,a=e.right,o=e.up,s=Quaternion.fromAxisAngle(n,i,scratchQuaternion2),l=Quaternion.fromAxisAngle(a,r,scratchQuaternion1),c=Quaternion.multiply(l,s,l),u=Quaternion.fromAxisAngle(o,t,scratchQuaternion2);Quaternion.multiply(u,c,c);var d=Matrix3.fromQuaternion(c,scratchMatrix3$2);Matrix3.multiplyByVector(d,a,a),Matrix3.multiplyByVector(d,o,o),Matrix3.multiplyByVector(d,n,n)}DeviceOrientationCameraController.prototype.update=function(){if(defined(this._alpha)){defined(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);var e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,i=this._lastGamma-this._gamma;rotate(this._scene.camera,-e,t,i),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma}},DeviceOrientationCameraController.prototype.isDestroyed=function(){return!1},DeviceOrientationCameraController.prototype.destroy=function(){return this._removeListener(),destroyObject(this)};var EllipsoidFS="#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#endif\nuniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\nvarying vec3 v_positionEC;\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\nvec3 positionEC = czm_pointAlongRay(ray, intersection);\nvec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\nvec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\nvec3 sphericalNormal = normalize(positionMC / u_radii);\nvec3 normalMC = geodeticNormal * side;\nvec3 normalEC = normalize(czm_normal * normalMC);\nvec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\nvec3 positionToEyeEC = -positionEC;\nczm_materialInput materialInput;\nmaterialInput.s = st.s;\nmaterialInput.st = st;\nmaterialInput.str = (positionMC + u_radii) / u_radii;\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef ONLY_SUN_LIGHTING\nreturn czm_private_phong(normalize(positionToEyeEC), material);\n#else\nreturn czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\nvoid main()\n{\nfloat maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\nvec3 direction = normalize(v_positionEC);\nvec3 ellipsoidCenter = czm_modelView[3].xyz;\nfloat t1 = -1.0;\nfloat t2 = -1.0;\nfloat b = -2.0 * dot(direction, ellipsoidCenter);\nfloat c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\nfloat discriminant = b * b - 4.0 * c;\nif (discriminant >= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ray ray = czm_ray(t * direction, direction);\nvec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n#ifdef LOG_DEPTH\nczm_writeLogDepth(1.0 + positionCC.w);\n#else\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n#endif\n}\n",EllipsoidVS="attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\nczm_vertexLogDepth();\n}\n",attributeLocations$4={position:0};function EllipsoidPrimitive(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.center=Cartesian3.clone(defaultValue(e.center,Cartesian3.ZERO)),this._center=new Cartesian3,this.radii=Cartesian3.clone(e.radii),this._radii=new Cartesian3,this._oneOverEllipsoidRadiiSquared=new Cartesian3,this._boundingSphere=new BoundingSphere,this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._modelMatrix=new Matrix4,this._computedModelMatrix=new Matrix4,this.show=defaultValue(e.show,!0),this.material=defaultValue(e.material,Material.fromType(Material.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=defaultValue(e.debugShowBoundingVolume,!1),this.onlySunLighting=defaultValue(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=defaultValue(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 DrawCommand({owner:defaultValue(e._owner,this)}),this._pickCommand=new DrawCommand({owner:defaultValue(e._owner,this),pickOnly:!0});var 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 getVertexArray(e){var t=e.cache.ellipsoidPrimitive_vertexArray;if(defined(t))return t;var i=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:VertexFormat.POSITION_ONLY}));return t=VertexArray.fromGeometry({context:e,geometry:i,attributeLocations:attributeLocations$4,bufferUsage:BufferUsage$1.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t}var logDepthExtension="#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";EllipsoidPrimitive.prototype.update=function(e){if(this.show&&e.mode===SceneMode$1.SCENE3D&&defined(this.center)&&defined(this.radii)){var t=e.context,i=this.material.isTranslucent(),r=this._translucent!==i;defined(this._rs)&&!r||(this._translucent=i,this._rs=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!i&&t.fragmentDepth,blending:i?BlendingState$1.ALPHA_BLEND:void 0})),defined(this._va)||(this._va=getVertexArray(t));var n=!1,a=this.radii;if(!Cartesian3.equals(this._radii,a)){Cartesian3.clone(a,this._radii);var o=this._oneOverEllipsoidRadiiSquared;o.x=1/(a.x*a.x),o.y=1/(a.y*a.y),o.z=1/(a.z*a.z),n=!0}Matrix4.equals(this.modelMatrix,this._modelMatrix)&&Cartesian3.equals(this.center,this._center)||(Matrix4.clone(this.modelMatrix,this._modelMatrix),Cartesian3.clone(this.center,this._center),Matrix4.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),n=!0),n&&(Cartesian3.clone(Cartesian3.ZERO,this._boundingSphere.center),this._boundingSphere.radius=Cartesian3.maximumComponent(a),BoundingSphere.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));var s=this._material!==this.material;this._material=this.material,this._material.update(t);var l=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;var c=e.useLogDepth,u=this._useLogDepth!==c;this._useLogDepth=c;var d,h,p=this._colorCommand;(s||l||r||u)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS]}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!i&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH","DISABLE_GL_POSITION_LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._sp=ShaderProgram.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations$4}),p.vertexArray=this._va,p.renderState=this._rs,p.shaderProgram=this._sp,p.uniformMap=combine(this._uniforms,this.material._uniforms),p.executeInClosestFrustum=i);var m=e.commandList,f=e.passes;if(f.render&&(p.boundingVolume=this._boundingSphere,p.debugShowBoundingVolume=this.debugShowBoundingVolume,p.modelMatrix=this._computedModelMatrix,p.pass=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,m.push(p)),f.pick){var g=this._pickCommand;defined(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||l||!defined(this._pickSP)||u)&&(d=new ShaderSource({sources:[EllipsoidVS]}),h=new ShaderSource({sources:[this.material.shaderSource,EllipsoidFS],pickColorQualifier:"uniform"}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!i&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH"),h.sources.push(logDepthExtension)),this._pickSP=ShaderProgram.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:attributeLocations$4}),g.vertexArray=this._va,g.renderState=this._rs,g.shaderProgram=this._pickSP,g.uniformMap=combine(combine(this._uniforms,this._pickUniforms),this.material._uniforms),g.executeInClosestFrustum=i),g.boundingVolume=this._boundingSphere,g.modelMatrix=this._computedModelMatrix,g.pass=i?Pass$1.TRANSLUCENT:Pass$1.OPAQUE,m.push(g)}}},EllipsoidPrimitive.prototype.isDestroyed=function(){return!1},EllipsoidPrimitive.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(),destroyObject(this)};var EllipsoidSurfaceAppearanceFS="varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n",EllipsoidSurfaceAppearanceVS="attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";function EllipsoidSurfaceAppearance(e){var t=defaultValue((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).translucent,!0),i=defaultValue(e.aboveGround,!1);this.material=defined(e.material)?e.material:Material.fromType(Material.ColorType),this.translucent=defaultValue(e.translucent,!0),this._vertexShaderSource=defaultValue(e.vertexShaderSource,EllipsoidSurfaceAppearanceVS),this._fragmentShaderSource=defaultValue(e.fragmentShaderSource,EllipsoidSurfaceAppearanceFS),this._renderState=Appearance.getDefaultRenderState(t,!i,e.renderState),this._closed=!1,this._flat=defaultValue(e.flat,!1),this._faceForward=defaultValue(e.faceForward,i),this._aboveGround=i}function Fog(){this.enabled=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}defineProperties$1(EllipsoidSurfaceAppearance.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 EllipsoidSurfaceAppearance.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),EllipsoidSurfaceAppearance.VERTEX_FORMAT=VertexFormat.POSITION_AND_ST,EllipsoidSurfaceAppearance.prototype.getFragmentShaderSource=Appearance.prototype.getFragmentShaderSource,EllipsoidSurfaceAppearance.prototype.isTranslucent=Appearance.prototype.isTranslucent,EllipsoidSurfaceAppearance.prototype.getRenderState=Appearance.prototype.getRenderState;for(var heightsTable=[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],densityTable=[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],i$3=0;i$3<densityTable.length;++i$3)densityTable[i$3]*=1e6;for(var tableStartDensity=densityTable[1],tableEndDensity=densityTable[densityTable.length-1],j=0;j<densityTable.length;++j)densityTable[j]=(densityTable[j]-tableEndDensity)/(tableStartDensity-tableEndDensity);var tableLastIndex=0;function findInterval(e){var t,i=heightsTable,r=i.length;if(e<i[0])return tableLastIndex=0;if(e>i[r-1])return tableLastIndex=r-2;if(e>=i[tableLastIndex]){if(tableLastIndex+1<r&&e<i[tableLastIndex+1])return tableLastIndex;if(tableLastIndex+2<r&&e<i[tableLastIndex+2])return++tableLastIndex}else if(0<=tableLastIndex-1&&e>=i[tableLastIndex-1])return--tableLastIndex;for(t=0;t<r-2&&!(e>=i[t]&&e<i[t+1]);++t);return tableLastIndex=t}var scratchPositionNormal$1=new Cartesian3;function FrameRateMonitor(e){this._scene=e.scene,this.samplingWindow=defaultValue(e.samplingWindow,FrameRateMonitor.defaultSettings.samplingWindow),this.quietPeriod=defaultValue(e.quietPeriod,FrameRateMonitor.defaultSettings.quietPeriod),this.warmupPeriod=defaultValue(e.warmupPeriod,FrameRateMonitor.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=defaultValue(e.minimumFrameRateDuringWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=defaultValue(e.minimumFrameRateAfterWarmup,FrameRateMonitor.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new Event,this._nominalFrameRate=new Event,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;var i=this;this._preUpdateRemoveListener=this._scene.preUpdate.addEventListener(function(e,t){update$5(i)}),this._hiddenPropertyName=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":void 0;var t=void 0!==document.hidden?"visibilitychange":void 0!==document.mozHidden?"mozvisibilitychange":void 0!==document.msHidden?"msvisibilitychange":void 0!==document.webkitHidden?"webkitvisibilitychange":void 0;function r(){visibilityChanged(i)}this._visibilityChangeRemoveListener=void 0,defined(t)&&(document.addEventListener(t,r,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(t,r,!1)})}function update$5(e,t){if(!(0<e._pauseCount)){var i=getTimestamp$1();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=i+e.quietPeriod/TimeConstants$1.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/TimeConstants$1.SECONDS_PER_MILLISECOND;else if(i>=e._quietPeriodEndTime){e._frameTimes.push(i);var r=i-e.samplingWindow/TimeConstants$1.SECONDS_PER_MILLISECOND;if(2<=e._frameTimes.length&&e._frameTimes[0]<=r){for(;2<=e._frameTimes.length&&e._frameTimes[1]<r;)e._frameTimes.shift();var n=(i-e._frameTimes[0])/(e._frameTimes.length-1);e._lastFramesPerSecond=1e3/n,1e3/(i>e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup)<n?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}}function visibilityChanged(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}function FrameState(e,t,i){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=SceneMode$1.SCENE3D,this.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=i,this.mapProjection=void 0,this.camera=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.terrainExaggeration=1,this.shadowState={shadowsEnabled:!0,lightShadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.imagerySplitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.sunColor=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0}function FrustumCommands(e,t){this.near=defaultValue(e,0),this.far=defaultValue(t,0);for(var i=Pass$1.NUMBER_OF_PASSES,r=new Array(i),n=new Array(i),a=0;a<i;++a)r[a]=[],n[a]=0;this.commands=r,this.indices=n}Fog.prototype.update=function(e){if(e.fog.enabled=this.enabled){var t=e.camera,i=t.positionCartographic;if(!defined(i)||8e5<i.height||e.mode!==SceneMode$1.SCENE3D)e.fog.enabled=!1;else{var r=i.height,n=findInterval(r),a=CesiumMath.clamp((r-heightsTable[n])/(heightsTable[n+1]-heightsTable[n]),0,1),o=CesiumMath.lerp(densityTable[n],densityTable[n+1],a),s=1e6*this.density;o=o*(s-s/tableStartDensity*tableEndDensity)*1e-6;var l=Cartesian3.normalize(t.positionWC,scratchPositionNormal$1);o*=1-Math.abs(Cartesian3.dot(t.directionWC,l)),e.fog.density=o,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness}}},FrameRateMonitor.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},FrameRateMonitor.fromScene=function(e){return defined(e._frameRateMonitor)&&!e._frameRateMonitor.isDestroyed()||(e._frameRateMonitor=new FrameRateMonitor({scene:e})),e._frameRateMonitor},defineProperties$1(FrameRateMonitor.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),FrameRateMonitor.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},FrameRateMonitor.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},FrameRateMonitor.prototype.isDestroyed=function(){return!1},FrameRateMonitor.prototype.destroy=function(){return this._preUpdateRemoveListener(),defined(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),destroyObject(this)};var GlobeFS="uniform vec4 u_initialColor;\n#ifdef WAJUE\nuniform mat4 dig_pos_x;\nuniform mat4 dig_pos_y;\nuniform mat4 dig_pos_z;\nuniform mat3 rect_dig;\nuniform int dig_max_index;\nuniform bool showSelfOnly;\n#endif\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\nuniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SPLIT\nuniform float u_dayTextureSplit[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_IMAGERY_CUTOUT\nuniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_COLOR_TO_ALPHA\nuniform vec4 u_colorsToAlpha[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nuniform vec2 u_lightingFadeDistance;\n#endif\n#ifdef TILE_LIMIT_RECTANGLE\nuniform vec4 u_cartographicLimitRectangle;\n#endif\n#ifdef GROUND_ATMOSPHERE\nuniform vec2 u_nightFadeDistance;\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nuniform sampler2D u_clippingPlanes;\nuniform mat4 u_clippingPlanesMatrix;\nuniform vec4 u_clippingPlanesEdgeStyle;\n#endif\n#if defined(FOG) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)) || defined(GROUND_ATMOSPHERE)\nuniform float u_minimumBrightness;\n#endif\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nuniform vec4 u_fillHighlightColor;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nuniform mat4 ym_pos_x;\nuniform mat4 ym_pos_y;\nuniform mat4 ym_pos_z;\nuniform mat3 rect_flood;\nuniform int ym_max_index;\nuniform bool globe;\nuniform bool showElseArea;\nvarying float v_height;\nvarying float v_slope;\nvarying float v_aspect;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying float v_distance;\nvarying vec3 v_fogRayleighColor;\nvarying vec3 v_fogMieColor;\n#endif\n#ifdef GROUND_ATMOSPHERE\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D textureToSample,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma,\nfloat split,\nvec4 colorToAlpha)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(textureToSample, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_COLOR_TO_ALPHA\nvec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);\ncolorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);\nalpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);\n#endif\n#if !defined(APPLY_GAMMA)\nvec4 tempColor = czm_gammaCorrect(vec4(color, alpha));\ncolor = tempColor.rgb;\nalpha = tempColor.a;\n#else\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\n#ifdef APPLY_SPLIT\nfloat splitPosition = czm_imagerySplitPosition;\nif (split < 0.0 && gl_FragCoord.x > splitPosition) {\nalpha = 0.0;\n}\nelse if (split > 0.0 && gl_FragCoord.x < splitPosition) {\nalpha = 0.0;\n}\n#endif\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\noutAlpha += sign(outAlpha) - 1.0;\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, max(outAlpha, 0.0));\n}\nvec3 colorCorrect(vec3 rgb) {\n#ifdef COLOR_CORRECT\nvec3 hsb = czm_RGBToHSB(rgb);\nhsb.x += u_hsbShift.x;\nhsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);\nhsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;\nrgb = czm_HSBToRGB(hsb);\n#endif\nreturn rgb;\n}\nvec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);\nvoid main()\n{\n#ifdef TILE_LIMIT_RECTANGLE\nif (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||\nv_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)\n{\ndiscard;\n}\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nfloat clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n#endif\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)\nvec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));\nvec3 normalEC = czm_normal3D * normalMC;\n#endif\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nfloat cameraDist;\nif (czm_sceneMode == czm_sceneMode2D)\n{\ncameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;\n}\nelse if (czm_sceneMode == czm_sceneModeColumbusView)\n{\ncameraDist = -czm_view[3].z;\n}\nelse\n{\ncameraDist = length(czm_view[3]);\n}\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nif (czm_sceneMode != czm_sceneMode3D) {\nvec3 radii = czm_ellipsoidRadii;\nfloat maxRadii = max(radii.x, max(radii.y, radii.z));\nfadeOutDist -= maxRadii;\nfadeInDist -= maxRadii;\n}\nfloat fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#else\nfloat fade = 0.0;\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\nwaterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);\n}\n#endif\n#ifdef APPLY_MATERIAL\nczm_materialInput materialInput;\nmaterialInput.st = v_textureCoordinates.st;\nmaterialInput.normalEC = normalize(v_normalEC);\nmaterialInput.slope = v_slope;\nmaterialInput.height = v_height;\nmaterialInput.aspect = v_aspect;\nczm_material material = czm_getMaterial(materialInput);\nbool stc_isIn = czm_isInEllipsoid (v_positionMC,ym_pos_x,ym_pos_y,ym_pos_z,rect_flood,ym_max_index);\nif(globe){\ncolor.xyz = mix(color.xyz, material.diffuse, material.alpha);\n}else{\nif(stc_isIn){\ncolor.xyz = mix(color.xyz, material.diffuse, material.alpha);\n}else{\nif(!showElseArea){\ncolor.xyz = vec3(0.82,0.82,0.82);\n}\n}\n}\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, fade);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#ifdef ENABLE_CLIPPING_PLANES\nvec4 clippingPlanesEdgeColor = vec4(1.0);\nclippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\nfloat clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\nif (clipDistance < clippingPlanesEdgeWidth)\n{\nfinalColor = clippingPlanesEdgeColor;\n}\n#endif\n#ifdef HIGHLIGHT_FILL_TILE\nfinalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvec3 fogColor = colorCorrect(v_fogMieColor) + finalColor.rgb * colorCorrect(v_fogRayleighColor);\n#ifndef HDR\nconst float fExposure = 2.0;\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\n#endif\n#endif\n#ifdef FOG\n#if defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)\nfloat darken = clamp(dot(normalize(czm_viewerPositionWC), normalize(czm_sunPositionWC)), u_minimumBrightness, 1.0);\nfogColor *= darken;\n#endif\n#ifdef HDR\nconst float modifier = 0.15;\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor, modifier), finalColor.a);\n#else\nfinalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#endif\n#endif\n#ifdef GROUND_ATMOSPHERE\nif (czm_sceneMode != czm_sceneMode3D)\n{\ngl_FragColor = finalColor;\nreturn;\n}\n#if defined(PER_FRAGMENT_GROUND_ATMOSPHERE) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\nfloat mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);\nvec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);\nxy *= czm_viewport.zw * mpp * 0.5;\nvec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));\nczm_ray ray = czm_ray(vec3(0.0), direction);\nvec3 ellipsoid_center = czm_view[3].xyz;\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\nvec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);\nellipsoidPosition = (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(ellipsoidPosition, true);\nvec3 groundAtmosphereColor = colorCorrect(atmosColor.mie) + finalColor.rgb * colorCorrect(atmosColor.rayleigh);\n#ifndef HDR\ngroundAtmosphereColor = vec3(1.0) - exp(-fExposure * groundAtmosphereColor);\n#endif\nfadeInDist = u_nightFadeDistance.x;\nfadeOutDist = u_nightFadeDistance.y;\nfloat sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#ifdef HDR\nsunlitAtmosphereIntensity = max(sunlitAtmosphereIntensity * sunlitAtmosphereIntensity, 0.03);\n#endif\ngroundAtmosphereColor = mix(groundAtmosphereColor, fogColor, sunlitAtmosphereIntensity);\n#else\nvec3 groundAtmosphereColor = fogColor;\n#endif\n#ifdef HDR\ngroundAtmosphereColor = czm_saturation(groundAtmosphereColor, 1.6);\n#endif\nfinalColor = vec4(mix(finalColor.rgb, groundAtmosphereColor, fade), finalColor.a);\n#endif\n#ifdef WAJUE\nbool dig_isIn = czm_isInEllipsoid (v_positionMC,dig_pos_x,dig_pos_y,dig_pos_z,rect_dig,dig_max_index);\nif(dig_isIn){\nif(!showSelfOnly){\ndiscard;\n}\n}else{\nif(showSelfOnly){\ndiscard;\n}\n}\n#endif\ngl_FragColor = finalColor;\n#ifdef  APPLY_EXCAVATE\ngl_FragColor = vec4(1.0);\n#endif\n}\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\n#ifdef HDR\nspecular *= 1.4;\nfloat e = 0.2;\nfloat d = 3.3;\nfloat c = 1.7;\nvec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));\n#else\nvec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;\n#endif\nreturn vec4(color, imageryColor.a);\n}\n#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n",GlobeVS="#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed0;\nattribute float compressed1;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec4 textureCoordAndEncodedNormals;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform mat4 u_modifiedModelViewProjection;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef APPLY_MATERIAL\nvarying float v_slope;\nvarying float v_aspect;\nvarying float v_height;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying float v_distance;\nvarying vec3 v_fogMieColor;\nvarying vec3 v_fogRayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn u_modifiedModelViewProjection * vec4(position, 1.0);\n}\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorY = u_southMercatorYAndOneOverHeight.x;\nfloat oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn u_modifiedModelViewProjection * rtcPosition2D;\n}\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, height, textureCoordinates);\n}\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\nvec3 position3DWC = position + u_center3D;\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\nvec2 xy = czm_decompressTextureCoordinates(compressed0.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed0.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = compressed1;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\nfloat encodedNormal = 0.0;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = compressed0.w;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = textureCoordAndEncodedNormals.w;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\nfloat webMercatorT = textureCoordAndEncodedNormals.z;\nfloat encodedNormal = 0.0;\n#else\nfloat webMercatorT = textureCoordinates.y;\nfloat encodedNormal = 0.0;\n#endif\n#endif\nvec3 position3DWC = position + u_center3D;\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\nvec3 normalMC = czm_octDecode(encodedNormal);\nv_normalMC = normalMC;\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(GENERATE_POSITION) || defined(HDR)\nv_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nAtmosphereColor atmosFogColor = computeGroundAtmosphereFromSpace(position3DWC, false);\nv_fogMieColor = atmosFogColor.mie;\nv_fogRayleighColor = atmosFogColor.rayleigh;\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n#ifdef APPLY_MATERIAL\nfloat northPoleZ = czm_ellipsoidRadii.z;\nvec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\nvec3 ellipsoidNormal = normalize(v_positionMC);\nvec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\nfloat dotProd = abs(dot(ellipsoidNormal, v_normalMC));\nv_slope = acos(dotProd);\nvec3 normalRejected = ellipsoidNormal * dotProd;\nvec3 normalProjected = v_normalMC - normalRejected;\nvec3 aspectVector = normalize(normalProjected);\nv_aspect = acos(dot(aspectVector, vectorEastMC));\nfloat determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\nv_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\nv_height = height;\n#endif\n}\n",GroundAtmosphere="const float fInnerRadius = 6378137.0;\nconst float fOuterRadius = 6378137.0 * 1.025;\nconst float fOuterRadius2 = fOuterRadius * fOuterRadius;\nconst float Kr = 0.0025;\nconst float Km = 0.0015;\nconst float ESun = 15.0;\nconst float fKrESun = Kr * ESun;\nconst float fKmESun = Km * ESun;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst float fScale = 1.0 / (fOuterRadius - fInnerRadius);\nconst float fScaleDepth = 0.25;\nconst float fScaleOverScaleDepth = fScale / fScaleDepth;\nstruct AtmosphereColor\n{\nvec3 mie;\nvec3 rayleigh;\n};\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos, bool useSunLighting)\n{\nvec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\nfloat fCameraHeight = length(czm_viewerPositionWC);\nfloat fCameraHeight2 = fCameraHeight * fCameraHeight;\nfloat B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\nfloat fLightAngle = czm_branchFreeTernary(useSunLighting, dot(czm_sunDirectionWC, v3Pos) / length(v3Pos), 1.0);\nfloat fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\nfloat fCameraScale = scale(fCameraAngle);\nfloat fLightScale = scale(fLightAngle);\nfloat fCameraOffset = fDepth*fCameraScale;\nfloat fTemp = (fLightScale + fCameraScale);\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0);\nvec3 v3Attenuate = vec3(0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nfloat fScatter = fDepth*fTemp - fCameraOffset;\nv3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nAtmosphereColor color;\ncolor.mie = v3FrontColor * (v3InvWavelength * fKrESun + fKmESun);\ncolor.rayleigh = v3Attenuate;\nreturn color;\n}\n";function GlobeSurfaceShader(e,t,i,r,n){this.numberOfDayTextures=e,this.flags=t,this.material=i,this.shaderProgram=r,this.clippingShaderState=n}function GlobeSurfaceShaderSet(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function getPositionMode(e){var t;switch(e){case SceneMode$1.SCENE3D:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }";break;case SceneMode$1.SCENE2D:case SceneMode$1.COLUMBUS_VIEW:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }";break;case SceneMode$1.MORPHING:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }"}return t}function get2DYPositionFraction(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}GlobeSurfaceShaderSet.prototype.getShaderProgram=function(e){var t=e.frameState,i=e.surfaceTile,r=e.numberOfDayTextures,n=e.applyBrightness,a=e.applyContrast,o=e.applyHue,s=e.applySaturation,l=e.applyGamma,c=e.applyAlpha,u=e.applySplit,d=e.showReflectiveOcean,h=e.showOceanWaves,p=e.enableLighting,m=e.showGroundAtmosphere,f=e.perFragmentGroundAtmosphere,g=e.hasVertexNormals,_=e.useWebMercatorProjection,y=e.enableFog,v=e.enableClippingPlanes,C=e.clippingPlanes,S=e.clippedByBoundaries,x=e.hasImageryLayerCutout,T=e.colorCorrect,b=e.highlightFillTile,E=e.colorToAlpha,P=0,A="",w=i.renderedMesh.encoding;w.quantization===TerrainQuantization$1.BITS12&&(P=1,A="QUANTIZATION_BITS12");var D=0,M="";defined(i.vertexArray)&&defined(i.terrainData)&&!i.terrainData._createdByUpsampling||(D=1,M="DISABLE_GL_POSITION_LOG_DEPTH");var I=0,R="";S&&(I=1,R="TILE_LIMIT_RECTANGLE");var O=0,L="";x&&(O=1,L="APPLY_IMAGERY_CUTOUT");var F=t.mode,N=F|n<<2|a<<3|o<<4|s<<5|l<<6|c<<7|d<<8|h<<9|p<<10|m<<11|f<<12|g<<13|_<<14|y<<15|P<<16|u<<17|v<<18|D<<19|I<<20|O<<21|T<<22|b<<23|E<<24,B=0;defined(C)&&0<C.length&&(B=v?C.clippingPlanesState:0);var V=i.surfaceShader;if(defined(V)&&V.numberOfDayTextures===r&&V.flags===N&&V.material===this.material&&V.clippingShaderState===B)return V.shaderProgram;var k=this._shadersByTexturesFlags[r];if(defined(k)||(k=this._shadersByTexturesFlags[r]=[]),!defined(V=k[N])||V.material!==this.material||V.clippingShaderState!==B){var $=this.baseVertexShaderSource.clone(),z=this.baseFragmentShaderSource.clone();0!==B&&z.sources.unshift(getClippingFunction(C,t.context)),$.defines.push(A,M),z.defines.push("TEXTURE_UNITS "+r,R,L),n&&z.defines.push("APPLY_BRIGHTNESS"),a&&z.defines.push("APPLY_CONTRAST"),o&&z.defines.push("APPLY_HUE"),s&&z.defines.push("APPLY_SATURATION"),l&&z.defines.push("APPLY_GAMMA"),c&&z.defines.push("APPLY_ALPHA"),d&&(z.defines.push("SHOW_REFLECTIVE_OCEAN"),$.defines.push("SHOW_REFLECTIVE_OCEAN")),h&&z.defines.push("SHOW_OCEAN_WAVES"),E&&z.defines.push("APPLY_COLOR_TO_ALPHA"),p&&(g?($.defines.push("ENABLE_VERTEX_LIGHTING"),z.defines.push("ENABLE_VERTEX_LIGHTING")):($.defines.push("ENABLE_DAYNIGHT_SHADING"),z.defines.push("ENABLE_DAYNIGHT_SHADING"))),m&&($.defines.push("GROUND_ATMOSPHERE"),z.defines.push("GROUND_ATMOSPHERE"),f&&z.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE")),$.defines.push("INCLUDE_WEB_MERCATOR_Y"),z.defines.push("INCLUDE_WEB_MERCATOR_Y"),y&&($.defines.push("FOG"),z.defines.push("FOG")),u&&z.defines.push("APPLY_SPLIT"),v&&z.defines.push("ENABLE_CLIPPING_PLANES"),T&&z.defines.push("COLOR_CORRECT"),b&&z.defines.push("HIGHLIGHT_FILL_TILE");var U="    vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates)\n    {\n        vec4 color = initialColor;\n";x&&(U+="        vec4 cutoutAndColorResult;\n        bool texelUnclipped;\n");for(var G=0;G<r;++G)U+=x?"        cutoutAndColorResult = u_dayTextureCutoutRectangles["+G+"];\n        texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;\n        cutoutAndColorResult = sampleAndBlend(\n":"        color = sampleAndBlend(\n",U+="            color,\n            u_dayTextures["+G+"],\n            u_dayTextureUseWebMercatorT["+G+"] ? textureCoordinates.xz : textureCoordinates.xy,\n            u_dayTextureTexCoordsRectangle["+G+"],\n            u_dayTextureTranslationAndScale["+G+"],\n            "+(c?"u_dayTextureAlpha["+G+"]":"1.0")+",\n            "+(n?"u_dayTextureBrightness["+G+"]":"0.0")+",\n            "+(a?"u_dayTextureContrast["+G+"]":"0.0")+",\n            "+(o?"u_dayTextureHue["+G+"]":"0.0")+",\n            "+(s?"u_dayTextureSaturation["+G+"]":"0.0")+",\n            "+(l?"u_dayTextureOneOverGamma["+G+"]":"0.0")+",\n            "+(u?"u_dayTextureSplit["+G+"]":"0.0")+",\n            "+(E?"u_colorsToAlpha["+G+"]":"vec4(0.0)")+"\n        );\n",x&&(U+="        color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);\n");U+="        return color;\n    }",z.sources.push(U),$.sources.push(getPositionMode(F)),$.sources.push(get2DYPositionFraction(_));var H=ShaderProgram.fromCache({context:t.context,vertexShaderSource:$,fragmentShaderSource:z,attributeLocations:w.getAttributeLocations()});V=k[N]=new GlobeSurfaceShader(r,N,this.material,H,B)}return(i.surfaceShader=V).shaderProgram},GlobeSurfaceShaderSet.prototype.destroy=function(){var e,t,i=this._shadersByTexturesFlags;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];if(!defined(n))continue;for(e in n)n.hasOwnProperty(e)&&defined(t=n[e])&&t.shaderProgram.destroy()}return destroyObject(this)};var ImageryState={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},ImageryState$1=freezeObject$1(ImageryState),QuadtreeTileLoadState={START:0,LOADING:1,DONE:2,FAILED:3},QuadtreeTileLoadState$1=freezeObject$1(QuadtreeTileLoadState),TerrainState$1={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},TerrainState$2=freezeObject$1(TerrainState$1);function GlobeSurfaceTile(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new Cartesian4(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.orientedBoundingBox=void 0,this.boundingVolumeSourceTile=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new Cartesian3,this.terrainState=TerrainState$2.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new BoundingSphere,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}function getPosition$2(e,t,i,r,n,a){if(e.decodePosition(r,n,a),defined(t)&&t!==SceneMode$1.SCENE3D){var o=i.ellipsoid.cartesianToCartographic(a);i.project(o,a),Cartesian3.fromElements(a.z,a.x,a.y,a)}return a}defineProperties$1(GlobeSurfaceTile.prototype,{eligibleForUnloading:{get:function(){for(var e=this.terrainState,t=!(e===TerrainState$2.RECEIVING||e===TerrainState$2.TRANSFORMING),i=this.imagery,r=0,n=i.length;t&&r<n;++r){var a=i[r];t=!defined(a.loadingImagery)||a.loadingImagery.state!==ImageryState$1.TRANSITIONING}return t}},renderedMesh:{get:function(){return defined(this.vertexArray)?this.mesh:defined(this.fill)?this.fill.mesh:void 0}}});var scratchV0=new Cartesian3,scratchV1=new Cartesian3,scratchV2=new Cartesian3,scratchResult=new Cartesian3;function prepareNewTile(e,t,i){var r=t.getTileDataAvailable(e.x,e.y,e.level);if(!defined(r)&&defined(e.parent)){var n=e.parent,a=n.data;defined(a)&&defined(a.terrainData)&&(r=a.terrainData.isChildAvailable(n.x,n.y,e.x,e.y))}!1===r&&(e.data.terrainState=TerrainState$2.FAILED);for(var o=0,s=i.length;o<s;++o){var l=i.get(o);l.show&&l._createTileImagerySkeletons(e,t)}}function processTerrainStateMachine(e,t,i,r,n){var a=e.data,o=e.parent;a.terrainState===TerrainState$2.FAILED&&void 0!==o&&(void 0!==o.data&&void 0!==o.data.terrainData&&!1!==o.data.terrainData.canUpsample||GlobeSurfaceTile.processStateMachine(o,t,i,r,!0));if(a.terrainState===TerrainState$2.FAILED&&upsample(a,e,t,i,e.x,e.y,e.level),a.terrainState===TerrainState$2.UNLOADED&&requestTileGeometry$1(a,i,e.x,e.y,e.level),a.terrainState===TerrainState$2.RECEIVED&&transform$1(a,t,i,e.x,e.y,e.level),a.terrainState===TerrainState$2.TRANSFORMED&&createResources$4(a,t.context,i,e.x,e.y,e.level,n),a.terrainState>=TerrainState$2.RECEIVED&&void 0===a.waterMaskTexture&&i.hasWaterMask)if(void 0!==a.terrainData.waterMask)createWaterMaskTextureIfNeeded(t.context,a);else{var s=a._findAncestorTileWithTerrainData(e);defined(s)&&defined(s.data.waterMaskTexture)&&(a.waterMaskTexture=s.data.waterMaskTexture,++a.waterMaskTexture.referenceCount,a._computeWaterMaskTranslationAndScale(e,s,a.waterMaskTranslationAndScale))}}function upsample(t,e,i,r,n,a,o){var s=e.parent;if(s){var l=s.data.terrainData,c=s.x,u=s.y,d=s.level;if(defined(l)){var h=l.upsample(r.tilingScheme,c,u,d,n,a,o);defined(h)&&(t.terrainState=TerrainState$2.RECEIVING,when(h,function(e){t.terrainData=e,t.terrainState=TerrainState$2.RECEIVED},function(){t.terrainState=TerrainState$2.FAILED}))}}else e.state=QuadtreeTileLoadState$1.FAILED}function requestTileGeometry$1(i,r,n,a,o){function s(e){i.terrainData=e,i.terrainState=TerrainState$2.RECEIVED,i.request=void 0}function l(){if(i.request.state===RequestState$1.CANCELLED)return i.terrainData=void 0,i.terrainState=TerrainState$2.UNLOADED,void(i.request=void 0);i.terrainState=TerrainState$2.FAILED,i.request=void 0;var e="Failed to obtain terrain tile X: "+n+" Y: "+a+" Level: "+o+".";r._requestError=TileProviderError.handleError(r._requestError,r,r.errorEvent,e,n,a,o,t)}function t(){var e=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.TERRAIN});i.request=e;var t=r.requestTileGeometry(n,a,o,e);defined(t)?(i.terrainState=TerrainState$2.RECEIVING,when(t,s,l)):(i.terrainState=TerrainState$2.UNLOADED,i.request=void 0)}t()}function transform$1(t,e,i,r,n,a){var o=i.tilingScheme,s=t.terrainData.createMesh(o,r,n,a,e.terrainExaggeration);defined(s)&&(t.terrainState=TerrainState$2.TRANSFORMING,when(s,function(e){t.mesh=e,t.orientedBoundingBox=OrientedBoundingBox.clone(e.orientedBoundingBox,t.orientedBoundingBox),t.occludeePointInScaledSpace=Cartesian3.clone(e.occludeePointInScaledSpace,t.occludeePointInScaledSpace),t.terrainState=TerrainState$2.TRANSFORMED},function(){t.terrainState=TerrainState$2.FAILED}))}function createResources$4(e,t,i,r,n,a,o){e.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(t,e.mesh),e.terrainState=TerrainState$2.READY,e.fill=e.fill&&e.fill.destroy(o)}function getContextWaterMaskData(e){var t=e.cache.tile_waterMaskData;if(!defined(t)){var i=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1,t={allWaterTexture:i,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR}),destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function createWaterMaskTextureIfNeeded(e,t){var i,r=t.terrainData.waterMask,n=getContextWaterMaskData(e),a=r.length;if(1===a){if(0===r[0])return;i=n.allWaterTexture}else{var o=Math.sqrt(a);(i=Texture.create({context:e,pixelFormat:PixelFormat$1.LUMINANCE,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{width:o,height:o,arrayBufferView:r},sampler:n.sampler,flipY:!1})).referenceCount=0}++i.referenceCount,t.waterMaskTexture=i,Cartesian4.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}GlobeSurfaceTile.prototype.pick=function(e,t,i,r,n){var a=this.renderedMesh;if(defined(a))for(var o=a.vertices,s=a.indices,l=a.encoding,c=s.length,u=0;u<c;u+=3){var d=s[u],h=s[u+1],p=s[u+2],m=getPosition$2(l,t,i,o,d,scratchV0),f=getPosition$2(l,t,i,o,h,scratchV1),g=getPosition$2(l,t,i,o,p,scratchV2),_=IntersectionTests.rayTriangle(e,m,f,g,r,scratchResult);if(defined(_))return Cartesian3.clone(_,n)}},GlobeSurfaceTile.prototype.freeResources=function(){defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=TerrainState$2.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();for(var e=this.imagery,t=0,i=e.length;t<i;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()},GlobeSurfaceTile.prototype.freeVertexArray=function(){GlobeSurfaceTile._freeVertexArray(this.vertexArray),this.vertexArray=void 0,GlobeSurfaceTile._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0},GlobeSurfaceTile.initialize=function(e,t,i){var r=e.data;defined(r)||(r=e.data=new GlobeSurfaceTile),e.state===QuadtreeTileLoadState$1.START&&(prepareNewTile(e,t,i),e.state=QuadtreeTileLoadState$1.LOADING)},GlobeSurfaceTile.processStateMachine=function(e,t,i,r,n,a){GlobeSurfaceTile.initialize(e,i,r);var o=e.data;if(e.state===QuadtreeTileLoadState$1.LOADING&&processTerrainStateMachine(e,t,i,r,n),!a){var s=e.renderable;e.renderable=defined(o.vertexArray);var l=o.terrainState===TerrainState$2.READY;e.upsampledFromParent=defined(o.terrainData)&&o.terrainData.wasCreatedByUpsampling();var c=o.processImagery(e,i,t);if(l&&c){var u=e._loadedCallbacks,d={};for(var h in u)u.hasOwnProperty(h)&&(u[h](e)||(d[h]=u[h]));e._loadedCallbacks=d,e.state=QuadtreeTileLoadState$1.DONE}s&&(e.renderable=!0)}},GlobeSurfaceTile.prototype.processImagery=function(e,t,i,r){var n,a,o=e.data,s=e.upsampledFromParent,l=!1,c=!0,u=o.imagery;for(n=0,a=u.length;n<a;++n){var d=u[n];if(defined(d.loadingImagery)){if(d.loadingImagery.state===ImageryState$1.PLACEHOLDER){var h=d.loadingImagery.imageryLayer;if(h.imageryProvider.ready){d.freeResources(),u.splice(n,1),h._createTileImagerySkeletons(e,t,n),--n,a=u.length;continue}s=!1}var p=d.processStateMachine(e,i,r);c=c&&p,l=l||p||defined(d.readyImagery),s=s&&defined(d.loadingImagery)&&(d.loadingImagery.state===ImageryState$1.FAILED||d.loadingImagery.state===ImageryState$1.INVALID)}else s=!1}return e.upsampledFromParent=s,e.renderable=e.renderable&&(l||c),c},GlobeSurfaceTile._createVertexArrayForMesh=function(e,t){var i=t.vertices,r=Buffer$1.createVertexBuffer({context:e,typedArray:i,usage:BufferUsage$1.STATIC_DRAW}),n=t.encoding.getAttributes(r),a=t.indices.indexBuffers||{},o=a[e.id];if(!defined(o)||o.isDestroyed()){var s=t.indices;(o=Buffer$1.createIndexBuffer({context:e,typedArray:s,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(s.BYTES_PER_ELEMENT)})).vertexArrayDestroyable=!1,o.referenceCount=1,a[e.id]=o,t.indices.indexBuffers=a}else++o.referenceCount;return new VertexArray({context:e,attributes:n,indexBuffer:o})},GlobeSurfaceTile._freeVertexArray=function(e){if(defined(e)){var t=e.indexBuffer;e.destroy(),defined(t)&&!t.isDestroyed()&&defined(t.referenceCount)&&(--t.referenceCount,0===t.referenceCount&&t.destroy())}},GlobeSurfaceTile.prototype._findAncestorTileWithTerrainData=function(e){for(var t=e.parent;defined(t)&&(!defined(t.data)||!defined(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t},GlobeSurfaceTile.prototype._computeWaterMaskTranslationAndScale=function(e,t,i){var r=t.rectangle,n=e.rectangle,a=n.width,o=n.height,s=a/r.width,l=o/r.height;return i.x=s*(n.west-r.west)/a,i.y=l*(n.south-r.south)/o,i.z=s,i.w=l,i};var ReprojectWebMercatorFS="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n",ReprojectWebMercatorVS="attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n";function Imagery(e,t,i,r,n){if(this.imageryLayer=e,this.x=t,this.y=i,this.level=r,this.request=void 0,0!==r){var a=t/2|0,o=i/2|0,s=r-1;this.parent=e.getImageryFromCache(a,o,s)}this.state=ImageryState$1.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!defined(n)&&e.imageryProvider.ready&&(n=e.imageryProvider.tilingScheme.tileXYToRectangle(t,i,r));this.rectangle=n}Imagery.createPlaceholder=function(e){var t=new Imagery(e,0,0,0);return t.addReference(),t.state=ImageryState$1.PLACEHOLDER,t},Imagery.prototype.addReference=function(){++this.referenceCount},Imagery.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),defined(this.parent)&&this.parent.releaseReference(),defined(this.image)&&defined(this.image.destroy)&&this.image.destroy(),defined(this.texture)&&this.texture.destroy(),defined(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),destroyObject(this),0):this.referenceCount},Imagery.prototype.processStateMachine=function(e,t,i){this.state!==ImageryState$1.UNLOADED||i||(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===ImageryState$1.RECEIVED&&(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));var r=this.state===ImageryState$1.READY&&t&&!this.texture;this.state!==ImageryState$1.TEXTURE_LOADED&&!r||(this.state=ImageryState$1.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};var ImagerySplitDirection={LEFT:-1,NONE:0,RIGHT:1},ImagerySplitDirection$1=freezeObject$1(ImagerySplitDirection);function TileImagery(e,t,i){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=i}function ImageryLayer(e,t){this._imageryProvider=e,t=defaultValue(t,defaultValue.EMPTY_OBJECT),this.alpha=defaultValue(t.alpha,defaultValue(e.defaultAlpha,1)),this.brightness=defaultValue(t.brightness,defaultValue(e.defaultBrightness,ImageryLayer.DEFAULT_BRIGHTNESS)),this.contrast=defaultValue(t.contrast,defaultValue(e.defaultContrast,ImageryLayer.DEFAULT_CONTRAST)),this.hue=defaultValue(t.hue,defaultValue(e.defaultHue,ImageryLayer.DEFAULT_HUE)),this.saturation=defaultValue(t.saturation,defaultValue(e.defaultSaturation,ImageryLayer.DEFAULT_SATURATION)),this.gamma=defaultValue(t.gamma,defaultValue(e.defaultGamma,ImageryLayer.DEFAULT_GAMMA)),this.splitDirection=defaultValue(t.splitDirection,defaultValue(e.defaultSplit,ImageryLayer.DEFAULT_SPLIT)),this.minificationFilter=defaultValue(t.minificationFilter,defaultValue(e.defaultMinificationFilter,ImageryLayer.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=defaultValue(t.magnificationFilter,defaultValue(e.defaultMagnificationFilter,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER)),this.show=defaultValue(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=defaultValue(t.rectangle,Rectangle.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new TileImagery(Imagery.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=defaultValue(t.colorToAlphaThreshold,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}TileImagery.prototype.freeResources=function(){defined(this.readyImagery)&&this.readyImagery.releaseReference(),defined(this.loadingImagery)&&this.loadingImagery.releaseReference()},TileImagery.prototype.processStateMachine=function(e,t,i){var r=this.loadingImagery,n=r.imageryLayer;if(r.processStateMachine(t,!this.useWebMercatorT,i),r.state===ImageryState$1.READY)return defined(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=n._calculateTextureTranslationAndScale(e,this),!0;for(var a,o=r.parent;defined(o)&&(o.state!==ImageryState$1.READY||!this.useWebMercatorT&&!defined(o.texture));)o.state!==ImageryState$1.FAILED&&o.state!==ImageryState$1.INVALID&&(a=a||o),o=o.parent;return this.readyImagery!==o&&(defined(this.readyImagery)&&this.readyImagery.releaseReference(),defined(this.readyImagery=o)&&(o.addReference(),this.textureTranslationAndScale=n._calculateTextureTranslationAndScale(e,this))),(r.state===ImageryState$1.FAILED||r.state===ImageryState$1.INVALID)&&(!defined(a)||(a.processStateMachine(t,!this.useWebMercatorT,i),!1))},defineProperties$1(ImageryLayer.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),ImageryLayer.DEFAULT_BRIGHTNESS=1,ImageryLayer.DEFAULT_CONTRAST=1,ImageryLayer.DEFAULT_HUE=0,ImageryLayer.DEFAULT_SATURATION=1,ImageryLayer.DEFAULT_GAMMA=1,ImageryLayer.DEFAULT_SPLIT=ImagerySplitDirection$1.NONE,ImageryLayer.DEFAULT_MINIFICATION_FILTER=TextureMinificationFilter$1.LINEAR,ImageryLayer.DEFAULT_MAGNIFICATION_FILTER=TextureMagnificationFilter$1.LINEAR,ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004,ImageryLayer.prototype.isBaseLayer=function(){return this._isBaseLayer},ImageryLayer.prototype.isDestroyed=function(){return!1},ImageryLayer.prototype.destroy=function(){return destroyObject(this)};var imageryBoundsScratch=new Rectangle,tileImageryBoundsScratch=new Rectangle,clippedRectangleScratch=new Rectangle,terrainRectangleScratch=new Rectangle;function getSamplerKey(e,t,i){return e+":"+t+":"+i}function getImageryCacheKey(e,t,i){return JSON.stringify([e,t,i])}ImageryLayer.prototype.getViewableRectangle=function(){var e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return Rectangle.intersection(e.rectangle,t)})},ImageryLayer.prototype._createTileImagerySkeletons=function(e,t,i){var r=e.data;if(defined(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(defined(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;var n=this._imageryProvider;if(defined(i)||(i=r.imagery.length),!n.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),r.imagery.splice(i,0,this._skeletonPlaceholder),!0;var a=n.tilingScheme.projection instanceof WebMercatorProjection&&e.rectangle.north<WebMercatorProjection.MaximumLatitude&&e.rectangle.south>-WebMercatorProjection.MaximumLatitude,o=Rectangle.intersection(n.rectangle,this._rectangle,imageryBoundsScratch),s=Rectangle.intersection(e.rectangle,o,tileImageryBoundsScratch);if(!defined(s)){if(!this.isBaseLayer())return!1;var l=o,c=e.rectangle;s=tileImageryBoundsScratch,c.south>=l.north?s.north=s.south=l.north:c.north<=l.south?s.north=s.south=l.south:(s.south=Math.max(c.south,l.south),s.north=Math.min(c.north,l.north)),c.west>=l.east?s.west=s.east=l.east:c.east<=l.west?s.west=s.east=l.west:(s.west=Math.max(c.west,l.west),s.east=Math.min(c.east,l.east))}var u=0;0<s.south?u=s.south:s.north<0&&(u=s.north);var d=getLevelWithMaximumTexelSpacing(this,1*t.getLevelMaximumGeometricError(e.level),u);d=Math.max(0,d);var h=n.maximumLevel;if(h<d&&(d=h),defined(n.minimumLevel)){var p=n.minimumLevel;d<p&&(d=p)}var m=n.tilingScheme,f=m.positionToTileXY(Rectangle.northwest(s),d),g=m.positionToTileXY(Rectangle.southeast(s),d),_=e.rectangle.width/512,y=e.rectangle.height/512,v=m.tileXYToRectangle(f.x,f.y,d);Math.abs(v.south-e.rectangle.north)<y&&f.y<g.y&&++f.y,Math.abs(v.east-e.rectangle.west)<_&&f.x<g.x&&++f.x;var C=m.tileXYToRectangle(g.x,g.y,d);Math.abs(C.north-e.rectangle.south)<y&&g.y>f.y&&--g.y,Math.abs(C.west-e.rectangle.east)<_&&g.x>f.x&&--g.x;var S,x,T=Rectangle.clone(e.rectangle,terrainRectangleScratch),b=m.tileXYToRectangle(f.x,f.y,d),E=Rectangle.intersection(b,o,clippedRectangleScratch);a?(m.rectangleToNativeRectangle(T,T),m.rectangleToNativeRectangle(b,b),m.rectangleToNativeRectangle(E,E),m.rectangleToNativeRectangle(o,o),S=m.tileXYToNativeRectangle.bind(m),_=T.width/512,y=T.height/512):S=m.tileXYToRectangle.bind(m);var P,A=0,w=1;!this.isBaseLayer()&&Math.abs(E.west-T.west)>=_&&(A=Math.min(1,(E.west-T.west)/T.width)),!this.isBaseLayer()&&Math.abs(E.north-T.north)>=y&&(w=Math.max(0,(E.north-T.south)/T.height));for(var D=w,M=f.x;M<=g.x;M++)if(x=A,b=S(M,f.y,d),defined(E=Rectangle.simpleIntersection(b,o,clippedRectangleScratch))){A=Math.min(1,(E.east-T.west)/T.width),M===g.x&&(this.isBaseLayer()||Math.abs(E.east-T.east)<_)&&(A=1),w=D;for(var I=f.y;I<=g.y;I++)if(P=w,b=S(M,I,d),defined(E=Rectangle.simpleIntersection(b,o,clippedRectangleScratch))){w=Math.max(0,(E.south-T.south)/T.height),I===g.y&&(this.isBaseLayer()||Math.abs(E.south-T.south)<y)&&(w=0);var R=new Cartesian4(x,w,A,P),O=this.getImageryFromCache(M,I,d);r.imagery.splice(i,0,new TileImagery(O,R,a)),++i}}return!0},ImageryLayer.prototype._calculateTextureTranslationAndScale=function(e,t){var i=t.readyImagery.rectangle,r=e.rectangle;if(t.useWebMercatorT){var n=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;i=n.rectangleToNativeRectangle(i,imageryBoundsScratch),r=n.rectangleToNativeRectangle(r,terrainRectangleScratch)}var a=r.width,o=r.height,s=a/i.width,l=o/i.height;return new Cartesian4(s*(r.west-i.west)/a,l*(r.south-i.south)/o,s,l)},ImageryLayer.prototype._requestImagery=function(n){var a=this._imageryProvider,o=this;function s(e){if(!defined(e))return l();n.image=e,n.state=ImageryState$1.RECEIVED,n.request=void 0,TileProviderError.handleSuccess(o._requestImageError)}function l(e){if(n.request.state===RequestState$1.CANCELLED)return n.state=ImageryState$1.UNLOADED,void(n.request=void 0);n.state=ImageryState$1.FAILED,n.request=void 0;var t="Failed to obtain image tile X: "+n.x+" Y: "+n.y+" Level: "+n.level+".";o._requestImageError=TileProviderError.handleError(o._requestImageError,a,a.errorEvent,t,n.x,n.y,n.level,i,e)}function i(){var e=new Request({throttle:!1,throttleByServer:!0,type:RequestType$1.IMAGERY});n.request=e,n.state=ImageryState$1.TRANSITIONING;var t=a.requestImage(n.x,n.y,n.level,e);if(!defined(t))return n.state=ImageryState$1.UNLOADED,void(n.request=void 0);if(defined(a.getTileCredits)&&(n.credits=a.getTileCredits(n.x,n.y,n.level)),defined(a.addImageryCache)){var i=o.getMaxLevel(),r={x:n.x,y:n.y,level:n.level,maxlevel:i,rectangle:{xmin:Number(Cesium.Math.toDegrees(n.rectangle.west).toFixed(6)),xmax:Number(Cesium.Math.toDegrees(n.rectangle.east).toFixed(6)),ymin:Number(Cesium.Math.toDegrees(n.rectangle.south).toFixed(6)),ymax:Number(Cesium.Math.toDegrees(n.rectangle.north).toFixed(6))}};a.addImageryCache(r)}when(t,s,l)}i()},ImageryLayer.prototype._createTextureWebGL=function(e,t){var i=new Sampler({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),r=t.image;return defined(r.internalFormat)?new Texture({context:e,pixelFormat:r.internalFormat,width:r.width,height:r.height,source:{arrayBufferView:r.bufferView},sampler:i}):new Texture({context:e,source:r,pixelFormat:this._imageryProvider.hasAlphaChannel?PixelFormat$1.RGBA:PixelFormat$1.RGB,sampler:i})},ImageryLayer.prototype._createTexture=function(e,t){var i=this._imageryProvider,r=t.image;if(defined(i.tileDiscardPolicy)){var n=i.tileDiscardPolicy;if(defined(n)){if(!n.isReady())return void(t.state=ImageryState$1.RECEIVED);if(n.shouldDiscardImage(r))return void(t.state=ImageryState$1.INVALID)}}var a=this._createTextureWebGL(e,t);i.tilingScheme.projection instanceof WebMercatorProjection?t.textureWebMercator=a:t.texture=a,t.image=void 0,t.state=ImageryState$1.TEXTURE_LOADED},ImageryLayer.prototype._finalizeReprojectTexture=function(e,t){var i=this.minificationFilter,r=this.magnificationFilter;if(i===TextureMinificationFilter$1.LINEAR&&r===TextureMagnificationFilter$1.LINEAR&&!PixelFormat$1.isCompressedFormat(t.pixelFormat)&&CesiumMath.isPowerOfTwo(t.width)&&CesiumMath.isPowerOfTwo(t.height)){i=TextureMinificationFilter$1.LINEAR_MIPMAP_LINEAR;var n=ContextLimits.maximumTextureFilterAnisotropy,a=Math.min(n,defaultValue(this._maximumAnisotropy,n)),o=getSamplerKey(i,r,a),s=e.cache.imageryLayerMipmapSamplers;defined(s)||(s={},e.cache.imageryLayerMipmapSamplers=s);var l=s[o];defined(l)||(l=s[o]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:i,magnificationFilter:r,maximumAnisotropy:a})),t.generateMipmap(MipmapHint$1.NICEST),t.sampler=l}else{var c=getSamplerKey(i,r,0),u=e.cache.imageryLayerNonMipmapSamplers;defined(u)||(u={},e.cache.imageryLayerNonMipmapSamplers=u);var d=u[c];defined(d)||(d=u[c]=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:i,magnificationFilter:r})),t.sampler=d}},ImageryLayer.prototype._reprojectTexture=function(e,t,i){var r=t.textureWebMercator||t.texture,n=t.rectangle,a=e.context;if((i=defaultValue(i,!0))&&!(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection)&&1e-5<n.width/r.width){var o=this;t.addReference();var s=new ComputeCommand({persists:!0,owner:this,preExecute:function(e){reprojectToGeographic(e,a,r,t.rectangle)},postExecute:function(e){t.texture=e,o._finalizeReprojectTexture(a,e),t.state=ImageryState$1.READY,t.releaseReference()}});this._reprojectComputeCommands.push(s)}else i&&(t.texture=r),this._finalizeReprojectTexture(a,r),t.state=ImageryState$1.READY},ImageryLayer.prototype.queueReprojectionCommands=function(e){for(var t=this._reprojectComputeCommands,i=t.length,r=0;r<i;++r)e.commandList.push(t[r]);t.length=0},ImageryLayer.prototype.cancelReprojections=function(){this._reprojectComputeCommands.length=0},ImageryLayer.prototype.getImageryFromCache=function(e,t,i,r){var n=getImageryCacheKey(e,t,i),a=this._imageryCache[n];return defined(a)||(a=new Imagery(this,e,t,i,r),this._imageryCache[n]=a),a.addReference(),a},ImageryLayer.prototype.removeImageryFromCache=function(e){var t=this._imageryProvider;if(defined(t.removeImageryCache)){var i=this.getMaxLevel(),r={x:e.x,y:e.y,level:e.level,maxLevel:i,rectangle:{xmin:Number(Cesium.Math.toDegrees(e.rectangle.west).toFixed(6)),xmax:Number(Cesium.Math.toDegrees(e.rectangle.east).toFixed(6)),ymin:Number(Cesium.Math.toDegrees(e.rectangle.south).toFixed(6)),ymax:Number(Cesium.Math.toDegrees(e.rectangle.north).toFixed(6))}};t.removeImageryCache(r)}var n=getImageryCacheKey(e.x,e.y,e.level);delete this._imageryCache[n]},ImageryLayer.prototype.getMaxLevel=function(){var e=0;for(var t in this._imageryCache){var i=this._imageryCache[t];i.level>e&&(e=i.level)}return e};var uniformMap={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new Cartesian2,texture:void 0},float32ArrayScratch=FeatureDetection.supportsTypedArrays()?new Float32Array(128):void 0;function reprojectToGeographic(e,t,i,r){var n=t.cache.imageryLayer_reproject;if(!defined(n)){n=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){defined(this.framebuffer)&&this.framebuffer.destroy(),defined(this.vertexArray)&&this.vertexArray.destroy(),defined(this.shaderProgram)&&this.shaderProgram.destroy()}};for(var a=new Float32Array(256),o=0,s=0;s<64;++s){var l=s/63;a[o++]=0,a[o++]=l,a[o++]=1,a[o++]=l}var c={position:0,webMercatorT:1},u=TerrainProvider.getRegularGridIndices(2,64),d=Buffer$1.createIndexBuffer({context:t,typedArray:u,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});n.vertexArray=new VertexArray({context:t,attributes:[{index:c.position,vertexBuffer:Buffer$1.createVertexBuffer({context:t,typedArray:a,usage:BufferUsage$1.STATIC_DRAW}),componentsPerAttribute:2},{index:c.webMercatorT,vertexBuffer:Buffer$1.createVertexBuffer({context:t,sizeInBytes:512,usage:BufferUsage$1.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:d});var h=new ShaderSource({sources:[ReprojectWebMercatorVS]});n.shaderProgram=ShaderProgram.fromCache({context:t,vertexShaderSource:h,fragmentShaderSource:ReprojectWebMercatorFS,attributeLocations:c}),n.sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}i.sampler=n.sampler;var p=i.width,m=i.height;uniformMap.textureDimensions.x=p,uniformMap.textureDimensions.y=m,uniformMap.texture=i;var f=Math.sin(r.south),g=.5*Math.log((1+f)/(1-f));f=Math.sin(r.north);var _=1/(.5*Math.log((1+f)/(1-f))-g),y=new Texture({context:t,width:p,height:m,pixelFormat:i.pixelFormat,pixelDatatype:i.pixelDatatype,preMultiplyAlpha:i.preMultiplyAlpha});CesiumMath.isPowerOfTwo(p)&&CesiumMath.isPowerOfTwo(m)&&y.generateMipmap(MipmapHint$1.NICEST);for(var v=r.south,C=r.north,S=float32ArrayScratch,x=0,T=0;T<64;++T){var b=T/63,E=CesiumMath.lerp(v,C,b);f=Math.sin(E);var P=(.5*Math.log((1+f)/(1-f))-g)*_;S[x++]=P,S[x++]=P}n.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(S),e.shaderProgram=n.shaderProgram,e.outputTexture=y,e.uniformMap=uniformMap,e.vertexArray=n.vertexArray}function getLevelWithMaximumTexelSpacing(e,t,i){var r=e._imageryProvider,n=r.tilingScheme,a=n.ellipsoid,o=e._imageryProvider.tilingScheme.projection instanceof GeographicProjection?1:Math.cos(i),s=n.rectangle,l=a.maximumRadius*s.width*o/(r.tileWidth*n.getNumberOfXTilesAtLevel(0))/t,c=Math.log(l)/Math.log(2);return 0|Math.round(c)}var TileSelectionResult={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>=TileSelectionResult.RENDERED_AND_KICKED},originalResult:function(e){return 3&e},kick:function(e){return 4|e}};function TerrainFillMesh(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 Cartesian4}TerrainFillMesh.prototype.update=function(e,t,i){this.changedThisFrame&&(createFillMesh(e,t,this.tile,i),this.changedThisFrame=!1)},TerrainFillMesh.prototype.destroy=function(e){defined(this.vertexArray)&&(defined(e)?e.push(this.vertexArray):GlobeSurfaceTile._freeVertexArray(this.vertexArray,e),this.vertexArray=void 0),defined(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};var traversalQueueScratch=new Queue;function visitRenderedTiles(e,t,i,r,n,a,o,s,l){if(void 0!==r){for(var c=r;c&&(c._lastSelectionResultFrame!==n||TileSelectionResult.wasKicked(c._lastSelectionResult)||TileSelectionResult.originalResult(c._lastSelectionResult)===TileSelectionResult.CULLED);){if(o)return;var u=c.parent;if(a>=TileEdge.NORTHWEST&&void 0!==u)switch(a){case TileEdge.NORTHWEST:c=c===u.northwestChild?u:void 0;break;case TileEdge.NORTHEAST:c=c===u.northeastChild?u:void 0;break;case TileEdge.SOUTHWEST:c=c===u.southwestChild?u:void 0;break;case TileEdge.SOUTHEAST:c=c===u.southeastChild?u:void 0}else c=u}if(void 0!==c)if(c._lastSelectionResult!==TileSelectionResult.RENDERED){if(TileSelectionResult.originalResult(r._lastSelectionResult)!==TileSelectionResult.CULLED)switch(a){case TileEdge.WEST:visitRenderedTiles(e,t,i,r.northwestChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.southwestChild,n,a,!0,s,l);break;case TileEdge.EAST:visitRenderedTiles(e,t,i,r.southeastChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.northeastChild,n,a,!0,s,l);break;case TileEdge.SOUTH:visitRenderedTiles(e,t,i,r.southwestChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.southeastChild,n,a,!0,s,l);break;case TileEdge.NORTH:visitRenderedTiles(e,t,i,r.northeastChild,n,a,!0,s,l),visitRenderedTiles(e,t,i,r.northwestChild,n,a,!0,s,l);break;case TileEdge.NORTHWEST:visitRenderedTiles(e,t,i,r.northwestChild,n,a,!0,s,l);break;case TileEdge.NORTHEAST:visitRenderedTiles(e,t,i,r.northeastChild,n,a,!0,s,l);break;case TileEdge.SOUTHWEST:visitRenderedTiles(e,t,i,r.southwestChild,n,a,!0,s,l);break;case TileEdge.SOUTHEAST:visitRenderedTiles(e,t,i,r.southeastChild,n,a,!0,s,l);break;default:throw new DeveloperError("Invalid edge")}}else{if(defined(c.data.vertexArray))return;visitTile$2(e,t,i,c,a,n,s,l)}}}function visitTile$2(e,t,i,r,n,a,o,s){var l=r.data;if(void 0===l.fill)l.fill=new TerrainFillMesh(r);else if(l.fill.visitedFrame===a)return;l.fill.enqueuedFrame!==a&&(l.fill.enqueuedFrame=a,l.fill.changedThisFrame=!1,o.enqueue(r)),propagateEdge(e,t,i,r,n,s)}function propagateEdge(e,t,i,r,n,a){var o,s,l,c,u,d,h=r.data.fill,p=i.data.fill;switch(o=defined(p)?(p.visitedFrame=t.frameNumber,p.changedThisFrame&&(createFillMesh(e,t,i,a),p.changedThisFrame=!1),i.data.fill.mesh):i.data.mesh,n){case TileEdge.WEST:s=h.westMeshes,l=h.westTiles;break;case TileEdge.SOUTH:s=h.southMeshes,l=h.southTiles;break;case TileEdge.EAST:s=h.eastMeshes,l=h.eastTiles;break;case TileEdge.NORTH:s=h.northMeshes,l=h.northTiles;break;case TileEdge.NORTHWEST:return h.changedThisFrame=h.changedThisFrame||h.northwestMesh!==o,h.northwestMesh=o,void(h.northwestTile=i);case TileEdge.NORTHEAST:return h.changedThisFrame=h.changedThisFrame||h.northeastMesh!==o,h.northeastMesh=o,void(h.northeastTile=i);case TileEdge.SOUTHWEST:return h.changedThisFrame=h.changedThisFrame||h.southwestMesh!==o,h.southwestMesh=o,void(h.southwestTile=i);case TileEdge.SOUTHEAST:return h.changedThisFrame=h.changedThisFrame||h.southeastMesh!==o,h.southeastMesh=o,void(h.southeastTile=i)}if(i.level<=r.level)return h.changedThisFrame=h.changedThisFrame||s[0]!==o||1!==s.length,s[0]=o,l[0]=i,s.length=1,void(l.length=1);var m,f=i.rectangle,g=r.rectangle;switch(n){case TileEdge.WEST:for(m=(g.north-g.south)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.greaterThan(f.north,d.south,m));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.greaterThanOrEquals(f.south,d.north,m));++u);break;case TileEdge.SOUTH:for(m=(g.east-g.west)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.lessThan(f.west,d.east,m));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.lessThanOrEquals(f.east,d.west,m));++u);break;case TileEdge.EAST:for(m=(g.north-g.south)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.lessThan(f.south,d.north,m));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.lessThanOrEquals(f.north,d.south,m));++u);break;case TileEdge.NORTH:for(m=(g.east-g.west)*CesiumMath.EPSILON5,c=0;c<l.length&&(d=l[c].rectangle,!CesiumMath.greaterThan(f.east,d.west,m));++c);for(u=c;u<l.length&&(d=l[u].rectangle,!CesiumMath.greaterThanOrEquals(f.west,d.east,m));++u);}u-c==1?(h.changedThisFrame=h.changedThisFrame||s[c]!==o,s[c]=o,l[c]=i):(h.changedThisFrame=!0,s.splice(c,u-c,o),l.splice(c,u-c,i))}TerrainFillMesh.updateFillTiles=function(e,t,i,r){var n=e._quadtree,a=n._levelZeroTiles,o=n._lastSelectionFrameNumber,s=traversalQueueScratch;s.clear();for(var l=0;l<t.length;++l){defined(t[l].data.vertexArray)&&s.enqueue(t[l])}for(var c=s.dequeue();void 0!==c;){var u=c.findTileToWest(a),d=c.findTileToSouth(a),h=c.findTileToEast(a),p=c.findTileToNorth(a);visitRenderedTiles(e,i,c,u,o,TileEdge.EAST,!1,s,r),visitRenderedTiles(e,i,c,d,o,TileEdge.NORTH,!1,s,r),visitRenderedTiles(e,i,c,h,o,TileEdge.WEST,!1,s,r),visitRenderedTiles(e,i,c,p,o,TileEdge.SOUTH,!1,s,r);var m=u.findTileToNorth(a),f=u.findTileToSouth(a),g=h.findTileToNorth(a),_=h.findTileToSouth(a);visitRenderedTiles(e,i,c,m,o,TileEdge.SOUTHEAST,!1,s,r),visitRenderedTiles(e,i,c,g,o,TileEdge.SOUTHWEST,!1,s,r),visitRenderedTiles(e,i,c,f,o,TileEdge.NORTHEAST,!1,s,r),visitRenderedTiles(e,i,c,_,o,TileEdge.NORTHWEST,!1,s,r),c=s.dequeue()}};var cartographicScratch$4=new Cartographic,centerCartographicScratch=new Cartographic,cartesianScratch=new Cartesian3,normalScratch$5=new Cartesian3,octEncodedNormalScratch=new Cartesian2,uvScratch2=new Cartesian2,uvScratch=new Cartesian2;function HeightAndNormal(){this.height=0,this.encodedNormal=new Cartesian2}function fillMissingCorner(e,t,i,r,n,a,o,s,l){if(defined(n))return n;var c;if(defined(a)&&defined(o))c=.5*(a.height+o.height);else if(defined(a))c=a.height;else if(defined(o))c=o.height;else if(defined(s))c=s.height;else{var u=e.tile.data.tileBoundingRegion,d=0,h=0;defined(u)&&(d=u.minimumHeight,h=u.maximumHeight),c=.5*(d+h)}return getVertexWithHeightAtCorner(e,t,i,r,c,l),l}var heightRangeScratch={minimumHeight:0,maximumHeight:0},swVertexScratch=new HeightAndNormal,seVertexScratch=new HeightAndNormal,nwVertexScratch=new HeightAndNormal,neVertexScratch=new HeightAndNormal,heightmapBuffer="undefined"!=typeof Uint8Array?new Uint8Array(81):void 0;function createFillMesh(e,t,i,r){GlobeSurfaceTile.initialize(i,e.terrainProvider,e._imageryLayers);var n=i.data,a=n.fill,o=i.rectangle,s=i.tilingScheme.ellipsoid,l=getCorner(a,s,0,1,a.northwestTile,a.northwestMesh,a.northTiles,a.northMeshes,a.westTiles,a.westMeshes,nwVertexScratch),c=getCorner(a,s,0,0,a.southwestTile,a.southwestMesh,a.westTiles,a.westMeshes,a.southTiles,a.southMeshes,swVertexScratch),u=getCorner(a,s,1,0,a.southeastTile,a.southeastMesh,a.southTiles,a.southMeshes,a.eastTiles,a.eastMeshes,seVertexScratch),d=getCorner(a,s,1,1,a.northeastTile,a.northeastMesh,a.eastTiles,a.eastMeshes,a.northTiles,a.northMeshes,neVertexScratch);d=fillMissingCorner(a,s,1,1,d,u=fillMissingCorner(a,s,1,1,u,c=fillMissingCorner(a,s,0,0,c,l=fillMissingCorner(a,s,0,1,l,c,d,u,nwVertexScratch),u,d,swVertexScratch),d,l,seVertexScratch),l,c,neVertexScratch);var h,p,m=c.height,f=u.height,g=l.height,_=d.height,y=Math.min(m,f,g,_),v=Math.max(m,f,g,_),C=.5*(y+v),S=e.getLevelMaximumGeometricError(i.level),x=s.maximumRadius-S,T=4*Math.acos(x/s.maximumRadius);if(T*=1.5,o.width>T&&v-y<=S){var b=new HeightmapTerrainData({width:9,height:9,buffer:heightmapBuffer,structure:{heightOffset:v}});a.mesh=b._createMeshSync(i.tilingScheme,i.x,i.y,i.level,1)}else{var E=new TerrainEncoding(void 0,void 0,void 0,void 0,!0,!0),P=centerCartographicScratch;P.longitude=.5*(o.east+o.west),P.latitude=.5*(o.north+o.south),P.height=C,E.center=s.cartographicToCartesian(P,E.center);var A,w=5;for(h=0,p=(A=a.westMeshes).length;h<p;++h)w+=A[h].eastIndicesNorthToSouth.length;for(h=0,p=(A=a.southMeshes).length;h<p;++h)w+=A[h].northIndicesWestToEast.length;for(h=0,p=(A=a.eastMeshes).length;h<p;++h)w+=A[h].westIndicesSouthToNorth.length;for(h=0,p=(A=a.northMeshes).length;h<p;++h)w+=A[h].southIndicesEastToWest.length;var D=heightRangeScratch;D.minimumHeight=y,D.maximumHeight=v;var M=E.getStride(),I=new Float32Array(w*M),R=0,O=R,L=R=addEdge(a,s,E,I,R=addVertexWithComputedPosition(s,o,E,I,R,0,1,l.height,l.encodedNormal,1,D),a.westTiles,a.westMeshes,TileEdge.EAST,D),F=R=addEdge(a,s,E,I,R=addVertexWithComputedPosition(s,o,E,I,R,0,0,c.height,c.encodedNormal,0,D),a.southTiles,a.southMeshes,TileEdge.NORTH,D),N=R=addEdge(a,s,E,I,R=addVertexWithComputedPosition(s,o,E,I,R,1,0,u.height,u.encodedNormal,0,D),a.eastTiles,a.eastMeshes,TileEdge.WEST,D);R=addEdge(a,s,E,I,R=addVertexWithComputedPosition(s,o,E,I,R,1,1,d.height,d.encodedNormal,1,D),a.northTiles,a.northMeshes,TileEdge.SOUTH,D),y=D.minimumHeight,v=D.maximumHeight;var B=OrientedBoundingBox.fromRectangle(o,y,v,i.tilingScheme.ellipsoid),V=WebMercatorProjection.geodeticLatitudeToMercatorAngle(o.south),k=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(o.north)-V),$=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(P.latitude)-V)*k;s.geodeticSurfaceNormalCartographic(cartographicScratch$4,normalScratch$5);var z=AttributeCompression.octEncode(normalScratch$5,octEncodedNormalScratch),U=R;E.encode(I,R*M,B.center,Cartesian2.fromElements(.5,.5,uvScratch),C,z,$);var G,H=++R,W=3*(H-1);if(W*(H<256?1:2)<=(I.length-H*M)*Float32Array.BYTES_PER_ELEMENT){var q=H*M*Float32Array.BYTES_PER_ELEMENT;G=H<256?new Uint8Array(I.buffer,q,W):new Uint16Array(I.buffer,q,W)}else G=H<256?new Uint8Array(W):new Uint16Array(W);I=new Float32Array(I.buffer,0,H*M);var j=0;for(h=0;h<H-2;++h)G[j++]=U,G[j++]=h,G[j++]=h+1;G[j++]=U,G[j++]=h,G[j++]=0;var Y=[];for(h=L;O<=h;--h)Y.push(h);var X=[];for(h=F;L<=h;--h)X.push(h);var Q=[];for(h=N;F<=h;--h)Q.push(h);var J=[];for(J.push(0),h=U-1;N<=h;--h)J.push(h);a.mesh=new TerrainMesh(E.center,I,G,y,v,BoundingSphere.fromOrientedBoundingBox(B),computeOccludeePoint(e,B.center,o,v),E.getStride(),B,E,t.terrainExaggeration,Y,X,Q,J)}var Z=t.context;defined(a.vertexArray)&&(defined(r)?r.push(a.vertexArray):GlobeSurfaceTile._freeVertexArray(a.vertexArray)),a.vertexArray=GlobeSurfaceTile._createVertexArrayForMesh(Z,a.mesh),n.processImagery(i,e.terrainProvider,t,!0);var K=a.waterMaskTexture;if(a.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){var ee=n._findAncestorTileWithTerrainData(i);defined(ee)&&defined(ee.data.waterMaskTexture)&&(a.waterMaskTexture=ee.data.waterMaskTexture,++a.waterMaskTexture.referenceCount,n._computeWaterMaskTranslationAndScale(i,ee,a.waterMaskTranslationAndScale))}defined(K)&&(--K.referenceCount,0===K.referenceCount&&K.destroy())}function addVertexWithComputedPosition(e,t,i,r,n,a,o,s,l,c,u){var d=cartographicScratch$4;d.longitude=CesiumMath.lerp(t.west,t.east,a),d.latitude=CesiumMath.lerp(t.south,t.north,o),d.height=s;var h=e.cartographicToCartesian(d,cartesianScratch),p=uvScratch2;return p.x=a,p.y=o,i.encode(r,n*i.getStride(),h,p,s,l,c),u.minimumHeight=Math.min(u.minimumHeight,s),u.maximumHeight=Math.max(u.maximumHeight,s),n+1}var sourceRectangleScratch=new Rectangle;function transformTextureCoordinates(e,t,i,r){var n=e.rectangle,a=t.rectangle;0===t.x&&1===i.x&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?((n=Rectangle.clone(e.rectangle,sourceRectangleScratch)).west-=CesiumMath.TWO_PI,n.east-=CesiumMath.TWO_PI):0===e.x&&0===i.x&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&((n=Rectangle.clone(e.rectangle,sourceRectangleScratch)).west+=CesiumMath.TWO_PI,n.east+=CesiumMath.TWO_PI);var o=n.east-n.west,s=(a.west-n.west)/o,l=(a.east-n.west)/o,c=n.north-n.south,u=(a.south-n.south)/c,d=(a.north-n.south)/c,h=(i.x-s)/(l-s),p=(i.y-u)/(d-u);return Math.abs(h)<Math.EPSILON5?h=0:Math.abs(h-1)<Math.EPSILON5&&(h=1),Math.abs(p)<Math.EPSILON5?p=0:Math.abs(p-1)<Math.EPSILON5&&(p=1),r.x=h,r.y=p,r}var encodedNormalScratch=new Cartesian2;function getVertexFromTileAtCorner(e,t,i,r,n){var a=e.encoding,o=e.vertices;if(n.height=a.decodeHeight(o,t),a.hasVertexNormals)a.getOctEncodedNormal(o,t,n.encodedNormal);else{var s=n.encodedNormal;s.x=0,s.y=0}}var encodedNormalScratch2=new Cartesian2,cartesianScratch2=new Cartesian3;function getInterpolatedVertexAtCorner(e,t,i,r,n,a,o,s,l,c){var u,d=r.encoding,h=r.vertices,p=transformTextureCoordinates(t,i,d.decodeTextureCoordinates(h,n,uvScratch),uvScratch),m=transformTextureCoordinates(t,i,d.decodeTextureCoordinates(h,a,uvScratch2),uvScratch2);u=l?(o-p.x)/(m.x-p.x):(s-p.y)/(m.y-p.y);var f,g=d.decodeHeight(h,n),_=d.decodeHeight(h,a),y=i.rectangle;if(cartographicScratch$4.longitude=CesiumMath.lerp(y.west,y.east,o),cartographicScratch$4.latitude=CesiumMath.lerp(y.south,y.north,s),c.height=cartographicScratch$4.height=CesiumMath.lerp(g,_,u),d.hasVertexNormals){var v=d.getOctEncodedNormal(h,n,encodedNormalScratch),C=d.getOctEncodedNormal(h,a,encodedNormalScratch2),S=AttributeCompression.octDecode(v.x,v.y,cartesianScratch),x=AttributeCompression.octDecode(C.x,C.y,cartesianScratch2);f=Cartesian3.lerp(S,x,u,cartesianScratch),Cartesian3.normalize(f,f),AttributeCompression.octEncode(f,c.encodedNormal)}else f=e.geodeticSurfaceNormalCartographic(cartographicScratch$4,cartesianScratch),AttributeCompression.octEncode(f,c.encodedNormal)}function getVertexWithHeightAtCorner(e,t,i,r,n,a){a.height=n;var o=t.geodeticSurfaceNormalCartographic(cartographicScratch$4,cartesianScratch);AttributeCompression.octEncode(o,a.encodedNormal)}function getCorner(e,t,i,r,n,a,o,s,l,c,u){var d;return getCornerFromEdge(e,t,s,o,!1,i,r,u)||getCornerFromEdge(e,t,c,l,!0,i,r,u)?u:meshIsUsable(n,a)?(getVertexFromTileAtCorner(a,0===i?0===r?a.eastIndicesNorthToSouth[0]:a.southIndicesEastToWest[0]:0===r?a.northIndicesWestToEast[0]:a.westIndicesSouthToNorth[0],i,r,u),u):defined(d=0===i?0===r?getClosestHeightToCorner(e.westMeshes,e.westTiles,TileEdge.EAST,e.southMeshes,e.southTiles,TileEdge.NORTH):getClosestHeightToCorner(e.northMeshes,e.northTiles,TileEdge.SOUTH,e.westMeshes,e.westTiles,TileEdge.EAST):0===r?getClosestHeightToCorner(e.southMeshes,e.southTiles,TileEdge.NORTH,e.eastMeshes,e.eastTiles,TileEdge.WEST):getClosestHeightToCorner(e.eastMeshes,e.eastTiles,TileEdge.WEST,e.northMeshes,e.northTiles,TileEdge.SOUTH))?(getVertexWithHeightAtCorner(e,t,i,r,d,u),u):void 0}function getClosestHeightToCorner(e,t,i,r,n,a,o,s){var l=getNearestHeightOnEdge(e,t,!1,i),c=getNearestHeightOnEdge(r,n,!0,a);return defined(l)&&defined(c)?.5*(l+c):defined(l)?l:c}function addEdge(e,t,i,r,n,a,o,s,l){for(var c=0;c<a.length;++c)n=addEdgeMesh(e,t,i,r,n,a[c],o[c],s,l);return n}function addEdgeMesh(e,t,i,r,n,a,o,s,l){var c=a.rectangle;s===TileEdge.EAST&&0===e.tile.x?((c=Rectangle.clone(a.rectangle,sourceRectangleScratch)).west-=CesiumMath.TWO_PI,c.east-=CesiumMath.TWO_PI):s===TileEdge.WEST&&0===a.x&&((c=Rectangle.clone(a.rectangle,sourceRectangleScratch)).west+=CesiumMath.TWO_PI,c.east+=CesiumMath.TWO_PI);var u,d,h,p,m=e.tile.rectangle;switch(0<n&&(i.decodeTextureCoordinates(r,n-1,uvScratch),u=uvScratch.x,d=uvScratch.y),s){case TileEdge.WEST:h=o.westIndicesSouthToNorth,p=!1;break;case TileEdge.NORTH:h=o.northIndicesWestToEast,p=!0;break;case TileEdge.EAST:h=o.eastIndicesNorthToSouth,p=!1;break;case TileEdge.SOUTH:h=o.southIndicesEastToWest,p=!0}var f,g,_=a,y=e.tile,v=o.encoding,C=o.vertices,S=i.getStride();v.hasWebMercatorT&&(f=WebMercatorProjection.geodeticLatitudeToMercatorAngle(m.south),g=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(m.north)-f));for(var x=0;x<h.length;++x){var T=h[x],b=v.decodeTextureCoordinates(C,T,uvScratch);transformTextureCoordinates(_,y,b,b);var E=b.x,P=b.y,A=p?E:P;if(!(A<0||1<A)&&!(Math.abs(E-u)<CesiumMath.EPSILON5&&Math.abs(P-d)<CesiumMath.EPSILON5)){var w=Math.abs(E)<CesiumMath.EPSILON5||Math.abs(E-1)<CesiumMath.EPSILON5,D=Math.abs(P)<CesiumMath.EPSILON5||Math.abs(P-1)<CesiumMath.EPSILON5;if(!w||!D){var M,I=v.decodePosition(C,T,cartesianScratch),R=v.decodeHeight(C,T);v.hasVertexNormals?M=v.getOctEncodedNormal(C,T,octEncodedNormalScratch):((M=octEncodedNormalScratch).x=0,M.y=0);var O=P;if(v.hasWebMercatorT){var L=CesiumMath.lerp(m.south,m.north,P);O=(WebMercatorProjection.geodeticLatitudeToMercatorAngle(L)-f)*g}i.encode(r,n*S,I,b,R,M,O),l.minimumHeight=Math.min(l.minimumHeight,R),l.maximumHeight=Math.max(l.maximumHeight,R),++n}}}return n}function getNearestHeightOnEdge(e,t,i,r,n,a){var o,s,l;l=i?(o=0,s=e.length,1):(o=e.length-1,s=-1);for(var c=o;c!==s;c+=l){var u=e[c];if(meshIsUsable(t[c],u)){var d;switch(r){case TileEdge.WEST:d=u.westIndicesSouthToNorth;break;case TileEdge.SOUTH:d=u.southIndicesEastToWest;break;case TileEdge.EAST:d=u.eastIndicesNorthToSouth;break;case TileEdge.NORTH:d=u.northIndicesWestToEast}var h=d[i?0:d.length-1];if(defined(h))return u.encoding.decodeHeight(u.vertices,h)}}}function meshIsUsable(e,t){return defined(t)&&(!defined(e.data.fill)||!e.data.fill.changedThisFrame)}function getCornerFromEdge(r,e,t,i,n,a,o,s){var l,c,u,d,h,p=i[n?0:t.length-1],m=t[n?0:t.length-1];if(meshIsUsable(p,m)&&(u=0===a?0===o?(l=n?m.northIndicesWestToEast:m.eastIndicesNorthToSouth,c=n):(l=n?m.eastIndicesNorthToSouth:m.southIndicesEastToWest,c=!n,!1):0===o?(l=n?m.westIndicesSouthToNorth:m.northIndicesWestToEast,c=!n,!0):(l=n?m.southIndicesEastToWest:m.westIndicesSouthToNorth,!(c=n)),0<l.length)){h=l[d=n?0:l.length-1],m.encoding.decodeTextureCoordinates(m.vertices,h,uvScratch);var f=transformTextureCoordinates(p,r.tile,uvScratch,uvScratch);if(f.x===a&&f.y===o)return getVertexFromTileAtCorner(m,h,a,o,s),!0;if(!((d=binarySearch(l,c?a:o,function(e,t){m.encoding.decodeTextureCoordinates(m.vertices,e,uvScratch);var i=transformTextureCoordinates(p,r.tile,uvScratch,uvScratch);return u?c?i.x-a:i.y-o:c?a-i.x:o-i.y}))<0))return getVertexFromTileAtCorner(m,l[d],a,o,s),!0;if(0<(d=~d)&&d<l.length)return getInterpolatedVertexAtCorner(e,p,r.tile,m,l[d-1],l[d],a,o,c,s),!0}return!1}var cornerPositionsScratch=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint(e,t,i,r,n){var a=e.quadtree._occluders.ellipsoid,o=a.ellipsoid,s=cornerPositionsScratch;return Cartesian3.fromRadians(i.west,i.south,r,o,s[0]),Cartesian3.fromRadians(i.east,i.south,r,o,s[1]),Cartesian3.fromRadians(i.west,i.north,r,o,s[2]),Cartesian3.fromRadians(i.east,i.north,r,o,s[3]),a.computeHorizonCullingPoint(t,s,n)}function GlobeSurfaceTileProvider(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.showGroundAtmosphere=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=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._errorEvent=new Event,this._imageryLayers.layerAdded.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Event,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 Color(0,0,.5,1),this._clippingPlanes=void 0,this.cartographicLimitRectangle=Rectangle.clone(Rectangle.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1}function sortTileImageryByLayerIndex(e,t){var i=e.loadingImagery;defined(i)||(i=e.readyImagery);var r=t.loadingImagery;return defined(r)||(r=t.readyImagery),i.imageryLayer._layerIndex-r.imageryLayer._layerIndex}function updateCredits(e,t){var i=t.creditDisplay;e._terrainProvider.ready&&defined(e._terrainProvider.credit)&&i.addCredit(e._terrainProvider.credit);for(var r=e._imageryLayers,n=0,a=r.length;n<a;++n){var o=r.get(n).imageryProvider;o.ready&&defined(o.credit)&&i.addCredit(o.credit)}}defineProperties$1(GlobeSurfaceTileProvider.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=Cartesian4.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){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,defined(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}}}),GlobeSurfaceTileProvider.prototype.update=function(e){this._imageryLayers._update()},GlobeSurfaceTileProvider.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(e){e.data.imagery.sort(sortTileImageryByLayerIndex)})),updateCredits(this,e);for(var t=this._vertexArraysToDestroy,i=t.length,r=0;r<i;++r)GlobeSurfaceTile._freeVertexArray(t[r]);t.length=0},GlobeSurfaceTileProvider.prototype.beginUpdate=function(e){for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;i<r;++i){var n=t[i];defined(n)&&(n.length=0)}var a=this._clippingPlanes;defined(a)&&a.enabled&&a.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1},GlobeSurfaceTileProvider.prototype.endUpdate=function(e){defined(this._renderState)||(this._renderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS}}),this._blendRenderState=RenderState.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:DepthFunction$1.LESS_OR_EQUAL},blending:BlendingState$1.ALPHA_BLEND})),this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&TerrainFillMesh.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;i<r;++i){var n=t[i];if(defined(n))for(var a=0,o=n.length;a<o;++a)addDrawCommandsForTile(this,n[a],e)}},GlobeSurfaceTileProvider.prototype.updateForPick=function(e){for(var t=this._drawCommands,i=0,r=this._usedDrawCommands;i<r;++i)e.commandList.push(t[i])},GlobeSurfaceTileProvider.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()},GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},GlobeSurfaceTileProvider.prototype.loadTile=function(e,t){var i,r=t.data,n=!0;defined(r)&&(n=r.boundingVolumeSourceTile!==t||t._lastSelectionResult===TileSelectionResult.CULLED_BUT_NEEDED,i=r.terrainState),GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this._vertexArraysToDestroy,n),r=t.data,n&&i!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)&&r.boundingVolumeSourceTile===t&&(n=!1,GlobeSurfaceTile.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this._vertexArraysToDestroy,n))};var boundingSphereScratch$1=new BoundingSphere,rectangleIntersectionScratch=new Rectangle,splitCartographicLimitRectangleScratch=new Rectangle,rectangleCenterScratch$3=new Cartographic;function clipRectangleAntimeridian(e,t){if(t.west<t.east)return t;var i=Rectangle.clone(t,splitCartographicLimitRectangleScratch);return 0<Rectangle.center(e,rectangleCenterScratch$3).longitude?i.east=CesiumMath.PI:i.west=-CesiumMath.PI,i}GlobeSurfaceTileProvider.prototype.computeTileVisibility=function(e,t,i){var r=this.computeDistanceToTile(e,t);if(e._distance=r,t.fog.enabled&&1<=CesiumMath.fog(r,t.fog.density))return Visibility$1.NONE;var n=e.data,a=n.tileBoundingRegion;if(void 0===n.boundingVolumeSourceTile)return Visibility$1.PARTIAL;var o=t.cullingVolume,s=n.orientedBoundingBox;!defined(s)&&defined(n.renderedMesh)&&(s=n.renderedMesh.boundingSphere3D),n.clippedByBoundaries=!1;var l=clipRectangleAntimeridian(e.rectangle,this.cartographicLimitRectangle),c=Rectangle.simpleIntersection(l,e.rectangle,rectangleIntersectionScratch);if(!defined(c))return Visibility$1.NONE;if(Rectangle.equals(c,e.rectangle)||(n.clippedByBoundaries=!0),t.mode!==SceneMode$1.SCENE3D&&(s=boundingSphereScratch$1,BoundingSphere.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,a.minimumHeight,a.maximumHeight,s),Cartesian3.fromElements(s.center.z,s.center.x,s.center.y,s.center),t.mode===SceneMode$1.MORPHING&&defined(n.renderedMesh)&&(s=BoundingSphere.union(n.renderedMesh.boundingSphere3D,s,s))),!defined(s))return Intersect$1.INTERSECTING;var u=this._clippingPlanes;if(defined(u)&&u.enabled){var d=u.computeIntersectionWithBoundingVolume(s);if(e.isClipped=d!==Intersect$1.INSIDE,d===Intersect$1.OUTSIDE)return Visibility$1.NONE}var h=o.computeVisibility(s);if(h===Intersect$1.OUTSIDE)return Visibility$1.NONE;var p=t.mode===SceneMode$1.SCENE3D&&t.camera.frustum instanceof OrthographicFrustum;if(t.mode!==SceneMode$1.SCENE3D||p||!defined(i))return h;var m=n.occludeePointInScaledSpace;return defined(m)?i.ellipsoid.isScaledSpacePointVisible(m)?h:Visibility$1.NONE:h},GlobeSurfaceTileProvider.prototype.canRefine=function(e){return!!defined(e.data.terrainData)||void 0!==this.terrainProvider.getTileDataAvailable(2*e.x,2*e.y,e.level+1)};var readyImageryScratch=[],canRenderTraversalStack=[];GlobeSurfaceTileProvider.prototype.canRenderWithoutLosingDetail=function(e,t){var i=e.data,r=readyImageryScratch;r.length=this._imageryLayers.length;var n,a,o,s=!1,l=!1;for(defined(i)&&(s=i.terrainState===TerrainState$2.READY,l=!0,n=i.imagery),a=0,o=r.length;a<o;++a)r[a]=l;if(defined(n))for(a=0,o=n.length;a<o;++a){var c=n[a],u=c.loadingImagery,d=!defined(u)||u.state===ImageryState$1.FAILED||u.state===ImageryState$1.INVALID,h=(c.loadingImagery||c.readyImagery).imageryLayer._layerIndex;r[h]=d&&r[h]}var p=this.quadtree._lastSelectionFrameNumber,m=canRenderTraversalStack;for(m.length=0,m.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);0<m.length;){var f=m.pop(),g=f._lastSelectionResultFrame===p?f._lastSelectionResult:TileSelectionResult.NONE;if(g===TileSelectionResult.RENDERED){if(!defined(f.data))continue;if(!s&&f.data.terrainState===TerrainState$2.READY)return!1;var _=f.data.imagery;for(a=0,o=_.length;a<o;++a){var y=_[a],v=y.loadingImagery,C=!defined(v)||v.state===ImageryState$1.FAILED||v.state===ImageryState$1.INVALID,S=(y.loadingImagery||y.readyImagery).imageryLayer._layerIndex;if(C&&!r[S])return!1}}else g===TileSelectionResult.REFINED&&m.push(f.southwestChild,f.southeastChild,f.northwestChild,f.northeastChild)}return!0};var tileDirectionScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.computeTileLoadPriority=function(e,t){var i=e.data;if(void 0===i)return 0;var r=i.orientedBoundingBox;if(void 0===r)return 0;var n=t.camera.positionWC,a=t.camera.directionWC,o=Cartesian3.subtract(r.center,n,tileDirectionScratch),s=Cartesian3.magnitude(o);return s<CesiumMath.EPSILON5?0:(Cartesian3.divideByScalar(o,s,o),(1-Cartesian3.dot(o,a))*e._distance)};var modifiedModelViewScratch$3=new Matrix4,modifiedModelViewProjectionScratch=new Matrix4,tileRectangleScratch=new Cartesian4,localizedCartographicLimitRectangleScratch=new Cartesian4,rtcScratch$3=new Cartesian3,centerEyeScratch=new Cartesian3,southwestScratch=new Cartesian3,northeastScratch=new Cartesian3;GlobeSurfaceTileProvider.prototype.showTileThisFrame=function(e,t){for(var i=0,r=e.data.imagery,n=0,a=r.length;n<a;++n){var o=r[n];defined(o.readyImagery)&&0!==o.readyImagery.imageryLayer.alpha&&++i}var s=this._tilesToRenderByTextureCount[i];defined(s)||(s=[],this._tilesToRenderByTextureCount[i]=s),s.push(e),defined(e.data.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;var l=this._debug;++l.tilesRendered,l.texturesRendered+=i};var cornerPositionsScratch$1=[new Cartesian3,new Cartesian3,new Cartesian3,new Cartesian3];function computeOccludeePoint$1(e,t,i,r,n){var a=e.quadtree._occluders.ellipsoid,o=a.ellipsoid,s=cornerPositionsScratch$1;return Cartesian3.fromRadians(i.west,i.south,r,o,s[0]),Cartesian3.fromRadians(i.east,i.south,r,o,s[1]),Cartesian3.fromRadians(i.west,i.north,r,o,s[2]),Cartesian3.fromRadians(i.east,i.north,r,o,s[3]),a.computeHorizonCullingPoint(t,s,n)}function updateTileBoundingRegion(e,t,i){var r=e.data;void 0===r&&(r=e.data=new GlobeSurfaceTile),void 0===r.tileBoundingRegion&&(r.tileBoundingRegion=new TileBoundingRegion({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:e.tilingScheme.ellipsoid,minimumHeight:0,maximumHeight:0}));var n=r.terrainData,a=r.mesh,o=r.tileBoundingRegion;if(void 0!==a&&void 0!==a.minimumHeight&&void 0!==a.maximumHeight)return o.minimumHeight=a.minimumHeight,o.maximumHeight=a.maximumHeight,e;if(void 0!==n&&void 0!==n._minimumHeight&&void 0!==n._maximumHeight)return o.minimumHeight=n._minimumHeight*i.terrainExaggeration,o.maximumHeight=n._maximumHeight*i.terrainExaggeration,e;o.minimumHeight=Number.NaN,o.maximumHeight=Number.NaN;for(var s=e.parent;void 0!==s;){var l=s.data;if(void 0!==l){var c=l.mesh;if(void 0!==c&&void 0!==c.minimumHeight&&void 0!==c.maximumHeight)return o.minimumHeight=c.minimumHeight,o.maximumHeight=c.maximumHeight,s;var u=l.terrainData;if(void 0!==u&&void 0!==u._minimumHeight&&void 0!==u._maximumHeight)return o.minimumHeight=u._minimumHeight*i.terrainExaggeration,o.maximumHeight=u._maximumHeight*i.terrainExaggeration,s}s=s.parent}}function getTileReadyCallback(l,c,u){return function(e){var t,i,r,n=-1,a=e.data.imagery,o=a.length;for(r=0;r<o;++r)if((i=defaultValue((t=a[r]).readyImagery,t.loadingImagery)).imageryLayer===c){n=r;break}if(-1!==n){var s=n+l;if(!defined(i=defined(t=a[s])?defaultValue(t.readyImagery,t.loadingImagery):void 0)||i.imageryLayer!==c)return!c._createTileImagerySkeletons(e,u,s);for(r=n;r<s;++r)a[r].freeResources();a.splice(n,l)}return!0}}GlobeSurfaceTileProvider.prototype.computeDistanceToTile=function(e,t){var i=updateTileBoundingRegion(e,this.terrainProvider,t),r=e.data,n=r.tileBoundingRegion;if(void 0===i)return 9999999999;if(r.boundingVolumeSourceTile!==i){r.boundingVolumeSourceTile=i;var a=e.rectangle;defined(a)&&a.width<CesiumMath.PI_OVER_TWO+CesiumMath.EPSILON5&&(r.orientedBoundingBox=OrientedBoundingBox.fromRectangle(e.rectangle,n.minimumHeight,n.maximumHeight,e.tilingScheme.ellipsoid,r.orientedBoundingBox),r.occludeePointInScaledSpace=computeOccludeePoint$1(this,r.orientedBoundingBox.center,e.rectangle,n.maximumHeight,r.occludeePointInScaledSpace))}var o=n.minimumHeight,s=n.maximumHeight;if(r.boundingVolumeSourceTile!==e){var l=t.camera.positionCartographic.height,c=Math.abs(l-o);Math.abs(l-s)<c?(n.minimumHeight=o,n.maximumHeight=o):(n.minimumHeight=s,n.maximumHeight=s)}var u=n.distanceToCamera(t);return n.minimumHeight=o,n.maximumHeight=s,u},GlobeSurfaceTileProvider.prototype.isDestroyed=function(){return!1},GlobeSurfaceTileProvider.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),destroyObject(this)},GlobeSurfaceTileProvider.prototype._onLayerAdded=function(l,e){if(l.show){var c=this._terrainProvider,t=this,i=l.imageryProvider,r=this._imageryLayersUpdatedEvent;i._reload=function(){l._imageryCache={},t._quadtree.forEachLoadedTile(function(e){if(!defined(e._loadedCallbacks[l._layerIndex])){var t,i=e.data.imagery,r=i.length,n=-1,a=0;for(t=0;t<r;++t){var o=i[t];if(defaultValue(o.readyImagery,o.loadingImagery).imageryLayer===l)-1===n&&(n=t),++a;else if(-1!==n)break}if(-1!==n){var s=n+a;l._createTileImagerySkeletons(e,c,s)&&(e._loadedCallbacks[l._layerIndex]=getTileReadyCallback(a,l,c),e.state=QuadtreeTileLoadState$1.LOADING)}}})},this._quadtree.forEachLoadedTile(function(e){l._createTileImagerySkeletons(e,c)&&(e.state=QuadtreeTileLoadState$1.LOADING,0===e.level||e._lastSelectionResultFrame===t.quadtree._lastSelectionFrameNumber&&e._lastSelectionResult===TileSelectionResult.RENDERED||(e.renderable=!1))}),this._layerOrderChanged=!0,r.raiseEvent()}},GlobeSurfaceTileProvider.prototype._onLayerRemoved=function(l,e){this._quadtree.forEachLoadedTile(function(e){for(var t=e.data.imagery,i=-1,r=0,n=0,a=t.length;n<a;++n){var o=t[n],s=o.loadingImagery;if(defined(s)||(s=o.readyImagery),s.imageryLayer===l)-1===i&&(i=n),o.freeResources(),++r;else if(-1!==i)break}-1!==i&&t.splice(i,r)}),defined(l.imageryProvider)&&(l.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()},GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var scratchClippingPlaneMatrix$2=new Matrix4,getDebugOrientedBoundingBox,getDebugBoundingSphere,debugDestroyPrimitive,toi,uoi,qoi,roi,soi;function createTileUniformMap(r,t){return{floodVar:function(){var e=ExpandByMars.floodAnalysis.floodVar;return new Cartesian4(e[0],e[1],e[2],e[3])},ym_pos_x:function(){return ExpandByMars.floodAnalysis.ym_pos_x},ym_pos_y:function(){return ExpandByMars.floodAnalysis.ym_pos_y},ym_pos_z:function(){return ExpandByMars.floodAnalysis.ym_pos_z},rect_flood:function(){return ExpandByMars.floodAnalysis.rect_flood},ym_max_index:function(){return ExpandByMars.floodAnalysis.ym_max_index},globe:function(){return ExpandByMars.floodAnalysis.globe},showElseArea:function(){return ExpandByMars.floodAnalysis.showElseArea},showSelfOnly:function(){return ExpandByMars.excavateAnalysis.showSelfOnly},dig_pos_x:function(){return ExpandByMars.excavateAnalysis.dig_pos_x},dig_pos_y:function(){return ExpandByMars.excavateAnalysis.dig_pos_y},dig_pos_z:function(){return ExpandByMars.excavateAnalysis.dig_pos_z},rect_dig:function(){return ExpandByMars.excavateAnalysis.rect_dig},dig_max_index:function(){return ExpandByMars.excavateAnalysis.dig_max_index},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_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){var e=r.context.uniformState.view,t=Matrix4.multiplyByPoint(e,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(e,t,modifiedModelViewScratch$3),modifiedModelViewScratch$3},u_modifiedModelViewProjection:function(){var e=r.context.uniformState.view,t=r.context.uniformState.projection,i=Matrix4.multiplyByPoint(e,this.properties.rtc,centerEyeScratch);return Matrix4.setTranslation(e,i,modifiedModelViewProjectionScratch),Matrix4.multiply(t,modifiedModelViewProjectionScratch,modifiedModelViewProjectionScratch),modifiedModelViewProjectionScratch},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_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(){var e=t._clippingPlanes;return defined(e)&&defined(e.texture)?e.texture:r.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){var e=t._clippingPlanes;return defined(e)?Matrix4.multiply(r.context.uniformState.view,e.modelMatrix,scratchClippingPlaneMatrix$2):Matrix4.IDENTITY},u_clippingPlanesEdgeStyle:function(){var e=this.properties.clippingPlanesEdgeColor;return e.alpha=this.properties.clippingPlanesEdgeWidth,e},u_minimumBrightness:function(){return r.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},properties:{initialColor:new Cartesian4(0,0,.5,1),fillHighlightColor:new Color(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new Cartesian2(65e5,9e6),nightFadeDistance:new Cartesian2(1e7,4e7),hsbShift:new Cartesian3,center3D:void 0,rtc:new Cartesian3,modifiedModelView:new Matrix4,tileRectangle:new Cartesian4,dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new Cartesian2,southMercatorYAndOneOverHeight:new Cartesian2,waterMask:void 0,waterMaskTranslationAndScale:new Cartesian4,minMaxHeight:new Cartesian2,scaleAndBias:new Matrix4,clippingPlanesEdgeColor:Color.clone(Color.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new Cartesian4}}}function createWireframeVertexArrayIfNecessary(e,t,i){var r,n,a=i.data;if(defined(a.vertexArray)?(r=a.mesh,n=a.vertexArray):defined(a.fill)&&defined(a.fill.vertexArray)&&(r=a.fill.mesh,n=a.fill.vertexArray),defined(r)&&defined(n)){if(defined(a.wireframeVertexArray)){if(a.wireframeVertexArray.mesh===r)return;a.wireframeVertexArray.destroy(),a.wireframeVertexArray=void 0}a.wireframeVertexArray=createWireframeVertexArray(e,n,r),a.wireframeVertexArray.mesh=r}}function createWireframeVertexArray(e,t,i){var r={indices:i.indices,primitiveType:PrimitiveType$1.TRIANGLES};GeometryPipeline.toWireframe(r);var n=r.indices,a=Buffer$1.createIndexBuffer({context:e,typedArray:n,usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.fromSizeInBytes(n.BYTES_PER_ELEMENT)});return new VertexArray({context:e,attributes:t._attributes,indexBuffer:a})}function voi(e){return new Primitive({geometryInstances:e,appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1})}qoi=new GeometryInstance({geometry:BoxOutlineGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2)})}),roi=new GeometryInstance({geometry:new SphereOutlineGeometry({radius:1})}),soi=new Matrix4,getDebugOrientedBoundingBox=function(e,t){return e===toi?uoi:(debugDestroyPrimitive(),toi=e,soi=Matrix4.fromRotationTranslation(e.halfAxes,e.center,soi),qoi.modelMatrix=soi,qoi.attributes.color=ColorGeometryInstanceAttribute.fromColor(t),uoi=voi(qoi))},getDebugBoundingSphere=function(e,t){return e===toi?uoi:(debugDestroyPrimitive(),toi=e,soi=Matrix4.fromTranslation(e.center,soi),soi=Matrix4.multiplyByUniformScale(soi,e.radius,soi),roi.modelMatrix=soi,roi.attributes.color=ColorGeometryInstanceAttribute.fromColor(t),uoi=voi(roi))},debugDestroyPrimitive=function(){defined(uoi)&&(uoi.destroy(),toi=uoi=void 0)};var otherPassesInitialColor=new Cartesian4(0,0,0,0),surfaceShaderSetOptionsScratch={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,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0};function addDrawCommandsForTile(e,t,i){var r=t.data;defined(r.vertexArray)||(void 0===r.fill&&(r.fill=new TerrainFillMesh(t)),r.fill.update(e,i));var n=i.creditDisplay,a=r.terrainData;if(defined(a)&&defined(a.credits))for(var o=a.credits,s=0,l=o.length;s<l;++s)n.addCredit(o[s]);var c=ContextLimits.maximumTextureImageUnits,u=r.waterMaskTexture,d=r.waterMaskTranslationAndScale;!defined(u)&&defined(r.fill)&&(u=r.fill.waterMaskTexture,d=r.fill.waterMaskTranslationAndScale);var h=e.hasWaterMask&&defined(u),p=e.oceanNormalMap,m=h&&defined(p),f=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,g=i.fog.enabled,_=e.showGroundAtmosphere,y=ShadowMode$1.castShadows(e.shadows),v=ShadowMode$1.receiveShadows(e.shadows),C=e.hueShift,S=e.saturationShift,x=e.brightnessShift,T=!(CesiumMath.equalsEpsilon(C,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(S,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(x,0,CesiumMath.EPSILON7)),b=!1;if(_){var E,P=i.mode,A=i.camera;E=P===SceneMode$1.SCENE2D||P===SceneMode$1.COLUMBUS_VIEW?A.positionCartographic.height:Cartesian3.magnitude(A.positionWC);var w=e.nightFadeOutDistance;P!==SceneMode$1.SCENE3D&&(w-=i.mapProjection.ellipsoid.maximumRadius),b=w<E}h&&--c,m&&--c,defined(i.shadowState)&&i.shadowState.shadowsEnabled&&--c,defined(e.clippingPlanes)&&e.clippingPlanes.enabled&&--c;var D=r.renderedMesh,M=D.center,I=D.encoding,R=tileRectangleScratch,O=0,L=0,F=0,N=0,B=!1;if(i.mode!==SceneMode$1.SCENE3D){var V=i.mapProjection,k=V.project(Rectangle.southwest(t.rectangle),southwestScratch),$=V.project(Rectangle.northeast(t.rectangle),northeastScratch);if(R.x=k.x,R.y=k.y,R.z=$.x,R.w=$.y,i.mode!==SceneMode$1.MORPHING&&((M=rtcScratch$3).x=0,M.y=.5*(R.z+R.x),M.z=.5*(R.w+R.y),R.x-=M.y,R.y-=M.z,R.z-=M.y,R.w-=M.z),i.mode===SceneMode$1.SCENE2D&&I.quantization===TerrainQuantization$1.BITS12){var z=1/(Math.pow(2,12)-1)*.5,U=(R.z-R.x)*z,G=(R.w-R.y)*z;R.x-=U,R.y-=G,R.z+=U,R.w+=G}V instanceof WebMercatorProjection&&(O=t.rectangle.south,L=t.rectangle.north,F=WebMercatorProjection.geodeticLatitudeToMercatorAngle(O),N=1/(WebMercatorProjection.geodeticLatitudeToMercatorAngle(L)-F),B=!0)}var H=surfaceShaderSetOptionsScratch;H.frameState=i,H.surfaceTile=r,H.showReflectiveOcean=h,H.showOceanWaves=m,H.enableLighting=e.enableLighting,H.showGroundAtmosphere=_,H.perFragmentGroundAtmosphere=b,H.hasVertexNormals=f,H.useWebMercatorProjection=B,H.clippedByBoundaries=r.clippedByBoundaries;var W=r.imagery,q=0,j=W.length,Y=e._renderState,X=e._blendRenderState,Q=Y,J=e._firstPassInitialColor,Z=i.context;defined(e._debug.boundingSphereTile)||debugDestroyPrimitive();do{var K,ee,te=0;if(e._drawCommands.length<=e._usedDrawCommands?((K=new DrawCommand).owner=t,K.cull=!1,K.boundingVolume=new BoundingSphere,K.orientedBoundingBox=void 0,ee=createTileUniformMap(i,e),e._drawCommands.push(K),e._uniformMaps.push(ee)):(K=e._drawCommands[e._usedDrawCommands],ee=e._uniformMaps[e._usedDrawCommands]),K.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){var ie=r.orientedBoundingBox;defined(ie)?getDebugOrientedBoundingBox(ie,Color.RED).update(i):defined(D)&&defined(D.boundingSphere3D)&&getDebugBoundingSphere(D.boundingSphere3D,Color.RED).update(i)}var re=ee.properties;Cartesian4.clone(J,re.initialColor),re.oceanNormalMap=p,re.lightingFadeDistance.x=e.lightingFadeOutDistance,re.lightingFadeDistance.y=e.lightingFadeInDistance,re.nightFadeDistance.x=e.nightFadeOutDistance,re.nightFadeDistance.y=e.nightFadeInDistance,re.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;var ne=!defined(r.vertexArray)&&defined(e.fillHighlightColor)&&0<e.fillHighlightColor.alpha;ne&&Color.clone(e.fillHighlightColor,re.fillHighlightColor),re.center3D=D.center,Cartesian3.clone(M,re.rtc),Cartesian4.clone(R,re.tileRectangle),re.southAndNorthLatitude.x=O,re.southAndNorthLatitude.y=L,re.southMercatorYAndOneOverHeight.x=F,re.southMercatorYAndOneOverHeight.y=N;var ae=localizedCartographicLimitRectangleScratch,oe=clipRectangleAntimeridian(t.rectangle,e.cartographicLimitRectangle);Cartesian3.fromElements(C,S,x,re.hsbShift);var se=t.rectangle,le=1/se.width,ce=1/se.height;ae.x=(oe.west-se.west)*le,ae.y=(oe.south-se.south)*ce,ae.z=(oe.east-se.west)*le,ae.w=(oe.north-se.south)*ce,Cartesian4.clone(ae,re.localizedCartographicLimitRectangle);var ue=g&&CesiumMath.fog(t._distance,i.fog.density)>CesiumMath.EPSILON3;T=T&&(ue||_);for(var de=!1,he=!1,pe=!1,me=!1,fe=!1,ge=!1,_e=!1,ye=!1,ve=!1;te<c&&q<j;){var Ce=W[q],Se=Ce.readyImagery;if(++q,defined(Se)&&0!==Se.imageryLayer.alpha){var xe=Ce.useWebMercatorT?Se.textureWebMercator:Se.texture,Te=Se.imageryLayer;defined(Ce.textureTranslationAndScale)||(Ce.textureTranslationAndScale=Te._calculateTextureTranslationAndScale(t,Ce)),re.dayTextures[te]=xe,re.dayTextureTranslationAndScale[te]=Ce.textureTranslationAndScale,re.dayTextureTexCoordsRectangle[te]=Ce.textureCoordinateRectangle,re.dayTextureUseWebMercatorT[te]=Ce.useWebMercatorT,re.dayTextureAlpha[te]=Te.alpha,ge=ge||1!==re.dayTextureAlpha[te],re.dayTextureBrightness[te]=Te.brightness,de=de||re.dayTextureBrightness[te]!==ImageryLayer.DEFAULT_BRIGHTNESS,re.dayTextureContrast[te]=Te.contrast,he=he||re.dayTextureContrast[te]!==ImageryLayer.DEFAULT_CONTRAST,re.dayTextureHue[te]=Te.hue,pe=pe||re.dayTextureHue[te]!==ImageryLayer.DEFAULT_HUE,re.dayTextureSaturation[te]=Te.saturation,me=me||re.dayTextureSaturation[te]!==ImageryLayer.DEFAULT_SATURATION,re.dayTextureOneOverGamma[te]=1/Te.gamma,fe=fe||re.dayTextureOneOverGamma[te]!==1/ImageryLayer.DEFAULT_GAMMA,re.dayTextureSplit[te]=Te.splitDirection,_e=_e||0!==re.dayTextureSplit[te];var be=re.dayTextureCutoutRectangles[te];if(defined(be)||(be=re.dayTextureCutoutRectangles[te]=new Cartesian4),Cartesian4.clone(Cartesian4.ZERO,be),defined(Te.cutoutRectangle)){var Ee=clipRectangleAntimeridian(se,Te.cutoutRectangle);ye=defined(Rectangle.simpleIntersection(Ee,se,rectangleIntersectionScratch))||ye,be.x=(Ee.west-se.west)*le,be.y=(Ee.south-se.south)*ce,be.z=(Ee.east-se.west)*le,be.w=(Ee.north-se.south)*ce}var Pe=re.colorsToAlpha[te];defined(Pe)||(Pe=re.colorsToAlpha[te]=new Cartesian4);var Ae=defined(Te.colorToAlpha)&&0<Te.colorToAlphaThreshold;if(ve=ve||Ae,Ae){var we=Te.colorToAlpha;Pe.x=we.red,Pe.y=we.green,Pe.z=we.blue,Pe.w=Te.colorToAlphaThreshold}else Pe.w=-1;if(defined(Se.credits))for(var De=Se.credits,Me=0,Ie=De.length;Me<Ie;++Me)n.addCredit(De[Me]);++te}}re.dayTextures.length=te,re.waterMask=u,Cartesian4.clone(d,re.waterMaskTranslationAndScale),re.minMaxHeight.x=I.minimumHeight,re.minMaxHeight.y=I.maximumHeight,Matrix4.clone(I.matrix,re.scaleAndBias);var Re=e._clippingPlanes,Oe=defined(Re)&&Re.enabled&&t.isClipped;Oe&&(re.clippingPlanesEdgeColor=Color.clone(Re.edgeColor,re.clippingPlanesEdgeColor),re.clippingPlanesEdgeWidth=Re.edgeWidth),defined(e.uniformMap)&&(ee=combine(ee,e.uniformMap)),H.numberOfDayTextures=te,H.applyBrightness=de,H.applyContrast=he,H.applyHue=pe,H.applySaturation=me,H.applyGamma=fe,H.applyAlpha=ge,H.applySplit=_e,H.enableFog=ue,H.enableClippingPlanes=Oe,H.clippingPlanes=Re,H.hasImageryLayerCutout=ye,H.colorCorrect=T,H.highlightFillTile=ne,H.colorToAlpha=ve,K.shaderProgram=e._surfaceShaderSet.getShaderProgram(H),K.castShadows=y,K.receiveShadows=v,K.renderState=Q,K.primitiveType=PrimitiveType$1.TRIANGLES,K.vertexArray=r.vertexArray||r.fill.vertexArray,K.uniformMap=ee,K.pass=ExpandByMars.underEarth.enable?Pass$1.TRANSLUCENT:Pass$1.GLOBE,e._debug.wireframe&&(createWireframeVertexArrayIfNecessary(Z,e,t),defined(r.wireframeVertexArray)&&(K.vertexArray=r.wireframeVertexArray,K.primitiveType=PrimitiveType$1.LINES));var Le=K.boundingVolume,Fe=K.orientedBoundingBox;if(i.mode!==SceneMode$1.SCENE3D){var Ne=r.tileBoundingRegion;BoundingSphere.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,Ne.minimumHeight,Ne.maximumHeight,Le),Cartesian3.fromElements(Le.center.z,Le.center.x,Le.center.y,Le.center),i.mode===SceneMode$1.MORPHING&&(Le=BoundingSphere.union(D.boundingSphere3D,Le,Le))}else K.boundingVolume=BoundingSphere.clone(D.boundingSphere3D,Le),K.orientedBoundingBox=OrientedBoundingBox.clone(r.orientedBoundingBox,Fe);K.dirty=!0,i.commandList.push(K),Q=X,J=otherPassesInitialColor}while(q<j)}function ImageryLayerCollection(){this._layers=[],this.layerAdded=new Event,this.layerRemoved=new Event,this.layerMoved=new Event,this.layerShownOrHidden=new Event}function getLayerIndex(e,t){return e.indexOf(t)}function swapLayers(e,t,i){var r=e._layers;if((t=CesiumMath.clamp(t,0,r.length-1))!==(i=CesiumMath.clamp(i,0,r.length-1))){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}defineProperties$1(ImageryLayerCollection.prototype,{length:{get:function(){return this._layers.length}}}),ImageryLayerCollection.prototype.add=function(e,t){defined(t)?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)},ImageryLayerCollection.prototype.addImageryProvider=function(e,t){var i=new ImageryLayer(e);return this.add(i,t),i},ImageryLayerCollection.prototype.remove=function(e,t){t=defaultValue(t,!0);var i=this._layers.indexOf(e);return-1!==i&&(this._layers.splice(i,1),this._update(),this.layerRemoved.raiseEvent(e,i),t&&e.destroy(),!0)},ImageryLayerCollection.prototype.removeAll=function(e){e=defaultValue(e,!0);for(var t=this._layers,i=0,r=t.length;i<r;i++){var n=t[i];this.layerRemoved.raiseEvent(n,i),e&&n.destroy()}this._layers=[]},ImageryLayerCollection.prototype.contains=function(e){return-1!==this.indexOf(e)},ImageryLayerCollection.prototype.indexOf=function(e){return this._layers.indexOf(e)},ImageryLayerCollection.prototype.get=function(e){return this._layers[e]},ImageryLayerCollection.prototype.raise=function(e){var t=getLayerIndex(this._layers,e);swapLayers(this,t,t+1)},ImageryLayerCollection.prototype.lower=function(e){var t=getLayerIndex(this._layers,e);swapLayers(this,t,t-1)},ImageryLayerCollection.prototype.raiseToTop=function(e){var t=getLayerIndex(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))},ImageryLayerCollection.prototype.lowerToBottom=function(e){var t=getLayerIndex(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var applicableRectangleScratch=new Rectangle,comparisonPoint;function QuadtreeOccluders(e){this._ellipsoid=new EllipsoidalOccluder(e.ellipsoid,Cartesian3.ZERO)}function QuadtreeTile(e){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=TileSelectionResult.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}function freeTile(e){defined(e)&&e.freeResources()}function TileReplacementQueue(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function remove$1(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}function QuadtreePrimitive(e){this._tileProvider=e.tileProvider,(this._tileProvider.quadtree=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};var t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new TileReplacementQueue,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=defaultValue(e.maximumScreenSpaceError,2),this.tileCacheSize=defaultValue(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new QuadtreeOccluders({ellipsoid:t}),this._tileLoadProgressEvent=new Event,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function invalidateAllTiles(e){var t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,clearTileLoadQueue(e);var i=e._levelZeroTiles;if(defined(i))for(var r=0;r<i.length;++r){for(var n=i[r].customData,a=n.length,o=0;o<a;++o){var s=n[o];s.level=0,e._addHeightCallbacks.push(s)}i[r].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}function clearTileLoadQueue(e){var 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}function updateTileLoadProgress(e,t){var i=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;i===e._lastTileLoadQueueLength&&!e._tilesInvalidated||(t.afterRender.push(Event.prototype.raiseEvent.bind(e._tileLoadProgressEvent,i)),e._lastTileLoadQueueLength=i);var r=e._debug;r.enableDebugOutput&&!r.suspendLodUpdate&&(r.maxDepth=e._tilesToRender.reduce(function(e,t){return Math.max(e,t.level)},-1),r.tilesRendered=e._tilesToRender.length,r.tilesVisited===r.lastTilesVisited&&r.tilesRendered===r.lastTilesRendered&&r.tilesCulled===r.lastTilesCulled&&r.maxDepth===r.lastMaxDepth&&r.tilesWaitingForChildren===r.lastTilesWaitingForChildren&&r.maxDepthVisited===r.lastMaxDepthVisited||(console.log("Visited "+r.tilesVisited+", Rendered: "+r.tilesRendered+", Culled: "+r.tilesCulled+", Max Depth Rendered: "+r.maxDepth+", Max Depth Visited: "+r.maxDepthVisited+", Waiting for children: "+r.tilesWaitingForChildren),r.lastTilesVisited=r.tilesVisited,r.lastTilesRendered=r.tilesRendered,r.lastTilesCulled=r.tilesCulled,r.lastMaxDepth=r.maxDepth,r.lastTilesWaitingForChildren=r.tilesWaitingForChildren,r.lastMaxDepthVisited=r.maxDepthVisited))}ImageryLayerCollection.prototype.pickImageryLayerFeatures=function(e,t){var i=t.globe.pick(e,t);if(defined(i)){for(var r,s=t.globe.ellipsoid.cartesianToCartographic(i),n=t.globe._surface._tilesToRender,a=0;!defined(r)&&a<n.length;++a){var o=n[a];Rectangle.contains(o.rectangle,s)&&(r=o)}if(defined(r)){for(var l=r.data.imagery,c=[],u=[],d=l.length-1;0<=d;--d){var h=l[d],p=h.readyImagery;if(defined(p)){var m=p.imageryLayer.imageryProvider;if(defined(m.pickFeatures)&&Rectangle.contains(p.rectangle,s)){var f=applicableRectangleScratch,g=1/1024;if(f.west=CesiumMath.lerp(r.rectangle.west,r.rectangle.east,h.textureCoordinateRectangle.x-g),f.east=CesiumMath.lerp(r.rectangle.west,r.rectangle.east,h.textureCoordinateRectangle.z+g),f.south=CesiumMath.lerp(r.rectangle.south,r.rectangle.north,h.textureCoordinateRectangle.y-g),f.north=CesiumMath.lerp(r.rectangle.south,r.rectangle.north,h.textureCoordinateRectangle.w+g),Rectangle.contains(f,s)){var _=m.pickFeatures(p.x,p.y,p.level,s.longitude,s.latitude);defined(_)&&(c.push(_),u.push(p.imageryLayer))}}}}if(0!==c.length)return when.all(c,function(e){for(var t=[],i=0;i<e.length;++i){var r=e[i],n=u[i];if(defined(r)&&0<r.length)for(var a=0;a<r.length;++a){var o=r[a];o.imageryLayer=n,defined(o.position)||(o.position=s),t.push(o)}}return t})}}},ImageryLayerCollection.prototype.queueReprojectionCommands=function(e){for(var t=this._layers,i=0,r=t.length;i<r;++i)t[i].queueReprojectionCommands(e)},ImageryLayerCollection.prototype.cancelReprojections=function(){for(var e=this._layers,t=0,i=e.length;t<i;++t)e[t].cancelReprojections()},ImageryLayerCollection.prototype.isDestroyed=function(){return!1},ImageryLayerCollection.prototype.destroy=function(){return this.removeAll(!0),destroyObject(this)},ImageryLayerCollection.prototype._update=function(){var e,t,i,r,n=!0,a=this._layers;for(i=0,r=a.length;i<r;++i)(t=a[i])._layerIndex=i,t.show?(t._isBaseLayer=n,n=!1):t._isBaseLayer=!1,t.show!==t._show&&(defined(t._show)&&(defined(e)||(e=[]),e.push(t)),t._show=t.show);if(defined(e))for(i=0,r=e.length;i<r;++i)t=e[i],this.layerShownOrHidden.raiseEvent(t,t._layerIndex,t.show)},defineProperties$1(QuadtreeOccluders.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),QuadtreeTile.createLevelZeroTiles=function(e){for(var t=e.getNumberOfXTilesAtLevel(0),i=e.getNumberOfYTilesAtLevel(0),r=new Array(t*i),n=0,a=0;a<i;++a)for(var o=0;o<t;++o)r[n++]=new QuadtreeTile({tilingScheme:e,x:o,y:a,level:0});return r},QuadtreeTile.prototype._updateCustomData=function(e,t,i){var r,n,a,o=this.customData;if(defined(t)&&defined(i)){for(o=o.filter(function(e){return-1===i.indexOf(e)}),this._customData=o,a=this._rectangle,r=0;r<t.length;++r)n=t[r],Rectangle.contains(a,n.positionCartographic)&&o.push(n);this._frameUpdated=e}else{var s=this._parent;if(defined(s)&&this._frameUpdated!==s._frameUpdated){o.length=0,a=this._rectangle;var l=s.customData;for(r=0;r<l.length;++r)n=l[r],Rectangle.contains(a,n.positionCartographic)&&o.push(n);this._frameUpdated=s._frameUpdated}}},defineProperties$1(QuadtreeTile.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 defined(this._southwestChild)||(this._southwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return defined(this._southeastChild)||(this._southeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return defined(this._northwestChild)||(this._northwestChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return defined(this._northeastChild)||(this._northeastChild=new QuadtreeTile({tilingScheme:this.tilingScheme,x:2*this.x+1,y:2*this.y,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<QuadtreeTileLoadState$1.DONE}},eligibleForUnloading:{get:function(){var e=!0;return defined(this.data)&&(defined(e=this.data.eligibleForUnloading)||(e=!0)),e}}}),QuadtreeTile.prototype.findLevelZeroTile=function(e,t,i){var r=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=r:r<=t&&(t-=r),!(i<0||i>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter(function(e){return e.x===t&&e.y===i})[0]},QuadtreeTile.prototype.findTileToWest=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;var i=t.findTileToWest(e);return void 0!==i?t.southwestChild===this?i.southeastChild:i.northeastChild:void 0},QuadtreeTile.prototype.findTileToEast=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;var i=t.findTileToEast(e);return void 0!==i?t.southeastChild===this?i.southwestChild:i.northwestChild:void 0},QuadtreeTile.prototype.findTileToSouth=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;var i=t.findTileToSouth(e);return void 0!==i?t.southwestChild===this?i.northwestChild:i.northeastChild:void 0},QuadtreeTile.prototype.findTileToNorth=function(e){var t=this.parent;if(void 0===t)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;var i=t.findTileToNorth(e);return void 0!==i?t.northwestChild===this?i.southwestChild:i.southeastChild:void 0},QuadtreeTile.prototype.freeResources=function(){this.state=QuadtreeTileLoadState$1.START,this.renderable=!1,this.upsampledFromParent=!1,defined(this.data)&&defined(this.data.freeResources)&&this.data.freeResources(),freeTile(this._southwestChild),this._southwestChild=void 0,freeTile(this._southeastChild),this._southeastChild=void 0,freeTile(this._northwestChild),this._northwestChild=void 0,freeTile(this._northeastChild),this._northeastChild=void 0},TileReplacementQueue.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},TileReplacementQueue.prototype.trimTiles=function(e){for(var t=this.tail,i=!0;i&&defined(this._lastBeforeStartOfFrame)&&this.count>e&&defined(t);){i=t!==this._lastBeforeStartOfFrame;var r=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),remove$1(this,t)),t=r}},TileReplacementQueue.prototype.markTileRendered=function(e){var t=this.head;if(t!==e){if(++this.count,!defined(t))return e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,void(this.tail=e);(defined(e.replacementPrevious)||defined(e.replacementNext))&&remove$1(this,e),e.replacementPrevious=void 0,(e.replacementNext=t).replacementPrevious=e,this.head=e}else e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext)},defineProperties$1(QuadtreePrimitive.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),QuadtreePrimitive.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},QuadtreePrimitive.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;defined(t);)t.state!==QuadtreeTileLoadState$1.START&&e(t),t=t.replacementNext},QuadtreePrimitive.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;i<r;++i)e(t[i])},QuadtreePrimitive.prototype.updateHeight=function(e,t){var r=this,n={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){for(var e=r._addHeightCallbacks,t=e.length,i=0;i<t;++i)if(e[i]===n){e.splice(i,1);break}r._removeHeightCallbacks.push(n)}};return r._addHeightCallbacks.push(n),n.removeFunc},QuadtreePrimitive.prototype.update=function(e){defined(this._tileProvider.update)&&this._tileProvider.update(e)},QuadtreePrimitive.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(invalidateAllTiles(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),clearTileLoadQueue(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},QuadtreePrimitive.prototype.render=function(e){var t=e.passes,i=this._tileProvider;t.render&&(i.beginUpdate(e),selectTilesForRendering(this,e),createRenderCommandsForSelectedTiles(this,e),i.endUpdate(e)),t.pick&&0<this._tilesToRender.length&&i.updateForPick(e)},QuadtreePrimitive.prototype.endFrame=function(e){e.passes.render&&e.mode!==SceneMode$1.MORPHING&&(processTileLoadQueue(this,e),updateHeights(this,e),updateTileLoadProgress(this,e))},QuadtreePrimitive.prototype.isDestroyed=function(){return!1},QuadtreePrimitive.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var centerScratch$5=new Cartographic;function compareDistanceToPoint(e,t){var i=Rectangle.center(e.rectangle,centerScratch$5),r=i.longitude-comparisonPoint.longitude,n=i.latitude-comparisonPoint.latitude,a=(i=Rectangle.center(t.rectangle,centerScratch$5)).longitude-comparisonPoint.longitude,o=i.latitude-comparisonPoint.latitude;return r*r+n*n-(a*a+o*o)}var cameraOriginScratch=new Cartesian3,rootTraversalDetails=[];function selectTilesForRendering(e,t){var i=e._debug;if(!i.suspendLodUpdate){var r;e._tilesToRender.length=0;var n,a=e._tileProvider;if(!defined(e._levelZeroTiles)){if(!a.ready)return;var o=a.tilingScheme;e._levelZeroTiles=QuadtreeTile.createLevelZeroTiles(o);var s=e._levelZeroTiles.length;if(rootTraversalDetails.length<s)for(rootTraversalDetails=new Array(s),r=0;r<s;++r)void 0===rootTraversalDetails[r]&&(rootTraversalDetails[r]=new TraversalDetails)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var l=e._levelZeroTiles,c=1<l.length?e._occluders:void 0;comparisonPoint=t.camera.positionCartographic,l.sort(compareDistanceToPoint);var u,d=e._addHeightCallbacks,h=e._removeHeightCallbacks,p=t.frameNumber;if(0<d.length||0<h.length){for(r=0,u=l.length;r<u;++r)(n=l[r])._updateCustomData(p,d,h);d.length=0,h.length=0}var m=t.camera;e._cameraPositionCartographic=m.positionCartographic;var f=Matrix4.getTranslation(m.transform,cameraOriginScratch);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(f,e._cameraReferenceFrameOriginCartographic),r=0,u=l.length;r<u;++r)n=l[r],e._tileReplacementQueue.markTileRendered(n),n.renderable?visitIfVisible(e,n,a,t,c,!1,rootTraversalDetails[r]):(queueTileLoad(e,e._tileLoadQueueHigh,n,t),++i.tilesWaitingForChildren);e._lastSelectionFrameNumber=p}}function queueTileLoad(e,t,i,r){i.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(i._loadPriority=e.tileProvider.computeTileLoadPriority(i,r)),t.push(i))}function TraversalDetails(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function TraversalQuadDetails(){this.southwest=new TraversalDetails,this.southeast=new TraversalDetails,this.northwest=new TraversalDetails,this.northeast=new TraversalDetails}TraversalQuadDetails.prototype.combine=function(e){var t=this.southwest,i=this.southeast,r=this.northwest,n=this.northeast;e.allAreRenderable=t.allAreRenderable&&i.allAreRenderable&&r.allAreRenderable&&n.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||r.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+i.notYetRenderableCount+r.notYetRenderableCount+n.notYetRenderableCount};for(var traversalQuadsByLevel=new Array(31),i$4=0;i$4<traversalQuadsByLevel.length;++i$4)traversalQuadsByLevel[i$4]=new TraversalQuadDetails;function visitTile$3(e,t,i,r,n){var a=e._debug;++a.tilesVisited,e._tileReplacementQueue.markTileRendered(i),i._updateCustomData(t.frameNumber),i.level>a.maxDepthVisited&&(a.maxDepthVisited=i.level);var o=screenSpaceError(e,t,i)<e.maximumScreenSpaceError,s=i.southwestChild,l=i.southeastChild,c=i.northwestChild,u=i.northeastChild,d=e._lastSelectionFrameNumber,h=i._lastSelectionResultFrame===d?i._lastSelectionResult:TileSelectionResult.NONE,p=e.tileProvider;if(o||r){var m=TileSelectionResult.originalResult(h)===TileSelectionResult.RENDERED,f=TileSelectionResult.originalResult(h)===TileSelectionResult.CULLED||h===TileSelectionResult.NONE,g=i.state===QuadtreeTileLoadState$1.DONE,_=m||f||g;if(_||defined(p.canRenderWithoutLosingDetail)&&(_=p.canRenderWithoutLosingDetail(i)),_)return o&&queueTileLoad(e,e._tileLoadQueueMedium,i,t),addTileToRenderList(e,i),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(n.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));r=!0,o&&queueTileLoad(e,e._tileLoadQueueHigh,i,t)}if(p.canRefine(i)){if(s.upsampledFromParent&&l.upsampledFromParent&&c.upsampledFromParent&&u.upsampledFromParent)return addTileToRenderList(e,i),queueTileLoad(e,e._tileLoadQueueMedium,i,t),e._tileReplacementQueue.markTileRendered(s),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(u),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1,i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,void(n.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(i));i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.REFINED;var y=e._tilesToRender.length,v=e._tileLoadQueueLow.length,C=e._tileLoadQueueMedium.length,S=e._tileLoadQueueHigh.length,x=e._tileToUpdateHeights.length;if(visitVisibleChildrenNearToFar(e,s,l,c,u,t,r,n),y!==e._tilesToRender.length){var T=n.allAreRenderable,b=n.anyWereRenderedLastFrame,E=n.notYetRenderableCount,P=!1;if(!T&&!b){for(var A=e._tilesToRender,w=y;w<A.length;++w)for(var D=A[w];void 0!==D&&D._lastSelectionResult!==TileSelectionResult.KICKED&&D!==i;)D._lastSelectionResult=TileSelectionResult.kick(D._lastSelectionResult),D=D.parent;e._tilesToRender.length=y,e._tileToUpdateHeights.length=x,addTileToRenderList(e,i),i._lastSelectionResult=TileSelectionResult.RENDERED;var M=h===TileSelectionResult.RENDERED;!M&&E>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=v,e._tileLoadQueueMedium.length=C,e._tileLoadQueueHigh.length=S,queueTileLoad(e,e._tileLoadQueueMedium,i,t),n.notYetRenderableCount=i.renderable?0:1,P=!0),n.allAreRenderable=i.renderable,(n.anyWereRenderedLastFrame=M)||e._tileToUpdateHeights.push(i),++a.tilesWaitingForChildren}e.preloadAncestors&&!P&&queueTileLoad(e,e._tileLoadQueueLow,i,t)}}else i._lastSelectionResultFrame=t.frameNumber,i._lastSelectionResult=TileSelectionResult.RENDERED,addTileToRenderList(e,i),queueTileLoad(e,e._tileLoadQueueHigh,i,t),n.allAreRenderable=i.renderable,n.anyWereRenderedLastFrame=h===TileSelectionResult.RENDERED,n.notYetRenderableCount=i.renderable?0:1}function visitVisibleChildrenNearToFar(e,t,i,r,n,a,o,s){var l=a.camera.positionCartographic,c=e._tileProvider,u=e._occluders,d=traversalQuadsByLevel[t.level];if(d){var h=d.southwest,p=d.southeast,m=d.northwest,f=d.northeast;l.longitude<t.rectangle.east?l.latitude<t.rectangle.north?(visitIfVisible(e,t,c,a,u,o,h),visitIfVisible(e,i,c,a,u,o,p),visitIfVisible(e,r,c,a,u,o,m),visitIfVisible(e,n,c,a,u,o,f)):(visitIfVisible(e,r,c,a,u,o,m),visitIfVisible(e,t,c,a,u,o,h),visitIfVisible(e,n,c,a,u,o,f),visitIfVisible(e,i,c,a,u,o,p)):l.latitude<t.rectangle.north?(visitIfVisible(e,i,c,a,u,o,p),visitIfVisible(e,t,c,a,u,o,h),visitIfVisible(e,n,c,a,u,o,f),visitIfVisible(e,r,c,a,u,o,m)):(visitIfVisible(e,n,c,a,u,o,f),visitIfVisible(e,r,c,a,u,o,m),visitIfVisible(e,i,c,a,u,o,p),visitIfVisible(e,t,c,a,u,o,h)),d.combine(s)}}function containsNeededPosition(e,t){var i=t.rectangle;return defined(e._cameraPositionCartographic)&&Rectangle.contains(i,e._cameraPositionCartographic)||defined(e._cameraReferenceFrameOriginCartographic)&&Rectangle.contains(i,e._cameraReferenceFrameOriginCartographic)}function visitIfVisible(e,t,i,r,n,a,o){if(i.computeTileVisibility(t,r,n)!==Visibility$1.NONE)return visitTile$3(e,r,t,a,o);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),o.allAreRenderable=!0,o.anyWereRenderedLastFrame=!1,o.notYetRenderableCount=0,containsNeededPosition(e,t)){defined(t.data)&&defined(t.data.vertexArray)||queueTileLoad(e,e._tileLoadQueueMedium,t,r);var s=e._lastSelectionFrameNumber,l=t._lastSelectionResultFrame===s?t._lastSelectionResult:TileSelectionResult.NONE;l!==TileSelectionResult.CULLED_BUT_NEEDED&&l!==TileSelectionResult.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=TileSelectionResult.CULLED_BUT_NEEDED}else(e.preloadSiblings||0===t.level)&&queueTileLoad(e,e._tileLoadQueueLow,t,r),t._lastSelectionResult=TileSelectionResult.CULLED;t._lastSelectionResultFrame=r.frameNumber}function screenSpaceError(e,t,i){if(t.mode===SceneMode$1.SCENE2D||t.camera.frustum instanceof OrthographicFrustum||t.camera.frustum instanceof OrthographicOffCenterFrustum)return screenSpaceError2D(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,a=r*t.context.drawingBufferHeight/(n*t.camera.frustum.sseDenominator);return t.fog.enabled&&(a-=CesiumMath.fog(n,t.fog.density)*t.fog.sse),a/=t.pixelRatio}function screenSpaceError2D(e,t,i){var r=t.camera.frustum;defined(r._offCenterFrustum)&&(r=r._offCenterFrustum);var n=t.context,a=n.drawingBufferWidth,o=n.drawingBufferHeight,s=e._tileProvider.getLevelMaximumGeometricError(i.level)/(Math.max(r.top-r.bottom,r.right-r.left)/Math.max(a,o));return t.fog.enabled&&t.mode!==SceneMode$1.SCENE2D&&(s-=CesiumMath.fog(i._distance,t.fog.density)*t.fog.sse),s/=t.pixelRatio}function addTileToRenderList(e,t){e._tilesToRender.push(t)}function processTileLoadQueue(e,t){var i=e._tileLoadQueueHigh,r=e._tileLoadQueueMedium,n=e._tileLoadQueueLow;if(0!==i.length||0!==r.length||0!==n.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);var a=getTimestamp$1()+e._loadQueueTimeSlice,o=e._tileProvider,s=processSinglePriorityLoadQueue(e,t,o,a,i,!1);processSinglePriorityLoadQueue(e,t,o,a,n,s=processSinglePriorityLoadQueue(e,t,o,a,r,s))}}function sortByLoadPriority(e,t){return e._loadPriority-t._loadPriority}function processSinglePriorityLoadQueue(e,t,i,r,n,a){void 0!==i.computeTileLoadPriority&&n.sort(sortByLoadPriority);for(var o=0,s=n.length;o<s&&(getTimestamp$1()<r||!a);++o){var l=n[o];e._tileReplacementQueue.markTileRendered(l),i.loadTile(t,l),a=!0}return a}var scratchRay=new Ray,scratchCartographic$d=new Cartographic,scratchPosition$b=new Cartesian3,scratchArray$1=[];function updateHeights(e,t){if(e.tileProvider.ready){var i=scratchArray$1;i.length=0;for(var r,n=e._tileToUpdateHeights,a=e._tileProvider.terrainProvider,o=getTimestamp$1()+e._updateHeightsTimeSlice,s=t.mode,l=t.mapProjection,c=e.tileProvider.tilingScheme.ellipsoid;0<n.length;){var u=n[0];if(defined(u.data)&&defined(u.data.mesh)){var d=u.customData,h=d.length,p=!1;for(r=e._lastTileIndex;r<h;++r){var m=d[r];if(u.level>m.level){if(defined(m.positionOnEllipsoidSurface)||(m.positionOnEllipsoidSurface=Cartesian3.fromRadians(m.positionCartographic.longitude,m.positionCartographic.latitude,0,c)),s===SceneMode$1.SCENE3D){var f=c.geodeticSurfaceNormal(m.positionOnEllipsoidSurface,scratchRay.direction);if(!defined(c.getSurfaceNormalIntersectionWithZAxis(m.positionOnEllipsoidSurface,11500,scratchRay.origin))){var g;defined(u.data.tileBoundingRegion)&&(g=u.data.tileBoundingRegion.minimumHeight);var _=Math.min(defaultValue(g,0),-11500),y=Cartesian3.multiplyByScalar(f,Math.abs(_)+1,scratchPosition$b);Cartesian3.subtract(m.positionOnEllipsoidSurface,y,scratchRay.origin)}}else Cartographic.clone(m.positionCartographic,scratchCartographic$d),scratchCartographic$d.height=-11500,l.project(scratchCartographic$d,scratchPosition$b),Cartesian3.fromElements(scratchPosition$b.z,scratchPosition$b.x,scratchPosition$b.y,scratchPosition$b),Cartesian3.clone(scratchPosition$b,scratchRay.origin),Cartesian3.clone(Cartesian3.UNIT_X,scratchRay.direction);var v=u.data.pick(scratchRay,s,l,!1,scratchPosition$b);defined(v)&&(m.callback(v),m.level=u.level)}else if(u.level===m.level){for(var C,S=u.children,x=S.length,T=0;T<x&&(C=S[T],!Rectangle.contains(C.rectangle,m.positionCartographic));++T);var b=a.getTileDataAvailable(C.x,C.y,C.level),E=u.parent;(defined(b)&&!b||defined(E)&&defined(E.data)&&defined(E.data.terrainData)&&!E.data.terrainData.isChildAvailable(E.x,E.y,C.x,C.y))&&m.removeFunc()}if(getTimestamp$1()>=o){p=!0;break}}if(p){e._lastTileIndex=r;break}e._lastTileIndex=0,n.shift()}else{var P=u._lastSelectionResultFrame===e._lastSelectionFrameNumber?u._lastSelectionResult:TileSelectionResult.NONE;P!==TileSelectionResult.RENDERED&&P!==TileSelectionResult.CULLED_BUT_NEEDED||i.push(u),n.shift(),e._lastTileIndex=0}}for(r=0;r<i.length;r++)n.push(i[r])}}function createRenderCommandsForSelectedTiles(e,t){for(var i=e._tileProvider,r=e._tilesToRender,n=0,a=r.length;n<a;++n){var o=r[n];i.showTileThisFrame(o,t)}}function Globe(e){var t=new EllipsoidTerrainProvider({ellipsoid:e=defaultValue(e,Ellipsoid.WGS84)}),i=new ImageryLayerCollection;this._ellipsoid=e,this._imageryLayerCollection=i,this._surfaceShaderSet=new GlobeSurfaceShaderSet,this._material=void 0,this._surface=new QuadtreePrimitive({tileProvider:new GlobeSurfaceTileProvider({terrainProvider:t,imageryLayers:i,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Event,makeShadersDirty(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Resource({url:buildModuleUrl("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.showGroundAtmosphere=!0,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=ShadowMode$1.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0}function makeShadersWaJue(e){var t=[],i=defined(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),r=[GroundAtmosphere];!defined(e._material)||i&&!e._terrainProvider.requestVertexNormals?e._surface._tileProvider.uniformMap=void 0:(r.push(e._material.shaderSource),t.push("WAJUE"),e._surface._tileProvider.uniformMap=e._material._uniforms),r.push(GlobeFS),e._surfaceShaderSet.baseVertexShaderSource=new ShaderSource({sources:[GroundAtmosphere,GlobeVS],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new ShaderSource({sources:r,defines:t}),e._surfaceShaderSet.material=e._material}function makeShadersDirty(e){var t=[],i=defined(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),r=[GroundAtmosphere];!defined(e._material)||i&&!e._terrainProvider.requestVertexNormals?e._surface._tileProvider.uniformMap=void 0:(r.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.uniformMap=e._material._uniforms),r.push(GlobeFS),e._surfaceShaderSet.baseVertexShaderSource=new ShaderSource({sources:[GroundAtmosphere,GlobeVS],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new ShaderSource({sources:r,defines:t}),e._surfaceShaderSet.material=e._material}function createComparePickTileFunction(i){return function(e,t){return BoundingSphere.distanceSquaredTo(e.pickBoundingSphere,i)-BoundingSphere.distanceSquaredTo(t.pickBoundingSphere,i)}}defineProperties$1(Globe.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!defined(this._surface)||this._surface.tileProvider.ready&&0===this._surface._tileLoadQueueHigh.length&&0===this._surface._tileLoadQueueMedium.length&&0===this._surface._tileLoadQueueLow.length}},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}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){defined(e)||(e=Rectangle.clone(Rectangle.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),defined(this._material)&&makeShadersDirty(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)&&"WaJue"==e.type?makeShadersWaJue(this):makeShadersDirty(this))}}});var scratchArray$2=[],scratchSphereIntersectionResult={start:0,stop:0};Globe.prototype.pickWorldCoordinates=function(e,t,i){var r=t.mode,n=t.mapProjection,a=scratchArray$2;a.length=0;var o,s,l,c=this._surface._tilesToRender,u=c.length;for(s=0;s<u;++s){var d=(o=c[s]).data;if(defined(d)){var h=d.pickBoundingSphere;if(r!==SceneMode$1.SCENE3D)d.pickBoundingSphere=h=BoundingSphere.fromRectangleWithHeights2D(o.rectangle,n,d.tileBoundingRegion.minimumHeight,d.tileBoundingRegion.maximumHeight,h),Cartesian3.fromElements(h.center.z,h.center.x,h.center.y,h.center);else{if(!defined(d.renderedMesh))continue;BoundingSphere.clone(d.renderedMesh.boundingSphere3D,h)}defined(IntersectionTests.raySphere(e,h,scratchSphereIntersectionResult))&&a.push(d)}}for(a.sort(createComparePickTileFunction(e.origin)),u=a.length,s=0;s<u&&!defined(l=a[s].pick(e,t.mode,t.mapProjection,!0,i));++s);return l};var cartoScratch$2=new Cartographic;Globe.prototype.pick=function(e,t,i){if(defined(i=this.pickWorldCoordinates(e,t,i))&&t.mode!==SceneMode$1.SCENE3D){i=Cartesian3.fromElements(i.y,i.z,i.x,i);var r=t.mapProjection.unproject(i,cartoScratch$2);i=t.globe.ellipsoid.cartographicToCartesian(r,i)}return i};var scratchGetHeightCartesian=new Cartesian3,scratchGetHeightIntersection=new Cartesian3,scratchGetHeightCartographic=new Cartographic,scratchGetHeightRay=new Ray;function tileIfContainsCartographic(e,t){return Rectangle.contains(e.rectangle,t)?e:void 0}Globe.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(defined(t)){var i,r,n=t.length;for(r=0;r<n&&(i=t[r],!Rectangle.contains(i.rectangle,e));++r);if(!(n<=r)){for(;i._lastSelectionResult===TileSelectionResult.REFINED;)i=tileIfContainsCartographic(i.southwestChild,e)||tileIfContainsCartographic(i.southeastChild,e)||tileIfContainsCartographic(i.northwestChild,e)||i.northeastChild;if(defined(i.data)&&defined(i.data.renderedMesh)){var a=this._surface._tileProvider.tilingScheme.ellipsoid,o=Cartesian3.fromRadians(e.longitude,e.latitude,0,a,scratchGetHeightCartesian),s=scratchGetHeightRay,l=a.geodeticSurfaceNormal(o,s.direction);if(!defined(a.getSurfaceNormalIntersectionWithZAxis(o,11500,s.origin))){var c;defined(i.data.tileBoundingRegion)&&(c=i.data.tileBoundingRegion.minimumHeight);var u=Math.min(defaultValue(c,0),-11500),d=Cartesian3.multiplyByScalar(l,Math.abs(u)+1,scratchGetHeightIntersection);Cartesian3.subtract(o,d,s.origin)}var h=i.data.pick(s,void 0,void 0,!1,scratchGetHeightIntersection);if(defined(h))return a.cartesianToCartographic(h,scratchGetHeightCartographic).height}}}},Globe.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)},Globe.prototype.beginFrame=function(t){var e=this._surface,i=e.tileProvider,r=this.terrainProvider,n=this.showWaterEffect&&r.ready&&r.hasWaterMask;if(n&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;var a=this._oceanNormalMapResource,o=a.url;if(defined(o)){var s=this;when(a.fetchImage(),function(e){o===s._oceanNormalMapResource.url&&(s._oceanNormalMap=s._oceanNormalMap&&s._oceanNormalMap.destroy(),s._oceanNormalMap=new Texture({context:t.context,source:e}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}var l=t.passes,c=t.mode;l.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e.tileCacheSize=this.tileCacheSize,e.loadingDescendantLimit=this.loadingDescendantLimit,e.preloadAncestors=this.preloadAncestors,e.preloadSiblings=this.preloadSiblings,i.terrainProvider=this.terrainProvider,i.lightingFadeOutDistance=this.lightingFadeOutDistance,i.lightingFadeInDistance=this.lightingFadeInDistance,i.nightFadeOutDistance=this.nightFadeOutDistance,i.nightFadeInDistance=this.nightFadeInDistance,i.zoomedOutOceanSpecularIntensity=c===SceneMode$1.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,i.hasWaterMask=n,i.oceanNormalMap=this._oceanNormalMap,i.enableLighting=this.enableLighting,i.showGroundAtmosphere=this.showGroundAtmosphere,i.shadows=this.shadows,i.hueShift=this.atmosphereHueShift,i.saturationShift=this.atmosphereSaturationShift,i.brightnessShift=this.atmosphereBrightnessShift,i.fillHighlightColor=this.fillHighlightColor,e.beginFrame(t))},Globe.prototype.render=function(e){this.show&&(defined(this._material)&&this._material.update(e.context),this._surface.render(e))},Globe.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)},Globe.prototype.isDestroyed=function(){return!1},Globe.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(),destroyObject(this)};var PassThrough="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n}\n",PassThroughDepth="uniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);\n}\n";function GlobeDepth(){this._globeColorTexture=void 0,this._primitiveColorTexture=void 0,this._depthStencilTexture=void 0,this._globeDepthTexture=void 0,this._tempGlobeDepthTexture=void 0,this._tempCopyDepthTexture=void 0,this._globeColorFramebuffer=void 0,this._primitiveColorFramebuffer=void 0,this._copyDepthFramebuffer=void 0,this._tempCopyDepthFramebuffer=void 0,this._updateDepthFramebuffer=void 0,this._clearGlobeColorCommand=void 0,this._clearPrimitiveColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._mergeColorCommand=void 0,this._viewport=new BoundingRectangle,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useLogDepth=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0,this._debugGlobeDepthViewportCommand=void 0}function executeDebugGlobeDepth(e,t,i,r){if(!defined(e._debugGlobeDepthViewportCommand)||r!==e._useLogDepth){var n=new ShaderSource({defines:[r?"LOG_DEPTH":""],sources:["uniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n    float z_window = czm_unpackDepth(texture2D(u_depthTexture, v_textureCoordinates));\n    z_window = czm_reverseLogDepth(z_window); \n    float n_range = czm_depthRange.near;\n    float f_range = czm_depthRange.far;\n    float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n    float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n    gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n"]});e._debugGlobeDepthViewportCommand=t.createViewportQuadCommand(n,{uniformMap:{u_depthTexture:function(){return e._globeDepthTexture}},owner:e}),e._useLogDepth=r}e._debugGlobeDepthViewportCommand.execute(t,i)}function destroyTextures(e){e._globeColorTexture=e._globeColorTexture&&!e._globeColorTexture.isDestroyed()&&e._globeColorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._globeDepthTexture=e._globeDepthTexture&&!e._globeDepthTexture.isDestroyed()&&e._globeDepthTexture.destroy()}function destroyFramebuffers$1(e){e._globeColorFramebuffer=e._globeColorFramebuffer&&!e._globeColorFramebuffer.isDestroyed()&&e._globeColorFramebuffer.destroy(),e._copyDepthFramebuffer=e._copyDepthFramebuffer&&!e._copyDepthFramebuffer.isDestroyed()&&e._copyDepthFramebuffer.destroy()}function destroyUpdateDepthResources(e){e._tempCopyDepthFramebuffer=e._tempCopyDepthFramebuffer&&!e._tempCopyDepthFramebuffer.isDestroyed()&&e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer=e._updateDepthFramebuffer&&!e._updateDepthFramebuffer.isDestroyed()&&e._updateDepthFramebuffer.destroy(),e._tempGlobeDepthTexture=e._tempGlobeDepthTexture&&!e._tempGlobeDepthTexture.isDestroyed()&&e._tempGlobeDepthTexture.destroy()}function createUpdateDepthResources(e,t,i,r,n){e._tempGlobeDepthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),e._tempCopyDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._tempGlobeDepthTexture],destroyAttachments:!1}),e._updateDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._globeDepthTexture],depthStencilTexture:n.framebuffer.depthStencilTexture,destroyAttachments:!1})}function createTextures$1(e,t,i,r,n){var a=n?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._globeColorTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:a,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),e._depthStencilTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}),e._globeDepthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}function createFramebuffers$1(e,t){e._globeColorFramebuffer=new Framebuffer({context:t,colorTextures:[e._globeColorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._copyDepthFramebuffer=new Framebuffer({context:t,colorTextures:[e._globeDepthTexture],destroyAttachments:!1})}function createPrimitiveFramebuffer(e,t,i,r,n){var a=n?t.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;e._primitiveColorTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:a,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),e._primitiveColorFramebuffer=new Framebuffer({context:t,colorTextures:[e._primitiveColorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1})}function destroyPrimitiveFramebuffer(e){e._primitiveColorTexture=e._primitiveColorTexture&&!e._primitiveColorTexture.isDestroyed()&&e._primitiveColorTexture.destroy(),e._primitiveColorFramebuffer=e._primitiveColorFramebuffer&&!e._primitiveColorFramebuffer.isDestroyed()&&e._primitiveColorFramebuffer.destroy()}function updateFramebuffers(e,t,i,r,n,a){var o=e._globeColorTexture,s=!defined(o)||o.width!==i||o.height!==r||n!==e._useHdr;s&&(destroyTextures(e),destroyFramebuffers$1(e),createTextures$1(e,t,i,r,n),createFramebuffers$1(e,t)),!s&&a===e._clearGlobeDepth||(destroyPrimitiveFramebuffer(e),a&&createPrimitiveFramebuffer(e,t,i,r,n))}function updateCopyCommands(e,t,i,r,n){e._viewport.width=i,e._viewport.height=r;var a=!BoundingRectangle.equals(e._viewport,n.viewport),o=a!==e._useScissorTest;e._useScissorTest=a,BoundingRectangle.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=BoundingRectangle.clone(n.viewport,e._scissorRectangle),o=!0),defined(e._rs)&&BoundingRectangle.equals(e._viewport,e._rs.viewport)&&!o||(e._rs=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:BlendingState$1.ALPHA_BLEND}),e._rsUpdate=RenderState.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:StencilConstants$1.CESIUM_3D_TILE_MASK,mask:StencilConstants$1.CESIUM_3D_TILE_MASK}})),defined(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._depthStencilTexture}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer,e._copyDepthCommand.renderState=e._rs,defined(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._globeColorTexture}},owner:e})),e._copyColorCommand.renderState=e._rs,defined(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(PassThroughDepth,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer,e._tempCopyDepthCommand.renderState=e._rs,defined(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._tempGlobeDepthTexture}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer,e._updateDepthCommand.renderState=e._rsUpdate,defined(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ClearCommand({color:new Color(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e._globeColorFramebuffer,defined(e._clearPrimitiveColorCommand)||(e._clearPrimitiveColorCommand=new ClearCommand({color:new Color(0,0,0,0),stencil:0,owner:e})),e._clearPrimitiveColorCommand.framebuffer=e._primitiveColorFramebuffer,defined(e._mergeColorCommand)||(e._mergeColorCommand=t.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return e._primitiveColorTexture}},owner:e})),e._mergeColorCommand.framebuffer=e._globeColorFramebuffer,e._mergeColorCommand.renderState=e._rsBlend}function GoogleEarthEnterpriseDiscardPolicy(){this._image=new Image}function GoogleEarthEnterpriseImageryProvider(e){var i;if(defined((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).metadata))i=e.metadata;else{var t=Resource.createIfNeeded(e.url);i=new GoogleEarthEnterpriseMetadata(t)}this._metadata=i,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=new GeographicTilingScheme({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Rectangle(-CesiumMath.PI,-CesiumMath.PI,CesiumMath.PI,CesiumMath.PI),ellipsoid:e.ellipsoid});var r=e.credit;"string"==typeof r&&(r=new Credit(r)),this._credit=r,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=23,defined(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new GoogleEarthEnterpriseDiscardPolicy),this._errorEvent=new Event,this._ready=!1;var n,a=this;this._readyPromise=i.readyPromise.then(function(e){if(i.imageryPresent)return TileProviderError.handleSuccess(n),a._ready=e;var t=new RuntimeError("The server "+i.url+" doesn't have imagery");return n=TileProviderError.handleError(n,a,a._errorEvent,t.message,void 0,void 0,void 0,t),when.reject(t)}).otherwise(function(e){return n=TileProviderError.handleError(n,a,a._errorEvent,e.message,void 0,void 0,void 0,e),when.reject(e)})}function buildImageResource$3(e,t,i,r,n,a){var o=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(i,r,n),s=t.imageryVersion;return s=defined(s)&&0<s?s:1,e._metadata.resource.getDerivedResource({url:"flatfile?f1-0"+o+"-i."+s.toString(),request:a})}function getImageType(e){var t="JFIF";if(e[6]===t.charCodeAt(0)&&e[7]===t.charCodeAt(1)&&e[8]===t.charCodeAt(2)&&e[9]===t.charCodeAt(3))return"image/jpeg";return e[1]==="PNG".charCodeAt(0)&&e[2]==="PNG".charCodeAt(1)&&e[3]==="PNG".charCodeAt(2)?"image/png":void 0}function decodeEarthImageryPacket(e){for(var t=protobuf.Reader.create(e),i=t.len,r={};t.pos<i;){var n=t.uint32();switch(n>>>3){case 1:r.imageType=t.uint32();break;case 2:r.imageData=t.bytes();break;case 3:r.alphaType=t.uint32();break;case 4:r.imageAlpha=t.bytes();break;case 5:var a=r.copyrightIds;if(defined(a)||(a=r.copyrightIds=[]),2==(7&n))for(var o=t.uint32()+t.pos;t.pos<o;)a.push(t.uint32());else a.push(t.uint32());break;default:t.skipType(7&n)}}var s=r.imageType;if(defined(s))switch(s){case 0:r.imageType="image/jpeg";break;case 4:r.imageType="image/png";break;default:throw new RuntimeError("GoogleEarthEnterpriseImageryProvider: Unsupported image type.")}var l=r.alphaType;return defined(l)&&0!==l&&(console.log("GoogleEarthEnterpriseImageryProvider: External alpha not supported."),delete r.alphaType,delete r.imageAlpha),r}defineProperties$1(GlobeDepth.prototype,{framebuffer:{get:function(){return this._globeColorFramebuffer}},primitiveFramebuffer:{get:function(){return this._primitiveColorFramebuffer}}}),GlobeDepth.prototype.executeDebugGlobeDepth=function(e,t,i){executeDebugGlobeDepth(this,e,t,i)},GlobeDepth.prototype.update=function(e,t,i,r,n){var a=i.width,o=i.height;updateFramebuffers(this,e,a,o,r,n),updateCopyCommands(this,e,a,o,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=r,this._clearGlobeDepth=n},GlobeDepth.prototype.executeCopyDepth=function(e,t){defined(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._globeDepthTexture)},GlobeDepth.prototype.executeUpdateDepth=function(e,t,i){var r=t.framebuffer.depthStencilTexture;if(i||r!==this._depthStencilTexture){if(defined(this._updateDepthCommand)){if(!defined(this._updateDepthFramebuffer)||this._updateDepthFramebuffer.depthStencilTexture!==r||this._updateDepthFramebuffer.getColorTexture(0)!==this._globeDepthTexture){var n=this._globeDepthTexture.width,a=this._globeDepthTexture.height;destroyUpdateDepthResources(this),createUpdateDepthResources(this,e,n,a,t),updateCopyCommands(this,e,n,a,t)}this._tempCopyDepthTexture=r,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}}else defined(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)},GlobeDepth.prototype.executeCopyColor=function(e,t){defined(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},GlobeDepth.prototype.executeMergeColor=function(e,t){defined(this._mergeColorCommand)&&this._mergeColorCommand.execute(e,t)},GlobeDepth.prototype.clear=function(e,t,i){var r=this._clearGlobeColorCommand;defined(r)&&(Color.clone(i,r.color),r.execute(e,t)),defined(r=this._clearPrimitiveColorCommand)&&defined(this._primitiveColorFramebuffer)&&r.execute(e,t)},GlobeDepth.prototype.isDestroyed=function(){return!1},GlobeDepth.prototype.destroy=function(){return destroyTextures(this),destroyFramebuffers$1(this),destroyPrimitiveFramebuffer(this),destroyUpdateDepthResources(this),defined(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),defined(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),defined(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),defined(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),defined(this._mergeColorCommand)&&(this._mergeColorCommand.shaderProgram=this._mergeColorCommand.shaderProgram.destroy()),defined(this._debugGlobeDepthViewportCommand)&&(this._debugGlobeDepthViewportCommand.shaderProgram=this._debugGlobeDepthViewportCommand.shaderProgram.destroy()),destroyObject(this)},GoogleEarthEnterpriseDiscardPolicy.prototype.isReady=function(){return!0},GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage=function(e){return e===this._image},defineProperties$1(GoogleEarthEnterpriseImageryProvider.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.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._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}}),GoogleEarthEnterpriseImageryProvider.prototype.getTileCredits=function(e,t,i){var r=this._metadata,n=r.getTileInformation(e,t,i);if(defined(n)){var a=r.providers[n.imageryProvider];if(defined(a))return[a]}},GoogleEarthEnterpriseImageryProvider.prototype.requestImage=function(e,t,i,r){var a=this._tileDiscardPolicy._image,o=this._metadata,n=GoogleEarthEnterpriseMetadata.tileXYToQuadKey(e,t,i),s=o.getTileInformation(e,t,i);if(!defined(s)){if(o.isValid(n)){var l=new Request({throttle:r.throttle,throttleByServer:r.throttleByServer,type:r.type,priorityFunction:r.priorityFunction});return void o.populateSubtree(e,t,i,l)}return a}if(!s.hasImagery())return a;var c=buildImageResource$3(this,s,e,t,i,r).fetchArrayBuffer();return defined(c)?c.then(function(e){decodeGoogleEarthEnterpriseData(o.key,e);var t,i=new Uint8Array(e),r=o.protoImagery;if(defined(r)&&r||(t=getImageType(i)),!defined(t)&&(!defined(r)||r)){var n=decodeEarthImageryPacket(i);t=n.imageType,i=n.imageData}return defined(t)&&defined(i)?loadImageFromTypedArray({uint8Array:i,format:t,flipY:!0}):a}):void 0},GoogleEarthEnterpriseImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){};var defaultColor$8=new Color(1,1,1,.4),defaultGlowColor=new Color(0,1,0,.05),defaultBackgroundColor$1=new Color(0,.5,0,.2);function GridImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new GeographicTilingScheme({ellipsoid:e.ellipsoid}),this._cells=defaultValue(e.cells,8),this._color=defaultValue(e.color,defaultColor$8),this._glowColor=defaultValue(e.glowColor,defaultGlowColor),this._glowWidth=defaultValue(e.glowWidth,6),this._backgroundColor=defaultValue(e.backgroundColor,defaultBackgroundColor$1),this._errorEvent=new Event,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._canvasSize=defaultValue(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=when.resolve(!0)}function InvertClassification(){this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._texture=void 0,this._classifiedTexture=void 0,this._depthStencilTexture=void 0,this._fbo=void 0,this._fboClassified=void 0,this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,stencil:0});var e=this;this._uniformMap={colorTexture:function(){return e._texture},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._classifiedTexture}}}defineProperties$1(GridImageryProvider.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),GridImageryProvider.prototype._drawGrid=function(e){for(var t=this._canvasSize,i=0;i<=this._cells;++i){var r=1+i/this._cells*(t-1);e.moveTo(r,0),e.lineTo(r,t),e.moveTo(0,r),e.lineTo(t,r)}e.stroke()},GridImageryProvider.prototype._createGridCanvas=function(){var e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;var t=this._canvasSize,i=e.getContext("2d"),r=this._backgroundColor.toCssColorString();i.fillStyle=r,i.fillRect(0,0,t,t);var n=this._glowColor.toCssColorString();i.strokeStyle=n,i.lineWidth=this._glowWidth,i.strokeRect(0,0,t,t),this._drawGrid(i),i.lineWidth=.5*this._glowWidth,i.strokeRect(0,0,t,t),this._drawGrid(i);var a=this._color.toCssColorString();return i.strokeStyle=a,i.lineWidth=2,i.strokeRect(0,0,t,t),i.lineWidth=1,this._drawGrid(i),e},GridImageryProvider.prototype.getTileCredits=function(e,t,i){},GridImageryProvider.prototype.requestImage=function(e,t,i,r){return this._canvas},GridImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){},defineProperties$1(InvertClassification.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}}),InvertClassification.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};var rsUnclassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsClassified={depthMask:!1,stencilTest:{enabled:!0,frontFunction:StencilFunction$1.NOT_EQUAL,frontOperation:{fail:StencilOperation$1.KEEP,zFail:StencilOperation$1.KEEP,zPass:StencilOperation$1.KEEP},backFunction:StencilFunction$1.NEVER,reference:0,mask:StencilConstants$1.CLASSIFICATION_MASK},blending:BlendingState$1.ALPHA_BLEND},rsDefault={depthMask:!0,depthTest:{enabled:!0},stencilTest:StencilConstants$1.setCesium3DTileBit(),stencilMask:StencilConstants$1.CESIUM_3D_TILE_MASK,blending:BlendingState$1.ALPHA_BLEND},translucentFS="#extension GL_EXT_frag_depth : enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform sampler2D classifiedTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n    vec4 color = texture2D(colorTexture, v_textureCoordinates);\n    if (color.a == 0.0)\n    {\n        discard;\n    }\n    bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));\n#ifdef UNCLASSIFIED\n    vec4 highlightColor = czm_invertClassificationColor;\n    if (isClassified)\n    {\n        discard;\n    }\n#else\n    vec4 highlightColor = vec4(1.0);\n    if (!isClassified)\n    {\n        discard;\n    }\n#endif\n    gl_FragColor = color * highlightColor;\n    gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;\n}\n",opaqueFS="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n    vec4 color = texture2D(colorTexture, v_textureCoordinates);\n    if (color.a == 0.0)\n    {\n        discard;\n    }\n#ifdef UNCLASSIFIED\n    gl_FragColor = color * czm_invertClassificationColor;\n#else\n    gl_FragColor = color;\n#endif\n}\n";function JobTypeBudget(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}function JobScheduler(e){var t=new Array(JobType$1.NUMBER_OF_JOB_TYPES);t[JobType$1.TEXTURE]=new JobTypeBudget(defined(e)?e[JobType$1.TEXTURE]:10),t[JobType$1.PROGRAM]=new JobTypeBudget(defined(e)?e[JobType$1.PROGRAM]:10),t[JobType$1.BUFFER]=new JobTypeBudget(defined(e)?e[JobType$1.BUFFER]:30);var i,r=t.length,n=0;for(i=0;i<r;++i)n+=t[i].total;var a=new Array(r);for(i=0;i<r;++i)a[i]=!1;this._totalBudget=n,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=a}InvertClassification.prototype.update=function(e){var t=this._texture,i=!defined(t)||this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;var r,n,a=e.drawingBufferWidth,o=e.drawingBufferHeight,s=!defined(t)||t.width!==a||t.height!==o;(s||i)&&(this._texture=this._texture&&this._texture.destroy(),this._classifiedTexture=this._classifiedTexture&&this._classifiedTexture.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._texture=new Texture({context:e,width:a,height:o,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}),defined(this._previousFramebuffer)||(this._classifiedTexture=new Texture({context:e,width:a,height:o,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.LINEAR,magnificationFilter:TextureMagnificationFilter$1.LINEAR})}),this._depthStencilTexture=new Texture({context:e,width:a,height:o,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}))),defined(this._fbo)&&!s&&!i||(this._fbo=this._fbo&&this._fbo.destroy(),this._fboClassified=this._fboClassified&&this._fboClassified.destroy(),defined(this._previousFramebuffer)?(r=this._previousFramebuffer.depthStencilTexture,n=this._previousFramebuffer.depthStencilRenderbuffer):r=this._depthStencilTexture,this._fbo=new Framebuffer({context:e,colorTextures:[this._texture],depthStencilTexture:r,depthStencilRenderbuffer:n,destroyAttachments:!1}),defined(this._previousFramebuffer)||(this._fboClassified=new Framebuffer({context:e,colorTextures:[this._classifiedTexture],depthStencilTexture:r,destroyAttachments:!1})));if(defined(this._rsUnclassified)||(this._rsUnclassified=RenderState.fromCache(rsUnclassified),this._rsClassified=RenderState.fromCache(rsClassified),this._rsDefault=RenderState.fromCache(rsDefault)),!defined(this._unclassifiedCommand)||i){defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());var l=defined(this._previousFramebuffer)?opaqueFS:translucentFS,c=new ShaderSource({defines:["UNCLASSIFIED"],sources:[l]}),u=new ShaderSource({sources:[l]});this._unclassifiedCommand=e.createViewportQuadCommand(c,{renderState:defined(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(u,{renderState:defined(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),defined(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),defined(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(PassThrough,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}},InvertClassification.prototype.clear=function(e,t){var i=t.framebuffer;defined(this._previousFramebuffer)?(t.framebuffer=this._fbo,this._clearColorCommand.execute(e,t)):(t.framebuffer=this._fbo,this._clearCommand.execute(e,t),t.framebuffer=this._fboClassified,this._clearCommand.execute(e,t)),t.framebuffer=i},InvertClassification.prototype.executeClassified=function(e,t){if(!defined(this._previousFramebuffer)){var i=t.framebuffer;t.framebuffer=this._fboClassified,this._translucentCommand.execute(e,t),t.framebuffer=i}this._classifiedCommand.execute(e,t)},InvertClassification.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)},InvertClassification.prototype.isDestroyed=function(){return!1},InvertClassification.prototype.destroy=function(){return this._fbo=this._fbo&&this._fbo.destroy(),this._texture=this._texture&&this._texture.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),defined(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),destroyObject(this)},defineProperties$1(JobTypeBudget.prototype,{total:{get:function(){return this._total}}}),JobScheduler.getTimestamp=getTimestamp$1,defineProperties$1(JobScheduler.prototype,{totalBudget:{get:function(){return this._totalBudget}}}),JobScheduler.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget},JobScheduler.prototype.resetBudgets=function(){for(var e=this._budgets,t=e.length,i=0;i<t;++i){var r=e[i];r.starvedLastFrame=r.starvedThisFrame,r.starvedThisFrame=!1,r.usedThisFrame=0,r.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0},JobScheduler.prototype.execute=function(e,t){var i,r=this._budgets,n=r[t],a=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&a)return!(n.starvedThisFrame=!0);if(n.usedThisFrame+n.stolenFromMeThisFrame>=n.total){var o,s=r.length;for(o=0;o<s&&(!((i=r[o]).usedThisFrame+i.stolenFromMeThisFrame<i.total)||i.starvedLastFrame);++o);if(o===s&&a)return!1;a&&(n.starvedThisFrame=!0)}var l=JobScheduler.getTimestamp();e.execute();var c=JobScheduler.getTimestamp()-l;return this._totalUsedThisFrame+=c,i?i.stolenFromMeThisFrame+=c:n.usedThisFrame+=c,this._executedThisFrame[t]=!0};var trailingSlashRegex$1=/\/$/,defaultCredit$3=new Credit('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function MapboxStyleImageryProvider(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).styleId,i=Resource.createIfNeeded(defaultValue(e.url,"https://api.mapbox.com/styles/v1/")),r=MapboxApi.getAccessToken(e.accessToken);this._styleId=t,this._accessToken=r,this._accessTokenErrorCredit=Credit.clone(MapboxApi.getErrorCredit(e.accessToken));var n=defaultValue(e.tilesize,512);this._tilesize=n;var a=defaultValue(e.username,"mapbox");this._username=a;var o,s=defined(e.scaleFactor)?"@2x":"",l=i.getUrlComponent();trailingSlashRegex$1.test(l)||(l+="/"),l+=this._username+"/"+t+"/tiles/"+this._tilesize+"/{z}/{x}/{y}"+s,i.url=l,i.setQueryParameters({access_token:r}),defined(e.credit)?"string"==typeof(o=e.credit)&&(o=new Credit(o)):o=defaultCredit$3,this._resource=i,this._imageryProvider=new UrlTemplateImageryProvider({url:i,credit:o,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function Moon(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).textureUrl;defined(t)||(t=buildModuleUrl("Assets/Textures/moonSmall.jpg")),this.show=defaultValue(e.show,!0),this.textureUrl=t,this._ellipsoid=defaultValue(e.ellipsoid,Ellipsoid.MOON),this.onlySunLighting=defaultValue(e.onlySunLighting,!0),this._ellipsoidPrimitive=new EllipsoidPrimitive({radii:this.ellipsoid.radii,material:Material.fromType(Material.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new IauOrientationAxes}defineProperties$1(MapboxStyleImageryProvider.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},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}}}),MapboxStyleImageryProvider.prototype.getTileCredits=function(e,t,i){if(defined(this._accessTokenErrorCredit))return[this._accessTokenErrorCredit]},MapboxStyleImageryProvider.prototype.requestImage=function(e,t,i,r){return this._imageryProvider.requestImage(e,t,i,r)},MapboxStyleImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},MapboxStyleImageryProvider._defaultCredit=defaultCredit$3,defineProperties$1(Moon.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var icrfToFixed=new Matrix3,rotationScratch$1=new Matrix3,translationScratch=new Cartesian3,scratchCommandList$1=[];function NeverTileDiscardPolicy(e){}Moon.prototype.update=function(e){if(this.show){var t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;var i=e.time;defined(Transforms.computeIcrfToFixedMatrix(i,icrfToFixed))||Transforms.computeTemeToPseudoFixedMatrix(i,icrfToFixed);var r=this._axes.evaluate(i,rotationScratch$1);Matrix3.transpose(r,r),Matrix3.multiply(icrfToFixed,r,r);var n=Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(i,translationScratch);Matrix3.multiplyByVector(icrfToFixed,n,n),Matrix4.fromRotationTranslation(r,n,t.modelMatrix);var a=e.commandList;return(e.commandList=scratchCommandList$1).length=0,t.update(e),e.commandList=a,1===scratchCommandList$1.length?scratchCommandList$1[0]:void 0}},Moon.prototype.isDestroyed=function(){return!1},Moon.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),destroyObject(this)},NeverTileDiscardPolicy.prototype.isReady=function(){return!0},NeverTileDiscardPolicy.prototype.shouldDiscardImage=function(e){return!1};var AdjustTranslucentFS="#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nif (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n{\n#ifdef MRT\ngl_FragData[0] = u_bgColor;\ngl_FragData[1] = vec4(u_bgColor.a);\n#else\ngl_FragColor = u_bgColor;\n#endif\nreturn;\n}\ndiscard;\n}\n",CompositeOITFS="uniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 opaque = texture2D(u_opaque, v_textureCoordinates);\nvec4 accum = texture2D(u_accumulation, v_textureCoordinates);\nfloat r = texture2D(u_revealage, v_textureCoordinates).r;\n#ifdef MRT\nvec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\nvec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\ngl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\nif (opaque != czm_backgroundColor)\n{\ngl_FragColor.a = 1.0;\n}\n}\n";function OIT(e){this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;var t=e.colorBufferFloat&&e.depthTexture;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=void 0,this._alphaFBO=void 0,this._adjustTranslucentFBO=void 0,this._adjustAlphaFBO=void 0,this._opaqueClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new ClearCommand({color:new Color(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new ClearCommand({color:new Color(0,0,0,0),owner:this}),this._alphaClearCommand=new ClearCommand({color:new Color(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 BoundingRectangle,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function destroyTextures$1(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function destroyFramebuffers$2(e){e._translucentFBO=e._translucentFBO&&!e._translucentFBO.isDestroyed()&&e._translucentFBO.destroy(),e._alphaFBO=e._alphaFBO&&!e._alphaFBO.isDestroyed()&&e._alphaFBO.destroy(),e._adjustTranslucentFBO=e._adjustTranslucentFBO&&!e._adjustTranslucentFBO.isDestroyed()&&e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO=e._adjustAlphaFBO&&!e._adjustAlphaFBO.isDestroyed()&&e._adjustAlphaFBO.destroy()}function destroyResources(e){destroyTextures$1(e),destroyFramebuffers$2(e)}function updateTextures(e,t,i,r){destroyTextures$1(e),e._accumulationTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT});var n=new Float32Array(i*r*4);e._revealageTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.FLOAT,source:{arrayBufferView:n,width:i,height:r},flipY:!1})}function updateFramebuffers$1(e,t){destroyFramebuffers$2(e);var i=WebGLConstants$1.FRAMEBUFFER_COMPLETE,r=!0;if(e._translucentMRTSupport&&(e._translucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],destroyAttachments:!1}),e._translucentFBO.status===i&&e._adjustTranslucentFBO.status===i||(destroyFramebuffers$2(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._alphaFBO=new Framebuffer({context:t,colorTextures:[e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new Framebuffer({context:t,colorTextures:[e._accumulationTexture],destroyAttachments:!1}),e._adjustAlphaFBO=new Framebuffer({context:t,colorTextures:[e._revealageTexture],destroyAttachments:!1});var n=e._translucentFBO.status===i,a=e._alphaFBO.status===i,o=e._adjustTranslucentFBO.status===i,s=e._adjustAlphaFBO.status===i;n&&a&&o&&s||(destroyResources(e),r=e._translucentMultipassSupport=!1)}return r}OIT.prototype.update=function(e,t,i,r){if(this.isSupported()){this._opaqueFBO=i,this._opaqueTexture=i.getColorTexture(0),this._depthStencilTexture=i.depthStencilTexture;var n=this._opaqueTexture.width,a=this._opaqueTexture.height,o=this._accumulationTexture,s=!defined(o)||o.width!==n||o.height!==a||r!==this._useHDR;if(s&&updateTextures(this,e,n,a),defined(this._translucentFBO)&&!s||updateFramebuffers$1(this,e)){this._useHDR=r;var l,c,u=this;defined(this._compositeCommand)||(l=new ShaderSource({sources:[CompositeOITFS]}),this._translucentMRTSupport&&l.defines.push("MRT"),c={u_opaque:function(){return u._opaqueTexture},u_accumulation:function(){return u._accumulationTexture},u_revealage:function(){return u._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this})),defined(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(l=new ShaderSource({defines:["MRT"],sources:[AdjustTranslucentFS]}),c={u_bgColor:function(){return u._translucentMRTClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this})):this._translucentMultipassSupport&&(l=new ShaderSource({sources:[AdjustTranslucentFS]}),c={u_bgColor:function(){return u._translucentMultipassClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this}),c={u_bgColor:function(){return u._alphaClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(l,{uniformMap:c,owner:this}))),this._viewport.width=n,this._viewport.height=a;var d=!BoundingRectangle.equals(this._viewport,t.viewport),h=d!==this._useScissorTest;this._useScissorTest=d,BoundingRectangle.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=BoundingRectangle.clone(t.viewport,this._scissorRectangle),h=!0),defined(this._rs)&&BoundingRectangle.equals(this._viewport,this._rs.viewport)&&!h||(this._rs=RenderState.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),defined(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)}}};var translucentMRTBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA},translucentColorBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ONE,functionDestinationRgb:BlendFunction$1.ONE,functionSourceAlpha:BlendFunction$1.ONE,functionDestinationAlpha:BlendFunction$1.ONE},translucentAlphaBlend={enabled:!0,color:new Color(0,0,0,0),equationRgb:BlendEquation$1.ADD,equationAlpha:BlendEquation$1.ADD,functionSourceRgb:BlendFunction$1.ZERO,functionDestinationRgb:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:BlendFunction$1.ZERO,functionDestinationAlpha:BlendFunction$1.ONE_MINUS_SOURCE_ALPHA};function getTranslucentRenderState$2(e,t,i,r){var n=i[r.id];if(!defined(n)){var a=RenderState.getState(r);a.depthMask=!1,a.blending=t,n=RenderState.fromCache(a),i[r.id]=n}return n}function getTranslucentMRTRenderState(e,t,i){return getTranslucentRenderState$2(t,translucentMRTBlend,e._translucentRenderStateCache,i)}function getTranslucentColorRenderState(e,t,i){return getTranslucentRenderState$2(t,translucentColorBlend,e._translucentRenderStateCache,i)}function getTranslucentAlphaRenderState(e,t,i){return getTranslucentRenderState$2(t,translucentAlphaBlend,e._alphaRenderStateCache,i)}var mrtShaderSource="    vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n    float ai = czm_gl_FragColor.a;\n    float wzi = czm_alphaWeight(ai);\n    gl_FragData[0] = vec4(Ci * wzi, ai);\n    gl_FragData[1] = vec4(ai * wzi);\n",colorShaderSource="    vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n    float ai = czm_gl_FragColor.a;\n    float wzi = czm_alphaWeight(ai);\n    gl_FragColor = vec4(Ci, ai) * wzi;\n",alphaShaderSource="    float ai = czm_gl_FragColor.a;\n    gl_FragColor = vec4(ai);\n";function getTranslucentShaderProgram(e,t,i,r){var n=e.shaderCache.getDerivedShaderProgram(t,i);if(!defined(n)){var a=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources=o.sources.map(function(e){return e=(e=(e=(e=ShaderSource.replaceMain(e,"czm_translucent_main")).replace(/gl_FragColor/g,"czm_gl_FragColor")).replace(/\bdiscard\b/g,"czm_discard = true")).replace(/czm_phong/g,"czm_translucentPhong")}),o.sources.splice(0,0,(-1!==r.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\nbool czm_discard = false;\n"),o.sources.push("void main()\n{\n    czm_translucent_main();\n    if (czm_discard)\n    {\n        discard;\n    }\n"+r+"}\n"),n=e.shaderCache.createDerivedShaderProgram(t,i,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:a})}return n}function getTranslucentMRTShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMRT",mrtShaderSource)}function getTranslucentColorShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"translucentMultipass",colorShaderSource)}function getTranslucentAlphaShaderProgram(e,t){return getTranslucentShaderProgram(e,t,"alphaMultipass",alphaShaderSource)}function executeTranslucentCommandsSortedMultipass(e,t,i,r,n,a){var o,s,l=t.context,c=t.frameState.useLogDepth,u=t._hdr,d=r.framebuffer,h=n.length,p=t.frameState.shadowState.lightShadowsEnabled;r.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(l,r),r.framebuffer=e._adjustAlphaFBO,e._adjustAlphaCommand.execute(l,r);var m=e._opaqueFBO;for(r.framebuffer=e._translucentFBO,s=0;s<h;++s)o=n[s],o=c?o.derivedCommands.logDepth.command:o,o=u?o.derivedCommands.hdr.command:o,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.translucentCommand:o.derivedCommands.oit.translucentCommand,t,l,r,m);for(defined(a)&&(o=a.unclassifiedCommand,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.translucentCommand:o.derivedCommands.oit.translucentCommand,t,l,r,m)),r.framebuffer=e._alphaFBO,s=0;s<h;++s)o=n[s],o=c?o.derivedCommands.logDepth.command:o,o=u?o.derivedCommands.hdr.command:o,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.alphaCommand:o.derivedCommands.oit.alphaCommand,t,l,r,m);defined(a)&&(o=a.unclassifiedCommand,i(p&&o.receiveShadows?o.derivedCommands.oit.shadows.alphaCommand:o.derivedCommands.oit.alphaCommand,t,l,r,m)),r.framebuffer=d}function executeTranslucentCommandsSortedMRT(e,t,i,r,n,a){var o=t.context,s=t.frameState.useLogDepth,l=t._hdr,c=r.framebuffer,u=n.length,d=t.frameState.shadowState.lightShadowsEnabled;r.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(o,r);var h,p=e._opaqueFBO;r.framebuffer=e._translucentFBO;for(var m=0;m<u;++m)h=n[m],h=s?h.derivedCommands.logDepth.command:h,h=l?h.derivedCommands.hdr.command:h,i(d&&h.receiveShadows?h.derivedCommands.oit.shadows.translucentCommand:h.derivedCommands.oit.translucentCommand,t,o,r,p);defined(a)&&(h=a.unclassifiedCommand,i(d&&h.receiveShadows?h.derivedCommands.oit.shadows.translucentCommand:h.derivedCommands.oit.translucentCommand,t,o,r,p)),r.framebuffer=c}OIT.prototype.createDerivedCommands=function(e,t,i){var r,n,a,o,s,l;(defined(i)||(i={}),this._translucentMRTSupport)?(defined(i.translucentCommand)&&(r=i.translucentCommand.shaderProgram,n=i.translucentCommand.renderState),i.translucentCommand=DrawCommand.shallowClone(e,i.translucentCommand),defined(r)&&i.shaderProgramId===e.shaderProgram.id?(i.translucentCommand.shaderProgram=r,i.translucentCommand.renderState=n):(i.translucentCommand.shaderProgram=getTranslucentMRTShaderProgram(t,e.shaderProgram),i.translucentCommand.renderState=getTranslucentMRTRenderState(this,t,e.renderState),i.shaderProgramId=e.shaderProgram.id)):(defined(i.translucentCommand)&&(a=i.translucentCommand.shaderProgram,o=i.translucentCommand.renderState,s=i.alphaCommand.shaderProgram,l=i.alphaCommand.renderState),i.translucentCommand=DrawCommand.shallowClone(e,i.translucentCommand),i.alphaCommand=DrawCommand.shallowClone(e,i.alphaCommand),defined(a)&&i.shaderProgramId===e.shaderProgram.id?(i.translucentCommand.shaderProgram=a,i.translucentCommand.renderState=o,i.alphaCommand.shaderProgram=s,i.alphaCommand.renderState=l):(i.translucentCommand.shaderProgram=getTranslucentColorShaderProgram(t,e.shaderProgram),i.translucentCommand.renderState=getTranslucentColorRenderState(this,t,e.renderState),i.alphaCommand.shaderProgram=getTranslucentAlphaShaderProgram(t,e.shaderProgram),i.alphaCommand.renderState=getTranslucentAlphaRenderState(this,t,e.renderState),i.shaderProgramId=e.shaderProgram.id));return i},OIT.prototype.executeCommands=function(e,t,i,r,n){this._translucentMRTSupport?executeTranslucentCommandsSortedMRT(this,e,t,i,r,n):executeTranslucentCommandsSortedMultipass(this,e,t,i,r,n)},OIT.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},OIT.prototype.clear=function(e,t,i){var r=t.framebuffer;t.framebuffer=this._opaqueFBO,Color.clone(i,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO,(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO,this._alphaClearCommand.execute(e,t)),t.framebuffer=r},OIT.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},OIT.prototype.isDestroyed=function(){return!1},OIT.prototype.destroy=function(){return destroyResources(this),defined(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),defined(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),defined(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),destroyObject(this)};var defaultSize=new Cartesian2(1,1);function Particle(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.mass=defaultValue(e.mass,1),this.position=Cartesian3.clone(defaultValue(e.position,Cartesian3.ZERO)),this.velocity=Cartesian3.clone(defaultValue(e.velocity,Cartesian3.ZERO)),this.life=defaultValue(e.life,Number.MAX_VALUE),this.image=e.image,this.startColor=Color.clone(defaultValue(e.startColor,Color.WHITE)),this.endColor=Color.clone(defaultValue(e.endColor,Color.WHITE)),this.startScale=defaultValue(e.startScale,1),this.endScale=defaultValue(e.endScale,1),this.imageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultSize)),this._age=0,this._normalizedAge=0,this._billboard=void 0}defineProperties$1(Particle.prototype,{age:{get:function(){return this._age}},normalizedAge:{get:function(){return this._normalizedAge}}});var deltaScratch=new Cartesian3;function ParticleBurst(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.time=defaultValue(e.time,0),this.minimum=defaultValue(e.minimum,0),this.maximum=defaultValue(e.maximum,50),this._complete=!1}function ParticleEmitter(e){}Particle.prototype.update=function(e,t){return Cartesian3.multiplyByScalar(this.velocity,e,deltaScratch),Cartesian3.add(this.position,deltaScratch,this.position),defined(t)&&t(this,e),this._age+=e,this.life===Number.MAX_VALUE?this._normalizedAge=0:this._normalizedAge=this._age/this.life,this._age<=this.life},defineProperties$1(ParticleBurst.prototype,{complete:{get:function(){return this._complete}}}),ParticleEmitter.prototype.emit=function(e){DeveloperError.throwInstantiationError()};var defaultImageSize=new Cartesian2(1,1);function ParticleSystem(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.updateCallback=e.updateCallback,this.loop=defaultValue(e.loop,!0),this.image=defaultValue(e.image,void 0);var t=e.emitter;defined(t)||(t=new CircleEmitter(.5)),this._emitter=t,this._bursts=e.bursts,this._modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this._emitterModelMatrix=Matrix4.clone(defaultValue(e.emitterModelMatrix,Matrix4.IDENTITY)),this._matrixDirty=!0,this._combinedMatrix=new Matrix4,this._startColor=Color.clone(defaultValue(e.color,defaultValue(e.startColor,Color.WHITE))),this._endColor=Color.clone(defaultValue(e.color,defaultValue(e.endColor,Color.WHITE))),this._startScale=defaultValue(e.scale,defaultValue(e.startScale,1)),this._endScale=defaultValue(e.scale,defaultValue(e.endScale,1)),this._emissionRate=defaultValue(e.emissionRate,5),this._minimumSpeed=defaultValue(e.speed,defaultValue(e.minimumSpeed,1)),this._maximumSpeed=defaultValue(e.speed,defaultValue(e.maximumSpeed,1)),this._minimumParticleLife=defaultValue(e.particleLife,defaultValue(e.minimumParticleLife,5)),this._maximumParticleLife=defaultValue(e.particleLife,defaultValue(e.maximumParticleLife,5)),this._minimumMass=defaultValue(e.mass,defaultValue(e.minimumMass,1)),this._maximumMass=defaultValue(e.mass,defaultValue(e.maximumMass,1)),this._minimumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.minimumImageSize,defaultImageSize))),this._maximumImageSize=Cartesian2.clone(defaultValue(e.imageSize,defaultValue(e.maximumImageSize,defaultImageSize))),this._lifetime=defaultValue(e.lifetime,Number.MAX_VALUE),this._billboardCollection=void 0,this._particles=[],this._particlePool=[],this._previousTime=void 0,this._currentTime=0,this._carryOver=0,this._complete=new Event,this._isComplete=!1,this._updateParticlePool=!0,this._particleEstimate=0}function updateParticlePool(e){var t=e._emissionRate,i=e._maximumParticleLife,r=0,n=e._bursts;if(defined(n))for(var a=n.length,o=0;o<a;++o)r+=n[o].maximum;for(var s=e._billboardCollection,l=e.image,c=Math.ceil(t*i+r),u=e._particles,d=e._particlePool,h=Math.max(c-u.length-d.length,0),p=0;p<h;++p){var m=new Particle;m._billboard=s.add({image:l}),d.push(m)}e._particleEstimate=c}function getOrCreateParticle(e){var t=e._particlePool.pop();return defined(t)||(t=new Particle),t}function addParticleToPool(e,t){e._particlePool.push(t)}function freeParticlePool(e){for(var t=e._particles,i=e._particlePool,r=e._billboardCollection,n=t.length,a=i.length,o=e._particleEstimate,s=a-Math.max(o-n-a,0),l=s;l<a;++l){var c=i[l];r.remove(c._billboard)}i.length=s}function removeBillboard(e){defined(e._billboard)&&(e._billboard.show=!1)}function updateBillboard(e,t){var i=t._billboard;defined(i)||(i=t._billboard=e._billboardCollection.add({image:t.image})),i.width=t.imageSize.x,i.height=t.imageSize.y,i.position=t.position,i.show=!0;var r=CesiumMath.lerp(t.startColor.red,t.endColor.red,t.normalizedAge),n=CesiumMath.lerp(t.startColor.green,t.endColor.green,t.normalizedAge),a=CesiumMath.lerp(t.startColor.blue,t.endColor.blue,t.normalizedAge),o=CesiumMath.lerp(t.startColor.alpha,t.endColor.alpha,t.normalizedAge);i.color=new Color(r,n,a,o),i.scale=CesiumMath.lerp(t.startScale,t.endScale,t.normalizedAge)}function addParticle(e,t){t.startColor=Color.clone(e._startColor,t.startColor),t.endColor=Color.clone(e._endColor,t.endColor),t.startScale=e._startScale,t.endScale=e._endScale,t.image=e.image,t.life=CesiumMath.randomBetween(e._minimumParticleLife,e._maximumParticleLife),t.mass=CesiumMath.randomBetween(e._minimumMass,e._maximumMass),t.imageSize.x=CesiumMath.randomBetween(e._minimumImageSize.x,e._maximumImageSize.x),t.imageSize.y=CesiumMath.randomBetween(e._minimumImageSize.y,e._maximumImageSize.y),t._normalizedAge=0,t._age=0;var i=CesiumMath.randomBetween(e._minimumSpeed,e._maximumSpeed);Cartesian3.multiplyByScalar(t.velocity,i,t.velocity),e._particles.push(t)}function calculateNumberToEmit(e,t){if(e._isComplete)return 0;var i=(t=CesiumMath.mod(t,e._lifetime))*e._emissionRate,r=Math.floor(i);if(e._carryOver+=i-r,1<e._carryOver&&(r++,e._carryOver-=1),defined(e.bursts))for(var n=e.bursts.length,a=0;a<n;a++){var o=e.bursts[a],s=e._currentTime;defined(o)&&!o._complete&&s>o.time&&(r+=CesiumMath.randomBetween(o.minimum,o.maximum),o._complete=!0)}return r}defineProperties$1(ParticleSystem.prototype,{emitter:{get:function(){return this._emitter},set:function(e){this._emitter=e}},bursts:{get:function(){return this._bursts},set:function(e){this._bursts=e,this._updateParticlePool=!0}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._modelMatrix,e),Matrix4.clone(e,this._modelMatrix)}},emitterModelMatrix:{get:function(){return this._emitterModelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!Matrix4.equals(this._emitterModelMatrix,e),Matrix4.clone(e,this._emitterModelMatrix)}},startColor:{get:function(){return this._startColor},set:function(e){Color.clone(e,this._startColor)}},endColor:{get:function(){return this._endColor},set:function(e){Color.clone(e,this._endColor)}},startScale:{get:function(){return this._startScale},set:function(e){this._startScale=e}},endScale:{get:function(){return this._endScale},set:function(e){this._endScale=e}},emissionRate:{get:function(){return this._emissionRate},set:function(e){this._emissionRate=e,this._updateParticlePool=!0}},minimumSpeed:{get:function(){return this._minimumSpeed},set:function(e){this._minimumSpeed=e}},maximumSpeed:{get:function(){return this._maximumSpeed},set:function(e){this._maximumSpeed=e}},minimumParticleLife:{get:function(){return this._minimumParticleLife},set:function(e){this._minimumParticleLife=e}},maximumParticleLife:{get:function(){return this._maximumParticleLife},set:function(e){this._maximumParticleLife=e,this._updateParticlePool=!0}},minimumMass:{get:function(){return this._minimumMass},set:function(e){this._minimumMass=e}},maximumMass:{get:function(){return this._maximumMass},set:function(e){this._maximumMass=e}},minimumImageSize:{get:function(){return this._minimumImageSize},set:function(e){this._minimumImageSize=e}},maximumImageSize:{get:function(){return this._maximumImageSize},set:function(e){this._maximumImageSize=e}},lifetime:{get:function(){return this._lifetime},set:function(e){this._lifetime=e}},complete:{get:function(){return this._complete}},isComplete:{get:function(){return this._isComplete}}});var rotatedVelocityScratch=new Cartesian3;function getElement(e){"string"==typeof e&&(e=document.getElementById(e));return e}function PerformanceDisplay(e){var t=getElement((e=defaultValue(e,defaultValue.EMPTY_OBJECT)).container);this._container=t;var i=document.createElement("div");i.className="cesium-performanceDisplay";var r=document.createElement("div");r.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),r.appendChild(this._fpsText);var n=document.createElement("div");n.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),n.appendChild(this._msText),i.appendChild(n),i.appendChild(r),this._container.appendChild(i),this._lastFpsSampleTime=getTimestamp$1(),this._lastMsSampleTime=getTimestamp$1(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;var a=document.createElement("div");a.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),a.appendChild(this._throttledText),i.appendChild(a)}function PickDepth(){this._framebuffer=void 0,this._depthTexture=void 0,this._textureToCopy=void 0,this._copyDepthCommand=void 0,this._useLogDepth=void 0,this._debugPickDepthViewportCommand=void 0}function executeDebugPickDepth(e,t,i,r){if(!defined(e._debugPickDepthViewportCommand)||r!==e._useLogDepth){var n=new ShaderSource({defines:[r?"LOG_DEPTH":""],sources:["uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n    float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n    z_window = czm_reverseLogDepth(z_window); \n    float n_range = czm_depthRange.near;\n    float f_range = czm_depthRange.far;\n    float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n    float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n    gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n"]});e._debugPickDepthViewportCommand=t.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return e._depthTexture}},owner:e}),e._useLogDepth=r}e._debugPickDepthViewportCommand.execute(t,i)}function destroyTextures$2(e){e._depthTexture=e._depthTexture&&!e._depthTexture.isDestroyed()&&e._depthTexture.destroy()}function destroyFramebuffers$3(e){e._framebuffer=e._framebuffer&&!e._framebuffer.isDestroyed()&&e._framebuffer.destroy()}function createTextures$2(e,t,i,r){e._depthTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE})}function createFramebuffers$2(e,t,i,r){destroyTextures$2(e),destroyFramebuffers$3(e),createTextures$2(e,t,i,r),e._framebuffer=new Framebuffer({context:t,colorTextures:[e._depthTexture],destroyAttachments:!1})}function updateFramebuffers$2(e,t,i){var r=i.width,n=i.height,a=e._depthTexture,o=!defined(a)||a.width!==r||a.height!==n;defined(e._framebuffer)&&!o||createFramebuffers$2(e,t,r,n)}function updateCopyCommands$1(e,t,i){if(!defined(e._copyDepthCommand)){e._copyDepthCommand=t.createViewportQuadCommand("uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n    gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n",{renderState:RenderState.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=i,e._copyDepthCommand.framebuffer=e._framebuffer}ParticleSystem.prototype.update=function(e){if(this.show){defined(this._billboardCollection)||(this._billboardCollection=new BillboardCollection),this._updateParticlePool&&(updateParticlePool(this),this._updateParticlePool=!1);var t=0;this._previousTime&&(t=JulianDate.secondsDifference(e.time,this._previousTime)),t<0&&(t=0);var i,r,n=this._particles,a=this._emitter,o=this.updateCallback,s=n.length;for(i=0;i<s;++i)(r=n[i]).update(t,o)?updateBillboard(this,r):(removeBillboard(r),addParticleToPool(this,r),n[i]=n[s-1],--i,--s);n.length=s;var l=calculateNumberToEmit(this,t);if(0<l&&defined(a)){this._matrixDirty&&(this._combinedMatrix=Matrix4.multiply(this.modelMatrix,this.emitterModelMatrix,this._combinedMatrix),this._matrixDirty=!1);var c=this._combinedMatrix;for(i=0;i<l;i++)r=getOrCreateParticle(this),this._emitter.emit(r),Cartesian3.add(r.position,r.velocity,rotatedVelocityScratch),Matrix4.multiplyByPoint(c,rotatedVelocityScratch,rotatedVelocityScratch),r.position=Matrix4.multiplyByPoint(c,r.position,r.position),Cartesian3.subtract(rotatedVelocityScratch,r.position,r.velocity),Cartesian3.normalize(r.velocity,r.velocity),addParticle(this,r),updateBillboard(this,r)}if(this._billboardCollection.update(e),this._previousTime=JulianDate.clone(e.time,this._previousTime),this._currentTime+=t,this._lifetime!==Number.MAX_VALUE&&this._currentTime>this._lifetime)if(this.loop){if(this._currentTime=CesiumMath.mod(this._currentTime,this._lifetime),this.bursts){var u=this.bursts.length;for(i=0;i<u;i++)this.bursts[i]._complete=!1}}else this._isComplete=!0,this._complete.raiseEvent(this);e.frameNumber%120==0&&freeParticlePool(this)}},ParticleSystem.prototype.isDestroyed=function(){return!1},ParticleSystem.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),destroyObject(this)},defineProperties$1(PerformanceDisplay.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(this._throttledText.nodeValue=e?"(throttled)":"",this._throttled=e)}}}),PerformanceDisplay.prototype.update=function(e){var t=getTimestamp$1(),i=defaultValue(e,!0);this._fpsFrameCount++;var r=t-this._lastFpsSampleTime;if(1e3<r){var n="N/A";i&&(n=1e3*this._fpsFrameCount/r|0),this._fpsText.nodeValue=n+" FPS",this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;var a=t-this._lastMsSampleTime;if(200<a){var o="N/A";i&&(o=(a/this._msFrameCount).toFixed(2)),this._msText.nodeValue=o+" MS",this._lastMsSampleTime=t,this._msFrameCount=0}},PerformanceDisplay.prototype.destroy=function(){return destroyObject(this)},PickDepth.prototype.executeDebugPickDepth=function(e,t,i){executeDebugPickDepth(this,e,t,i)},PickDepth.prototype.update=function(e,t){updateFramebuffers$2(this,e,t),updateCopyCommands$1(this,e,t)};var scratchPackedDepth=new Cartesian4,packedDepthScale=new Cartesian4(1,1/255,1/65025,1/16581375);function PickDepthFramebuffer(){this._depthStencilTexture=void 0,this._framebuffer=void 0,this._passState=void 0}function destroyResources$1(e){e._framebuffer=e._framebuffer&&e._framebuffer.destroy(),e._depthStencilTexture=e._depthStencilTexture&&e._depthStencilTexture.destroy()}function createResources$5(e,t){var i=t.drawingBufferWidth,r=t.drawingBufferHeight;e._depthStencilTexture=new Texture({context:t,width:i,height:r,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8}),e._framebuffer=new Framebuffer({context:t,depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1});var n=new PassState(t);n.blendingEnabled=!1,n.scissorTest={enabled:!0,rectangle:new BoundingRectangle},n.viewport=new BoundingRectangle,e._passState=n}function PickFramebuffer(e){var t=new PassState(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new BoundingRectangle},t.viewport=new BoundingRectangle,this._context=e,this._fb=void 0,this._passState=t,this._width=0,this._height=0}PickDepth.prototype.getDepth=function(e,t,i){var r=e.readPixels({x:t,y:i,width:1,height:1,framebuffer:this._framebuffer}),n=Cartesian4.unpack(r,0,scratchPackedDepth);return Cartesian4.divideByScalar(n,255,n),Cartesian4.dot(n,packedDepthScale)},PickDepth.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},PickDepth.prototype.isDestroyed=function(){return!1},PickDepth.prototype.destroy=function(){return destroyTextures$2(this),destroyFramebuffers$3(this),this._copyDepthCommand.shaderProgram=defined(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy(),destroyObject(this)},PickDepthFramebuffer.prototype.update=function(e,t,i){var r=i.width,n=i.height;defined(this._framebuffer)&&r===this._depthStencilTexture.width&&n===this._depthStencilTexture.height||(destroyResources$1(this),createResources$5(this,e));var a=this._framebuffer,o=this._passState;return o.framebuffer=a,o.viewport.width=r,o.viewport.height=n,o.scissorTest.rectangle.x=t.x,o.scissorTest.rectangle.y=n-t.y,o.scissorTest.rectangle.width=1,o.scissorTest.rectangle.height=1,o},PickDepthFramebuffer.prototype.isDestroyed=function(){return!1},PickDepthFramebuffer.prototype.destroy=function(){return destroyResources$1(this),destroyObject(this)},PickFramebuffer.prototype.begin=function(e,t){var i=this._context,r=t.width,n=t.height;return BoundingRectangle.clone(e,this._passState.scissorTest.rectangle),defined(this._fb)&&this._width===r&&this._height===n||(this._width=r,this._height=n,this._fb=this._fb&&this._fb.destroy(),this._fb=new Framebuffer({context:i,colorTextures:[new Texture({context:i,width:r,height:n})],depthStencilRenderbuffer:new Renderbuffer({context:i,width:r,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL})}),this._passState.framebuffer=this._fb),this._passState.viewport.width=r,this._passState.viewport.height=n,this._passState};var colorScratch$7=new Color;function SceneFramebuffer(){this._colorTexture=void 0,this._idTexture=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._framebuffer=void 0,this._idFramebuffer=void 0,this._idClearColor=new Color(0,0,0,0),this._useHdr=void 0,this._clearCommand=new ClearCommand({color:new Color(0,0,0,0),depth:1,owner:this})}function destroyResources$2(e){e._framebuffer=e._framebuffer&&e._framebuffer.destroy(),e._idFramebuffer=e._idFramebuffer&&e._idFramebuffer.destroy(),e._colorTexture=e._colorTexture&&e._colorTexture.destroy(),e._idTexture=e._idTexture&&e._idTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&e._depthStencilTexture.destroy(),e._depthStencilRenderbuffer=e._depthStencilRenderbuffer&&e._depthStencilRenderbuffer.destroy(),e._depthStencilIdTexture=e._depthStencilIdTexture&&e._depthStencilIdTexture.destroy(),e._depthStencilIdRenderbuffer=e._depthStencilIdRenderbuffer&&e._depthStencilIdRenderbuffer.destroy(),e._framebuffer=void 0,e._idFramebuffer=void 0,e._colorTexture=void 0,e._idTexture=void 0,e._depthStencilTexture=void 0,e._depthStencilRenderbuffer=void 0,e._depthStencilIdTexture=void 0,e._depthStencilIdRenderbuffer=void 0}function ShadowMapShader(){}function isSun(e){return 7471e3<Math.abs(e.x)||(7471e3<Math.abs(e.y)||7471e3<Math.abs(e.z))}function ShadowMap(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).context;this._enabled=defaultValue(e.enabled,!0),this._softShadows=defaultValue(e.softShadows,!1),this._normalOffset=defaultValue(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=defaultValue(e.fromLightSource,!0),this.darkness=defaultValue(e.darkness,.3),this._darkness=this.darkness,this.maximumDistance=defaultValue(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1;var i,r=this._needsUpdate=!0;(FeatureDetection.isInternetExplorer()||FeatureDetection.isEdge()||(FeatureDetection.isChrome()||FeatureDetection.isFirefox())&&FeatureDetection.isWindows()&&!t.depthTexture)&&(r=!1),this._polygonOffsetSupported=r,this._terrainBias={polygonOffset:r,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:r,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 Matrix4,this._shadowMapTexture=void 0,this._lightDirectionEC=new Cartesian3,this._lightPositionEC=new Cartesian4,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new ShadowMapCamera,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new BoundingSphere,this._isPointLight=defaultValue(e.isPointLight,!1),this._pointLightRadius=defaultValue(e.pointLightRadius,100),this._cascadesEnabled=!this._isPointLight&&defaultValue(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?defaultValue(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new Cartesian2,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new OrthographicOffCenterFrustum:defined(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new Cartesian4,new Cartesian4],this._cascadeMatrices=[new Matrix4,new Matrix4,new Matrix4,new Matrix4],this._cascadeDistances=new Cartesian4,i=this._isPointLight?6:this._cascadesEnabled?this._numberOfCascades:1,this._passes=new Array(i);for(var n=0;n<i;++n)this._passes[n]=new ShadowPass(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,createRenderStates$5(this),this._clearCommand=new ClearCommand({depth:1,color:new Color}),this._clearPassState=new PassState(t),this._size=defaultValue(e.size,2048),this.size=this._size}function ShadowPass(e){this.camera=new ShadowMapCamera,this.passState=new PassState(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function createRenderState$1(e,t){return RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.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 createRenderStates$5(e){var t=!e._usesDepthTexture;e._primitiveRenderState=createRenderState$1(t,e._primitiveBias),e._terrainRenderState=createRenderState$1(t,e._terrainBias),e._pointRenderState=createRenderState$1(t,e._pointBias)}function destroyFramebuffer$1(e){for(var t=e._passes.length,i=0;i<t;++i){var r=e._passes[i],n=r.framebuffer;defined(n)&&!n.isDestroyed()&&n.destroy(),r.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function createSampler$1(){return new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}function createFramebufferColor(e,t){for(var i=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),r=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:createSampler$1()}),n=new Framebuffer({context:t,depthRenderbuffer:i,colorTextures:[r],destroyAttachments:!1}),a=e._passes.length,o=0;o<a;++o){var s=e._passes[o];s.framebuffer=n,s.passState.framebuffer=n}e._shadowMapTexture=r,e._depthAttachment=i,e._colorAttachment=r}function createFramebufferDepth(e,t){for(var i=new Texture({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:createSampler$1()}),r=new Framebuffer({context:t,depthStencilTexture:i,destroyAttachments:!1}),n=e._passes.length,a=0;a<n;++a){var o=e._passes[a];o.framebuffer=r,o.passState.framebuffer=r}e._shadowMapTexture=i,e._depthAttachment=i}function createFramebufferCube(e,t){for(var i=new Renderbuffer({context:t,width:e._textureSize.x,height:e._textureSize.y,format:RenderbufferFormat$1.DEPTH_COMPONENT16}),r=new CubeMap({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:createSampler$1()}),n=[r.negativeX,r.negativeY,r.negativeZ,r.positiveX,r.positiveY,r.positiveZ],a=0;a<6;++a){var o=new Framebuffer({context:t,depthRenderbuffer:i,colorTextures:[n[a]],destroyAttachments:!1}),s=e._passes[a];s.framebuffer=o,s.passState.framebuffer=o}e._shadowMapTexture=r,e._depthAttachment=i,e._colorAttachment=r}function createFramebuffer$3(e,t){e._isPointLight?createFramebufferCube(e,t):e._usesDepthTexture?createFramebufferDepth(e,t):createFramebufferColor(e,t)}function checkFramebuffer(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==WebGLConstants$1.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,createRenderStates$5(e),destroyFramebuffer$1(e),createFramebuffer$3(e,t))}function updateFramebuffer(e,t){defined(e._passes[0].framebuffer)&&e._shadowMapTexture.width===e._textureSize.x||(destroyFramebuffer$1(e),createFramebuffer$3(e,t),checkFramebuffer(e,t),clearFramebuffer(e,t))}function clearFramebuffer(e,t,i){i=defaultValue(i,0),!e._isPointLight&&0!==i||(e._clearCommand.framebuffer=e._passes[i].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function resize(e,t){e._size=t;var i=e._passes,r=i.length,n=e._textureSize;if(e._isPointLight){t=ContextLimits.maximumCubeMapSize>=t?t:ContextLimits.maximumCubeMapSize,n.x=t;var a=new BoundingRectangle(0,0,n.y=t,t);i[0].passState.viewport=a,i[1].passState.viewport=a,i[2].passState.viewport=a,i[3].passState.viewport=a,i[4].passState.viewport=a,i[5].passState.viewport=a}else 1===r?(t=ContextLimits.maximumTextureSize>=t?t:ContextLimits.maximumTextureSize,n.x=t,n.y=t,i[0].passState.viewport=new BoundingRectangle(0,0,t,t)):4===r&&(t=ContextLimits.maximumTextureSize>=2*t?t:ContextLimits.maximumTextureSize/2,n.x=2*t,n.y=2*t,i[0].passState.viewport=new BoundingRectangle(0,0,t,t),i[1].passState.viewport=new BoundingRectangle(t,0,t,t),i[2].passState.viewport=new BoundingRectangle(0,t,t,t),i[3].passState.viewport=new BoundingRectangle(t,t,t,t));e._clearPassState.viewport=new BoundingRectangle(0,0,n.x,n.y);for(var o=0;o<r;++o){var s=i[o],l=s.passState.viewport,c=l.x/n.x,u=l.y/n.y,d=l.width/n.x,h=l.height/n.y;s.textureOffsets=new Matrix4(d,0,0,c,0,h,0,u,0,0,1,0,0,0,0,1)}}PickFramebuffer.prototype.end=function(e){for(var t=defaultValue(e.width,1),i=defaultValue(e.height,1),r=this._context,n=r.readPixels({x:e.x,y:e.y,width:t,height:i,framebuffer:this._fb}),a=Math.max(t,i),o=a*a,s=Math.floor(.5*t),l=Math.floor(.5*i),c=0,u=0,d=0,h=-1,p=0;p<o;++p){if(-s<=c&&c<=s&&-l<=u&&u<=l){var m=4*((l-u)*t+c+s);colorScratch$7.red=Color.byteToFloat(n[m]),colorScratch$7.green=Color.byteToFloat(n[1+m]),colorScratch$7.blue=Color.byteToFloat(n[2+m]),colorScratch$7.alpha=Color.byteToFloat(n[3+m]);var f=r.getObjectByPickColor(colorScratch$7);if(defined(f))return f}if(c===u||c<0&&-c===u||0<c&&c===1-u){var g=d;d=-h,h=g}c+=d,u+=h}},PickFramebuffer.prototype.isDestroyed=function(){return!1},PickFramebuffer.prototype.destroy=function(){return this._fb=this._fb&&this._fb.destroy(),destroyObject(this)},SceneFramebuffer.prototype.update=function(e,t,i){var r=t.width,n=t.height,a=this._colorTexture;if(!defined(a)||a.width!==r||a.height!==n||i!==this._useHdr){destroyResources$2(this);var o=(this._useHdr=i)?e.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._colorTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:o,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),this._idTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),e.depthTexture?(this._depthStencilTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}),this._depthStencilIdTexture=new Texture({context:e,width:r,height:n,pixelFormat:PixelFormat$1.DEPTH_STENCIL,pixelDatatype:PixelDatatype$1.UNSIGNED_INT_24_8,sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})):(this._depthStencilRenderbuffer=new Renderbuffer({context:e,width:r,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL}),this._depthStencilIdRenderbuffer=new Renderbuffer({context:e,width:r,height:n,format:RenderbufferFormat$1.DEPTH_STENCIL})),this._framebuffer=new Framebuffer({context:e,colorTextures:[this._colorTexture],depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}),this._idFramebuffer=new Framebuffer({context:e,colorTextures:[this._idTexture],depthStencilTexture:this._depthStencilIdTexture,depthStencilRenderbuffer:this._depthStencilIdRenderbuffer,destroyAttachments:!1})}},SceneFramebuffer.prototype.clear=function(e,t,i){var r=t.framebuffer;t.framebuffer=this._framebuffer,Color.clone(i,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=this._idFramebuffer,Color.clone(this._idClearColor,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=r},SceneFramebuffer.prototype.getFramebuffer=function(){return this._framebuffer},SceneFramebuffer.prototype.getIdFramebuffer=function(){return this._idFramebuffer},SceneFramebuffer.prototype.isDestroyed=function(){return!1},SceneFramebuffer.prototype.destroy=function(){return destroyResources$2(this),destroyObject(this)},ShadowMapShader.getShadowCastShaderKeyword=function(e,t,i,r){return"castShadow "+e+" "+t+" "+i+" "+r},ShadowMapShader.createShadowCastVertexShader=function(e,t,i){var r=e.defines.slice(0),n=e.sources.slice(0);r.push("SHADOW_MAP"),i&&r.push("GENERATE_POSITION");var a=defined(ShaderSource.findPositionVarying(e));if(t&&!a){for(var o=n.length,s=0;s<o;++s)n[s]=ShaderSource.replaceMain(n[s],"czm_shadow_cast_main");n.push("varying vec3 v_positionEC; \nvoid main() \n{ \n    czm_shadow_cast_main(); \n    v_positionEC = (czm_inverseProjection * gl_Position).xyz; \n}")}return new ShaderSource({defines:r,sources:n})},ShadowMapShader.createShadowCastFragmentShader=function(e,t,i,r){var n=e.defines.slice(0),a=e.sources.slice(0),o=ShaderSource.findPositionVarying(e),s=defined(o);s||(o="v_positionEC");for(var l=a.length,c=0;c<l;++c)a[c]=ShaderSource.replaceMain(a[c],"czm_shadow_cast_main");var u="";return t&&(s||(u+="varying vec3 v_positionEC; \n"),u+="uniform vec4 shadowMap_lightPositionEC; \n"),u+=r?"void main() \n{ \n":"void main() \n{ \n    czm_shadow_cast_main(); \n    if (gl_FragColor.a == 0.0) \n    { \n       discard; \n    } \n",u+=t?"    float distance = length("+o+"); \n    if (distance >= shadowMap_lightPositionEC.w) \n    { \n        discard; \n    } \n    distance /= shadowMap_lightPositionEC.w; // radius \n    gl_FragColor = czm_packDepth(distance); \n":i?"    gl_FragColor = vec4(1.0); \n":"    gl_FragColor = czm_packDepth(gl_FragCoord.z); \n",u+="} \n",a.push(u),new ShaderSource({defines:n,sources:a})},ShadowMapShader.getShadowReceiveShaderKeyword=function(e,t,i,r){return"receiveShadow "+e._usesDepthTexture+e._polygonOffsetSupported+e._isPointLight+e._isSpotLight+(1<e._numberOfCascades)+e.debugCascadeColors+e.softShadows+t+i+r},ShadowMapShader.createShadowReceiveVertexShader=function(e,t,i){var r=e.defines.slice(0),n=e.sources.slice(0);return r.push("SHADOW_MAP"),t&&(i?r.push("GENERATE_POSITION_AND_NORMAL"):r.push("GENERATE_POSITION")),new ShaderSource({defines:r,sources:n})},ShadowMapShader.createShadowReceiveFragmentShader=function(e,t,i,r,n){for(var a=ShaderSource.findNormalVarying(e),o=!r&&defined(a)||r&&n,s=ShaderSource.findPositionVarying(e),l=defined(s),c=t._usesDepthTexture,u=t._polygonOffsetSupported,d=t._isPointLight,h=t._isSpotLight,p=1<t._numberOfCascades,m=t.debugCascadeColors,f=t.softShadows,g=d?t._pointBias:r?t._terrainBias:t._primitiveBias,_=e.defines.slice(0),y=e.sources.slice(0),v=y.length,C=0;C<v;++C)y[C]=ShaderSource.replaceMain(y[C],"czm_shadow_receive_main");d?_.push("USE_CUBE_MAP_SHADOW"):c&&_.push("USE_SHADOW_DEPTH_TEXTURE"),f&&!d&&_.push("USE_SOFT_SHADOWS"),p&&i&&r&&(o?_.push("ENABLE_VERTEX_LIGHTING"):_.push("ENABLE_DAYNIGHT_SHADING")),i&&g.normalShading&&o&&(_.push("USE_NORMAL_SHADING"),0<g.normalShadingSmooth&&_.push("USE_NORMAL_SHADING_SMOOTH"));var S="";return S+=d?"uniform samplerCube shadowMap_textureCube; \n":"uniform sampler2D shadowMap_texture; \n",S+="uniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \n#ifdef LOG_DEPTH \nvarying vec3 v_logPositionEC; \n#endif \nvec4 getPositionEC() \n{ \n"+(l?"    return vec4("+s+", 1.0); \n":"#ifndef LOG_DEPTH \n    return czm_windowToEyeCoordinates(gl_FragCoord); \n#else \n    return vec4(v_logPositionEC, 1.0); \n#endif \n")+"} \nvec3 getNormalEC() \n{ \n"+(o?"    return normalize("+a+"); \n":"    return vec3(1.0); \n")+"} \nvoid applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) \n{ \n"+(g.normalOffset&&o?"    float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; \n    float normalOffsetScale = 1.0 - nDotL; \n    vec3 offset = normalOffset * normalOffsetScale * normalEC; \n    positionEC.xyz += offset; \n":"")+"} \n",S+="void main() \n{ \n    czm_shadow_receive_main(); \n    vec4 positionEC = getPositionEC(); \n    vec3 normalEC = getNormalEC(); \n    float depth = -positionEC.z; \n",S+="    czm_shadowParameters shadowParameters; \n    shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \n    shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \n    shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \n    shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \n",r?S+="    shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n":u||(S+="    shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n"),S+=d?"    vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n    float distance = length(directionEC); \n    directionEC = normalize(directionEC); \n    float radius = shadowMap_lightPositionEC.w; \n    // Stop early if the fragment is beyond the point light radius \n    if (distance > radius) \n    { \n        return; \n    } \n    vec3 directionWC  = czm_inverseViewRotation * directionEC; \n    shadowParameters.depth = distance / radius; \n    shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n    shadowParameters.texCoords = directionWC; \n    float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); \n":h?"    vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \n    float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n    applyNormalOffset(positionEC, normalEC, nDotL); \n    vec4 shadowPosition = shadowMap_matrix * positionEC; \n    // Spot light uses a perspective projection, so perform the perspective divide \n    shadowPosition /= shadowPosition.w; \n    // Stop early if the fragment is not in the shadow bounds \n    if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n    { \n        return; \n    } \n    shadowParameters.texCoords = shadowPosition.xy; \n    shadowParameters.depth = shadowPosition.z; \n    shadowParameters.nDotL = nDotL; \n    float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n":p?"    float maxDepth = shadowMap_cascadeSplits[1].w; \n    // Stop early if the eye depth exceeds the last cascade \n    if (depth > maxDepth) \n    { \n        return; \n    } \n    // Get the cascade based on the eye-space depth \n    vec4 weights = czm_cascadeWeights(depth); \n    // Apply normal offset \n    float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n    applyNormalOffset(positionEC, normalEC, nDotL); \n    // Transform position into the cascade \n    vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; \n    // Get visibility \n    shadowParameters.texCoords = shadowPosition.xy; \n    shadowParameters.depth = shadowPosition.z; \n    shadowParameters.nDotL = nDotL; \n    float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n    // Fade out shadows that are far away \n    float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; \n    float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); \n    visibility = mix(visibility, 1.0, fade); \n"+(m?"    // Draw cascade colors for debugging \n    gl_FragColor *= czm_cascadeColor(weights); \n":""):"    float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n    applyNormalOffset(positionEC, normalEC, nDotL); \n    vec4 shadowPosition = shadowMap_matrix * positionEC; \n    // Stop early if the fragment is not in the shadow bounds \n    if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n    { \n        return; \n    } \n    shadowParameters.texCoords = shadowPosition.xy; \n    shadowParameters.depth = shadowPosition.z; \n    shadowParameters.nDotL = nDotL; \n    float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n",isSun(t._lightCamera.position)?S+="    gl_FragColor.rgb *= visibility; \n} \n":S+="    gl_FragColor.rgb = gl_FragColor.rgb; \n} \n",y.push(S),new ShaderSource({defines:_,sources:y})},ShadowMap.MAXIMUM_DISTANCE=2e4,ShadowMap.prototype.debugCreateRenderStates=function(){createRenderStates$5(this)},defineProperties$1(ShadowMap.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){resize(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}}});var scratchViewport$2=new BoundingRectangle;function createDebugShadowViewCommand(e,t){var i;i=e._isPointLight?"uniform samplerCube shadowMap_textureCube; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n    vec2 uv = v_textureCoordinates; \n    vec3 dir; \n \n    if (uv.y < 0.5) \n    { \n        if (uv.x < 0.333) \n        { \n            dir.x = -1.0; \n            dir.y = uv.x * 6.0 - 1.0; \n            dir.z = uv.y * 4.0 - 1.0; \n        } \n        else if (uv.x < 0.666) \n        { \n            dir.y = -1.0; \n            dir.x = uv.x * 6.0 - 3.0; \n            dir.z = uv.y * 4.0 - 1.0; \n        } \n        else \n        { \n            dir.z = -1.0; \n            dir.x = uv.x * 6.0 - 5.0; \n            dir.y = uv.y * 4.0 - 1.0; \n        } \n    } \n    else \n    { \n        if (uv.x < 0.333) \n        { \n            dir.x = 1.0; \n            dir.y = uv.x * 6.0 - 1.0; \n            dir.z = uv.y * 4.0 - 3.0; \n        } \n        else if (uv.x < 0.666) \n        { \n            dir.y = 1.0; \n            dir.x = uv.x * 6.0 - 3.0; \n            dir.z = uv.y * 4.0 - 3.0; \n        } \n        else \n        { \n            dir.z = 1.0; \n            dir.x = uv.x * 6.0 - 5.0; \n            dir.y = uv.y * 4.0 - 3.0; \n        } \n    } \n \n    float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir)); \n    gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n":"uniform sampler2D shadowMap_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n"+(e._usesDepthTexture?"    float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r; \n":"    float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates)); \n")+"    gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n";var r=t.createViewportQuadCommand(i,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return r.pass=Pass$1.OVERLAY,r}function updateDebugShadowViewCommand(e,t){var i=t.context,r=t.context.drawingBufferWidth,n=t.context.drawingBufferHeight,a=.3*Math.min(r,n),o=scratchViewport$2;o.x=r-a,o.y=0,o.width=a,o.height=a;var s=e._debugShadowViewCommand;defined(s)||(s=createDebugShadowViewCommand(e,i),e._debugShadowViewCommand=s),defined(s.renderState)&&BoundingRectangle.equals(s.renderState.viewport,o)||(s.renderState=RenderState.fromCache({viewport:BoundingRectangle.clone(o)})),t.commandList.push(e._debugShadowViewCommand)}var frustumCornersNDC$1=new Array(8);frustumCornersNDC$1[0]=new Cartesian4(-1,-1,-1,1),frustumCornersNDC$1[1]=new Cartesian4(1,-1,-1,1),frustumCornersNDC$1[2]=new Cartesian4(1,1,-1,1),frustumCornersNDC$1[3]=new Cartesian4(-1,1,-1,1),frustumCornersNDC$1[4]=new Cartesian4(-1,-1,1,1),frustumCornersNDC$1[5]=new Cartesian4(1,-1,1,1),frustumCornersNDC$1[6]=new Cartesian4(1,1,1,1),frustumCornersNDC$1[7]=new Cartesian4(-1,1,1,1);for(var scratchMatrix$4=new Matrix4,scratchFrustumCorners$1=new Array(8),i$5=0;i$5<8;++i$5)scratchFrustumCorners$1[i$5]=new Cartesian4;function createDebugPointLight(e,t){return new Primitive({geometryInstances:[new GeometryInstance({geometry:new BoxOutlineGeometry({minimum:new Cartesian3(-.5,-.5,-.5),maximum:new Cartesian3(.5,.5,.5)}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}}),new GeometryInstance({geometry:new SphereOutlineGeometry({radius:.5}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(t)}})],appearance:new PerInstanceColorAppearance({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var debugOutlineColors=[Color.RED,Color.GREEN,Color.BLUE,Color.MAGENTA],scratchScale$8=new Cartesian3;function applyDebugSettings$1(e,t){updateDebugShadowViewCommand(e,t);var i=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(i&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new DebugCameraPrimitive({camera:e._sceneCamera,color:Color.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){i&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(var r=0;r<e._numberOfCascades;++r)i&&(e._debugCascadeFrustums[r]=e._debugCascadeFrustums[r]&&e._debugCascadeFrustums[r].destroy(),e._debugCascadeFrustums[r]=new DebugCameraPrimitive({camera:e._passes[r].camera,color:debugOutlineColors[r],updateOnChange:!1})),e._debugCascadeFrustums[r].update(t)}}else if(e._isPointLight){if(!defined(e._debugLightFrustum)||e._needsUpdate){var n=e._shadowMapCamera.positionWC,a=Quaternion.IDENTITY,o=2*e._pointLightRadius,s=Cartesian3.fromElements(o,o,o,scratchScale$8),l=Matrix4.fromTranslationQuaternionRotationScale(n,a,s,scratchMatrix$4);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=createDebugPointLight(l,Color.YELLOW)}e._debugLightFrustum.update(t)}else defined(e._debugLightFrustum)&&!e._needsUpdate||(e._debugLightFrustum=new DebugCameraPrimitive({camera:e._shadowMapCamera,color:Color.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function ShadowMapCamera(){this.viewMatrix=new Matrix4,this.inverseViewMatrix=new Matrix4,this.frustum=void 0,this.positionCartographic=new Cartographic,this.positionWC=new Cartesian3,this.directionWC=Cartesian3.clone(Cartesian3.UNIT_Z),this.upWC=Cartesian3.clone(Cartesian3.UNIT_Y),this.rightWC=Cartesian3.clone(Cartesian3.UNIT_X),this.viewProjectionMatrix=new Matrix4}ShadowMapCamera.prototype.clone=function(e){Matrix4.clone(e.viewMatrix,this.viewMatrix),Matrix4.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Cartographic.clone(e.positionCartographic,this.positionCartographic),Cartesian3.clone(e.positionWC,this.positionWC),Cartesian3.clone(e.directionWC,this.directionWC),Cartesian3.clone(e.upWC,this.upWC),Cartesian3.clone(e.rightWC,this.rightWC)};var scaleBiasMatrix=new Matrix4(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);ShadowMapCamera.prototype.getViewProjection=function(){var e=this.viewMatrix,t=this.frustum.projectionMatrix;return Matrix4.multiply(t,e,this.viewProjectionMatrix),Matrix4.multiply(scaleBiasMatrix,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var scratchSplits$1=new Array(5),scratchFrustum=new PerspectiveFrustum,scratchCascadeDistances=new Array(4),scratchMin$3=new Cartesian3,scratchMax$3=new Cartesian3;function computeCascades(e,t){var i,r=e._shadowMapCamera,n=e._sceneCamera,a=n.frustum.near,o=n.frustum.far,s=e._numberOfCascades,l=o-a,c=o/a,u=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,u=.9);var h=scratchCascadeDistances,p=scratchSplits$1;for(p[0]=a,p[s]=o,i=0;i<s;++i){var m=(i+1)/s,f=a*Math.pow(c,m),g=a+l*m,_=CesiumMath.lerp(g,f,u);p[i+1]=_,h[i]=_-p[i]}if(d){for(i=0;i<s;++i)h[i]=Math.min(h[i],e._maximumCascadeDistances[i]);var y=p[0];for(i=0;i<s-1;++i)y+=h[i],p[i+1]=y}Cartesian4.unpack(p,0,e._cascadeSplits[0]),Cartesian4.unpack(p,1,e._cascadeSplits[1]),Cartesian4.unpack(h,0,e._cascadeDistances);var v=r.frustum,C=v.left,S=v.right,x=v.bottom,T=v.top,b=v.near,E=v.far,P=r.positionWC,A=r.directionWC,w=r.upWC,D=n.frustum.clone(scratchFrustum),M=r.getViewProjection();for(i=0;i<s;++i){D.near=p[i],D.far=p[i+1];for(var I=Matrix4.multiply(D.projectionMatrix,n.viewMatrix,scratchMatrix$4),R=Matrix4.inverse(I,scratchMatrix$4),O=Matrix4.multiply(M,R,scratchMatrix$4),L=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin$3),F=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax$3),N=0;N<8;++N){var B=Cartesian4.clone(frustumCornersNDC$1[N],scratchFrustumCorners$1[N]);Matrix4.multiplyByVector(O,B,B),Cartesian3.divideByScalar(B,B.w,B),Cartesian3.minimumByComponent(B,L,L),Cartesian3.maximumByComponent(B,F,F)}L.x=Math.max(L.x,0),L.y=Math.max(L.y,0),L.z=0,F.x=Math.min(F.x,1),F.y=Math.min(F.y,1),F.z=Math.min(F.z,1);var V=e._passes[i],k=V.camera;k.clone(r);var $=k.frustum;$.left=C+L.x*(S-C),$.right=C+F.x*(S-C),$.bottom=x+L.y*(T-x),$.top=x+F.y*(T-x),$.near=b+L.z*(E-b),$.far=b+F.z*(E-b),V.cullingVolume=k.frustum.computeCullingVolume(P,A,w);var z=e._cascadeMatrices[i];Matrix4.multiply(k.getViewProjection(),n.inverseViewMatrix,z),Matrix4.multiply(V.textureOffsets,z,z)}}var scratchLightView=new Matrix4,scratchRight$2=new Cartesian3,scratchUp=new Cartesian3,scratchTranslation$1=new Cartesian3;function fitShadowMapToScene(e,t){var i=e._shadowMapCamera,r=e._sceneCamera,n=Matrix4.multiply(r.frustum.projectionMatrix,r.viewMatrix,scratchMatrix$4),a=Matrix4.inverse(n,scratchMatrix$4),o=i.directionWC,s=r.directionWC,l=Cartesian3.cross(o,s,scratchRight$2);s=Cartesian3.cross(l,o,scratchUp),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l);for(var c=Cartesian3.fromElements(0,0,0,scratchTranslation$1),u=Matrix4.computeView(c,o,s,l,scratchLightView),d=Matrix4.multiply(u,a,scratchMatrix$4),h=Cartesian3.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,scratchMin$3),p=Cartesian3.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,scratchMax$3),m=0;m<8;++m){var f=Cartesian4.clone(frustumCornersNDC$1[m],scratchFrustumCorners$1[m]);Matrix4.multiplyByVector(d,f,f),Cartesian3.divideByScalar(f,f.w,f),Cartesian3.minimumByComponent(f,h,h),Cartesian3.maximumByComponent(f,p,p)}p.z+=1e3,h.z-=10;var g=scratchTranslation$1;g.x=-.5*(h.x+p.x),g.y=-.5*(h.y+p.y),g.z=-p.z;var _=Matrix4.fromTranslation(g,scratchMatrix$4);u=Matrix4.multiply(_,u,u);var y=.5*(p.x-h.x),v=.5*(p.y-h.y),C=p.z-h.z,S=i.frustum;S.left=-y,S.right=y,S.bottom=-v,S.top=v,S.near=.01,S.far=C,Matrix4.clone(u,i.viewMatrix),Matrix4.inverse(u,i.inverseViewMatrix),Matrix4.getTranslation(i.inverseViewMatrix,i.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(i.positionWC,i.positionCartographic),Cartesian3.clone(o,i.directionWC),Cartesian3.clone(s,i.upWC),Cartesian3.clone(l,i.rightWC)}var directions=[new Cartesian3(-1,0,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(0,1,0),new Cartesian3(0,0,1)],ups=[new Cartesian3(0,-1,0),new Cartesian3(0,0,-1),new Cartesian3(0,-1,0),new Cartesian3(0,-1,0),new Cartesian3(0,0,1),new Cartesian3(0,-1,0)],rights=[new Cartesian3(0,0,1),new Cartesian3(1,0,0),new Cartesian3(-1,0,0),new Cartesian3(0,0,-1),new Cartesian3(1,0,0),new Cartesian3(1,0,0)];function computeOmnidirectional(e,t){var i=new PerspectiveFrustum;i.fov=CesiumMath.PI_OVER_TWO,i.near=1,i.far=e._pointLightRadius,i.aspectRatio=1;for(var r=0;r<6;++r){var n=e._passes[r].camera;n.positionWC=e._shadowMapCamera.positionWC,n.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),n.directionWC=directions[r],n.upWC=ups[r],n.rightWC=rights[r],Matrix4.computeView(n.positionWC,n.directionWC,n.upWC,n.rightWC,n.viewMatrix),Matrix4.inverse(n.viewMatrix,n.inverseViewMatrix),n.frustum=i}}var scratchCartesian1$8=new Cartesian3,scratchCartesian2$b=new Cartesian3,scratchBoundingSphere$4=new BoundingSphere,scratchCenter$5=scratchBoundingSphere$4.center;function checkVisibility(e,t){var i=e._sceneCamera,r=e._shadowMapCamera,n=scratchBoundingSphere$4;if(e._cascadesEnabled){if(i.frustum.near>=e.maximumDistance)return e._outOfView=!0,void(e._needsUpdate=!1);var a=t.mapProjection.ellipsoid.geodeticSurfaceNormal(i.positionWC,scratchCartesian1$8),o=Cartesian3.negate(r.directionWC,scratchCartesian2$b),s=Cartesian3.dot(a,o),l=CesiumMath.clamp(s/.1,0,1);if(e._darkness=CesiumMath.lerp(1,e.darkness,l),s<0)return e._outOfView=!0,void(e._needsUpdate=!1);e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)n.center=r.positionWC,n.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(n)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(n),BoundingSphere.clone(n,e._boundingSphere);else{var c=r.frustum.far/2,u=Cartesian3.add(r.positionWC,Cartesian3.multiplyByScalar(r.directionWC,c,scratchCenter$5),scratchCenter$5);n.center=u,n.radius=c,e._outOfView=t.cullingVolume.computeVisibility(n)===Intersect$1.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(n),BoundingSphere.clone(n,e._boundingSphere)}}function updateCameras(e,t){var i=t.camera,r=e._lightCamera,n=e._sceneCamera,a=e._shadowMapCamera;e._cascadesEnabled?Cartesian3.clone(r.directionWC,a.directionWC):e._isPointLight?Cartesian3.clone(r.positionWC,a.positionWC):a.clone(r);var o,s,l=e._lightDirectionEC;Matrix4.multiplyByPointAsVector(i.viewMatrix,a.directionWC,l),Cartesian3.normalize(l,l),Cartesian3.negate(l,l),Matrix4.multiplyByPoint(i.viewMatrix,a.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius,s=e._fitNearFar?(o=Math.min(t.shadowState.nearPlane,e.maximumDistance),Math.min(t.shadowState.farPlane,e.maximumDistance+1)):(o=i.frustum.near,e.maximumDistance),e._sceneCamera=Camera.clone(i,n),i.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=o,e._sceneCamera.frustum.far=s,e._distance=s-o,checkVisibility(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}ShadowMap.prototype.update=function(e){if(updateCameras(this,e),this._needsUpdate)if(updateFramebuffer(this,e.context),this._isPointLight&&computeOmnidirectional(this,e),this._cascadesEnabled&&(fitShadowMapToScene(this,e),1<this._numberOfCascades&&computeCascades(this,e)),this._isPointLight)this._shadowMapCullingVolume=CullingVolume.fromBoundingSphere(this._boundingSphere);else{var t=this._shadowMapCamera,i=t.positionWC,r=t.directionWC,n=t.upWC;this._shadowMapCullingVolume=t.frustum.computeCullingVolume(i,r,n),1===this._passes.length&&this._passes[0].camera.clone(t)}if(1===this._passes.length){var a=this._sceneCamera.inverseViewMatrix;Matrix4.multiply(this._shadowMapCamera.getViewProjection(),a,this._shadowMapMatrix)}this.debugShow&&applyDebugSettings$1(this,e)},ShadowMap.prototype.updatePass=function(e,t){clearFramebuffer(this,e,t)};var scratchTexelStepSize=new Cartesian2;function combineUniforms(t,e,i){var r=t._isPointLight?t._pointBias:i?t._terrainBias:t._primitiveBias;return combine(e,{shadowMap_texture:function(){return t._shadowMapTexture},shadowMap_textureCube:function(){return t._shadowMapTexture},shadowMap_matrix:function(){return t._shadowMapMatrix},shadowMap_cascadeSplits:function(){return t._cascadeSplits},shadowMap_cascadeMatrices:function(){return t._cascadeMatrices},shadowMap_lightDirectionEC:function(){return t._lightDirectionEC},shadowMap_lightPositionEC:function(){return t._lightPositionEC},shadowMap_cascadeDistances:function(){return t._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){var e=scratchTexelStepSize;return e.x=1/t._textureSize.x,e.y=1/t._textureSize.y,Cartesian4.fromElements(e.x,e.y,r.depthBias,r.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return Cartesian4.fromElements(r.normalOffsetScale,t._distance,t.maximumDistance,t._darkness,this.combinedUniforms2)},combinedUniforms1:new Cartesian4,combinedUniforms2:new Cartesian4},!1)}function createCastDerivedCommand(e,t,i,r,n,a){var o,s,l;if(defined(a)&&(o=a.shaderProgram,s=a.renderState,l=a.uniformMap),(a=DrawCommand.shallowClone(i,a)).castShadows=!0,a.receiveShadows=!1,!defined(o)||n!==i.shaderProgram.id||t){var c=i.shaderProgram,u=i.pass===Pass$1.GLOBE,d=i.pass!==Pass$1.TRANSLUCENT,h=e._isPointLight,p=e._usesDepthTexture,m=ShadowMapShader.getShadowCastShaderKeyword(h,u,p,d);if(!defined(o=r.shaderCache.getDerivedShaderProgram(c,m))){var f=c.vertexShaderSource,g=c.fragmentShaderSource,_=ShadowMapShader.createShadowCastVertexShader(f,h,u),y=ShadowMapShader.createShadowCastFragmentShader(g,h,p,d);o=r.shaderCache.createDerivedShaderProgram(c,m,{vertexShaderSource:_,fragmentShaderSource:y,attributeLocations:c._attributeLocations})}s=e._primitiveRenderState,h?s=e._pointRenderState:u&&(s=e._terrainRenderState),i.renderState.cull.enabled||((s=clone(s,!1)).cull=clone(s.cull,!1),s.cull.enabled=!1,s=RenderState.fromCache(s)),l=combineUniforms(e,i.uniformMap,u)}return a.shaderProgram=o,a.renderState=s,a.uniformMap=l,a}function View(e,t,i){var r,n,a=e.context,o=[],s=t.frustum.near,l=t.frustum.far,c=e.logarithmicDepthBuffer?e.logarithmicDepthFarToNearRatio:e.farToNearRatio;updateFrustums(s,l,c,Math.ceil(Math.log(l/s)/Math.log(c)),e.logarithmicDepthBuffer,o,!1,void 0),a.depthTexture&&(r=new GlobeDepth),e._useOIT&&a.depthTexture&&(n=new OIT(a));var u=new PassState(a);u.viewport=BoundingRectangle.clone(i),this.camera=t,this._cameraClone=Camera.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=i,this.passState=u,this.pickFramebuffer=new PickFramebuffer(a),this.pickDepthFramebuffer=new PickDepthFramebuffer,this.sceneFramebuffer=new SceneFramebuffer,this.globeDepth=r,this.oit=n,this.pickDepths=[],this.debugGlobeDepths=[],this.frustumCommandsList=o,this.debugFrustumStatistics=void 0,this.updateFrustums=!1}ShadowMap.createReceiveDerivedCommand=function(e,t,i,r,n){defined(n)||(n={});var a=0<e.length,o=t.shaderProgram,s=o.vertexShaderSource,l=o.fragmentShaderSource,c=t.pass===Pass$1.GLOBE,u=!1;if(c&&(u=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&a){var d,h;defined(n.receiveCommand)&&(d=n.receiveCommand.shaderProgram,h=n.receiveCommand.uniformMap),n.receiveCommand=DrawCommand.shallowClone(t,n.receiveCommand),n.castShadows=!1,n.receiveShadows=!0;var p=n.receiveShaderCastShadows!==t.castShadows,m=n.receiveShaderProgramId!==t.shaderProgram.id;if(!defined(d)||m||i||p){var f=ShadowMapShader.getShadowReceiveShaderKeyword(e[0],t.castShadows,c,u);if(!defined(d=r.shaderCache.getDerivedShaderProgram(o,f))){var g=ShadowMapShader.createShadowReceiveVertexShader(s,c,u),_=ShadowMapShader.createShadowReceiveFragmentShader(l,e[0],t.castShadows,c,u);d=r.shaderCache.createDerivedShaderProgram(o,f,{vertexShaderSource:g,fragmentShaderSource:_,attributeLocations:o._attributeLocations})}h=combineUniforms(e[0],t.uniformMap,c)}n.receiveCommand.shaderProgram=d,n.receiveCommand.uniformMap=h,n.receiveShaderProgramId=t.shaderProgram.id,n.receiveShaderCastShadows=t.castShadows}return n},ShadowMap.createCastDerivedCommand=function(e,t,i,r,n){if(defined(n)||(n={}),t.castShadows){var a=n.castCommands;defined(a)||(a=n.castCommands=[]);var o=n.castShaderProgramId,s=e.length;a.length=s;for(var l=0;l<s;++l)a[l]=createCastDerivedCommand(e[l],i,t,r,o,a[l]);n.castShaderProgramId=t.shaderProgram.id}return n},ShadowMap.prototype.isDestroyed=function(){return!1},ShadowMap.prototype.destroy=function(){destroyFramebuffer$1(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(var e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return destroyObject(this)};var scratchPosition0=new Cartesian3,scratchPosition1=new Cartesian3;function maxComponent(e,t){var i=Math.max(Math.abs(e.x),Math.abs(t.x)),r=Math.max(Math.abs(e.y),Math.abs(t.y)),n=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(i,r),n)}function cameraEqual(e,t,i){var r=1/Math.max(1,maxComponent(e.position,t.position));return Cartesian3.multiplyByScalar(e.position,r,scratchPosition0),Cartesian3.multiplyByScalar(t.position,r,scratchPosition1),Cartesian3.equalsEpsilon(scratchPosition0,scratchPosition1,i)&&Cartesian3.equalsEpsilon(e.direction,t.direction,i)&&Cartesian3.equalsEpsilon(e.up,t.up,i)&&Cartesian3.equalsEpsilon(e.right,t.right,i)&&Matrix4.equalsEpsilon(e.transform,t.transform,i)&&e.frustum.equalsEpsilon(t.frustum,i)}function updateFrustums(e,t,i,r,n,a,o,s){a.length=r;for(var l=0;l<r;++l){var c,u;o?(c=Math.min(t-s,e+l*s),u=Math.min(t,c+s)):(u=i*(c=Math.max(e,Math.pow(i,l)*e)),n||(u=Math.min(t,u)));var d=a[l];defined(d)?(d.near=c,d.far=u):d=a[l]=new FrustumCommands(c,u)}}function insertIntoBin(e,t,i,r){e.debugShowFrustums&&(i.debugOverlappingFrustums=0);for(var n=t.frustumCommandsList,a=n.length,o=0;o<a;++o){var s=n[o],l=s.near,c=s.far;if(!(r.start>c)){if(r.stop<l)break;var u=i.pass,d=s.indices[u]++;if(s.commands[u][d]=i,e.debugShowFrustums&&(i.debugOverlappingFrustums|=1<<o),i.executeInClosestFrustum)break}}if(e.debugShowFrustums){var h=t.debugFrustumStatistics.commandsInFrustums;h[i.debugOverlappingFrustums]=defined(h[i.debugOverlappingFrustums])?h[i.debugOverlappingFrustums]+1:1,++t.debugFrustumStatistics.totalCommands}e.updateDerivedCommands(i)}View.prototype.checkForCameraUpdates=function(e){var t=this.camera,i=this._cameraClone;return cameraEqual(t,i,CesiumMath.EPSILON15)?(this._cameraStartFired&&getTimestamp$1()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=getTimestamp$1(),Camera.clone(t,i),!0)};var scratchCullingVolume=new CullingVolume,distances=new Interval;View.prototype.createPotentiallyVisibleSet=function(e){var t=e.frameState,i=t.camera,r=i.directionWC,n=i.positionWC,a=e._computeCommandList,o=e._overlayCommandList,s=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});for(var l=this.frustumCommandsList,c=l.length,u=Pass$1.NUMBER_OF_PASSES,d=0;d<c;++d)for(var h=0;h<u;++h)l[d].indices[h]=0;a.length=0,o.length=0;for(var p=Number.MAX_VALUE,m=-Number.MAX_VALUE,f=!1,g=t.shadowState.shadowsEnabled,_=Number.MAX_VALUE,y=-Number.MAX_VALUE,v=Number.MAX_VALUE,C=t.mode===SceneMode$1.SCENE3D?t.occluder:void 0,S=t.cullingVolume,x=scratchCullingVolume.planes,T=0;T<5;++T)x[T]=S.planes[T];S=scratchCullingVolume;for(var b=s.length,E=0;E<b;++E){var P=s[E],A=P.pass;if(A===Pass$1.COMPUTE)a.push(P);else if(A===Pass$1.OVERLAY)o.push(P);else{var w=P.boundingVolume;if(defined(w)){if(!e.isVisible(P,S,C))continue;if(distances=w.computePlaneDistances(n,r,distances),p=Math.min(p,distances.start),m=Math.max(m,distances.stop),g&&P.receiveShadows&&distances.start<ShadowMap.MAXIMUM_DISTANCE&&!(A===Pass$1.GLOBE&&distances.start<-100&&100<distances.stop)){var D=distances.stop-distances.start;A!==Pass$1.GLOBE&&distances.start<100&&(v=Math.min(v,D)),_=Math.min(_,distances.start),y=Math.max(y,distances.stop)}}else distances.start=i.frustum.near,distances.stop=i.frustum.far,f=!(P instanceof ClearCommand);insertIntoBin(e,this,P,distances)}}f?(p=i.frustum.near,m=i.frustum.far):(p=Math.min(Math.max(p,i.frustum.near),i.frustum.far),m=Math.max(Math.min(m,i.frustum.far),p),g&&(_=Math.min(Math.max(_,i.frustum.near),i.frustum.far),y=Math.max(Math.min(y,i.frustum.far),_))),g&&(t.shadowState.nearPlane=_,t.shadowState.farPlane=y,t.shadowState.closestObjectSize=v);var M,I=e.mode===SceneMode$1.SCENE2D,R=t.useLogDepth,O=R?e.logarithmicDepthFarToNearRatio:e.farToNearRatio;M=I?(m=Math.min(m,i.position.z+e.nearToFarDistance2D),p=Math.min(p,m),Math.ceil(Math.max(1,m-p)/e.nearToFarDistance2D)):Math.ceil(Math.log(m/p)/Math.log(O)),(this.updateFrustums||p!==Number.MAX_VALUE&&(M!==c||0!==l.length&&(p<l[0].near||m>l[c-1].far&&(R||!CesiumMath.equalsEpsilon(m,l[c-1].far,CesiumMath.EPSILON8)))))&&(this.updateFrustums=!1,updateFrustums(p,m,O,M,R,l,I,e.nearToFarDistance2D),this.createPotentiallyVisibleSet(e));var L=t.frustumSplits;L.length=M+1;for(var F=0;F<M;++F)L[F]=l[F].near,F===M-1&&(L[F+1]=l[F].far)},View.prototype.destroy=function(){var e,t;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();var i=this.pickDepths,r=this.debugGlobeDepths;for(t=i.length,e=0;e<t;++e)i[e].destroy();for(t=r.length,e=0;e<t;++e)r[e].destroy()};var offscreenDefaultWidth=.1,mostDetailedPreloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PRELOAD}),mostDetailedPickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.MOST_DETAILED_PICK}),pickTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PICK});function Picking(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;var t=new BoundingRectangle(0,0,1,1),i=new Camera(e);i.frustum=new OrthographicFrustum({width:offscreenDefaultWidth,aspectRatio:1,near:.1}),this._pickOffscreenView=new View(e,i,t)}Picking.prototype.update=function(){this._pickPositionCacheDirty=!0},Picking.prototype.getPickDepth=function(e,t){var i=e.view.pickDepths,r=i[t];return defined(r)||(r=new PickDepth,i[t]=r),r};var scratchOrthoPickingFrustum=new OrthographicOffCenterFrustum,scratchOrthoOrigin=new Cartesian3,scratchOrthoDirection=new Cartesian3,scratchOrthoPixelSize=new Cartesian2,scratchOrthoPickVolumeMatrix4=new Matrix4;function getPickOrthographicCullingVolume(e,t,i,r,n){var a=e.camera,o=a.frustum;defined(o._offCenterFrustum)&&(o=o._offCenterFrustum);var s=2*(t.x-n.x)/n.width-1;s*=.5*(o.right-o.left);var l=2*(n.height-t.y-n.y)/n.height-1;l*=.5*(o.top-o.bottom);var c=Matrix4.clone(a.transform,scratchOrthoPickVolumeMatrix4);a._setTransform(Matrix4.IDENTITY);var u=Cartesian3.clone(a.position,scratchOrthoOrigin);Cartesian3.multiplyByScalar(a.right,s,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),Cartesian3.multiplyByScalar(a.up,l,scratchOrthoDirection),Cartesian3.add(scratchOrthoDirection,u,u),a._setTransform(c),e.mode===SceneMode$1.SCENE2D&&Cartesian3.fromElements(u.z,u.x,u.y,u);var d=o.getPixelDimensions(n.width,n.height,1,1,scratchOrthoPixelSize),h=scratchOrthoPickingFrustum;return h.right=.5*d.x,h.left=-h.right,h.top=.5*d.y,h.bottom=-h.top,h.near=o.near,h.far=o.far,h.computeCullingVolume(u,a.directionWC,a.upWC)}var scratchPerspPickingFrustum=new PerspectiveOffCenterFrustum,scratchPerspPixelSize=new Cartesian2;function getPickPerspectiveCullingVolume(e,t,i,r,n){var a=e.camera,o=a.frustum,s=o.near,l=Math.tan(.5*o.fovy),c=o.aspectRatio*l,u=(2*(t.x-n.x)/n.width-1)*s*c,d=(2*(n.height-t.y-n.y)/n.height-1)*s*l,h=o.getPixelDimensions(n.width,n.height,1,1,scratchPerspPixelSize),p=h.x*i*.5,m=h.y*r*.5,f=scratchPerspPickingFrustum;return f.top=d+m,f.bottom=d-m,f.right=u+p,f.left=u-p,f.near=s,f.far=o.far,f.computeCullingVolume(a.positionWC,a.directionWC,a.upWC)}function getPickCullingVolume(e,t,i,r,n){var a=e.camera.frustum;return a instanceof OrthographicFrustum||a instanceof OrthographicOffCenterFrustum?getPickOrthographicCullingVolume(e,t,i,r,n):getPickPerspectiveCullingVolume(e,t,i,r,n)}var scratchRectangleWidth=3,scratchRectangleHeight=3,scratchRectangle$7=new BoundingRectangle(0,0,scratchRectangleWidth,scratchRectangleHeight),scratchPosition$c=new Cartesian2,scratchColorZero=new Color(0,0,0,0);function renderTranslucentDepthForPick(e,t){var i=e.context,r=e.frameState,n=e.environmentState,a=e.defaultView,o=(e.view=a).viewport;o.x=0,o.y=0,o.width=i.drawingBufferWidth,o.height=i.drawingBufferHeight;var s=a.passState;s.viewport=BoundingRectangle.clone(o,s.viewport),e.clearPasses(r.passes),r.passes.pick=!0,r.passes.depth=!0,r.cullingVolume=getPickCullingVolume(e,t,1,1,o),r.tilesetPassState=pickTilesetPassState,e.updateEnvironment(),n.renderTranslucentDepthForPick=!0,s=a.pickDepthFramebuffer.update(i,t,o),e.updateAndExecuteCommands(s,scratchColorZero),e.resolveFramebuffers(s),i.endFrame()}Picking.prototype.pick=function(e,t,i,r){scratchRectangleWidth=defaultValue(i,3),scratchRectangleHeight=defaultValue(r,scratchRectangleWidth);var n=e.context,a=n.uniformState,o=e.frameState,s=e.defaultView,l=(e.view=s).viewport;l.x=0,l.y=0,l.width=n.drawingBufferWidth,l.height=n.drawingBufferHeight;var c=s.passState;c.viewport=BoundingRectangle.clone(l,c.viewport);var u=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition$c);e.jobScheduler.disableThisFrame(),e.updateFrameState(),o.cullingVolume=getPickCullingVolume(e,u,scratchRectangleWidth,scratchRectangleHeight,l),o.invertClassification=!1,o.passes.pick=!0,o.tilesetPassState=pickTilesetPassState,a.update(o),e.updateEnvironment(),scratchRectangle$7.x=u.x-.5*(scratchRectangleWidth-1),scratchRectangle$7.y=e.drawingBufferHeight-u.y-.5*(scratchRectangleHeight-1),scratchRectangle$7.width=scratchRectangleWidth,scratchRectangle$7.height=scratchRectangleHeight,c=s.pickFramebuffer.begin(scratchRectangle$7,s.viewport),e.updateAndExecuteCommands(c,scratchColorZero),e.resolveFramebuffers(c);var d=s.pickFramebuffer.end(scratchRectangle$7);return n.endFrame(),d};var scratchPerspectiveFrustum=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum=new OrthographicFrustum,scratchOrthographicOffCenterFrustum=new OrthographicOffCenterFrustum;Picking.prototype.pickPositionWorldCoordinates=function(e,t,i){if(e.useDepthPicking){var r=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(r))return Cartesian3.clone(this._pickPositionCache[r],i);var n=e.frameState,a=e.context,o=a.uniformState,s=e.defaultView;e.view=s;var l=SceneTransforms.transformWindowToDrawingBuffer(e,t,scratchPosition$c);e.pickTranslucentDepth?renderTranslucentDepthForPick(e,l):(e.updateFrameState(),o.update(n),e.updateEnvironment()),l.y=e.drawingBufferHeight-l.y;var c,u=e.camera;c=defined(u.frustum.fov)?u.frustum.clone(scratchPerspectiveFrustum):defined(u.frustum.infiniteProjectionMatrix)?u.frustum.clone(scratchPerspectiveOffCenterFrustum):defined(u.frustum.width)?u.frustum.clone(scratchOrthographicFrustum):u.frustum.clone(scratchOrthographicOffCenterFrustum);for(var d=s.frustumCommandsList,h=d.length,p=0;p<h;++p){var m=this.getPickDepth(e,p).getDepth(a,l.x,l.y);if(0<m&&m<1){var f,g=d[p];return e.mode===SceneMode$1.SCENE2D?(f=u.position.z,u.position.z=f-g.near+1,c.far=Math.max(1,g.far-g.near),c.near=1,o.update(n)):(c.near=g.near*(0!==p?e.opaqueFrustumNearOffset:1),c.far=g.far),o.updateFrustum(c),i=SceneTransforms.drawingBufferToWgs84Coordinates(e,l,m,i),e.mode===SceneMode$1.SCENE2D&&(u.position.z=f,o.update(n)),this._pickPositionCache[r]=Cartesian3.clone(i),i}}this._pickPositionCache[r]=void 0}};var scratchPickPositionCartographic=new Cartographic;function drillPick(e,t){var i,r,n=[],a=[],o=[],s=[];defined(e)||(e=Number.MAX_VALUE);for(var l=t();defined(l);){var c=l.object,u=l.position,d=l.exclude;if(defined(u)&&!defined(c)){n.push(l);break}if(!defined(c)||!defined(c.primitive))break;if(!d&&(n.push(l),--e<=0))break;var h=c.primitive,p=!1;"function"==typeof h.getGeometryInstanceAttributes&&defined(c.id)&&defined(r=h.getGeometryInstanceAttributes(c.id))&&defined(r.show)&&(p=!0,r.show=ShowGeometryInstanceAttribute.toValue(!1,r.show),o.push(r)),c instanceof Cesium3DTileFeature&&(p=!0,c.show=!1,s.push(c)),p||(h.show=!1,a.push(h)),l=t()}for(i=0;i<a.length;++i)a[i].show=!0;for(i=0;i<o.length;++i)(r=o[i]).show=ShowGeometryInstanceAttribute.toValue(!0,r.show);for(i=0;i<s.length;++i)s[i].show=!0;return n}Picking.prototype.pickPosition=function(e,t,i){if(defined(i=this.pickPositionWorldCoordinates(e,t,i))&&e.mode!==SceneMode$1.SCENE3D){Cartesian3.fromElements(i.y,i.z,i.x,i);var r=e.mapProjection,n=r.ellipsoid,a=r.unproject(i,scratchPickPositionCartographic);n.cartographicToCartesian(a,i)}return i},Picking.prototype.drillPick=function(t,i,e,r,n){var a=this;return drillPick(e,function(){var e=a.pick(t,i,r,n);if(defined(e))return{object:e,position:void 0,exclude:!1}}).map(function(e){return e.object})};var scratchRight$3=new Cartesian3,scratchUp$1=new Cartesian3;function MostDetailedRayPick(e,t,i){this.ray=e,this.width=t,this.tilesets=i,this.ready=!1,this.deferred=when.defer(),this.promise=this.deferred.promise}function updateOffscreenCameraFromRay(e,t,i,r){var n=t.direction,a=Cartesian3.mostOrthogonalAxis(n,scratchRight$3),o=Cartesian3.cross(n,a,scratchRight$3),s=Cartesian3.cross(n,o,scratchUp$1);return r.position=t.origin,r.direction=n,r.up=s,r.right=o,r.frustum.width=defaultValue(i,offscreenDefaultWidth),r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function updateMostDetailedRayPick(e,t,i){var r=t.frameState,n=i.ray,a=i.width,o=i.tilesets,s=e._pickOffscreenView.camera,l=updateOffscreenCameraFromRay(e,n,a,s),c=mostDetailedPreloadTilesetPassState;c.camera=s,c.cullingVolume=l;for(var u=!0,d=o.length,h=0;h<d;++h){var p=o[h];p.show&&t.primitives.contains(p)&&(p.updateForPass(r,c),u=u&&c.ready)}return u&&i.deferred.resolve(),u}function getTilesets(e,t,i){for(var r=e.length,n=0;n<r;++n){var a=e.get(n);a.show&&(a instanceof Cesium3DTileset?defined(t)&&-1!==t.indexOf(a)||i.push(a):a instanceof PrimitiveCollection&&getTilesets(a,t,i))}}function launchMostDetailedRayPick(e,t,i,r,n,a){var o=[];if(getTilesets(t.primitives,r,o),0===o.length)return when.resolve(a());var s=new MostDetailedRayPick(i,n,o);return e._mostDetailedRayPicks.push(s),s.promise.then(function(){return a()})}function isExcluded(e,t){return!(!defined(e)||!defined(t)||0===t.length)&&(-1<t.indexOf(e)||-1<t.indexOf(e.primitive)||-1<t.indexOf(e.id))}function getRayIntersection(e,t,i,r,n,a,o){var s=t.context,l=s.uniformState,c=t.frameState,u=e._pickOffscreenView;updateOffscreenCameraFromRay(e,i,n,(t.view=u).camera),scratchRectangle$7=BoundingRectangle.clone(u.viewport,scratchRectangle$7);var d,h=u.pickFramebuffer.begin(scratchRectangle$7,u.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),c.invertClassification=!1,c.passes.pick=!0,c.passes.offscreen=!0,c.tilesetPassState=o?mostDetailedPickTilesetPassState:pickTilesetPassState,l.update(c),t.updateEnvironment(),t.updateAndExecuteCommands(h,scratchColorZero),t.resolveFramebuffers(h);var p=u.pickFramebuffer.end(s);if(t.context.depthTexture)for(var m=u.frustumCommandsList.length,f=0;f<m;++f){var g=e.getPickDepth(t,f).getDepth(s,0,0);if(0<g&&g<1){var _=u.frustumCommandsList[f],y=_.near*(0!==f?t.opaqueFrustumNearOffset:1),v=y+g*(_.far-y);d=Ray.getPoint(i,v);break}}if(t.view=t.defaultView,s.endFrame(),defined(p)||defined(d))return{object:p,position:d,exclude:!defined(d)&&a||isExcluded(p,r)}}function getRayIntersections(e,t,i,r,n,a,o,s){return drillPick(r,function(){return getRayIntersection(e,t,i,n,a,o,s)})}function pickFromRay(e,t,i,r,n,a,o){var s=getRayIntersections(e,t,i,1,r,n,a,o);if(0<s.length)return s[0]}function drillPickFromRay(e,t,i,r,n,a,o,s){return getRayIntersections(e,t,i,r,n,a,o,s)}function deferPromiseUntilPostRender(i,e){var r=when.defer();return e.then(function(e){var t=i.postRender.addEventListener(function(){r.resolve(e),t()});i.requestRender()}).otherwise(function(e){r.reject(e)}),r.promise}Picking.prototype.updateMostDetailedRayPicks=function(e){for(var t=this._mostDetailedRayPicks,i=0;i<t.length;++i)updateMostDetailedRayPick(this,e,t[i])&&t.splice(i--,1)},Picking.prototype.pickFromRay=function(e,t,i,r){return pickFromRay(this,e,t,i,r,!1,!1)},Picking.prototype.drillPickFromRay=function(e,t,i,r,n){return drillPickFromRay(this,e,t,i,r,n,!1,!1)},Picking.prototype.pickFromRayMostDetailed=function(e,t,i,r){var n=this;return t=Ray.clone(t),i=defined(i)?i.slice():i,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(n,e,t,i,r,function(){return pickFromRay(n,e,t,i,r,!1,!0)}))},Picking.prototype.drillPickFromRayMostDetailed=function(e,t,i,r,n){var a=this;return t=Ray.clone(t),r=defined(r)?r.slice():r,deferPromiseUntilPostRender(e,launchMostDetailedRayPick(a,e,t,r,n,function(){return drillPickFromRay(a,e,t,i,r,n,!1,!0)}))};var scratchSurfacePosition=new Cartesian3,scratchSurfaceNormal=new Cartesian3,scratchSurfaceRay=new Ray,scratchCartographic$e=new Cartographic;function getRayForSampleHeight(e,t){var i=e.globe,r=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid,n=ApproximateTerrainHeights._defaultMaxTerrainHeight,a=r.geodeticSurfaceNormalCartographic(t,scratchSurfaceNormal),o=Cartographic.toCartesian(t,r,scratchSurfacePosition),s=scratchSurfaceRay;s.origin=o,s.direction=a;var l=new Ray;return Ray.getPoint(s,n,l.origin),Cartesian3.negate(a,l.direction),l}function getRayForClampToHeight(e,t){var i=e.globe,r=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid;return getRayForSampleHeight(e,Cartographic.fromCartesian(t,r,scratchCartographic$e))}function getHeightFromCartesian(e,t){var i=e.globe,r=defined(i)?i.ellipsoid:e.mapProjection.ellipsoid;return Cartographic.fromCartesian(t,r,scratchCartographic$e).height}function sampleHeightMostDetailed(t,i,e,r,n){var a=getRayForSampleHeight(i,e);return launchMostDetailedRayPick(t,i,a,r,n,function(){var e=pickFromRay(t,i,a,r,n,!0,!0);if(defined(e))return getHeightFromCartesian(i,e.position)})}function clampToHeightMostDetailed(t,i,e,r,n,a){var o=getRayForClampToHeight(i,e);return launchMostDetailedRayPick(t,i,o,r,n,function(){var e=pickFromRay(t,i,o,r,n,!0,!0);if(defined(e))return Cartesian3.clone(e.position,a)})}Picking.prototype.sampleHeight=function(e,t,i,r){var n=pickFromRay(this,e,getRayForSampleHeight(e,t),i,r,!0,!1);if(defined(n))return getHeightFromCartesian(e,n.position)},Picking.prototype.clampToHeight=function(e,t,i,r,n){var a=pickFromRay(this,e,getRayForClampToHeight(e,t),i,r,!0,!1);if(defined(a))return Cartesian3.clone(a.position,n)},Picking.prototype.sampleHeightMostDetailed=function(e,r,t,i){t=defined(t)?t.slice():t;for(var n=r.length,a=new Array(n),o=0;o<n;++o)a[o]=sampleHeightMostDetailed(this,e,r[o],t,i);return deferPromiseUntilPostRender(e,when.all(a).then(function(e){for(var t=e.length,i=0;i<t;++i)r[i].height=e[i];return r}))},Picking.prototype.clampToHeightMostDetailed=function(e,r,t,i){t=defined(t)?t.slice():t;for(var n=r.length,a=new Array(n),o=0;o<n;++o)a[o]=clampToHeightMostDetailed(this,e,r[o],t,i,r[o]);return deferPromiseUntilPostRender(e,when.all(a).then(function(e){for(var t=e.length,i=0;i<t;++i)r[i]=e[i];return r}))},Picking.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};var PostProcessStageSampleMode={NEAREST:0,LINEAR:1};function PostProcessStage(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).fragmentShader,i=defaultValue(e.textureScale,1),r=defaultValue(e.pixelFormat,PixelFormat$1.RGBA);this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=i,this._forcePowerOfTwo=defaultValue(e.forcePowerOfTwo,!1),this._sampleMode=defaultValue(e.sampleMode,PostProcessStageSampleMode.NEAREST),this._pixelFormat=r,this._pixelDatatype=defaultValue(e.pixelDatatype,PixelDatatype$1.UNSIGNED_BYTE),this._clearColor=defaultValue(e.clearColor,Color.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;var n=new PassState;n.scissorTest={enabled:!0,rectangle:defined(e.scissorRectangle)?BoundingRectangle.clone(e.scissorRectangle):new BoundingRectangle},this._passState=n,this._ready=!1;var a=e.name;defined(a)||(a=createGuid()),this._name=a,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}defineProperties$1(PostProcessStage.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(defined(this._textureCache)){var e=this._textureCache.getFramebuffer(this._name);if(defined(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}}});var depthTextureRegex=/uniform\s+sampler2D\s+depthTexture/g;function getUniformValueGetterAndSetter(n,a,o){var e=a[o];return("string"==typeof e||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)&&n._dirtyUniforms.push(o),{get:function(){return a[o]},set:function(e){var t=a[o];a[o]=e;var i=n._actualUniforms,r=i[o];defined(r)&&r!==t&&r instanceof Texture&&!defined(n._textureCache.getStageByName(o))&&(n._texturesToRelease.push(r),delete i[o],delete i[o+"Dimensions"]),t instanceof Texture&&n._texturesToRelease.push(t),"string"==typeof e||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData?n._dirtyUniforms.push(o):i[o]=e}}}function getUniformMapFunction(t,i){return function(){var e=t._actualUniforms[i];return"function"==typeof e?e():e}}function getUniformMapDimensionsFunction(t,i){return function(){var e=t[i]();if(defined(e))return e.dimensions}}function createUniformMap$5(e){if(!defined(e._uniformMap)){var t={},i={},r=e._uniforms,n=e._actualUniforms;for(var a in r)if(r.hasOwnProperty(a)){"function"!=typeof r[a]?(t[a]=getUniformMapFunction(e,a),i[a]=getUniformValueGetterAndSetter(e,r,a)):(t[a]=r[a],i[a]=r[a]),n[a]=r[a];var o=t[a]();("string"==typeof o||o instanceof Texture||o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement)&&(t[a+"Dimensions"]=getUniformMapDimensionsFunction(t,a))}e._uniforms={},defineProperties$1(e._uniforms,i),e._uniformMap=combine(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 createDrawCommand(e,t){if(!defined(e._command)||e._logDepthChanged||e._selectedDirty){var i=e._fragmentShader;if(defined(e._selectedIdTexture))i="#define CZM_SELECTED_FEATURE \nuniform sampler2D czm_idTexture; \nuniform sampler2D czm_selectedIdTexture; \nuniform float czm_selectedIdTextureStep; \nvarying vec2 v_textureCoordinates; \nbool czm_selected(vec2 offset) \n{ \n    bool selected = false;\n    vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset); \n    for (int i = 0; i < "+e._selectedIdTexture.width+"; ++i) \n    { \n        vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5)); \n        if (all(equal(id, selectedId))) \n        { \n            return true; \n        } \n    } \n    return false; \n} \n\nbool czm_selected() \n{ \n    return czm_selected(vec2(0.0)); \n} \n\n"+(i=i.replace(/varying\s+vec2\s+v_textureCoordinates;/g,""));var r=new ShaderSource({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[i]});e._command=t.createViewportQuadCommand(r,{uniformMap:e._uniformMap,owner:e})}}function createSampler$2(e){var t,i;i=e._sampleMode===PostProcessStageSampleMode.LINEAR?(t=TextureMinificationFilter$1.LINEAR,TextureMagnificationFilter$1.LINEAR):(t=TextureMinificationFilter$1.NEAREST,TextureMagnificationFilter$1.NEAREST);var r=e._sampler;defined(r)&&r.minificationFilter===t&&r.magnificationFilter===i||(e._sampler=new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:t,magnificationFilter:i}))}function createLoadImageFunction(t,i){return function(e){t._texturesToCreate.push({name:i,source:e})}}function createStageOutputTextureFunction(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function updateUniformTextures(e,t){var i,r,n,a=e._texturesToRelease,o=a.length;for(i=0;i<o;++i)r=(r=a[i])&&r.destroy();a.length=0;var s=e._texturesToCreate;for(o=s.length,i=0;i<o;++i){var l=s[i];n=l.name;var c=l.source;e._actualUniforms[n]=new Texture({context:t,source:c})}s.length=0;var u=e._dirtyUniforms;if(0!==u.length||defined(e._texturePromise)){if(0!==u.length&&!defined(e._texturePromise)){o=u.length;var d=e._uniforms,h=[];for(i=0;i<o;++i){var p=d[n=u[i]];if(defined(e._textureCache.getStageByName(p)))e._actualUniforms[n]=createStageOutputTextureFunction(e,p);else if("string"==typeof p){var m=new Resource({url:p});h.push(m.fetchImage().then(createLoadImageFunction(e,n)))}else e._texturesToCreate.push({name:n,source:p})}(u.length=0)<h.length?(e._ready=!1,e._texturePromise=when.all(h).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}}else e._ready=!0}function releaseResources(e){defined(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();var t=e._textureCache;if(defined(t)){var i=e._uniforms,r=e._actualUniforms;for(var n in r)r.hasOwnProperty(n)&&r[n]instanceof Texture&&(defined(t.getStageByName(i[n]))||r[n].destroy(),e._dirtyUniforms.push(n))}}function isSelectedTextureDirty(e){var t=defined(e._selected)?e._selected.length:0,i=defined(e._parentSelected)?e._parentSelected:0,r=e._selected!==e._selectedShadow||t!==e._selectedLength;if(r=r||e._parentSelected!==e._parentSelectedShadow||i!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!r&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(var n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return r}function createSelectedTexture(e,t){if(e._selectedDirty){e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;var i=e._combinedSelected;if(defined(i)){var r,n,a,o=0,s=i.length;for(r=0;r<s;++r)defined((n=i[r]).pickIds)?o+=n.pickIds.length:defined(n.pickId)&&++o;if(0===s||0===o){var l=new Uint8Array(4);return l[0]=255,l[1]=255,l[2]=255,l[3]=255,void(e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:l,width:1,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})}))}var c=0,u=new Uint8Array(4*o);for(r=0;r<s;++r)if(defined((n=i[r]).pickIds))for(var d=n.pickIds,h=d.length,p=0;p<h;++p)a=d[p].color,u[c]=Color.floatToByte(a.red),u[c+1]=Color.floatToByte(a.green),u[c+2]=Color.floatToByte(a.blue),u[c+3]=Color.floatToByte(a.alpha),c+=4;else defined(n.pickId)&&(a=n.pickId.color,u[c]=Color.floatToByte(a.red),u[c+1]=Color.floatToByte(a.green),u[c+2]=Color.floatToByte(a.blue),u[c+3]=Color.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new Texture({context:t,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:u,width:o,height:1},sampler:new Sampler({wrapS:TextureWrap$1.CLAMP_TO_EDGE,wrapT:TextureWrap$1.CLAMP_TO_EDGE,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}}}PostProcessStage.prototype._isSupported=function(e){return!depthTextureRegex.test(this._fragmentShader)||e.depthTexture},PostProcessStage.prototype.update=function(e,t){if(this.enabled===this._enabled||this.enabled||releaseResources(this),this._enabled=this.enabled,this._enabled&&(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=isSelectedTextureDirty(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0,createSelectedTexture(this,e),createUniformMap$5(this),updateUniformTextures(this,e),createDrawCommand(this,e),createSampler$2(this),this._selectedDirty=!1,this._ready)){var i=this._textureCache.getFramebuffer(this._name);if(defined(this._command.framebuffer=i)){var r,n=i.getColorTexture(0);n.width===e.drawingBufferWidth&&n.height===e.drawingBufferHeight||defined(r=this._renderState)&&n.width===r.viewport.width&&n.height===r.viewport.height||(this._renderState=RenderState.fromCache({viewport:new BoundingRectangle(0,0,n.width,n.height)})),this._command.renderState=r}}},PostProcessStage.prototype.execute=function(e,t,i,r){if(defined(this._command)&&defined(this._command.framebuffer)&&this._ready&&this._enabled){this._colorTexture=t,this._depthTexture=i,this._idTexture=r,Sampler.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);var n=0<this.scissorRectangle.width&&0<this.scissorRectangle.height?this._passState:void 0;defined(n)&&(n.context=e),this._command.execute(e,n)}},PostProcessStage.prototype.isDestroyed=function(){return!1},PostProcessStage.prototype.destroy=function(){return releaseResources(this),destroyObject(this)};var AcesTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\ncolor /= texture2D(autoExposure, vec2(0.5)).r;\n#endif\ncolor = czm_acesTonemapping(color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",AmbientOcclusionGenerate="uniform sampler2D randomTexture;\nuniform sampler2D depthTexture;\nuniform float intensity;\nuniform float bias;\nuniform float lengthCap;\nuniform float stepSize;\nuniform float frustumLength;\nvarying vec2 v_textureCoordinates;\nvec4 clipToEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);\nposEC = posEC / posEC.w;\nreturn posEC;\n}\nvec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)\n{\nvec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);\nvec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);\nvec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);\nvec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);\nvec3 up = posInCamera.xyz - posInCameraUp.xyz;\nvec3 down = posInCameraDown.xyz - posInCamera.xyz;\nvec3 left = posInCamera.xyz - posInCameraLeft.xyz;\nvec3 right = posInCameraRight.xyz - posInCamera.xyz;\nvec3 DX = length(left) < length(right) ? left : right;\nvec3 DY = length(up) < length(down) ? up : down;\nreturn normalize(cross(DY, DX));\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = clipToEye(v_textureCoordinates, depth);\nif (posInCamera.z > frustumLength)\n{\ngl_FragColor = vec4(1.0);\nreturn;\n}\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nfloat depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));\nfloat depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));\nfloat depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));\nfloat depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));\nvec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);\nfloat ao = 0.0;\nvec2 sampleDirection = vec2(1.0, 0.0);\nfloat gapAngle = 90.0 * czm_radiansPerDegree;\nfloat randomVal = texture2D(randomTexture, v_textureCoordinates).x;\nfor (int i = 0; i < 4; i++)\n{\nfloat newGapAngle = gapAngle * (float(i) + randomVal);\nfloat cosVal = cos(newGapAngle);\nfloat sinVal = sin(newGapAngle);\nvec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);\nfloat localAO = 0.0;\nfloat localStepSize = stepSize;\nfor (int j = 0; j < 6; j++)\n{\nvec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;\nif(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)\n{\nbreak;\n}\nfloat stepDepthInfo = czm_readDepth(depthTexture, newCoords);\nvec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);\nvec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;\nfloat len = length(diffVec);\nif (len > lengthCap)\n{\nbreak;\n}\nfloat dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );\nfloat weight = len / lengthCap;\nweight = 1.0 - weight * weight;\nif (dotVal < bias)\n{\ndotVal = 0.0;\n}\nlocalAO = max(localAO, dotVal * weight);\nlocalStepSize += stepSize;\n}\nao += localAO;\n}\nao /= 4.0;\nao = 1.0 - clamp(ao, 0.0, 1.0);\nao = pow(ao, intensity);\ngl_FragColor = vec4(vec3(ao), 1.0);\n}\n",AmbientOcclusionModulate="uniform sampler2D colorTexture;\nuniform sampler2D ambientOcclusionTexture;\nuniform bool ambientOcclusionOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;\ngl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;\n}\n",BlackAndWhite="uniform sampler2D colorTexture;\nuniform float gradations;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = vec4(rgb, 1.0);\nreturn;\n}\n#endif\nfloat luminance = czm_luminance(rgb);\nfloat darkness = luminance * gradations;\ndarkness = (darkness - fract(darkness)) / gradations;\ngl_FragColor = vec4(vec3(darkness), 1.0);\n}\n",BloomComposite="uniform sampler2D colorTexture;\nuniform sampler2D bloomTexture;\nuniform bool glowOnly;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\n#ifdef CZM_SELECTED_FEATURE\nif (czm_selected()) {\ngl_FragColor = color;\nreturn;\n}\n#endif\nvec4 bloom = texture2D(bloomTexture, v_textureCoordinates);\ngl_FragColor = glowOnly ? bloom : bloom + color;\n}\n",Brightness="uniform sampler2D colorTexture;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 target = vec3(0.0);\ngl_FragColor = vec4(mix(target, rgb, brightness), 1.0);\n}\n",ContrastBias="uniform sampler2D colorTexture;\nuniform float contrast;\nuniform float brightness;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;\nsceneColor = czm_RGBToHSB(sceneColor);\nsceneColor.z += brightness;\nsceneColor = czm_HSBToRGB(sceneColor);\nfloat factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\nsceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\ngl_FragColor = vec4(sceneColor, 1.0);\n}\n",DepthOfField="uniform sampler2D colorTexture;\nuniform sampler2D blurTexture;\nuniform sampler2D depthTexture;\nuniform float focalDistance;\nvarying vec2 v_textureCoordinates;\nvec4 toEye(vec2 uv, float depth)\n{\nvec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\nvec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\nposInCamera = posInCamera / posInCamera.w;\nreturn posInCamera;\n}\nfloat computeDepthBlur(float depth)\n{\nfloat f;\nif (depth < focalDistance)\n{\nf = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);\n}\nelse\n{\nf = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);\nf = pow(f, 0.1);\n}\nf *= f;\nf = clamp(f, 0.0, 1.0);\nreturn pow(f, 0.5);\n}\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\nvec4 posInCamera = toEye(v_textureCoordinates, depth);\nfloat d = computeDepthBlur(-posInCamera.z);\ngl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);\n}\n",DepthView="uniform sampler2D depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat depth = czm_readDepth(depthTexture, v_textureCoordinates);\ngl_FragColor = vec4(vec3(depth), 1.0);\n}\n",EdgeDetection="uniform sampler2D depthTexture;\nuniform float length;\nuniform vec4 color;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nfloat directions[3];\ndirections[0] = -1.0;\ndirections[1] = 0.0;\ndirections[2] = 1.0;\nfloat scalars[3];\nscalars[0] = 3.0;\nscalars[1] = 10.0;\nscalars[2] = 3.0;\nfloat padx = czm_pixelRatio / czm_viewport.z;\nfloat pady = czm_pixelRatio / czm_viewport.w;\n#ifdef CZM_SELECTED_FEATURE\nbool selected = false;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nselected = selected || czm_selected(vec2(-padx, dir * pady));\nselected = selected || czm_selected(vec2(padx, dir * pady));\nselected = selected || czm_selected(vec2(dir * padx, -pady));\nselected = selected || czm_selected(vec2(dir * padx, pady));\nif (selected)\n{\nbreak;\n}\n}\nif (!selected)\n{\ngl_FragColor = vec4(color.rgb, 0.0);\nreturn;\n}\n#endif\nfloat horizEdge = 0.0;\nfloat vertEdge = 0.0;\nfor (int i = 0; i < 3; ++i)\n{\nfloat dir = directions[i];\nfloat scale = scalars[i];\nhorizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;\nhorizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;\nvertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;\nvertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;\n}\nfloat len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\ngl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);\n}\n",FilmicTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\nconst float A = 0.22;\nconst float B = 0.30;\nconst float C = 0.10;\nconst float D = 0.20;\nconst float E = 0.01;\nconst float F = 0.30;\nconst float white = 11.2;\nvec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\nfloat w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\nc = czm_inverseGamma(c / w);\ngl_FragColor = vec4(c, fragmentColor.a);\n}\n",FXAA="varying vec2 v_textureCoordinates;\nuniform sampler2D colorTexture;\nconst float fxaaQualitySubpix = 0.5;\nconst float fxaaQualityEdgeThreshold = 0.125;\nconst float fxaaQualityEdgeThresholdMin = 0.0833;\nvoid main()\n{\nvec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;\nvec4 color = FxaaPixelShader(\nv_textureCoordinates,\ncolorTexture,\nfxaaQualityRcpFrame,\nfxaaQualitySubpix,\nfxaaQualityEdgeThreshold,\nfxaaQualityEdgeThresholdMin);\nfloat alpha = texture2D(colorTexture, v_textureCoordinates).a;\ngl_FragColor = vec4(color.rgb, alpha);\n}\n",GaussianBlur1D="#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D colorTexture;\n#ifdef USE_STEP_SIZE\nuniform float stepSize;\n#else\nuniform vec2 step;\n#endif\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\n#ifdef USE_STEP_SIZE\nvec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));\n#else\nvec2 step = step;\n#endif\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(colorTexture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * step;\nresult += texture2D(colorTexture, st - offset) * g.x;\nresult += texture2D(colorTexture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n",LensFlare="uniform sampler2D colorTexture;\nuniform sampler2D dirtTexture;\nuniform sampler2D starTexture;\nuniform vec2 dirtTextureDimensions;\nuniform float distortion;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform float dirtAmount;\nuniform float earthRadius;\nuniform float intensity;\nvarying vec2 v_textureCoordinates;\n#define DISTANCE_TO_SPACE 6500000.0\nvec4 getNDCFromWC(vec3 WC, float earthRadius)\n{\nvec4 positionEC = czm_view * vec4(WC, 1.0);\npositionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nreturn czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n}\nfloat isInEarth(vec2 texcoord, vec2 sceneSize)\n{\nvec2 NDC = texcoord * 2.0 - 1.0;\nvec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);\nvec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);\nNDC.xy -= earthPosSC.xy;\nfloat X = abs(NDC.x) * sceneSize.x;\nfloat Y = abs(NDC.y) * sceneSize.y;\nreturn clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));\n}\nvec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)\n{\nvec2 sceneSize = czm_viewport.zw;\nvec3 color;\nif(isSpace)\n{\ncolor.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;\n}\nelse\n{\ncolor.r = texture2D(tex, texcoord + direction * distortion.r).r;\ncolor.g = texture2D(tex, texcoord + direction * distortion.g).g;\ncolor.b = texture2D(tex, texcoord + direction * distortion.b).b;\n}\nreturn vec4(clamp(color, 0.0, 1.0), 0.0);\n}\nvoid main(void)\n{\nvec4 originalColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 rgb = originalColor.rgb;\nbool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;\nvec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);\nvec4 sunPositionEC = czm_view * sunPos;\nvec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);\nsunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);\nif(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))\n{\ngl_FragColor = originalColor;\nreturn;\n}\nvec2 texcoord = vec2(1.0) - v_textureCoordinates;\nvec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\nvec2 invPixelSize = 1.0 / pixelSize;\nvec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);\nvec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;\nvec3 direction = normalize(vec3(ghostVec, 0.0));\nvec4 result = vec4(0.0);\nvec4 ghost = vec4(0.0);\nfor (int i = 0; i < 4; ++i)\n{\nvec2 offset = fract(texcoord + ghostVec * float(i));\nghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);\n}\nresult += ghost;\nvec2 haloVec = normalize(ghostVec) * haloWidth;\nfloat weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\nweightForHalo = pow(1.0 - weightForHalo, 5.0);\nresult += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;\nvec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;\nif (dirtTexCoords.x > 1.0)\n{\ndirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) :  fract(dirtTexCoords.x);\n}\nif (dirtTexCoords.y > 1.0)\n{\ndirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) :  fract(dirtTexCoords.y);\n}\nresult += dirtAmount * texture2D(dirtTexture, dirtTexCoords);\nfloat camrot = czm_view[0].z + czm_view[1].y;\nfloat cosValue = cos(camrot);\nfloat sinValue = sin(camrot);\nmat3 rotation = mat3(\ncosValue, -sinValue, 0.0,\nsinValue, cosValue, 0.0,\n0.0, 0.0, 1.0\n);\nvec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);\nvec3 st2 = vec3((rotation * st1).xy, 1.0);\nvec3 st3 = st2 * 0.5 + vec3(0.5);\nvec2 lensStarTexcoord = st3.xy;\nfloat weightForLensFlare = length(vec3(sunPos.xy, 0.0));\nfloat oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);\nif (!isSpace)\n{\nresult *= oneMinusWeightForLensFlare * intensity * 0.2;\n}\nelse\n{\nresult *= oneMinusWeightForLensFlare * intensity;\nresult *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;\n}\nresult += texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = result;\n}\n",ModifiedReinhardTonemapping="uniform sampler2D colorTexture;\nuniform vec3 white;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = (color * (1.0 + color / white)) / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",NightVision="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nfloat rand(vec2 co)\n{\nreturn fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);\n}\nvoid main(void)\n{\nfloat noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;\nvec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\nvec3 green = vec3(0.0, 1.0, 0.0);\ngl_FragColor = vec4((noiseValue + rgb) * green, 1.0);\n}\n",ReinhardTonemapping="uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\nvoid main()\n{\nvec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\nvec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\nfloat exposure = texture2D(autoExposure, vec2(0.5)).r;\ncolor /= exposure;\n#endif\ncolor = color / (1.0 + color);\ncolor = czm_inverseGamma(color);\ngl_FragColor = vec4(color, fragmentColor.a);\n}\n",Silhouette="uniform sampler2D colorTexture;\nuniform sampler2D silhouetteTexture;\nvarying vec2 v_textureCoordinates;\nvoid main(void)\n{\nvec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\ngl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);\n}\n",FXAA3_11="#if (FXAA_QUALITY_PRESET == 10)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 3.0\n#define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 3.0\n#define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 4.0\n#define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 4.0\n#define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 4.0\n#define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 2.0\n#define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 3.0\n#define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n#define FXAA_QUALITY_PS 9\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 4.0\n#define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n#define FXAA_QUALITY_PS 10\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 4.0\n#define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n#define FXAA_QUALITY_PS 11\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 4.0\n#define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.0\n#define FXAA_QUALITY_P2 1.0\n#define FXAA_QUALITY_P3 1.0\n#define FXAA_QUALITY_P4 1.0\n#define FXAA_QUALITY_P5 1.5\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\nFxaaFloat4 FxaaPixelShader(\nFxaaFloat2 pos,\nFxaaTex tex,\nFxaaFloat2 fxaaQualityRcpFrame,\nFxaaFloat fxaaQualitySubpix,\nFxaaFloat fxaaQualityEdgeThreshold,\nFxaaFloat fxaaQualityEdgeThresholdMin\n) {\nFxaaFloat2 posM;\nposM.x = pos.x;\nposM.y = pos.y;\nFxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n#define lumaM rgbyM.y\nFxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat maxSM = max(lumaS, lumaM);\nFxaaFloat minSM = min(lumaS, lumaM);\nFxaaFloat maxESM = max(lumaE, maxSM);\nFxaaFloat minESM = min(lumaE, minSM);\nFxaaFloat maxWN = max(lumaN, lumaW);\nFxaaFloat minWN = min(lumaN, lumaW);\nFxaaFloat rangeMax = max(maxWN, maxESM);\nFxaaFloat rangeMin = min(minWN, minESM);\nFxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\nFxaaFloat range = rangeMax - rangeMin;\nFxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\nFxaaBool earlyExit = range < rangeMaxClamped;\nif(earlyExit)\nreturn rgbyM;\nFxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNS = lumaN + lumaS;\nFxaaFloat lumaWE = lumaW + lumaE;\nFxaaFloat subpixRcpRange = 1.0/range;\nFxaaFloat subpixNSWE = lumaNS + lumaWE;\nFxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\nFxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\nFxaaFloat lumaNESE = lumaNE + lumaSE;\nFxaaFloat lumaNWNE = lumaNW + lumaNE;\nFxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\nFxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\nFxaaFloat lumaNWSW = lumaNW + lumaSW;\nFxaaFloat lumaSWSE = lumaSW + lumaSE;\nFxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\nFxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\nFxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\nFxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\nFxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\nFxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\nFxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\nFxaaFloat lengthSign = fxaaQualityRcpFrame.x;\nFxaaBool horzSpan = edgeHorz >= edgeVert;\nFxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\nif(!horzSpan) lumaN = lumaW;\nif(!horzSpan) lumaS = lumaE;\nif(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\nFxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\nFxaaFloat gradientN = lumaN - lumaM;\nFxaaFloat gradientS = lumaS - lumaM;\nFxaaFloat lumaNN = lumaN + lumaM;\nFxaaFloat lumaSS = lumaS + lumaM;\nFxaaBool pairN = abs(gradientN) >= abs(gradientS);\nFxaaFloat gradient = max(abs(gradientN), abs(gradientS));\nif(pairN) lengthSign = -lengthSign;\nFxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\nFxaaFloat2 posB;\nposB.x = posM.x;\nposB.y = posM.y;\nFxaaFloat2 offNP;\noffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\noffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\nif(!horzSpan) posB.x += lengthSign * 0.5;\nif( horzSpan) posB.y += lengthSign * 0.5;\nFxaaFloat2 posN;\nposN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\nposN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\nFxaaFloat2 posP;\nposP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\nposP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\nFxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\nFxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\nFxaaFloat subpixE = subpixC * subpixC;\nFxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\nif(!pairN) lumaNN = lumaSS;\nFxaaFloat gradientScaled = gradient * 1.0/4.0;\nFxaaFloat lumaMM = lumaM - lumaNN * 0.5;\nFxaaFloat subpixF = subpixD * subpixE;\nFxaaBool lumaMLTZero = lumaMM < 0.0;\nlumaEndN -= lumaNN * 0.5;\nlumaEndP -= lumaNN * 0.5;\nFxaaBool doneN = abs(lumaEndN) >= gradientScaled;\nFxaaBool doneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\nFxaaBool doneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n#if (FXAA_QUALITY_PS > 3)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n#if (FXAA_QUALITY_PS > 4)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n#if (FXAA_QUALITY_PS > 5)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n#if (FXAA_QUALITY_PS > 6)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n#if (FXAA_QUALITY_PS > 7)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n#if (FXAA_QUALITY_PS > 8)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n#if (FXAA_QUALITY_PS > 9)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n#if (FXAA_QUALITY_PS > 10)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n#if (FXAA_QUALITY_PS > 11)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n#if (FXAA_QUALITY_PS > 12)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\nFxaaFloat dstN = posM.x - posN.x;\nFxaaFloat dstP = posP.x - posM.x;\nif(!horzSpan) dstN = posM.y - posN.y;\nif(!horzSpan) dstP = posP.y - posM.y;\nFxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\nFxaaFloat spanLength = (dstP + dstN);\nFxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\nFxaaFloat spanLengthRcp = 1.0/spanLength;\nFxaaBool directionN = dstN < dstP;\nFxaaFloat dst = min(dstN, dstP);\nFxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\nFxaaFloat subpixG = subpixF * subpixF;\nFxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\nFxaaFloat subpixH = subpixG * fxaaQualitySubpix;\nFxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\nFxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\nif(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\nif( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\nreturn FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n}\n";function PostProcessStageComposite(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._stages=e.stages,this._inputPreviousStageTexture=defaultValue(e.inputPreviousStageTexture,!0);var t=e.name;defined(t)||(t=createGuid()),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}function isSelectedTextureDirty$1(e){var t=defined(e._selected)?e._selected.length:0,i=defined(e._parentSelected)?e._parentSelected:0,r=e._selected!==e._selectedShadow||t!==e._selectedLength;if(r=r||e._parentSelected!==e._parentSelectedShadow||i!==e._parentSelectedLength,defined(e._selected)&&defined(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):defined(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!r&&defined(e._combinedSelected)){if(!defined(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(var n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return r}defineProperties$1(PostProcessStageComposite.prototype,{ready:{get:function(){for(var e=this._stages,t=e.length,i=0;i<t;++i)if(!e[i].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){for(var t=this._stages,i=t.length,r=0;r<i;++r)t[r].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}}}),PostProcessStageComposite.prototype._isSupported=function(e){for(var t=this._stages,i=t.length,r=0;r<i;++r)if(!t[r]._isSupported(e))return!1;return!0},PostProcessStageComposite.prototype.get=function(e){return this._stages[e]},PostProcessStageComposite.prototype.update=function(e,t){this._selectedDirty=isSelectedTextureDirty$1(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=defined(this._selected)?this._selected.length:0,this._parentSelectedLength=defined(this._parentSelected)?this._parentSelected.length:0;for(var i=this._stages,r=i.length,n=0;n<r;++n){var a=i[n];this._selectedDirty&&(a.parentSelected=this._combinedSelected),a.update(e,t)}},PostProcessStageComposite.prototype.isDestroyed=function(){return!1},PostProcessStageComposite.prototype.destroy=function(){for(var e=this._stages,t=e.length,i=0;i<t;++i)e[i].destroy();return destroyObject(this)};var PostProcessStageLibrary={};function createBlur(e){var t="#define USE_STEP_SIZE\n"+GaussianBlur1D,r=new PostProcessStage({name:e+"_x_direction",fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:PostProcessStageSampleMode.LINEAR}),n=new PostProcessStage({name:e+"_y_direction",fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:PostProcessStageSampleMode.LINEAR}),i={};return defineProperties$1(i,{delta:{get:function(){return r.uniforms.delta},set:function(e){var t=r.uniforms,i=n.uniforms;t.delta=i.delta=e}},sigma:{get:function(){return r.uniforms.sigma},set:function(e){var t=r.uniforms,i=n.uniforms;t.sigma=i.sigma=e}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(e){var t=r.uniforms,i=n.uniforms;t.stepSize=i.stepSize=e}}}),new PostProcessStageComposite({name:e,stages:[r,n],uniforms:i})}function getSilhouetteEdgeDetection(e){if(!defined(e))return PostProcessStageLibrary.createEdgeDetectionStage();for(var t=new PostProcessStageComposite({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),i={},r="",n="",a=0;a<e.length;++a)r+="uniform sampler2D edgeTexture"+a+"; \n",n+="        vec4 edge"+a+" = texture2D(edgeTexture"+a+", v_textureCoordinates); \n        if (edge"+a+".a > 0.0) \n        { \n            color = edge"+a+"; \n            break; \n        } \n",i["edgeTexture"+a]=e[a].name;return new PostProcessStageComposite({name:"czm_edge_detection_composite",stages:[t,new PostProcessStage({name:"czm_edge_detection_combine",fragmentShader:r+"varying vec2 v_textureCoordinates; \nvoid main() { \n    vec4 color = vec4(0.0); \n    for (int i = 0; i < "+e.length+"; i++) \n    { \n"+n+"    } \n    gl_FragColor = color; \n} \n",uniforms:i})]})}PostProcessStageLibrary.createBlurStage=function(){return createBlur("czm_blur")},PostProcessStageLibrary.createDepthOfFieldStage=function(){var t=createBlur("czm_depth_of_field_blur"),i=new PostProcessStage({name:"czm_depth_of_field_composite",fragmentShader:DepthOfField,uniforms:{focalDistance:5,blurTexture:t.name}}),e={};return defineProperties$1(e,{focalDistance:{get:function(){return i.uniforms.focalDistance},set:function(e){i.uniforms.focalDistance=e}},delta:{get:function(){return t.uniforms.delta},set:function(e){t.uniforms.delta=e}},sigma:{get:function(){return t.uniforms.sigma},set:function(e){t.uniforms.sigma=e}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}}}),new PostProcessStageComposite({name:"czm_depth_of_field",stages:[t,i],inputPreviousStageTexture:!1,uniforms:e})},PostProcessStageLibrary.isDepthOfFieldSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createEdgeDetectionStage=function(){return new PostProcessStage({name:"czm_edge_detection_"+createGuid(),fragmentShader:EdgeDetection,uniforms:{length:.25,color:Color.clone(Color.BLACK)}})},PostProcessStageLibrary.isEdgeDetectionSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createSilhouetteStage=function(e){var t=getSilhouetteEdgeDetection(e);return new PostProcessStageComposite({name:"czm_silhouette",stages:[t,new PostProcessStage({name:"czm_silhouette_color_edges",fragmentShader:Silhouette,uniforms:{silhouetteTexture:t.name}})],inputPreviousStageTexture:!1,uniforms:t.uniforms})},PostProcessStageLibrary.isSilhouetteSupported=function(e){return e.context.depthTexture},PostProcessStageLibrary.createBloomStage=function(){var t=new PostProcessStage({name:"czm_bloom_contrast_bias",fragmentShader:ContrastBias,uniforms:{contrast:128,brightness:-.3}}),i=createBlur("czm_bloom_blur"),e=new PostProcessStageComposite({name:"czm_bloom_contrast_bias_blur",stages:[t,i]}),r=new PostProcessStage({name:"czm_bloom_generate_composite",fragmentShader:BloomComposite,uniforms:{glowOnly:!1,bloomTexture:e.name}}),n={};return defineProperties$1(n,{glowOnly:{get:function(){return r.uniforms.glowOnly},set:function(e){r.uniforms.glowOnly=e}},contrast:{get:function(){return t.uniforms.contrast},set:function(e){t.uniforms.contrast=e}},brightness:{get:function(){return t.uniforms.brightness},set:function(e){t.uniforms.brightness=e}},delta:{get:function(){return i.uniforms.delta},set:function(e){i.uniforms.delta=e}},sigma:{get:function(){return i.uniforms.sigma},set:function(e){i.uniforms.sigma=e}},stepSize:{get:function(){return i.uniforms.stepSize},set:function(e){i.uniforms.stepSize=e}}}),new PostProcessStageComposite({name:"czm_bloom",stages:[e,r],inputPreviousStageTexture:!1,uniforms:n})},PostProcessStageLibrary.createAmbientOcclusionStage=function(){var t=new PostProcessStage({name:"czm_ambient_occlusion_generate",fragmentShader:AmbientOcclusionGenerate,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),i=createBlur("czm_ambient_occlusion_blur");i.uniforms.stepSize=.86;var e=new PostProcessStageComposite({name:"czm_ambient_occlusion_generate_blur",stages:[t,i]}),r=new PostProcessStage({name:"czm_ambient_occlusion_composite",fragmentShader:AmbientOcclusionModulate,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:e.name}}),n={};return defineProperties$1(n,{intensity:{get:function(){return t.uniforms.intensity},set:function(e){t.uniforms.intensity=e}},bias:{get:function(){return t.uniforms.bias},set:function(e){t.uniforms.bias=e}},lengthCap:{get:function(){return t.uniforms.lengthCap},set:function(e){t.uniforms.lengthCap=e}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}},frustumLength:{get:function(){return t.uniforms.frustumLength},set:function(e){t.uniforms.frustumLength=e}},randomTexture:{get:function(){return t.uniforms.randomTexture},set:function(e){t.uniforms.randomTexture=e}},delta:{get:function(){return i.uniforms.delta},set:function(e){i.uniforms.delta=e}},sigma:{get:function(){return i.uniforms.sigma},set:function(e){i.uniforms.sigma=e}},blurStepSize:{get:function(){return i.uniforms.stepSize},set:function(e){i.uniforms.stepSize=e}},ambientOcclusionOnly:{get:function(){return r.uniforms.ambientOcclusionOnly},set:function(e){r.uniforms.ambientOcclusionOnly=e}}}),new PostProcessStageComposite({name:"czm_ambient_occlusion",stages:[e,r],inputPreviousStageTexture:!1,uniforms:n})},PostProcessStageLibrary.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var fxaaFS="#define FXAA_QUALITY_PRESET 39 \n"+FXAA3_11+"\n"+FXAA;function PostProcessStageTextureCache(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function getLastStageName(e){for(;defined(e.length);)e=e.get(e.length-1);return e.name}function getStageDependencies(e,t,i,r,n){if(!r.enabled||!r._isSupported(t))return n;var a=i[r.name]={};defined(n)&&(a[getLastStageName(e.getStageByName(n))]=!0);var o=r.uniforms;if(defined(o))for(var s=Object.getOwnPropertyNames(o),l=s.length,c=0;c<l;++c){var u=o[s[c]];if("string"==typeof u){var d=e.getStageByName(u);defined(d)&&(a[getLastStageName(d)]=!0)}}return r.name}function getCompositeDependencies(e,t,i,r,n){if(defined(r.enabled)&&!r.enabled||defined(r._isSupported)&&!r._isSupported(t))return n;for(var a,o,s=n,l=!defined(r.inputPreviousStageTexture)||r.inputPreviousStageTexture,c=n,u=r.length,d=0;d<u;++d){var h=r.get(d);c=defined(h.length)?getCompositeDependencies(e,t,i,h,n):getStageDependencies(e,t,i,h,n),l&&(n=c)}if(l)for(a=1;a<u;++a)defined(i[o=getLastStageName(r.get(a))])||(i[o]={}),i[o][s]=!0;else for(a=1;a<u;++a)for(var p=i[o=getLastStageName(r.get(a))],m=0;m<a;++m)p[getLastStageName(r.get(m))]=!0;return c}function getDependencies(e,t){var i={};if(defined(e.ambientOcclusion)){var r=e.ambientOcclusion,n=e.bloom,a=e._tonemapping,o=e.fxaa,s=getCompositeDependencies(e,t,i,r,void 0);getStageDependencies(e,t,i,o,s=getCompositeDependencies(e,t,i,e,s=getStageDependencies(e,t,i,a,s=getCompositeDependencies(e,t,i,n,s))))}else getCompositeDependencies(e,t,i,e,void 0);return i}function getFramebuffer(e,t,i){var r,n,a=e._collection.getStageByName(t),o=a._textureScale,s=a._forcePowerOfTwo,l=a._pixelFormat,c=a._pixelDatatype,u=a._clearColor,d=e._framebuffers,h=d.length;for(r=0;r<h;++r)if(o===(n=d[r]).textureScale&&s===n.forcePowerOfTwo&&l===n.pixelFormat&&c===n.pixelDatatype&&Color.equals(u,n.clearColor)){for(var p=n.stages,m=p.length,f=!1,g=0;g<m;++g)if(i[p[g]]){f=!0;break}if(!f)break}return defined(n)&&r<h?n.stages.push(t):(n={textureScale:o,forcePowerOfTwo:s,pixelFormat:l,pixelDatatype:c,clearColor:u,stages:[t],buffer:void 0,clear:void 0},d.push(n)),n}function createFramebuffers$3(e,t){var i=getDependencies(e._collection,t);for(var r in i)i.hasOwnProperty(r)&&(e._stageNameToFramebuffer[r]=getFramebuffer(e,r,i[r]))}function releaseResources$1(e){for(var t=e._framebuffers,i=t.length,r=0;r<i;++r){var n=t[r];n.buffer=n.buffer&&n.buffer.destroy(),n.buffer=void 0}}function updateFramebuffers$3(e,t){for(var i=e._width,r=e._height,n=e._framebuffers,a=n.length,o=0;o<a;++o){var s=n[o],l=s.textureScale,c=Math.ceil(i*l),u=Math.ceil(r*l),d=Math.min(c,u);s.forcePowerOfTwo&&(CesiumMath.isPowerOfTwo(d)||(d=CesiumMath.nextPowerOfTwo(d)),u=c=d),s.buffer=new Framebuffer({context:t,colorTextures:[new Texture({context:t,width:c,height:u,pixelFormat:s.pixelFormat,pixelDatatype:s.pixelDatatype})]}),s.clear=new ClearCommand({color:s.clearColor,framebuffer:s.buffer})}}PostProcessStageLibrary.createFXAAStage=function(){return new PostProcessStage({name:"czm_FXAA",fragmentShader:fxaaFS,sampleMode:PostProcessStageSampleMode.LINEAR})},PostProcessStageLibrary.createAcesTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_aces",fragmentShader:t+=AcesTonemapping,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createFilmicTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_filmic",fragmentShader:t+=FilmicTonemapping,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createReinhardTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_reinhard",fragmentShader:t+=ReinhardTonemapping,uniforms:{autoExposure:void 0}})},PostProcessStageLibrary.createModifiedReinhardTonemappingStage=function(e){var t=e?"#define AUTO_EXPOSURE\n":"";return new PostProcessStage({name:"czm_modified_reinhard",fragmentShader:t+=ModifiedReinhardTonemapping,uniforms:{white:Color.WHITE,autoExposure:void 0}})},PostProcessStageLibrary.createAutoExposureStage=function(){return new AutoExposure},PostProcessStageLibrary.createBlackAndWhiteStage=function(){return new PostProcessStage({name:"czm_black_and_white",fragmentShader:BlackAndWhite,uniforms:{gradations:5}})},PostProcessStageLibrary.createBrightnessStage=function(){return new PostProcessStage({name:"czm_brightness",fragmentShader:Brightness,uniforms:{brightness:.5}})},PostProcessStageLibrary.createNightVisionStage=function(){return new PostProcessStage({name:"czm_night_vision",fragmentShader:NightVision})},PostProcessStageLibrary.createDepthViewStage=function(){return new PostProcessStage({name:"czm_depth_view",fragmentShader:DepthView})},PostProcessStageLibrary.createLensFlareStage=function(){return new PostProcessStage({name:"czm_lens_flare",fragmentShader:LensFlare,uniforms:{dirtTexture:buildModuleUrl("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:buildModuleUrl("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:Ellipsoid.WGS84.maximumRadius}})},PostProcessStageTextureCache.prototype.updateDependencies=function(){this._updateDependencies=!0},PostProcessStageTextureCache.prototype.update=function(e){var t=this._collection,i=this._updateDependencies,r=defined(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),n=defined(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),a=defined(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),o=defined(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),s=!defined(t._activeStages)||0<t._activeStages.length||r||n||a||o;if((i||!s&&0<this._framebuffers.length)&&(releaseResources$1(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),i||s){0===this._framebuffers.length&&createFramebuffers$3(this,e);var l=e.drawingBufferWidth,c=e.drawingBufferHeight,u=this._width!==l||this._height!==c;(i||u)&&(this._width=l,this._height=c,this._updateDependencies=!1,releaseResources$1(this),updateFramebuffers$3(this,e))}},PostProcessStageTextureCache.prototype.clear=function(e){for(var t=this._framebuffers,i=0;i<t.length;++i)t[i].clear.execute(e)},PostProcessStageTextureCache.prototype.getStageByName=function(e){return this._collection.getStageByName(e)},PostProcessStageTextureCache.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)},PostProcessStageTextureCache.prototype.getFramebuffer=function(e){var t=this._stageNameToFramebuffer[e];if(defined(t))return t.buffer},PostProcessStageTextureCache.prototype.isDestroyed=function(){return!1},PostProcessStageTextureCache.prototype.destroy=function(){return releaseResources$1(this),destroyObject(this)};var Tonemapper={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Tonemapper.REINHARD||e===Tonemapper.MODIFIED_REINHARD||e===Tonemapper.FILMIC||e===Tonemapper.ACES}},Tonemapper$1=freezeObject$1(Tonemapper),stackScratch=[];function PostProcessStageCollection(){var e=PostProcessStageLibrary.createFXAAStage(),t=PostProcessStageLibrary.createAmbientOcclusionStage(),i=PostProcessStageLibrary.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=PostProcessStageLibrary.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Tonemapper$1.ACES;var r=this._tonemapping;e.enabled=!1,t.enabled=!1,i.enabled=!1,r.enabled=!1;var n=new PostProcessStageTextureCache(this),a={},o=stackScratch;for(o.push(e,t,i,r);0<o.length;){var s=o.pop();(a[s.name]=s)._textureCache=n;var l=s.length;if(defined(l))for(var c=0;c<l;++c)o.push(s.get(c))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;var u=this;t.uniforms.randomTexture=function(){return u._randomTexture},this._ao=t,this._bloom=i,this._fxaa=e,this._lastLength=void 0,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=a,this._textureCache=n}function removeStages(e){if(e._stagesRemoved){e._stagesRemoved=!1;for(var t=[],i=e._stages,r=i.length,n=0,a=0;n<r;++n){var o=i[n];o&&(o._index=a++,t.push(o))}e._stages=t}}function getOutputTexture(e){for(;defined(e.length);)e=e.get(e.length-1);return e.outputTexture}function execute(e,t,i,r,n){if(defined(e.execute))e.execute(t,i,r,n);else{var a,o=e.length;if(e.inputPreviousStageTexture)for(execute(e.get(0),t,i,r,n),a=1;a<o;++a)execute(e.get(a),t,getOutputTexture(e.get(a-1)),r,n);else for(a=0;a<o;++a)execute(e.get(a),t,i,r,n)}}function QuadtreeTileProvider(){DeveloperError.throwInstantiationError()}function SceneTransitioner(e){this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}defineProperties$1(PostProcessStageCollection.prototype,{ready:{get:function(){for(var e=!1,t=this._stages,i=t.length-1;0<=i;--i){var r=t[i];e=e||r.ready&&r.enabled}var n=this._fxaa,a=this._ao,o=this._bloom,s=this._tonemapping;return e=(e=(e=(e=e||n.ready&&n.enabled)||a.ready&&a.enabled)||o.ready&&o.enabled)||s.ready&&s.enabled}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return removeStages(this),this._stages.length}},outputTexture:{get:function(){var e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);for(var t=this._stages,i=t.length-1;0<=i;--i){var r=t[i];if(defined(r)&&r.ready&&r.enabled)return this.getOutputTexture(r.name)}var n=this._tonemapping;if(n.enabled&&n.ready)return this.getOutputTexture(n.name);var a=this._bloom;if(a.enabled&&a.ready)return this.getOutputTexture(a.name);var o=this._ao;return o.enabled&&o.ready?this.getOutputTexture(o.name):void 0}},hasSelected:{get:function(){for(var e=arraySlice(this._stages);0<e.length;){var t=e.pop();if(defined(t)){if(defined(t.selected))return!0;var i=t.length;if(defined(i))for(var r=0;r<i;++r)e.push(t.get(r))}}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper!==e){defined(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());var t,i=this._autoExposureEnabled;switch(e){case Tonemapper$1.REINHARD:t=PostProcessStageLibrary.createReinhardTonemappingStage(i);break;case Tonemapper$1.MODIFIED_REINHARD:t=PostProcessStageLibrary.createModifiedReinhardTonemappingStage(i);break;case Tonemapper$1.FILMIC:t=PostProcessStageLibrary.createFilmicTonemappingStage(i);break;default:t=PostProcessStageLibrary.createAcesTonemappingStage(i)}if(i){var r=this._autoExposure;t.uniforms.autoExposure=function(){return r.outputTexture}}this._tonemapper=e,this._tonemapping=t,defined(this._stageNames)&&((this._stageNames[t.name]=t)._textureCache=this._textureCache),this._textureCacheDirty=!0}}}}),PostProcessStageCollection.prototype.add=function(e){var t=this._stageNames,i=stackScratch;for(i.push(e);0<i.length;){var r=i.pop();(t[r.name]=r)._textureCache=this._textureCache;var n=r.length;if(defined(n))for(var a=0;a<n;++a)i.push(r.get(a))}var o=this._stages;return e._index=o.length,o.push(e),this._textureCacheDirty=!0,e},PostProcessStageCollection.prototype.remove=function(e){if(!this.contains(e))return!1;var t=this._stageNames,i=stackScratch;for(i.push(e);0<i.length;){var r=i.pop();delete t[r.name];var n=r.length;if(defined(n))for(var a=0;a<n;++a)i.push(r.get(a))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0},PostProcessStageCollection.prototype.contains=function(e){return defined(e)&&defined(e._index)&&e._textureCache===this._textureCache},PostProcessStageCollection.prototype.get=function(e){return removeStages(this),this._stages[e]},PostProcessStageCollection.prototype.removeAll=function(){for(var e=this._stages,t=e.length,i=0;i<t;++i)this.remove(e[i]);e.length=0},PostProcessStageCollection.prototype.getStageByName=function(e){return this._stageNames[e]},PostProcessStageCollection.prototype.update=function(e,t,i){removeStages(this);var r=this._activeStages,n=this._activeStages=this._previousActiveStages;this._previousActiveStages=r;var a,o,s=this._stages,l=n.length=s.length,c=0;for(a=0;a<l;++a)(o=s[a]).ready&&o.enabled&&o._isSupported(e)&&(n[c++]=o);var u=(n.length=c)!==r.length;if(!u)for(a=0;a<c;++a)if(n[a]!==r[a]){u=!0;break}var d=this._ao,h=this._bloom,p=this._autoExposure,m=this._tonemapping,f=this._fxaa;m.enabled=i;var g=d.enabled&&d._isSupported(e),_=h.enabled&&h._isSupported(e),y=m.enabled&&m._isSupported(e),v=f.enabled&&f._isSupported(e);if((u||this._textureCacheDirty||c!==this._lastLength||g!==this._aoEnabled||_!==this._bloomEnabled||y!==this._tonemappingEnabled||v!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._lastLength=c,this._aoEnabled=g,this._bloomEnabled=_,this._tonemappingEnabled=y,this._fxaaEnabled=v,this._textureCacheDirty=!1),defined(this._randomTexture)&&!g&&(this._randomTexture.destroy(),this._randomTexture=void 0),!defined(this._randomTexture)&&g){l=196608;var C=new Uint8Array(l);for(a=0;a<l;a+=3)C[a]=Math.floor(255*Math.random());this._randomTexture=new Texture({context:e,pixelFormat:PixelFormat$1.RGB,pixelDatatype:PixelDatatype$1.UNSIGNED_BYTE,source:{arrayBufferView:C,width:256,height:256},sampler:new Sampler({wrapS:TextureWrap$1.REPEAT,wrapT:TextureWrap$1.REPEAT,minificationFilter:TextureMinificationFilter$1.NEAREST,magnificationFilter:TextureMagnificationFilter$1.NEAREST})})}for(this._textureCache.update(e),f.update(e,t),d.update(e,t),h.update(e,t),m.update(e,t),this._autoExposureEnabled&&p.update(e,t),l=s.length,a=0;a<l;++a)s[a].update(e,t)},PostProcessStageCollection.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)},PostProcessStageCollection.prototype.getOutputTexture=function(e){var t=this.getStageByName(e);if(defined(t))return getOutputTexture(t)},PostProcessStageCollection.prototype.execute=function(e,t,i,r){var n=this._activeStages,a=n.length,o=this._fxaa,s=this._ao,l=this._bloom,c=this._autoExposure,u=this._tonemapping,d=s.enabled&&s._isSupported(e),h=l.enabled&&l._isSupported(e),p=this._autoExposureEnabled,m=u.enabled&&u._isSupported(e),f=o.enabled&&o._isSupported(e);if(f||d||h||m||0!==a){var g=t;d&&s.ready&&(execute(s,e,g,i,r),g=getOutputTexture(s)),h&&l.ready&&(execute(l,e,g,i,r),g=getOutputTexture(l)),p&&c.ready&&execute(c,e,g,i,r),m&&u.ready&&(execute(u,e,g,i,r),g=getOutputTexture(u));var _=g;if(0<a){execute(n[0],e,g,i,r);for(var y=1;y<a;++y)execute(n[y],e,getOutputTexture(n[y-1]),i,r);_=getOutputTexture(n[a-1])}f&&o.ready&&execute(o,e,_,i,r)}},PostProcessStageCollection.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){var i=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return i.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},PostProcessStageCollection.prototype.isDestroyed=function(){return!1},PostProcessStageCollection.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(),destroyObject(this)},QuadtreeTileProvider.computeDefaultLevelZeroMaximumGeometricError=function(e){return 2*e.ellipsoid.maximumRadius*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))},defineProperties$1(QuadtreeTileProvider.prototype,{quadtree:{get:DeveloperError.throwInstantiationError,set:DeveloperError.throwInstantiationError},ready:{get:DeveloperError.throwInstantiationError},tilingScheme:{get:DeveloperError.throwInstantiationError},errorEvent:{get:DeveloperError.throwInstantiationError}}),QuadtreeTileProvider.prototype.update=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.beginUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.endUpdate=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.getLevelMaximumGeometricError=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.loadTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeTileVisibility=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.showTileThisFrame=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.computeDistanceToTile=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.isDestroyed=DeveloperError.throwInstantiationError,QuadtreeTileProvider.prototype.destroy=DeveloperError.throwInstantiationError,SceneTransitioner.prototype.completeMorph=function(){defined(this._completeMorph)&&this._completeMorph()},SceneTransitioner.prototype.morphTo2D=function(e,t){defined(this._completeMorph)&&this._completeMorph();var i=this._scene;this._previousMode=i.mode,this._morphToOrthographic=i.camera.frustum instanceof OrthographicFrustum,this._previousMode!==SceneMode$1.SCENE2D&&this._previousMode!==SceneMode$1.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE2D,!0),i._mode=SceneMode$1.MORPHING,i.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.COLUMBUS_VIEW?morphFromColumbusViewTo2D(this,e):morphFrom3DTo2D(this,e,t),0===e&&defined(this._completeMorph)&&this._completeMorph())};var scratchToCVPosition=new Cartesian3,scratchToCVDirection=new Cartesian3,scratchToCVUp=new Cartesian3,scratchToCVPosition2D=new Cartesian3,scratchToCVDirection2D=new Cartesian3,scratchToCVUp2D=new Cartesian3,scratchToCVSurfacePosition=new Cartesian3,scratchToCVCartographic=new Cartographic,scratchToCVToENU=new Matrix4,scratchToCVFrustumPerspective=new PerspectiveFrustum,scratchToCVFrustumOrthographic=new OrthographicFrustum,scratchToCVCamera={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};SceneTransitioner.prototype.morphToColumbusView=function(e,t){defined(this._completeMorph)&&this._completeMorph();var i=this._scene;if(this._previousMode=i.mode,this._previousMode!==SceneMode$1.COLUMBUS_VIEW&&this._previousMode!==SceneMode$1.MORPHING){this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.COLUMBUS_VIEW,!0),i.camera._setTransform(Matrix4.IDENTITY);var r,n=scratchToCVPosition,a=scratchToCVDirection,o=scratchToCVUp;if(0<e)n.x=0,n.y=-1,n.z=1,n=Cartesian3.multiplyByScalar(Cartesian3.normalize(n,n),5*t.maximumRadius,n),Cartesian3.negate(Cartesian3.normalize(n,a),a),Cartesian3.cross(Cartesian3.UNIT_X,a,o);else{var s=i.camera;if(this._previousMode===SceneMode$1.SCENE2D)Cartesian3.clone(s.position,n),n.z=s.frustum.right-s.frustum.left,Cartesian3.negate(Cartesian3.UNIT_Z,a),Cartesian3.clone(Cartesian3.UNIT_Y,o);else{Cartesian3.clone(s.positionWC,n),Cartesian3.clone(s.directionWC,a),Cartesian3.clone(s.upWC,o);var l=t.scaleToGeodeticSurface(n,scratchToCVSurfacePosition),c=Transforms.eastNorthUpToFixedFrame(l,t,scratchToCVToENU);Matrix4.inverseTransformation(c,c),i.mapProjection.project(t.cartesianToCartographic(n,scratchToCVCartographic),n),Matrix4.multiplyByPointAsVector(c,a,a),Matrix4.multiplyByPointAsVector(c,o,o)}}this._morphToOrthographic?((r=scratchToCVFrustumOrthographic).width=i.camera.frustum.right-i.camera.frustum.left,r.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight):((r=scratchToCVFrustumPerspective).aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,r.fov=CesiumMath.toRadians(60));var u=scratchToCVCamera;u.position=n,u.direction=a,u.up=o,u.frustum=r;var d=completeColumbusViewCallback(u);createMorphHandler(this,d),this._previousMode===SceneMode$1.SCENE2D?morphFrom2DToColumbusView(this,e,u,d):(u.position2D=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,n,scratchToCVPosition2D),u.direction2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a,scratchToCVDirection2D),u.up2D=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,o,scratchToCVUp2D),i._mode=SceneMode$1.MORPHING,morphFrom3DToColumbusView(this,e,u,d)),0===e&&defined(this._completeMorph)&&this._completeMorph()}};var scratchCVTo3DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch2DTo3DFrustumPersp=new PerspectiveFrustum;function createMorphHandler(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new ScreenSpaceEventHandler(e._scene.canvas);var i=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=i,e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.LEFT_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.MIDDLE_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.RIGHT_DOWN),e._morphHandler.setInputAction(i,ScreenSpaceEventType$1.WHEEL)}}function destroyMorphHandler(e){for(var t=e._currentTweens,i=0;i<t.length;++i)t[i].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}SceneTransitioner.prototype.morphTo3D=function(e,t){defined(this._completeMorph)&&this._completeMorph();var i=this._scene;if(this._previousMode=i.mode,this._previousMode!==SceneMode$1.SCENE3D&&this._previousMode!==SceneMode$1.MORPHING){if(this._scene.morphStart.raiseEvent(this,this._previousMode,SceneMode$1.SCENE3D,!0),i._mode=SceneMode$1.MORPHING,i.camera._setTransform(Matrix4.IDENTITY),this._previousMode===SceneMode$1.SCENE2D)morphFrom2DTo3D(this,e,t);else{var r,n;0<e?(r=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*t.maximumRadius,t,r.position),Cartesian3.negate(r.position,r.direction),Cartesian3.normalize(r.direction,r.direction),Cartesian3.clone(Cartesian3.UNIT_Z,r.up)):r=getColumbusViewTo3DCamera(this,t);var a=i.camera;a.frustum instanceof OrthographicFrustum?n=a.frustum.clone():((n=scratch2DTo3DFrustumPersp).aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,n.fov=CesiumMath.toRadians(60)),r.frustum=n;var o=complete3DCallback(r);createMorphHandler(this,o),morphFromColumbusViewTo3D(this,e,r,o)}0===e&&defined(this._completeMorph)&&this._completeMorph()}},SceneTransitioner.prototype.isDestroyed=function(){return!1},SceneTransitioner.prototype.destroy=function(){return destroyMorphHandler(this),destroyObject(this)};var scratchCVTo3DCartographic=new Cartographic,scratchCVTo3DSurfacePoint=new Cartesian3,scratchCVTo3DFromENU=new Matrix4;function getColumbusViewTo3DCamera(e,t){var i=e._scene,r=i.camera,n=scratchCVTo3DCamera,a=n.position,o=n.direction,s=n.up,l=i.mapProjection.unproject(r.position,scratchCVTo3DCartographic);t.cartographicToCartesian(l,a);var c=t.scaleToGeodeticSurface(a,scratchCVTo3DSurfacePoint),u=Transforms.eastNorthUpToFixedFrame(c,t,scratchCVTo3DFromENU);return Matrix4.multiplyByPointAsVector(u,r.direction,o),Matrix4.multiplyByPointAsVector(u,r.up,s),n}var scratchCVTo3DStartPos=new Cartesian3,scratchCVTo3DStartDir=new Cartesian3,scratchCVTo3DStartUp=new Cartesian3,scratchCVTo3DEndPos=new Cartesian3,scratchCVTo3DEndDir=new Cartesian3,scratchCVTo3DEndUp=new Cartesian3;function morphFromColumbusViewTo3D(e,t,i,r){t*=.5;var n=e._scene,a=n.camera,o=Cartesian3.clone(a.position,scratchCVTo3DStartPos),s=Cartesian3.clone(a.direction,scratchCVTo3DStartDir),l=Cartesian3.clone(a.up,scratchCVTo3DStartUp),c=Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,i.position,scratchCVTo3DEndPos),u=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,i.direction,scratchCVTo3DEndDir),d=Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D_INVERSE,i.up,scratchCVTo3DEndUp);var h=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(o,c,e.time,a.position),columbusViewMorph(s,u,e.time,a.direction),columbusViewMorph(l,d,e.time,a.up),Cartesian3.cross(a.direction,a.up,a.right),Cartesian3.normalize(a.right,a.right)},complete:function(){addMorphTimeAnimations(e,n,0,1,t,r)}});e._currentTweens.push(h)}var scratch2DTo3DFrustumOrtho=new OrthographicFrustum,scratch3DToCVStartPos=new Cartesian3,scratch3DToCVStartDir=new Cartesian3,scratch3DToCVStartUp=new Cartesian3,scratch3DToCVEndPos=new Cartesian3,scratch3DToCVEndDir=new Cartesian3,scratch3DToCVEndUp=new Cartesian3;function morphFrom2DTo3D(e,t,i){t/=3;var r,n,a=e._scene,o=a.camera;0<t?(r=scratchCVTo3DCamera,Cartesian3.fromDegrees(0,0,5*i.maximumRadius,i,r.position),Cartesian3.negate(r.position,r.direction),Cartesian3.normalize(r.direction,r.direction),Cartesian3.clone(Cartesian3.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=getColumbusViewTo3DCamera(e,i)),e._morphToOrthographic?((n=scratch2DTo3DFrustumOrtho).aspectRatio=a.drawingBufferWidth/a.drawingBufferHeight,n.width=o.frustum.right-o.frustum.left):((n=scratch2DTo3DFrustumPersp).aspectRatio=a.drawingBufferWidth/a.drawingBufferHeight,n.fov=CesiumMath.toRadians(60)),r.frustum=n;var s,l=complete3DCallback(r);createMorphHandler(e,l),s=e._morphToOrthographic?function(){morphFromColumbusViewTo3D(e,t,r,l)}:function(){morphOrthographicToPerspective(e,t,r,function(){morphFromColumbusViewTo3D(e,t,r,l)})},0<t?(a._mode=SceneMode$1.SCENE2D,o.flyTo({duration:t,destination:Cartesian3.fromDegrees(0,0,5*i.maximumRadius,i,scratch3DToCVEndPos),complete:function(){a._mode=SceneMode$1.MORPHING,s()}})):s()}function columbusViewMorph(e,t,i,r){return Cartesian3.lerp(e,t,i,r)}function morphPerspectiveToOrthographic(e,t,i,r,n){var a=e._scene,o=a.camera;if(!(o.frustum instanceof OrthographicFrustum)){var s=o.frustum.fov,l=.5*CesiumMath.RADIANS_PER_DEGREE,c=i.position.z*Math.tan(.5*s);o.frustum.far=c/Math.tan(.5*l)+1e7;var u=a.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){o.frustum.fov=CesiumMath.lerp(s,l,e.time);var t=c/Math.tan(.5*o.frustum.fov);r(o,t)},complete:function(){o.frustum=i.frustum.clone(),n(e)}});e._currentTweens.push(u)}}var scratchCVTo2DStartPos=new Cartesian3,scratchCVTo2DStartDir=new Cartesian3,scratchCVTo2DStartUp=new Cartesian3,scratchCVTo2DEndPos=new Cartesian3,scratchCVTo2DEndDir=new Cartesian3,scratchCVTo2DEndUp=new Cartesian3,scratchCVTo2DFrustum=new OrthographicOffCenterFrustum,scratchCVTo2DRay=new Ray,scratchCVTo2DPickPos=new Cartesian3,scratchCVTo2DCamera={position:void 0,direction:void 0,up:void 0,frustum:void 0};function morphFromColumbusViewTo2D(e,t){t*=.5;var i=e._scene,r=i.camera,n=Cartesian3.clone(r.position,scratchCVTo2DStartPos),a=Cartesian3.clone(r.direction,scratchCVTo2DStartDir),o=Cartesian3.clone(r.up,scratchCVTo2DStartUp),s=Cartesian3.negate(Cartesian3.UNIT_Z,scratchCVTo2DEndDir),l=Cartesian3.clone(Cartesian3.UNIT_Y,scratchCVTo2DEndUp),c=scratchCVTo2DEndPos;if(0<t)Cartesian3.clone(Cartesian3.ZERO,scratchCVTo2DEndPos),c.z=5*i.mapProjection.ellipsoid.maximumRadius;else{Cartesian3.clone(n,scratchCVTo2DEndPos);var u=scratchCVTo2DRay;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,n,u.origin),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a,u.direction);var d=i.globe;if(defined(d)){var h=d.pickWorldCoordinates(u,i,scratchCVTo2DPickPos);defined(h)&&(Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,h,c),c.z+=Cartesian3.distance(n,c))}}var p=scratchCVTo2DFrustum;p.right=.5*c.z,p.left=-p.right,p.top=p.right*(i.drawingBufferHeight/i.drawingBufferWidth),p.bottom=-p.top;var m=scratchCVTo2DCamera;m.position=c,m.direction=s,m.up=l,m.frustum=p;var f=complete2DCallback(m);function g(e,t){e.position.z=t}createMorphHandler(e,f);var _=i.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(n,c,e.time,r.position),columbusViewMorph(a,s,e.time,r.direction),columbusViewMorph(o,l,e.time,r.up),Cartesian3.cross(r.direction,r.up,r.right),Cartesian3.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)},complete:function(){morphPerspectiveToOrthographic(e,t,m,g,f)}});e._currentTweens.push(_)}var scratch3DTo2DCartographic=new Cartographic,scratch3DTo2DCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,position2D:new Cartesian3,direction2D:new Cartesian3,up2D:new Cartesian3,frustum:new OrthographicOffCenterFrustum},scratch3DTo2DEndCamera={position:new Cartesian3,direction:new Cartesian3,up:new Cartesian3,frustum:void 0},scratch3DTo2DPickPosition=new Cartesian3,scratch3DTo2DRay=new Ray,scratch3DTo2DToENU=new Matrix4,scratch3DTo2DSurfacePoint=new Cartesian3;function morphFrom3DTo2D(e,t,i){t*=.5;var r=e._scene,n=r.camera,a=scratch3DTo2DCamera;if(0<t)Cartesian3.clone(Cartesian3.ZERO,a.position),a.position.z=5*i.maximumRadius,Cartesian3.negate(Cartesian3.UNIT_Z,a.direction),Cartesian3.clone(Cartesian3.UNIT_Y,a.up);else{i.cartesianToCartographic(n.positionWC,scratch3DTo2DCartographic),r.mapProjection.project(scratch3DTo2DCartographic,a.position),Cartesian3.negate(Cartesian3.UNIT_Z,a.direction),Cartesian3.clone(Cartesian3.UNIT_Y,a.up);var o=scratch3DTo2DRay;Cartesian3.clone(a.position2D,o.origin);var s=Cartesian3.clone(n.directionWC,o.direction),l=i.scaleToGeodeticSurface(n.positionWC,scratch3DTo2DSurfacePoint),c=Transforms.eastNorthUpToFixedFrame(l,i,scratch3DTo2DToENU);Matrix4.inverseTransformation(c,c),Matrix4.multiplyByPointAsVector(c,s,s),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,s,s);var u=r.globe;if(defined(u)){var d=u.pickWorldCoordinates(o,r,scratch3DTo2DPickPosition);if(defined(d)){var h=Cartesian3.distance(a.position2D,d);d.x+=h,Cartesian3.clone(d,a.position2D)}}}function p(e,t){e.position.x=t}Matrix4.multiplyByPoint(Camera.TRANSFORM_2D,a.position,a.position2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a.direction,a.direction2D),Matrix4.multiplyByPointAsVector(Camera.TRANSFORM_2D,a.up,a.up2D);var m=a.frustum;m.right=.5*a.position.z,m.left=-m.right,m.top=m.right*(r.drawingBufferHeight/r.drawingBufferWidth),m.bottom=-m.top;var f=scratch3DTo2DEndCamera;Matrix4.multiplyByPoint(Camera.TRANSFORM_2D_INVERSE,a.position2D,f.position),Cartesian3.clone(a.direction,f.direction),Cartesian3.clone(a.up,f.up),f.frustum=m;var g=complete2DCallback(f);createMorphHandler(e,g),morphFrom3DToColumbusView(e,t,a,function(){morphPerspectiveToOrthographic(e,t,a,p,g)})}function morphOrthographicToPerspective(e,t,i,r){var n=e._scene,a=n.camera,o=a.frustum.right-a.frustum.left;a.frustum=i.frustum.clone();var s=a.frustum.fov,l=.5*CesiumMath.RADIANS_PER_DEGREE,c=o*Math.tan(.5*s);a.frustum.far=c/Math.tan(.5*l)+1e7,a.frustum.fov=l;var u=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){a.frustum.fov=CesiumMath.lerp(l,s,e.time),a.position.z=c/Math.tan(.5*a.frustum.fov)},complete:function(){r(e)}});e._currentTweens.push(u)}function morphFrom2DToColumbusView(n,a,o,s){a*=.5;var l=n._scene,c=l.camera,u=Cartesian3.clone(o.position,scratch3DToCVEndPos),d=Cartesian3.clone(o.direction,scratch3DToCVEndDir),h=Cartesian3.clone(o.up,scratch3DToCVEndUp);function e(){c.frustum=o.frustum.clone();var t=Cartesian3.clone(c.position,scratch3DToCVStartPos),i=Cartesian3.clone(c.direction,scratch3DToCVStartDir),r=Cartesian3.clone(c.up,scratch3DToCVStartUp);t.z=u.z;var e=l.tweens.add({duration:a,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(t,u,e.time,c.position),columbusViewMorph(i,d,e.time,c.direction),columbusViewMorph(r,h,e.time,c.up),Cartesian3.cross(c.direction,c.up,c.right),Cartesian3.normalize(c.right,c.right)},complete:function(){s(n)}});n._currentTweens.push(e)}l._mode=SceneMode$1.MORPHING,n._morphToOrthographic?e():morphOrthographicToPerspective(n,0,o,e)}function morphFrom3DToColumbusView(e,t,i,r){var n=e._scene,a=n.camera,o=Cartesian3.clone(a.position,scratch3DToCVStartPos),s=Cartesian3.clone(a.direction,scratch3DToCVStartDir),l=Cartesian3.clone(a.up,scratch3DToCVStartUp),c=Cartesian3.clone(i.position2D,scratch3DToCVEndPos),u=Cartesian3.clone(i.direction2D,scratch3DToCVEndDir),d=Cartesian3.clone(i.up2D,scratch3DToCVEndUp);var h=n.tweens.add({duration:t,easingFunction:EasingFunction$1.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){columbusViewMorph(o,c,e.time,a.position),columbusViewMorph(s,u,e.time,a.direction),columbusViewMorph(l,d,e.time,a.up),Cartesian3.cross(a.direction,a.up,a.right),Cartesian3.normalize(a.right,a.right),a._adjustOrthographicFrustum(!0)},complete:function(){addMorphTimeAnimations(e,n,1,0,t,r)}});e._currentTweens.push(h)}function addMorphTimeAnimations(e,t,i,r,n,a){var o={object:t,property:"morphTime",startValue:i,stopValue:r,duration:n,easingFunction:EasingFunction$1.QUARTIC_OUT};defined(a)&&(o.complete=function(){a(e)});var s=t.tweens.addProperty(o);e._currentTweens.push(s)}function complete3DCallback(a){return function(e){var t=e._scene;t._mode=SceneMode$1.SCENE3D,t.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE3D),destroyMorphHandler(e);var i=t.camera;e._previousMode===SceneMode$1.MORPHING&&!e._morphCancelled||(e._morphCancelled=!1,Cartesian3.clone(a.position,i.position),Cartesian3.clone(a.direction,i.direction),Cartesian3.clone(a.up,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right),i.frustum=a.frustum.clone());var r=i.frustum;t.frameState.useLogDepth&&(r.near=.1,r.far=1e10);var n=defined(e._completeMorph);e._completeMorph=void 0,t.camera.update(t.mode),e._scene.morphComplete.raiseEvent(e,e._previousMode,SceneMode$1.SCENE3D,n)}}function complete2DCallback(n){return function(e){var t=e._scene;t._mode=SceneMode$1.SCENE2D,t.morphTime=SceneMode$1.getMorphTime(SceneMode$1.SCENE2D),destroyMorphHandler(e);var i=t.camera;Cartesian3.clone(n.position,i.position),i.position.z=2*t.mapProjection.ellipsoid.maximumRadius,Cartesian3.clone(n.direction,i.direction),Cartesian3.clone(n.up,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right),i.frustum=n.frustum.clone();var r=defined(e._completeMorph);e._completeMorph=void 0,t.camera.update(t.mode),e._scene.morphComplete.raiseEvent(e,e._previousMode,SceneMode$1.SCENE2D,r)}}function completeColumbusViewCallback(a){return function(e){var t=e._scene;t._mode=SceneMode$1.COLUMBUS_VIEW,t.morphTime=SceneMode$1.getMorphTime(SceneMode$1.COLUMBUS_VIEW),destroyMorphHandler(e);var i=t.camera;e._previousModeMode===SceneMode$1.MORPHING&&!e._morphCancelled||(e._morphCancelled=!1,Cartesian3.clone(a.position,i.position),Cartesian3.clone(a.direction,i.direction),Cartesian3.clone(a.up,i.up),Cartesian3.cross(i.direction,i.up,i.right),Cartesian3.normalize(i.right,i.right));var r=i.frustum;t.frameState.useLogDepth&&(r.near=.1,r.far=1e10);var n=defined(e._completeMorph);e._completeMorph=void 0,t.camera.update(t.mode),e._scene.morphComplete.raiseEvent(e,e._previousMode,SceneMode$1.COLUMBUS_VIEW,n)}}function Tween(e,t,i,r,n,a,o,s,l,c){this._tweens=e,this._tweenjs=t,this._startObject=clone(i),this._stopObject=clone(r),this._duration=n,this._delay=a,this._easingFunction=o,this._update=s,this._complete=l,this.cancel=c,this.needsStart=!0}function TweenCollection(){this._tweens=[]}function ScreenSpaceCameraController(e){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=CameraEventType$1.LEFT_DRAG,this.zoomEventTypes=[CameraEventType$1.RIGHT_DRAG,CameraEventType$1.WHEEL,CameraEventType$1.PINCH],this.rotateEventTypes=CameraEventType$1.LEFT_DRAG,this.tiltEventTypes=[CameraEventType$1.MIDDLE_DRAG,CameraEventType$1.PINCH,{eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.CTRL},{eventType:CameraEventType$1.RIGHT_DRAG,modifier:KeyboardEventModifier$1.CTRL}],this.lookEventTypes={eventType:CameraEventType$1.LEFT_DRAG,modifier:KeyboardEventModifier$1.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,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._aggregator=new CameraEventAggregator(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._tweens=new TweenCollection,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new Cartesian2(-1,-1),this._tiltCenter=new Cartesian3,this._rotateMousePosition=new Cartesian2(-1,-1),this._rotateStartPosition=new Cartesian3,this._strafeStartPosition=new Cartesian3,this._zoomMouseStart=new Cartesian2(-1,-1),this._zoomWorldPosition=new Cartesian3,this._useZoomWorldPosition=!1,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._rotatingZoom=!1;var t=e.mapProjection;this._maxCoord=t.project(new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=2e-4,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3}function decay(e,t){if(e<0)return 0;var i=25*(1-t);return Math.exp(-i*e)}function sameMousePosition(e){return Cartesian2.equalsEpsilon(e.startPosition,e.endPosition,CesiumMath.EPSILON14)}defineProperties$1(Tween.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}}}),Tween.prototype.cancelTween=function(){this._tweens.remove(this)},defineProperties$1(TweenCollection.prototype,{length:{get:function(){return this._tweens.length}}}),TweenCollection.prototype.add=function(e){if(0===(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).duration)return defined(e.complete)&&e.complete(),new Tween(this);var t=e.duration/TimeConstants$1.SECONDS_PER_MILLISECOND,i=defaultValue(e.delay,0),r=i/TimeConstants$1.SECONDS_PER_MILLISECOND,n=defaultValue(e.easingFunction,EasingFunction$1.LINEAR_NONE),a=e.startObject,o=new TWEEN.Tween(a);o.to(clone(e.stopObject),t),o.delay(r),o.easing(n),defined(e.update)&&o.onUpdate(function(){e.update(a)}),o.onComplete(defaultValue(e.complete,null)),o.repeat(defaultValue(e._repeat,0));var s=new Tween(this,o,e.startObject,e.stopObject,e.duration,i,n,e.update,e.complete,e.cancel);return this._tweens.push(s),s},TweenCollection.prototype.addProperty=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).object,i=e.property,r=e.startValue,n=e.stopValue;return this.add({startObject:{value:r},stopObject:{value:n},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){t[i]=e.value},complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},TweenCollection.prototype.addAlpha=function(e){var r=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material,n=[];for(var t in r.uniforms)r.uniforms.hasOwnProperty(t)&&defined(r.uniforms[t])&&defined(r.uniforms[t].alpha)&&n.push(t);return this.add({startObject:{alpha:defaultValue(e.startValue,0)},stopObject:{alpha:defaultValue(e.stopValue,1)},duration:defaultValue(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){for(var t=n.length,i=0;i<t;++i)r.uniforms[n[i]].alpha=e.alpha},complete:e.complete,cancel:e.cancel})},TweenCollection.prototype.addOffsetIncrement=function(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).material.uniforms;return this.addProperty({object:t,property:"offset",startValue:t.offset,stopValue:t.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},TweenCollection.prototype.remove=function(e){if(!defined(e))return!1;var t=this._tweens.indexOf(e);return-1!==t&&(e.tweenjs.stop(),defined(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0)},TweenCollection.prototype.removeAll=function(){for(var e=this._tweens,t=0;t<e.length;++t){var i=e[t];i.tweenjs.stop(),defined(i.cancel)&&i.cancel()}e.length=0},TweenCollection.prototype.contains=function(e){return defined(e)&&-1!==this._tweens.indexOf(e)},TweenCollection.prototype.get=function(e){return this._tweens[e]},TweenCollection.prototype.update=function(e){var t=this._tweens,i=0;for(e=defined(e)?e/TimeConstants$1.SECONDS_PER_MILLISECOND:getTimestamp$1();i<t.length;){var r=t[i],n=r.tweenjs;r.needsStart?(r.needsStart=!1,n.start(e)):n.update(e)?i++:(n.stop(),t.splice(i,1))}};var inertiaMaxClickTimeThreshold=.4;function maintainInertia(e,t,i,r,n,a,o){var s=a[o];defined(s)||(s=a[o]={startPosition:new Cartesian2,endPosition:new Cartesian2,motion:new Cartesian2,active:!1});var l=e.getButtonPressTime(t,i),c=e.getButtonReleaseTime(t,i),u=l&&c&&(c.getTime()-l.getTime())/1e3,d=new Date,h=c&&(d.getTime()-c.getTime())/1e3;if(l&&c&&u<inertiaMaxClickTimeThreshold){var p=decay(h,r);if(s.active)s.startPosition=Cartesian2.clone(s.endPosition,s.startPosition),s.endPosition=Cartesian2.multiplyByScalar(s.motion,p,s.endPosition),s.endPosition=Cartesian2.add(s.startPosition,s.endPosition,s.endPosition),s.motion=Cartesian2.clone(Cartesian2.ZERO,s.motion);else{var m=e.getLastMovement(t,i);if(!defined(m)||sameMousePosition(m))return;s.motion.x=.5*(m.endPosition.x-m.startPosition.x),s.motion.y=.5*(m.endPosition.y-m.startPosition.y),s.startPosition=Cartesian2.clone(m.startPosition,s.startPosition),s.endPosition=Cartesian2.multiplyByScalar(s.motion,p,s.endPosition),s.endPosition=Cartesian2.add(s.startPosition,s.endPosition,s.endPosition),s.active=!0}if(isNaN(s.endPosition.x)||isNaN(s.endPosition.y)||Cartesian2.distance(s.startPosition,s.endPosition)<.5)return void(s.active=!1);if(!e.isButtonDown(t,i))n(a,e.getStartMousePosition(t,i),s)}else s.active=!1}var scratchEventTypeArray=[];function reactToInput(e,t,i,r,n,a){if(defined(i)){var o=e._aggregator;isArray$1(i)||(scratchEventTypeArray[0]=i,i=scratchEventTypeArray);for(var s=i.length,l=0;l<s;++l){var c=i[l],u=defined(c.eventType)?c.eventType:c,d=c.modifier,h=o.isMoving(u,d)&&o.getMovement(u,d),p=o.getStartMousePosition(u,d);e.enableInputs&&t&&(h?r(e,p,h):n<1&&maintainInertia(o,u,d,n,r,e,a))}}}var scratchZoomPickRay=new Ray,scratchPickCartesian=new Cartesian3,scratchZoomOffset=new Cartesian2,scratchZoomDirection=new Cartesian3,scratchCenterPixel=new Cartesian2,scratchCenterPosition=new Cartesian3,scratchPositionNormal$2=new Cartesian3,scratchPickNormal=new Cartesian3,scratchZoomAxis=new Cartesian3,scratchCameraPositionNormal=new Cartesian3,scratchTargetNormal=new Cartesian3,scratchCameraPosition$1=new Cartesian3,scratchCameraUpNormal=new Cartesian3,scratchCameraRightNormal=new Cartesian3,scratchForwardNormal=new Cartesian3,scratchPositionToTarget=new Cartesian3,scratchPositionToTargetNormal=new Cartesian3,scratchPan=new Cartesian3,scratchCenterMovement=new Cartesian3,scratchCenter$6=new Cartesian3,scratchCartesian$9=new Cartesian3,scratchCartesianTwo=new Cartesian3,scratchCartesianThree=new Cartesian3,scratchZoomViewOptions={orientation:new HeadingPitchRoll};function handleZoom(e,t,i,r,n,a){var o=1;defined(a)&&(o=CesiumMath.clamp(Math.abs(a),.25,1));var s=e.minimumZoomDistance*o,l=e.maximumZoomDistance,c=r*(n-s);c=CesiumMath.clamp(c,e._minimumZoomRate,e._maximumZoomRate);var u=(i.endPosition.y-i.startPosition.y)/e._scene.canvas.clientHeight,d=c*(u=Math.min(u,e.maximumMovementRatio));if(!(0<d&&Math.abs(n-s)<1||d<0&&Math.abs(n-l)<1)){n-d<s?d=n-s-1:l<n-d&&(d=n-l);var h=e._scene,p=h.camera,m=h.mode,f=scratchZoomViewOptions.orientation;if(f.heading=p.heading,f.pitch=p.pitch,f.roll=p.roll,p.frustum instanceof OrthographicFrustum)0<Math.abs(d)&&(p.zoomIn(d),p._adjustOrthographicFrustum());else{var g,_=Cartesian2.equals(t,e._zoomMouseStart),y=e._zoomingOnVector,v=e._rotatingZoom;if(_||(e._zoomMouseStart=Cartesian2.clone(t,e._zoomMouseStart),defined(e._globe)&&(g=m===SceneMode$1.SCENE2D?(g=p.getPickRay(t,scratchZoomPickRay).origin,Cartesian3.fromElements(g.y,g.z,g.x)):pickGlobe(e,t,scratchPickCartesian)),defined(g)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=Cartesian3.clone(g,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,y=e._zoomingOnVector=!1,v=e._rotatingZoom=!1),e._useZoomWorldPosition){var C=m===SceneMode$1.COLUMBUS_VIEW;if(p.positionCartographic.height<2e6&&(v=!0),!_||v){if(m===SceneMode$1.SCENE2D){var S=e._zoomWorldPosition,x=p.position;if(!Cartesian3.equals(S,x)&&p.positionCartographic.height<2*e._maxCoord.x){var T=p.position.x,b=Cartesian3.subtract(S,x,scratchZoomDirection);Cartesian3.normalize(b,b);var E=Cartesian3.distance(S,x)*d/(.5*p.getMagnitude());p.move(b,.5*E),(p.position.x<0&&0<T||0<p.position.x&&T<0)&&(g=p.getPickRay(t,scratchZoomPickRay).origin,g=Cartesian3.fromElements(g.y,g.z,g.x),e._zoomWorldPosition=Cartesian3.clone(g,e._zoomWorldPosition))}}else if(m===SceneMode$1.SCENE3D){var P=Cartesian3.normalize(p.position,scratchCameraPositionNormal);if(p.positionCartographic.height<3e3&&Math.abs(Cartesian3.dot(p.direction,P))<.6)C=!0;else{var A=h.canvas,w=scratchCenterPixel;w.x=A.clientWidth/2,w.y=A.clientHeight/2;var D=pickGlobe(e,w,scratchCenterPosition);if(defined(D)&&p.positionCartographic.height<1e6){var M=scratchCameraPosition$1;Cartesian3.clone(p.position,M);var I=e._zoomWorldPosition,R=scratchTargetNormal;if(R=Cartesian3.normalize(I,R),Cartesian3.dot(R,P)<0)return;var O=scratchCenter$6,L=scratchForwardNormal;Cartesian3.clone(p.direction,L),Cartesian3.add(M,Cartesian3.multiplyByScalar(L,1e3,scratchCartesian$9),O);var F=scratchPositionToTarget,N=scratchPositionToTargetNormal;Cartesian3.subtract(I,M,F),Cartesian3.normalize(F,N);var B=Cartesian3.dot(P,N);if(0<=B)return void(e._zoomMouseStart.x=-1);var V=Math.acos(-B),k=Cartesian3.magnitude(M),$=Cartesian3.magnitude(I),z=k-d,U=Cartesian3.magnitude(F),G=Math.asin(CesiumMath.clamp(U/$*Math.sin(V),-1,1))-Math.asin(CesiumMath.clamp(z/$*Math.sin(V),-1,1))+V,H=scratchCameraUpNormal;Cartesian3.normalize(M,H);var W=scratchCameraRightNormal;W=Cartesian3.cross(N,H,W),W=Cartesian3.normalize(W,W),Cartesian3.normalize(Cartesian3.cross(H,W,scratchCartesian$9),L),Cartesian3.multiplyByScalar(Cartesian3.normalize(O,scratchCartesian$9),Cartesian3.magnitude(O)-d,O),Cartesian3.normalize(M,M),Cartesian3.multiplyByScalar(M,z,M);var q=scratchPan;Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(H,Math.cos(G)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(L,Math.sin(G),scratchCartesianThree),scratchCartesian$9),z,q),Cartesian3.add(M,q,M),Cartesian3.normalize(O,H),Cartesian3.normalize(Cartesian3.cross(H,W,scratchCartesian$9),L);var j=scratchCenterMovement;return Cartesian3.multiplyByScalar(Cartesian3.add(Cartesian3.multiplyByScalar(H,Math.cos(G)-1,scratchCartesianTwo),Cartesian3.multiplyByScalar(L,Math.sin(G),scratchCartesianThree),scratchCartesian$9),Cartesian3.magnitude(O),j),Cartesian3.add(O,j,O),Cartesian3.clone(M,p.position),Cartesian3.normalize(Cartesian3.subtract(O,M,scratchCartesian$9),p.direction),Cartesian3.clone(p.direction,p.direction),Cartesian3.cross(p.direction,p.up,p.right),Cartesian3.cross(p.right,p.direction,p.up),void p.setView(scratchZoomViewOptions)}if(defined(D)){var Y=Cartesian3.normalize(D,scratchPositionNormal$2),X=Cartesian3.normalize(e._zoomWorldPosition,scratchPickNormal),Q=Cartesian3.dot(X,Y);if(0<Q&&Q<1){var J=CesiumMath.acosClamped(Q),Z=Cartesian3.cross(X,Y,scratchZoomAxis),K=d/(Math.abs(J)>CesiumMath.toRadians(20)?.75*p.positionCartographic.height:p.positionCartographic.height-d);p.rotate(Z,J*K)}}else C=!0}}e._rotatingZoom=!C}if(!_&&C||y){var ee=SceneTransforms.wgs84ToWindowCoordinates(h,e._zoomWorldPosition,scratchZoomOffset),te=(m!==SceneMode$1.COLUMBUS_VIEW&&Cartesian2.equals(t,e._zoomMouseStart)&&defined(ee)?p.getPickRay(ee,scratchZoomPickRay):p.getPickRay(t,scratchZoomPickRay)).direction;m!==SceneMode$1.COLUMBUS_VIEW&&m!==SceneMode$1.SCENE2D||Cartesian3.fromElements(te.y,te.z,te.x,te),p.move(te,d),e._zoomingOnVector=!0}else p.zoomIn(d);p.setView(scratchZoomViewOptions)}else p.zoomIn(d)}}}var translate2DStart=new Ray,translate2DEnd=new Ray,scratchTranslateP0=new Cartesian3;function translate2D(e,t,i){var r=e._scene.camera,n=r.getPickRay(i.startPosition,translate2DStart).origin,a=r.getPickRay(i.endPosition,translate2DEnd).origin;n=Cartesian3.fromElements(n.y,n.z,n.x,n),a=Cartesian3.fromElements(a.y,a.z,a.x,a);var o=Cartesian3.subtract(n,a,scratchTranslateP0),s=Cartesian3.magnitude(o);0<s&&(Cartesian3.normalize(o,o),r.move(o,s))}function zoom2D$1(e,t,i){defined(i.distance)&&(i=i.distance);var r=e._scene.camera;handleZoom(e,t,i,e._zoomFactor,r.getMagnitude())}var twist2DStart=new Cartesian2,twist2DEnd=new Cartesian2;function twist2D(e,t,i){if(defined(i.angleAndHeight))singleAxisTwist2D(e,t,i.angleAndHeight);else{var r=e._scene,n=r.camera,a=r.canvas,o=a.clientWidth,s=a.clientHeight,l=twist2DStart;l.x=2/o*i.startPosition.x-1,l.y=2/s*(s-i.startPosition.y)-1,l=Cartesian2.normalize(l,l);var c=twist2DEnd;c.x=2/o*i.endPosition.x-1,c.y=2/s*(s-i.endPosition.y)-1,c=Cartesian2.normalize(c,c);var u=CesiumMath.acosClamped(l.x);l.y<0&&(u=CesiumMath.TWO_PI-u);var d=CesiumMath.acosClamped(c.x);c.y<0&&(d=CesiumMath.TWO_PI-d);var h=d-u;n.twistRight(h)}}function singleAxisTwist2D(e,t,i){var r=e._rotateFactor*e._rotateRateRangeAdjustment;r>e._maximumRotateRate&&(r=e._maximumRotateRate),r<e._minimumRotateRate&&(r=e._minimumRotateRate);var n=e._scene,a=n.camera,o=n.canvas,s=(i.endPosition.x-i.startPosition.x)/o.clientWidth,l=r*(s=Math.min(s,e.maximumMovementRatio))*Math.PI*4;a.twistRight(l)}function update2D(e){var t=e._scene.mapMode2D===MapMode2D$1.ROTATE;Matrix4.equals(Matrix4.IDENTITY,e._scene.camera.transform)?(reactToInput(e,e.enableTranslate,e.translateEventTypes,translate2D,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D$1,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.tiltEventTypes,twist2D,e.inertiaSpin,"_lastInertiaTiltMovement")):(reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom2D$1,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&reactToInput(e,e.enableRotate,e.translateEventTypes,twist2D,e.inertiaSpin,"_lastInertiaSpinMovement"))}var pickGlobeScratchRay$1=new Ray,scratchDepthIntersection$1=new Cartesian3,scratchRayIntersection$1=new Cartesian3;function pickGlobe(e,t,i){var r=e._scene,n=e._globe,a=r.camera;if(defined(n)){var o;r.pickPositionSupported&&(o=r.pickPositionWorldCoordinates(t,scratchDepthIntersection$1));var s=a.getPickRay(t,pickGlobeScratchRay$1),l=n.pickWorldCoordinates(s,r,scratchRayIntersection$1);return(defined(o)?Cartesian3.distance(o,a.positionWC):Number.POSITIVE_INFINITY)<(defined(l)?Cartesian3.distance(l,a.positionWC):Number.POSITIVE_INFINITY)?Cartesian3.clone(o,i):Cartesian3.clone(l,i)}}var translateCVStartRay=new Ray,translateCVEndRay=new Ray,translateCVStartPos=new Cartesian3,translateCVEndPos=new Cartesian3,translatCVDifference=new Cartesian3,translateCVOrigin=new Cartesian3,translateCVPlane=new Plane(Cartesian3.UNIT_X,0),translateCVStartMouse=new Cartesian2,translateCVEndMouse=new Cartesian2;function translateCV(e,t,i){if(Cartesian3.equals(t,e._translateMousePosition)||(e._looking=!1),Cartesian3.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking)look3D(e,t,i);else if(e._strafing)strafe(e,t,i);else{var r,n=e._scene.camera,a=Cartesian2.clone(i.startPosition,translateCVStartMouse),o=Cartesian2.clone(i.endPosition,translateCVEndMouse),s=n.getPickRay(a,translateCVStartRay),l=Cartesian3.clone(Cartesian3.ZERO,translateCVOrigin),c=Cartesian3.UNIT_X;if(n.position.z<e._minimumPickingTerrainHeight&&defined(r=pickGlobe(e,a,translateCVStartPos))&&(l.x=r.x),l.x>n.position.z&&defined(r))return Cartesian3.clone(r,e._strafeStartPosition),e._strafing=!0,strafe(e,t,i),void(e._strafeMousePosition=Cartesian2.clone(t,e._strafeMousePosition));var u=Plane.fromPointNormal(l,c,translateCVPlane);s=n.getPickRay(a,translateCVStartRay);var d=IntersectionTests.rayPlane(s,u,translateCVStartPos),h=n.getPickRay(o,translateCVEndRay),p=IntersectionTests.rayPlane(h,u,translateCVEndPos);if(!defined(d)||!defined(p))return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._translateMousePosition);var m=Cartesian3.subtract(d,p,translatCVDifference),f=m.x;m.x=m.y,m.y=m.z,m.z=f;var g=Cartesian3.magnitude(m);g>CesiumMath.EPSILON6&&(Cartesian3.normalize(m,m),n.move(m,g))}}var rotateCVWindowPos=new Cartesian2,rotateCVWindowRay=new Ray,rotateCVCenter=new Cartesian3,rotateCVVerticalCenter=new Cartesian3,rotateCVTransform=new Matrix4,rotateCVVerticalTransform=new Matrix4,rotateCVOrigin=new Cartesian3,rotateCVPlane=new Plane(Cartesian3.UNIT_X,0),rotateCVCartesian3=new Cartesian3,rotateCVCart=new Cartographic,rotateCVOldTransform=new Matrix4,rotateCVQuaternion=new Quaternion,rotateCVMatrix=new Matrix3,tilt3DCartesian3=new Cartesian3;function rotateCV(e,t,i){if(defined(i.angleAndHeight)&&(i=i.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking)look3D(e,t,i);else{var r=e._scene.camera,n=e._maxCoord,a=Math.abs(r.position.x)-n.x<0&&Math.abs(r.position.y)-n.y<0;e._tiltCVOffMap||!a||r.position.z>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,rotateCVOnPlane(e,t,i)):rotateCVOnTerrain(e,t,i)}}function rotateCVOnPlane(e,t,i){var r=e._scene,n=r.camera,a=r.canvas,o=rotateCVWindowPos;o.x=a.clientWidth/2,o.y=a.clientHeight/2;var s,l=n.getPickRay(o,rotateCVWindowRay),c=Cartesian3.UNIT_X,u=l.origin,d=l.direction,h=Cartesian3.dot(c,d);if(Math.abs(h)>CesiumMath.EPSILON6&&(s=-Cartesian3.dot(c,u)/h),!defined(s)||s<=0)return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._tiltCenterMousePosition);var p=Cartesian3.multiplyByScalar(d,s,rotateCVCenter);Cartesian3.add(u,p,p);var m=r.mapProjection,f=m.ellipsoid;Cartesian3.fromElements(p.y,p.z,p.x,p);var g=m.unproject(p,rotateCVCart);f.cartographicToCartesian(g,p);var _=Transforms.eastNorthUpToFixedFrame(p,f,rotateCVTransform),y=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var C=Matrix4.clone(n.transform,rotateCVOldTransform);n._setTransform(_),rotate3D(e,t,i,Cartesian3.UNIT_Z),n._setTransform(C),e._globe=y;var S=(e._ellipsoid=v).maximumRadius;e._rotateFactor=1/S,e._rotateRateRangeAdjustment=S}function rotateCVOnTerrain(e,t,i){var r,n,a=e._scene,o=a.camera,s=Cartesian3.UNIT_X;if(Cartesian2.equals(t,e._tiltCenterMousePosition))r=Cartesian3.clone(e._tiltCenter,rotateCVCenter);else{if(o.position.z<e._minimumPickingTerrainHeight&&(r=pickGlobe(e,t,rotateCVCenter)),!defined(r)){var l,c=(n=o.getPickRay(t,rotateCVWindowRay)).origin,u=n.direction,d=Cartesian3.dot(s,u);if(Math.abs(d)>CesiumMath.EPSILON6&&(l=-Cartesian3.dot(s,c)/d),!defined(l)||l<=0)return e._looking=!0,look3D(e,t,i),void Cartesian2.clone(t,e._tiltCenterMousePosition);r=Cartesian3.multiplyByScalar(u,l,rotateCVCenter),Cartesian3.add(c,r,r)}Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(r,e._tiltCenter)}var h=a.canvas,p=rotateCVWindowPos;p.x=h.clientWidth/2,p.y=e._tiltCenterMousePosition.y,n=o.getPickRay(p,rotateCVWindowRay);var m=Cartesian3.clone(Cartesian3.ZERO,rotateCVOrigin);m.x=r.x;var f=Plane.fromPointNormal(m,s,rotateCVPlane),g=IntersectionTests.rayPlane(n,f,rotateCVVerticalCenter),_=o._projection,y=_.ellipsoid;Cartesian3.fromElements(r.y,r.z,r.x,r);var v=_.unproject(r,rotateCVCart);y.cartographicToCartesian(v,r);var C,S=Transforms.eastNorthUpToFixedFrame(r,y,rotateCVTransform);C=defined(g)?(Cartesian3.fromElements(g.y,g.z,g.x,g),v=_.unproject(g,rotateCVCart),y.cartographicToCartesian(v,g),Transforms.eastNorthUpToFixedFrame(g,y,rotateCVVerticalTransform)):S;var x=e._globe,T=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var b=Cartesian3.UNIT_Z,E=Matrix4.clone(o.transform,rotateCVOldTransform);o._setTransform(S);var P=Cartesian3.cross(Cartesian3.UNIT_Z,Cartesian3.normalize(o.position,rotateCVCartesian3),rotateCVCartesian3),A=Cartesian3.dot(o.right,P);if(rotate3D(e,t,i,b,!1,!0),o._setTransform(C),A<0){i.startPosition.y>i.endPosition.y&&(b=void 0);var w=o.constrainedAxis;rotate3D(e,t,i,b,!(o.constrainedAxis=void 0),!1),o.constrainedAxis=w}else rotate3D(e,t,i,b,!0,!1);o._setTransform(E),e._globe=x;var D=(e._ellipsoid=T).maximumRadius;e._rotateFactor=1/D,e._rotateRateRangeAdjustment=D;var M=Cartesian3.clone(o.positionWC,rotateCVCartesian3);if(o._adjustHeightForTerrain(),!Cartesian3.equals(o.positionWC,M)){o._setTransform(C),o.worldToCameraCoordinatesPoint(M,M);var I=Cartesian3.magnitudeSquared(M);Cartesian3.magnitudeSquared(o.position)>I&&(Cartesian3.normalize(o.position,o.position),Cartesian3.multiplyByScalar(o.position,Math.sqrt(I),o.position));var R=Cartesian3.angleBetween(M,o.position),O=Cartesian3.cross(M,o.position,M);Cartesian3.normalize(O,O);var L=Quaternion.fromAxisAngle(O,R,rotateCVQuaternion),F=Matrix3.fromQuaternion(L,rotateCVMatrix);Matrix3.multiplyByVector(F,o.direction,o.direction),Matrix3.multiplyByVector(F,o.up,o.up),Cartesian3.cross(o.direction,o.up,o.right),Cartesian3.cross(o.right,o.direction,o.up),o._setTransform(E)}}var zoomCVWindowPos=new Cartesian2,zoomCVWindowRay=new Ray,zoomCVIntersection=new Cartesian3;function zoomCV(e,t,i){defined(i.distance)&&(i=i.distance);var r=e._scene,n=r.camera,a=r.canvas,o=zoomCVWindowPos;o.x=a.clientWidth/2,o.y=a.clientHeight/2;var s,l,c=n.getPickRay(o,zoomCVWindowRay);if(n.position.z<e._minimumPickingTerrainHeight&&(s=pickGlobe(e,o,zoomCVIntersection)),defined(s))l=Cartesian3.distance(c.origin,s);else{var u=Cartesian3.UNIT_X,d=c.origin,h=c.direction;l=-Cartesian3.dot(u,d)/Cartesian3.dot(u,h)}handleZoom(e,t,i,e._zoomFactor,l)}function updateCV(e){var t=e._scene.camera;if(Matrix4.equals(Matrix4.IDENTITY,t.transform)){var i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),reactToInput(e,e.enableTilt,e.tiltEventTypes,rotateCV,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableTranslate,e.translateEventTypes,translateCV,e.inertiaTranslate,"_lastInertiaTranslateMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoomCV,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D),!(e._aggregator.anyButtonDown||defined(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||defined(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||i.contains(e._tween))){var r=t.createCorrectPositionTween(e.bounceAnimationTime);defined(r)&&(e._tween=i.add(r))}i.update()}else reactToInput(e,e.enableRotate,e.rotateEventTypes,rotate3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D$1,e.inertiaZoom,"_lastInertiaZoomMovement")}var scratchStrafeRay=new Ray,scratchStrafePlane=new Plane(Cartesian3.UNIT_X,0),scratchStrafeIntersection=new Cartesian3,scratchStrafeDirection=new Cartesian3,scratchMousePos=new Cartesian3;function strafe(e,t,i){var r=e._scene,n=r.camera,a=pickGlobe(e,i.startPosition,scratchMousePos);if(defined(a)){var o=i.endPosition,s=n.getPickRay(o,scratchStrafeRay),l=Cartesian3.clone(n.direction,scratchStrafeDirection);r.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(l.z,l.x,l.y,l);var c=Plane.fromPointNormal(a,l,scratchStrafePlane),u=IntersectionTests.rayPlane(s,c,scratchStrafeIntersection);defined(u)&&(l=Cartesian3.subtract(a,u,l),r.mode===SceneMode$1.COLUMBUS_VIEW&&Cartesian3.fromElements(l.y,l.z,l.x,l),Cartesian3.add(n.position,l,n.position))}}var spin3DPick=new Cartesian3,scratchCartographic$f=new Cartographic,scratchRadii$2=new Cartesian3,scratchEllipsoid$e=new Ellipsoid,scratchLookUp=new Cartesian3;function spin3D(e,t,i){var r=e._scene.camera;if(Matrix4.equals(r.transform,Matrix4.IDENTITY)){var n,a,o,s=e._ellipsoid.geodeticSurfaceNormal(r.position,scratchLookUp),l=e._ellipsoid.cartesianToCartographic(r.positionWC,scratchCartographic$f).height,c=e._globe;if(defined(c)&&l<e._minimumPickingTerrainHeight&&defined(o=pickGlobe(e,i.startPosition,scratchMousePos))){var u=r.getPickRay(i.startPosition,pickGlobeScratchRay$1),d=e._ellipsoid.geodeticSurfaceNormal(o);Math.abs(Cartesian3.dot(u.direction,d))<.05&&!e._looking&&(e._rotating=!1,e._strafing=!0)}Cartesian2.equals(t,e._rotateMousePosition)?e._looking?look3D(e,t,i,s):e._rotating?rotate3D(e,t,i):e._strafing?(Cartesian3.clone(o,e._strafeStartPosition),strafe(e,t,i)):(n=Cartesian3.magnitude(e._rotateStartPosition),(a=scratchRadii$2).x=a.y=a.z=n,pan3D(e,t,i,Ellipsoid.fromCartesian3(a,scratchEllipsoid$e))):(e._looking=!1,e._rotating=!1,e._strafing=!1,defined(c)&&l<e._minimumPickingTerrainHeight?defined(o)?Cartesian3.magnitude(r.position)<Cartesian3.magnitude(o)?(Cartesian3.clone(o,e._strafeStartPosition),e._strafing=!0,strafe(e,t,i)):(n=Cartesian3.magnitude(o),(a=scratchRadii$2).x=a.y=a.z=n,pan3D(e,t,i,Ellipsoid.fromCartesian3(a,scratchEllipsoid$e)),Cartesian3.clone(o,e._rotateStartPosition)):(e._looking=!0,look3D(e,t,i,s)):defined(r.pickEllipsoid(i.startPosition,e._ellipsoid,spin3DPick))?(pan3D(e,t,i,e._ellipsoid),Cartesian3.clone(spin3DPick,e._rotateStartPosition)):l>e._minimumTrackBallHeight?(e._rotating=!0,rotate3D(e,t,i)):(e._looking=!0,look3D(e,t,i,s)),Cartesian2.clone(t,e._rotateMousePosition))}else rotate3D(e,t,i)}function rotate3D(e,t,i,r,n,a){n=defaultValue(n,!1),a=defaultValue(a,!1);var o=e._scene,s=o.camera,l=o.canvas,c=s.constrainedAxis;defined(r)&&(s.constrainedAxis=r);var u=Cartesian3.magnitude(s.position),d=e._rotateFactor*(u-e._rotateRateRangeAdjustment);d>e._maximumRotateRate&&(d=e._maximumRotateRate),d<e._minimumRotateRate&&(d=e._minimumRotateRate);var h=(i.startPosition.x-i.endPosition.x)/l.clientWidth,p=(i.startPosition.y-i.endPosition.y)/l.clientHeight;h=Math.min(h,e.maximumMovementRatio),p=Math.min(p,e.maximumMovementRatio);var m=d*h*Math.PI*2,f=d*p*Math.PI;n||s.rotateRight(m),a||s.rotateUp(f),s.constrainedAxis=c}var pan3DP0=Cartesian4.clone(Cartesian4.UNIT_W),pan3DP1=Cartesian4.clone(Cartesian4.UNIT_W),pan3DTemp0=new Cartesian3,pan3DStartMousePosition=new Cartesian2,pan3DEndMousePosition=new Cartesian2;function pan3D(e,t,i,r){var n=e._scene.camera,a=Cartesian2.clone(i.startPosition,pan3DStartMousePosition),o=Cartesian2.clone(i.endPosition,pan3DEndMousePosition),s=n.pickEllipsoid(a,r,pan3DP0),l=n.pickEllipsoid(o,r,pan3DP1);if(!defined(s)||!defined(l))return e._rotating=!0,void rotate3D(e,t,i);s=n.worldToCameraCoordinates(s,s),l=n.worldToCameraCoordinates(l,l),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l);var c=Cartesian3.dot(s,l),u=Cartesian3.cross(s,l,pan3DTemp0);if(c<1&&!Cartesian3.equalsEpsilon(u,Cartesian3.ZERO,CesiumMath.EPSILON14)){var d=Math.acos(c);n.rotate(u,d)}}var zoom3DUnitPosition=new Cartesian3,zoom3DCartographic=new Cartographic;function zoom3D$1(e,t,i){defined(i.distance)&&(i=i.distance);var r=e._ellipsoid,n=e._scene,a=n.camera,o=n.canvas,s=zoomCVWindowPos;s.x=o.clientWidth/2,s.y=o.clientHeight/2;var l,c,u=a.getPickRay(s,zoomCVWindowRay),d=r.cartesianToCartographic(a.position,zoom3DCartographic).height;d<e._minimumPickingTerrainHeight&&(l=pickGlobe(e,s,zoomCVIntersection)),c=defined(l)?Cartesian3.distance(u.origin,l):d;var h=Cartesian3.normalize(a.position,zoom3DUnitPosition);handleZoom(e,t,i,e._zoomFactor,c,Cartesian3.dot(h,a.direction))}var tilt3DWindowPos=new Cartesian2,tilt3DRay=new Ray,tilt3DCenter=new Cartesian3,tilt3DVerticalCenter=new Cartesian3,tilt3DTransform=new Matrix4,tilt3DVerticalTransform=new Matrix4,tilt3DOldTransform=new Matrix4,tilt3DQuaternion=new Quaternion,tilt3DMatrix=new Matrix3,tilt3DCart=new Cartographic,tilt3DLookUp=new Cartesian3;function tilt3D(e,t,i){var r=e._scene.camera;if(Matrix4.equals(r.transform,Matrix4.IDENTITY))if(defined(i.angleAndHeight)&&(i=i.angleAndHeight),Cartesian2.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){var n=e._ellipsoid.geodeticSurfaceNormal(r.position,tilt3DLookUp);look3D(e,t,i,n)}else{var a=e._ellipsoid.cartesianToCartographic(r.position,tilt3DCart);e._tiltOnEllipsoid||a.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,tilt3DOnEllipsoid(e,t,i)):tilt3DOnTerrain(e,t,i)}}var tilt3DOnEllipsoidCartographic=new Cartographic;function tilt3DOnEllipsoid(e,t,i){var r=e._ellipsoid,n=e._scene,a=n.camera,o=.25*e.minimumZoomDistance,s=r.cartesianToCartographic(a.positionWC,tilt3DOnEllipsoidCartographic).height;if(!(s-o-1<CesiumMath.EPSILON3&&i.endPosition.y-i.startPosition.y<0)){var l=n.canvas,c=tilt3DWindowPos;c.x=l.clientWidth/2,c.y=l.clientHeight/2;var u,d=a.getPickRay(c,tilt3DRay),h=IntersectionTests.rayEllipsoid(d,r);if(defined(h))u=Ray.getPoint(d,h.start,tilt3DCenter);else{if(!(s>e._minimumTrackBallHeight)){e._looking=!0;var p=e._ellipsoid.geodeticSurfaceNormal(a.position,tilt3DLookUp);return look3D(e,t,i,p),void Cartesian2.clone(t,e._tiltCenterMousePosition)}var m=IntersectionTests.grazingAltitudeLocation(d,r);if(!defined(m))return;var f=r.cartesianToCartographic(m,tilt3DCart);f.height=0,u=r.cartographicToCartesian(f,tilt3DCenter)}var g=Transforms.eastNorthUpToFixedFrame(u,r,tilt3DTransform),_=e._globe,y=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var v=Matrix4.clone(a.transform,tilt3DOldTransform);a._setTransform(g),rotate3D(e,t,i,Cartesian3.UNIT_Z),a._setTransform(v),e._globe=_;var C=(e._ellipsoid=y).maximumRadius;e._rotateFactor=1/C,e._rotateRateRangeAdjustment=C}}function tilt3DOnTerrain(e,t,i){var r,n,a,o=e._ellipsoid,s=e._scene,l=s.camera;if(Cartesian2.equals(t,e._tiltCenterMousePosition))r=Cartesian3.clone(e._tiltCenter,tilt3DCenter);else{if(!defined(r=pickGlobe(e,t,tilt3DCenter))){if(n=l.getPickRay(t,tilt3DRay),!defined(a=IntersectionTests.rayEllipsoid(n,o))){if(o.cartesianToCartographic(l.position,tilt3DCart).height<=e._minimumTrackBallHeight){e._looking=!0;var c=e._ellipsoid.geodeticSurfaceNormal(l.position,tilt3DLookUp);look3D(e,t,i,c),Cartesian2.clone(t,e._tiltCenterMousePosition)}return}r=Ray.getPoint(n,a.start,tilt3DCenter)}Cartesian2.clone(t,e._tiltCenterMousePosition),Cartesian3.clone(r,e._tiltCenter)}var u=s.canvas,d=tilt3DWindowPos;d.x=u.clientWidth/2,d.y=e._tiltCenterMousePosition.y,n=l.getPickRay(d,tilt3DRay);var h=Cartesian3.magnitude(r),p=Cartesian3.fromElements(h,h,h,scratchRadii$2),m=Ellipsoid.fromCartesian3(p,scratchEllipsoid$e);if(defined(a=IntersectionTests.rayEllipsoid(n,m))){var f=Cartesian3.magnitude(n.origin)>h?a.start:a.stop,g=Ray.getPoint(n,f,tilt3DVerticalCenter),_=Transforms.eastNorthUpToFixedFrame(r,o,tilt3DTransform),y=Transforms.eastNorthUpToFixedFrame(g,m,tilt3DVerticalTransform),v=e._globe,C=e._ellipsoid;e._globe=void 0,e._ellipsoid=Ellipsoid.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;var S=Cartesian3.UNIT_Z,x=Matrix4.clone(l.transform,tilt3DOldTransform);l._setTransform(_);var T=Cartesian3.cross(g,l.positionWC,tilt3DCartesian3),b=Cartesian3.dot(l.rightWC,T);if(rotate3D(e,t,i,S,!1,!0),l._setTransform(y),b<0){i.startPosition.y>i.endPosition.y&&(S=void 0);var E=l.constrainedAxis;rotate3D(e,t,i,S,!(l.constrainedAxis=void 0),!1),l.constrainedAxis=E}else rotate3D(e,t,i,S,!0,!1);l._setTransform(x),e._globe=v;var P=(e._ellipsoid=C).maximumRadius;e._rotateFactor=1/P,e._rotateRateRangeAdjustment=P;var A=Cartesian3.clone(l.positionWC,tilt3DCartesian3);if(l._adjustHeightForTerrain(),!Cartesian3.equals(l.positionWC,A)){l._setTransform(y),l.worldToCameraCoordinatesPoint(A,A);var w=Cartesian3.magnitudeSquared(A);Cartesian3.magnitudeSquared(l.position)>w&&(Cartesian3.normalize(l.position,l.position),Cartesian3.multiplyByScalar(l.position,Math.sqrt(w),l.position));var D=Cartesian3.angleBetween(A,l.position),M=Cartesian3.cross(A,l.position,A);Cartesian3.normalize(M,M);var I=Quaternion.fromAxisAngle(M,D,tilt3DQuaternion),R=Matrix3.fromQuaternion(I,tilt3DMatrix);Matrix3.multiplyByVector(R,l.direction,l.direction),Matrix3.multiplyByVector(R,l.up,l.up),Cartesian3.cross(l.direction,l.up,l.right),Cartesian3.cross(l.right,l.direction,l.up),l._setTransform(x)}}}var look3DStartPos=new Cartesian2,look3DEndPos=new Cartesian2,look3DStartRay=new Ray,look3DEndRay=new Ray,look3DNegativeRot=new Cartesian3,look3DTan=new Cartesian3;function look3D(e,t,i,r){var n=e._scene.camera,a=look3DStartPos;a.x=i.startPosition.x,a.y=0;var o=look3DEndPos;o.x=i.endPosition.x,o.y=0;var s,l,c=n.getPickRay(a,look3DStartRay),u=n.getPickRay(o,look3DEndRay),d=0;n.frustum instanceof OrthographicFrustum?(s=c.origin,l=u.origin,Cartesian3.add(n.direction,s,s),Cartesian3.add(n.direction,l,l),Cartesian3.subtract(s,n.position,s),Cartesian3.subtract(l,n.position,l),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l)):(s=c.direction,l=u.direction);var h=Cartesian3.dot(s,l);h<1&&(d=Math.acos(h)),d=i.startPosition.x>i.endPosition.x?-d:d;var p=e._horizontalRotationAxis;if(defined(r)?n.look(r,-d):defined(p)?n.look(p,-d):n.lookLeft(d),a.x=0,a.y=i.startPosition.y,o.x=0,o.y=i.endPosition.y,c=n.getPickRay(a,look3DStartRay),u=n.getPickRay(o,look3DEndRay),d=0,n.frustum instanceof OrthographicFrustum?(s=c.origin,l=u.origin,Cartesian3.add(n.direction,s,s),Cartesian3.add(n.direction,l,l),Cartesian3.subtract(s,n.position,s),Cartesian3.subtract(l,n.position,l),Cartesian3.normalize(s,s),Cartesian3.normalize(l,l)):(s=c.direction,l=u.direction),(h=Cartesian3.dot(s,l))<1&&(d=Math.acos(h)),d=i.startPosition.y>i.endPosition.y?-d:d,defined(r=defaultValue(r,p))){var m=n.direction,f=Cartesian3.negate(r,look3DNegativeRot),g=Cartesian3.equalsEpsilon(m,r,CesiumMath.EPSILON2),_=Cartesian3.equalsEpsilon(m,f,CesiumMath.EPSILON2);if(g||_)(g&&d<0||_&&0<d)&&n.look(n.right,-d);else{h=Cartesian3.dot(m,r);var y=CesiumMath.acosClamped(h);0<d&&y<d&&(d=y-CesiumMath.EPSILON4),h=Cartesian3.dot(m,f),y=CesiumMath.acosClamped(h),d<0&&y<-d&&(d=-y+CesiumMath.EPSILON4);var v=Cartesian3.cross(r,m,look3DTan);n.look(v,d)}}else n.lookUp(d)}function update3D(e){reactToInput(e,e.enableRotate,e.rotateEventTypes,spin3D,e.inertiaSpin,"_lastInertiaSpinMovement"),reactToInput(e,e.enableZoom,e.zoomEventTypes,zoom3D$1,e.inertiaZoom,"_lastInertiaZoomMovement"),reactToInput(e,e.enableTilt,e.tiltEventTypes,tilt3D,e.inertiaSpin,"_lastInertiaTiltMovement"),reactToInput(e,e.enableLook,e.lookEventTypes,look3D)}ScreenSpaceCameraController.prototype.update=function(){Matrix4.equals(this._scene.camera.transform,Matrix4.IDENTITY)?(this._globe=this._scene.globe,this._ellipsoid=defined(this._globe)?this._globe.ellipsoid:this._scene.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=Ellipsoid.UNIT_SPHERE),this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight*this._scene.terrainExaggeration,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight*this._scene.terrainExaggeration,this._minimumTrackBallHeight=this.minimumTrackBallHeight*this._scene.terrainExaggeration;var e=this._ellipsoid.maximumRadius;this._rotateFactor=1/e,this._rotateRateRangeAdjustment=e;var t=this._scene.mode;t===SceneMode$1.SCENE2D?update2D(this):t===SceneMode$1.COLUMBUS_VIEW?(this._horizontalRotationAxis=Cartesian3.UNIT_Z,updateCV(this)):t===SceneMode$1.SCENE3D&&(this._horizontalRotationAxis=void 0,update3D(this)),this._aggregator.reset()},ScreenSpaceCameraController.prototype.isDestroyed=function(){return!1},ScreenSpaceCameraController.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),destroyObject(this)};var AdditiveBlend="uniform sampler2D colorTexture;\nuniform sampler2D colorTexture2;\nuniform vec2 center;\nuniform float radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(colorTexture, v_textureCoordinates);\nvec4 color1 = texture2D(colorTexture2, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - center) / radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color1, t);\n}\n",BrightPass="uniform sampler2D colorTexture;\nuniform float avgLuminance;\nuniform float threshold;\nuniform float offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(colorTexture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(avgLuminance) * luminance / avgLuminance;\nfloat brightLum = max(scaledLum - threshold, 0.0);\nfloat brightness = brightLum / (offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n";function SunPostProcess(){this._sceneFramebuffer=new SceneFramebuffer;var e=new Array(6);e[0]=new PostProcessStage({fragmentShader:PassThrough,textureScale:.125,forcePowerOfTwo:!0,sampleMode:PostProcessStageSampleMode.LINEAR});var t=e[1]=new PostProcessStage({fragmentShader:BrightPass,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:.125,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new Cartesian2,e[2]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/t.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:.125,forcePowerOfTwo:!0}),e[3]=new PostProcessStage({fragmentShader:GaussianBlur1D,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/t.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:.125,forcePowerOfTwo:!0}),e[4]=new PostProcessStage({fragmentShader:PassThrough,sampleMode:PostProcessStageSampleMode.LINEAR}),this._uCenter=new Cartesian2,this._uRadius=void 0,e[5]=new PostProcessStage({fragmentShader:AdditiveBlend,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.getFramebuffer().getColorTexture(0)}}}),this._stages=new PostProcessStageComposite({stages:e});for(var r=new PostProcessStageTextureCache(this),n=e.length,a=0;a<n;++a)e[a]._textureCache=r;this._textureCache=r,this.length=e.length}SunPostProcess.prototype.get=function(e){return this._stages.get(e)},SunPostProcess.prototype.getStageByName=function(e){for(var t=this._stages.length,i=0;i<t;++i){var r=this._stages.get(i);if(r.name===e)return r}};var sunPositionECScratch=new Cartesian4,sunPositionWCScratch=new Cartesian2,sizeScratch=new Cartesian2,postProcessMatrix4Scratch=new Matrix4;function updateSunPosition(e,t,i){var r=t.uniformState,n=r.sunPositionWC,a=r.view,o=r.viewProjection,s=r.projection,l=Matrix4.computeViewportTransformation(i,0,1,postProcessMatrix4Scratch),c=Matrix4.multiplyByPoint(a,n,sunPositionECScratch),u=Transforms.pointToGLWindowCoordinates(o,l,n,sunPositionWCScratch);c.x+=CesiumMath.SOLAR_RADIUS;var d=Transforms.pointToGLWindowCoordinates(s,l,c,c),h=30*Cartesian2.magnitude(Cartesian2.subtract(d,u,d))*2,p=sizeScratch;p.x=h,p.y=h,e._uCenter=Cartesian2.clone(u,e._uCenter),e._uRadius=.15*Math.max(p.x,p.y);var m=t.drawingBufferWidth,f=t.drawingBufferHeight,g=e._stages,_=g.get(0),y=_.outputTexture.width,v=_.outputTexture.height,C=new BoundingRectangle;C.width=y,C.height=v,l=Matrix4.computeViewportTransformation(C,0,1,postProcessMatrix4Scratch),u=Transforms.pointToGLWindowCoordinates(o,l,n,sunPositionWCScratch),p.x*=y/m,p.y*=v/f;var S=_.scissorRectangle;S.x=Math.max(u.x-.5*p.x,0),S.y=Math.max(u.y-.5*p.y,0),S.width=Math.min(p.x,m),S.height=Math.min(p.y,f);for(var x=1;x<4;++x)BoundingRectangle.clone(S,g.get(x).scissorRectangle)}SunPostProcess.prototype.clear=function(e,t,i){this._sceneFramebuffer.clear(e,t,i),this._textureCache.clear(e)},SunPostProcess.prototype.update=function(e){var t=e.context,i=e.viewport,r=this._sceneFramebuffer;r.update(t,i);var n=r.getFramebuffer();return this._textureCache.update(t),this._stages.update(t,!1),updateSunPosition(this,t,i),n},SunPostProcess.prototype.execute=function(e){var t=this._sceneFramebuffer.getFramebuffer().getColorTexture(0),i=this._stages,r=i.length;i.get(0).execute(e,t);for(var n=1;n<r;++n)i.get(n).execute(e,i.get(n-1).outputTexture)},SunPostProcess.prototype.copy=function(e,t){if(!defined(this._copyColorCommand)){var i=this;this._copyColorCommand=e.createViewportQuadCommand(PassThrough,{uniformMap:{colorTexture:function(){return i._stages.get(i._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},SunPostProcess.prototype.isDestroyed=function(){return!1},SunPostProcess.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),destroyObject(this)};var requestRenderAfterFrame=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function Scene(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).canvas,i=e.contextOptions,r=e.creditContainer,n=e.creditViewport,a=defined(r),o=new Context(t,i);a||((r=document.createElement("div")).style.position="absolute",r.style.bottom="0",r.style["text-shadow"]="0 0 2px #000000",r.style.color="#ffffff",r.style["font-size"]="10px",r.style["padding-right"]="5px",t.parentNode.appendChild(r)),defined(n)||(n=t.parentNode),this._id=createGuid(),this._jobScheduler=new JobScheduler,this._frameState=new FrameState(o,new CreditDisplay(r," • ",n),this._jobScheduler),this._frameState.scene3DOnly=defaultValue(e.scene3DOnly,!1),this._removeCreditContainer=!a,this._creditContainer=r,this._canvas=t,this._context=o,this._computeEngine=new ComputeEngine(o),this._globe=void 0,this._primitives=new PrimitiveCollection,this._groundPrimitives=new PrimitiveCollection,this._logDepthBuffer=o.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new TweenCollection,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=defaultValue(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new DepthPlane,this._clearColorCommand=new ClearCommand({color:new Color,stencil:0,owner:this}),this._depthClearCommand=new ClearCommand({depth:1,owner:this}),this._stencilClearCommand=new ClearCommand({stencil:0}),this._classificationStencilClearCommand=new ClearCommand({stencil:0,renderState:RenderState.fromCache({stencilMask:StencilConstants$1.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new SceneTransitioner(this),this._preUpdate=new Event,this._postUpdate=new Event,this._renderError=new Event,this._preRender=new Event,this._postRender=new Event,this._minimumDisableDepthTestDistance=0,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Event,this.morphComplete=new Event,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=Color.clone(Color.BLACK),this._mode=SceneMode$1.SCENE3D,this._mapProjection=defined(e.mapProjection)?e.mapProjection:new GeographicProjection,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowGlobeDepth=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.fog=new Fog,this._sunCamera=new Camera(this),this.shadowMap=new ShadowMap({context:o,lightCamera:this._sunCamera,enabled:defaultValue(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=Color.clone(Color.WHITE),this._actualInvertClassificationColor=Color.clone(this._invertClassificationColor),this._invertClassification=new InvertClassification,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new PostProcessStageCollection,this._brdfLutGenerator=new BrdfLutGenerator,this._terrainExaggeration=defaultValue(e.terrainExaggeration,1),this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new ScreenSpaceCameraController(this),this._mapMode2D=defaultValue(e.mapMode2D,MapMode2D$1.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,separatePrimitiveFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=defaultValue(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=defaultValue(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=RequestScheduler.requestCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeTaskProcessorListenerCallback=TaskProcessor.taskCompletedEvent.addEventListener(requestRenderAfterFrame(this)),this._removeGlobeCallbacks=[];var s=new BoundingRectangle(0,0,o.drawingBufferWidth,o.drawingBufferHeight),l=new Camera(this);this._logDepthBuffer&&(l.frustum.near=.1,l.frustum.far=1e10),this.preloadFlightCamera=new Camera(this),this.preloadFlightCullingVolume=void 0,this._picking=new Picking(this),this._defaultView=new View(this,l,s),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this._sunColor=new Cartesian3(1.8,1.85,2),this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,updateFrameNumber(this,0,JulianDate.now()),this.updateFrameState(),this.initializeFrame()}function updateGlobeListeners(e,t){for(var i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;var r=[];defined(t)&&(r.push(t.imageryLayersUpdatedEvent.addEventListener(requestRenderAfterFrame(e))),r.push(t.terrainProviderChanged.addEventListener(requestRenderAfterFrame(e)))),e._removeGlobeCallbacks=r}function updateDerivedCommands(e,t,i){var r=e._frameState,n=e._context,a=e._view.oit,o=r.shadowState.lightShadowMaps,s=r.shadowState.lightShadowsEnabled,l=t.derivedCommands;defined(t.pickId)&&(l.picking=DerivedCommand.createPickDerivedCommand(e,t,n,l.picking)),t.pickOnly||(l.depth=DerivedCommand.createDepthOnlyDerivedCommand(e,t,n,l.depth)),l.originalCommand=t,e._hdr&&(l.hdr=DerivedCommand.createHdrCommand(t,n,l.hdr),l=(t=l.hdr.command).derivedCommands),s&&t.receiveShadows&&(l.shadows=ShadowMap.createReceiveDerivedCommand(o,t,i,n,l.shadows)),t.pass===Pass$1.TRANSLUCENT&&defined(a)&&a.isSupported()&&(s&&t.receiveShadows?(l.oit=defined(l.oit)?l.oit:{},l.oit.shadows=a.createDerivedCommands(l.shadows.receiveCommand,n,l.oit.shadows)):l.oit=a.createDerivedCommands(t,n,l.oit))}defineProperties$1(Scene.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 ContextLimits.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return ContextLimits.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 OctahedralProjectedCubeMap.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,updateGlobeListeners(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(defined(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(defined(this.globe))return this.globe.terrainProvider},set:function(e){defined(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(defined(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){e===SceneMode$1.SCENE2D?this.morphTo2D(0):e===SceneMode$1.SCENE3D?this.morphTo3D(0):e===SceneMode$1.COLUMBUS_VIEW&&this.morphToColumbusView(0),this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},terrainExaggeration:{get:function(){return this._terrainExaggeration}},useWebVR:{get:function(){return this._useWebVR},set:function(e){this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Camera(this),defined(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new DeviceOrientationCameraController(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}},imagerySplitPosition:{get:function(){return this._frameState.imagerySplitPosition},set:function(e){this._frameState.imagerySplitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){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,this._defaultView.updateFrustums=!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){var t=this._context,i=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=i!==this._hdr,this._hdr=i}},highDynamicRangeSupported:{get:function(){var e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},sunColor:{get:function(){return this._sunColor},set:function(e){this._sunColor=e}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return this._frameState.useLogDepth?.9:.9999}}}),Scene.prototype.getCompressedTextureFormatSupported=function(e){var t=this.context;return("WEBGL_compressed_texture_s3tc"===e||"s3tc"===e)&&t.s3tc||("WEBGL_compressed_texture_pvrtc"===e||"pvrtc"===e)&&t.pvrtc||("WEBGL_compressed_texture_etc1"===e||"etc1"===e)&&t.etc1},Scene.prototype.updateDerivedCommands=function(e){if(defined(e.derivedCommands)){var t=this._frameState,i=this._context,r=!1,n=t.shadowState.lastDirtyTime;e.lastDirtyTime!==n&&(e.lastDirtyTime=n,r=e.dirty=!0);var a=t.useLogDepth,o=this._hdr,s=e.derivedCommands,l=defined(s.logDepth),c=defined(s.hdr),u=defined(s.originalCommand),d=a&&!l,h=o&&!c,p=!(a&&o||u);if(e.dirty=e.dirty||d||h||p,e.dirty){e.dirty=!1;var m=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(s.shadows=ShadowMap.createCastDerivedCommand(m,e,r,i,s.shadows)),(l||d)&&(s.logDepth=DerivedCommand.createLogDepthCommand(e,i,s.logDepth),updateDerivedCommands(this,s.logDepth.command,r)),(u||p)&&updateDerivedCommands(this,e,r)}}};var renderTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.RENDER}),preloadTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD}),preloadFlightTilesetPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.PRELOAD_FLIGHT}),requestRenderModeDeferCheckPassState=new Cesium3DTilePassState({pass:Cesium3DTilePass$1.REQUEST_RENDER_MODE_DEFER_CHECK}),scratchOccluderBoundingSphere=new BoundingSphere,scratchOccluder;function getOccluder(e){var t=e.globe;if(e._mode===SceneMode$1.SCENE3D&&defined(t)&&t.show){var i=t.ellipsoid;return scratchOccluderBoundingSphere.radius=i.minimumRadius,scratchOccluder=Occluder.fromBoundingSphere(scratchOccluderBoundingSphere,e.camera.positionWC,scratchOccluder)}}function updateFrameNumber(e,t,i){var r=e._frameState;r.frameNumber=t,r.time=JulianDate.clone(i,r.time)}function getAttributeLocations$2(e){var t={},i=e.vertexAttributes;for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r].index);return t}function createDebugFragmentShaderProgram(e,t,i){var r=t.context,n=defaultValue(i,e.shaderProgram),a=n.fragmentShaderSource.clone(),o=[];a.sources=a.sources.map(function(e){e=ShaderSource.replaceMain(e,"czm_Debug_main");for(var t,i=/gl_FragData\[(\d+)\]/g;null!==(t=i.exec(e));)-1===o.indexOf(t[1])&&o.push(t[1]);return e});var s,l=o.length,c="void main() \n{ \n    czm_Debug_main(); \n";if(t.debugShowCommands){defined(e._debugColor)||(e._debugColor=Color.fromRandom());var u=e._debugColor;if(0<l)for(s=0;s<l;++s)c+="    gl_FragData["+o[s]+"].rgb *= vec3("+u.red+", "+u.green+", "+u.blue+"); \n";else c+="    gl_FragColor.rgb *= vec3("+u.red+", "+u.green+", "+u.blue+"); \n"}if(t.debugShowFrustums){var d=1&e.debugOverlappingFrustums?"1.0":"0.0",h=2&e.debugOverlappingFrustums?"1.0":"0.0",p=4&e.debugOverlappingFrustums?"1.0":"0.0";if(0<l)for(s=0;s<l;++s)c+="    gl_FragData["+o[s]+"].rgb *= vec3("+d+", "+h+", "+p+"); \n";else c+="    gl_FragColor.rgb *= vec3("+d+", "+h+", "+p+"); \n"}c+="}",a.sources.push(c);var m=getAttributeLocations$2(n);return ShaderProgram.fromCache({context:r,vertexShaderSource:n.vertexShaderSource,fragmentShaderSource:a,attributeLocations:m})}function executeDebugCommand(e,t,i){var r=DrawCommand.shallowClone(e);r.shaderProgram=createDebugFragmentShaderProgram(e,t),r.execute(t.context,i),r.shaderProgram.destroy()}Scene.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1},Scene.prototype.updateFrameState=function(){var 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=getOccluder(this),t.terrainExaggeration=this._terrainExaggeration,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof OrthographicFrustum||this.camera.frustum instanceof OrthographicOffCenterFrustum),t.sunColor=this._sunColor,defined(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=Color.clone(this.invertClassificationColor,this._actualInvertClassificationColor),InvertClassification.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,defined(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0},Scene.prototype.isVisible=function(e,t,i){return defined(e)&&(!defined(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Intersect$1.OUTSIDE&&(!defined(i)||!e.occlude||!e.boundingVolume.isOccluded(i)))};var transformFrom2D=new Matrix4(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function debugShowBoundingVolume(e,t,i,r){var n,a=t._frameState,o=a.context,s=e.boundingVolume;defined(t._debugVolume)&&t._debugVolume.destroy();var l=Cartesian3.clone(s.center);if(a.mode!==SceneMode$1.SCENE3D){l=Matrix4.multiplyByPoint(transformFrom2D,l,l);var c=a.mapProjection,u=c.unproject(l);l=c.ellipsoid.cartographicToCartesian(u)}if(defined(s.radius)){var d=s.radius;n=GeometryPipeline.toWireframe(EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:new Cartesian3(d,d,d),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive({geometryInstances:new GeometryInstance({geometry:n,modelMatrix:Matrix4.fromTranslation(l),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}else{var h=s.halfAxes;n=GeometryPipeline.toWireframe(BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:PerInstanceColorAppearance.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Primitive({geometryInstances:new GeometryInstance({geometry:n,modelMatrix:Matrix4.fromRotationTranslation(h,l,new Matrix4),attributes:{color:new ColorGeometryInstanceAttribute(1,0,0,1)}}),appearance:new PerInstanceColorAppearance({flat:!0,translucent:!1}),asynchronous:!1})}var p,m=a.commandList,f=a.commandList=[];t._debugVolume.update(a),e=f[0],a.useLogDepth&&(e=DerivedCommand.createLogDepthCommand(e,o).command);defined(r)&&(p=i.framebuffer,i.framebuffer=r),e.execute(o,i),defined(p)&&(i.framebuffer=p),a.commandList=m}function executeCommand(e,t,i,r,n){var a=t._frameState;if(!defined(t.debugCommandFilter)||t.debugCommandFilter(e))if(e instanceof ClearCommand)e.execute(i,r);else{e.debugShowBoundingVolume&&defined(e.boundingVolume)&&debugShowBoundingVolume(e,t,r,n),a.useLogDepth&&defined(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);var o=a.passes;if(!o.pick&&t._hdr&&defined(e.derivedCommands)&&defined(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),o.pick||o.depth){if(o.pick&&!o.depth&&defined(e.derivedCommands.picking))return void(e=e.derivedCommands.picking.pickCommand).execute(i,r);if(defined(e.derivedCommands.depth))return void(e=e.derivedCommands.depth.depthOnlyCommand).execute(i,r)}t.debugShowCommands||t.debugShowFrustums?executeDebugCommand(e,t,r):a.shadowState.lightShadowsEnabled&&e.receiveShadows&&defined(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(i,r):e.execute(i,r)}}function executeIdCommand(e,t,i,r){var n=t._frameState,a=e.derivedCommands;defined(a)&&(n.useLogDepth&&defined(a.logDepth)&&(e=a.logDepth.command),defined((a=e.derivedCommands).picking)?(e=a.picking.pickCommand).execute(i,r):defined(a.depth)&&(e=a.depth.depthOnlyCommand).execute(i,r))}function backToFront(e,t,i){return t.boundingVolume.distanceSquaredTo(i)-e.boundingVolume.distanceSquaredTo(i)}function frontToBack(e,t,i){return e.boundingVolume.distanceSquaredTo(i)-t.boundingVolume.distanceSquaredTo(i)+CesiumMath.EPSILON12}function executeTranslucentCommandsBackToFront(e,t,i,r,n){var a=e.context;mergeSort(r,backToFront,e.camera.positionWC),defined(n)&&t(n.unclassifiedCommand,e,a,i);for(var o=r.length,s=0;s<o;++s)t(r[s],e,a,i)}function executeTranslucentCommandsFrontToBack(e,t,i,r,n){var a=e.context;mergeSort(r,frontToBack,e.camera.positionWC),defined(n)&&t(n.unclassifiedCommand,e,a,i);for(var o=r.length,s=0;s<o;++s)t(r[s],e,a,i)}function getDebugGlobeDepth(e,t){var i=e._view.debugGlobeDepths,r=i[t];return!defined(r)&&e.context.depthTexture&&(r=new GlobeDepth,i[t]=r),r}transformFrom2D=Matrix4.inverseTransformation(transformFrom2D,transformFrom2D);var scratchPerspectiveFrustum$1=new PerspectiveFrustum,scratchPerspectiveOffCenterFrustum$1=new PerspectiveOffCenterFrustum,scratchOrthographicFrustum$1=new OrthographicFrustum,scratchOrthographicOffCenterFrustum$1=new OrthographicOffCenterFrustum;function executeCommands(e,t){var i,r=e.camera,n=e.context,a=n.uniformState;a.updateCamera(r),(i=defined(r.frustum.fov)?r.frustum.clone(scratchPerspectiveFrustum$1):defined(r.frustum.infiniteProjectionMatrix)?r.frustum.clone(scratchPerspectiveOffCenterFrustum$1):defined(r.frustum.width)?r.frustum.clone(scratchOrthographicFrustum$1):r.frustum.clone(scratchOrthographicOffCenterFrustum$1)).near=r.frustum.near,i.far=r.frustum.far,a.updateFrustum(i),a.updatePass(Pass$1.ENVIRONMENT);var o,s=e._frameState.passes,l=s.pick,c=e._environmentState,u=e._view,d=c.renderTranslucentDepthForPick,h=c.useWebVR;if(!l){var p,m=c.skyBoxCommand;if(defined(m)&&executeCommand(m,e,n,t),c.isSkyAtmosphereVisible&&executeCommand(c.skyAtmosphereCommand,e,n,t),c.isSunVisible)if(c.sunDrawCommand.execute(n,t),e.sunBloom&&!h)p=c.useGlobeDepthFramebuffer?u.globeDepth.framebuffer:c.usePostProcess?u.sceneFramebuffer.getFramebuffer():c.originalFramebuffer,e._sunPostProcess.execute(n),e._sunPostProcess.copy(n,p),t.framebuffer=p;c.isMoonVisible&&c.moonCommand.execute(n,t)}o=c.useOIT?(defined(e._executeOITFunction)||(e._executeOITFunction=function(e,t,i,r,n){u.oit.executeCommands(e,t,i,r,n)}),e._executeOITFunction):s.render?executeTranslucentCommandsBackToFront:executeTranslucentCommandsFrontToBack;for(var f,g=u.frustumCommandsList,_=g.length,y=c.clearGlobeDepth,v=c.useDepthPlane,C=c.separatePrimitiveFramebuffer=!1,S=e._depthClearCommand,x=e._stencilClearCommand,T=e._classificationStencilClearCommand,b=e._depthPlane,E=c.usePostProcessSelected,P=r.position.z,A=0;A<_;++A){var w=_-A-1,D=g[w];e.mode===SceneMode$1.SCENE2D?(r.position.z=P-D.near+1,i.far=Math.max(1,D.far-D.near),i.near=1,a.update(e.frameState)):(i.near=0!=w?D.near*e.opaqueFrustumNearOffset:D.near,i.far=D.far),a.updateFrustum(i);var M,I=e.debugShowGlobeDepth?getDebugGlobeDepth(e,w):u.globeDepth;C&&(t.framebuffer=I.framebuffer),e.debugShowGlobeDepth&&defined(I)&&c.useGlobeDepthFramebuffer&&(I.update(n,t,u.viewport,e._hdr,y),I.clear(n,t,e._clearColorCommand.color),M=t.framebuffer,t.framebuffer=I.framebuffer),S.execute(n,t),n.stencilBuffer&&x.execute(n,t),a.updatePass(Pass$1.GLOBE);var R,O=D.commands[Pass$1.GLOBE],L=D.indices[Pass$1.GLOBE];for(f=0;f<L;++f)executeCommand(O[f],e,n,t);for(defined(I)&&c.useGlobeDepthFramebuffer&&I.executeCopyDepth(n,t),e.debugShowGlobeDepth&&defined(I)&&c.useGlobeDepthFramebuffer&&(t.framebuffer=M),a.updatePass(Pass$1.TERRAIN_CLASSIFICATION),O=D.commands[Pass$1.TERRAIN_CLASSIFICATION],L=D.indices[Pass$1.TERRAIN_CLASSIFICATION],f=0;f<L;++f)executeCommand(O[f],e,n,t);if(y&&(S.execute(n,t),v&&b.execute(n,t)),C&&(t.framebuffer=I.primitiveFramebuffer),!c.useInvertClassification||l){for(a.updatePass(Pass$1.CESIUM_3D_TILE),O=D.commands[Pass$1.CESIUM_3D_TILE],L=D.indices[Pass$1.CESIUM_3D_TILE],f=0;f<L;++f)executeCommand(O[f],e,n,t);if(0<L)for(defined(I)&&c.useGlobeDepthFramebuffer&&I.executeUpdateDepth(n,t,y),a.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),O=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],L=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],f=0;f<L;++f)executeCommand(O[f],e,n,t)}else{e._invertClassification.clear(n,t);var F=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo,a.updatePass(Pass$1.CESIUM_3D_TILE),O=D.commands[Pass$1.CESIUM_3D_TILE],L=D.indices[Pass$1.CESIUM_3D_TILE],f=0;f<L;++f)executeCommand(O[f],e,n,t);for(defined(I)&&c.useGlobeDepthFramebuffer&&I.executeUpdateDepth(n,t,y),a.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),O=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],L=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],f=0;f<L;++f)executeCommand(O[f],e,n,t);for(t.framebuffer=F,e._invertClassification.executeClassified(n,t),1===e.frameState.invertClassificationColor.alpha&&e._invertClassification.executeUnclassified(n,t),0<L&&n.stencilBuffer&&T.execute(n,t),a.updatePass(Pass$1.CESIUM_3D_TILE_CLASSIFICATION),O=D.commands[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],L=D.indices[Pass$1.CESIUM_3D_TILE_CLASSIFICATION],f=0;f<L;++f)executeCommand(O[f],e,n,t)}for(0<L&&n.stencilBuffer&&x.execute(n,t),a.updatePass(Pass$1.OPAQUE),O=D.commands[Pass$1.OPAQUE],L=D.indices[Pass$1.OPAQUE],f=0;f<L;++f)executeCommand(O[f],e,n,t);if(0!=w&&e.mode!==SceneMode$1.SCENE2D&&(i.near=D.near,a.updateFrustum(i)),!l&&c.useInvertClassification&&e.frameState.invertClassificationColor.alpha<1&&(R=e._invertClassification),a.updatePass(Pass$1.TRANSLUCENT),(O=D.commands[Pass$1.TRANSLUCENT]).length=D.indices[Pass$1.TRANSLUCENT],o(e,executeCommand,t,O,R),n.depthTexture&&e.useDepthPicking&&(c.useGlobeDepthFramebuffer||d)){var N=d?t.framebuffer.depthStencilTexture:I.framebuffer.depthStencilTexture,B=e._picking.getPickDepth(e,w);B.update(n,N),B.executeCopyDepth(n,t)}if(C&&(t.framebuffer=I.framebuffer),!l&&E){var V=t.framebuffer;for(t.framebuffer=u.sceneFramebuffer.getIdFramebuffer(),i.near=0!=w?D.near*e.opaqueFrustumNearOffset:D.near,i.far=D.far,a.updateFrustum(i),a.updatePass(Pass$1.GLOBE),O=D.commands[Pass$1.GLOBE],L=D.indices[Pass$1.GLOBE],f=0;f<L;++f)executeIdCommand(O[f],e,n,t);for(y&&(S.framebuffer=t.framebuffer,S.execute(n,t),S.framebuffer=void 0),y&&v&&b.execute(n,t),a.updatePass(Pass$1.CESIUM_3D_TILE),O=D.commands[Pass$1.CESIUM_3D_TILE],L=D.indices[Pass$1.CESIUM_3D_TILE],f=0;f<L;++f)executeIdCommand(O[f],e,n,t);for(a.updatePass(Pass$1.OPAQUE),O=D.commands[Pass$1.OPAQUE],L=D.indices[Pass$1.OPAQUE],f=0;f<L;++f)executeIdCommand(O[f],e,n,t);for(a.updatePass(Pass$1.TRANSLUCENT),O=D.commands[Pass$1.TRANSLUCENT],L=D.indices[Pass$1.TRANSLUCENT],f=0;f<L;++f)executeIdCommand(O[f],e,n,t);t.framebuffer=V}}}function executeComputeCommands(e){e.context.uniformState.updatePass(Pass$1.COMPUTE);var t=e._environmentState.sunComputeCommand;defined(t)&&t.execute(e._computeEngine);for(var i=e._computeCommandList,r=i.length,n=0;n<r;++n)i[n].execute(e._computeEngine)}function executeOverlayCommands(e,t){e.context.uniformState.updatePass(Pass$1.OVERLAY);for(var i=e.context,r=e._overlayCommandList,n=r.length,a=0;a<n;++a)r[a].execute(i,t)}function insertShadowCastCommands(e,t,i){for(var r=i.shadowMapCullingVolume,n=i.isPointLight,a=i.passes,o=a.length,s=t.length,l=0;l<s;++l){var c=t[l];if(e.updateDerivedCommands(c),c.castShadows&&(c.pass===Pass$1.GLOBE||c.pass===Pass$1.CESIUM_3D_TILE||c.pass===Pass$1.OPAQUE||c.pass===Pass$1.TRANSLUCENT)&&e.isVisible(c,r))if(n)for(var u=0;u<o;++u)a[u].commandList.push(c);else if(1===o)a[0].commandList.push(c);else for(var d=!1,h=o-1;0<=h;--h){var p=a[h].cullingVolume;if(e.isVisible(c,p))a[h].commandList.push(c),d=!0;else if(d)break}}}function executeShadowMapCastCommands(e){var t=e.frameState,i=t.shadowState.shadowMaps,r=i.length;if(t.shadowState.shadowsEnabled)for(var n=e.context,a=n.uniformState,o=0;o<r;++o){var s=i[o];if(!s.outOfView){var l,c=s.passes,u=c.length;for(l=0;l<u;++l)c[l].commandList.length=0;for(insertShadowCastCommands(e,e.frameState.commandList,s),l=0;l<u;++l){var d=s.passes[l];a.updateCamera(d.camera),s.updatePass(n,l);for(var h=d.commandList.length,p=0;p<h;++p){var m=d.commandList[p];a.updatePass(m.pass),executeCommand(m.derivedCommands.shadows.castCommands[o],e,n,d.passState)}}}}}var scratchEyeTranslation=new Cartesian3;function executeWebVRCommands(e,t,i){var r=e._view,n=r.camera,a=e._environmentState.renderTranslucentDepthForPick;updateAndClearFramebuffers(e,t,i),a||updateAndRenderPrimitives(e),r.createPotentiallyVisibleSet(e),a||(executeComputeCommands(e),executeShadowMapCastCommands(e));var o=t.viewport;o.x=0,o.y=0,o.width=.5*o.width;var s=Camera.clone(n,e._cameraVR);s.frustum=n.frustum;var l=n.frustum.near,c=l*defaultValue(e.focalLength,5),u=defaultValue(e.eyeSeparation,c/30),d=Cartesian3.multiplyByScalar(s.right,.5*u,scratchEyeTranslation);n.frustum.aspectRatio=o.width/o.height;var h=.5*u*l/c;Cartesian3.add(s.position,d,n.position),n.frustum.xOffset=h,executeCommands(e,t),o.x=o.width,Cartesian3.subtract(s.position,d,n.position),n.frustum.xOffset=-h,executeCommands(e,t),Camera.clone(s,n)}Scene.prototype.updateAndExecuteCommands=function(e,t){var i=this._frameState.mode;this._environmentState.useWebVR?executeWebVRCommands(this,e,t):i!==SceneMode$1.SCENE2D||this._mapMode2D===MapMode2D$1.ROTATE?executeCommandsInViewport(!0,this,e,t):(updateAndClearFramebuffers(this,e,t),execute2DViewportCommands(this,e))};var scratch2DViewportCartographic=new Cartographic(Math.PI,CesiumMath.PI_OVER_TWO),scratch2DViewportMaxCoord=new Cartesian3,scratch2DViewportSavedPosition=new Cartesian3,scratch2DViewportTransform=new Matrix4,scratch2DViewportCameraTransform=new Matrix4,scratch2DViewportEyePoint=new Cartesian3,scratch2DViewportWindowCoords=new Cartesian3,scratch2DViewport=new BoundingRectangle;function execute2DViewportCommands(e,t){var i=e.context,r=e.frameState,n=e.camera,a=t.viewport,o=BoundingRectangle.clone(a,scratch2DViewport);t.viewport=o;var s=scratch2DViewportCartographic,l=scratch2DViewportMaxCoord;e.mapProjection.project(s,l);var c=Cartesian3.clone(n.position,scratch2DViewportSavedPosition),u=Matrix4.clone(n.transform,scratch2DViewportCameraTransform),d=n.frustum.clone();n._setTransform(Matrix4.IDENTITY);var h=Matrix4.computeViewportTransformation(o,0,1,scratch2DViewportTransform),p=n.frustum.projectionMatrix,m=n.positionWC.y,f=Cartesian3.fromElements(CesiumMath.sign(m)*l.x-m,0,-n.positionWC.x,scratch2DViewportEyePoint),g=Transforms.pointToGLWindowCoordinates(p,h,f,scratch2DViewportWindowCoords);g.x=Math.floor(g.x);var _=o.x,y=o.width;if(0===m||g.x<=_||g.x>=_+y)executeCommandsInViewport(!0,e,t);else if(Math.abs(_+.5*y-g.x)<1)o.width=g.x-o.x,n.position.x*=CesiumMath.sign(n.position.x),n.frustum.right=0,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!0,e,t),o.x=g.x,n.position.x=-n.position.x,n.frustum.right=-n.frustum.left,n.frustum.left=0,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!1,e,t);else if(g.x>_+.5*y){o.width=g.x-_;var v=n.frustum.right;n.frustum.right=l.x-m,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!0,e,t),o.x=g.x,o.width=_+y-g.x,n.position.x=-n.position.x,n.frustum.left=-n.frustum.right,n.frustum.right=v-2*n.frustum.right,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!1,e,t)}else{o.x=g.x,o.width=_+y-g.x;var C=n.frustum.left;n.frustum.left=-l.x-m,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!0,e,t),o.x=_,o.width=g.x-_,n.position.x=-n.position.x,n.frustum.right=-n.frustum.left,n.frustum.left=C-2*n.frustum.left,r.cullingVolume=n.frustum.computeCullingVolume(n.positionWC,n.directionWC,n.upWC),i.uniformState.update(r),executeCommandsInViewport(!1,e,t)}n._setTransform(u),Cartesian3.clone(c,n.position),n.frustum=d.clone(),t.viewport=a}function executeCommandsInViewport(e,t,i,r){var n=t._environmentState,a=t._view,o=n.renderTranslucentDepthForPick;e||o||(t.frameState.commandList.length=0),o||updateAndRenderPrimitives(t),a.createPotentiallyVisibleSet(t),e&&(defined(r)&&updateAndClearFramebuffers(t,i,r),o||(executeComputeCommands(t),executeShadowMapCastCommands(t))),executeCommands(t,i)}var scratchCullingVolume$1=new CullingVolume;function updateDebugFrustumPlanes(e){var t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new DebugCameraPrimitive({camera:e.camera,updateOnChange:!1}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),defined(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function updateShadowMaps(e){var t=e._frameState,i=t.shadowMaps,r=i.length,n=0<r&&!t.passes.pick&&e.mode===SceneMode$1.SCENE3D;if(n!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=n),t.shadowState.lightShadowsEnabled=!1,n){for(var a=0;a<r;++a)if(i[a]!==t.shadowState.shadowMaps[a]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0;for(var o=t.shadowState.lightShadowMaps.length=0;o<r;++o){var s=i[o];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 updateAndRenderPrimitives(e){var t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),updateDebugFrustumPlanes(e),updateShadowMaps(e),e._globe&&!ExpandByMars.mirror.MirrorEnable&&e._globe.render(t)}function updateAndClearFramebuffers(e,t,i){var r=e._context,n=e._frameState,a=e._environmentState,o=e._view,s=e._frameState.passes.pick,l=a.useWebVR;a.originalFramebuffer=t.framebuffer,defined(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!l?e._sunPostProcess=new SunPostProcess:defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!defined(e.sun)&&defined(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);var c=e._clearColorCommand;Color.clone(i,c.color),c.execute(r,t);var u=a.useGlobeDepthFramebuffer=defined(o.globeDepth);u&&(o.globeDepth.update(r,t,o.viewport,e._hdr,a.clearGlobeDepth),o.globeDepth.clear(r,t,i));var d=o.oit,h=a.useOIT=!s&&defined(d)&&d.isSupported();h&&(d.update(r,t,o.globeDepth.framebuffer,e._hdr),d.clear(r,t,i),a.useOIT=d.isSupported());var p,m=e.postProcessStages,f=a.usePostProcess=!s&&(e._hdr||0<m.length||m.ambientOcclusion.enabled||m.fxaa.enabled||m.bloom.enabled);if(a.usePostProcessSelected=!1,f&&(o.sceneFramebuffer.update(r,o.viewport,e._hdr),o.sceneFramebuffer.clear(r,t,i),m.update(r,n.useLogDepth,e._hdr),m.clear(r),f=a.usePostProcess=m.ready,a.usePostProcessSelected=f&&m.hasSelected),a.isSunVisible&&e.sunBloom&&!l?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(r,t,i)):u?t.MirrorEnable?t.framebuffer=ExpandByMars.mirror.MirrorFrameBuffer:t.framebuffer=o.globeDepth.framebuffer:f&&(t.framebuffer=o.sceneFramebuffer.getFramebuffer()),defined(t.framebuffer)&&c.execute(r,t),a.useInvertClassification=!s&&defined(t.framebuffer)&&e.invertClassification)if(1===e.frameState.invertClassificationColor.alpha&&a.useGlobeDepthFramebuffer&&(p=o.globeDepth.framebuffer),defined(p)||r.depthTexture){if(e._invertClassification.previousFramebuffer=p,e._invertClassification.update(r),e._invertClassification.clear(r,t),e.frameState.invertClassificationColor.alpha<1&&h){var g=e._invertClassification.unclassifiedCommand,_=g.derivedCommands;_.oit=d.createDerivedCommands(g,r,_.oit)}}else a.useInvertClassification=!1}function callAfterRenderFunctions(e){for(var t=e._frameState.afterRender,i=0,r=t.length;i<r;++i)t[i](),e.requestRender();t.length=0}function updateDebugShowFramesPerSecond(e,t){if(e.debugShowFramesPerSecond){if(!defined(e._performanceDisplay)){var i=document.createElement("div");i.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(i);var r=new PerformanceDisplay({container:i});e._performanceDisplay=r,e._performanceContainer=i}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else defined(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function prePassesUpdate(e){e._jobScheduler.resetBudgets();var t=e._frameState;e.primitives.prePassesUpdate(t),defined(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function postPassesUpdate(e){var t=e._frameState;e.primitives.postPassesUpdate(t),RequestScheduler.update()}Scene.prototype.updateEnvironment=function(){var e=this._frameState,t=this._view,i=this._environmentState,r=e.passes.render,n=e.passes.offscreen,a=this.skyAtmosphere,o=this.globe;if(!r||this._mode!==SceneMode$1.SCENE2D&&t.camera.frustum instanceof OrthographicFrustum)i.skyAtmosphereCommand=void 0,i.skyBoxCommand=void 0,i.sunDrawCommand=void 0,i.sunComputeCommand=void 0,i.moonCommand=void 0;else{defined(a)&&defined(o)&&(a.setDynamicAtmosphereColor(o.enableLighting),i.isReadyForAtmosphere=i.isReadyForAtmosphere||0<o._surface._tilesToRender.length),i.skyAtmosphereCommand=defined(a)?a.update(e):void 0,i.skyBoxCommand=defined(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;var s=defined(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;i.sunDrawCommand=defined(s)?s.drawCommand:void 0,i.sunComputeCommand=defined(s)?s.computeCommand:void 0,i.moonCommand=defined(this.moon)?this.moon.update(e):void 0}var l=i.clearGlobeDepth=defined(o)&&(!o.depthTestAgainstTerrain||this.mode===SceneMode$1.SCENE2D);(i.useDepthPlane=l&&this.mode===SceneMode$1.SCENE3D)&&this._depthPlane.update(e),i.renderTranslucentDepthForPick=!1,i.useWebVR=this._useWebVR&&this.mode!==SceneMode$1.SCENE2D&&!n;for(var c=e.mode===SceneMode$1.SCENE3D?e.occluder:void 0,u=e.cullingVolume,d=scratchCullingVolume$1.planes,h=0;h<5;++h)d[h]=u.planes[h];u=scratchCullingVolume$1,i.isSkyAtmosphereVisible=defined(i.skyAtmosphereCommand)&&i.isReadyForAtmosphere,i.isSunVisible=this.isVisible(i.sunDrawCommand,u,c),i.isMoonVisible=this.isVisible(i.moonCommand,u,c);var p=this.specularEnvironmentMaps,m=this._specularEnvironmentMapAtlas;!defined(p)||defined(m)&&m.url===p?!defined(p)&&defined(m)&&(m.destroy(),this._specularEnvironmentMapAtlas=void 0):(m=m&&m.destroy(),this._specularEnvironmentMapAtlas=new OctahedralProjectedCubeMap(p)),defined(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)},Scene.prototype.resolveFramebuffers=function(e){var t=this._context,i=this._frameState,r=this._environmentState,n=this._view,a=n.globeDepth,o=r.useOIT,s=r.useGlobeDepthFramebuffer,l=r.usePostProcess,c=r.originalFramebuffer,u=s?a.framebuffer:void 0,d=n.sceneFramebuffer.getFramebuffer(),h=n.sceneFramebuffer.getIdFramebuffer();if(r.separatePrimitiveFramebuffer&&a.executeMergeColor(t,e),o&&(e.framebuffer=l?d:c,n.oit.execute(t,e)),l){var p=d;s&&!o&&(p=u);var m=this.postProcessStages,f=p.getColorTexture(0),g=h.getColorTexture(0),_=defaultValue(u,d).depthStencilTexture;m.execute(t,f,_,g),m.copy(t,c)}o||l||!s||(e.framebuffer=c,a.executeCopyColor(t,e));var y=i.useLogDepth;this.debugShowGlobeDepth&&s&&getDebugGlobeDepth(this,this.debugShowDepthFrustum-1).executeDebugGlobeDepth(t,e,y);this.debugShowPickDepth&&s&&this._picking.getPickDepth(this,this.debugShowDepthFrustum-1).executeDebugPickDepth(t,e,y)},Scene.prototype.initializeFrame=function(){120==this._shaderFrameCount++&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._screenSpaceCameraController.update(),defined(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};var scratchBackgroundColor=new Color;function render(e){var t=e._frameState,i=e.context,r=i.uniformState,n=e._defaultView;e._view=n,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=renderTilesetPassState;var a=defaultValue(e.backgroundColor,Color.BLACK);e._hdr&&((a=Color.clone(a,scratchBackgroundColor)).red=Math.pow(a.red,e.gamma),a.green=Math.pow(a.green,e.gamma),a.blue=Math.pow(a.blue,e.gamma)),t.backgroundColor=a,e.fog.update(t),r.update(t);var o=e.shadowMap;defined(o)&&o.enabled&&(Cartesian3.negate(r.sunDirectionWC,e._sunCamera.direction),t.shadowMaps.push(o)),e._computeCommandList.length=0,e._overlayCommandList.length=0;var s=n.viewport;if(s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight,(l=n.passState).MirrorEnable=!1,l.framebuffer=void 0,l.blendingEnabled=void 0,l.scissorTest=void 0,l.viewport=BoundingRectangle.clone(s,l.viewport),defined(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(l,a),e.resolveFramebuffers(l),l.framebuffer=void 0,l.framebuffer=ExpandByMars.MirrorFrameBuffer,executeOverlayCommands(e,l),defined(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),ExpandByMars.mirror.MirrorEnable){var l;l.MirrorEnable=!0,(l=n.passState).framebuffer=ExpandByMars.mirror.MirrorFrameBuffer;var c=reflectCameraByPlane(e._view.camera,ExpandByMars.mirror.planeOrigin,Cesium.ExpandByMars.mirror.normal),u={};u.position=new Cartesian3(e.camera.position.x,e.camera.position.y,e.camera.position.z),u.right=new Cartesian3(e.camera.right.x,e.camera.right.y,e.camera.right.z),u.up=new Cartesian3(e.camera.up.x,e.camera.up.y,e.camera.up.z),u.direction=new Cartesian3(e.camera.direction.x,e.camera.direction.y,e.camera.direction.z),e.camera.position=c.position,e.camera.right=c.right,e.camera.direction=c.direction,e.camera.up=c.up,e.camera.frustum.near=Cartesian3.distance(e._view.camera.position,ExpandByMars.mirror.planeOrigin),ExpandByMars.mirror.MirrorProjectionMatrix=Matrix4.computePerspectiveFieldOfView(e.camera.frustum.fov,e.camera.frustum.aspectRatio,e.camera.frustum.near,e.camera.frustum.far,new Matrix4),ExpandByMars.mirror.MirrorViewMatrix=Matrix4.computeView(e.camera.position,e.camera.direction,e.camera.up,e.camera.right,new Matrix4),l.viewport=BoundingRectangle.clone(s,l.viewport),defined(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(l,a),l.framebuffer=ExpandByMars.mirror.MirrorFrameBuffer,e.resolveFramebuffers(l),executeOverlayCommands(e,l),defined(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),e.camera.position=u.position,e.camera.right=u.right,e.camera.direction=u.direction,e.camera.up=u.up,e.camera.frustum.near=1}i.endFrame()}function tryAndCatchError(t,e){try{e(t)}catch(e){if(t._renderError.raiseEvent(t,e),t.rethrowRenderErrors)throw e}}function updateMostDetailedRayPicks(e){return e._picking.updateMostDetailedRayPicks(e)}function updatePreloadPass(e){var t=e._frameState;preloadTilesetPassState.camera=t.camera,preloadTilesetPassState.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,preloadTilesetPassState)}function updatePreloadFlightPass(e){var t=e._frameState;t.camera.hasCurrentFlight()&&(preloadFlightTilesetPassState.camera=e.preloadFlightCamera,preloadFlightTilesetPassState.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,preloadFlightTilesetPassState))}function updateRequestRenderModeDeferCheckPass(e){e.primitives.updateForPass(e._frameState,requestRenderModeDeferCheckPassState)}Scene.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);var t=this._frameState;t.newFrame=!1,defined(e)||(e=JulianDate.now());var i=this._view.checkForCameraUpdates(this),r=!this.requestRenderMode||this._renderRequested||i||this._logDepthBufferDirty||this._hdrDirty||this.mode===SceneMode$1.MORPHING;if(!r&&defined(this.maximumRenderTimeChange)&&defined(this._lastRenderTime)){var n=Math.abs(JulianDate.secondsDifference(this._lastRenderTime,e));r=r||n>this.maximumRenderTimeChange}r&&(this._lastRenderTime=JulianDate.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1,updateFrameNumber(this,CesiumMath.incrementWrap(t.frameNumber,15e6,1),e),t.newFrame=!0);tryAndCatchError(this,prePassesUpdate),this.primitives.show&&(tryAndCatchError(this,updateMostDetailedRayPicks),tryAndCatchError(this,updatePreloadPass),tryAndCatchError(this,updatePreloadFlightPass),r||tryAndCatchError(this,updateRequestRenderModeDeferCheckPass)),this._postUpdate.raiseEvent(this,e),r&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),tryAndCatchError(this,render)),updateDebugShowFramesPerSecond(this,r),tryAndCatchError(this,postPassesUpdate),callAfterRenderFunctions(this),r&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())},Scene.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)},Scene.prototype.requestRender=function(){this._renderRequested=!0},Scene.prototype.clampLineWidth=function(e){return Math.max(ContextLimits.minimumAliasedLineWidth,Math.min(e,ContextLimits.maximumAliasedLineWidth))},Scene.prototype.pick=function(e,t,i){return this._picking.pick(this,e,t,i)},Scene.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)},Scene.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)},Scene.prototype.drillPick=function(e,t,i,r){return this._picking.drillPick(this,e,t,i,r)},Scene.prototype.pickFromRay=function(e,t,i){return this._picking.pickFromRay(this,e,t,i)},Scene.prototype.drillPickFromRay=function(e,t,i,r){return this._picking.drillPickFromRay(this,e,t,i,r)},Scene.prototype.pickFromRayMostDetailed=function(e,t,i){return this._picking.pickFromRayMostDetailed(this,e,t,i)},Scene.prototype.drillPickFromRayMostDetailed=function(e,t,i,r){return this._picking.drillPickFromRayMostDetailed(this,e,t,i,r)},Scene.prototype.sampleHeight=function(e,t,i){return this._picking.sampleHeight(this,e,t,i)},Scene.prototype.clampToHeight=function(e,t,i,r){return this._picking.clampToHeight(this,e,t,i,r)},Scene.prototype.sampleHeightMostDetailed=function(e,t,i){return this._picking.sampleHeightMostDetailed(this,e,t,i)},Scene.prototype.clampToHeightMostDetailed=function(e,t,i){return this._picking.clampToHeightMostDetailed(this,e,t,i)},Scene.prototype.cartesianToCanvasCoordinates=function(e,t){return SceneTransforms.wgs84ToWindowCoordinates(this,e,t)},Scene.prototype.completeMorph=function(){this._transitioner.completeMorph()},Scene.prototype.morphTo2D=function(e){var t,i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo2D(e,t)},Scene.prototype.morphToColumbusView=function(e){var t,i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphToColumbusView(e,t)},Scene.prototype.morphTo3D=function(e){var t,i=this.globe;t=defined(i)?i.ellipsoid:this.mapProjection.ellipsoid,e=defaultValue(e,2),this._transitioner.morphTo3D(e,t)},Scene.prototype.isDestroyed=function(){return!1},Scene.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.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(),defined(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(var e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,destroyObject(this)};var SkyAtmosphereFS="#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\nuniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor;\nconst float g = -0.95;\nconst float g2 = g * g;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\nvarying vec3 v_toCamera;\nvarying vec3 v_positionEC;\nvoid main (void)\n{\nfloat cosAngle = dot(czm_sunDirectionWC, normalize(v_toCamera)) / length(v_toCamera);\nfloat rayleighPhase = 0.75 * (1.0 + cosAngle * cosAngle);\nfloat miePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + cosAngle * cosAngle) / pow(1.0 + g2 - 2.0 * g * cosAngle, 1.5);\nvec3 rgb = rayleighPhase * v_rayleighColor + miePhase * v_mieColor;\n#ifndef HDR\nconst float exposure = 2.0;\nrgb = vec3(1.0) - exp(-exposure * rgb);\n#endif\n#ifdef COLOR_CORRECT\nvec3 hsb = czm_RGBToHSB(rgb);\nhsb.x += u_hsbShift.x;\nhsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0);\nhsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0;\nrgb = czm_HSBToRGB(hsb);\n#endif\nfloat atmosphereAlpha = clamp((u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.x) / (u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.z), 0.0, 1.0);\nfloat nightAlpha = (u_cameraAndRadiiAndDynamicAtmosphereColor.w > 0.0) ? clamp(dot(normalize(czm_viewerPositionWC), normalize(czm_sunPositionWC)), 0.0, 1.0) : 1.0;\natmosphereAlpha *= pow(nightAlpha, 0.5);\ngl_FragColor = vec4(rgb, mix(rgb.b, 1.0, atmosphereAlpha) * smoothstep(0.0, 1.0, czm_morphTime));\n}\n",SkyAtmosphereVS="attribute vec4 position;\nuniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * czm_pi;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * czm_pi;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 InvWavelength = vec3(\n5.60204474633241,\n9.473284437923038,\n19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\nvarying vec3 v_toCamera;\nfloat scale(float cosAngle)\n{\nfloat x = 1.0 - cosAngle;\nreturn rayleighScaleDepth  * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid main(void)\n{\nfloat cameraHeight = u_cameraAndRadiiAndDynamicAtmosphereColor.x;\nfloat outerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.y;\nfloat innerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.z;\nvec3 positionV3 = position.xyz;\nvec3 ray = positionV3 - czm_viewerPositionWC;\nfloat far = length(ray);\nray /= far;\nfloat atmosphereScale = 1.0 / (outerRadius - innerRadius);\n#ifdef SKY_FROM_SPACE\nfloat B = 2.0 * dot(czm_viewerPositionWC, ray);\nfloat C = cameraHeight * cameraHeight - outerRadius * outerRadius;\nfloat det = max(0.0, B*B - 4.0 * C);\nfloat near = 0.5 * (-B - sqrt(det));\nvec3 start = czm_viewerPositionWC + ray * near;\nfar -= near;\nfloat startAngle = dot(ray, start) / outerRadius;\nfloat startDepth = exp(-1.0 / rayleighScaleDepth );\nfloat startOffset = startDepth*scale(startAngle);\n#else // SKY_FROM_ATMOSPHERE\nvec3 start = czm_viewerPositionWC;\nfloat height = length(start);\nfloat depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));\nfloat startAngle = dot(ray, start) / height;\nfloat startOffset = depth*scale(startAngle);\n#endif\nfloat sampleLength = far / fSamples;\nfloat scaledLength = sampleLength * atmosphereScale;\nvec3 sampleRay = ray * sampleLength;\nvec3 samplePoint = start + sampleRay * 0.5;\nvec3 frontColor = vec3(0.0, 0.0, 0.0);\nvec3 lightDir = (u_cameraAndRadiiAndDynamicAtmosphereColor.w > 0.0) ? czm_sunPositionWC - czm_viewerPositionWC : czm_viewerPositionWC;\nlightDir = normalize(lightDir);\nfor(int i=0; i<nSamples; i++)\n{\nfloat height = length(samplePoint);\nfloat depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - height));\nfloat fLightAngle = dot(lightDir, samplePoint) / height;\nfloat fCameraAngle = dot(ray, samplePoint) / height;\nfloat fScatter = (startOffset + depth*(scale(fLightAngle) - scale(fCameraAngle)));\nvec3 attenuate = exp(-fScatter * (InvWavelength * Kr4PI + Km4PI));\nfrontColor += attenuate * (depth * scaledLength);\nsamplePoint += sampleRay;\n}\nv_mieColor = frontColor * KmESun;\nv_rayleighColor = frontColor * (InvWavelength * KrESun);\nv_toCamera = czm_viewerPositionWC - positionV3;\ngl_Position = czm_modelViewProjection * position;\n}\n";function SkyAtmosphere(e){e=defaultValue(e,Ellipsoid.WGS84),this.show=!0,this._ellipsoid=e,this._command=new DrawCommand({owner:this}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._spSkyFromSpaceColorCorrect=void 0,this._spSkyFromAtmosphereColorCorrect=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new Cartesian3;var t=new Cartesian4;t.w=0,t.y=Cartesian3.maximumComponent(Cartesian3.multiplyByScalar(e.radii,1.025,new Cartesian3)),t.z=e.maximumRadius,this._cameraAndRadiiAndDynamicAtmosphereColor=t;var i=this;this._command.uniformMap={u_cameraAndRadiiAndDynamicAtmosphereColor:function(){return i._cameraAndRadiiAndDynamicAtmosphereColor},u_hsbShift:function(){return i._hueSaturationBrightness.x=i.hueShift,i._hueSaturationBrightness.y=i.saturationShift,i._hueSaturationBrightness.z=i.brightnessShift,i._hueSaturationBrightness}}}function colorCorrect(e){return!(CesiumMath.equalsEpsilon(e.hueShift,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(e.saturationShift,0,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(e.brightnessShift,0,CesiumMath.EPSILON7))}defineProperties$1(SkyAtmosphere.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),SkyAtmosphere.prototype.setDynamicAtmosphereColor=function(e){this._cameraAndRadiiAndDynamicAtmosphereColor.w=e?1:0},SkyAtmosphere.prototype.update=function(e){if(this.show){var t=e.mode;if((t===SceneMode$1.SCENE3D||t===SceneMode$1.MORPHING)&&e.passes.render){var i=this._command;if(!defined(i.vertexArray)){var r=e.context,n=EllipsoidGeometry.createGeometry(new EllipsoidGeometry({radii:Cartesian3.multiplyByScalar(this._ellipsoid.radii,1.025,new Cartesian3),slicePartitions:256,stackPartitions:256,vertexFormat:VertexFormat.POSITION_ONLY}));i.vertexArray=VertexArray.fromGeometry({context:r,geometry:n,attributeLocations:GeometryPipeline.createAttributeLocations(n),bufferUsage:BufferUsage$1.STATIC_DRAW}),i.renderState=RenderState.fromCache({cull:{enabled:!0,face:CullFace$1.FRONT},blending:BlendingState$1.ALPHA_BLEND,depthMask:!1});var a=new ShaderSource({defines:["SKY_FROM_SPACE"],sources:[SkyAtmosphereVS]});this._spSkyFromSpace=ShaderProgram.fromCache({context:r,vertexShaderSource:a,fragmentShaderSource:SkyAtmosphereFS}),a=new ShaderSource({defines:["SKY_FROM_ATMOSPHERE"],sources:[SkyAtmosphereVS]}),this._spSkyFromAtmosphere=ShaderProgram.fromCache({context:r,vertexShaderSource:a,fragmentShaderSource:SkyAtmosphereFS})}var o=colorCorrect(this);if(o&&(!defined(this._spSkyFromSpaceColorCorrect)||!defined(this._spSkyFromAtmosphereColorCorrect))){var s=e.context,l=new ShaderSource({defines:["SKY_FROM_SPACE"],sources:[SkyAtmosphereVS]}),c=new ShaderSource({defines:["COLOR_CORRECT"],sources:[SkyAtmosphereFS]});this._spSkyFromSpaceColorCorrect=ShaderProgram.fromCache({context:s,vertexShaderSource:l,fragmentShaderSource:c}),l=new ShaderSource({defines:["SKY_FROM_ATMOSPHERE"],sources:[SkyAtmosphereVS]}),this._spSkyFromAtmosphereColorCorrect=ShaderProgram.fromCache({context:s,vertexShaderSource:l,fragmentShaderSource:c})}var u=e.camera.positionWC,d=Cartesian3.magnitude(u);return(this._cameraAndRadiiAndDynamicAtmosphereColor.x=d)>this._cameraAndRadiiAndDynamicAtmosphereColor.y?i.shaderProgram=o?this._spSkyFromSpaceColorCorrect:this._spSkyFromSpace:i.shaderProgram=o?this._spSkyFromAtmosphereColorCorrect:this._spSkyFromAtmosphere,i}}},SkyAtmosphere.prototype.isDestroyed=function(){return!1},SkyAtmosphere.prototype.destroy=function(){var e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyFromSpace=this._spSkyFromSpace&&this._spSkyFromSpace.destroy(),this._spSkyFromAtmosphere=this._spSkyFromAtmosphere&&this._spSkyFromAtmosphere.destroy(),this._spSkyFromSpaceColorCorrect=this._spSkyFromSpaceColorCorrect&&this._spSkyFromSpaceColorCorrect.destroy(),this._spSkyFromAtmosphereColorCorrect=this._spSkyFromAtmosphereColorCorrect&&this._spSkyFromAtmosphereColorCorrect.destroy(),destroyObject(this)};var SkyBoxFS="uniform samplerCube u_cubeMap;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\ngl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}\n",SkyBoxVS="attribute vec3 position;\nuniform mat3 u_rotateMatrix;\nvarying vec3 v_texCoord;\nvoid main()\n{\nvec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\ngl_Position = czm_projection * vec4(p, 1.0);\nv_texCoord = position.xyz;\n}\n";function SkyBox(e){this.sources=e.sources,this._sources=void 0,this.nearGround=e.nearGround,this.show=defaultValue(e.show,!0),this._command=new DrawCommand({modelMatrix:Matrix4.clone(Matrix4.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}function SphereEmitter(e){e=defaultValue(e,1),this._radius=defaultValue(e,1)}function StyleExpression(){}SkyBox.prototype.update=function(e,t){var i=this;if(this.show&&(e.mode===SceneMode$1.SCENE3D||e.mode===SceneMode$1.MORPHING)&&e.passes.render){var r=e.context;if(this._sources!==this.sources){this._sources=this.sources;var n=this.sources;"string"==typeof n.positiveX?loadCubeMap(r,this._sources).then(function(e){i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new CubeMap({context:r,source:n}))}var a=this._command;if(!defined(a.vertexArray)){a.uniformMap={u_cubeMap:function(){return i._cubeMap},u_rotateMatrix:function(){return i.nearGround?(a.modelMatrix=Transforms.eastNorthUpToFixedFrame(e.camera._positionWC),Matrix4.getRotation(a.modelMatrix,new Matrix3)):Matrix3.IDENTITY}};var o=BoxGeometry.createGeometry(BoxGeometry.fromDimensions({dimensions:new Cartesian3(2,2,2),vertexFormat:VertexFormat.POSITION_ONLY})),s=this._attributeLocations=GeometryPipeline.createAttributeLocations(o);a.vertexArray=VertexArray.fromGeometry({context:r,geometry:o,attributeLocations:s,bufferUsage:BufferUsage$1.STATIC_DRAW}),a.renderState=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND})}if(!defined(a.shaderProgram)||this._useHdr!==t){var l=new ShaderSource({defines:[t?"HDR":""],sources:[SkyBoxFS]});a.shaderProgram=ShaderProgram.fromCache({context:r,vertexShaderSource:SkyBoxVS,fragmentShaderSource:l,attributeLocations:this._attributeLocations}),this._useHdr=t}if(defined(this._cubeMap))return a}},SkyBox.prototype.isDestroyed=function(){return!1},SkyBox.prototype.destroy=function(){var 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(),destroyObject(this)},defineProperties$1(SphereEmitter.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}}),SphereEmitter.prototype.emit=function(e){var t=CesiumMath.randomBetween(0,CesiumMath.TWO_PI),i=CesiumMath.randomBetween(0,CesiumMath.PI),r=CesiumMath.randomBetween(0,this._radius),n=r*Math.cos(t)*Math.sin(i),a=r*Math.sin(t)*Math.sin(i),o=r*Math.cos(i);e.position=Cartesian3.fromElements(n,a,o,e.position),e.velocity=Cartesian3.normalize(e.position,e.velocity)},StyleExpression.prototype.evaluate=function(e,t){DeveloperError.throwInstantiationError()},StyleExpression.prototype.evaluateColor=function(e,t){DeveloperError.throwInstantiationError()},StyleExpression.prototype.getShaderFunction=function(e,t,i,r){DeveloperError.throwInstantiationError()};var SunFS="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color = texture2D(u_texture, v_textureCoordinates);\ngl_FragColor = czm_gammaCorrect(color);\n}\n",SunTextureFS="uniform float u_radiusTS;\nvarying vec2 v_textureCoordinates;\nvec2 rotate(vec2 p, vec2 direction)\n{\nreturn vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);\n}\nvec4 addBurst(vec2 position, vec2 direction, float lengthScalar)\n{\nvec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);\nfloat radius = length(rotatedPosition) * lengthScalar;\nfloat burst = 1.0 - smoothstep(0.0, 0.55, radius);\nreturn vec4(burst);\n}\nvoid main()\n{\nfloat lengthScalar = 2.0 / sqrt(2.0);\nvec2 position = v_textureCoordinates - vec2(0.5);\nfloat radius = length(position) * lengthScalar;\nfloat surface = step(radius, u_radiusTS);\nvec4 color = vec4(vec2(1.0), surface + 0.2, surface);\nfloat glow = 1.0 - smoothstep(0.0, 0.55, radius);\ncolor.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;\nvec4 burst = vec4(0.0);\nburst += 0.4 * addBurst(position, vec2(0.38942,  0.92106), lengthScalar);\nburst += 0.4 * addBurst(position, vec2(0.99235,  0.12348), lengthScalar);\nburst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar);\nburst += 0.3 * addBurst(position, vec2(0.31457,  0.94924), lengthScalar);\nburst += 0.3 * addBurst(position, vec2(0.97931,  0.20239), lengthScalar);\nburst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar);\ncolor += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;\ngl_FragColor = clamp(color, vec4(0.0), vec4(1.0));\n}\n",SunVS="attribute vec2 direction;\nuniform float u_size;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 position;\nif (czm_morphTime == 1.0)\n{\nposition = vec4(czm_sunPositionWC, 1.0);\n}\nelse\n{\nposition = vec4(czm_sunPositionColumbusView.zxy, 1.0);\n}\nvec4 positionEC = czm_view * position;\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\nvec2 halfSize = vec2(u_size * 0.5);\nhalfSize *= ((direction * 2.0) - 1.0);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);\nv_textureCoordinates = direction;\n}\n";function Sun(){this.show=!0,this._drawCommand=new DrawCommand({primitiveType:PrimitiveType$1.TRIANGLES,boundingVolume:new BoundingSphere,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new BoundingSphere,this._boundingVolume2D=new BoundingSphere,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;var e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}defineProperties$1(Sun.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});var scratchPositionWC=new Cartesian2,scratchLimbWC=new Cartesian2,scratchPositionEC=new Cartesian4,scratchCartesian4$6=new Cartesian4;function TileBoundingVolume(){}function TileCoordinatesImageryProvider(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this._tilingScheme=defined(e.tilingScheme)?e.tilingScheme:new GeographicTilingScheme({ellipsoid:e.ellipsoid}),this._color=defaultValue(e.color,Color.YELLOW),this._errorEvent=new Event,this._tileWidth=defaultValue(e.tileWidth,256),this._tileHeight=defaultValue(e.tileHeight,256),this._readyPromise=when.resolve(!0)}function TileDiscardPolicy(e){DeveloperError.throwInstantiationError()}Sun.prototype.update=function(e,t,i){if(this.show){var r=e.mode;if(r!==SceneMode$1.SCENE2D&&r!==SceneMode$1.MORPHING&&e.passes.render){var n=e.context,a=t.viewport.width,o=t.viewport.height;if(!defined(this._texture)||a!==this._drawingBufferWidth||o!==this._drawingBufferHeight||this._glowFactorDirty||i!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=a,this._drawingBufferHeight=o,this._glowFactorDirty=!1,this._useHdr=i;var s=Math.max(a,o);s=Math.pow(2,Math.ceil(Math.log(s)/Math.log(2))-2),s=Math.max(1,s);var l=i?n.halfFloatingPointTexture?PixelDatatype$1.HALF_FLOAT:PixelDatatype$1.FLOAT:PixelDatatype$1.UNSIGNED_BYTE;this._texture=new Texture({context:n,width:s,height:s,pixelFormat:PixelFormat$1.RGBA,pixelDatatype:l}),this._glowLengthTS=5*this._glowFactor,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;var c=this,u={u_radiusTS:function(){return c._radiusTS}};this._commands.computeCommand=new ComputeCommand({fragmentShaderSource:SunTextureFS,outputTexture:this._texture,uniformMap:u,persists:!1,owner:this,postExecute:function(){c._commands.computeCommand=void 0}})}var d=this._drawCommand;if(!defined(d.vertexArray)){var h={direction:0},p=new Uint8Array(8);p[0]=0,p[1]=0,p[2]=255,p[3]=0,p[4]=255,p[5]=255,p[6]=0,p[7]=255;var m=Buffer$1.createVertexBuffer({context:n,typedArray:p,usage:BufferUsage$1.STATIC_DRAW}),f=[{index:h.direction,vertexBuffer:m,componentsPerAttribute:2,normalize:!0,componentDatatype:ComponentDatatype$1.UNSIGNED_BYTE}],g=Buffer$1.createIndexBuffer({context:n,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:BufferUsage$1.STATIC_DRAW,indexDatatype:IndexDatatype$1.UNSIGNED_SHORT});d.vertexArray=new VertexArray({context:n,attributes:f,indexBuffer:g}),d.shaderProgram=ShaderProgram.fromCache({context:n,vertexShaderSource:SunVS,fragmentShaderSource:SunFS,attributeLocations:h}),d.renderState=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND}),d.uniformMap=this._uniformMap}var _=n.uniformState.sunPositionWC,y=n.uniformState.sunPositionColumbusView,v=this._boundingVolume,C=this._boundingVolume2D;Cartesian3.clone(_,v.center),C.center.x=y.z,C.center.y=y.x,C.center.z=y.y,v.radius=CesiumMath.SOLAR_RADIUS+CesiumMath.SOLAR_RADIUS*this._glowLengthTS,C.radius=v.radius,r===SceneMode$1.SCENE3D?BoundingSphere.clone(v,d.boundingVolume):r===SceneMode$1.COLUMBUS_VIEW&&BoundingSphere.clone(C,d.boundingVolume);var S=SceneTransforms.computeActualWgs84Position(e,_,scratchCartesian4$6),x=Cartesian3.magnitude(Cartesian3.subtract(S,e.camera.position,scratchCartesian4$6)),T=n.uniformState.projection,b=scratchPositionEC;b.x=0,b.y=0,b.z=-x,b.w=1;var E=Matrix4.multiplyByVector(T,b,scratchCartesian4$6),P=SceneTransforms.clipToGLWindowCoordinates(t.viewport,E,scratchPositionWC);b.x=CesiumMath.SOLAR_RADIUS;var A=Matrix4.multiplyByVector(T,b,scratchCartesian4$6),w=SceneTransforms.clipToGLWindowCoordinates(t.viewport,A,scratchLimbWC);return this._size=Cartesian2.magnitude(Cartesian2.subtract(w,P,scratchCartesian4$6)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands}}},Sun.prototype.isDestroyed=function(){return!1},Sun.prototype.destroy=function(){var 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(),destroyObject(this)},TileBoundingVolume.prototype.boundingVolume=void 0,TileBoundingVolume.prototype.boundingSphere=void 0,TileBoundingVolume.prototype.distanceToCamera=function(e){DeveloperError.throwInstantiationError()},TileBoundingVolume.prototype.intersectPlane=function(e){DeveloperError.throwInstantiationError()},TileBoundingVolume.prototype.createDebugVolume=function(e){DeveloperError.throwInstantiationError()},defineProperties$1(TileCoordinatesImageryProvider.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),TileCoordinatesImageryProvider.prototype.getTileCredits=function(e,t,i){},TileCoordinatesImageryProvider.prototype.requestImage=function(e,t,i,r){var n=document.createElement("canvas");n.width=256,n.height=256;var a=n.getContext("2d"),o=this._color.toCssColorString();return a.strokeStyle=o,a.lineWidth=2,a.strokeRect(1,1,255,255),a.font="bold 25px Arial",a.textAlign="center",a.fillStyle=o,a.fillText("L: "+i,124,86),a.fillText("X: "+e,124,136),a.fillText("Y: "+t,124,186),n},TileCoordinatesImageryProvider.prototype.pickFeatures=function(e,t,i,r,n){},TileDiscardPolicy.prototype.isReady=DeveloperError.throwInstantiationError,TileDiscardPolicy.prototype.shouldDiscardImage=DeveloperError.throwInstantiationError;var TileState={START:0,LOADING:1,READY:2,UPSAMPLED_ONLY:3},TileState$1=freezeObject$1(TileState);function TimeDynamicPointCloud(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT),this.show=defaultValue(e.show,!0),this.modelMatrix=Matrix4.clone(defaultValue(e.modelMatrix,Matrix4.IDENTITY)),this.shadows=defaultValue(e.shadows,ShadowMode$1.ENABLED),this.maximumMemoryUsage=defaultValue(e.maximumMemoryUsage,256),this.shading=new PointCloudShading(e.shading),this.style=e.style,this.frameFailed=new Event,this.frameChanged=new Event,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new PointCloudEyeDomeLighting,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._readyPromise=when.defer(),this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=arrayFill(new Array(5),0),this._runningAverage=0}function getFragmentShaderLoaded$1(e){return"uniform vec4 czm_pickColor;\n"+e}function getUniformMapLoaded$1(t){return function(e){return combine(e,{czm_pickColor:function(){return t._pickId.color}})}}function getPickIdLoaded$1(){return"czm_pickColor"}defineProperties$1(TimeDynamicPointCloud.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ClippingPlaneCollection.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(defined(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}},readyPromise:{get:function(){return this._readyPromise.promise}}}),TimeDynamicPointCloud.prototype.makeStyleDirty=function(){this._styleDirty=!0},TimeDynamicPointCloud.prototype._getAverageLoadTime=function(){return 0===this._runningLength?.05:this._runningAverage};var scratchDate$1=new JulianDate;function getClockMultiplier(e){var t=e._clock,i=t.canAnimate&&t.shouldAnimate,r=t.multiplier;return i?r:0}function getIntervalIndex(e,t){return e._intervals.indexOf(t.start)}function getNextInterval(e,t){var i=e._intervals,r=e._clock,n=getClockMultiplier(e);if(0!==n){var a=e._getAverageLoadTime(),o=JulianDate.addSeconds(r.currentTime,a*n,scratchDate$1),s=i.indexOf(o);return s===getIntervalIndex(e,t)&&(0<=n?++s:--s),i.get(s)}}function getCurrentInterval(e){var t=e._intervals,i=e._clock.currentTime,r=t.indexOf(i);return t.get(r)}function reachedInterval(e,t,i){var r=getClockMultiplier(e),n=getIntervalIndex(e,t),a=getIntervalIndex(e,i);return 0<=r?a<=n:n<=a}function handleFrameFailure(i,r){return function(e){var t=defined(e.message)?e.message:e.toString();0<i.frameFailed.numberOfListeners?i.frameFailed.raiseEvent({uri:r,message:t}):(console.log("A frame failed to load: "+r),console.log("Error: "+t))}}function requestFrame(t,e,i){var r=getIntervalIndex(t,e),n=t._frames,a=n[r];if(!defined(a)){var o=e.data.transform,s=defined(o)?Matrix4.fromArray(o):void 0,l=e.data.uri;a={pointCloud:void 0,transform:s,timestamp:getTimestamp$1(),sequential:!0,ready:!1,touchedFrameNumber:i.frameNumber},n[r]=a,Resource.fetchArrayBuffer({url:l}).then(function(e){return a.pointCloud=new PointCloud({arrayBuffer:e,cull:!0,fragmentShaderLoaded:getFragmentShaderLoaded$1,uniformMapLoaded:getUniformMapLoaded$1(t),pickIdLoaded:getPickIdLoaded$1}),a.pointCloud.readyPromise}).otherwise(handleFrameFailure(t,l))}return a}function updateAverageLoadTime(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 prepareFrame(e,t,i,r){t.touchedFrameNumber<r.frameNumber-1&&(t.sequential=!1);var n=t.pointCloud;if(defined(n)&&!t.ready){var a=r.commandList,o=a.length;if(renderFrame(e,t,i,r),n.ready)if(t.ready=!0,e._totalMemoryUsageInBytes+=n.geometryByteLength,a.length=o,t.sequential)updateAverageLoadTime(e,(getTimestamp$1()-t.timestamp)/1e3)}t.touchedFrameNumber=r.frameNumber}var scratchModelMatrix=new Matrix4;function getGeometricError$1(e,t){var i=e.shading;return defined(i)&&defined(i.baseResolution)?i.baseResolution:defined(t.boundingSphere)?CesiumMath.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function getMaximumAttenuation(e){var t=e.shading;return defined(t)&&defined(t.maximumAttenuation)?t.maximumAttenuation:10}var defaultShading$1=new PointCloudShading;function renderFrame(e,t,i,r){var n=defaultValue(e.shading,defaultShading$1),a=t.pointCloud,o=defaultValue(t.transform,Matrix4.IDENTITY);a.modelMatrix=Matrix4.multiplyTransformation(e.modelMatrix,o,scratchModelMatrix),a.style=e.style,a.time=i.timeSinceLoad,a.shadows=e.shadows,a.clippingPlanes=e._clippingPlanes,a.isClipped=i.isClipped,a.attenuation=n.attenuation,a.backFaceCulling=n.backFaceCulling,a.normalShading=n.normalShading,a.geometricError=getGeometricError$1(e,a),a.geometricErrorScale=n.geometricErrorScale,a.maximumAttenuation=getMaximumAttenuation(e),a.update(r),t.touchedFrameNumber=r.frameNumber}function loadFrame(e,t,i,r){prepareFrame(e,requestFrame(e,t,r),i,r)}function getUnloadCondition(t){return function(e){return e.touchedFrameNumber<t.frameNumber}}function unloadFrames(e,t){for(var i=e._frames,r=i.length,n=0;n<r;++n){var a=i[n];if(defined(a)&&(!defined(t)||t(a))){var o=a.pointCloud;a.ready&&(e._totalMemoryUsageInBytes-=o.geometryByteLength),defined(o)&&o.destroy(),a===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),i[n]=void 0}}}function getFrame(e,t){var i=getIntervalIndex(e,t),r=e._frames[i];if(defined(r)&&r.ready)return r}function updateInterval(e,t,i,r,n){return!!defined(i)&&(!!i.ready||(loadFrame(e,t,r,n),i.ready))}function getNearestReadyInterval(e,t,i,r,n){var a,o,s=e._intervals,l=e._frames,c=getIntervalIndex(e,i),u=getIntervalIndex(e,t);if(u<=c){for(a=c;u<=a;--a)if(updateInterval(e,o=s.get(a),l[a],r,n))return o}else for(a=c;a<=u;++a)if(updateInterval(e,o=s.get(a),l[a],r,n))return o;return t}function setFramesDirty(e,t,i){for(var r=e._frames,n=r.length,a=0;a<n;++a){var o=r[a];defined(o)&&defined(o.pointCloud)&&(o.pointCloud.clippingPlanesDirty=t,o.pointCloud.styleDirty=i)}}var updateState={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};TimeDynamicPointCloud.prototype.update=function(e){if(e.mode!==SceneMode$1.MORPHING&&this.show){defined(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),defined(this._loadTimestamp)||(this._loadTimestamp=JulianDate.clone(e.time));var t=Math.max(1e3*JulianDate.secondsDifference(e.time,this._loadTimestamp),0),i=this._clippingPlanes,r=0,n=!1,a=defined(i)&&i.enabled;a&&(i.update(e),r=i.clippingPlanesState),this._clippingPlanesState!==r&&(this._clippingPlanesState=r,n=!0);var o=this._styleDirty;this._styleDirty=!1,(n||o)&&setFramesDirty(this,n,o),updateState.timeSinceLoad=t,updateState.isClipped=a;var s=this.shading,l=this._pointCloudEyeDomeLighting,c=e.commandList,u=c.length,d=this._previousInterval,h=this._nextInterval,p=getCurrentInterval(this);if(defined(p)){var m=!1,f=getClockMultiplier(this),g=0===f;f!==this._clockMultiplier&&(m=!0,this._clockMultiplier=f),defined(d)&&!g||(d=p),defined(h)&&!m&&!reachedInterval(this,p,h)||(h=getNextInterval(this,p));var _=getFrame(this,d=getNearestReadyInterval(this,d,p,updateState,e));defined(_)||(loadFrame(this,d,updateState,e),_=this._lastRenderedFrame),defined(_)&&renderFrame(this,_,updateState,e),defined(h)&&loadFrame(this,h,updateState,e);var y=this;defined(_)&&!defined(this._lastRenderedFrame)&&e.afterRender.push(function(){y._readyPromise.resolve(y)}),defined(_)&&_!==this._lastRenderedFrame&&0<y.frameChanged.numberOfListeners&&e.afterRender.push(function(){y.frameChanged.raiseEvent(y)}),this._previousInterval=d,this._nextInterval=h,this._lastRenderedFrame=_;var v=this._totalMemoryUsageInBytes;1024*this.maximumMemoryUsage*1024<v&&unloadFrames(this,getUnloadCondition(e));var C=c.length-u;defined(s)&&s.attenuation&&s.eyeDomeLighting&&0<C&&l.update(e,u,s)}}},TimeDynamicPointCloud.prototype.isDestroyed=function(){return!1},TimeDynamicPointCloud.prototype.destroy=function(){return unloadFrames(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),destroyObject(this)};var ViewportQuadFS="varying vec2 v_textureCoordinates;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_textureCoordinates.s;\nmaterialInput.st = v_textureCoordinates;\nmaterialInput.str = vec3(v_textureCoordinates, 0.0);\nmaterialInput.normalEC = vec3(0.0, 0.0, -1.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n",oldValue;function ViewportQuad(e,t){this.show=!0,defined(e)||(e=new BoundingRectangle),this.rectangle=BoundingRectangle.clone(e),defined(t)||(t=Material.fromType(Material.ColorType,{color:new Color(1,1,1,1)})),this.material=t,this._material=void 0,this._overlayCommand=void 0,this._rs=void 0}ViewportQuad.prototype.update=function(e){if(this.show){var t=this._rs;if(defined(t)&&BoundingRectangle.equals(t.viewport,this.rectangle)||(this._rs=RenderState.fromCache({blending:BlendingState$1.ALPHA_BLEND,viewport:this.rectangle})),e.passes.render){var i=e.context;if(this._material!==this.material||!defined(this._overlayCommand)){this._material=this.material,defined(this._overlayCommand)&&this._overlayCommand.shaderProgram.destroy();var r=new ShaderSource({sources:[this._material.shaderSource,ViewportQuadFS]});this._overlayCommand=i.createViewportQuadCommand(r,{renderState:this._rs,uniformMap:this._material._uniforms,owner:this}),this._overlayCommand.pass=Pass$1.OVERLAY}this._material.update(i),this._overlayCommand.uniformMap=this._material._uniforms,e.commandList.push(this._overlayCommand)}}},ViewportQuad.prototype.isDestroyed=function(){return!1},ViewportQuad.prototype.destroy=function(){return defined(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),destroyObject(this)},"undefined"!=typeof ko&&(oldValue=ko),function(R){var S=this||(0,eval)("this"),x=S.document,C=S.navigator,T=S.jQuery,b=S.JSON;T||"undefined"==typeof jQuery||(T=jQuery),function(e,r){function i(e,t){return null===e||typeof e in l?e===t:!1}function a(e,t){var i;return function(){i||(i=I.a.setTimeout(function(){i=R;e()},t))}}function o(e,t){var i;return function(){clearTimeout(i);i=I.a.setTimeout(e,t)}}function c(e,t){t&&"change"!==t?"beforeChange"===t?this.oc(e):this.bb(e,t):this.pc(e)}function n(e,t){null!==t&&t.s&&t.s()}function s(e,t){var i=this.pd,r=i[p];r.qa||(this.Pb&&this.kb[t]?(i.tc(t,e,this.kb[t]),this.kb[t]=null,--this.Pb):r.F[t]||i.tc(t,e,r.G?{da:e}:i.Zc(e)),e.Ka&&e.fd())}var I="undefined"!==typeof e?e:{};I.b=function(e,t){for(var i=e.split("."),r=I,n=0;n<i.length-1;n++)r=r[i[n]];r[i[i.length-1]]=t},I.J=function(e,t,i){e[t]=i},I.version="3.5.0",I.b("version",I.version),I.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},I.a=function(){function d(e,t){for(var i in e)a.call(e,i)&&t(i,e[i])}function e(e,t){if(t)for(var i in t)a.call(t,i)&&(e[i]=t[i]);return e}function t(e,t){e.__proto__=t;return e}function n(e,t,i,r){var n=e[t].match(u)||[];I.a.C(i.match(u),function(e){I.a.Oa(n,e,r)});e[t]=n.join(" ")}var a=Object.prototype.hasOwnProperty,i={__proto__:[]}instanceof Array,r="function"===typeof Symbol,o={},s={};o[C&&/Firefox\/2/i.test(C.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];o.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");d(o,function(e,t){if(t.length)for(var i=0,r=t.length;i<r;i++)s[t[i]]=e});var l={propertychange:!0},c=x&&function(){for(var e=3,t=x.createElement("div"),i=t.getElementsByTagName("i");t.innerHTML="\x3c!--[if gt IE "+ ++e+"]><i></i><![endif]--\x3e",i[0];);return 4<e?e:R}(),u=/\S+/g,h;return{Ic:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],C:function(e,t,i){for(var r=0,n=e.length;r<n;r++)t.call(i,e[r],r,e)},A:"function"==typeof Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t)}:function(e,t){for(var i=0,r=e.length;i<r;i++)if(e[i]===t)return i;return-1},Lb:function(e,t,i){for(var r=0,n=e.length;r<n;r++)if(t.call(i,e[r],r,e))return e[r];return R},hb:function(e,t){var i=I.a.A(e,t);0<i?e.splice(i,1):0===i&&e.shift()},vc:function(e){var t=[];e&&I.a.C(e,function(e){0>I.a.A(t,e)&&t.push(e)});return t},Mb:function(e,t,i){var r=[];if(e)for(var n=0,a=e.length;n<a;n++)r.push(t.call(i,e[n],n));return r},fb:function(e,t,i){var r=[];if(e)for(var n=0,a=e.length;n<a;n++)t.call(i,e[n],n)&&r.push(e[n]);return r},gb:function(e,t){if(t instanceof Array)e.push.apply(e,t);else for(var i=0,r=t.length;i<r;i++)e.push(t[i]);return e},Oa:function(e,t,i){var r=I.a.A(I.a.$b(e),t);0>r?i&&e.push(t):i||e.splice(r,1)},Ba:i,extend:e,setPrototypeOf:t,zb:i?t:e,O:d,Ha:function(e,t,i){if(!e)return e;var r={},n;for(n in e)a.call(e,n)&&(r[n]=t.call(i,e[n],n,e));return r},Sb:function(e){for(;e.firstChild;)I.removeNode(e.firstChild)},Xb:function(e){e=I.a.la(e);for(var t=(e[0]&&e[0].ownerDocument||x).createElement("div"),i=0,r=e.length;i<r;i++)t.appendChild(I.na(e[i]));return t},Ca:function(e,t){for(var i=0,r=e.length,n=[];i<r;i++){var a=e[i].cloneNode(!0);n.push(t?I.na(a):a)}return n},ua:function(e,t){I.a.Sb(e);if(t)for(var i=0,r=t.length;i<r;i++)e.appendChild(t[i])},Wc:function(e,t){var i=e.nodeType?[e]:e;if(0<i.length){for(var r=i[0],n=r.parentNode,a=0,o=t.length;a<o;a++)n.insertBefore(t[a],r);a=0;for(o=i.length;a<o;a++)I.removeNode(i[a])}},Ua:function(e,t){if(e.length){for(t=8===t.nodeType&&t.parentNode||t;e.length&&e[0].parentNode!==t;)e.splice(0,1);for(;1<e.length&&e[e.length-1].parentNode!==t;)e.length--;if(1<e.length){var i=e[0],r=e[e.length-1];for(e.length=0;i!==r;)e.push(i),i=i.nextSibling;e.push(r)}}return e},Yc:function(e,t){7>c?e.setAttribute("selected",t):e.selected=t},Cb:function(e){return null===e||e===R?"":e.trim?e.trim():e.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Td:function(e,t){e=e||"";return t.length>e.length?!1:e.substring(0,t.length)===t},ud:function(e,t){if(e===t)return!0;if(11===e.nodeType)return!1;if(t.contains)return t.contains(1!==e.nodeType?e.parentNode:e);if(t.compareDocumentPosition)return 16==(t.compareDocumentPosition(e)&16);for(;e&&e!=t;)e=e.parentNode;return!!e},Rb:function(e){return I.a.ud(e,e.ownerDocument.documentElement)},jd:function(e){return!!I.a.Lb(e,I.a.Rb)},P:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},zc:function(e){return I.onError?function(){try{return e.apply(this,arguments)}catch(e){throw I.onError&&I.onError(e),e}}:e},setTimeout:function(e,t){return setTimeout(I.a.zc(e),t)},Fc:function(e){setTimeout(function(){I.onError&&I.onError(e);throw e},0)},H:function(t,e,i){var r=I.a.zc(i);i=l[e];if(I.options.useOnlyNativeEvents||i||!T)if(i||"function"!=typeof t.addEventListener)if("undefined"!=typeof t.attachEvent){var n=function(e){r.call(t,e)},a="on"+e;t.attachEvent(a,n);I.a.I.za(t,function(){t.detachEvent(a,n)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else t.addEventListener(e,r,!1);else h||(h="function"==typeof T(t).on?"on":"bind"),T(t)[h](e,r)},Fb:function(e,t){if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var i;"input"===I.a.P(e)&&e.type&&"click"==t.toLowerCase()?(i=e.type,i="checkbox"==i||"radio"==i):i=!1;if(I.options.useOnlyNativeEvents||!T||i)if("function"==typeof x.createEvent)if("function"==typeof e.dispatchEvent)i=x.createEvent(s[t]||"HTMLEvents"),i.initEvent(t,!0,!0,S,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(i);else throw Error("The supplied element doesn't support dispatchEvent");else if(i&&e.click)e.click();else if("undefined"!=typeof e.fireEvent)e.fireEvent("on"+t);else throw Error("Browser doesn't support triggering events");else T(e).trigger(t)},c:function(e){return I.N(e)?e():e},$b:function(e){return I.N(e)?e.w():e},Eb:function(t,e,i){var r;e&&("object"===typeof t.classList?(r=t.classList[i?"add":"remove"],I.a.C(e.match(u),function(e){r.call(t.classList,e)})):"string"===typeof t.className.baseVal?n(t.className,"baseVal",e,i):n(t,"className",e,i))},Ab:function(e,t){var i=I.a.c(t);if(null===i||i===R)i="";var r=I.h.firstChild(e);!r||3!=r.nodeType||I.h.nextSibling(r)?I.h.ua(e,[e.ownerDocument.createTextNode(i)]):r.data=i;I.a.zd(e)},Xc:function(e,t){e.name=t;if(7>=c)try{var i=e.name.replace(/[&<>'"]/g,function(e){return"&#"+e.charCodeAt(0)+";"});e.mergeAttributes(x.createElement("<input name='"+i+"'/>"),!1)}catch(e){}},zd:function(e){9<=c&&(e=1==e.nodeType?e:e.parentNode,e.style&&(e.style.zoom=e.style.zoom))},vd:function(e){if(c){var t=e.style.width;e.style.width=0;e.style.width=t}},Od:function(e,t){e=I.a.c(e);t=I.a.c(t);for(var i=[],r=e;r<=t;r++)i.push(r);return i},la:function(e){for(var t=[],i=0,r=e.length;i<r;i++)t.push(e[i]);return t},Da:function(e){return r?Symbol(e):e},Xd:6===c,Yd:7===c,W:c,Kc:function(e,t){for(var i=I.a.la(e.getElementsByTagName("input")).concat(I.a.la(e.getElementsByTagName("textarea"))),r="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},n=[],a=i.length-1;0<=a;a--)r(i[a])&&n.push(i[a]);return n},Md:function(e){return"string"==typeof e&&(e=I.a.Cb(e))?b&&b.parse?b.parse(e):new Function("return "+e)():null},fc:function(e,t,i){if(!b||!b.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 b.stringify(I.a.c(e),t,i)},Nd:function(e,t,i){i=i||{};var r=i.params||{},n=i.includeFields||this.Ic,a=e;if("object"==typeof e&&"form"===I.a.P(e))for(var a=e.action,o=n.length-1;0<=o;o--)for(var s=I.a.Kc(e,n[o]),l=s.length-1;0<=l;l--)r[s[l].name]=s[l].value;t=I.a.c(t);var c=x.createElement("form");c.style.display="none";c.action=a;c.method="post";for(var u in t)e=x.createElement("input"),e.type="hidden",e.name=u,e.value=I.a.fc(I.a.c(t[u])),c.appendChild(e);d(r,function(e,t){var i=x.createElement("input");i.type="hidden";i.name=e;i.value=t;c.appendChild(i)});x.body.appendChild(c);i.submitter?i.submitter(c):c.submit();setTimeout(function(){c.parentNode.removeChild(c)},0)}}}(),I.b("utils",I.a),I.b("utils.arrayForEach",I.a.C),I.b("utils.arrayFirst",I.a.Lb),I.b("utils.arrayFilter",I.a.fb),I.b("utils.arrayGetDistinctValues",I.a.vc),I.b("utils.arrayIndexOf",I.a.A),I.b("utils.arrayMap",I.a.Mb),I.b("utils.arrayPushAll",I.a.gb),I.b("utils.arrayRemoveItem",I.a.hb),I.b("utils.cloneNodes",I.a.Ca),I.b("utils.createSymbolOrString",I.a.Da),I.b("utils.extend",I.a.extend),I.b("utils.fieldsIncludedWithJsonPost",I.a.Ic),I.b("utils.getFormFields",I.a.Kc),I.b("utils.objectMap",I.a.Ha),I.b("utils.peekObservable",I.a.$b),I.b("utils.postJson",I.a.Nd),I.b("utils.parseJson",I.a.Md),I.b("utils.registerEventHandler",I.a.H),I.b("utils.stringifyJson",I.a.fc),I.b("utils.range",I.a.Od),I.b("utils.toggleDomNodeCssClass",I.a.Eb),I.b("utils.triggerEvent",I.a.Fb),I.b("utils.unwrapObservable",I.a.c),I.b("utils.objectForEach",I.a.O),I.b("utils.addOrRemoveItem",I.a.Oa),I.b("utils.setTextContent",I.a.Ab),I.b("unwrap",I.a.c),Function.prototype.bind||(Function.prototype.bind=function(t){var i=this;if(1===arguments.length)return function(){return i.apply(t,arguments)};var r=Array.prototype.slice.call(arguments,1);return function(){var e=r.slice(0);e.push.apply(e,arguments);return i.apply(t,e)}}),I.a.g=new function(){var r=0,n="__ko__"+(new Date).getTime(),a={},o,e;I.a.W?(o=function(e,t){var i=e[n];if(!i||"null"===i||!a[i]){if(!t)return R;i=e[n]="ko"+r++;a[i]={}}return a[i]},e=function(e){var t=e[n];return t?(delete a[t],e[n]=null,!0):!1}):(o=function(e,t){var i=e[n];!i&&t&&(i=e[n]={});return i},e=function(e){return e[n]?(delete e[n],!0):!1});return{get:function(e,t){var i=o(e,!1);return i&&i[t]},set:function(e,t,i){(e=o(e,i!==R))&&(e[t]=i)},Tb:function(e,t,i){e=o(e,!0);return e[t]||(e[t]=i)},clear:e,Z:function(){return r+++n}}},I.b("utils.domData",I.a.g),I.b("utils.domData.clear",I.a.g.clear),I.a.I=new function(){function r(e,t){var i=I.a.g.get(e,o);i===R&&t&&(i=[],I.a.g.set(e,o,i));return i}function a(e){var t=r(e,!1);if(t)for(var t=t.slice(0),i=0;i<t.length;i++)t[i](e);I.a.g.clear(e);I.a.I.cleanExternalData(e);s[e.nodeType]&&n(e.childNodes,!0)}function n(e,t){for(var i=[],r,n=0;n<e.length;n++)if(!t||8===e[n].nodeType)if(a(i[i.length]=r=e[n]),e[n]!==r)for(;n--&&-1==I.a.A(i,e[n]););}var o=I.a.g.Z(),t={1:!0,8:!0,9:!0},s={1:!0,9:!0};return{za:function(e,t){if("function"!=typeof t)throw Error("Callback must be a function");r(e,!0).push(t)},xb:function(e,t){var i=r(e,!1);i&&(I.a.hb(i,t),0==i.length&&I.a.g.set(e,o,R))},na:function(e){t[e.nodeType]&&(a(e),s[e.nodeType]&&n(e.getElementsByTagName("*")));return e},removeNode:function(e){I.na(e);e.parentNode&&e.parentNode.removeChild(e)},cleanExternalData:function(e){T&&"function"==typeof T.cleanData&&T.cleanData([e])}}},I.na=I.a.I.na,I.removeNode=I.a.I.removeNode,I.b("cleanNode",I.na),I.b("removeNode",I.removeNode),I.b("utils.domNodeDisposal",I.a.I),I.b("utils.domNodeDisposal.addDisposeCallback",I.a.I.za),I.b("utils.domNodeDisposal.removeDisposeCallback",I.a.I.xb),function(){var s=[0,"",""],e=[1,"<table>","</table>"],t=[3,"<table><tbody><tr>","</tr></tbody></table>"],i=[1,"<select multiple='multiple'>","</select>"],l={thead:e,tbody:e,tfoot:e,tr:[2,"<table><tbody>","</tbody></table>"],td:t,th:t,option:i,optgroup:i},c=8>=I.a.W;I.a.ta=function(e,t){var i;if(T)if(T.parseHTML)i=T.parseHTML(e,t)||[];else{if((i=T.clean([e],t))&&i[0]){for(var r=i[0];r.parentNode&&11!==r.parentNode.nodeType;)r=r.parentNode;r.parentNode&&r.parentNode.removeChild(r)}}else{(i=t)||(i=x);var r=i.parentWindow||i.defaultView||S,n=I.a.Cb(e).toLowerCase(),a=i.createElement("div"),o;o=(n=n.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&l[n[1]]||s;n=o[0];o="ignored<div>"+o[1]+e+o[2]+"</div>";"function"==typeof r.innerShiv?a.appendChild(r.innerShiv(o)):(c&&i.body.appendChild(a),a.innerHTML=o,c&&a.parentNode.removeChild(a));for(;n--;)a=a.lastChild;i=I.a.la(a.lastChild.childNodes)}return i};I.a.Ld=function(e,t){var i=I.a.ta(e,t);return i.length&&i[0].parentElement||I.a.Xb(i)};I.a.dc=function(e,t){I.a.Sb(e);t=I.a.c(t);if(null!==t&&t!==R)if("string"!=typeof t&&(t=t.toString()),T)T(e).html(t);else for(var i=I.a.ta(t,e.ownerDocument),r=0;r<i.length;r++)e.appendChild(i[r])}}(),I.b("utils.parseHtmlFragment",I.a.ta),I.b("utils.setHtml",I.a.dc),I.aa=function(){function s(e,t){if(e)if(8==e.nodeType){var i=I.aa.Tc(e.nodeValue);null!=i&&t.push({sd:e,Jd:i})}else if(1==e.nodeType)for(var i=0,r=e.childNodes,n=r.length;i<n;i++)s(r[i],t)}var r={};return{Wb:function(e){if("function"!=typeof e)throw Error("You can only pass a function to ko.memoization.memoize()");var t=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);r[t]=e;return"\x3c!--[ko_memo:"+t+"]--\x3e"},ad:function(e,t){var i=r[e];if(i===R)throw Error("Couldn't find any memo with ID "+e+". Perhaps it's already been unmemoized.");try{return i.apply(null,t||[]),!0}finally{delete r[e]}},bd:function(e,t){var i=[];s(e,i);for(var r=0,n=i.length;r<n;r++){var a=i[r].sd,o=[a];t&&I.a.gb(o,t);I.aa.ad(i[r].Jd,o);a.nodeValue="";a.parentNode&&a.parentNode.removeChild(a)}},Tc:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:null}}}(),I.b("memoization",I.aa),I.b("memoization.memoize",I.aa.Wb),I.b("memoization.unmemoize",I.aa.ad),I.b("memoization.parseMemoText",I.aa.Tc),I.b("memoization.unmemoizeDomNodeAndDescendants",I.aa.bd),I.ma=function(){function e(){if(n)for(var e=n,t=0,i;o<n;)if(i=r[o++]){if(o>e){if(5e3<=++t){o=n;I.a.Fc(Error("'Too much recursion' after processing "+t+" task groups."));break}e=n}try{i()}catch(e){I.a.Fc(e)}}}function t(){e();o=n=r.length=0}var i,r=[],n=0,a=1,o=0;S.MutationObserver?i=function(e){var t=x.createElement("div");new MutationObserver(e).observe(t,{attributes:!0});return function(){t.classList.toggle("foo")}}(t):i=x&&"onreadystatechange"in x.createElement("script")?function(e){var t=x.createElement("script");t.onreadystatechange=function(){t.onreadystatechange=null;x.documentElement.removeChild(t);t=null;e()};x.documentElement.appendChild(t)}:function(e){setTimeout(e,0)};return{scheduler:i,yb:function(e){n||I.ma.scheduler(t);r[n++]=e;return a++},cancel:function(e){e=e-(a-n);e>=o&&e<n&&(r[e]=null)},resetForTesting:function(){var e=n-o;o=n=r.length=0;return e},Rd:e}}(),I.b("tasks",I.ma),I.b("tasks.schedule",I.ma.yb),I.b("tasks.runEarly",I.ma.Rd),I.Ta={throttle:function(t,i){t.throttleEvaluation=i;var r=null;return I.$({read:t,write:function(e){clearTimeout(r);r=I.a.setTimeout(function(){t(e)},i)}})},rateLimit:function(e,t){var i,r,n;"number"==typeof t?i=t:(i=t.timeout,r=t.method);e.Hb=!1;n="function"==typeof r?r:"notifyWhenChangesStop"==r?o:a;e.tb(function(e){return n(e,i,t)})},deferred:function(r,e){if(!0!==e)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");r.Hb||(r.Hb=!0,r.tb(function(e){var t,i=!1;return function(){if(!i){I.ma.cancel(t);t=I.ma.yb(e);try{i=!0,r.notifySubscribers(R,"dirty")}finally{i=!1}}}}))},notify:function(e,t){e.equalityComparer="always"==t?null:i}};var l={undefined:1,boolean:1,number:1,string:1};I.b("extenders",I.Ta),I.gc=function(e,t,i){this.da=e;this.kc=t;this.lc=i;this.Ib=!1;this.ab=this.Jb=null;I.J(this,"dispose",this.s);I.J(this,"disposeWhenNodeIsRemoved",this.l)},I.gc.prototype.s=function(){this.Ib||(this.ab&&I.a.I.xb(this.Jb,this.ab),this.Ib=!0,this.lc(),this.da=this.kc=this.lc=this.Jb=this.ab=null)},I.gc.prototype.l=function(e){this.Jb=e;I.a.I.za(e,this.ab=this.s.bind(this))},I.R=function(){I.a.zb(this,t);t.ob(this)};var t={ob:function(e){e.S={change:[]};e.rc=1},subscribe:function(e,t,i){var r=this;i=i||"change";var n=new I.gc(r,t?e.bind(t):e,function(){I.a.hb(r.S[i],n);r.cb&&r.cb(i)});r.Qa&&r.Qa(i);r.S[i]||(r.S[i]=[]);r.S[i].push(n);return n},notifySubscribers:function(e,t){t=t||"change";"change"===t&&this.Gb();if(this.Wa(t)){var i="change"===t&&this.dd||this.S[t].slice(0);try{I.v.wc();for(var r=0,n;n=i[r];++r)n.Ib||n.kc(e)}finally{I.v.end()}}},mb:function(){return this.rc},Cd:function(e){return this.mb()!==e},Gb:function(){++this.rc},tb:function(e){var i=this,t=I.N(i),r,n,a,o,s;i.bb||(i.bb=i.notifySubscribers,i.notifySubscribers=c);var l=e(function(){i.Ka=!1;t&&o===i&&(o=i.mc?i.mc():i());var e=n||s&&i.qb(a,o);s=n=r=!1;e&&i.bb(a=o)});i.pc=function(e,t){t&&i.Ka||(s=!t);i.dd=i.S.change.slice(0);i.Ka=r=!0;o=e;l()};i.oc=function(e){r||(a=e,i.bb(e,"beforeChange"))};i.qc=function(){s=!0};i.fd=function(){i.qb(a,i.w(!0))&&(n=!0)}},Wa:function(e){return this.S[e]&&this.S[e].length},Ad:function(e){if(e)return this.S[e]&&this.S[e].length||0;var i=0;I.a.O(this.S,function(e,t){"dirty"!==e&&(i+=t.length)});return i},qb:function(e,t){return!this.equalityComparer||!this.equalityComparer(e,t)},toString:function(){return"[object Object]"},extend:function(e){var r=this;e&&I.a.O(e,function(e,t){var i=I.Ta[e];"function"==typeof i&&(r=i(r,t)||r)});return r}};I.J(t,"init",t.ob),I.J(t,"subscribe",t.subscribe),I.J(t,"extend",t.extend),I.J(t,"getSubscriptionsCount",t.Ad),I.a.Ba&&I.a.setPrototypeOf(t,Function.prototype),I.R.fn=t,I.Pc=function(e){return null!=e&&"function"==typeof e.subscribe&&"function"==typeof e.notifySubscribers},I.b("subscribable",I.R),I.b("isSubscribable",I.Pc),I.U=I.v=function(){function r(e){t.push(i);i=e}function n(){i=t.pop()}var t=[],i,a=0;return{wc:r,end:n,ac:function(e){if(i){if(!I.Pc(e))throw Error("Only subscribable things can act as dependencies");i.nd.call(i.od,e,e.ed||(e.ed=++a))}},K:function(e,t,i){try{return r(),e.apply(t,i||[])}finally{n()}},pa:function(){if(i)return i.o.pa()},Va:function(){if(i)return i.o.Va()},rb:function(){if(i)return i.rb},o:function(){if(i)return i.o}}}(),I.b("computedContext",I.U),I.b("computedContext.getDependenciesCount",I.U.pa),I.b("computedContext.getDependencies",I.U.Va),I.b("computedContext.isInitial",I.U.rb),I.b("computedContext.registerDependency",I.U.ac),I.b("ignoreDependencies",I.Wd=I.v.K);var u=I.a.Da("_latestValue");I.sa=function(e){function t(){if(0<arguments.length)return t.qb(t[u],arguments[0])&&(t.xa(),t[u]=arguments[0],t.wa()),this;I.v.ac(t);return t[u]}t[u]=e;I.a.Ba||I.a.extend(t,I.R.fn);I.R.fn.ob(t);I.a.zb(t,d);I.options.deferUpdates&&I.Ta.deferred(t,!0);return t};var d={equalityComparer:i,w:function(){return this[u]},wa:function(){this.notifySubscribers(this[u],"spectate");this.notifySubscribers(this[u])},xa:function(){this.notifySubscribers(this[u],"beforeChange")}};I.a.Ba&&I.a.setPrototypeOf(d,I.R.fn);var h=I.sa.Na="__ko_proto__";d[h]=I.sa,I.N=function(e){if((e="function"==typeof e&&e[h])&&e!==d[h]&&e!==I.o.fn[h])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!e},I.Ya=function(e){return"function"==typeof e&&(e[h]===d[h]||e[h]===I.o.fn[h]&&e.Mc)},I.b("observable",I.sa),I.b("isObservable",I.N),I.b("isWriteableObservable",I.Ya),I.b("isWritableObservable",I.Ya),I.b("observable.fn",d),I.J(d,"peek",d.w),I.J(d,"valueHasMutated",d.wa),I.J(d,"valueWillMutate",d.xa),I.Ia=function(e){e=e||[];if("object"!=typeof e||!("length"in e))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");e=I.sa(e);I.a.zb(e,I.Ia.fn);return e.extend({trackArrayChanges:!0})},I.Ia.fn={remove:function(t){for(var e=this.w(),i=[],r="function"!=typeof t||I.N(t)?function(e){return e===t}:t,n=0;n<e.length;n++){var a=e[n];if(r(a)){0===i.length&&this.xa();if(e[n]!==a)throw Error("Array modified during remove; cannot remove item");i.push(a);e.splice(n,1);n--}}i.length&&this.wa();return i},removeAll:function(t){if(t===R){var e=this.w(),i=e.slice(0);this.xa();e.splice(0,e.length);this.wa();return i}return t?this.remove(function(e){return 0<=I.a.A(t,e)}):[]},destroy:function(t){var e=this.w(),i="function"!=typeof t||I.N(t)?function(e){return e===t}:t;this.xa();for(var r=e.length-1;0<=r;r--){var n=e[r];i(n)&&(n._destroy=!0)}this.wa()},destroyAll:function(t){return t===R?this.destroy(function(){return!0}):t?this.destroy(function(e){return 0<=I.a.A(t,e)}):[]},indexOf:function(e){var t=this();return I.a.A(t,e)},replace:function(e,t){var i=this.indexOf(e);0<=i&&(this.xa(),this.w()[i]=t,this.wa())},sorted:function(e){var t=this().slice(0);return e?t.sort(e):t.sort()},reversed:function(){return this().slice(0).reverse()}},I.a.Ba&&I.a.setPrototypeOf(I.Ia.fn,I.sa.fn),I.a.C("pop push reverse shift sort splice unshift".split(" "),function(i){I.Ia.fn[i]=function(){var e=this.w();this.xa();this.yc(e,i,arguments);var t=e[i].apply(e,arguments);this.wa();return t===e?this:t}}),I.a.C(["slice"],function(t){I.Ia.fn[t]=function(){var e=this();return e[t].apply(e,arguments)}}),I.Oc=function(e){return I.N(e)&&"function"==typeof e.remove&&"function"==typeof e.push},I.b("observableArray",I.Ia),I.b("isObservableArray",I.Oc),I.Ta.trackArrayChanges=function(i,e){function t(){function e(){if(p){var e=[].concat(i.w()||[]);if(i.Wa("arrayChange")){var t;if(!h||1<p)h=I.a.Ob(n,e,i.Nb);t=h}n=e;h=null;p=0;t&&t.length&&i.notifySubscribers(t,"arrayChange")}}d?e():(d=!0,a=i.notifySubscribers,i.notifySubscribers=function(e,t){t&&"change"!==t||++p;return a.apply(this,arguments)},n=[].concat(i.w()||[]),h=null,r=i.subscribe(e))}i.Nb={};e&&"object"==typeof e&&I.a.extend(i.Nb,e);i.Nb.sparse=!0;if(!i.yc){var d=!1,h=null,r,p=0,n,a,o=i.Qa,s=i.cb;i.Qa=function(e){o&&o.call(i,e);"arrayChange"===e&&t()};i.cb=function(e){s&&s.call(i,e);"arrayChange"!==e||i.Wa("arrayChange")||(a&&(i.notifySubscribers=a,a=R),r&&r.s(),r=null,d=!1,n=R)};i.yc=function(e,t,i){function r(e,t,i){return n[n.length]={status:e,value:t,index:i}}if(d&&!p){var n=[],a=e.length,o=i.length,s=0;switch(t){case"push":s=a;case"unshift":for(t=0;t<o;t++)r("added",i[t],s+t);break;case"pop":s=a-1;case"shift":a&&r("deleted",e[s],s);break;case"splice":t=Math.min(Math.max(0,0>i[0]?a+i[0]:i[0]),a);for(var a=1===o?a:Math.min(t+(i[1]||0),a),o=t+o-2,s=Math.max(a,o),l=[],c=[],u=2;t<s;++t,++u)t<a&&c.push(r("deleted",e[t],t)),t<o&&l.push(r("added",i[u],t));I.a.Jc(c,l);break;default:return}h=n}}}};var p=I.a.Da("_state");I.o=I.$=function(e,t,i){function r(){if(0<arguments.length){if("function"===typeof n)n.apply(a.lb,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}a.qa||I.v.ac(r);(a.ka||a.G&&r.Xa())&&r.ha();return a.X}"object"===typeof e?i=e:(i=i||{},e&&(i.read=e));if("function"!=typeof i.read)throw Error("Pass a function that returns the value of the ko.computed");var n=i.write,a={X:R,ra:!0,ka:!0,pb:!1,hc:!1,qa:!1,vb:!1,G:!1,Vc:i.read,lb:t||i.owner,l:i.disposeWhenNodeIsRemoved||i.l||null,Sa:i.disposeWhen||i.Sa,Qb:null,F:{},V:0,Hc:null};r[p]=a;r.Mc="function"===typeof n;I.a.Ba||I.a.extend(r,I.R.fn);I.R.fn.ob(r);I.a.zb(r,m);i.pure?(a.vb=!0,a.G=!0,I.a.extend(r,f)):i.deferEvaluation&&I.a.extend(r,g);I.options.deferUpdates&&I.Ta.deferred(r,!0);a.l&&(a.hc=!0,a.l.nodeType||(a.l=null));a.G||i.deferEvaluation||r.ha();a.l&&r.ja()&&I.a.I.za(a.l,a.Qb=function(){r.s()});return r};var m={equalityComparer:i,pa:function(){return this[p].V},Va:function(){var i=[];I.a.O(this[p].F,function(e,t){i[t.La]=t.da});return i},Ub:function(t){if(!this[p].V)return!1;var e=this.Va();return-1!==I.a.A(e,t)?!0:!!I.a.Lb(e,function(e){return e.Ub&&e.Ub(t)})},tc:function(e,t,i){if(this[p].vb&&t===this)throw Error("A 'pure' computed must not be called recursively");this[p].F[e]=i;i.La=this[p].V++;i.Ma=t.mb()},Xa:function(){var e,t,i=this[p].F;for(e in i)if(Object.prototype.hasOwnProperty.call(i,e)&&(t=i[e],this.Ja&&t.da.Ka||t.da.Cd(t.Ma)))return!0},Id:function(){this.Ja&&!this[p].pb&&this.Ja(!1)},ja:function(){var e=this[p];return e.ka||0<e.V},Qd:function(){this.Ka?this[p].ka&&(this[p].ra=!0):this.Gc()},Zc:function(e){if(e.Hb){var t=e.subscribe(this.Id,this,"dirty"),i=e.subscribe(this.Qd,this);return{da:e,s:function(){t.s();i.s()}}}return e.subscribe(this.Gc,this)},Gc:function(){var e=this,t=e.throttleEvaluation;t&&0<=t?(clearTimeout(this[p].Hc),this[p].Hc=I.a.setTimeout(function(){e.ha(!0)},t)):e.Ja?e.Ja(!0):e.ha(!0)},ha:function(e){var t=this[p],i=t.Sa,r=!1;if(!t.pb&&!t.qa){if(t.l&&!I.a.Rb(t.l)||i&&i()){if(!t.hc){this.s();return}}else t.hc=!1;t.pb=!0;try{r=this.yd(e)}finally{t.pb=!1}return r}},yd:function(e){var t=this[p],i=!1,r=t.vb?R:!t.V,i={pd:this,kb:t.F,Pb:t.V};I.v.wc({od:i,nd:s,o:this,rb:r});t.F={};t.V=0;var n=this.xd(t,i);t.V?i=this.qb(t.X,n):(this.s(),i=!0);i&&(t.G?this.Gb():this.notifySubscribers(t.X,"beforeChange"),t.X=n,this.notifySubscribers(t.X,"spectate"),!t.G&&e&&this.notifySubscribers(t.X),this.qc&&this.qc());r&&this.notifySubscribers(t.X,"awake");return i},xd:function(e,t){try{var i=e.Vc;return e.lb?i.call(e.lb):i()}finally{I.v.end(),t.Pb&&!e.G&&I.a.O(t.kb,n),e.ra=e.ka=!1}},w:function(e){var t=this[p];(t.ka&&(e||!t.V)||t.G&&this.Xa())&&this.ha();return t.X},tb:function(e){I.R.fn.tb.call(this,e);this.mc=function(){this[p].G||(this[p].ra?this.ha():this[p].ka=!1);return this[p].X};this.Ja=function(e){this.oc(this[p].X);this[p].ka=!0;e&&(this[p].ra=!0);this.pc(this,!e)}},s:function(){var e=this[p];!e.G&&e.F&&I.a.O(e.F,function(e,t){t.s&&t.s()});e.l&&e.Qb&&I.a.I.xb(e.l,e.Qb);e.F=R;e.V=0;e.qa=!0;e.ra=!1;e.ka=!1;e.G=!1;e.l=R;e.Sa=R;e.Vc=R;this.Mc||(e.lb=R)}},f={Qa:function(e){var n=this,a=n[p];if(!a.qa&&a.G&&"change"==e){a.G=!1;if(a.ra||n.Xa())a.F=null,a.V=0,n.ha()&&n.Gb();else{var i=[];I.a.O(a.F,function(e,t){i[t.La]=e});I.a.C(i,function(e,t){var i=a.F[e],r=n.Zc(i.da);r.La=t;r.Ma=i.Ma;a.F[e]=r});n.Xa()&&n.ha()&&n.Gb()}a.qa||n.notifySubscribers(a.X,"awake")}},cb:function(e){var i=this[p];i.qa||"change"!=e||this.Wa("change")||(I.a.O(i.F,function(e,t){t.s&&(i.F[e]={da:t.da,La:t.La,Ma:t.Ma},t.s())}),i.G=!0,this.notifySubscribers(R,"asleep"))},mb:function(){var e=this[p];e.G&&(e.ra||this.Xa())&&this.ha();return I.R.fn.mb.call(this)}},g={Qa:function(e){"change"!=e&&"beforeChange"!=e||this.w()}};I.a.Ba&&I.a.setPrototypeOf(m,I.R.fn);var _=I.sa.Na;m[_]=I.o,I.Nc=function(e){return"function"==typeof e&&e[_]===m[_]},I.Ed=function(e){return I.Nc(e)&&e[p]&&e[p].vb},I.b("computed",I.o),I.b("dependentObservable",I.o),I.b("isComputed",I.Nc),I.b("isPureComputed",I.Ed),I.b("computed.fn",m),I.J(m,"peek",m.w),I.J(m,"dispose",m.s),I.J(m,"isActive",m.ja),I.J(m,"getDependenciesCount",m.pa),I.J(m,"getDependencies",m.Va),I.wb=function(e,t){if("function"===typeof e)return I.o(e,t,{pure:!0});e=I.a.extend({},e);e.pure=!0;return I.o(e,t)},I.b("pureComputed",I.wb),function(){function s(r,n,a){a=a||new t;r=n(r);if("object"!=typeof r||null===r||r===R||r instanceof RegExp||r instanceof Date||r instanceof String||r instanceof Number||r instanceof Boolean)return r;var o=r instanceof Array?[]:{};a.save(r,o);e(r,function(e){var t=n(r[e]);switch(typeof t){case"boolean":case"number":case"string":case"function":o[e]=t;break;case"object":case"undefined":var i=a.get(t);o[e]=i!==R?i:s(t,n,a)}});return o}function e(e,t){if(e instanceof Array){for(var i=0;i<e.length;i++)t(i);"function"==typeof e.toJSON&&t("toJSON")}else for(i in e)t(i)}function t(){this.keys=[];this.values=[]}I.$c=function(e){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return s(e,function(e){for(var t=0;I.N(e)&&10>t;t++)e=e();return e})};I.toJSON=function(e,t,i){e=I.$c(e);return I.a.fc(e,t,i)};t.prototype={constructor:t,save:function(e,t){var i=I.a.A(this.keys,e);0<=i?this.values[i]=t:(this.keys.push(e),this.values.push(t))},get:function(e){e=I.a.A(this.keys,e);return 0<=e?this.values[e]:R}}}(),I.b("toJS",I.$c),I.b("toJSON",I.toJSON),I.Vd=function(r,e,n){function t(t){var e=I.wb(r,n).extend({Ga:"always"}),i=e.subscribe(function(e){e&&(i.s(),t(e))});e.notifySubscribers(e.w());return i}return"function"!==typeof Promise||e?t(e.bind(n)):new Promise(t)},I.b("when",I.Vd),function(){I.u={L:function(e){switch(I.a.P(e)){case"option":return!0===e.__ko__hasDomDataOptionValue__?I.a.g.get(e,I.f.options.Yb):7>=I.a.W?e.getAttributeNode("value")&&e.getAttributeNode("value").specified?e.value:e.text:e.value;case"select":return 0<=e.selectedIndex?I.u.L(e.options[e.selectedIndex]):R;default:return e.value}},ya:function(e,t,i){switch(I.a.P(e)){case"option":"string"===typeof t?(I.a.g.set(e,I.f.options.Yb,R),"__ko__hasDomDataOptionValue__"in e&&delete e.__ko__hasDomDataOptionValue__,e.value=t):(I.a.g.set(e,I.f.options.Yb,t),e.__ko__hasDomDataOptionValue__=!0,e.value="number"===typeof t?t:"");break;case"select":if(""===t||null===t)t=R;for(var r=-1,n=0,a=e.options.length,o;n<a;++n)if(o=I.u.L(e.options[n]),o==t||""===o&&t===R){r=n;break}if(i||0<=r||t===R&&1<e.size)e.selectedIndex=r,6===I.a.W&&I.a.setTimeout(function(){e.selectedIndex=r},0);break;default:if(null===t||t===R)t="";e.value=t}}}}(),I.b("selectExtensions",I.u),I.b("selectExtensions.readValue",I.u.L),I.b("selectExtensions.writeValue",I.u.ya),I.m=function(){function r(e){e=I.a.Cb(e);123===e.charCodeAt(0)&&(e=e.slice(1,-1));e+="\n,";var t=[],i=e.match(d),r,n=[],a=0;if(1<i.length){for(var o=0,s;s=i[o];++o){var l=s.charCodeAt(0);if(44===l){if(0>=a){t.push(r&&n.length?{key:r,value:n.join("")}:{unknown:r||n.join("")});r=a=0;n=[];continue}}else if(58===l){if(!a&&!r&&1===n.length){r=n.pop();continue}}else if(47===l&&1<s.length&&(47===s.charCodeAt(1)||42===s.charCodeAt(1)))continue;else 47===l&&o&&1<s.length?(l=i[o-1].match(h))&&!p[l[0]]&&(e=e.substr(e.indexOf(s)+1),i=e.match(d),o=-1,s="/"):40===l||123===l||91===l?++a:41===l||125===l||93===l?--a:r||n.length||34!==l&&39!==l||(s=s.slice(1,-1));n.push(s)}if(0<a)throw Error("Unbalanced parentheses, braces, or brackets")}return t}var c=["true","false","null","undefined"],u=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,d=RegExp("\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|`(?:\\\\.|[^`])*`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*\n|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,\"'`{}()/:[\\]]*[^\\s,\"'`{}()/:[\\]]|[^\\s]","g"),h=/[\])"'A-Za-z0-9_$]+$/,p={in:1,return:1,typeof:1},m={};return{Ra:[],va:m,Zb:r,ub:function(e,t){function n(e,t){var i;if(!l){var r=I.getBindingHandler(e);if(r&&r.preprocess&&!(t=r.preprocess(t,e,n)))return;if(r=m[e])i=t,0<=I.a.A(c,i)?i=!1:(r=i.match(u),i=null===r?!1:r[1]?"Object("+r[1]+")"+r[2]:i),r=i;r&&o.push("'"+("string"==typeof m[e]?m[e]:e)+"':function(_z){"+i+"=_z}")}s&&(t="function(){return "+t+" }");a.push("'"+e+"':"+t)}t=t||{};var a=[],o=[],s=t.valueAccessors,l=t.bindingParams,i="string"===typeof e?r(e):e;I.a.C(i,function(e){n(e.key||e.unknown,e.value)});o.length&&n("_ko_property_writers","{"+o.join(",")+" }");return a.join(",")},Hd:function(e,t){for(var i=0;i<e.length;i++)if(e[i].key==t)return!0;return!1},$a:function(e,t,i,r,n){if(e&&I.N(e))!I.Ya(e)||n&&e.w()===r||e(r);else if((e=t.get("_ko_property_writers"))&&e[i])e[i](r)}}}(),I.b("expressionRewriting",I.m),I.b("expressionRewriting.bindingRewriteValidators",I.m.Ra),I.b("expressionRewriting.parseObjectLiteral",I.m.Zb),I.b("expressionRewriting.preProcessBindings",I.m.ub),I.b("expressionRewriting._twoWayBindings",I.m.va),I.b("jsonExpressionRewriting",I.m),I.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",I.m.ub),function(){function a(e){return 8==e.nodeType&&i.test(t?e.text:e.nodeValue)}function o(e){return 8==e.nodeType&&n.test(t?e.text:e.nodeValue)}function r(e,t){for(var i=e,r=1,n=[];i=i.nextSibling;){if(o(i)&&(I.a.g.set(i,c,!0),r--,0===r))return n;n.push(i);a(i)&&r++}if(!t)throw Error("Cannot find closing comment tag to match: "+e.nodeValue);return null}function s(e,t){var i=r(e,t);return i?0<i.length?i[i.length-1].nextSibling:e.nextSibling:null}var t=x&&"\x3c!--test--\x3e"===x.createComment("test").text,i=t?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,n=t?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,l={ul:!0,ol:!0},c="__ko_matchedEndComment__";I.h={ea:{},childNodes:function(e){return a(e)?r(e):e.childNodes},Ea:function(e){if(a(e)){e=I.h.childNodes(e);for(var t=0,i=e.length;t<i;t++)I.removeNode(e[t])}else I.a.Sb(e)},ua:function(e,t){if(a(e)){I.h.Ea(e);for(var i=e.nextSibling,r=0,n=t.length;r<n;r++)i.parentNode.insertBefore(t[r],i)}else I.a.ua(e,t)},Uc:function(e,t){a(e)?e.parentNode.insertBefore(t,e.nextSibling):e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)},Vb:function(e,t,i){i?a(e)?e.parentNode.insertBefore(t,i.nextSibling):i.nextSibling?e.insertBefore(t,i.nextSibling):e.appendChild(t):I.h.Uc(e,t)},firstChild:function(e){if(a(e))return!e.nextSibling||o(e.nextSibling)?null:e.nextSibling;if(e.firstChild&&o(e.firstChild))throw Error("Found invalid end comment, as the first child of "+e);return e.firstChild},nextSibling:function(e){a(e)&&(e=s(e));if(e.nextSibling&&o(e.nextSibling)){var t=e.nextSibling;if(o(t)&&!I.a.g.get(t,c))throw Error("Found end comment without a matching opening comment, as child of "+e);return null}return e.nextSibling},Bd:a,Ud:function(e){return(e=(t?e.text:e.nodeValue).match(i))?e[1]:null},Rc:function(e){if(l[I.a.P(e)]){var t=e.firstChild;if(t){do{if(1===t.nodeType){var i;i=t.firstChild;var r=null;if(i){do{if(r)r.push(i);else if(a(i)){var n=s(i,!0);n?i=n:r=[i]}else o(i)&&(r=[i])}while(i=i.nextSibling)}if(i=r)for(r=t.nextSibling,n=0;n<i.length;n++)r?e.insertBefore(i[n],r):e.appendChild(i[n])}}while(t=t.nextSibling)}}}}}(),I.b("virtualElements",I.h),I.b("virtualElements.allowedBindings",I.h.ea),I.b("virtualElements.emptyNode",I.h.Ea),I.b("virtualElements.insertAfter",I.h.Vb),I.b("virtualElements.prepend",I.h.Uc),I.b("virtualElements.setDomNodeChildren",I.h.ua),function(){I.ga=function(){this.md={}};I.a.extend(I.ga.prototype,{nodeHasBindings:function(e){switch(e.nodeType){case 1:return null!=e.getAttribute("data-bind")||I.i.getComponentNameForNode(e);case 8:return I.h.Bd(e);default:return!1}},getBindings:function(e,t){var i=this.getBindingsString(e,t),i=i?this.parseBindingsString(i,t,e):null;return I.i.sc(i,e,t,!1)},getBindingAccessors:function(e,t){var i=this.getBindingsString(e,t),i=i?this.parseBindingsString(i,t,e,{valueAccessors:!0}):null;return I.i.sc(i,e,t,!0)},getBindingsString:function(e){switch(e.nodeType){case 1:return e.getAttribute("data-bind");case 8:return I.h.Ud(e);default:return null}},parseBindingsString:function(t,e,i,r){try{var n=this.md,a=t+(r&&r.valueAccessors||""),o;if(!(o=n[a])){var s,l="with($context){with($data||{}){return{"+I.m.ub(t,r)+"}}}";s=new Function("$context","$element",l);o=n[a]=s}return o(e,i)}catch(e){throw e.message="Unable to parse bindings.\nBindings value: "+t+"\nMessage: "+e.message,e}}});I.ga.instance=new I.ga}(),I.b("bindingProvider",I.ga),function(){function r(e){var t=(e=I.a.g.get(e,C))&&e.M;t&&(e.M=null,t.Sc())}function n(e,t,i){this.node=e;this.xc=t;this.ib=[];this.T=!1;t.M||I.a.I.za(e,r);i&&i.M&&(i.M.ib.push(e),this.Kb=i)}function a(e){return function(){return e}}function p(e){return e()}function o(i){return I.a.Ha(I.v.K(i),function(e,t){return function(){return i()[t]}})}function s(e,t,i){return"function"===typeof e?o(e.bind(null,t,i)):I.a.Ha(e,a)}function m(e,t){return o(this.getBindings.bind(this,e,t))}function l(e,t){var i=I.h.firstChild(t);if(i){var r,n=I.ga.instance,a=n.preprocessNode;if(a){for(;r=i;)i=I.h.nextSibling(r),a.call(n,r);i=I.h.firstChild(t)}for(;r=i;)i=I.h.nextSibling(r),c(e,r)}I.j.Ga(t,I.j.T)}function c(e,t){var i=e,r=1===t.nodeType;r&&I.h.Rc(t);if(r||I.ga.instance.nodeHasBindings(t))i=u(t,null,e).bindingContextForDescendants;i&&!y[I.a.P(t)]&&l(i,t)}function f(r){var n=[],a={},o=[];I.a.O(r,function t(e){if(!a[e]){var i=I.getBindingHandler(e);i&&(i.after&&(o.push(e),I.a.C(i.after,function(e){if(r[e]){if(-1!==I.a.A(o,e))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+o.join(", "));t(e)}}),o.length--),n.push({key:e,Lc:i}));a[e]=!0}});return n}function u(n,e,t){var i=I.a.g.Tb(n,C,{}),r=i.gd;if(!e){if(r)throw Error("You cannot apply bindings multiple times to the same element.");i.gd=!0}r||(i.context=t);var a;if(e&&"function"!==typeof e)a=e;else{var o=I.ga.instance,s=o.getBindingAccessors||m,l=I.$(function(){if(a=e?e(t,n):s.call(o,n,t)){if(t[g])t[g]();if(t[_])t[_]()}return a},null,{l:n});a&&l.ja()||(l=null)}var c=t,u;if(a){var d=function(){return I.a.Ha(l?l():a,p)},h=l?function(e){return function(){return p(l()[e])}}:function(e){return a[e]};d.get=function(e){return a[e]&&p(h(e))};d.has=function(e){return e in a};I.j.T in a&&I.j.subscribe(n,I.j.T,function(){var e=(0,a[I.j.T])();if(e){var t=I.h.childNodes(n);t.length&&e(t,I.Dc(t[0]))}});I.j.oa in a&&(c=I.j.Bb(n,t),I.j.subscribe(n,I.j.oa,function(){var e=(0,a[I.j.oa])();e&&I.h.firstChild(n)&&e(n)}));i=f(a);I.a.C(i,function(e){var t=e.Lc.init,i=e.Lc.update,r=e.key;if(8===n.nodeType&&!I.h.ea[r])throw Error("The binding '"+r+"' cannot be used with virtual elements");try{"function"==typeof t&&I.v.K(function(){var e=t(n,h(r),d,c.$data,c);if(e&&e.controlsDescendantBindings){if(u!==R)throw Error("Multiple bindings ("+u+" and "+r+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");u=r}}),"function"==typeof i&&I.$(function(){i(n,h(r),d,c.$data,c)},null,{l:n})}catch(e){throw e.message='Unable to process binding "'+r+": "+a[r]+'"\nMessage: '+e.message,e}})}i=u===R;return{shouldBindDescendants:i,bindingContextForDescendants:i&&c}}function d(e,t){return e&&e instanceof I.fa?e:new I.fa(e,R,R,t)}var g=I.a.Da("_subscribable"),h=I.a.Da("_ancestorBindingInfo"),_=I.a.Da("_dataDependency");I.f={};var y={script:!0,textarea:!0,template:!0};I.getBindingHandler=function(e){return I.f[e]};var v={};I.fa=function(e,i,r,n,t){function a(){var e=c?l():l,t=I.a.c(e);i?(I.a.extend(o,i),h in i&&(o[h]=i[h])):(o.$parents=[],o.$root=t,o.ko=I);o[g]=u;s?t=o.$data:(o.$rawData=e,o.$data=t);r&&(o[r]=t);n&&n(o,i,t);if(i&&i[g]&&!I.U.o().Ub(i[g]))i[g]();d&&(o[_]=d);return o.$data}var o=this,s=e===v,l=s?R:e,c="function"==typeof l&&!I.N(l),u,d=t&&t.dataDependency;t&&t.exportDependencies?a():(u=I.wb(a),u.w(),u.ja()?u.equalityComparer=null:o[g]=R)};I.fa.prototype.createChildContext=function(t,i,r,e){!e&&i&&"object"==typeof i&&(e=i,i=e.as,r=e.extend);if(i&&e&&e.noChildContext){var n="function"==typeof t&&!I.N(t);return new I.fa(v,this,null,function(e){r&&r(e);e[i]=n?t():t},e)}return new I.fa(t,this,i,function(e,t){e.$parentContext=t;e.$parent=t.$data;e.$parents=(t.$parents||[]).slice(0);e.$parents.unshift(e.$parent);r&&r(e)},e)};I.fa.prototype.extend=function(t,e){return new I.fa(v,this,null,function(e){I.a.extend(e,"function"==typeof t?t(e):t)},e)};var C=I.a.g.Z();n.prototype.Sc=function(){this.Kb&&this.Kb.M&&this.Kb.M.rd(this.node)};n.prototype.rd=function(e){I.a.hb(this.ib,e);!this.ib.length&&this.T&&this.Bc()};n.prototype.Bc=function(){this.T=!0;this.xc.M&&!this.ib.length&&(this.xc.M=null,I.a.I.xb(this.node,r),I.j.Ga(this.node,I.j.oa),this.Sc())};I.j={T:"childrenComplete",oa:"descendantsComplete",subscribe:function(e,t,i,r){e=I.a.g.Tb(e,C,{});e.Fa||(e.Fa=new I.R);return e.Fa.subscribe(i,r,t)},Ga:function(e,t){var i=I.a.g.get(e,C);if(i&&(i.Fa&&i.Fa.notifySubscribers(e,t),t==I.j.T))if(i.M)i.M.Bc();else if(i.M===R&&i.Fa&&i.Fa.Wa(I.j.oa))throw Error("descendantsComplete event not supported for bindings on this node")},Bb:function(e,t){var i=I.a.g.Tb(e,C,{});i.M||(i.M=new n(e,i,t[h]));return t[h]==i?t:t.extend(function(e){e[h]=i})}};I.Sd=function(e){return(e=I.a.g.get(e,C))&&e.context};I.eb=function(e,t,i){1===e.nodeType&&I.h.Rc(e);return u(e,t,d(i))};I.kd=function(e,t,i){i=d(i);return I.eb(e,s(t,i,e),i)};I.Pa=function(e,t){1!==t.nodeType&&8!==t.nodeType||l(d(e),t)};I.uc=function(e,t,i){!T&&S.jQuery&&(T=S.jQuery);if(2>arguments.length){if(t=x.body,!t)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!t||1!==t.nodeType&&8!==t.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");c(d(e,i),t)};I.Cc=function(e){return!e||1!==e.nodeType&&8!==e.nodeType?R:I.Sd(e)};I.Dc=function(e){return(e=I.Cc(e))?e.$data:R};I.b("bindingHandlers",I.f);I.b("bindingEvent",I.j);I.b("bindingEvent.subscribe",I.j.subscribe);I.b("bindingEvent.startPossiblyAsyncContentBinding",I.j.Bb);I.b("applyBindings",I.uc);I.b("applyBindingsToDescendants",I.Pa);I.b("applyBindingAccessorsToNode",I.eb);I.b("applyBindingsToNode",I.kd);I.b("contextFor",I.Cc);I.b("dataFor",I.Dc)}(),function(s){function r(r,e){var n=Object.prototype.hasOwnProperty.call(o,r)?o[r]:s,a;n?n.subscribe(e):(n=o[r]=new I.R,n.subscribe(e),t(r,function(e,t){var i=!(!t||!t.synchronous);c[r]={definition:e,Fd:i};delete o[r];a||i?n.notifySubscribers(e):I.ma.yb(function(){n.notifySubscribers(e)})}),a=!0)}function t(e,i){l("getConfig",[e],function(t){t?l("loadComponent",[e,t],function(e){i(e,t)}):i(null,null)})}function l(t,i,r,n){n||(n=I.i.loaders.slice(0));var e=n.shift();if(e){var a=e[t];if(a){var o=!1;if(a.apply(e,i.concat(function(e){o?r(null):null!==e?r(e):l(t,i,r,n)}))!==s&&(o=!0,!e.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else l(t,i,r,n)}else r(null)}var o={},c={};I.i={get:function(e,t){var i=Object.prototype.hasOwnProperty.call(c,e)?c[e]:s;i?i.Fd?I.v.K(function(){t(i.definition)}):I.ma.yb(function(){t(i.definition)}):r(e,t)},Ac:function(e){delete c[e]},nc:l};I.i.loaders=[];I.b("components",I.i);I.b("components.get",I.i.get);I.b("components.clearCachedDefinition",I.i.Ac)}(),function(){function n(t,e,i,r){function n(){0===--o&&r(a)}var a={},o=2,s=i.template;i=i.viewModel;s?l(e,s,function(e){I.i.nc("loadTemplate",[t,e],function(e){a.template=e;n()})}):n();i?l(e,i,function(e){I.i.nc("loadViewModel",[t,e],function(e){a[u]=e;n()})}):n()}function a(e,t,i){if("function"===typeof t)i(function(e){return new t(e)});else if("function"===typeof t[u])i(t[u]);else if("instance"in t){var r=t.instance;i(function(){return r})}else"viewModel"in t?a(e,t.viewModel,i):e("Unknown viewModel value: "+t)}function o(e){switch(I.a.P(e)){case"script":return I.a.ta(e.text);case"textarea":return I.a.ta(e.value);case"template":if(s(e.content))return I.a.Ca(e.content.childNodes)}return I.a.Ca(e.childNodes)}function s(e){return S.DocumentFragment?e instanceof DocumentFragment:e&&11===e.nodeType}function l(e,t,i){"string"===typeof t.require?r||S.require?(r||S.require)([t.require],i):e("Uses require, but no AMD loader is present"):i(t)}function c(t){return function(e){throw Error("Component '"+t+"': "+e)}}var i={};I.i.register=function(e,t){if(!t)throw Error("Invalid configuration for "+e);if(I.i.sb(e))throw Error("Component "+e+" is already registered");i[e]=t};I.i.sb=function(e){return Object.prototype.hasOwnProperty.call(i,e)};I.i.unregister=function(e){delete i[e];I.i.Ac(e)};I.i.Ec={getConfig:function(e,t){t(I.i.sb(e)?i[e]:null)},loadComponent:function(t,e,i){var r=c(t);l(r,e,function(e){n(t,r,e,i)})},loadTemplate:function(e,t,i){e=c(e);if("string"===typeof t)i(I.a.ta(t));else if(t instanceof Array)i(t);else if(s(t))i(I.a.la(t.childNodes));else if(t.element)if(t=t.element,S.HTMLElement?t instanceof HTMLElement:t&&t.tagName&&1===t.nodeType)i(o(t));else if("string"===typeof t){var r=x.getElementById(t);r?i(o(r)):e("Cannot find element with ID "+t)}else e("Unknown element type: "+t);else e("Unknown template value: "+t)},loadViewModel:function(e,t,i){a(c(e),t,i)}};var u="createViewModel";I.b("components.register",I.i.register);I.b("components.isRegistered",I.i.sb);I.b("components.unregister",I.i.unregister);I.b("components.defaultLoader",I.i.Ec);I.i.loaders.push(I.i.Ec);I.i.cd=i}(),function(){function o(i,e){var t=i.getAttribute("params");if(t){var t=n.parseBindingsString(t,e,i,{valueAccessors:!0,bindingParams:!0}),t=I.a.Ha(t,function(e){return I.o(e,null,{l:i})}),r=I.a.Ha(t,function(t){var e=t.w();return t.ja()?I.o({read:function(){return I.a.c(t())},write:I.Ya(e)&&function(e){t()(e)},l:i}):e});Object.prototype.hasOwnProperty.call(r,"$raw")||(r.$raw=t);return r}return{$raw:{}}}I.i.getComponentNameForNode=function(e){var t=I.a.P(e);if(I.i.sb(t)&&(-1!=t.indexOf("-")||"[object HTMLUnknownElement]"==""+e||8>=I.a.W&&e.tagName===t))return t};I.i.sc=function(e,t,i,r){if(1===t.nodeType){var n=I.i.getComponentNameForNode(t);if(n){e=e||{};if(e.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var a={name:n,params:o(t,i)};e.component=r?function(){return a}:a}}return e};var n=new I.ga;9>I.a.W&&(I.i.register=function(t){return function(e){return t.apply(this,arguments)}}(I.i.register),x.createDocumentFragment=function(i){return function(){var e=i(),t=I.i.cd;return e}}(x.createDocumentFragment))}(),function(){function p(e,t,i){t=t.template;if(!t)throw Error("Component '"+e+"' has no template");e=I.a.Ca(t);I.h.ua(i,e)}function m(e,t,i){var r=e.createViewModel;return r?r.call(e,t,i):t}var f=0;I.f.component={init:function(o,t,e,i,s){function l(){var e=c&&c.dispose;"function"===typeof e&&e.call(c);d&&d.s();u=c=d=null}var c,u,d,h=I.a.la(I.h.childNodes(o));I.h.Ea(o);I.a.I.za(o,l);I.o(function(){var e=I.a.c(t()),i,r;"string"===typeof e?i=e:(i=I.a.c(e.name),r=I.a.c(e.params));if(!i)throw Error("No component name specified");var n=I.j.Bb(o,s),a=u=++f;I.i.get(i,function(e){if(u===a){l();if(!e)throw Error("Unknown component '"+i+"'");p(i,e,o);var t=m(e,r,{element:o,templateNodes:h});e=n.createChildContext(t,{extend:function(e){e.$component=t;e.$componentTemplateNodes=h}});t&&t.koDescendantsComplete&&(d=I.j.subscribe(o,I.j.oa,t.koDescendantsComplete,t));c=t;I.Pa(e,o)}})},null,{l:o});return{controlsDescendantBindings:!0}}};I.h.ea.component=!0}();var y={class:"className",for:"htmlFor"};I.f.attr={update:function(n,e){var t=I.a.c(e())||{};I.a.O(t,function(e,t){t=I.a.c(t);var i=e.indexOf(":"),i="lookupNamespaceURI"in n&&0<i&&n.lookupNamespaceURI(e.substr(0,i)),r=!1===t||null===t||t===R;r?i?n.removeAttributeNS(i,e):n.removeAttribute(e):t=t.toString();8>=I.a.W&&e in y?(e=y[e],r?n.removeAttribute(e):n[e]=t):r||(i?n.setAttributeNS(i,e,t):n.setAttribute(e,t));"name"===e&&I.a.Xc(n,r?"":t)})}},function(){I.f.checked={after:["value","attr"],init:function(a,o,s){function e(){var e=a.checked,t=l();if(!I.U.rb()&&(e||!u&&!I.U.pa())){var i=I.v.K(o);if(d){var r=h?i.w():i,n=p;p=t;n!==t?e&&(I.a.Oa(r,t,!0),I.a.Oa(r,n,!1)):I.a.Oa(r,t,e);h&&I.Ya(i)&&i(r)}else c&&(t===R?t=e:e||(t=R)),I.m.$a(i,s,"checked",t,!0)}}function t(){var e=I.a.c(o()),t=l();d?(a.checked=0<=I.a.A(e,t),p=t):a.checked=c&&t===R?!!e:l()===e}var l=I.wb(function(){if(s.has("checkedValue"))return I.a.c(s.get("checkedValue"));if(r)return s.has("value")?I.a.c(s.get("value")):a.value}),c="checkbox"==a.type,u="radio"==a.type;if(c||u){var i=o(),d=c&&I.a.c(i)instanceof Array,h=!(d&&i.push&&i.splice),r=u||d,p=d?l():R;u&&!a.name&&I.f.uniqueName.init(a,function(){return!0});I.o(e,null,{l:a});I.a.H(a,"click",e);I.o(t,null,{l:a});i=R}}};I.m.va.checked=!0;I.f.checkedValue={update:function(e,t){e.value=I.a.c(t())}}}(),I.f["class"]={update:function(e,t){var i=I.a.Cb(I.a.c(t()));I.a.Eb(e,e.__ko__cssValue,!1);e.__ko__cssValue=i;I.a.Eb(e,i,!0)}},I.f.css={update:function(i,e){var t=I.a.c(e());null!==t&&"object"==typeof t?I.a.O(t,function(e,t){t=I.a.c(t);I.a.Eb(i,e,t)}):I.f["class"].update(i,e)}},I.f.enable={update:function(e,t){var i=I.a.c(t());i&&e.disabled?e.removeAttribute("disabled"):i||e.disabled||(e.disabled=!0)}},I.f.disable={update:function(e,t){I.f.enable.update(e,function(){return!I.a.c(t())})}},I.f.event={init:function(e,a,o,s,l){var t=a()||{};I.a.O(t,function(n){"string"==typeof n&&I.a.H(e,n,function(e){var t,i=a()[n];if(i){try{var r=I.a.la(arguments);s=l.$data;r.unshift(s);t=i.apply(s,r)}finally{!0!==t&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}!1===o.get(n+"Bubble")&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}})})}},I.f.foreach={Qc:function(i){return function(){var e=i(),t=I.a.$b(e);if(!t||"number"==typeof t.length)return{foreach:e,templateEngine:I.ba.Na};I.a.c(e);return{foreach:t.data,as:t.as,noChildContext:t.noChildContext,includeDestroyed:t.includeDestroyed,afterAdd:t.afterAdd,beforeRemove:t.beforeRemove,afterRender:t.afterRender,beforeMove:t.beforeMove,afterMove:t.afterMove,templateEngine:I.ba.Na}}},init:function(e,t){return I.f.template.init(e,I.f.foreach.Qc(t))},update:function(e,t,i,r,n){return I.f.template.update(e,I.f.foreach.Qc(t),i,r,n)}},I.m.Ra.foreach=!1,I.h.ea.foreach=!0,I.f.hasfocus={init:function(r,n,a){function e(e){r.__ko_hasfocusUpdating=!0;var t=r.ownerDocument;if("activeElement"in t){var i;try{i=t.activeElement}catch(e){i=t.body}e=i===r}t=n();I.m.$a(t,a,"hasfocus",e,!0);r.__ko_hasfocusLastValue=e;r.__ko_hasfocusUpdating=!1}var t=e.bind(null,!0),i=e.bind(null,!1);I.a.H(r,"focus",t);I.a.H(r,"focusin",t);I.a.H(r,"blur",i);I.a.H(r,"focusout",i);r.__ko_hasfocusLastValue=!1},update:function(e,t){var i=!!I.a.c(t());e.__ko_hasfocusUpdating||e.__ko_hasfocusLastValue===i||(i?e.focus():e.blur(),!i&&e.__ko_hasfocusLastValue&&e.ownerDocument.body.focus(),I.v.K(I.a.Fb,null,[e,i?"focusin":"focusout"]))}},I.m.va.hasfocus=!0,I.f.hasFocus=I.f.hasfocus,I.m.va.hasFocus="hasfocus",I.f.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){I.a.dc(e,t())}},function(){function e(e,p,m){I.f[e]={init:function(n,a,e,t,o){var s,l,c={},u,d,h;if(p){t=e.get("as");var i=e.get("noChildContext");h=!(t&&i);c={as:t,noChildContext:i,exportDependencies:h}}d=(u="render"==e.get("completeOn"))||e.has(I.j.oa);I.o(function(){var e=I.a.c(a()),t=!m!==!e,i=!l,r;if(h||t!==s){d&&(o=I.j.Bb(n,o));if(t){if(!p||h)c.dataDependency=I.U.o();r=p?o.createChildContext("function"==typeof e?e:a,c):I.U.pa()?o.extend(null,c):o}i&&I.U.pa()&&(l=I.a.Ca(I.h.childNodes(n),!0));t?(i||I.h.ua(n,I.a.Ca(l)),I.Pa(r,n)):(I.h.Ea(n),u||I.j.Ga(n,I.j.T));s=t}},null,{l:n});return{controlsDescendantBindings:!0}}};I.m.Ra[e]=!1;I.h.ea[e]=!0}e("if");e("ifnot",!1,!0);e("with",!0)}(),I.f.let={init:function(e,t,i,r,n){t=n.extend(t);I.Pa(t,e);return{controlsDescendantBindings:!0}}},I.h.ea.let=!0;var v={};I.f.options={init:function(e){if("select"!==I.a.P(e))throw Error("options binding applies only to SELECT elements");for(;0<e.length;)e.remove(0);return{controlsDescendantBindings:!0}},update:function(r,e,n){function t(){return I.a.fb(r.options,function(e){return e.selected})}function a(e,t,i){var r=typeof t;return"function"==r?t(e):"string"==r?e[t]:i}function i(e,t){if(p&&c)I.u.ya(r,I.a.c(n.get("value")),!0);else if(h.length){var i=0<=I.a.A(h,I.u.L(t[0]));I.a.Yc(t[0],i);p&&!i&&I.v.K(I.a.Fb,null,[r,"change"])}}var o=r.multiple,s=0!=r.length&&o?r.scrollTop:null,l=I.a.c(e()),c=n.get("valueAllowUnset")&&n.has("value"),u=n.get("optionsIncludeDestroyed");e={};var d,h=[];c||(o?h=I.a.Mb(t(),I.u.L):0<=r.selectedIndex&&h.push(I.u.L(r.options[r.selectedIndex])));l&&("undefined"==typeof l.length&&(l=[l]),d=I.a.fb(l,function(e){return u||e===R||null===e||!I.a.c(e._destroy)}),n.has("optionsCaption")&&(l=I.a.c(n.get("optionsCaption")),null!==l&&l!==R&&d.unshift(v)));var p=!1;e.beforeRemove=function(e){r.removeChild(e)};l=i;n.has("optionsAfterRender")&&"function"==typeof n.get("optionsAfterRender")&&(l=function(e,t){i(0,t);I.v.K(n.get("optionsAfterRender"),null,[t[0],e!==v?e:R])});I.a.cc(r,d,function(e,t,i){i.length&&(h=!c&&i[0].selected?[I.u.L(i[0])]:[],p=!0);t=r.ownerDocument.createElement("option");e===v?(I.a.Ab(t,n.get("optionsCaption")),I.u.ya(t,R)):(i=a(e,n.get("optionsValue"),e),I.u.ya(t,I.a.c(i)),e=a(e,n.get("optionsText"),i),I.a.Ab(t,e));return[t]},e,l);I.v.K(function(){if(c)I.u.ya(r,I.a.c(n.get("value")),!0);else{var e;o?e=h.length&&t().length<h.length:e=h.length&&0<=r.selectedIndex?I.u.L(r.options[r.selectedIndex])!==h[0]:h.length||0<=r.selectedIndex;e&&I.a.Fb(r,"change")}});I.a.vd(r);s&&20<Math.abs(s-r.scrollTop)&&(r.scrollTop=s)}},I.f.options.Yb=I.a.g.Z(),I.f.selectedOptions={after:["options","foreach"],init:function(i,r,n){I.a.H(i,"change",function(){var e=r(),t=[];I.a.C(i.getElementsByTagName("option"),function(e){e.selected&&t.push(I.u.L(e))});I.m.$a(e,n,"selectedOptions",t)})},update:function(e,t){if("select"!=I.a.P(e))throw Error("values binding applies only to SELECT elements");var i=I.a.c(t()),r=e.scrollTop;i&&"number"==typeof i.length&&I.a.C(e.getElementsByTagName("option"),function(e){var t=0<=I.a.A(i,I.u.L(e));e.selected!=t&&I.a.Yc(e,t)});e.scrollTop=r}},I.m.va.selectedOptions=!0,I.f.style={update:function(r,e){var t=I.a.c(e()||{});I.a.O(t,function(e,t){t=I.a.c(t);if(null===t||t===R||!1===t)t="";if(T)T(r).css(e,t);else if(/^--/.test(e))r.style.setProperty(e,t);else{e=e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()});var i=r.style[e];r.style[e]=t;t===i||r.style[e]!=i||isNaN(t)||(r.style[e]=t+"px")}})}},I.f.submit={init:function(r,n,e,t,a){if("function"!=typeof n())throw Error("The value for a submit binding must be a function");I.a.H(r,"submit",function(e){var t,i=n();try{t=i.call(a.$data,r)}finally{!0!==t&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}})}},I.f.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){I.a.Ab(e,t())}},I.h.ea.text=!0,function(){if(S&&S.navigator){var e=function(e){if(e)return parseFloat(e[1])},t=S.navigator.userAgent,h,p,m,f,g;(h=S.opera&&S.opera.version&&parseInt(S.opera.version()))||(g=e(t.match(/Edge\/([^ ]+)$/)))||e(t.match(/Chrome\/([^ ]+)/))||(p=e(t.match(/Version\/([^ ]+) Safari/)))||(m=e(t.match(/Firefox\/([^ ]+)/)))||(f=I.a.W||e(t.match(/MSIE ([^ ]+)/)))||(f=e(t.match(/rv:([^ )]+)/)))}if(8<=f&&10>f)var r=I.a.g.Z(),n=I.a.g.Z(),a=function(e){var t=this.activeElement;(t=t&&I.a.g.get(t,n))&&t(e)},_=function(e,t){var i=e.ownerDocument;I.a.g.get(i,r)||(I.a.g.set(i,r,!0),I.a.H(i,"selectionchange",a));I.a.g.set(e,n,t)};I.f.textInput={init:function(i,t,r){function e(e,t){I.a.H(i,e,t)}function n(){var e=I.a.c(t());if(null===e||e===R)e="";c!==R&&e===c?I.a.setTimeout(n,4):i.value!==e&&(d=!0,i.value=e,d=!1,s=i.value)}function a(){l||(c=i.value,l=I.a.setTimeout(o,4))}function o(){clearTimeout(l);c=l=R;var e=i.value;s!==e&&(s=e,I.m.$a(t(),r,"textInput",e))}var s=i.value,l,c,u=9==I.a.W?a:o,d=!1;f&&e("keypress",o);11>f&&e("propertychange",function(e){d||"value"!==e.propertyName||u(e)});8==f&&(e("keyup",o),e("keydown",o));_&&(_(i,u),e("dragend",a));(!f||9<=f)&&e("input",u);5>p&&"textarea"===I.a.P(i)?(e("keydown",a),e("paste",a),e("cut",a)):11>h?e("keydown",a):4>m?(e("DOMAutoComplete",o),e("dragdrop",o),e("drop",o)):g&&"number"===i.type&&e("keydown",a);e("change",o);e("blur",o);I.o(n,null,{l:i})}};I.m.va.textInput=!0;I.f.textinput={preprocess:function(e,t,i){i("textInput",e)}}}(),I.f.uniqueName={init:function(e,t){if(t()){var i="ko_unique_"+ ++I.f.uniqueName.qd;I.a.Xc(e,i)}}},I.f.uniqueName.qd=0,I.f.using={init:function(e,t,i,r,n){var a;i.has("as")&&(a={as:i.get("as"),noChildContext:i.get("noChildContext")});t=n.createChildContext(t,a);I.Pa(t,e);return{controlsDescendantBindings:!0}}},I.h.ea.using=!0,I.f.value={after:["options","foreach"],init:function(i,r,n){var a=I.a.P(i),e="input"==a;if(!e||"checkbox"!=i.type&&"radio"!=i.type){var t=["change"],o=n.get("valueUpdate"),s=!1,l=null;o&&("string"==typeof o&&(o=[o]),I.a.gb(t,o),t=I.a.vc(t));var c=function(){l=null;s=!1;var e=r(),t=I.u.L(i);I.m.$a(e,n,"value",t)};!I.a.W||!e||"text"!=i.type||"off"==i.autocomplete||i.form&&"off"==i.form.autocomplete||-1!=I.a.A(t,"propertychange")||(I.a.H(i,"propertychange",function(){s=!0}),I.a.H(i,"focus",function(){s=!1}),I.a.H(i,"blur",function(){s&&c()}));I.a.C(t,function(e){var t=c;I.a.Td(e,"after")&&(t=function(){l=I.u.L(i);I.a.setTimeout(c,0)},e=e.substring(5));I.a.H(i,e,t)});var u;u=e&&"file"==i.type?function(){var e=I.a.c(r());null===e||e===R||""===e?i.value="":I.v.K(c)}:function(){var e=I.a.c(r()),t=I.u.L(i);if(null!==l&&e===l)I.a.setTimeout(u,0);else if(e!==t||t===R)"select"===a?(t=n.get("valueAllowUnset"),I.u.ya(i,e,t),t||e===I.u.L(i)||I.v.K(c)):I.u.ya(i,e)};I.o(u,null,{l:i})}else I.eb(i,{checkedValue:r})},update:function(){}},I.m.va.value=!0,I.f.visible={update:function(e,t){var i=I.a.c(t()),r="none"!=e.style.display;i&&!r?e.style.display="":!i&&r&&(e.style.display="none")}},I.f.hidden={update:function(e,t){I.f.visible.update(e,function(){return!I.a.c(t())})}},function(a){I.f[a]={init:function(e,t,i,r,n){return I.f.event.init.call(this,e,function(){var e={};e[a]=t();return e},i,r,n)}}}("click"),I.ca=function(){},I.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},I.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},I.ca.prototype.makeTemplateSource=function(e,t){if("string"==typeof e){t=t||x;var i=t.getElementById(e);if(!i)throw Error("Cannot find template with ID "+e);return new I.B.D(i)}if(1==e.nodeType||8==e.nodeType)return new I.B.ia(e);throw Error("Unknown template type: "+e)},I.ca.prototype.renderTemplate=function(e,t,i,r){e=this.makeTemplateSource(e,r);return this.renderTemplateSource(e,t,i,r)},I.ca.prototype.isTemplateRewritten=function(e,t){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(e,t).data("isRewritten")},I.ca.prototype.rewriteTemplate=function(e,t,i){e=this.makeTemplateSource(e,i);t=t(e.text());e.text(t);e.data("isRewritten",!0)},I.b("templateEngine",I.ca),I.ic=function(){function o(e,t,i,r){e=I.m.Zb(e);for(var n=I.m.Ra,a=0;a<e.length;a++){var o=e[a].key;if(Object.prototype.hasOwnProperty.call(n,o)){var s=n[o];if("function"===typeof s){if(o=s(e[a].value))throw Error(o)}else if(!s)throw Error("This template engine does not support the '"+o+"' binding within its templates")}}i="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+I.m.ub(e,{valueAccessors:!0})+" } })()},'"+i.toLowerCase()+"')";return r.createJavaScriptEvaluatorBlock(i)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,i=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{wd:function(e,t,i){t.isTemplateRewritten(e,i)||t.rewriteTemplate(e,function(e){return I.ic.Kd(e,t)},i)},Kd:function(e,a){return e.replace(t,function(e,t,i,r,n){return o(n,t,i,a)}).replace(i,function(e,t){return o(t,"\x3c!-- ko --\x3e","#comment",a)})},ld:function(r,n){return I.aa.Wb(function(e,t){var i=e.nextSibling;i&&i.nodeName.toLowerCase()===n&&I.eb(i,r,t)})}}}(),I.b("__tr_ambtns",I.ic.ld),function(){I.B={};I.B.D=function(e){if(this.D=e){var t=I.a.P(e);this.Db="script"===t?1:"textarea"===t?2:"template"==t&&e.content&&11===e.content.nodeType?3:4}};I.B.D.prototype.text=function(){var e=1===this.Db?"text":2===this.Db?"value":"innerHTML";if(0==arguments.length)return this.D[e];var t=arguments[0];"innerHTML"===e?I.a.dc(this.D,t):this.D[e]=t};var t=I.a.g.Z()+"_";I.B.D.prototype.data=function(e){if(1===arguments.length)return I.a.g.get(this.D,t+e);I.a.g.set(this.D,t+e,arguments[1])};var r=I.a.g.Z();I.B.D.prototype.nodes=function(){var e=this.D;if(0==arguments.length){var t=I.a.g.get(e,r)||{},i=t.jb||(3===this.Db?e.content:4===this.Db?e:R);if(!i||t.hd)if(t=this.text())i=I.a.Ld(t,e.ownerDocument),this.text(""),I.a.g.set(e,r,{jb:i,hd:!0});return i}I.a.g.set(e,r,{jb:arguments[0]})};I.B.ia=function(e){this.D=e};I.B.ia.prototype=new I.B.D;I.B.ia.prototype.constructor=I.B.ia;I.B.ia.prototype.text=function(){if(0==arguments.length){var e=I.a.g.get(this.D,r)||{};e.jc===R&&e.jb&&(e.jc=e.jb.innerHTML);return e.jc}I.a.g.set(this.D,r,{jc:arguments[0]})};I.b("templateSources",I.B);I.b("templateSources.domElement",I.B.D);I.b("templateSources.anonymousTemplate",I.B.ia)}(),function(){function r(e,t,i){var r;for(t=I.h.nextSibling(t);e&&(r=e)!==t;)e=I.h.nextSibling(r),i(r,e)}function h(e,t){if(e.length){var n=e[0],a=e[e.length-1],i=n.parentNode,o=I.ga.instance,s=o.preprocessNode;if(s){r(n,a,function(e,t){var i=e.previousSibling,r=s.call(o,e);r&&(e===n&&(n=r[0]||t),e===a&&(a=r[r.length-1]||i))});e.length=0;if(!n)return;n===a?e.push(n):(e.push(n,a),I.a.Ua(e,i))}r(n,a,function(e){1!==e.nodeType&&8!==e.nodeType||I.uc(t,e)});r(n,a,function(e){1!==e.nodeType&&8!==e.nodeType||I.aa.bd(e,[t])});I.a.Ua(e,i)}}function l(e){return e.nodeType?e:0<e.length?e[0]:null}function p(e,t,i,r,n){n=n||{};var a=(e&&l(e)||i||{}).ownerDocument,o=n.templateEngine||c;I.ic.wd(i,o,a);i=o.renderTemplate(i,r,n,a);if("number"!=typeof i.length||0<i.length&&"number"!=typeof i[0].nodeType)throw Error("Template engine must return an array of DOM nodes");a=!1;switch(t){case"replaceChildren":I.h.ua(e,i);a=!0;break;case"replaceNode":I.a.Wc(e,i);a=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+t)}a&&(h(i,r),n.afterRender&&I.v.K(n.afterRender,null,[i,r[n.as||"$data"]]),"replaceChildren"==t&&I.j.Ga(e,I.j.T));return i}function m(e,t,i){return I.N(e)?e():"function"===typeof e?e(t,i):e}var c;I.ec=function(e){if(e!=R&&!(e instanceof I.ca))throw Error("templateEngine must inherit from ko.templateEngine");c=e};I.bc=function(i,r,n,a,o){n=n||{};if((n.templateEngine||c)==R)throw Error("Set a template engine before calling renderTemplate");o=o||"replaceChildren";if(a){var s=l(a);return I.$(function(){var e=r&&r instanceof I.fa?r:new I.fa(r,null,null,null,{exportDependencies:!0}),t=m(i,e.$data,e),e=p(a,o,t,e,n);"replaceNode"==o&&(a=e,s=l(a))},null,{Sa:function(){return!s||!I.a.Rb(s)},l:s&&"replaceNode"==o?s.parentNode:s})}return I.aa.Wb(function(e){I.bc(i,r,n,e,"replaceNode")})};I.Pd=function(r,t,n,a,o){function i(e,t){I.v.K(I.a.cc,null,[a,e,l,n,s,t]);I.j.Ga(a,I.j.T)}function s(e,t){h(t,c);n.afterRender&&n.afterRender(t,e);c=null}function l(e,t){c=o.createChildContext(e,{as:u,noChildContext:n.noChildContext,extend:function(e){e.$index=t;u&&(e[u+"Index"]=t)}});var i=m(r,e,c);return p(a,"ignoreTargetNode",i,c,n)}var c,u=n.as,d=!1===n.includeDestroyed||I.options.foreachHidesDestroyed&&!n.includeDestroyed;if(d||n.beforeRemove||!I.Oc(t))return I.$(function(){var e=I.a.c(t)||[];"undefined"==typeof e.length&&(e=[e]);d&&(e=I.a.fb(e,function(e){return e===R||null===e||!I.a.c(e._destroy)}));i(e)},null,{l:a});i(t.w());var e=t.subscribe(function(e){i(t(),e)},null,"arrayChange");e.l(a);return e};var o=I.a.g.Z(),n=I.a.g.Z();I.f.template={init:function(e,t){var i=I.a.c(t());if("string"==typeof i||i.name)I.h.Ea(e);else if("nodes"in i){i=i.nodes||[];if(I.N(i))throw Error('The "nodes" option must be a plain, non-observable array.');var r=i[0]&&i[0].parentNode;r&&I.a.g.get(r,n)||(r=I.a.Xb(i),I.a.g.set(r,n,!0));new I.B.ia(e).nodes(r)}else if(i=I.h.childNodes(e),0<i.length)r=I.a.Xb(i),new I.B.ia(e).nodes(r);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(e,t,i,r,n){var a=t();t=I.a.c(a);i=!0;r=null;"string"==typeof t?t={}:(a=t.name,"if"in t&&(i=I.a.c(t["if"])),i&&"ifnot"in t&&(i=!I.a.c(t.ifnot)));"foreach"in t?r=I.Pd(a||e,i&&t.foreach||[],t,e,n):i?(i=n,"data"in t&&(i=n.createChildContext(t.data,{as:t.as,noChildContext:t.noChildContext,exportDependencies:!0})),r=I.bc(a||e,i,t,e)):I.h.Ea(e);n=r;(t=I.a.g.get(e,o))&&"function"==typeof t.s&&t.s();I.a.g.set(e,o,!n||n.ja&&!n.ja()?R:n)}};I.m.Ra.template=function(e){e=I.m.Zb(e);return 1==e.length&&e[0].unknown||I.m.Hd(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"};I.h.ea.template=!0}(),I.b("setTemplateEngine",I.ec),I.b("renderTemplate",I.bc),I.a.Jc=function(e,t,i){if(e.length&&t.length){var r,n,a,o,s;for(r=n=0;(!i||r<i)&&(o=e[n]);++n){for(a=0;s=t[a];++a)if(o.value===s.value){o.moved=s.index;s.moved=o.index;t.splice(a,1);r=a=0;break}r+=a}}},I.a.Ob=function(){function r(e,t,i,r,n){var a=Math.min,o=Math.max,s=[],l,c=e.length,u,d=t.length,h=d-c||1,p=c+d+1,m,f,g;for(l=0;l<=c;l++)for(f=m,s.push(m=[]),g=a(d,l+h),u=o(0,l-1);u<=g;u++)m[u]=u?l?e[l-1]===t[u-1]?f[u-1]:a(f[u]||p,m[u-1]||p)+1:u+1:l+1;a=[];o=[];h=[];l=c;for(u=d;l||u;)d=s[l][u]-1,u&&d===s[l][u-1]?o.push(a[a.length]={status:i,value:t[--u],index:u}):l&&d===s[l-1][u]?h.push(a[a.length]={status:r,value:e[--l],index:l}):(--u,--l,n.sparse||a.push({status:"retained",value:t[u]}));I.a.Jc(h,o,!n.dontLimitMoves&&10*c);return a.reverse()}return function(e,t,i){i="boolean"===typeof i?{dontLimitMoves:i}:i||{};e=e||[];t=t||[];return e.length<t.length?r(e,t,"added","deleted",i):r(t,e,"deleted","added",i)}}(),I.b("utils.compareArrays",I.a.Ob),function(){function w(t,i,r,n,a){var o=[],e=I.$(function(){var e=i(r,a,I.a.Ua(o,t))||[];0<o.length&&(I.a.Wc(o,e),n&&I.v.K(n,null,[r,e,a]));o.length=0;I.a.gb(o,e)},null,{l:t,Sa:function(){return!I.a.jd(o)}});return{Y:o,$:e.ja()?e:R}}var D=I.a.g.Z(),M=I.a.g.Z();I.a.cc=function(t,e,i,r,n,a){function o(e){v={Aa:e,nb:I.sa(p++)};d.push(v);u||y.push(v)}function s(e){v=c[e];p!==v.nb.w()&&_.push(v);v.nb(p++);I.a.Ua(v.Y,t);d.push(v)}function l(t,i){if(t)for(var r=0,e=i.length;r<e;r++)I.a.C(i[r].Y,function(e){t(e,r,i[r].Aa)})}e=e||[];"undefined"==typeof e.length&&(e=[e]);r=r||{};var c=I.a.g.get(t,D),u=!c,d=[],h=0,p=0,m=[],f=[],g=[],_=[],y=[],v,C=0;if(u)I.a.C(e,o);else{if(!a||c&&c._countWaitingForRemove){var S=I.a.Mb(c,function(e){return e.Aa});a=I.a.Ob(S,e,{dontLimitMoves:r.dontLimitMoves,sparse:!0})}for(var S=0,x,T,b;x=a[S];S++)switch(T=x.moved,b=x.index,x.status){case"deleted":for(;h<b;)s(h++);T===R&&(v=c[h],v.$&&(v.$.s(),v.$=R),I.a.Ua(v.Y,t).length&&(r.beforeRemove&&(d.push(v),C++,v.Aa===M?v=null:g.push(v)),v&&m.push.apply(m,v.Y)));h++;break;case"added":for(;p<b;)s(h++);T!==R?(f.push(d.length),s(T)):o(x.value)}for(;p<e.length;)s(h++);d._countWaitingForRemove=C}I.a.g.set(t,D,d);l(r.beforeMove,_);I.a.C(m,r.beforeRemove?I.na:I.removeNode);var E,P,A;try{A=t.ownerDocument.activeElement}catch(e){}if(f.length)for(;(S=f.shift())!=R;){v=d[S];for(E=R;S;)if((P=d[--S].Y)&&P.length){E=P[P.length-1];break}for(e=0;h=v.Y[e];E=h,e++)I.h.Vb(t,h,E)}S=0;for(f=I.h.firstChild(t);v=d[S];S++){v.Y||I.a.extend(v,w(t,i,v.Aa,n,v.nb));for(e=0;h=v.Y[e];f=h.nextSibling,E=h,e++)h!==f&&I.h.Vb(t,h,E);!v.Dd&&n&&(n(v.Aa,v.Y,v.nb),v.Dd=!0,E=v.Y[v.Y.length-1])}A&&t.ownerDocument.activeElement!=A&&A.focus();l(r.beforeRemove,g);for(S=0;S<g.length;++S)g[S].Aa=M;l(r.afterMove,_);l(r.afterAdd,y)}}(),I.b("utils.setDomNodeChildrenFromArrayMapping",I.a.cc),I.ba=function(){this.allowTemplateRewriting=!1},I.ba.prototype=new I.ca,I.ba.prototype.constructor=I.ba,I.ba.prototype.renderTemplateSource=function(e,t,i,r){if(t=(9>I.a.W?0:e.nodes)?e.nodes():null)return I.a.la(t.cloneNode(!0).childNodes);e=e.text();return I.a.ta(e,r)},I.ba.Na=new I.ba,I.ec(I.ba.Na),I.b("nativeTemplateEngine",I.ba),function(){I.Za=function(){var a=this.Gd=function(){if(!T||!T.tmpl)return 0;try{if(0<=T.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(e){}return 1}();this.renderTemplateSource=function(e,t,i,r){r=r||x;i=i||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var n=e.data("precompiled");n||(n=e.text()||"",n=T.template(null,"{{ko_with $item.koBindingContext}}"+n+"{{/ko_with}}"),e.data("precompiled",n));e=[t.$data];t=T.extend({koBindingContext:t},i.templateOptions);t=T.tmpl(n,e,t);t.appendTo(r.createElement("div"));T.fragments={};return t};this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"};this.addTemplate=function(e,t){x.write("<script type='text/html' id='"+e+"'>"+t+"<\/script>")};0<a&&(T.tmpl.tag.ko_code={open:"__.push($1 || '');"},T.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};I.Za.prototype=new I.ca;I.Za.prototype.constructor=I.Za;var e=new I.Za;0<e.Gd&&I.ec(e);I.b("jqueryTmplTemplateEngine",I.Za)}()}(S.ko={})}();var knockout=ko;"undefined"!=typeof window?(ko=window.ko,void 0!==oldValue?window.ko=oldValue:delete window.ko):(ko=global.ko,void 0!==oldValue?global.ko=oldValue:delete global.ko);var OBSERVABLES_PROPERTY="__knockoutObservables",SUBSCRIBABLE_PROPERTY="__knockoutSubscribable";function track(n,e){if(!n)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var a=this,o=getAllObservablesForObject(n,!0);return(e=e||Object.getOwnPropertyNames(n)).forEach(function(e){if(e!==OBSERVABLES_PROPERTY&&e!==SUBSCRIBABLE_PROPERTY&&!(e in o)){var t=n[e],i=t instanceof Array,r=a.isObservable(t)?t:i?a.observableArray(t):a.observable(t);Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:r,set:a.isWriteableObservable(r)?r:void 0}),o[e]=r,i&&notifyWhenPresentOrFutureArrayValuesMutate(a,r)}}),n}function getAllObservablesForObject(e,t){var i=e[OBSERVABLES_PROPERTY];return!i&&t&&(i={},Object.defineProperty(e,OBSERVABLES_PROPERTY,{value:i})),i}function defineComputedProperty(e,t,i){var r={owner:e,deferEvaluation:!0};if("function"==typeof i)r.read=i;else{if("value"in i)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if("function"!=typeof i.get)throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');r.read=i.get,r.write=i.set}return e[t]=this.computed(r),track.call(this,e,[t]),e}function notifyWhenPresentOrFutureArrayValuesMutate(t,i){var r=null;t.computed(function(){r&&(r.dispose(),r=null);var e=i();e instanceof Array&&(r=startWatchingArrayInstance(t,i,e))})}function startWatchingArrayInstance(e,t,i){return getSubscribableForArray(e,i).subscribe(t)}function getSubscribableForArray(e,t){var i=t[SUBSCRIBABLE_PROPERTY];if(!i){i=new e.subscribable,Object.defineProperty(t,SUBSCRIBABLE_PROPERTY,{value:i});var r={};wrapStandardArrayMutators(t,i,r),addKnockoutArrayMutators(e,t,i,r)}return i}function wrapStandardArrayMutators(i,r,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(e){var t=i[e];i[e]=function(){var e=t.apply(this,arguments);return!0!==n.pause&&r.notifySubscribers(this),e}})}function addKnockoutArrayMutators(i,r,n,a){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(t){Object.defineProperty(r,t,{enumerable:!1,value:function(){var e;a.pause=!0;try{e=i.observableArray.fn[t].apply(i.observableArray(r),arguments)}finally{a.pause=!1}return n.notifySubscribers(r),e}})})}function getObservable(e,t){if(!e)return null;var i=getAllObservablesForObject(e,!1);return i&&i[t]||null}function valueHasMutated(e,t){var i=getObservable(e,t);i&&i.valueHasMutated()}function attachToKo(e){e.track=track,e.getObservable=getObservable,e.valueHasMutated=valueHasMutated,e.defineProperty=defineComputedProperty}var knockout_es5={attachToKo:attachToKo},svgNS="http://www.w3.org/2000/svg",svgClassName="cesium-svgPath-svg",SvgPathBindingHandler={register:function(o){o.bindingHandlers.cesiumSvgPath={init:function(e,r){var n=document.createElementNS(svgNS,"svg:svg");n.setAttribute("class",svgClassName);var a=document.createElementNS(svgNS,"path");return n.appendChild(a),o.virtualElements.setDomNodeChildren(e,[n]),o.computed({read:function(){var e=o.unwrap(r());a.setAttribute("d",o.unwrap(e.path));var t=o.unwrap(e.width),i=o.unwrap(e.height);n.setAttribute("width",t),n.setAttribute("height",i),n.setAttribute("viewBox","0 0 "+t+" "+i),e.css&&n.setAttribute("class",svgClassName+" "+o.unwrap(e.css))},disposeWhenNodeIsRemoved:e}),{controlsDescendantBindings:!0}}},o.virtualElements.allowedBindings.cesiumSvgPath=!0}};knockout_es5.attachToKo(knockout),SvgPathBindingHandler.register(knockout);var tmp$6={},TQj,UQj,VQj,WQj,XQj,YQj,DSj_unstuff,DSj_unstuffLUT,DSj_unstuff2,DSj_unstuffLUT2,DSj_originalUnstuff,DSj_originalUnstuff2,ESj,FSj,WYj,XYj,PQj,QQj,RQj,SQj;TQj={defaultNoDataValue:-34027999387901484e22,decode:function(e,t){var i=(t=t||{}).encodedMaskData||null===t.encodedMaskData,r=XQj(e,t.inputOffset||0,i),n=null!==t.noDataValue?t.noDataValue:TQj.defaultNoDataValue,a=UQj(r,t.pixelType||Float32Array,t.encodedMaskData,n,t.returnMask),o={width:r.width,height:r.height,pixelData:a.resultPixels,minValue:a.minValue,maxValue:r.pixels.maxValue,noDataValue:n};return a.resultMask&&(o.maskData=a.resultMask),t.returnEncodedMask&&r.mask&&(o.encodedMaskData=r.mask.bitset?r.mask.bitset:null),t.returnFileInfo&&(o.fileInfo=VQj(r),t.computeUsedBitDepths&&(o.fileInfo.bitDepths=WQj(r))),o}},UQj=function(e,t,i,r,n){var a,o,s,l=0,c=e.pixels.numBlocksX,u=e.pixels.numBlocksY,d=Math.floor(e.width/c),h=Math.floor(e.height/u),p=2*e.maxZError,m=Number.MAX_VALUE;i=i||(e.mask?e.mask.bitset:null),o=new t(e.width*e.height),n&&i&&(s=new Uint8Array(e.width*e.height));for(var f,g,_=new Float32Array(d*h),y=0;y<=u;y++){var v=y!==u?h:e.height%u;if(0!==v)for(var C=0;C<=c;C++){var S=C!==c?d:e.width%c;if(0!==S){var x,T,b,E,P=y*e.width*h+C*d,A=e.width-S,w=e.pixels.blocks[l];if(w.encoding<2?(x=0===w.encoding?w.rawData:(YQj(w.stuffedData,w.bitsPerPixel,w.numValidPixels,w.offset,p,_,e.pixels.maxValue),_),T=0):b=2===w.encoding?0:w.offset,i)for(g=0;g<v;g++){for(7&P&&(E=i[P>>3],E<<=7&P),f=0;f<S;f++)7&P||(E=i[P>>3]),128&E?(s&&(s[P]=1),m=(a=w.encoding<2?x[T++]:b)<m?a:m,o[P++]=a):(s&&(s[P]=0),o[P++]=r),E<<=1;P+=A}else if(w.encoding<2)for(g=0;g<v;g++){for(f=0;f<S;f++)m=(a=x[T++])<m?a:m,o[P++]=a;P+=A}else for(m=b<m?b:m,g=0;g<v;g++){for(f=0;f<S;f++)o[P++]=b;P+=A}if(1===w.encoding&&T!==w.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:o,resultMask:s,minValue:m}},VQj=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},WQj=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},r=0;r<t;r++){var n=e.pixels.blocks[r];0===n.encoding?i.float32=!0:1===n.encoding?i[n.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},XQj=function(e,t,i){var r={},n=new Uint8Array(e,t,10);if(r.fileIdentifierString=String.fromCharCode.apply(null,n),"CntZImage"!==r.fileIdentifierString.trim())throw"Unexpected file identifier string: "+r.fileIdentifierString;t+=10;var a=new DataView(e,t,24);if(r.fileVersion=a.getInt32(0,!0),r.imageType=a.getInt32(4,!0),r.height=a.getUint32(8,!0),r.width=a.getUint32(12,!0),r.maxZError=a.getFloat64(16,!0),t+=24,!i)if(a=new DataView(e,t,16),r.mask={},r.mask.numBlocksY=a.getUint32(0,!0),r.mask.numBlocksX=a.getUint32(4,!0),r.mask.numBytes=a.getUint32(8,!0),r.mask.maxValue=a.getFloat32(12,!0),t+=16,0<r.mask.numBytes){var o=new Uint8Array(Math.ceil(r.width*r.height/8)),s=(a=new DataView(e,t,r.mask.numBytes)).getInt16(0,!0),l=2,c=0;do{if(0<s)for(;s--;)o[c++]=a.getUint8(l++);else{var u=a.getUint8(l++);for(s=-s;s--;)o[c++]=u}s=a.getInt16(l,!0),l+=2}while(l<r.mask.numBytes);if(-32768!==s||c<o.length)throw"Unexpected end of mask RLE encoding";r.mask.bitset=o,t+=r.mask.numBytes}else 0==(r.mask.numBytes|r.mask.numBlocksY|r.mask.maxValue)&&(r.mask.bitset=new Uint8Array(Math.ceil(r.width*r.height/8)));a=new DataView(e,t,16),r.pixels={},r.pixels.numBlocksY=a.getUint32(0,!0),r.pixels.numBlocksX=a.getUint32(4,!0),r.pixels.numBytes=a.getUint32(8,!0),r.pixels.maxValue=a.getFloat32(12,!0),t+=16;var d=r.pixels.numBlocksX,h=r.pixels.numBlocksY,p=d+(0<r.width%d?1:0),m=h+(0<r.height%h?1:0);r.pixels.blocks=new Array(p*m);for(var f=0,g=0;g<m;g++)for(var _=0;_<p;_++){var y=0,v=e.byteLength-t;a=new DataView(e,t,Math.min(10,v));var C={};r.pixels.blocks[f++]=C;var S=a.getUint8(0);if(y++,C.encoding=63&S,3<C.encoding)throw"Invalid block encoding ("+C.encoding+")";if(2!==C.encoding){if(0!==S&&2!==S){if(S>>=6,2===(C.offsetType=S))C.offset=a.getInt8(1),y++;else if(1===S)C.offset=a.getInt16(1,!0),y+=2;else{if(0!==S)throw"Invalid block offset type";C.offset=a.getFloat32(1,!0),y+=4}if(1===C.encoding)if(S=a.getUint8(y),y++,C.bitsPerPixel=63&S,S>>=6,2===(C.numValidPixelsType=S))C.numValidPixels=a.getUint8(y),y++;else if(1===S)C.numValidPixels=a.getUint16(y,!0),y+=2;else{if(0!==S)throw"Invalid valid pixel count type";C.numValidPixels=a.getUint32(y,!0),y+=4}}var x;if(t+=y,3!==C.encoding)if(0===C.encoding){var T=(r.pixels.numBytes-1)/4;if(T!==Math.floor(T))throw"uncompressed block has invalid length";x=new ArrayBuffer(4*T),new Uint8Array(x).set(new Uint8Array(e,t,4*T));var b=new Float32Array(x);C.rawData=b,t+=4*T}else if(1===C.encoding){var E=Math.ceil(C.numValidPixels*C.bitsPerPixel/8),P=Math.ceil(E/4);x=new ArrayBuffer(4*P),new Uint8Array(x).set(new Uint8Array(e,t,E)),C.stuffedData=new Uint32Array(x),t+=E}}else t++}return r.eofOffset=t,r},YQj=function(e,t,i,r,n,a,o){var s,l,c,u=(1<<t)-1,d=0,h=0,p=Math.ceil((o-r)/n),m=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*m,s=0;s<i;s++){if(0===h&&(c=e[d++],h=32),t<=h)l=c>>>h-t&u,h-=t;else{var f=t-h;l=(c&u)<<f&u,l+=(c=e[d++])>>>(h=32-f)}a[s]=l<p?r+l*n:o}return a},PQj=TQj,DSj_unstuff=function(e,t,i,r,n,a,o,s){var l,c,u,d,h,p=(1<<i)-1,m=0,f=0,g=4*e.length-Math.ceil(i*r/8);if(e[e.length-1]<<=8*g,n)for(l=0;l<r;l++)0===f&&(u=e[m++],f=32),i<=f?(c=u>>>f-i&p,f-=i):(c=(u&p)<<(d=i-f)&p,c+=(u=e[m++])>>>(f=32-d)),t[l]=n[c];else for(h=Math.ceil((s-a)/o),l=0;l<r;l++)0===f&&(u=e[m++],f=32),i<=f?(c=u>>>f-i&p,f-=i):(c=(u&p)<<(d=i-f)&p,c+=(u=e[m++])>>>(f=32-d)),t[l]=c<h?a+c*o:s},DSj_unstuffLUT=function(e,t,i,r,n,a){var o,s=(1<<t)-1,l=0,c=0,u=0,d=0,h=0,p=[],m=4*e.length-Math.ceil(t*i/8);e[e.length-1]<<=8*m;var f=Math.ceil((a-r)/n);for(c=0;c<i;c++)0===d&&(o=e[l++],d=32),t<=d?(h=o>>>d-t&s,d-=t):(h=(o&s)<<(u=t-d)&s,h+=(o=e[l++])>>>(d=32-u)),p[c]=h<f?r+h*n:a;return p.unshift(r),p},DSj_unstuff2=function(e,t,i,r,n,a,o,s){var l,c,u,d,h=(1<<i)-1,p=0,m=0,f=0;if(n)for(l=0;l<r;l++)0===m&&(u=e[p++],m=32,f=0),i<=m?(c=u>>>f&h,m-=i,f+=i):(c=u>>>f&h,m=32-(d=i-m),c|=((u=e[p++])&(1<<d)-1)<<i-d,f=d),t[l]=n[c];else{var g=Math.ceil((s-a)/o);for(l=0;l<r;l++)0===m&&(u=e[p++],m=32,f=0),i<=m?(c=u>>>f&h,m-=i,f+=i):(c=u>>>f&h,m=32-(d=i-m),c|=((u=e[p++])&(1<<d)-1)<<i-d,f=d),t[l]=c<g?a+c*o:s}return t},DSj_unstuffLUT2=function(e,t,i,r,n,a){var o,s=(1<<t)-1,l=0,c=0,u=0,d=0,h=0,p=0,m=[],f=Math.ceil((a-r)/n);for(c=0;c<i;c++)0===d&&(o=e[l++],d=32,p=0),t<=d?(h=o>>>p&s,d-=t,p+=t):(h=o>>>p&s,d=32-(u=t-d),h|=((o=e[l++])&(1<<u)-1)<<t-u,p=u),m[c]=h<f?r+h*n:a;return m.unshift(r),m},DSj_originalUnstuff=function(e,t,i,r){var n,a,o,s,l=(1<<i)-1,c=0,u=0,d=4*e.length-Math.ceil(i*r/8);for(e[e.length-1]<<=8*d,n=0;n<r;n++)0===u&&(o=e[c++],u=32),i<=u?(a=o>>>u-i&l,u-=i):(a=(o&l)<<(s=i-u)&l,a+=(o=e[c++])>>>(u=32-s)),t[n]=a;return t},DSj_originalUnstuff2=function(e,t,i,r){var n,a,o,s,l=(1<<i)-1,c=0,u=0,d=0;for(n=0;n<r;n++)0===u&&(o=e[c++],u=32,d=0),i<=u?(a=o>>>d&l,u-=i,d+=i):(a=o>>>d&l,u=32-(s=i-u),a|=((o=e[c++])&(1<<s)-1)<<i-s,d=s),t[n]=a;return t},ESj={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,i=65535,r=e.length,n=Math.floor(r/2),a=0;n;){var o=359<=n?359:n;for(n-=o;t+=e[a++]<<8,i+=t+=e[a++],--o;);t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16)}return 1&r&&(i+=t+=e[a]<<8),((i=(65535&i)+(i>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var i=t.ptr,r=new Uint8Array(e,i,6),n={};if(n.fileIdentifierString=String.fromCharCode.apply(null,r),0!==n.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+n.fileIdentifierString;i+=6;var a,o=new DataView(e,i,8),s=o.getInt32(0,!0);if(i+=4,3<=(n.fileVersion=s)&&(n.checksum=o.getUint32(4,!0),i+=4),o=new DataView(e,i,12),n.height=o.getUint32(0,!0),n.width=o.getUint32(4,!0),i+=8,4<=s?(n.numDims=o.getUint32(8,!0),i+=4):n.numDims=1,o=new DataView(e,i,40),n.numValidPixel=o.getUint32(0,!0),n.microBlockSize=o.getInt32(4,!0),n.blobSize=o.getInt32(8,!0),n.imageType=o.getInt32(12,!0),n.maxZError=o.getFloat64(16,!0),n.zMin=o.getFloat64(24,!0),n.zMax=o.getFloat64(32,!0),i+=40,t.headerInfo=n,t.ptr=i,3<=s&&(a=4<=s?52:48,this.computeChecksumFletcher32(new Uint8Array(e,i-a,n.blobSize-14))!==n.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var i=t.headerInfo,r=this.getDataTypeArray(i.imageType),n=i.numDims*this.getDataTypeSize(i.imageType),a=this.readSubArray(e,t.ptr,r,n),o=this.readSubArray(e,t.ptr+n,r,n);t.ptr+=2*n;var s,l=!0;for(s=0;s<i.numDims;s++)if(a[s]!==o[s]){l=!1;break}return i.minValues=a,i.maxValues=o,l},readSubArray:function(e,t,i,r){var n;if(i===Uint8Array)n=new Uint8Array(e,t,r);else{var a=new ArrayBuffer(r);new Uint8Array(a).set(new Uint8Array(e,t,r)),n=new i(a)}return n},readMask:function(e,t){var i,r,n=t.ptr,a=t.headerInfo,o=a.width*a.height,s=a.numValidPixel,l=new DataView(e,n,4),c={};if(c.numBytes=l.getUint32(0,!0),n+=4,(0===s||o===s)&&0!==c.numBytes)throw"invalid mask";if(0===s)i=new Uint8Array(Math.ceil(o/8)),c.bitset=i,r=new Uint8Array(o),t.pixels.resultMask=r,n+=c.numBytes;else if(0<c.numBytes){i=new Uint8Array(Math.ceil(o/8));var u=(l=new DataView(e,n,c.numBytes)).getInt16(0,!0),d=2,h=0,p=0;do{if(0<u)for(;u--;)i[h++]=l.getUint8(d++);else for(p=l.getUint8(d++),u=-u;u--;)i[h++]=p;u=l.getInt16(d,!0),d+=2}while(d<c.numBytes);if(-32768!==u||h<i.length)throw"Unexpected end of mask RLE encoding";r=new Uint8Array(o);var m=0,f=0;for(f=0;f<o;f++)7&f?(m=i[f>>3],m<<=7&f):m=i[f>>3],128&m&&(r[f]=1);t.pixels.resultMask=r,c.bitset=i,n+=c.numBytes}return t.ptr=n,t.mask=c,!0},readDataOneSweep:function(e,t,i){var r,n=t.ptr,a=t.headerInfo,o=a.numDims,s=a.width*a.height,l=a.imageType,c=a.numValidPixel*ESj.getDataTypeSize(l)*o,u=t.pixels.resultMask;if(i===Uint8Array)r=new Uint8Array(e,n,c);else{var d=new ArrayBuffer(c);new Uint8Array(d).set(new Uint8Array(e,n,c)),r=new i(d)}if(r.length===s*o)t.pixels.resultPixels=r;else{t.pixels.resultPixels=new i(s*o);var h=0,p=0,m=0,f=0;if(1<o)for(m=0;m<o;m++)for(f=m*s,p=0;p<s;p++)u[p]&&(t.pixels.resultPixels[f+p]=r[h++]);else for(p=0;p<s;p++)u[p]&&(t.pixels.resultPixels[p]=r[h++])}return n+=c,t.ptr=n,!0},readHuffmanTree:function(e,t){var i=this.HUFFMAN_LUT_BITS_MAX,r=new DataView(e,t.ptr,16);if(t.ptr+=16,r.getInt32(0,!0)<2)throw"unsupported Huffman version";var n=r.getInt32(4,!0),a=r.getInt32(8,!0),o=r.getInt32(12,!0);if(o<=a)return!1;var s=new Uint32Array(o-a);ESj.decodeBits(e,t,s);var l,c,u,d,h=[];for(l=a;l<o;l++)h[c=l-(l<n?0:n)]={first:s[l-a],second:null};var p=e.byteLength-t.ptr,m=Math.ceil(p/4),f=new ArrayBuffer(4*m);new Uint8Array(f).set(new Uint8Array(e,t.ptr,p));var g,_=new Uint32Array(f),y=0,v=0;for(g=_[0],l=a;l<o;l++)0<(d=h[c=l-(l<n?0:n)].first)&&(h[c].second=g<<y>>>32-d,d<=32-y?32===(y+=d)&&(y=0,g=_[++v]):(y+=d-32,g=_[++v],h[c].second|=g>>>32-y));var C=0,S=0,x=new FSj;for(l=0;l<h.length;l++)void 0!==h[l]&&(C=Math.max(C,h[l].first));S=i<=C?i:C,30<=C&&console.log("WARning, large NUM LUT BITS IS "+C);var T,b,E,P,A,w=[];for(l=a;l<o;l++)if(0<(d=h[c=l-(l<n?0:n)].first))if(T=[d,c],d<=S)for(b=h[c].second<<S-d,E=1<<S-d,u=0;u<E;u++)w[b|u]=T;else for(b=h[c].second,A=x,P=d-1;0<=P;P--)A=b>>>P&1?(A.right||(A.right=new FSj),A.right):(A.left||(A.left=new FSj),A.left),0!==P||A.val||(A.val=T[1]);return{decodeLut:w,numBitsLUTQick:S,numBitsLUT:C,tree:x,stuffedData:_,srcPtr:v,bitPos:y}},readHuffman:function(e,t,i){var r,n,a,o,s,l,c,u,d,h=t.headerInfo,p=h.numDims,m=t.headerInfo.height,f=t.headerInfo.width,g=f*m,_=this.readHuffmanTree(e,t),y=_.decodeLut,v=_.tree,C=_.stuffedData,S=_.srcPtr,x=_.bitPos,T=_.numBitsLUTQick,b=_.numBitsLUT,E=0===t.headerInfo.imageType?128:0,P=t.pixels.resultMask,A=0;0<x&&(S++,x=0);var w,D=C[S],M=1===t.encodeMode,I=new i(g*p),R=I;for(w=0;w<h.numDims;w++){if(1<p&&(R=new i(I.buffer,g*w,g),A=0),t.headerInfo.numValidPixel===f*m)for(l=u=0;l<m;l++)for(c=0;c<f;c++,u++){if(n=0,s=o=D<<x>>>32-T,32-x<T&&(s=o|=C[S+1]>>>64-x-T),y[s])n=y[s][1],x+=y[s][0];else for(s=o=D<<x>>>32-b,32-x<b&&(s=o|=C[S+1]>>>64-x-b),r=v,d=0;d<b;d++)if(!(r=o>>>b-d-1&1?r.right:r.left).left&&!r.right){n=r.val,x=x+d+1;break}32<=x&&(x-=32,D=C[++S]),a=n-E,M?(a+=0<c?A:0<l?R[u-f]:A,a&=255,A=R[u]=a):R[u]=a}else for(l=u=0;l<m;l++)for(c=0;c<f;c++,u++)if(P[u]){if(n=0,s=o=D<<x>>>32-T,32-x<T&&(s=o|=C[S+1]>>>64-x-T),y[s])n=y[s][1],x+=y[s][0];else for(s=o=D<<x>>>32-b,32-x<b&&(s=o|=C[S+1]>>>64-x-b),r=v,d=0;d<b;d++)if(!(r=o>>>b-d-1&1?r.right:r.left).left&&!r.right){n=r.val,x=x+d+1;break}32<=x&&(x-=32,D=C[++S]),a=n-E,M?(0<c&&P[u-1]?a+=A:0<l&&P[u-f]?a+=R[u-f]:a+=A,a&=255,A=R[u]=a):R[u]=a}t.ptr=t.ptr+4*(S+1)+(0<x?4:0)}t.pixels.resultPixels=I},decodeBits:function(e,t,i,r,n){var a=t.headerInfo,o=a.fileVersion,s=0,l=5<=e.byteLength-t.ptr?5:e.byteLength-t.ptr,c=new DataView(e,t.ptr,l),u=c.getUint8(0);s++;var d=u>>6,h=0==d?4:3-d,p=0<(32&u),m=31&u,f=0;if(1==h)f=c.getUint8(s),s++;else if(2==h)f=c.getUint16(s,!0),s+=2;else{if(4!=h)throw"Invalid valid pixel count type";f=c.getUint32(s,!0),s+=4}var g,_,y,v,C,S,x,T,b,E=2*a.maxZError,P=1<a.numDims?a.maxValues[n]:a.zMax;if(p){for(t.counter.lut++,T=c.getUint8(s),s++,v=Math.ceil((T-1)*m/8),C=Math.ceil(v/4),_=new ArrayBuffer(4*C),y=new Uint8Array(_),t.ptr+=s,y.set(new Uint8Array(e,t.ptr,v)),x=new Uint32Array(_),t.ptr+=v,b=0;T-1>>>b;)b++;v=Math.ceil(f*b/8),C=Math.ceil(v/4),_=new ArrayBuffer(4*C),(y=new Uint8Array(_)).set(new Uint8Array(e,t.ptr,v)),g=new Uint32Array(_),t.ptr+=v,S=3<=o?DSj_unstuffLUT2(x,m,T-1,r,E,P):DSj_unstuffLUT(x,m,T-1,r,E,P),3<=o?DSj_unstuff2(g,i,b,f,S):DSj_unstuff(g,i,b,f,S)}else t.counter.bitstuffer++,b=m,t.ptr+=s,0<b&&(v=Math.ceil(f*b/8),C=Math.ceil(v/4),_=new ArrayBuffer(4*C),(y=new Uint8Array(_)).set(new Uint8Array(e,t.ptr,v)),g=new Uint32Array(_),t.ptr+=v,3<=o?null===r?DSj_originalUnstuff2(g,i,b,f):DSj_unstuff2(g,i,b,f,!1,r,E,P):null===r?DSj_originalUnstuff(g,i,b,f):DSj_unstuff(g,i,b,f,!1,r,E,P))},readTiles:function(e,t,i){var r=t.headerInfo,n=r.width,a=r.height,o=r.microBlockSize,s=r.imageType,l=ESj.getDataTypeSize(s),c=Math.ceil(n/o),u=Math.ceil(a/o);t.pixels.numBlocksY=u,t.pixels.numBlocksX=c;var d,h,p,m,f,g,_,y,v=t.pixels.ptr=0,C=0,S=0,x=0,T=0,b=0,E=0,P=0,A=0,w=0,D=0,M=0,I=0,R=0,O=0,L=new i(o*o),F=a%o||o,N=n%o||o,B=r.numDims,V=t.pixels.resultMask,k=t.pixels.resultPixels;for(S=0;S<u;S++)for(T=S!==u-1?o:F,x=0;x<c;x++)for(w=S*n*o+x*o,D=n-(b=x!==c-1?o:N),y=0;y<B;y++){if(1<B&&(k=new i(t.pixels.resultPixels.buffer,n*a*y*l,n*a)),E=e.byteLength-t.ptr,h={},O=0,O++,A=(P=(d=new DataView(e,t.ptr,Math.min(10,E))).getUint8(0))>>6&255,(P>>2&15)!==(x*o>>3&15))throw"integrity issue";if(3<(f=3&P))throw t.ptr+=O,"Invalid block encoding ("+f+")";if(2!=f)if(0==f){if(t.counter.uncompressed++,t.ptr+=O,M=(M=T*b*l)<(I=e.byteLength-t.ptr)?M:I,p=new ArrayBuffer(M%l==0?M:M+l-M%l),new Uint8Array(p).set(new Uint8Array(e,t.ptr,M)),m=new i(p),R=0,V)for(v=0;v<T;v++){for(C=0;C<b;C++)V[w]&&(k[w]=m[R++]),w++;w+=D}else for(v=0;v<T;v++){for(C=0;C<b;C++)k[w++]=m[R++];w+=D}t.ptr+=R*l}else if(g=ESj.getDataTypeUsed(s,A),_=ESj.getOnePixel(h,O,g,d),O+=ESj.getDataTypeSize(g),3==f)if(t.ptr+=O,t.counter.constantoffset++,V)for(v=0;v<T;v++){for(C=0;C<b;C++)V[w]&&(k[w]=_),w++;w+=D}else for(v=0;v<T;v++){for(C=0;C<b;C++)k[w++]=_;w+=D}else if(t.ptr+=O,ESj.decodeBits(e,t,L,_,y),O=0,V)for(v=0;v<T;v++){for(C=0;C<b;C++)V[w]&&(k[w]=L[O++]),w++;w+=D}else for(v=0;v<T;v++){for(C=0;C<b;C++)k[w++]=L[O++];w+=D}else t.counter.constant++,t.ptr+=O}},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:ESj.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e){var t=e.headerInfo.zMax,i=e.headerInfo.numDims,r=e.headerInfo.height*e.headerInfo.width,n=r*i,a=0,o=0,s=0,l=e.pixels.resultMask;if(l)if(1<i)for(a=0;a<i;a++)for(s=a*r,o=0;o<r;o++)l[o]&&(e.pixels.resultPixels[s+o]=t);else for(o=0;o<r;o++)l[o]&&(e.pixels.resultPixels[o]=t);else if(e.pixels.resultPixels.fill)e.pixels.resultPixels.fill(t);else for(o=0;o<n;o++)e.pixels.resultPixels[o]=t},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:t=Float32Array;break;case 7:t=Float64Array;break;default:t=Float32Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:t="F32";break;case 7:t="F64";break;default:t="F32"}return t},isValidPixelValue:function(e,t){if(null===t)return!1;var i;switch(e){case 0:i=-128<=t&&t<=127;break;case 1:i=0<=t&&t<=255;break;case 2:i=-32768<=t&&t<=32767;break;case 3:i=0<=t&&t<=65536;break;case 4:i=-2147483648<=t&&t<=2147483647;break;case 5:i=0<=t&&t<=4294967296;break;case 6:i=-34027999387901484e22<=t&&t<=34027999387901484e22;break;case 7:i=5e-324<=t&&t<=17976931348623157e292;break;default:i=!1}return i},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var i=e;switch(e){case 2:case 4:i=e-t;break;case 3:case 5:i=e-2*t;break;case 6:i=0===t?e:1===t?2:1;break;case 7:i=0===t?e:e-2*t+1;break;default:i=e}return i},getOnePixel:function(e,t,i,r){var n=0;switch(i){case 0:n=r.getInt8(t);break;case 1:n=r.getUint8(t);break;case 2:n=r.getInt16(t,!0);break;case 3:n=r.getUint16(t,!0);break;case 4:n=r.getInt32(t,!0);break;case 5:n=r.getUInt32(t,!0);break;case 6:n=r.getFloat32(t,!0);break;case 7:n=r.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return n}},FSj=function(e,t,i){this.val=e,this.left=t,this.right=i},QQj={decode:function(e,t){var i=(t=t||{}).noDataValue,r=0,n={};n.ptr=t.inputOffset||0,n.pixels={},ESj.readHeaderInfo(e,n);var a=n.headerInfo,o=a.fileVersion,s=ESj.getDataTypeArray(a.imageType);ESj.readMask(e,n),a.numValidPixel===a.width*a.height||n.pixels.resultMask||(n.pixels.resultMask=t.maskData);var l,c=a.width*a.height;if(n.pixels.resultPixels=new s(c*a.numDims),n.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},0!==a.numValidPixel)if(a.zMax===a.zMin)ESj.constructConstantSurface(n);else if(4<=o&&ESj.checkMinMaxRanges(e,n))ESj.constructConstantSurface(n);else{var u=new DataView(e,n.ptr,2),d=u.getUint8(0);if(n.ptr++,d)ESj.readDataOneSweep(e,n,s);else if(1<o&&a.imageType<=1&&Math.abs(a.maxZError-.5)<1e-5){var h=u.getUint8(1);if(n.ptr++,2<(n.encodeMode=h)||o<4&&1<h)throw"Invalid Huffman flag "+h;h?ESj.readHuffman(e,n,s):ESj.readTiles(e,n,s)}else ESj.readTiles(e,n,s)}n.eofOffset=n.ptr,t.inputOffset?(l=n.headerInfo.blobSize+t.inputOffset-n.ptr,1<=Math.abs(l)&&(n.eofOffset=t.inputOffset+n.headerInfo.blobSize)):(l=n.headerInfo.blobSize-n.ptr,1<=Math.abs(l)&&(n.eofOffset=n.headerInfo.blobSize));var p={width:a.width,height:a.height,pixelData:n.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,validPixelCount:a.numValidPixel,dimCount:a.numDims,dimStats:{minValues:a.minValues,maxValues:a.maxValues},maskData:n.pixels.resultMask};if(n.pixels.resultMask&&ESj.isValidPixelValue(a.imageType,i)){var m=n.pixels.resultMask;for(r=0;r<c;r++)m[r]||(p.pixelData[r]=i);p.noDataValue=i}return n.noDataValue=i,t.returnFileInfo&&(p.fileInfo=ESj.formatFileInfo(n)),p},getBandCount:function(e){for(var t=0,i=0,r={ptr:0,pixels:{}};i<e.byteLength-58;)ESj.readHeaderInfo(e,r),i+=r.headerInfo.blobSize,t++,r.ptr=i;return t}},WYj=new ArrayBuffer(4),XYj=new Uint8Array(WYj),RQj=(new Uint32Array(WYj)[0]=1)===XYj[0],SQj={decode:function(e,t){if(!RQj)throw"Big endian system is not supported.";var i,r,n=(t=t||{}).inputOffset||0,a=new Uint8Array(e,n,10),o=String.fromCharCode.apply(null,a);if("CntZImage"===o.trim())i=PQj,r=1;else{if("Lerc2"!==o.substring(0,5))throw"Unexpected file identifier string: "+o;i=QQj,r=2}for(var s,l,c,u,d,h,p=0,m=e.byteLength-10,f=[],g={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]};n<m;){var _=i.decode(e,{inputOffset:n,encodedMaskData:s,maskData:c,returnMask:0===p,returnEncodedMask:0===p,returnFileInfo:!0,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});n=_.fileInfo.eofOffset,0===p&&(s=_.encodedMaskData,c=_.maskData,g.width=_.width,g.height=_.height,g.dimCount=_.dimCount||1,g.pixelType=_.pixelType||_.fileInfo.pixelType,g.mask=_.maskData),1<r&&_.fileInfo.mask&&0<_.fileInfo.mask.numBytes&&f.push(_.maskData),p++,g.pixels.push(_.pixelData),g.statistics.push({minValue:_.minValue,maxValue:_.maxValue,noDataValue:_.noDataValue,dimStats:_.dimStats})}if(1<r&&1<f.length){for(h=g.width*g.height,g.bandMasks=f,(c=new Uint8Array(h)).set(f[0]),u=1;u<f.length;u++)for(l=f[u],d=0;d<h;d++)c[d]=c[d]&l[d];g.maskData=c}return g}},tmp$6.Lerc=SQj;var LercDecode=tmp$6.Lerc,tmp$7={},qZj,rZj;qZj=tmp$7,rZj=function(){return n={},r.m=i=[function(e,t,i){var r=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e};function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=i(1),o=a.webm,s=a.mp4,l="undefined"!=typeof navigator&&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,c=(r(u,[{key:"_addSourceToVideo",value:function(e,t,i){var r=document.createElement("source");r.src=i,r.type="video/"+t,e.appendChild(r)}},{key:"enable",value:function(){l?(this.disable(),console.warn("\n        NoSleep enabled for older iOS devices. This can interrupt\n        active or long-running network requests from completing successfully.\n        See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n      "),this.noSleepTimer=window.setInterval(function(){document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){l?this.noSleepTimer&&(console.warn("\n          NoSleep now disabled for older iOS devices.\n        "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),u);function u(){var e=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),l?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("muted",""),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",o),this._addSourceToVideo(this.noSleepVideo,"mp4",s),this.noSleepVideo.addEventListener("loadedmetadata",function(){e.noSleepVideo.duration<=1?e.noSleepVideo.setAttribute("loop",""):e.noSleepVideo.addEventListener("timeupdate",function(){.5<e.noSleepVideo.currentTime&&(e.noSleepVideo.currentTime=Math.random())})}))}e.exports=c},function(e,t,i){e.exports={webm:"data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=",mp4:"data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}}],r.c=n,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0);function r(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}var i,n},qZj.NoSleep=rZj();var NoSleep=tmp$7.NoSleep;function ClockViewModel(t){defined(t)||(t=new Clock),this._clock=t,this._eventHelper=new EventHelper,this._eventHelper.add(t.onTick,this.synchronize,this),this.systemTime=knockout.observable(JulianDate.now()),this.systemTime.equalityComparer=JulianDate.equals,this.startTime=knockout.observable(t.startTime),this.startTime.equalityComparer=JulianDate.equals,this.startTime.subscribe(function(e){t.startTime=e,this.synchronize()},this),this.stopTime=knockout.observable(t.stopTime),this.stopTime.equalityComparer=JulianDate.equals,this.stopTime.subscribe(function(e){t.stopTime=e,this.synchronize()},this),this.currentTime=knockout.observable(t.currentTime),this.currentTime.equalityComparer=JulianDate.equals,this.currentTime.subscribe(function(e){t.currentTime=e,this.synchronize()},this),this.multiplier=knockout.observable(t.multiplier),this.multiplier.subscribe(function(e){t.multiplier=e,this.synchronize()},this),this.clockStep=knockout.observable(t.clockStep),this.clockStep.subscribe(function(e){t.clockStep=e,this.synchronize()},this),this.clockRange=knockout.observable(t.clockRange),this.clockRange.subscribe(function(e){t.clockRange=e,this.synchronize()},this),this.canAnimate=knockout.observable(t.canAnimate),this.canAnimate.subscribe(function(e){t.canAnimate=e,this.synchronize()},this),this.shouldAnimate=knockout.observable(t.shouldAnimate),this.shouldAnimate.subscribe(function(e){t.shouldAnimate=e,this.synchronize()},this),knockout.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}function Command(){this.canExecute=void 0,this.beforeExecute=void 0,this.afterExecute=void 0,DeveloperError.throwInstantiationError()}function createCommand$2(i,e){e=defaultValue(e,!0);var r=new Event,n=new Event;function t(){var e,t={args:arguments,cancel:!1};return r.raiseEvent(t),t.cancel||(e=i.apply(null,arguments),n.raiseEvent(e)),e}return t.canExecute=e,knockout.track(t,["canExecute"]),defineProperties$1(t,{beforeExecute:{value:r},afterExecute:{value:n}}),t}defineProperties$1(ClockViewModel.prototype,{clock:{get:function(){return this._clock}}}),ClockViewModel.prototype.synchronize=function(){var e=this._clock;this.systemTime=JulianDate.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},ClockViewModel.prototype.isDestroyed=function(){return!1},ClockViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),destroyObject(this)};var InspectorShared={};function subscribeAndEvaluate(e,t,i,r,n){return i.call(r,e[t]),knockout.getObservable(e,t).subscribe(i,r,n)}function ToggleButtonViewModel(e,t){this._command=e,t=defaultValue(t,defaultValue.EMPTY_OBJECT),this.toggled=defaultValue(t.toggled,!1),this.tooltip=defaultValue(t.tooltip,""),knockout.track(this,["toggled","tooltip"])}InspectorShared.createCheckbox=function(e,t,i){var r=document.createElement("div"),n=document.createElement("label"),a=document.createElement("input");a.type="checkbox";var o="checked: "+t;return defined(i)&&(o+=", enable: "+i),a.setAttribute("data-bind",o),n.appendChild(a),n.appendChild(document.createTextNode(e)),r.appendChild(n),r},InspectorShared.createSection=function(e,t,i,r){var n=document.createElement("div");n.className="cesium-cesiumInspector-section",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-section-collapsed": !'+i+" }"),e.appendChild(n);var a=document.createElement("h3");a.className="cesium-cesiumInspector-sectionHeader",a.appendChild(document.createTextNode(t)),a.setAttribute("data-bind","click: "+r),n.appendChild(a);var o=document.createElement("div");return o.className="cesium-cesiumInspector-sectionContent",n.appendChild(o),o},defineProperties$1(ToggleButtonViewModel.prototype,{command:{get:function(){return this._command}}});var DepthViewPacked="uniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nfloat z_window = czm_unpackDepth(texture2D(u_depthTexture, v_textureCoordinates));\nz_window = czm_reverseLogDepth(z_window);\nfloat n_range = czm_depthRange.near;\nfloat f_range = czm_depthRange.far;\nfloat z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\nfloat scale = pow(z_ndc * 0.5 + 0.5, 8.0);\ngl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";function removePipelineExtras(e){return ForEach.shader(e,function(e){removeExtras(e)}),ForEach.buffer(e,function(e){removeExtras(e)}),ForEach.image(e,function(e){removeExtras(e),ForEach.compressedImage(e,function(e){removeExtras(e)})}),removeExtras(e),e}function removeExtras(e){defined(e.extras)&&(defined(e.extras._pipeline)&&delete e.extras._pipeline,0===Object.keys(e.extras).length&&delete e.extras)}var svgNS$1="http://www.w3.org/2000/svg",xlinkNS="http://www.w3.org/1999/xlink",widgetForDrag,gradientEnabledColor0=Color.fromCssColorString("rgba(247,250,255,0.384)"),gradientEnabledColor1=Color.fromCssColorString("rgba(143,191,255,0.216)"),gradientEnabledColor2=Color.fromCssColorString("rgba(153,197,255,0.098)"),gradientEnabledColor3=Color.fromCssColorString("rgba(255,255,255,0.086)"),gradientDisabledColor0=Color.fromCssColorString("rgba(255,255,255,0.267)"),gradientDisabledColor1=Color.fromCssColorString("rgba(255,255,255,0)"),gradientKnobColor=Color.fromCssColorString("rgba(66,67,68,0.3)"),gradientPointerColor=Color.fromCssColorString("rgba(0,0,0,0.5)");function getElementColor(e){return Color.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}function svgFromObject(e){var t=document.createElementNS(svgNS$1,e.tagName);for(var i in e)if(e.hasOwnProperty(i)&&"tagName"!==i)if("children"===i){var r,n=e.children.length;for(r=0;r<n;++r)t.appendChild(svgFromObject(e.children[r]))}else 0===i.indexOf("xlink:")?t.setAttributeNS(xlinkNS,i.substring(6),e[i]):"textContent"===i?t.textContent=e[i]:t.setAttribute(i,e[i]);return t}function svgText(e,t,i){var r=document.createElementNS(svgNS$1,"text");r.setAttribute("x",e),r.setAttribute("y",t),r.setAttribute("class","cesium-animation-svgText");var n=document.createElementNS(svgNS$1,"tspan");return n.textContent=i,r.appendChild(n),r}function setShuttleRingPointer(e,t,i){e.setAttribute("transform","translate(100,100) rotate("+i+")"),t.setAttribute("transform","rotate("+i+")")}var makeColorStringScratch=new Color;function makeColorString(e,t){var i=t.alpha,r=1-i;return makeColorStringScratch.red=e.red*r+t.red*i,makeColorStringScratch.green=e.green*r+t.green*i,makeColorStringScratch.blue=e.blue*r+t.blue*i,makeColorStringScratch.toCssColorString()}function rectButton(e,t,i){return svgFromObject({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},{tagName:"use",class:"cesium-animation-buttonPath","xlink:href":i},{tagName:"title",textContent:""}]})}function wingButton(e,t,i){return svgFromObject({tagName:"g",class:"cesium-animation-rectButton",transform:"translate("+e+","+t+")",children:[{tagName:"use",class:"cesium-animation-buttonGlow","xlink:href":"#animation_pathWingButton"},{tagName:"use",class:"cesium-animation-buttonMain","xlink:href":"#animation_pathWingButton"},{tagName:"use",class:"cesium-animation-buttonPath","xlink:href":i},{tagName:"title",textContent:""}]})}function setShuttleRingFromMouseOrTouch(e,t){var i=e._viewModel,r=i.shuttleRingDragging;if(!r||widgetForDrag===e)if("mousedown"===t.type||r&&"mousemove"===t.type||"touchstart"===t.type&&1===t.touches.length||r&&"touchmove"===t.type&&1===t.touches.length){var n,a,o=e._centerX,s=e._centerY,l=e._svgNode.getBoundingClientRect();if(a="touchstart"===t.type||"touchmove"===t.type?(n=t.touches[0].clientX,t.touches[0].clientY):(n=t.clientX,t.clientY),!r&&(n>l.right||n<l.left||a<l.top||a>l.bottom))return;var c=e._shuttleRingPointer.getBoundingClientRect(),u=n-o-l.left,d=a-s-l.top,h=180*Math.atan2(d,u)/Math.PI+90;180<h&&(h-=360);var p=i.shuttleRingAngle;r||n<c.right&&n>c.left&&a>c.top&&a<c.bottom?(widgetForDrag=e,i.shuttleRingDragging=!0,i.shuttleRingAngle=h):h<p?i.slower():p<h&&i.faster(),t.preventDefault()}else e===widgetForDrag&&(widgetForDrag=void 0),i.shuttleRingDragging=!1}function SvgButton(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;var i=this;this._clickFunction=function(){var e=i._viewModel.command;e.canExecute&&e()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[subscribeAndEvaluate(t,"toggled",this.setToggled,this),subscribeAndEvaluate(t,"tooltip",this.setTooltip,this),subscribeAndEvaluate(t.command,"canExecute",this.setEnabled,this)]}function Animation(e,t){e=getElement(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;var 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); }",document.head.insertBefore(i,document.head.childNodes[0]);var r=document.createElement("div");r.className="cesium-animation-theme",r.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=r,this._themeNormal=r.childNodes[0],this._themeHover=r.childNodes[1],this._themeSelect=r.childNodes[2],this._themeDisabled=r.childNodes[3],this._themeKnob=r.childNodes[4],this._themePointer=r.childNodes[5],this._themeSwoosh=r.childNodes[6],this._themeSwooshHover=r.childNodes[7];var n=document.createElementNS(svgNS$1,"svg:svg");(this._svgNode=n).setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",xlinkNS);var a=document.createElementNS(svgNS$1,"g");this._topG=a,this._realtimeSVG=new SvgButton(wingButton(3,4,"#animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new SvgButton(rectButton(44,99,"#animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new SvgButton(rectButton(124,99,"#animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new SvgButton(rectButton(84,99,"#animation_pathPause"),t.pauseViewModel);var o=document.createElementNS(svgNS$1,"g");o.appendChild(this._realtimeSVG.svgElement),o.appendChild(this._playReverseSVG.svgElement),o.appendChild(this._playForwardSVG.svgElement),o.appendChild(this._pauseSVG.svgElement);var s=svgFromObject({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=s;var l=svgFromObject({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:"use",transform:"translate(100,97) scale(-1,1)","xlink:href":"#animation_pathSwooshFX"},{tagName:"use",transform:"translate(100,97)","xlink:href":"#animation_pathSwooshFX"},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=l,this._shuttleRingPointer=svgFromObject({tagName:"use",class:"cesium-animation-shuttleRingPointer","xlink:href":"#animation_pathPointer"});var c=svgFromObject({tagName:"g",transform:"translate(100,100)"});this._knobOuter=svgFromObject({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});var u=svgFromObject({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:61});this._knobDate=svgText(0,-24,""),this._knobTime=svgText(0,-7,""),this._knobStatus=svgText(0,-41,"");var d=svgFromObject({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:61}),h=document.createElementNS(svgNS$1,"g");h.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(r),a.appendChild(h),a.appendChild(c),a.appendChild(o),h.appendChild(s),h.appendChild(l),h.appendChild(this._shuttleRingPointer),c.appendChild(this._knobOuter),c.appendChild(u),c.appendChild(this._knobDate),c.appendChild(this._knobTime),c.appendChild(this._knobStatus),c.appendChild(d),n.appendChild(a),e.appendChild(n);var p=this;function m(e){setShuttleRingFromMouseOrTouch(p,e)}this._mouseCallback=m,s.addEventListener("mousedown",m,!0),s.addEventListener("touchstart",m,!0),l.addEventListener("mousedown",m,!0),l.addEventListener("touchstart",m,!0),document.addEventListener("mousemove",m,!0),document.addEventListener("touchmove",m,!0),document.addEventListener("mouseup",m,!0),document.addEventListener("touchend",m,!0),document.addEventListener("touchcancel",m,!0),this._shuttleRingPointer.addEventListener("mousedown",m,!0),this._shuttleRingPointer.addEventListener("touchstart",m,!0),this._knobOuter.addEventListener("mousedown",m,!0),this._knobOuter.addEventListener("touchstart",m,!0);var f,g=this._knobTime.childNodes[0],_=this._knobDate.childNodes[0],y=this._knobStatus.childNodes[0];this._subscriptions=[subscribeAndEvaluate(t.pauseViewModel,"toggled",function(e){f!==e&&((f=e)?p._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):p._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),subscribeAndEvaluate(t,"shuttleRingAngle",function(e){setShuttleRingPointer(p._shuttleRingPointer,p._knobOuter,e)}),subscribeAndEvaluate(t,"dateLabel",function(e){_.textContent!==e&&(_.textContent=e)}),subscribeAndEvaluate(t,"timeLabel",function(e){g.textContent!==e&&(g.textContent=e)}),subscribeAndEvaluate(t,"multiplierLabel",function(e){y.textContent!==e&&(y.textContent=e)})],this.applyThemeChanges(),this.resize()}SvgButton.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);for(var e=this._subscriptions,t=0,i=e.length;t<i;t++)e[t].dispose();destroyObject(this)},SvgButton.prototype.isDestroyed=function(){return!1},SvgButton.prototype.setEnabled=function(e){if(this._enabled!==e){if(!(this._enabled=e))return void this.svgElement.setAttribute("class","cesium-animation-buttonDisabled");if(this._toggled)return void this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled");this.svgElement.setAttribute("class","cesium-animation-rectButton")}},SvgButton.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")))},SvgButton.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e},defineProperties$1(Animation.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),Animation.prototype.isDestroyed=function(){return!1},Animation.prototype.destroy=function(){defined(this._observer)&&(this._observer.disconnect(),this._observer=void 0);var e=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",e,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",e,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",e,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",e,!0),document.removeEventListener("mousemove",e,!0),document.removeEventListener("touchmove",e,!0),document.removeEventListener("mouseup",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("touchcancel",e,!0),this._shuttleRingPointer.removeEventListener("mousedown",e,!0),this._shuttleRingPointer.removeEventListener("touchstart",e,!0),this._knobOuter.removeEventListener("mousedown",e,!0),this._knobOuter.removeEventListener("touchstart",e,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();for(var t=this._subscriptions,i=0,r=t.length;i<r;i++)t[i].dispose();return destroyObject(this)},Animation.prototype.resize=function(){var e=this._container.clientWidth,t=this._container.clientHeight;if(e!==this._lastWidth||t!==this._lastHeight){var i=this._svgNode,r=e,n=t;0===e&&0===t?(r=200,n=132):0===e?r=(n=t)/132*200:0===t&&(n=(r=e)/200*132);var a=r/200,o=n/132;i.style.cssText="width: "+r+"px; height: "+n+"px; position: absolute; bottom: 0; left: 0; overflow: hidden;",i.setAttribute("width",r),i.setAttribute("height",n),i.setAttribute("viewBox","0 0 "+r+" "+n),this._topG.setAttribute("transform","scale("+a+","+o+")"),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*o),this._lastHeight=e,this._lastWidth=t}},Animation.prototype.applyThemeChanges=function(){if(!document.body.contains(this._container)){if(defined(this._observer))return;var e=this;return e._observer=new MutationObserver(function(){document.body.contains(e._container)&&(e._observer.disconnect(),e._observer=void 0,e.applyThemeChanges())}),void e._observer.observe(document,{childList:!0,subtree:!0})}var t=getElementColor(this._themeNormal),i=getElementColor(this._themeHover),r=getElementColor(this._themeSelect),n=getElementColor(this._themeDisabled),a=getElementColor(this._themeKnob),o=getElementColor(this._themePointer),s=getElementColor(this._themeSwoosh),l=getElementColor(this._themeSwooshHover),c=svgFromObject({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(t,gradientEnabledColor0)},{tagName:"stop",offset:"12%","stop-color":makeColorString(t,gradientEnabledColor1)},{tagName:"stop",offset:"46%","stop-color":makeColorString(t,gradientEnabledColor2)},{tagName:"stop",offset:"81%","stop-color":makeColorString(t,gradientEnabledColor3)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(i,gradientEnabledColor0)},{tagName:"stop",offset:"12%","stop-color":makeColorString(i,gradientEnabledColor1)},{tagName:"stop",offset:"46%","stop-color":makeColorString(i,gradientEnabledColor2)},{tagName:"stop",offset:"81%","stop-color":makeColorString(i,gradientEnabledColor3)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(r,gradientEnabledColor0)},{tagName:"stop",offset:"12%","stop-color":makeColorString(r,gradientEnabledColor1)},{tagName:"stop",offset:"46%","stop-color":makeColorString(r,gradientEnabledColor2)},{tagName:"stop",offset:"81%","stop-color":makeColorString(r,gradientEnabledColor3)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":makeColorString(n,gradientDisabledColor0)},{tagName:"stop",offset:"75%","stop-color":makeColorString(n,gradientDisabledColor1)}]},{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":s.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":s.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":s.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":o.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":o.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":makeColorString(o,gradientPointerColor)},{tagName:"stop",offset:"100%","stop-color":makeColorString(o,gradientPointerColor)}]},{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":makeColorString(a,gradientEnabledColor0)},{tagName:"stop",offset:"60%","stop-color":makeColorString(a,gradientKnobColor)},{tagName:"stop",offset:"85%","stop-color":makeColorString(a,gradientEnabledColor1)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":makeColorString(a,gradientKnobColor)},{tagName:"stop",offset:"60%","stop-color":makeColorString(a,gradientEnabledColor0)},{tagName:"stop",offset:"85%","stop-color":makeColorString(a,gradientEnabledColor3)}]},{id:"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"},{id:"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"},{id:"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"},{id:"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"},{id:"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"},{id:"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"},{id:"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"},{id:"animation_pathPointer",tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},{id:"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"}]});defined(this._defsElement)?this._svgNode.replaceChild(c,this._defsElement):this._svgNode.appendChild(c),this._defsElement=c};var realtimeShuttleRingAngle=15,maxShuttleRingAngle=105;function numberComparator(e,t){return e-t}function getTypicalMultiplierIndex(e,t){var i=binarySearch(t,e,numberComparator);return i<0?~i:i}function angleToMultiplier(e,t){if(Math.abs(e)<=realtimeShuttleRingAngle)return e/realtimeShuttleRingAngle;var i,r=realtimeShuttleRingAngle,n=maxShuttleRingAngle;return 0<e?(i=(Math.log(t[t.length-1])-0)/(n-r),Math.exp(0+i*(e-r))):(i=(Math.log(-t[0])-0)/(n-r),-Math.exp(0+i*(Math.abs(e)-r)))}function multiplierToAngle(e,t,i){if(i.clockStep===ClockStep$1.SYSTEM_CLOCK)return realtimeShuttleRingAngle;if(Math.abs(e)<=1)return e*realtimeShuttleRingAngle;var r=t[t.length-1];r<e?e=r:e<-r&&(e=-r);var n,a=realtimeShuttleRingAngle,o=maxShuttleRingAngle;return 0<e?(n=(Math.log(r)-0)/(o-a),(Math.log(e)-0)/n+a):(n=(Math.log(-t[0])-0)/(o-a),-((Math.log(Math.abs(e))-0)/n+a))}function AnimationViewModel(e){var s=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=AnimationViewModel.defaultDateFormatter,this._timeFormatter=AnimationViewModel.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,knockout.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(AnimationViewModel.defaultTicks),this.timeLabel=void 0,knockout.defineProperty(this,"timeLabel",function(){return s._timeFormatter(s._clockViewModel.currentTime,s)}),this.dateLabel=void 0,knockout.defineProperty(this,"dateLabel",function(){return s._dateFormatter(s._clockViewModel.currentTime,s)}),this.multiplierLabel=void 0,knockout.defineProperty(this,"multiplierLabel",function(){var e=s._clockViewModel;if(e.clockStep===ClockStep$1.SYSTEM_CLOCK)return"今天";var t=e.multiplier;return t%1==0?t.toFixed(0)+"x":t.toFixed(3).replace(/0{0,3}$/,"")+"x"}),this.shuttleRingAngle=void 0,knockout.defineProperty(this,"shuttleRingAngle",{get:function(){return multiplierToAngle(e.multiplier,s._allShuttleRingTicks,e)},set:function(e){e=Math.max(Math.min(e,maxShuttleRingAngle),-maxShuttleRingAngle);var t=s._allShuttleRingTicks,i=s._clockViewModel;if(i.clockStep=ClockStep$1.SYSTEM_CLOCK_MULTIPLIER,Math.abs(e)!==maxShuttleRingAngle){var r=angleToMultiplier(e,t);if(s.snapToTicks)r=t[getTypicalMultiplierIndex(r,t)];else if(0!==r){var n=Math.abs(r);if(100<n){var a=n.toFixed(0).length-2,o=Math.pow(10,a);r=Math.round(r/o)*o|0}else realtimeShuttleRingAngle<n?r=Math.round(r):1<n?r=+r.toFixed(1):0<n&&(r=+r.toFixed(2))}i.multiplier=r}else i.multiplier=0<e?t[t.length-1]:t[0]}}),this._canAnimate=void 0,knockout.defineProperty(this,"_canAnimate",function(){var e=s._clockViewModel,t=e.clockRange;if(s.shuttleRingDragging||t===ClockRange$1.UNBOUNDED)return!0;var i=e.multiplier,r=e.currentTime,n=e.startTime,a=!1;if(t===ClockRange$1.LOOP_STOP)a=JulianDate.greaterThan(r,n)||r.equals(n)&&0<i;else{var o=e.stopTime;a=JulianDate.greaterThan(r,n)&&JulianDate.lessThan(r,o)||r.equals(n)&&0<i||r.equals(o)&&i<0}return a||(e.shouldAnimate=!1),a}),this._isSystemTimeAvailable=void 0,knockout.defineProperty(this,"_isSystemTimeAvailable",function(){var e=s._clockViewModel;if(e.clockRange===ClockRange$1.UNBOUNDED)return!0;var t=e.systemTime;return JulianDate.greaterThanOrEquals(t,e.startTime)&&JulianDate.lessThanOrEquals(t,e.stopTime)}),this._isAnimating=void 0,knockout.defineProperty(this,"_isAnimating",function(){return s._clockViewModel.shouldAnimate&&(s._canAnimate||s.shuttleRingDragging)});var t=createCommand$2(function(){var e=s._clockViewModel;e.shouldAnimate?e.shouldAnimate=!1:s._canAnimate&&(e.shouldAnimate=!0)});this._pauseViewModel=new ToggleButtonViewModel(t,{toggled:knockout.computed(function(){return!s._isAnimating}),tooltip:"暂停"});var i=createCommand$2(function(){var e=s._clockViewModel,t=e.multiplier;0<t&&(e.multiplier=-t),e.shouldAnimate=!0});this._playReverseViewModel=new ToggleButtonViewModel(i,{toggled:knockout.computed(function(){return s._isAnimating&&e.multiplier<0}),tooltip:"后退"});var r=createCommand$2(function(){var e=s._clockViewModel,t=e.multiplier;t<0&&(e.multiplier=-t),e.shouldAnimate=!0});this._playForwardViewModel=new ToggleButtonViewModel(r,{toggled:knockout.computed(function(){return s._isAnimating&&0<e.multiplier&&e.clockStep!==ClockStep$1.SYSTEM_CLOCK}),tooltip:"前进"});var n=createCommand$2(function(){s._clockViewModel.clockStep=ClockStep$1.SYSTEM_CLOCK},knockout.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new ToggleButtonViewModel(n,{toggled:knockout.computed(function(){return e.clockStep===ClockStep$1.SYSTEM_CLOCK}),tooltip:knockout.computed(function(){return s._isSystemTimeAvailable?"今天 (实时)":"当前时间不在范围内"})}),this._slower=createCommand$2(function(){var e=s._clockViewModel,t=s._allShuttleRingTicks,i=getTypicalMultiplierIndex(e.multiplier,t)-1;0<=i&&(e.multiplier=t[i])}),this._faster=createCommand$2(function(){var e=s._clockViewModel,t=s._allShuttleRingTicks,i=getTypicalMultiplierIndex(e.multiplier,t)+1;i<t.length&&(e.multiplier=t[i])})}function BaseLayerPickerViewModel(e){var t=(e=defaultValue(e,defaultValue.EMPTY_OBJECT)).globe,i=defaultValue(e.imageryProviderViewModels,[]),r=defaultValue(e.terrainProviderViewModels,[]);this._globe=t,this.imageryProviderViewModels=i.slice(0),this.terrainProviderViewModels=r.slice(0),this.dropDownVisible=!1,knockout.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);var l=knockout.getObservable(this,"imageryProviderViewModels"),n=knockout.pureComputed(function(){var e,t=l(),i={};for(e=0;e<t.length;e++){var r=t[e],n=r.category;defined(i[n])?i[n].push(r):i[n]=[r]}var a=Object.keys(i),o=[];for(e=0;e<a.length;e++){var s=a[e];o.push({name:s,providers:i[s]})}return o});this._imageryProviders=n;var c=knockout.getObservable(this,"terrainProviderViewModels"),a=knockout.pureComputed(function(){var e,t=c(),i={};for(e=0;e<t.length;e++){var r=t[e],n=r.category;defined(i[n])?i[n].push(r):i[n]=[r]}var a=Object.keys(i),o=[];for(e=0;e<a.length;e++){var s=a[e];o.push({name:s,providers:i[s]})}return o});this._terrainProviders=a,this.buttonTooltip=void 0,knockout.defineProperty(this,"buttonTooltip",function(){var e=this.selectedImagery,t=this.selectedTerrain,i=defined(e)?e.name:void 0,r=defined(t)?t.name:void 0;return defined(i)&&defined(r)?i+"\n"+r:defined(i)?i:r}),this.buttonImageUrl=void 0,knockout.defineProperty(this,"buttonImageUrl",function(){var e=this.selectedImagery;if(defined(e))return e.iconUrl}),this.selectedImagery=void 0;var d=knockout.observable();this._currentImageryProviders=[],knockout.defineProperty(this,"selectedImagery",{get:function(){return d()},set:function(e){if(d()!==e){var t,i=this._currentImageryProviders,r=i.length,n=this._globe.imageryLayers,a=!1;for(t=0;t<r;t++)for(var o=n.length,s=0;s<o;s++){var l=n.get(s);if(l.imageryProvider===i[t]){n.remove(l),a=!0;break}}if(defined(e)){var c=e.creationCommand();if(isArray$1(c)){for(t=c.length-1;0<=t;t--)n.addImageryProvider(c[t],0);this._currentImageryProviders=c.slice(0)}else if(this._currentImageryProviders=[c],a)n.addImageryProvider(c,0);else{var u=n.get(0);defined(u)&&n.remove(u),n.addImageryProvider(c,0)}}d(e),this.dropDownVisible=!1}else this.dropDownVisible=!1}}),this.selectedTerrain=void 0;var o=knockout.observable();knockout.defineProperty(this,"selectedTerrain",{get:function(){return o()},set:function(e){var t;o()!==e?(defined(e)&&(t=e.creationCommand()),this._globe.depthTestAgainstTerrain=!(t instanceof EllipsoidTerrainProvider),this._globe.terrainProvider=t,o(e),this.dropDownVisible=!1):this.dropDownVisible=!1}});var s=this;this._toggleDropDown=createCommand$2(function(){s.dropDownVisible=!s.dropDownVisible}),this.selectedImagery=defaultValue(e.selectedImageryProviderViewModel,i[0]),this.selectedTerrain=defaultValue(e.selectedTerrainProviderViewModel,r[0])}function BaseLayerPicker(e,t){e=getElement(e);var i=new BaseLayerPickerViewModel(t),r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(r);var n=document.createElement("img");n.setAttribute("draggable","false"),n.className="cesium-baseLayerPicker-selected",n.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),r.appendChild(n);var a=document.createElement("div");a.className="cesium-baseLayerPicker-dropDown",a.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(a);var o=document.createElement("div");o.className="cesium-baseLayerPicker-sectionTitle",o.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),o.innerHTML="地图",a.appendChild(o);var s=document.createElement("div");s.className="cesium-baseLayerPicker-section",s.setAttribute("data-bind","foreach: _imageryProviders"),a.appendChild(s);var l=document.createElement("div");l.className="cesium-baseLayerPicker-category",s.appendChild(l);var c=document.createElement("div");c.className="cesium-baseLayerPicker-categoryTitle",c.setAttribute("data-bind","text: name"),l.appendChild(c);var u=document.createElement("div");u.className="cesium-baseLayerPicker-choices",u.setAttribute("data-bind","foreach: providers"),l.appendChild(u);var d=document.createElement("div");d.className="cesium-baseLayerPicker-item",d.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),u.appendChild(d);var h=document.createElement("img");h.className="cesium-baseLayerPicker-itemIcon",h.setAttribute("data-bind","attr: { src: iconUrl }"),h.setAttribute("draggable","false"),d.appendChild(h);var p=document.createElement("div");p.className="cesium-baseLayerPicker-itemLabel",p.setAttribute("data-bind","text: name"),d.appendChild(p);var m=document.createElement("div");m.className="cesium-baseLayerPicker-sectionTitle",m.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),m.innerHTML="地形",a.appendChild(m);var f=document.createElement("div");f.className="cesium-baseLayerPicker-section",f.setAttribute("data-bind","foreach: _terrainProviders"),a.appendChild(f);var g=document.createElement("div");g.className="cesium-baseLayerPicker-category",f.appendChild(g);var _=document.createElement("div");_.className="cesium-baseLayerPicker-categoryTitle",_.setAttribute("data-bind","text: name"),g.appendChild(_);var y=document.createElement("div");y.className="cesium-baseLayerPicker-choices",y.setAttribute("data-bind","foreach: providers"),g.appendChild(y);var v=document.createElement("div");v.className="cesium-baseLayerPicker-item",v.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),y.appendChild(v);var C=document.createElement("img");C.className="cesium-baseLayerPicker-itemIcon",C.setAttribute("data-bind","attr: { src: iconUrl }"),C.setAttribute("draggable","false"),v.appendChild(C);var S=document.createElement("div");S.className="cesium-baseLayerPicker-itemLabel",S.setAttribute("data-bind","text: name"),v.appendChild(S),knockout.applyBindings(i,r),knockout.applyBindings(i,a),this._viewModel=i,this._container=e,this._element=r,this._dropPanel=a,this._closeDropDown=function(e){r.contains(e.target)||a.contains(e.target)||(i.dropDownVisible=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}function ProviderViewModel(e){var t=e.creationFunction;defined(t.canExecute)||(t=createCommand$2(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=defaultValue(e.category,""),knockout.track(this,["name","tooltip","iconUrl"])}function createDefaultImageryProviderViewModels(){var e=[];return e.push(new ProviderViewModel({name:"谷歌卫星",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"谷歌卫星地图",category:"标准坐标系",creationFunction:function(){return[new UrlTemplateImageryProvider({url:"http://www.google.cn/maps/vt?lyrs=s&x={x}&y={y}&z={z}"})]}})),e.push(new ProviderViewModel({name:"Bing卫星",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"微软提供的高清卫星地图",category:"标准坐标系",creationFunction:function(){return new BingMapsImageryProvider({url:"https://dev.virtualearth.net",key:"AtkX3zhnRe5fyGuLU30uZw8r3sxdBDnpQly7KfFTCB2rGlDgXBG3yr-qEiQEicEc",mapStyle:"Aerial"})}})),e.push(new ProviderViewModel({name:"ESRI卫星",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/esriWorldImagery.png"),tooltip:"ESRI提供的高清卫星地图",category:"标准坐标系",creationFunction:function(){return new ArcGisMapServerImageryProvider({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new ProviderViewModel({name:"天地图卫星",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"国家测绘局提供的天地图卫星",category:"标准坐标系",creationFunction:function(){for(var e=new Array(18),t=0;t<=18;t++)e[t]=t.toString();return new WebMapTileServiceImageryProvider({url:"//t0.tianditu.gov.cn/img_w/wmts?service=WMTS&version=1.0.0&request=GetTile&tilematrix={TileMatrix}&layer=img&style={style}&tilerow={TileRow}&tilecol={TileCol}&tilematrixset={TileMatrixSet}&format=tiles&tk=87949882c75775b5069a0076357b7530",layer:"img",style:"default",format:"tiles",tileMatrixSetID:"w",subdomains:["0","1","2","3","4","5","6","7"],tileMatrixLabels:e,maximumLevel:18})}})),e.push(new ProviderViewModel({name:"单张图片",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:"本地单张图片离线数据",category:"标准坐标系",creationFunction:function(){return new TileMapServiceImageryProvider({url:buildModuleUrl("Assets/Textures/NaturalEarthII")})}})),e.push(new ProviderViewModel({name:"谷歌卫星",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/mapboxSatellite.png"),tooltip:"谷歌卫星地图",category:"国测局偏移坐标系",creationFunction:function(){return[new UrlTemplateImageryProvider({url:"http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&gl=CN&x={x}&y={y}&z={z}&s=Gali",subdomains:["1","2","3"]}),new UrlTemplateImageryProvider({url:"http://mt{s}.google.cn/vt/imgtp=png32&lyrs=h@207000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galil",subdomains:["1","2","3"]})]}})),e.push(new ProviderViewModel({name:"高德卫星",iconUrl:buildModuleUrl("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"高德卫星地图",category:"国测局偏移坐标系",creationFunction:function(){return[new UrlTemplateImageryProvider({url:"http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",subdomains:["1","2","3","4"]}),new UrlTemplateImageryProvider({url:"http://webst0{s}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8",subdomains:["1","2","3","4"]})]}})),e}function createDefaultTerrainProviderViewModels(){var e=[];return e.push(new ProviderViewModel({name:"无地形",iconUrl:buildModuleUrl("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84标准椭球,即 EPSG:4326",category:"",creationFunction:function(){return new EllipsoidTerrainProvider}})),e.push(new ProviderViewModel({name:"全球地形",iconUrl:buildModuleUrl("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"由 Cesium官方 提供的高分辨率全球地形",category:"",creationFunction:function(){return createWorldTerrain({requestWaterMask:!0,requestVertexNormals:!0})}})),e}function getPickTileset(i){return function(e){var t=i._scene.pick(e.position);defined(t)&&t.primitive instanceof Cesium3DTileset&&(i.tileset=t.primitive),i.pickActive=!1}}function selectTilesetOnHover(i,e){e?i._eventHandler.setInputAction(function(e){var t=i._scene.pick(e.endPosition);defined(t)&&t.primitive instanceof Cesium3DTileset&&(i.tileset=t.primitive)},ScreenSpaceEventType$1.MOUSE_MOVE):(i._eventHandler.removeInputAction(ScreenSpaceEventType$1.MOUSE_MOVE),i.picking=i.picking)}AnimationViewModel.defaultDateFormatter=function(e,t){var i=JulianDate.toDate(e);return i.getFullYear()+"年"+(i.getMonth()+1)+"月"+i.getDate()+"日"},AnimationViewModel.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],AnimationViewModel.defaultTimeFormatter=function(e,t){var i=JulianDate.toDate(e);return sprintf("%02d:%02d:%02d",i.getHours(),i.getMinutes(),i.getSeconds())},AnimationViewModel.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)},AnimationViewModel.prototype.setShuttleRingTicks=function(e){var t,i,r,n={},a=this._sortedFilteredPositiveTicks;for(t=a.length=0,i=e.length;t<i;++t)r=e[t],n.hasOwnProperty(r)||(n[r]=!0,a.push(r));a.sort(numberComparator);var o=[];for(t=(i=a.length)-1;0<=t;--t)0!==(r=a[t])&&o.push(-r);Array.prototype.push.apply(o,a),this._allShuttleRingTicks=o},defineProperties$1(AnimationViewModel.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){this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){this._timeFormatter=e}}}),AnimationViewModel._maxShuttleRingAngle=maxShuttleRingAngle,AnimationViewModel._realtimeShuttleRingAngle=realtimeShuttleRingAngle,defineProperties$1(BaseLayerPickerViewModel.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}}),defineProperties$1(BaseLayerPicker.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),BaseLayerPicker.prototype.isDestroyed=function(){return!1},BaseLayerPicker.prototype.destroy=function(){return FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),knockout.cleanNode(this._element),knockout.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),destroyObject(this)},defineProperties$1(ProviderViewModel.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});var stringOptions$1={maximumFractionDigits:3};function formatMemoryString$1(e){var t=e/1048576;return t<1?t.toLocaleString(void 0,stringOptions$1):Math.round(t).toLocaleString()}function getStatistics(e,t){if(!defined(e))return"";var i=t?e._statisticsPerPass[Cesium3DTilePass$1.PICK]:e._statisticsPerPass[Cesium3DTilePass$1.RENDER],r='<ul class="cesium-cesiumInspector-statistics">';return r+="<li><strong>Visited: </strong>"+i.visited.toLocaleString()+"</li><li><strong>Selected: </strong>"+i.selected.toLocaleString()+"</li><li><strong>Commands: </strong>"+i.numberOfCommands.toLocaleString()+"</li>",r+="</ul>",t||(r+='<ul class="cesium-cesiumInspector-statistics">',r+="<li><strong>Requests: </strong>"+i.numberOfPendingRequests.toLocaleString()+"</li><li><strong>Attempted: </strong>"+i.numberOfAttemptedRequests.toLocaleString()+"</li><li><strong>Processing: </strong>"+i.numberOfTilesProcessing.toLocaleString()+"</li><li><strong>Content Ready: </strong>"+i.numberOfTilesWithContentReady.toLocaleString()+"</li><li><strong>Total: </strong>"+i.numberOfTilesTotal.toLocaleString()+"</li>",r+="</ul>",r+='<ul class="cesium-cesiumInspector-statistics">',r+="<li><strong>Features Selected: </strong>"+i.numberOfFeaturesSelected.toLocaleString()+"</li><li><strong>Features Loaded: </strong>"+i.numberOfFeaturesLoaded.toLocaleString()+"</li><li><strong>Points Selected: </strong>"+i.numberOfPointsSelected.toLocaleString()+"</li><li><strong>Points Loaded: </strong>"+i.numberOfPointsLoaded.toLocaleString()+"</li><li><strong>Triangles Selected: </strong>"+i.numberOfTrianglesSelected.toLocaleString()+"</li>",r+="</ul>",r+='<ul class="cesium-cesiumInspector-statistics">',r+="<li><strong>Tiles styled: </strong>"+i.numberOfTilesStyled.toLocaleString()+"</li><li><strong>Features styled: </strong>"+i.numberOfFeaturesStyled.toLocaleString()+"</li>",r+="</ul>",r+='<ul class="cesium-cesiumInspector-statistics">',r+="<li><strong>Children Union Culled: </strong>"+i.numberOfTilesCulledWithChildrenUnion.toLocaleString()+"</li>",r+="</ul>",r+='<ul class="cesium-cesiumInspector-statistics">',r+="<li><strong>Geometry Memory (MB): </strong>"+formatMemoryString$1(i.geometryByteLength)+"</li><li><strong>Texture Memory (MB): </strong>"+formatMemoryString$1(i.texturesByteLength)+"</li><li><strong>Batch Table Memory (MB): </strong>"+formatMemoryString$1(i.batchTableByteLength)+"</li>",r+="</ul>"),r}var colorBlendModes=[{text:"Highlight",value:Cesium3DTileColorBlendMode$1.HIGHLIGHT},{text:"Replace",value:Cesium3DTileColorBlendMode$1.REPLACE},{text:"Mix",value:Cesium3DTileColorBlendMode$1.MIX}],highlightColor$1=new Color(1,1,0,.4),scratchColor$l=new Color,oldColor=new Color;function Cesium3DTilesInspectorViewModel(r,e){var n=this,t=r.canvas;this._eventHandler=new ScreenSpaceEventHandler(t),this._scene=r,this._performanceContainer=e,this._canvas=t,this._performanceDisplay=new PerformanceDisplay({container:e}),this._statisticsText="",this._pickStatisticsText="",this._editorError="",this.performance=!1,this.showStatistics=!0,this.showPickStatistics=!0,this.inspectorVisible=!0,this.tilesetVisible=!1,this.displayVisible=!1,this.updateVisible=!1,this.loggingVisible=!1,this.styleVisible=!1,this.tileDebugLabelsVisible=!1,this.optimizationVisible=!1,this.styleString="{}",this._tileset=void 0,this._feature=void 0,this._tile=void 0,knockout.track(this,["performance","inspectorVisible","_statisticsText","_pickStatisticsText","_editorError","showPickStatistics","showStatistics","tilesetVisible","displayVisible","updateVisible","loggingVisible","styleVisible","optimizationVisible","tileDebugLabelsVisible","styleString","_feature","_tile"]),this._properties=knockout.observable({}),this.properties=[],knockout.defineProperty(this,"properties",function(){var e=[],t=n._properties();for(var i in t)t.hasOwnProperty(i)&&e.push(i);return e});var i=knockout.observable();knockout.defineProperty(this,"dynamicScreenSpaceError",{get:function(){return i()},set:function(e){i(e),defined(n._tileset)&&(n._tileset.dynamicScreenSpaceError=e)}}),this.dynamicScreenSpaceError=!1;var a=knockout.observable();knockout.defineProperty(this,"colorBlendMode",{get:function(){return a()},set:function(e){a(e),defined(n._tileset)&&(n._tileset.colorBlendMode=e,n._scene.requestRender())}}),this.colorBlendMode=Cesium3DTileColorBlendMode$1.HIGHLIGHT;var o=knockout.observable();knockout.defineProperty(this,"picking",{get:function(){return o()},set:function(e){o(e),e?n._eventHandler.setInputAction(function(e){var t=r.pick(e.endPosition);if(t instanceof Cesium3DTileFeature?(n.feature=t,n.tile=t.content.tile):defined(t)&&defined(t.content)?(n.feature=void 0,n.tile=t.content.tile):(n.feature=void 0,n.tile=void 0),defined(n._tileset)){var i;if(p&&defined(t)&&defined(t.content))r.pickPositionSupported&&defined(i=r.pickPosition(e.endPosition))&&(n._tileset.debugPickPosition=i),n._tileset.debugPickedTile=t.content.tile;else n._tileset.debugPickedTile=void 0;n._scene.requestRender()}},ScreenSpaceEventType$1.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction(ScreenSpaceEventType$1.MOUSE_MOVE))}}),this.picking=!0;var s=knockout.observable();knockout.defineProperty(this,"colorize",{get:function(){return s()},set:function(e){s(e),defined(n._tileset)&&(n._tileset.debugColorizeTiles=e,n._scene.requestRender())}}),this.colorize=!1;var l=knockout.observable();knockout.defineProperty(this,"wireframe",{get:function(){return l()},set:function(e){l(e),defined(n._tileset)&&(n._tileset.debugWireframe=e,n._scene.requestRender())}}),this.wireframe=!1;var c=knockout.observable();knockout.defineProperty(this,"showBoundingVolumes",{get:function(){return c()},set:function(e){c(e),defined(n._tileset)&&(n._tileset.debugShowBoundingVolume=e,n._scene.requestRender())}}),this.showBoundingVolumes=!1;var u=knockout.observable();knockout.defineProperty(this,"showContentBoundingVolumes",{get:function(){return u()},set:function(e){u(e),defined(n._tileset)&&(n._tileset.debugShowContentBoundingVolume=e,n._scene.requestRender())}}),this.showContentBoundingVolumes=!1;var d=knockout.observable();knockout.defineProperty(this,"showRequestVolumes",{get:function(){return d()},set:function(e){d(e),defined(n._tileset)&&(n._tileset.debugShowViewerRequestVolume=e,n._scene.requestRender())}}),this.showRequestVolumes=!1;var h=knockout.observable();knockout.defineProperty(this,"freezeFrame",{get:function(){return h()},set:function(e){h(e),defined(n._tileset)&&(n._tileset.debugFreezeFrame=e,n._scene.debugShowFrustumPlanes=e,n._scene.requestRender())}}),this.freezeFrame=!1;var p=knockout.observable();knockout.defineProperty(this,"showOnlyPickedTileDebugLabel",{get:function(){return p()},set:function(e){p(e),defined(n._tileset)&&(n._tileset.debugPickedTileLabelOnly=e,n._scene.requestRender())}}),this.showOnlyPickedTileDebugLabel=!1;var m=knockout.observable();knockout.defineProperty(this,"showGeometricError",{get:function(){return m()},set:function(e){m(e),defined(n._tileset)&&(n._tileset.debugShowGeometricError=e,n._scene.requestRender())}}),this.showGeometricError=!1;var f=knockout.observable();knockout.defineProperty(this,"showRenderingStatistics",{get:function(){return f()},set:function(e){f(e),defined(n._tileset)&&(n._tileset.debugShowRenderingStatistics=e,n._scene.requestRender())}}),this.showRenderingStatistics=!1;var g=knockout.observable();knockout.defineProperty(this,"showMemoryUsage",{get:function(){return g()},set:function(e){g(e),defined(n._tileset)&&(n._tileset.debugShowMemoryUsage=e,n._scene.requestRender())}}),this.showMemoryUsage=!1;var _=knockout.observable();knockout.defineProperty(this,"showUrl",{get:function(){return _()},set:function(e){_(e),defined(n._tileset)&&(n._tileset.debugShowUrl=e,n._scene.requestRender())}}),this.showUrl=!1;var y=knockout.observable();knockout.defineProperty(this,"maximumScreenSpaceError",{get:function(){return y()},set:function(e){e=Number(e),isNaN(e)||(y(e),defined(n._tileset)&&(n._tileset.maximumScreenSpaceError=e))}}),this.maximumScreenSpaceError=16;var v=knockout.observable();knockout.defineProperty(this,"dynamicScreenSpaceErrorDensity",{get:function(){return v()},set:function(e){e=Number(e),isNaN(e)||(v(e),defined(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorDensity=e))}}),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorDensitySliderValue=void 0,knockout.defineProperty(this,"dynamicScreenSpaceErrorDensitySliderValue",{get:function(){return Math.pow(v(),1/6)},set:function(e){v(Math.pow(e,6))}});var C=knockout.observable();knockout.defineProperty(this,"dynamicScreenSpaceErrorFactor",{get:function(){return C()},set:function(e){e=Number(e),isNaN(e)||(C(e),defined(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorFactor=e))}}),this.dynamicScreenSpaceErrorFactor=4;var S=getPickTileset(this),x=knockout.observable();knockout.defineProperty(this,"pickActive",{get:function(){return x()},set:function(e){x(e),e?n._eventHandler.setInputAction(S,ScreenSpaceEventType$1.LEFT_CLICK):n._eventHandler.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK)}});var T=knockout.observable();knockout.defineProperty(this,"pointCloudShading",{get:function(){return T()},set:function(e){T(e),defined(n._tileset)&&(n._tileset.pointCloudShading.attenuation=e)}}),this.pointCloudShading=!1;var b=knockout.observable();knockout.defineProperty(this,"geometricErrorScale",{get:function(){return b()},set:function(e){e=Number(e),isNaN(e)||(b(e),defined(n._tileset)&&(n._tileset.pointCloudShading.geometricErrorScale=e))}}),this.geometricErrorScale=1;var E=knockout.observable();knockout.defineProperty(this,"maximumAttenuation",{get:function(){return E()},set:function(e){e=Number(e),isNaN(e)||(E(e),defined(n._tileset)&&(n._tileset.pointCloudShading.maximumAttenuation=0===e?void 0:e))}}),this.maximumAttenuation=0;var P=knockout.observable();knockout.defineProperty(this,"baseResolution",{get:function(){return P()},set:function(e){e=Number(e),isNaN(e)||(P(e),defined(n._tileset)&&(n._tileset.pointCloudShading.baseResolution=0===e?void 0:e))}}),this.baseResolution=0;var A=knockout.observable();knockout.defineProperty(this,"eyeDomeLighting",{get:function(){return A()},set:function(e){A(e),defined(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLighting=e)}}),this.eyeDomeLighting=!1;var w=knockout.observable();knockout.defineProperty(this,"eyeDomeLightingStrength",{get:function(){return w()},set:function(e){e=Number(e),isNaN(e)||(w(e),defined(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingStrength=e))}}),this.eyeDomeLightingStrength=1;var D=knockout.observable();knockout.defineProperty(this,"eyeDomeLightingRadius",{get:function(){return D()},set:function(e){e=Number(e),isNaN(e)||(D(e),defined(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingRadius=e))}}),this.eyeDomeLightingRadius=1,this.pickActive=!1;var M=knockout.observable();knockout.defineProperty(this,"skipLevelOfDetail",{get:function(){return M()},set:function(e){M(e),defined(n._tileset)&&(n._tileset.skipLevelOfDetail=e)}}),this.skipLevelOfDetail=!0;var I=knockout.observable();knockout.defineProperty(this,"skipScreenSpaceErrorFactor",{get:function(){return I()},set:function(e){e=Number(e),isNaN(e)||(I(e),defined(n._tileset)&&(n._tileset.skipScreenSpaceErrorFactor=e))}}),this.skipScreenSpaceErrorFactor=16;var R=knockout.observable();knockout.defineProperty(this,"baseScreenSpaceError",{get:function(){return R()},set:function(e){e=Number(e),isNaN(e)||(R(e),defined(n._tileset)&&(n._tileset.baseScreenSpaceError=e))}}),this.baseScreenSpaceError=1024;var O=knockout.observable();knockout.defineProperty(this,"skipLevels",{get:function(){return O()},set:function(e){e=Number(e),isNaN(e)||(O(e),defined(n._tileset)&&(n._tileset.skipLevels=e))}}),this.skipLevels=1;var L=knockout.observable();knockout.defineProperty(this,"immediatelyLoadDesiredLevelOfDetail",{get:function(){return L()},set:function(e){L(e),defined(n._tileset)&&(n._tileset.immediatelyLoadDesiredLevelOfDetail=e)}}),this.immediatelyLoadDesiredLevelOfDetail=!1;var F=knockout.observable();knockout.defineProperty(this,"loadSiblings",{get:function(){return F()},set:function(e){F(e),defined(n._tileset)&&(n._tileset.loadSiblings=e)}}),this.loadSiblings=!1,this._style=void 0,this._shouldStyle=!1,this._definedProperties=["properties","dynamicScreenSpaceError","colorBlendMode","picking","colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","maximumScreenSpaceError","dynamicScreenSpaceErrorDensity","baseScreenSpaceError","skipScreenSpaceErrorFactor","skipLevelOfDetail","skipLevels","immediatelyLoadDesiredLevelOfDetail","loadSiblings","dynamicScreenSpaceErrorDensitySliderValue","dynamicScreenSpaceErrorFactor","pickActive","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl","pointCloudShading","geometricErrorScale","maximumAttenuation","baseResolution","eyeDomeLighting","eyeDomeLightingStrength","eyeDomeLightingRadius"],this._removePostRenderEvent=r.postRender.addEventListener(function(){n._update()}),defined(this._tileset)||selectTilesetOnHover(this,!0)}function hasFeatures(e){if(0<e.featuresLength)return!0;var t=e.innerContents;if(defined(t)){for(var i=t.length,r=0;r<i;++r)if(!hasFeatures(t[r]))return!1;return!0}return!1}function Cesium3DTilesInspector(e,t){e=getElement(e);var i=document.createElement("div"),r=document.createElement("div");r.setAttribute("data-bind","visible: performance");var n=new Cesium3DTilesInspectorViewModel(t,r);this._viewModel=n,this._container=e,this._element=i;var a=document.createElement("div");a.textContent="3D Tiles Inspector",a.className="cesium-cesiumInspector-button",a.setAttribute("data-bind","click: toggleInspector"),i.appendChild(a),i.className="cesium-cesiumInspector cesium-3DTilesInspector",i.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'),e.appendChild(i);var o=document.createElement("div");(this._panel=o).className="cesium-cesiumInspector-dropDown",i.appendChild(o);var s=InspectorShared.createSection,l=InspectorShared.createCheckbox,c=s(o,"Tileset","tilesetVisible","toggleTileset"),u=s(o,"Display","displayVisible","toggleDisplay"),d=s(o,"Update","updateVisible","toggleUpdate"),h=s(o,"Logging","loggingVisible","toggleLogging"),p=s(o,"Tile Debug Labels","tileDebugLabelsVisible","toggleTileDebugLabels"),m=s(o,"Style","styleVisible","toggleStyle"),f=s(o,"Optimization","optimizationVisible","toggleOptimization"),g=document.createElement("div");g.className="field-group";var _=document.createElement("label");_.className="field-label",_.appendChild(document.createTextNode("Properties: "));var y=document.createElement("div");y.setAttribute("data-bind","text: properties"),g.appendChild(_),g.appendChild(y),c.appendChild(g),c.appendChild(makeButton("togglePickTileset","Pick Tileset","pickActive")),c.appendChild(makeButton("trimTilesCache","Trim Tiles Cache")),c.appendChild(l("Enable Picking","picking")),u.appendChild(l("Colorize","colorize")),u.appendChild(l("Wireframe","wireframe")),u.appendChild(l("Bounding Volumes","showBoundingVolumes")),u.appendChild(l("Content Volumes","showContentBoundingVolumes")),u.appendChild(l("Request Volumes","showRequestVolumes")),u.appendChild(l("Point Cloud Shading","pointCloudShading"));var v=document.createElement("div");v.setAttribute("data-bind","visible: pointCloudShading"),v.appendChild(makeRangeInput("geometricErrorScale",0,2,.01,"Geometric Error Scale")),v.appendChild(makeRangeInput("maximumAttenuation",0,32,1,"Maximum Attenuation")),v.appendChild(makeRangeInput("baseResolution",0,1,.01,"Base Resolution")),v.appendChild(l("Eye Dome Lighting (EDL)","eyeDomeLighting")),u.appendChild(v);var C=document.createElement("div");C.setAttribute("data-bind","visible: eyeDomeLighting"),C.appendChild(makeRangeInput("eyeDomeLightingStrength",0,2,.1,"EDL Strength")),C.appendChild(makeRangeInput("eyeDomeLightingRadius",0,4,.1,"EDL Radius")),v.appendChild(C),d.appendChild(l("Freeze Frame","freezeFrame")),d.appendChild(l("Dynamic Screen Space Error","dynamicScreenSpaceError"));var S=document.createElement("div");S.appendChild(makeRangeInput("maximumScreenSpaceError",0,128,1,"Maximum Screen Space Error")),d.appendChild(S);var x=document.createElement("div");x.setAttribute("data-bind","visible: dynamicScreenSpaceError"),x.appendChild(makeRangeInput("dynamicScreenSpaceErrorDensitySliderValue",0,1,.005,"Screen Space Error Density","dynamicScreenSpaceErrorDensity")),x.appendChild(makeRangeInput("dynamicScreenSpaceErrorFactor",1,10,.1,"Screen Space Error Factor")),d.appendChild(x),h.appendChild(l("Performance","performance")),h.appendChild(r),h.appendChild(l("Statistics","showStatistics"));var T=document.createElement("div");T.className="cesium-3dTilesInspector-statistics",T.setAttribute("data-bind","html: statisticsText, visible: showStatistics"),h.appendChild(T),h.appendChild(l("Pick Statistics","showPickStatistics"));var b=document.createElement("div");b.className="cesium-3dTilesInspector-statistics",b.setAttribute("data-bind","html: pickStatisticsText, visible: showPickStatistics"),h.appendChild(b);var E=document.createElement("div");m.appendChild(E),E.appendChild(document.createTextNode("Color Blend Mode: "));var P=document.createElement("select");P.setAttribute("data-bind",'options: colorBlendModes, optionsText: "text", optionsValue: "value", value: colorBlendMode'),E.appendChild(P);var A=document.createElement("textarea");A.setAttribute("data-bind","textInput: styleString, event: { keydown: styleEditorKeyPress }"),E.className="cesium-cesiumInspector-styleEditor",E.appendChild(A);var w=makeButton("compileStyle","Compile (Ctrl+Enter)");E.appendChild(w);var D=document.createElement("div");D.className="cesium-cesiumInspector-error",D.setAttribute("data-bind","text: editorError"),E.appendChild(D),p.appendChild(l("Show Picked Only","showOnlyPickedTileDebugLabel")),p.appendChild(l("Geometric Error","showGeometricError")),p.appendChild(l("Rendering Statistics","showRenderingStatistics")),p.appendChild(l("Memory Usage (MB)","showMemoryUsage")),p.appendChild(l("Url","showUrl")),f.appendChild(l("Skip Tile LODs","skipLevelOfDetail"));var M=document.createElement("div");M.appendChild(makeRangeInput("skipScreenSpaceErrorFactor",1,50,1,"Skip SSE Factor")),f.appendChild(M);var I=document.createElement("div");I.appendChild(makeRangeInput("baseScreenSpaceError",0,4096,1,"SSE before skipping LOD")),f.appendChild(I);var R=document.createElement("div");R.appendChild(makeRangeInput("skipLevels",0,10,1,"Min. levels to skip")),f.appendChild(R),f.appendChild(l("Load only tiles that meet the max SSE.","immediatelyLoadDesiredLevelOfDetail")),f.appendChild(l("Load siblings of visible tiles","loadSiblings")),knockout.applyBindings(n,i)}function makeRangeInput(e,t,i,r,n,a){a=defaultValue(a,e);var o=document.createElement("input");o.setAttribute("data-bind","value: "+a),o.type="number";var s=document.createElement("input");s.type="range",s.min=t,s.max=i,s.step=r,s.setAttribute("data-bind",'valueUpdate: "input", value: '+e);var l=document.createElement("div");l.appendChild(s);var c=document.createElement("div");return c.className="cesium-cesiumInspector-slider",c.appendChild(document.createTextNode(n)),c.appendChild(o),c.appendChild(l),c}function makeButton(e,t,i){var r=document.createElement("button");r.type="button",r.textContent=t,r.className="cesium-cesiumInspector-pickButton";var n="click: "+e;return defined(i)&&(n+=', css: {"cesium-cesiumInspector-pickButtonHighlight" : '+i+"}"),r.setAttribute("data-bind",n),r}function frustumStatisticsToString(e){var t;if(defined(e)){t="Command Statistics";var i=e.commandsInFrustums;for(var r in i)if(i.hasOwnProperty(r)){var n,a=parseInt(r,10);if(7===a)n="1, 2 and 3";else{for(var o=[],s=2;0<=s;s--){var l=Math.pow(2,s);l<=a&&(o.push(s+1),a-=l)}n=o.reverse().join(" and ")}t+="<br>&nbsp;&nbsp;&nbsp;&nbsp;"+i[r]+" in frustum "+n}t+="<br>Total: "+e.totalCommands}return t}function boundDepthFrustum(e,t,i){var r=Math.min(i,t);return r=Math.max(r,e)}function CesiumInspectorViewModel(e,t){var u=this,i=e.canvas,r=new ScreenSpaceEventHandler(i);this._eventHandler=r,this._scene=e,this._canvas=i,this._primitive=void 0,this._tile=void 0,this._modelMatrixPrimitive=void 0,this._performanceDisplay=void 0,this._performanceContainer=t;var n,d=this._scene.globe;function a(e){var t=u._scene.pick({x:e.position.x,y:e.position.y});defined(t)&&(u.primitive=defined(t.collection)?t.collection:t.primitive),u._scene.requestRender(),u.pickPrimitiveActive=!1}function o(e){var t,i=d.ellipsoid,r=u._scene.camera.pickEllipsoid({x:e.position.x,y:e.position.y},i);if(defined(r))for(var n=i.cartesianToCartographic(r),a=d._surface.tileProvider._tilesToRenderByTextureCount,o=0;!t&&o<a.length;++o){var s=a[o];if(defined(s))for(var l=0;!t&&l<s.length;++l){var c=s[l];Rectangle.contains(c.rectangle,n)&&(t=c)}}u.tile=t,u.pickTileActive=!1}d.depthTestAgainstTerrain=!0,this.frustums=!1,this.frustumPlanes=!1,this.performance=!1,this.shaderCacheText="",this.primitiveBoundingSphere=!1,this.primitiveReferenceFrame=!1,this.filterPrimitive=!1,this.tileBoundingSphere=!1,this.filterTile=!1,this.wireframe=!1,this.globeDepth=!1,this.pickDepth=!1,this.depthFrustum=1,this._numberOfFrustums=1,this.suspendUpdates=!1,this.tileCoordinates=!1,this.frustumStatisticText=!1,this.tileText="",this.hasPickedPrimitive=!1,this.hasPickedTile=!1,this.pickPrimitiveActive=!1,this.pickTileActive=!1,this.dropDownVisible=!0,this.generalVisible=!0,this.primitivesVisible=!1,this.terrainVisible=!1,this.depthFrustumText="",knockout.track(this,["frustums","frustumPlanes","performance","shaderCacheText","primitiveBoundingSphere","primitiveReferenceFrame","filterPrimitive","tileBoundingSphere","filterTile","wireframe","globeDepth","pickDepth","depthFrustum","suspendUpdates","tileCoordinates","frustumStatisticText","tileText","hasPickedPrimitive","hasPickedTile","pickPrimitiveActive","pickTileActive","dropDownVisible","generalVisible","primitivesVisible","terrainVisible","depthFrustumText"]),this._toggleDropDown=createCommand$2(function(){u.dropDownVisible=!u.dropDownVisible}),this._toggleGeneral=createCommand$2(function(){u.generalVisible=!u.generalVisible}),this._togglePrimitives=createCommand$2(function(){u.primitivesVisible=!u.primitivesVisible}),this._toggleTerrain=createCommand$2(function(){u.terrainVisible=!u.terrainVisible}),this._frustumsSubscription=knockout.getObservable(this,"frustums").subscribe(function(e){u._scene.debugShowFrustums=e,u._scene.requestRender()}),this._frustumPlanesSubscription=knockout.getObservable(this,"frustumPlanes").subscribe(function(e){u._scene.debugShowFrustumPlanes=e,u._scene.requestRender()}),this._performanceSubscription=knockout.getObservable(this,"performance").subscribe(function(e){e?u._performanceDisplay=new PerformanceDisplay({container:u._performanceContainer}):u._performanceContainer.innerHTML=""}),this._showPrimitiveBoundingSphere=createCommand$2(function(){return u._primitive.debugShowBoundingVolume=u.primitiveBoundingSphere,u._scene.requestRender(),!0}),this._primitiveBoundingSphereSubscription=knockout.getObservable(this,"primitiveBoundingSphere").subscribe(function(){u._showPrimitiveBoundingSphere()}),this._showPrimitiveReferenceFrame=createCommand$2(function(){if(u.primitiveReferenceFrame){var e=u._primitive.modelMatrix;u._modelMatrixPrimitive=new DebugModelMatrixPrimitive({modelMatrix:e}),u._scene.primitives.add(u._modelMatrixPrimitive)}else defined(u._modelMatrixPrimitive)&&(u._scene.primitives.remove(u._modelMatrixPrimitive),u._modelMatrixPrimitive=void 0);return u._scene.requestRender(),!0}),this._primitiveReferenceFrameSubscription=knockout.getObservable(this,"primitiveReferenceFrame").subscribe(function(){u._showPrimitiveReferenceFrame()}),this._doFilterPrimitive=createCommand$2(function(){return u.filterPrimitive?u._scene.debugCommandFilter=function(e){return!(!defined(u._modelMatrixPrimitive)||e.owner!==u._modelMatrixPrimitive._primitive)||!!defined(u._primitive)&&(e.owner===u._primitive||e.owner===u._primitive._billboardCollection||e.owner.primitive===u._primitive)}:u._scene.debugCommandFilter=void 0,!0}),this._filterPrimitiveSubscription=knockout.getObservable(this,"filterPrimitive").subscribe(function(){u._doFilterPrimitive(),u._scene.requestRender()}),this._wireframeSubscription=knockout.getObservable(this,"wireframe").subscribe(function(e){d._surface.tileProvider._debug.wireframe=e,u._scene.requestRender()}),this._globeDepthSubscription=knockout.getObservable(this,"globeDepth").subscribe(function(e){u._scene.debugShowGlobeDepth=e,u._scene.requestRender()}),this._pickDepthSubscription=knockout.getObservable(this,"pickDepth").subscribe(function(e){u._scene.debugShowPickDepth=e,u._scene.requestRender()}),this._depthFrustumSubscription=knockout.getObservable(this,"depthFrustum").subscribe(function(e){u._scene.debugShowDepthFrustum=e,u._scene.requestRender()}),this._incrementDepthFrustum=createCommand$2(function(){var e=u.depthFrustum+1;return u.depthFrustum=boundDepthFrustum(1,u._numberOfFrustums,e),u._scene.requestRender(),!0}),this._decrementDepthFrustum=createCommand$2(function(){var e=u.depthFrustum-1;return u.depthFrustum=boundDepthFrustum(1,u._numberOfFrustums,e),u._scene.requestRender(),!0}),this._suspendUpdatesSubscription=knockout.getObservable(this,"suspendUpdates").subscribe(function(e){(d._surface._debug.suspendLodUpdate=e)||(u.filterTile=!1)}),this._showTileCoordinates=createCommand$2(function(){return u.tileCoordinates&&!defined(n)?n=e.imageryLayers.addImageryProvider(new TileCoordinatesImageryProvider({tilingScheme:e.terrainProvider.tilingScheme})):!u.tileCoordinates&&defined(n)&&(e.imageryLayers.remove(n),n=void 0),!0}),this._tileCoordinatesSubscription=knockout.getObservable(this,"tileCoordinates").subscribe(function(){u._showTileCoordinates(),u._scene.requestRender()}),this._tileBoundingSphereSubscription=knockout.getObservable(this,"tileBoundingSphere").subscribe(function(){u._showTileBoundingSphere(),u._scene.requestRender()}),this._showTileBoundingSphere=createCommand$2(function(){return u.tileBoundingSphere?d._surface.tileProvider._debug.boundingSphereTile=u._tile:d._surface.tileProvider._debug.boundingSphereTile=void 0,u._scene.requestRender(),!0}),this._doFilterTile=createCommand$2(function(){return u.filterTile?(u.suspendUpdates=!0,d._surface._tilesToRender=[],defined(u._tile)&&u._tile.renderable&&d._surface._tilesToRender.push(u._tile)):u.suspendUpdates=!1,!0}),this._filterTileSubscription=knockout.getObservable(this,"filterTile").subscribe(function(){u.doFilterTile(),u._scene.requestRender()}),this._pickPrimitive=createCommand$2(function(){u.pickPrimitiveActive=!u.pickPrimitiveActive}),this._pickPrimitiveActiveSubscription=knockout.getObservable(this,"pickPrimitiveActive").subscribe(function(e){e?r.setInputAction(a,ScreenSpaceEventType$1.LEFT_CLICK):r.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK)}),this._pickTile=createCommand$2(function(){u.pickTileActive=!u.pickTileActive}),this._pickTileActiveSubscription=knockout.getObservable(this,"pickTileActive").subscribe(function(e){e?r.setInputAction(o,ScreenSpaceEventType$1.LEFT_CLICK):r.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK)}),this._removePostRenderEvent=e.postRender.addEventListener(function(){u._update()})}function CesiumInspector(e,t){e=getElement(e);var i=document.createElement("div"),r=new CesiumInspectorViewModel(t,i);this._viewModel=r,this._container=e;var n=document.createElement("div");this._element=n;var a=document.createElement("div");a.textContent="Cesium Inspector",a.className="cesium-cesiumInspector-button",a.setAttribute("data-bind","click: toggleDropDown"),n.appendChild(a),n.className="cesium-cesiumInspector",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }'),e.appendChild(this._element);var o=document.createElement("div");(this._panel=o).className="cesium-cesiumInspector-dropDown",n.appendChild(o);var s=InspectorShared.createSection,l=InspectorShared.createCheckbox,c=s(o,"General","generalVisible","toggleGeneral"),u=l("Show Frustums","frustums"),d=document.createElement("div");d.className="cesium-cesiumInspector-frustumStatistics",d.setAttribute("data-bind","visible: frustums, html: frustumStatisticText"),u.appendChild(d),c.appendChild(u),c.appendChild(l("Show Frustum Planes","frustumPlanes")),c.appendChild(l("Performance Display","performance")),i.className="cesium-cesiumInspector-performanceDisplay",c.appendChild(i);var h=document.createElement("div");h.className="cesium-cesiumInspector-shaderCache",h.setAttribute("data-bind","html: shaderCacheText"),c.appendChild(h);var p=document.createElement("div");c.appendChild(p);var m=document.createElement("span");m.setAttribute("data-bind",'html: "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frustum:"'),p.appendChild(m);var f=document.createElement("span");f.setAttribute("data-bind","text: depthFrustumText"),p.appendChild(f);var g=document.createElement("input");g.type="button",g.value="-",g.className="cesium-cesiumInspector-pickButton",g.setAttribute("data-bind","click: decrementDepthFrustum"),p.appendChild(g);var _=document.createElement("input");_.type="button",_.value="+",_.className="cesium-cesiumInspector-pickButton",_.setAttribute("data-bind","click: incrementDepthFrustum"),p.appendChild(_);var y=s(o,"Primitives","primitivesVisible","togglePrimitives"),v=document.createElement("div");v.className="cesium-cesiumInspector-pickSection",y.appendChild(v);var C=document.createElement("input");C.type="button",C.value="Pick a primitive",C.className="cesium-cesiumInspector-pickButton",C.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive');var S=document.createElement("div");S.className="cesium-cesiumInspector-center",S.appendChild(C),v.appendChild(S),v.appendChild(l("Show bounding sphere","primitiveBoundingSphere","hasPickedPrimitive")),v.appendChild(l("Show reference frame","primitiveReferenceFrame","hasPickedPrimitive")),this._primitiveOnly=l("Show only selected","filterPrimitive","hasPickedPrimitive"),v.appendChild(this._primitiveOnly);var x=s(o,"Terrain","terrainVisible","toggleTerrain"),T=document.createElement("div");T.className="cesium-cesiumInspector-pickSection",x.appendChild(T);var b=document.createElement("input");b.type="button",b.value="Pick a tile",b.className="cesium-cesiumInspector-pickButton",b.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile'),(S=document.createElement("div")).appendChild(b),S.className="cesium-cesiumInspector-center",T.appendChild(S);var E=document.createElement("div");T.appendChild(E);var P=document.createElement("input");P.type="button",P.value="Parent",P.className="cesium-cesiumInspector-pickButton",P.setAttribute("data-bind","click: selectParent");var A=document.createElement("input");A.type="button",A.value="NW",A.className="cesium-cesiumInspector-pickButton",A.setAttribute("data-bind","click: selectNW");var w=document.createElement("input");w.type="button",w.value="NE",w.className="cesium-cesiumInspector-pickButton",w.setAttribute("data-bind","click: selectNE");var D=document.createElement("input");D.type="button",D.value="SW",D.className="cesium-cesiumInspector-pickButton",D.setAttribute("data-bind","click: selectSW");var M=document.createElement("input");M.type="button",M.value="SE",M.className="cesium-cesiumInspector-pickButton",M.setAttribute("data-bind","click: selectSE");var I=document.createElement("div");I.className="cesium-cesiumInspector-tileText",E.className="cesium-cesiumInspector-frustumStatistics",E.appendChild(I),E.setAttribute("data-bind","visible: hasPickedTile"),I.setAttribute("data-bind","html: tileText");var R=document.createElement("div");R.className="cesium-cesiumInspector-relativeText",R.textContent="Select relative:",E.appendChild(R);var O=document.createElement("table"),L=document.createElement("tr"),F=document.createElement("tr"),N=document.createElement("td");N.appendChild(P);var B=document.createElement("td");B.appendChild(A);var V=document.createElement("td");V.appendChild(w),L.appendChild(N),L.appendChild(B),L.appendChild(V);var k=document.createElement("td"),$=document.createElement("td");$.appendChild(D);var z=document.createElement("td");z.appendChild(M),F.appendChild(k),F.appendChild($),F.appendChild(z),O.appendChild(L),O.appendChild(F),E.appendChild(O),T.appendChild(l("Show bounding volume","tileBoundingSphere","hasPickedTile")),T.appendChild(l("Show only selected","filterTile","hasPickedTile")),x.appendChild(l("Wireframe","wireframe")),x.appendChild(l("Suspend LOD update","suspendUpdates")),x.appendChild(l("Show tile coordinates","tileCoordinates")),knockout.applyBindings(r,this._element)}function getDefaultSkyBoxUrl(e){return buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_"+e+".jpg")}function startRenderLoop(a){a._renderLoopRunning=!0;var o=0;requestAnimationFramePolyFill(function e(t){if(!a.isDestroyed())if(a._useDefaultRenderLoop)try{var i=a._targetFrameRate;if(defined(i)){var r=1e3/i,n=t-o;r<n&&(a.resize(),a.render(),o=t-n%r),requestAnimationFramePolyFill(e)}else a.resize(),a.render(),requestAnimationFramePolyFill(e)}catch(e){a._useDefaultRenderLoop=!1,a._renderLoopRunning=!1,a._showRenderLoopErrors&&a.showErrorPanel("WebGL渲染时发生错误,渲染已经停止,请刷新页面。",void 0,e)}else a._renderLoopRunning=!1})}function configurePixelRatio(e){var t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,defined(e._scene)&&(e._scene.pixelRatio=t),t}function configureCanvasSize(e){var t=e._canvas,i=t.clientWidth,r=t.clientHeight,n=configurePixelRatio(e);e._canvasClientWidth=i,e._canvasClientHeight=r,i*=n,r*=n,t.width=i,t.height=r,e._canRender=0!==i&&0!==r,e._lastDevicePixelRatio=window.devicePixelRatio}function configureCameraFrustum(e){var t=e._canvas,i=t.width,r=t.height;if(0!==i&&0!==r){var n=e._scene.camera.frustum;defined(n.aspectRatio)?n.aspectRatio=i/r:(n.top=n.right*(r/i),n.bottom=-n.top)}}function CesiumWidget(e,t){e=getElement(e),t=defaultValue(t,defaultValue.EMPTY_OBJECT);var i=document.createElement("div");i.className="cesium-widget",e.appendChild(i);var r=document.createElement("canvas"),n=FeatureDetection.supportsImageRenderingPixelated();(this._supportsImageRenderingPixelated=n)&&(r.style.imageRendering=FeatureDetection.imageRenderingValue()),r.oncontextmenu=function(){return!1},r.onselectstart=function(){return!1},i.appendChild(r);var a=document.createElement("div");a.className="cesium-widget-credits";var o=defined(t.creditContainer)?getElement(t.creditContainer):i;o.appendChild(a);var s=defined(t.creditViewport)?getElement(t.creditViewport):i,l=defaultValue(t.showRenderLoopErrors,!0),c=defaultValue(t.useBrowserRecommendedResolution,!1);this._element=i,this._container=e,this._canvas=r,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=s,this._creditContainer=o,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=l,this._resolutionScale=1,this._useBrowserRecommendedResolution=c,this._forceResize=!1,this._clock=defined(t.clock)?t.clock:new Clock,configureCanvasSize(this);try{var u=new Scene({canvas:r,contextOptions:t.contextOptions,creditContainer:a,creditViewport:s,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:defaultValue(t.scene3DOnly,!1),terrainExaggeration:t.terrainExaggeration,shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange});(this._scene=u).camera.constrainedAxis=Cartesian3.UNIT_Z,configurePixelRatio(this),configureCameraFrustum(this);var d=defaultValue(u.mapProjection.ellipsoid,Ellipsoid.WGS84),h=t.globe;defined(h)||(h=new Globe(d)),!1!==h&&(u.globe=h,u.globe.shadows=defaultValue(t.terrainShadows,ShadowMode$1.RECEIVE_ONLY));var p=t.skyBox;defined(p)||(p=new SkyBox({sources:{positiveX:getDefaultSkyBoxUrl("px"),negativeX:getDefaultSkyBoxUrl("mx"),positiveY:getDefaultSkyBoxUrl("py"),negativeY:getDefaultSkyBoxUrl("my"),positiveZ:getDefaultSkyBoxUrl("pz"),negativeZ:getDefaultSkyBoxUrl("mz")}})),!1!==p&&(u.skyBox=p,u.sun=new Sun,u.moon=new Moon);var m=t.skyAtmosphere;defined(m)||(m=new SkyAtmosphere(d)),!1!==m&&(u.skyAtmosphere=m);var f=!1!==t.globe&&t.imageryProvider;defined(f)||(f=createWorldImagery()),!1!==f&&u.imageryLayers.addImageryProvider(f),defined(t.terrainProvider)&&!1!==t.globe&&(u.terrainProvider=t.terrainProvider),this._screenSpaceEventHandler=new ScreenSpaceEventHandler(r),defined(t.sceneMode)&&(t.sceneMode===SceneMode$1.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===SceneMode$1.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=defaultValue(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;var g=this;u.renderError.addEventListener(function(e,t){if(g._useDefaultRenderLoop=!1,g._renderLoopRunning=!1,g._showRenderLoopErrors){g.showErrorPanel("WebGL渲染时发生错误,渲染已经停止,请刷新页面。",void 0,t)}})}catch(e){if(l){this.showErrorPanel("构造CesiumWidget时出错",'访问<a href="http://get.webgl.org"> http://get.webgl.org </a>以验证您的Web浏览器和硬件是否支持WebGL。请考虑尝试使用其他最新浏览器或更新显卡驱动程序。详细的错误信息如下:',e)}throw e}}function FullscreenButtonViewModel(e){var t=this,i=knockout.observable(Fullscreen.fullscreen),r=knockout.observable(Fullscreen.enabled);this.isFullscreen=void 0,knockout.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,knockout.defineProperty(this,"isFullscreenEnabled",{get:function(){return r()},set:function(e){r(e&&Fullscreen.enabled)}}),this.tooltip=void 0,knockout.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"退出全屏":"全屏":"全屏不可用"}),this._command=createCommand$2(function(){Fullscreen.fullscreen?Fullscreen.exitFullscreen():Fullscreen.requestFullscreen(t._fullscreenElement)},knockout.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=defaultValue(getElement(e),document.body),this._callback=function(){i(Fullscreen.fullscreen)},document.addEventListener(Fullscreen.changeEventName,this._callback)}defineProperties$1(Cesium3DTilesInspectorViewModel.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},statisticsText:{get:function(){return this._statisticsText}},pickStatisticsText:{get:function(){return this._pickStatisticsText}},colorBlendModes:{get:function(){return colorBlendModes}},editorError:{get:function(){return this._editorError}},tileset:{get:function(){return this._tileset},set:function(e){if(this._tileset=e,this._style=void 0,this.styleString="{}",this.feature=void 0,this.tile=void 0,defined(e)){var t=this;e.readyPromise.then(function(e){t.isDestroyed()||t._properties(e.properties)});for(var i=["colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl"],r=i.length,n=0;n<r;++n){var a=i[n];this[a]=this[a]}this.maximumScreenSpaceError=e.maximumScreenSpaceError,this.dynamicScreenSpaceError=e.dynamicScreenSpaceError,this.dynamicScreenSpaceErrorDensity=e.dynamicScreenSpaceErrorDensity,this.dynamicScreenSpaceErrorFactor=e.dynamicScreenSpaceErrorFactor,this.colorBlendMode=e.colorBlendMode,this.skipLevelOfDetail=e.skipLevelOfDetail,this.skipScreenSpaceErrorFactor=e.skipScreenSpaceErrorFactor,this.baseScreenSpaceError=e.baseScreenSpaceError,this.skipLevels=e.skipLevels,this.immediatelyLoadDesiredLevelOfDetail=e.immediatelyLoadDesiredLevelOfDetail,this.loadSiblings=e.loadSiblings;var o=e.pointCloudShading;this.pointCloudShading=o.attenuation,this.geometricErrorScale=o.geometricErrorScale,this.maximumAttenuation=o.maximumAttenuation?o.maximumAttenuation:0,this.baseResolution=o.baseResolution?o.baseResolution:0,this.eyeDomeLighting=o.eyeDomeLighting,this.eyeDomeLightingStrength=o.eyeDomeLightingStrength,this.eyeDomeLightingRadius=o.eyeDomeLightingRadius,this._scene.requestRender()}else this._properties({});this._statisticsText=getStatistics(e,!1),this._pickStatisticsText=getStatistics(e,!0),selectTilesetOnHover(this,!1)}},feature:{get:function(){return this._feature},set:function(e){if(this._feature!==e){var t=this._feature;defined(t)&&!t.content.isDestroyed()&&(!this.colorize&&defined(this._style)?t.color=defined(this._style.color)?this._style.color.evaluateColor(t,scratchColor$l):Color.WHITE:t.color=oldColor,this._scene.requestRender()),defined(e)&&(Color.clone(e.color,oldColor),e.color=highlightColor$1,this._scene.requestRender()),this._feature=e}}},tile:{get:function(){return this._tile},set:function(e){if(this._tile!==e){var t=this._tile;!defined(t)||t.isDestroyed()||hasFeatures(t.content)||(t.color=oldColor,this._scene.requestRender()),defined(e)&&!hasFeatures(e.content)&&(Color.clone(e.color,oldColor),e.color=highlightColor$1,this._scene.requestRender()),this._tile=e}}}}),Cesium3DTilesInspectorViewModel.prototype.togglePickTileset=function(){this.pickActive=!this.pickActive},Cesium3DTilesInspectorViewModel.prototype.toggleInspector=function(){this.inspectorVisible=!this.inspectorVisible},Cesium3DTilesInspectorViewModel.prototype.toggleTileset=function(){this.tilesetVisible=!this.tilesetVisible},Cesium3DTilesInspectorViewModel.prototype.toggleDisplay=function(){this.displayVisible=!this.displayVisible},Cesium3DTilesInspectorViewModel.prototype.toggleUpdate=function(){this.updateVisible=!this.updateVisible},Cesium3DTilesInspectorViewModel.prototype.toggleLogging=function(){this.loggingVisible=!this.loggingVisible},Cesium3DTilesInspectorViewModel.prototype.toggleStyle=function(){this.styleVisible=!this.styleVisible},Cesium3DTilesInspectorViewModel.prototype.toggleTileDebugLabels=function(){this.tileDebugLabelsVisible=!this.tileDebugLabelsVisible},Cesium3DTilesInspectorViewModel.prototype.toggleOptimization=function(){this.optimizationVisible=!this.optimizationVisible},Cesium3DTilesInspectorViewModel.prototype.trimTilesCache=function(){defined(this._tileset)&&this._tileset.trimLoadedTiles()},Cesium3DTilesInspectorViewModel.prototype.compileStyle=function(){var e=this._tileset;if(defined(e)&&this.styleString!==JSON.stringify(e.style)){this._editorError="";try{0===this.styleString.length&&(this.styleString="{}"),this._style=new Cesium3DTileStyle(JSON.parse(this.styleString)),this._shouldStyle=!0,this._scene.requestRender()}catch(e){this._editorError=e.toString()}this.feature=this._feature,this.tile=this._tile}},Cesium3DTilesInspectorViewModel.prototype.styleEditorKeyPress=function(e,t){if(9===t.keyCode){t.preventDefault();var i,r=t.target,n=r.selectionStart,a=r.selectionEnd,o=a,s=r.value.slice(n,a).split("\n"),l=s.length;if(t.shiftKey)for(i=0;i<l;++i)" "===s[i][0]&&(" "===s[i][1]?(s[i]=s[i].substr(2),o-=2):(s[i]=s[i].substr(1),o-=1));else for(i=0;i<l;++i)s[i]="  "+s[i],o+=2;var c=s.join("\n");r.value=r.value.slice(0,n)+c+r.value.slice(a),r.selectionStart=n!==a?n:o,r.selectionEnd=o}else!t.ctrlKey||10!==t.keyCode&&13!==t.keyCode||this.compileStyle();return!0},Cesium3DTilesInspectorViewModel.prototype._update=function(){var e=this._tileset;if(this.performance&&this._performanceDisplay.update(),defined(e)){if(e.isDestroyed())return this.tile=void 0,this.feature=void 0,void(this.tileset=void 0);var t=e.style;this._style!==e.style&&(this._shouldStyle?(e.style=this._style,this._shouldStyle=!1):(this._style=t,this.styleString=JSON.stringify(t.style,null,"  ")))}this.showStatistics&&(this._statisticsText=getStatistics(e,!1),this._pickStatisticsText=getStatistics(e,!0))},Cesium3DTilesInspectorViewModel.prototype.isDestroyed=function(){return!1},Cesium3DTilesInspectorViewModel.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();var t=this;return this._definedProperties.forEach(function(e){knockout.getObservable(t,e).dispose()}),destroyObject(this)},Cesium3DTilesInspectorViewModel.getStatistics=getStatistics,defineProperties$1(Cesium3DTilesInspector.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),Cesium3DTilesInspector.prototype.isDestroyed=function(){return!1},Cesium3DTilesInspector.prototype.destroy=function(){return knockout.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),destroyObject(this)},defineProperties$1(CesiumInspectorViewModel.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},toggleDropDown:{get:function(){return this._toggleDropDown}},showPrimitiveBoundingSphere:{get:function(){return this._showPrimitiveBoundingSphere}},showPrimitiveReferenceFrame:{get:function(){return this._showPrimitiveReferenceFrame}},doFilterPrimitive:{get:function(){return this._doFilterPrimitive}},incrementDepthFrustum:{get:function(){return this._incrementDepthFrustum}},decrementDepthFrustum:{get:function(){return this._decrementDepthFrustum}},showTileCoordinates:{get:function(){return this._showTileCoordinates}},showTileBoundingSphere:{get:function(){return this._showTileBoundingSphere}},doFilterTile:{get:function(){return this._doFilterTile}},toggleGeneral:{get:function(){return this._toggleGeneral}},togglePrimitives:{get:function(){return this._togglePrimitives}},toggleTerrain:{get:function(){return this._toggleTerrain}},pickPrimitive:{get:function(){return this._pickPrimitive}},pickTile:{get:function(){return this._pickTile}},selectParent:{get:function(){var e=this;return createCommand$2(function(){e.tile=e.tile.parent})}},selectNW:{get:function(){var e=this;return createCommand$2(function(){e.tile=e.tile.northwestChild})}},selectNE:{get:function(){var e=this;return createCommand$2(function(){e.tile=e.tile.northeastChild})}},selectSW:{get:function(){var e=this;return createCommand$2(function(){e.tile=e.tile.southwestChild})}},selectSE:{get:function(){var e=this;return createCommand$2(function(){e.tile=e.tile.southeastChild})}},primitive:{get:function(){return this._primitive},set:function(e){var t=this._primitive;e!==t&&(this.hasPickedPrimitive=!0,defined(t)&&(t.debugShowBoundingVolume=!1),this._scene.debugCommandFilter=void 0,defined(this._modelMatrixPrimitive)&&(this._scene.primitives.remove(this._modelMatrixPrimitive),this._modelMatrixPrimitive=void 0),(this._primitive=e).show=!1,setTimeout(function(){e.show=!0},50),this.showPrimitiveBoundingSphere(),this.showPrimitiveReferenceFrame(),this.doFilterPrimitive())}},tile:{get:function(){return this._tile},set:function(e){if(defined(e)){if(this.hasPickedTile=!0,e!==this._tile){this.tileText="L: "+e.level+" X: "+e.x+" Y: "+e.y,this.tileText+="<br>SW corner: "+e.rectangle.west+", "+e.rectangle.south,this.tileText+="<br>NE corner: "+e.rectangle.east+", "+e.rectangle.north;var t=e.data;defined(t)&&defined(t.tileBoundingRegion)?this.tileText+="<br>Min: "+t.tileBoundingRegion.minimumHeight+" Max: "+t.tileBoundingRegion.maximumHeight:this.tileText+="<br>(Tile is not loaded)"}this._tile=e,this.showTileBoundingSphere(),this.doFilterTile()}else this.hasPickedTile=!1,this._tile=void 0}}}),CesiumInspectorViewModel.prototype._update=function(){this.frustums&&(this.frustumStatisticText=frustumStatisticsToString(this._scene.debugFrustumStatistics));var e=this._scene.numberOfFrustums;this._numberOfFrustums=e,this.depthFrustum=boundDepthFrustum(1,e,this.depthFrustum),this.depthFrustumText=this.depthFrustum+" of "+e,this.performance&&this._performanceDisplay.update(),this.primitiveReferenceFrame&&(this._modelMatrixPrimitive.modelMatrix=this._primitive.modelMatrix),this.shaderCacheText="Cached shaders: "+this._scene.context.shaderCache.numberOfShaders},CesiumInspectorViewModel.prototype.isDestroyed=function(){return!1},CesiumInspectorViewModel.prototype.destroy=function(){return this._eventHandler.destroy(),this._removePostRenderEvent(),this._frustumsSubscription.dispose(),this._frustumPlanesSubscription.dispose(),this._performanceSubscription.dispose(),this._primitiveBoundingSphereSubscription.dispose(),this._primitiveReferenceFrameSubscription.dispose(),this._filterPrimitiveSubscription.dispose(),this._wireframeSubscription.dispose(),this._globeDepthSubscription.dispose(),this._pickDepthSubscription.dispose(),this._depthFrustumSubscription.dispose(),this._suspendUpdatesSubscription.dispose(),this._tileCoordinatesSubscription.dispose(),this._tileBoundingSphereSubscription.dispose(),this._filterTileSubscription.dispose(),this._pickPrimitiveActiveSubscription.dispose(),this._pickTileActiveSubscription.dispose(),destroyObject(this)},defineProperties$1(CesiumInspector.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),CesiumInspector.prototype.isDestroyed=function(){return!1},CesiumInspector.prototype.destroy=function(){return knockout.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),destroyObject(this)},defineProperties$1(CesiumWidget.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}},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){this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e)&&!this._renderLoopRunning&&startRenderLoop(this)}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){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)}}}),CesiumWidget.prototype.showErrorPanel=function(e,t,i){var r=this._element,n=document.createElement("div");n.className="cesium-widget-errorPanel";var a=document.createElement("div");a.className="cesium-widget-errorPanel-content",n.appendChild(a);var o=document.createElement("div");o.className="cesium-widget-errorPanel-header",o.appendChild(document.createTextNode(e)),a.appendChild(o);var s=document.createElement("div");function l(){s.style.maxHeight=Math.max(Math.round(.9*r.clientHeight-100),30)+"px"}if(s.className="cesium-widget-errorPanel-scroll",a.appendChild(s),l(),defined(window.addEventListener)&&window.addEventListener("resize",l,!1),defined(t)){var c=document.createElement("div");c.className="cesium-widget-errorPanel-message",c.innerHTML="<p>"+t+"</p>",s.appendChild(c)}var u="(no error details available)";defined(i)&&(u=formatError(i));var d=document.createElement("div");d.className="cesium-widget-errorPanel-message",d.appendChild(document.createTextNode(u)),s.appendChild(d);var h=document.createElement("div");h.className="cesium-widget-errorPanel-buttonPanel",a.appendChild(h);var p=document.createElement("button");p.setAttribute("type","button"),p.className="cesium-button",p.appendChild(document.createTextNode("OK")),p.onclick=function(){defined(l)&&defined(window.removeEventListener)&&window.removeEventListener("resize",l,!1),r.removeChild(n)},h.appendChild(p),r.appendChild(n),"undefined"!=typeof console&&console.error(e+"\n"+t+"\n"+u)},CesiumWidget.prototype.isDestroyed=function(){return!1},CesiumWidget.prototype.destroy=function(){this._scene=this._scene&&this._scene.destroy(),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),destroyObject(this)},CesiumWidget.prototype.resize=function(){var e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,configureCanvasSize(this),configureCameraFrustum(this),this._scene.requestRender())},CesiumWidget.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();var e=this._clock.tick();this._scene.render(e)}else this._clock.tick()},defineProperties$1(FullscreenButtonViewModel.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){this._fullscreenElement=e}},command:{get:function(){return this._command}}}),FullscreenButtonViewModel.prototype.isDestroyed=function(){return!1},FullscreenButtonViewModel.prototype.destroy=function(){document.removeEventListener(Fullscreen.changeEventName,this._callback),destroyObject(this)};var enterFullScreenPath="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",exitFullScreenPath="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 FullscreenButton(e,t){e=getElement(e);var i=new FullscreenButtonViewModel(t);i._exitFullScreenPath=exitFullScreenPath,i._enterFullScreenPath=enterFullScreenPath;var r=document.createElement("button");r.type="button",r.className="cesium-button cesium-fullscreenButton",r.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(r),knockout.applyBindings(i,r),this._container=e,this._viewModel=i,this._element=r}defineProperties$1(FullscreenButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),FullscreenButton.prototype.isDestroyed=function(){return!1},FullscreenButton.prototype.destroy=function(){return this._viewModel.destroy(),knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)};var DEFAULT_HEIGHT=1e3;function GeocoderViewModel(e){defined(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new CartographicGeocoderService,new IonGeocoderService({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._geocodePromise=void 0,this._complete=new Event,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=handleArrowDown,this._handleArrowUp=handleArrowUp;var a=this;this._suggestionsVisible=knockout.pureComputed(function(){var e=0<knockout.getObservable(a,"_suggestions")().length,t=knockout.getObservable(a,"_showSuggestions")();return e&&t}),this._searchCommand=createCommand$2(function(e){if(e=defaultValue(e,GeocodeType$1.SEARCH),a._focusTextbox=!1,defined(a._selectedSuggestion))return a.activateSuggestion(a._selectedSuggestion),!1;a.hideSuggestions(),a.isSearchInProgress?cancelGeocode(a):geocode(a,a._geocoderServices,e)}),this.deselectSuggestion=function(){a._selectedSuggestion=void 0},this.handleKeyDown=function(e,t){var i="ArrowDown"===t.key||"Down"===t.key||40===t.keyCode,r="ArrowUp"===t.key||"Up"===t.key||38===t.keyCode;return(i||r)&&t.preventDefault(),!0},this.handleKeyUp=function(e,t){var i="ArrowDown"===t.key||"Down"===t.key||40===t.keyCode,r="ArrowUp"===t.key||"Up"===t.key||38===t.keyCode,n="Enter"===t.key||13===t.keyCode;return r?handleArrowUp(a):i?handleArrowDown(a):n&&a._searchCommand(),!0},this.activateSuggestion=function(e){a.hideSuggestions(),a._searchText=e.displayName;var t=e.destination;clearSuggestions(a),a.destinationFound(a,t)},this.hideSuggestions=function(){a._showSuggestions=!1,a._selectedSuggestion=void 0},this.showSuggestions=function(){a._showSuggestions=!0},this.handleMouseover=function(e,t){e!==a._selectedSuggestion&&(a._selectedSuggestion=e)},this.keepExpanded=!1,this.autoComplete=defaultValue(e.autocomplete,!0),this.destinationFound=defaultValue(e.destinationFound,GeocoderViewModel.flyToDestination),this._focusTextbox=!1,knockout.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);var t=knockout.getObservable(this,"_searchText");t.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=t.subscribe(function(){GeocoderViewModel._updateSearchSuggestions(a)}),this.isSearchInProgress=void 0,knockout.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,knockout.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"查询中...":this._searchText},set:function(e){this._searchText=e}}),this.flightDuration=void 0,knockout.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(e){this._flightDuration=e}})}function handleArrowUp(e){if(0!==e._suggestions.length){var t,i=e._suggestions.indexOf(e._selectedSuggestion);-1!==i&&0!==i?(t=i-1,e._selectedSuggestion=e._suggestions[t],GeocoderViewModel._adjustSuggestionsScroll(e,t)):e._selectedSuggestion=void 0}}function handleArrowDown(e){if(0!==e._suggestions.length){var t=e._suggestions.length,i=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[i],GeocoderViewModel._adjustSuggestionsScroll(e,i)}}function computeFlyToLocationForCartographic(t,e){return defined(defined(e)?e.availability:void 0)?sampleTerrainMostDetailed(e,[t]).then(function(e){return(t=e[0]).height+=DEFAULT_HEIGHT,t}):(t.height+=DEFAULT_HEIGHT,when.resolve(t))}function flyToDestination(e,t){var i,r=e._scene,n=r.mapProjection.ellipsoid,a=r.camera,o=r.terrainProvider,s=t;t instanceof Rectangle?CesiumMath.equalsEpsilon(t.south,t.north,CesiumMath.EPSILON7)&&CesiumMath.equalsEpsilon(t.east,t.west,CesiumMath.EPSILON7)?t=Rectangle.center(t):i=computeFlyToLocationForRectangle(t,r):t=n.cartesianToCartographic(t),defined(i)||(i=computeFlyToLocationForCartographic(t,o)),i.then(function(e){s=n.cartographicToCartesian(e)}).always(function(){a.flyTo({destination:s,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:Matrix4.IDENTITY})})}function chainPromise(e,t,i,r){return e.then(function(e){return defined(e)&&"fulfilled"===e.state&&0<e.value.length?e:t.geocode(i,r).then(function(e){return{state:"fulfilled",value:e}}).otherwise(function(e){return{state:"rejected",reason:e}})})}function geocode(i,e,t){var r=i._searchText;if(hasOnlyWhitespace(r))i.showSuggestions();else{i._isSearchInProgress=!0;for(var n=when.resolve(),a=0;a<e.length;a++)n=chainPromise(n,e[a],r,t);(i._geocodePromise=n).then(function(e){if(!n.cancel){i._isSearchInProgress=!1;var t=e.value;if("fulfilled"===e.state&&defined(t)&&0<t.length)return i._searchText=t[0].displayName,void i.destinationFound(i,t[0].destination);i._searchText=r}})}}function adjustSuggestionsScroll(e,t){var i=getElement(e._viewContainer),r=i.getElementsByClassName("search-results")[0],n=i.getElementsByTagName("li")[t];if(0!==t){var a=n.offsetTop;a+n.clientHeight>r.clientHeight?r.scrollTop=a+n.clientHeight:a<r.scrollTop&&(r.scrollTop=a)}else r.scrollTop=0}function cancelGeocode(e){e._isSearchInProgress=!1,defined(e._geocodePromise)&&(e._geocodePromise.cancel=!0,e._geocodePromise=void 0)}function hasOnlyWhitespace(e){return/^\s*$/.test(e)}function clearSuggestions(e){knockout.getObservable(e,"_suggestions").removeAll()}function updateSearchSuggestions(r){if(r.autoComplete){var i=r._searchText;if(clearSuggestions(r),!hasOnlyWhitespace(i)){var t=when.resolve([]);r._geocoderServices.forEach(function(e){t=t.then(function(t){return 5<=t.length?t:e.geocode(i,GeocodeType$1.AUTOCOMPLETE).then(function(e){return t=t.concat(e)})})}),t.then(function(e){for(var t=r._suggestions,i=0;i<e.length;i++)t.push(e[i])})}}}defineProperties$1(GeocoderViewModel.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}}}),GeocoderViewModel.prototype.destroy=function(){this._suggestionSubscription.dispose()},GeocoderViewModel.flyToDestination=flyToDestination,GeocoderViewModel._updateSearchSuggestions=updateSearchSuggestions,GeocoderViewModel._adjustSuggestionsScroll=adjustSuggestionsScroll;var startSearchPath="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",stopSearchPath="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 Geocoder(e){var t=getElement(e.container),i=new GeocoderViewModel(e);i._startSearchPath=startSearchPath,i._stopSearchPath=stopSearchPath;var r=document.createElement("form");r.setAttribute("data-bind","submit: search");var n=document.createElement("input");n.type="search",n.className="cesium-geocoder-input",n.setAttribute("placeholder","搜索定位..."),n.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(){n.select()},0)},n.addEventListener("focus",this._onTextBoxFocus,!1),r.appendChild(n),this._textBox=n;var a=document.createElement("span");a.className="cesium-geocoder-searchButton",a.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),r.appendChild(a),t.appendChild(r);var o=document.createElement("div");o.className="search-results",o.setAttribute("data-bind","visible: _suggestionsVisible");var s=document.createElement("ul");s.setAttribute("data-bind","foreach: _suggestions");var l=document.createElement("li");s.appendChild(l),l.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),o.appendChild(s),t.appendChild(o),knockout.applyBindings(i,r),knockout.applyBindings(i,o),this._container=t,this._searchSuggestionsContainer=o,this._viewModel=i,this._form=r,this._onInputBegin=function(e){t.contains(e.target)||(i._focusTextbox=!1,i.hideSuggestions())},this._onInputEnd=function(e){t.contains(e.target)&&(i._focusTextbox=!0,i.showSuggestions())},FeatureDetection.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),document.addEventListener("pointerup",this._onInputEnd,!0),document.addEventListener("pointercancel",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),document.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),document.addEventListener("touchend",this._onInputEnd,!0),document.addEventListener("touchcancel",this._onInputEnd,!0))}function HomeButtonViewModel(e,t){this._scene=e,this._duration=t;var i=this;this._command=createCommand$2(function(){i._scene.camera.flyHome(i._duration)}),this.tooltip="复位视角",knockout.track(this,["tooltip"])}function HomeButton(e,t,i){e=getElement(e);var r=new HomeButtonViewModel(t,i);r._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";var n=document.createElement("button");n.type="button",n.className="cesium-button cesium-toolbar-button cesium-home-button",n.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(n),knockout.applyBindings(r,n),this._container=e,this._viewModel=r,this._element=n}defineProperties$1(Geocoder.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}}),Geocoder.prototype.isDestroyed=function(){return!1},Geocoder.prototype.destroy=function(){return FeatureDetection.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),document.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),document.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),document.removeEventListener("touchend",this._onInputEnd,!0)),this._viewModel.destroy(),knockout.cleanNode(this._form),knockout.cleanNode(this._searchSuggestionsContainer),this._container.removeChild(this._form),this._container.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),destroyObject(this)},defineProperties$1(HomeButtonViewModel.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){this._duration=e}}}),defineProperties$1(HomeButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),HomeButton.prototype.isDestroyed=function(){return!1},HomeButton.prototype.destroy=function(){return knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)};var cameraEnabledPath="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",cameraDisabledPath="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 InfoBoxViewModel(){this._cameraClicked=new Event,this._closeClicked=new Event,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",knockout.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,knockout.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?cameraDisabledPath:cameraEnabledPath}}),knockout.defineProperty(this,"_bodyless",{get:function(){return!defined(this.description)||0===this.description.length}})}function InfoBox(e){e=getElement(e);var l=document.createElement("div");l.className="cesium-infoBox",l.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(l);var t=document.createElement("div");t.className="cesium-infoBox-title",t.setAttribute("data-bind","text: titleText"),l.appendChild(t);var 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 }'),l.appendChild(i);var r=document.createElement("button");r.type="button",r.className="cesium-infoBox-close",r.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),r.innerHTML="&times;",l.appendChild(r);var c=document.createElement("iframe");c.className="cesium-infoBox-iframe",c.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),c.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),c.setAttribute("allowfullscreen",!0),l.appendChild(c);var n=new InfoBoxViewModel;knockout.applyBindings(n,l),this._container=e,this._element=l,this._frame=c,this._viewModel=n,this._descriptionSubscription=void 0;var a=this;c.addEventListener("load",function(){var e=c.contentDocument,t=e.createElement("link");t.href=buildModuleUrl("Widgets/InfoBox/InfoBoxDescription.css"),t.rel="stylesheet",t.type="text/css";var s=e.createElement("div");s.className="cesium-infoBox-description",e.head.appendChild(t),e.body.appendChild(s),a._descriptionSubscription=subscribeAndEvaluate(n,"description",function(e){c.style.height="5px",s.innerHTML=e;var t=null,i=s.firstElementChild;if(null!==i&&1===s.childNodes.length){var r=window.getComputedStyle(i);if(null!==r){var n=r["background-color"],a=Color.fromCssColorString(n);defined(a)&&0!==a.alpha&&(t=r["background-color"])}}l.style["background-color"]=t;var o=s.getBoundingClientRect().height;c.style.height=o+"px"})}),c.setAttribute("src","about:blank")}function NavigationHelpButtonViewModel(){this.showInstructions=!1;var e=this;this._command=createCommand$2(function(){e.showInstructions=!e.showInstructions}),this._showClick=createCommand$2(function(){e._touch=!1}),this._showTouch=createCommand$2(function(){e._touch=!0}),this._touch=!1,this.tooltip="鼠标或触摸操作帮助",knockout.track(this,["tooltip","showInstructions","_touch"])}function NavigationHelpButton(e){var t=getElement(e.container),i=new NavigationHelpButtonViewModel,r=defaultValue(e.instructionsInitiallyVisible,!1);i.showInstructions=r,i._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";var n=document.createElement("span");n.className="cesium-navigationHelpButton-wrapper",t.appendChild(n);var a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",a.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),n.appendChild(a);var o=document.createElement("div");o.className="cesium-navigation-help",o.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),n.appendChild(o);var s=document.createElement("button");s.type="button",s.className="cesium-navigation-button cesium-navigation-button-left",s.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');var l=document.createElement("img");l.src=buildModuleUrl("Widgets/Images/NavigationHelp/Mouse.svg"),l.className="cesium-navigation-button-icon",l.style.width="25px",l.style.height="25px",s.appendChild(l),s.appendChild(document.createTextNode("鼠标"));var c=document.createElement("button");c.type="button",c.className="cesium-navigation-button cesium-navigation-button-right",c.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');var u=document.createElement("img");u.src=buildModuleUrl("Widgets/Images/NavigationHelp/Touch.svg"),u.className="cesium-navigation-button-icon",u.style.width="25px",u.style.height="25px",c.appendChild(u),c.appendChild(document.createTextNode("触摸")),o.appendChild(s),o.appendChild(c);var d=document.createElement("div");d.className="cesium-click-navigation-help cesium-navigation-help-instructions",d.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),d.innerHTML='            <table>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/MouseLeft.svg")+'" width="48" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-pan">平移视图</div>                        <div class="cesium-navigation-help-details">鼠标左键拖动</div>                    </td>                </tr>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/MouseRight.svg")+'" width="48" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-zoom">缩放视图</div>                        <div class="cesium-navigation-help-details">右键拖动或鼠标中键滚动</div>                    </td>                </tr>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/MouseMiddle.svg")+'" width="48" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-rotate">旋转视图</div>                        <div class="cesium-navigation-help-details">中键拖动</div>                        <div class="cesium-navigation-help-details">或按Ctrl键同时左键拖动</div>                    </td>                </tr>            </table>',o.appendChild(d);var h=document.createElement("div");h.className="cesium-touch-navigation-help cesium-navigation-help-instructions",h.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),h.innerHTML='            <table>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchDrag.svg")+'" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-pan">平移视图</div>                        <div class="cesium-navigation-help-details">单指拖动</div>                    </td>                </tr>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchZoom.svg")+'" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-zoom">缩放视图</div>                        <div class="cesium-navigation-help-details">双指向内或向外滑动</div>                    </td>                </tr>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchTilt.svg")+'" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-rotate">倾斜角度</div>                        <div class="cesium-navigation-help-details">双指拖曳,相同方向</div>                    </td>                </tr>                <tr>                    <td><img src="'+buildModuleUrl("Widgets/Images/NavigationHelp/TouchRotate.svg")+'" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-tilt">旋转视图</div>                        <div class="cesium-navigation-help-details">双指拖曳,相反方向</div>                    </td>                </tr>            </table>',o.appendChild(h),knockout.applyBindings(i,n),this._container=t,this._viewModel=i,this._wrapper=n,this._closeInstructions=function(e){n.contains(e.target)||(i.showInstructions=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}function PerformanceWatchdogViewModel(e){this._scene=e.scene,this.lowFrameRateMessage=defaultValue(e.lowFrameRateMessage,"This application appears to be performing poorly on your system.  Please try using a different web browser or updating your video drivers."),this.lowFrameRateMessageDismissed=!1,this.showingLowFrameRateMessage=!1,knockout.track(this,["lowFrameRateMessage","lowFrameRateMessageDismissed","showingLowFrameRateMessage"]);var t=this;this._dismissMessage=createCommand$2(function(){t.showingLowFrameRateMessage=!1,t.lowFrameRateMessageDismissed=!0});var i=FrameRateMonitor.fromScene(e.scene);this._unsubscribeLowFrameRate=i.lowFrameRate.addEventListener(function(){t.lowFrameRateMessageDismissed||(t.showingLowFrameRateMessage=!0)}),this._unsubscribeNominalFrameRate=i.nominalFrameRate.addEventListener(function(){t.showingLowFrameRateMessage=!1})}function PerformanceWatchdog(e){var t=getElement(e.container),i=new PerformanceWatchdogViewModel(e),r=document.createElement("div");r.className="cesium-performance-watchdog-message-area",r.setAttribute("data-bind","visible: showingLowFrameRateMessage");var n=document.createElement("button");n.setAttribute("type","button"),n.className="cesium-performance-watchdog-message-dismiss",n.innerHTML="&times;",n.setAttribute("data-bind","click: dismissMessage"),r.appendChild(n);var a=document.createElement("div");a.className="cesium-performance-watchdog-message",a.setAttribute("data-bind","html: lowFrameRateMessage"),r.appendChild(a),t.appendChild(r),knockout.applyBindings(i,r),this._container=t,this._viewModel=i,this._element=r}function ProjectionPickerViewModel(e){this._scene=e,this._orthographic=e.camera.frustum instanceof OrthographicFrustum,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,knockout.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);var n=this;knockout.defineProperty(this,"selectedTooltip",function(){return n._orthographic?n.tooltipOrthographic:n.tooltipPerspective}),this._toggleDropDown=createCommand$2(function(){n.sceneMode===SceneMode$1.SCENE2D||n._flightInProgress||(n.dropDownVisible=!n.dropDownVisible)}),this._eventHelper=new EventHelper,this._eventHelper.add(e.morphComplete,function(e,t,i,r){n.sceneMode=i,n._orthographic=i===SceneMode$1.SCENE2D||n._scene.camera.frustum instanceof OrthographicFrustum}),this._eventHelper.add(e.preRender,function(){n._flightInProgress=defined(e.camera._currentFlight)}),this._switchToPerspective=createCommand$2(function(){n.sceneMode!==SceneMode$1.SCENE2D&&(n._scene.camera.switchToPerspectiveFrustum(),n._orthographic=!1,n.dropDownVisible=!1)}),this._switchToOrthographic=createCommand$2(function(){n.sceneMode!==SceneMode$1.SCENE2D&&(n._scene.camera.switchToOrthographicFrustum(),n._orthographic=!0,n.dropDownVisible=!1)}),this._sceneMode=SceneMode$1}InfoBoxViewModel.prototype.maxHeightOffset=function(e){return this.maxHeight-e+"px"},defineProperties$1(InfoBoxViewModel.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}}),defineProperties$1(InfoBox.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}}),InfoBox.prototype.isDestroyed=function(){return!1},InfoBox.prototype.destroy=function(){var e=this._container;return knockout.cleanNode(this._element),e.removeChild(this._element),defined(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),destroyObject(this)},defineProperties$1(NavigationHelpButtonViewModel.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}}),defineProperties$1(NavigationHelpButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),NavigationHelpButton.prototype.isDestroyed=function(){return!1},NavigationHelpButton.prototype.destroy=function(){return FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),knockout.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),destroyObject(this)},defineProperties$1(PerformanceWatchdogViewModel.prototype,{scene:{get:function(){return this._scene}},dismissMessage:{get:function(){return this._dismissMessage}}}),PerformanceWatchdogViewModel.prototype.destroy=function(){return this._unsubscribeLowFrameRate(),this._unsubscribeNominalFrameRate(),destroyObject(this)},defineProperties$1(PerformanceWatchdog.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),PerformanceWatchdog.prototype.isDestroyed=function(){return!1},PerformanceWatchdog.prototype.destroy=function(){return this._viewModel.destroy(),knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)},defineProperties$1(ProjectionPickerViewModel.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}}}),ProjectionPickerViewModel.prototype.isDestroyed=function(){return!1},ProjectionPickerViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),destroyObject(this)};var perspectivePath="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",orthographicPath="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 ProjectionPicker(e,t){e=getElement(e);var i=new ProjectionPickerViewModel(t);i._perspectivePath=perspectivePath,i._orthographicPath=orthographicPath;var r=document.createElement("span");r.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(r);var n=document.createElement("button");n.type="button",n.className="cesium-button cesium-toolbar-button",n.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'),n.innerHTML='\x3c!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --\x3e\x3c!-- /ko --\x3e\x3c!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --\x3e\x3c!-- /ko --\x3e',r.appendChild(n);var a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",a.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 }'),r.appendChild(a);var o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",o.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 }'),r.appendChild(o),knockout.applyBindings(i,r),this._viewModel=i,this._container=e,this._wrapper=r,this._closeDropDown=function(e){r.contains(e.target)||(i.dropDownVisible=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}function SceneModePickerViewModel(e,t){this._scene=e;var n=this;this._eventHelper=new EventHelper,this._eventHelper.add(e.morphStart,function(e,t,i,r){n.sceneMode=i,n.dropDownVisible=!1}),this._duration=defaultValue(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="二维视图",this.tooltip3D="三维视图",this.tooltipColumbusView="哥伦布视图",knockout.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,knockout.defineProperty(this,"selectedTooltip",function(){var e=n.sceneMode;return e===SceneMode$1.SCENE2D?n.tooltip2D:e===SceneMode$1.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=createCommand$2(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=createCommand$2(function(){e.morphTo2D(n._duration)}),this._morphTo3D=createCommand$2(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=createCommand$2(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=SceneMode$1}defineProperties$1(ProjectionPicker.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),ProjectionPicker.prototype.isDestroyed=function(){return!1},ProjectionPicker.prototype.destroy=function(){return this._viewModel.destroy(),FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),knockout.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),destroyObject(this)},defineProperties$1(SceneModePickerViewModel.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){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}}}),SceneModePickerViewModel.prototype.isDestroyed=function(){return!1},SceneModePickerViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),destroyObject(this)};var globePath="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",flatMapPath="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",columbusViewPath="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 SceneModePicker(e,t,i){e=getElement(e);var r=new SceneModePickerViewModel(t,i);r._globePath=globePath,r._flatMapPath=flatMapPath,r._columbusViewPath=columbusViewPath;var n=document.createElement("span");n.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(n);var a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button",a.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'),a.innerHTML='\x3c!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --\x3e\x3c!-- /ko --\x3e\x3c!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --\x3e\x3c!-- /ko --\x3e\x3c!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --\x3e\x3c!-- /ko --\x3e',n.appendChild(a);var o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",o.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 }'),n.appendChild(o);var 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.SCENE2D)),       "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D,       "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),n.appendChild(s);var 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 }'),n.appendChild(l),knockout.applyBindings(r,n),this._viewModel=r,this._container=e,this._wrapper=n,this._closeDropDown=function(e){n.contains(e.target)||(r.dropDownVisible=!1)},FeatureDetection.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}defineProperties$1(SceneModePicker.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),SceneModePicker.prototype.isDestroyed=function(){return!1},SceneModePicker.prototype.destroy=function(){return this._viewModel.destroy(),FeatureDetection.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),knockout.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),destroyObject(this)};var screenSpacePos=new Cartesian2,offScreen="-1000px";function SelectionIndicatorViewModel(i,e,t){this._scene=i,this._screenPositionX=offScreen,this._screenPositionY=offScreen,this._tweens=i.tweens,this._container=defaultValue(t,document.body),this._selectionIndicatorElement=e,this._scale=1,this.position=void 0,this.showSelection=!1,knockout.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,knockout.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&defined(this.position)}}),knockout.defineProperty(this,"_transform",{get:function(){return"scale("+this._scale+")"}}),this.computeScreenSpacePosition=function(e,t){return SceneTransforms.wgs84ToWindowCoordinates(i,e,t)}}function SelectionIndicator(e,t){e=getElement(e),this._container=e;var i=document.createElement("div");i.className="cesium-selection-wrapper",i.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(i),this._element=i;var r="http://www.w3.org/2000/svg",n=document.createElementNS(r,"svg:svg");n.setAttribute("width",160),n.setAttribute("height",160),n.setAttribute("viewBox","0 0 160 160");var a=document.createElementNS(r,"g");a.setAttribute("transform","translate(80,80)"),n.appendChild(a);var o=document.createElementNS(r,"path");o.setAttribute("data-bind","attr: { transform: _transform }"),o.setAttribute("d","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"),a.appendChild(o),i.appendChild(n);var s=new SelectionIndicatorViewModel(t,this._element,this._container);this._viewModel=s,knockout.applyBindings(this._viewModel,this._element)}function TimelineHighlightRange(e,t,i){this._color=e,this._height=t,this._base=defaultValue(i,0)}function TimelineTrack(e,t,i,r){this.interval=e,this.height=t,this.color=i||new Color(.5,.5,.5,1),this.backgroundColor=r||new Color(0,0,0,0)}SelectionIndicatorViewModel.prototype.update=function(){if(this.showSelection&&defined(this.position)){var e=this.computeScreenSpacePosition(this.position,screenSpacePos);if(defined(e)){var t=this._container,i=t.parentNode.clientWidth,r=t.parentNode.clientHeight,n=this._selectionIndicatorElement.clientWidth,a=.5*n;e.x=Math.min(Math.max(e.x,-n),i+n)-a,e.y=Math.min(Math.max(e.y,-n),r+n)-a,this._screenPositionX=Math.floor(e.x+.25)+"px",this._screenPositionY=Math.floor(e.y+.25)+"px"}else this._screenPositionX=offScreen,this._screenPositionY=offScreen}},SelectionIndicatorViewModel.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:EasingFunction$1.EXPONENTIAL_OUT})},SelectionIndicatorViewModel.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:EasingFunction$1.EXPONENTIAL_OUT})},defineProperties$1(SelectionIndicatorViewModel.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}}),defineProperties$1(SelectionIndicator.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),SelectionIndicator.prototype.isDestroyed=function(){return!1},SelectionIndicator.prototype.destroy=function(){var e=this._container;return knockout.cleanNode(this._element),e.removeChild(this._element),destroyObject(this)},TimelineHighlightRange.prototype.getHeight=function(){return this._height},TimelineHighlightRange.prototype.getBase=function(){return this._base},TimelineHighlightRange.prototype.getStartTime=function(){return this._start},TimelineHighlightRange.prototype.getStopTime=function(){return this._stop},TimelineHighlightRange.prototype.setRange=function(e,t){this._start=e,this._stop=t},TimelineHighlightRange.prototype.render=function(e){var t="";if(this._start&&this._stop&&this._color){var i=JulianDate.secondsDifference(this._start,e.epochJulian),r=Math.round(e.timeBarWidth*e.getAlpha(i)),n=JulianDate.secondsDifference(this._stop,e.epochJulian),a=Math.round(e.timeBarWidth*e.getAlpha(n))-r;r<0&&(a+=r,r=0),r+a>e.timeBarWidth&&(a=e.timeBarWidth-r),0<a&&(t='<span class="cesium-timeline-highlight" style="left: '+r.toString()+"px; width: "+a.toString()+"px; bottom: "+this._base.toString()+"px; height: "+this._height+"px; background-color: "+this._color+';"></span>')}return t},TimelineTrack.prototype.render=function(e,t){var i=this.interval.start,r=this.interval.stop,n=t.startJulian,a=JulianDate.addSeconds(t.startJulian,t.duration,new JulianDate);if(JulianDate.lessThan(i,n)&&JulianDate.greaterThan(r,a))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(JulianDate.lessThanOrEquals(i,a)&&JulianDate.greaterThanOrEquals(r,n)){var o,s,l;for(o=0;o<t.timeBarWidth;++o){var c=JulianDate.addSeconds(t.startJulian,o/t.timeBarWidth*t.duration,new JulianDate);!defined(s)&&JulianDate.greaterThanOrEquals(c,i)?s=o:!defined(l)&&JulianDate.greaterThanOrEquals(c,r)&&(l=o)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),defined(s)&&(defined(l)||(l=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(s,t.y,Math.max(l-s,1),this.height))}};var timelineWheelDelta=1e12,timelineMouseMode={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},timelineTouchMode={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},timelineTicScales=[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];function Timeline(e,t){e=getElement(e),this.container=e;var i=document.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=timelineMouseMode.none,this._touchMode=timelineTouchMode.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=createMouseDownCallback(this),this._onMouseUp=createMouseUpCallback(this),this._onMouseMove=createMouseMoveCallback(this),this._onMouseWheel=createMouseWheelCallback(this),this._onTouchStart=createTouchStartCallback(this),this._onTouchMove=createTouchMoveCallback(this),this._onTouchEnd=createTouchEndCallback(this);var r=this._timeBarEle;document.addEventListener("mouseup",this._onMouseUp,!1),document.addEventListener("mousemove",this._onMouseMove,!1),r.addEventListener("mousedown",this._onMouseDown,!1),r.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),r.addEventListener("mousewheel",this._onMouseWheel,!1),r.addEventListener("touchstart",this._onTouchStart,!1),r.addEventListener("touchmove",this._onTouchMove,!1),r.addEventListener("touchend",this._onTouchEnd,!1),r.addEventListener("touchcancel",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()}function twoDigits(e){return e<10?"0"+e.toString():e.toString()}function createMouseDownCallback(t){return function(e){t._mouseMode!==timelineMouseMode.touchOnly&&(0===e.button?(t._mouseMode=timelineMouseMode.scrub,t._scrubElement&&(t._scrubElement.style.backgroundPosition="-16px 0"),t._onMouseMove(e)):(t._mouseX=e.clientX,2===e.button?t._mouseMode=timelineMouseMode.zoom:t._mouseMode=timelineMouseMode.slide)),e.preventDefault()}}function createMouseUpCallback(t){return function(e){t._mouseMode=timelineMouseMode.none,t._scrubElement&&(t._scrubElement.style.backgroundPosition="0 0"),t._timelineDrag=0,t._timelineDragLocation=void 0}}function createMouseMoveCallback(n){return function(e){var t;if(n._mouseMode===timelineMouseMode.scrub){e.preventDefault();var i=e.clientX-n._topDiv.getBoundingClientRect().left;i<0?(n._timelineDragLocation=0,n._timelineDrag=-.01*n._timeBarSecondsSpan):i>n._topDiv.clientWidth?(n._timelineDragLocation=n._topDiv.clientWidth,n._timelineDrag=.01*n._timeBarSecondsSpan):(n._timelineDragLocation=void 0,n._setTimeBarTime(i,i*n._timeBarSecondsSpan/n._topDiv.clientWidth))}else if(n._mouseMode===timelineMouseMode.slide){if(t=n._mouseX-e.clientX,n._mouseX=e.clientX,0!==t){var r=t*n._timeBarSecondsSpan/n._topDiv.clientWidth;n.zoomTo(JulianDate.addSeconds(n._startJulian,r,new JulianDate),JulianDate.addSeconds(n._endJulian,r,new JulianDate))}}else n._mouseMode===timelineMouseMode.zoom&&(t=n._mouseX-e.clientX,n._mouseX=e.clientX,0!==t&&n.zoomFrom(Math.pow(1.01,t)))}}function createMouseWheelCallback(i){return function(e){var t=e.wheelDeltaY||e.wheelDelta||-e.detail;t/=timelineWheelDelta=Math.max(Math.min(Math.abs(t),timelineWheelDelta),1),i.zoomFrom(Math.pow(1.05,-t))}}function createTouchStartCallback(a){return function(e){var t,i,r=e.touches.length,n=a._topDiv.getBoundingClientRect().left;e.preventDefault(),a._mouseMode=timelineMouseMode.touchOnly,1===r?(t=JulianDate.secondsDifference(a._scrubJulian,a._startJulian),i=Math.round(t*a._topDiv.clientWidth/a._timeBarSecondsSpan+n),Math.abs(e.touches[0].clientX-i)<50?(a._touchMode=timelineTouchMode.scrub,a._scrubElement&&(a._scrubElement.style.backgroundPosition=1===r?"-16px 0":"0 0")):(a._touchMode=timelineTouchMode.singleTap,a._touchState.centerX=e.touches[0].clientX-n)):2===r?(a._touchMode=timelineTouchMode.slideZoom,a._touchState.centerX=.5*(e.touches[0].clientX+e.touches[1].clientX)-n,a._touchState.spanX=Math.abs(e.touches[0].clientX-e.touches[1].clientX)):a._touchMode=timelineTouchMode.ignore}}function createTouchEndCallback(r){return function(e){var t=e.touches.length,i=r._topDiv.getBoundingClientRect().left;r._touchMode===timelineTouchMode.singleTap?(r._touchMode=timelineTouchMode.scrub,r._onTouchMove(e)):r._touchMode===timelineTouchMode.scrub&&r._onTouchMove(e),r._mouseMode=timelineMouseMode.touchOnly,1!==t?r._touchMode=0<t?timelineTouchMode.ignore:timelineTouchMode.none:r._touchMode===timelineTouchMode.slideZoom&&(r._touchState.centerX=e.touches[0].clientX-i),r._scrubElement&&(r._scrubElement.style.backgroundPosition="0 0")}}function createTouchMoveCallback(c){return function(e){var t,i,r,n,a,o,s=1,l=c._topDiv.getBoundingClientRect().left;c._touchMode===timelineTouchMode.singleTap&&(c._touchMode=timelineTouchMode.slideZoom),c._mouseMode=timelineMouseMode.touchOnly,c._touchMode===timelineTouchMode.scrub?(e.preventDefault(),1===e.changedTouches.length&&0<=(i=e.changedTouches[0].clientX-l)&&i<=c._topDiv.clientWidth&&c._setTimeBarTime(i,i*c._timeBarSecondsSpan/c._topDiv.clientWidth)):c._touchMode===timelineTouchMode.slideZoom&&(2===(r=e.touches.length)?(n=.5*(e.touches[0].clientX+e.touches[1].clientX)-l,a=Math.abs(e.touches[0].clientX-e.touches[1].clientX)):1===r&&(n=e.touches[0].clientX-l,a=0),defined(n)&&(o=0<a&&0<c._touchState.spanX?(s=c._touchState.spanX/a,JulianDate.addSeconds(c._startJulian,(c._touchState.centerX*c._timeBarSecondsSpan-n*c._timeBarSecondsSpan*s)/c._topDiv.clientWidth,new JulianDate)):(t=c._touchState.centerX-n,JulianDate.addSeconds(c._startJulian,t*c._timeBarSecondsSpan/c._topDiv.clientWidth,new JulianDate)),c.zoomTo(o,JulianDate.addSeconds(o,c._timeBarSecondsSpan*s,new JulianDate)),c._touchState.centerX=n,c._touchState.spanX=a))}}function lockScreen(e){var t=!1,i=window.screen;return defined(i)&&(defined(i.lockOrientation)?t=i.lockOrientation(e):defined(i.mozLockOrientation)?t=i.mozLockOrientation(e):defined(i.msLockOrientation)?t=i.msLockOrientation(e):defined(i.orientation&&i.orientation.lock)&&(t=i.orientation.lock(e))),t}function unlockScreen(){var e=window.screen;defined(e)&&(defined(e.unlockOrientation)?e.unlockOrientation():defined(e.mozUnlockOrientation)?e.mozUnlockOrientation():defined(e.msUnlockOrientation)?e.msUnlockOrientation():defined(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function toggleVR(e,t,i,r){r()||(i()?(t.useWebVR=!1,e._locked&&(unlockScreen(),e._locked=!1),e._noSleep.disable(),Fullscreen.exitFullscreen(),i(!1)):(Fullscreen.fullscreen||Fullscreen.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=lockScreen("landscape")),i(t.useWebVR=!0)))}function VRButtonViewModel(e,t){var i=this,r=knockout.observable(Fullscreen.enabled),n=knockout.observable(!1);this.isVRMode=void 0,knockout.defineProperty(this,"isVRMode",{get:function(){return n()}}),this.isVREnabled=void 0,knockout.defineProperty(this,"isVREnabled",{get:function(){return r()},set:function(e){r(e&&Fullscreen.enabled)}}),this.tooltip=void 0,knockout.defineProperty(this,"tooltip",function(){return r()?n()?"退出VR模式":"进入VR模式":"VR mode is unavailable"});var a=knockout.observable(!1);this._isOrthographic=void 0,knockout.defineProperty(this,"_isOrthographic",{get:function(){return a()}}),this._eventHelper=new EventHelper,this._eventHelper.add(e.preRender,function(){a(e.camera.frustum instanceof OrthographicFrustum)}),this._locked=!1,this._noSleep=new NoSleep,this._command=createCommand$2(function(){toggleVR(i,e,n,a)},knockout.getObservable(this,"isVREnabled")),this._vrElement=defaultValue(getElement(t),document.body),this._callback=function(){!Fullscreen.fullscreen&&n()&&(e.useWebVR=!1,i._locked&&(unlockScreen(),i._locked=!1),i._noSleep.disable(),n(!1))},document.addEventListener(Fullscreen.changeEventName,this._callback)}Timeline.prototype.addEventListener=function(e,t,i){this._topDiv.addEventListener(e,t,i)},Timeline.prototype.removeEventListener=function(e,t,i){this._topDiv.removeEventListener(e,t,i)},Timeline.prototype.isDestroyed=function(){return!1},Timeline.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this),document.removeEventListener("mouseup",this._onMouseUp,!1),document.removeEventListener("mousemove",this._onMouseMove,!1);var e=this._timeBarEle;e.removeEventListener("mousedown",this._onMouseDown,!1),e.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),e.removeEventListener("mousewheel",this._onMouseWheel,!1),e.removeEventListener("touchstart",this._onTouchStart,!1),e.removeEventListener("touchmove",this._onTouchMove,!1),e.removeEventListener("touchend",this._onTouchEnd,!1),e.removeEventListener("touchcancel",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),destroyObject(this)},Timeline.prototype.addHighlightRange=function(e,t,i){var r=new TimelineHighlightRange(e,t,i);return this._highlightRanges.push(r),this.resize(),r},Timeline.prototype.addTrack=function(e,t,i,r){var n=new TimelineTrack(e,t,i,r);return this._trackList.push(n),this._lastHeight=void 0,this.resize(),n},Timeline.prototype.zoomTo=function(e,t){if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=JulianDate.secondsDifference(t,e),this._clock&&this._clock.clockRange!==ClockRange$1.UNBOUNDED){var i=this._clock.startTime,r=this._clock.stopTime,n=JulianDate.secondsDifference(r,i),a=JulianDate.secondsDifference(i,this._startJulian),o=JulianDate.secondsDifference(r,this._endJulian);this._timeBarSecondsSpan>=n?(this._timeBarSecondsSpan=n,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):0<a?(this._endJulian=JulianDate.addSeconds(this._endJulian,a,new JulianDate),this._startJulian=i,this._timeBarSecondsSpan=JulianDate.secondsDifference(this._endJulian,this._startJulian)):o<0&&(this._startJulian=JulianDate.addSeconds(this._startJulian,o,new JulianDate),this._endJulian=r,this._timeBarSecondsSpan=JulianDate.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();var s=document.createEvent("Event");s.initEvent("setzoom",!0,!0),s.startJulian=this._startJulian,s.endJulian=this._endJulian,s.epochJulian=this._epochJulian,s.totalSpan=this._timeBarSecondsSpan,s.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(s)},Timeline.prototype.zoomFrom=function(e){var t=JulianDate.secondsDifference(this._scrubJulian,this._startJulian);1<e||t<0||t>this._timeBarSecondsSpan?t=.5*this._timeBarSecondsSpan:t+=t-.5*this._timeBarSecondsSpan;var i=this._timeBarSecondsSpan-t;this.zoomTo(JulianDate.addSeconds(this._startJulian,t-t*e,new JulianDate),JulianDate.addSeconds(this._endJulian,i*e-i,new JulianDate))},Timeline.prototype.makeLabel=function(e){var t=JulianDate.toDate(e);return t.getFullYear()+"年"+(t.getMonth()+1)+"月"+t.getDate()+"日"+twoDigits(t.getHours())+":"+twoDigits(t.getMinutes())+":"+twoDigits(t.getSeconds())},Timeline.prototype.smallestTicInPixels=7,Timeline.prototype._makeTics=function(){var e,t=this._timeBarEle,i=JulianDate.secondsDifference(this._scrubJulian,this._startJulian),r=Math.round(i*this._topDiv.clientWidth/this._timeBarSecondsSpan),n=r-8,a=this;this._needleEle.style.left=r.toString()+"px";var o="",s=31536e6,l=0,c=this._timeBarSecondsSpan;c<.01?(c=.01,this._timeBarSecondsSpan=.01,this._endJulian=JulianDate.addSeconds(this._startJulian,.01,new JulianDate)):s<c&&(c=s,this._timeBarSecondsSpan=s,this._endJulian=JulianDate.addSeconds(this._startJulian,s,new JulianDate));var u=this._timeBarEle.clientWidth;u<10&&(u=10);var d,h=this._startJulian,p=Math.min(c/u*1e-5,.4),m=JulianDate.toGregorianDate(h);d=31536e4<c?JulianDate.fromDate(new Date(Date.UTC(100*Math.floor(m.year/100),0))):31536e3<c?JulianDate.fromDate(new Date(Date.UTC(10*Math.floor(m.year/10),0))):86400<c?JulianDate.fromDate(new Date(Date.UTC(m.year,0))):JulianDate.fromDate(new Date(Date.UTC(m.year,m.month,m.day)));var f=JulianDate.secondsDifference(this._startJulian,JulianDate.addSeconds(d,p,new JulianDate)),g=f+c;function _(e){return Math.floor(f/e)*e}function y(e,t){return Math.ceil(e/t+.5)*t}function v(e){return(e-f)/c}function C(e,t){return e-t*Math.round(e/t)}this._epochJulian=d,this._rulerEle.innerHTML=this.makeLabel(JulianDate.addSeconds(this._endJulian,-.01,new JulianDate));var S=this._rulerEle.offsetWidth+20;S<30&&(S=180);var x=l;l-=1e-10;var T={startTime:f,startJulian:h,epochJulian:d,duration:c,timeBarWidth:u,getAlpha:v};this._highlightRanges.forEach(function(e){o+=e.render(T)});var b=0,E=0,P=0,A=S/u;1<A&&(A=1),A*=this._timeBarSecondsSpan;var w,D=-1,M=-1,I=timelineTicScales.length;for(w=0;w<I;++w){var R=timelineTicScales[w];if(++D,A<(b=R)&&l<R)break;M<0&&u*(R/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(M=D)}if(0<D){for(;0<D;)if(--D,Math.abs(C(b,timelineTicScales[D]))<1e-5){timelineTicScales[D]>=l&&(E=timelineTicScales[D]);break}if(0<=M)for(;M<D;){if(Math.abs(C(E,timelineTicScales[M]))<1e-5&&timelineTicScales[M]>=l){P=timelineTicScales[M];break}++M}}1e-10<(l=x)&&P<1e-5&&1e-10<Math.abs(l-b)&&(P=l)<=b+1e-10&&(E=0);var O,L=-999999;if(3<=u*(P/this._timeBarSecondsSpan))for(e=_(P);e<=g;e=y(e,P))o+='<span class="cesium-timeline-ticTiny" style="left: '+Math.round(u*v(e)).toString()+'px;"></span>';if(3<=u*(E/this._timeBarSecondsSpan))for(e=_(E);e<=g;e=y(e,E))o+='<span class="cesium-timeline-ticSub" style="left: '+Math.round(u*v(e)).toString()+'px;"></span>';if(2<=u*(b/this._timeBarSecondsSpan)){g+=this._mainTicSpan=b,e=_(b);for(var F=JulianDate.computeTaiMinusUtc(d);e<=g;){var N=JulianDate.addSeconds(h,e-f,new JulianDate);if(2.1<b){var B=JulianDate.computeTaiMinusUtc(N);.1<Math.abs(B-F)&&(e+=B-F,N=JulianDate.addSeconds(h,e-f,new JulianDate))}var V=Math.round(u*v(e)),k=this.makeLabel(N);this._rulerEle.innerHTML=k,(O=this._rulerEle.offsetWidth)<10&&(O=S);var $=V-(O/2-1);L<$?(L=$+O+5,o+='<span class="cesium-timeline-ticMain" style="left: '+V.toString()+'px;"></span><span class="cesium-timeline-ticLabel" style="left: '+$.toString()+'px;">'+k+"</span>"):o+='<span class="cesium-timeline-ticSub" style="left: '+V.toString()+'px;"></span>',e=y(e,b)}}else this._mainTicSpan=-1;o+='<span class="cesium-timeline-icon16" style="left:'+n+'px;bottom:0;background-position: 0 0;"></span>',t.innerHTML=o,this._scrubElement=t.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),T.y=0,this._trackList.forEach(function(e){e.render(a._context,T),T.y+=e.height})},Timeline.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;var e=this._scrubElement;if(defined(this._scrubElement)){var t=JulianDate.secondsDifference(this._scrubJulian,this._startJulian),i=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==i&&(this._lastXPos=i,e.style.left=i-8+"px",this._needleEle.style.left=i+"px")}defined(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(JulianDate.addSeconds(this._startJulian,this._timelineDrag,new JulianDate),JulianDate.addSeconds(this._endJulian,this._timelineDrag,new JulianDate)))},Timeline.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=JulianDate.addSeconds(this._startJulian,t,new JulianDate),this._scrubElement){var i=e-8;this._scrubElement.style.left=i.toString()+"px",this._needleEle.style.left=e.toString()+"px"}var r=document.createEvent("Event");r.initEvent("settime",!0,!0),r.clientX=e,r.timeSeconds=t,r.timeJulian=this._scrubJulian,r.clock=this._clock,this._topDiv.dispatchEvent(r)},Timeline.prototype.resize=function(){var e=this.container.clientWidth,t=this.container.clientHeight;if(e!==this._lastWidth||t!==this._lastHeight){this._trackContainer.style.height=t+"px";var i=1;this._trackList.forEach(function(e){i+=e.height}),this._trackListEle.style.height=i.toString()+"px",this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=i,this._makeTics(),this._lastXPos=void 0,this._lastWidth=e,this._lastHeight=t}},defineProperties$1(VRButtonViewModel.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){this._vrElement=e}},command:{get:function(){return this._command}}}),VRButtonViewModel.prototype.isDestroyed=function(){return!1},VRButtonViewModel.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(Fullscreen.changeEventName,this._callback),destroyObject(this)};var enterVRPath="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",exitVRPath="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 VRButton(e,t,i){e=getElement(e);var r=new VRButtonViewModel(t,i);r._exitVRPath=exitVRPath,r._enterVRPath=enterVRPath;var n=document.createElement("button");n.type="button",n.className="cesium-button cesium-vrButton",n.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(n),knockout.applyBindings(r,n),this._container=e,this._viewModel=r,this._element=n}defineProperties$1(VRButton.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),VRButton.prototype.isDestroyed=function(){return!1},VRButton.prototype.destroy=function(){return this._viewModel.destroy(),knockout.cleanNode(this._element),this._container.removeChild(this._element),destroyObject(this)};var boundingSphereScratch$2=new BoundingSphere;function onTimelineScrubfunction(e){var t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function pickEntity(e,t){var i=e.scene.pick(t.position);if(defined(i)){var r=defaultValue(i.id,i.primitive.id);if(r instanceof Entity)return r}if(defined(e.scene.globe))return pickImageryLayerFeature(e,t.position)}function trackDataSourceClock(e,t,i){if(defined(i)){var r=i.clock;defined(r)&&(r.getValue(t),defined(e)&&(e.updateFromClock(),e.zoomTo(r.startTime,r.stopTime)))}}var cartesian3Scratch$3=new Cartesian3;function pickImageryLayerFeature(n,e){var t=n.scene,i=t.camera.getPickRay(e),r=t.imageryLayers.pickImageryLayerFeatures(i,t);if(defined(r)){var a=new Entity({id:"Loading...",description:"Loading feature information..."});return when(r,function(e){if(n.selectedEntity===a)if(defined(e)&&0!==e.length){var t=e[0],i=new Entity({id:t.name,description:t.description});if(defined(t.position)){var r=n.scene.globe.ellipsoid.cartographicToCartesian(t.position,cartesian3Scratch$3);i.position=new ConstantPositionProperty(r)}n.selectedEntity=i}else n.selectedEntity=createNoFeaturesEntity()},function(){n.selectedEntity===a&&(n.selectedEntity=createNoFeaturesEntity())}),a}}function createNoFeaturesEntity(){return new Entity({id:"None",description:"No features found."})}function enableVRUI(e,t){var i=e._geocoder,r=e._homeButton,n=e._sceneModePicker,a=e._projectionPicker,o=e._baseLayerPicker,s=e._animation,l=e._timeline,c=e._fullscreenButton,u=e._infoBox,d=e._selectionIndicator,h=t?"hidden":"visible";defined(i)&&(i.container.style.visibility=h),defined(r)&&(r.container.style.visibility=h),defined(n)&&(n.container.style.visibility=h),defined(a)&&(a.container.style.visibility=h),defined(o)&&(o.container.style.visibility=h),defined(s)&&(s.container.style.visibility=h),defined(l)&&(l.container.style.visibility=h),defined(c)&&c.viewModel.isFullscreenEnabled&&(c.container.style.visibility=h),defined(u)&&(u.container.style.visibility=h),defined(d)&&(d.container.style.visibility=h),e._container&&e.forceResize()}function Viewer(e,t){e=getElement(e);var i=!(defined((t=defaultValue(t,defaultValue.EMPTY_OBJECT)).globe)&&!1===t.globe||defined(t.baseLayerPicker)&&!1===t.baseLayerPicker),r=this,n=document.createElement("div");n.className="cesium-viewer",e.appendChild(n);var a=document.createElement("div");a.className="cesium-viewer-cesiumWidgetContainer",n.appendChild(a);var o=document.createElement("div");o.className="cesium-viewer-bottom",n.appendChild(o);var s,l,c=defaultValue(t.scene3DOnly,!1),u=!1;defined(t.clockViewModel)?s=(l=t.clockViewModel).clock:(l=new ClockViewModel(s=new Clock),u=!0),defined(t.shouldAnimate)&&(s.shouldAnimate=t.shouldAnimate);var d=new CesiumWidget(a,{imageryProvider:!i&&!defined(t.imageryProvider)&&void 0,clock:s,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:defined(t.creditContainer)?t.creditContainer:o,creditViewport:t.creditViewport,scene3DOnly:c,terrainExaggeration:t.terrainExaggeration,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange}),h=t.dataSources,p=!1;defined(h)||(h=new DataSourceCollection,p=!0);var m,f,g=d.scene,_=new DataSourceDisplay({scene:g,dataSourceCollection:h}),y=new EventHelper;if(y.add(s.onTick,Viewer.prototype._onTick,this),y.add(g.morphStart,Viewer.prototype._clearTrackedObject,this),!defined(t.selectionIndicator)||!1!==t.selectionIndicator){var v=document.createElement("div");v.className="cesium-viewer-selectionIndicatorContainer",n.appendChild(v),m=new SelectionIndicator(v,g)}if(!defined(t.infoBox)||!1!==t.infoBox){var C=document.createElement("div");C.className="cesium-viewer-infoBoxContainer",n.appendChild(C);var S=(f=new InfoBox(C)).viewModel;y.add(S.cameraClicked,Viewer.prototype._onInfoBoxCameraClicked,this),y.add(S.closeClicked,Viewer.prototype._onInfoBoxClockClicked,this)}var x,T,b,E,P,A,w,D,M,I,R,O,L,F,N,B=document.createElement("div");if(B.className="cesium-viewer-toolbar",n.appendChild(B),!defined(t.geocoder)||!1!==t.geocoder){var V,k=document.createElement("div");k.className="cesium-viewer-geocoderContainer",B.appendChild(k),defined(t.geocoder)&&"boolean"!=typeof t.geocoder&&(V=isArray$1(t.geocoder)?t.geocoder:[t.geocoder]),x=new Geocoder({container:k,geocoderServices:V,scene:g}),y.add(x.viewModel.search.beforeExecute,Viewer.prototype._clearObjects,this)}if(defined(t.homeButton)&&!1===t.homeButton||(T=new HomeButton(B,g),defined(x)&&y.add(T.viewModel.command.afterExecute,function(){var e=x.viewModel;e.searchText="",e.isSearchInProgress&&e.search()}),y.add(T.viewModel.command.beforeExecute,Viewer.prototype._clearTrackedObject,this)),c||defined(t.sceneModePicker)&&!1===t.sceneModePicker||(b=new SceneModePicker(B,g)),t.projectionPicker&&(E=new ProjectionPicker(B,g)),i){var $=defaultValue(t.imageryProviderViewModels,createDefaultImageryProviderViewModels()),z=defaultValue(t.terrainProviderViewModels,createDefaultTerrainProviderViewModels());P=new BaseLayerPicker(B,{globe:g.globe,imageryProviderViewModels:$,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:z,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),A=B.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}if(defined(t.imageryProvider)&&!1!==t.imageryProvider&&(i&&(P.viewModel.selectedImagery=void 0),g.imageryLayers.removeAll(),g.imageryLayers.addImageryProvider(t.imageryProvider)),defined(t.terrainProvider)&&(i&&(P.viewModel.selectedTerrain=void 0),g.terrainProvider=t.terrainProvider),!defined(t.animation)||!1!==t.animation){var U=document.createElement("div");U.className="cesium-viewer-animationContainer",n.appendChild(U),w=new Animation(U,new AnimationViewModel(l))}if(!defined(t.timeline)||!1!==t.timeline){var G=document.createElement("div");G.className="cesium-viewer-timelineContainer",n.appendChild(G),(D=new Timeline(G,s)).addEventListener("settime",onTimelineScrubfunction,!1),D.zoomTo(s.startTime,s.stopTime)}if(defined(t.fullscreenButton)&&!1===t.fullscreenButton||((R=document.createElement("div")).className="cesium-button cesium-toolbar-button ",B.appendChild(R),I=subscribeAndEvaluate((M=new FullscreenButton(R,t.fullscreenElement)).viewModel,"isFullscreenEnabled",function(e){R.style.display=e?"inline-block":"none"})),t.vrButton){var H=document.createElement("div");H.className="cesium-button cesium-toolbar-button ",B.appendChild(H),L=subscribeAndEvaluate((O=new VRButton(H,g,t.fullScreenElement)).viewModel,"isVREnabled",function(e){H.style.display=e?"inline-block":"none"}),F=subscribeAndEvaluate(O.viewModel,"isVRMode",function(e){enableVRUI(r,e)})}if(!defined(t.navigationHelpButton)||!1!==t.navigationHelpButton){var W=!0;try{if(defined(window.localStorage)){var q=window.localStorage.getItem("cesium-hasSeenNavHelp");defined(q)&&Boolean(q)?W=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch(e){}N=new NavigationHelpButton({container:B,instructionsInitiallyVisible:defaultValue(t.navigationInstructionsInitiallyVisible,W)})}this._baseLayerPickerDropDown=A,this._fullscreenSubscription=I,this._vrSubscription=L,this._vrModeSubscription=F,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=defaultValue(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=o,this._element=n,this._cesiumWidget=d,this._selectionIndicator=m,this._infoBox=f,this._dataSourceCollection=h,this._destroyDataSourceCollection=p,this._dataSourceDisplay=_,this._clockViewModel=l,this._destroyClockViewModel=u,this._toolbar=B,this._homeButton=T,this._sceneModePicker=b,this._projectionPicker=E,this._baseLayerPicker=P,this._navigationHelpButton=N,this._animation=w,this._timeline=D,this._fullscreenButton=M,this._vrButton=O,this._geocoder=x,this._eventHelper=y,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=defined(f)||defined(m),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._clockTrackedDataSource=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new Event,this._trackedEntityChanged=new Event,knockout.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),y.add(h.dataSourceAdded,Viewer.prototype._onDataSourceAdded,this),y.add(h.dataSourceRemoved,Viewer.prototype._onDataSourceRemoved,this),y.add(g.postUpdate,Viewer.prototype.resize,this),y.add(g.postRender,Viewer.prototype._postRender,this);for(var j=h.length,Y=0;Y<j;Y++)this._dataSourceAdded(h,h.get(Y));this._dataSourceAdded(void 0,_.defaultDataSource),y.add(h.dataSourceAdded,Viewer.prototype._dataSourceAdded,this),y.add(h.dataSourceRemoved,Viewer.prototype._dataSourceRemoved,this),d.screenSpaceEventHandler.setInputAction(function(e){r.selectedEntity=pickEntity(r,e)},ScreenSpaceEventType$1.LEFT_CLICK),d.screenSpaceEventHandler.setInputAction(function(e){var t=pickEntity(r,e);defined(t)?Property.getValueOrUndefined(t.position,r.clock.currentTime)?r.trackedEntity=t:r.zoomTo(t):defined(r.trackedEntity)&&(r.trackedEntity=void 0)},ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK)}function zoomToOrFly(i,e,t,r){cancelZoom(i);var n=when.defer();return i._zoomPromise=n,i._zoomIsFlight=r,i._zoomOptions=t,when(e,function(e){if(i._zoomPromise===n)if(e instanceof ImageryLayer)e.getViewableRectangle().then(function(e){return computeFlyToLocationForRectangle(e,i.scene)}).then(function(e){i._zoomPromise===n&&(i._zoomTarget=e)});else if(e instanceof Cesium3DTileset)i._zoomTarget=e;else if(e instanceof TimeDynamicPointCloud)i._zoomTarget=e;else if(e.isLoading&&defined(e.loadingEvent))var t=e.loadingEvent.addEventListener(function(){t(),i._zoomPromise===n&&(i._zoomTarget=e.entities.values.slice(0))});else isArray$1(e)?i._zoomTarget=e.slice(0):(defined((e=defaultValue(e.values,e)).entities)&&(e=e.entities.values),isArray$1(e)?i._zoomTarget=e.slice(0):i._zoomTarget=[e])}),i.scene.requestRender(),n.promise}function clearZoom(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function cancelZoom(e){var t=e._zoomPromise;defined(t)&&(clearZoom(e),t.resolve(!1))}function updateZoomTarget(t){var i=t._zoomTarget;if(defined(i)&&t.scene.mode!==SceneMode$1.MORPHING){var r,e,n=t.scene,a=n.camera,o=t._zoomPromise,s=defaultValue(t._zoomOptions,{});if(i instanceof Cesium3DTileset)return i.readyPromise.then(function(){var e=i.boundingSphere;defined(s.offset)||(s.offset=new HeadingPitchRange(0,-.5,e.radius)),r={offset:s.offset,duration:s.duration,maximumHeight:s.maximumHeight,complete:function(){o.resolve(!0)},cancel:function(){o.resolve(!1)}},t._zoomIsFlight?a.flyToBoundingSphere(i.boundingSphere,r):(a.viewBoundingSphere(e,s.offset),a.lookAtTransform(Matrix4.IDENTITY),o.resolve(!0)),clearZoom(t)});if(i instanceof TimeDynamicPointCloud)return i.readyPromise.then(function(){var e=i.boundingSphere;defined(s.offset)||(s.offset=new HeadingPitchRange(0,-.5,e.radius)),r={offset:s.offset,duration:s.duration,maximumHeight:s.maximumHeight,complete:function(){o.resolve(!0)},cancel:function(){o.resolve(!1)}},t._zoomIsFlight?a.flyToBoundingSphere(e,r):(a.viewBoundingSphere(e,s.offset),a.lookAtTransform(Matrix4.IDENTITY),o.resolve(!0)),clearZoom(t)});if(i instanceof Cartographic)return r={destination:n.mapProjection.ellipsoid.cartographicToCartesian(i),duration:s.duration,maximumHeight:s.maximumHeight,complete:function(){o.resolve(!0)},cancel:function(){o.resolve(!1)}},t._zoomIsFlight?a.flyTo(r):(a.setView(r),o.resolve(!0)),void clearZoom(t);for(var l=i,c=[],u=0,d=l.length;u<d;u++){var h=t._dataSourceDisplay.getBoundingSphere(l[u],!1,boundingSphereScratch$2);if(h===BoundingSphereState$1.PENDING)return;h!==BoundingSphereState$1.FAILED&&c.push(BoundingSphere.clone(boundingSphereScratch$2))}0!==c.length?(t.trackedEntity=void 0,e=BoundingSphere.fromBoundingSpheres(c),t._zoomIsFlight?(clearZoom(t),a.flyToBoundingSphere(e,{duration:s.duration,maximumHeight:s.maximumHeight,complete:function(){o.resolve(!0)},cancel:function(){o.resolve(!1)},offset:s.offset})):(a.viewBoundingSphere(e,s.offset),a.lookAtTransform(Matrix4.IDENTITY),clearZoom(t),o.resolve(!0))):cancelZoom(t)}}function updateTrackedEntity(e){if(e._needTrackedEntityUpdate){var t=e._trackedEntity,i=e.clock.currentTime;if(defined(Property.getValueOrUndefined(t.position,i))){var r=e.scene,n=e._dataSourceDisplay.getBoundingSphere(t,!1,boundingSphereScratch$2);if(n!==BoundingSphereState$1.PENDING){var a=r.mode;a!==SceneMode$1.COLUMBUS_VIEW&&a!==SceneMode$1.SCENE2D||(r.screenSpaceCameraController.enableTranslate=!1),a!==SceneMode$1.COLUMBUS_VIEW&&a!==SceneMode$1.SCENE3D||(r.screenSpaceCameraController.enableTilt=!1);var o=n!==BoundingSphereState$1.FAILED?boundingSphereScratch$2:void 0;e._entityView=new EntityView(t,r,r.mapProjection.ellipsoid),e._entityView.update(i,o),e._needTrackedEntityUpdate=!1}}}}function viewerCesium3DTilesInspectorMixin(e){var t=document.createElement("div");t.className="cesium-viewer-cesium3DTilesInspectorContainer",e.container.appendChild(t);var i=new Cesium3DTilesInspector(t,e.scene);defineProperties$1(e,{cesium3DTilesInspector:{get:function(){return i}}})}function viewerCesiumInspectorMixin(e){var t=document.createElement("div");t.className="cesium-viewer-cesiumInspectorContainer",e.container.appendChild(t);var i=new CesiumInspector(t,e.scene);defineProperties$1(e,{cesiumInspector:{get:function(){return i}}})}function viewerDragDropMixin(o,e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);var t=!0,i=defaultValue(e.flyToOnDrop,!0),r=new Event,s=defaultValue(e.clearOnDrop,!0),n=defaultValue(e.dropTarget,o.container),l=defaultValue(e.clampToGround,!0),c=e.proxy;function a(e){stop(e),s&&(o.entities.removeAll(),o.dataSources.removeAll());for(var t=e.dataTransfer.files,i=t.length,r=0;r<i;r++){var n=t[r],a=new FileReader;a.onload=createOnLoadCallback(o,n,c,l),a.onerror=createDropErrorCallback(o,n),a.readAsText(n)}}n=getElement(n),defineProperties$1(o,{dropTarget:{get:function(){return n},set:function(e){unsubscribe(n,a),subscribe(n=e,a)}},dropEnabled:{get:function(){return t},set:function(e){e!==t&&(e?subscribe(n,a):unsubscribe(n,a),t=e)}},dropError:{get:function(){return r}},clearOnDrop:{get:function(){return s},set:function(e){s=e}},flyToOnDrop:{get:function(){return i},set:function(e){i=e}},proxy:{get:function(){return c},set:function(e){c=e}},clampToGround:{get:function(){return l},set:function(e){l=e}}}),subscribe(n,a),o.destroy=wrapFunction(o,o.destroy,function(){o.dropEnabled=!1}),o._handleDrop=a}function stop(e){e.stopPropagation(),e.preventDefault()}function unsubscribe(e,t){var i=e;defined(i)&&(i.removeEventListener("drop",t,!1),i.removeEventListener("dragenter",stop,!1),i.removeEventListener("dragover",stop,!1),i.removeEventListener("dragexit",stop,!1))}function subscribe(e,t){e.addEventListener("drop",t,!1),e.addEventListener("dragenter",stop,!1),e.addEventListener("dragover",stop,!1),e.addEventListener("dragexit",stop,!1)}function createOnLoadCallback(r,n,a,o){var s=r.scene;return function(e){var t=n.name;try{var i;if(/\.czml$/i.test(t))i=CzmlDataSource.load(JSON.parse(e.target.result),{sourceUri:t});else if(/\.geojson$/i.test(t)||/\.json$/i.test(t)||/\.topojson$/i.test(t))i=GeoJsonDataSource.load(JSON.parse(e.target.result),{sourceUri:t,clampToGround:o});else{if(!/\.(kml|kmz)$/i.test(t))return void r.dropError.raiseEvent(r,t,"Unrecognized file: "+t);i=KmlDataSource.load(n,{sourceUri:t,proxy:a,camera:s.camera,canvas:s.canvas,clampToGround:o})}defined(i)&&r.dataSources.add(i).then(function(e){r.flyToOnDrop&&r.flyTo(e)}).otherwise(function(e){r.dropError.raiseEvent(r,t,e)})}catch(e){r.dropError.raiseEvent(r,t,e)}}}function createDropErrorCallback(t,i){return function(e){t.dropError.raiseEvent(t,i.name,e.target.error)}}function viewerPerformanceWatchdogMixin(e,t){t=defaultValue(t,defaultValue.EMPTY_OBJECT);var i=new PerformanceWatchdog({scene:e.scene,container:e.bottomContainer,lowFrameRateMessage:t.lowFrameRateMessage});defineProperties$1(e,{performanceWatchdog:{get:function(){return i}}})}function callAndWrap(e,t,i){try{return e(t,i)}catch(e){return when.reject(e)}}function createTaskProcessorWorker(n){var a;return function(e){var t=e.data,i=[],r={id:t.id,result:void 0,error:void 0};return when(callAndWrap(n,t.parameters,i)).then(function(e){r.result=e}).otherwise(function(e){e instanceof Error?r.error={name:e.name,message:e.message,stack:e.stack}:r.error=e}).always(function(){defined(a)||(a=defaultValue(self.webkitPostMessage,self.postMessage)),t.canTransferArrayBuffer||(i.length=0);try{a(r,i)}catch(e){r.result=void 0,r.error="postMessage failed with error: "+formatError(e)+"\n  with responseMessage: "+JSON.stringify(r),a(r)}})}}defineProperties$1(Viewer.prototype,{container:{get:function(){return this._container}},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,cancelZoom(this);var t=this.scene,i=t.mode;defined(e)&&defined(e.position)?this._needTrackedEntityUpdate=!0:(this._needTrackedEntityUpdate=!1,i!==SceneMode$1.COLUMBUS_VIEW&&i!==SceneMode$1.SCENE2D||(t.screenSpaceCameraController.enableTranslate=!0),i!==SceneMode$1.COLUMBUS_VIEW&&i!==SceneMode$1.SCENE3D||(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(Matrix4.IDENTITY)),this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;var t=defined(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;defined(e)?defined(t)&&t.animateAppear():defined(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,trackDataSourceClock(this._timeline,this.clock,e))}}}),Viewer.prototype.extend=function(e,t){e(this,t)},Viewer.prototype.resize=function(){var e=this._cesiumWidget,t=this._container,i=t.clientWidth,r=t.clientHeight,n=defined(this._animation),a=defined(this._timeline);if(e.resize(),i!==this._lastWidth||r!==this._lastHeight){var o=r-125,s=this._baseLayerPickerDropDown;if(defined(s)&&(s.style.maxHeight=o+"px"),defined(this._geocoder))this._geocoder.searchSuggestionsContainer.style.maxHeight=o+"px";defined(this._infoBox)&&(this._infoBox.viewModel.maxHeight=o);var l,c=this._timeline,u=0,d=0,h=0;if(n&&"hidden"!==window.getComputedStyle(this._animation.container).visibility){var p=this._lastWidth;l=this._animation.container,900<i?(u=169,p<=900&&(l.style.width="169px",l.style.height="112px",this._animation.resize())):600<=i?(u=136,(p<600||900<p)&&(l.style.width="136px",l.style.height="90px",this._animation.resize())):(u=106,(600<p||0===p)&&(l.style.width="106px",l.style.height="70px",this._animation.resize())),d=u+5}if(a&&"hidden"!==window.getComputedStyle(this._timeline.container).visibility){this._fullscreenButton,this._vrButton;var m=c.container,f=m.style;h=m.clientHeight+3,f.left=u+"px";f.right="0px",c.resize()}this._bottomContainer.style.left=d+"px",this._bottomContainer.style.bottom=h+"px",this._lastWidth=i,this._lastHeight=r}},Viewer.prototype.forceResize=function(){this._lastWidth=0,this.resize()},Viewer.prototype.render=function(){this._cesiumWidget.render()},Viewer.prototype.isDestroyed=function(){return!1},Viewer.prototype.destroy=function(){var e;this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType$1.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType$1.LEFT_DOUBLE_CLICK);var t=this.dataSources,i=t.length;for(e=0;e<i;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(),defined(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),defined(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),defined(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),defined(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),defined(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),defined(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),defined(this._timeline)&&(this._timeline.removeEventListener("settime",onTimelineScrubfunction,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),defined(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),defined(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),defined(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),defined(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()),destroyObject(this)},Viewer.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(Viewer.prototype._onEntityCollectionChanged,this)},Viewer.prototype._dataSourceRemoved=function(e,t){var i=t.entities;i.collectionChanged.removeEventListener(Viewer.prototype._onEntityCollectionChanged,this),defined(this.trackedEntity)&&i.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),defined(this.selectedEntity)&&i.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)},Viewer.prototype._onTick=function(e){var t=e.currentTime,i=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=i);var r,n=this._entityView;if(defined(n)){var a=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(a,!1,boundingSphereScratch$2)===BoundingSphereState$1.DONE&&n.update(t,boundingSphereScratch$2)}var o=!1,s=this.selectedEntity,l=defined(s)&&this._enableInfoOrSelection;l&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,boundingSphereScratch$2)!==BoundingSphereState$1.FAILED?r=boundingSphereScratch$2.center:defined(s.position)&&(r=s.position.getValue(t,r)),o=defined(r));var c=defined(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;defined(c)&&(c.position=Cartesian3.clone(r,c.position),c.showSelection=l&&o,c.update());var u=defined(this._infoBox)?this._infoBox.viewModel:void 0;defined(u)&&(u.showInfo=l,u.enableCamera=o,u.isCameraTracking=this.trackedEntity===this.selectedEntity,l?(u.titleText=defaultValue(s.name,s.id),u.description=Property.getValueOrDefault(s.description,t,"")):(u.titleText="",u.description=""))},Viewer.prototype._onEntityCollectionChanged=function(e,t,i){for(var r=i.length,n=0;n<r;n++){var a=i[n];this.trackedEntity===a&&(this.trackedEntity=void 0),this.selectedEntity===a&&(this.selectedEntity=void 0)}},Viewer.prototype._onInfoBoxCameraClicked=function(e){e.isCameraTracking&&this.trackedEntity===this.selectedEntity?this.trackedEntity=void 0:defined(this.selectedEntity.position)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)},Viewer.prototype._clearTrackedObject=function(){this.trackedEntity=void 0},Viewer.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0},Viewer.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0},Viewer.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&trackDataSourceClock(this.timeline,this.clock,e)},Viewer.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);var i=t.entities.id,r=this._eventHelper.add(t.changedEvent,Viewer.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[i]=r},Viewer.prototype._onDataSourceRemoved=function(e,t){var i=this.clockTrackedDataSource===t,r=t.entities.id;if(this._dataSourceChangedListeners[r](),this._dataSourceChangedListeners[r]=void 0,i){var n=e.length;this._automaticallyTrackDataSourceClocks&&0<n?this.clockTrackedDataSource=e.get(n-1):this.clockTrackedDataSource=void 0}},Viewer.prototype.zoomTo=function(e,t){return zoomToOrFly(this,e,{offset:t},!1)},Viewer.prototype.flyTo=function(e,t){return zoomToOrFly(this,e,t,!0)},Viewer.prototype._postRender=function(){updateZoomTarget(this),updateTrackedEntity(this)};var VERSION="1.63.1";exports.Animation=Animation,exports.AnimationViewModel=AnimationViewModel,exports.Appearance=Appearance,exports.ApproximateTerrainHeights=ApproximateTerrainHeights,exports.ArcGISTiledElevationTerrainProvider=ArcGISTiledElevationTerrainProvider,exports.ArcGisMapServerImageryProvider=ArcGisMapServerImageryProvider,exports.ArcType=ArcType$1,exports.AssociativeArray=AssociativeArray,exports.AttributeCompression=AttributeCompression,exports.AttributeType=AttributeType$1,exports.AutoExposure=AutoExposure,exports.Autolinker=Autolinker,exports.AutomaticUniforms=AutomaticUniforms,exports.Axis=Axis$1,exports.AxisAlignedBoundingBox=AxisAlignedBoundingBox,exports.BaseLayerPicker=BaseLayerPicker,exports.BaseLayerPickerViewModel=BaseLayerPickerViewModel,exports.BatchTable=BatchTable,exports.Batched3DModel3DTileContent=Batched3DModel3DTileContent,exports.Billboard=Billboard,exports.BillboardCollection=BillboardCollection,exports.BillboardGraphics=BillboardGraphics,exports.BillboardVisualizer=BillboardVisualizer,exports.BingMapsApi=BingMapsApi,exports.BingMapsGeocoderService=BingMapsGeocoderService,exports.BingMapsImageryProvider=BingMapsImageryProvider,exports.BingMapsStyle=BingMapsStyle$1,exports.BlendEquation=BlendEquation$1,exports.BlendFunction=BlendFunction$1,exports.BlendOption=BlendOption$1,exports.BlendingState=BlendingState$1,exports.BoundingRectangle=BoundingRectangle,exports.BoundingSphere=BoundingSphere,exports.BoundingSphereState=BoundingSphereState$1,exports.BoxEmitter=BoxEmitter,exports.BoxGeometry=BoxGeometry,exports.BoxGeometryUpdater=BoxGeometryUpdater,exports.BoxGraphics=BoxGraphics,exports.BoxOutlineGeometry=BoxOutlineGeometry,exports.BrdfLutGenerator=BrdfLutGenerator,exports.Buffer=Buffer$1,exports.BufferUsage=BufferUsage$1,exports.CallbackProperty=CallbackProperty,exports.Camera=Camera,exports.CameraEventAggregator=CameraEventAggregator,exports.CameraEventType=CameraEventType$1,exports.CameraFlightPath=CameraFlightPath,exports.Cartesian2=Cartesian2,exports.Cartesian3=Cartesian3,exports.Cartesian4=Cartesian4,exports.Cartographic=Cartographic,exports.CartographicGeocoderService=CartographicGeocoderService,exports.CatmullRomSpline=CatmullRomSpline,exports.Cesium3DTile=Cesium3DTile,exports.Cesium3DTileBatchTable=Cesium3DTileBatchTable,exports.Cesium3DTileColorBlendMode=Cesium3DTileColorBlendMode$1,exports.Cesium3DTileContent=Cesium3DTileContent,exports.Cesium3DTileContentFactory=Cesium3DTileContentFactory,exports.Cesium3DTileContentState=Cesium3DTileContentState$1,exports.Cesium3DTileFeature=Cesium3DTileFeature,exports.Cesium3DTileFeatureTable=Cesium3DTileFeatureTable,exports.Cesium3DTileOptimizationHint=Cesium3DTileOptimizationHint$1,exports.Cesium3DTileOptimizations=Cesium3DTileOptimizations,exports.Cesium3DTilePass=Cesium3DTilePass$1,exports.Cesium3DTilePassState=Cesium3DTilePassState,exports.Cesium3DTilePointFeature=Cesium3DTilePointFeature,exports.Cesium3DTileRefine=Cesium3DTileRefine$1,exports.Cesium3DTileStyle=Cesium3DTileStyle,exports.Cesium3DTileStyleEngine=Cesium3DTileStyleEngine,exports.Cesium3DTilesInspector=Cesium3DTilesInspector,exports.Cesium3DTilesInspectorViewModel=Cesium3DTilesInspectorViewModel,exports.Cesium3DTileset=Cesium3DTileset,exports.Cesium3DTilesetCache=Cesium3DTilesetCache,exports.Cesium3DTilesetHeatmap=Cesium3DTilesetHeatmap,exports.Cesium3DTilesetMostDetailedTraversal=Cesium3DTilesetMostDetailedTraversal,exports.Cesium3DTilesetStatistics=Cesium3DTilesetStatistics,exports.Cesium3DTilesetTraversal=Cesium3DTilesetTraversal,exports.CesiumInspector=CesiumInspector,exports.CesiumInspectorViewModel=CesiumInspectorViewModel,exports.CesiumTerrainProvider=CesiumTerrainProvider,exports.CesiumWidget=CesiumWidget,exports.Check=Check,exports.CheckerboardMaterialProperty=CheckerboardMaterialProperty,exports.CircleEmitter=CircleEmitter,exports.CircleGeometry=CircleGeometry,exports.CircleOutlineGeometry=CircleOutlineGeometry,exports.ClassificationModel=ClassificationModel,exports.ClassificationPrimitive=ClassificationPrimitive,exports.ClassificationType=ClassificationType$1,exports.ClearCommand=ClearCommand,exports.ClippingPlane=ClippingPlane,exports.ClippingPlaneCollection=ClippingPlaneCollection,exports.Clock=Clock,exports.ClockRange=ClockRange$1,exports.ClockStep=ClockStep$1,exports.ClockViewModel=ClockViewModel,exports.Color=Color,exports.ColorBlendMode=ColorBlendMode$1,exports.ColorGeometryInstanceAttribute=ColorGeometryInstanceAttribute,exports.ColorMaterialProperty=ColorMaterialProperty,exports.Command=Command,exports.ComponentDatatype=ComponentDatatype$1,exports.Composite3DTileContent=Composite3DTileContent,exports.CompositeEntityCollection=CompositeEntityCollection,exports.CompositeMaterialProperty=CompositeMaterialProperty,exports.CompositePositionProperty=CompositePositionProperty,exports.CompositeProperty=CompositeProperty,exports.CompressedTextureBuffer=CompressedTextureBuffer,exports.ComputeCommand=ComputeCommand,exports.ComputeEngine=ComputeEngine,exports.ConditionsExpression=ConditionsExpression,exports.ConeEmitter=ConeEmitter,exports.ConstantPositionProperty=ConstantPositionProperty,exports.ConstantProperty=ConstantProperty,exports.Context=Context,exports.ContextLimits=ContextLimits,exports.CoplanarPolygonGeometry=CoplanarPolygonGeometry,exports.CoplanarPolygonGeometryLibrary=CoplanarPolygonGeometryLibrary,exports.CoplanarPolygonOutlineGeometry=CoplanarPolygonOutlineGeometry,exports.CornerType=CornerType$1,exports.CorridorGeometry=CorridorGeometry,exports.CorridorGeometryLibrary=CorridorGeometryLibrary,exports.CorridorGeometryUpdater=CorridorGeometryUpdater,exports.CorridorGraphics=CorridorGraphics,exports.CorridorOutlineGeometry=CorridorOutlineGeometry,exports.Credit=Credit,exports.CreditDisplay=CreditDisplay,exports.CubeMap=CubeMap,exports.CubeMapFace=CubeMapFace,exports.CubicRealPolynomial=CubicRealPolynomial,exports.CullFace=CullFace$1,exports.CullingVolume=CullingVolume,exports.CustomDataSource=CustomDataSource,exports.CylinderGeometry=CylinderGeometry,exports.CylinderGeometryLibrary=CylinderGeometryLibrary,exports.CylinderGeometryUpdater=CylinderGeometryUpdater,exports.CylinderGraphics=CylinderGraphics,exports.CylinderOutlineGeometry=CylinderOutlineGeometry,exports.CzmlDataSource=CzmlDataSource,exports.DataSource=DataSource,exports.DataSourceClock=DataSourceClock,exports.DataSourceCollection=DataSourceCollection,exports.DataSourceDisplay=DataSourceDisplay,exports.DebugAppearance=DebugAppearance,exports.DebugCameraPrimitive=DebugCameraPrimitive,exports.DebugModelMatrixPrimitive=DebugModelMatrixPrimitive,exports.DefaultProxy=DefaultProxy,exports.DepthFunction=DepthFunction$1,exports.DepthPlane=DepthPlane,exports.DerivedCommand=DerivedCommand,exports.DeveloperError=DeveloperError,exports.DeviceOrientationCameraController=DeviceOrientationCameraController,exports.DiscardEmptyTileImagePolicy=DiscardEmptyTileImagePolicy,exports.DiscardMissingTileImagePolicy=DiscardMissingTileImagePolicy,exports.DistanceDisplayCondition=DistanceDisplayCondition,exports.DistanceDisplayConditionGeometryInstanceAttribute=DistanceDisplayConditionGeometryInstanceAttribute,exports.DoublyLinkedList=DoublyLinkedList,exports.DracoLoader=DracoLoader,exports.DrawCommand=DrawCommand,exports.DynamicGeometryBatch=DynamicGeometryBatch,exports.DynamicGeometryUpdater=DynamicGeometryUpdater,exports.EarthOrientationParameters=EarthOrientationParameters,exports.EarthOrientationParametersSample=EarthOrientationParametersSample,exports.EasingFunction=EasingFunction$1,exports.EllipseGeometry=EllipseGeometry,exports.EllipseGeometryLibrary=EllipseGeometryLibrary,exports.EllipseGeometryUpdater=EllipseGeometryUpdater,exports.EllipseGraphics=EllipseGraphics,exports.EllipseOutlineGeometry=EllipseOutlineGeometry,exports.Ellipsoid=Ellipsoid,exports.EllipsoidGeodesic=EllipsoidGeodesic,exports.EllipsoidGeometry=EllipsoidGeometry,exports.EllipsoidGeometryUpdater=EllipsoidGeometryUpdater,exports.EllipsoidGraphics=EllipsoidGraphics,exports.EllipsoidOutlineGeometry=EllipsoidOutlineGeometry,exports.EllipsoidPrimitive=EllipsoidPrimitive,exports.EllipsoidRhumbLine=EllipsoidRhumbLine,exports.EllipsoidSurfaceAppearance=EllipsoidSurfaceAppearance,exports.EllipsoidTangentPlane=EllipsoidTangentPlane,exports.EllipsoidTerrainProvider=EllipsoidTerrainProvider,exports.EllipsoidalOccluder=EllipsoidalOccluder,exports.Empty3DTileContent=Empty3DTileContent,exports.EncodedCartesian3=EncodedCartesian3,exports.Entity=Entity,exports.EntityCluster=EntityCluster,exports.EntityCollection=EntityCollection,exports.EntityView=EntityView,exports.Event=Event,exports.EventHelper=EventHelper,exports.ExpandByMars=ExpandByMars,exports.Expression=Expression,exports.ExpressionNodeType=ExpressionNodeType$1,exports.ExtrapolationType=ExtrapolationType$1,exports.FXAA3_11=FXAA3_11,exports.FeatureDetection=FeatureDetection,exports.Fog=Fog,exports.ForEach=ForEach,exports.FrameRateMonitor=FrameRateMonitor,exports.FrameState=FrameState,exports.Framebuffer=Framebuffer,exports.FrustumCommands=FrustumCommands,exports.FrustumGeometry=FrustumGeometry,exports.FrustumOutlineGeometry=FrustumOutlineGeometry,exports.Fullscreen=Fullscreen,exports.FullscreenButton=FullscreenButton,exports.FullscreenButtonViewModel=FullscreenButtonViewModel,exports.GeoJsonDataSource=GeoJsonDataSource,exports.GeocodeType=GeocodeType$1,exports.Geocoder=Geocoder,exports.GeocoderService=GeocoderService,exports.GeocoderViewModel=GeocoderViewModel,exports.GeographicProjection=GeographicProjection,exports.GeographicTilingScheme=GeographicTilingScheme,exports.Geometry=Geometry,exports.Geometry3DTileContent=Geometry3DTileContent,exports.GeometryAttribute=GeometryAttribute,exports.GeometryAttributes=GeometryAttributes,exports.GeometryInstance=GeometryInstance,exports.GeometryInstanceAttribute=GeometryInstanceAttribute,exports.GeometryOffsetAttribute=GeometryOffsetAttribute$1,exports.GeometryPipeline=GeometryPipeline,exports.GeometryType=GeometryType$1,exports.GeometryUpdater=GeometryUpdater,exports.GeometryVisualizer=GeometryVisualizer,exports.GetFeatureInfoFormat=GetFeatureInfoFormat,exports.Globe=Globe,exports.GlobeDepth=GlobeDepth,exports.GlobeSurfaceShaderSet=GlobeSurfaceShaderSet,exports.GlobeSurfaceTile=GlobeSurfaceTile,exports.GlobeSurfaceTileProvider=GlobeSurfaceTileProvider,exports.GoogleEarthEnterpriseImageryProvider=GoogleEarthEnterpriseImageryProvider,exports.GoogleEarthEnterpriseMapsProvider=GoogleEarthEnterpriseMapsProvider,exports.GoogleEarthEnterpriseMetadata=GoogleEarthEnterpriseMetadata,exports.GoogleEarthEnterpriseTerrainData=GoogleEarthEnterpriseTerrainData,exports.GoogleEarthEnterpriseTerrainProvider=GoogleEarthEnterpriseTerrainProvider,exports.GoogleEarthEnterpriseTileInformation=GoogleEarthEnterpriseTileInformation,exports.GregorianDate=GregorianDate,exports.GridImageryProvider=GridImageryProvider,exports.GridMaterialProperty=GridMaterialProperty,exports.GroundGeometryUpdater=GroundGeometryUpdater,exports.GroundPolylineGeometry=GroundPolylineGeometry,exports.GroundPolylinePrimitive=GroundPolylinePrimitive,exports.GroundPrimitive=GroundPrimitive,exports.HeadingPitchRange=HeadingPitchRange,exports.HeadingPitchRoll=HeadingPitchRoll,exports.Heap=Heap,exports.HeightReference=HeightReference$1,exports.HeightmapEncoding=HeightmapEncoding$1,exports.HeightmapTerrainData=HeightmapTerrainData,exports.HeightmapTessellator=HeightmapTessellator,exports.HermitePolynomialApproximation=HermitePolynomialApproximation,exports.HermiteSpline=HermiteSpline,exports.HomeButton=HomeButton,exports.HomeButtonViewModel=HomeButtonViewModel,exports.HorizontalOrigin=HorizontalOrigin$1,exports.Iau2000Orientation=Iau2000Orientation,exports.Iau2006XysData=Iau2006XysData,exports.Iau2006XysSample=Iau2006XysSample,exports.IauOrientationAxes=IauOrientationAxes,exports.IauOrientationParameters=IauOrientationParameters,exports.ImageMaterialProperty=ImageMaterialProperty,exports.Imagery=Imagery,exports.ImageryLayer=ImageryLayer,exports.ImageryLayerCollection=ImageryLayerCollection,exports.ImageryLayerFeatureInfo=ImageryLayerFeatureInfo,exports.ImageryProvider=ImageryProvider,exports.ImagerySplitDirection=ImagerySplitDirection$1,exports.ImageryState=ImageryState$1,exports.IndexDatatype=IndexDatatype$1,exports.InfoBox=InfoBox,exports.InfoBoxViewModel=InfoBoxViewModel,exports.InspectorShared=InspectorShared,exports.Instanced3DModel3DTileContent=Instanced3DModel3DTileContent,exports.InterpolationAlgorithm=InterpolationAlgorithm,exports.Intersect=Intersect$1,exports.IntersectionTests=IntersectionTests,exports.Intersections2D=Intersections2D,exports.Interval=Interval,exports.InvertClassification=InvertClassification,exports.Ion=Ion,exports.IonGeocoderService=IonGeocoderService,exports.IonImageryProvider=IonImageryProvider,exports.IonResource=IonResource,exports.IonWorldImageryStyle=IonWorldImageryStyle$1,exports.Iso8601=Iso8601,exports.JobScheduler=JobScheduler,exports.JobType=JobType$1,exports.JulianDate=JulianDate,exports.KeyboardEventModifier=KeyboardEventModifier$1,exports.KmlCamera=KmlCamera,exports.KmlDataSource=KmlDataSource,exports.KmlLookAt=KmlLookAt,exports.KmlTour=KmlTour,exports.KmlTourFlyTo=KmlTourFlyTo,exports.KmlTourWait=KmlTourWait,exports.Label=Label,exports.LabelCollection=LabelCollection,exports.LabelGraphics=LabelGraphics,exports.LabelStyle=LabelStyle$1,exports.LabelVisualizer=LabelVisualizer,exports.LagrangePolynomialApproximation=LagrangePolynomialApproximation,exports.LeapSecond=LeapSecond,exports.LercDecode=LercDecode,exports.LinearApproximation=LinearApproximation,exports.LinearSpline=LinearSpline,exports.ManagedArray=ManagedArray,exports.MapMode2D=MapMode2D$1,exports.MapProjection=MapProjection,exports.MapboxApi=MapboxApi,exports.MapboxImageryProvider=MapboxImageryProvider,exports.MapboxStyleImageryProvider=MapboxStyleImageryProvider,exports.Material=Material,exports.MaterialAppearance=MaterialAppearance,exports.MaterialProperty=MaterialProperty,exports.Math=CesiumMath,exports.Matrix2=Matrix2,exports.Matrix3=Matrix3,exports.Matrix4=Matrix4,exports.MipmapHint=MipmapHint$1,exports.Model=Model,exports.ModelAnimation=ModelAnimation,exports.ModelAnimationCache=ModelAnimationCache,exports.ModelAnimationCollection=ModelAnimationCollection,exports.ModelAnimationLoop=ModelAnimationLoop$1,exports.ModelAnimationState=ModelAnimationState,exports.ModelGraphics=ModelGraphics,exports.ModelInstance=ModelInstance,exports.ModelInstanceCollection=ModelInstanceCollection,exports.ModelLoadResources=ModelLoadResources,exports.ModelMaterial=ModelMaterial,exports.ModelMesh=ModelMesh,exports.ModelNode=ModelNode,exports.ModelUtility=ModelUtility,exports.ModelVisualizer=ModelVisualizer,exports.Moon=Moon,exports.NavigationHelpButton=NavigationHelpButton,exports.NavigationHelpButtonViewModel=NavigationHelpButtonViewModel,exports.NearFarScalar=NearFarScalar,exports.NeverTileDiscardPolicy=NeverTileDiscardPolicy,exports.NoSleep=NoSleep,exports.NodeTransformationProperty=NodeTransformationProperty,exports.OIT=OIT,exports.Occluder=Occluder,exports.OctahedralProjectedCubeMap=OctahedralProjectedCubeMap,exports.OffsetGeometryInstanceAttribute=OffsetGeometryInstanceAttribute,exports.OpenCageGeocoderService=OpenCageGeocoderService,exports.OpenStreetMapImageryProvider=OpenStreetMapImageryProvider,exports.OrderedGroundPrimitiveCollection=OrderedGroundPrimitiveCollection,exports.OrientedBoundingBox=OrientedBoundingBox,exports.OrthographicFrustum=OrthographicFrustum,exports.OrthographicOffCenterFrustum=OrthographicOffCenterFrustum,exports.Packable=Packable,exports.PackableForInterpolation=PackableForInterpolation,exports.Particle=Particle,exports.ParticleBurst=ParticleBurst,exports.ParticleEmitter=ParticleEmitter,exports.ParticleSystem=ParticleSystem,exports.Pass=Pass$1,exports.PassState=PassState,exports.PathGraphics=PathGraphics,exports.PathVisualizer=PathVisualizer,exports.PeliasGeocoderService=PeliasGeocoderService,exports.PerInstanceColorAppearance=PerInstanceColorAppearance,exports.PerformanceDisplay=PerformanceDisplay,exports.PerformanceWatchdog=PerformanceWatchdog,exports.PerformanceWatchdogViewModel=PerformanceWatchdogViewModel,exports.PerspectiveFrustum=PerspectiveFrustum,exports.PerspectiveOffCenterFrustum=PerspectiveOffCenterFrustum,exports.PickDepth=PickDepth,exports.PickDepthFramebuffer=PickDepthFramebuffer,exports.PickFramebuffer=PickFramebuffer,exports.Picking=Picking,exports.PinBuilder=PinBuilder,exports.PixelDatatype=PixelDatatype$1,exports.PixelFormat=PixelFormat$1,exports.Plane=Plane,exports.PlaneGeometry=PlaneGeometry,exports.PlaneGeometryUpdater=PlaneGeometryUpdater,exports.PlaneGraphics=PlaneGraphics,exports.PlaneOutlineGeometry=PlaneOutlineGeometry,exports.PointCloud=PointCloud,exports.PointCloud3DTileContent=PointCloud3DTileContent,exports.PointCloudEyeDomeLighting=PointCloudEyeDomeLighting,exports.PointCloudShading=PointCloudShading,exports.PointGraphics=PointGraphics,exports.PointPrimitive=PointPrimitive,exports.PointPrimitiveCollection=PointPrimitiveCollection,exports.PointVisualizer=PointVisualizer,exports.PolygonGeometry=PolygonGeometry,exports.PolygonGeometryLibrary=PolygonGeometryLibrary,exports.PolygonGeometryUpdater=PolygonGeometryUpdater,exports.PolygonGraphics=PolygonGraphics,exports.PolygonHierarchy=PolygonHierarchy,exports.PolygonOutlineGeometry=PolygonOutlineGeometry,exports.PolygonPipeline=PolygonPipeline,exports.Polyline=Polyline,exports.PolylineArrowMaterialProperty=PolylineArrowMaterialProperty,exports.PolylineCollection=PolylineCollection,exports.PolylineColorAppearance=PolylineColorAppearance,exports.PolylineDashMaterialProperty=PolylineDashMaterialProperty,exports.PolylineGeometry=PolylineGeometry,exports.PolylineGeometryUpdater=PolylineGeometryUpdater,exports.PolylineGlowMaterialProperty=PolylineGlowMaterialProperty,exports.PolylineGraphics=PolylineGraphics,exports.PolylineMaterialAppearance=PolylineMaterialAppearance,exports.PolylineOutlineMaterialProperty=PolylineOutlineMaterialProperty,exports.PolylinePipeline=PolylinePipeline,exports.PolylineVisualizer=PolylineVisualizer,exports.PolylineVolumeGeometry=PolylineVolumeGeometry,exports.PolylineVolumeGeometryLibrary=PolylineVolumeGeometryLibrary,exports.PolylineVolumeGeometryUpdater=PolylineVolumeGeometryUpdater,exports.PolylineVolumeGraphics=PolylineVolumeGraphics,exports.PolylineVolumeOutlineGeometry=PolylineVolumeOutlineGeometry,exports.PositionProperty=PositionProperty,exports.PositionPropertyArray=PositionPropertyArray,exports.PostProcessStage=PostProcessStage,exports.PostProcessStageCollection=PostProcessStageCollection,exports.PostProcessStageComposite=PostProcessStageComposite,exports.PostProcessStageLibrary=PostProcessStageLibrary,exports.PostProcessStageSampleMode=PostProcessStageSampleMode,exports.PostProcessStageTextureCache=PostProcessStageTextureCache,exports.Primitive=Primitive,exports.PrimitiveCollection=PrimitiveCollection,exports.PrimitivePipeline=PrimitivePipeline,exports.PrimitiveState=PrimitiveState$1,exports.PrimitiveType=PrimitiveType$1,exports.ProjectionPicker=ProjectionPicker,exports.ProjectionPickerViewModel=ProjectionPickerViewModel,exports.Property=Property,exports.PropertyArray=PropertyArray,exports.PropertyBag=PropertyBag,exports.ProviderViewModel=ProviderViewModel,exports.QuadraticRealPolynomial=QuadraticRealPolynomial,exports.QuadtreeOccluders=QuadtreeOccluders,exports.QuadtreePrimitive=QuadtreePrimitive,exports.QuadtreeTile=QuadtreeTile,exports.QuadtreeTileLoadState=QuadtreeTileLoadState$1,exports.QuadtreeTileProvider=QuadtreeTileProvider,exports.QuantizedMeshTerrainData=QuantizedMeshTerrainData,exports.QuarticRealPolynomial=QuarticRealPolynomial,exports.Quaternion=Quaternion,exports.QuaternionSpline=QuaternionSpline,exports.Queue=Queue,exports.Ray=Ray,exports.Rectangle=Rectangle,exports.RectangleCollisionChecker=RectangleCollisionChecker,exports.RectangleGeometry=RectangleGeometry,exports.RectangleGeometryLibrary=RectangleGeometryLibrary,exports.RectangleGeometryUpdater=RectangleGeometryUpdater,exports.RectangleGraphics=RectangleGraphics,exports.RectangleOutlineGeometry=RectangleOutlineGeometry,exports.ReferenceFrame=ReferenceFrame$1,exports.ReferenceProperty=ReferenceProperty,exports.RenderState=RenderState,exports.Renderbuffer=Renderbuffer,exports.RenderbufferFormat=RenderbufferFormat$1,exports.Request=Request,exports.RequestErrorEvent=RequestErrorEvent,exports.RequestScheduler=RequestScheduler,exports.RequestState=RequestState$1,exports.RequestType=RequestType$1,exports.Resource=Resource,exports.Rotation=Rotation,exports.RuntimeError=RuntimeError,exports.SDFSettings=SDFSettings$1,exports.SampledPositionProperty=SampledPositionProperty,exports.SampledProperty=SampledProperty,exports.Sampler=Sampler,exports.ScaledPositionProperty=ScaledPositionProperty,exports.Scene=Scene,exports.SceneFramebuffer=SceneFramebuffer,exports.SceneMode=SceneMode$1,exports.SceneModePicker=SceneModePicker,exports.SceneModePickerViewModel=SceneModePickerViewModel,exports.SceneTransforms=SceneTransforms,exports.SceneTransitioner=SceneTransitioner,exports.ScreenSpaceCameraController=ScreenSpaceCameraController,exports.ScreenSpaceEventHandler=ScreenSpaceEventHandler,exports.ScreenSpaceEventType=ScreenSpaceEventType$1,exports.SelectionIndicator=SelectionIndicator,exports.SelectionIndicatorViewModel=SelectionIndicatorViewModel,exports.ShaderCache=ShaderCache,exports.ShaderProgram=ShaderProgram,exports.ShaderSource=ShaderSource,exports.ShadowMap=ShadowMap,exports.ShadowMapShader=ShadowMapShader,exports.ShadowMode=ShadowMode$1,exports.ShadowVolumeAppearance=ShadowVolumeAppearance,exports.ShowGeometryInstanceAttribute=ShowGeometryInstanceAttribute,exports.Simon1994PlanetaryPositions=Simon1994PlanetaryPositions,exports.SimplePolylineGeometry=SimplePolylineGeometry,exports.SingleTileImageryProvider=SingleTileImageryProvider,exports.SkyAtmosphere=SkyAtmosphere,exports.SkyBox=SkyBox,exports.SphereEmitter=SphereEmitter,exports.SphereGeometry=SphereGeometry,exports.SphereOutlineGeometry=SphereOutlineGeometry,exports.Spherical=Spherical,exports.Spline=Spline,exports.StaticGeometryColorBatch=StaticGeometryColorBatch,exports.StaticGeometryPerMaterialBatch=StaticGeometryPerMaterialBatch,exports.StaticGroundGeometryColorBatch=StaticGroundGeometryColorBatch,exports.StaticGroundGeometryPerMaterialBatch=StaticGroundGeometryPerMaterialBatch,exports.StaticGroundPolylinePerMaterialBatch=StaticGroundPolylinePerMaterialBatch,exports.StaticOutlineGeometryBatch=StaticOutlineGeometryBatch,exports.StencilConstants=StencilConstants$1,exports.StencilFunction=StencilFunction$1,exports.StencilOperation=StencilOperation$1,exports.StripeMaterialProperty=StripeMaterialProperty,exports.StripeOrientation=StripeOrientation$1,exports.StyleExpression=StyleExpression,exports.Sun=Sun,exports.SunPostProcess=SunPostProcess,exports.SvgPathBindingHandler=SvgPathBindingHandler,exports.TaskProcessor=TaskProcessor,exports.TerrainData=TerrainData,exports.TerrainEncoding=TerrainEncoding,exports.TerrainFillMesh=TerrainFillMesh,exports.TerrainMesh=TerrainMesh,exports.TerrainOffsetProperty=TerrainOffsetProperty,exports.TerrainProvider=TerrainProvider,exports.TerrainQuantization=TerrainQuantization$1,exports.TerrainState=TerrainState$2,exports.Texture=Texture,exports.TextureAtlas=TextureAtlas,exports.TextureCache=TextureCache,exports.TextureMagnificationFilter=TextureMagnificationFilter$1,exports.TextureMinificationFilter=TextureMinificationFilter$1,exports.TextureWrap=TextureWrap$1,exports.TileAvailability=TileAvailability,exports.TileBoundingRegion=TileBoundingRegion,exports.TileBoundingSphere=TileBoundingSphere,exports.TileBoundingVolume=TileBoundingVolume,exports.TileCoordinatesImageryProvider=TileCoordinatesImageryProvider,exports.TileDiscardPolicy=TileDiscardPolicy,exports.TileEdge=TileEdge,exports.TileImagery=TileImagery,exports.TileMapServiceImageryProvider=TileMapServiceImageryProvider,exports.TileOrientedBoundingBox=TileOrientedBoundingBox,exports.TileProviderError=TileProviderError,exports.TileReplacementQueue=TileReplacementQueue,exports.TileSelectionResult=TileSelectionResult,exports.TileState=TileState$1,exports.Tileset3DTileContent=Tileset3DTileContent,exports.TilingScheme=TilingScheme,exports.TimeConstants=TimeConstants$1,exports.TimeDynamicImagery=TimeDynamicImagery,exports.TimeDynamicPointCloud=TimeDynamicPointCloud,exports.TimeInterval=TimeInterval,exports.TimeIntervalCollection=TimeIntervalCollection,exports.TimeIntervalCollectionPositionProperty=TimeIntervalCollectionPositionProperty,exports.TimeIntervalCollectionProperty=TimeIntervalCollectionProperty,exports.TimeStandard=TimeStandard$1,exports.Timeline=Timeline,exports.TimelineHighlightRange=TimelineHighlightRange,exports.TimelineTrack=TimelineTrack,exports.Tipsify=Tipsify,exports.ToggleButtonViewModel=ToggleButtonViewModel,exports.Tonemapper=Tonemapper$1,exports.Transforms=Transforms,exports.TranslationRotationScale=TranslationRotationScale,exports.TridiagonalSystemSolver=TridiagonalSystemSolver,exports.TrustedServers=TrustedServers,exports.Tween=TWEEN,exports.TweenCollection=TweenCollection,exports.UniformState=UniformState,exports.Uri=URI,exports.UrlTemplateImageryProvider=UrlTemplateImageryProvider,exports.VERSION=VERSION,exports.VRButton=VRButton,exports.VRButtonViewModel=VRButtonViewModel,exports.VRTheWorldTerrainProvider=VRTheWorldTerrainProvider,exports.Vector3DTileBatch=Vector3DTileBatch,exports.Vector3DTileContent=Vector3DTileContent,exports.Vector3DTileGeometry=Vector3DTileGeometry,exports.Vector3DTilePoints=Vector3DTilePoints,exports.Vector3DTilePolygons=Vector3DTilePolygons,exports.Vector3DTilePolylines=Vector3DTilePolylines,exports.Vector3DTilePrimitive=Vector3DTilePrimitive,exports.VelocityOrientationProperty=VelocityOrientationProperty,exports.VelocityVectorProperty=VelocityVectorProperty,exports.VertexArray=VertexArray,exports.VertexArrayFacade=VertexArrayFacade,exports.VertexFormat=VertexFormat,exports.VerticalOrigin=VerticalOrigin$1,exports.VideoSynchronizer=VideoSynchronizer,exports.View=View,exports.Viewer=Viewer,exports.ViewportQuad=ViewportQuad,exports.Visibility=Visibility$1,exports.Visualizer=Visualizer,exports.WallGeometry=WallGeometry,exports.WallGeometryLibrary=WallGeometryLibrary,exports.WallGeometryUpdater=WallGeometryUpdater,exports.WallGraphics=WallGraphics,exports.WallOutlineGeometry=WallOutlineGeometry,exports.WebGLConstants=WebGLConstants$1,exports.WebMapServiceImageryProvider=WebMapServiceImageryProvider,exports.WebMapTileServiceImageryProvider=WebMapTileServiceImageryProvider,exports.WebMercatorProjection=WebMercatorProjection,exports.WebMercatorTilingScheme=WebMercatorTilingScheme,exports.WeightSpline=WeightSpline,exports.WindingOrder=WindingOrder$1,exports._shadersAcesTonemappingStage=AcesTonemapping,exports._shadersAdditiveBlend=AdditiveBlend,exports._shadersAdjustTranslucentFS=AdjustTranslucentFS,exports._shadersAllMaterialAppearanceFS=AllMaterialAppearanceFS,exports._shadersAllMaterialAppearanceVS=AllMaterialAppearanceVS,exports._shadersAmbientOcclusionGenerate=AmbientOcclusionGenerate,exports._shadersAmbientOcclusionModulate=AmbientOcclusionModulate,exports._shadersAspectRampMaterial=AspectRampMaterial,exports._shadersBasicMaterialAppearanceFS=BasicMaterialAppearanceFS,exports._shadersBasicMaterialAppearanceVS=BasicMaterialAppearanceVS,exports._shadersBillboardCollectionFS=BillboardCollectionFS,exports._shadersBillboardCollectionVS=BillboardCollectionVS,exports._shadersBlackAndWhite=BlackAndWhite,exports._shadersBloomComposite=BloomComposite,exports._shadersBrdfLutGeneratorFS=BrdfLutGeneratorFS,exports._shadersBrightPass=BrightPass,exports._shadersBrightness=Brightness,exports._shadersBumpMapMaterial=BumpMapMaterial,exports._shadersCheckFloatTexturePrecisionFS=CheckFloatTexturePrecisionFS,exports._shadersCheckerboardMaterial=CheckerboardMaterial,exports._shadersCompositeOITFS=CompositeOITFS,exports._shadersContrastBias=ContrastBias,exports._shadersCzmBuiltins=CzmBuiltins,exports._shadersDepthOfField=DepthOfField,exports._shadersDepthPlaneFS=DepthPlaneFS,exports._shadersDepthPlaneVS=DepthPlaneVS,exports._shadersDepthView=DepthView,exports._shadersDepthViewPacked=DepthViewPacked,exports._shadersDotMaterial=DotMaterial,exports._shadersEdgeDetection=EdgeDetection,exports._shadersElevationContourMaterial=ElevationContourMaterial,exports._shadersElevationRampMaterial=ElevationRampMaterial,exports._shadersEllipsoidFS=EllipsoidFS,exports._shadersEllipsoidSurfaceAppearanceFS=EllipsoidSurfaceAppearanceFS,exports._shadersEllipsoidSurfaceAppearanceVS=EllipsoidSurfaceAppearanceVS,exports._shadersEllipsoidVS=EllipsoidVS,exports._shadersFXAA=FXAA,exports._shadersFadeMaterial=FadeMaterial,exports._shadersFilmicTonemapping=FilmicTonemapping,exports._shadersGaussianBlur1D=GaussianBlur1D,exports._shadersGlobeFS=GlobeFS,exports._shadersGlobeVS=GlobeVS,exports._shadersGridMaterial=GridMaterial,exports._shadersGroundAtmosphere=GroundAtmosphere,exports._shadersHSBToRGB=czm_HSBToRGB,exports._shadersHSLToRGB=czm_HSLToRGB,exports._shadersLensFlare=LensFlare,exports._shadersModifiedReinhardTonemapping=ModifiedReinhardTonemapping,exports._shadersNightVision=NightVision,exports._shadersNormalMapMaterial=NormalMapMaterial,exports._shadersOctahedralProjectionAtlasFS=OctahedralProjectionAtlasFS,exports._shadersOctahedralProjectionFS=OctahedralProjectionFS,exports._shadersOctahedralProjectionVS=OctahedralProjectionVS,exports._shadersPassThrough=PassThrough,exports._shadersPassThroughDepth=PassThroughDepth,exports._shadersPerInstanceColorAppearanceFS=PerInstanceColorAppearanceFS,exports._shadersPerInstanceColorAppearanceVS=PerInstanceColorAppearanceVS,exports._shadersPerInstanceFlatColorAppearanceFS=PerInstanceFlatColorAppearanceFS,exports._shadersPerInstanceFlatColorAppearanceVS=PerInstanceFlatColorAppearanceVS,exports._shadersPointCloudEyeDomeLighting=PointCloudEyeDomeLightingShader,exports._shadersPointPrimitiveCollectionFS=PointPrimitiveCollectionFS,exports._shadersPointPrimitiveCollectionVS=PointPrimitiveCollectionVS,exports._shadersPolylineArrowMaterial=PolylineArrowMaterial,exports._shadersPolylineColorAppearanceVS=PolylineColorAppearanceVS,exports._shadersPolylineCommon=PolylineCommon,exports._shadersPolylineDashMaterial=PolylineDashMaterial,exports._shadersPolylineFS=PolylineFS,exports._shadersPolylineGlowMaterial=PolylineGlowMaterial,exports._shadersPolylineMaterialAppearanceVS=PolylineMaterialAppearanceVS,exports._shadersPolylineOutlineMaterial=PolylineOutlineMaterial,exports._shadersPolylineShadowVolumeFS=PolylineShadowVolumeFS,exports._shadersPolylineShadowVolumeMorphFS=PolylineShadowVolumeMorphFS,exports._shadersPolylineShadowVolumeMorphVS=PolylineShadowVolumeMorphVS,exports._shadersPolylineShadowVolumeVS=PolylineShadowVolumeVS,exports._shadersPolylineVS=PolylineVS,exports._shadersRGBToHSB=czm_RGBToHSB,exports._shadersRGBToHSL=czm_RGBToHSL,exports._shadersRGBToXYZ=czm_RGBToXYZ,exports._shadersReinhardTonemapping=ReinhardTonemapping,exports._shadersReprojectWebMercatorFS=ReprojectWebMercatorFS,exports._shadersReprojectWebMercatorVS=ReprojectWebMercatorVS,exports._shadersRimLightingMaterial=RimLightingMaterial,exports._shadersShadowVolumeAppearanceFS=ShadowVolumeAppearanceFS,exports._shadersShadowVolumeAppearanceVS=ShadowVolumeAppearanceVS,exports._shadersShadowVolumeFS=ShadowVolumeFS,exports._shadersSilhouette=Silhouette,exports._shadersSkyAtmosphereFS=SkyAtmosphereFS,exports._shadersSkyAtmosphereVS=SkyAtmosphereVS,exports._shadersSkyBoxFS=SkyBoxFS,exports._shadersSkyBoxVS=SkyBoxVS,exports._shadersSlopeRampMaterial=SlopeRampMaterial,exports._shadersStripeMaterial=StripeMaterial,exports._shadersSunFS=SunFS,exports._shadersSunTextureFS=SunTextureFS,exports._shadersSunVS=SunVS,exports._shadersTexturedMaterialAppearanceFS=TexturedMaterialAppearanceFS,exports._shadersTexturedMaterialAppearanceVS=TexturedMaterialAppearanceVS,exports._shadersVector3DTilePolylinesVS=Vector3DTilePolylinesVS,exports._shadersVectorTileVS=VectorTileVS,exports._shadersViewportQuadFS=ViewportQuadFS,exports._shadersViewportQuadVS=ViewportQuadVS,exports._shadersWaJueMaterial=WaJueMaterial,exports._shadersWater=WaterMaterial,exports._shadersXYZToRGB=czm_XYZToRGB,exports._shadersYanMoMaterial=YanMoMaterial,exports._shadersacesTonemapping=czm_acesTonemapping,exports._shadersalphaWeight=czm_alphaWeight,exports._shadersantialias=czm_antialias,exports._shadersapproximateSphericalCoordinates=czm_approximateSphericalCoordinates,exports._shadersbranchFreeTernary=czm_branchFreeTernary,exports._shaderscascadeColor=czm_cascadeColor,exports._shaderscascadeDistance=czm_cascadeDistance,exports._shaderscascadeMatrix=czm_cascadeMatrix,exports._shaderscascadeWeights=czm_cascadeWeights,exports._shaderscolumbusViewMorph=czm_columbusViewMorph,exports._shaderscomputePosition=czm_computePosition,exports._shaderscosineAndSine=czm_cosineAndSine,exports._shadersdecompressTextureCoordinates=czm_decompressTextureCoordinates,exports._shadersdegreesPerRadian=czm_degreesPerRadian,exports._shadersdepthClampFarPlane=czm_depthClampFarPlane,exports._shadersdepthRange=czm_depthRange,exports._shadersdepthRangeStruct=czm_depthRangeStruct,exports._shaderseastNorthUpToEyeCoordinates=czm_eastNorthUpToEyeCoordinates,exports._shadersellipsoid=czm_ellipsoid,exports._shadersellipsoidContainsPoint=czm_ellipsoidContainsPoint,exports._shadersellipsoidInverseRadii=czm_ellipsoidInverseRadii,exports._shadersellipsoidNew=czm_ellipsoidNew,exports._shadersellipsoidRadii=czm_ellipsoidRadii,exports._shadersellipsoidWgs84TextureCoordinates=czm_ellipsoidWgs84TextureCoordinates,exports._shadersepsilon1=czm_epsilon1,exports._shadersepsilon2=czm_epsilon2,exports._shadersepsilon3=czm_epsilon3,exports._shadersepsilon4=czm_epsilon4,exports._shadersepsilon5=czm_epsilon5,exports._shadersepsilon6=czm_epsilon6,exports._shadersepsilon7=czm_epsilon7,exports._shadersequalsEpsilon=czm_equalsEpsilon,exports._shaderseyeOffset=czm_eyeOffset,exports._shaderseyeToWindowCoordinates=czm_eyeToWindowCoordinates,exports._shadersfastApproximateAtan=czm_fastApproximateAtan,exports._shadersfog=czm_fog,exports._shadersfromCartesian=czm_fromCartesian,exports._shadersgammaCorrect=czm_gammaCorrect,exports._shadersgeodeticSurfaceNormal=czm_geodeticSurfaceNormal,exports._shadersgetDefaultMaterial=czm_getDefaultMaterial,exports._shadersgetFloodRect=czm_getFloodRect,exports._shadersgetIndexMat=czm_getIndexMat,exports._shadersgetLambertDiffuse=czm_getLambertDiffuse,exports._shadersgetMaxIndex=czm_getMaxIndex,exports._shadersgetMaxIndexVal=czm_getMaxIndexVal,exports._shadersgetSpecular=czm_getSpecular,exports._shadersgetWaterNoise=czm_getWaterNoise,exports._shadersgetWgs84EllipsoidEC=czm_getWgs84EllipsoidEC,exports._shadershue=czm_hue,exports._shadersinfinity=czm_infinity,exports._shadersinverseGamma=czm_inverseGamma,exports._shadersisEmpty=czm_isEmpty,exports._shadersisFull=czm_isFull,exports._shadersisInEllipsoid=czm_isInEllipsoid,exports._shadersisInObliq=czm_isInObliq,exports._shaderslatitudeToWebMercatorFraction=czm_latitudeToWebMercatorFraction,exports._shaderslineDistance=czm_lineDistance,exports._shadersluminance=czm_luminance,exports._shadersmagnitude=czm_magnitude,exports._shadersmagnitudeSquared=czm_magnitudeSquared,exports._shadersmaterial=czm_material,exports._shadersmaterialInput=czm_materialInput,exports._shadersmetersPerPixel=czm_metersPerPixel,exports._shadersmodelToWindowCoordinates=czm_modelToWindowCoordinates,exports._shadersmultiplyComponents=czm_multiplyComponents,exports._shadersmultiplyWithColorBalance=czm_multiplyWithColorBalance,exports._shadersnearFarScalar=czm_nearFarScalar,exports._shadersoctDecode=czm_octDecode,exports._shadersoneOverPi=czm_oneOverPi,exports._shadersoneOverTwoPi=czm_oneOverTwoPi,exports._shaderspackDepth=czm_packDepth,exports._shaderspassCesium3DTile=czm_passCesium3DTile,exports._shaderspassCesium3DTileClassification=czm_passCesium3DTileClassification,exports._shaderspassCesium3DTileClassificationIgnoreShow=czm_passCesium3DTileClassificationIgnoreShow,exports._shaderspassClassification=czm_passClassification,exports._shaderspassCompute=czm_passCompute,exports._shaderspassEnvironment=czm_passEnvironment,exports._shaderspassGlobe=czm_passGlobe,exports._shaderspassOpaque=czm_passOpaque,exports._shaderspassOverlay=czm_passOverlay,exports._shaderspassTerrainClassification=czm_passTerrainClassification,exports._shaderspassTranslucent=czm_passTranslucent,exports._shadersphong=czm_phong,exports._shaderspi=czm_pi,exports._shaderspiOverFour=czm_piOverFour,exports._shaderspiOverSix=czm_piOverSix,exports._shaderspiOverThree=czm_piOverThree,exports._shaderspiOverTwo=czm_piOverTwo,exports._shadersplaneDistance=czm_planeDistance,exports._shaderspointAlongRay=czm_pointAlongRay,exports._shadersradiansPerDegree=czm_radiansPerDegree,exports._shadersray=czm_ray;exports._shadersrayEllipsoidIntersectionInterval=czm_rayEllipsoidIntersectionInterval,exports._shadersraySegment=czm_raySegment,exports._shadersreadDepth=czm_readDepth,exports._shadersreverseLogDepth=czm_reverseLogDepth,exports._shaderssampleOctahedralProjection=czm_sampleOctahedralProjection,exports._shaderssaturation=czm_saturation,exports._shadersscaleToGeodeticSurface=czm_scaleToGeodeticSurface,exports._shaderssceneMode2D=czm_sceneMode2D,exports._shaderssceneMode3D=czm_sceneMode3D,exports._shaderssceneModeColumbusView=czm_sceneModeColumbusView,exports._shaderssceneModeMorphing=czm_sceneModeMorphing,exports._shadersshadowDepthCompare=czm_shadowDepthCompare,exports._shadersshadowParameters=czm_shadowParameters,exports._shadersshadowVisibility=czm_shadowVisibility,exports._shaderssignNotZero=czm_signNotZero,exports._shaderssolarRadius=czm_solarRadius,exports._shaderssphericalHarmonics=czm_sphericalHarmonics,exports._shadersstcParameters=czm_stcParameters,exports._shaderstangentToEyeSpaceMatrix=czm_tangentToEyeSpaceMatrix,exports._shadersthreePiOver2=czm_threePiOver2,exports._shaderstransformPlane=czm_transformPlane,exports._shaderstranslateRelativeToEye=czm_translateRelativeToEye,exports._shaderstranslucentPhong=czm_translucentPhong,exports._shaderstranspose=czm_transpose,exports._shaderstwoPi=czm_twoPi,exports._shadersunpackDepth=czm_unpackDepth,exports._shadersunpackFloat=czm_unpackFloat,exports._shadersvertexLogDepth=czm_vertexLogDepth,exports._shaderswebMercatorMaxLatitude=czm_webMercatorMaxLatitude,exports._shaderswindowToEyeCoordinates=czm_windowToEyeCoordinates,exports._shaderswriteDepthClampedToFarPlane=czm_writeDepthClampedToFarPlane,exports._shaderswriteLogDepth=czm_writeLogDepth,exports.addBuffer=addBuffer,exports.addDefaults=addDefaults,exports.addExtensionsRequired=addExtensionsRequired,exports.addExtensionsUsed=addExtensionsUsed,exports.addPipelineExtras=addPipelineExtras,exports.addToArray=addToArray,exports.appendForwardSlash=appendForwardSlash,exports.arrayFill=arrayFill,exports.arrayRemoveDuplicates=arrayRemoveDuplicates,exports.arraySlice=arraySlice,exports.barycentricCoordinates=barycentricCoordinates,exports.binarySearch=binarySearch,exports.bitmap_sdf=calcSDF,exports.buildModuleUrl=buildModuleUrl,exports.cancelAnimationFrame=cancelAnimationFramePolyfill,exports.checkFloatTexturePrecision=checkFloatTexturePrecision,exports.clone=clone,exports.combine=combine,exports.computeFlyToLocationForRectangle=computeFlyToLocationForRectangle,exports.createBillboardPointCallback=createBillboardPointCallback,exports.createCommand=createCommand$2,exports.createDefaultImageryProviderViewModels=createDefaultImageryProviderViewModels,exports.createDefaultTerrainProviderViewModels=createDefaultTerrainProviderViewModels,exports.createGuid=createGuid,exports.createMaterialPropertyDescriptor=createMaterialPropertyDescriptor,exports.createOpenStreetMapImageryProvider=createOpenStreetMapImageryProvider,exports.createPropertyDescriptor=createPropertyDescriptor,exports.createRawPropertyDescriptor=createRawPropertyDescriptor,exports.createTangentSpaceDebugPrimitive=createTangentSpaceDebugPrimitive,exports.createTaskProcessorWorker=createTaskProcessorWorker,exports.createTileMapServiceImageryProvider=createTileMapServiceImageryProvider,exports.createUniform=createUniform$1,exports.createUniformArray=createUniformArray,exports.createWorldImagery=createWorldImagery,exports.createWorldTerrain=createWorldTerrain,exports.decodeGoogleEarthEnterpriseData=decodeGoogleEarthEnterpriseData,exports.defaultValue=defaultValue,exports.defineProperties=defineProperties$1,exports.defined=defined,exports.deprecationWarning=deprecationWarning,exports.destroyObject=destroyObject,exports.earcut_2_1_1=earcut,exports.exportKml=exportKml,exports.findAccessorMinMax=findAccessorMinMax,exports.formatError=formatError,exports.freezeObject=freezeObject$1,exports.freezeRenderState=freezeRenderState,exports.getAbsoluteUri=getAbsoluteUri,exports.getAccessorByteStride=getAccessorByteStride,exports.getBaseUri=getBaseUri,exports.getBinaryAccessor=getBinaryAccessor,exports.getClipAndStyleCode=getClipAndStyleCode,exports.getClippingFunction=getClippingFunction,exports.getComponentReader=getComponentReader,exports.getElement=getElement,exports.getExtensionFromUri=getExtensionFromUri,exports.getFilenameFromUri=getFilenameFromUri,exports.getImagePixels=getImagePixels,exports.getMagic=getMagic,exports.getStringFromTypedArray=getStringFromTypedArray,exports.getTimestamp=getTimestamp$1,exports.graphemesplitter=GraphemeSplitter,exports.hasExtension=hasExtension,exports.heightReferenceOnEntityPropertyChanged=heightReferenceOnEntityPropertyChanged,exports.isArray=isArray$1,exports.isBitSet=isBitSet,exports.isBlobUri=isBlobUri,exports.isCrossOriginUrl=isCrossOriginUrl,exports.isDataUri=isDataUri,exports.isLeapYear=isLeapYear,exports.jsep=jsep,exports.kdbush=kdbush,exports.knockout=knockout,exports.knockout_3_5_0=knockout,exports.knockout_es5=knockout_es5,exports.loadAndExecuteScript=loadAndExecuteScript,exports.loadCRN=loadCRN,exports.loadCubeMap=loadCubeMap,exports.loadImageFromTypedArray=loadImageFromTypedArray,exports.loadKTX=loadKTX,exports.measureText=measureText,exports.mergeSort=mergeSort,exports.mersenne_twister=MersenneTwister,exports.modernizeShader=modernizeShader,exports.moveTechniqueRenderStates=moveTechniqueRenderStates,exports.moveTechniquesToExtension=moveTechniquesToExtension,exports.numberOfComponentsForType=numberOfComponentsForType,exports.objectToQuery=objectToQuery,exports.oneTimeWarning=oneTimeWarning,exports.parseGlb=parseGlb,exports.parseResponseHeaders=parseResponseHeaders,exports.pointInsideTriangle=pointInsideTriangle,exports.processModelMaterialsCommon=processModelMaterialsCommon,exports.processPbrMaterials=processPbrMaterials,exports.protobuf_minimal=protobuf,exports.purify=purify,exports.queryToObject=queryToObject,exports.quickselect=quickselect,exports.rbush=rbush,exports.readAccessorPacked=readAccessorPacked,exports.removeExtensionsRequired=removeExtensionsRequired,exports.removeExtensionsUsed=removeExtensionsUsed,exports.removePipelineExtras=removePipelineExtras,exports.removeUnusedElements=removeUnusedElements,exports.requestAnimationFrame=requestAnimationFramePolyFill,exports.sampleTerrain=sampleTerrain,exports.sampleTerrainMostDetailed=sampleTerrainMostDetailed,exports.scaleToGeodeticSurface=scaleToGeodeticSurface,exports.sprintf=sprintf,exports.subdivideArray=subdivideArray,exports.subscribeAndEvaluate=subscribeAndEvaluate,exports.topojson=topojson,exports.updateAccessorComponentTypes=updateAccessorComponentTypes,exports.updateVersion=updateVersion,exports.viewerCesium3DTilesInspectorMixin=viewerCesium3DTilesInspectorMixin,exports.viewerCesiumInspectorMixin=viewerCesiumInspectorMixin,exports.viewerDragDropMixin=viewerDragDropMixin,exports.viewerPerformanceWatchdogMixin=viewerPerformanceWatchdogMixin,exports.webGLConstantToGlslType=webGLConstantToGlslType,exports.when=when,exports.wrapFunction=wrapFunction,exports.writeTextToCanvas=writeTextToCanvas,exports.zip=zip,Object.defineProperty(exports,"__esModule",{value:!0})});