49 lines
3.3 MiB
49 lines
3.3 MiB
import{Q as e,a3 as t,_ as n,r as i,a2 as o,x as r,a4 as s,d as a,o as c,c as l,N as u,e as d,w as h,l as p,A as f,f as m,m as _,I as g,a5 as y,a6 as b,a7 as v,n as A,K as T,M as w,J as E,O as x,a8 as S}from"./index.e5c8b0d6.js";import{R as C}from"./index.030fe210.js";import{d as I}from"./download.57166482.js";function O(t){return e({url:"/hjjc/gjdevhsjqcx",method:"get",params:t})}function D(e){return null!=e}function P(e){let t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(n){t=n.stack}this.stack=t}D(Object.create)&&(P.prototype=Object.create(Error.prototype),P.prototype.constructor=P),P.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return D(this.stack)&&(e+=`\n${this.stack.toString()}`),e},P.throwInstantiationError=function(){throw new P("This function defines an interface and should not be called directly.")};const N={};function R(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}N.typeOf={},N.defined=function(e,t){if(!D(t))throw new P(function(e){return`${e} is required, actual value was undefined`}(e))},N.typeOf.func=function(e,t){if("function"!=typeof t)throw new P(R(typeof t,"function",e))},N.typeOf.string=function(e,t){if("string"!=typeof t)throw new P(R(typeof t,"string",e))},N.typeOf.number=function(e,t){if("number"!=typeof t)throw new P(R(typeof t,"number",e))},N.typeOf.number.lessThan=function(e,t,n){if(N.typeOf.number(e,t),t>=n)throw new P(`Expected ${e} to be less than ${n}, actual value was ${t}`)},N.typeOf.number.lessThanOrEquals=function(e,t,n){if(N.typeOf.number(e,t),t>n)throw new P(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)},N.typeOf.number.greaterThan=function(e,t,n){if(N.typeOf.number(e,t),t<=n)throw new P(`Expected ${e} to be greater than ${n}, actual value was ${t}`)},N.typeOf.number.greaterThanOrEquals=function(e,t,n){if(N.typeOf.number(e,t),t<n)throw new P(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)},N.typeOf.object=function(e,t){if("object"!=typeof t)throw new P(R(typeof t,"object",e))},N.typeOf.bool=function(e,t){if("boolean"!=typeof t)throw new P(R(typeof t,"boolean",e))},N.typeOf.bigint=function(e,t){if("bigint"!=typeof t)throw new P(R(typeof t,"bigint",e))},N.typeOf.number.equals=function(e,t,n,i){if(N.typeOf.number(e,n),N.typeOf.number(t,i),n!==i)throw new P(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};const L=N;function M(e,t){return null!=e?e:t}M.EMPTY_OBJECT=Object.freeze({});var F=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,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};F.prototype.init_seed=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}},F.prototype.init_by_array=function(e,t){var n,i,o;for(this.init_seed(19650218),n=1,i=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1664525*((4294901760&r)>>>16)<<16)+1664525*(65535&r))+e[i]+i,this.mt[n]>>>=0,i++,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(o=this.N-1;o;o--){r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1566083941*((4294901760&r)>>>16)<<16)+1566083941*(65535&r))-n,this.mt[n]>>>=0,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648},F.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[1&e];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[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},F.prototype.random_int31=function(){return this.random_int()>>>1},F.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},F.prototype.random=function(){return this.random_int()*(1/4294967296)},F.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},F.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)};var B=F;const z={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};z.sign=M(Math.sign,(function(e){return 0===(e=+e)||e!=e?e:e>0?1:-1})),z.signNotZero=function(e){return e<0?-1:1},z.toSNorm=function(e,t){return t=M(t,255),Math.round((.5*z.clamp(e,-1,1)+.5)*t)},z.fromSNorm=function(e,t){return t=M(t,255),z.clamp(e,0,t)/t*2-1},z.normalize=function(e,t,n){return 0===(n=Math.max(n-t,0))?0:z.clamp((e-t)/n,0,1)},z.sinh=M(Math.sinh,(function(e){return(Math.exp(e)-Math.exp(-e))/2})),z.cosh=M(Math.cosh,(function(e){return(Math.exp(e)+Math.exp(-e))/2})),z.lerp=function(e,t,n){return(1-n)*e+n*t},z.PI=Math.PI,z.ONE_OVER_PI=1/Math.PI,z.PI_OVER_TWO=Math.PI/2,z.PI_OVER_THREE=Math.PI/3,z.PI_OVER_FOUR=Math.PI/4,z.PI_OVER_SIX=Math.PI/6,z.THREE_PI_OVER_TWO=3*Math.PI/2,z.TWO_PI=2*Math.PI,z.ONE_OVER_TWO_PI=1/(2*Math.PI),z.RADIANS_PER_DEGREE=Math.PI/180,z.DEGREES_PER_RADIAN=180/Math.PI,z.RADIANS_PER_ARCSECOND=z.RADIANS_PER_DEGREE/3600,z.toRadians=function(e){if(!D(e))throw new P("degrees is required.");return e*z.RADIANS_PER_DEGREE},z.toDegrees=function(e){if(!D(e))throw new P("radians is required.");return e*z.DEGREES_PER_RADIAN},z.convertLongitudeRange=function(e){if(!D(e))throw new P("angle is required.");const t=z.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},z.clampToLatitudeRange=function(e){if(!D(e))throw new P("angle is required.");return z.clamp(e,-1*z.PI_OVER_TWO,z.PI_OVER_TWO)},z.negativePiToPi=function(e){if(!D(e))throw new P("angle is required.");return e>=-z.PI&&e<=z.PI?e:z.zeroToTwoPi(e+z.PI)-z.PI},z.zeroToTwoPi=function(e){if(!D(e))throw new P("angle is required.");if(e>=0&&e<=z.TWO_PI)return e;const t=z.mod(e,z.TWO_PI);return Math.abs(t)<z.EPSILON14&&Math.abs(e)>z.EPSILON14?z.TWO_PI:t},z.mod=function(e,t){if(!D(e))throw new P("m is required.");if(!D(t))throw new P("n is required.");if(0===t)throw new P("divisor cannot be 0.");return z.sign(e)===z.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t},z.equalsEpsilon=function(e,t,n,i){if(!D(e))throw new P("left is required.");if(!D(t))throw new P("right is required.");n=M(n,0),i=M(i,n);const o=Math.abs(e-t);return o<=i||o<=n*Math.max(Math.abs(e),Math.abs(t))},z.lessThan=function(e,t,n){if(!D(e))throw new P("first is required.");if(!D(t))throw new P("second is required.");if(!D(n))throw new P("absoluteEpsilon is required.");return e-t<-n},z.lessThanOrEquals=function(e,t,n){if(!D(e))throw new P("first is required.");if(!D(t))throw new P("second is required.");if(!D(n))throw new P("absoluteEpsilon is required.");return e-t<n},z.greaterThan=function(e,t,n){if(!D(e))throw new P("first is required.");if(!D(t))throw new P("second is required.");if(!D(n))throw new P("absoluteEpsilon is required.");return e-t>n},z.greaterThanOrEquals=function(e,t,n){if(!D(e))throw new P("first is required.");if(!D(t))throw new P("second is required.");if(!D(n))throw new P("absoluteEpsilon is required.");return e-t>-n};const U=[1];z.factorial=function(e){if("number"!=typeof e||e<0)throw new P("A number greater than or equal to 0 is required.");const t=U.length;if(e>=t){let n=U[t-1];for(let i=t;i<=e;i++){const e=n*i;U.push(e),n=e}}return U[e]},z.incrementWrap=function(e,t,n){if(n=M(n,0),!D(e))throw new P("n is required.");if(t<=n)throw new P("maximumValue must be greater than minimumValue.");return++e>t&&(e=n),e},z.isPowerOfTwo=function(e){if("number"!=typeof e||e<0||e>4294967295)throw new P("A number between 0 and (2^32)-1 is required.");return 0!==e&&!(e&e-1)},z.nextPowerOfTwo=function(e){if("number"!=typeof e||e<0||e>2147483648)throw new P("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},z.previousPowerOfTwo=function(e){if("number"!=typeof e||e<0||e>4294967295)throw new P("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e=((e|=e>>32)>>>0)-(e>>>1)},z.clamp=function(e,t,n){return L.typeOf.number("value",e),L.typeOf.number("min",t),L.typeOf.number("max",n),e<t?t:e>n?n:e};let k=new B;z.setRandomNumberSeed=function(e){if(!D(e))throw new P("seed is required.");k=new B(e)},z.nextRandomNumber=function(){return k.random()},z.randomBetween=function(e,t){return z.nextRandomNumber()*(t-e)+e},z.acosClamped=function(e){if(!D(e))throw new P("value is required.");return Math.acos(z.clamp(e,-1,1))},z.asinClamped=function(e){if(!D(e))throw new P("value is required.");return Math.asin(z.clamp(e,-1,1))},z.chordLength=function(e,t){if(!D(e))throw new P("angle is required.");if(!D(t))throw new P("radius is required.");return 2*t*Math.sin(.5*e)},z.logBase=function(e,t){if(!D(e))throw new P("number is required.");if(!D(t))throw new P("base is required.");return Math.log(e)/Math.log(t)},z.cbrt=M(Math.cbrt,(function(e){const t=Math.pow(Math.abs(e),1/3);return e<0?-t:t})),z.log2=M(Math.log2,(function(e){return Math.log(e)*Math.LOG2E})),z.fog=function(e,t){const n=e*t;return 1-Math.exp(-n*n)},z.fastApproximateAtan=function(e){return L.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},z.fastApproximateAtan2=function(e,t){let n;L.typeOf.number("x",e),L.typeOf.number("y",t);let i=Math.abs(e);n=Math.abs(t);const o=Math.max(i,n);n=Math.min(i,n);const r=n/o;if(isNaN(r))throw new P("either x or y must be nonzero");return i=z.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?z.PI_OVER_TWO-i:i,i=e<0?z.PI-i:i,i=t<0?-i:i,i};const V=z;function H(e,t,n){this.x=M(e,0),this.y=M(t,0),this.z=M(n,0)}H.fromSpherical=function(e,t){L.typeOf.object("spherical",e),D(t)||(t=new H);const n=e.clock,i=e.cone,o=M(e.magnitude,1),r=o*Math.sin(i);return t.x=r*Math.cos(n),t.y=r*Math.sin(n),t.z=o*Math.cos(i),t},H.fromElements=function(e,t,n,i){return D(i)?(i.x=e,i.y=t,i.z=n,i):new H(e,t,n)},H.clone=function(e,t){if(D(e))return D(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new H(e.x,e.y,e.z)},H.fromCartesian4=H.clone,H.packedLength=3,H.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t},H.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new H),n.x=e[t++],n.y=e[t++],n.z=e[t],n},H.packArray=function(e,t){L.defined("array",e);const n=e.length,i=3*n;if(D(t)){if(!Array.isArray(t)&&t.length!==i)throw new P("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let o=0;o<n;++o)H.pack(e[o],t,3*o);return t},H.unpackArray=function(e,t){if(L.defined("array",e),L.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!=0)throw new P("array length must be a multiple of 3.");const n=e.length;D(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){const n=i/3;t[n]=H.unpack(e,i,t[n])}return t},H.fromArray=H.unpack,H.maximumComponent=function(e){return L.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)},H.minimumComponent=function(e){return L.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)},H.minimumByComponent=function(e,t,n){return L.typeOf.object("first",e),L.typeOf.object("second",t),L.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n},H.maximumByComponent=function(e,t,n){return L.typeOf.object("first",e),L.typeOf.object("second",t),L.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n},H.clamp=function(e,t,n,i){L.typeOf.object("value",e),L.typeOf.object("min",t),L.typeOf.object("max",n),L.typeOf.object("result",i);const o=V.clamp(e.x,t.x,n.x),r=V.clamp(e.y,t.y,n.y),s=V.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i},H.magnitudeSquared=function(e){return L.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z},H.magnitude=function(e){return Math.sqrt(H.magnitudeSquared(e))};const G=new H;H.distance=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),H.subtract(e,t,G),H.magnitude(G)},H.distanceSquared=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),H.subtract(e,t,G),H.magnitudeSquared(G)},H.normalize=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=H.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new P("normalized result is not a number");return t},H.dot=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z},H.multiplyComponents=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n},H.divideComponents=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n},H.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n},H.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n},H.multiplyByScalar=function(e,t,n){return L.typeOf.object("cartesian",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n},H.divideByScalar=function(e,t,n){return L.typeOf.object("cartesian",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n},H.negate=function(e,t){return L.typeOf.object("cartesian",e),L.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t},H.abs=function(e,t){return L.typeOf.object("cartesian",e),L.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const j=new H;H.lerp=function(e,t,n,i){return L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i),H.multiplyByScalar(t,n,j),i=H.multiplyByScalar(e,1-n,i),H.add(j,i,i)};const W=new H,q=new H;H.angleBetween=function(e,t){L.typeOf.object("left",e),L.typeOf.object("right",t),H.normalize(e,W),H.normalize(t,q);const n=H.dot(W,q),i=H.magnitude(H.cross(W,q,W));return Math.atan2(i,n)};const Y=new H;H.mostOrthogonalAxis=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=H.normalize(e,Y);return H.abs(n,n),t=n.x<=n.y?n.x<=n.z?H.clone(H.UNIT_X,t):H.clone(H.UNIT_Z,t):n.y<=n.z?H.clone(H.UNIT_Y,t):H.clone(H.UNIT_Z,t)},H.projectVector=function(e,t,n){L.defined("a",e),L.defined("b",t),L.defined("result",n);const i=H.dot(e,t)/H.dot(t,t);return H.multiplyByScalar(t,i,n)},H.equals=function(e,t){return e===t||D(e)&&D(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},H.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]},H.equalsEpsilon=function(e,t,n,i){return e===t||D(e)&&D(t)&&V.equalsEpsilon(e.x,t.x,n,i)&&V.equalsEpsilon(e.y,t.y,n,i)&&V.equalsEpsilon(e.z,t.z,n,i)},H.cross=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=t.x,a=t.y,c=t.z,l=o*c-r*a,u=r*s-i*c,d=i*a-o*s;return n.x=l,n.y=u,n.z=d,n},H.midpoint=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y),n.z=.5*(e.z+t.z),n},H.fromDegrees=function(e,t,n,i,o){return L.typeOf.number("longitude",e),L.typeOf.number("latitude",t),e=V.toRadians(e),t=V.toRadians(t),H.fromRadians(e,t,n,i,o)};let X=new H,Q=new H;const $=new H(40680631590769,40680631590769,40408299984661.445);function K(e,t,n,i){this.x=M(e,0),this.y=M(t,0),this.z=M(n,0),this.w=M(i,0)}H.fromRadians=function(e,t,n,i,o){L.typeOf.number("longitude",e),L.typeOf.number("latitude",t),n=M(n,0);const r=D(i)?i.radiiSquared:$,s=Math.cos(t);X.x=s*Math.cos(e),X.y=s*Math.sin(e),X.z=Math.sin(t),X=H.normalize(X,X),H.multiplyComponents(r,X,Q);const a=Math.sqrt(H.dot(X,Q));return Q=H.divideByScalar(Q,a,Q),X=H.multiplyByScalar(X,n,X),D(o)||(o=new H),H.add(Q,X,o)},H.fromDegreesArray=function(e,t,n){if(L.defined("coordinates",e),e.length<2||e.length%2!=0)throw new P("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;D(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const i=e[o],r=e[o+1],s=o/2;n[s]=H.fromDegrees(i,r,0,t,n[s])}return n},H.fromRadiansArray=function(e,t,n){if(L.defined("coordinates",e),e.length<2||e.length%2!=0)throw new P("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;D(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const i=e[o],r=e[o+1],s=o/2;n[s]=H.fromRadians(i,r,0,t,n[s])}return n},H.fromDegreesArrayHeights=function(e,t,n){if(L.defined("coordinates",e),e.length<3||e.length%3!=0)throw new P("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;D(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const i=e[o],r=e[o+1],s=e[o+2],a=o/3;n[a]=H.fromDegrees(i,r,s,t,n[a])}return n},H.fromRadiansArrayHeights=function(e,t,n){if(L.defined("coordinates",e),e.length<3||e.length%3!=0)throw new P("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;D(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const i=e[o],r=e[o+1],s=e[o+2],a=o/3;n[a]=H.fromRadians(i,r,s,t,n[a])}return n},H.ZERO=Object.freeze(new H(0,0,0)),H.ONE=Object.freeze(new H(1,1,1)),H.UNIT_X=Object.freeze(new H(1,0,0)),H.UNIT_Y=Object.freeze(new H(0,1,0)),H.UNIT_Z=Object.freeze(new H(0,0,1)),H.prototype.clone=function(e){return H.clone(this,e)},H.prototype.equals=function(e){return H.equals(this,e)},H.prototype.equalsEpsilon=function(e,t,n){return H.equalsEpsilon(this,e,t,n)},H.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`},K.fromElements=function(e,t,n,i,o){return D(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new K(e,t,n,i)},K.fromColor=function(e,t){return L.typeOf.object("color",e),D(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new K(e.red,e.green,e.blue,e.alpha)},K.clone=function(e,t){if(D(e))return D(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new K(e.x,e.y,e.z,e.w)},K.packedLength=4,K.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t},K.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new K),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n},K.packArray=function(e,t){L.defined("array",e);const n=e.length,i=4*n;if(D(t)){if(!Array.isArray(t)&&t.length!==i)throw new P("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let o=0;o<n;++o)K.pack(e[o],t,4*o);return t},K.unpackArray=function(e,t){if(L.defined("array",e),L.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!=0)throw new P("array length must be a multiple of 4.");const n=e.length;D(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const n=i/4;t[n]=K.unpack(e,i,t[n])}return t},K.fromArray=K.unpack,K.maximumComponent=function(e){return L.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)},K.minimumComponent=function(e){return L.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)},K.minimumByComponent=function(e,t,n){return L.typeOf.object("first",e),L.typeOf.object("second",t),L.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n},K.maximumByComponent=function(e,t,n){return L.typeOf.object("first",e),L.typeOf.object("second",t),L.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n},K.clamp=function(e,t,n,i){L.typeOf.object("value",e),L.typeOf.object("min",t),L.typeOf.object("max",n),L.typeOf.object("result",i);const o=V.clamp(e.x,t.x,n.x),r=V.clamp(e.y,t.y,n.y),s=V.clamp(e.z,t.z,n.z),a=V.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i},K.magnitudeSquared=function(e){return L.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},K.magnitude=function(e){return Math.sqrt(K.magnitudeSquared(e))};const Z=new K;K.distance=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),K.subtract(e,t,Z),K.magnitude(Z)},K.distanceSquared=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),K.subtract(e,t,Z),K.magnitudeSquared(Z)},K.normalize=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=K.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new P("normalized result is not a number");return t},K.dot=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},K.multiplyComponents=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n},K.divideComponents=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n},K.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},K.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},K.multiplyByScalar=function(e,t,n){return L.typeOf.object("cartesian",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},K.divideByScalar=function(e,t,n){return L.typeOf.object("cartesian",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},K.negate=function(e,t){return L.typeOf.object("cartesian",e),L.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},K.abs=function(e,t){return L.typeOf.object("cartesian",e),L.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};const J=new K;K.lerp=function(e,t,n,i){return L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i),K.multiplyByScalar(t,n,J),i=K.multiplyByScalar(e,1-n,i),K.add(J,i,i)};const ee=new K;K.mostOrthogonalAxis=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=K.normalize(e,ee);return K.abs(n,n),t=n.x<=n.y?n.x<=n.z?n.x<=n.w?K.clone(K.UNIT_X,t):K.clone(K.UNIT_W,t):n.z<=n.w?K.clone(K.UNIT_Z,t):K.clone(K.UNIT_W,t):n.y<=n.z?n.y<=n.w?K.clone(K.UNIT_Y,t):K.clone(K.UNIT_W,t):n.z<=n.w?K.clone(K.UNIT_Z,t):K.clone(K.UNIT_W,t)},K.equals=function(e,t){return e===t||D(e)&&D(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},K.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]},K.equalsEpsilon=function(e,t,n,i){return e===t||D(e)&&D(t)&&V.equalsEpsilon(e.x,t.x,n,i)&&V.equalsEpsilon(e.y,t.y,n,i)&&V.equalsEpsilon(e.z,t.z,n,i)&&V.equalsEpsilon(e.w,t.w,n,i)},K.ZERO=Object.freeze(new K(0,0,0,0)),K.ONE=Object.freeze(new K(1,1,1,1)),K.UNIT_X=Object.freeze(new K(1,0,0,0)),K.UNIT_Y=Object.freeze(new K(0,1,0,0)),K.UNIT_Z=Object.freeze(new K(0,0,1,0)),K.UNIT_W=Object.freeze(new K(0,0,0,1)),K.prototype.clone=function(e){return K.clone(this,e)},K.prototype.equals=function(e){return K.equals(this,e)},K.prototype.equalsEpsilon=function(e,t,n){return K.equalsEpsilon(this,e,t,n)},K.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const te=new Float32Array(1),ne=new Uint8Array(te.buffer),ie=new Uint32Array([287454020]),oe=68===new Uint8Array(ie.buffer)[0];function re(e,t,n,i,o,r,s,a,c){this[0]=M(e,0),this[1]=M(i,0),this[2]=M(s,0),this[3]=M(t,0),this[4]=M(o,0),this[5]=M(a,0),this[6]=M(n,0),this[7]=M(r,0),this[8]=M(c,0)}K.packFloat=function(e,t){return L.typeOf.number("value",e),D(t)||(t=new K),te[0]=e,oe?(t.x=ne[0],t.y=ne[1],t.z=ne[2],t.w=ne[3]):(t.x=ne[3],t.y=ne[2],t.z=ne[1],t.w=ne[0]),t},K.unpackFloat=function(e){return L.typeOf.object("packedFloat",e),oe?(ne[0]=e.x,ne[1]=e.y,ne[2]=e.z,ne[3]=e.w):(ne[0]=e.w,ne[1]=e.z,ne[2]=e.y,ne[3]=e.x),te[0]},re.packedLength=9,re.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t},re.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new re),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n},re.packArray=function(e,t){L.defined("array",e);const n=e.length,i=9*n;if(D(t)){if(!Array.isArray(t)&&t.length!==i)throw new P("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let o=0;o<n;++o)re.pack(e[o],t,9*o);return t},re.unpackArray=function(e,t){if(L.defined("array",e),L.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!=0)throw new P("array length must be a multiple of 9.");const n=e.length;D(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){const n=i/9;t[n]=re.unpack(e,i,t[n])}return t},re.clone=function(e,t){if(D(e))return D(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 re(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},re.fromArray=re.unpack,re.fromColumnMajorArray=function(e,t){return L.defined("values",e),re.clone(e,t)},re.fromRowMajorArray=function(e,t){return L.defined("values",e),D(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 re(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},re.fromQuaternion=function(e,t){L.typeOf.object("quaternion",e);const n=e.x*e.x,i=e.x*e.y,o=e.x*e.z,r=e.x*e.w,s=e.y*e.y,a=e.y*e.z,c=e.y*e.w,l=e.z*e.z,u=e.z*e.w,d=e.w*e.w,h=n-s-l+d,p=2*(i-u),f=2*(o+c),m=2*(i+u),_=-n+s-l+d,g=2*(a-r),y=2*(o-c),b=2*(a+r),v=-n-s+l+d;return D(t)?(t[0]=h,t[1]=m,t[2]=y,t[3]=p,t[4]=_,t[5]=b,t[6]=f,t[7]=g,t[8]=v,t):new re(h,p,f,m,_,g,y,b,v)},re.fromHeadingPitchRoll=function(e,t){L.typeOf.object("headingPitchRoll",e);const n=Math.cos(-e.pitch),i=Math.cos(-e.heading),o=Math.cos(e.roll),r=Math.sin(-e.pitch),s=Math.sin(-e.heading),a=Math.sin(e.roll),c=n*i,l=-o*s+a*r*i,u=a*s+o*r*i,d=n*s,h=o*i+a*r*s,p=-a*i+o*r*s,f=-r,m=a*n,_=o*n;return D(t)?(t[0]=c,t[1]=d,t[2]=f,t[3]=l,t[4]=h,t[5]=m,t[6]=u,t[7]=p,t[8]=_,t):new re(c,l,u,d,h,p,f,m,_)},re.fromScale=function(e,t){return L.typeOf.object("scale",e),D(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 re(e.x,0,0,0,e.y,0,0,0,e.z)},re.fromUniformScale=function(e,t){return L.typeOf.number("scale",e),D(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 re(e,0,0,0,e,0,0,0,e)},re.fromCrossProduct=function(e,t){return L.typeOf.object("vector",e),D(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 re(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},re.fromRotationX=function(e,t){L.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return D(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new re(1,0,0,0,n,-i,0,i,n)},re.fromRotationY=function(e,t){L.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return D(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new re(n,0,i,0,1,0,-i,0,n)},re.fromRotationZ=function(e,t){L.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return D(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new re(n,-i,0,i,n,0,0,0,1)},re.toArray=function(e,t){return L.typeOf.object("matrix",e),D(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]]},re.getElementIndex=function(e,t){return L.typeOf.number.greaterThanOrEquals("row",t,0),L.typeOf.number.lessThanOrEquals("row",t,2),L.typeOf.number.greaterThanOrEquals("column",e,0),L.typeOf.number.lessThanOrEquals("column",e,2),3*e+t},re.getColumn=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,2),L.typeOf.object("result",n);const i=3*t,o=e[i],r=e[i+1],s=e[i+2];return n.x=o,n.y=r,n.z=s,n},re.setColumn=function(e,t,n,i){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,2),L.typeOf.object("cartesian",n),L.typeOf.object("result",i);const o=3*t;return(i=re.clone(e,i))[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i},re.getRow=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,2),L.typeOf.object("result",n);const i=e[t],o=e[t+3],r=e[t+6];return n.x=i,n.y=o,n.z=r,n},re.setRow=function(e,t,n,i){return L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,2),L.typeOf.object("cartesian",n),L.typeOf.object("result",i),(i=re.clone(e,i))[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const se=new H;re.setScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("scale",t),L.typeOf.object("result",n);const i=re.getScale(e,se),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const ae=new H;re.setUniformScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number("scale",t),L.typeOf.object("result",n);const i=re.getScale(e,ae),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const ce=new H;re.getScale=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t.x=H.magnitude(H.fromElements(e[0],e[1],e[2],ce)),t.y=H.magnitude(H.fromElements(e[3],e[4],e[5],ce)),t.z=H.magnitude(H.fromElements(e[6],e[7],e[8],ce)),t};const le=new H;re.getMaximumScale=function(e){return re.getScale(e,le),H.maximumComponent(le)};const ue=new H;re.setRotation=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("result",n);const i=re.getScale(e,ue);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=t[3]*i.y,n[4]=t[4]*i.y,n[5]=t[5]*i.y,n[6]=t[6]*i.z,n[7]=t[7]*i.z,n[8]=t[8]*i.z,n};const de=new H;re.getRotation=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=re.getScale(e,de);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t},re.multiply=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n);const i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],r=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],s=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],a=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],l=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 n[0]=i,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=c,n[6]=l,n[7]=u,n[8]=d,n},re.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n},re.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n},re.multiplyByVector=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("cartesian",t),L.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[3]*o+e[6]*r,a=e[1]*i+e[4]*o+e[7]*r,c=e[2]*i+e[5]*o+e[8]*r;return n.x=s,n.y=a,n.z=c,n},re.multiplyByScalar=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},re.multiplyByScale=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.object("scale",t),L.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n},re.multiplyByUniformScale=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.number("scale",t),L.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n},re.negate=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},re.transpose=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=e[0],i=e[3],o=e[6],r=e[1],s=e[4],a=e[7],c=e[2],l=e[5],u=e[8];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t[4]=s,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t};const he=[1,0,0],pe=[2,2,1];function fe(e){let t=0;for(let n=0;n<3;++n){const i=e[re.getElementIndex(pe[n],he[n])];t+=2*i*i}return Math.sqrt(t)}function me(e,t){const n=V.EPSILON15;let i=0,o=1;for(let l=0;l<3;++l){const t=Math.abs(e[re.getElementIndex(pe[l],he[l])]);t>i&&(o=l,i=t)}let r=1,s=0;const a=he[o],c=pe[o];if(Math.abs(e[re.getElementIndex(c,a)])>n){const t=(e[re.getElementIndex(c,c)]-e[re.getElementIndex(a,a)])/2/e[re.getElementIndex(c,a)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),r=1/Math.sqrt(1+n*n),s=n*r}return(t=re.clone(re.IDENTITY,t))[re.getElementIndex(a,a)]=t[re.getElementIndex(c,c)]=r,t[re.getElementIndex(c,a)]=s,t[re.getElementIndex(a,c)]=-s,t}const _e=new re,ge=new re;re.computeEigenDecomposition=function(e,t){L.typeOf.object("matrix",e);const n=V.EPSILON20;let i=0,o=0;D(t)||(t={});const r=t.unitary=re.clone(re.IDENTITY,t.unitary),s=t.diagonal=re.clone(e,t.diagonal),a=n*function(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}(s);for(;o<10&&fe(s)>a;)me(s,_e),re.transpose(_e,ge),re.multiply(s,_e,s),re.multiply(ge,s,s),re.multiply(r,_e,r),++i>2&&(++o,i=0);return t},re.abs=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},re.determinant=function(e){L.typeOf.object("matrix",e);const t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],c=e[5],l=e[8];return t*(r*l-c*s)+o*(c*i-n*l)+a*(n*s-r*i)},re.inverse=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],d=re.determinant(e);if(Math.abs(d)<=V.EPSILON15)throw new P("matrix is not invertible");t[0]=s*u-l*a,t[1]=l*o-i*u,t[2]=i*a-s*o,t[3]=c*a-r*u,t[4]=n*u-c*o,t[5]=r*o-n*a,t[6]=r*l-c*s,t[7]=c*i-n*l,t[8]=n*s-r*i;const h=1/d;return re.multiplyByScalar(t,h,t)};const ye=new re;function be(e){let t;this.name="RuntimeError",this.message=e;try{throw new Error}catch(n){t=n.stack}this.stack=t}function ve(e,t,n,i,o,r,s,a,c,l,u,d,h,p,f,m){this[0]=M(e,0),this[1]=M(o,0),this[2]=M(c,0),this[3]=M(h,0),this[4]=M(t,0),this[5]=M(r,0),this[6]=M(l,0),this[7]=M(p,0),this[8]=M(n,0),this[9]=M(s,0),this[10]=M(u,0),this[11]=M(f,0),this[12]=M(i,0),this[13]=M(a,0),this[14]=M(d,0),this[15]=M(m,0)}re.inverseTranspose=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),re.inverse(re.transpose(e,ye),t)},re.equals=function(e,t){return e===t||D(e)&&D(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]},re.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},re.IDENTITY=Object.freeze(new re(1,0,0,0,1,0,0,0,1)),re.ZERO=Object.freeze(new re(0,0,0,0,0,0,0,0,0)),re.COLUMN0ROW0=0,re.COLUMN0ROW1=1,re.COLUMN0ROW2=2,re.COLUMN1ROW0=3,re.COLUMN1ROW1=4,re.COLUMN1ROW2=5,re.COLUMN2ROW0=6,re.COLUMN2ROW1=7,re.COLUMN2ROW2=8,Object.defineProperties(re.prototype,{length:{get:function(){return re.packedLength}}}),re.prototype.clone=function(e){return re.clone(this,e)},re.prototype.equals=function(e){return re.equals(this,e)},re.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},re.prototype.equalsEpsilon=function(e,t){return re.equalsEpsilon(this,e,t)},re.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})`},D(Object.create)&&(be.prototype=Object.create(Error.prototype),be.prototype.constructor=be),be.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return D(this.stack)&&(e+=`\n${this.stack.toString()}`),e},ve.packedLength=16,ve.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t},ve.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new ve),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n},ve.packArray=function(e,t){L.defined("array",e);const n=e.length,i=16*n;if(D(t)){if(!Array.isArray(t)&&t.length!==i)throw new P("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let o=0;o<n;++o)ve.pack(e[o],t,16*o);return t},ve.unpackArray=function(e,t){if(L.defined("array",e),L.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!=0)throw new P("array length must be a multiple of 16.");const n=e.length;D(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){const n=i/16;t[n]=ve.unpack(e,i,t[n])}return t},ve.clone=function(e,t){if(D(e))return D(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 ve(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])},ve.fromArray=ve.unpack,ve.fromColumnMajorArray=function(e,t){return L.defined("values",e),ve.clone(e,t)},ve.fromRowMajorArray=function(e,t){return L.defined("values",e),D(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 ve(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])},ve.fromRotationTranslation=function(e,t,n){return L.typeOf.object("rotation",e),t=M(t,H.ZERO),D(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new ve(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)},ve.fromTranslationQuaternionRotationScale=function(e,t,n,i){L.typeOf.object("translation",e),L.typeOf.object("rotation",t),L.typeOf.object("scale",n),D(i)||(i=new ve);const o=n.x,r=n.y,s=n.z,a=t.x*t.x,c=t.x*t.y,l=t.x*t.z,u=t.x*t.w,d=t.y*t.y,h=t.y*t.z,p=t.y*t.w,f=t.z*t.z,m=t.z*t.w,_=t.w*t.w,g=a-d-f+_,y=2*(c-m),b=2*(l+p),v=2*(c+m),A=-a+d-f+_,T=2*(h-u),w=2*(l-p),E=2*(h+u),x=-a-d+f+_;return i[0]=g*o,i[1]=v*o,i[2]=w*o,i[3]=0,i[4]=y*r,i[5]=A*r,i[6]=E*r,i[7]=0,i[8]=b*s,i[9]=T*s,i[10]=x*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},ve.fromTranslationRotationScale=function(e,t){return L.typeOf.object("translationRotationScale",e),ve.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)},ve.fromTranslation=function(e,t){return L.typeOf.object("translation",e),ve.fromRotationTranslation(re.IDENTITY,e,t)},ve.fromScale=function(e,t){return L.typeOf.object("scale",e),D(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 ve(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},ve.fromUniformScale=function(e,t){return L.typeOf.number("scale",e),D(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 ve(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)},ve.fromRotation=function(e,t){return L.typeOf.object("rotation",e),D(t)||(t=new ve),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};const Ae=new H,Te=new H,we=new H;ve.fromCamera=function(e,t){L.typeOf.object("camera",e);const n=e.position,i=e.direction,o=e.up;L.typeOf.object("camera.position",n),L.typeOf.object("camera.direction",i),L.typeOf.object("camera.up",o),H.normalize(i,Ae),H.normalize(H.cross(Ae,o,Te),Te),H.normalize(H.cross(Te,Ae,we),we);const r=Te.x,s=Te.y,a=Te.z,c=Ae.x,l=Ae.y,u=Ae.z,d=we.x,h=we.y,p=we.z,f=n.x,m=n.y,_=n.z,g=r*-f+s*-m+a*-_,y=d*-f+h*-m+p*-_,b=c*f+l*m+u*_;return D(t)?(t[0]=r,t[1]=d,t[2]=-c,t[3]=0,t[4]=s,t[5]=h,t[6]=-l,t[7]=0,t[8]=a,t[9]=p,t[10]=-u,t[11]=0,t[12]=g,t[13]=y,t[14]=b,t[15]=1,t):new ve(r,s,a,g,d,h,p,y,-c,-l,-u,b,0,0,0,1)},ve.computePerspectiveFieldOfView=function(e,t,n,i,o){L.typeOf.number.greaterThan("fovY",e,0),L.typeOf.number.lessThan("fovY",e,Math.PI),L.typeOf.number.greaterThan("near",n,0),L.typeOf.number.greaterThan("far",i,0),L.typeOf.object("result",o);const r=1/Math.tan(.5*e),s=r/t,a=(i+n)/(n-i),c=2*i*n/(n-i);return o[0]=s,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=r,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=a,o[11]=-1,o[12]=0,o[13]=0,o[14]=c,o[15]=0,o},ve.computeOrthographicOffCenter=function(e,t,n,i,o,r,s){L.typeOf.number("left",e),L.typeOf.number("right",t),L.typeOf.number("bottom",n),L.typeOf.number("top",i),L.typeOf.number("near",o),L.typeOf.number("far",r),L.typeOf.object("result",s);let a=1/(t-e),c=1/(i-n),l=1/(r-o);const u=-(t+e)*a,d=-(i+n)*c,h=-(r+o)*l;return a*=2,c*=2,l*=-2,s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=l,s[11]=0,s[12]=u,s[13]=d,s[14]=h,s[15]=1,s},ve.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){L.typeOf.number("left",e),L.typeOf.number("right",t),L.typeOf.number("bottom",n),L.typeOf.number("top",i),L.typeOf.number("near",o),L.typeOf.number("far",r),L.typeOf.object("result",s);const a=2*o/(t-e),c=2*o/(i-n),l=(t+e)/(t-e),u=(i+n)/(i-n),d=-(r+o)/(r-o),h=-2*r*o/(r-o);return s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=l,s[9]=u,s[10]=d,s[11]=-1,s[12]=0,s[13]=0,s[14]=h,s[15]=0,s},ve.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){L.typeOf.number("left",e),L.typeOf.number("right",t),L.typeOf.number("bottom",n),L.typeOf.number("top",i),L.typeOf.number("near",o),L.typeOf.object("result",r);const s=2*o/(t-e),a=2*o/(i-n),c=(t+e)/(t-e),l=(i+n)/(i-n),u=-2*o;return r[0]=s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=c,r[9]=l,r[10]=-1,r[11]=-1,r[12]=0,r[13]=0,r[14]=u,r[15]=0,r},ve.computeViewportTransformation=function(e,t,n,i){D(i)||(i=new ve),e=M(e,M.EMPTY_OBJECT);const o=M(e.x,0),r=M(e.y,0),s=M(e.width,0),a=M(e.height,0);t=M(t,0);const c=.5*s,l=.5*a,u=.5*((n=M(n,1))-t),d=c,h=l,p=u,f=o+c,m=r+l,_=t+u;return i[0]=d,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=p,i[11]=0,i[12]=f,i[13]=m,i[14]=_,i[15]=1,i},ve.computeView=function(e,t,n,i,o){return L.typeOf.object("position",e),L.typeOf.object("direction",t),L.typeOf.object("up",n),L.typeOf.object("right",i),L.typeOf.object("result",o),o[0]=i.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=i.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=i.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-H.dot(i,e),o[13]=-H.dot(n,e),o[14]=H.dot(t,e),o[15]=1,o},ve.toArray=function(e,t){return L.typeOf.object("matrix",e),D(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]]},ve.getElementIndex=function(e,t){return L.typeOf.number.greaterThanOrEquals("row",t,0),L.typeOf.number.lessThanOrEquals("row",t,3),L.typeOf.number.greaterThanOrEquals("column",e,0),L.typeOf.number.lessThanOrEquals("column",e,3),4*e+t},ve.getColumn=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,3),L.typeOf.object("result",n);const i=4*t,o=e[i],r=e[i+1],s=e[i+2],a=e[i+3];return n.x=o,n.y=r,n.z=s,n.w=a,n},ve.setColumn=function(e,t,n,i){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,3),L.typeOf.object("cartesian",n),L.typeOf.object("result",i);const o=4*t;return(i=ve.clone(e,i))[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=n.w,i},ve.getRow=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,3),L.typeOf.object("result",n);const i=e[t],o=e[t+4],r=e[t+8],s=e[t+12];return n.x=i,n.y=o,n.z=r,n.w=s,n},ve.setRow=function(e,t,n,i){return L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,3),L.typeOf.object("cartesian",n),L.typeOf.object("result",i),(i=ve.clone(e,i))[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i},ve.setTranslation=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.object("translation",t),L.typeOf.object("result",n),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};const Ee=new H;ve.setScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("scale",t),L.typeOf.object("result",n);const i=ve.getScale(e,Ee),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const xe=new H;ve.setUniformScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number("scale",t),L.typeOf.object("result",n);const i=ve.getScale(e,xe),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const Se=new H;ve.getScale=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t.x=H.magnitude(H.fromElements(e[0],e[1],e[2],Se)),t.y=H.magnitude(H.fromElements(e[4],e[5],e[6],Se)),t.z=H.magnitude(H.fromElements(e[8],e[9],e[10],Se)),t};const Ce=new H;ve.getMaximumScale=function(e){return ve.getScale(e,Ce),H.maximumComponent(Ce)};const Ie=new H;ve.setRotation=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("result",n);const i=ve.getScale(e,Ie);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=e[3],n[4]=t[3]*i.y,n[5]=t[4]*i.y,n[6]=t[5]*i.y,n[7]=e[7],n[8]=t[6]*i.z,n[9]=t[7]*i.z,n[10]=t[8]*i.z,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const Oe=new H;ve.getRotation=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=ve.getScale(e,Oe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[4]/n.y,t[4]=e[5]/n.y,t[5]=e[6]/n.y,t[6]=e[8]/n.z,t[7]=e[9]/n.z,t[8]=e[10]/n.z,t},ve.multiply=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],d=e[8],h=e[9],p=e[10],f=e[11],m=e[12],_=e[13],g=e[14],y=e[15],b=t[0],v=t[1],A=t[2],T=t[3],w=t[4],E=t[5],x=t[6],S=t[7],C=t[8],I=t[9],O=t[10],D=t[11],P=t[12],N=t[13],R=t[14],M=t[15],F=i*b+a*v+d*A+m*T,B=o*b+c*v+h*A+_*T,z=r*b+l*v+p*A+g*T,U=s*b+u*v+f*A+y*T,k=i*w+a*E+d*x+m*S,V=o*w+c*E+h*x+_*S,H=r*w+l*E+p*x+g*S,G=s*w+u*E+f*x+y*S,j=i*C+a*I+d*O+m*D,W=o*C+c*I+h*O+_*D,q=r*C+l*I+p*O+g*D,Y=s*C+u*I+f*O+y*D,X=i*P+a*N+d*R+m*M,Q=o*P+c*N+h*R+_*M,$=r*P+l*N+p*R+g*M,K=s*P+u*N+f*R+y*M;return n[0]=F,n[1]=B,n[2]=z,n[3]=U,n[4]=k,n[5]=V,n[6]=H,n[7]=G,n[8]=j,n[9]=W,n[10]=q,n[11]=Y,n[12]=X,n[13]=Q,n[14]=$,n[15]=K,n},ve.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},ve.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},ve.multiplyTransformation=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],l=e[8],u=e[9],d=e[10],h=e[12],p=e[13],f=e[14],m=t[0],_=t[1],g=t[2],y=t[4],b=t[5],v=t[6],A=t[8],T=t[9],w=t[10],E=t[12],x=t[13],S=t[14],C=i*m+s*_+l*g,I=o*m+a*_+u*g,O=r*m+c*_+d*g,D=i*y+s*b+l*v,P=o*y+a*b+u*v,N=r*y+c*b+d*v,R=i*A+s*T+l*w,M=o*A+a*T+u*w,F=r*A+c*T+d*w,B=i*E+s*x+l*S+h,z=o*E+a*x+u*S+p,U=r*E+c*x+d*S+f;return n[0]=C,n[1]=I,n[2]=O,n[3]=0,n[4]=D,n[5]=P,n[6]=N,n[7]=0,n[8]=R,n[9]=M,n[10]=F,n[11]=0,n[12]=B,n[13]=z,n[14]=U,n[15]=1,n},ve.multiplyByMatrix3=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("rotation",t),L.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],l=e[8],u=e[9],d=e[10],h=t[0],p=t[1],f=t[2],m=t[3],_=t[4],g=t[5],y=t[6],b=t[7],v=t[8],A=i*h+s*p+l*f,T=o*h+a*p+u*f,w=r*h+c*p+d*f,E=i*m+s*_+l*g,x=o*m+a*_+u*g,S=r*m+c*_+d*g,C=i*y+s*b+l*v,I=o*y+a*b+u*v,O=r*y+c*b+d*v;return n[0]=A,n[1]=T,n[2]=w,n[3]=0,n[4]=E,n[5]=x,n[6]=S,n[7]=0,n[8]=C,n[9]=I,n[10]=O,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},ve.multiplyByTranslation=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("translation",t),L.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=i*e[0]+o*e[4]+r*e[8]+e[12],a=i*e[1]+o*e[5]+r*e[9]+e[13],c=i*e[2]+o*e[6]+r*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=s,n[13]=a,n[14]=c,n[15]=e[15],n},ve.multiplyByScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("scale",t),L.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z;return 1===i&&1===o&&1===r?ve.clone(e,n):(n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=e[3],n[4]=o*e[4],n[5]=o*e[5],n[6]=o*e[6],n[7]=e[7],n[8]=r*e[8],n[9]=r*e[9],n[10]=r*e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n)},ve.multiplyByUniformScale=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.number("scale",t),L.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3],n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7],n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},ve.multiplyByVector=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("cartesian",t),L.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=t.w,a=e[0]*i+e[4]*o+e[8]*r+e[12]*s,c=e[1]*i+e[5]*o+e[9]*r+e[13]*s,l=e[2]*i+e[6]*o+e[10]*r+e[14]*s,u=e[3]*i+e[7]*o+e[11]*r+e[15]*s;return n.x=a,n.y=c,n.z=l,n.w=u,n},ve.multiplyByPointAsVector=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("cartesian",t),L.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r,a=e[1]*i+e[5]*o+e[9]*r,c=e[2]*i+e[6]*o+e[10]*r;return n.x=s,n.y=a,n.z=c,n},ve.multiplyByPoint=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("cartesian",t),L.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r+e[12],a=e[1]*i+e[5]*o+e[9]*r+e[13],c=e[2]*i+e[6]*o+e[10]*r+e[14];return n.x=s,n.y=a,n.z=c,n},ve.multiplyByScalar=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},ve.negate=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},ve.transpose=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=e[1],i=e[2],o=e[3],r=e[6],s=e[7],a=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=r,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=s,t[14]=a,t[15]=e[15],t},ve.abs=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},ve.equals=function(e,t){return e===t||D(e)&&D(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]},ve.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},ve.getTranslation=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t},ve.getMatrix3=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};const De=new re,Pe=new re,Ne=new K,Re=new K(0,0,0,1);ve.inverse=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=e[0],i=e[4],o=e[8],r=e[12],s=e[1],a=e[5],c=e[9],l=e[13],u=e[2],d=e[6],h=e[10],p=e[14],f=e[3],m=e[7],_=e[11],g=e[15];let y=h*g,b=p*_,v=d*g,A=p*m,T=d*_,w=h*m,E=u*g,x=p*f,S=u*_,C=h*f,I=u*m,O=d*f;const D=y*a+A*c+T*l-(b*a+v*c+w*l),P=b*s+E*c+C*l-(y*s+x*c+S*l),N=v*s+x*a+I*l-(A*s+E*a+O*l),R=w*s+S*a+O*c-(T*s+C*a+I*c),M=b*i+v*o+w*r-(y*i+A*o+T*r),F=y*n+x*o+S*r-(b*n+E*o+C*r),B=A*n+E*i+O*r-(v*n+x*i+I*r),z=T*n+C*i+I*o-(w*n+S*i+O*o);y=o*l,b=r*c,v=i*l,A=r*a,T=i*c,w=o*a,E=n*l,x=r*s,S=n*c,C=o*s,I=n*a,O=i*s;const U=y*m+A*_+T*g-(b*m+v*_+w*g),k=b*f+E*_+C*g-(y*f+x*_+S*g),H=v*f+x*m+I*g-(A*f+E*m+O*g),G=w*f+S*m+O*_-(T*f+C*m+I*_),j=v*h+w*p+b*d-(T*p+y*d+A*h),W=S*p+y*u+x*h-(E*h+C*p+b*u),q=E*d+O*p+A*u-(I*p+v*u+x*d),Y=I*h+T*u+C*d-(S*d+O*h+w*u);let X=n*D+i*P+o*N+r*R;if(Math.abs(X)<V.EPSILON21){if(re.equalsEpsilon(ve.getMatrix3(e,De),Pe,V.EPSILON7)&&K.equals(ve.getRow(e,3,Ne),Re))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 be("matrix is not invertible because its determinate is zero.")}return X=1/X,t[0]=D*X,t[1]=P*X,t[2]=N*X,t[3]=R*X,t[4]=M*X,t[5]=F*X,t[6]=B*X,t[7]=z*X,t[8]=U*X,t[9]=k*X,t[10]=H*X,t[11]=G*X,t[12]=j*X,t[13]=W*X,t[14]=q*X,t[15]=Y*X,t},ve.inverseTransformation=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[4],s=e[5],a=e[6],c=e[8],l=e[9],u=e[10],d=e[12],h=e[13],p=e[14],f=-n*d-i*h-o*p,m=-r*d-s*h-a*p,_=-c*d-l*h-u*p;return t[0]=n,t[1]=r,t[2]=c,t[3]=0,t[4]=i,t[5]=s,t[6]=l,t[7]=0,t[8]=o,t[9]=a,t[10]=u,t[11]=0,t[12]=f,t[13]=m,t[14]=_,t[15]=1,t};const Le=new ve;ve.inverseTranspose=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),ve.inverse(ve.transpose(e,Le),t)},ve.IDENTITY=Object.freeze(new ve(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),ve.ZERO=Object.freeze(new ve(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),ve.COLUMN0ROW0=0,ve.COLUMN0ROW1=1,ve.COLUMN0ROW2=2,ve.COLUMN0ROW3=3,ve.COLUMN1ROW0=4,ve.COLUMN1ROW1=5,ve.COLUMN1ROW2=6,ve.COLUMN1ROW3=7,ve.COLUMN2ROW0=8,ve.COLUMN2ROW1=9,ve.COLUMN2ROW2=10,ve.COLUMN2ROW3=11,ve.COLUMN3ROW0=12,ve.COLUMN3ROW1=13,ve.COLUMN3ROW2=14,ve.COLUMN3ROW3=15,Object.defineProperties(ve.prototype,{length:{get:function(){return ve.packedLength}}}),ve.prototype.clone=function(e){return ve.clone(this,e)},ve.prototype.equals=function(e){return ve.equals(this,e)},ve.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]},ve.prototype.equalsEpsilon=function(e,t){return ve.equalsEpsilon(this,e,t)},ve.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]})`};const Me=Object.freeze({DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047}),Fe=new H;function Be(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const ze={};ze[Me.FLOAT]="float",ze[Me.FLOAT_VEC2]="vec2",ze[Me.FLOAT_VEC3]="vec3",ze[Me.FLOAT_VEC4]="vec4",ze[Me.INT]="int",ze[Me.INT_VEC2]="ivec2",ze[Me.INT_VEC3]="ivec3",ze[Me.INT_VEC4]="ivec4",ze[Me.BOOL]="bool",ze[Me.BOOL_VEC2]="bvec2",ze[Me.BOOL_VEC3]="bvec3",ze[Me.BOOL_VEC4]="bvec4",ze[Me.FLOAT_MAT2]="mat2",ze[Me.FLOAT_MAT3]="mat3",ze[Me.FLOAT_MAT4]="mat4",ze[Me.SAMPLER_2D]="sampler2D",ze[Me.SAMPLER_CUBE]="samplerCube",Be.prototype.getDeclaration=function(e){let t=`uniform ${ze[this._datatype]} ${e}`;const n=this._size;return t+=1===n?";":`[${n.toString()}];`,t};const Ue={czm_viewport:new Be({size:1,datatype:Me.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new Be({size:1,datatype:Me.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new Be({size:1,datatype:Me.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_eyeEllipsoidNormalEC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.eyeEllipsoidNormalEC}}),czm_eyeEllipsoidCurvature:new Be({size:1,datatype:Me.FLOAT_VEC2,getValue:function(e){return e.eyeEllipsoidCurvature}}),czm_modelToEnu:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.modelToEnu}}),czm_enuToModel:new Be({size:1,datatype:Me.FLOAT_MAT4,getValue:function(e){return e.enuToModel}}),czm_entireFrustum:new Be({size:1,datatype:Me.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new Be({size:1,datatype:Me.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new Be({size:1,datatype:Me.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return ve.getTranslation(e.inverseView,Fe)}}),czm_frameNumber:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new Be({size:1,datatype:Me.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new Be({size:1,datatype:Me.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new Be({size:1,datatype:Me.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new Be({size:1,datatype:Me.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new Be({size:1,datatype:Me.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new Be({size:9,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new Be({size:1,datatype:Me.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.fogDensity}}),czm_fogMinimumBrightness:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.fogMinimumBrightness}}),czm_atmosphereHsbShift:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.atmosphereHsbShift}}),czm_atmosphereLightIntensity:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.atmosphereLightIntensity}}),czm_atmosphereRayleighCoefficient:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.atmosphereRayleighCoefficient}}),czm_atmosphereRayleighScaleHeight:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.atmosphereRayleighScaleHeight}}),czm_atmosphereMieCoefficient:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.atmosphereMieCoefficient}}),czm_atmosphereMieScaleHeight:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.atmosphereMieScaleHeight}}),czm_atmosphereMieAnisotropy:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.atmosphereMieAnisotropy}}),czm_atmosphereDynamicLighting:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.atmosphereDynamicLighting}}),czm_splitPosition:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new Be({size:1,datatype:Me.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new Be({size:1,datatype:Me.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new Be({size:1,datatype:Me.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})};function ke(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Ve(){return!0}function He(e,t){function n(){throw new P(t)}t=M(t,"This object was destroyed, i.e., destroy() was called.");for(const i in e)"function"==typeof e[i]&&(e[i]=n);e.isDestroyed=Ve}const Ge={UNSIGNED_BYTE:Me.UNSIGNED_BYTE,UNSIGNED_SHORT:Me.UNSIGNED_SHORT,UNSIGNED_INT:Me.UNSIGNED_INT,getSizeInBytes:function(e){switch(e){case Ge.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Ge.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Ge.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new P("indexDatatype is required and must be a valid IndexDatatype constant.")},fromSizeInBytes:function(e){switch(e){case 2:return Ge.UNSIGNED_SHORT;case 4:return Ge.UNSIGNED_INT;case 1:return Ge.UNSIGNED_BYTE;default:throw new P("Size in bytes cannot be mapped to an IndexDatatype")}},validate:function(e){return D(e)&&(e===Ge.UNSIGNED_BYTE||e===Ge.UNSIGNED_SHORT||e===Ge.UNSIGNED_INT)},createTypedArray:function(e,t){if(!D(e))throw new P("numberOfVertices is required.");return e>=V.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},createTypedArrayFromArrayBuffer:function(e,t,n,i){if(!D(e))throw new P("numberOfVertices is required.");if(!D(t))throw new P("sourceArray is required.");if(!D(n))throw new P("byteOffset is required.");return e>=V.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)},fromTypedArray:function(e){if(e instanceof Uint8Array)return Ge.UNSIGNED_BYTE;if(e instanceof Uint16Array)return Ge.UNSIGNED_SHORT;if(e instanceof Uint32Array)return Ge.UNSIGNED_INT;throw new P("array must be a Uint8Array, Uint16Array, or Uint32Array.")}},je=Object.freeze(Ge),We={STREAM_DRAW:Me.STREAM_DRAW,STATIC_DRAW:Me.STATIC_DRAW,DYNAMIC_DRAW:Me.DYNAMIC_DRAW,validate:function(e){return e===We.STREAM_DRAW||e===We.STATIC_DRAW||e===We.DYNAMIC_DRAW}},qe=Object.freeze(We);function Ye(e){if(e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context),!D(e.typedArray)&&!D(e.sizeInBytes))throw new P("Either options.sizeInBytes or options.typedArray is required.");if(D(e.typedArray)&&D(e.sizeInBytes))throw new P("Cannot pass in both options.sizeInBytes and options.typedArray.");if(D(e.typedArray)&&(L.typeOf.object("options.typedArray",e.typedArray),L.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!qe.validate(e.usage))throw new P("usage is invalid.");const t=e.context._gl,n=e.bufferTarget,i=e.typedArray;let o=e.sizeInBytes;const r=e.usage,s=D(i);s&&(o=i.byteLength),L.typeOf.number.greaterThan("sizeInBytes",o,0);const a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=ke(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}let Xe;Ye.createVertexBuffer=function(e){return L.defined("options.context",e.context),new Ye({context:e.context,bufferTarget:Me.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})},Ye.createIndexBuffer=function(e){if(L.defined("options.context",e.context),!je.validate(e.indexDatatype))throw new P("Invalid indexDatatype.");if(e.indexDatatype===je.UNSIGNED_INT&&!e.context.elementIndexUint)throw new P("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.");const t=e.context,n=e.indexDatatype,i=je.getSizeInBytes(n),o=new Ye({context:t,bufferTarget:Me.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),r=o.sizeInBytes/i;return Object.defineProperties(o,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return r}}}),o},Object.defineProperties(Ye.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}}),Ye.prototype._getBuffer=function(){return this._buffer},Ye.prototype.copyFromArrayView=function(e,t){t=M(t,0),L.defined("arrayView",e),L.typeOf.number.lessThanOrEquals("offsetInBytes + arrayView.byteLength",t+e.byteLength,this._sizeInBytes);const n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)},Ye.prototype.copyFromBuffer=function(e,t,n,i){if(!this._webgl2)throw new P("A WebGL 2 context is required.");if(!D(e))throw new P("readBuffer must be defined.");if(!D(i)||i<=0)throw new P("sizeInBytes must be defined and be greater than zero.");if(!D(t)||t<0||t+i>e._sizeInBytes)throw new P("readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.");if(!D(n)||n<0||n+i>this._sizeInBytes)throw new P("writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.");if(this._buffer===e._buffer&&(n>=t&&n<t+i||t>n&&t<n+i))throw new P("When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap.");if(this._bufferTarget===Me.ELEMENT_ARRAY_BUFFER&&e._bufferTarget!==Me.ELEMENT_ARRAY_BUFFER||this._bufferTarget!==Me.ELEMENT_ARRAY_BUFFER&&e._bufferTarget===Me.ELEMENT_ARRAY_BUFFER)throw new P("Can not copy an index buffer into another buffer type.");const o=Me.COPY_READ_BUFFER,r=Me.COPY_WRITE_BUFFER,s=this._gl;s.bindBuffer(r,this._buffer),s.bindBuffer(o,e._buffer),s.copyBufferSubData(o,r,t,n,i),s.bindBuffer(r,null),s.bindBuffer(o,null)},Ye.prototype.getBufferData=function(e,t,n,i){if(t=M(t,0),n=M(n,0),!this._webgl2)throw new P("A WebGL 2 context is required.");if(!D(e))throw new P("arrayView is required.");let o,r,s=e.byteLength;if(D(i)?(o=i,D(s)?r=1:(s=e.length,r=e.BYTES_PER_ELEMENT)):D(s)?(o=s-n,r=1):(s=e.length,o=s-n,r=e.BYTES_PER_ELEMENT),n<0||n>s)throw new P("destinationOffset must be greater than zero and less than the arrayView length.");if(n+o>s)throw new P("destinationOffset + length must be less than or equal to the arrayViewLength.");if(t<0||t>this._sizeInBytes)throw new P("sourceOffset must be greater than zero and less than the buffers size.");if(t+o*r>this._sizeInBytes)throw new P("sourceOffset + length must be less than the buffers size.");const a=this._gl,c=Me.COPY_READ_BUFFER;a.bindBuffer(c,this._buffer),a.getBufferSubData(c,t,e,n,i),a.bindBuffer(c,null)},Ye.prototype.isDestroyed=function(){return!1},Ye.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),He(this)};const Qe={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},$e={};Object.defineProperties($e,{element:{get:function(){if($e.supportsFullscreen())return document[Qe.fullscreenElement]}},changeEventName:{get:function(){if($e.supportsFullscreen())return Qe.fullscreenchange}},errorEventName:{get:function(){if($e.supportsFullscreen())return Qe.fullscreenerror}},enabled:{get:function(){if($e.supportsFullscreen())return document[Qe.fullscreenEnabled]}},fullscreen:{get:function(){if($e.supportsFullscreen())return null!==$e.element}}}),$e.supportsFullscreen=function(){if(D(Xe))return Xe;Xe=!1;const e=document.body;if("function"==typeof e.requestFullscreen)return Qe.requestFullscreen="requestFullscreen",Qe.exitFullscreen="exitFullscreen",Qe.fullscreenEnabled="fullscreenEnabled",Qe.fullscreenElement="fullscreenElement",Qe.fullscreenchange="fullscreenchange",Qe.fullscreenerror="fullscreenerror",Xe=!0,Xe;const t=["webkit","moz","o","ms","khtml"];let n;for(let i=0,o=t.length;i<o;++i){const o=t[i];n=`${o}RequestFullscreen`,"function"==typeof e[n]?(Qe.requestFullscreen=n,Xe=!0):(n=`${o}RequestFullScreen`,"function"==typeof e[n]&&(Qe.requestFullscreen=n,Xe=!0)),n=`${o}ExitFullscreen`,"function"==typeof document[n]?Qe.exitFullscreen=n:(n=`${o}CancelFullScreen`,"function"==typeof document[n]&&(Qe.exitFullscreen=n)),n=`${o}FullscreenEnabled`,void 0!==document[n]?Qe.fullscreenEnabled=n:(n=`${o}FullScreenEnabled`,void 0!==document[n]&&(Qe.fullscreenEnabled=n)),n=`${o}FullscreenElement`,void 0!==document[n]?Qe.fullscreenElement=n:(n=`${o}FullScreenElement`,void 0!==document[n]&&(Qe.fullscreenElement=n)),n=`${o}fullscreenchange`,void 0!==document[`on${n}`]&&("ms"===o&&(n="MSFullscreenChange"),Qe.fullscreenchange=n),n=`${o}fullscreenerror`,void 0!==document[`on${n}`]&&("ms"===o&&(n="MSFullscreenError"),Qe.fullscreenerror=n)}return Xe},$e.requestFullscreen=function(e,t){$e.supportsFullscreen()&&e[Qe.requestFullscreen]({vrDisplay:t})},$e.exitFullscreen=function(){$e.supportsFullscreen()&&document[Qe.exitFullscreen]()},$e._names=Qe;const Ke=$e;let Ze,Je,et,tt,nt,it,ot,rt,st,at,ct,lt,ut,dt,ht,pt,ft,mt;function _t(e){const t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}function gt(){if(!D(Je)&&(Je=!1,!At())){const e=/ Chrome\/([\.0-9]+)/.exec(Ze.userAgent);null!==e&&(Je=!0,et=_t(e[1]))}return Je}function yt(){if(!D(tt)&&(tt=!1,!gt()&&!At()&&/ Safari\/[\.0-9]+/.test(Ze.userAgent))){const e=/ Version\/([\.0-9]+)/.exec(Ze.userAgent);null!==e&&(tt=!0,nt=_t(e[1]))}return tt}function bt(){if(!D(it)){it=!1;const e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(Ze.userAgent);null!==e&&(it=!0,ot=_t(e[1]),ot.isNightly=!!e[2])}return it}function vt(){if(!D(rt)){let e;rt=!1,"Microsoft Internet Explorer"===Ze.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(Ze.userAgent),null!==e&&(rt=!0,st=_t(e[1]))):"Netscape"===Ze.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(Ze.userAgent),null!==e&&(rt=!0,st=_t(e[1])))}return rt}function At(){if(!D(at)){at=!1;const e=/ Edg\/([\.0-9]+)/.exec(Ze.userAgent);null!==e&&(at=!0,ct=_t(e[1]))}return at}function Tt(){if(!D(lt)){lt=!1;const e=/Firefox\/([\.0-9]+)/.exec(Ze.userAgent);null!==e&&(lt=!0,ut=_t(e[1]))}return lt}function wt(){if(!D(mt)){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=e.style.imageRendering;mt=D(t)&&""!==t,mt&&(ft=t)}return mt}function Et(){if(!Et.initialized)throw new P("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return Et._result}Ze="undefined"!=typeof navigator?navigator:{},Et._promise=void 0,Et._result=void 0,Et.initialize=function(){return D(Et._promise)||(Et._promise=new Promise((e=>{const t=new Image;t.onload=function(){Et._result=t.width>0&&t.height>0,e(Et._result)},t.onerror=function(){Et._result=!1,e(Et._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}))),Et._promise},Object.defineProperties(Et,{initialized:{get:function(){return D(Et._result)}}});const xt=[];"undefined"!=typeof ArrayBuffer&&(xt.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),"undefined"!=typeof Uint8ClampedArray&&xt.push(Uint8ClampedArray),"undefined"!=typeof Uint8ClampedArray&&xt.push(Uint8ClampedArray),"undefined"!=typeof BigInt64Array&&xt.push(BigInt64Array),"undefined"!=typeof BigUint64Array&&xt.push(BigUint64Array));const St={isChrome:gt,chromeVersion:function(){return gt()&&et},isSafari:yt,safariVersion:function(){return yt()&&nt},isWebkit:bt,webkitVersion:function(){return bt()&&ot},isInternetExplorer:vt,internetExplorerVersion:function(){return vt()&&st},isEdge:At,edgeVersion:function(){return At()&&ct},isFirefox:Tt,firefoxVersion:function(){return Tt()&&ut},isWindows:function(){return D(dt)||(dt=/Windows/i.test(Ze.appVersion)),dt},isIPadOrIOS:function(){return D(ht)||(ht="iPhone"===navigator.platform||"iPod"===navigator.platform||"iPad"===navigator.platform),ht},hardwareConcurrency:M(Ze.hardwareConcurrency,3),supportsPointerEvents:function(){return D(pt)||(pt=!Tt()&&"undefined"!=typeof PointerEvent&&(!D(Ze.pointerEnabled)||Ze.pointerEnabled)),pt},supportsImageRenderingPixelated:wt,supportsWebP:Et,imageRenderingValue:function(){return wt()?ft:void 0},typedArrayTypes:xt,supportsBasis:function(e){return St.supportsWebAssembly()&&e.context.supportsBasis},supportsFullscreen:function(){return Ke.supportsFullscreen()},supportsTypedArrays:function(){return"undefined"!=typeof ArrayBuffer},supportsBigInt64Array:function(){return"undefined"!=typeof BigInt64Array},supportsBigUint64Array:function(){return"undefined"!=typeof BigUint64Array},supportsBigInt:function(){return"undefined"!=typeof BigInt},supportsWebWorkers:function(){return"undefined"!=typeof Worker},supportsWebAssembly:function(){return"undefined"!=typeof WebAssembly},supportsWebgl2:function(e){return L.defined("scene",e),e.context.webgl2},supportsEsmWebWorkers:function(){return!Tt()||parseInt(ut)>=114}},Ct=St;function It(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),6*n<1?e+6*(t-e)*n:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function Ot(e,t,n,i){this.red=M(e,1),this.green=M(t,1),this.blue=M(n,1),this.alpha=M(i,1)}let Dt,Pt,Nt;Ot.fromCartesian4=function(e,t){return L.typeOf.object("cartesian",e),D(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new Ot(e.x,e.y,e.z,e.w)},Ot.fromBytes=function(e,t,n,i,o){return e=Ot.byteToFloat(M(e,255)),t=Ot.byteToFloat(M(t,255)),n=Ot.byteToFloat(M(n,255)),i=Ot.byteToFloat(M(i,255)),D(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new Ot(e,t,n,i)},Ot.fromAlpha=function(e,t,n){return L.typeOf.object("color",e),L.typeOf.number("alpha",t),D(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new Ot(e.red,e.green,e.blue,t)},Ct.supportsTypedArrays()&&(Dt=new ArrayBuffer(4),Pt=new Uint32Array(Dt),Nt=new Uint8Array(Dt)),Ot.fromRgba=function(e,t){return Pt[0]=e,Ot.fromBytes(Nt[0],Nt[1],Nt[2],Nt[3],t)},Ot.fromHsl=function(e,t,n,i,o){e=M(e,0)%1,t=M(t,0),n=M(n,0),i=M(i,1);let r=n,s=n,a=n;if(0!==t){let i;i=n<.5?n*(1+t):n+t-n*t;const o=2*n-i;r=It(o,i,e+1/3),s=It(o,i,e),a=It(o,i,e-1/3)}return D(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new Ot(r,s,a,i)},Ot.fromRandom=function(e,t){let n=(e=M(e,M.EMPTY_OBJECT)).red;if(!D(n)){const t=M(e.minimumRed,0),i=M(e.maximumRed,1);L.typeOf.number.lessThanOrEquals("minimumRed",t,i),n=t+V.nextRandomNumber()*(i-t)}let i=e.green;if(!D(i)){const t=M(e.minimumGreen,0),n=M(e.maximumGreen,1);L.typeOf.number.lessThanOrEquals("minimumGreen",t,n),i=t+V.nextRandomNumber()*(n-t)}let o=e.blue;if(!D(o)){const t=M(e.minimumBlue,0),n=M(e.maximumBlue,1);L.typeOf.number.lessThanOrEquals("minimumBlue",t,n),o=t+V.nextRandomNumber()*(n-t)}let r=e.alpha;if(!D(r)){const t=M(e.minimumAlpha,0),n=M(e.maximumAlpha,1);L.typeOf.number.lessThanOrEquals("minumumAlpha",t,n),r=t+V.nextRandomNumber()*(n-t)}return D(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new Ot(n,i,o,r)};const Rt=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Lt=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Mt=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,Ft=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;function Bt(e){e=M(e,M.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}Ot.fromCssColorString=function(e,t){L.typeOf.string("color",e),D(t)||(t=new Ot);const n=Ot[(e=e.trim()).toUpperCase()];if(D(n))return Ot.clone(n,t),t;let i=Rt.exec(e);return null!==i?(t.red=parseInt(i[1],16)/15,t.green=parseInt(i[2],16)/15,t.blue=parseInt(i[3],16)/15,t.alpha=parseInt(M(i[4],"f"),16)/15,t):(i=Lt.exec(e),null!==i?(t.red=parseInt(i[1],16)/255,t.green=parseInt(i[2],16)/255,t.blue=parseInt(i[3],16)/255,t.alpha=parseInt(M(i[4],"ff"),16)/255,t):(i=Mt.exec(e),null!==i?(t.red=parseFloat(i[1])/("%"===i[1].substr(-1)?100:255),t.green=parseFloat(i[2])/("%"===i[2].substr(-1)?100:255),t.blue=parseFloat(i[3])/("%"===i[3].substr(-1)?100:255),t.alpha=parseFloat(M(i[4],"1.0")),t):(i=Ft.exec(e),null!==i?Ot.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(M(i[4],"1.0")),t):t=void 0)))},Ot.packedLength=4,Ot.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t},Ot.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new Ot),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n},Ot.byteToFloat=function(e){return e/255},Ot.floatToByte=function(e){return 1===e?255:256*e|0},Ot.clone=function(e,t){if(D(e))return D(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new Ot(e.red,e.green,e.blue,e.alpha)},Ot.equals=function(e,t){return e===t||D(e)&&D(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha},Ot.equalsArray=function(e,t,n){return e.red===t[n]&&e.green===t[n+1]&&e.blue===t[n+2]&&e.alpha===t[n+3]},Ot.prototype.clone=function(e){return Ot.clone(this,e)},Ot.prototype.equals=function(e){return Ot.equals(this,e)},Ot.prototype.equalsEpsilon=function(e,t){return this===e||D(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},Ot.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`},Ot.prototype.toCssColorString=function(){const e=Ot.floatToByte(this.red),t=Ot.floatToByte(this.green),n=Ot.floatToByte(this.blue);return 1===this.alpha?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`},Ot.prototype.toCssHexString=function(){let e=Ot.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=Ot.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=Ot.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=Ot.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`},Ot.prototype.toBytes=function(e){const t=Ot.floatToByte(this.red),n=Ot.floatToByte(this.green),i=Ot.floatToByte(this.blue),o=Ot.floatToByte(this.alpha);return D(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]},Ot.prototype.toRgba=function(){return Nt[0]=Ot.floatToByte(this.red),Nt[1]=Ot.floatToByte(this.green),Nt[2]=Ot.floatToByte(this.blue),Nt[3]=Ot.floatToByte(this.alpha),Pt[0]},Ot.prototype.brighten=function(e,t){return L.typeOf.number("magnitude",e),L.typeOf.number.greaterThanOrEquals("magnitude",e,0),L.typeOf.object("result",t),e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t},Ot.prototype.darken=function(e,t){return L.typeOf.number("magnitude",e),L.typeOf.number.greaterThanOrEquals("magnitude",e,0),L.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t},Ot.prototype.withAlpha=function(e,t){return Ot.fromAlpha(this,e,t)},Ot.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n},Ot.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n},Ot.multiply=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n},Ot.divide=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n},Ot.mod=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n},Ot.lerp=function(e,t,n,i){return L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i),i.red=V.lerp(e.red,t.red,n),i.green=V.lerp(e.green,t.green,n),i.blue=V.lerp(e.blue,t.blue,n),i.alpha=V.lerp(e.alpha,t.alpha,n),i},Ot.multiplyByScalar=function(e,t,n){return L.typeOf.object("color",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n},Ot.divideByScalar=function(e,t,n){return L.typeOf.object("color",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n},Ot.ALICEBLUE=Object.freeze(Ot.fromCssColorString("#F0F8FF")),Ot.ANTIQUEWHITE=Object.freeze(Ot.fromCssColorString("#FAEBD7")),Ot.AQUA=Object.freeze(Ot.fromCssColorString("#00FFFF")),Ot.AQUAMARINE=Object.freeze(Ot.fromCssColorString("#7FFFD4")),Ot.AZURE=Object.freeze(Ot.fromCssColorString("#F0FFFF")),Ot.BEIGE=Object.freeze(Ot.fromCssColorString("#F5F5DC")),Ot.BISQUE=Object.freeze(Ot.fromCssColorString("#FFE4C4")),Ot.BLACK=Object.freeze(Ot.fromCssColorString("#000000")),Ot.BLANCHEDALMOND=Object.freeze(Ot.fromCssColorString("#FFEBCD")),Ot.BLUE=Object.freeze(Ot.fromCssColorString("#0000FF")),Ot.BLUEVIOLET=Object.freeze(Ot.fromCssColorString("#8A2BE2")),Ot.BROWN=Object.freeze(Ot.fromCssColorString("#A52A2A")),Ot.BURLYWOOD=Object.freeze(Ot.fromCssColorString("#DEB887")),Ot.CADETBLUE=Object.freeze(Ot.fromCssColorString("#5F9EA0")),Ot.CHARTREUSE=Object.freeze(Ot.fromCssColorString("#7FFF00")),Ot.CHOCOLATE=Object.freeze(Ot.fromCssColorString("#D2691E")),Ot.CORAL=Object.freeze(Ot.fromCssColorString("#FF7F50")),Ot.CORNFLOWERBLUE=Object.freeze(Ot.fromCssColorString("#6495ED")),Ot.CORNSILK=Object.freeze(Ot.fromCssColorString("#FFF8DC")),Ot.CRIMSON=Object.freeze(Ot.fromCssColorString("#DC143C")),Ot.CYAN=Object.freeze(Ot.fromCssColorString("#00FFFF")),Ot.DARKBLUE=Object.freeze(Ot.fromCssColorString("#00008B")),Ot.DARKCYAN=Object.freeze(Ot.fromCssColorString("#008B8B")),Ot.DARKGOLDENROD=Object.freeze(Ot.fromCssColorString("#B8860B")),Ot.DARKGRAY=Object.freeze(Ot.fromCssColorString("#A9A9A9")),Ot.DARKGREEN=Object.freeze(Ot.fromCssColorString("#006400")),Ot.DARKGREY=Ot.DARKGRAY,Ot.DARKKHAKI=Object.freeze(Ot.fromCssColorString("#BDB76B")),Ot.DARKMAGENTA=Object.freeze(Ot.fromCssColorString("#8B008B")),Ot.DARKOLIVEGREEN=Object.freeze(Ot.fromCssColorString("#556B2F")),Ot.DARKORANGE=Object.freeze(Ot.fromCssColorString("#FF8C00")),Ot.DARKORCHID=Object.freeze(Ot.fromCssColorString("#9932CC")),Ot.DARKRED=Object.freeze(Ot.fromCssColorString("#8B0000")),Ot.DARKSALMON=Object.freeze(Ot.fromCssColorString("#E9967A")),Ot.DARKSEAGREEN=Object.freeze(Ot.fromCssColorString("#8FBC8F")),Ot.DARKSLATEBLUE=Object.freeze(Ot.fromCssColorString("#483D8B")),Ot.DARKSLATEGRAY=Object.freeze(Ot.fromCssColorString("#2F4F4F")),Ot.DARKSLATEGREY=Ot.DARKSLATEGRAY,Ot.DARKTURQUOISE=Object.freeze(Ot.fromCssColorString("#00CED1")),Ot.DARKVIOLET=Object.freeze(Ot.fromCssColorString("#9400D3")),Ot.DEEPPINK=Object.freeze(Ot.fromCssColorString("#FF1493")),Ot.DEEPSKYBLUE=Object.freeze(Ot.fromCssColorString("#00BFFF")),Ot.DIMGRAY=Object.freeze(Ot.fromCssColorString("#696969")),Ot.DIMGREY=Ot.DIMGRAY,Ot.DODGERBLUE=Object.freeze(Ot.fromCssColorString("#1E90FF")),Ot.FIREBRICK=Object.freeze(Ot.fromCssColorString("#B22222")),Ot.FLORALWHITE=Object.freeze(Ot.fromCssColorString("#FFFAF0")),Ot.FORESTGREEN=Object.freeze(Ot.fromCssColorString("#228B22")),Ot.FUCHSIA=Object.freeze(Ot.fromCssColorString("#FF00FF")),Ot.GAINSBORO=Object.freeze(Ot.fromCssColorString("#DCDCDC")),Ot.GHOSTWHITE=Object.freeze(Ot.fromCssColorString("#F8F8FF")),Ot.GOLD=Object.freeze(Ot.fromCssColorString("#FFD700")),Ot.GOLDENROD=Object.freeze(Ot.fromCssColorString("#DAA520")),Ot.GRAY=Object.freeze(Ot.fromCssColorString("#808080")),Ot.GREEN=Object.freeze(Ot.fromCssColorString("#008000")),Ot.GREENYELLOW=Object.freeze(Ot.fromCssColorString("#ADFF2F")),Ot.GREY=Ot.GRAY,Ot.HONEYDEW=Object.freeze(Ot.fromCssColorString("#F0FFF0")),Ot.HOTPINK=Object.freeze(Ot.fromCssColorString("#FF69B4")),Ot.INDIANRED=Object.freeze(Ot.fromCssColorString("#CD5C5C")),Ot.INDIGO=Object.freeze(Ot.fromCssColorString("#4B0082")),Ot.IVORY=Object.freeze(Ot.fromCssColorString("#FFFFF0")),Ot.KHAKI=Object.freeze(Ot.fromCssColorString("#F0E68C")),Ot.LAVENDER=Object.freeze(Ot.fromCssColorString("#E6E6FA")),Ot.LAVENDAR_BLUSH=Object.freeze(Ot.fromCssColorString("#FFF0F5")),Ot.LAWNGREEN=Object.freeze(Ot.fromCssColorString("#7CFC00")),Ot.LEMONCHIFFON=Object.freeze(Ot.fromCssColorString("#FFFACD")),Ot.LIGHTBLUE=Object.freeze(Ot.fromCssColorString("#ADD8E6")),Ot.LIGHTCORAL=Object.freeze(Ot.fromCssColorString("#F08080")),Ot.LIGHTCYAN=Object.freeze(Ot.fromCssColorString("#E0FFFF")),Ot.LIGHTGOLDENRODYELLOW=Object.freeze(Ot.fromCssColorString("#FAFAD2")),Ot.LIGHTGRAY=Object.freeze(Ot.fromCssColorString("#D3D3D3")),Ot.LIGHTGREEN=Object.freeze(Ot.fromCssColorString("#90EE90")),Ot.LIGHTGREY=Ot.LIGHTGRAY,Ot.LIGHTPINK=Object.freeze(Ot.fromCssColorString("#FFB6C1")),Ot.LIGHTSEAGREEN=Object.freeze(Ot.fromCssColorString("#20B2AA")),Ot.LIGHTSKYBLUE=Object.freeze(Ot.fromCssColorString("#87CEFA")),Ot.LIGHTSLATEGRAY=Object.freeze(Ot.fromCssColorString("#778899")),Ot.LIGHTSLATEGREY=Ot.LIGHTSLATEGRAY,Ot.LIGHTSTEELBLUE=Object.freeze(Ot.fromCssColorString("#B0C4DE")),Ot.LIGHTYELLOW=Object.freeze(Ot.fromCssColorString("#FFFFE0")),Ot.LIME=Object.freeze(Ot.fromCssColorString("#00FF00")),Ot.LIMEGREEN=Object.freeze(Ot.fromCssColorString("#32CD32")),Ot.LINEN=Object.freeze(Ot.fromCssColorString("#FAF0E6")),Ot.MAGENTA=Object.freeze(Ot.fromCssColorString("#FF00FF")),Ot.MAROON=Object.freeze(Ot.fromCssColorString("#800000")),Ot.MEDIUMAQUAMARINE=Object.freeze(Ot.fromCssColorString("#66CDAA")),Ot.MEDIUMBLUE=Object.freeze(Ot.fromCssColorString("#0000CD")),Ot.MEDIUMORCHID=Object.freeze(Ot.fromCssColorString("#BA55D3")),Ot.MEDIUMPURPLE=Object.freeze(Ot.fromCssColorString("#9370DB")),Ot.MEDIUMSEAGREEN=Object.freeze(Ot.fromCssColorString("#3CB371")),Ot.MEDIUMSLATEBLUE=Object.freeze(Ot.fromCssColorString("#7B68EE")),Ot.MEDIUMSPRINGGREEN=Object.freeze(Ot.fromCssColorString("#00FA9A")),Ot.MEDIUMTURQUOISE=Object.freeze(Ot.fromCssColorString("#48D1CC")),Ot.MEDIUMVIOLETRED=Object.freeze(Ot.fromCssColorString("#C71585")),Ot.MIDNIGHTBLUE=Object.freeze(Ot.fromCssColorString("#191970")),Ot.MINTCREAM=Object.freeze(Ot.fromCssColorString("#F5FFFA")),Ot.MISTYROSE=Object.freeze(Ot.fromCssColorString("#FFE4E1")),Ot.MOCCASIN=Object.freeze(Ot.fromCssColorString("#FFE4B5")),Ot.NAVAJOWHITE=Object.freeze(Ot.fromCssColorString("#FFDEAD")),Ot.NAVY=Object.freeze(Ot.fromCssColorString("#000080")),Ot.OLDLACE=Object.freeze(Ot.fromCssColorString("#FDF5E6")),Ot.OLIVE=Object.freeze(Ot.fromCssColorString("#808000")),Ot.OLIVEDRAB=Object.freeze(Ot.fromCssColorString("#6B8E23")),Ot.ORANGE=Object.freeze(Ot.fromCssColorString("#FFA500")),Ot.ORANGERED=Object.freeze(Ot.fromCssColorString("#FF4500")),Ot.ORCHID=Object.freeze(Ot.fromCssColorString("#DA70D6")),Ot.PALEGOLDENROD=Object.freeze(Ot.fromCssColorString("#EEE8AA")),Ot.PALEGREEN=Object.freeze(Ot.fromCssColorString("#98FB98")),Ot.PALETURQUOISE=Object.freeze(Ot.fromCssColorString("#AFEEEE")),Ot.PALEVIOLETRED=Object.freeze(Ot.fromCssColorString("#DB7093")),Ot.PAPAYAWHIP=Object.freeze(Ot.fromCssColorString("#FFEFD5")),Ot.PEACHPUFF=Object.freeze(Ot.fromCssColorString("#FFDAB9")),Ot.PERU=Object.freeze(Ot.fromCssColorString("#CD853F")),Ot.PINK=Object.freeze(Ot.fromCssColorString("#FFC0CB")),Ot.PLUM=Object.freeze(Ot.fromCssColorString("#DDA0DD")),Ot.POWDERBLUE=Object.freeze(Ot.fromCssColorString("#B0E0E6")),Ot.PURPLE=Object.freeze(Ot.fromCssColorString("#800080")),Ot.RED=Object.freeze(Ot.fromCssColorString("#FF0000")),Ot.ROSYBROWN=Object.freeze(Ot.fromCssColorString("#BC8F8F")),Ot.ROYALBLUE=Object.freeze(Ot.fromCssColorString("#4169E1")),Ot.SADDLEBROWN=Object.freeze(Ot.fromCssColorString("#8B4513")),Ot.SALMON=Object.freeze(Ot.fromCssColorString("#FA8072")),Ot.SANDYBROWN=Object.freeze(Ot.fromCssColorString("#F4A460")),Ot.SEAGREEN=Object.freeze(Ot.fromCssColorString("#2E8B57")),Ot.SEASHELL=Object.freeze(Ot.fromCssColorString("#FFF5EE")),Ot.SIENNA=Object.freeze(Ot.fromCssColorString("#A0522D")),Ot.SILVER=Object.freeze(Ot.fromCssColorString("#C0C0C0")),Ot.SKYBLUE=Object.freeze(Ot.fromCssColorString("#87CEEB")),Ot.SLATEBLUE=Object.freeze(Ot.fromCssColorString("#6A5ACD")),Ot.SLATEGRAY=Object.freeze(Ot.fromCssColorString("#708090")),Ot.SLATEGREY=Ot.SLATEGRAY,Ot.SNOW=Object.freeze(Ot.fromCssColorString("#FFFAFA")),Ot.SPRINGGREEN=Object.freeze(Ot.fromCssColorString("#00FF7F")),Ot.STEELBLUE=Object.freeze(Ot.fromCssColorString("#4682B4")),Ot.TAN=Object.freeze(Ot.fromCssColorString("#D2B48C")),Ot.TEAL=Object.freeze(Ot.fromCssColorString("#008080")),Ot.THISTLE=Object.freeze(Ot.fromCssColorString("#D8BFD8")),Ot.TOMATO=Object.freeze(Ot.fromCssColorString("#FF6347")),Ot.TURQUOISE=Object.freeze(Ot.fromCssColorString("#40E0D0")),Ot.VIOLET=Object.freeze(Ot.fromCssColorString("#EE82EE")),Ot.WHEAT=Object.freeze(Ot.fromCssColorString("#F5DEB3")),Ot.WHITE=Object.freeze(Ot.fromCssColorString("#FFFFFF")),Ot.WHITESMOKE=Object.freeze(Ot.fromCssColorString("#F5F5F5")),Ot.YELLOW=Object.freeze(Ot.fromCssColorString("#FFFF00")),Ot.YELLOWGREEN=Object.freeze(Ot.fromCssColorString("#9ACD32")),Ot.TRANSPARENT=Object.freeze(new Ot(0,0,0,0)),Bt.ALL=Object.freeze(new Bt({color:new Ot(0,0,0,0),depth:1,stencil:0})),Bt.prototype.execute=function(e,t){e.clear(this,t)};const zt=Object.freeze({ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,VOXELS:9,OVERLAY:10,NUMBER_OF_PASSES:11});function Ut(e){e=M(e,M.EMPTY_OBJECT),this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=M(e.persists,!1),this.pass=zt.COMPUTE,this.owner=e.owner}function kt(e,t){this.x=M(e,0),this.y=M(t,0)}Ut.prototype.execute=function(e){e.execute(this)},kt.fromElements=function(e,t,n){return D(n)?(n.x=e,n.y=t,n):new kt(e,t)},kt.clone=function(e,t){if(D(e))return D(t)?(t.x=e.x,t.y=e.y,t):new kt(e.x,e.y)},kt.fromCartesian3=kt.clone,kt.fromCartesian4=kt.clone,kt.packedLength=2,kt.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.x,t[n]=e.y,t},kt.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new kt),n.x=e[t++],n.y=e[t],n},kt.packArray=function(e,t){L.defined("array",e);const n=e.length,i=2*n;if(D(t)){if(!Array.isArray(t)&&t.length!==i)throw new P("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let o=0;o<n;++o)kt.pack(e[o],t,2*o);return t},kt.unpackArray=function(e,t){if(L.defined("array",e),L.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!=0)throw new P("array length must be a multiple of 2.");const n=e.length;D(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){const n=i/2;t[n]=kt.unpack(e,i,t[n])}return t},kt.fromArray=kt.unpack,kt.maximumComponent=function(e){return L.typeOf.object("cartesian",e),Math.max(e.x,e.y)},kt.minimumComponent=function(e){return L.typeOf.object("cartesian",e),Math.min(e.x,e.y)},kt.minimumByComponent=function(e,t,n){return L.typeOf.object("first",e),L.typeOf.object("second",t),L.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},kt.maximumByComponent=function(e,t,n){return L.typeOf.object("first",e),L.typeOf.object("second",t),L.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},kt.clamp=function(e,t,n,i){L.typeOf.object("value",e),L.typeOf.object("min",t),L.typeOf.object("max",n),L.typeOf.object("result",i);const o=V.clamp(e.x,t.x,n.x),r=V.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i},kt.magnitudeSquared=function(e){return L.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y},kt.magnitude=function(e){return Math.sqrt(kt.magnitudeSquared(e))};const Vt=new kt;kt.distance=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),kt.subtract(e,t,Vt),kt.magnitude(Vt)},kt.distanceSquared=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),kt.subtract(e,t,Vt),kt.magnitudeSquared(Vt)},kt.normalize=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=kt.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,isNaN(t.x)||isNaN(t.y))throw new P("normalized result is not a number");return t},kt.dot=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.x*t.x+e.y*t.y},kt.cross=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.x*t.y-e.y*t.x},kt.multiplyComponents=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n},kt.divideComponents=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n},kt.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n},kt.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n},kt.multiplyByScalar=function(e,t,n){return L.typeOf.object("cartesian",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n},kt.divideByScalar=function(e,t,n){return L.typeOf.object("cartesian",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n},kt.negate=function(e,t){return L.typeOf.object("cartesian",e),L.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t},kt.abs=function(e,t){return L.typeOf.object("cartesian",e),L.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const Ht=new kt;kt.lerp=function(e,t,n,i){return L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i),kt.multiplyByScalar(t,n,Ht),i=kt.multiplyByScalar(e,1-n,i),kt.add(Ht,i,i)};const Gt=new kt,jt=new kt;kt.angleBetween=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),kt.normalize(e,Gt),kt.normalize(t,jt),V.acosClamped(kt.dot(Gt,jt))};const Wt=new kt;kt.mostOrthogonalAxis=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=kt.normalize(e,Wt);return kt.abs(n,n),t=n.x<=n.y?kt.clone(kt.UNIT_X,t):kt.clone(kt.UNIT_Y,t)},kt.equals=function(e,t){return e===t||D(e)&&D(t)&&e.x===t.x&&e.y===t.y},kt.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},kt.equalsEpsilon=function(e,t,n,i){return e===t||D(e)&&D(t)&&V.equalsEpsilon(e.x,t.x,n,i)&&V.equalsEpsilon(e.y,t.y,n,i)},kt.ZERO=Object.freeze(new kt(0,0)),kt.ONE=Object.freeze(new kt(1,1)),kt.UNIT_X=Object.freeze(new kt(1,0)),kt.UNIT_Y=Object.freeze(new kt(0,1)),kt.prototype.clone=function(e){return kt.clone(this,e)},kt.prototype.equals=function(e){return kt.equals(this,e)},kt.prototype.equalsEpsilon=function(e,t,n){return kt.equalsEpsilon(this,e,t,n)},kt.prototype.toString=function(){return`(${this.x}, ${this.y})`};const qt=new H,Yt=new H;function Xt(e,t,n,i,o){if(!D(e))throw new P("cartesian is required.");if(!D(t))throw new P("oneOverRadii is required.");if(!D(n))throw new P("oneOverRadiiSquared is required.");if(!D(i))throw new P("centerToleranceSquared is required.");const r=e.x,s=e.y,a=e.z,c=t.x,l=t.y,u=t.z,d=r*r*c*c,h=s*s*l*l,p=a*a*u*u,f=d+h+p,m=Math.sqrt(1/f),_=H.multiplyByScalar(e,m,qt);if(f<i)return isFinite(m)?H.clone(_,o):void 0;const g=n.x,y=n.y,b=n.z,v=Yt;v.x=_.x*g*2,v.y=_.y*y*2,v.z=_.z*b*2;let A,T,w,E,x,S,C,I,O,N,R,L=(1-m)*H.magnitude(e)/(.5*H.magnitude(v)),M=0;do{L-=M,w=1/(1+L*g),E=1/(1+L*y),x=1/(1+L*b),S=w*w,C=E*E,I=x*x,O=S*w,N=C*E,R=I*x,A=d*S+h*C+p*I-1,T=d*O*g+h*N*y+p*R*b;M=A/(-2*T)}while(Math.abs(A)>V.EPSILON12);return D(o)?(o.x=r*w,o.y=s*E,o.z=a*x,o):new H(r*w,s*E,a*x)}function Qt(e,t,n){this.longitude=M(e,0),this.latitude=M(t,0),this.height=M(n,0)}Qt.fromRadians=function(e,t,n,i){return L.typeOf.number("longitude",e),L.typeOf.number("latitude",t),n=M(n,0),D(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Qt(e,t,n)},Qt.fromDegrees=function(e,t,n,i){return L.typeOf.number("longitude",e),L.typeOf.number("latitude",t),e=V.toRadians(e),t=V.toRadians(t),Qt.fromRadians(e,t,n,i)};const $t=new H,Kt=new H,Zt=new H,Jt=new H(1/6378137,1/6378137,1/6356752.314245179),en=new H(1/40680631590769,1/40680631590769,1/40408299984661.445),tn=V.EPSILON1;function nn(e,t,n,i){t=M(t,0),n=M(n,0),i=M(i,0),L.typeOf.number.greaterThanOrEquals("x",t,0),L.typeOf.number.greaterThanOrEquals("y",n,0),L.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new H(t,n,i),e._radiiSquared=new H(t*t,n*n,i*i),e._radiiToTheFourth=new H(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new H(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),e._oneOverRadiiSquared=new H(0===t?0:1/(t*t),0===n?0:1/(n*n),0===i?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=V.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function on(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,nn(this,e,t,n)}Qt.fromCartesian=function(e,t,n){const i=D(t)?t.oneOverRadii:Jt,o=D(t)?t.oneOverRadiiSquared:en,r=Xt(e,i,o,D(t)?t._centerToleranceSquared:tn,Kt);if(!D(r))return;let s=H.multiplyComponents(r,o,$t);s=H.normalize(s,s);const a=H.subtract(e,r,Zt),c=Math.atan2(s.y,s.x),l=Math.asin(s.z),u=V.sign(H.dot(a,e))*H.magnitude(a);return D(n)?(n.longitude=c,n.latitude=l,n.height=u,n):new Qt(c,l,u)},Qt.toCartesian=function(e,t,n){return L.defined("cartographic",e),H.fromRadians(e.longitude,e.latitude,e.height,t,n)},Qt.clone=function(e,t){if(D(e))return D(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Qt(e.longitude,e.latitude,e.height)},Qt.equals=function(e,t){return e===t||D(e)&&D(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},Qt.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},Qt.ZERO=Object.freeze(new Qt(0,0,0)),Qt.prototype.clone=function(e){return Qt.clone(this,e)},Qt.prototype.equals=function(e){return Qt.equals(this,e)},Qt.prototype.equalsEpsilon=function(e,t){return Qt.equalsEpsilon(this,e,t)},Qt.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(on.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}}}),on.clone=function(e,t){if(!D(e))return;const n=e._radii;return D(t)?(H.clone(n,t._radii),H.clone(e._radiiSquared,t._radiiSquared),H.clone(e._radiiToTheFourth,t._radiiToTheFourth),H.clone(e._oneOverRadii,t._oneOverRadii),H.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new on(n.x,n.y,n.z)},on.fromCartesian3=function(e,t){return D(t)||(t=new on),D(e)?(nn(t,e.x,e.y,e.z),t):t},on.WGS84=Object.freeze(new on(6378137,6378137,6356752.314245179)),on.UNIT_SPHERE=Object.freeze(new on(1,1,1)),on.MOON=Object.freeze(new on(V.LUNAR_RADIUS,V.LUNAR_RADIUS,V.LUNAR_RADIUS)),on.prototype.clone=function(e){return on.clone(this,e)},on.packedLength=H.packedLength,on.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),H.pack(e._radii,t,n),t},on.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=H.unpack(e,t);return on.fromCartesian3(i,n)},on.prototype.geocentricSurfaceNormal=H.normalize,on.prototype.geodeticSurfaceNormalCartographic=function(e,t){L.typeOf.object("cartographic",e);const n=e.longitude,i=e.latitude,o=Math.cos(i),r=o*Math.cos(n),s=o*Math.sin(n),a=Math.sin(i);return D(t)||(t=new H),t.x=r,t.y=s,t.z=a,H.normalize(t,t)},on.prototype.geodeticSurfaceNormal=function(e,t){if(L.typeOf.object("cartesian",e),isNaN(e.x)||isNaN(e.y)||isNaN(e.z))throw new P("cartesian has a NaN component");if(!H.equalsEpsilon(e,H.ZERO,V.EPSILON14))return D(t)||(t=new H),t=H.multiplyComponents(e,this._oneOverRadiiSquared,t),H.normalize(t,t)};const rn=new H,sn=new H;on.prototype.cartographicToCartesian=function(e,t){const n=rn,i=sn;this.geodeticSurfaceNormalCartographic(e,n),H.multiplyComponents(this._radiiSquared,n,i);const o=Math.sqrt(H.dot(n,i));return H.divideByScalar(i,o,i),H.multiplyByScalar(n,e.height,n),D(t)||(t=new H),H.add(i,n,t)},on.prototype.cartographicArrayToCartesianArray=function(e,t){L.defined("cartographics",e);const n=e.length;D(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const an=new H,cn=new H,ln=new H;on.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,cn);if(!D(n))return;const i=this.geodeticSurfaceNormal(n,an),o=H.subtract(e,n,ln),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=V.sign(H.dot(o,e))*H.magnitude(o);return D(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new Qt(r,s,a)},on.prototype.cartesianArrayToCartographicArray=function(e,t){L.defined("cartesians",e);const n=e.length;D(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t},on.prototype.scaleToGeodeticSurface=function(e,t){return Xt(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},on.prototype.scaleToGeocentricSurface=function(e,t){L.typeOf.object("cartesian",e),D(t)||(t=new H);const n=e.x,i=e.y,o=e.z,r=this._oneOverRadiiSquared,s=1/Math.sqrt(n*n*r.x+i*i*r.y+o*o*r.z);return H.multiplyByScalar(e,s,t)},on.prototype.transformPositionToScaledSpace=function(e,t){return D(t)||(t=new H),H.multiplyComponents(e,this._oneOverRadii,t)},on.prototype.transformPositionFromScaledSpace=function(e,t){return D(t)||(t=new H),H.multiplyComponents(e,this._radii,t)},on.prototype.equals=function(e){return this===e||D(e)&&H.equals(this._radii,e._radii)},on.prototype.toString=function(){return this._radii.toString()},on.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(L.typeOf.object("position",e),!V.equalsEpsilon(this._radii.x,this._radii.y,V.EPSILON15))throw new P("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");L.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=M(t,0);const i=this._squaredXOverSquaredZ;if(D(n)||(n=new H),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const un=new H;on.prototype.getLocalCurvature=function(e,t){L.typeOf.object("surfacePosition",e),D(t)||(t=new kt);const n=this.getSurfaceNormalIntersectionWithZAxis(e,0,un),i=H.distance(e,n),o=i*(this.minimumRadius*i/this.maximumRadius**2)**2;return kt.fromElements(1/i,1/o,t)};const dn=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],hn=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function pn(e,t,n){L.typeOf.number("a",e),L.typeOf.number("b",t),L.typeOf.func("func",n);const i=.5*(t+e),o=.5*(t-e);let r=0;for(let s=0;s<5;s++){const e=o*dn[s];r+=hn[s]*(n(i+e)+n(i-e))}return r*=o,r}function fn(e){this._ellipsoid=M(e,on.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}on.prototype.surfaceArea=function(e){L.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,o=e.north;for(;n<t;)n+=V.TWO_PI;const r=this._radiiSquared,s=r.x,a=r.y,c=r.z,l=s*a;return pn(i,o,(function(e){const i=Math.cos(e),o=Math.sin(e);return Math.cos(e)*pn(t,n,(function(e){const t=Math.cos(e),n=Math.sin(e);return Math.sqrt(l*o*o+c*(a*t*t+s*n*n)*i*i)}))}))},Object.defineProperties(fn.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),fn.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=e.latitude*n,r=e.height;return D(t)?(t.x=i,t.y=o,t.z=r,t):new H(i,o,r)},fn.prototype.unproject=function(e,t){if(!D(e))throw new P("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=e.y*n,r=e.z;return D(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new Qt(i,o,r)};const mn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});function _n(e,t,n){L.defined("array",e),L.defined("itemToFind",t),L.defined("comparator",n);let i,o,r=0,s=e.length-1;for(;r<=s;)if(i=~~((r+s)/2),o=n(e[i],t),o<0)r=i+1;else{if(!(o>0))return i;s=i-1}return~(s+1)}function gn(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}function yn(e){if(null===e||isNaN(e))throw new P("year is required and must be a number.");return e%4==0&&e%100!=0||e%400==0}const bn=[31,28,31,30,31,30,31,31,30,31,30,31];function vn(e,t,n,i,o,r,s,a){e=M(e,1),t=M(t,1),n=M(n,1),i=M(i,0),o=M(o,0),r=M(r,0),s=M(s,0),a=M(a,!1),L.typeOf.number.greaterThanOrEquals("Year",e,1),L.typeOf.number.lessThanOrEquals("Year",e,9999),L.typeOf.number.greaterThanOrEquals("Month",t,1),L.typeOf.number.lessThanOrEquals("Month",t,12),L.typeOf.number.greaterThanOrEquals("Day",n,1),L.typeOf.number.lessThanOrEquals("Day",n,31),L.typeOf.number.greaterThanOrEquals("Hour",i,0),L.typeOf.number.lessThanOrEquals("Hour",i,23),L.typeOf.number.greaterThanOrEquals("Minute",o,0),L.typeOf.number.lessThanOrEquals("Minute",o,59),L.typeOf.bool("IsLeapSecond",a),L.typeOf.number.greaterThanOrEquals("Second",r,0),L.typeOf.number.lessThanOrEquals("Second",r,a?60:59),L.typeOf.number.greaterThanOrEquals("Millisecond",s,0),L.typeOf.number.lessThan("Millisecond",s,1e3),function(){const i=2===t&&yn(e)?bn[t-1]+1:bn[t-1];if(n>i)throw new P("Month and Day represents invalid date")}(),this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=o,this.second=r,this.millisecond=s,this.isLeapSecond=a}function An(e,t){this.julianDate=e,this.offset=t}const Tn=Object.freeze({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}),wn=Object.freeze({UTC:0,TAI:1}),En=new vn,xn=[31,28,31,30,31,30,31,31,30,31,30,31];function Sn(e,t){return Hn.compare(e.julianDate,t.julianDate)}const Cn=new An;function In(e){Cn.julianDate=e;const t=Hn.leapSeconds;let n=_n(t,Cn,Sn);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;if(n>0){Hn.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset)}Hn.addSeconds(e,i,e)}function On(e,t){Cn.julianDate=e;const n=Hn.leapSeconds;let i=_n(n,Cn,Sn);if(i<0&&(i=~i),0===i)return Hn.addSeconds(e,-n[0].offset,t);if(i>=n.length)return Hn.addSeconds(e,-n[i-1].offset,t);const o=Hn.secondsDifference(n[i].julianDate,e);return 0===o?Hn.addSeconds(e,-n[i].offset,t):o<=1?void 0:Hn.addSeconds(e,-n[--i].offset,t)}function Dn(e,t,n){const i=t/Tn.SECONDS_PER_DAY|0;return e+=i,(t-=Tn.SECONDS_PER_DAY*i)<0&&(e--,t+=Tn.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function Pn(e,t,n,i,o,r,s){const a=(t-14)/12|0,c=e+4800+a;let l=(1461*c/4|0)+(367*(t-2-12*a)/12|0)-(3*((c+100)/100|0)/4|0)+n-32075;(i-=12)<0&&(i+=24);const u=r+(i*Tn.SECONDS_PER_HOUR+o*Tn.SECONDS_PER_MINUTE+s*Tn.SECONDS_PER_MILLISECOND);return u>=43200&&(l-=1),[l,u]}const Nn=/^(\d{4})$/,Rn=/^(\d{4})-(\d{2})$/,Ln=/^(\d{4})-?(\d{3})$/,Mn=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,Fn=/^(\d{4})-?(\d{2})-?(\d{2})$/,Bn=/([Z+\-])?(\d{2})?:?(\d{2})?$/,zn=/^(\d{2})(\.\d+)?/.source+Bn.source,Un=/^(\d{2}):?(\d{2})(\.\d+)?/.source+Bn.source,kn=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+Bn.source,Vn="Invalid ISO 8601 date.";function Hn(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=M(e,0),t=M(t,0),n=M(n,wn.UTC);const i=0|e;Dn(i,t+=(e-i)*Tn.SECONDS_PER_DAY,this),n===wn.UTC&&In(this)}Hn.fromGregorianDate=function(e,t){if(!(e instanceof vn))throw new P("date must be a valid GregorianDate.");const n=Pn(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return D(t)?(Dn(n[0],n[1],t),In(t),t):new Hn(n[0],n[1],wn.UTC)},Hn.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new P("date must be a valid JavaScript Date.");const n=Pn(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return D(t)?(Dn(n[0],n[1],t),In(t),t):new Hn(n[0],n[1],wn.UTC)},Hn.fromIso8601=function(e,t){if("string"!=typeof e)throw new P(Vn);let n,i=(e=e.replace(",",".")).split("T"),o=1,r=1,s=0,a=0,c=0,l=0;const u=i[0],d=i[1];let h,p,f,m;if(!D(u))throw new P(Vn);if(i=u.match(Fn),null!==i){if(f=u.split("-").length-1,f>0&&2!==f)throw new P(Vn);n=+i[1],o=+i[2],r=+i[3]}else if(i=u.match(Rn),null!==i)n=+i[1],o=+i[2];else if(i=u.match(Nn),null!==i)n=+i[1];else{let e;if(i=u.match(Ln),null!==i){if(n=+i[1],e=+i[2],p=yn(n),e<1||p&&e>366||!p&&e>365)throw new P(Vn)}else{if(i=u.match(Mn),null===i)throw new P(Vn);{n=+i[1];const t=+i[2],o=+i[3]||0;if(f=u.split("-").length-1,f>0&&(!D(i[3])&&1!==f||D(i[3])&&2!==f))throw new P(Vn);e=7*t+o-new Date(Date.UTC(n,0,4)).getUTCDay()-3}}h=new Date(Date.UTC(n,0,1)),h.setUTCDate(e),o=h.getUTCMonth()+1,r=h.getUTCDate()}if(p=yn(n),o<1||o>12||r<1||(2!==o||!p)&&r>xn[o-1]||p&&2===o&&r>29)throw new P(Vn);if(D(d)){if(i=d.match(kn),null!==i){if(f=d.split(":").length-1,f>0&&2!==f&&3!==f)throw new P(Vn);s=+i[1],a=+i[2],c=+i[3],l=1e3*+(i[4]||0),m=5}else if(i=d.match(Un),null!==i){if(f=d.split(":").length-1,f>2)throw new P(Vn);s=+i[1],a=+i[2],c=60*+(i[3]||0),m=4}else{if(i=d.match(zn),null===i)throw new P(Vn);s=+i[1],a=60*+(i[2]||0),m=3}if(a>=60||c>=61||s>24||24===s&&(a>0||c>0||l>0))throw new P(Vn);const e=i[m],t=+i[m+1],u=+(i[m+2]||0);switch(e){case"+":s-=t,a-=u;break;case"-":s+=t,a+=u;break;case"Z":break;default:a+=new Date(Date.UTC(n,o-1,r,s,a)).getTimezoneOffset()}}const _=60===c;for(_&&c--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(h=p&&2===o?29:xn[o-1];r>h;)r-=h,o++,o>12&&(o-=12,n++),h=p&&2===o?29:xn[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,n--),h=p&&2===o?29:xn[o-1],r+=h;const g=Pn(n,o,r,s,a,c,l);return D(t)?(Dn(g[0],g[1],t),In(t)):t=new Hn(g[0],g[1],wn.UTC),_&&Hn.addSeconds(t,1,t),t},Hn.now=function(e){return Hn.fromDate(new Date,e)};const Gn=new Hn(0,0,wn.TAI);Hn.toGregorianDate=function(e,t){if(!D(e))throw new P("julianDate is required.");let n=!1,i=On(e,Gn);D(i)||(Hn.addSeconds(e,-1,Gn),i=On(Gn,Gn),n=!0);let o=i.dayNumber;const r=i.secondsOfDay;r>=43200&&(o+=1);let s=o+68569|0;const a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;const c=4e3*(s+1)/1461001|0;s=s-(1461*c/4|0)+31|0;const l=80*s/2447|0,u=s-(2447*l/80|0)|0;s=l/11|0;const d=l+2-12*s|0,h=100*(a-49)+c+s|0;let p=r/Tn.SECONDS_PER_HOUR|0,f=r-p*Tn.SECONDS_PER_HOUR;const m=f/Tn.SECONDS_PER_MINUTE|0;f-=m*Tn.SECONDS_PER_MINUTE;let _=0|f;const g=(f-_)/Tn.SECONDS_PER_MILLISECOND;return p+=12,p>23&&(p-=24),n&&(_+=1),D(t)?(t.year=h,t.month=d,t.day=u,t.hour=p,t.minute=m,t.second=_,t.millisecond=g,t.isLeapSecond=n,t):new vn(h,d,u,p,m,_,g,n)},Hn.toDate=function(e){if(!D(e))throw new P("julianDate is required.");const t=Hn.toGregorianDate(e,En);let n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))},Hn.toIso8601=function(e,t){if(!D(e))throw new P("julianDate is required.");const n=Hn.toGregorianDate(e,En);let i=n.year,o=n.month,r=n.day,s=n.hour;const a=n.minute,c=n.second,l=n.millisecond;let u;return 1e4===i&&1===o&&1===r&&0===s&&0===a&&0===c&&0===l&&(i=9999,o=12,r=31,s=24),D(t)||0===l?D(t)&&0!==t?(u=(.01*l).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${u}Z`):`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}Z`:(u=(.01*l).toString().replace(".",""),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${u}Z`)},Hn.clone=function(e,t){if(D(e))return D(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new Hn(e.dayNumber,e.secondsOfDay,wn.TAI)},Hn.compare=function(e,t){if(!D(e))throw new P("left is required.");if(!D(t))throw new P("right is required.");const n=e.dayNumber-t.dayNumber;return 0!==n?n:e.secondsOfDay-t.secondsOfDay},Hn.equals=function(e,t){return e===t||D(e)&&D(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay},Hn.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(Hn.secondsDifference(e,t))<=n},Hn.totalDays=function(e){if(!D(e))throw new P("julianDate is required.");return e.dayNumber+e.secondsOfDay/Tn.SECONDS_PER_DAY},Hn.secondsDifference=function(e,t){if(!D(e))throw new P("left is required.");if(!D(t))throw new P("right is required.");return(e.dayNumber-t.dayNumber)*Tn.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)},Hn.daysDifference=function(e,t){if(!D(e))throw new P("left is required.");if(!D(t))throw new P("right is required.");return e.dayNumber-t.dayNumber+(e.secondsOfDay-t.secondsOfDay)/Tn.SECONDS_PER_DAY},Hn.computeTaiMinusUtc=function(e){Cn.julianDate=e;const t=Hn.leapSeconds;let n=_n(t,Cn,Sn);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset},Hn.addSeconds=function(e,t,n){if(!D(e))throw new P("julianDate is required.");if(!D(t))throw new P("seconds is required.");if(!D(n))throw new P("result is required.");return Dn(e.dayNumber,e.secondsOfDay+t,n)},Hn.addMinutes=function(e,t,n){if(!D(e))throw new P("julianDate is required.");if(!D(t))throw new P("minutes is required.");if(!D(n))throw new P("result is required.");const i=e.secondsOfDay+t*Tn.SECONDS_PER_MINUTE;return Dn(e.dayNumber,i,n)},Hn.addHours=function(e,t,n){if(!D(e))throw new P("julianDate is required.");if(!D(t))throw new P("hours is required.");if(!D(n))throw new P("result is required.");const i=e.secondsOfDay+t*Tn.SECONDS_PER_HOUR;return Dn(e.dayNumber,i,n)},Hn.addDays=function(e,t,n){if(!D(e))throw new P("julianDate is required.");if(!D(t))throw new P("days is required.");if(!D(n))throw new P("result is required.");return Dn(e.dayNumber+t,e.secondsOfDay,n)},Hn.lessThan=function(e,t){return Hn.compare(e,t)<0},Hn.lessThanOrEquals=function(e,t){return Hn.compare(e,t)<=0},Hn.greaterThan=function(e,t){return Hn.compare(e,t)>0},Hn.greaterThanOrEquals=function(e,t){return Hn.compare(e,t)>=0},Hn.prototype.clone=function(e){return Hn.clone(this,e)},Hn.prototype.equals=function(e){return Hn.equals(this,e)},Hn.prototype.equalsEpsilon=function(e,t){return Hn.equalsEpsilon(this,e,t)},Hn.prototype.toString=function(){return Hn.toIso8601(this)},Hn.leapSeconds=[new An(new Hn(2441317,43210,wn.TAI),10),new An(new Hn(2441499,43211,wn.TAI),11),new An(new Hn(2441683,43212,wn.TAI),12),new An(new Hn(2442048,43213,wn.TAI),13),new An(new Hn(2442413,43214,wn.TAI),14),new An(new Hn(2442778,43215,wn.TAI),15),new An(new Hn(2443144,43216,wn.TAI),16),new An(new Hn(2443509,43217,wn.TAI),17),new An(new Hn(2443874,43218,wn.TAI),18),new An(new Hn(2444239,43219,wn.TAI),19),new An(new Hn(2444786,43220,wn.TAI),20),new An(new Hn(2445151,43221,wn.TAI),21),new An(new Hn(2445516,43222,wn.TAI),22),new An(new Hn(2446247,43223,wn.TAI),23),new An(new Hn(2447161,43224,wn.TAI),24),new An(new Hn(2447892,43225,wn.TAI),25),new An(new Hn(2448257,43226,wn.TAI),26),new An(new Hn(2448804,43227,wn.TAI),27),new An(new Hn(2449169,43228,wn.TAI),28),new An(new Hn(2449534,43229,wn.TAI),29),new An(new Hn(2450083,43230,wn.TAI),30),new An(new Hn(2450630,43231,wn.TAI),31),new An(new Hn(2451179,43232,wn.TAI),32),new An(new Hn(2453736,43233,wn.TAI),33),new An(new Hn(2454832,43234,wn.TAI),34),new An(new Hn(2456109,43235,wn.TAI),35),new An(new Hn(2457204,43236,wn.TAI),36),new An(new Hn(2457754,43237,wn.TAI),37)];var jn,Wn={exports:{}},qn={exports:{}};var Yn,Xn={exports:{}};
|
||
/*!
|
||
* URI.js - Mutating URLs
|
||
* IPv6 Support
|
||
*
|
||
* Version: 1.19.11
|
||
*
|
||
* Author: Rodney Rehm
|
||
* Web: http://medialize.github.io/URI.js/
|
||
*
|
||
* Licensed under
|
||
* MIT License http://www.opensource.org/licenses/mit-license
|
||
*
|
||
*/var Qn,$n,Kn,Zn,Jn={exports:{}};
|
||
/*!
|
||
* URI.js - Mutating URLs
|
||
* Second Level Domain (SLD) Support
|
||
*
|
||
* Version: 1.19.11
|
||
*
|
||
* Author: Rodney Rehm
|
||
* Web: http://medialize.github.io/URI.js/
|
||
*
|
||
* Licensed under
|
||
* MIT License http://www.opensource.org/licenses/mit-license
|
||
*
|
||
*/Kn=t,Zn=function(e,t,n,i){var o=i&&i.URI;function r(e,t){var n=arguments.length>=1;if(!(this instanceof r))return n?arguments.length>=2?new r(e,t):new r(e):new r;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}r.version="1.19.11";var s=r.prototype,a=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function u(e){return"Array"===l(e)}function d(e,t){var n,i,o={};if("RegExp"===l(t))o=null;else if(u(t))for(n=0,i=t.length;n<i;n++)o[t[n]]=!0;else o[t]=!0;for(n=0,i=e.length;n<i;n++)(o&&void 0!==o[e[n]]||!o&&t.test(e[n]))&&(e.splice(n,1),i--,n--);return e}function h(e,t){var n,i;if(u(t)){for(n=0,i=t.length;n<i;n++)if(!h(e,t[n]))return!1;return!0}var o=l(t);for(n=0,i=e.length;n<i;n++)if("RegExp"===o){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function p(e,t){if(!u(e)||!u(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function f(e){return e.replace(/^\/+|\/+$/g,"")}function m(e){return escape(e)}function _(e){return encodeURIComponent(e).replace(/[!'()*]/g,m).replace(/\*/g,"%2A")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return r.domAttributes[t]}},r.encode=_,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=_,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(e,t){var n=r.encode(e+"");return void 0===t&&(t=r.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},r.decodeQuery=function(e,t){e+="",void 0===t&&(t=r.escapeQuerySpace);try{return r.decode(t?e.replace(/\+/g,"%20"):e)}catch(n){return e}};var g,y={encode:"encode",decode:"decode"},b=function(e,t){return function(n){try{return r[t](n+"").replace(r.characters[e][t].expression,(function(n){return r.characters[e][t].map[n]}))}catch(i){return n}}};for(g in y)r[g+"PathSegment"]=b("pathname",y[g]),r[g+"UrnPathSegment"]=b("urnpath",y[g]);var v=function(e,t,n){return function(i){var o;o=n?function(e){return r[t](r[n](e))}:r[t];for(var s=(i+"").split(e),a=0,c=s.length;a<c;a++)s[a]=o(s[a]);return s.join(e)}};function A(e){return function(t,n){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!n),this)}}function T(e,t){return function(n,i){return void 0===n?this._parts[e]||"":(null!==n&&(n+="").charAt(0)===t&&(n=n.substring(1)),this._parts[e]=n,this.build(!i),this)}}r.decodePath=v("/","decodePathSegment"),r.decodeUrnPath=v(":","decodeUrnPathSegment"),r.recodePath=v("/","encodePathSegment","decode"),r.recodeUrnPath=v(":","encodeUrnPathSegment","decode"),r.encodeReserved=b("reserved","encode"),r.parse=function(e,t){var n;return t||(t={preventInvalidHostname:r.preventInvalidHostname}),(n=(e=(e=e.replace(r.leading_whitespace_expression,"")).replace(r.ascii_tab_whitespace,"")).indexOf("#"))>-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),(n=e.indexOf("?"))>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),"//"===(e=(e=e.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).replace(/^[/\\]{2,}/i,"//")).substring(0,2)?(t.protocol=null,e=e.substring(2),e=r.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(r.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3).replace(/\\/g,"/")?(e=e.substring(n+3),e=r.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},r.parseHost=function(e,t){e||(e="");var n,i,o=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===o&&(o=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,o)||null,"/"===t.port&&(t.port=null);else{var s=e.indexOf(":"),a=e.indexOf("/"),c=e.indexOf(":",s+1);-1!==c&&(-1===a||c<a)?(t.hostname=e.substring(0,o)||null,t.port=null):(i=e.substring(0,o).split(":"),t.hostname=i[0]||null,t.port=i[1]||null)}return t.hostname&&"/"!==e.substring(o).charAt(0)&&(o++,e="/"+e),t.preventInvalidHostname&&r.ensureValidHostname(t.hostname,t.protocol),t.port&&r.ensureValidPort(t.port),e.substring(o)||"/"},r.parseAuthority=function(e,t){return e=r.parseUserinfo(e,t),r.parseHost(e,t)},r.parseUserinfo=function(e,t){var n=e;-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/"));var i,o=e.indexOf("/"),s=e.lastIndexOf("@",o>-1?o:e.length-1);return s>-1&&(-1===o||s<o)?(i=e.substring(0,s).split(":"),t.username=i[0]?r.decode(i[0]):null,i.shift(),t.password=i[0]?r.decode(i.join(":")):null,e=n.substring(s+1)):(t.username=null,t.password=null),e},r.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var n,i,o,s={},c=e.split("&"),l=c.length,u=0;u<l;u++)n=c[u].split("="),i=r.decodeQuery(n.shift(),t),o=n.length?r.decodeQuery(n.join("="),t):null,"__proto__"!==i&&(a.call(s,i)?("string"!=typeof s[i]&&null!==s[i]||(s[i]=[s[i]]),s[i].push(o)):s[i]=o);return s},r.build=function(e){var t="",n=!1;return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//",n=!0),t+=r.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&n&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},r.buildHost=function(e){var t="";return e.hostname?(r.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},r.buildAuthority=function(e){return r.buildUserinfo(e)+r.buildHost(e)},r.buildUserinfo=function(e){var t="";return e.username&&(t+=r.encode(e.username)),e.password&&(t+=":"+r.encode(e.password)),t&&(t+="@"),t},r.buildQuery=function(e,t,n){var i,o,s,c,l="";for(o in e)if("__proto__"!==o&&a.call(e,o))if(u(e[o]))for(i={},s=0,c=e[o].length;s<c;s++)void 0!==e[o][s]&&void 0===i[e[o][s]+""]&&(l+="&"+r.buildQueryParameter(o,e[o][s],n),!0!==t&&(i[e[o][s]+""]=!0));else void 0!==e[o]&&(l+="&"+r.buildQueryParameter(o,e[o],n));return l.substring(1)},r.buildQueryParameter=function(e,t,n){return r.encodeQuery(e,n)+(null!==t?"="+r.encodeQuery(t,n):"")},r.addQuery=function(e,t,n){if("object"==typeof t)for(var i in t)a.call(t,i)&&r.addQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=n);"string"==typeof e[t]&&(e[t]=[e[t]]),u(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},r.setQuery=function(e,t,n){if("object"==typeof t)for(var i in t)a.call(t,i)&&r.setQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");e[t]=void 0===n?null:n}},r.removeQuery=function(e,t,n){var i,o,s;if(u(t))for(i=0,o=t.length;i<o;i++)e[t[i]]=void 0;else if("RegExp"===l(t))for(s in e)t.test(s)&&(e[s]=void 0);else if("object"==typeof t)for(s in t)a.call(t,s)&&r.removeQuery(e,s,t[s]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==n?"RegExp"===l(n)?!u(e[t])&&n.test(e[t])?e[t]=void 0:e[t]=d(e[t],n):e[t]!==String(n)||u(n)&&1!==n.length?u(e[t])&&(e[t]=d(e[t],n)):e[t]=void 0:e[t]=void 0}},r.hasQuery=function(e,t,n,i){switch(l(t)){case"String":break;case"RegExp":for(var o in e)if(a.call(e,o)&&t.test(o)&&(void 0===n||r.hasQuery(e,o,n)))return!0;return!1;case"Object":for(var s in t)if(a.call(t,s)&&!r.hasQuery(e,s,t[s]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(n)){case"Undefined":return t in e;case"Boolean":return n===Boolean(u(e[t])?e[t].length:e[t]);case"Function":return!!n(e[t],t,e);case"Array":return!!u(e[t])&&(i?h:p)(e[t],n);case"RegExp":return u(e[t])?!!i&&h(e[t],n):Boolean(e[t]&&e[t].match(n));case"Number":n=String(n);case"String":return u(e[t])?!!i&&h(e[t],n):e[t]===n;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var e=[],t=[],n=0,i=0;i<arguments.length;i++){var o=new r(arguments[i]);e.push(o);for(var s=o.segment(),a=0;a<s.length;a++)"string"==typeof s[a]&&t.push(s[a]),s[a]&&n++}if(!t.length||!n)return new r("");var c=new r("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||c.path("/"+c.path()),c.normalize()},r.commonPath=function(e,t){var n,i=Math.min(e.length,t.length);for(n=0;n<i;n++)if(e.charAt(n)!==t.charAt(n)){n--;break}return n<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(n)&&"/"===t.charAt(n)||(n=e.substring(0,n).lastIndexOf("/")),e.substring(0,n+1))},r.withinString=function(e,t,n){n||(n={});var i=n.start||r.findUri.start,o=n.end||r.findUri.end,s=n.trim||r.findUri.trim,a=n.parens||r.findUri.parens,c=/[a-z0-9-]=["']?$/i;for(i.lastIndex=0;;){var l=i.exec(e);if(!l)break;var u=l.index;if(n.ignoreHtml){var d=e.slice(Math.max(u-3,0),u);if(d&&c.test(d))continue}for(var h=u+e.slice(u).search(o),p=e.slice(u,h),f=-1;;){var m=a.exec(p);if(!m)break;var _=m.index+m[0].length;f=Math.max(f,_)}if(!((p=f>-1?p.slice(0,f)+p.slice(f).replace(s,""):p.replace(s,"")).length<=l[0].length||n.ignore&&n.ignore.test(p))){var g=t(p,u,h=u+p.length,e);void 0!==g?(g=String(g),e=e.slice(0,u)+g+e.slice(h),i.lastIndex=u+g.length):i.lastIndex=h}}return i.lastIndex=0,e},r.ensureValidHostname=function(t,n){var i=!!t,o=!1;if(!!n&&(o=h(r.hostProtocols,n)),o&&!i)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},r.noConflict=function(e){if(e){var t={URI:this.noConflict()};return i.URITemplate&&"function"==typeof i.URITemplate.noConflict&&(t.URITemplate=i.URITemplate.noConflict()),i.IPv6&&"function"==typeof i.IPv6.noConflict&&(t.IPv6=i.IPv6.noConflict()),i.SecondLevelDomains&&"function"==typeof i.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=i.SecondLevelDomains.noConflict()),t}return i.URI===this&&(i.URI=o),this},s.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new r(this)},s.valueOf=s.toString=function(){return this.build(!1)._string},s.protocol=A("protocol"),s.username=A("username"),s.password=A("password"),s.hostname=A("hostname"),s.port=A("port"),s.query=T("query","?"),s.fragment=T("fragment","#"),s.search=function(e,t){var n=this.query(e,t);return"string"==typeof n&&n.length?"?"+n:n},s.hash=function(e,t){var n=this.fragment(e,t);return"string"==typeof n&&n.length?"#"+n:n},s.pathname=function(e,t){if(void 0===e||!0===e){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?r.decodeUrnPath:r.decodePath)(n):n}return this._parts.urn?this._parts.path=e?r.recodeUrnPath(e):"":this._parts.path=e?r.recodePath(e):"/",this.build(!t),this},s.path=s.pathname,s.href=function(e,t){var n;if(void 0===e)return this.toString();this._string="",this._parts=r._parts();var i=e instanceof r,o="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName&&(e=e[r.getDomAttribute(e)]||"",o=!1),!i&&o&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=r.parse(String(e),this._parts);else{if(!i&&!o)throw new TypeError("invalid input");var s=i?e._parts:e;for(n in s)"query"!==n&&a.call(this._parts,n)&&(this._parts[n]=s[n]);s.query&&this.query(s.query,!1)}return this.build(!t),this},s.is=function(e){var t=!1,i=!1,o=!1,s=!1,a=!1,c=!1,l=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,i=r.ip4_expression.test(this._parts.hostname),o=r.ip6_expression.test(this._parts.hostname),a=(s=!(t=i||o))&&n&&n.has(this._parts.hostname),c=s&&r.idn_expression.test(this._parts.hostname),l=s&&r.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return s;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return i;case"ip6":case"ipv6":case"inet6":return o;case"idn":return c;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var w=s.protocol,E=s.port,x=s.hostname;s.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(r.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return w.call(this,e,t)},s.scheme=s.protocol,s.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),r.ensureValidPort(e))),E.call(this,e,t))},s.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var n={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==r.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(e,this._parts.protocol)}return x.call(this,e,t)},s.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=this.protocol();return this.authority()?(n?n+"://":"")+this.authority():""}var i=r(e);return this.protocol(i.protocol()).authority(i.authority()).build(!t),this},s.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?r.buildHost(this._parts):"";if("/"!==r.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},s.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?r.buildAuthority(this._parts):"";if("/"!==r.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},s.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=r.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),r.parseUserinfo(e,this._parts),this.build(!t),this},s.resource=function(e,t){var n;return void 0===e?this.path()+this.search()+this.hash():(n=r.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},s.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var i=this._parts.hostname.length-this.domain().length,o=this._parts.hostname.substring(0,i),s=new RegExp("^"+c(o));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&r.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(s,e),this.build(!t),this},s.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var i=this._parts.hostname.length-this.tld(t).length-1;return i=this._parts.hostname.lastIndexOf(".",i-1)+1,this._parts.hostname.substring(i)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var o=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},s.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var i=this._parts.hostname.lastIndexOf("."),o=this._parts.hostname.substring(i+1);return!0!==t&&n&&n.list[o.toLowerCase()]&&n.get(this._parts.hostname)||o}var r;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');r=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(r,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");r=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(r,e)}return this.build(!t),this},s.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var n=this._parts.path.length-this.filename().length-1,i=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?r.decodePath(i):i}var o=this._parts.path.length-this.filename().length,s=this._parts.path.substring(0,o),a=new RegExp("^"+c(s));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=r.recodePath(e),this._parts.path=this._parts.path.replace(a,e),this.build(!t),this},s.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var n=this._parts.path.lastIndexOf("/"),i=this._parts.path.substring(n+1);return e?r.decodePathSegment(i):i}var o=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(o=!0);var s=new RegExp(c(this.filename())+"$");return e=r.recodePath(e),this._parts.path=this._parts.path.replace(s,e),o?this.normalizePath(t):this.build(!t),this},s.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var n,i,o=this.filename(),s=o.lastIndexOf(".");return-1===s?"":(n=o.substring(s+1),i=/^[a-z0-9%]+$/i.test(n)?n:"",e?r.decodePathSegment(i):i)}"."===e.charAt(0)&&(e=e.substring(1));var a,l=this.suffix();if(l)a=e?new RegExp(c(l)+"$"):new RegExp(c("."+l)+"$");else{if(!e)return this;this._parts.path+="."+r.recodePath(e)}return a&&(e=r.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},s.segment=function(e,t,n){var i=this._parts.urn?":":"/",o=this.path(),r="/"===o.substring(0,1),s=o.split(i);if(void 0!==e&&"number"!=typeof e&&(n=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(r&&s.shift(),e<0&&(e=Math.max(s.length+e,0)),void 0===t)return void 0===e?s:s[e];if(null===e||void 0===s[e])if(u(t)){s=[];for(var a=0,c=t.length;a<c;a++)(t[a].length||s.length&&s[s.length-1].length)&&(s.length&&!s[s.length-1].length&&s.pop(),s.push(f(t[a])))}else(t||"string"==typeof t)&&(t=f(t),""===s[s.length-1]?s[s.length-1]=t:s.push(t));else t?s[e]=f(t):s.splice(e,1);return r&&s.unshift(""),this.path(s.join(i),n)},s.segmentCoded=function(e,t,n){var i,o,s;if("number"!=typeof e&&(n=t,t=e,e=void 0),void 0===t){if(u(i=this.segment(e,t,n)))for(o=0,s=i.length;o<s;o++)i[o]=r.decode(i[o]);else i=void 0!==i?r.decode(i):void 0;return i}if(u(t))for(o=0,s=t.length;o<s;o++)t[o]=r.encode(t[o]);else t="string"==typeof t||t instanceof String?r.encode(t):t;return this.segment(e,t,n)};var S=s.query;return s.query=function(e,t){if(!0===e)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var n=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),i=e.call(this,n);return this._parts.query=r.buildQuery(i||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=r.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):S.call(this,e,t)},s.setQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)i[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var o in e)a.call(e,o)&&(i[o]=e[o])}return this._parts.query=r.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},s.addQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(i,e,void 0===t?null:t),this._parts.query=r.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},s.removeQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(i,e,t),this._parts.query=r.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},s.hasQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(i,e,t,n)},s.setSearch=s.setQuery,s.addSearch=s.addQuery,s.removeSearch=s.removeQuery,s.hasSearch=s.hasQuery,s.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},s.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},s.normalizeHostname=function(n){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!n)),this},s.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},s.normalizePath=function(e){var t,n=this._parts.path;if(!n)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var i,o,s="";for("/"!==(n=r.recodePath(n)).charAt(0)&&(t=!0,n="/"+n),"/.."!==n.slice(-3)&&"/."!==n.slice(-2)||(n+="/"),n=n.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(s=n.substring(1).match(/^(\.\.\/)+/)||"")&&(s=s[0]);-1!==(i=n.search(/\/\.\.(\/|$)/));)0!==i?(-1===(o=n.substring(0,i).lastIndexOf("/"))&&(o=i),n=n.substring(0,o)+n.substring(i+3)):n=n.substring(3);return t&&this.is("relative")&&(n=s+n.substring(1)),this._parts.path=n,this.build(!e),this},s.normalizePathname=s.normalizePath,s.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},s.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},s.normalizeSearch=s.normalizeQuery,s.normalizeHash=s.normalizeFragment,s.iso8859=function(){var e=r.encode,t=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=e,r.decode=t}return this},s.unicode=function(){var e=r.encode,t=r.decode;r.encode=_,r.decode=unescape;try{this.normalize()}finally{r.encode=e,r.decode=t}return this},s.readable=function(){var t=this.clone();t.username("").password("").normalize();var n="";if(t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(n+=e.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(n+="/"),n+=t.path(!0),t._parts.query){for(var i="",o=0,s=t._parts.query.split("&"),a=s.length;o<a;o++){var c=(s[o]||"").split("=");i+="&"+r.decodeQuery(c[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==c[1]&&(i+="="+r.decodeQuery(c[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+i.substring(1)}return n+=r.decodeQuery(t.hash(),!0)},s.absoluteTo=function(e){var t,n,i,o=this.clone(),s=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof r||(e=new r(e)),o._parts.protocol)return o;if(o._parts.protocol=e._parts.protocol,this._parts.hostname)return o;for(n=0;i=s[n];n++)o._parts[i]=e._parts[i];return o._parts.path?(".."===o._parts.path.substring(-2)&&(o._parts.path+="/"),"/"!==o.path().charAt(0)&&(t=(t=e.directory())||(0===e.path().indexOf("/")?"/":""),o._parts.path=(t?t+"/":"")+o._parts.path,o.normalizePath())):(o._parts.path=e._parts.path,o._parts.query||(o._parts.query=e._parts.query)),o.build(),o},s.relativeTo=function(e){var t,n,i,o,s,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new r(e).normalize(),t=a._parts,n=e._parts,o=a.path(),s=e.path(),"/"!==o.charAt(0))throw new Error("URI is already relative");if("/"!==s.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===n.protocol&&(t.protocol=null),t.username!==n.username||t.password!==n.password)return a.build();if(null!==t.protocol||null!==t.username||null!==t.password)return a.build();if(t.hostname!==n.hostname||t.port!==n.port)return a.build();if(t.hostname=null,t.port=null,o===s)return t.path="",a.build();if(!(i=r.commonPath(o,s)))return a.build();var c=n.path.substring(i.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=c+t.path.substring(i.length)||"./",a.build()},s.equals=function(e){var t,n,i,o,s,c=this.clone(),l=new r(e),d={};if(c.normalize(),l.normalize(),c.toString()===l.toString())return!0;if(i=c.query(),o=l.query(),c.query(""),l.query(""),c.toString()!==l.toString())return!1;if(i.length!==o.length)return!1;for(s in t=r.parseQuery(i,this._parts.escapeQuerySpace),n=r.parseQuery(o,this._parts.escapeQuerySpace),t)if(a.call(t,s)){if(u(t[s])){if(!p(t[s],n[s]))return!1}else if(t[s]!==n[s])return!1;d[s]=!0}for(s in n)if(a.call(n,s)&&!d[s])return!1;return!0},s.preventInvalidHostname=function(e){return this._parts.preventInvalidHostname=!!e,this},s.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},s.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},r},(
|
||
/*!
|
||
* URI.js - Mutating URLs
|
||
*
|
||
* Version: 1.19.11
|
||
*
|
||
* Author: Rodney Rehm
|
||
* Web: http://medialize.github.io/URI.js/
|
||
*
|
||
* Licensed under
|
||
* MIT License http://www.opensource.org/licenses/mit-license
|
||
*
|
||
*/
|
||
$n=Wn).exports?$n.exports=Zn(function(){return jn||(jn=1,e=qn,n=qn.exports,function(i){var o=n&&!n.nodeType&&n,r=e&&!e.nodeType&&e,s="object"==typeof t&&t;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,c,l=2147483647,u=36,d=/^xn--/,h=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,_=String.fromCharCode;function g(e){throw new RangeError(f[e])}function y(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function b(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+y((e=e.replace(p,".")).split("."),t).join(".")}function v(e){for(var t,n,i=[],o=0,r=e.length;o<r;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<r?56320==(64512&(n=e.charCodeAt(o++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),o--):i.push(t);return i}function A(e){return y(e,(function(e){var t="";return e>65535&&(t+=_((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+_(e)})).join("")}function T(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var i=0;for(e=n?m(e/700):e>>1,e+=m(e/t);e>455;i+=u)e=m(e/35);return m(i+36*e/(e+38))}function E(e){var t,n,i,o,r,s,a,c,d,h,p,f=[],_=e.length,y=0,b=128,v=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&g("not-basic"),f.push(e.charCodeAt(i));for(o=n>0?n+1:0;o<_;){for(r=y,s=1,a=u;o>=_&&g("invalid-input"),((c=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:u)>=u||c>m((l-y)/s))&&g("overflow"),y+=c*s,!(c<(d=a<=v?1:a>=v+26?26:a-v));a+=u)s>m(l/(h=u-d))&&g("overflow"),s*=h;v=w(y-r,t=f.length+1,0==r),m(y/t)>l-b&&g("overflow"),b+=m(y/t),y%=t,f.splice(y++,0,b)}return A(f)}function x(e){var t,n,i,o,r,s,a,c,d,h,p,f,y,b,A,E=[];for(f=(e=v(e)).length,t=128,n=0,r=72,s=0;s<f;++s)(p=e[s])<128&&E.push(_(p));for(i=o=E.length,o&&E.push("-");i<f;){for(a=l,s=0;s<f;++s)(p=e[s])>=t&&p<a&&(a=p);for(a-t>m((l-n)/(y=i+1))&&g("overflow"),n+=(a-t)*y,t=a,s=0;s<f;++s)if((p=e[s])<t&&++n>l&&g("overflow"),p==t){for(c=n,d=u;!(c<(h=d<=r?1:d>=r+26?26:d-r));d+=u)A=c-h,b=u-h,E.push(_(T(h+A%b,0))),c=m(A/b);E.push(_(T(c,0))),r=w(n,y,i==o),n=0,++i}++n,++t}return E.join("")}if(a={version:"1.3.2",ucs2:{decode:v,encode:A},decode:E,encode:x,toASCII:function(e){return b(e,(function(e){return h.test(e)?"xn--"+x(e):e}))},toUnicode:function(e){return b(e,(function(e){return d.test(e)?E(e.slice(4).toLowerCase()):e}))}},o&&r)if(e.exports==o)r.exports=a;else for(c in a)a.hasOwnProperty(c)&&(o[c]=a[c]);else i.punycode=a}(t)),qn.exports;var e,n}(),function(){return Yn||(Yn=1,n=t,i=function(e){var t=e&&e.IPv6;return{best:function(e){var t,n,i=e.toLowerCase().split(":"),o=i.length,r=8;for(""===i[0]&&""===i[1]&&""===i[2]?(i.shift(),i.shift()):""===i[0]&&""===i[1]?i.shift():""===i[o-1]&&""===i[o-2]&&i.pop(),-1!==i[(o=i.length)-1].indexOf(".")&&(r=7),t=0;t<o&&""!==i[t];t++);if(t<r)for(i.splice(t,1,"0000");i.length<r;)i.splice(t,0,"0000");for(var s=0;s<r;s++){n=i[s].split("");for(var a=0;a<3&&"0"===n[0]&&n.length>1;a++)n.splice(0,1);i[s]=n.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(s=0;s<r;s++)h?"0"===i[s]?u+=1:(h=!1,u>l&&(c=d,l=u)):"0"===i[s]&&(h=!0,d=s,u=1);u>l&&(c=d,l=u),l>1&&i.splice(c,l,""),o=i.length;var p="";for(""===i[0]&&(p=":"),s=0;s<o&&(p+=i[s],s!==o-1);s++)p+=":";return""===i[o-1]&&(p+=":"),p},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),this}}},(e=Xn).exports?e.exports=i():n.IPv6=i(n)),Xn.exports;var e,n,i}(),function(){return Qn||(Qn=1,n=t,i=function(e){var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return!1;var o=n.list[e.slice(t+1)];return!!o&&o.indexOf(" "+e.slice(i+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return null;var o=n.list[e.slice(t+1)];return o?o.indexOf(" "+e.slice(i+1,t)+" ")<0?null:e.slice(i+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n},(e=Jn).exports?e.exports=i():n.SecondLevelDomains=i(n)),Jn.exports;var e,n,i}()):Kn.URI=Zn(Kn.punycode,Kn.IPv6,Kn.SecondLevelDomains,Kn);const ei=Wn.exports;function ti(e,t){if(null===e||"object"!=typeof e)return e;t=M(t,!1);const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let o=e[i];t&&(o=ti(o,t)),n[i]=o}return n}function ni(e,t,n){n=M(n,!1);const i={},o=D(e),r=D(t);let s,a,c;if(o)for(s in e)e.hasOwnProperty(s)&&(a=e[s],r&&n&&"object"==typeof a&&t.hasOwnProperty(s)?(c=t[s],i[s]="object"==typeof c?ni(a,c,n):a):i[s]=a);if(r)for(s in t)t.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(c=t[s],i[s]=c);return i}function ii(){let e,t;const n=new Promise((function(n,i){e=n,t=i}));return{resolve:e,reject:t,promise:n}}function oi(e,t){let n;return"undefined"!=typeof document&&(n=document),oi._implementation(e,t,n)}oi._implementation=function(e,t,n){if(!D(e))throw new P("relative uri is required.");if(!D(t)){if(void 0===n)return e;t=M(n.baseURI,n.location.href)}const i=new ei(e);return""!==i.scheme()?i.toString():i.absoluteTo(t).toString()};const ri={};function si(e,t,n){D(t)||(t=e.width),D(n)||(n=e.height);let i=ri[t];D(i)||(i={},ri[t]=i);let o=i[n];if(!D(o)){const e=document.createElement("canvas");e.width=t,e.height=n,o=e.getContext("2d",{willReadFrequently:!0}),o.globalCompositeOperation="copy",i[n]=o}return o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n).data}const ai=/^blob:/i;function ci(e){return L.typeOf.string("uri",e),ai.test(e)}let li;function ui(e){D(li)||(li=document.createElement("a")),li.href=window.location.href;const t=li.host,n=li.protocol;return li.href=e,li.href=li.href,n!==li.protocol||t!==li.host}const di=/^data:/i;function hi(e){return L.typeOf.string("uri",e),di.test(e)}const pi=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),fi=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3});function mi(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.throttleByServer,!1),n=M(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=M(e.priority,0),this.throttle=n,this.throttleByServer=t,this.type=M(e.type,fi.OTHER),this.serverKey=e.serverKey,this.state=pi.UNISSUED,this.deferred=void 0,this.cancelled=!1}function _i(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=function(e){const t={};if(!e)return t;const n=e.split("\r\n");for(let i=0;i<n.length;++i){const e=n[i],o=e.indexOf(": ");if(o>0){const n=e.substring(0,o),i=e.substring(o+2);t[n]=i}}return t}(this.responseHeaders))}function gi(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}function yi(e,t){return t-e}function bi(e){L.typeOf.object("options",e),L.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function vi(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}mi.prototype.cancel=function(){this.cancelled=!0},mi.prototype.clone=function(e){return D(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=pi.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new mi(this)},_i.prototype.toString=function(){let e="Request has failed.";return D(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e},Object.defineProperties(gi.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),gi.prototype.addEventListener=function(e,t){L.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}},gi.prototype.removeEventListener=function(e,t){L.typeOf.func("listener",e);const n=this._listeners,i=this._scopes;let o=-1;for(let r=0;r<n.length;r++)if(n[r]===e&&i[r]===t){o=r;break}return-1!==o&&(this._insideRaiseEvent?(this._toRemove.push(o),n[o]=void 0,i[o]=void 0):(n.splice(o,1),i.splice(o,1)),!0)},gi.prototype.raiseEvent=function(){let e;this._insideRaiseEvent=!0;const t=this._listeners,n=this._scopes;let i=t.length;for(e=0;e<i;e++){D(t[e])&&t[e].apply(n[e],arguments)}const o=this._toRemove;if(i=o.length,i>0){for(o.sort(yi),e=0;e<i;e++){const i=o[e];t.splice(i,1),n.splice(i,1)}o.length=0}this._insideRaiseEvent=!1},Object.defineProperties(bi.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){L.typeOf.number.greaterThanOrEquals("maximumLength",e,0);const t=this._length;if(e<t){const n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}}),bi.prototype.reserve=function(e){e=M(e,this._length),this._array.length=e},bi.prototype.heapify=function(e){e=M(e,0);const t=this._length,n=this._comparator,i=this._array;let o=-1,r=!0;for(;r;){const s=2*(e+1),a=s-1;o=a<t&&n(i[a],i[e])<0?a:e,s<t&&n(i[s],i[o])<0&&(o=s),o!==e?(vi(i,o,e),e=o):r=!1}},bi.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)},bi.prototype.insert=function(e){L.defined("element",e);const t=this._array,n=this._comparator,i=this._maximumLength;let o,r=this._length++;for(r<t.length?t[r]=e:t.push(e);0!==r;){const e=Math.floor((r-1)/2);if(!(n(t[r],t[e])<0))break;vi(t,r,e),r=e}return D(i)&&this._length>i&&(o=t[i],this._length=i),o},bi.prototype.pop=function(e){if(e=M(e,0),0===this._length)return;L.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return vi(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};const Ai={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let Ti=20;const wi=new bi({comparator:function(e,t){return e.priority-t.priority}});wi.maximumLength=Ti,wi.reserve(Ti);const Ei=[];let xi={};const Si="undefined"!=typeof document?new ei(document.location.href):new ei,Ci=new gi;function Ii(){}function Oi(e){D(e.priorityFunction)&&(e.priority=e.priorityFunction())}function Di(e){return e.state===pi.UNISSUED&&(e.state=pi.ISSUED,e.deferred=ii()),e.deferred.promise}function Pi(e){const t=Di(e);return e.state=pi.ACTIVE,Ei.push(e),++Ai.numberOfActiveRequests,++Ai.numberOfActiveRequestsEver,++xi[e.serverKey],e.requestFunction().then(function(e){return function(t){if(e.state===pi.CANCELLED)return;const n=e.deferred;--Ai.numberOfActiveRequests,--xi[e.serverKey],Ci.raiseEvent(),e.state=pi.RECEIVED,e.deferred=void 0,n.resolve(t)}}(e)).catch(function(e){return function(t){e.state!==pi.CANCELLED&&(++Ai.numberOfFailedRequests,--Ai.numberOfActiveRequests,--xi[e.serverKey],Ci.raiseEvent(t),e.state=pi.FAILED,e.deferred.reject(t))}}(e)),t}function Ni(e){const t=e.state===pi.ACTIVE;if(e.state=pi.CANCELLED,++Ai.numberOfCancelledRequests,D(e.deferred)){const t=e.deferred;e.deferred=void 0,t.reject()}t&&(--Ai.numberOfActiveRequests,--xi[e.serverKey],++Ai.numberOfCancelledActiveRequests),D(e.cancelFunction)&&e.cancelFunction()}Ii.maximumRequests=50,Ii.maximumRequestsPerServer=18,Ii.requestsByServer={},Ii.throttleRequests=!0,Ii.debugShowStatistics=!1,Ii.requestCompletedEvent=Ci,Object.defineProperties(Ii,{statistics:{get:function(){return Ai}},priorityHeapLength:{get:function(){return Ti},set:function(e){if(e<Ti)for(;wi.length>e;){Ni(wi.pop())}Ti=e,wi.maximumLength=e,wi.reserve(e)}}}),Ii.serverHasOpenSlots=function(e,t){t=M(t,1);const n=M(Ii.requestsByServer[e],Ii.maximumRequestsPerServer);return xi[e]+t<=n},Ii.heapHasOpenSlots=function(e){return wi.length+e<=Ti},Ii.update=function(){let e,t,n=0;const i=Ei.length;for(e=0;e<i;++e)t=Ei[e],t.cancelled&&Ni(t),t.state===pi.ACTIVE?n>0&&(Ei[e-n]=t):++n;Ei.length-=n;const o=wi.internalArray,r=wi.length;for(e=0;e<r;++e)Oi(o[e]);wi.resort();const s=Math.max(Ii.maximumRequests-Ei.length,0);let a=0;for(;a<s&&wi.length>0;)t=wi.pop(),t.cancelled?Ni(t):!t.throttleByServer||Ii.serverHasOpenSlots(t.serverKey)?(Pi(t),++a):Ni(t);!function(){if(!Ii.debugShowStatistics)return;0===Ai.numberOfActiveRequests&&Ai.lastNumberOfActiveRequests>0&&(Ai.numberOfAttemptedRequests>0&&(Ai.numberOfAttemptedRequests=0),Ai.numberOfCancelledRequests>0&&(Ai.numberOfCancelledRequests=0),Ai.numberOfCancelledActiveRequests>0&&(Ai.numberOfCancelledActiveRequests=0),Ai.numberOfFailedRequests>0&&(Ai.numberOfFailedRequests=0));Ai.lastNumberOfActiveRequests=Ai.numberOfActiveRequests}()},Ii.getServerKey=function(e){L.typeOf.string("url",e);let t=new ei(e);""===t.scheme()&&(t=t.absoluteTo(Si),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${"https"===t.scheme()?"443":"80"}`);return D(xi[n])||(xi[n]=0),n},Ii.request=function(e){if(L.typeOf.object("request",e),L.typeOf.string("request.url",e.url),L.typeOf.func("request.requestFunction",e.requestFunction),hi(e.url)||ci(e.url))return Ci.raiseEvent(),e.state=pi.RECEIVED,e.requestFunction();if(++Ai.numberOfAttemptedRequests,D(e.serverKey)||(e.serverKey=Ii.getServerKey(e.url)),Ii.throttleRequests&&e.throttleByServer&&!Ii.serverHasOpenSlots(e.serverKey))return;if(!Ii.throttleRequests||!e.throttle)return Pi(e);if(Ei.length>=Ii.maximumRequests)return;Oi(e);const t=wi.insert(e);if(D(t)){if(t===e)return;Ni(t)}return Di(e)},Ii.clearForSpecs=function(){for(;wi.length>0;){Ni(wi.pop())}const e=Ei.length;for(let t=0;t<e;++t)Ni(Ei[t]);Ei.length=0,xi={},Ai.numberOfAttemptedRequests=0,Ai.numberOfActiveRequests=0,Ai.numberOfCancelledRequests=0,Ai.numberOfCancelledActiveRequests=0,Ai.numberOfFailedRequests=0,Ai.numberOfActiveRequestsEver=0,Ai.lastNumberOfActiveRequests=0},Ii.numberOfActiveRequestsByServer=function(e){return xi[e]},Ii.requestHeap=wi;const Ri={};let Li={};Ri.add=function(e,t){if(!D(e))throw new P("host is required.");if(!D(t)||t<=0)throw new P("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;D(Li[n])||(Li[n]=!0)},Ri.remove=function(e,t){if(!D(e))throw new P("host is required.");if(!D(t)||t<=0)throw new P("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;D(Li[n])&&delete Li[n]},Ri.contains=function(e){if(!D(e))throw new P("url is required.");const t=function(e){const t=new ei(e);t.normalize();let n=t.authority();if(0!==n.length){if(t.authority(n),-1!==n.indexOf("@")){const e=n.split("@");n=e[1]}if(-1===n.indexOf(":")){let e=t.scheme();if(0===e.length&&(e=window.location.protocol,e=e.substring(0,e.length-1)),"http"===e)n+=":80";else{if("https"!==e)return;n+=":443"}}return n}}(e);return!(!D(t)||!D(Li[t]))},Ri.clear=function(){Li={}};const Mi=Ri,Fi=function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob","blob"===e.responseType}catch(e){return!1}}();function Bi(e){"string"==typeof(e=M(e,M.EMPTY_OBJECT))&&(e={url:e}),L.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=zi(e.templateValues,{}),this._queryParameters=zi(e.queryParameters,{}),this.headers=zi(e.headers,{}),this.request=M(e.request,new mi),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=M(e.retryAttempts,0),this._retryCount=0;M(e.parseUrl,!0)?this.parseUrl(e.url,!0,!0):this._url=e.url,this._credits=e.credits}function zi(e,t){return D(e)?ti(e):t}let Ui;function ki(e,t,n){if(!n)return ni(e,t);const i=ti(e,!0);for(const o in t)if(t.hasOwnProperty(o)){let e=i[o];const n=t[o];D(e)?(Array.isArray(e)||(e=i[o]=[e]),i[o]=e.concat(n)):i[o]=Array.isArray(n)?n.slice():n}return i}function Vi(e){const t=e.resource,n=e.flipY,i=e.skipColorSpaceConversion,o=e.preferImageBitmap,r=t.request;r.url=t.url,r.requestFunction=function(){let e=!1;t.isDataUri||t.isBlobUri||(e=t.isCrossOriginUrl);const s=ii();return Bi._Implementations.createImage(r,e,s,n,i,o),s.promise};const s=Ii.request(r);if(D(s))return s.catch((function(e){return r.state!==pi.FAILED?Promise.reject(e):t.retryOnError(e).then((function(s){return s?(r.state=pi.UNISSUED,r.deferred=void 0,Vi({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(e)}))}))}function Hi(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const o=e.request,r=e.url;o.url=r,o.requestFunction=function(){const e=ii();return window[n]=function(t){e.resolve(t);try{delete window[n]}catch(i){window[n]=void 0}},Bi._Implementations.loadAndExecuteScript(r,n,e),e.promise};const s=Ii.request(o);if(D(s))return s.catch((function(i){return o.state!==pi.FAILED?Promise.reject(i):e.retryOnError(i).then((function(r){return r?(o.state=pi.UNISSUED,o.deferred=void 0,Hi(e,t,n)):Promise.reject(i)}))}))}function Gi(e){if(e.state===pi.ISSUED||e.state===pi.ACTIVE)throw new be("The Resource is already being fetched.");e.state=pi.UNISSUED,e.deferred=void 0}Bi.createIfNeeded=function(e){return e instanceof Bi?e.getDerivedResource({request:e.request}):"string"!=typeof e?e:new Bi({url:e})},Bi.supportsImageBitmapOptions=function(){if(D(Ui))return Ui;if("function"!=typeof createImageBitmap)return Ui=Promise.resolve(!1),Ui;return Ui=Bi.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then((function(e){return Promise.all([createImageBitmap(e,{imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"}),createImageBitmap(e)])})).then((function(e){const t=si(e[0]),n=si(e[1]);return t[1]!==n[1]})).catch((function(){return!1})),Ui},Object.defineProperties(Bi,{isBlobSupported:{get:function(){return Fi}}}),Object.defineProperties(Bi.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){this.parseUrl(e,!1,!1)}},extension:{get:function(){return function(e){if(!D(e))throw new P("uri is required.");const t=new ei(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return-1!==i&&(n=n.substr(i+1)),i=n.lastIndexOf("."),n=-1===i?"":n.substr(i+1),n}(this._url)}},isDataUri:{get:function(){return hi(this._url)}},isBlobUri:{get:function(){return ci(this._url)}},isCrossOriginUrl:{get:function(){return ui(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}}),Bi.prototype.toString=function(){return this.getUrlComponent(!0,!0)},Bi.prototype.parseUrl=function(e,t,n,i){let o=new ei(e);const r=function(e){if(0===e.length)return{};if(-1===e.indexOf("="))return{[e]:void 0};return function(e){if(!D(e))throw new P("queryString is required.");const t={};if(""===e)return t;const n=e.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,o=n.length;i<o;++i){const e=n[i].split("="),o=decodeURIComponent(e[0]);let r=e[1];r=D(r)?decodeURIComponent(r):"";const s=t[o];"string"==typeof s?t[o]=[s,r]:Array.isArray(s)?s.push(r):t[o]=r}return t}(e)}(o.query());this._queryParameters=t?ki(r,this.queryParameters,n):r,o.search(""),o.fragment(""),D(i)&&""===o.scheme()&&(o=o.absoluteTo(oi(i))),this._url=o.toString()},Bi.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;let n=this._url;e&&(n=`${n}${function(e){const t=Object.keys(e);if(0===t.length)return"";if(1===t.length&&!D(e[t[0]]))return`?${t[0]}`;return`?${function(e){if(!D(e))throw new P("obj is required.");let t="";for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=`${encodeURIComponent(n)}=`;if(Array.isArray(i))for(let e=0,n=i.length;e<n;++e)t+=`${o+encodeURIComponent(i[e])}&`;else t+=`${o+encodeURIComponent(i)}&`}return t=t.slice(0,-1),t}(e)}`}(this.queryParameters)}`),n=n.replace(/%7B/g,"{").replace(/%7D/g,"}");const i=this._templateValues;return Object.keys(i).length>0&&(n=n.replace(/{(.*?)}/g,(function(e,t){const n=i[t];return D(n)?encodeURIComponent(n):e}))),t&&D(this.proxy)&&(n=this.proxy.getURL(n)),n},Bi.prototype.setQueryParameters=function(e,t){this._queryParameters=t?ki(this._queryParameters,e,!1):ki(e,this._queryParameters,!1)},Bi.prototype.appendQueryParameters=function(e){this._queryParameters=ki(e,this._queryParameters,!0)},Bi.prototype.setTemplateValues=function(e,t){this._templateValues=t?ni(this._templateValues,e):ni(e,this._templateValues)},Bi.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,D(e.url)){const n=M(e.preserveQueryParameters,!1);t.parseUrl(e.url,!0,n,this._url)}return D(e.queryParameters)&&(t._queryParameters=ni(e.queryParameters,t.queryParameters)),D(e.templateValues)&&(t._templateValues=ni(e.templateValues,t.templateValues)),D(e.headers)&&(t.headers=ni(e.headers,t.headers)),D(e.proxy)&&(t.proxy=e.proxy),D(e.request)&&(t.request=e.request),D(e.retryCallback)&&(t.retryCallback=e.retryCallback),D(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},Bi.prototype.retryOnError=function(e){const t=this.retryCallback;if("function"!=typeof t||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const n=this;return Promise.resolve(t(this,e)).then((function(e){return++n._retryCount,e}))},Bi.prototype.clone=function(e){return D(e)?(e._url=this._url,e._queryParameters=ti(this._queryParameters),e._templateValues=ti(this._templateValues),e.headers=ti(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e):new Bi({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:D(this.credits)?this.credits.slice():void 0})},Bi.prototype.getBaseUri=function(e){return function(e,t){if(!D(e))throw new P("uri is required.");let n="";const i=e.lastIndexOf("/");return-1!==i&&(n=e.substring(0,i+1)),t?(0!==(e=new ei(e)).query().length&&(n+=`?${e.query()}`),0!==e.fragment().length&&(n+=`#${e.fragment()}`),n):n}(this.getUrlComponent(e),e)},Bi.prototype.appendForwardSlash=function(){var e;this._url=(0!==(e=this._url).length&&"/"===e[e.length-1]||(e=`${e}/`),e)},Bi.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},Bi.fetchArrayBuffer=function(e){return new Bi(e).fetchArrayBuffer()},Bi.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},Bi.fetchBlob=function(e){return new Bi(e).fetchBlob()},Bi.prototype.fetchImage=function(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.preferImageBitmap,!1),n=M(e.preferBlob,!1),i=M(e.flipY,!1),o=M(e.skipColorSpaceConversion,!1);if(Gi(this.request),!Fi||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return Vi({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});const r=this.fetchBlob();if(!D(r))return;let s,a,c,l;return Bi.supportsImageBitmapOptions().then((function(e){return s=e,a=s&&t,r})).then((function(e){if(!D(e))return;if(l=e,a)return Bi.createImageBitmapFromBlob(e,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});const t=window.URL.createObjectURL(e);return c=new Bi({url:t}),Vi({resource:c,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})})).then((function(e){if(D(e))return e.blob=l,a||window.URL.revokeObjectURL(c.url),e})).catch((function(e){return D(c)&&window.URL.revokeObjectURL(c.url),e.blob=l,Promise.reject(e)}))},Bi.fetchImage=function(e){return new Bi(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},Bi.prototype.fetchText=function(){return this.fetch({responseType:"text"})},Bi.fetchText=function(e){return new Bi(e).fetchText()},Bi.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(D(e))return e.then((function(e){if(D(e))return JSON.parse(e)}))},Bi.fetchJson=function(e){return new Bi(e).fetchJson()},Bi.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},Bi.fetchXML=function(e){return new Bi(e).fetchXML()},Bi.prototype.fetchJsonp=function(e){let t;e=M(e,"callback"),Gi(this.request);do{t=`loadJsonp${V.nextRandomNumber().toString().substring(2,8)}`}while(D(window[t]));return Hi(this,e,t)},Bi.fetchJsonp=function(e){return new Bi(e).fetchJsonp(e.callbackParameterName)},Bi.prototype._makeRequest=function(e){const t=this;Gi(t.request);const n=t.request,i=t.url;n.url=i,n.requestFunction=function(){const o=e.responseType,r=ni(e.headers,t.headers),s=e.overrideMimeType,a=e.method,c=e.data,l=ii(),u=Bi._Implementations.loadWithXhr(i,o,a,c,r,l,s);return D(u)&&D(u.abort)&&(n.cancelFunction=function(){u.abort()}),l.promise};const o=Ii.request(n);if(D(o))return o.then((function(e){return n.cancelFunction=void 0,e})).catch((function(i){return n.cancelFunction=void 0,n.state!==pi.FAILED?Promise.reject(i):t.retryOnError(i).then((function(o){return o?(n.state=pi.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(i)}))}))};const ji=/^data:(.*?)(;base64)?,(.*)$/;function Wi(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function qi(e,t){const n=Wi(e,t),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let r=0;r<n.length;r++)o[r]=n.charCodeAt(r);return i}Bi.prototype.fetch=function(e){return(e=zi(e,{})).method="GET",this._makeRequest(e)},Bi.fetch=function(e){return new Bi(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Bi.prototype.delete=function(e){return(e=zi(e,{})).method="DELETE",this._makeRequest(e)},Bi.delete=function(e){return new Bi(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})},Bi.prototype.head=function(e){return(e=zi(e,{})).method="HEAD",this._makeRequest(e)},Bi.head=function(e){return new Bi(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Bi.prototype.options=function(e){return(e=zi(e,{})).method="OPTIONS",this._makeRequest(e)},Bi.options=function(e){return new Bi(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Bi.prototype.post=function(e,t){return L.defined("data",e),(t=zi(t,{})).method="POST",t.data=e,this._makeRequest(t)},Bi.post=function(e){return new Bi(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Bi.prototype.put=function(e,t){return L.defined("data",e),(t=zi(t,{})).method="PUT",t.data=e,this._makeRequest(t)},Bi.put=function(e){return new Bi(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Bi.prototype.patch=function(e,t){return L.defined("data",e),(t=zi(t,{})).method="PATCH",t.data=e,this._makeRequest(t)},Bi.patch=function(e){return new Bi(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Bi._Implementations={},Bi._Implementations.loadImageElement=function(e,t,n){const i=new Image;i.onload=function(){0===i.naturalWidth&&0===i.naturalHeight&&0===i.width&&0===i.height&&(i.width=300,i.height=150),n.resolve(i)},i.onerror=function(e){n.reject(e)},t&&(Mi.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e},Bi._Implementations.createImage=function(e,t,n,i,o,r){const s=e.url;Bi.supportsImageBitmapOptions().then((function(a){if(!a||!r)return void Bi._Implementations.loadImageElement(s,t,n);const c=ii(),l=Bi._Implementations.loadWithXhr(s,"blob","GET",void 0,void 0,c,void 0,void 0,void 0);return D(l)&&D(l.abort)&&(e.cancelFunction=function(){l.abort()}),c.promise.then((function(e){if(D(e))return Bi.createImageBitmapFromBlob(e,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});n.reject(new be(`Successfully retrieved ${s} but it contained no content.`))})).then((function(e){n.resolve(e)}))})).catch((function(e){n.reject(e)}))},Bi.createImageBitmapFromBlob=function(e,t){return L.defined("options",t),L.typeOf.bool("options.flipY",t.flipY),L.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),L.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};const Yi="undefined"==typeof XMLHttpRequest;function Xi(e){e=M(e,M.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=M(e.addNewLeapSeconds,!0),D(e.data)?$i(this,e.data):$i(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}function Qi(e,t){return Hn.compare(e.julianDate,t)}function $i(e,t){if(!D(t.columnNames))throw new be("Error in loaded EOP data: The columnNames property is required.");if(!D(t.samples))throw new be("Error in loaded EOP data: The samples property is required.");const n=t.columnNames.indexOf("modifiedJulianDateUtc"),i=t.columnNames.indexOf("xPoleWanderRadians"),o=t.columnNames.indexOf("yPoleWanderRadians"),r=t.columnNames.indexOf("ut1MinusUtcSeconds"),s=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),c=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||o<0||r<0||s<0||a<0||c<0)throw new be("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const l=e._samples=t.samples,u=e._dates=[];let d;e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=o,e._ut1MinusUtcSecondsColumn=r,e._xCelestialPoleOffsetRadiansColumn=s,e._yCelestialPoleOffsetRadiansColumn=a,e._taiMinusUtcSecondsColumn=c,e._columnCount=t.columnNames.length,e._lastIndex=void 0;const h=e._addNewLeapSeconds;for(let p=0,f=l.length;p<f;p+=e._columnCount){const e=l[p+n],t=l[p+c],i=new Hn(e+Tn.MODIFIED_JULIAN_DATE_DIFFERENCE,t,wn.TAI);if(u.push(i),h){if(t!==d&&D(d)){const e=Hn.leapSeconds,n=_n(e,i,Qi);if(n<0){const o=new An(i,t);e.splice(~n,0,o)}}d=t}}}function Ki(e,t,n,i,o){const r=n*i;o.xPoleWander=t[r+e._xPoleWanderRadiansColumn],o.yPoleWander=t[r+e._yPoleWanderRadiansColumn],o.xPoleOffset=t[r+e._xCelestialPoleOffsetRadiansColumn],o.yPoleOffset=t[r+e._yCelestialPoleOffsetRadiansColumn],o.ut1MinusUtc=t[r+e._ut1MinusUtcSecondsColumn]}function Zi(e,t,n){return t+e*(n-t)}function Ji(e,t,n,i,o,r,s){const a=e._columnCount;if(r>t.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;const c=t[o],l=t[r];if(c.equals(l)||i.equals(c))return Ki(e,n,o,a,s),s;if(i.equals(l))return Ki(e,n,r,a,s),s;const u=Hn.secondsDifference(i,c)/Hn.secondsDifference(l,c),d=o*a,h=r*a;let p=n[d+e._ut1MinusUtcSecondsColumn],f=n[h+e._ut1MinusUtcSecondsColumn];const m=f-p;if(m>.5||m<-.5){const t=n[d+e._taiMinusUtcSecondsColumn],o=n[h+e._taiMinusUtcSecondsColumn];t!==o&&(l.equals(i)?p=f:f-=o-t)}return s.xPoleWander=Zi(u,n[d+e._xPoleWanderRadiansColumn],n[h+e._xPoleWanderRadiansColumn]),s.yPoleWander=Zi(u,n[d+e._yPoleWanderRadiansColumn],n[h+e._yPoleWanderRadiansColumn]),s.xPoleOffset=Zi(u,n[d+e._xCelestialPoleOffsetRadiansColumn],n[h+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=Zi(u,n[d+e._yCelestialPoleOffsetRadiansColumn],n[h+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=Zi(u,p,f),s}function eo(e,t,n){this.heading=M(e,0),this.pitch=M(t,0),this.roll=M(n,0)}Bi._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){const a=ji.exec(e);if(null!==a)return void r.resolve(function(e,t){t=M(t,"");const n=e[1],i=!!e[2],o=e[3];let r,s;switch(t){case"":case"text":return Wi(i,o);case"arraybuffer":return qi(i,o);case"blob":return r=qi(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString(Wi(i,o),n);case"json":return JSON.parse(Wi(i,o));default:throw new P(`Unhandled responseType: ${t}`)}}(a,t));if(Yi)return void function(e,t,n,i,o,r){fetch(e,{method:n,headers:o}).then((async e=>{if(!e.ok){const t={};return e.headers.forEach(((e,n)=>{t[n]=e})),void r.reject(new _i(e.status,e,t))}switch(t){case"text":r.resolve(e.text());break;case"json":r.resolve(e.json());break;default:r.resolve(new Uint8Array(await e.arrayBuffer()).buffer)}})).catch((()=>{r.reject(new _i)}))}(e,t,n,0,o,r);const c=new XMLHttpRequest;if(Mi.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),D(s)&&D(c.overrideMimeType)&&c.overrideMimeType(s),D(o))for(const u in o)o.hasOwnProperty(u)&&c.setRequestHeader(u,o[u]);D(t)&&(c.responseType=t);let l=!1;return"string"==typeof e&&(l=0===e.indexOf("file://")||"undefined"!=typeof window&&"file://"===window.location.origin),c.onload=function(){if((c.status<200||c.status>=300)&&(!l||0!==c.status))return void r.reject(new _i(c.status,c.response,c.getAllResponseHeaders()));const e=c.response,i=c.responseType;if("HEAD"===n||"OPTIONS"===n){const e=c.getAllResponseHeaders().trim().split(/[\r\n]+/),t={};return e.forEach((function(e){const n=e.split(": "),i=n.shift();t[i]=n.join(": ")})),void r.resolve(t)}if(204===c.status)r.resolve(void 0);else if(!D(e)||D(t)&&i!==t)if("json"===t&&"string"==typeof e)try{r.resolve(JSON.parse(e))}catch(o){r.reject(o)}else(""===i||"document"===i)&&D(c.responseXML)&&c.responseXML.hasChildNodes()?r.resolve(c.responseXML):""!==i&&"text"!==i||!D(c.responseText)?r.reject(new be("Invalid XMLHttpRequest response type.")):r.resolve(c.responseText);else r.resolve(e)},c.onerror=function(e){r.reject(new _i)},c.send(i),c},Bi._Implementations.loadAndExecuteScript=function(e,t,n){return function(e){const t=document.createElement("script");return t.async=!0,t.src=e,new Promise(((e,n)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const i=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,i.removeChild(t),e()},t.onerror=function(e){n(e)},i.appendChild(t)}))}(e).catch((function(e){n.reject(e)}))},Bi._DefaultImplementations={},Bi._DefaultImplementations.createImage=Bi._Implementations.createImage,Bi._DefaultImplementations.loadWithXhr=Bi._Implementations.loadWithXhr,Bi._DefaultImplementations.loadAndExecuteScript=Bi._Implementations.loadAndExecuteScript,Bi.DEFAULT=Object.freeze(new Bi({url:"undefined"==typeof document?"":document.location.href.split("?")[0]})),Xi.fromUrl=async function(e,t){L.defined("url",e),t=M(t,M.EMPTY_OBJECT);const n=Bi.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch(o){throw new be(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new Xi({addNewLeapSeconds:t.addNewLeapSeconds,data:i})},Xi.NONE=Object.freeze({compute:function(e,t){return D(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new gn(0,0,0,0,0),t}}),Xi.prototype.compute=function(e,t){if(!D(this._samples))return;if(D(t)||(t=new gn(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;const n=this._dates,i=this._lastIndex;let o=0,r=0;if(D(i)){const s=n[i],a=n[i+1],c=Hn.lessThanOrEquals(s,e),l=!D(a),u=l||Hn.greaterThanOrEquals(a,e);if(c&&u)return o=i,!l&&a.equals(e)&&++o,r=o+1,Ji(this,n,this._samples,e,o,r,t),t}let s=_n(n,e,Hn.compare,this._dateColumn);return s>=0?(s<n.length-1&&n[s+1].equals(e)&&++s,o=s,r=s):(r=~s,o=r-1,o<0&&(o=0)),this._lastIndex=o,Ji(this,n,this._samples,e,o,r,t),t},eo.fromQuaternion=function(e,t){if(!D(e))throw new P("quaternion is required");D(t)||(t=new eo);const n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),o=2*(e.w*e.x+e.y*e.z),r=1-2*(e.y*e.y+e.z*e.z),s=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(s,r),t.roll=Math.atan2(o,i),t.pitch=-V.asinClamped(n),t},eo.fromDegrees=function(e,t,n,i){if(!D(e))throw new P("heading is required");if(!D(t))throw new P("pitch is required");if(!D(n))throw new P("roll is required");return D(i)||(i=new eo),i.heading=e*V.RADIANS_PER_DEGREE,i.pitch=t*V.RADIANS_PER_DEGREE,i.roll=n*V.RADIANS_PER_DEGREE,i},eo.clone=function(e,t){if(D(e))return D(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new eo(e.heading,e.pitch,e.roll)},eo.equals=function(e,t){return e===t||D(e)&&D(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll},eo.equalsEpsilon=function(e,t,n,i){return e===t||D(e)&&D(t)&&V.equalsEpsilon(e.heading,t.heading,n,i)&&V.equalsEpsilon(e.pitch,t.pitch,n,i)&&V.equalsEpsilon(e.roll,t.roll,n,i)},eo.prototype.clone=function(e){return eo.clone(this,e)},eo.prototype.equals=function(e){return eo.equals(this,e)},eo.prototype.equalsEpsilon=function(e,t,n){return eo.equalsEpsilon(this,e,t,n)},eo.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const to=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;let no,io,oo;function ro(e){return"undefined"==typeof document?e:(D(no)||(no=document.createElement("a")),no.href=e,no.href)}function so(){var e;if(D(io))return io;let t;if(t="undefined"!=typeof CESIUM_BASE_URL?CESIUM_BASE_URL:D(null==(e=import.meta)?void 0:e.url)?oi(".",import.meta.url):"object"==typeof define&&D(define.amd)&&!define.amd.toUrlUndefined&&D(require.toUrl)?oi("..",lo("Core/buildModuleUrl.js")):function(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){const n=e[t].getAttribute("src"),i=to.exec(n);if(null!==i)return i[1]}}(),!D(t))throw new P("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return io=new Bi({url:ro(t)}),io.appendForwardSlash(),io}function ao(e){return ro(require.toUrl(`../${e}`))}function co(e){return so().getDerivedResource({url:e}).url}function lo(e){D(oo)||(oo="object"==typeof define&&D(define.amd)&&!define.amd.toUrlUndefined&&D(require.toUrl)?ao:co);return oo(e)}function uo(e,t,n){this.x=e,this.y=t,this.s=n}function ho(e){e=M(e,M.EMPTY_OBJECT),this._xysFileUrlTemplate=Bi.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=M(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=M(e.sampleZeroJulianEphemerisDate,2442396.5),this._sampleZeroDateTT=new Hn(this._sampleZeroJulianEphemerisDate,0,wn.TAI),this._stepSizeDays=M(e.stepSizeDays,1),this._samplesPerXysFile=M(e.samplesPerXysFile,1e3),this._totalSamples=M(e.totalSamples,27426),this._samples=new Array(3*this._totalSamples),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t);for(let r=0;r<=t;++r){n[r]=o,i[r]=r*this._stepSizeDays;for(let e=0;e<=t;++e)e!==r&&(n[r]*=r-e);n[r]=1/n[r]}this._work=new Array(t+1),this._coef=new Array(t+1)}lo._cesiumScriptRegex=to,lo._buildModuleUrlFromBaseUrl=co,lo._clearBaseResource=function(){io=void 0},lo.setBaseUrl=function(e){io=Bi.DEFAULT.getDerivedResource({url:e})},lo.getCesiumBaseUrl=so;const po=new Hn(0,0,wn.TAI);function fo(e,t,n){const i=po;return i.dayNumber=t,i.secondsOfDay=n,Hn.daysDifference(i,e._sampleZeroDateTT)}function mo(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n;const i=e._xysFileUrlTemplate;n=D(i)?i.getDerivedResource({templateValues:{0:t}}):new Bi({url:lo(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const o=n.fetchJson().then((function(n){e._chunkDownloadsInProgress[t]=!1;const i=e._samples,o=n.samples,r=t*e._samplesPerXysFile*3;for(let e=0,t=o.length;e<t;++e)i[r+e]=o[e]}));return e._chunkDownloadsInProgress[t]=o,o}function _o(e,t,n,i){this.x=M(e,0),this.y=M(t,0),this.z=M(n,0),this.w=M(i,0)}ho.prototype.preload=function(e,t,n,i){const o=fo(this,e,t),r=fo(this,n,i);let s=o/this._stepSizeDays-this._interpolationOrder/2|0;s<0&&(s=0);let a=r/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const c=s/this._samplesPerXysFile|0,l=a/this._samplesPerXysFile|0,u=[];for(let d=c;d<=l;++d)u.push(mo(this,d));return Promise.all(u)},ho.prototype.computeXysRadians=function(e,t,n){const i=fo(this,e,t);if(i<0)return;const o=i/this._stepSizeDays|0;if(o>=this._totalSamples)return;const r=this._interpolationOrder;let s=o-(r/2|0);s<0&&(s=0);let a=s+r;a>=this._totalSamples&&(a=this._totalSamples-1,s=a-r,s<0&&(s=0));let c=!1;const l=this._samples;if(D(l[3*s])||(mo(this,s/this._samplesPerXysFile|0),c=!0),D(l[3*a])||(mo(this,a/this._samplesPerXysFile|0),c=!0),c)return;D(n)?(n.x=0,n.y=0,n.s=0):n=new uo(0,0,0);const u=i-s*this._stepSizeDays,d=this._work,h=this._denominators,p=this._coef,f=this._xTable;let m,_;for(m=0;m<=r;++m)d[m]=u-f[m];for(m=0;m<=r;++m){for(p[m]=1,_=0;_<=r;++_)_!==m&&(p[m]*=d[_]);p[m]*=h[m];let e=3*(s+m);n.x+=p[m]*l[e++],n.y+=p[m]*l[e++],n.s+=p[m]*l[e]}return n};let go=new H;_o.fromAxisAngle=function(e,t,n){L.typeOf.object("axis",e),L.typeOf.number("angle",t);const i=t/2,o=Math.sin(i);go=H.normalize(e,go);const r=go.x*o,s=go.y*o,a=go.z*o,c=Math.cos(i);return D(n)?(n.x=r,n.y=s,n.z=a,n.w=c,n):new _o(r,s,a,c)};const yo=[1,2,0],bo=new Array(3);_o.fromRotationMatrix=function(e,t){let n,i,o,r,s;L.typeOf.object("matrix",e);const a=e[re.COLUMN0ROW0],c=e[re.COLUMN1ROW1],l=e[re.COLUMN2ROW2],u=a+c+l;if(u>0)n=Math.sqrt(u+1),s=.5*n,n=.5/n,i=(e[re.COLUMN1ROW2]-e[re.COLUMN2ROW1])*n,o=(e[re.COLUMN2ROW0]-e[re.COLUMN0ROW2])*n,r=(e[re.COLUMN0ROW1]-e[re.COLUMN1ROW0])*n;else{const t=yo;let u=0;c>a&&(u=1),l>a&&l>c&&(u=2);const d=t[u],h=t[d];n=Math.sqrt(e[re.getElementIndex(u,u)]-e[re.getElementIndex(d,d)]-e[re.getElementIndex(h,h)]+1);const p=bo;p[u]=.5*n,n=.5/n,s=(e[re.getElementIndex(h,d)]-e[re.getElementIndex(d,h)])*n,p[d]=(e[re.getElementIndex(d,u)]+e[re.getElementIndex(u,d)])*n,p[h]=(e[re.getElementIndex(h,u)]+e[re.getElementIndex(u,h)])*n,i=-p[0],o=-p[1],r=-p[2]}return D(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new _o(i,o,r,s)};const vo=new _o;let Ao=new _o,To=new _o,wo=new _o;_o.fromHeadingPitchRoll=function(e,t){return L.typeOf.object("headingPitchRoll",e),wo=_o.fromAxisAngle(H.UNIT_X,e.roll,vo),To=_o.fromAxisAngle(H.UNIT_Y,-e.pitch,t),t=_o.multiply(To,wo,To),Ao=_o.fromAxisAngle(H.UNIT_Z,-e.heading,vo),_o.multiply(Ao,t,t)};const Eo=new H,xo=new H,So=new _o,Co=new _o,Io=new _o;_o.packedLength=4,_o.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t},_o.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new _o),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n},_o.packedInterpolationLength=3,_o.convertPackedArrayForInterpolation=function(e,t,n,i){_o.unpack(e,4*n,Io),_o.conjugate(Io,Io);for(let o=0,r=n-t+1;o<r;o++){const n=3*o;_o.unpack(e,4*(t+o),So),_o.multiply(So,Io,So),So.w<0&&_o.negate(So,So),_o.computeAxis(So,Eo);const r=_o.computeAngle(So);D(i)||(i=[]),i[n]=Eo.x*r,i[n+1]=Eo.y*r,i[n+2]=Eo.z*r}},_o.unpackInterpolationResult=function(e,t,n,i,o){D(o)||(o=new _o),H.fromArray(e,0,xo);const r=H.magnitude(xo);return _o.unpack(t,4*i,Co),0===r?_o.clone(_o.IDENTITY,So):_o.fromAxisAngle(xo,r,So),_o.multiply(So,Co,o)},_o.clone=function(e,t){if(D(e))return D(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new _o(e.x,e.y,e.z,e.w)},_o.conjugate=function(e,t){return L.typeOf.object("quaternion",e),L.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},_o.magnitudeSquared=function(e){return L.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},_o.magnitude=function(e){return Math.sqrt(_o.magnitudeSquared(e))},_o.normalize=function(e,t){L.typeOf.object("result",t);const n=1/_o.magnitude(e),i=e.x*n,o=e.y*n,r=e.z*n,s=e.w*n;return t.x=i,t.y=o,t.z=r,t.w=s,t},_o.inverse=function(e,t){L.typeOf.object("result",t);const n=_o.magnitudeSquared(e);return t=_o.conjugate(e,t),_o.multiplyByScalar(t,1/n,t)},_o.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n},_o.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n},_o.negate=function(e,t){return L.typeOf.object("quaternion",e),L.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},_o.dot=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},_o.multiply=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=e.w,a=t.x,c=t.y,l=t.z,u=t.w,d=s*a+i*u+o*l-r*c,h=s*c-i*l+o*u+r*a,p=s*l+i*c-o*a+r*u,f=s*u-i*a-o*c-r*l;return n.x=d,n.y=h,n.z=p,n.w=f,n},_o.multiplyByScalar=function(e,t,n){return L.typeOf.object("quaternion",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n},_o.divideByScalar=function(e,t,n){return L.typeOf.object("quaternion",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n},_o.computeAxis=function(e,t){L.typeOf.object("quaternion",e),L.typeOf.object("result",t);const n=e.w;if(Math.abs(n-1)<V.EPSILON6||Math.abs(n+1)<V.EPSILON6)return t.x=1,t.y=t.z=0,t;const i=1/Math.sqrt(1-n*n);return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},_o.computeAngle=function(e){return L.typeOf.object("quaternion",e),Math.abs(e.w-1)<V.EPSILON6?0:2*Math.acos(e.w)};let Oo=new _o;_o.lerp=function(e,t,n,i){return L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i),Oo=_o.multiplyByScalar(t,n,Oo),i=_o.multiplyByScalar(e,1-n,i),_o.add(Oo,i,i)};let Do=new _o,Po=new _o,No=new _o;_o.slerp=function(e,t,n,i){L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i);let o=_o.dot(e,t),r=t;if(o<0&&(o=-o,r=Do=_o.negate(t,Do)),1-o<V.EPSILON6)return _o.lerp(e,r,n,i);const s=Math.acos(o);return Po=_o.multiplyByScalar(e,Math.sin((1-n)*s),Po),No=_o.multiplyByScalar(r,Math.sin(n*s),No),i=_o.add(Po,No,i),_o.multiplyByScalar(i,1/Math.sin(s),i)},_o.log=function(e,t){L.typeOf.object("quaternion",e),L.typeOf.object("result",t);const n=V.acosClamped(e.w);let i=0;return 0!==n&&(i=n/Math.sin(n)),H.multiplyByScalar(e,i,t)},_o.exp=function(e,t){L.typeOf.object("cartesian",e),L.typeOf.object("result",t);const n=H.magnitude(e);let i=0;return 0!==n&&(i=Math.sin(n)/n),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=Math.cos(n),t};const Ro=new H,Lo=new H,Mo=new _o,Fo=new _o;_o.computeInnerQuadrangle=function(e,t,n,i){L.typeOf.object("q0",e),L.typeOf.object("q1",t),L.typeOf.object("q2",n),L.typeOf.object("result",i);const o=_o.conjugate(t,Mo);_o.multiply(o,n,Fo);const r=_o.log(Fo,Ro);_o.multiply(o,e,Fo);const s=_o.log(Fo,Lo);return H.add(r,s,r),H.multiplyByScalar(r,.25,r),H.negate(r,r),_o.exp(r,Mo),_o.multiply(t,Mo,i)},_o.squad=function(e,t,n,i,o,r){L.typeOf.object("q0",e),L.typeOf.object("q1",t),L.typeOf.object("s0",n),L.typeOf.object("s1",i),L.typeOf.number("t",o),L.typeOf.object("result",r);const s=_o.slerp(e,t,o,Mo),a=_o.slerp(n,i,o,Fo);return _o.slerp(s,a,2*o*(1-o),r)};const Bo=new _o,zo=1.9011074535173003,Uo=Ct.supportsTypedArrays()?new Float32Array(8):[],Vo=Ct.supportsTypedArrays()?new Float32Array(8):[],Ho=Ct.supportsTypedArrays()?new Float32Array(8):[],Go=Ct.supportsTypedArrays()?new Float32Array(8):[];for(let ko=0;ko<7;++ko){const e=ko+1,t=2*e+1;Uo[ko]=1/(e*t),Vo[ko]=e/t}Uo[7]=zo/136,Vo[7]=8*zo/17,_o.fastSlerp=function(e,t,n,i){L.typeOf.object("start",e),L.typeOf.object("end",t),L.typeOf.number("t",n),L.typeOf.object("result",i);let o,r=_o.dot(e,t);r>=0?o=1:(o=-1,r=-r);const s=r-1,a=1-n,c=n*n,l=a*a;for(let p=7;p>=0;--p)Ho[p]=(Uo[p]*c-Vo[p])*s,Go[p]=(Uo[p]*l-Vo[p])*s;const u=o*n*(1+Ho[0]*(1+Ho[1]*(1+Ho[2]*(1+Ho[3]*(1+Ho[4]*(1+Ho[5]*(1+Ho[6]*(1+Ho[7])))))))),d=a*(1+Go[0]*(1+Go[1]*(1+Go[2]*(1+Go[3]*(1+Go[4]*(1+Go[5]*(1+Go[6]*(1+Go[7])))))))),h=_o.multiplyByScalar(e,d,Bo);return _o.multiplyByScalar(t,u,i),_o.add(h,i,i)},_o.fastSquad=function(e,t,n,i,o,r){L.typeOf.object("q0",e),L.typeOf.object("q1",t),L.typeOf.object("s0",n),L.typeOf.object("s1",i),L.typeOf.number("t",o),L.typeOf.object("result",r);const s=_o.fastSlerp(e,t,o,Mo),a=_o.fastSlerp(n,i,o,Fo);return _o.fastSlerp(s,a,2*o*(1-o),r)},_o.equals=function(e,t){return e===t||D(e)&&D(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},_o.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n},_o.ZERO=Object.freeze(new _o(0,0,0,0)),_o.IDENTITY=Object.freeze(new _o(0,0,0,1)),_o.prototype.clone=function(e){return _o.clone(this,e)},_o.prototype.equals=function(e){return _o.equals(this,e)},_o.prototype.equalsEpsilon=function(e,t){return _o.equalsEpsilon(this,e,t)},_o.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const jo={},Wo={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"}},qo={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Yo={},Xo={east:new H,north:new H,up:new H,west:new H,south:new H,down:new H};let Qo=new H,$o=new H,Ko=new H;jo.localFrameToFixedFrameGenerator=function(e,t){if(!Wo.hasOwnProperty(e)||!Wo[e].hasOwnProperty(t))throw new P("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=Wo[e][t];let i;const o=e+t;return D(Yo[o])?i=Yo[o]:(i=function(i,o,r){if(!D(i))throw new P("origin is required.");if(isNaN(i.x)||isNaN(i.y)||isNaN(i.z))throw new P("origin has a NaN component");if(D(r)||(r=new ve),H.equalsEpsilon(i,H.ZERO,V.EPSILON14))H.unpack(qo[e],0,Qo),H.unpack(qo[t],0,$o),H.unpack(qo[n],0,Ko);else if(V.equalsEpsilon(i.x,0,V.EPSILON14)&&V.equalsEpsilon(i.y,0,V.EPSILON14)){const o=V.sign(i.z);H.unpack(qo[e],0,Qo),"east"!==e&&"west"!==e&&H.multiplyByScalar(Qo,o,Qo),H.unpack(qo[t],0,$o),"east"!==t&&"west"!==t&&H.multiplyByScalar($o,o,$o),H.unpack(qo[n],0,Ko),"east"!==n&&"west"!==n&&H.multiplyByScalar(Ko,o,Ko)}else{(o=M(o,on.WGS84)).geodeticSurfaceNormal(i,Xo.up);const r=Xo.up,s=Xo.east;s.x=-i.y,s.y=i.x,s.z=0,H.normalize(s,Xo.east),H.cross(r,s,Xo.north),H.multiplyByScalar(Xo.up,-1,Xo.down),H.multiplyByScalar(Xo.east,-1,Xo.west),H.multiplyByScalar(Xo.north,-1,Xo.south),Qo=Xo[e],$o=Xo[t],Ko=Xo[n]}return r[0]=Qo.x,r[1]=Qo.y,r[2]=Qo.z,r[3]=0,r[4]=$o.x,r[5]=$o.y,r[6]=$o.z,r[7]=0,r[8]=Ko.x,r[9]=Ko.y,r[10]=Ko.z,r[11]=0,r[12]=i.x,r[13]=i.y,r[14]=i.z,r[15]=1,r},Yo[o]=i),i},jo.eastNorthUpToFixedFrame=jo.localFrameToFixedFrameGenerator("east","north"),jo.northEastDownToFixedFrame=jo.localFrameToFixedFrameGenerator("north","east"),jo.northUpEastToFixedFrame=jo.localFrameToFixedFrameGenerator("north","up"),jo.northWestUpToFixedFrame=jo.localFrameToFixedFrameGenerator("north","west");const Zo=new _o,Jo=new H(1,1,1),er=new ve;jo.headingPitchRollToFixedFrame=function(e,t,n,i,o){L.typeOf.object("HeadingPitchRoll",t),i=M(i,jo.eastNorthUpToFixedFrame);const r=_o.fromHeadingPitchRoll(t,Zo),s=ve.fromTranslationQuaternionRotationScale(H.ZERO,r,Jo,er);return o=i(e,n,o),ve.multiply(o,s,o)};const tr=new ve,nr=new re;jo.headingPitchRollQuaternion=function(e,t,n,i,o){L.typeOf.object("HeadingPitchRoll",t);const r=jo.headingPitchRollToFixedFrame(e,t,n,i,tr),s=ve.getMatrix3(r,nr);return _o.fromRotationMatrix(s,o)};const ir=new H(1,1,1),or=new H,rr=new ve,sr=new ve,ar=new re,cr=new _o;jo.fixedFrameToHeadingPitchRoll=function(e,t,n,i){L.defined("transform",e),t=M(t,on.WGS84),n=M(n,jo.eastNorthUpToFixedFrame),D(i)||(i=new eo);const o=ve.getTranslation(e,or);if(H.equals(o,H.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=ve.inverseTransformation(n(o,t,rr),rr),s=ve.setScale(e,ir,sr);s=ve.setTranslation(s,H.ZERO,s),r=ve.multiply(r,s,r);let a=_o.fromRotationMatrix(ve.getMatrix3(r,ar),cr);return a=_o.normalize(a,a),eo.fromQuaternion(a,i)};const lr=V.TWO_PI/86400;let ur=new Hn;jo.computeTemeToPseudoFixedMatrix=function(e,t){if(!D(e))throw new P("date is required.");ur=Hn.addSeconds(e,-Hn.computeTaiMinusUtc(e),ur);const n=ur.dayNumber,i=ur.secondsOfDay;let o;const r=n-2451545;o=i>=43200?(r+.5)/Tn.DAYS_PER_JULIAN_CENTURY:(r-.5)/Tn.DAYS_PER_JULIAN_CENTURY;const s=(24110.54841+o*(8640184.812866+o*(.093104+-62e-7*o)))*lr%V.TWO_PI+(72921158553e-15+11772758384668e-32*(n-2451545.5))*((i+.5*Tn.SECONDS_PER_DAY)%Tn.SECONDS_PER_DAY),a=Math.cos(s),c=Math.sin(s);return D(t)?(t[0]=a,t[1]=-c,t[2]=0,t[3]=c,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new re(a,c,0,-c,a,0,0,0,1)},jo.iau2006XysData=new ho,jo.earthOrientationParameters=Xi.NONE;const dr=32.184;jo.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+dr,i=e.stop.dayNumber,o=e.stop.secondsOfDay+dr;return jo.iau2006XysData.preload(t,n,i,o)},jo.computeIcrfToFixedMatrix=function(e,t){if(!D(e))throw new P("date is required.");D(t)||(t=new re);const n=jo.computeFixedToIcrfMatrix(e,t);if(D(n))return re.transpose(n,t)};const hr=new uo(0,0,0),pr=new gn(0,0,0,0,0),fr=new re,mr=new re;jo.computeFixedToIcrfMatrix=function(e,t){if(!D(e))throw new P("date is required.");D(t)||(t=new re);const n=jo.earthOrientationParameters.compute(e,pr);if(!D(n))return;const i=e.dayNumber,o=e.secondsOfDay+dr,r=jo.iau2006XysData.computeXysRadians(i,o,hr);if(!D(r))return;const s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-s*s-a*a)),l=fr;l[0]=1-c*s*s,l[3]=-c*s*a,l[6]=s,l[1]=-c*s*a,l[4]=1-c*a*a,l[7]=a,l[2]=-s,l[5]=-a,l[8]=1-c*(s*s+a*a);const u=re.fromRotationZ(-r.s,mr),d=re.multiply(l,u,fr),h=e.dayNumber-2451545,p=(e.secondsOfDay-Hn.computeTaiMinusUtc(e)+n.ut1MinusUtc)/Tn.SECONDS_PER_DAY;let f=.779057273264+p+.00273781191135448*(h+p);f=f%1*V.TWO_PI;const m=re.fromRotationZ(f,mr),_=re.multiply(d,m,fr),g=Math.cos(n.xPoleWander),y=Math.cos(n.yPoleWander),b=Math.sin(n.xPoleWander),v=Math.sin(n.yPoleWander);let A=i-2451545+o/Tn.SECONDS_PER_DAY;A/=36525;const T=-47e-6*A*V.RADIANS_PER_DEGREE/3600,w=Math.cos(T),E=Math.sin(T),x=mr;return x[0]=g*w,x[1]=g*E,x[2]=b,x[3]=-y*E+v*b*w,x[4]=y*w+v*b*E,x[5]=-v*g,x[6]=-v*E-y*b*w,x[7]=v*w-y*b*E,x[8]=y*g,re.multiply(_,x,t)};const _r=new K;jo.pointToWindowCoordinates=function(e,t,n,i){return(i=jo.pointToGLWindowCoordinates(e,t,n,i)).y=2*t[5]-i.y,i},jo.pointToGLWindowCoordinates=function(e,t,n,i){if(!D(e))throw new P("modelViewProjectionMatrix is required.");if(!D(t))throw new P("viewportTransformation is required.");if(!D(n))throw new P("point is required.");D(i)||(i=new kt);const o=_r;return ve.multiplyByVector(e,K.fromElements(n.x,n.y,n.z,1,o),o),K.multiplyByScalar(o,1/o.w,o),ve.multiplyByVector(t,o,o),kt.fromCartesian4(o,i)};const gr=new H,yr=new H,br=new H;jo.rotationMatrixFromPositionVelocity=function(e,t,n,i){if(!D(e))throw new P("position is required.");if(!D(t))throw new P("velocity is required.");const o=M(n,on.WGS84).geodeticSurfaceNormal(e,gr);let r=H.cross(t,o,yr);H.equalsEpsilon(r,H.ZERO,V.EPSILON6)&&(r=H.clone(H.UNIT_X,r));const s=H.cross(r,t,br);return H.normalize(s,s),H.cross(t,s,r),H.negate(r,r),H.normalize(r,r),D(i)||(i=new re),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=r.x,i[4]=r.y,i[5]=r.z,i[6]=s.x,i[7]=s.y,i[8]=s.z,i};const vr=new ve(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),Ar=new Qt,Tr=new H,wr=new H,Er=new re,xr=new ve,Sr=new ve;jo.basisTo2D=function(e,t,n){if(!D(e))throw new P("projection is required.");if(!D(t))throw new P("matrix is required.");if(!D(n))throw new P("result is required.");const i=ve.getTranslation(t,wr),o=e.ellipsoid;let r;if(H.equals(i,H.ZERO))r=H.clone(H.ZERO,Tr);else{const t=o.cartesianToCartographic(i,Ar);r=e.project(t,Tr),H.fromElements(r.z,r.x,r.y,r)}const s=jo.eastNorthUpToFixedFrame(i,o,xr),a=ve.inverseTransformation(s,Sr),c=ve.getMatrix3(t,Er),l=ve.multiplyByMatrix3(a,c,n);return ve.multiply(vr,l,n),ve.setTranslation(n,r,n),n},jo.wgs84To2DModelMatrix=function(e,t,n){if(!D(e))throw new P("projection is required.");if(!D(t))throw new P("center is required.");if(!D(n))throw new P("result is required.");const i=e.ellipsoid,o=jo.eastNorthUpToFixedFrame(t,i,xr),r=ve.inverseTransformation(o,Sr),s=i.cartesianToCartographic(t,Ar),a=e.project(s,Tr);H.fromElements(a.z,a.x,a.y,a);const c=ve.fromTranslation(a,xr);return ve.multiply(vr,r,n),ve.multiply(c,n,n),n};const Cr=jo;function Ir(e,t,n,i){this.west=M(e,0),this.south=M(t,0),this.east=M(n,0),this.north=M(i,0)}Object.defineProperties(Ir.prototype,{width:{get:function(){return Ir.computeWidth(this)}},height:{get:function(){return Ir.computeHeight(this)}}}),Ir.packedLength=4,Ir.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t},Ir.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new Ir),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n},Ir.computeWidth=function(e){L.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t<n&&(t+=V.TWO_PI),t-n},Ir.computeHeight=function(e){return L.typeOf.object("rectangle",e),e.north-e.south},Ir.fromDegrees=function(e,t,n,i,o){return e=V.toRadians(M(e,0)),t=V.toRadians(M(t,0)),n=V.toRadians(M(n,0)),i=V.toRadians(M(i,0)),D(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new Ir(e,t,n,i)},Ir.fromRadians=function(e,t,n,i,o){return D(o)?(o.west=M(e,0),o.south=M(t,0),o.east=M(n,0),o.north=M(i,0),o):new Ir(e,t,n,i)},Ir.fromCartographicArray=function(e,t){L.defined("cartographics",e);let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let c=0,l=e.length;c<l;c++){const t=e[c];n=Math.min(n,t.longitude),i=Math.max(i,t.longitude),s=Math.min(s,t.latitude),a=Math.max(a,t.latitude);const l=t.longitude>=0?t.longitude:t.longitude+V.TWO_PI;o=Math.min(o,l),r=Math.max(r,l)}return i-n>r-o&&(n=o,i=r,i>V.PI&&(i-=V.TWO_PI),n>V.PI&&(n-=V.TWO_PI)),D(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new Ir(n,s,i,a)},Ir.fromCartesianArray=function(e,t,n){L.defined("cartesians",e),t=M(t,on.WGS84);let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let l=0,u=e.length;l<u;l++){const n=t.cartesianToCartographic(e[l]);i=Math.min(i,n.longitude),o=Math.max(o,n.longitude),a=Math.min(a,n.latitude),c=Math.max(c,n.latitude);const u=n.longitude>=0?n.longitude:n.longitude+V.TWO_PI;r=Math.min(r,u),s=Math.max(s,u)}return o-i>s-r&&(i=r,o=s,o>V.PI&&(o-=V.TWO_PI),i>V.PI&&(i-=V.TWO_PI)),D(n)?(n.west=i,n.south=a,n.east=o,n.north=c,n):new Ir(i,a,o,c)};const Or=new H,Dr=new H,Pr=new H,Nr=new H,Rr=new H,Lr=new Array(5);for(let ko=0;ko<Lr.length;++ko)Lr[ko]=new H;Ir.fromBoundingSphere=function(e,t,n){L.typeOf.object("boundingSphere",e);const i=e.center,o=e.radius;if(D(t)||(t=on.WGS84),D(n)||(n=new Ir),H.equals(i,H.ZERO))return Ir.clone(Ir.MAX_VALUE,n),n;const r=Cr.eastNorthUpToFixedFrame(i,t,Or),s=ve.multiplyByPointAsVector(r,H.UNIT_X,Dr);H.normalize(s,s);const a=ve.multiplyByPointAsVector(r,H.UNIT_Y,Pr);H.normalize(a,a),H.multiplyByScalar(a,o,a),H.multiplyByScalar(s,o,s);const c=H.negate(a,Rr),l=H.negate(s,Nr),u=Lr;let d=u[0];return H.add(i,a,d),d=u[1],H.add(i,l,d),d=u[2],H.add(i,c,d),d=u[3],H.add(i,s,d),u[4]=i,Ir.fromCartesianArray(u,t,n)},Ir.clone=function(e,t){if(D(e))return D(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new Ir(e.west,e.south,e.east,e.north)},Ir.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n},Ir.prototype.clone=function(e){return Ir.clone(this,e)},Ir.prototype.equals=function(e){return Ir.equals(this,e)},Ir.equals=function(e,t){return e===t||D(e)&&D(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},Ir.prototype.equalsEpsilon=function(e,t){return Ir.equalsEpsilon(this,e,t)},Ir.validate=function(e){L.typeOf.object("rectangle",e);const t=e.north;L.typeOf.number.greaterThanOrEquals("north",t,-V.PI_OVER_TWO),L.typeOf.number.lessThanOrEquals("north",t,V.PI_OVER_TWO);const n=e.south;L.typeOf.number.greaterThanOrEquals("south",n,-V.PI_OVER_TWO),L.typeOf.number.lessThanOrEquals("south",n,V.PI_OVER_TWO);const i=e.west;L.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),L.typeOf.number.lessThanOrEquals("west",i,Math.PI);const o=e.east;L.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),L.typeOf.number.lessThanOrEquals("east",o,Math.PI)},Ir.southwest=function(e,t){return L.typeOf.object("rectangle",e),D(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Qt(e.west,e.south)},Ir.northwest=function(e,t){return L.typeOf.object("rectangle",e),D(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Qt(e.west,e.north)},Ir.northeast=function(e,t){return L.typeOf.object("rectangle",e),D(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Qt(e.east,e.north)},Ir.southeast=function(e,t){return L.typeOf.object("rectangle",e),D(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Qt(e.east,e.south)},Ir.center=function(e,t){L.typeOf.object("rectangle",e);let n=e.east;const i=e.west;n<i&&(n+=V.TWO_PI);const o=V.negativePiToPi(.5*(i+n)),r=.5*(e.south+e.north);return D(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new Qt(o,r)},Ir.intersection=function(e,t,n){L.typeOf.object("rectangle",e),L.typeOf.object("otherRectangle",t);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=V.TWO_PI:r<s&&i>0&&(r+=V.TWO_PI),i<o&&s<0?s+=V.TWO_PI:r<s&&o<0&&(o+=V.TWO_PI);const a=V.negativePiToPi(Math.max(o,s)),c=V.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&c<=a)return;const l=Math.max(e.south,t.south),u=Math.min(e.north,t.north);return l>=u?void 0:D(n)?(n.west=a,n.south=l,n.east=c,n.north=u,n):new Ir(a,l,c,u)},Ir.simpleIntersection=function(e,t,n){L.typeOf.object("rectangle",e),L.typeOf.object("otherRectangle",t);const i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),s=Math.min(e.north,t.north);if(!(o>=s||i>=r))return D(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new Ir(i,o,r,s)},Ir.union=function(e,t,n){L.typeOf.object("rectangle",e),L.typeOf.object("otherRectangle",t),D(n)||(n=new Ir);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=V.TWO_PI:r<s&&i>0&&(r+=V.TWO_PI),i<o&&s<0?s+=V.TWO_PI:r<s&&o<0&&(o+=V.TWO_PI);const a=V.negativePiToPi(Math.min(o,s)),c=V.negativePiToPi(Math.max(i,r));return n.west=a,n.south=Math.min(e.south,t.south),n.east=c,n.north=Math.max(e.north,t.north),n},Ir.expand=function(e,t,n){return L.typeOf.object("rectangle",e),L.typeOf.object("cartographic",t),D(n)||(n=new Ir),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n},Ir.contains=function(e,t){L.typeOf.object("rectangle",e),L.typeOf.object("cartographic",t);let n=t.longitude;const i=t.latitude,o=e.west;let r=e.east;return r<o&&(r+=V.TWO_PI,n<0&&(n+=V.TWO_PI)),(n>o||V.equalsEpsilon(n,o,V.EPSILON14))&&(n<r||V.equalsEpsilon(n,r,V.EPSILON14))&&i>=e.south&&i<=e.north};const Mr=new Qt;function Fr(e,t,n,i){this.x=M(e,0),this.y=M(t,0),this.width=M(n,0),this.height=M(i,0)}Ir.subsample=function(e,t,n,i){L.typeOf.object("rectangle",e),t=M(t,on.WGS84),n=M(n,0),D(i)||(i=[]);let o=0;const r=e.north,s=e.south,a=e.east,c=e.west,l=Mr;l.height=n,l.longitude=c,l.latitude=r,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.longitude=a,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.latitude=s,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.longitude=c,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.latitude=r<0?r:s>0?s:0;for(let u=1;u<8;++u)l.longitude=-Math.PI+u*V.PI_OVER_TWO,Ir.contains(e,l)&&(i[o]=t.cartographicToCartesian(l,i[o]),o++);return 0===l.latitude&&(l.longitude=c,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.longitude=a,i[o]=t.cartographicToCartesian(l,i[o]),o++),i.length=o,i},Ir.subsection=function(e,t,n,i,o,r){if(L.typeOf.object("rectangle",e),L.typeOf.number.greaterThanOrEquals("westLerp",t,0),L.typeOf.number.lessThanOrEquals("westLerp",t,1),L.typeOf.number.greaterThanOrEquals("southLerp",n,0),L.typeOf.number.lessThanOrEquals("southLerp",n,1),L.typeOf.number.greaterThanOrEquals("eastLerp",i,0),L.typeOf.number.lessThanOrEquals("eastLerp",i,1),L.typeOf.number.greaterThanOrEquals("northLerp",o,0),L.typeOf.number.lessThanOrEquals("northLerp",o,1),L.typeOf.number.lessThanOrEquals("westLerp",t,i),L.typeOf.number.lessThanOrEquals("southLerp",n,o),D(r)||(r=new Ir),e.west<=e.east){const n=e.east-e.west;r.west=e.west+t*n,r.east=e.west+i*n}else{const n=V.TWO_PI+e.east-e.west;r.west=V.negativePiToPi(e.west+t*n),r.east=V.negativePiToPi(e.west+i*n)}const s=e.north-e.south;return r.south=e.south+n*s,r.north=e.south+o*s,1===t&&(r.west=e.east),1===i&&(r.east=e.east),1===n&&(r.south=e.north),1===o&&(r.north=e.north),r},Ir.MAX_VALUE=Object.freeze(new Ir(-Math.PI,-V.PI_OVER_TWO,Math.PI,V.PI_OVER_TWO)),Fr.packedLength=4,Fr.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t},Fr.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new Fr),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n},Fr.fromPoints=function(e,t){if(D(t)||(t=new Fr),!D(e)||0===e.length)return t.x=0,t.y=0,t.width=0,t.height=0,t;const n=e.length;let i=e[0].x,o=e[0].y,r=e[0].x,s=e[0].y;for(let a=1;a<n;a++){const t=e[a],n=t.x,c=t.y;i=Math.min(n,i),r=Math.max(n,r),o=Math.min(c,o),s=Math.max(c,s)}return t.x=i,t.y=o,t.width=r-i,t.height=s-o,t};const Br=new fn,zr=new Qt,Ur=new Qt;Fr.fromRectangle=function(e,t,n){if(D(n)||(n=new Fr),!D(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;const i=(t=M(t,Br)).project(Ir.southwest(e,zr)),o=t.project(Ir.northeast(e,Ur));return kt.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n},Fr.clone=function(e,t){if(D(e))return D(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new Fr(e.x,e.y,e.width,e.height)},Fr.union=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),D(n)||(n=new Fr);const i=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=Math.max(e.x+e.width,t.x+t.width),s=Math.max(e.y+e.height,t.y+t.height);return n.x=i,n.y=o,n.width=r-i,n.height=s-o,n},Fr.expand=function(e,t,n){L.typeOf.object("rectangle",e),L.typeOf.object("point",t),n=Fr.clone(e,n);const i=t.x-n.x,o=t.y-n.y;return i>n.width?n.width=i:i<0&&(n.width-=i,n.x=t.x),o>n.height?n.height=o:o<0&&(n.height-=o,n.y=t.y),n},Fr.intersect=function(e,t){L.typeOf.object("left",e),L.typeOf.object("right",t);const n=e.x,i=e.y,o=t.x,r=t.y;return n>o+t.width||n+e.width<o||i+e.height<r||i>r+t.height?mn.OUTSIDE:mn.INTERSECTING},Fr.equals=function(e,t){return e===t||D(e)&&D(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},Fr.prototype.clone=function(e){return Fr.clone(this,e)},Fr.prototype.intersect=function(e){return Fr.intersect(this,e)},Fr.prototype.equals=function(e){return Fr.equals(this,e)};const kr={POINTS:Me.POINTS,LINES:Me.LINES,LINE_LOOP:Me.LINE_LOOP,LINE_STRIP:Me.LINE_STRIP,TRIANGLES:Me.TRIANGLES,TRIANGLE_STRIP:Me.TRIANGLE_STRIP,TRIANGLE_FAN:Me.TRIANGLE_FAN,isLines:function(e){return e===kr.LINES||e===kr.LINE_LOOP||e===kr.LINE_STRIP},isTriangles:function(e){return e===kr.TRIANGLES||e===kr.TRIANGLE_STRIP||e===kr.TRIANGLE_FAN},validate:function(e){return e===kr.POINTS||e===kr.LINES||e===kr.LINE_LOOP||e===kr.LINE_STRIP||e===kr.TRIANGLES||e===kr.TRIANGLE_STRIP||e===kr.TRIANGLE_FAN}},Vr=Object.freeze(kr),Hr="in vec4 position;\nin vec2 textureCoordinates;\n\nout vec2 v_textureCoordinates;\n\nvoid main() \n{\n gl_Position = position;\n v_textureCoordinates = textureCoordinates;\n}\n",Gr=1,jr=2,Wr=4,qr=8,Yr=16,Xr=32,Qr=64,$r=128;function Kr(e){e=M(e,M.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=M(e.primitiveType,Vr.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=M(e.offset,0),this._instanceCount=M(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._flags=0,this.cull=M(e.cull,!0),this.occlude=M(e.occlude,!0),this.executeInClosestFrustum=M(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.castShadows=M(e.castShadows,!1),this.receiveShadows=M(e.receiveShadows,!1),this.pickOnly=M(e.pickOnly,!1),this.depthForTranslucentClassification=M(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Zr(e,t){return(e._flags&t)===t}function Jr(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(Kr.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 Zr(this,Gr)},set:function(e){Zr(this,Gr)!==e&&(Jr(this,Gr,e),this.dirty=!0)}},occlude:{get:function(){return Zr(this,jr)},set:function(e){Zr(this,jr)!==e&&(Jr(this,jr,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 Zr(this,Yr)},set:function(e){Zr(this,Yr)!==e&&(Jr(this,Yr,e),this.dirty=!0)}},receiveShadows:{get:function(){return Zr(this,Xr)},set:function(e){Zr(this,Xr)!==e&&(Jr(this,Xr,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 Zr(this,Wr)},set:function(e){Zr(this,Wr)!==e&&(Jr(this,Wr,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 Zr(this,qr)},set:function(e){Zr(this,qr)!==e&&(Jr(this,qr,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 Zr(this,Qr)},set:function(e){Zr(this,Qr)!==e&&(Jr(this,Qr,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return Zr(this,$r)},set:function(e){Zr(this,$r)!==e&&(Jr(this,$r,e),this.dirty=!0)}}}),Kr.shallowClone=function(e,t){if(D(e))return D(t)||(t=new Kr),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._owner=e._owner,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._pickId=e._pickId,t._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t},Kr.prototype.execute=function(e,t){e.draw(this,t)};const es={UNSIGNED_BYTE:Me.UNSIGNED_BYTE,UNSIGNED_SHORT:Me.UNSIGNED_SHORT,UNSIGNED_INT:Me.UNSIGNED_INT,FLOAT:Me.FLOAT,HALF_FLOAT:Me.HALF_FLOAT_OES,UNSIGNED_INT_24_8:Me.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:Me.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:Me.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:Me.UNSIGNED_SHORT_5_6_5,toWebGLConstant:function(e,t){switch(e){case es.UNSIGNED_BYTE:return Me.UNSIGNED_BYTE;case es.UNSIGNED_SHORT:return Me.UNSIGNED_SHORT;case es.UNSIGNED_INT:return Me.UNSIGNED_INT;case es.FLOAT:return Me.FLOAT;case es.HALF_FLOAT:return t.webgl2?Me.HALF_FLOAT:Me.HALF_FLOAT_OES;case es.UNSIGNED_INT_24_8:return Me.UNSIGNED_INT_24_8;case es.UNSIGNED_SHORT_4_4_4_4:return Me.UNSIGNED_SHORT_4_4_4_4;case es.UNSIGNED_SHORT_5_5_5_1:return Me.UNSIGNED_SHORT_5_5_5_1;case es.UNSIGNED_SHORT_5_6_5:return es.UNSIGNED_SHORT_5_6_5}},isPacked:function(e){return e===es.UNSIGNED_INT_24_8||e===es.UNSIGNED_SHORT_4_4_4_4||e===es.UNSIGNED_SHORT_5_5_5_1||e===es.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(e){switch(e){case es.UNSIGNED_BYTE:return 1;case es.UNSIGNED_SHORT:case es.UNSIGNED_SHORT_4_4_4_4:case es.UNSIGNED_SHORT_5_5_5_1:case es.UNSIGNED_SHORT_5_6_5:case es.HALF_FLOAT:return 2;case es.UNSIGNED_INT:case es.FLOAT:case es.UNSIGNED_INT_24_8:return 4}},validate:function(e){return e===es.UNSIGNED_BYTE||e===es.UNSIGNED_SHORT||e===es.UNSIGNED_INT||e===es.FLOAT||e===es.HALF_FLOAT||e===es.UNSIGNED_INT_24_8||e===es.UNSIGNED_SHORT_4_4_4_4||e===es.UNSIGNED_SHORT_5_5_5_1||e===es.UNSIGNED_SHORT_5_6_5}},ts=Object.freeze(es),ns={DEPTH_COMPONENT:Me.DEPTH_COMPONENT,DEPTH_STENCIL:Me.DEPTH_STENCIL,ALPHA:Me.ALPHA,RED:Me.RED,RG:Me.RG,RGB:Me.RGB,RGBA:Me.RGBA,LUMINANCE:Me.LUMINANCE,LUMINANCE_ALPHA:Me.LUMINANCE_ALPHA,RGB_DXT1:Me.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:Me.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:Me.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:Me.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:Me.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:Me.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:Me.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:Me.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:Me.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:Me.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:Me.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:Me.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:Me.COMPRESSED_RGBA_BPTC_UNORM,componentsLength:function(e){switch(e){case ns.RGB:return 3;case ns.RGBA:return 4;case ns.LUMINANCE_ALPHA:case ns.RG:return 2;case ns.ALPHA:case ns.RED:case ns.LUMINANCE:default:return 1}},validate:function(e){return e===ns.DEPTH_COMPONENT||e===ns.DEPTH_STENCIL||e===ns.ALPHA||e===ns.RED||e===ns.RG||e===ns.RGB||e===ns.RGBA||e===ns.LUMINANCE||e===ns.LUMINANCE_ALPHA||e===ns.RGB_DXT1||e===ns.RGBA_DXT1||e===ns.RGBA_DXT3||e===ns.RGBA_DXT5||e===ns.RGB_PVRTC_4BPPV1||e===ns.RGB_PVRTC_2BPPV1||e===ns.RGBA_PVRTC_4BPPV1||e===ns.RGBA_PVRTC_2BPPV1||e===ns.RGBA_ASTC||e===ns.RGB_ETC1||e===ns.RGB8_ETC2||e===ns.RGBA8_ETC2_EAC||e===ns.RGBA_BC7},isColorFormat:function(e){return e===ns.RED||e===ns.ALPHA||e===ns.RGB||e===ns.RGBA||e===ns.LUMINANCE||e===ns.LUMINANCE_ALPHA},isDepthFormat:function(e){return e===ns.DEPTH_COMPONENT||e===ns.DEPTH_STENCIL},isCompressedFormat:function(e){return e===ns.RGB_DXT1||e===ns.RGBA_DXT1||e===ns.RGBA_DXT3||e===ns.RGBA_DXT5||e===ns.RGB_PVRTC_4BPPV1||e===ns.RGB_PVRTC_2BPPV1||e===ns.RGBA_PVRTC_4BPPV1||e===ns.RGBA_PVRTC_2BPPV1||e===ns.RGBA_ASTC||e===ns.RGB_ETC1||e===ns.RGB8_ETC2||e===ns.RGBA8_ETC2_EAC||e===ns.RGBA_BC7},isDXTFormat:function(e){return e===ns.RGB_DXT1||e===ns.RGBA_DXT1||e===ns.RGBA_DXT3||e===ns.RGBA_DXT5},isPVRTCFormat:function(e){return e===ns.RGB_PVRTC_4BPPV1||e===ns.RGB_PVRTC_2BPPV1||e===ns.RGBA_PVRTC_4BPPV1||e===ns.RGBA_PVRTC_2BPPV1},isASTCFormat:function(e){return e===ns.RGBA_ASTC},isETC1Format:function(e){return e===ns.RGB_ETC1},isETC2Format:function(e){return e===ns.RGB8_ETC2||e===ns.RGBA8_ETC2_EAC},isBC7Format:function(e){return e===ns.RGBA_BC7},compressedTextureSizeInBytes:function(e,t,n){switch(e){case ns.RGB_DXT1:case ns.RGBA_DXT1:case ns.RGB_ETC1:case ns.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case ns.RGBA_DXT3:case ns.RGBA_DXT5:case ns.RGBA_ASTC:case ns.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case ns.RGB_PVRTC_4BPPV1:case ns.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case ns.RGB_PVRTC_2BPPV1:case ns.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case ns.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}},textureSizeInBytes:function(e,t,n,i){let o=ns.componentsLength(e);return ts.isPacked(t)&&(o=1),o*ts.sizeInBytes(t)*n*i},alignmentInBytes:function(e,t,n){const i=ns.textureSizeInBytes(e,t,n,1)%4;return 0===i?4:2===i?2:1},createTypedArray:function(e,t,n,i){let o;const r=ts.sizeInBytes(t);o=r===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===ts.FLOAT?Float32Array:Uint32Array;return new o(ns.componentsLength(e)*n*i)},flipY:function(e,t,n,i,o){if(1===o)return e;const r=ns.createTypedArray(t,n,i,o),s=ns.componentsLength(t),a=i*s;for(let c=0;c<o;++c){const t=c*i*s,n=(o-c-1)*i*s;for(let i=0;i<a;++i)r[n+i]=e[t+i]}return r},toInternalFormat:function(e,t,n){if(!n.webgl2)return e;if(e===ns.DEPTH_STENCIL)return Me.DEPTH24_STENCIL8;if(e===ns.DEPTH_COMPONENT){if(t===ts.UNSIGNED_SHORT)return Me.DEPTH_COMPONENT16;if(t===ts.UNSIGNED_INT)return Me.DEPTH_COMPONENT24}if(t===ts.FLOAT)switch(e){case ns.RGBA:return Me.RGBA32F;case ns.RGB:return Me.RGB32F;case ns.RG:return Me.RG32F;case ns.RED:return Me.R32F}if(t===ts.HALF_FLOAT)switch(e){case ns.RGBA:return Me.RGBA16F;case ns.RGB:return Me.RGB16F;case ns.RG:return Me.RG16F;case ns.RED:return Me.R16F}return e}},is=Object.freeze(ns),os={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_maximumSamples:0,_highpFloatSupported:!1,_highpIntSupported:!1};Object.defineProperties(os,{maximumCombinedTextureImageUnits:{get:function(){return os._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return os._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return os._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return os._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return os._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return os._maximumTextureSize}},maximumVaryingVectors:{get:function(){return os._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return os._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return os._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return os._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return os._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return os._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return os._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return os._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return os._maximumViewportWidth}},maximumViewportHeight:{get:function(){return os._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return os._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return os._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return os._maximumColorAttachments}},maximumSamples:{get:function(){return os._maximumSamples}},highpFloatSupported:{get:function(){return os._highpFloatSupported}},highpIntSupported:{get:function(){return os._highpIntSupported}}});const rs=os;function ss(e,t,n){const i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function as(e,t,n){const i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function cs(e){const t=(e=M(e,M.EMPTY_OBJECT)).context;L.defined("options.context",t);const n=t._gl,i=rs.maximumColorAttachments;if(this._gl=n,this._framebuffer=n.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=M(e.destroyAttachments,!0),D(e.colorTextures)&&D(e.colorRenderbuffers))throw new P("Cannot have both color texture and color renderbuffer attachments.");if(D(e.depthTexture)&&D(e.depthRenderbuffer))throw new P("Cannot have both a depth texture and depth renderbuffer attachment.");if(D(e.depthStencilTexture)&&D(e.depthStencilRenderbuffer))throw new P("Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.");const o=D(e.depthTexture)||D(e.depthRenderbuffer),r=D(e.depthStencilTexture)||D(e.depthStencilRenderbuffer);if(o&&r)throw new P("Cannot have both a depth and depth-stencil attachment.");if(D(e.stencilRenderbuffer)&&r)throw new P("Cannot have both a stencil and depth-stencil attachment.");if(o&&D(e.stencilRenderbuffer))throw new P("Cannot have both a depth and stencil attachment.");let s,a,c,l,u;if(this._bind(),D(e.colorTextures)){const n=e.colorTextures;if(l=this._colorTextures.length=this._activeColorAttachments.length=n.length,l>i)throw new P("The number of color attachments exceeds the number supported.");for(c=0;c<l;++c){if(s=n[c],!is.isColorFormat(s.pixelFormat))throw new P("The color-texture pixel-format must be a color format.");if(s.pixelDatatype===ts.FLOAT&&!t.colorBufferFloat)throw new P("The color texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions. See Context.colorBufferFloat.");if(s.pixelDatatype===ts.HALF_FLOAT&&!t.colorBufferHalfFloat)throw new P("The color texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension. See Context.colorBufferHalfFloat.");u=this._gl.COLOR_ATTACHMENT0+c,ss(this,u,s),this._activeColorAttachments[c]=u,this._colorTextures[c]=s}}if(D(e.colorRenderbuffers)){const t=e.colorRenderbuffers;if(l=this._colorRenderbuffers.length=this._activeColorAttachments.length=t.length,l>i)throw new P("The number of color attachments exceeds the number supported.");for(c=0;c<l;++c)a=t[c],u=this._gl.COLOR_ATTACHMENT0+c,as(this,u,a),this._activeColorAttachments[c]=u,this._colorRenderbuffers[c]=a}if(D(e.depthTexture)){if(s=e.depthTexture,s.pixelFormat!==is.DEPTH_COMPONENT)throw new P("The depth-texture pixel-format must be DEPTH_COMPONENT.");ss(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s}if(D(e.depthRenderbuffer)&&(a=e.depthRenderbuffer,as(this,this._gl.DEPTH_ATTACHMENT,a),this._depthRenderbuffer=a),D(e.stencilRenderbuffer)&&(a=e.stencilRenderbuffer,as(this,this._gl.STENCIL_ATTACHMENT,a),this._stencilRenderbuffer=a),D(e.depthStencilTexture)){if(s=e.depthStencilTexture,s.pixelFormat!==is.DEPTH_STENCIL)throw new P("The depth-stencil pixel-format must be DEPTH_STENCIL.");ss(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s}D(e.depthStencilRenderbuffer)&&(a=e.depthStencilRenderbuffer,as(this,this._gl.DEPTH_STENCIL_ATTACHMENT,a),this._depthStencilRenderbuffer=a),this._unBind()}Object.defineProperties(cs.prototype,{status:{get:function(){this._bind();const e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}}),cs.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)},cs.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},cs.prototype.bindDraw=function(){const e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)},cs.prototype.bindRead=function(){const e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)},cs.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments},cs.prototype.getColorTexture=function(e){if(!D(e)||e<0||e>=this._colorTextures.length)throw new P("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorTextures[e]},cs.prototype.getColorRenderbuffer=function(e){if(!D(e)||e<0||e>=this._colorRenderbuffers.length)throw new P("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorRenderbuffers[e]},cs.prototype.isDestroyed=function(){return!1},cs.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let n=t.length;for(;e<n;++e){const n=t[e];D(n)&&n.destroy()}const i=this._colorRenderbuffers;for(n=i.length,e=0;e<n;++e){const t=i[e];D(t)&&t.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),He(this)};const ls={CLOCKWISE:Me.CW,COUNTER_CLOCKWISE:Me.CCW,validate:function(e){return e===ls.CLOCKWISE||e===ls.COUNTER_CLOCKWISE}},us=Object.freeze(ls);function ds(e){if("object"!=typeof e||null===e)return e;let t;const n=Object.keys(e);for(let i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&"_applyFunctions"!==t&&(e[t]=ds(e[t]));return Object.freeze(e)}function hs(e){return e===Me.FUNC_ADD||e===Me.FUNC_SUBTRACT||e===Me.FUNC_REVERSE_SUBTRACT||e===Me.MIN||e===Me.MAX}function ps(e){return e===Me.ZERO||e===Me.ONE||e===Me.SRC_COLOR||e===Me.ONE_MINUS_SRC_COLOR||e===Me.DST_COLOR||e===Me.ONE_MINUS_DST_COLOR||e===Me.SRC_ALPHA||e===Me.ONE_MINUS_SRC_ALPHA||e===Me.DST_ALPHA||e===Me.ONE_MINUS_DST_ALPHA||e===Me.CONSTANT_COLOR||e===Me.ONE_MINUS_CONSTANT_COLOR||e===Me.CONSTANT_ALPHA||e===Me.ONE_MINUS_CONSTANT_ALPHA||e===Me.SRC_ALPHA_SATURATE}function fs(e){return e===Me.NEVER||e===Me.LESS||e===Me.EQUAL||e===Me.LEQUAL||e===Me.GREATER||e===Me.NOTEQUAL||e===Me.GEQUAL||e===Me.ALWAYS}function ms(e){return e===Me.ZERO||e===Me.KEEP||e===Me.REPLACE||e===Me.INCR||e===Me.DECR||e===Me.INVERT||e===Me.INCR_WRAP||e===Me.DECR_WRAP}function _s(e){const t=M(e,M.EMPTY_OBJECT),n=M(t.cull,M.EMPTY_OBJECT),i=M(t.polygonOffset,M.EMPTY_OBJECT),o=M(t.scissorTest,M.EMPTY_OBJECT),r=M(o.rectangle,M.EMPTY_OBJECT),s=M(t.depthRange,M.EMPTY_OBJECT),a=M(t.depthTest,M.EMPTY_OBJECT),c=M(t.colorMask,M.EMPTY_OBJECT),l=M(t.blending,M.EMPTY_OBJECT),u=M(l.color,M.EMPTY_OBJECT),d=M(t.stencilTest,M.EMPTY_OBJECT),h=M(d.frontOperation,M.EMPTY_OBJECT),p=M(d.backOperation,M.EMPTY_OBJECT),f=M(t.sampleCoverage,M.EMPTY_OBJECT),m=t.viewport;if(this.frontFace=M(t.frontFace,us.COUNTER_CLOCKWISE),this.cull={enabled:M(n.enabled,!1),face:M(n.face,Me.BACK)},this.lineWidth=M(t.lineWidth,1),this.polygonOffset={enabled:M(i.enabled,!1),factor:M(i.factor,0),units:M(i.units,0)},this.scissorTest={enabled:M(o.enabled,!1),rectangle:Fr.clone(r)},this.depthRange={near:M(s.near,0),far:M(s.far,1)},this.depthTest={enabled:M(a.enabled,!1),func:M(a.func,Me.LESS)},this.colorMask={red:M(c.red,!0),green:M(c.green,!0),blue:M(c.blue,!0),alpha:M(c.alpha,!0)},this.depthMask=M(t.depthMask,!0),this.stencilMask=M(t.stencilMask,-1),this.blending={enabled:M(l.enabled,!1),color:new Ot(M(u.red,0),M(u.green,0),M(u.blue,0),M(u.alpha,0)),equationRgb:M(l.equationRgb,Me.FUNC_ADD),equationAlpha:M(l.equationAlpha,Me.FUNC_ADD),functionSourceRgb:M(l.functionSourceRgb,Me.ONE),functionSourceAlpha:M(l.functionSourceAlpha,Me.ONE),functionDestinationRgb:M(l.functionDestinationRgb,Me.ZERO),functionDestinationAlpha:M(l.functionDestinationAlpha,Me.ZERO)},this.stencilTest={enabled:M(d.enabled,!1),frontFunction:M(d.frontFunction,Me.ALWAYS),backFunction:M(d.backFunction,Me.ALWAYS),reference:M(d.reference,0),mask:M(d.mask,-1),frontOperation:{fail:M(h.fail,Me.KEEP),zFail:M(h.zFail,Me.KEEP),zPass:M(h.zPass,Me.KEEP)},backOperation:{fail:M(p.fail,Me.KEEP),zFail:M(p.zFail,Me.KEEP),zPass:M(p.zPass,Me.KEEP)}},this.sampleCoverage={enabled:M(f.enabled,!1),value:M(f.value,1),invert:M(f.invert,!1)},this.viewport=D(m)?new Fr(m.x,m.y,m.width,m.height):void 0,this.lineWidth<rs.minimumAliasedLineWidth||this.lineWidth>rs.maximumAliasedLineWidth)throw new P("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!us.validate(this.frontFace))throw new P("Invalid renderState.frontFace.");if((_=this.cull.face)!==Me.FRONT&&_!==Me.BACK&&_!==Me.FRONT_AND_BACK)throw new P("Invalid renderState.cull.face.");var _,g;if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new P("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new P("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new P("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new P("renderState.depthRange.far must be less than or equal to one.");if((g=this.depthTest.func)!==Me.NEVER&&g!==Me.LESS&&g!==Me.EQUAL&&g!==Me.LEQUAL&&g!==Me.GREATER&&g!==Me.NOTEQUAL&&g!==Me.GEQUAL&&g!==Me.ALWAYS)throw new P("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new P("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!hs(this.blending.equationRgb))throw new P("Invalid renderState.blending.equationRgb.");if(!hs(this.blending.equationAlpha))throw new P("Invalid renderState.blending.equationAlpha.");if(!ps(this.blending.functionSourceRgb))throw new P("Invalid renderState.blending.functionSourceRgb.");if(!ps(this.blending.functionSourceAlpha))throw new P("Invalid renderState.blending.functionSourceAlpha.");if(!ps(this.blending.functionDestinationRgb))throw new P("Invalid renderState.blending.functionDestinationRgb.");if(!ps(this.blending.functionDestinationAlpha))throw new P("Invalid renderState.blending.functionDestinationAlpha.");if(!fs(this.stencilTest.frontFunction))throw new P("Invalid renderState.stencilTest.frontFunction.");if(!fs(this.stencilTest.backFunction))throw new P("Invalid renderState.stencilTest.backFunction.");if(!ms(this.stencilTest.frontOperation.fail))throw new P("Invalid renderState.stencilTest.frontOperation.fail.");if(!ms(this.stencilTest.frontOperation.zFail))throw new P("Invalid renderState.stencilTest.frontOperation.zFail.");if(!ms(this.stencilTest.frontOperation.zPass))throw new P("Invalid renderState.stencilTest.frontOperation.zPass.");if(!ms(this.stencilTest.backOperation.fail))throw new P("Invalid renderState.stencilTest.backOperation.fail.");if(!ms(this.stencilTest.backOperation.zFail))throw new P("Invalid renderState.stencilTest.backOperation.zFail.");if(!ms(this.stencilTest.backOperation.zPass))throw new P("Invalid renderState.stencilTest.backOperation.zPass.");if(D(this.viewport)){if(this.viewport.width<0)throw new P("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new P("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>rs.maximumViewportWidth)throw new P(`renderState.viewport.width must be less than or equal to the maximum viewport width (${rs.maximumViewportWidth.toString()}). Check maximumViewportWidth.`);if(this.viewport.height>rs.maximumViewportHeight)throw new P(`renderState.viewport.height must be less than or equal to the maximum viewport height (${rs.maximumViewportHeight.toString()}). Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}let gs=0,ys={};function bs(e,t,n){n?e.enable(t):e.disable(t)}function vs(e,t){e.frontFace(t.frontFace)}function As(e,t){const n=t.cull,i=n.enabled;bs(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function Ts(e,t){e.lineWidth(t.lineWidth)}function ws(e,t){const n=t.polygonOffset,i=n.enabled;bs(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function Es(e,t,n){const i=t.scissorTest,o=D(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(bs(e,e.SCISSOR_TEST,o),o){const t=D(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(t.x,t.y,t.width,t.height)}}function xs(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function Ss(e,t){const n=t.depthTest,i=n.enabled;bs(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function Cs(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function Is(e,t){e.depthMask(t.depthMask)}function Os(e,t){e.stencilMask(t.stencilMask)}function Ds(e,t,n){const i=t.blending,o=D(n.blendingEnabled)?n.blendingEnabled:i.enabled;bs(e,e.BLEND,o),o&&(!function(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function Ps(e,t){const n=t.stencilTest,i=n.enabled;if(bs(e,e.STENCIL_TEST,i),i){const t=n.frontFunction,i=n.backFunction,o=n.reference,r=n.mask;e.stencilFunc(t,o,r),e.stencilFuncSeparate(e.BACK,i,o,r),e.stencilFuncSeparate(e.FRONT,t,o,r);const s=n.frontOperation,a=s.fail,c=s.zFail,l=s.zPass;e.stencilOpSeparate(e.FRONT,a,c,l);const u=n.backOperation,d=u.fail,h=u.zFail,p=u.zPass;e.stencilOpSeparate(e.BACK,d,h,p)}}function Ns(e,t){const n=t.sampleCoverage,i=n.enabled;bs(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}_s.fromCache=function(e){const t=JSON.stringify(e);let n=ys[t];if(D(n))return++n.referenceCount,n.state;let i=new _s(e);const o=JSON.stringify(i);return n=ys[o],D(n)||(i.id=gs++,i=ds(i),n={referenceCount:0,state:i},ys[o]=n),++n.referenceCount,ys[t]={referenceCount:1,state:n.state},n.state},_s.removeFromCache=function(e){const t=new _s(e),n=JSON.stringify(t),i=ys[n],o=JSON.stringify(e),r=ys[o];D(r)&&(--r.referenceCount,0===r.referenceCount&&(delete ys[o],D(i)&&--i.referenceCount)),D(i)&&0===i.referenceCount&&delete ys[n]},_s.getCache=function(){return ys},_s.clearCache=function(){ys={}};const Rs=new Fr;function Ls(e,t,n){let i=M(t.viewport,n.viewport);D(i)||(i=Rs,i.width=n.context.drawingBufferWidth,i.height=n.context.drawingBufferHeight),n.context.uniformState.viewport=i,e.viewport(i.x,i.y,i.width,i.height)}function Ms(e,t,n,i){this[0]=M(e,0),this[1]=M(n,0),this[2]=M(t,0),this[3]=M(i,0)}_s.apply=function(e,t,n){vs(e,t),As(e,t),Ts(e,t),ws(e,t),xs(e,t),Ss(e,t),Cs(e,t),Is(e,t),Os(e,t),Ps(e,t),Ns(e,t),Es(e,t,n),Ds(e,t,n),Ls(e,t,n)},_s.partialApply=function(e,t,n,i,o,r){if(t!==n){let i=n._applyFunctions[t.id];D(i)||(i=function(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(vs),e.cull.enabled===t.cull.enabled&&e.cull.face===t.cull.face||n.push(As),e.lineWidth!==t.lineWidth&&n.push(Ts),e.polygonOffset.enabled===t.polygonOffset.enabled&&e.polygonOffset.factor===t.polygonOffset.factor&&e.polygonOffset.units===t.polygonOffset.units||n.push(ws),e.depthRange.near===t.depthRange.near&&e.depthRange.far===t.depthRange.far||n.push(xs),e.depthTest.enabled===t.depthTest.enabled&&e.depthTest.func===t.depthTest.func||n.push(Ss),e.colorMask.red===t.colorMask.red&&e.colorMask.green===t.colorMask.green&&e.colorMask.blue===t.colorMask.blue&&e.colorMask.alpha===t.colorMask.alpha||n.push(Cs),e.depthMask!==t.depthMask&&n.push(Is),e.stencilMask!==t.stencilMask&&n.push(Os),e.stencilTest.enabled===t.stencilTest.enabled&&e.stencilTest.frontFunction===t.stencilTest.frontFunction&&e.stencilTest.backFunction===t.stencilTest.backFunction&&e.stencilTest.reference===t.stencilTest.reference&&e.stencilTest.mask===t.stencilTest.mask&&e.stencilTest.frontOperation.fail===t.stencilTest.frontOperation.fail&&e.stencilTest.frontOperation.zFail===t.stencilTest.frontOperation.zFail&&e.stencilTest.backOperation.fail===t.stencilTest.backOperation.fail&&e.stencilTest.backOperation.zFail===t.stencilTest.backOperation.zFail&&e.stencilTest.backOperation.zPass===t.stencilTest.backOperation.zPass||n.push(Ps),e.sampleCoverage.enabled===t.sampleCoverage.enabled&&e.sampleCoverage.value===t.sampleCoverage.value&&e.sampleCoverage.invert===t.sampleCoverage.invert||n.push(Ns),n}(t,n),n._applyFunctions[t.id]=i);const o=i.length;for(let t=0;t<o;++t)i[t](e,n)}((D(i.scissorTest)?i.scissorTest:t.scissorTest)!==(D(o.scissorTest)?o.scissorTest:n.scissorTest)||r)&&Es(e,n,o);const s=D(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,a=D(o.blendingEnabled)?o.blendingEnabled:n.blending.enabled;(s!==a||a&&t.blending!==n.blending)&&Ds(e,n,o),t===n&&i===o&&i.context===o.context||Ls(e,n,o)},_s.getState=function(e){if(!D(e))throw new P("renderState is required.");return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:Fr.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:Ot.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:D(e.viewport)?Fr.clone(e.viewport):void 0}},Ms.packedLength=4,Ms.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t},Ms.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new Ms),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n},Ms.packArray=function(e,t){L.defined("array",e);const n=e.length,i=4*n;if(D(t)){if(!Array.isArray(t)&&t.length!==i)throw new P("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}else t=new Array(i);for(let o=0;o<n;++o)Ms.pack(e[o],t,4*o);return t},Ms.unpackArray=function(e,t){if(L.defined("array",e),L.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!=0)throw new P("array length must be a multiple of 4.");const n=e.length;D(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const n=i/4;t[n]=Ms.unpack(e,i,t[n])}return t},Ms.clone=function(e,t){if(D(e))return D(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Ms(e[0],e[2],e[1],e[3])},Ms.fromArray=Ms.unpack,Ms.fromColumnMajorArray=function(e,t){return L.defined("values",e),Ms.clone(e,t)},Ms.fromRowMajorArray=function(e,t){return L.defined("values",e),D(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Ms(e[0],e[1],e[2],e[3])},Ms.fromScale=function(e,t){return L.typeOf.object("scale",e),D(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Ms(e.x,0,0,e.y)},Ms.fromUniformScale=function(e,t){return L.typeOf.number("scale",e),D(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Ms(e,0,0,e)},Ms.fromRotation=function(e,t){L.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return D(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new Ms(n,-i,i,n)},Ms.toArray=function(e,t){return L.typeOf.object("matrix",e),D(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]]},Ms.getElementIndex=function(e,t){return L.typeOf.number.greaterThanOrEquals("row",t,0),L.typeOf.number.lessThanOrEquals("row",t,1),L.typeOf.number.greaterThanOrEquals("column",e,0),L.typeOf.number.lessThanOrEquals("column",e,1),2*e+t},Ms.getColumn=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,1),L.typeOf.object("result",n);const i=2*t,o=e[i],r=e[i+1];return n.x=o,n.y=r,n},Ms.setColumn=function(e,t,n,i){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,1),L.typeOf.object("cartesian",n),L.typeOf.object("result",i);const o=2*t;return(i=Ms.clone(e,i))[o]=n.x,i[o+1]=n.y,i},Ms.getRow=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,1),L.typeOf.object("result",n);const i=e[t],o=e[t+2];return n.x=i,n.y=o,n},Ms.setRow=function(e,t,n,i){return L.typeOf.object("matrix",e),L.typeOf.number.greaterThanOrEquals("index",t,0),L.typeOf.number.lessThanOrEquals("index",t,1),L.typeOf.object("cartesian",n),L.typeOf.object("result",i),(i=Ms.clone(e,i))[t]=n.x,i[t+2]=n.y,i};const Fs=new kt;Ms.setScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("scale",t),L.typeOf.object("result",n);const i=Ms.getScale(e,Fs),o=t.x/i.x,r=t.y/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};const Bs=new kt;Ms.setUniformScale=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.number("scale",t),L.typeOf.object("result",n);const i=Ms.getScale(e,Bs),o=t/i.x,r=t/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};const zs=new kt;Ms.getScale=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t.x=kt.magnitude(kt.fromElements(e[0],e[1],zs)),t.y=kt.magnitude(kt.fromElements(e[2],e[3],zs)),t};const Us=new kt;Ms.getMaximumScale=function(e){return Ms.getScale(e,Us),kt.maximumComponent(Us)};const ks=new kt;Ms.setRotation=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("result",n);const i=Ms.getScale(e,ks);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.y,n[3]=t[3]*i.y,n};const Vs=new kt;function Hs(e,t,n,i){switch(t.type){case e.FLOAT:return new Gs(e,t,n,i);case e.FLOAT_VEC2:return new js(e,t,n,i);case e.FLOAT_VEC3:return new Ws(e,t,n,i);case e.FLOAT_VEC4:return new qs(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new Ys(e,t,n,i);case e.INT:case e.BOOL:return new Xs(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new Qs(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new $s(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new Ks(e,t,n,i);case e.FLOAT_MAT2:return new Js(e,t,n,i);case e.FLOAT_MAT3:return new ta(e,t,n,i);case e.FLOAT_MAT4:return new ia(e,t,n,i);default:throw new be(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function Gs(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}function js(e,t,n,i){this.name=n,this.value=void 0,this._value=new kt,this._gl=e,this._location=i}function Ws(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}function qs(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}function Ys(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}function Xs(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}function Qs(e,t,n,i){this.name=n,this.value=void 0,this._value=new kt,this._gl=e,this._location=i}function $s(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}function Ks(e,t,n,i){this.name=n,this.value=void 0,this._value=new K,this._gl=e,this._location=i}Ms.getRotation=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=Ms.getScale(e,Vs);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.y,t[3]=e[3]/n.y,t},Ms.multiply=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n);const i=e[0]*t[0]+e[2]*t[1],o=e[0]*t[2]+e[2]*t[3],r=e[1]*t[0]+e[3]*t[1],s=e[1]*t[2]+e[3]*t[3];return n[0]=i,n[1]=r,n[2]=o,n[3]=s,n},Ms.add=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n},Ms.subtract=function(e,t,n){return L.typeOf.object("left",e),L.typeOf.object("right",t),L.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n},Ms.multiplyByVector=function(e,t,n){L.typeOf.object("matrix",e),L.typeOf.object("cartesian",t),L.typeOf.object("result",n);const i=e[0]*t.x+e[2]*t.y,o=e[1]*t.x+e[3]*t.y;return n.x=i,n.y=o,n},Ms.multiplyByScalar=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.number("scalar",t),L.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n},Ms.multiplyByScale=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.object("scale",t),L.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n},Ms.multiplyByUniformScale=function(e,t,n){return L.typeOf.object("matrix",e),L.typeOf.number("scale",t),L.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n},Ms.negate=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},Ms.transpose=function(e,t){L.typeOf.object("matrix",e),L.typeOf.object("result",t);const n=e[0],i=e[2],o=e[1],r=e[3];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t},Ms.abs=function(e,t){return L.typeOf.object("matrix",e),L.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},Ms.equals=function(e,t){return e===t||D(e)&&D(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},Ms.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]},Ms.equalsEpsilon=function(e,t,n){return n=M(n,0),e===t||D(e)&&D(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n},Ms.IDENTITY=Object.freeze(new Ms(1,0,0,1)),Ms.ZERO=Object.freeze(new Ms(0,0,0,0)),Ms.COLUMN0ROW0=0,Ms.COLUMN0ROW1=1,Ms.COLUMN1ROW0=2,Ms.COLUMN1ROW1=3,Object.defineProperties(Ms.prototype,{length:{get:function(){return Ms.packedLength}}}),Ms.prototype.clone=function(e){return Ms.clone(this,e)},Ms.prototype.equals=function(e){return Ms.equals(this,e)},Ms.prototype.equalsEpsilon=function(e,t){return Ms.equalsEpsilon(this,e,t)},Ms.prototype.toString=function(){return`(${this[0]}, ${this[2]})\n(${this[1]}, ${this[3]})`},Gs.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))},js.prototype.set=function(){const e=this.value;kt.equals(e,this._value)||(kt.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))},Ws.prototype.set=function(){const e=this.value;if(D(e.red))Ot.equals(e,this._value)||(this._value=Ot.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else{if(!D(e.x))throw new P(`Invalid vec3 value for uniform "${this.name}".`);H.equals(e,this._value)||(this._value=H.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z))}},qs.prototype.set=function(){const e=this.value;if(D(e.red))Ot.equals(e,this._value)||(this._value=Ot.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else{if(!D(e.x))throw new P(`Invalid vec4 value for uniform "${this.name}".`);K.equals(e,this._value)||(this._value=K.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w))}},Ys.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)},Ys.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1},Xs.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))},Qs.prototype.set=function(){const e=this.value;kt.equals(e,this._value)||(kt.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))},$s.prototype.set=function(){const e=this.value;H.equals(e,this._value)||(H.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))},Ks.prototype.set=function(){const e=this.value;K.equals(e,this._value)||(K.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};const Zs=new Float32Array(4);function Js(e,t,n,i){this.name=n,this.value=void 0,this._value=new Ms,this._gl=e,this._location=i}Js.prototype.set=function(){if(!Ms.equalsArray(this.value,this._value,0)){Ms.clone(this.value,this._value);const e=Ms.toArray(this.value,Zs);this._gl.uniformMatrix2fv(this._location,!1,e)}};const ea=new Float32Array(9);function ta(e,t,n,i){this.name=n,this.value=void 0,this._value=new re,this._gl=e,this._location=i}ta.prototype.set=function(){if(!re.equalsArray(this.value,this._value,0)){re.clone(this.value,this._value);const e=re.toArray(this.value,ea);this._gl.uniformMatrix3fv(this._location,!1,e)}};const na=new Float32Array(16);function ia(e,t,n,i){this.name=n,this.value=void 0,this._value=new ve,this._gl=e,this._location=i}function oa(e,t,n,i){switch(t.type){case e.FLOAT:return new ra(e,t,n,i);case e.FLOAT_VEC2:return new sa(e,t,n,i);case e.FLOAT_VEC3:return new aa(e,t,n,i);case e.FLOAT_VEC4:return new ca(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new la(e,t,n,i);case e.INT:case e.BOOL:return new ua(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new da(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new ha(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new pa(e,t,n,i);case e.FLOAT_MAT2:return new fa(e,t,n,i);case e.FLOAT_MAT3:return new ma(e,t,n,i);case e.FLOAT_MAT4:return new _a(e,t,n,i);default:throw new be(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function ra(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._location=i[0]}function sa(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(2*o),this._gl=e,this._location=i[0]}function aa(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(3*o),this._gl=e,this._location=i[0]}function ca(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(4*o),this._gl=e,this._location=i[0]}function la(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._locations=i,this.textureUnitIndex=void 0}function ua(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o),this._gl=e,this._location=i[0]}function da(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(2*o),this._gl=e,this._location=i[0]}function ha(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(3*o),this._gl=e,this._location=i[0]}function pa(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(4*o),this._gl=e,this._location=i[0]}function fa(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(4*o),this._gl=e,this._location=i[0]}function ma(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(9*o),this._gl=e,this._location=i[0]}function _a(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(16*o),this._gl=e,this._location=i[0]}ia.prototype.set=function(){if(!ve.equalsArray(this.value,this._value,0)){ve.clone(this.value,this._value);const e=ve.toArray(this.value,na);this._gl.uniformMatrix4fv(this._location,!1,e)}},ra.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const t=e[o];t!==n[o]&&(n[o]=t,i=!0)}i&&this._gl.uniform1fv(this._location,n)},sa.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];kt.equalsArray(t,n,o)||(kt.pack(t,n,o),i=!0),o+=2}i&&this._gl.uniform2fv(this._location,n)},aa.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];if(D(t.red))t.red===n[o]&&t.green===n[o+1]&&t.blue===n[o+2]||(n[o]=t.red,n[o+1]=t.green,n[o+2]=t.blue,i=!0);else{if(!D(t.x))throw new P("Invalid vec3 value.");H.equalsArray(t,n,o)||(H.pack(t,n,o),i=!0)}o+=3}i&&this._gl.uniform3fv(this._location,n)},ca.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];if(D(t.red))Ot.equalsArray(t,n,o)||(Ot.pack(t,n,o),i=!0);else{if(!D(t.x))throw new P("Invalid vec4 value.");K.equalsArray(t,n,o)||(K.pack(t,n,o),i=!0)}o+=4}i&&this._gl.uniform4fv(this._location,n)},la.prototype.set=function(){const e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,n=this.value,i=n.length;for(let o=0;o<i;++o){const i=n[o];e.activeTexture(t+o),e.bindTexture(i._target,i._texture)}},la.prototype._setSampler=function(e){this.textureUnitIndex=e;const t=this._locations,n=t.length;for(let i=0;i<n;++i){const n=e+i;this._gl.uniform1i(t[i],n)}return e+n},ua.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const t=e[o];t!==n[o]&&(n[o]=t,i=!0)}i&&this._gl.uniform1iv(this._location,n)},da.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];kt.equalsArray(t,n,o)||(kt.pack(t,n,o),i=!0),o+=2}i&&this._gl.uniform2iv(this._location,n)},ha.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];H.equalsArray(t,n,o)||(H.pack(t,n,o),i=!0),o+=3}i&&this._gl.uniform3iv(this._location,n)},pa.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];K.equalsArray(t,n,o)||(K.pack(t,n,o),i=!0),o+=4}i&&this._gl.uniform4iv(this._location,n)},fa.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];Ms.equalsArray(t,n,o)||(Ms.pack(t,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)},ma.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];re.equalsArray(t,n,o)||(re.pack(t,n,o),i=!0),o+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)},_a.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const t=e[r];ve.equalsArray(t,n,o)||(ve.pack(t,n,o),i=!0),o+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};let ga=0;function ya(e){let t=e.vertexShaderText,n=e.fragmentShaderText;"undefined"!=typeof spector&&(t=t.replace(/^#line/gm,"//#line"),n=n.replace(/^#line/gm,"//#line"));const i=function(e,t){const n={};if(!rs.highpFloatSupported||!rs.highpIntSupported){let i,o,r,s;const a=ba(e),c=ba(t),l=a.length,u=c.length;for(i=0;i<l;i++)for(o=0;o<u;o++)if(a[i]===c[o]){r=a[i],s=`czm_mediump_${r}`;const e=new RegExp(`${r}\\b`,"g");t=t.replace(e,s),n[s]=r}}return{fragmentShaderText:t,duplicateUniformNames:n}}(t,n);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=i.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=i.fragmentShaderText,this.id=ga++}function ba(e){const t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(D(n)){const e=n.length;for(let i=0;i<e;i++){const e=n[i].trim(),o=e.slice(e.lastIndexOf(" ")+1);t.push(o)}}return t}ya.fromCache=function(e){return e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context),e.context.shaderCache.getShaderProgram(e)},ya.replaceCache=function(e){return e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context),e.context.shaderCache.replaceShaderProgram(e)},Object.defineProperties(ya.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return va(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return va(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return va(this),this._uniformsByName}}});function va(e){D(e._program)||Aa(e)}function Aa(e){const t=e._program,n=e._gl,i=function(e,t){const n=t._vertexShaderText,i=t._fragmentShaderText,o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,n),e.compileShader(o);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,i),e.compileShader(r);const s=e.createProgram();e.attachShader(s,o),e.attachShader(s,r);const a=t._attributeLocations;if(D(a))for(const h in a)a.hasOwnProperty(h)&&e.bindAttribLocation(s,a[h],h);let c,l;if(e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return t._logShaderCompilation&&(c=e.getShaderInfoLog(o),D(c)&&c.length,c=e.getShaderInfoLog(r),D(c)&&c.length,c=e.getProgramInfoLog(s),D(c)&&c.length),e.deleteShader(o),e.deleteShader(r),s;const u=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(c=e.getProgramInfoLog(s),d(o,"vertex"),d(r,"fragment"),l=`Program failed to link. Link log: ${c}`):(c=e.getShaderInfoLog(o),l=`Vertex shader failed to compile. Compile log: ${c}`):(c=e.getShaderInfoLog(r),l=`Fragment shader failed to compile. Compile log: ${c}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new be(l);function d(e,t){D(u)&&u.getTranslatedShaderSource(e)}}(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=function(e,t){const n={},i=[],o=[],r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){const r=e.getActiveUniform(t,s),a="[0]",c=-1!==r.name.indexOf(a,r.name.length-a.length)?r.name.slice(0,r.name.length-3):r.name;if(0!==c.indexOf("gl_"))if(r.name.indexOf("[")<0){const s=e.getUniformLocation(t,c);if(null!==s){const t=Hs(e,r,c,s);n[c]=t,i.push(t),t._setSampler&&o.push(t)}}else{let s,a,l,u;const d=c.indexOf("[");if(d>=0){if(s=n[c.slice(0,d)],!D(s))continue;a=s._locations,a.length<=1&&(l=s.value,u=e.getUniformLocation(t,c),null!==u&&(a.push(u),l.push(e.getUniform(t,u))))}else{a=[];for(let n=0;n<r.size;++n)u=e.getUniformLocation(t,`${c}[${n}]`),null!==u&&a.push(u);s=oa(e,r,c,a),n[c]=s,i.push(s),s._setSampler&&o.push(s)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}(n,i),s=function(e,t){const n=[],i=[];for(const o in t)if(t.hasOwnProperty(o)){const r=t[o];let s=o;const a=e._duplicateUniformNames[s];D(a)&&(r.name=a,s=a);const c=Ue[s];D(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=function(e,t,n){const i={};for(let o=0;o<n;++o){const n=e.getActiveAttrib(t,o),r=e.getAttribLocation(t,n.name);i[n.name]={name:n.name,type:n.type,index:r}}return i}(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=function(e,t,n){e.useProgram(t);let i=0;const o=n.length;for(let r=0;r<o;++r)i=n[r]._setSampler(i);return e.useProgram(null),i}(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),"undefined"!=typeof spector&&(e._program.__SPECTOR_rebuildProgram=function(t,n,i,o){const r=e._vertexShaderText,s=e._fragmentShaderText,a=/ ! = /g;e._vertexShaderText=t.replace(a," != "),e._fragmentShaderText=n.replace(a," != ");try{Aa(e),i(e._program)}catch(c){e._vertexShaderText=r,e._fragmentShaderText=s;const t=/(?:Compile|Link) error: ([^]*)/.exec(c.message);o(t?t[1]:c.message)}})}function Ta(e){this._context=e}let wa;ya.prototype._bind=function(){va(this),this._gl.useProgram(this._program)},ya.prototype._setUniforms=function(e,t,n){let i,o;if(D(e)){const t=this._manualUniforms;for(i=t.length,o=0;o<i;++o){const n=t[o];n.value=e[n.name]()}}const r=this._automaticUniforms;for(i=r.length,o=0;o<i;++o){const e=r[o];e.uniform.value=e.automaticUniform.getValue(t)}const s=this._uniforms;for(i=s.length,o=0;o<i;++o)s[o].set();if(n){const e=this._gl,t=this._program;if(e.validateProgram(t),!e.getProgramParameter(t,e.VALIDATE_STATUS))throw new P(`Program validation failed. Program info log: ${e.getProgramInfoLog(t)}`)}},ya.prototype.isDestroyed=function(){return!1},ya.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)},ya.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),He(this)};const Ea=new Kr({primitiveType:Vr.TRIANGLES}),xa=new Bt({color:new Ot(0,0,0,0)});Ta.prototype.execute=function(e){if(L.defined("computeCommand",e),D(e.preExecute)&&e.preExecute(e),!D(e.fragmentShaderSource)&&!D(e.shaderProgram))throw new P("computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.");L.defined("computeCommand.outputTexture",e.outputTexture);const t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=D(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=D(e.shaderProgram)?e.shaderProgram:function(e,t){return ya.fromCache({context:e,vertexShaderSource:Hr,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}(o,e.fragmentShaderSource),a=function(e,t){return new cs({context:e,colorTextures:[t],destroyAttachments:!1})}(o,t),c=function(e,t){return D(wa)&&wa.viewport.width===e&&wa.viewport.height===t||(wa=_s.fromCache({viewport:new Fr(0,0,e,t)})),wa}(n,i),l=e.uniformMap,u=xa;u.framebuffer=a,u.renderState=c,u.execute(o);const d=Ea;d.vertexArray=r,d.renderState=c,d.shaderProgram=s,d.uniformMap=l,d.framebuffer=a,d.execute(o),a.destroy(),e.persists||(s.destroy(),D(e.vertexArray)&&r.destroy()),D(e.postExecute)&&e.postExecute(t)},Ta.prototype.isDestroyed=function(){return!1},Ta.prototype.destroy=function(){return He(this)};const Sa={BYTE:Me.BYTE,UNSIGNED_BYTE:Me.UNSIGNED_BYTE,SHORT:Me.SHORT,UNSIGNED_SHORT:Me.UNSIGNED_SHORT,INT:Me.INT,UNSIGNED_INT:Me.UNSIGNED_INT,FLOAT:Me.FLOAT,DOUBLE:Me.DOUBLE,getSizeInBytes:function(e){if(!D(e))throw new P("value is required.");switch(e){case Sa.BYTE:return Int8Array.BYTES_PER_ELEMENT;case Sa.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Sa.SHORT:return Int16Array.BYTES_PER_ELEMENT;case Sa.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Sa.INT:return Int32Array.BYTES_PER_ELEMENT;case Sa.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Sa.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case Sa.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new P("componentDatatype is not a valid value.")}},fromTypedArray:function(e){if(e instanceof Int8Array)return Sa.BYTE;if(e instanceof Uint8Array)return Sa.UNSIGNED_BYTE;if(e instanceof Int16Array)return Sa.SHORT;if(e instanceof Uint16Array)return Sa.UNSIGNED_SHORT;if(e instanceof Int32Array)return Sa.INT;if(e instanceof Uint32Array)return Sa.UNSIGNED_INT;if(e instanceof Float32Array)return Sa.FLOAT;if(e instanceof Float64Array)return Sa.DOUBLE;throw new P("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")},validate:function(e){return D(e)&&(e===Sa.BYTE||e===Sa.UNSIGNED_BYTE||e===Sa.SHORT||e===Sa.UNSIGNED_SHORT||e===Sa.INT||e===Sa.UNSIGNED_INT||e===Sa.FLOAT||e===Sa.DOUBLE)},createTypedArray:function(e,t){if(!D(e))throw new P("componentDatatype is required.");if(!D(t))throw new P("valuesOrLength is required.");switch(e){case Sa.BYTE:return new Int8Array(t);case Sa.UNSIGNED_BYTE:return new Uint8Array(t);case Sa.SHORT:return new Int16Array(t);case Sa.UNSIGNED_SHORT:return new Uint16Array(t);case Sa.INT:return new Int32Array(t);case Sa.UNSIGNED_INT:return new Uint32Array(t);case Sa.FLOAT:return new Float32Array(t);case Sa.DOUBLE:return new Float64Array(t);default:throw new P("componentDatatype is not a valid value.")}},createArrayBufferView:function(e,t,n,i){if(!D(e))throw new P("componentDatatype is required.");if(!D(t))throw new P("buffer is required.");switch(n=M(n,0),i=M(i,(t.byteLength-n)/Sa.getSizeInBytes(e)),e){case Sa.BYTE:return new Int8Array(t,n,i);case Sa.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case Sa.SHORT:return new Int16Array(t,n,i);case Sa.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case Sa.INT:return new Int32Array(t,n,i);case Sa.UNSIGNED_INT:return new Uint32Array(t,n,i);case Sa.FLOAT:return new Float32Array(t,n,i);case Sa.DOUBLE:return new Float64Array(t,n,i);default:throw new P("componentDatatype is not a valid value.")}},fromName:function(e){switch(e){case"BYTE":return Sa.BYTE;case"UNSIGNED_BYTE":return Sa.UNSIGNED_BYTE;case"SHORT":return Sa.SHORT;case"UNSIGNED_SHORT":return Sa.UNSIGNED_SHORT;case"INT":return Sa.INT;case"UNSIGNED_INT":return Sa.UNSIGNED_INT;case"FLOAT":return Sa.FLOAT;case"DOUBLE":return Sa.DOUBLE;default:throw new P("name is not a valid value.")}}},Ca=Object.freeze(Sa),Ia={};function Oa(e,t){if(!D(e))throw new P("identifier is required.");D(Ia[e])||(Ia[e]=!0)}function Da(e,t){if(!D(e)||!D(t))throw new P("identifier and message are required.");Oa(e)}Oa.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.",Oa.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",Oa.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",Oa.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";const Pa=Object.freeze({NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3});function Na(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.attributes",e.attributes),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=M(e.primitiveType,Vr.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=M(e.geometryType,Pa.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Na.computeNumberOfVertices=function(e){L.typeOf.object("geometry",e);let t=-1;for(const n in e.attributes)if(e.attributes.hasOwnProperty(n)&&D(e.attributes[n])&&D(e.attributes[n].values)){const i=e.attributes[n],o=i.values.length/i.componentsPerAttribute;if(t!==o&&-1!==t)throw new P("All attribute lists must have the same number of attributes.");t=o}return t};const Ra=new Qt,La=new H,Ma=new ve,Fa=[new Qt,new Qt,new Qt],Ba=[new kt,new kt,new kt],za=[new kt,new kt,new kt],Ua=new H,ka=new _o,Va=new ve,Ha=new Ms;function Ga(e){if(!D((e=M(e,M.EMPTY_OBJECT)).componentDatatype))throw new P("options.componentDatatype is required.");if(!D(e.componentsPerAttribute))throw new P("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new P("options.componentsPerAttribute must be between 1 and 4.");if(!D(e.values))throw new P("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=M(e.normalize,!1),this.values=e.values}function ja(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}function Wa(){if(!D(Qa._canTransferArrayBuffer)){const t=Xa("transferTypedArrayTest");t.postMessage=M(t.webkitPostMessage,t.postMessage);const n=99,i=new Int8Array([n]);try{t.postMessage({array:i},[i.buffer])}catch(e){return Qa._canTransferArrayBuffer=!1,Qa._canTransferArrayBuffer}Qa._canTransferArrayBuffer=new Promise((e=>{t.onmessage=function(i){const o=i.data.array,r=D(o)&&o[0]===n;e(r),t.terminate(),Qa._canTransferArrayBuffer=r}}))}return Qa._canTransferArrayBuffer}Na._textureCoordinateRotationPoints=function(e,t,n,i){let o;const r=Ir.center(i,Ra),s=Qt.toCartesian(r,n,La),a=Cr.eastNorthUpToFixedFrame(s,n,Ma),c=ve.inverse(a,Ma),l=Ba,u=Fa;u[0].longitude=i.west,u[0].latitude=i.south,u[1].longitude=i.west,u[1].latitude=i.north,u[2].longitude=i.east,u[2].latitude=i.south;let d=Ua;for(o=0;o<3;o++)Qt.toCartesian(u[o],n,d),d=ve.multiplyByPointAsVector(c,d,d),l[o].x=d.x,l[o].y=d.y;const h=_o.fromAxisAngle(H.UNIT_Z,-t,ka),p=re.fromQuaternion(h,Va),f=e.length;let m=Number.POSITIVE_INFINITY,_=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,y=Number.NEGATIVE_INFINITY;for(o=0;o<f;o++)d=ve.multiplyByPointAsVector(c,e[o],d),d=re.multiplyByVector(p,d,d),m=Math.min(m,d.x),_=Math.min(_,d.y),g=Math.max(g,d.x),y=Math.max(y,d.y);const b=Ms.fromRotation(t,Ha),v=za;v[0].x=m,v[0].y=_,v[1].x=m,v[1].y=y,v[2].x=g,v[2].y=_;const A=l[0],T=l[2].x-A.x,w=l[1].y-A.y;for(o=0;o<3;o++){const e=v[o];Ms.multiplyByVector(b,e,e),e.x=(e.x-A.x)/T,e.y=(e.y-A.y)/w}const E=v[0],x=v[1],S=v[2],C=new Array(6);return kt.pack(E,C),kt.pack(x,C,2),kt.pack(S,C,4),C},Object.defineProperties(ja.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}}),ja.clone=function(e){if(D(e))return new ja(e._format,e._datatype,e._width,e._height,e._buffer)},ja.prototype.clone=function(){return ja.clone(this)};const qa=new gi;function Ya(e){let t;try{t=new Blob([e],{type:"application/javascript"})}catch(n){const i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);i.append(e),t=i.getBlob("application/javascript")}return(window.URL||window.webkitURL).createObjectURL(t)}function Xa(e){const t=new ei(e),n=0!==t.scheme().length&&0===t.fragment().length,i={};let o;if(ui(e)){return o=Ya(`importScripts("${e}");`),new Worker(o,i)}const r=e.replace(/\.js$/,"");if(!n&&"undefined"!=typeof CESIUM_WORKERS){const e=`\n importScripts("${Ya(CESIUM_WORKERS)}");\n CesiumWorkers["${r}"]();\n `;return o=Ya(e),new Worker(o,i)}if(o=e,n||(o=lo(`${Qa._workerModulePrefix+r}.js`)),!Ct.supportsEsmWebWorkers())throw new be("This browser is not supported. Please update your browser to continue.");return i.type="module",new Worker(o,i)}function Qa(e,t){this._workerPath=e,this._maximumActiveTasks=M(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._nextID=0,this._webAssemblyPromise=void 0}const $a=[];async function Ka(e,t,n){const i=await Promise.resolve(Wa());D(n)?i||(n.length=0):n=$a;const o=e._nextID++,r=new Promise(((t,n)=>{e._worker.addEventListener("message",((e,t,n,i)=>{const o=({data:r})=>{if(r.id===t){if(D(r.error)){let e=r.error;"RuntimeError"===e.name?(e=new be(r.error.message),e.stack=r.error.stack):"DeveloperError"===e.name?(e=new P(r.error.message),e.stack=r.error.stack):"Error"===e.name&&(e=new Error(r.error.message),e.stack=r.error.stack),qa.raiseEvent(e),i(e)}else qa.raiseEvent(),n(r.result);e.removeEventListener("message",o)}};return o})(e._worker,o,t,n))}));return e._worker.postMessage({id:o,baseUrl:lo.getCesiumBaseUrl().url,parameters:t,canTransferArrayBuffer:i},n),r}function Za(){}let Ja;function ec(e){let t;if(L.defined("resourceOrUrlOrBuffer",e),e instanceof ArrayBuffer||ArrayBuffer.isView(e))t=Promise.resolve(e);else{t=Bi.createIfNeeded(e).fetchArrayBuffer()}return t.then((function(e){return Za.transcode(e,Ja)}))}function tc(e,t,n,i,o,r,s,a,c,l,u){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=s,this._internalFormat=o,this._pixelFormat=r,this._size=a,this._preMultiplyAlpha=c,this._flipY=l,this._initialized=u}Qa.prototype.scheduleTask=function(e,t){if(D(this._worker)||(this._worker=Xa(this._workerPath)),!(this._activeTasks>=this._maximumActiveTasks))return async function(e,t,n){++e._activeTasks;try{const i=await Ka(e,t,n);return--e._activeTasks,i}catch(i){throw--e._activeTasks,i}}(this,e,t)},Qa.prototype.initWebAssemblyModule=async function(e){if(D(this._webAssemblyPromise))return this._webAssemblyPromise;return this._webAssemblyPromise=(async()=>{const t=this._worker=Xa(this._workerPath),n=await async function(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Ct.supportsWebAssembly()){if(!D(t.fallbackModulePath))throw new be(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=lo(t.fallbackModulePath),n}n.wasmBinaryFile=lo(t.wasmBinaryFile);const i=await Bi.fetchArrayBuffer({url:n.wasmBinaryFile});return n.wasmBinary=i,n}(this,e),i=await Promise.resolve(Wa());let o;const r=n.wasmBinary;D(r)&&i&&(o=[r]);const s=new Promise(((e,n)=>{t.onmessage=function({data:t}){D(t)?e(t.result):n(new be("Could not configure wasm module"))}}));return t.postMessage({canTransferArrayBuffer:i,parameters:{webAssemblyConfig:n}},o),s})(),this._webAssemblyPromise},Qa.prototype.isDestroyed=function(){return!1},Qa.prototype.destroy=function(){return D(this._worker)&&this._worker.terminate(),He(this)},Qa.taskCompletedEvent=qa,Qa._defaultWorkerModulePrefix="Workers/",Qa._workerModulePrefix=Qa._defaultWorkerModulePrefix,Qa._canTransferArrayBuffer=void 0,Za._transcodeTaskProcessor=new Qa("transcodeKTX2",Number.POSITIVE_INFINITY),Za._readyPromise=void 0,Za.transcode=function(e,t){return L.defined("supportedTargetFormats",t),D(Za._readyPromise)||function(){const e=Za._transcodeTaskProcessor.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then((function(e){if(e)return Za._transcodeTaskProcessor;throw new be("KTX2 transcoder could not be initialized.")}));Za._readyPromise=e}(),Za._readyPromise.then((function(n){let i;if(e instanceof ArrayBuffer){const o=new Uint8Array(e);return i={supportedTargetFormats:t,ktx2Buffer:o},n.scheduleTask(i,[e])}return i={supportedTargetFormats:t,ktx2Buffer:e},n.scheduleTask(i,[e.buffer])})).then((function(e){const t=e.length,n=Object.keys(e[0]),i=n.length;let o;for(o=0;o<t;o++){const t=e[o];for(let e=0;e<i;e++){const i=t[n[e]];t[n[e]]=new ja(i.internalFormat,i.datatype,i.width,i.height,i.levelBuffer)}}if(1===i){for(o=0;o<t;++o)e[o]=e[o][n[0]];1===t&&(e=e[0])}return e})).catch((function(e){throw e}))},ec.setKTX2SupportedFormats=function(e,t,n,i,o,r){Ja={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}},Object.defineProperties(tc.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}}),tc.prototype.copyFrom=function(e){L.defined("options",e);const t=M(e.xOffset,0),n=M(e.yOffset,0);if(L.defined("options.source",e.source),L.typeOf.number.greaterThanOrEquals("xOffset",t,0),L.typeOf.number.greaterThanOrEquals("yOffset",n,0),t+e.source.width>this._size)throw new P("xOffset + options.source.width must be less than or equal to width.");if(n+e.source.height>this._size)throw new P("yOffset + options.source.height must be less than or equal to height.");const i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);const a=i.width,c=i.height;let l=i.arrayBufferView;const u=this._size,d=this._pixelFormat,h=this._internalFormat,p=this._pixelDatatype,f=this._preMultiplyAlpha,m=this._flipY,_=M(e.skipColorSpaceConversion,!1);let g=4;D(l)&&(g=is.alignmentInBytes(d,p,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,g),_?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let y=!1;if(!this._initialized){if(0===t&&0===n&&a===u&&c===u)D(l)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),m&&(l=is.flipY(l,d,p,u,u)),o.texImage2D(s,0,h,u,u,0,d,ts.toWebGLConstant(p,this._context),l)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,m),o.texImage2D(s,0,h,d,ts.toWebGLConstant(p,this._context),i)),y=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);const e=is.createTypedArray(d,p,u,u);o.texImage2D(s,0,h,u,u,0,d,ts.toWebGLConstant(p,this._context),e)}this._initialized=!0}y||(D(l)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),m&&(l=is.flipY(l,d,p,a,c)),o.texSubImage2D(s,0,t,n,a,c,d,ts.toWebGLConstant(p,this._context),l)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,m),o.texSubImage2D(s,0,t,n,d,ts.toWebGLConstant(p,this._context),i))),o.bindTexture(r,null)},tc.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=M(e,0),t=M(t,0),n=M(n,0),i=M(i,0),o=M(o,this._size),r=M(r,this._size),L.typeOf.number.greaterThanOrEquals("xOffset",e,0),L.typeOf.number.greaterThanOrEquals("yOffset",t,0),L.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),L.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),e+o>this._size)throw new P("xOffset + source.width must be less than or equal to width.");if(t+r>this._size)throw new P("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===ts.FLOAT)throw new P("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===ts.HALF_FLOAT)throw new P("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(this._targetFace,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};const nc={DONT_CARE:Me.DONT_CARE,FASTEST:Me.FASTEST,NICEST:Me.NICEST,validate:function(e){return e===nc.DONT_CARE||e===nc.FASTEST||e===nc.NICEST}},ic=Object.freeze(nc),oc={NEAREST:Me.NEAREST,LINEAR:Me.LINEAR,validate:function(e){return e===oc.NEAREST||e===oc.LINEAR}},rc=Object.freeze(oc),sc={NEAREST:Me.NEAREST,LINEAR:Me.LINEAR,NEAREST_MIPMAP_NEAREST:Me.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:Me.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:Me.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:Me.LINEAR_MIPMAP_LINEAR,validate:function(e){return e===sc.NEAREST||e===sc.LINEAR||e===sc.NEAREST_MIPMAP_NEAREST||e===sc.LINEAR_MIPMAP_NEAREST||e===sc.NEAREST_MIPMAP_LINEAR||e===sc.LINEAR_MIPMAP_LINEAR}},ac=Object.freeze(sc),cc={CLAMP_TO_EDGE:Me.CLAMP_TO_EDGE,REPEAT:Me.REPEAT,MIRRORED_REPEAT:Me.MIRRORED_REPEAT,validate:function(e){return e===cc.CLAMP_TO_EDGE||e===cc.REPEAT||e===cc.MIRRORED_REPEAT}},lc=Object.freeze(cc);function uc(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.wrapS,lc.CLAMP_TO_EDGE),n=M(e.wrapT,lc.CLAMP_TO_EDGE),i=M(e.minificationFilter,ac.LINEAR),o=M(e.magnificationFilter,rc.LINEAR),r=D(e.maximumAnisotropy)?e.maximumAnisotropy:1;if(!lc.validate(t))throw new P("Invalid sampler.wrapS.");if(!lc.validate(n))throw new P("Invalid sampler.wrapT.");if(!ac.validate(i))throw new P("Invalid sampler.minificationFilter.");if(!rc.validate(o))throw new P("Invalid sampler.magnificationFilter.");L.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}function dc(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context);const t=e.context,n=e.source;let i,o;if(D(n)){const e=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];if(!(e[0]&&e[1]&&e[2]&&e[3]&&e[4]&&e[5]))throw new P("options.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.");i=e[0].width,o=e[0].height;for(let t=1;t<6;++t)if(Number(e[t].width)!==i||Number(e[t].height)!==o)throw new P("Each face in options.source must have the same width and height.")}else i=e.width,o=e.height;const r=i,s=M(e.pixelDatatype,ts.UNSIGNED_BYTE),a=M(e.pixelFormat,is.RGBA),c=is.toInternalFormat(a,s,t);if(!D(i)||!D(o))throw new P("options requires a source field to create an initialized cube map or width and height fields to create a blank cube map.");if(i!==o)throw new P("Width must equal height.");if(r<=0)throw new P("Width and height must be greater than zero.");if(r>rs.maximumCubeMapSize)throw new P(`Width and height must be less than or equal to the maximum cube map size (${rs.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!is.validate(a))throw new P("Invalid options.pixelFormat.");if(is.isDepthFormat(a))throw new P("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!ts.validate(s))throw new P("Invalid options.pixelDatatype.");if(s===ts.FLOAT&&!t.floatingPointTexture)throw new P("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(s===ts.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new P("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension.");const l=6*is.textureSizeInBytes(a,s,r,r),u=e.preMultiplyAlpha||a===is.RGB||a===is.LUMINANCE,d=M(e.flipY,!0),h=M(e.skipColorSpaceConversion,!1),p=t._gl,f=p.TEXTURE_CUBE_MAP,m=p.createTexture();function _(e,n,o,l,u){let d=n.arrayBufferView;D(d)||(d=n.bufferView);let h=4;D(d)&&(h=is.alignmentInBytes(a,s,i)),p.pixelStorei(p.UNPACK_ALIGNMENT,h),u?p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.NONE):p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.BROWSER_DEFAULT_WEBGL),D(d)?(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!1),l&&(d=is.flipY(d,a,s,r,r)),p.texImage2D(e,0,c,r,r,0,a,ts.toWebGLConstant(s,t),d)):(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,l),p.texImage2D(e,0,c,a,ts.toWebGLConstant(s,t),n))}p.activeTexture(p.TEXTURE0),p.bindTexture(f,m),D(n)?(_(p.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,u,d,h),_(p.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,u,d,h),_(p.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,u,d,h),_(p.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,u,d,h),_(p.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,u,d,h),_(p.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,u,d,h)):(p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_X,0,c,r,r,0,a,ts.toWebGLConstant(s,t),null),p.texImage2D(p.TEXTURE_CUBE_MAP_NEGATIVE_X,0,c,r,r,0,a,ts.toWebGLConstant(s,t),null),p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_Y,0,c,r,r,0,a,ts.toWebGLConstant(s,t),null),p.texImage2D(p.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,c,r,r,0,a,ts.toWebGLConstant(s,t),null),p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_Z,0,c,r,r,0,a,ts.toWebGLConstant(s,t),null),p.texImage2D(p.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,c,r,r,0,a,ts.toWebGLConstant(s,t),null)),p.bindTexture(f,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=f,this._texture=m,this._pixelFormat=a,this._pixelDatatype=s,this._size=r,this._hasMipmap=!1,this._sizeInBytes=l,this._preMultiplyAlpha=u,this._flipY=d,this._sampler=void 0;const g=D(n);this._positiveX=new tc(t,m,f,p.TEXTURE_CUBE_MAP_POSITIVE_X,c,a,s,r,u,d,g),this._negativeX=new tc(t,m,f,p.TEXTURE_CUBE_MAP_NEGATIVE_X,c,a,s,r,u,d,g),this._positiveY=new tc(t,m,f,p.TEXTURE_CUBE_MAP_POSITIVE_Y,c,a,s,r,u,d,g),this._negativeY=new tc(t,m,f,p.TEXTURE_CUBE_MAP_NEGATIVE_Y,c,a,s,r,u,d,g),this._positiveZ=new tc(t,m,f,p.TEXTURE_CUBE_MAP_POSITIVE_Z,c,a,s,r,u,d,g),this._negativeZ=new tc(t,m,f,p.TEXTURE_CUBE_MAP_NEGATIVE_Z,c,a,s,r,u,d,g),this.sampler=D(e.sampler)?e.sampler:new uc}function hc(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}Object.defineProperties(uc.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}}}),uc.equals=function(e,t){return e===t||D(e)&&D(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy},uc.NEAREST=Object.freeze(new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:ac.NEAREST,magnificationFilter:rc.NEAREST})),Object.defineProperties(dc.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=t===ac.NEAREST_MIPMAP_NEAREST||t===ac.NEAREST_MIPMAP_LINEAR||t===ac.LINEAR_MIPMAP_NEAREST||t===ac.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===ts.FLOAT&&!o.textureFloatLinear||r===ts.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?ac.NEAREST_MIPMAP_NEAREST:ac.NEAREST,n=rc.NEAREST);const s=o._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.texParameteri(a,s.TEXTURE_MIN_FILTER,t),s.texParameteri(a,s.TEXTURE_MAG_FILTER,n),s.texParameteri(a,s.TEXTURE_WRAP_S,e.wrapS),s.texParameteri(a,s.TEXTURE_WRAP_T,e.wrapT),D(this._textureFilterAnisotropic)&&s.texParameteri(a,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),s.bindTexture(a,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(4*this._sizeInBytes/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}}),dc.prototype.generateMipmap=function(e){if(e=M(e,ic.DONT_CARE),this._size>1&&!V.isPowerOfTwo(this._size))throw new P("width and height must be a power of two to call generateMipmap().");if(!ic.validate(e))throw new P("hint is invalid.");this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)},dc.prototype.isDestroyed=function(){return!1},dc.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=He(this._positiveX),this._negativeX=He(this._negativeX),this._positiveY=He(this._positiveY),this._negativeY=He(this._negativeY),this._positiveZ=He(this._positiveZ),this._negativeZ=He(this._negativeZ),He(this)};const pc={czm_degreesPerRadian:"/**\n * A built-in GLSL floating-point constant for converting radians to degrees.\n *\n * @alias czm_degreesPerRadian\n * @glslConstant\n *\n * @see CesiumMath.DEGREES_PER_RADIAN\n *\n * @example\n * // GLSL declaration\n * const float czm_degreesPerRadian = ...;\n *\n * // Example\n * float deg = czm_degreesPerRadian * rad;\n */\nconst float czm_degreesPerRadian = 57.29577951308232;\n",czm_depthRange:"/**\n * A built-in GLSL vec2 constant for defining the depth range.\n * This is a workaround to a bug where IE11 does not implement gl_DepthRange.\n *\n * @alias czm_depthRange\n * @glslConstant\n *\n * @example\n * // GLSL declaration\n * float depthRangeNear = czm_depthRange.near;\n * float depthRangeFar = czm_depthRange.far;\n *\n */\nconst czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n",czm_epsilon1:"/**\n * 0.1\n *\n * @name czm_epsilon1\n * @glslConstant\n */\nconst float czm_epsilon1 = 0.1;\n",czm_epsilon2:"/**\n * 0.01\n *\n * @name czm_epsilon2\n * @glslConstant\n */\nconst float czm_epsilon2 = 0.01;\n",czm_epsilon3:"/**\n * 0.001\n *\n * @name czm_epsilon3\n * @glslConstant\n */\nconst float czm_epsilon3 = 0.001;\n",czm_epsilon4:"/**\n * 0.0001\n *\n * @name czm_epsilon4\n * @glslConstant\n */\nconst float czm_epsilon4 = 0.0001;\n",czm_epsilon5:"/**\n * 0.00001\n *\n * @name czm_epsilon5\n * @glslConstant\n */\nconst float czm_epsilon5 = 0.00001;\n",czm_epsilon6:"/**\n * 0.000001\n *\n * @name czm_epsilon6\n * @glslConstant\n */\nconst float czm_epsilon6 = 0.000001;\n",czm_epsilon7:"/**\n * 0.0000001\n *\n * @name czm_epsilon7\n * @glslConstant\n */\nconst float czm_epsilon7 = 0.0000001;\n",czm_infinity:"/**\n * DOC_TBA\n *\n * @name czm_infinity\n * @glslConstant\n */\nconst float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?\n",czm_oneOverPi:"/**\n * A built-in GLSL floating-point constant for <code>1/pi</code>.\n *\n * @alias czm_oneOverPi\n * @glslConstant\n *\n * @see CesiumMath.ONE_OVER_PI\n *\n * @example\n * // GLSL declaration\n * const float czm_oneOverPi = ...;\n *\n * // Example\n * float pi = 1.0 / czm_oneOverPi;\n */\nconst float czm_oneOverPi = 0.3183098861837907;\n",czm_oneOverTwoPi:"/**\n * A built-in GLSL floating-point constant for <code>1/2pi</code>.\n *\n * @alias czm_oneOverTwoPi\n * @glslConstant\n *\n * @see CesiumMath.ONE_OVER_TWO_PI\n *\n * @example\n * // GLSL declaration\n * const float czm_oneOverTwoPi = ...;\n *\n * // Example\n * float pi = 2.0 * czm_oneOverTwoPi;\n */\nconst float czm_oneOverTwoPi = 0.15915494309189535;\n",czm_passCesium3DTile:"/**\n * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}\n *\n * @name czm_passCesium3DTile\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCesium3DTile = 4.0;\n",czm_passCesium3DTileClassification:"/**\n * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}\n *\n * @name czm_passCesium3DTileClassification\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCesium3DTileClassification = 5.0;\n",czm_passCesium3DTileClassificationIgnoreShow:"/**\n * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}\n *\n * @name czm_passCesium3DTileClassificationIgnoreShow\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCesium3DTileClassificationIgnoreShow = 6.0;\n",czm_passClassification:"/**\n * The automatic GLSL constant for {@link Pass#CLASSIFICATION}\n *\n * @name czm_passClassification\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passClassification = 7.0;\n",czm_passCompute:"/**\n * The automatic GLSL constant for {@link Pass#COMPUTE}\n *\n * @name czm_passCompute\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCompute = 1.0;\n",czm_passEnvironment:"/**\n * The automatic GLSL constant for {@link Pass#ENVIRONMENT}\n *\n * @name czm_passEnvironment\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passEnvironment = 0.0;\n",czm_passGlobe:"/**\n * The automatic GLSL constant for {@link Pass#GLOBE}\n *\n * @name czm_passGlobe\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passGlobe = 2.0;\n",czm_passOpaque:"/**\n * The automatic GLSL constant for {@link Pass#OPAQUE}\n *\n * @name czm_passOpaque\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passOpaque = 7.0;\n",czm_passOverlay:"/**\n * The automatic GLSL constant for {@link Pass#OVERLAY}\n *\n * @name czm_passOverlay\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passOverlay = 10.0;\n",czm_passTerrainClassification:"/**\n * The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}\n *\n * @name czm_passTerrainClassification\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passTerrainClassification = 3.0;\n",czm_passTranslucent:"/**\n * The automatic GLSL constant for {@link Pass#TRANSLUCENT}\n *\n * @name czm_passTranslucent\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passTranslucent = 8.0;\n",czm_passVoxels:"/**\n * The automatic GLSL constant for {@link Pass#VOXELS}\n *\n * @name czm_passVoxels\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passVoxels = 9.0;\n",czm_pi:"/**\n * A built-in GLSL floating-point constant for <code>Math.PI</code>.\n *\n * @alias czm_pi\n * @glslConstant\n *\n * @see CesiumMath.PI\n *\n * @example\n * // GLSL declaration\n * const float czm_pi = ...;\n *\n * // Example\n * float twoPi = 2.0 * czm_pi;\n */\nconst float czm_pi = 3.141592653589793;\n",czm_piOverFour:"/**\n * A built-in GLSL floating-point constant for <code>pi/4</code>.\n *\n * @alias czm_piOverFour\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_FOUR\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverFour = ...;\n *\n * // Example\n * float pi = 4.0 * czm_piOverFour;\n */\nconst float czm_piOverFour = 0.7853981633974483;\n",czm_piOverSix:"/**\n * A built-in GLSL floating-point constant for <code>pi/6</code>.\n *\n * @alias czm_piOverSix\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_SIX\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverSix = ...;\n *\n * // Example\n * float pi = 6.0 * czm_piOverSix;\n */\nconst float czm_piOverSix = 0.5235987755982988;\n",czm_piOverThree:"/**\n * A built-in GLSL floating-point constant for <code>pi/3</code>.\n *\n * @alias czm_piOverThree\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_THREE\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverThree = ...;\n *\n * // Example\n * float pi = 3.0 * czm_piOverThree;\n */\nconst float czm_piOverThree = 1.0471975511965976;\n",czm_piOverTwo:"/**\n * A built-in GLSL floating-point constant for <code>pi/2</code>.\n *\n * @alias czm_piOverTwo\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_TWO\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverTwo = ...;\n *\n * // Example\n * float pi = 2.0 * czm_piOverTwo;\n */\nconst float czm_piOverTwo = 1.5707963267948966;\n",czm_radiansPerDegree:"/**\n * A built-in GLSL floating-point constant for converting degrees to radians.\n *\n * @alias czm_radiansPerDegree\n * @glslConstant\n *\n * @see CesiumMath.RADIANS_PER_DEGREE\n *\n * @example\n * // GLSL declaration\n * const float czm_radiansPerDegree = ...;\n *\n * // Example\n * float rad = czm_radiansPerDegree * deg;\n */\nconst float czm_radiansPerDegree = 0.017453292519943295;\n",czm_sceneMode2D:"/**\n * The constant identifier for the 2D {@link SceneMode}\n *\n * @name czm_sceneMode2D\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneModeColumbusView\n * @see czm_sceneMode3D\n * @see czm_sceneModeMorphing\n */\nconst float czm_sceneMode2D = 2.0;\n",czm_sceneMode3D:"/**\n * The constant identifier for the 3D {@link SceneMode}\n *\n * @name czm_sceneMode3D\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneMode2D\n * @see czm_sceneModeColumbusView\n * @see czm_sceneModeMorphing\n */\nconst float czm_sceneMode3D = 3.0;\n",czm_sceneModeColumbusView:"/**\n * The constant identifier for the Columbus View {@link SceneMode}\n *\n * @name czm_sceneModeColumbusView\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneMode2D\n * @see czm_sceneMode3D\n * @see czm_sceneModeMorphing\n */\nconst float czm_sceneModeColumbusView = 1.0;\n",czm_sceneModeMorphing:"/**\n * The constant identifier for the Morphing {@link SceneMode}\n *\n * @name czm_sceneModeMorphing\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneMode2D\n * @see czm_sceneModeColumbusView\n * @see czm_sceneMode3D\n */\nconst float czm_sceneModeMorphing = 0.0;\n",czm_solarRadius:"/**\n * A built-in GLSL floating-point constant for one solar radius.\n *\n * @alias czm_solarRadius\n * @glslConstant\n *\n * @see CesiumMath.SOLAR_RADIUS\n *\n * @example\n * // GLSL declaration\n * const float czm_solarRadius = ...;\n */\nconst float czm_solarRadius = 695500000.0;\n",czm_threePiOver2:"/**\n * A built-in GLSL floating-point constant for <code>3pi/2</code>.\n *\n * @alias czm_threePiOver2\n * @glslConstant\n *\n * @see CesiumMath.THREE_PI_OVER_TWO\n *\n * @example\n * // GLSL declaration\n * const float czm_threePiOver2 = ...;\n *\n * // Example\n * float pi = (2.0 / 3.0) * czm_threePiOver2;\n */\nconst float czm_threePiOver2 = 4.71238898038469;\n",czm_twoPi:"/**\n * A built-in GLSL floating-point constant for <code>2pi</code>.\n *\n * @alias czm_twoPi\n * @glslConstant\n *\n * @see CesiumMath.TWO_PI\n *\n * @example\n * // GLSL declaration\n * const float czm_twoPi = ...;\n *\n * // Example\n * float pi = czm_twoPi / 2.0;\n */\nconst float czm_twoPi = 6.283185307179586;\n",czm_webMercatorMaxLatitude:"/**\n * The maximum latitude, in radians, both North and South, supported by a Web Mercator\n * (EPSG:3857) projection. Technically, the Mercator projection is defined\n * for any latitude up to (but not including) 90 degrees, but it makes sense\n * to cut it off sooner because it grows exponentially with increasing latitude.\n * The logic behind this particular cutoff value, which is the one used by\n * Google Maps, Bing Maps, and Esri, is that it makes the projection\n * square. That is, the rectangle is equal in the X and Y directions.\n *\n * The constant value is computed as follows:\n * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))\n *\n * @name czm_webMercatorMaxLatitude\n * @glslConstant\n */\nconst float czm_webMercatorMaxLatitude = 1.4844222297453324;\n",czm_depthRangeStruct:"/**\n * @name czm_depthRangeStruct\n * @glslStruct\n */\nstruct czm_depthRangeStruct\n{\n float near;\n float far;\n};\n",czm_material:"/**\n * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.\n *\n * @name czm_material\n * @glslStruct\n *\n * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n * @property {float} specular Intensity of incoming light reflecting in a single direction.\n * @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n */\nstruct czm_material\n{\n vec3 diffuse;\n float specular;\n float shininess;\n vec3 normal;\n vec3 emission;\n float alpha;\n};\n",czm_materialInput:"/**\n * Used as input to every material's czm_getMaterial function.\n *\n * @name czm_materialInput\n * @glslStruct\n *\n * @property {float} s 1D texture coordinates.\n * @property {vec2} st 2D texture coordinates.\n * @property {vec3} str 3D texture coordinates.\n * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.\n * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.\n * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.\n * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.\n * @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials.\n * @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials.\n */\nstruct czm_materialInput\n{\n float s;\n vec2 st;\n vec3 str;\n vec3 normalEC;\n mat3 tangentToEyeMatrix;\n vec3 positionToEyeEC;\n float height;\n float slope;\n float aspect;\n};\n",czm_modelMaterial:"/**\n * Struct for representing a material for a {@link Model}. The model\n * rendering pipeline will pass this struct between material, custom shaders,\n * and lighting stages. This is not to be confused with {@link czm_material}\n * which is used by the older Fabric materials system, although they are similar.\n * <p>\n * All color values (diffuse, specular, emissive) are in linear color space.\n * </p>\n *\n * @name czm_modelMaterial\n * @glslStruct\n *\n * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n * @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.\n * @property {float} roughness A number from 0.0 to 1.0 representing how rough the surface is. Values near 0.0 produce glossy surfaces, while values near 1.0 produce rough surfaces.\n * @property {vec3} normalEC Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n * @property {float} occlusion Ambient occlusion recieved at this point on the material. 1.0 means fully lit, 0.0 means fully occluded.\n * @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n */\nstruct czm_modelMaterial {\n vec3 diffuse;\n float alpha;\n vec3 specular;\n float roughness;\n vec3 normalEC;\n float occlusion;\n vec3 emissive;\n};\n",czm_modelVertexOutput:"/**\n * Struct for representing the output of a custom vertex shader.\n * \n * @name czm_modelVertexOutput\n * @glslStruct\n *\n * @see {@link CustomShader}\n * @see {@link Model}\n *\n * @property {vec3} positionMC The position of the vertex in model coordinates\n * @property {float} pointSize A custom value for gl_PointSize. This is only used for point primitives. \n */\nstruct czm_modelVertexOutput {\n vec3 positionMC;\n float pointSize;\n};\n",czm_pbrParameters:"/**\n * Parameters for {@link czm_pbrLighting}\n *\n * @name czm_material\n * @glslStruct\n *\n * @property {vec3} diffuseColor the diffuse color of the material for the lambert term of the rendering equation\n * @property {float} roughness a value from 0.0 to 1.0 that indicates how rough the surface of the material is.\n * @property {vec3} f0 The reflectance of the material at normal incidence\n */\nstruct czm_pbrParameters\n{\n vec3 diffuseColor;\n float roughness;\n vec3 f0;\n};\n",czm_ray:"/**\n * DOC_TBA\n *\n * @name czm_ray\n * @glslStruct\n */\nstruct czm_ray\n{\n vec3 origin;\n vec3 direction;\n};\n",czm_raySegment:"/**\n * DOC_TBA\n *\n * @name czm_raySegment\n * @glslStruct\n */\nstruct czm_raySegment\n{\n float start;\n float stop;\n};\n\n/**\n * DOC_TBA\n *\n * @name czm_emptyRaySegment\n * @glslConstant \n */\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\n\n/**\n * DOC_TBA\n *\n * @name czm_fullRaySegment\n * @glslConstant \n */\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n",czm_shadowParameters:"struct czm_shadowParameters\n{\n#ifdef USE_CUBE_MAP_SHADOW\n vec3 texCoords;\n#else\n vec2 texCoords;\n#endif\n\n float depthBias;\n float depth;\n float nDotL;\n vec2 texelStepSize;\n float normalShadingSmooth;\n float darkness;\n};\n",czm_HSBToRGB:"/**\n * Converts an HSB color (hue, saturation, brightness) to RGB\n * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n *\n * @name czm_HSBToRGB\n * @glslFunction\n * \n * @param {vec3} hsb The color in HSB.\n *\n * @returns {vec3} The color in RGB.\n *\n * @example\n * vec3 hsb = czm_RGBToHSB(rgb);\n * hsb.z *= 0.1;\n * rgb = czm_HSBToRGB(hsb);\n */\n\nconst vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\nvec3 czm_HSBToRGB(vec3 hsb)\n{\n vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\n return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n}\n",czm_HSLToRGB:"/**\n * Converts an HSL color (hue, saturation, lightness) to RGB\n * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n *\n * @name czm_HSLToRGB\n * @glslFunction\n * \n * @param {vec3} rgb The color in HSL.\n *\n * @returns {vec3} The color in RGB.\n *\n * @example\n * vec3 hsl = czm_RGBToHSL(rgb);\n * hsl.z *= 0.1;\n * rgb = czm_HSLToRGB(hsl);\n */\n\nvec3 hueToRGB(float hue)\n{\n float r = abs(hue * 6.0 - 3.0) - 1.0;\n float g = 2.0 - abs(hue * 6.0 - 2.0);\n float b = 2.0 - abs(hue * 6.0 - 4.0);\n return clamp(vec3(r, g, b), 0.0, 1.0);\n}\n\nvec3 czm_HSLToRGB(vec3 hsl)\n{\n vec3 rgb = hueToRGB(hsl.x);\n float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n",czm_RGBToHSB:"/**\n * Converts an RGB color to HSB (hue, saturation, brightness)\n * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n *\n * @name czm_RGBToHSB\n * @glslFunction\n * \n * @param {vec3} rgb The color in RGB.\n *\n * @returns {vec3} The color in HSB.\n *\n * @example\n * vec3 hsb = czm_RGBToHSB(rgb);\n * hsb.z *= 0.1;\n * rgb = czm_HSBToRGB(hsb);\n */\n\nconst vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\nvec3 czm_RGBToHSB(vec3 rgb)\n{\n vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\n vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\n float d = q.x - min(q.w, q.y);\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n}\n",czm_RGBToHSL:"/**\n * Converts an RGB color to HSL (hue, saturation, lightness)\n * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n *\n * @name czm_RGBToHSL\n * @glslFunction\n * \n * @param {vec3} rgb The color in RGB.\n *\n * @returns {vec3} The color in HSL.\n *\n * @example\n * vec3 hsl = czm_RGBToHSL(rgb);\n * hsl.z *= 0.1;\n * rgb = czm_HSLToRGB(hsl);\n */\n \nvec3 RGBtoHCV(vec3 rgb)\n{\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 czm_RGBToHSL(vec3 rgb)\n{\n vec3 hcv = RGBtoHCV(rgb);\n float l = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\n return vec3(hcv.x, s, l);\n}\n",czm_RGBToXYZ:"/**\n * Converts an RGB color to CIE Yxy.\n * <p>The conversion is described in\n * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n * </p>\n * \n * @name czm_RGBToXYZ\n * @glslFunction\n * \n * @param {vec3} rgb The color in RGB.\n *\n * @returns {vec3} The color in CIE Yxy.\n *\n * @example\n * vec3 xyz = czm_RGBToXYZ(rgb);\n * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n * rgb = czm_XYZToRGB(xyz);\n */\nvec3 czm_RGBToXYZ(vec3 rgb)\n{\n const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n 0.3576, 0.7152, 0.1192,\n 0.1805, 0.0722, 0.9505);\n vec3 xyz = RGB2XYZ * rgb;\n vec3 Yxy;\n Yxy.r = xyz.g;\n float temp = dot(vec3(1.0), xyz);\n Yxy.gb = xyz.rg / temp;\n return Yxy;\n}\n",czm_XYZToRGB:"/**\n * Converts a CIE Yxy color to RGB.\n * <p>The conversion is described in\n * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n * </p>\n * \n * @name czm_XYZToRGB\n * @glslFunction\n * \n * @param {vec3} Yxy The color in CIE Yxy.\n *\n * @returns {vec3} The color in RGB.\n *\n * @example\n * vec3 xyz = czm_RGBToXYZ(rgb);\n * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n * rgb = czm_XYZToRGB(xyz);\n */\nvec3 czm_XYZToRGB(vec3 Yxy)\n{\n const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n -1.5371, 1.8760, -0.2040,\n -0.4985, 0.0416, 1.0572);\n vec3 xyz;\n xyz.r = Yxy.r * Yxy.g / Yxy.b;\n xyz.g = Yxy.r;\n xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\n \n return XYZ2RGB * xyz;\n}\n",czm_acesTonemapping:"// See:\n// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/\n\nvec3 czm_acesTonemapping(vec3 color) {\n float g = 0.985;\n float a = 0.065;\n float b = 0.0001;\n float c = 0.433;\n float d = 0.238;\n\n color = (color * (color + a) - b) / (color * (g * color + c) + d);\n\n color = clamp(color, 0.0, 1.0);\n\n return color;\n}\n",czm_alphaWeight:"/**\n * @private\n */\nfloat czm_alphaWeight(float a)\n{\n float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\n // See Weighted Blended Order-Independent Transparency for examples of different weighting functions:\n // http://jcgt.org/published/0002/02/09/\n return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n}\n",czm_antialias:"/**\n * Procedural anti-aliasing by blurring two colors that meet at a sharp edge.\n *\n * @name czm_antialias\n * @glslFunction\n *\n * @param {vec4} color1 The color on one side of the edge.\n * @param {vec4} color2 The color on the other side of the edge.\n * @param {vec4} currentcolor The current color, either <code>color1</code> or <code>color2</code>.\n * @param {float} dist The distance to the edge in texture coordinates.\n * @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.\n * @returns {vec4} The anti-aliased color.\n *\n * @example\n * // GLSL declarations\n * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);\n * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);\n *\n * // get the color for a material that has a sharp edge at the line y = 0.5 in texture space\n * float dist = abs(textureCoordinates.t - 0.5);\n * vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));\n * vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);\n */\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\n float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\n float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\n val1 = val1 * (1.0 - val2);\n val1 = val1 * val1 * (3.0 - (2.0 * val1));\n val1 = pow(val1, 0.5); //makes the transition nicer\n \n vec4 midColor = (color1 + color2) * 0.5;\n return mix(midColor, currentColor, val1);\n}\n\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\n return czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n",czm_applyHSBShift:"/**\n * Apply a HSB color shift to an RGB color.\n *\n * @param {vec3} rgb The color in RGB space.\n * @param {vec3} hsbShift The amount to shift each component. The xyz components correspond to hue, saturation, and brightness. Shifting the hue by +/- 1.0 corresponds to shifting the hue by a full cycle. Saturation and brightness are clamped between 0 and 1 after the adjustment\n * @param {bool} ignoreBlackPixels If true, black pixels will be unchanged. This is necessary in some shaders such as atmosphere-related effects.\n *\n * @return {vec3} The RGB color after shifting in HSB space and clamping saturation and brightness to a valid range.\n */\nvec3 czm_applyHSBShift(vec3 rgb, vec3 hsbShift, bool ignoreBlackPixels) {\n // Convert rgb color to hsb\n vec3 hsb = czm_RGBToHSB(rgb);\n\n // Perform hsb shift\n // Hue cycles around so no clamp is needed.\n hsb.x += hsbShift.x; // hue\n hsb.y = clamp(hsb.y + hsbShift.y, 0.0, 1.0); // saturation\n\n // brightness\n //\n // Some shaders such as atmosphere-related effects need to leave black\n // pixels unchanged\n if (ignoreBlackPixels) {\n hsb.z = hsb.z > czm_epsilon7 ? hsb.z + hsbShift.z : 0.0;\n } else {\n hsb.z = hsb.z + hsbShift.z;\n }\n hsb.z = clamp(hsb.z, 0.0, 1.0);\n\n // Convert shifted hsb back to rgb\n return czm_HSBToRGB(hsb);\n}\n",czm_approximateSphericalCoordinates:"/**\n * Approximately computes spherical coordinates given a normal.\n * Uses approximate inverse trigonometry for speed and consistency,\n * since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.\n *\n * @name czm_approximateSphericalCoordinates\n * @glslFunction\n *\n * @param {vec3} normal arbitrary-length normal.\n *\n * @returns {vec2} Approximate latitude and longitude spherical coordinates.\n */\nvec2 czm_approximateSphericalCoordinates(vec3 normal) {\n // Project into plane with vertical for latitude\n float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\n float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\n return vec2(latitudeApproximation, longitudeApproximation);\n}\n",czm_approximateTanh:"/**\n * Compute a rational approximation to tanh(x)\n *\n * @param {float} x A real number input\n * @returns {float} An approximation for tanh(x)\n*/\nfloat czm_approximateTanh(float x) {\n float x2 = x * x;\n return max(-1.0, min(1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2)));\n}\n",czm_backFacing:"/**\n * Determines if the fragment is back facing\n *\n * @name czm_backFacing\n * @glslFunction \n * \n * @returns {bool} <code>true</code> if the fragment is back facing; otherwise, <code>false</code>.\n */\nbool czm_backFacing()\n{\n // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494.\n return gl_FrontFacing == false;\n}\n",czm_branchFreeTernary:"/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a float expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {float} a Value to return if the comparison is true.\n * @param {float} b Value to return if the comparison is false.\n *\n * @returns {float} equivalent of comparison ? a : b\n */\nfloat czm_branchFreeTernary(bool comparison, float a, float b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n\n/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a vec2 expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {vec2} a Value to return if the comparison is true.\n * @param {vec2} b Value to return if the comparison is false.\n *\n * @returns {vec2} equivalent of comparison ? a : b\n */\nvec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n\n/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a vec3 expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {vec3} a Value to return if the comparison is true.\n * @param {vec3} b Value to return if the comparison is false.\n *\n * @returns {vec3} equivalent of comparison ? a : b\n */\nvec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n\n/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a vec4 expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {vec3} a Value to return if the comparison is true.\n * @param {vec3} b Value to return if the comparison is false.\n *\n * @returns {vec3} equivalent of comparison ? a : b\n */\nvec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n",czm_cascadeColor:"\nvec4 czm_cascadeColor(vec4 weights)\n{\n return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\n vec4(0.0, 1.0, 0.0, 1.0) * weights.y +\n vec4(0.0, 0.0, 1.0, 1.0) * weights.z +\n vec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n}\n",czm_cascadeDistance:"\nuniform vec4 shadowMap_cascadeDistances;\n\nfloat czm_cascadeDistance(vec4 weights)\n{\n return dot(shadowMap_cascadeDistances, weights);\n}\n",czm_cascadeMatrix:"\nuniform mat4 shadowMap_cascadeMatrices[4];\n\nmat4 czm_cascadeMatrix(vec4 weights)\n{\n return shadowMap_cascadeMatrices[0] * weights.x +\n shadowMap_cascadeMatrices[1] * weights.y +\n shadowMap_cascadeMatrices[2] * weights.z +\n shadowMap_cascadeMatrices[3] * weights.w;\n}\n",czm_cascadeWeights:"\nuniform vec4 shadowMap_cascadeSplits[2];\n\nvec4 czm_cascadeWeights(float depthEye)\n{\n // One component is set to 1.0 and all others set to 0.0.\n vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\n vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\n return near * far;\n}\n",czm_clipPolygons:"float getSignedDistance(vec2 uv, highp sampler2D clippingDistance) {\n float signedDistance = texture(clippingDistance, uv).r;\n return (signedDistance - 0.5) * 2.0;\n}\n\nvoid czm_clipPolygons(highp sampler2D clippingDistance, int extentsLength, vec2 clippingPosition, int regionIndex) {\n // Position is completely outside of polygons bounds\n vec2 rectUv = clippingPosition;\n if (regionIndex < 0 || rectUv.x <= 0.0 || rectUv.y <= 0.0 || rectUv.x >= 1.0 || rectUv.y >= 1.0) {\n #ifdef CLIPPING_INVERSE \n discard;\n #endif\n return;\n }\n\n vec2 clippingDistanceTextureDimensions = vec2(textureSize(clippingDistance, 0));\n vec2 sampleOffset = max(1.0 / clippingDistanceTextureDimensions, vec2(0.005));\n float dimension = float(extentsLength);\n if (extentsLength > 2) {\n dimension = ceil(log2(float(extentsLength)));\n }\n\n vec2 textureOffset = vec2(mod(float(regionIndex), dimension), floor(float(regionIndex) / dimension)) / dimension;\n vec2 uv = textureOffset + rectUv / dimension;\n\n float signedDistance = getSignedDistance(uv, clippingDistance);\n\n #ifdef CLIPPING_INVERSE\n if (signedDistance > 0.0) {\n discard;\n }\n #else\n if (signedDistance < 0.0) {\n discard;\n }\n #endif\n}\n",czm_columbusViewMorph:"/**\n * DOC_TBA\n *\n * @name czm_columbusViewMorph\n * @glslFunction\n */\nvec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\n // Just linear for now.\n vec3 p = mix(position2D.xyz, position3D.xyz, time);\n return vec4(p, 1.0);\n}\n",czm_computeAtmosphereColor:"/**\n * Compute the atmosphere color, applying Rayleigh and Mie scattering. This\n * builtin uses automatic uniforms so the atmophere settings are synced with the\n * state of the Scene, even in other contexts like Model.\n *\n * @name czm_computeAtmosphereColor\n * @glslFunction\n *\n * @param {vec3} positionWC Position of the fragment in world coords (low precision)\n * @param {vec3} lightDirection Light direction from the sun or other light source.\n * @param {vec3} rayleighColor The Rayleigh scattering color computed by a scattering function\n * @param {vec3} mieColor The Mie scattering color computed by a scattering function\n * @param {float} opacity The opacity computed by a scattering function.\n */\nvec4 czm_computeAtmosphereColor(\n vec3 positionWC,\n vec3 lightDirection,\n vec3 rayleighColor,\n vec3 mieColor,\n float opacity\n) {\n // Setup the primary ray: from the camera position to the vertex position.\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n\n float cosAngle = dot(cameraToPositionWCDirection, lightDirection);\n float cosAngleSq = cosAngle * cosAngle;\n\n float G = czm_atmosphereMieAnisotropy;\n float GSq = G * G;\n\n // The Rayleigh phase function.\n float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);\n // The Mie phase function.\n float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));\n\n // The final color is generated by combining the effects of the Rayleigh and Mie scattering.\n vec3 rayleigh = rayleighPhase * rayleighColor;\n vec3 mie = miePhase * mieColor;\n\n vec3 color = (rayleigh + mie) * czm_atmosphereLightIntensity;\n\n return vec4(color, opacity);\n}\n",czm_computeGroundAtmosphereScattering:"/**\n * Compute atmosphere scattering for the ground atmosphere and fog. This method\n * uses automatic uniforms so it is always synced with the scene settings.\n *\n * @name czm_computeGroundAtmosphereScattering\n * @glslfunction\n *\n * @param {vec3} positionWC The position of the fragment in world coordinates.\n * @param {vec3} lightDirection The direction of the light to calculate the scattering from.\n * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.\n * @param {vec3} mieColor The variable the Mie scattering will be written to.\n * @param {float} opacity The variable the transmittance will be written to.\n */\nvoid czm_computeGroundAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);\n\n float atmosphereInnerRadius = length(positionWC);\n\n czm_computeScattering(\n primaryRay,\n length(cameraToPositionWC),\n lightDirection,\n atmosphereInnerRadius,\n rayleighColor,\n mieColor,\n opacity\n );\n}\n",czm_computePosition:"/**\n * Returns a position in model coordinates relative to eye taking into\n * account the current scene mode: 3D, 2D, or Columbus view.\n * <p>\n * This uses standard position attributes, <code>position3DHigh</code>, \n * <code>position3DLow</code>, <code>position2DHigh</code>, and <code>position2DLow</code>, \n * and should be used when writing a vertex shader for an {@link Appearance}.\n * </p>\n *\n * @name czm_computePosition\n * @glslFunction\n *\n * @returns {vec4} The position relative to eye.\n *\n * @example\n * vec4 p = czm_computePosition();\n * v_positionEC = (czm_modelViewRelativeToEye * p).xyz;\n * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n *\n * @see czm_translateRelativeToEye\n */\nvec4 czm_computePosition();\n",czm_computeScattering:"/**\n * This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as\n * the transmittance value for the ray. This function uses automatic uniforms\n * so the atmosphere settings are always synced with the current scene.\n *\n * @name czm_computeScattering\n * @glslfunction\n *\n * @param {czm_ray} primaryRay The ray from the camera to the position.\n * @param {float} primaryRayLength The length of the primary ray.\n * @param {vec3} lightDirection The direction of the light to calculate the scattering from.\n * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.\n * @param {vec3} mieColor The variable the Mie scattering will be written to.\n * @param {float} opacity The variable the transmittance will be written to.\n */\nvoid czm_computeScattering(\n czm_ray primaryRay,\n float primaryRayLength,\n vec3 lightDirection,\n float atmosphereInnerRadius,\n out vec3 rayleighColor,\n out vec3 mieColor,\n out float opacity\n) {\n const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.\n const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.\n const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\n // Initialize the default scattering amounts to 0.\n rayleighColor = vec3(0.0);\n mieColor = vec3(0.0);\n opacity = 0.0;\n\n float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;\n\n vec3 origin = vec3(0.0);\n\n // Calculate intersection from the camera to the outer ring of the atmosphere.\n czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);\n\n // Return empty colors if no intersection with the atmosphere geometry.\n if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {\n rayleighColor = vec3(1.0, 0.0, 1.0);\n return;\n }\n\n // To deal with smaller values of PRIMARY_STEPS (e.g. 4)\n // we implement a split strategy: sky or horizon.\n // For performance reasons, instead of a if/else branch\n // a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0\n float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);\n // Value close to 0.0: close to the horizon\n // Value close to 1.0: above in the sky\n float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));\n\n // The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.\n float start_0 = primaryRayAtmosphereIntersect.start;\n primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);\n // The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.\n primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));\n\n // For the number of ray steps, distinguish inside or outside atmosphere (outer space)\n // (1) from outer space we have to use more ray steps to get a realistic rendering\n // (2) within atmosphere we need fewer steps for faster rendering\n float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters\n float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));\n int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.\n int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\n // Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.\n float rayPositionLength = primaryRayAtmosphereIntersect.start;\n // (1) Outside the atmosphere: constant rayStepLength\n // (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps\n float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;\n float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));\n float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));\n\n vec3 rayleighAccumulation = vec3(0.0);\n vec3 mieAccumulation = vec3(0.0);\n vec2 opticalDepth = vec2(0.0);\n vec2 heightScale = vec2(czm_atmosphereRayleighScaleHeight, czm_atmosphereMieScaleHeight);\n\n // Sample positions on the primary ray.\n for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {\n\n // The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot\n // loop with non-constant condition, so it has to break early instead\n if (i >= PRIMARY_STEPS) {\n break;\n }\n\n // Calculate sample position along viewpoint ray.\n vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);\n\n // Calculate height of sample position above ellipsoid.\n float sampleHeight = length(samplePosition) - atmosphereInnerRadius;\n\n // Calculate and accumulate density of particles at the sample position.\n vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;\n opticalDepth += sampleDensity;\n\n // Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.\n czm_ray lightRay = czm_ray(samplePosition, lightDirection);\n czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);\n\n float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);\n float lightPositionLength = 0.0;\n\n vec2 lightOpticalDepth = vec2(0.0);\n\n // Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.\n for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {\n\n // The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot\n // loop with non-constant condition, so it has to break early instead\n if (j >= LIGHT_STEPS) {\n break;\n }\n\n // Calculate sample position along light ray.\n vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);\n\n // Calculate height of the light sample position above ellipsoid.\n float lightHeight = length(lightPosition) - atmosphereInnerRadius;\n\n // Calculate density of photons at the light sample position.\n lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;\n\n // Increment distance on light ray.\n lightPositionLength += lightStepLength;\n }\n\n // Compute attenuation via the primary ray and the light ray.\n vec3 attenuation = exp(-((czm_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (czm_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));\n\n // Accumulate the scattering.\n rayleighAccumulation += sampleDensity.x * attenuation;\n mieAccumulation += sampleDensity.y * attenuation;\n\n // Increment distance on primary ray.\n rayPositionLength += (rayStepLength += rayStepLengthIncrease);\n }\n\n // Compute the scattering amount.\n rayleighColor = czm_atmosphereRayleighCoefficient * rayleighAccumulation;\n mieColor = czm_atmosphereMieCoefficient * mieAccumulation;\n\n // Compute the transmittance i.e. how much light is passing through the atmosphere.\n opacity = length(exp(-((czm_atmosphereMieCoefficient * opticalDepth.y) + (czm_atmosphereRayleighCoefficient * opticalDepth.x))));\n}\n",czm_cosineAndSine:"/**\n * @private\n */\nvec2 cordic(float angle)\n{\n// Scale the vector by the appropriate factor for the 24 iterations to follow.\n vec2 vector = vec2(6.0725293500888267e-1, 0.0);\n// Iteration 1\n float sense = (angle < 0.0) ? -1.0 : 1.0;\n // float factor = sense * 1.0; // 2^-0\n mat2 rotation = mat2(1.0, sense, -sense, 1.0);\n vector = rotation * vector;\n angle -= sense * 7.8539816339744828e-1; // atan(2^-0)\n// Iteration 2\n sense = (angle < 0.0) ? -1.0 : 1.0;\n float factor = sense * 5.0e-1; // 2^-1\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 4.6364760900080609e-1; // atan(2^-1)\n// Iteration 3\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 2.5e-1; // 2^-2\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 2.4497866312686414e-1; // atan(2^-2)\n// Iteration 4\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.25e-1; // 2^-3\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.2435499454676144e-1; // atan(2^-3)\n// Iteration 5\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 6.25e-2; // 2^-4\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 6.2418809995957350e-2; // atan(2^-4)\n// Iteration 6\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.125e-2; // 2^-5\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.1239833430268277e-2; // atan(2^-5)\n// Iteration 7\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.5625e-2; // 2^-6\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.5623728620476831e-2; // atan(2^-6)\n// Iteration 8\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 7.8125e-3; // 2^-7\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 7.8123410601011111e-3; // atan(2^-7)\n// Iteration 9\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.90625e-3; // 2^-8\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.9062301319669718e-3; // atan(2^-8)\n// Iteration 10\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.953125e-3; // 2^-9\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.9531225164788188e-3; // atan(2^-9)\n// Iteration 11\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 9.765625e-4; // 2^-10\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 9.7656218955931946e-4; // atan(2^-10)\n// Iteration 12\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 4.8828125e-4; // 2^-11\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 4.8828121119489829e-4; // atan(2^-11)\n// Iteration 13\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 2.44140625e-4; // 2^-12\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 2.4414062014936177e-4; // atan(2^-12)\n// Iteration 14\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.220703125e-4; // 2^-13\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.2207031189367021e-4; // atan(2^-13)\n// Iteration 15\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 6.103515625e-5; // 2^-14\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 6.1035156174208773e-5; // atan(2^-14)\n// Iteration 16\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.0517578125e-5; // 2^-15\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.0517578115526096e-5; // atan(2^-15)\n// Iteration 17\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.52587890625e-5; // 2^-16\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.5258789061315762e-5; // atan(2^-16)\n// Iteration 18\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 7.62939453125e-6; // 2^-17\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 7.6293945311019700e-6; // atan(2^-17)\n// Iteration 19\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.814697265625e-6; // 2^-18\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.8146972656064961e-6; // atan(2^-18)\n// Iteration 20\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.9073486328125e-6; // 2^-19\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.9073486328101870e-6; // atan(2^-19)\n// Iteration 21\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 9.5367431640625e-7; // 2^-20\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 9.5367431640596084e-7; // atan(2^-20)\n// Iteration 22\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 4.76837158203125e-7; // 2^-21\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 4.7683715820308884e-7; // atan(2^-21)\n// Iteration 23\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 2.384185791015625e-7; // 2^-22\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 2.3841857910155797e-7; // atan(2^-22)\n// Iteration 24\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.1920928955078125e-7; // 2^-23\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n// angle -= sense * 1.1920928955078068e-7; // atan(2^-23)\n\n return vector;\n}\n\n/**\n * Computes the cosine and sine of the provided angle using the CORDIC algorithm.\n *\n * @name czm_cosineAndSine\n * @glslFunction\n *\n * @param {float} angle The angle in radians.\n *\n * @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).\n *\n * @example\n * vec2 v = czm_cosineAndSine(czm_piOverSix);\n * float cosine = v.x;\n * float sine = v.y;\n */\nvec2 czm_cosineAndSine(float angle)\n{\n if (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n {\n if (angle < 0.0)\n {\n return -cordic(angle + czm_pi);\n }\n else\n {\n return -cordic(angle - czm_pi);\n }\n }\n else\n {\n return cordic(angle);\n }\n}\n",czm_decompressTextureCoordinates:"/**\n * Decompresses texture coordinates that were packed into a single float.\n *\n * @name czm_decompressTextureCoordinates\n * @glslFunction\n *\n * @param {float} encoded The compressed texture coordinates.\n * @returns {vec2} The decompressed texture coordinates.\n */\n vec2 czm_decompressTextureCoordinates(float encoded)\n {\n float temp = encoded / 4096.0;\n float xZeroTo4095 = floor(temp);\n float stx = xZeroTo4095 / 4095.0;\n float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\n return vec2(stx, sty);\n }\n",czm_defaultPbrMaterial:"/**\n * Get default parameters for physically based rendering. These defaults\n * describe a rough dielectric (non-metal) surface (e.g. rough plastic).\n *\n * @return {czm_pbrParameters} Default parameters for {@link czm_pbrLighting}\n */\nczm_pbrParameters czm_defaultPbrMaterial()\n{\n czm_pbrParameters results;\n results.diffuseColor = vec3(1.0);\n results.roughness = 1.0;\n\n const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\n results.f0 = REFLECTANCE_DIELECTRIC;\n return results;\n}\n",czm_depthClamp:"// emulated noperspective\n#if (__VERSION__ == 300 || defined(GL_EXT_frag_depth)) && !defined(LOG_DEPTH)\nout float v_WindowZ;\n#endif\n\n/**\n * Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2.\n * GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes, \n * capping the shadow volume. More information here: \n * https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt.\n *\n * When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring \n * no geometry gets clipped by setting the clip space z value to 0.0 and then\n * sending the unaltered screen space z value (using emulated noperspective\n * interpolation) to the frag shader where it is clamped to [0,1] and then\n * written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on:\n * https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv.\n *\n * When GL_EXT_frag_depth is not available, which is the case on some mobile \n * devices, we must attempt to fix this only in the vertex shader. \n * The approach is to clamp the z value to the far plane, which closes the \n * shadow volume but also distorts the geometry, so there can still be artifacts\n * on frustum seams.\n *\n * @name czm_depthClamp\n * @glslFunction\n *\n * @param {vec4} coords The vertex in clip coordinates.\n * @returns {vec4} The modified vertex.\n *\n * @example\n * gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0));\n *\n * @see czm_writeDepthClamp\n */\nvec4 czm_depthClamp(vec4 coords)\n{\n#ifndef LOG_DEPTH\n#if __VERSION__ == 300 || defined(GL_EXT_frag_depth)\n v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\n coords.z = 0.0;\n#else\n coords.z = min(coords.z, coords.w);\n#endif\n#endif\n return coords;\n}\n",czm_eastNorthUpToEyeCoordinates:"/**\n * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system \n * to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the \n * surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.\n * <br /><br />\n * The ellipsoid is assumed to be centered at the model coordinate's origin.\n *\n * @name czm_eastNorthUpToEyeCoordinates\n * @glslFunction\n *\n * @param {vec3} positionMC The position on the ellipsoid in model coordinates.\n * @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.\n *\n * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.\n *\n * @example\n * // Transform a vector defined in the east-north-up coordinate \n * // system, (0, 0, 1) which is the surface normal, to eye \n * // coordinates.\n * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);\n */\nmat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\n vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates\n vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordinates\n vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates\n\n return mat3(\n tangentEC.x, tangentEC.y, tangentEC.z,\n bitangentEC.x, bitangentEC.y, bitangentEC.z,\n normalEC.x, normalEC.y, normalEC.z);\n}\n",czm_ellipsoidContainsPoint:"/**\n * DOC_TBA\n *\n * @name czm_ellipsoidContainsPoint\n * @glslFunction\n *\n */\nbool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)\n{\n vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\n return (dot(scaled, scaled) <= 1.0);\n}\n",czm_ellipsoidWgs84TextureCoordinates:"/**\n * DOC_TBA\n *\n * @name czm_ellipsoidWgs84TextureCoordinates\n * @glslFunction\n */\nvec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\n return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n",czm_equalsEpsilon:"/**\n * Compares <code>left</code> and <code>right</code> componentwise. Returns <code>true</code>\n * if they are within <code>epsilon</code> and <code>false</code> otherwise. The inputs\n * <code>left</code> and <code>right</code> can be <code>float</code>s, <code>vec2</code>s,\n * <code>vec3</code>s, or <code>vec4</code>s.\n *\n * @name czm_equalsEpsilon\n * @glslFunction\n *\n * @param {} left The first vector.\n * @param {} right The second vector.\n * @param {float} epsilon The epsilon to use for equality testing.\n * @returns {bool} <code>true</code> if the components are within <code>epsilon</code> and <code>false</code> otherwise.\n *\n * @example\n * // GLSL declarations\n * bool czm_equalsEpsilon(float left, float right, float epsilon);\n * bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);\n * bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);\n * bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);\n */\nbool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\n return all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\n\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\n return all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\n\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\n return all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\n\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\n return (abs(left - right) <= epsilon);\n}\n",czm_eyeOffset:"/**\n * DOC_TBA\n *\n * @name czm_eyeOffset\n * @glslFunction\n *\n * @param {vec4} positionEC DOC_TBA.\n * @param {vec3} eyeOffset DOC_TBA.\n *\n * @returns {vec4} DOC_TBA.\n */\nvec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\n // This equation is approximate in x and y.\n vec4 p = positionEC;\n vec4 zEyeOffset = normalize(p) * eyeOffset.z;\n p.xy += eyeOffset.xy + zEyeOffset.xy;\n p.z += zEyeOffset.z;\n return p;\n}\n",czm_eyeToWindowCoordinates:"/**\n * Transforms a position from eye to window coordinates. The transformation\n * from eye to clip coordinates is done using {@link czm_projection}.\n * The transform from normalized device coordinates to window coordinates is\n * done using {@link czm_viewportTransformation}, which assumes a depth range\n * of <code>near = 0</code> and <code>far = 1</code>.\n * <br /><br />\n * This transform is useful when there is a need to manipulate window coordinates\n * in a vertex shader as done by {@link BillboardCollection}.\n *\n * @name czm_eyeToWindowCoordinates\n * @glslFunction\n *\n * @param {vec4} position The position in eye coordinates to transform.\n *\n * @returns {vec4} The transformed position in window coordinates.\n *\n * @see czm_modelToWindowCoordinates\n * @see czm_projection\n * @see czm_viewportTransformation\n * @see BillboardCollection\n *\n * @example\n * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n */\nvec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\n vec4 q = czm_projection * positionEC; // clip coordinates\n q.xyz /= q.w; // normalized device coordinates\n q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n return q;\n}\n",czm_fastApproximateAtan:"/**\n * Approxiamtes atan over the range [0, 1]. Safe to flip output for negative input.\n *\n * Based on Michal Drobot's approximation from ShaderFastLibs, which in turn is based on\n * \"Efficient approximations for the arctangent function,\" Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006.\n * Adapted from ShaderFastLibs under MIT License.\n *\n * Chosen for the following characteristics over range [0, 1]:\n * - basically no error at 0 and 1, important for getting around range limit (naive atan2 via atan requires infinite range atan)\n * - no visible artifacts from first-derivative discontinuities, unlike latitude via range-reduced sqrt asin approximations (at equator)\n *\n * The original code is x * (-0.1784 * abs(x) - 0.0663 * x * x + 1.0301);\n * Removed the abs() in here because it isn't needed, the input range is guaranteed as [0, 1] by how we're approximating atan2.\n *\n * @name czm_fastApproximateAtan\n * @glslFunction\n *\n * @param {float} x Value between 0 and 1 inclusive.\n *\n * @returns {float} Approximation of atan(x)\n */\nfloat czm_fastApproximateAtan(float x) {\n return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);\n}\n\n/**\n * Approximation of atan2.\n *\n * Range reduction math based on nvidia's cg reference implementation for atan2: http://developer.download.nvidia.com/cg/atan2.html\n * However, we replaced their atan curve with Michael Drobot's (see above).\n *\n * @name czm_fastApproximateAtan\n * @glslFunction\n *\n * @param {float} x Value between -1 and 1 inclusive.\n * @param {float} y Value between -1 and 1 inclusive.\n *\n * @returns {float} Approximation of atan2(x, y)\n */\nfloat czm_fastApproximateAtan(float x, float y) {\n // atan approximations are usually only reliable over [-1, 1], or, in our case, [0, 1] due to modifications.\n // So range-reduce using abs and by flipping whether x or y is on top.\n float t = abs(x); // t used as swap and atan result.\n float opposite = abs(y);\n float adjacent = max(t, opposite);\n opposite = min(t, opposite);\n\n t = czm_fastApproximateAtan(opposite / adjacent);\n\n // Undo range reduction\n t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);\n t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);\n t = czm_branchFreeTernary(y < 0.0, -t, t);\n return t;\n}\n",czm_fog:"/**\n * Gets the color with fog at a distance from the camera.\n *\n * @name czm_fog\n * @glslFunction\n *\n * @param {float} distanceToCamera The distance to the camera in meters.\n * @param {vec3} color The original color.\n * @param {vec3} fogColor The color of the fog.\n *\n * @returns {vec3} The color adjusted for fog at the distance from the camera.\n */\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n{\n float scalar = distanceToCamera * czm_fogDensity;\n float fog = 1.0 - exp(-(scalar * scalar));\n return mix(color, fogColor, fog);\n}\n\n/**\n * Gets the color with fog at a distance from the camera.\n *\n * @name czm_fog\n * @glslFunction\n *\n * @param {float} distanceToCamera The distance to the camera in meters.\n * @param {vec3} color The original color.\n * @param {vec3} fogColor The color of the fog.\n * @param {float} fogModifierConstant A constant to modify the appearance of fog.\n *\n * @returns {vec3} The color adjusted for fog at the distance from the camera.\n */\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n{\n float scalar = distanceToCamera * czm_fogDensity;\n float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\n return mix(color, fogColor, fog);\n}\n",czm_gammaCorrect:"/**\n * Converts a color from RGB space to linear space.\n *\n * @name czm_gammaCorrect\n * @glslFunction\n *\n * @param {vec3} color The color in RGB space.\n * @returns {vec3} The color in linear space.\n */\nvec3 czm_gammaCorrect(vec3 color) {\n#ifdef HDR\n color = pow(color, vec3(czm_gamma));\n#endif\n return color;\n}\n\nvec4 czm_gammaCorrect(vec4 color) {\n#ifdef HDR\n color.rgb = pow(color.rgb, vec3(czm_gamma));\n#endif\n return color;\n}\n",czm_geodeticSurfaceNormal:"/**\n * DOC_TBA\n *\n * @name czm_geodeticSurfaceNormal\n * @glslFunction\n *\n * @param {vec3} positionOnEllipsoid DOC_TBA\n * @param {vec3} ellipsoidCenter DOC_TBA\n * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA\n * \n * @returns {vec3} DOC_TBA.\n */\nvec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\n return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n",czm_getDefaultMaterial:"/**\n * An czm_material with default values. Every material's czm_getMaterial\n * should use this default material as a base for the material it returns.\n * The default normal value is given by materialInput.normalEC.\n *\n * @name czm_getDefaultMaterial\n * @glslFunction\n *\n * @param {czm_materialInput} input The input used to construct the default material.\n *\n * @returns {czm_material} The default material.\n *\n * @see czm_materialInput\n * @see czm_material\n * @see czm_getMaterial\n */\nczm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\n czm_material material;\n material.diffuse = vec3(0.0);\n material.specular = 0.0;\n material.shininess = 1.0;\n material.normal = materialInput.normalEC;\n material.emission = vec3(0.0);\n material.alpha = 1.0;\n return material;\n}\n",czm_getDynamicAtmosphereLightDirection:"/**\n * Select which direction vector to use for dynamic atmosphere lighting based on an enum value\n *\n * @name czm_getDynamicAtmosphereLightDirection\n * @glslfunction\n * @see DynamicAtmosphereLightingType.js\n *\n * @param {vec3} positionWC the position of the vertex/fragment in world coordinates. This is normalized and returned when dynamic lighting is turned off.\n * @param {float} lightEnum The enum value for selecting between light sources.\n * @return {vec3} The normalized light direction vector. Depending on the enum value, it is either positionWC, czm_lightDirectionWC or czm_sunDirectionWC\n */\nvec3 czm_getDynamicAtmosphereLightDirection(vec3 positionWC, float lightEnum) {\n const float NONE = 0.0;\n const float SCENE_LIGHT = 1.0;\n const float SUNLIGHT = 2.0;\n\n vec3 lightDirection =\n positionWC * float(lightEnum == NONE) +\n czm_lightDirectionWC * float(lightEnum == SCENE_LIGHT) +\n czm_sunDirectionWC * float(lightEnum == SUNLIGHT);\n return normalize(lightDirection);\n}\n",czm_getLambertDiffuse:"/**\n * Calculates the intensity of diffusely reflected light.\n *\n * @name czm_getLambertDiffuse\n * @glslFunction\n *\n * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n * @param {vec3} normalEC The surface normal in eye coordinates.\n *\n * @returns {float} The intensity of the diffuse reflection.\n *\n * @see czm_phong\n *\n * @example\n * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n */\nfloat czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\n return max(dot(lightDirectionEC, normalEC), 0.0);\n}\n",czm_getSpecular:"/**\n * Calculates the specular intensity of reflected light.\n *\n * @name czm_getSpecular\n * @glslFunction\n *\n * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.\n * @param {vec3} normalEC The surface normal in eye coordinates.\n * @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n *\n * @returns {float} The intensity of the specular highlight.\n *\n * @see czm_phong\n *\n * @example\n * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n */\nfloat czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\n vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\n float specular = max(dot(toReflectedLight, toEyeEC), 0.0);\n\n // pow has undefined behavior if both parameters <= 0.\n // Prevent this by making sure shininess is at least czm_epsilon2.\n return pow(specular, max(shininess, czm_epsilon2));\n}\n",czm_getWaterNoise:"/**\n * @private\n */\nvec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\n float cosAngle = cos(angleInRadians);\n float sinAngle = sin(angleInRadians);\n\n // time dependent sampling directions\n vec2 s0 = vec2(1.0/17.0, 0.0);\n vec2 s1 = vec2(-1.0/29.0, 0.0);\n vec2 s2 = vec2(1.0/101.0, 1.0/59.0);\n vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\n\n // rotate sampling direction by specified angle\n s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\n s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\n s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\n s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\n\n vec2 uv0 = (uv/103.0) + (time * s0);\n vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\n vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\n vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\n\n uv0 = fract(uv0);\n uv1 = fract(uv1);\n uv2 = fract(uv2);\n uv3 = fract(uv3);\n vec4 noise = (texture(normalMap, uv0)) +\n (texture(normalMap, uv1)) +\n (texture(normalMap, uv2)) +\n (texture(normalMap, uv3));\n\n // average and scale to between -1 and 1\n return ((noise / 4.0) - 0.5) * 2.0;\n}\n",czm_hue:"/**\n * Adjusts the hue of a color.\n * \n * @name czm_hue\n * @glslFunction\n * \n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the hue of the color in radians.\n *\n * @returns {float} The color with the hue adjusted.\n *\n * @example\n * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)\n */\nvec3 czm_hue(vec3 rgb, float adjustment)\n{\n const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n 0.595716, -0.274453, -0.321263,\n 0.211456, -0.522591, 0.311135);\n const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n 1.0, -0.2721, -0.6474,\n 1.0, -1.107, 1.7046);\n \n vec3 yiq = toYIQ * rgb;\n float hue = atan(yiq.z, yiq.y) + adjustment;\n float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n \n vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n return toRGB * color;\n}\n",czm_inverseGamma:"/**\n * Converts a color in linear space to RGB space.\n *\n * @name czm_inverseGamma\n * @glslFunction\n *\n * @param {vec3} color The color in linear space.\n * @returns {vec3} The color in RGB space.\n */\nvec3 czm_inverseGamma(vec3 color) {\n return pow(color, vec3(1.0 / czm_gamma));\n}\n",czm_isEmpty:"/**\n * Determines if a time interval is empty.\n *\n * @name czm_isEmpty\n * @glslFunction \n * \n * @param {czm_raySegment} interval The interval to test.\n * \n * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.\n *\n * @example\n * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n */\nbool czm_isEmpty(czm_raySegment interval)\n{\n return (interval.stop < 0.0);\n}\n",czm_isFull:"/**\n * Determines if a time interval is empty.\n *\n * @name czm_isFull\n * @glslFunction \n * \n * @param {czm_raySegment} interval The interval to test.\n * \n * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.\n *\n * @example\n * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n */\nbool czm_isFull(czm_raySegment interval)\n{\n return (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n",czm_latitudeToWebMercatorFraction:"/**\n * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.\n *\n * @name czm_latitudeToWebMercatorFraction\n * @glslFunction\n *\n * @param {float} latitude The geodetic latitude, in radians.\n * @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.\n * @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.\n *\n * @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern\n * boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return\n * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.\n */ \nfloat czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n{\n float sinLatitude = sin(latitude);\n float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\n \n return (mercatorY - southMercatorY) * oneOverMercatorHeight;\n}\n",czm_lineDistance:"/**\n * Computes distance from an point in 2D to a line in 2D.\n *\n * @name czm_lineDistance\n * @glslFunction\n *\n * param {vec2} point1 A point along the line.\n * param {vec2} point2 A point along the line.\n * param {vec2} point A point that may or may not be on the line.\n * returns {float} The distance from the point to the line.\n */\nfloat czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {\n return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);\n}\n",czm_linearToSrgb:"/**\n * Converts a linear RGB color to an sRGB color.\n *\n * @param {vec3|vec4} linearIn The color in linear color space.\n * @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.\n */\nvec3 czm_linearToSrgb(vec3 linearIn) \n{\n return pow(linearIn, vec3(1.0/2.2));\n}\n\nvec4 czm_linearToSrgb(vec4 linearIn) \n{\n vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));\n return vec4(srgbOut, linearIn.a);\n}\n",czm_luminance:"/**\n * Computes the luminance of a color. \n *\n * @name czm_luminance\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * \n * @returns {float} The luminance.\n *\n * @example\n * float light = czm_luminance(vec3(0.0)); // 0.0\n * float dark = czm_luminance(vec3(1.0)); // ~1.0 \n */\nfloat czm_luminance(vec3 rgb)\n{\n // Algorithm from Chapter 10 of Graphics Shaders.\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n return dot(rgb, W);\n}\n",czm_metersPerPixel:"/**\n * Computes the size of a pixel in meters at a distance from the eye.\n * <p>\n * Use this version when passing in a custom pixel ratio. For example, passing in 1.0 will return meters per native device pixel.\n * </p>\n * @name czm_metersPerPixel\n * @glslFunction\n *\n * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.\n * @param {float} pixelRatio The scaling factor from pixel space to coordinate space\n *\n * @returns {float} The meters per pixel at positionEC.\n */\nfloat czm_metersPerPixel(vec4 positionEC, float pixelRatio)\n{\n float width = czm_viewport.z;\n float height = czm_viewport.w;\n float pixelWidth;\n float pixelHeight;\n\n float top = czm_frustumPlanes.x;\n float bottom = czm_frustumPlanes.y;\n float left = czm_frustumPlanes.z;\n float right = czm_frustumPlanes.w;\n\n if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n {\n float frustumWidth = right - left;\n float frustumHeight = top - bottom;\n pixelWidth = frustumWidth / width;\n pixelHeight = frustumHeight / height;\n }\n else\n {\n float distanceToPixel = -positionEC.z;\n float inverseNear = 1.0 / czm_currentFrustum.x;\n float tanTheta = top * inverseNear;\n pixelHeight = 2.0 * distanceToPixel * tanTheta / height;\n tanTheta = right * inverseNear;\n pixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n }\n\n return max(pixelWidth, pixelHeight) * pixelRatio;\n}\n\n/**\n * Computes the size of a pixel in meters at a distance from the eye.\n * <p>\n * Use this version when scaling by pixel ratio.\n * </p>\n * @name czm_metersPerPixel\n * @glslFunction\n *\n * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.\n *\n * @returns {float} The meters per pixel at positionEC.\n */\nfloat czm_metersPerPixel(vec4 positionEC)\n{\n return czm_metersPerPixel(positionEC, czm_pixelRatio);\n}\n",czm_modelToWindowCoordinates:"/**\n * Transforms a position from model to window coordinates. The transformation\n * from model to clip coordinates is done using {@link czm_modelViewProjection}.\n * The transform from normalized device coordinates to window coordinates is\n * done using {@link czm_viewportTransformation}, which assumes a depth range\n * of <code>near = 0</code> and <code>far = 1</code>.\n * <br /><br />\n * This transform is useful when there is a need to manipulate window coordinates\n * in a vertex shader as done by {@link BillboardCollection}.\n * <br /><br />\n * This function should not be confused with {@link czm_viewportOrthographic},\n * which is an orthographic projection matrix that transforms from window \n * coordinates to clip coordinates.\n *\n * @name czm_modelToWindowCoordinates\n * @glslFunction\n *\n * @param {vec4} position The position in model coordinates to transform.\n *\n * @returns {vec4} The transformed position in window coordinates.\n *\n * @see czm_eyeToWindowCoordinates\n * @see czm_modelViewProjection\n * @see czm_viewportTransformation\n * @see czm_viewportOrthographic\n * @see BillboardCollection\n *\n * @example\n * vec4 positionWC = czm_modelToWindowCoordinates(positionMC);\n */\nvec4 czm_modelToWindowCoordinates(vec4 position)\n{\n vec4 q = czm_modelViewProjection * position; // clip coordinates\n q.xyz /= q.w; // normalized device coordinates\n q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n return q;\n}\n",czm_multiplyWithColorBalance:"/**\n * DOC_TBA\n *\n * @name czm_multiplyWithColorBalance\n * @glslFunction\n */\nvec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\n // Algorithm from Chapter 10 of Graphics Shaders.\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n \n vec3 target = left * right;\n float leftLuminance = dot(left, W);\n float rightLuminance = dot(right, W);\n float targetLuminance = dot(target, W);\n \n return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n",czm_nearFarScalar:"/**\n * Computes a value that scales with distance. The scaling is clamped at the near and\n * far distances, and does not extrapolate. This function works with the\n * {@link NearFarScalar} JavaScript class.\n *\n * @name czm_nearFarScalar\n * @glslFunction\n *\n * @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).\n * @param {float} cameraDistSq The square of the current distance from the camera.\n *\n * @returns {float} The value at this distance.\n */\nfloat czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\n float valueAtMin = nearFarScalar.y;\n float valueAtMax = nearFarScalar.w;\n float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\n float farDistanceSq = nearFarScalar.z * nearFarScalar.z;\n\n float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\n\n t = pow(clamp(t, 0.0, 1.0), 0.2);\n\n return mix(valueAtMin, valueAtMax, t);\n}\n",czm_octDecode:" /**\n * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.\n * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n *\n * @name czm_octDecode\n * @param {vec2} encoded The oct-encoded, unit-length vector\n * @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.\n * @returns {vec3} The decoded and normalized vector\n */\n vec3 czm_octDecode(vec2 encoded, float range)\n {\n if (encoded.x == 0.0 && encoded.y == 0.0) {\n return vec3(0.0, 0.0, 0.0);\n }\n\n encoded = encoded / range * 2.0 - 1.0;\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n if (v.z < 0.0)\n {\n v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n }\n\n return normalize(v);\n }\n\n/**\n * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.\n * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n *\n * @name czm_octDecode\n * @param {vec2} encoded The oct-encoded, unit-length vector\n * @returns {vec3} The decoded and normalized vector\n */\n vec3 czm_octDecode(vec2 encoded)\n {\n return czm_octDecode(encoded, 255.0);\n }\n\n /**\n * Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.\n * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n *\n * @name czm_octDecode\n * @param {float} encoded The oct-encoded, unit-length vector\n * @returns {vec3} The decoded and normalized vector\n */\n vec3 czm_octDecode(float encoded)\n {\n float temp = encoded / 256.0;\n float x = floor(temp);\n float y = (temp - x) * 256.0;\n return czm_octDecode(vec2(x, y));\n }\n\n/**\n * Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.\n * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n *\n * @name czm_octDecode\n * @param {vec2} encoded The packed oct-encoded, unit-length vectors.\n * @param {vec3} vector1 One decoded and normalized vector.\n * @param {vec3} vector2 One decoded and normalized vector.\n * @param {vec3} vector3 One decoded and normalized vector.\n */\n void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n {\n float temp = encoded.x / 65536.0;\n float x = floor(temp);\n float encodedFloat1 = (temp - x) * 65536.0;\n\n temp = encoded.y / 65536.0;\n float y = floor(temp);\n float encodedFloat2 = (temp - y) * 65536.0;\n\n vector1 = czm_octDecode(encodedFloat1);\n vector2 = czm_octDecode(encodedFloat2);\n vector3 = czm_octDecode(vec2(x, y));\n }\n\n",czm_packDepth:"/**\n * Packs a depth value into a vec3 that can be represented by unsigned bytes.\n *\n * @name czm_packDepth\n * @glslFunction\n *\n * @param {float} depth The floating-point depth.\n * @returns {vec3} The packed depth.\n */\nvec4 czm_packDepth(float depth)\n{\n // See Aras Pranckevičius' post Encoding Floats to RGBA\n // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n return enc;\n}\n",czm_pbrLighting:"vec3 lambertianDiffuse(vec3 diffuseColor)\n{\n return diffuseColor / czm_pi;\n}\n\nvec3 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\nfloat smithVisibilityG1(float NdotV, float roughness)\n{\n // this is the k value for direct lighting.\n // for image based lighting it will be roughness^2 / 2\n float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\nfloat smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n{\n return (\n smithVisibilityG1(NdotL, roughness) *\n smithVisibilityG1(NdotV, roughness)\n );\n}\n\nfloat GGX(float roughness, float NdotH)\n{\n float roughnessSquared = roughness * roughness;\n float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n return roughnessSquared / (czm_pi * f * f);\n}\n\n/**\n * Compute the diffuse and specular contributions using physically based\n * rendering. This function only handles direct lighting.\n * <p>\n * This function only handles the lighting calculations. Metallic/roughness\n * and specular/glossy must be handled separately. See {@czm_pbrMetallicRoughnessMaterial}, {@czm_pbrSpecularGlossinessMaterial} and {@czm_defaultPbrMaterial}\n * </p>\n *\n * @name czm_pbrlighting\n * @glslFunction\n *\n * @param {vec3} positionEC The position of the fragment in eye coordinates\n * @param {vec3} normalEC The surface normal in eye coordinates\n * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n * @param {vec3} lightColorHdr radiance of the light source. This is a HDR value.\n * @param {czm_pbrParameters} The computed PBR parameters.\n * @return {vec3} The computed HDR color\n *\n * @example\n * czm_pbrParameters pbrParameters = czm_pbrMetallicRoughnessMaterial(\n * baseColor,\n * metallic,\n * roughness\n * );\n * vec3 color = czm_pbrlighting(\n * positionEC,\n * normalEC,\n * lightDirectionEC,\n * lightColorHdr,\n * pbrParameters);\n */\nvec3 czm_pbrLighting(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n vec3 lightColorHdr,\n czm_pbrParameters pbrParameters\n)\n{\n vec3 v = -normalize(positionEC);\n vec3 l = normalize(lightDirectionEC);\n vec3 h = normalize(v + l);\n vec3 n = normalEC;\n float NdotL = clamp(dot(n, l), 0.001, 1.0);\n float NdotV = abs(dot(n, v)) + 0.001;\n float NdotH = clamp(dot(n, h), 0.0, 1.0);\n float LdotH = clamp(dot(l, h), 0.0, 1.0);\n float VdotH = clamp(dot(v, h), 0.0, 1.0);\n\n vec3 f0 = pbrParameters.f0;\n float reflectance = max(max(f0.r, f0.g), f0.b);\n vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n vec3 F = fresnelSchlick2(f0, f90, VdotH);\n\n float alpha = pbrParameters.roughness;\n float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n float D = GGX(alpha, NdotH);\n vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n\n vec3 diffuseColor = pbrParameters.diffuseColor;\n // F here represents the specular contribution\n vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n\n // Lo = (diffuse + specular) * Li * NdotL\n return (diffuseContribution + specularContribution) * NdotL * lightColorHdr;\n}\n",czm_pbrMetallicRoughnessMaterial:"/**\n * Compute parameters for physically based rendering using the\n * metallic/roughness workflow. All inputs are linear; sRGB texture values must\n * be decoded beforehand\n *\n * @name czm_pbrMetallicRoughnessMaterial\n * @glslFunction\n *\n * @param {vec3} baseColor For dielectrics, this is the base color. For metals, this is the f0 value (reflectance at normal incidence)\n * @param {float} metallic 0.0 indicates dielectric. 1.0 indicates metal. Values in between are allowed (e.g. to model rust or dirt);\n * @param {float} roughness A value between 0.0 and 1.0\n * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}\n */\nczm_pbrParameters czm_pbrMetallicRoughnessMaterial(\n vec3 baseColor,\n float metallic,\n float roughness\n) \n{\n czm_pbrParameters results;\n\n // roughness is authored as perceptual roughness\n // square it to get material roughness\n roughness = clamp(roughness, 0.0, 1.0);\n results.roughness = roughness * roughness;\n\n // dielectrics use f0 = 0.04, metals use albedo as f0\n metallic = clamp(metallic, 0.0, 1.0);\n const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\n vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);\n results.f0 = f0;\n\n // diffuse only applies to dielectrics.\n results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);\n\n return results;\n}\n",czm_pbrSpecularGlossinessMaterial:"/**\n * Compute parameters for physically based rendering using the\n * specular/glossy workflow. All inputs are linear; sRGB texture values must\n * be decoded beforehand\n *\n * @name czm_pbrSpecularGlossinessMaterial\n * @glslFunction\n *\n * @param {vec3} diffuse The diffuse color for dielectrics (non-metals)\n * @param {vec3} specular The reflectance at normal incidence (f0)\n * @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is.\n * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}\n */\nczm_pbrParameters czm_pbrSpecularGlossinessMaterial(\n vec3 diffuse,\n vec3 specular,\n float glossiness\n) \n{\n czm_pbrParameters results;\n\n // glossiness is the opposite of roughness, but easier for artists to use.\n float roughness = 1.0 - glossiness;\n results.roughness = roughness * roughness;\n\n results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));\n results.f0 = specular;\n\n return results;\n}\n",czm_phong:"float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\n return czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\n\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\n return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\n\n/**\n * Computes a color using the Phong lighting model.\n *\n * @name czm_phong\n * @glslFunction\n *\n * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.\n * @param {czm_material} material The fragment's material.\n *\n * @returns {vec4} The computed color.\n *\n * @example\n * vec3 positionToEyeEC = // ...\n * czm_material material = // ...\n * vec3 lightDirectionEC = // ...\n * out_FragColor = czm_phong(normalize(positionToEyeEC), material, lightDirectionEC);\n *\n * @see czm_getMaterial\n */\nvec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\n // Diffuse from directional light sources at eye (for top-down)\n float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\n if (czm_sceneMode == czm_sceneMode3D) {\n // (and horizon views in 3D)\n diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n }\n\n float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\n\n // Temporary workaround for adding ambient.\n vec3 materialDiffuse = material.diffuse * 0.5;\n\n vec3 ambient = materialDiffuse;\n vec3 color = ambient + material.emission;\n color += materialDiffuse * diffuse * czm_lightColor;\n color += material.specular * specular * czm_lightColor;\n\n return vec4(color, material.alpha);\n}\n\nvec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\n float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);\n float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\n\n vec3 ambient = vec3(0.0);\n vec3 color = ambient + material.emission;\n color += material.diffuse * diffuse * czm_lightColor;\n color += material.specular * specular * czm_lightColor;\n\n return vec4(color, material.alpha);\n}\n",czm_planeDistance:"/**\n * Computes distance from a point to a plane.\n *\n * @name czm_planeDistance\n * @glslFunction\n *\n * param {vec4} plane A Plane in Hessian Normal Form. See Plane.js\n * param {vec3} point A point in the same space as the plane.\n * returns {float} The distance from the point to the plane.\n */\nfloat czm_planeDistance(vec4 plane, vec3 point) {\n return (dot(plane.xyz, point) + plane.w);\n}\n\n/**\n * Computes distance from a point to a plane.\n *\n * @name czm_planeDistance\n * @glslFunction\n *\n * param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js\n * param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js\n * param {vec3} point A point in the same space as the plane.\n * returns {float} The distance from the point to the plane.\n */\nfloat czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {\n return (dot(planeNormal, point) + planeDistance);\n}\n",czm_pointAlongRay:"/**\n * Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.\n *\n * @name czm_pointAlongRay\n * @glslFunction\n *\n * @param {czm_ray} ray The ray to compute the point along.\n * @param {float} time The time along the ray.\n * \n * @returns {vec3} The point along the ray at the given time.\n * \n * @example\n * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction\n * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)\n */\nvec3 czm_pointAlongRay(czm_ray ray, float time)\n{\n return ray.origin + (time * ray.direction);\n}\n",czm_rayEllipsoidIntersectionInterval:"/**\n * DOC_TBA\n *\n * @name czm_rayEllipsoidIntersectionInterval\n * @glslFunction\n */\nczm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)\n{\n // ray and ellipsoid center in eye coordinates. radii in model coordinates.\n vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\n vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\n\n q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;\n\n float q2 = dot(q, q);\n float qw = dot(q, w);\n\n if (q2 > 1.0) // Outside ellipsoid.\n {\n if (qw >= 0.0) // Looking outward or tangent (0 intersections).\n {\n return czm_emptyRaySegment;\n }\n else // qw < 0.0.\n {\n float qw2 = qw * qw;\n float difference = q2 - 1.0; // Positively valued.\n float w2 = dot(w, w);\n float product = w2 * difference;\n\n if (qw2 < product) // Imaginary roots (0 intersections).\n {\n return czm_emptyRaySegment;\n }\n else if (qw2 > product) // Distinct roots (2 intersections).\n {\n float discriminant = qw * qw - product;\n float temp = -qw + sqrt(discriminant); // Avoid cancellation.\n float root0 = temp / w2;\n float root1 = difference / temp;\n if (root0 < root1)\n {\n czm_raySegment i = czm_raySegment(root0, root1);\n return i;\n }\n else\n {\n czm_raySegment i = czm_raySegment(root1, root0);\n return i;\n }\n }\n else // qw2 == product. Repeated roots (2 intersections).\n {\n float root = sqrt(difference / w2);\n czm_raySegment i = czm_raySegment(root, root);\n return i;\n }\n }\n }\n else if (q2 < 1.0) // Inside ellipsoid (2 intersections).\n {\n float difference = q2 - 1.0; // Negatively valued.\n float w2 = dot(w, w);\n float product = w2 * difference; // Negatively valued.\n float discriminant = qw * qw - product;\n float temp = -qw + sqrt(discriminant); // Positively valued.\n czm_raySegment i = czm_raySegment(0.0, temp / w2);\n return i;\n }\n else // q2 == 1.0. On ellipsoid.\n {\n if (qw < 0.0) // Looking inward.\n {\n float w2 = dot(w, w);\n czm_raySegment i = czm_raySegment(0.0, -qw / w2);\n return i;\n }\n else // qw >= 0.0. Looking outward or tangent.\n {\n return czm_emptyRaySegment;\n }\n }\n}\n",czm_raySphereIntersectionInterval:"/**\n * Compute the intersection interval of a ray with a sphere.\n *\n * @name czm_raySphereIntersectionInterval\n * @glslFunction\n *\n * @param {czm_ray} ray The ray.\n * @param {vec3} center The center of the sphere.\n * @param {float} radius The radius of the sphere.\n * @return {czm_raySegment} The intersection interval of the ray with the sphere.\n */\nczm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius)\n{\n vec3 o = ray.origin;\n vec3 d = ray.direction;\n\n vec3 oc = o - center;\n\n float a = dot(d, d);\n float b = 2.0 * dot(d, oc);\n float c = dot(oc, oc) - (radius * radius);\n\n float det = (b * b) - (4.0 * a * c);\n\n if (det < 0.0) {\n return czm_emptyRaySegment;\n }\n\n float sqrtDet = sqrt(det);\n\n float t0 = (-b - sqrtDet) / (2.0 * a);\n float t1 = (-b + sqrtDet) / (2.0 * a);\n\n czm_raySegment result = czm_raySegment(t0, t1);\n return result;\n}\n",czm_readDepth:"float czm_readDepth(sampler2D depthTexture, vec2 texCoords)\n{\n return czm_reverseLogDepth(texture(depthTexture, texCoords).r);\n}\n",czm_readNonPerspective:"/**\n * Reads a value previously transformed with {@link czm_writeNonPerspective}\n * by dividing it by `w`, the value used in the perspective divide.\n * This function is intended to be called in a fragment shader to access a\n * `varying` that should not be subject to perspective interpolation.\n * For example, screen-space texture coordinates. The value should have been\n * previously written in the vertex shader with a call to\n * {@link czm_writeNonPerspective}.\n *\n * @name czm_readNonPerspective\n * @glslFunction\n *\n * @param {float|vec2|vec3|vec4} value The non-perspective value to be read.\n * @param {float} oneOverW One over the perspective divide value, `w`. Usually this is simply `gl_FragCoord.w`.\n * @returns {float|vec2|vec3|vec4} The usable value.\n */\nfloat czm_readNonPerspective(float value, float oneOverW) {\n return value * oneOverW;\n}\n\nvec2 czm_readNonPerspective(vec2 value, float oneOverW) {\n return value * oneOverW;\n}\n\nvec3 czm_readNonPerspective(vec3 value, float oneOverW) {\n return value * oneOverW;\n}\n\nvec4 czm_readNonPerspective(vec4 value, float oneOverW) {\n return value * oneOverW;\n}\n",czm_reverseLogDepth:"float czm_reverseLogDepth(float logZ)\n{\n#ifdef LOG_DEPTH\n float near = czm_currentFrustum.x;\n float far = czm_currentFrustum.y;\n float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;\n float depthFromNear = pow(2.0, log2Depth) - 1.0;\n return far * (1.0 - near / (depthFromNear + near)) / (far - near);\n#endif\n return logZ;\n}\n",czm_round:"/**\n * Round a floating point value. This function exists because round() doesn't\n * exist in GLSL 1.00. \n *\n * @param {float|vec2|vec3|vec4} value The value to round\n * @param {float|vec2|vec3|vec3} The rounded value. The type matches the input.\n */\nfloat czm_round(float value) {\n return floor(value + 0.5);\n}\n\nvec2 czm_round(vec2 value) {\n return floor(value + 0.5);\n}\n\nvec3 czm_round(vec3 value) {\n return floor(value + 0.5);\n}\n\nvec4 czm_round(vec4 value) {\n return floor(value + 0.5);\n}\n",czm_sampleOctahedralProjection:"/**\n * Samples the 4 neighboring pixels and return the weighted average.\n *\n * @private\n */\nvec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)\n{\n direction /= dot(vec3(1.0), abs(direction));\n vec2 rev = abs(direction.zx) - vec2(1.0);\n vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,\n direction.z < 0.0 ? rev.y : -rev.y);\n vec2 uv = direction.y < 0.0 ? neg : direction.xz;\n vec2 coord = 0.5 * uv + vec2(0.5);\n vec2 pixel = 1.0 / textureSize;\n\n if (lod > 0.0)\n {\n // Each subseqeuent mip level is half the size\n float scale = 1.0 / pow(2.0, lod);\n float offset = ((textureSize.y + 1.0) / textureSize.x);\n\n coord.x *= offset;\n coord *= scale;\n\n coord.x += offset + pixel.x;\n coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;\n }\n else\n {\n coord.x *= (textureSize.y / textureSize.x);\n }\n\n // Do bilinear filtering\n #ifndef OES_texture_float_linear\n vec3 color1 = texture(projectedMap, coord + vec2(0.0, pixel.y)).rgb;\n vec3 color2 = texture(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;\n vec3 color3 = texture(projectedMap, coord + pixel).rgb;\n vec3 color4 = texture(projectedMap, coord).rgb;\n\n vec2 texturePosition = coord * textureSize;\n\n float fu = fract(texturePosition.x);\n float fv = fract(texturePosition.y);\n\n vec3 average1 = mix(color4, color2, fu);\n vec3 average2 = mix(color1, color3, fu);\n\n vec3 color = mix(average1, average2, fv);\n #else\n vec3 color = texture(projectedMap, coord).rgb;\n #endif\n\n return color;\n}\n\n\n/**\n * Samples from a cube map that has been projected using an octahedral projection from the given direction.\n *\n * @name czm_sampleOctahedralProjection\n * @glslFunction\n *\n * @param {sampler2D} projectedMap The texture with the octahedral projected cube map.\n * @param {vec2} textureSize The width and height dimensions in pixels of the projected map.\n * @param {vec3} direction The normalized direction used to sample the cube map.\n * @param {float} lod The level of detail to sample.\n * @param {float} maxLod The maximum level of detail.\n * @returns {vec3} The color of the cube map at the direction.\n */\nvec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\n float currentLod = floor(lod + 0.5);\n float nextLod = min(currentLod + 1.0, maxLod);\n\n vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\n vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);\n\n return mix(colorNextLod, colorCurrentLod, nextLod - lod);\n}\n",czm_saturation:"/**\n * Adjusts the saturation of a color.\n * \n * @name czm_saturation\n * @glslFunction\n * \n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n",czm_shadowDepthCompare:"\nfloat czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)\n{\n return czm_unpackDepth(czm_textureCube(shadowMap, d));\n}\n\nfloat czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\n return texture(shadowMap, uv).r;\n#else\n return czm_unpackDepth(texture(shadowMap, uv));\n#endif\n}\n\nfloat czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\n return step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n\nfloat czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\n return step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n",czm_shadowVisibility:"\nfloat czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n{\n#ifdef USE_NORMAL_SHADING\n#ifdef USE_NORMAL_SHADING_SMOOTH\n float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n#else\n float strength = step(0.0, nDotL);\n#endif\n visibility *= strength;\n#endif\n\n visibility = max(visibility, darkness);\n return visibility;\n}\n\n#ifdef USE_CUBE_MAP_SHADOW\nfloat czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n{\n float depthBias = shadowParameters.depthBias;\n float depth = shadowParameters.depth;\n float nDotL = shadowParameters.nDotL;\n float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n float darkness = shadowParameters.darkness;\n vec3 uvw = shadowParameters.texCoords;\n\n depth -= depthBias;\n float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\n return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#else\nfloat czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n{\n float depthBias = shadowParameters.depthBias;\n float depth = shadowParameters.depth;\n float nDotL = shadowParameters.nDotL;\n float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n float darkness = shadowParameters.darkness;\n vec2 uv = shadowParameters.texCoords;\n\n depth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\n vec2 texelStepSize = shadowParameters.texelStepSize;\n float radius = 1.0;\n float dx0 = -texelStepSize.x * radius;\n float dy0 = -texelStepSize.y * radius;\n float dx1 = texelStepSize.x * radius;\n float dy1 = texelStepSize.y * radius;\n float visibility = (\n czm_shadowDepthCompare(shadowMap, uv, depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n ) * (1.0 / 9.0);\n#else\n float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n#endif\n\n return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#endif\n",czm_signNotZero:"/**\n * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL\n * built-in function <code>sign</code> except that returns 1.0 instead of 0.0 when the input value is 0.0.\n * \n * @name czm_signNotZero\n * @glslFunction\n *\n * @param {} value The value for which to determine the sign.\n * @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.\n */\nfloat czm_signNotZero(float value)\n{\n return value >= 0.0 ? 1.0 : -1.0;\n}\n\nvec2 czm_signNotZero(vec2 value)\n{\n return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\n\nvec3 czm_signNotZero(vec3 value)\n{\n return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\n\nvec4 czm_signNotZero(vec4 value)\n{\n return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n",czm_sphericalHarmonics:"/**\n * Computes a color from the third order spherical harmonic coefficients and a normalized direction vector.\n * <p>\n * The order of the coefficients is [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22].\n * </p>\n *\n * @name czm_sphericalHarmonics\n * @glslFunction\n *\n * @param {vec3} normal The normalized direction.\n * @param {vec3[9]} coefficients The third order spherical harmonic coefficients.\n * @returns {vec3} The color at the direction.\n *\n * @see https://graphics.stanford.edu/papers/envmap/envmap.pdf\n */\nvec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])\n{\n vec3 L00 = coefficients[0];\n vec3 L1_1 = coefficients[1];\n vec3 L10 = coefficients[2];\n vec3 L11 = coefficients[3];\n vec3 L2_2 = coefficients[4];\n vec3 L2_1 = coefficients[5];\n vec3 L20 = coefficients[6];\n vec3 L21 = coefficients[7];\n vec3 L22 = coefficients[8];\n\n float x = normal.x;\n float y = normal.y;\n float z = normal.z;\n\n return\n L00\n + L1_1 * y\n + L10 * z\n + L11 * x\n + L2_2 * (y * x)\n + L2_1 * (y * z)\n + L20 * (3.0 * z * z - 1.0)\n + L21 * (z * x)\n + L22 * (x * x - y * y);\n}\n",czm_srgbToLinear:"/**\n * Converts an sRGB color to a linear RGB color.\n *\n * @param {vec3|vec4} srgbIn The color in sRGB space\n * @returns {vec3|vec4} The color in linear color space. The vector type matches the input.\n */\nvec3 czm_srgbToLinear(vec3 srgbIn)\n{\n return pow(srgbIn, vec3(2.2));\n}\n\nvec4 czm_srgbToLinear(vec4 srgbIn) \n{\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n return vec4(linearOut, srgbIn.a);\n}\n",czm_tangentToEyeSpaceMatrix:"/**\n * Creates a matrix that transforms vectors from tangent space to eye space.\n *\n * @name czm_tangentToEyeSpaceMatrix\n * @glslFunction\n *\n * @param {vec3} normalEC The normal vector in eye coordinates.\n * @param {vec3} tangentEC The tangent vector in eye coordinates.\n * @param {vec3} bitangentEC The bitangent vector in eye coordinates.\n *\n * @returns {mat3} The matrix that transforms from tangent space to eye space.\n *\n * @example\n * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);\n * vec3 normal = tangentToEye * texture(normalMap, st).xyz;\n */\nmat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n{\n vec3 normal = normalize(normalEC);\n vec3 tangent = normalize(tangentEC);\n vec3 bitangent = normalize(bitangentEC);\n return mat3(tangent.x , tangent.y , tangent.z,\n bitangent.x, bitangent.y, bitangent.z,\n normal.x , normal.y , normal.z);\n}\n",czm_textureCube:"/**\n * A wrapper around the texture (WebGL2) / textureCube (WebGL1)\n * function to allow for WebGL 1 support.\n * \n * @name czm_textureCube\n * @glslFunction\n *\n * @param {samplerCube} sampler The sampler.\n * @param {vec3} p The coordinates to sample the texture at.\n */\nvec4 czm_textureCube(samplerCube sampler, vec3 p) {\n#if __VERSION__ == 300\n return texture(sampler, p);\n#else \n return textureCube(sampler, p);\n#endif\n}",czm_transformPlane:"/**\n * Transforms a plane.\n * \n * @name czm_transformPlane\n * @glslFunction\n *\n * @param {vec4} plane The plane in Hessian Normal Form.\n * @param {mat4} transform The inverse-transpose of a transformation matrix.\n */\nvec4 czm_transformPlane(vec4 plane, mat4 transform) {\n vec4 transformedPlane = transform * plane;\n // Convert the transformed plane to Hessian Normal Form\n float normalMagnitude = length(transformedPlane.xyz);\n return transformedPlane / normalMagnitude;\n}\n",czm_translateRelativeToEye:"/**\n * Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},\n * and then provided to the shader as separate <code>high</code> and <code>low</code> bits to\n * be relative to the eye. As shown in the example, the position can then be transformed in eye\n * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},\n * respectively.\n * <p>\n * This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as\n * described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}.\n * </p>\n *\n * @name czm_translateRelativeToEye\n * @glslFunction\n *\n * @param {vec3} high The position's high bits.\n * @param {vec3} low The position's low bits.\n * @returns {vec3} The position translated to be relative to the camera's position.\n *\n * @example\n * in vec3 positionHigh;\n * in vec3 positionLow;\n *\n * void main()\n * {\n * vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n * }\n *\n * @see czm_modelViewRelativeToEye\n * @see czm_modelViewProjectionRelativeToEye\n * @see czm_computePosition\n * @see EncodedCartesian3\n */\nvec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\n vec3 highDifference = high - czm_encodedCameraPositionMCHigh;\n // This check handles the case when NaN values have gotten into `highDifference`.\n // Such a thing could happen on devices running iOS.\n if (length(highDifference) == 0.0) { \n highDifference = vec3(0); \n }\n vec3 lowDifference = low - czm_encodedCameraPositionMCLow;\n\n return vec4(highDifference + lowDifference, 1.0);\n}\n",czm_translucentPhong:"/**\n * @private\n */\nvec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\n // Diffuse from directional light sources at eye (for top-down and horizon views)\n float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\n\n if (czm_sceneMode == czm_sceneMode3D) {\n // (and horizon views in 3D)\n diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n }\n\n diffuse = clamp(diffuse, 0.0, 1.0);\n\n float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);\n\n // Temporary workaround for adding ambient.\n vec3 materialDiffuse = material.diffuse * 0.5;\n\n vec3 ambient = materialDiffuse;\n vec3 color = ambient + material.emission;\n color += materialDiffuse * diffuse * czm_lightColor;\n color += material.specular * specular * czm_lightColor;\n\n return vec4(color, material.alpha);\n}\n",czm_transpose:"/**\n * Returns the transpose of the matrix. The input <code>matrix</code> can be\n * a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.\n *\n * @name czm_transpose\n * @glslFunction\n *\n * @param {} matrix The matrix to transpose.\n *\n * @returns {} The transposed matrix.\n *\n * @example\n * // GLSL declarations\n * mat2 czm_transpose(mat2 matrix);\n * mat3 czm_transpose(mat3 matrix);\n * mat4 czm_transpose(mat4 matrix);\n *\n * // Transpose a 3x3 rotation matrix to find its inverse.\n * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(\n * positionMC, normalEC);\n * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);\n */\nmat2 czm_transpose(mat2 matrix)\n{\n return mat2(\n matrix[0][0], matrix[1][0],\n matrix[0][1], matrix[1][1]);\n}\n\nmat3 czm_transpose(mat3 matrix)\n{\n return mat3(\n matrix[0][0], matrix[1][0], matrix[2][0],\n matrix[0][1], matrix[1][1], matrix[2][1],\n matrix[0][2], matrix[1][2], matrix[2][2]);\n}\n\nmat4 czm_transpose(mat4 matrix)\n{\n return mat4(\n matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\n matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\n matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\n matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n",czm_unpackClippingExtents:"vec2 getLookupUv(vec2 dimensions, int i) {\n int pixY = i / int(dimensions.x);\n int pixX = i - (pixY * int(dimensions.x));\n float pixelWidth = 1.0 / dimensions.x;\n float pixelHeight = 1.0 / dimensions.y;\n float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel\n float v = (float(pixY) + 0.5) * pixelHeight;\n return vec2(u, v);\n}\n\nvec4 czm_unpackClippingExtents(highp sampler2D extentsTexture, int index) {\n vec2 textureDimensions = vec2(textureSize(extentsTexture, 0));\n return texture(extentsTexture, getLookupUv(textureDimensions, index));\n}",czm_unpackDepth:"/**\n * Unpacks a vec4 depth value to a float in [0, 1) range.\n *\n * @name czm_unpackDepth\n * @glslFunction\n *\n * @param {vec4} packedDepth The packed depth.\n *\n * @returns {float} The floating-point depth in [0, 1) range.\n */\n float czm_unpackDepth(vec4 packedDepth)\n {\n // See Aras Pranckevičius' post Encoding Floats to RGBA\n // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n }\n",czm_unpackFloat:"/**\n * Unpack an IEEE 754 single-precision float that is packed as a little-endian unsigned normalized vec4.\n *\n * @name czm_unpackFloat\n * @glslFunction\n *\n * @param {vec4} packedFloat The packed float.\n *\n * @returns {float} The floating-point depth in arbitrary range.\n */\nfloat czm_unpackFloat(vec4 packedFloat)\n{\n // Convert to [0.0, 255.0] and round to integer\n packedFloat = floor(packedFloat * 255.0 + 0.5);\n float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;\n float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0; \n if (exponent == -127.0)\n {\n return 0.0;\n }\n float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);\n float result = sign * exp2(exponent - 23.0) * mantissa;\n return result;\n}\n",czm_unpackUint:"/**\n * Unpack unsigned integers of 1-4 bytes. in WebGL 1, there is no uint type,\n * so the return value is an int.\n * <p>\n * There are also precision limitations in WebGL 1. highp int is still limited\n * to 24 bits. Above the value of 2^24 = 16777216, precision loss may occur.\n * </p>\n *\n * @param {float|vec2|vec3|vec4} packed The packed value. For vectors, the components are listed in little-endian order.\n *\n * @return {int} The unpacked value.\n */\n int czm_unpackUint(float packedValue) {\n float rounded = czm_round(packedValue * 255.0);\n return int(rounded);\n }\n\n int czm_unpackUint(vec2 packedValue) {\n vec2 rounded = czm_round(packedValue * 255.0);\n return int(dot(rounded, vec2(1.0, 256.0)));\n }\n\n int czm_unpackUint(vec3 packedValue) {\n vec3 rounded = czm_round(packedValue * 255.0);\n return int(dot(rounded, vec3(1.0, 256.0, 65536.0)));\n }\n\n int czm_unpackUint(vec4 packedValue) {\n vec4 rounded = czm_round(packedValue * 255.0);\n return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));\n }\n",czm_valueTransform:"/**\n * Transform metadata values following the EXT_structural_metadata spec\n * by multiplying by scale and adding the offset. Operations are always\n * performed component-wise, even for matrices.\n * \n * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} offset The offset to add\n * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} scale The scale factor to multiply\n * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} value The original value.\n *\n * @return {float|vec2|vec3|vec4|mat2|mat3|mat4} The transformed value of the same scalar/vector/matrix type as the input.\n */\nfloat czm_valueTransform(float offset, float scale, float value) {\n return scale * value + offset;\n}\n\nvec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) {\n return scale * value + offset;\n}\n\nvec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) {\n return scale * value + offset;\n}\n\nvec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) {\n return scale * value + offset;\n}\n\nmat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) {\n return matrixCompMult(scale, value) + offset;\n}\n\nmat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) {\n return matrixCompMult(scale, value) + offset;\n}\n\nmat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) {\n return matrixCompMult(scale, value) + offset;\n}\n",czm_vertexLogDepth:"#ifdef LOG_DEPTH\n// 1.0 at the near plane, increasing linearly from there.\nout float v_depthFromNearPlusOne;\n#ifdef SHADOW_MAP\nout vec3 v_logPositionEC;\n#endif\n#endif\n\nvec4 czm_updatePositionDepth(vec4 coords) {\n#if defined(LOG_DEPTH)\n\n#ifdef SHADOW_MAP\n vec3 logPositionEC = (czm_inverseProjection * coords).xyz;\n v_logPositionEC = logPositionEC;\n#endif\n\n // With the very high far/near ratios used with the logarithmic depth\n // buffer, floating point rounding errors can cause linear depth values\n // to end up on the wrong side of the far plane, even for vertices that\n // are really nowhere near it. Since we always write a correct logarithmic\n // depth value in the fragment shader anyway, we just need to make sure\n // such errors don't cause the primitive to be clipped entirely before\n // we even get to the fragment shader.\n coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n#endif\n\n return coords;\n}\n\n/**\n * Writes the logarithmic depth to gl_Position using the already computed gl_Position.\n *\n * @name czm_vertexLogDepth\n * @glslFunction\n */\nvoid czm_vertexLogDepth()\n{\n#ifdef LOG_DEPTH\n v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;\n gl_Position = czm_updatePositionDepth(gl_Position);\n#endif\n}\n\n/**\n * Writes the logarithmic depth to gl_Position using the provided clip coordinates.\n * <p>\n * An example use case for this function would be moving the vertex in window coordinates\n * before converting back to clip coordinates. Use the original vertex clip coordinates.\n * </p>\n * @name czm_vertexLogDepth\n * @glslFunction\n *\n * @param {vec4} clipCoords The vertex in clip coordinates.\n *\n * @example\n * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));\n */\nvoid czm_vertexLogDepth(vec4 clipCoords)\n{\n#ifdef LOG_DEPTH\n v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;\n czm_updatePositionDepth(clipCoords);\n#endif\n}\n",czm_windowToEyeCoordinates:"vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)\n{\n // Reconstruct NDC coordinates\n float x = 2.0 * screenCoordinate.x - 1.0;\n float y = 2.0 * screenCoordinate.y - 1.0;\n float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n vec4 q = vec4(x, y, z, 1.0);\n\n // Reverse the perspective division to obtain clip coordinates.\n q /= screenCoordinate.w;\n\n // Reverse the projection transformation to obtain eye coordinates.\n if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s\n {\n q = czm_inverseProjection * q;\n }\n else\n {\n float top = czm_frustumPlanes.x;\n float bottom = czm_frustumPlanes.y;\n float left = czm_frustumPlanes.z;\n float right = czm_frustumPlanes.w;\n\n float near = czm_currentFrustum.x;\n float far = czm_currentFrustum.y;\n\n q.x = (q.x * (right - left) + left + right) * 0.5;\n q.y = (q.y * (top - bottom) + bottom + top) * 0.5;\n q.z = (q.z * (near - far) - near - far) * 0.5;\n q.w = 1.0;\n }\n\n return q;\n}\n\n/**\n * Transforms a position from window to eye coordinates.\n * The transform from window to normalized device coordinates is done using components\n * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n * the inverse of <code>czm_viewportTransformation</code>. The transformation from\n * normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,\n * which is expected to be the scalar used in the perspective divide. The transformation\n * from clip to eye coordinates is done using {@link czm_inverseProjection}.\n *\n * @name czm_windowToEyeCoordinates\n * @glslFunction\n *\n * @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n *\n * @returns {vec4} The transformed position in eye coordinates.\n *\n * @see czm_modelToWindowCoordinates\n * @see czm_eyeToWindowCoordinates\n * @see czm_inverseProjection\n * @see czm_viewport\n * @see czm_viewportTransformation\n *\n * @example\n * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n */\nvec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\n vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;\n return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));\n}\n\nvec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)\n{\n // See reverseLogDepth.glsl. This is separate to re-use the pow.\n#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)\n float near = czm_currentFrustum.x;\n float far = czm_currentFrustum.y;\n float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;\n float depthFromNear = pow(2.0, log2Depth) - 1.0;\n float depthFromCamera = depthFromNear + near;\n vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);\n vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);\n eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision\n return eyeCoordinate;\n#else\n vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);\n vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);\n#endif\n return eyeCoordinate;\n}\n\n/**\n * Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.\n * This function produces more accurate results for window positions with log depth than\n * conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version\n * of czm_windowToEyeCoordinates.\n *\n * @name czm_windowToEyeCoordinates\n * @glslFunction\n *\n * @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.\n * @param {float} depthOrLogDepth A depth or log depth for the fragment.\n *\n * @see czm_modelToWindowCoordinates\n * @see czm_eyeToWindowCoordinates\n * @see czm_inverseProjection\n * @see czm_viewport\n * @see czm_viewportTransformation\n *\n * @returns {vec4} The transformed position in eye coordinates.\n */\nvec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n{\n vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;\n return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);\n}\n",czm_writeDepthClamp:"// emulated noperspective\n#if !defined(LOG_DEPTH)\nin float v_WindowZ;\n#endif\n\n/**\n * Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane\n * by writing the fragment's depth. See czm_depthClamp for more details.\n *\n * @name czm_writeDepthClamp\n * @glslFunction\n *\n * @example\n * out_FragColor = color;\n * czm_writeDepthClamp();\n *\n * @see czm_depthClamp\n */\nvoid czm_writeDepthClamp()\n{\n#if (!defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))\n gl_FragDepth = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);\n#endif\n}\n",czm_writeLogDepth:"#ifdef LOG_DEPTH\nin float v_depthFromNearPlusOne;\n\n#ifdef POLYGON_OFFSET\nuniform vec2 u_polygonOffset;\n#endif\n\n#endif\n\n/**\n * Writes the fragment depth to the logarithmic depth buffer.\n * <p>\n * Use this when the vertex shader does not call {@link czm_vertexlogDepth}, for example, when\n * ray-casting geometry using a full screen quad.\n * </p>\n * @name czm_writeLogDepth\n * @glslFunction\n *\n * @param {float} depth The depth coordinate, where 1.0 is on the near plane and\n * depth increases in eye-space units from there\n *\n * @example\n * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);\n */\nvoid czm_writeLogDepth(float depth)\n{\n#if (defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))\n // Discard the vertex if it's not between the near and far planes.\n // We allow a bit of epsilon on the near plane comparison because a 1.0\n // from the vertex shader (indicating the vertex should be _on_ the near\n // plane) will not necessarily come here as exactly 1.0.\n if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {\n discard;\n }\n\n#ifdef POLYGON_OFFSET\n // Polygon offset: m * factor + r * units\n float factor = u_polygonOffset[0];\n float units = u_polygonOffset[1];\n\n#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n // This factor doesn't work in IE 10\n if (factor != 0.0) {\n // m = sqrt(dZdX^2 + dZdY^2);\n float x = dFdx(depth);\n float y = dFdy(depth);\n float m = sqrt(x * x + y * y);\n\n // Apply the factor before computing the log depth.\n depth += m * factor;\n }\n#endif\n\n#endif\n\n gl_FragDepth = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;\n\n#ifdef POLYGON_OFFSET\n // Apply the units after the log depth.\n gl_FragDepth += czm_epsilon7 * units;\n#endif\n\n#endif\n}\n\n/**\n * Writes the fragment depth to the logarithmic depth buffer.\n * <p>\n * Use this when the vertex shader calls {@link czm_vertexlogDepth}.\n * </p>\n *\n * @name czm_writeLogDepth\n * @glslFunction\n */\nvoid czm_writeLogDepth() {\n#ifdef LOG_DEPTH\n czm_writeLogDepth(v_depthFromNearPlusOne);\n#endif\n}\n",czm_writeNonPerspective:"/**\n * Transforms a value for non-perspective interpolation by multiplying\n * it by w, the value used in the perspective divide. This function is\n * intended to be called in a vertex shader to compute the value of a\n * `varying` that should not be subject to perspective interpolation.\n * For example, screen-space texture coordinates. The fragment shader\n * must call {@link czm_readNonPerspective} to retrieve the final\n * non-perspective value.\n *\n * @name czm_writeNonPerspective\n * @glslFunction\n *\n * @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective.\n * @param {float} w The perspective divide value. Usually this is the computed `gl_Position.w`.\n * @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a `varying` and read in the\n * fragment shader with {@link czm_readNonPerspective}.\n */\nfloat czm_writeNonPerspective(float value, float w) {\n return value * w;\n}\n\nvec2 czm_writeNonPerspective(vec2 value, float w) {\n return value * w;\n}\n\nvec3 czm_writeNonPerspective(vec3 value, float w) {\n return value * w;\n}\n\nvec4 czm_writeNonPerspective(vec4 value, float w) {\n return value * w;\n}\n"};function fc(e){return(e=e.replace(/\/\/.*/g,"")).replace(/\/\*\*[\s\S]*?\*\//gm,(function(e){const t=e.match(/\n/gm).length;let n="";for(let i=0;i<t;++i)n+="\n";return n}))}function mc(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return D(i)||(i={name:e,glslSource:t=fc(t),dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function _c(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);D(n)&&null!==n&&(n=n.filter((function(e,t){return n.indexOf(e)===t})),n.forEach((function(n){if(n!==e.name&&bc._czmBuiltinsAndUniforms.hasOwnProperty(n)){const i=mc(n,bc._czmBuiltinsAndUniforms[n],t);e.dependsOn.push(i),i.requiredBy.push(e),_c(i,t)}})))}function gc(e){const t=[],n=mc("main",e,t);_c(n,t),function(e){const t=[],n=[];for(;e.length>0;){const i=e.pop();n.push(i),0===i.requiredBy.length&&t.push(i)}for(;t.length>0;){const n=t.shift();e.push(n);for(let e=0;e<n.dependsOn.length;++e){const i=n.dependsOn[e],o=i.requiredBy.indexOf(n);i.requiredBy.splice(o,1),0===i.requiredBy.length&&t.push(i)}}const i=[];for(let o=0;o<n.length;++o)0!==n[o].requiredBy.length&&i.push(n[o]);if(0!==i.length){let e="A circular dependency was found in the following built-in functions/structs/constants: \n";for(let t=0;t<i.length;++t)e=`${e+i[t].name}\n`;throw new P(e)}}(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}\n`;return i.replace(n.glslSource,"")}function yc(e,t,n){let i,o,r="";const s=e.sources;if(D(s))for(i=0,o=s.length;i<o;++i)r+=`\n#line 0\n${s[i]}`;let a;r=fc(r),r=r.replace(/#version\s+(.*?)\n/gm,(function(e,t){if(D(a)&&a!==t)throw new P(`inconsistent versions found: ${a} and ${t}`);return a=t,"\n"}));const c=[];r=r.replace(/#extension.*\n/gm,(function(e){return c.push(e),"\n"})),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");const l=e.pickColorQualifier;D(l)&&(r=bc.createPickFragmentShaderSource(r,l));let u="";const d=c.length;for(i=0;i<d;i++)u+=c[i];t&&(u+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n #define highp mediump\n#endif\n\n");const h=e.defines;if(D(h))for(i=0,o=h.length;i<o;++i){const e=h[i];0!==e.length&&(u+=`#define ${e}\n`)}n.textureFloatLinear&&(u+="#define OES_texture_float_linear\n\n"),n.floatingPointTexture&&(u+="#define OES_texture_float\n\n");let p="";e.includeBuiltIns&&(p=gc(r)),u+="\n#line 0\n";const f=p+r;return n.webgl2&&t&&!/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g.test(f)&&!/czm_out_FragColor/g.test(f)&&/out_FragColor/g.test(f)&&(u+="layout(location = 0) out vec4 out_FragColor;\n\n"),u+=p,u+=r,u=n.webgl2?`#version 300 es\n${u}`:function(e,t){let n=e;return n=n.replaceAll("version 300 es",""),n=n.replaceAll(/(texture\()/g,"texture2D("),t?(n=n.replaceAll(/\n\s*(in)\s+(vec\d|mat\d|float)/g,"\nvarying $2"),/out_FragData_(\d+)/.test(n)&&(n=`#extension GL_EXT_draw_buffers : enable\n${n}`,n=n.replaceAll(/layout\s+\(location\s*=\s*\d+\)\s*out\s+vec4\s+out_FragData_\d+;/g,""),n=n.replaceAll(/out_FragData_(\d+)/g,"gl_FragData[$1]")),n=n.replaceAll(/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,""),n=n.replaceAll(/out_FragColor/g,"gl_FragColor"),n=n.replaceAll(/out_FragColor\[(\d+)\]/g,"gl_FragColor[$1]"),/gl_FragDepth/.test(n)&&(n=`#extension GL_EXT_frag_depth : enable\n${n}`,n=n.replaceAll(/gl_FragDepth/g,"gl_FragDepthEXT")),n=`#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n${n}`):(n=n.replaceAll(/(in)\s+(vec\d|mat\d|float)/g,"attribute $2"),n=n.replaceAll(/(out)\s+(vec\d|mat\d|float)\s+([\w]+);/g,"varying $2 $3;")),n=`#version 100\n${n}`,n}(u,t),u}function bc(e){const t=(e=M(e,M.EMPTY_OBJECT)).pickColorQualifier;if(D(t)&&"uniform"!==t&&"in"!==t)throw new P("options.pickColorQualifier must be 'uniform' or 'in'.");this.defines=D(e.defines)?e.defines.slice(0):[],this.sources=D(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=M(e.includeBuiltIns,!0)}bc.prototype.clone=function(){return new bc({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})},bc.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)},bc.prototype.getCacheKey=function(){return`${this.defines.slice().sort().join(",")}:${this.pickColorQualifier}:${this.includeBuiltIns}:${this.sources.join("\n")}`},bc.prototype.createCombinedVertexShader=function(e){return yc(this,!1,e)},bc.prototype.createCombinedFragmentShader=function(e){return yc(this,!0,e)},bc._czmBuiltinsAndUniforms={};for(const ko in pc)pc.hasOwnProperty(ko)&&(bc._czmBuiltinsAndUniforms[ko]=pc[ko]);for(const ko in Ue)if(Ue.hasOwnProperty(ko)){const e=Ue[ko];"function"==typeof e.getDeclaration&&(bc._czmBuiltinsAndUniforms[ko]=e.getDeclaration(ko))}function vc(e,t){const n=e.sources,i=n.length;for(let o=0;o<i;++o)if(-1!==n[o].indexOf(t))return!0;return!1}function Ac(e,t){const n=t.length;for(let i=0;i<n;++i){const n=t[i];if(vc(e,n))return n}}bc.createPickVertexShaderSource=function(e){return`${bc.replaceMain(e,"czm_old_main")}\nin vec4 pickColor; \nout vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}`},bc.createPickFragmentShaderSource=function(e,t){return`${bc.replaceMain(e,"czm_old_main")}\n${`${t} vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n if (out_FragColor.a == 0.0) { \n discard; \n } \n out_FragColor = czm_pickColor; \n}`}`};const Tc=["v_normalEC","v_normal"];bc.findNormalVarying=function(e){return vc(e,"#ifdef HAS_NORMALS")?function(e,t){const n=e.defines,i=n.length;for(let o=0;o<i;++o)if(n[o]===t)return!0;return!1}(e,"HAS_NORMALS")?"v_normalEC":void 0:Ac(e,Tc)};const wc=["v_positionEC"];function Ec(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}function xc(e,t){const n=t.derivedKeywords,i=n.length;for(let o=0;o<i;++o){const i=n[o]+t.keyword;xc(e,e._shaders[i])}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}function Sc(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context);const t=e.context;let n=e.width,i=e.height;const o=e.source;D(o)&&(D(n)||(n=M(o.videoWidth,o.width)),D(i)||(i=M(o.videoHeight,o.height)));const r=M(e.pixelFormat,is.RGBA),s=M(e.pixelDatatype,ts.UNSIGNED_BYTE),a=is.toInternalFormat(r,s,t),c=is.isCompressedFormat(a);if(!D(n)||!D(i))throw new P("options requires a source field to create an initialized texture or width and height fields to create a blank texture.");if(L.typeOf.number.greaterThan("width",n,0),n>rs.maximumTextureSize)throw new P(`Width must be less than or equal to the maximum texture size (${rs.maximumTextureSize}). Check maximumTextureSize.`);if(L.typeOf.number.greaterThan("height",i,0),i>rs.maximumTextureSize)throw new P(`Height must be less than or equal to the maximum texture size (${rs.maximumTextureSize}). Check maximumTextureSize.`);if(!is.validate(r))throw new P("Invalid options.pixelFormat.");if(!c&&!ts.validate(s))throw new P("Invalid options.pixelDatatype.");if(r===is.DEPTH_COMPONENT&&s!==ts.UNSIGNED_SHORT&&s!==ts.UNSIGNED_INT)throw new P("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(r===is.DEPTH_STENCIL&&s!==ts.UNSIGNED_INT_24_8)throw new P("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(s===ts.FLOAT&&!t.floatingPointTexture)throw new P("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.");if(s===ts.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new P("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.");if(is.isDepthFormat(r)){if(D(o))throw new P("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.");if(!t.depthTexture)throw new P("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.")}if(c){if(!D(o)||!D(o.arrayBufferView))throw new P("When options.pixelFormat is compressed, options.source.arrayBufferView must be defined.");if(is.isDXTFormat(a)&&!t.s3tc)throw new P("When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc.");if(is.isPVRTCFormat(a)&&!t.pvrtc)throw new P("When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc.");if(is.isASTCFormat(a)&&!t.astc)throw new P("When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc.");if(is.isETC2Format(a)&&!t.etc)throw new P("When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc.");if(is.isETC1Format(a)&&!t.etc1)throw new P("When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1.");if(is.isBC7Format(a)&&!t.bc7)throw new P("When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7.");if(is.compressedTextureSizeInBytes(a,n,i)!==o.arrayBufferView.byteLength)throw new P("The byte length of the array buffer is invalid for the compressed texture with the given width and height.")}const l=e.preMultiplyAlpha||r===is.RGB||r===is.LUMINANCE,u=M(e.flipY,!0),d=M(e.skipColorSpaceConversion,!1);let h=!0;const p=t._gl,f=p.TEXTURE_2D,m=p.createTexture();p.activeTexture(p.TEXTURE0),p.bindTexture(f,m);let _,g=4;if(D(o)&&D(o.arrayBufferView)&&!c&&(g=is.alignmentInBytes(r,s,n)),p.pixelStorei(p.UNPACK_ALIGNMENT,g),d?p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.NONE):p.pixelStorei(p.UNPACK_COLORSPACE_CONVERSION_WEBGL,p.BROWSER_DEFAULT_WEBGL),D(o))if(D(o.arrayBufferView)){p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!1);let e,l,d,h=o.arrayBufferView;if(c){if(p.compressedTexImage2D(f,0,a,n,i,0,h),D(o.mipLevels))for(l=n,d=i,e=0;e<o.mipLevels.length;++e)l=0|Math.floor(l/2),l<1&&(l=1),d=0|Math.floor(d/2),d<1&&(d=1),p.compressedTexImage2D(f,e+1,a,l,d,0,o.mipLevels[e])}else if(u&&(h=is.flipY(h,r,s,n,i)),p.texImage2D(f,0,a,n,i,0,r,ts.toWebGLConstant(s,t),h),D(o.mipLevels))for(l=n,d=i,e=0;e<o.mipLevels.length;++e)l=0|Math.floor(l/2),l<1&&(l=1),d=0|Math.floor(d/2),d<1&&(d=1),p.texImage2D(f,e+1,a,l,d,0,r,ts.toWebGLConstant(s,t),o.mipLevels[e])}else D(o.framebuffer)?(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!1),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._bind(),p.copyTexImage2D(f,0,a,o.xOffset,o.yOffset,n,i,0),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._unBind()):(p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,u),p.texImage2D(f,0,a,r,ts.toWebGLConstant(s,t),o));else p.texImage2D(f,0,a,n,i,0,r,ts.toWebGLConstant(s,t),null),h=!1;p.bindTexture(f,null),_=c?is.compressedTextureSizeInBytes(r,n,i):is.textureSizeInBytes(r,s,n,i),this._id=ke(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=f,this._texture=m,this._internalFormat=a,this._pixelFormat=r,this._pixelDatatype=s,this._width=n,this._height=i,this._dimensions=new kt(n,i),this._hasMipmap=!1,this._sizeInBytes=_,this._preMultiplyAlpha=l,this._flipY=u,this._initialized=h,this._sampler=void 0,this.sampler=D(e.sampler)?e.sampler:new uc}function Cc(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}function Ic(){this.high=H.clone(H.ZERO),this.low=H.clone(H.ZERO)}bc.findPositionVarying=function(e){return Ac(e,wc)},Object.defineProperties(Ec.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}}),Ec.prototype.replaceShaderProgram=function(e){return D(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)},Ec.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource;const i=e.attributeLocations;"string"==typeof t&&(t=new bc({sources:[t]})),"string"==typeof n&&(n=new bc({sources:[n]}));const o=`${t.getCacheKey()}:${n.getCacheKey()}:${D(i)?function(e){const t=Object.keys(e).sort();return JSON.stringify(e,t)}(i):""}`;let r;if(D(this._shaders[o]))r=this._shaders[o],delete this._shadersToRelease[o];else{const e=this._context,s=t.createCombinedVertexShader(e),a=n.createCombinedFragmentShader(e),c=new ya({gl:e._gl,logShaderCompilation:e.logShaderCompilation,debugShaders:e.debugShaders,vertexShaderSource:t,vertexShaderText:s,fragmentShaderSource:n,fragmentShaderText:a,attributeLocations:i});r={cache:this,shaderProgram:c,keyword:o,derivedKeywords:[],count:0},c._cachedShader=r,this._shaders[o]=r,++this._numberOfShaders}return++r.count,r.shaderProgram},Ec.prototype.replaceDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(D(r)){xc(this,r);const e=i.derivedKeywords.indexOf(t);e>-1&&i.derivedKeywords.splice(e,1)}return this.createDerivedShaderProgram(e,t,n)},Ec.prototype.getDerivedShaderProgram=function(e,t){const n=t+e._cachedShader.keyword,i=this._shaders[n];if(D(i))return i.shaderProgram},Ec.prototype.createDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword;let r=n.vertexShaderSource,s=n.fragmentShaderSource;const a=n.attributeLocations;"string"==typeof r&&(r=new bc({sources:[r]})),"string"==typeof s&&(s=new bc({sources:[s]}));const c=this._context,l=r.createCombinedVertexShader(c),u=s.createCombinedFragmentShader(c),d=new ya({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:r,vertexShaderText:l,fragmentShaderSource:s,fragmentShaderText:u,attributeLocations:a}),h={cache:this,shaderProgram:d,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),d._cachedShader=h,this._shaders[o]=h,d},Ec.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){xc(this,e[t]),--this._numberOfShaders}this._shadersToRelease={}},Ec.prototype.releaseShaderProgram=function(e){if(D(e)){const t=e._cachedShader;t&&0==--t.count&&(this._shadersToRelease[t.keyword]=t)}},Ec.prototype.isDestroyed=function(){return!1},Ec.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return He(this)},Sc.create=function(e){return new Sc(e)},Sc.fromFramebuffer=function(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context);const t=e.context,n=t._gl,i=M(e.pixelFormat,is.RGB),o=M(e.framebufferXOffset,0),r=M(e.framebufferYOffset,0),s=M(e.width,n.drawingBufferWidth),a=M(e.height,n.drawingBufferHeight),c=e.framebuffer;if(!is.validate(i))throw new P("Invalid pixelFormat.");if(is.isDepthFormat(i)||is.isCompressedFormat(i))throw new P("pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.");if(L.defined("options.context",e.context),L.typeOf.number.greaterThanOrEquals("framebufferXOffset",o,0),L.typeOf.number.greaterThanOrEquals("framebufferYOffset",r,0),o+s>n.drawingBufferWidth)throw new P("framebufferXOffset + width must be less than or equal to drawingBufferWidth");if(r+a>n.drawingBufferHeight)throw new P("framebufferYOffset + height must be less than or equal to drawingBufferHeight.");return new Sc({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:D(c)?c:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})},Object.defineProperties(Sc.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=this._context,o=this._pixelFormat,r=this._pixelDatatype,s=t===ac.NEAREST_MIPMAP_NEAREST||t===ac.NEAREST_MIPMAP_LINEAR||t===ac.LINEAR_MIPMAP_NEAREST||t===ac.LINEAR_MIPMAP_LINEAR;(r===ts.FLOAT&&!i.textureFloatLinear||r===ts.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?ac.NEAREST_MIPMAP_NEAREST:ac.NEAREST,n=rc.NEAREST),i.webgl2&&is.isDepthFormat(o)&&(t=ac.NEAREST,n=rc.NEAREST);const a=i._gl,c=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(c,this._texture),a.texParameteri(c,a.TEXTURE_MIN_FILTER,t),a.texParameteri(c,a.TEXTURE_MAG_FILTER,n),a.texParameteri(c,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(c,a.TEXTURE_WRAP_T,e.wrapT),D(this._textureFilterAnisotropic)&&a.texParameteri(c,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(c,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}}}),Sc.prototype.copyFrom=function(e){L.defined("options",e);const t=M(e.xOffset,0),n=M(e.yOffset,0);if(L.defined("options.source",e.source),is.isDepthFormat(this._pixelFormat))throw new P("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(is.isCompressedFormat(this._pixelFormat))throw new P("Cannot call copyFrom with a compressed texture pixel format.");L.typeOf.number.greaterThanOrEquals("xOffset",t,0),L.typeOf.number.greaterThanOrEquals("yOffset",n,0),L.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+e.source.width,this._width),L.typeOf.number.lessThanOrEquals("yOffset + options.source.height",n+e.source.height,this._height);const i=e.source,o=this._context,r=o._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture);const a=i.width,c=i.height;let l=i.arrayBufferView;const u=this._width,d=this._height,h=this._internalFormat,p=this._pixelFormat,f=this._pixelDatatype,m=this._preMultiplyAlpha,_=this._flipY,g=M(e.skipColorSpaceConversion,!1);let y=4;D(l)&&(y=is.alignmentInBytes(p,f,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,y),g?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let b=!1;if(!this._initialized){if(0===t&&0===n&&a===u&&c===d)D(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),_&&(l=is.flipY(l,p,f,u,d)),r.texImage2D(s,0,h,u,d,0,p,ts.toWebGLConstant(f,o),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,_),r.texImage2D(s,0,h,p,ts.toWebGLConstant(f,o),i)),b=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const e=is.createTypedArray(p,f,u,d);r.texImage2D(s,0,h,u,d,0,p,ts.toWebGLConstant(f,o),e)}this._initialized=!0}b||(D(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),_&&(l=is.flipY(l,p,f,a,c)),r.texSubImage2D(s,0,t,n,a,c,p,ts.toWebGLConstant(f,o),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,_),r.texSubImage2D(s,0,t,n,p,ts.toWebGLConstant(f,o),i))),r.bindTexture(s,null)},Sc.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=M(e,0),t=M(t,0),n=M(n,0),i=M(i,0),o=M(o,this._width),r=M(r,this._height),is.isDepthFormat(this._pixelFormat))throw new P("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===ts.FLOAT)throw new P("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===ts.HALF_FLOAT)throw new P("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(is.isCompressedFormat(this._pixelFormat))throw new P("Cannot call copyFrom with a compressed texture pixel format.");L.typeOf.number.greaterThanOrEquals("xOffset",e,0),L.typeOf.number.greaterThanOrEquals("yOffset",t,0),L.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),L.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),L.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),L.typeOf.number.lessThanOrEquals("yOffset + height",t+r,this._height);const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(a,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0},Sc.prototype.generateMipmap=function(e){if(e=M(e,ic.DONT_CARE),is.isDepthFormat(this._pixelFormat))throw new P("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(is.isCompressedFormat(this._pixelFormat))throw new P("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!V.isPowerOfTwo(this._width))throw new P("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!V.isPowerOfTwo(this._height))throw new P("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!ic.validate(e))throw new P("hint is invalid.");this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)},Sc.prototype.isDestroyed=function(){return!1},Sc.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),He(this)},Object.defineProperties(Cc.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}}),Cc.prototype.getTexture=function(e){const t=this._textures[e];if(D(t))return delete this._texturesToRelease[e],++t.count,t.texture},Cc.prototype.addTexture=function(e,t){const n={texture:t,count:1};t.finalDestroy=t.destroy;const i=this;t.destroy=function(){0==--n.count&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures},Cc.prototype.destroyReleasedTextures=function(){const e=this._texturesToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];delete this._textures[t],n.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}},Cc.prototype.isDestroyed=function(){return!1},Cc.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return He(this)},Ic.encode=function(e,t){let n;return L.typeOf.number("value",e),D(t)||(t={high:0,low:0}),e>=0?(n=65536*Math.floor(e/65536),t.high=n,t.low=e-n):(n=65536*Math.floor(-e/65536),t.high=-n,t.low=e+n),t};const Oc={high:0,low:0};Ic.fromCartesian=function(e,t){L.typeOf.object("cartesian",e),D(t)||(t=new Ic);const n=t.high,i=t.low;return Ic.encode(e.x,Oc),n.x=Oc.high,i.x=Oc.low,Ic.encode(e.y,Oc),n.y=Oc.high,i.y=Oc.low,Ic.encode(e.z,Oc),n.z=Oc.high,i.z=Oc.low,t};const Dc=new Ic;function Pc(e,t){if(L.typeOf.object("normal",e),!V.equalsEpsilon(H.magnitude(e),1,V.EPSILON6))throw new P("normal must be normalized.");L.typeOf.number("distance",t),this.normal=H.clone(e),this.distance=t}Ic.writeElements=function(e,t,n){L.defined("cartesianArray",t),L.typeOf.number("index",n),L.typeOf.number.greaterThanOrEquals("index",n,0),Ic.fromCartesian(e,Dc);const i=Dc.high,o=Dc.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z},Pc.fromPointNormal=function(e,t,n){if(L.typeOf.object("point",e),L.typeOf.object("normal",t),!V.equalsEpsilon(H.magnitude(t),1,V.EPSILON6))throw new P("normal must be normalized.");const i=-H.dot(t,e);return D(n)?(H.clone(t,n.normal),n.distance=i,n):new Pc(t,i)};const Nc=new H;Pc.fromCartesian4=function(e,t){L.typeOf.object("coefficients",e);const n=H.fromCartesian4(e,Nc),i=e.w;if(!V.equalsEpsilon(H.magnitude(n),1,V.EPSILON6))throw new P("normal must be normalized.");return D(t)?(H.clone(n,t.normal),t.distance=i,t):new Pc(n,i)},Pc.getPointDistance=function(e,t){return L.typeOf.object("plane",e),L.typeOf.object("point",t),H.dot(e.normal,t)+e.distance};const Rc=new H;Pc.projectPointOntoPlane=function(e,t,n){L.typeOf.object("plane",e),L.typeOf.object("point",t),D(n)||(n=new H);const i=Pc.getPointDistance(e,t),o=H.multiplyByScalar(e.normal,i,Rc);return H.subtract(t,o,n)};const Lc=new ve,Mc=new K,Fc=new H;function Bc(e){this.planes=M(e,[])}Pc.transform=function(e,t,n){L.typeOf.object("plane",e),L.typeOf.object("transform",t);const i=e.normal,o=e.distance,r=ve.inverseTranspose(t,Lc);let s=K.fromElements(i.x,i.y,i.z,o,Mc);s=ve.multiplyByVector(r,s,s);const a=H.fromCartesian4(s,Fc);return s=K.divideByScalar(s,H.magnitude(a),s),Pc.fromCartesian4(s,n)},Pc.clone=function(e,t){return L.typeOf.object("plane",e),D(t)?(H.clone(e.normal,t.normal),t.distance=e.distance,t):new Pc(e.normal,e.distance)},Pc.equals=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.distance===t.distance&&H.equals(e.normal,t.normal)},Pc.ORIGIN_XY_PLANE=Object.freeze(new Pc(H.UNIT_Z,0)),Pc.ORIGIN_YZ_PLANE=Object.freeze(new Pc(H.UNIT_X,0)),Pc.ORIGIN_ZX_PLANE=Object.freeze(new Pc(H.UNIT_Y,0));const zc=[new H,new H,new H];H.clone(H.UNIT_X,zc[0]),H.clone(H.UNIT_Y,zc[1]),H.clone(H.UNIT_Z,zc[2]);const Uc=new H,kc=new H,Vc=new Pc(new H(1,0,0),0);function Hc(e){e=M(e,M.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=M(e.near,1),this._near=this.near,this.far=M(e.far,5e8),this._far=this.far,this._cullingVolume=new Bc,this._orthographicMatrix=new ve}function Gc(e){if(!(D(e.right)&&D(e.left)&&D(e.top)&&D(e.bottom)&&D(e.near)&&D(e.far)))throw new P("right, left, top, bottom, near, or far parameters are not set.");if(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far){if(e.left>e.right)throw new P("right must be greater than left.");if(e.bottom>e.top)throw new P("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new P("near must be greater than zero and less than far.");e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=ve.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Bc.fromBoundingSphere=function(e,t){if(!D(e))throw new P("boundingSphere is required.");D(t)||(t=new Bc);const n=zc.length,i=t.planes;i.length=2*n;const o=e.center,r=e.radius;let s=0;for(let a=0;a<n;++a){const e=zc[a];let t=i[s],n=i[s+1];D(t)||(t=i[s]=new K),D(n)||(n=i[s+1]=new K),H.multiplyByScalar(e,-r,Uc),H.add(o,Uc,Uc),t.x=e.x,t.y=e.y,t.z=e.z,t.w=-H.dot(e,Uc),H.multiplyByScalar(e,r,Uc),H.add(o,Uc,Uc),n.x=-e.x,n.y=-e.y,n.z=-e.z,n.w=-H.dot(H.negate(e,kc),Uc),s+=2}return t},Bc.prototype.computeVisibility=function(e){if(!D(e))throw new P("boundingVolume is required.");const t=this.planes;let n=!1;for(let i=0,o=t.length;i<o;++i){const o=e.intersectPlane(Pc.fromCartesian4(t[i],Vc));if(o===mn.OUTSIDE)return mn.OUTSIDE;o===mn.INTERSECTING&&(n=!0)}return n?mn.INTERSECTING:mn.INSIDE},Bc.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!D(e))throw new P("boundingVolume is required.");if(!D(t))throw new P("parentPlaneMask is required.");if(t===Bc.MASK_OUTSIDE||t===Bc.MASK_INSIDE)return t;let n=Bc.MASK_INSIDE;const i=this.planes;for(let o=0,r=i.length;o<r;++o){const r=o<31?1<<o:0;if(o<31&&!(t&r))continue;const s=e.intersectPlane(Pc.fromCartesian4(i[o],Vc));if(s===mn.OUTSIDE)return Bc.MASK_OUTSIDE;s===mn.INTERSECTING&&(n|=r)}return n},Bc.MASK_OUTSIDE=4294967295,Bc.MASK_INSIDE=0,Bc.MASK_INDETERMINATE=2147483647,Object.defineProperties(Hc.prototype,{projectionMatrix:{get:function(){return Gc(this),this._orthographicMatrix}}});const jc=new H,Wc=new H,qc=new H,Yc=new H;function Xc(e){e=M(e,M.EMPTY_OBJECT),this._offCenterFrustum=new Hc,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=M(e.near,1),this._near=this.near,this.far=M(e.far,5e8),this._far=this.far}function Qc(e){if(!(D(e.width)&&D(e.aspectRatio)&&D(e.near)&&D(e.far)))throw new P("width, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new P("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new P("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;const n=1/e.aspectRatio;t.right=.5*e.width,t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}Hc.prototype.computeCullingVolume=function(e,t,n){if(!D(e))throw new P("position is required.");if(!D(t))throw new P("direction is required.");if(!D(n))throw new P("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,l=this.far,u=H.cross(t,n,jc);H.normalize(u,u);const d=Wc;H.multiplyByScalar(t,c,d),H.add(e,d,d);const h=qc;H.multiplyByScalar(u,a,h),H.add(d,h,h);let p=i[0];return D(p)||(p=i[0]=new K),p.x=u.x,p.y=u.y,p.z=u.z,p.w=-H.dot(u,h),H.multiplyByScalar(u,s,h),H.add(d,h,h),p=i[1],D(p)||(p=i[1]=new K),p.x=-u.x,p.y=-u.y,p.z=-u.z,p.w=-H.dot(H.negate(u,Yc),h),H.multiplyByScalar(n,r,h),H.add(d,h,h),p=i[2],D(p)||(p=i[2]=new K),p.x=n.x,p.y=n.y,p.z=n.z,p.w=-H.dot(n,h),H.multiplyByScalar(n,o,h),H.add(d,h,h),p=i[3],D(p)||(p=i[3]=new K),p.x=-n.x,p.y=-n.y,p.z=-n.z,p.w=-H.dot(H.negate(n,Yc),h),p=i[4],D(p)||(p=i[4]=new K),p.x=t.x,p.y=t.y,p.z=t.z,p.w=-H.dot(t,d),H.multiplyByScalar(t,l,h),H.add(e,h,h),p=i[5],D(p)||(p=i[5]=new K),p.x=-t.x,p.y=-t.y,p.z=-t.z,p.w=-H.dot(H.negate(t,Yc),h),this._cullingVolume},Hc.prototype.getPixelDimensions=function(e,t,n,i,o){if(Gc(this),!D(e)||!D(t))throw new P("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new P("drawingBufferWidth must be greater than zero.");if(t<=0)throw new P("drawingBufferHeight must be greater than zero.");if(!D(n))throw new P("distance is required.");if(!D(i))throw new P("pixelRatio is required.");if(i<=0)throw new P("pixelRatio must be greater than zero.");if(!D(o))throw new P("A result object is required.");const r=i*(this.right-this.left)/e,s=i*(this.top-this.bottom)/t;return o.x=r,o.y=s,o},Hc.prototype.clone=function(e){return D(e)||(e=new Hc),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},Hc.prototype.equals=function(e){return D(e)&&e instanceof Hc&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},Hc.prototype.equalsEpsilon=function(e,t,n){return e===this||D(e)&&e instanceof Hc&&V.equalsEpsilon(this.right,e.right,t,n)&&V.equalsEpsilon(this.left,e.left,t,n)&&V.equalsEpsilon(this.top,e.top,t,n)&&V.equalsEpsilon(this.bottom,e.bottom,t,n)&&V.equalsEpsilon(this.near,e.near,t,n)&&V.equalsEpsilon(this.far,e.far,t,n)},Xc.packedLength=4,Xc.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t},Xc.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new Xc),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n},Object.defineProperties(Xc.prototype,{projectionMatrix:{get:function(){return Qc(this),this._offCenterFrustum.projectionMatrix}},offCenterFrustum:{get:function(){return Qc(this),this._offCenterFrustum}}}),Xc.prototype.computeCullingVolume=function(e,t,n){return Qc(this),this._offCenterFrustum.computeCullingVolume(e,t,n)},Xc.prototype.getPixelDimensions=function(e,t,n,i,o){return Qc(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)},Xc.prototype.clone=function(e){return D(e)||(e=new Xc),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},Xc.prototype.equals=function(e){return!!(D(e)&&e instanceof Xc)&&(Qc(this),Qc(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},Xc.prototype.equalsEpsilon=function(e,t,n){return!!(D(e)&&e instanceof Xc)&&(Qc(this),Qc(e),V.equalsEpsilon(this.width,e.width,t,n)&&V.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const $c={};function Kc(e,t){t=Hn.addSeconds(e,32.184,t);const n=Hn.totalDays(t)-2451545;return t=Hn.addSeconds(t,function(e){const t=6.239996+.0172019696544*e;return.001657*Math.sin(t+.01671*Math.sin(t))}(n),t)}const Zc=new Hn(2451545,0,wn.TAI),Jc=V.RADIANS_PER_DEGREE,el=V.RADIANS_PER_ARCSECOND,tl=new re;function nl(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=V.PI),n<0||n>V.PI)throw new P("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");const a=e*(1-t),c=i-o,l=o,u=function(e,t){if(t<0||t>=1)throw new P("eccentricity out of range.");const n=function(e,t){if(t<0||t>=1)throw new P("eccentricity out of range.");const n=Math.floor(e/V.TWO_PI);e-=n*V.TWO_PI;let i,o=e+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),r=Number.MAX_VALUE;for(i=0;i<il&&Math.abs(r-o)>ol;++i){r=o;o=r-(r-t*Math.sin(r)-e)/(1-t*Math.cos(r))}if(i>=il)throw new P("Kepler equation did not converge");return r=o+n*V.TWO_PI,r}(e,t);return function(e,t){if(t<0||t>=1)throw new P("eccentricity out of range.");const n=Math.floor(e/V.TWO_PI);e-=n*V.TWO_PI;const i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t);let r=Math.atan2(o,i);r=V.zeroToTwoPi(r),e<0&&(r-=V.TWO_PI);return r+=n*V.TWO_PI,r}(n,t)}(r-i,t),d=function(e,t){if(e<0)throw new P("eccentricity cannot be negative.");if(e<=t)return"Circular";if(e<1-t)return"Elliptical";if(e<=1+t)return"Parabolic";return"Hyperbolic"}(t,0);if("Hyperbolic"===d&&Math.abs(V.negativePiToPi(u))>=Math.acos(-1/t))throw new P("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");!function(e,t,n,i){if(t<0||t>V.PI)throw new P("inclination out of range");const o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),c=Math.cos(n),l=Math.sin(n);D(i)?(i[0]=c*o-l*r*s,i[1]=l*o+c*r*s,i[2]=r*a,i[3]=-c*r-l*o*s,i[4]=-l*r+c*o*s,i[5]=o*a,i[6]=l*a,i[7]=-c*a,i[8]=s):i=new re(c*o-l*r*s,-c*r-l*o*s,l*a,l*o+c*r*s,-l*r+c*o*s,-c*a,r*a,o*a,s)}(c,n,l,tl);const h=a*(1+t),p=Math.cos(u),f=Math.sin(u),m=1+t*p;if(m<=V.Epsilon10)throw new P("elements cannot be converted to cartesian");const _=h/m;return D(s)?(s.x=_*p,s.y=_*f,s.z=0):s=new H(_*p,_*f,0),re.multiplyByVector(tl,s,s)}const il=50,ol=V.EPSILON8;const rl=100.46645683*Jc,sl=1295977422.83429*el,al=1e-7*-79,cl=232*1e-7,ll=1e-7*-52,ul=1e-7*-116,dl=new Hn(0,0,wn.TAI);function hl(e,t){Kc(e,dl);const n=(dl.dayNumber-Zc.dayNumber+(dl.secondsOfDay-Zc.secondsOfDay)/Tn.SECONDS_PER_DAY)/Tn.DAYS_PER_JULIAN_CENTURY,i=n*n,o=i*n,r=o*n;let s=383397.7725+.004*n,a=.055545526-16e-9*n;const c=5.15668983*Jc;let l=-8e-5*n+.02966*i-42e-6*o-13e-8*r;const u=83.35324312*Jc;let d=14643420.2669*n-38.2702*i-.045047*o+21301e-8*r;const h=125.04455501*Jc;let p=-6967919.3631*n+6.3602*i+.007625*o-3586e-8*r;const f=218.31664563*Jc;let m=1732559343.4847*n-6.391*i+.006588*o-3169e-8*r;const _=297.85019547*Jc+el*(1602961601.209*n-6.3706*i+.006593*o-3169e-8*r),g=134.96340251*Jc+el*(1717915923.2178*n+31.8792*i+.051635*o-2447e-7*r),y=357.52910918*Jc+el*(129596581.0481*n-.5532*i+136e-6*o-1149e-8*r),b=310.17137918*Jc-el*(6967051.436*n+6.2068*i+.007618*o-3219e-8*r),v=2*_,A=4*_,T=6*_,w=2*g,E=3*g,x=4*g,S=2*(93.27209062*Jc+el*(1739527262.8478*n-12.7512*i-.001037*o+417e-8*r));s+=3400.4*Math.cos(v)-635.6*Math.cos(v-g)-235.6*Math.cos(g)+218.1*Math.cos(v-y)+181*Math.cos(v+g),a+=.014216*Math.cos(v-g)+.008551*Math.cos(v-w)-.001383*Math.cos(g)+.001356*Math.cos(v+g)-.001147*Math.cos(A-E)-914e-6*Math.cos(A-w)+869e-6*Math.cos(v-y-g)-627e-6*Math.cos(v)-394e-6*Math.cos(A-x)+282e-6*Math.cos(v-y-w)-279e-6*Math.cos(_-g)-236e-6*Math.cos(w)+231e-6*Math.cos(A)+229e-6*Math.cos(T-x)-201e-6*Math.cos(w-S),l+=486.26*Math.cos(v-S)-40.13*Math.cos(v)+37.51*Math.cos(S)+25.73*Math.cos(w-S)+19.97*Math.cos(v-y-S),d+=-55609*Math.sin(v-g)-34711*Math.sin(v-w)-9792*Math.sin(g)+9385*Math.sin(A-E)+7505*Math.sin(A-w)+5318*Math.sin(v+g)+3484*Math.sin(A-x)-3417*Math.sin(v-y-g)-2530*Math.sin(T-x)-2376*Math.sin(v)-2075*Math.sin(v-E)-1883*Math.sin(w)-1736*Math.sin(T-5*g)+1626*Math.sin(y)-1370*Math.sin(T-E),p+=-5392*Math.sin(v-S)-540*Math.sin(y)-441*Math.sin(v)+423*Math.sin(S)-288*Math.sin(w-S),m+=-3332.9*Math.sin(v)+1197.4*Math.sin(v-g)-662.5*Math.sin(y)+396.3*Math.sin(g)-218*Math.sin(v-y);const C=2*b,I=3*b;l+=46.997*Math.cos(b)*n-.614*Math.cos(v-S+b)*n+.614*Math.cos(v-S-b)*n-.0297*Math.cos(C)*i-.0335*Math.cos(b)*i+.0012*Math.cos(v-S+C)*i-16e-5*Math.cos(b)*o+4e-5*Math.cos(I)*o+4e-5*Math.cos(C)*o;const O=2.116*Math.sin(b)*n-.111*Math.sin(v-S-b)*n-.0015*Math.sin(b)*i;d+=O,m+=O,p+=-520.77*Math.sin(b)*n+13.66*Math.sin(v-S+b)*n+1.12*Math.sin(v-b)*n-1.06*Math.sin(S-b)*n+.66*Math.sin(C)*i+.371*Math.sin(b)*i-.035*Math.sin(v-S+C)*i-.015*Math.sin(v-S+b)*i+.0014*Math.sin(b)*o-.0011*Math.sin(I)*o-9e-4*Math.sin(C)*o,s*=1e3;return nl(s,a,c+l*el,u+d*el,h+p*el,f+m*el,t)}const pl=new re(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let fl=new H;$c.computeSunPositionInEarthInertialFrame=function(e,t){return D(e)||(e=Hn.now()),D(t)||(t=new H),fl=function(e,t){Kc(e,dl);const n=(dl.dayNumber-Zc.dayNumber+(dl.secondsOfDay-Zc.secondsOfDay)/Tn.SECONDS_PER_DAY)/(10*Tn.DAYS_PER_JULIAN_CENTURY),i=.3595362*n,o=149598022260.7121+957426.3679999999*Math.cos(16002*i)+-2243968.05*Math.sin(16002*i)+-2273887.624*Math.cos(21863*i)+-688150.202*Math.sin(21863*i)+927506.794*Math.cos(32004*i)+1017265.516*Math.sin(32004*i)+-119678.29599999999*Math.cos(10931*i)+807828.498*Math.sin(10931*i)+478713.18399999995*Math.cos(14529*i)+209437.01799999998*Math.sin(14529*i)+-613351.267*Math.cos(16368*i)+359034.888*Math.sin(16368*i)+284235.953*Math.cos(15318*i)+-418874.03599999996*Math.sin(15318*i)+-164557.657*Math.cos(32794*i)+329115.314*Math.sin(32794*i),r=rl+sl*n+-325e-7*Math.cos(10*i)+-105e-7*Math.sin(10*i)+-322e-7*Math.cos(16002*i)+-137e-7*Math.sin(16002*i)+al*Math.cos(21863*i)+258e-7*Math.sin(21863*i)+cl*Math.cos(10931*i)+35e-7*Math.sin(10931*i)+ll*Math.cos(1473*i)+ul*Math.sin(1473*i)+97e-7*Math.cos(32004*i)+-88e-7*Math.sin(32004*i)+55e-7*Math.cos(4387*i)+-112e-7*Math.sin(4387*i)+-41e-7*Math.cos(73*i)+-8e-6*Math.sin(73*i);return nl(o,.0167086342-.0004203654*n,469.97289*el*n,102.93734808*Jc+11612.3529*el*n,174.87317577*Jc-8679.27034*el*n,r,t)}(e,fl),t=H.negate(fl,t),function(e,t){t=hl(e,t),H.multiplyByScalar(t,-.01215058143522694,t)}(e,fl),H.subtract(t,fl,t),re.multiplyByVector(pl,t,t),t},$c.computeMoonPositionInEarthInertialFrame=function(e,t){return D(e)||(e=Hn.now()),t=hl(e,t),re.multiplyByVector(pl,t,t),t};const ml=$c,_l={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3,getMorphTime:function(e){return e===_l.SCENE3D?1:e!==_l.MORPHING?0:void 0}},gl=Object.freeze(_l);function yl(e){e=M(e,M.EMPTY_OBJECT),this.color=Ot.clone(M(e.color,Ot.WHITE)),this.intensity=M(e.intensity,2)}function bl(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new Fr,this._viewportCartesian4=new K,this._viewportDirty=!1,this._viewportOrthographicMatrix=ve.clone(ve.IDENTITY),this._viewportTransformation=ve.clone(ve.IDENTITY),this._model=ve.clone(ve.IDENTITY),this._view=ve.clone(ve.IDENTITY),this._inverseView=ve.clone(ve.IDENTITY),this._projection=ve.clone(ve.IDENTITY),this._infiniteProjection=ve.clone(ve.IDENTITY),this._entireFrustum=new kt,this._currentFrustum=new kt,this._frustumPlanes=new K,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=re.clone(ve.IDENTITY),this._view3DDirty=!0,this._view3D=new ve,this._inverseView3DDirty=!0,this._inverseView3D=new ve,this._inverseModelDirty=!0,this._inverseModel=new ve,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new re,this._viewRotation=new re,this._inverseViewRotation=new re,this._viewRotation3D=new re,this._inverseViewRotation3D=new re,this._inverseProjectionDirty=!0,this._inverseProjection=new ve,this._modelViewDirty=!0,this._modelView=new ve,this._modelView3DDirty=!0,this._modelView3D=new ve,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new ve,this._inverseModelViewDirty=!0,this._inverseModelView=new ve,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new ve,this._viewProjectionDirty=!0,this._viewProjection=new ve,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new ve,this._modelViewProjectionDirty=!0,this._modelViewProjection=new ve,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new ve,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new ve,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new ve,this._normalDirty=!0,this._normal=new re,this._normal3DDirty=!0,this._normal3D=new re,this._inverseNormalDirty=!0,this._inverseNormal=new re,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new re,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new Ic,this._cameraPosition=new H,this._sunPositionWC=new H,this._sunPositionColumbusView=new H,this._sunDirectionWC=new H,this._sunDirectionEC=new H,this._moonDirectionEC=new H,this._lightDirectionWC=new H,this._lightDirectionEC=new H,this._lightColor=new H,this._lightColorHdr=new H,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new H,this._cameraRight=new H,this._cameraUp=new H,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new kt,this._eyeEllipsoidNormalEC=new H,this._eyeEllipsoidCurvature=new kt,this._modelToEnu=new ve,this._enuToModel=new ve,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new Ot,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new kt,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._fogMinimumBrightness=void 0,this._atmosphereHsbShift=void 0,this._atmosphereLightIntensity=void 0,this._atmosphereRayleighCoefficient=new H,this._atmosphereRayleighScaleHeight=new H,this._atmosphereMieCoefficient=new H,this._atmosphereMieScaleHeight=void 0,this._atmosphereMieAnisotropy=void 0,this._atmosphereDynamicLighting=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}Object.defineProperties(bl.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!Fr.equals(e,this._viewport)){Fr.clone(e,this._viewport);const t=this._viewport,n=this._viewportCartesian4;n.x=t.x,n.y=t.y,n.z=t.width,n.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return Sl(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return Sl(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){ve.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,ve.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,ve.getMatrix3(this.inverseModel,e),re.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return Fl(this),this._view3D}},viewRotation:{get:function(){return Fl(this),this._viewRotation}},viewRotation3D:{get:function(){return Fl(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return Bl(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return Bl(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){var e;return(e=this)._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode===gl.SCENE2D||e._mode===gl.MORPHING||e._orthographicIn3D?ve.clone(ve.ZERO,e._inverseProjection):ve.inverse(e._projection,e._inverseProjection)),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){var e;return(e=this)._modelViewDirty&&(e._modelViewDirty=!1,ve.multiplyTransformation(e._view,e._model,e._modelView)),this._modelView}},modelView3D:{get:function(){var e;return(e=this)._modelView3DDirty&&(e._modelView3DDirty=!1,ve.multiplyTransformation(e.view3D,e._model,e._modelView3D)),this._modelView3D}},modelViewRelativeToEye:{get:function(){return function(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;const t=e.modelView,n=e._modelViewRelativeToEye;n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=0,n[13]=0,n[14]=0,n[15]=t[15]}}(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){var e;return(e=this)._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,ve.inverse(e.modelView,e._inverseModelView)),this._inverseModelView}},inverseModelView3D:{get:function(){var e;return(e=this)._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,ve.inverse(e.modelView3D,e._inverseModelView3D)),this._inverseModelView3D}},viewProjection:{get:function(){var e;return(e=this)._viewProjectionDirty&&(e._viewProjectionDirty=!1,ve.multiply(e._projection,e._view,e._viewProjection)),this._viewProjection}},inverseViewProjection:{get:function(){var e;return(e=this)._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,ve.inverse(e.viewProjection,e._inverseViewProjection)),this._inverseViewProjection}},modelViewProjection:{get:function(){var e;return(e=this)._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,ve.multiply(e._projection,e.modelView,e._modelViewProjection)),this._modelViewProjection}},inverseModelViewProjection:{get:function(){var e;return(e=this)._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,ve.inverse(e.modelViewProjection,e._inverseModelViewProjection)),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){var e;return(e=this)._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,ve.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye)),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){var e;return(e=this)._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,ve.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection)),this._modelViewInfiniteProjection}},normal:{get:function(){return function(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;ve.getMatrix3(e.inverseModelView,t),re.transpose(t,t)}}(this),this._normal}},normal3D:{get:function(){return function(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;ve.getMatrix3(e.inverseModelView3D,t),re.transpose(t,t)}}(this),this._normal3D}},inverseNormal:{get:function(){return function(e){if(e._inverseNormalDirty){e._inverseNormalDirty=!1;const t=e._inverseNormal;ve.getMatrix3(e.modelView,t),re.transpose(t,t)}}(this),this._inverseNormal}},inverseNormal3D:{get:function(){return function(e){if(e._inverseNormal3DDirty){e._inverseNormal3DDirty=!1;const t=e._inverseNormal3D;ve.getMatrix3(e.modelView3D,t),re.transpose(t,t)}}(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},eyeEllipsoidNormalEC:{get:function(){return this._eyeEllipsoidNormalEC}},eyeEllipsoidCurvature:{get:function(){return this._eyeEllipsoidCurvature}},modelToEnu:{get:function(){return this._modelToEnu}},enuToModel:{get:function(){return this._enuToModel}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return Il(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return Il(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},fogMinimumBrightness:{get:function(){return this._fogMinimumBrightness}},atmosphereHsbShift:{get:function(){return this._atmosphereHsbShift}},atmosphereLightIntensity:{get:function(){return this._atmosphereLightIntensity}},atmosphereRayleighCoefficient:{get:function(){return this._atmosphereRayleighCoefficient}},atmosphereRayleighScaleHeight:{get:function(){return this._atmosphereRayleighScaleHeight}},atmosphereMieCoefficient:{get:function(){return this._atmosphereMieCoefficient}},atmosphereMieScaleHeight:{get:function(){return this._atmosphereMieScaleHeight}},atmosphereMieAnisotropy:{get:function(){return this._atmosphereMieAnisotropy}},atmosphereDynamicLighting:{get:function(){return this._atmosphereDynamicLighting}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},splitPosition:{get:function(){return this._splitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return M(this._ellipsoid,on.WGS84)}}});const vl=new H,Al=new ve;let Tl=new re;const wl=new Qt;bl.prototype.updateCamera=function(e){var t,n;t=this,n=e.viewMatrix,ve.clone(n,t._view),ve.getMatrix3(n,t._viewRotation),t._view3DDirty=!0,t._inverseView3DDirty=!0,t._modelViewDirty=!0,t._modelView3DDirty=!0,t._modelViewRelativeToEyeDirty=!0,t._inverseModelViewDirty=!0,t._inverseModelView3DDirty=!0,t._viewProjectionDirty=!0,t._inverseViewProjectionDirty=!0,t._modelViewProjectionDirty=!0,t._modelViewProjectionRelativeToEyeDirty=!0,t._modelViewInfiniteProjectionDirty=!0,t._normalDirty=!0,t._inverseNormalDirty=!0,t._normal3DDirty=!0,t._inverseNormal3DDirty=!0,function(e,t){ve.clone(t,e._inverseView),ve.getMatrix3(t,e._inverseViewRotation)}(this,e.inverseViewMatrix),function(e,t){H.clone(t.positionWC,e._cameraPosition),H.clone(t.directionWC,e._cameraDirection),H.clone(t.rightWC,e._cameraRight),H.clone(t.upWC,e._cameraUp);const n=e._ellipsoid;let i;const o=t.positionCartographic;if(D(o)?(e._eyeHeight=o.height,e._eyeEllipsoidNormalEC=n.geodeticSurfaceNormalCartographic(o,e._eyeEllipsoidNormalEC),i=H.fromRadians(o.longitude,o.latitude,0,n,vl)):(e._eyeHeight=-n.maximumRadius,H.magnitude(t.positionWC)>0&&(e._eyeEllipsoidNormalEC=H.normalize(t.positionWC,e._eyeEllipsoidNormalEC)),i=n.scaleToGeodeticSurface(t.positionWC,vl)),e._encodedCameraPositionMCDirty=!0,!D(i))return;e._eyeEllipsoidNormalEC=re.multiplyByVector(e._viewRotation,e._eyeEllipsoidNormalEC,e._eyeEllipsoidNormalEC);const r=Cr.eastNorthUpToFixedFrame(i,n,Al);e._enuToModel=ve.multiplyTransformation(e.inverseModel,r,e._enuToModel),e._modelToEnu=ve.inverseTransformation(e._enuToModel,e._modelToEnu),V.equalsEpsilon(n._radii.x,n._radii.y,V.EPSILON15)&&(e._eyeEllipsoidCurvature=n.getLocalCurvature(i,e._eyeEllipsoidCurvature))}(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==gl.SCENE2D&&e.frustum instanceof Xc},bl.prototype.updateFrustum=function(e){var t,n;t=this,n=e.projectionMatrix,ve.clone(n,t._projection),t._inverseProjectionDirty=!0,t._viewProjectionDirty=!0,t._inverseViewProjectionDirty=!0,t._modelViewProjectionDirty=!0,t._modelViewProjectionRelativeToEyeDirty=!0,D(e.infiniteProjectionMatrix)&&function(e,t){ve.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=V.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne;const i=e.offCenterFrustum;D(i)&&(e=i),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right},bl.prototype.updatePass=function(e){this._pass=e};const El=[],xl=new yl;function Sl(e){if(e._viewportDirty){const t=e._viewport;ve.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),ve.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}bl.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;const t=e.camera;this.updateCamera(t),e.mode===gl.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),function(e,t){D(Cr.computeIcrfToFixedMatrix(t.time,Tl))||(Tl=Cr.computeTemeToPseudoFixedMatrix(t.time,Tl));let n=ml.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);re.multiplyByVector(Tl,n,n),H.normalize(n,e._sunDirectionWC),n=re.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),H.normalize(n,n),n=ml.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),re.multiplyByVector(Tl,n,n),re.multiplyByVector(e.viewRotation3D,n,n),H.normalize(n,n);const i=t.mapProjection,o=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,wl);i.project(o,e._sunPositionColumbusView)}(this,e);const n=M(e.light,xl);n instanceof yl?(this._lightDirectionWC=H.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=H.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=H.normalize(H.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=re.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let o=H.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=H.multiplyByScalar(o,n.intensity,o);const r=H.maximumComponent(o);r>1?H.divideByScalar(o,r,this._lightColor):H.clone(o,this._lightColor);const s=e.brdfLutGenerator,a=D(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=M(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=M(e.sphericalHarmonicCoefficients,El),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,D(this._specularEnvironmentMaps)&&kt.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._fogMinimumBrightness=e.fog.minimumBrightness;const c=e.atmosphere;D(c)&&(this._atmosphereHsbShift=H.fromElements(c.hueShift,c.saturationShift,c.brightnessShift,this._atmosphereHsbShift),this._atmosphereLightIntensity=c.lightIntensity,this._atmosphereRayleighCoefficient=H.clone(c.rayleighCoefficient,this._atmosphereRayleighCoefficient),this._atmosphereRayleighScaleHeight=c.rayleighScaleHeight,this._atmosphereMieCoefficient=H.clone(c.mieCoefficient,this._atmosphereMieCoefficient),this._atmosphereMieScaleHeight=c.mieScaleHeight,this._atmosphereMieAnisotropy=c.mieAnisotropy,this._atmosphereDynamicLighting=c.dynamicLighting),this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Cr.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const l=t.frustum.fov,u=this._viewport;let d;d=D(l)?u.height>u.width?2*Math.tan(.5*l)/u.height:2*Math.tan(.5*l)/u.width:1/Math.max(u.width,u.height),this._geometricToleranceOverMeter=d*e.maximumScreenSpaceError,Ot.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};const Cl=new H;function Il(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,ve.multiplyByPoint(e.inverseModel,e._cameraPosition,Cl),Ic.fromCartesian(Cl,e._encodedCameraPositionMC))}const Ol=new H,Dl=new H,Pl=new H,Nl=new H,Rl=new Qt,Ll=new H,Ml=new ve;function Fl(e){e._view3DDirty&&(e._mode===gl.SCENE3D?ve.clone(e._view,e._view3D):function(e,t,n,i,o,r,s,a){const c=Ol;c.x=e.y,c.y=e.z,c.z=e.x;const l=Dl;l.x=n.y,l.y=n.z,l.z=n.x;const u=Pl;u.x=i.y,u.y=i.z,u.z=i.x;const d=Nl;d.x=t.y,d.y=t.z,d.z=t.x,r===gl.SCENE2D&&(c.z=.5*o);const h=s.unproject(c,Rl);h.longitude=V.clamp(h.longitude,-Math.PI,Math.PI),h.latitude=V.clamp(h.latitude,-V.PI_OVER_TWO,V.PI_OVER_TWO);const p=s.ellipsoid,f=p.cartographicToCartesian(h,Ll),m=Cr.eastNorthUpToFixedFrame(f,p,Ml);ve.multiplyByPointAsVector(m,l,l),ve.multiplyByPointAsVector(m,u,u),ve.multiplyByPointAsVector(m,d,d),D(a)||(a=new ve),a[0]=l.x,a[1]=u.x,a[2]=-d.x,a[3]=0,a[4]=l.y,a[5]=u.y,a[6]=-d.y,a[7]=0,a[8]=l.z,a[9]=u.z,a[10]=-d.z,a[11]=0,a[12]=-H.dot(l,f),a[13]=-H.dot(u,f),a[14]=H.dot(d,f),a[15]=1}(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),ve.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function Bl(e){e._inverseView3DDirty&&(ve.inverseTransformation(e.view3D,e._inverseView3D),ve.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function zl(e,t,n,i){const o=D(t.vertexBuffer),r=D(t.value),s=t.value?t.value.length:t.componentsPerAttribute;if(!o&&!r)throw new P("attribute must have a vertexBuffer or a value.");if(o&&r)throw new P("attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.");if(1!==s&&2!==s&&3!==s&&4!==s){if(r)throw new P("attribute.value.length must be in the range [1, 4].");throw new P("attribute.componentsPerAttribute must be in the range [1, 4].")}if(D(t.componentDatatype)&&!Ca.validate(t.componentDatatype))throw new P("attribute must have a valid componentDatatype or not specify it.");if(D(t.strideInBytes)&&t.strideInBytes>255)throw new P("attribute must have a strideInBytes less than or equal to 255 or not specify it.");if(D(t.instanceDivisor)&&t.instanceDivisor>0&&!i.instancedArrays)throw new P("instanced arrays is not supported");if(D(t.instanceDivisor)&&t.instanceDivisor<0)throw new P("attribute must have an instanceDivisor greater than or equal to zero");if(D(t.instanceDivisor)&&r)throw new P("attribute cannot have have an instanceDivisor if it is not backed by a buffer");if(D(t.instanceDivisor)&&t.instanceDivisor>0&&0===t.index)throw new P("attribute zero cannot have an instanceDivisor greater than 0");const a={index:M(t.index,n),enabled:M(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:M(t.componentDatatype,Ca.FLOAT),normalize:M(t.normalize,!1),offsetInBytes:M(t.offsetInBytes,0),strideInBytes:M(t.strideInBytes,0),instanceDivisor:M(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(e){const 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),this.instanceDivisor>0&&(i.glVertexAttribDivisor(t,this.instanceDivisor),i._vertexAttribDivisors[t]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(e){e.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(e){e.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(e){e.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(e){e.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(e){e.vertexAttrib4fv(this.index,this.value)}}a.disableVertexAttribArray=function(e){}}e.push(a)}function Ul(e,t,n){for(let i=0;i<t.length;++i){const n=t[i];n.enabled&&n.vertexAttrib(e)}D(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function kl(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context),L.defined("options.attributes",e.attributes);const t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer;let r;const s=[];let a=1,c=!1,l=!1,u=i.length;for(r=0;r<u;++r)zl(s,i[r],r,t);for(u=s.length,r=0;r<u;++r){const e=s[r];if(D(e.vertexBuffer)&&0===e.instanceDivisor){const t=e.strideInBytes||e.componentsPerAttribute*Ca.getSizeInBytes(e.componentDatatype);a=e.vertexBuffer.sizeInBytes/t;break}}for(r=0;r<u;++r)s[r].instanceDivisor>0&&(c=!0),D(s[r].value)&&(l=!0);const d={};for(r=0;r<u;++r){const e=s[r].index;if(d[e])throw new P(`Index ${e} is used by more than one attribute.`);d[e]=!0}let h;t.vertexArrayObject&&(h=t.glCreateVertexArray(),t.glBindVertexArray(h),Ul(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=c,this._hasConstantAttributes=l,this._context=t,this._gl=n,this._vao=h,this._attributes=s,this._indexBuffer=o}function Vl(e){return e.values.length/e.componentsPerAttribute}function Hl(e){return Ca.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function Gl(e,t){L.defined("canvas",e);const{getWebGLStub:n,requestWebgl1:i,webgl:o={},allowTextureFilterAnisotropic:r=!0}=M(t,{});o.alpha=M(o.alpha,!1),o.stencil=M(o.stencil,!0),o.powerPreference=M(o.powerPreference,"high-performance");const s=D(n)?n(e,o):function(e,t,n){if("undefined"==typeof WebGLRenderingContext)throw new be("The browser does not support WebGL. Visit http://get.webgl.org.");const i="undefined"!=typeof WebGL2RenderingContext;n||i||(n=!0);const o=n?"webgl":"webgl2",r=e.getContext(o,t);if(!D(r))throw new be("The browser supports WebGL, but initialization failed.");return r}(e,o,i),a="undefined"!=typeof WebGL2RenderingContext&&s instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=s,this._gl=s,this._webgl2=a,this._id=ke(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new Ec(this),this._textureCache=new Cc;const c=s;this._stencilBits=c.getParameter(c.STENCIL_BITS),rs._maximumCombinedTextureImageUnits=c.getParameter(c.MAX_COMBINED_TEXTURE_IMAGE_UNITS),rs._maximumCubeMapSize=c.getParameter(c.MAX_CUBE_MAP_TEXTURE_SIZE),rs._maximumFragmentUniformVectors=c.getParameter(c.MAX_FRAGMENT_UNIFORM_VECTORS),rs._maximumTextureImageUnits=c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS),rs._maximumRenderbufferSize=c.getParameter(c.MAX_RENDERBUFFER_SIZE),rs._maximumTextureSize=c.getParameter(c.MAX_TEXTURE_SIZE),rs._maximumVaryingVectors=c.getParameter(c.MAX_VARYING_VECTORS),rs._maximumVertexAttributes=c.getParameter(c.MAX_VERTEX_ATTRIBS),rs._maximumVertexTextureImageUnits=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS),rs._maximumVertexUniformVectors=c.getParameter(c.MAX_VERTEX_UNIFORM_VECTORS),rs._maximumSamples=this._webgl2?c.getParameter(c.MAX_SAMPLES):0;const l=c.getParameter(c.ALIASED_LINE_WIDTH_RANGE);rs._minimumAliasedLineWidth=l[0],rs._maximumAliasedLineWidth=l[1];const u=c.getParameter(c.ALIASED_POINT_SIZE_RANGE);rs._minimumAliasedPointSize=u[0],rs._maximumAliasedPointSize=u[1];const d=c.getParameter(c.MAX_VIEWPORT_DIMS);rs._maximumViewportWidth=d[0],rs._maximumViewportHeight=d[1];const h=c.getShaderPrecisionFormat(c.FRAGMENT_SHADER,c.HIGH_FLOAT);rs._highpFloatSupported=0!==h.precision;const p=c.getShaderPrecisionFormat(c.FRAGMENT_SHADER,c.HIGH_INT);rs._highpIntSupported=0!==p.rangeMax,this._antialias=c.getContextAttributes().antialias,this._standardDerivatives=!!ql(c,["OES_standard_derivatives"]),this._blendMinmax=!!ql(c,["EXT_blend_minmax"]),this._elementIndexUint=!!ql(c,["OES_element_index_uint"]),this._depthTexture=!!ql(c,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!ql(c,["EXT_frag_depth"]),this._debugShaders=ql(c,["WEBGL_debug_shaders"]),this._textureFloat=!!ql(c,["OES_texture_float"]),this._textureHalfFloat=!!ql(c,["OES_texture_half_float"]),this._textureFloatLinear=!!ql(c,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!ql(c,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!ql(c,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!ql(c,["EXT_float_blend"]),this._colorBufferHalfFloat=!!ql(c,["EXT_color_buffer_half_float"]),this._s3tc=!!ql(c,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!ql(c,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!ql(c,["WEBGL_compressed_texture_astc"]),this._etc=!!ql(c,["WEBG_compressed_texture_etc"]),this._etc1=!!ql(c,["WEBGL_compressed_texture_etc1"]),this._bc7=!!ql(c,["EXT_texture_compression_bptc"]),ec.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const f=r?ql(c,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;let m,_,g,y,b,v,A,T,w,E;if(this._textureFilterAnisotropic=f,rs._maximumTextureFilterAnisotropy=D(f)?c.getParameter(f.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1,a){const e=this;m=function(){return e._gl.createVertexArray()},_=function(t){e._gl.bindVertexArray(t)},g=function(t){e._gl.deleteVertexArray(t)},y=function(e,t,n,i,o){c.drawElementsInstanced(e,t,n,i,o)},b=function(e,t,n,i){c.drawArraysInstanced(e,t,n,i)},v=function(e,t){c.vertexAttribDivisor(e,t)},A=function(e){c.drawBuffers(e)}}else T=ql(c,["OES_vertex_array_object"]),D(T)&&(m=function(){return T.createVertexArrayOES()},_=function(e){T.bindVertexArrayOES(e)},g=function(e){T.deleteVertexArrayOES(e)}),w=ql(c,["ANGLE_instanced_arrays"]),D(w)&&(y=function(e,t,n,i,o){w.drawElementsInstancedANGLE(e,t,n,i,o)},b=function(e,t,n,i){w.drawArraysInstancedANGLE(e,t,n,i)},v=function(e,t){w.vertexAttribDivisorANGLE(e,t)}),E=ql(c,["WEBGL_draw_buffers"]),D(E)&&(A=function(e){E.drawBuffersWEBGL(e)});this.glCreateVertexArray=m,this.glBindVertexArray=_,this.glDeleteVertexArray=g,this.glDrawElementsInstanced=y,this.glDrawArraysInstanced=b,this.glVertexAttribDivisor=v,this.glDrawBuffers=A,this._vertexArrayObject=!!T,this._instancedArrays=!!w,this._drawBuffers=!!E,rs._maximumDrawBuffers=this.drawBuffers?c.getParameter(Me.MAX_DRAW_BUFFERS):1,rs._maximumColorAttachments=this.drawBuffers?c.getParameter(Me.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new Ot(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const x=new bl,S=new hc(this),C=_s.fromCache();this._defaultPassState=S,this._defaultRenderState=C,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=x,this._currentRenderState=C,this._currentPassState=S,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let I=0;I<rs._maximumVertexAttributes;I++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:n,requestWebgl1:i,webgl:o,allowTextureFilterAnisotropic:r},this.cache={},_s.apply(c,C,S)}function jl(e,t,n){const i=e.getError();if(i!==e.NO_ERROR)throw new be(function(e,t,n,i){let o=`${function(e,t){let n="WebGL Error: ";switch(t){case e.INVALID_ENUM:n+="INVALID_ENUM";break;case e.INVALID_VALUE:n+="INVALID_VALUE";break;case e.INVALID_OPERATION:n+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:n+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:n+="CONTEXT_LOST_WEBGL lost";break;default:n+=`Unknown (${t})`}return n}(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)0!==r&&(o+=", "),o+=n[r];return o+=");",o}(e,t,n,i))}function Wl(e,t,n){return{get:function(){const i=e[t];return n(e,`get: ${t}`,i),e[t]},set:function(i){e[t]=i,n(e,`set: ${t}`,i)}}}function ql(e,t){const n=t.length;for(let i=0;i<n;++i){const n=e.getExtension(t[i]);if(n)return n}}kl.fromGeometry=function(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context);const t=e.context,n=M(e.geometry,M.EMPTY_OBJECT),i=M(e.bufferUsage,qe.DYNAMIC_DRAW),o=M(e.attributeLocations,M.EMPTY_OBJECT),r=M(e.interleave,!1),s=e.vertexArrayAttributes;let a,c,l;const u=D(s)?s:[],d=n.attributes;if(r){const e=function(e){let t,n,i;const o=[];for(n in e)e.hasOwnProperty(n)&&D(e[n])&&D(e[n].values)&&(o.push(n),e[n].componentDatatype===Ca.DOUBLE&&(e[n].componentDatatype=Ca.FLOAT,e[n].values=Ca.createTypedArray(Ca.FLOAT,e[n].values)));let r;const s=o.length;if(s>0)for(r=Vl(e[o[0]]),t=1;t<s;++t){const n=Vl(e[o[t]]);if(n!==r)throw new be(`Each attribute list must have the same number of vertices. Attribute ${o[t]} has a different number of vertices (${n.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort((function(t,n){return Ca.getSizeInBytes(e[n].componentDatatype)-Ca.getSizeInBytes(e[t].componentDatatype)}));let a=0;const c={};for(t=0;t<s;++t)n=o[t],i=e[n],c[n]=a,a+=Hl(i);if(a>0){const l=Ca.getSizeInBytes(e[o[0]].componentDatatype),u=a%l;0!==u&&(a+=l-u);const d=new ArrayBuffer(r*a),h={};for(t=0;t<s;++t){n=o[t];const i=Ca.getSizeInBytes(e[n].componentDatatype);h[n]={pointer:Ca.createTypedArray(e[n].componentDatatype,d),index:c[n]/i,strideInComponentType:a/i}}for(t=0;t<r;++t)for(let r=0;r<s;++r){n=o[r],i=e[n];const s=i.values,a=h[n],c=a.pointer,l=i.componentsPerAttribute;for(let e=0;e<l;++e)c[a.index+e]=s[t*l+e];a.index+=a.strideInComponentType}return{buffer:d,offsetsInBytes:c,vertexSizeInBytes:a}}}(d);if(D(e)){l=Ye.createVertexBuffer({context:t,typedArray:e.buffer,usage:i});const n=e.offsetsInBytes,r=e.vertexSizeInBytes;for(a in d)d.hasOwnProperty(a)&&D(d[a])&&(c=d[a],D(c.values)?u.push({index:o[a],vertexBuffer:l,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:n[a],strideInBytes:r}):u.push({index:o[a],value:c.value,componentDatatype:c.componentDatatype,normalize:c.normalize}))}}else for(a in d)if(d.hasOwnProperty(a)&&D(d[a])){c=d[a];let e=c.componentDatatype;e===Ca.DOUBLE&&(e=Ca.FLOAT),l=void 0,D(c.values)&&(l=Ye.createVertexBuffer({context:t,typedArray:Ca.createTypedArray(e,c.values),usage:i})),u.push({index:o[a],vertexBuffer:l,value:c.value,componentDatatype:e,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let h;const p=n.indices;return D(p)&&(h=Na.computeNumberOfVertices(n)>=V.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?Ye.createIndexBuffer({context:t,typedArray:new Uint32Array(p),usage:i,indexDatatype:je.UNSIGNED_INT}):Ye.createIndexBuffer({context:t,typedArray:new Uint16Array(p),usage:i,indexDatatype:je.UNSIGNED_SHORT})),new kl({context:t,attributes:u,indexBuffer:h})},Object.defineProperties(kl.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}}),kl.prototype.getAttribute=function(e){return L.defined("index",e),this._attributes[e]},kl.prototype._bind=function(){D(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&function(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,o=e._attributes,r=rs.maximumVertexAttributes;let s;if(n){const e=o.length;for(s=0;s<e;++s){const e=o[s];if(e.enabled){const n=e.instanceDivisor,o=e.index;n!==i[o]&&(t.glVertexAttribDivisor(o,n),i[o]=n)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}(this),this._hasConstantAttributes&&function(e,t){const n=e._attributes,i=n.length;for(let o=0;o<i;++o){const e=n[o];e.enabled&&D(e.value)&&e.vertexAttrib(t)}}(this,this._gl)):Ul(this._gl,this._attributes,this._indexBuffer)},kl.prototype._unBind=function(){if(D(this._vao))this._context.glBindVertexArray(null);else{const e=this._attributes,t=this._gl;for(let n=0;n<e.length;++n){const i=e[n];i.enabled&&i.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}},kl.prototype.isDestroyed=function(){return!1},kl.prototype.destroy=function(){const e=this._attributes;for(let n=0;n<e.length;++n){const t=e[n].vertexBuffer;D(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy()}const t=this._indexBuffer;return D(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),D(this._vao)&&this._context.glDeleteVertexArray(this._vao),He(this)};const Yl={};function Xl(e,t,n,i){const o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,_s.partialApply(e._gl,o,t,r,n,i)}let Ql;function $l(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=Ql;if(D(t))t._bind(),function(e){if(e.validateFramebuffer){const t=e._gl,n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(n!==t.FRAMEBUFFER_COMPLETE){let e;switch(n){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:e="Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:e="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:e="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:e="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions."}throw new P(e)}}}(e),n=t._getActiveColorAttachments();else{const t=e._gl;t.bindFramebuffer(t.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}Object.defineProperties(Gl.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},msaa:{get:function(){return this._webgl2}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=function(e,t){if(!D(t))return e;function n(n){return function(){const i=n.apply(e,arguments);return t(e,n,arguments),i}}const i={};for(const o in e){const r=e[o];r instanceof Function?i[o]=n(r):Object.defineProperty(i,o,Wl(e,o,t))}return i}(this._originalGLContext,e?jl:void 0)}},defaultTexture:{get:function(){return void 0===this._defaultTexture&&(this._defaultTexture=new Sc({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return void 0===this._defaultEmissiveTexture&&(this._defaultEmissiveTexture=new Sc({context:this,pixelFormat:is.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return void 0===this._defaultNormalTexture&&(this._defaultNormalTexture=new Sc({context:this,pixelFormat:is.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(void 0===this._defaultCubeMap){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new dc({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 Yl}}}),"undefined"!=typeof WebGLRenderingContext&&(Ql=[Me.BACK]);const Kl=new Bt;Gl.prototype.clear=function(e,t){e=M(e,Kl),t=M(t,this._defaultPassState);const n=this._gl;let i=0;const o=e.color,r=e.depth,s=e.stencil;D(o)&&(Ot.equals(this._clearColor,o)||(Ot.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),D(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),D(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);Xl(this,M(e.renderState,this._defaultRenderState),t,!0);$l(this,M(e.framebuffer,t.framebuffer)),n.clear(i)},Gl.prototype.draw=function(e,t,n,i){L.defined("drawCommand",e),L.defined("drawCommand.shaderProgram",e._shaderProgram),t=M(t,this._defaultPassState);const o=M(e._framebuffer,t.framebuffer),r=M(e._renderState,this._defaultRenderState);n=M(n,e._shaderProgram),i=M(i,e._uniformMap),function(e,t,n,i,o){if(D(t)&&o.depthTest&&o.depthTest.enabled&&!t.hasDepthAttachment)throw new P("The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.");$l(e,t),Xl(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}(this,o,t,n,r),function(e,t,n,i){const o=t._primitiveType,r=t._vertexArray;let s=t._offset,a=t._count;const c=t.instanceCount;if(!Vr.validate(o))throw new P("drawCommand.primitiveType is required and must be valid.");if(L.defined("drawCommand.vertexArray",r),L.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),D(a)&&L.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),L.typeOf.number.greaterThanOrEquals("drawCommand.instanceCount",c,0),c>0&&!e.instancedArrays)throw new P("Instanced arrays extension is not supported");e._us.model=M(t._modelMatrix,ve.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();const l=r.indexBuffer;D(l)?(s*=l.bytesPerIndex,a=D(a)?Math.min(a,l.numberOfIndices):l.numberOfIndices,0===c?e._gl.drawElements(o,a,l.indexDatatype,s):e.glDrawElementsInstanced(o,a,l.indexDatatype,s,c)):(a=D(a)?Math.min(a,r.numberOfVertices):r.numberOfVertices,0===c?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,c)),r._unBind()}(this,e,n,i)},Gl.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=Ql;this.drawBuffers&&this.glDrawBuffers(t);const n=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let i=0;i<n;++i)e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)},Gl.prototype.readPixels=function(e){const t=this._gl;e=M(e,M.EMPTY_OBJECT);const n=Math.max(M(e.x,0),0),i=Math.max(M(e.y,0),0),o=M(e.width,t.drawingBufferWidth),r=M(e.height,t.drawingBufferHeight),s=e.framebuffer;L.typeOf.number.greaterThan("readState.width",o,0),L.typeOf.number.greaterThan("readState.height",r,0);let a=ts.UNSIGNED_BYTE;D(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);const c=is.createTypedArray(is.RGBA,a,o,r);return $l(this,s),t.readPixels(n,i,o,r,is.RGBA,ts.toWebGLConstant(a,this),c),c};const Zl={position:0,textureCoordinates:1};function Jl(e,t,n){this._pickObjects=e,this.key=t,this.color=n}function eu(e){const t=(e=M(e,M.EMPTY_OBJECT)).context,n=e.width,i=e.height;L.defined("options.context",t),L.defined("options.width",n),L.defined("options.height",i),this._width=n,this._height=i;const o=e.colorRenderbuffers,r=e.colorTextures;if(D(o)!==D(r))throw new P("Both color renderbuffer and texture attachments must be provided.");const s=e.depthStencilRenderbuffer,a=e.depthStencilTexture;if(D(s)!==D(a))throw new P("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new cs({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new cs({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}Gl.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!D(e)){const t=new Na({attributes:{position:new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:Vr.TRIANGLES});e=kl.fromGeometry({context:this,geometry:t,attributeLocations:Zl,bufferUsage:qe.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e},Gl.prototype.createViewportQuadCommand=function(e,t){return t=M(t,M.EMPTY_OBJECT),new Kr({vertexArray:this.getViewportQuadVertexArray(),primitiveType:Vr.TRIANGLES,renderState:t.renderState,shaderProgram:ya.fromCache({context:this,vertexShaderSource:Hr,fragmentShaderSource:e,attributeLocations:Zl}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})},Gl.prototype.getObjectByPickColor=function(e){return L.defined("pickColor",e),this._pickObjects[e.toRgba()]},Object.defineProperties(Jl.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}}),Jl.prototype.destroy=function(){delete this._pickObjects[this.key]},Gl.prototype.createPickId=function(e){L.defined("object",e),++this._nextPickColor[0];const t=this._nextPickColor[0];if(0===t)throw new be("Out of unique Pick IDs.");return this._pickObjects[t]=e,new Jl(this._pickObjects,t,Ot.fromRgba(t))},Gl.prototype.isDestroyed=function(){return!1},Gl.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];D(n.destroy)&&n.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),He(this)},Gl._deprecationWarning=Da,eu.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer},eu.prototype.getColorFramebuffer=function(){return this._colorFramebuffer},eu.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();const n=e._gl;let i=0;this._colorFramebuffer._colorTextures.length>0&&(i|=n.COLOR_BUFFER_BIT),D(this._colorFramebuffer.depthStencilTexture)&&(i|=n.DEPTH_BUFFER_BIT|(t?n.STENCIL_BUFFER_BIT:0)),n.blitFramebuffer(0,0,this._width,this._height,0,0,this._width,this._height,i,n.NEAREST),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null)},eu.prototype.isDestroyed=function(){return!1},eu.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),He(this)};const tu={RGBA4:Me.RGBA4,RGBA8:Me.RGBA8,RGBA16F:Me.RGBA16F,RGBA32F:Me.RGBA32F,RGB5_A1:Me.RGB5_A1,RGB565:Me.RGB565,DEPTH_COMPONENT16:Me.DEPTH_COMPONENT16,STENCIL_INDEX8:Me.STENCIL_INDEX8,DEPTH_STENCIL:Me.DEPTH_STENCIL,DEPTH24_STENCIL8:Me.DEPTH24_STENCIL8,validate:function(e){return e===tu.RGBA4||e===tu.RGBA8||e===tu.RGBA16F||e===tu.RGBA32F||e===tu.RGB5_A1||e===tu.RGB565||e===tu.DEPTH_COMPONENT16||e===tu.STENCIL_INDEX8||e===tu.DEPTH_STENCIL||e===tu.DEPTH24_STENCIL8},getColorFormat:function(e){return e===Me.FLOAT?tu.RGBA32F:e===Me.HALF_FLOAT_OES?tu.RGBA16F:tu.RGBA8}},nu=Object.freeze(tu);function iu(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.context",e.context);const t=e.context._gl,n=rs.maximumRenderbufferSize,i=M(e.format,nu.RGBA4),o=D(e.width)?e.width:t.drawingBufferWidth,r=D(e.height)?e.height:t.drawingBufferHeight,s=M(e.numSamples,1);if(!nu.validate(i))throw new P("Invalid format.");if(L.typeOf.number.greaterThan("width",o,0),o>n)throw new P(`Width must be less than or equal to the maximum renderbuffer size (${n}). Check maximumRenderbufferSize.`);if(L.typeOf.number.greaterThan("height",r,0),r>n)throw new P(`Height must be less than or equal to the maximum renderbuffer size (${n}). Check maximumRenderbufferSize.`);this._gl=t,this._format=i,this._width=o,this._height=r,this._renderbuffer=this._gl.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this._renderbuffer),s>1?t.renderbufferStorageMultisample(t.RENDERBUFFER,s,i,o,r):t.renderbufferStorage(t.RENDERBUFFER,i,o,r),t.bindRenderbuffer(t.RENDERBUFFER,null)}function ou(e){if(e=M(e,M.EMPTY_OBJECT),this._numSamples=M(e.numSamples,1),this._colorAttachmentsLength=M(e.colorAttachmentsLength,1),this._color=M(e.color,!0),this._depth=M(e.depth,!1),this._depthStencil=M(e.depthStencil,!1),this._supportsDepthTexture=M(e.supportsDepthTexture,!1),!this._color&&!this._depth&&!this._depthStencil)throw new P("Must enable at least one type of framebuffer attachment.");if(this._depth&&this._depthStencil)throw new P("Cannot have both a depth and depth-stencil attachment.");this._createColorAttachments=M(e.createColorAttachments,!0),this._createDepthAttachments=M(e.createDepthAttachments,!0),this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._multisampleFramebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength),this._colorRenderbuffers=new Array(this._colorAttachmentsLength)),this._colorRenderbuffer=void 0,this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(iu.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}}),iu.prototype._getRenderbuffer=function(){return this._renderbuffer},iu.prototype.isDestroyed=function(){return!1},iu.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),He(this)},Object.defineProperties(ou.prototype,{framebuffer:{get:function(){return this._numSamples>1?this._multisampleFramebuffer.getRenderFramebuffer():this._framebuffer}},numSamples:{get:function(){return this._numSamples}},status:{get:function(){return this.framebuffer.status}}}),ou.prototype.isDirty=function(e,t,n,i,o){n=M(n,1);const r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=D(i)&&this._pixelDatatype!==i||D(o)&&this._pixelFormat!==o,c=D(1===n?this._framebuffer:this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!c||this._color&&!D(this._colorTextures[0])},ou.prototype.update=function(e,t,n,i,o,r){if(!D(t)||!D(n))throw new P("width and height must be defined.");if(i=e.msaa?M(i,1):1,o=M(o,this._color?M(this._pixelDatatype,ts.UNSIGNED_BYTE):void 0),r=M(r,this._color?M(this._pixelFormat,is.RGBA):void 0),this.isDirty(t,n,i,o,r)){if(this.destroy(),this._width=t,this._height=n,this._numSamples=i,this._pixelDatatype=o,this._pixelFormat=r,this._attachmentsDirty=!1,this._color&&this._createColorAttachments)for(let i=0;i<this._colorAttachmentsLength;++i)if(this._colorTextures[i]=new Sc({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:uc.NEAREST}),this._numSamples>1){const r=nu.getColorFormat(o);this._colorRenderbuffers[i]=new iu({context:e,width:t,height:n,format:r,numSamples:this._numSamples})}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new Sc({context:e,width:t,height:n,pixelFormat:is.DEPTH_STENCIL,pixelDatatype:ts.UNSIGNED_INT_24_8,sampler:uc.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new iu({context:e,width:t,height:n,format:nu.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new iu({context:e,width:t,height:n,format:nu.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new Sc({context:e,width:t,height:n,pixelFormat:is.DEPTH_COMPONENT,pixelDatatype:ts.UNSIGNED_INT,sampler:uc.NEAREST}):this._depthRenderbuffer=new iu({context:e,width:t,height:n,format:nu.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new eu({context:e,width:this._width,height:this._height,colorTextures:this._colorTextures,colorRenderbuffers:this._colorRenderbuffers,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}):this._framebuffer=new cs({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}},ou.prototype.getColorTexture=function(e){if((e=M(e,0))>=this._colorAttachmentsLength)throw new P("index must be smaller than total number of color attachments.");return this._colorTextures[e]},ou.prototype.setColorTexture=function(e,t){if(t=M(t,0),this._createColorAttachments)throw new P("createColorAttachments must be false if setColorTexture is called.");if(t>=this._colorAttachmentsLength)throw new P("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e},ou.prototype.getColorRenderbuffer=function(e){if((e=M(e,0))>=this._colorAttachmentsLength)throw new P("index must be smaller than total number of color attachments.");return this._colorRenderbuffers[e]},ou.prototype.setColorRenderbuffer=function(e,t){if(t=M(t,0),this._createColorAttachments)throw new P("createColorAttachments must be false if setColorRenderbuffer is called.");if(t>=this._colorAttachmentsLength)throw new P("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e},ou.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer},ou.prototype.setDepthRenderbuffer=function(e){if(this._createDepthAttachments)throw new P("createDepthAttachments must be false if setDepthRenderbuffer is called.");this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e},ou.prototype.getDepthTexture=function(){return this._depthTexture},ou.prototype.setDepthTexture=function(e){if(this._createDepthAttachments)throw new P("createDepthAttachments must be false if setDepthTexture is called.");this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e},ou.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer},ou.prototype.setDepthStencilRenderbuffer=function(e){if(this._createDepthAttachments)throw new P("createDepthAttachments must be false if setDepthStencilRenderbuffer is called.");this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e},ou.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture},ou.prototype.setDepthStencilTexture=function(e){if(this._createDepthAttachments)throw new P("createDepthAttachments must be false if setDepthStencilTexture is called.");this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e},ou.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)},ou.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i},ou.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()},ou.prototype.destroy=function(){if(this._color){let e;const t=this._colorTextures.length;for(e=0;e<t;++e){const t=this._colorTextures[e];this._createColorAttachments&&D(t)&&!t.isDestroyed()&&(this._colorTextures[e].destroy(),this._colorTextures[e]=void 0),D(t)&&t.isDestroyed()&&(this._colorTextures[e]=void 0);const n=this._colorRenderbuffers[e];this._createColorAttachments&&D(n)&&!n.isDestroyed()&&(this._colorRenderbuffers[e].destroy(),this._colorRenderbuffers[e]=void 0),D(n)&&n.isDestroyed()&&(this._colorRenderbuffers[e]=void 0)}}this._depthStencil&&(this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),D(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),D(this._depthStencilRenderbuffer)&&this._depthStencilRenderbuffer.isDestroyed()&&(this._depthStencilRenderbuffer=void 0)),this._depth&&(this._createDepthAttachments&&(this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy()),D(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),D(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};const ru={VERTEX:0,FRAGMENT:1,BOTH:2,includesVertexShader:function(e){return L.typeOf.number("destination",e),e===ru.VERTEX||e===ru.BOTH},includesFragmentShader:function(e){return L.typeOf.number("destination",e),e===ru.FRAGMENT||e===ru.BOTH}},su=Object.freeze(ru);function au(e){this.name=e,this.fields=[]}function cu(e){this.signature=e,this.body=[]}function lu(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}function uu(e,t,n,i){if(L.defined("context",e),!t||0===t.length)throw new P("At least one attribute is required.");const o=uu._verifyAttributes(t);n=M(n,0);const r=[],s={};let a,c;const l=o.length;for(let d=0;d<l;++d){const e=o[d];e.vertexBuffer?r.push(e):(c=e.usage,a=s[c],D(a)||(a=s[c]=[]),a.push(e))}function u(e,t){return Ca.getSizeInBytes(t.componentDatatype)-Ca.getSizeInBytes(e.componentDatatype)}for(c in this._allBuffers=[],s)if(s.hasOwnProperty(c)){a=s[c],a.sort(u);const e=uu._vertexSizeInBytes(a),t={vertexSizeInBytes:e,vertexBuffer:void 0,usage:a[0].usage,needsCommit:!1,arrayBuffer:void 0,arrayViews:uu._createArrayViews(a,e)};this._allBuffers.push(t)}this._size=0,this._instanced=M(i,!1),this._precreated=r,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}au.prototype.addField=function(e,t){const n=` ${e} ${t};`;this.fields.push(n)},au.prototype.generateGlslLines=function(){let e=this.fields;return 0===e.length&&(e=[" float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")},cu.prototype.addLines=function(e){if("string"!=typeof e&&!Array.isArray(e))throw new P(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this.body;if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;i++)t.push(` ${e[i]}`)}else t.push(` ${e}`)},cu.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")},Object.defineProperties(lu.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}}),lu.prototype.addDefine=function(e,t,n){L.typeOf.string("identifier",e),n=M(n,su.BOTH);let i=e;D(t)&&(i+=` ${t.toString()}`),su.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),su.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)},lu.prototype.addStruct=function(e,t,n){L.typeOf.string("structId",e),L.typeOf.string("structName",t),L.typeOf.number("destination",n),this._structs[e]=new au(t),su.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),su.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)},lu.prototype.addStructField=function(e,t,n){L.typeOf.string("structId",e),L.typeOf.string("type",t),L.typeOf.string("identifier",n),this._structs[e].addField(t,n)},lu.prototype.addFunction=function(e,t,n){L.typeOf.string("functionName",e),L.typeOf.string("signature",t),L.typeOf.number("destination",n),this._functions[e]=new cu(t),su.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),su.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)},lu.prototype.addFunctionLines=function(e,t){if(L.typeOf.string("functionName",e),"string"!=typeof t&&!Array.isArray(t))throw new P(`Expected lines to be a string or an array of strings, actual value was ${t}`);this._functions[e].addLines(t)},lu.prototype.addUniform=function(e,t,n){L.typeOf.string("type",e),L.typeOf.string("identifier",t),n=M(n,su.BOTH);const i=`uniform ${e} ${t};`;su.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),su.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)},lu.prototype.setPositionAttribute=function(e,t){if(L.typeOf.string("type",e),L.typeOf.string("identifier",t),D(this._positionAttributeLine))throw new P("setPositionAttribute() must be called exactly once for the attribute used for gl_Position. For other attributes, use addAttribute()");return this._positionAttributeLine=`in ${e} ${t};`,this._attributeLocations[t]=0,0},lu.prototype.addAttribute=function(e,t){L.typeOf.string("type",e),L.typeOf.string("identifier",t);const n=`in ${e} ${t};`;this._attributeLines.push(n);const i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=function(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}(e),i},lu.prototype.addVarying=function(e,t,n){L.typeOf.string("type",e),L.typeOf.string("identifier",t),n=D(n)?`${n} `:"";const i=`${e} ${t};`;this._vertexShaderParts.varyingLines.push(`${n}out ${i}`),this._fragmentShaderParts.varyingLines.push(`${n}in ${i}`)},lu.prototype.addVertexLines=function(e){if("string"!=typeof e&&!Array.isArray(e))throw new P(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._vertexShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)},lu.prototype.addFragmentLines=function(e){if("string"!=typeof e&&!Array.isArray(e))throw new P(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._fragmentShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)},lu.prototype.buildShaderProgram=function(e){L.typeOf.object("context",e);const t=D(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=function(e){const t=[],n=[];let i,o,r,s,a=e._vertexShaderParts.structIds;for(i=0;i<a.length;i++)o=a[i],r=e._structs[o],s=r.generateGlslLines(),t.push.apply(t,s);for(a=e._fragmentShaderParts.structIds,i=0;i<a.length;i++)o=a[i],r=e._structs[o],s=r.generateGlslLines(),n.push.apply(n,s);return{vertexLines:t,fragmentLines:n}}(this),i=function(e){const t=[],n=[];let i,o,r,s,a=e._vertexShaderParts.functionIds;for(i=0;i<a.length;i++)o=a[i],r=e._functions[o],s=r.generateGlslLines(),t.push.apply(t,s);for(a=e._fragmentShaderParts.functionIds,i=0;i<a.length;i++)o=a[i],r=e._functions[o],s=r.generateGlslLines(),n.push.apply(n,s);return{vertexLines:t,fragmentLines:n}}(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join("\n"),r=new bc({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join("\n"),a=new bc({defines:this._fragmentShaderParts.defineLines,sources:[s]});return ya.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})},lu.prototype.clone=function(){return ti(this,!0)},uu._verifyAttributes=function(e){const t=[];for(let i=0;i<e.length;++i){const n=e[i],o={index:M(n.index,i),enabled:M(n.enabled,!0),componentsPerAttribute:n.componentsPerAttribute,componentDatatype:M(n.componentDatatype,Ca.FLOAT),normalize:M(n.normalize,!1),vertexBuffer:n.vertexBuffer,usage:M(n.usage,qe.STATIC_DRAW)};if(t.push(o),1!==o.componentsPerAttribute&&2!==o.componentsPerAttribute&&3!==o.componentsPerAttribute&&4!==o.componentsPerAttribute)throw new P("attribute.componentsPerAttribute must be in the range [1, 4].");const r=o.componentDatatype;if(!Ca.validate(r))throw new P("Attribute must have a valid componentDatatype or not specify it.");if(!qe.validate(o.usage))throw new P("Attribute must have a valid usage or not specify it.")}const n=new Array(t.length);for(let i=0;i<t.length;++i){const e=t[i].index;if(n[e])throw new P(`Index ${e} is used by more than one attribute.`);n[e]=!0}return t},uu._vertexSizeInBytes=function(e){let t=0;const n=e.length;for(let r=0;r<n;++r){const n=e[r];t+=n.componentsPerAttribute*Ca.getSizeInBytes(n.componentDatatype)}const i=n>0?Ca.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0;return t+=0===o?0:i-o,t},uu._createArrayViews=function(e,t){const n=[];let i=0;const o=e.length;for(let r=0;r<o;++r){const o=e[r],s=o.componentDatatype;n.push({index:o.index,enabled:o.enabled,componentsPerAttribute:o.componentsPerAttribute,componentDatatype:s,normalize:o.normalize,offsetInBytes:i,vertexSizeInComponentType:t/Ca.getSizeInBytes(s),view:void 0}),i+=o.componentsPerAttribute*Ca.getSizeInBytes(s)}return n},uu.prototype.resize=function(e){this._size=e;const t=this._allBuffers;this.writers=[];for(let n=0,i=t.length;n<i;++n){const e=t[n];uu._resize(e,this._size),uu._appendWriters(this.writers,e)}fu(this)},uu._resize=function(e,t){if(e.vertexSizeInBytes>0){const n=new ArrayBuffer(t*e.vertexSizeInBytes);if(D(e.arrayBuffer)){const t=new Uint8Array(n),i=new Uint8Array(e.arrayBuffer),o=i.length;for(let e=0;e<o;++e)t[e]=i[e]}const i=e.arrayViews,o=i.length;for(let e=0;e<o;++e){const t=i[e];t.view=Ca.createArrayBufferView(t.componentDatatype,n,t.offsetInBytes)}e.arrayBuffer=n}};const du=[function(e,t,n){return function(i,o){t[i*n]=o,e.needsCommit=!0}},function(e,t,n){return function(i,o,r){const s=i*n;t[s]=o,t[s+1]=r,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s){const a=i*n;t[a]=o,t[a+1]=r,t[a+2]=s,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s,a){const c=i*n;t[c]=o,t[c+1]=r,t[c+2]=s,t[c+3]=a,e.needsCommit=!0}}];function hu(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;const n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=D(n);if(!o||n.sizeInBytes<i)return o&&n.destroy(),t.vertexBuffer=Ye.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}function pu(e,t,n){if(e.needsCommit&&e.vertexSizeInBytes>0){const i=e.vertexSizeInBytes*t,o=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,o),i)}}function fu(e){const t=e.va;if(!D(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].va.destroy();e.va=void 0}function mu(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new gi,this.setValue(e)}function _u(e){return new mu(e)}function gu(e,t,n){return function(e,t,n,i,o){return{configurable:i,get:function(){return this[t]},set:function(i){const r=this[t],s=this[n];D(s)&&(s(),this[n]=void 0),!(void 0!==i)||D(i)&&D(i.getValue)||!D(o)||(i=o(i)),r!==i&&(this[t]=i,this._definitionChanged.raiseEvent(this,e,i,r)),D(i)&&D(i.definitionChanged)&&(this[n]=i.definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this,e,i,i)}),this))}}}(e,`_${e.toString()}`,`_${e.toString()}Subscription`,M(t,!1),M(n,_u))}function yu(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function bu(){this._array=[],this._hash={}}function vu(e,t){e=M(e,0),this._near=e,t=M(t,Number.MAX_VALUE),this._far=t}function Au(e,t,n,i){this.near=M(e,0),this.nearValue=M(t,0),this.far=M(n,1),this.farValue=M(i,0)}uu._appendWriters=function(e,t){const n=t.arrayViews,i=n.length;for(let o=0;o<i;++o){const i=n[o];e[i.index]=du[i.componentsPerAttribute-1](t,i.view,i.vertexSizeInComponentType)}},uu.prototype.commit=function(e){let t=!1;const n=this._allBuffers;let i,o,r;for(o=0,r=n.length;o<r;++o)i=n[o],t=hu(this,i)||t;if(t||!D(this.va)){fu(this);const t=this.va=[],s=V.SIXTY_FOUR_KILOBYTES-4,a=D(e)&&!this._instanced?Math.ceil(this._size/s):1;for(let c=0;c<a;++c){let l=[];for(o=0,r=n.length;o<r;++o){i=n[o];const e=c*(i.vertexSizeInBytes*s);uu._appendAttributes(l,i,e,this._instanced)}l=l.concat(this._precreated),t.push({va:new kl({context:this._context,attributes:l,indexBuffer:e}),indicesCount:1.5*(c!==a-1?s:this._size%s)})}}},uu._appendAttributes=function(e,t,n,i){const o=t.arrayViews,r=o.length;for(let s=0;s<r;++s){const r=o[s];e.push({index:r.index,enabled:r.enabled,componentsPerAttribute:r.componentsPerAttribute,componentDatatype:r.componentDatatype,normalize:r.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:n+r.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:i?1:0})}},uu.prototype.subCommit=function(e,t){if(e<0||e>=this._size)throw new P("offsetInVertices must be greater than or equal to zero and less than the vertex array size.");if(e+t>this._size)throw new P("offsetInVertices + lengthInVertices cannot exceed the vertex array size.");const n=this._allBuffers;for(let i=0,o=n.length;i<o;++i)pu(n[i],e,t)},uu.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1},uu.prototype.isDestroyed=function(){return!1},uu.prototype.destroy=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t){const n=e[t];n.vertexBuffer=n.vertexBuffer&&n.vertexBuffer.destroy()}return fu(this),He(this)},Object.defineProperties(mu.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}}),mu.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value},mu.prototype.setValue=function(e){const t=this._value;if(t!==e){const n=D(e),i=n&&"function"==typeof e.clone,o=n&&"function"==typeof e.equals;(!o||!e.equals(t))&&(this._hasClone=i,this._hasEquals=o,this._value=i?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}},mu.prototype.equals=function(e){return this===e||e instanceof mu&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))},mu.prototype.valueOf=function(){return this._value},mu.prototype.toString=function(){return String(this._value)},Object.defineProperties(yu.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),image:gu("image"),scale:gu("scale"),pixelOffset:gu("pixelOffset"),eyeOffset:gu("eyeOffset"),horizontalOrigin:gu("horizontalOrigin"),verticalOrigin:gu("verticalOrigin"),heightReference:gu("heightReference"),color:gu("color"),rotation:gu("rotation"),alignedAxis:gu("alignedAxis"),sizeInMeters:gu("sizeInMeters"),width:gu("width"),height:gu("height"),scaleByDistance:gu("scaleByDistance"),translucencyByDistance:gu("translucencyByDistance"),pixelOffsetScaleByDistance:gu("pixelOffsetScaleByDistance"),imageSubRegion:gu("imageSubRegion"),distanceDisplayCondition:gu("distanceDisplayCondition"),disableDepthTestDistance:gu("disableDepthTestDistance")}),yu.prototype.clone=function(e){return D(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 yu(this)},yu.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this._show,e.show),this.image=M(this._image,e.image),this.scale=M(this._scale,e.scale),this.pixelOffset=M(this._pixelOffset,e.pixelOffset),this.eyeOffset=M(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=M(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=M(this._verticalOrigin,e.verticalOrigin),this.heightReference=M(this._heightReference,e.heightReference),this.color=M(this._color,e.color),this.rotation=M(this._rotation,e.rotation),this.alignedAxis=M(this._alignedAxis,e.alignedAxis),this.sizeInMeters=M(this._sizeInMeters,e.sizeInMeters),this.width=M(this._width,e.width),this.height=M(this._height,e.height),this.scaleByDistance=M(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=M(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=M(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=M(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=M(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=M(this._disableDepthTestDistance,e.disableDepthTestDistance)},Object.defineProperties(bu.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}}),bu.prototype.contains=function(e){if("string"!=typeof e&&"number"!=typeof e)throw new P("key is required to be a string or number.");return D(this._hash[e])},bu.prototype.set=function(e,t){if("string"!=typeof e&&"number"!=typeof e)throw new P("key is required to be a string or number.");t!==this._hash[e]&&(this.remove(e),this._hash[e]=t,this._array.push(t))},bu.prototype.get=function(e){if("string"!=typeof e&&"number"!=typeof e)throw new P("key is required to be a string or number.");return this._hash[e]},bu.prototype.remove=function(e){if(D(e)&&"string"!=typeof e&&"number"!=typeof e)throw new P("key is required to be a string or number.");const t=this._hash[e],n=D(t);if(n){const n=this._array;n.splice(n.indexOf(t),1),delete this._hash[e]}return n},bu.prototype.removeAll=function(){const e=this._array;e.length>0&&(this._hash={},e.length=0)},Object.defineProperties(vu.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}}}),vu.packedLength=2,vu.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),t[n++]=e.near,t[n]=e.far,t},vu.unpack=function(e,t,n){if(!D(e))throw new P("array is required");return t=M(t,0),D(n)||(n=new vu),n.near=e[t++],n.far=e[t],n},vu.equals=function(e,t){return e===t||D(e)&&D(t)&&e.near===t.near&&e.far===t.far},vu.clone=function(e,t){if(D(e))return D(t)||(t=new vu),t.near=e.near,t.far=e.far,t},vu.prototype.clone=function(e){return vu.clone(this,e)},vu.prototype.equals=function(e){return vu.equals(this,e)},Au.clone=function(e,t){if(D(e))return D(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new Au(e.near,e.nearValue,e.far,e.farValue)},Au.packedLength=4,Au.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t},Au.unpack=function(e,t,n){if(!D(e))throw new P("array is required");return t=M(t,0),D(n)||(n=new Au),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n},Au.equals=function(e,t){return e===t||D(e)&&D(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue},Au.prototype.clone=function(e){return Au.clone(this,e)},Au.prototype.equals=function(e){return Au.equals(this,e)};const Tu={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2,CLAMP_TO_TERRAIN:3,RELATIVE_TO_TERRAIN:4,CLAMP_TO_3D_TILE:5,RELATIVE_TO_3D_TILE:6},wu=Object.freeze(Tu);function Eu(e){return e===Tu.CLAMP_TO_GROUND||e===Tu.CLAMP_TO_3D_TILE||e===Tu.CLAMP_TO_TERRAIN}function xu(e){return e===Tu.RELATIVE_TO_GROUND||e===Tu.RELATIVE_TO_3D_TILE||e===Tu.RELATIVE_TO_TERRAIN}const Su=Object.freeze({CENTER:0,LEFT:1,RIGHT:-1}),Cu=Object.freeze({CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1}),Iu=Object.freeze({DONE:0,PENDING:1,FAILED:2});function Ou(){P.throwInstantiationError()}Object.defineProperties(Ou.prototype,{isConstant:{get:P.throwInstantiationError},definitionChanged:{get:P.throwInstantiationError}}),Ou.prototype.getValue=P.throwInstantiationError,Ou.prototype.equals=P.throwInstantiationError,Ou.equals=function(e,t){return e===t||D(e)&&e.equals(t)},Ou.arrayEquals=function(e,t){if(e===t)return!0;if(!D(e)||!D(t)||e.length!==t.length)return!1;const n=e.length;for(let i=0;i<n;i++)if(!Ou.equals(e[i],t[i]))return!1;return!0},Ou.isConstant=function(e){return!D(e)||e.isConstant},Ou.getValueOrUndefined=function(e,t,n){return D(e)?e.getValue(t,n):void 0},Ou.getValueOrDefault=function(e,t,n,i){return D(e)?M(e.getValue(t,i),n):n},Ou.getValueOrClonedDefault=function(e,t,n,i){let o;return D(e)&&(o=e.getValue(t,i)),D(o)||(o=n.clone(o)),o};const Du=Ot.WHITE,Pu=H.ZERO,Nu=wu.NONE,Ru=kt.ZERO,Lu=H.ZERO,Mu=Su.CENTER,Fu=Cu.CENTER,Bu=new H,zu=new Ot,Uu=new H,ku=new kt,Vu=new Au,Hu=new Au,Gu=new Au,ju=new Fr,Wu=new vu;function qu(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function Yu(e,t){if(!D(e))throw new P("entityCluster is required.");if(!D(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(Yu.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new bu,this._onCollectionChanged(t,t.values,[],[])}function Xu(e,t,n){D(e)&&(e.billboard=void 0,n.removeBillboard(t))}function Qu(e,t){this.start=M(e,0),this.stop=M(t,0)}function $u(e,t){this.center=H.clone(M(e,H.ZERO)),this.radius=M(t,0)}Yu.prototype.update=function(e){if(!D(e))throw new P("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const o=t[i],r=o.entity,s=r._billboard;let a,c,l=o.billboard,u=r.isShowing&&r.isAvailable(e)&&Ou.getValueOrDefault(s._show,e,!0);if(u&&(c=Ou.getValueOrUndefined(r._position,e,Bu),a=Ou.getValueOrUndefined(s._image,e),u=D(c)&&D(a)),!u){Xu(o,r,n);continue}Ou.isConstant(r._position)||(n._clusterDirty=!0),D(l)||(l=n.getBillboard(r),l.id=r,l.image=void 0,o.billboard=l),l.show=u,D(l.image)&&o.textureValue===a||(l.image=a,o.textureValue=a),l.position=c,l.color=Ou.getValueOrDefault(s._color,e,Du,zu),l.eyeOffset=Ou.getValueOrDefault(s._eyeOffset,e,Pu,Uu),l.heightReference=Ou.getValueOrDefault(s._heightReference,e,Nu),l.pixelOffset=Ou.getValueOrDefault(s._pixelOffset,e,Ru,ku),l.scale=Ou.getValueOrDefault(s._scale,e,1),l.rotation=Ou.getValueOrDefault(s._rotation,e,0),l.alignedAxis=Ou.getValueOrDefault(s._alignedAxis,e,Lu),l.horizontalOrigin=Ou.getValueOrDefault(s._horizontalOrigin,e,Mu),l.verticalOrigin=Ou.getValueOrDefault(s._verticalOrigin,e,Fu),l.width=Ou.getValueOrUndefined(s._width,e),l.height=Ou.getValueOrUndefined(s._height,e),l.scaleByDistance=Ou.getValueOrUndefined(s._scaleByDistance,e,Vu),l.translucencyByDistance=Ou.getValueOrUndefined(s._translucencyByDistance,e,Hu),l.pixelOffsetScaleByDistance=Ou.getValueOrUndefined(s._pixelOffsetScaleByDistance,e,Gu),l.sizeInMeters=Ou.getValueOrDefault(s._sizeInMeters,e,false),l.distanceDisplayCondition=Ou.getValueOrUndefined(s._distanceDisplayCondition,e,Wu),l.disableDepthTestDistance=Ou.getValueOrUndefined(s._disableDepthTestDistance,e);const d=Ou.getValueOrUndefined(s._imageSubRegion,e,ju);D(d)&&l.setImageSubRegion(l._imageId,d)}return!0},Yu.prototype.getBoundingSphere=function(e,t){if(!D(e))throw new P("entity is required.");if(!D(t))throw new P("result is required.");const n=this._items.get(e.id);if(!D(n)||!D(n.billboard))return Iu.FAILED;const i=n.billboard;if(i.heightReference===wu.NONE)t.center=H.clone(i.position,t.center);else{if(!D(i._clampedPosition))return Iu.PENDING;t.center=H.clone(i._clampedPosition,t.center)}return t.radius=0,Iu.DONE},Yu.prototype.isDestroyed=function(){return!1},Yu.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Yu.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return He(this)},Yu.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],D(r._billboard)&&D(r._position)&&s.set(r.id,new qu(r));for(o=i.length-1;o>-1;o--)r=i[o],D(r._billboard)&&D(r._position)?s.contains(r.id)||s.set(r.id,new qu(r)):(Xu(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],Xu(s.get(r.id),r,a),s.remove(r.id)};const Ku=new H,Zu=new H,Ju=new H,ed=new H,td=new H,nd=new H,id=new H,od=new H,rd=new H,sd=new H,ad=new H,cd=new H,ld=4/3*V.PI;$u.fromPoints=function(e,t){if(D(t)||(t=new $u),!D(e)||0===e.length)return t.center=H.clone(H.ZERO,t.center),t.radius=0,t;const n=H.clone(e[0],id),i=H.clone(n,Ku),o=H.clone(n,Zu),r=H.clone(n,Ju),s=H.clone(n,ed),a=H.clone(n,td),c=H.clone(n,nd),l=e.length;let u;for(u=1;u<l;u++){H.clone(e[u],n);const t=n.x,l=n.y,d=n.z;t<i.x&&H.clone(n,i),t>s.x&&H.clone(n,s),l<o.y&&H.clone(n,o),l>a.y&&H.clone(n,a),d<r.z&&H.clone(n,r),d>c.z&&H.clone(n,c)}const d=H.magnitudeSquared(H.subtract(s,i,od)),h=H.magnitudeSquared(H.subtract(a,o,od)),p=H.magnitudeSquared(H.subtract(c,r,od));let f=i,m=s,_=d;h>_&&(_=h,f=o,m=a),p>_&&(_=p,f=r,m=c);const g=rd;g.x=.5*(f.x+m.x),g.y=.5*(f.y+m.y),g.z=.5*(f.z+m.z);let y=H.magnitudeSquared(H.subtract(m,g,od)),b=Math.sqrt(y);const v=sd;v.x=i.x,v.y=o.y,v.z=r.z;const A=ad;A.x=s.x,A.y=a.y,A.z=c.z;const T=H.midpoint(v,A,cd);let w=0;for(u=0;u<l;u++){H.clone(e[u],n);const t=H.magnitude(H.subtract(n,T,od));t>w&&(w=t);const i=H.magnitudeSquared(H.subtract(n,g,od));if(i>y){const e=Math.sqrt(i);b=.5*(b+e),y=b*b;const t=e-b;g.x=(b*g.x+t*n.x)/e,g.y=(b*g.y+t*n.y)/e,g.z=(b*g.z+t*n.z)/e}}return b<w?(H.clone(g,t.center),t.radius=b):(H.clone(T,t.center),t.radius=w),t};const ud=new fn,dd=new H,hd=new H,pd=new Qt,fd=new Qt;$u.fromRectangle2D=function(e,t,n){return $u.fromRectangleWithHeights2D(e,t,0,0,n)},$u.fromRectangleWithHeights2D=function(e,t,n,i,o){if(D(o)||(o=new $u),!D(e))return o.center=H.clone(H.ZERO,o.center),o.radius=0,o;t=M(t,ud),Ir.southwest(e,pd),pd.height=n,Ir.northeast(e,fd),fd.height=i;const r=t.project(pd,dd),s=t.project(fd,hd),a=s.x-r.x,c=s.y-r.y,l=s.z-r.z;o.radius=.5*Math.sqrt(a*a+c*c+l*l);const u=o.center;return u.x=r.x+.5*a,u.y=r.y+.5*c,u.z=r.z+.5*l,o};const md=[];$u.fromRectangle3D=function(e,t,n,i){if(t=M(t,on.WGS84),n=M(n,0),D(i)||(i=new $u),!D(e))return i.center=H.clone(H.ZERO,i.center),i.radius=0,i;const o=Ir.subsample(e,t,n,md);return $u.fromPoints(o,i)},$u.fromVertices=function(e,t,n,i){if(D(i)||(i=new $u),!D(e)||0===e.length)return i.center=H.clone(H.ZERO,i.center),i.radius=0,i;t=M(t,H.ZERO),n=M(n,3),L.typeOf.number.greaterThanOrEquals("stride",n,3);const o=id;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;const r=H.clone(o,Ku),s=H.clone(o,Zu),a=H.clone(o,Ju),c=H.clone(o,ed),l=H.clone(o,td),u=H.clone(o,nd),d=e.length;let h;for(h=0;h<d;h+=n){const n=e[h]+t.x,i=e[h+1]+t.y,d=e[h+2]+t.z;o.x=n,o.y=i,o.z=d,n<r.x&&H.clone(o,r),n>c.x&&H.clone(o,c),i<s.y&&H.clone(o,s),i>l.y&&H.clone(o,l),d<a.z&&H.clone(o,a),d>u.z&&H.clone(o,u)}const p=H.magnitudeSquared(H.subtract(c,r,od)),f=H.magnitudeSquared(H.subtract(l,s,od)),m=H.magnitudeSquared(H.subtract(u,a,od));let _=r,g=c,y=p;f>y&&(y=f,_=s,g=l),m>y&&(y=m,_=a,g=u);const b=rd;b.x=.5*(_.x+g.x),b.y=.5*(_.y+g.y),b.z=.5*(_.z+g.z);let v=H.magnitudeSquared(H.subtract(g,b,od)),A=Math.sqrt(v);const T=sd;T.x=r.x,T.y=s.y,T.z=a.z;const w=ad;w.x=c.x,w.y=l.y,w.z=u.z;const E=H.midpoint(T,w,cd);let x=0;for(h=0;h<d;h+=n){o.x=e[h]+t.x,o.y=e[h+1]+t.y,o.z=e[h+2]+t.z;const n=H.magnitude(H.subtract(o,E,od));n>x&&(x=n);const i=H.magnitudeSquared(H.subtract(o,b,od));if(i>v){const e=Math.sqrt(i);A=.5*(A+e),v=A*A;const t=e-A;b.x=(A*b.x+t*o.x)/e,b.y=(A*b.y+t*o.y)/e,b.z=(A*b.z+t*o.z)/e}}return A<x?(H.clone(b,i.center),i.radius=A):(H.clone(E,i.center),i.radius=x),i},$u.fromEncodedCartesianVertices=function(e,t,n){if(D(n)||(n=new $u),!D(e)||!D(t)||e.length!==t.length||0===e.length)return n.center=H.clone(H.ZERO,n.center),n.radius=0,n;const i=id;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];const o=H.clone(i,Ku),r=H.clone(i,Zu),s=H.clone(i,Ju),a=H.clone(i,ed),c=H.clone(i,td),l=H.clone(i,nd),u=e.length;let d;for(d=0;d<u;d+=3){const n=e[d]+t[d],u=e[d+1]+t[d+1],h=e[d+2]+t[d+2];i.x=n,i.y=u,i.z=h,n<o.x&&H.clone(i,o),n>a.x&&H.clone(i,a),u<r.y&&H.clone(i,r),u>c.y&&H.clone(i,c),h<s.z&&H.clone(i,s),h>l.z&&H.clone(i,l)}const h=H.magnitudeSquared(H.subtract(a,o,od)),p=H.magnitudeSquared(H.subtract(c,r,od)),f=H.magnitudeSquared(H.subtract(l,s,od));let m=o,_=a,g=h;p>g&&(g=p,m=r,_=c),f>g&&(g=f,m=s,_=l);const y=rd;y.x=.5*(m.x+_.x),y.y=.5*(m.y+_.y),y.z=.5*(m.z+_.z);let b=H.magnitudeSquared(H.subtract(_,y,od)),v=Math.sqrt(b);const A=sd;A.x=o.x,A.y=r.y,A.z=s.z;const T=ad;T.x=a.x,T.y=c.y,T.z=l.z;const w=H.midpoint(A,T,cd);let E=0;for(d=0;d<u;d+=3){i.x=e[d]+t[d],i.y=e[d+1]+t[d+1],i.z=e[d+2]+t[d+2];const n=H.magnitude(H.subtract(i,w,od));n>E&&(E=n);const o=H.magnitudeSquared(H.subtract(i,y,od));if(o>b){const e=Math.sqrt(o);v=.5*(v+e),b=v*v;const t=e-v;y.x=(v*y.x+t*i.x)/e,y.y=(v*y.y+t*i.y)/e,y.z=(v*y.z+t*i.z)/e}}return v<E?(H.clone(y,n.center),n.radius=v):(H.clone(w,n.center),n.radius=E),n},$u.fromCornerPoints=function(e,t,n){L.typeOf.object("corner",e),L.typeOf.object("oppositeCorner",t),D(n)||(n=new $u);const i=H.midpoint(e,t,n.center);return n.radius=H.distance(i,t),n},$u.fromEllipsoid=function(e,t){return L.typeOf.object("ellipsoid",e),D(t)||(t=new $u),H.clone(H.ZERO,t.center),t.radius=e.maximumRadius,t};const _d=new H;$u.fromBoundingSpheres=function(e,t){if(D(t)||(t=new $u),!D(e)||0===e.length)return t.center=H.clone(H.ZERO,t.center),t.radius=0,t;const n=e.length;if(1===n)return $u.clone(e[0],t);if(2===n)return $u.union(e[0],e[1],t);const i=[];let o;for(o=0;o<n;o++)i.push(e[o].center);const r=(t=$u.fromPoints(i,t)).center;let s=t.radius;for(o=0;o<n;o++){const t=e[o];s=Math.max(s,H.distance(r,t.center,_d)+t.radius)}return t.radius=s,t};const gd=new H,yd=new H,bd=new H;$u.fromOrientedBoundingBox=function(e,t){L.defined("orientedBoundingBox",e),D(t)||(t=new $u);const n=e.halfAxes,i=re.getColumn(n,0,gd),o=re.getColumn(n,1,yd),r=re.getColumn(n,2,bd);return H.add(i,o,i),H.add(i,r,i),t.center=H.clone(e.center,t.center),t.radius=H.magnitude(i),t};const vd=new H,Ad=new H;$u.fromTransformation=function(e,t){L.typeOf.object("transformation",e),D(t)||(t=new $u);const n=ve.getTranslation(e,vd),i=ve.getScale(e,Ad),o=.5*H.magnitude(i);return t.center=H.clone(n,t.center),t.radius=o,t},$u.clone=function(e,t){if(D(e))return D(t)?(t.center=H.clone(e.center,t.center),t.radius=e.radius,t):new $u(e.center,e.radius)},$u.packedLength=4,$u.pack=function(e,t,n){L.typeOf.object("value",e),L.defined("array",t),n=M(n,0);const i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t},$u.unpack=function(e,t,n){L.defined("array",e),t=M(t,0),D(n)||(n=new $u);const i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};const Td=new H,wd=new H;$u.union=function(e,t,n){L.typeOf.object("left",e),L.typeOf.object("right",t),D(n)||(n=new $u);const i=e.center,o=e.radius,r=t.center,s=t.radius,a=H.subtract(r,i,Td),c=H.magnitude(a);if(o>=c+s)return e.clone(n),n;if(s>=c+o)return t.clone(n),n;const l=.5*(o+c+s),u=H.multiplyByScalar(a,(-o+l)/c,wd);return H.add(u,i,u),H.clone(u,n.center),n.radius=l,n};const Ed=new H;$u.expand=function(e,t,n){L.typeOf.object("sphere",e),L.typeOf.object("point",t),n=$u.clone(e,n);const i=H.magnitude(H.subtract(t,n.center,Ed));return i>n.radius&&(n.radius=i),n},$u.intersectPlane=function(e,t){L.typeOf.object("sphere",e),L.typeOf.object("plane",t);const n=e.center,i=e.radius,o=t.normal,r=H.dot(o,n)+t.distance;return r<-i?mn.OUTSIDE:r<i?mn.INTERSECTING:mn.INSIDE},$u.transform=function(e,t,n){return L.typeOf.object("sphere",e),L.typeOf.object("transform",t),D(n)||(n=new $u),n.center=ve.multiplyByPoint(t,e.center,n.center),n.radius=ve.getMaximumScale(t)*e.radius,n};const xd=new H;$u.distanceSquaredTo=function(e,t){L.typeOf.object("sphere",e),L.typeOf.object("cartesian",t);const n=H.subtract(e.center,t,xd),i=H.magnitude(n)-e.radius;return i<=0?0:i*i},$u.transformWithoutScale=function(e,t,n){return L.typeOf.object("sphere",e),L.typeOf.object("transform",t),D(n)||(n=new $u),n.center=ve.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};const Sd=new H;$u.computePlaneDistances=function(e,t,n,i){L.typeOf.object("sphere",e),L.typeOf.object("position",t),L.typeOf.object("direction",n),D(i)||(i=new Qu);const o=H.subtract(e.center,t,Sd),r=H.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};const Cd=new H,Id=new H,Od=new H,Dd=new H,Pd=new H,Nd=new Qt,Rd=new Array(8);for(let ko=0;ko<8;++ko)Rd[ko]=new H;const Ld=new fn;function Md(e){e=M(e,M.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}$u.projectTo2D=function(e,t,n){L.typeOf.object("sphere",e);const i=(t=M(t,Ld)).ellipsoid;let o=e.center;const r=e.radius;let s;s=H.equals(o,H.ZERO)?H.clone(H.UNIT_X,Cd):i.geodeticSurfaceNormal(o,Cd);const a=H.cross(H.UNIT_Z,s,Id);H.normalize(a,a);const c=H.cross(s,a,Od);H.normalize(c,c),H.multiplyByScalar(s,r,s),H.multiplyByScalar(c,r,c),H.multiplyByScalar(a,r,a);const l=H.negate(c,Pd),u=H.negate(a,Dd),d=Rd;let h=d[0];H.add(s,c,h),H.add(h,a,h),h=d[1],H.add(s,c,h),H.add(h,u,h),h=d[2],H.add(s,l,h),H.add(h,u,h),h=d[3],H.add(s,l,h),H.add(h,a,h),H.negate(s,s),h=d[4],H.add(s,c,h),H.add(h,a,h),h=d[5],H.add(s,c,h),H.add(h,u,h),h=d[6],H.add(s,l,h),H.add(h,u,h),h=d[7],H.add(s,l,h),H.add(h,a,h);const p=d.length;for(let g=0;g<p;++g){const e=d[g];H.add(o,e,e);const n=i.cartesianToCartographic(e,Nd);t.project(n,e)}o=(n=$u.fromPoints(d,n)).center;const f=o.x,m=o.y,_=o.z;return o.x=_,o.y=f,o.z=m,n},$u.isOccluded=function(e,t){return L.typeOf.object("sphere",e),L.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)},$u.equals=function(e,t){return e===t||D(e)&&D(t)&&H.equals(e.center,t.center)&&e.radius===t.radius},$u.prototype.intersectPlane=function(e){return $u.intersectPlane(this,e)},$u.prototype.distanceSquaredTo=function(e){return $u.distanceSquaredTo(this,e)},$u.prototype.computePlaneDistances=function(e,t,n){return $u.computePlaneDistances(this,e,t,n)},$u.prototype.isOccluded=function(e){return $u.isOccluded(this,e)},$u.prototype.equals=function(e){return $u.equals(this,e)},$u.prototype.clone=function(e){return $u.clone(this,e)},$u.prototype.volume=function(){const e=this.radius;return ld*e*e*e};const Fd=Object.freeze({NONE:0,TOP:1,ALL:2});function Bd(e){e=M(e,M.EMPTY_OBJECT),this.position=M(e.position,!1),this.normal=M(e.normal,!1),this.st=M(e.st,!1),this.bitangent=M(e.bitangent,!1),this.tangent=M(e.tangent,!1),this.color=M(e.color,!1)}Bd.POSITION_ONLY=Object.freeze(new Bd({position:!0})),Bd.POSITION_AND_NORMAL=Object.freeze(new Bd({position:!0,normal:!0})),Bd.POSITION_NORMAL_AND_ST=Object.freeze(new Bd({position:!0,normal:!0,st:!0})),Bd.POSITION_AND_ST=Object.freeze(new Bd({position:!0,st:!0})),Bd.POSITION_AND_COLOR=Object.freeze(new Bd({position:!0,color:!0})),Bd.ALL=Object.freeze(new Bd({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0})),Bd.DEFAULT=Bd.POSITION_NORMAL_AND_ST,Bd.packedLength=6,Bd.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),t[n++]=e.position?1:0,t[n++]=e.normal?1:0,t[n++]=e.st?1:0,t[n++]=e.tangent?1:0,t[n++]=e.bitangent?1:0,t[n]=e.color?1:0,t},Bd.unpack=function(e,t,n){if(!D(e))throw new P("array is required");return t=M(t,0),D(n)||(n=new Bd),n.position=1===e[t++],n.normal=1===e[t++],n.st=1===e[t++],n.tangent=1===e[t++],n.bitangent=1===e[t++],n.color=1===e[t],n},Bd.clone=function(e,t){if(D(e))return D(t)||(t=new Bd),t.position=e.position,t.normal=e.normal,t.st=e.st,t.tangent=e.tangent,t.bitangent=e.bitangent,t.color=e.color,t};const zd=new H;function Ud(e){const t=(e=M(e,M.EMPTY_OBJECT)).minimum,n=e.maximum;if(L.typeOf.object("min",t),L.typeOf.object("max",n),D(e.offsetAttribute)&&e.offsetAttribute===Fd.TOP)throw new P("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");const i=M(e.vertexFormat,Bd.DEFAULT);this._minimum=H.clone(t),this._maximum=H.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}Ud.fromDimensions=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).dimensions;L.typeOf.object("dimensions",t),L.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),L.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),L.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=H.multiplyByScalar(t,.5,new H);return new Ud({minimum:H.negate(n,new H),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})},Ud.fromAxisAlignedBoundingBox=function(e){return L.typeOf.object("boundingBox",e),new Ud({minimum:e.minimum,maximum:e.maximum})},Ud.packedLength=2*H.packedLength+Bd.packedLength+1,Ud.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),H.pack(e._minimum,t,n),H.pack(e._maximum,t,n+H.packedLength),Bd.pack(e._vertexFormat,t,n+2*H.packedLength),t[n+2*H.packedLength+Bd.packedLength]=M(e._offsetAttribute,-1),t};const kd=new H,Vd=new H,Hd=new Bd,Gd={minimum:kd,maximum:Vd,vertexFormat:Hd,offsetAttribute:void 0};let jd;Ud.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=H.unpack(e,t,kd),o=H.unpack(e,t+H.packedLength,Vd),r=Bd.unpack(e,t+2*H.packedLength,Hd),s=e[t+2*H.packedLength+Bd.packedLength];return D(n)?(n._minimum=H.clone(i,n._minimum),n._maximum=H.clone(o,n._maximum),n._vertexFormat=Bd.clone(r,n._vertexFormat),n._offsetAttribute=-1===s?void 0:s,n):(Gd.offsetAttribute=-1===s?void 0:s,new Ud(Gd))},Ud.createGeometry=function(e){const t=e._minimum,n=e._maximum,i=e._vertexFormat;if(H.equals(t,n))return;const o=new Md;let r,s;if(i.position&&(i.st||i.normal||i.tangent||i.bitangent)){if(i.position&&(s=new Float64Array(72),s[0]=t.x,s[1]=t.y,s[2]=n.z,s[3]=n.x,s[4]=t.y,s[5]=n.z,s[6]=n.x,s[7]=n.y,s[8]=n.z,s[9]=t.x,s[10]=n.y,s[11]=n.z,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=n.x,s[16]=t.y,s[17]=t.z,s[18]=n.x,s[19]=n.y,s[20]=t.z,s[21]=t.x,s[22]=n.y,s[23]=t.z,s[24]=n.x,s[25]=t.y,s[26]=t.z,s[27]=n.x,s[28]=n.y,s[29]=t.z,s[30]=n.x,s[31]=n.y,s[32]=n.z,s[33]=n.x,s[34]=t.y,s[35]=n.z,s[36]=t.x,s[37]=t.y,s[38]=t.z,s[39]=t.x,s[40]=n.y,s[41]=t.z,s[42]=t.x,s[43]=n.y,s[44]=n.z,s[45]=t.x,s[46]=t.y,s[47]=n.z,s[48]=t.x,s[49]=n.y,s[50]=t.z,s[51]=n.x,s[52]=n.y,s[53]=t.z,s[54]=n.x,s[55]=n.y,s[56]=n.z,s[57]=t.x,s[58]=n.y,s[59]=n.z,s[60]=t.x,s[61]=t.y,s[62]=t.z,s[63]=n.x,s[64]=t.y,s[65]=t.z,s[66]=n.x,s[67]=t.y,s[68]=n.z,s[69]=t.x,s[70]=t.y,s[71]=n.z,o.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s})),i.normal){const e=new Float32Array(72);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=1,e[9]=0,e[10]=0,e[11]=1,e[12]=0,e[13]=0,e[14]=-1,e[15]=0,e[16]=0,e[17]=-1,e[18]=0,e[19]=0,e[20]=-1,e[21]=0,e[22]=0,e[23]=-1,e[24]=1,e[25]=0,e[26]=0,e[27]=1,e[28]=0,e[29]=0,e[30]=1,e[31]=0,e[32]=0,e[33]=1,e[34]=0,e[35]=0,e[36]=-1,e[37]=0,e[38]=0,e[39]=-1,e[40]=0,e[41]=0,e[42]=-1,e[43]=0,e[44]=0,e[45]=-1,e[46]=0,e[47]=0,e[48]=0,e[49]=1,e[50]=0,e[51]=0,e[52]=1,e[53]=0,e[54]=0,e[55]=1,e[56]=0,e[57]=0,e[58]=1,e[59]=0,e[60]=0,e[61]=-1,e[62]=0,e[63]=0,e[64]=-1,e[65]=0,e[66]=0,e[67]=-1,e[68]=0,e[69]=0,e[70]=-1,e[71]=0,o.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}if(i.st){const e=new Float32Array(48);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=1,e[5]=1,e[6]=0,e[7]=1,e[8]=1,e[9]=0,e[10]=0,e[11]=0,e[12]=0,e[13]=1,e[14]=1,e[15]=1,e[16]=0,e[17]=0,e[18]=1,e[19]=0,e[20]=1,e[21]=1,e[22]=0,e[23]=1,e[24]=1,e[25]=0,e[26]=0,e[27]=0,e[28]=0,e[29]=1,e[30]=1,e[31]=1,e[32]=1,e[33]=0,e[34]=0,e[35]=0,e[36]=0,e[37]=1,e[38]=1,e[39]=1,e[40]=0,e[41]=0,e[42]=1,e[43]=0,e[44]=1,e[45]=1,e[46]=0,e[47]=1,o.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:e})}if(i.tangent){const e=new Float32Array(72);e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=1,e[7]=0,e[8]=0,e[9]=1,e[10]=0,e[11]=0,e[12]=-1,e[13]=0,e[14]=0,e[15]=-1,e[16]=0,e[17]=0,e[18]=-1,e[19]=0,e[20]=0,e[21]=-1,e[22]=0,e[23]=0,e[24]=0,e[25]=1,e[26]=0,e[27]=0,e[28]=1,e[29]=0,e[30]=0,e[31]=1,e[32]=0,e[33]=0,e[34]=1,e[35]=0,e[36]=0,e[37]=-1,e[38]=0,e[39]=0,e[40]=-1,e[41]=0,e[42]=0,e[43]=-1,e[44]=0,e[45]=0,e[46]=-1,e[47]=0,e[48]=-1,e[49]=0,e[50]=0,e[51]=-1,e[52]=0,e[53]=0,e[54]=-1,e[55]=0,e[56]=0,e[57]=-1,e[58]=0,e[59]=0,e[60]=1,e[61]=0,e[62]=0,e[63]=1,e[64]=0,e[65]=0,e[66]=1,e[67]=0,e[68]=0,e[69]=1,e[70]=0,e[71]=0,o.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}if(i.bitangent){const e=new Float32Array(72);e[0]=0,e[1]=1,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=1,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=1,e[14]=0,e[15]=0,e[16]=1,e[17]=0,e[18]=0,e[19]=1,e[20]=0,e[21]=0,e[22]=1,e[23]=0,e[24]=0,e[25]=0,e[26]=1,e[27]=0,e[28]=0,e[29]=1,e[30]=0,e[31]=0,e[32]=1,e[33]=0,e[34]=0,e[35]=1,e[36]=0,e[37]=0,e[38]=1,e[39]=0,e[40]=0,e[41]=1,e[42]=0,e[43]=0,e[44]=1,e[45]=0,e[46]=0,e[47]=1,e[48]=0,e[49]=0,e[50]=1,e[51]=0,e[52]=0,e[53]=1,e[54]=0,e[55]=0,e[56]=1,e[57]=0,e[58]=0,e[59]=1,e[60]=0,e[61]=0,e[62]=1,e[63]=0,e[64]=0,e[65]=1,e[66]=0,e[67]=0,e[68]=1,e[69]=0,e[70]=0,e[71]=1,o.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}r=new Uint16Array(36),r[0]=0,r[1]=1,r[2]=2,r[3]=0,r[4]=2,r[5]=3,r[6]=6,r[7]=5,r[8]=4,r[9]=7,r[10]=6,r[11]=4,r[12]=8,r[13]=9,r[14]=10,r[15]=8,r[16]=10,r[17]=11,r[18]=14,r[19]=13,r[20]=12,r[21]=15,r[22]=14,r[23]=12,r[24]=18,r[25]=17,r[26]=16,r[27]=19,r[28]=18,r[29]=16,r[30]=20,r[31]=21,r[32]=22,r[33]=20,r[34]=22,r[35]=23}else s=new Float64Array(24),s[0]=t.x,s[1]=t.y,s[2]=t.z,s[3]=n.x,s[4]=t.y,s[5]=t.z,s[6]=n.x,s[7]=n.y,s[8]=t.z,s[9]=t.x,s[10]=n.y,s[11]=t.z,s[12]=t.x,s[13]=t.y,s[14]=n.z,s[15]=n.x,s[16]=t.y,s[17]=n.z,s[18]=n.x,s[19]=n.y,s[20]=n.z,s[21]=t.x,s[22]=n.y,s[23]=n.z,o.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s}),r=new Uint16Array(36),r[0]=4,r[1]=5,r[2]=6,r[3]=4,r[4]=6,r[5]=7,r[6]=1,r[7]=0,r[8]=3,r[9]=1,r[10]=3,r[11]=2,r[12]=1,r[13]=6,r[14]=5,r[15]=1,r[16]=2,r[17]=6,r[18]=2,r[19]=3,r[20]=7,r[21]=2,r[22]=7,r[23]=6,r[24]=3,r[25]=0,r[26]=4,r[27]=3,r[28]=4,r[29]=7,r[30]=0,r[31]=1,r[32]=5,r[33]=0,r[34]=5,r[35]=4;const a=H.subtract(n,t,zd),c=.5*H.magnitude(a);if(D(e._offsetAttribute)){const t=s.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);o.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:o,indices:r,primitiveType:Vr.TRIANGLES,boundingSphere:new $u(H.ZERO,c),offsetAttribute:e._offsetAttribute})},Ud.getUnitBox=function(){return D(jd)||(jd=Ud.createGeometry(Ud.fromDimensions({dimensions:new H(1,1,1),vertexFormat:Bd.POSITION_ONLY}))),jd};const Wd=new H;function qd(e){const t=(e=M(e,M.EMPTY_OBJECT)).minimum,n=e.maximum;if(L.typeOf.object("min",t),L.typeOf.object("max",n),D(e.offsetAttribute)&&e.offsetAttribute===Fd.TOP)throw new P("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=H.clone(t),this._max=H.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}qd.fromDimensions=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).dimensions;L.typeOf.object("dimensions",t),L.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),L.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),L.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=H.multiplyByScalar(t,.5,new H);return new qd({minimum:H.negate(n,new H),maximum:n,offsetAttribute:e.offsetAttribute})},qd.fromAxisAlignedBoundingBox=function(e){return L.typeOf.object("boundindBox",e),new qd({minimum:e.minimum,maximum:e.maximum})},qd.packedLength=2*H.packedLength+1,qd.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),H.pack(e._min,t,n),H.pack(e._max,t,n+H.packedLength),t[n+2*H.packedLength]=M(e._offsetAttribute,-1),t};const Yd=new H,Xd=new H,Qd={minimum:Yd,maximum:Xd,offsetAttribute:void 0};function $d(e,t,n,i){e=M(e,1),t=M(t,1),n=M(n,1),i=M(i,1),this.value=new Uint8Array([Ot.floatToByte(e),Ot.floatToByte(t),Ot.floatToByte(n),Ot.floatToByte(i)])}function Kd(e,t){if(e=M(e,0),(t=M(t,Number.MAX_VALUE))<=e)throw new P("far distance must be greater than near distance.");this.value=new Float32Array([e,t])}function Zd(e){if(!D((e=M(e,M.EMPTY_OBJECT)).geometry))throw new P("options.geometry is required.");this.geometry=e.geometry,this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=M(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}function Jd(e){e=M(e,M.EMPTY_OBJECT),this.start=D(e.start)?Hn.clone(e.start):new Hn,this.stop=D(e.stop)?Hn.clone(e.stop):new Hn,this.data=e.data,this.isStartIncluded=M(e.isStartIncluded,!0),this.isStopIncluded=M(e.isStopIncluded,!0)}qd.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=H.unpack(e,t,Yd),o=H.unpack(e,t+H.packedLength,Xd),r=e[t+2*H.packedLength];return D(n)?(n._min=H.clone(i,n._min),n._max=H.clone(o,n._max),n._offsetAttribute=-1===r?void 0:r,n):(Qd.offsetAttribute=-1===r?void 0:r,new qd(Qd))},qd.createGeometry=function(e){const t=e._min,n=e._max;if(H.equals(t,n))return;const i=new Md,o=new Uint16Array(24),r=new Float64Array(24);r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=n.x,r[4]=t.y,r[5]=t.z,r[6]=n.x,r[7]=n.y,r[8]=t.z,r[9]=t.x,r[10]=n.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=n.z,r[15]=n.x,r[16]=t.y,r[17]=n.z,r[18]=n.x,r[19]=n.y,r[20]=n.z,r[21]=t.x,r[22]=n.y,r[23]=n.z,i.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:r}),o[0]=4,o[1]=5,o[2]=5,o[3]=6,o[4]=6,o[5]=7,o[6]=7,o[7]=4,o[8]=0,o[9]=1,o[10]=1,o[11]=2,o[12]=2,o[13]=3,o[14]=3,o[15]=0,o[16]=0,o[17]=4,o[18]=1,o[19]=5,o[20]=2,o[21]=6,o[22]=3,o[23]=7;const s=H.subtract(n,t,Wd),a=.5*H.magnitude(s);if(D(e._offsetAttribute)){const t=r.length,n=e._offsetAttribute===Fd.NONE?0:1,o=new Uint8Array(t/3).fill(n);i.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:o})}return new Na({attributes:i,indices:o,primitiveType:Vr.LINES,boundingSphere:new $u(H.ZERO,a),offsetAttribute:e._offsetAttribute})},Object.defineProperties($d.prototype,{componentDatatype:{get:function(){return Ca.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}}),$d.fromColor=function(e){if(!D(e))throw new P("color is required.");return new $d(e.red,e.green,e.blue,e.alpha)},$d.toValue=function(e,t){if(!D(e))throw new P("color is required.");return D(t)?e.toBytes(t):new Uint8Array(e.toBytes())},$d.equals=function(e,t){return e===t||D(e)&&D(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]},Object.defineProperties(Kd.prototype,{componentDatatype:{get:function(){return Ca.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}}),Kd.fromDistanceDisplayCondition=function(e){if(!D(e))throw new P("distanceDisplayCondition is required.");if(e.far<=e.near)throw new P("distanceDisplayCondition.far distance must be greater than distanceDisplayCondition.near distance.");return new Kd(e.near,e.far)},Kd.toValue=function(e,t){if(!D(e))throw new P("distanceDisplayCondition is required.");return D(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])},Object.defineProperties(Jd.prototype,{isEmpty:{get:function(){const e=Hn.compare(this.stop,this.start);return e<0||0===e&&(!this.isStartIncluded||!this.isStopIncluded)}}});const eh={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};Jd.fromIso8601=function(e,t){L.typeOf.object("options",e),L.typeOf.string("options.iso8601",e.iso8601);const n=e.iso8601.split("/");if(2!==n.length)throw new P("options.iso8601 is an invalid ISO 8601 interval.");const i=Hn.fromIso8601(n[0]),o=Hn.fromIso8601(n[1]),r=M(e.isStartIncluded,!0),s=M(e.isStopIncluded,!0),a=e.data;return D(t)?(t.start=i,t.stop=o,t.isStartIncluded=r,t.isStopIncluded=s,t.data=a,t):(eh.start=i,eh.stop=o,eh.isStartIncluded=r,eh.isStopIncluded=s,eh.data=a,new Jd(eh))},Jd.toIso8601=function(e,t){return L.typeOf.object("timeInterval",e),`${Hn.toIso8601(e.start,t)}/${Hn.toIso8601(e.stop,t)}`},Jd.clone=function(e,t){if(D(e))return D(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new Jd(e)},Jd.equals=function(e,t,n){return e===t||D(e)&&D(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&Hn.equals(e.start,t.start)&&Hn.equals(e.stop,t.stop)&&(e.data===t.data||D(n)&&n(e.data,t.data)))},Jd.equalsEpsilon=function(e,t,n,i){return n=M(n,0),e===t||D(e)&&D(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&Hn.equalsEpsilon(e.start,t.start,n)&&Hn.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||D(i)&&i(e.data,t.data)))},Jd.intersect=function(e,t,n,i){if(L.typeOf.object("left",e),!D(t))return Jd.clone(Jd.EMPTY,n);const o=e.start,r=e.stop,s=t.start,a=t.stop,c=Hn.greaterThanOrEquals(s,o)&&Hn.greaterThanOrEquals(r,s),l=!c&&Hn.lessThanOrEquals(s,o)&&Hn.lessThanOrEquals(o,a);if(!c&&!l)return Jd.clone(Jd.EMPTY,n);const u=e.isStartIncluded,d=e.isStopIncluded,h=t.isStartIncluded,p=t.isStopIncluded,f=Hn.lessThan(r,a);return D(n)||(n=new Jd),n.start=c?s:o,n.isStartIncluded=u&&h||!Hn.equals(s,o)&&(c&&h||l&&u),n.stop=f?r:a,n.isStopIncluded=f?d:d&&p||!Hn.equals(a,r)&&p,n.data=D(i)?i(e.data,t.data):e.data,n},Jd.contains=function(e,t){if(L.typeOf.object("timeInterval",e),L.typeOf.object("julianDate",t),e.isEmpty)return!1;const n=Hn.compare(e.start,t);if(0===n)return e.isStartIncluded;const i=Hn.compare(t,e.stop);return 0===i?e.isStopIncluded:n<0&&i<0},Jd.prototype.clone=function(e){return Jd.clone(this,e)},Jd.prototype.equals=function(e,t){return Jd.equals(this,e,t)},Jd.prototype.equalsEpsilon=function(e,t,n){return Jd.equalsEpsilon(this,e,t,n)},Jd.prototype.toString=function(){return Jd.toIso8601(this)},Jd.EMPTY=Object.freeze(new Jd({start:new Hn,stop:new Hn,isStartIncluded:!1,isStopIncluded:!1}));const th=Object.freeze(Hn.fromIso8601("0000-01-01T00:00:00Z")),nh=Object.freeze(Hn.fromIso8601("9999-12-31T24:00:00Z")),ih={MINIMUM_VALUE:th,MAXIMUM_VALUE:nh,MAXIMUM_INTERVAL:Object.freeze(new Jd({start:th,stop:nh}))};function oh(e,t,n){e=M(e,0),t=M(t,0),n=M(n,0),this.value=new Float32Array([e,t,n])}function rh(e){e=M(e,!0),this.value=rh.toValue(e)}Object.defineProperties(oh.prototype,{componentDatatype:{get:function(){return Ca.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),oh.fromCartesian3=function(e){return L.defined("offset",e),new oh(e.x,e.y,e.z)},oh.toValue=function(e,t){return L.defined("offset",e),D(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t},Object.defineProperties(rh.prototype,{componentDatatype:{get:function(){return Ca.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}}),rh.toValue=function(e,t){if(!D(e))throw new P("show is required.");return D(t)?(t[0]=e,t):new Uint8Array([e])};const sh={ADD:Me.FUNC_ADD,SUBTRACT:Me.FUNC_SUBTRACT,REVERSE_SUBTRACT:Me.FUNC_REVERSE_SUBTRACT,MIN:Me.MIN,MAX:Me.MAX},ah=Object.freeze(sh),ch={ZERO:Me.ZERO,ONE:Me.ONE,SOURCE_COLOR:Me.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:Me.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:Me.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:Me.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:Me.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:Me.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:Me.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:Me.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:Me.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:Me.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:Me.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:Me.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:Me.SRC_ALPHA_SATURATE},lh=Object.freeze(ch),uh={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:ah.ADD,equationAlpha:ah.ADD,functionSourceRgb:lh.SOURCE_ALPHA,functionSourceAlpha:lh.ONE,functionDestinationRgb:lh.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:lh.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:ah.ADD,equationAlpha:ah.ADD,functionSourceRgb:lh.ONE,functionSourceAlpha:lh.ONE,functionDestinationRgb:lh.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:lh.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:ah.ADD,equationAlpha:ah.ADD,functionSourceRgb:lh.SOURCE_ALPHA,functionSourceAlpha:lh.ONE,functionDestinationRgb:lh.ONE,functionDestinationAlpha:lh.ONE})},dh=Object.freeze(uh),hh={FRONT:Me.FRONT,BACK:Me.BACK,FRONT_AND_BACK:Me.FRONT_AND_BACK},ph=Object.freeze(hh);function fh(e){e=M(e,M.EMPTY_OBJECT),this.material=e.material,this.translucent=M(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=M(e.closed,!1)}Object.defineProperties(fh.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}}}),fh.prototype.getFragmentShaderSource=function(){const e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),D(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},fh.prototype.isTranslucent=function(){return D(this.material)&&this.material.isTranslucent()||!D(this.material)&&this.translucent},fh.prototype.getRenderState=function(){const e=this.isTranslucent(),t=ti(this.renderState,!1);return e?(t.depthMask=!1,t.blending=dh.ALPHA_BLEND):t.depthMask=!0,t},fh.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=dh.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:ph.BACK}),D(n)&&(i=ni(n,i,!0)),i};function mh(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=M(e.minificationFilter,ac.LINEAR),this._magnificationFilter=M(e.magnificationFilter,rc.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,function(e,t){let n;e=M(e,M.EMPTY_OBJECT),t._strict=M(e.strict,!1),t._count=M(e.count,0),t._template=ti(M(e.fabric,M.EMPTY_OBJECT)),t._template.uniforms=ti(M(t._template.uniforms,M.EMPTY_OBJECT)),t._template.materials=ti(M(t._template.materials,M.EMPTY_OBJECT)),t.type=D(t._template.type)?t._template.type:ke(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];const i=mh._materialCache.getMaterial(t.type);if(D(i)){const e=ti(i.fabric,!0);t._template=ni(t._template,e,!0),n=i.translucent}(function(e){const t=e._template,n=t.uniforms,i=t.materials,o=t.components;if(D(o)&&D(t.source))throw new P("fabric: cannot have source and components in the same template.");_h(t,bh,gh,!0),_h(o,vh,gh,!0);const r=[];for(const s in i)i.hasOwnProperty(s)&&r.push(s);_h(n,r,yh,!1)})(t),D(i)||mh._materialCache.addMaterial(t.type,t);(function(e){const t=e._template.components,n=e._template.source;if(D(n))e.shaderSource+=`${n}\n`;else{if(e.shaderSource+="czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n",e.shaderSource+="czm_material material = czm_getDefaultMaterial(materialInput);\n",D(t)){const n=Object.keys(e._template.materials).length>0;for(const i in t)if(t.hasOwnProperty(i))if("diffuse"===i||"emission"===i){const o=n&&Ah(t[i],e)?t[i]:`czm_gammaCorrect(${t[i]})`;e.shaderSource+=`material.${i} = ${o}; \n`}else e.shaderSource+="alpha"===i?`material.alpha = ${t.alpha}; \n`:`material.${i} = ${t[i]};\n`}e.shaderSource+="return material;\n}\n"}})(t),function(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&Eh(e,n)}(t),function(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const o=new mh({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=ni(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);const r="czm_getMaterial",s=`${r}_${e._count++}`;xh(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;if(0===xh(e,i,`${s}(materialInput)`)&&t)throw new P(`strict: shader source does not use material '${i}'.`)}}(t);const o=0===t._translucentFunctions.length||void 0;if(n=M(n,o),n=M(e.translucent,n),D(n))if("function"==typeof n){const e=function(){return n(t)};t._translucentFunctions.push(e)}else t._translucentFunctions.push(n)}(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),D(mh._uniformList[this.type])||(mh._uniformList[this.type]=Object.keys(this._uniforms))}function _h(e,t,n,i){if(D(e))for(const o in e)if(e.hasOwnProperty(o)){const e=-1!==t.indexOf(o);(i&&!e||!i&&e)&&n(o,t)}}function gh(e,t){let n=`fabric: property name '${e}' is not valid. It should be `;for(let i=0;i<t.length;i++){const e=`'${t[i]}'`;n+=i===t.length-1?`or ${e}.`:`${e}, `}throw new P(n)}function yh(e,t){throw new P(`fabric: uniforms and materials cannot share the same property '${e}'`)}mh._uniformList={},mh.fromType=function(e,t){if(!D(mh._materialCache.getMaterial(e)))throw new P(`material with type '${e}' does not exist.`);const n=new mh({fabric:{type:e}});if(D(t))for(const i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n},mh.prototype.isTranslucent=function(){if(D(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){const n=t[i];if(e="function"==typeof n?e&&n():e&&n,!e)break}return e},mh.prototype.update=function(e){let t,n;this._defaultTexture=e.defaultTexture;const i=this._loadedImages;let o=i.length;for(t=0;t<o;++t){const o=i[t];n=o.id;let r,s=o.image;Array.isArray(s)&&(r=s.slice(1,s.length).map((function(e){return e.bufferView})),s=s[0]);const a=new uc({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let c;c=D(s.internalFormat)?new Sc({context:e,pixelFormat:s.internalFormat,width:s.width,height:s.height,source:{arrayBufferView:s.bufferView,mipLevels:r},sampler:a}):new Sc({context:e,source:s,sampler:a});const l=this._textures[n];D(l)&&l!==this._defaultTexture&&l.destroy(),this._textures[n]=c;const u=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(u)){const e=this.uniforms[u];e.x=c._width,e.y=c._height}}i.length=0;const r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){const i=r[t];n=i.id;const o=i.images,s=new dc({context:e,source:{positiveX:o[0],negativeX:o[1],positiveY:o[2],negativeY:o[3],positiveZ:o[4],negativeZ:o[5]},sampler:new uc({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=s}r.length=0;const s=this._updateFunctions;for(o=s.length,t=0;t<o;++t)s[t](this,e);const a=this.materials;for(const c in a)a.hasOwnProperty(c)&&a[c].update(e)},mh.prototype.isDestroyed=function(){return!1},mh.prototype.destroy=function(){const e=this._textures;for(const n in e)if(e.hasOwnProperty(n)){const t=e[n];t!==this._defaultTexture&&t.destroy()}const t=this.materials;for(const n in t)t.hasOwnProperty(n)&&t[n].destroy();return He(this)};const bh=["type","materials","uniforms","components","source"],vh=["diffuse","specular","shininess","normal","emission","alpha"];function Ah(e,t){const n=t._template.materials;for(const i in n)if(n.hasOwnProperty(i)&&e.indexOf(i)>-1)return!0;return!1}const Th={mat2:Ms,mat3:re,mat4:ve},wh=/\.ktx2$/i;function Eh(e,t){const n=e._strict,i=e._template.uniforms,o=i[t],r=function(e){let t=e.type;if(!D(t)){const n=typeof e;if("number"===n)t="float";else if("boolean"===n)t="bool";else if("string"===n||e instanceof Bi||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===mh.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"===n)if(Array.isArray(e))4!==e.length&&9!==e.length&&16!==e.length||(t=`mat${Math.sqrt(e.length)}`);else{let n=0;for(const t in e)e.hasOwnProperty(t)&&(n+=1);n>=2&&n<=4?t=`vec${n}`:6===n&&(t="samplerCube")}}return t}(o);if(!D(r))throw new P(`fabric: uniform '${t}' has invalid type.`);let s;if("channels"===r){if(s=xh(e,t,o,!1),0===s&&n)throw new P(`strict: shader source does not use channels '${t}'.`)}else{if("sampler2D"===r){const n=`${t}Dimensions`;(function(e,t,n){return xh(e,t,t,n)})(e,n)>0&&(i[n]={type:"ivec3",x:1,y:1},Eh(e,n))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){const n=`uniform ${r} ${t};`;e.shaderSource=n+e.shaderSource}const a=`${t}_${e._count++}`;if(s=xh(e,t,a),1===s&&n)throw new P(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,"sampler2D"===r)e._uniforms[a]=function(){return e._textures[t]},e._updateFunctions.push(function(e){let t;return function(n,i){const o=n.uniforms,r=o[e],s=t!==r,a=!D(r)||r===mh.DefaultImageId;t=r;let c,l,u=n._textures[e];if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&D(u)&&(u!==i.defaultTexture&&u.destroy(),u=void 0),!D(u)||u===i.defaultTexture){const t=new uc({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});return u=new Sc({context:i,source:r,sampler:t}),void(n._textures[e]=u)}u.copyFrom({source:r})}else D(u)||(n._textures[e]=i.defaultTexture);return}if(r instanceof Sc&&r!==u){n._texturePaths[e]=void 0;const t=n._textures[e];return D(t)&&t!==n._defaultTexture&&t.destroy(),n._textures[e]=r,c=`${e}Dimensions`,void(o.hasOwnProperty(c)&&(l=o[c],l.x=r._width,l.y=r._height))}if(s&&D(u)&&a&&(u!==n._defaultTexture&&u.destroy(),u=void 0),D(u)||(n._texturePaths[e]=void 0,u=n._textures[e]=n._defaultTexture,c=`${e}Dimensions`,o.hasOwnProperty(c)&&(l=o[c],l.x=u._width,l.y=u._height)),a)return;const d=r instanceof Bi;if(!D(n._texturePaths[e])||d&&r.url!==n._texturePaths[e].url||!d&&r!==n._texturePaths[e]){if("string"==typeof r||d){const t=d?r:Bi.createIfNeeded(r);let i;i=wh.test(t.url)?ec(t.url):t.fetchImage(),Promise.resolve(i).then((function(t){n._loadedImages.push({id:e,image:t})})).catch((function(){D(u)&&u!==n._defaultTexture&&u.destroy(),n._textures[e]=n._defaultTexture}))}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:r});n._texturePaths[e]=r}}}(t));else if("samplerCube"===r)e._uniforms[a]=function(){return e._textures[t]},e._updateFunctions.push(function(e){return function(t,n){const i=t.uniforms[e];if(i instanceof dc){const n=t._textures[e];return n!==t._defaultTexture&&n.destroy(),t._texturePaths[e]=void 0,void(t._textures[e]=i)}if(D(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===mh.DefaultCubeMapId)return;const o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){const n=[Bi.createIfNeeded(i.positiveX).fetchImage(),Bi.createIfNeeded(i.negativeX).fetchImage(),Bi.createIfNeeded(i.positiveY).fetchImage(),Bi.createIfNeeded(i.negativeY).fetchImage(),Bi.createIfNeeded(i.positiveZ).fetchImage(),Bi.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(n).then((function(n){t._loadedCubeMaps.push({id:e,images:n})})),t._texturePaths[e]=o}}}(t));else if(-1!==r.indexOf("mat")){const n=new Th[r];e._uniforms[a]=function(){return Th[r].fromColumnMajorArray(e.uniforms[t],n)}}else e._uniforms[a]=function(){return e.uniforms[t]}}}function xh(e,t,n,i){i=M(i,!0);let o=0;const r=new RegExp(`([\\w${i?".":""}])?`+t+"([\\w])?","g");return e.shaderSource=e.shaderSource.replace(r,(function(e,t,i){return t||i?e:(o+=1,n)})),o}function Sh(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.translucent,!0),n=M(e.closed,!1),i=M(e.materialSupport,Sh.MaterialSupport.TEXTURED);this.material=D(e.material)?e.material:mh.fromType(mh.ColorType),this.translucent=t,this._vertexShaderSource=M(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=M(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=fh.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=M(e.flat,!1),this._faceForward=M(e.faceForward,!n)}mh._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},mh.DefaultImageId="czm_defaultImage",mh.DefaultCubeMapId="czm_defaultCubeMap",mh.ColorType="Color",mh._materialCache.addMaterial(mh.ColorType,{fabric:{type:mh.ColorType,uniforms:{color:new Ot(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),mh.ImageType="Image",mh._materialCache.addMaterial(mh.ImageType,{fabric:{type:mh.ImageType,uniforms:{image:mh.DefaultImageId,repeat:new kt(1,1),color:new Ot(1,1,1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),mh.DiffuseMapType="DiffuseMap",mh._materialCache.addMaterial(mh.DiffuseMapType,{fabric:{type:mh.DiffuseMapType,uniforms:{image:mh.DefaultImageId,channels:"rgb",repeat:new kt(1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),mh.AlphaMapType="AlphaMap",mh._materialCache.addMaterial(mh.AlphaMapType,{fabric:{type:mh.AlphaMapType,uniforms:{image:mh.DefaultImageId,channel:"a",repeat:new kt(1,1)},components:{alpha:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),mh.SpecularMapType="SpecularMap",mh._materialCache.addMaterial(mh.SpecularMapType,{fabric:{type:mh.SpecularMapType,uniforms:{image:mh.DefaultImageId,channel:"r",repeat:new kt(1,1)},components:{specular:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),mh.EmissionMapType="EmissionMap",mh._materialCache.addMaterial(mh.EmissionMapType,{fabric:{type:mh.EmissionMapType,uniforms:{image:mh.DefaultImageId,channels:"rgb",repeat:new kt(1,1)},components:{emission:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),mh.BumpMapType="BumpMap",mh._materialCache.addMaterial(mh.BumpMapType,{fabric:{type:mh.BumpMapType,uniforms:{image:mh.DefaultImageId,channel:"r",strength:.8,repeat:new kt(1,1)},source:"uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n vec2 centerPixel = fract(repeat * st);\n float centerBump = texture(image, centerPixel).channel;\n\n float imageWidth = float(imageDimensions.x);\n vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\n float rightBump = texture(image, rightPixel).channel;\n\n float imageHeight = float(imageDimensions.y);\n vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\n float topBump = texture(image, leftPixel).channel;\n\n vec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\n vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\n\n material.normal = normalEC;\n material.diffuse = vec3(0.01);\n\n return material;\n}\n"},translucent:!1}),mh.NormalMapType="NormalMap",mh._materialCache.addMaterial(mh.NormalMapType,{fabric:{type:mh.NormalMapType,uniforms:{image:mh.DefaultImageId,channels:"rgb",strength:.8,repeat:new kt(1,1)},source:"uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n \n vec4 textureValue = texture(image, fract(repeat * materialInput.st));\n vec3 normalTangentSpace = textureValue.channels;\n normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\n normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\n normalTangentSpace = normalize(normalTangentSpace);\n vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\n \n material.normal = normalEC;\n \n return material;\n}\n"},translucent:!1}),mh.GridType="Grid",mh._materialCache.addMaterial(mh.GridType,{fabric:{type:mh.GridType,uniforms:{color:new Ot(0,1,0,1),cellAlpha:.1,lineCount:new kt(8,8),lineThickness:new kt(1,1),lineOffset:new kt(0,0)},source:'uniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n float scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\n scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\n float scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\n scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\n\n float value;\n\n // Fuzz Factor - Controls blurriness of lines\n#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n const float fuzz = 1.2;\n vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\n\n // From "3D Engine Design for Virtual Globes" by Cozzi and Ring, Listing 4.13.\n vec2 dx = abs(dFdx(st));\n vec2 dy = abs(dFdy(st));\n vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\n value = min(\n smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\n smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\n // If no derivatives available (IE 10?), revert to view-dependent fuzz\n const float fuzz = 0.05;\n\n vec2 range = 0.5 - (lineThickness * 0.05);\n value = min(\n 1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n 1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\n\n // Edges taken from RimLightingMaterial.glsl\n // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\n float sRim = smoothstep(0.8, 1.0, dRim);\n value *= (1.0 - sRim);\n\n vec4 halfColor;\n halfColor.rgb = color.rgb * 0.5;\n halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\n halfColor = czm_gammaCorrect(halfColor);\n material.diffuse = halfColor.rgb;\n material.emission = halfColor.rgb;\n material.alpha = halfColor.a;\n\n return material;\n}\n'},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),mh.StripeType="Stripe",mh._materialCache.addMaterial(mh.StripeType,{fabric:{type:mh.StripeType,uniforms:{horizontal:!0,evenColor:new Ot(1,1,1,.5),oddColor:new Ot(0,0,1,.5),offset:0,repeat:5},source:"uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // Based on the Stripes Fragment Shader in the Orange Book (11.1.2)\n float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\n float value = fract((coord - offset) * (repeat * 0.5));\n float dist = min(value, min(abs(value - 0.5), 1.0 - value));\n\n vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\n vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\n color = czm_gammaCorrect(color);\n\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}}),mh.CheckerboardType="Checkerboard",mh._materialCache.addMaterial(mh.CheckerboardType,{fabric:{type:mh.CheckerboardType,uniforms:{lightColor:new Ot(1,1,1,.5),darkColor:new Ot(0,0,0,.5),repeat:new kt(5,5)},source:"uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights\n float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0); // 0.0 or 1.0\n\n // Find the distance from the closest separator (region between two colors)\n float scaledWidth = fract(repeat.s * st.s);\n scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\n float scaledHeight = fract(repeat.t * st.t);\n scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\n float value = min(scaledWidth, scaledHeight);\n\n vec4 currentColor = mix(lightColor, darkColor, b);\n vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\n\n color = czm_gammaCorrect(color);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),mh.DotType="Dot",mh._materialCache.addMaterial(mh.DotType,{fabric:{type:mh.DotType,uniforms:{lightColor:new Ot(1,1,0,.75),darkColor:new Ot(0,1,1,.75),repeat:new kt(5,5)},source:"uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights\n float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5)); // 0.0 or 1.0\n\n vec4 color = mix(lightColor, darkColor, b);\n color = czm_gammaCorrect(color);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),mh.WaterType="Water",mh._materialCache.addMaterial(mh.WaterType,{fabric:{type:mh.WaterType,uniforms:{baseWaterColor:new Ot(.2,.3,.6,1),blendColor:new Ot(0,1,.699,1),specularMap:mh.DefaultImageId,normalMap:mh.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:"// Thanks for the contribution Jonas\n// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\nuniform 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;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n float time = czm_frameNumber * animationSpeed;\n\n // fade is a function of the distance from the fragment and the frequency of the waves\n float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\n\n float specularMapValue = texture(specularMap, materialInput.st).r;\n\n // note: not using directional motion at this time, just set the angle to 0.0;\n vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\n vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\n\n // fade out the normal perturbation as we move further from the water surface\n normalTangentSpace.xy /= fade;\n\n // attempt to fade out the normal perturbation as we approach non water areas (low specular map value)\n normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\n\n normalTangentSpace = normalize(normalTangentSpace);\n\n // get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane\n float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\n\n // fade out water effect as specular map value decreases\n material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;\n\n // base color is a blend of the water and non-water color based on the value from the specular map\n // may need a uniform blend factor to better control this\n material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\n\n // diffuse highlights are based on how perturbed the normal is\n material.diffuse += (0.1 * tsPerturbationRatio);\n\n material.diffuse = material.diffuse;\n\n material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\n\n material.specular = specularIntensity;\n material.shininess = 10.0;\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}}),mh.RimLightingType="RimLighting",mh._materialCache.addMaterial(mh.RimLightingType,{fabric:{type:mh.RimLightingType,uniforms:{color:new Ot(1,0,0,.7),rimColor:new Ot(1,1,1,.4),width:.3},source:"uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\n float s = smoothstep(1.0 - width, 1.0, d);\n\n vec4 outColor = czm_gammaCorrect(color);\n vec4 outRimColor = czm_gammaCorrect(rimColor);\n\n material.diffuse = outColor.rgb;\n material.emission = outRimColor.rgb * s;\n material.alpha = mix(outColor.a, outRimColor.a, s);\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}}),mh.FadeType="Fade",mh._materialCache.addMaterial(mh.FadeType,{fabric:{type:mh.FadeType,uniforms:{fadeInColor:new Ot(1,0,0,1),fadeOutColor:new Ot(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new kt(.5,.5)},source:"uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\n\nfloat getTime(float t, float coord)\n{\n float scalar = 1.0 / maximumDistance;\n float q = distance(t, coord) * scalar;\n if (repeat)\n {\n float r = distance(t, coord + 1.0) * scalar;\n float s = distance(t, coord - 1.0) * scalar;\n q = min(min(r, s), q);\n }\n return clamp(q, 0.0, 1.0);\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n float s = getTime(time.x, st.s) * fadeDirection.s;\n float t = getTime(time.y, st.t) * fadeDirection.t;\n\n float u = length(vec2(s, t));\n vec4 color = mix(fadeInColor, fadeOutColor, u);\n\n color = czm_gammaCorrect(color);\n material.emission = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}}),mh.PolylineArrowType="PolylineArrow",mh._materialCache.addMaterial(mh.PolylineArrowType,{fabric:{type:mh.PolylineArrowType,uniforms:{color:new Ot(1,1,1,1)},source:"uniform vec4 color;\n\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\n float slope = (p0.y - p1.y) / (p0.x - p1.x);\n return slope * (x - p0.x) + p0.y;\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\n // If no derivatives available (IE 10?), 2.5% of the line will be the arrow head\n float base = 0.975;\n#endif\n\n vec2 center = vec2(1.0, 0.5);\n float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\n float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\n\n float halfWidth = 0.15;\n float s = step(0.5 - halfWidth, st.t);\n s *= 1.0 - step(0.5 + halfWidth, st.t);\n s *= 1.0 - step(base, st.s);\n\n float t = step(base, materialInput.st.s);\n t *= 1.0 - step(ptOnUpperLine, st.t);\n t *= step(ptOnLowerLine, st.t);\n\n // Find the distance from the closest separator (region between two colors)\n float dist;\n if (st.s < base)\n {\n float d1 = abs(st.t - (0.5 - halfWidth));\n float d2 = abs(st.t - (0.5 + halfWidth));\n dist = min(d1, d2);\n }\n else\n {\n float d1 = czm_infinity;\n if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n {\n d1 = abs(st.s - base);\n }\n float d2 = abs(st.t - ptOnUpperLine);\n float d3 = abs(st.t - ptOnLowerLine);\n dist = min(min(d1, d2), d3);\n }\n\n vec4 outsideColor = vec4(0.0);\n vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\n vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\n\n outColor = czm_gammaCorrect(outColor);\n material.diffuse = outColor.rgb;\n material.alpha = outColor.a;\n return material;\n}\n"},translucent:!0}),mh.PolylineDashType="PolylineDash",mh._materialCache.addMaterial(mh.PolylineDashType,{fabric:{type:mh.PolylineDashType,uniforms:{color:new Ot(1,0,1,1),gapColor:new Ot(0,0,0,0),dashLength:16,dashPattern:255},source:"uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nin float v_polylineAngle;\n\nconst float maskLength = 16.0;\n\nmat2 rotate(float rad) {\n float c = cos(rad);\n float s = sin(rad);\n return mat2(\n c, s,\n -s, c\n );\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\n\n // Get the relative position within the dash from 0 to 1\n float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\n // Figure out the mask index.\n float maskIndex = floor(dashPosition * maskLength);\n // Test the bit mask.\n float maskTest = floor(dashPattern / pow(2.0, maskIndex));\n vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\n if (fragColor.a < 0.005) { // matches 0/255 and 1/255\n discard;\n }\n\n fragColor = czm_gammaCorrect(fragColor);\n material.emission = fragColor.rgb;\n material.alpha = fragColor.a;\n return material;\n}\n"},translucent:!0}),mh.PolylineGlowType="PolylineGlow",mh._materialCache.addMaterial(mh.PolylineGlowType,{fabric:{type:mh.PolylineGlowType,uniforms:{color:new Ot(0,.5,1,1),glowPower:.25,taperPower:1},source:"uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\n\n if (taperPower <= 0.99999) {\n glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n }\n\n vec4 fragColor;\n fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\n fragColor.a = clamp(0.0, 1.0, glow) * color.a;\n fragColor = czm_gammaCorrect(fragColor);\n\n material.emission = fragColor.rgb;\n material.alpha = fragColor.a;\n\n return material;\n}\n"},translucent:!0}),mh.PolylineOutlineType="PolylineOutline",mh._materialCache.addMaterial(mh.PolylineOutlineType,{fabric:{type:mh.PolylineOutlineType,uniforms:{color:new Ot(1,1,1,1),outlineColor:new Ot(1,0,0,1),outlineWidth:1},source:"uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\n\nin float v_width;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\n float b = step(0.5 - halfInteriorWidth, st.t);\n b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\n\n // Find the distance from the closest separator (region between two colors)\n float d1 = abs(st.t - (0.5 - halfInteriorWidth));\n float d2 = abs(st.t - (0.5 + halfInteriorWidth));\n float dist = min(d1, d2);\n\n vec4 currentColor = mix(outlineColor, color, b);\n vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\n outColor = czm_gammaCorrect(outColor);\n\n material.diffuse = outColor.rgb;\n material.alpha = outColor.a;\n\n return material;\n}\n"},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),mh.ElevationContourType="ElevationContour",mh._materialCache.addMaterial(mh.ElevationContourType,{fabric:{type:mh.ElevationContourType,uniforms:{spacing:100,color:new Ot(1,0,0,1),width:1},source:"uniform vec4 color;\nuniform float spacing;\nuniform float width;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n float distanceToContour = mod(materialInput.height, spacing);\n\n#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n float dxc = abs(dFdx(materialInput.height));\n float dyc = abs(dFdy(materialInput.height));\n float dF = max(dxc, dyc) * czm_pixelRatio * width;\n float alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\n // If no derivatives available (IE 10?), use pixel ratio\n float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\n\n vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\n material.diffuse = outColor.rgb;\n material.alpha = outColor.a;\n\n return material;\n}\n"},translucent:!1}),mh.ElevationRampType="ElevationRamp",mh._materialCache.addMaterial(mh.ElevationRampType,{fabric:{type:mh.ElevationRampType,uniforms:{image:mh.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:"uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\n vec4 rampColor = texture(image, vec2(scaledHeight, 0.5));\n rampColor = czm_gammaCorrect(rampColor);\n material.diffuse = rampColor.rgb;\n material.alpha = rampColor.a;\n return material;\n}\n"},translucent:!1}),mh.SlopeRampMaterialType="SlopeRamp",mh._materialCache.addMaterial(mh.SlopeRampMaterialType,{fabric:{type:mh.SlopeRampMaterialType,uniforms:{image:mh.DefaultImageId},source:"uniform sampler2D image;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec4 rampColor = texture(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\n rampColor = czm_gammaCorrect(rampColor);\n material.diffuse = rampColor.rgb;\n material.alpha = rampColor.a;\n return material;\n}\n"},translucent:!1}),mh.AspectRampMaterialType="AspectRamp",mh._materialCache.addMaterial(mh.AspectRampMaterialType,{fabric:{type:mh.AspectRampMaterialType,uniforms:{image:mh.DefaultImageId},source:"uniform sampler2D image;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec4 rampColor = texture(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\n rampColor = czm_gammaCorrect(rampColor);\n material.diffuse = rampColor.rgb;\n material.alpha = rampColor.a;\n return material;\n}\n"},translucent:!1}),mh.ElevationBandType="ElevationBand",mh._materialCache.addMaterial(mh.ElevationBandType,{fabric:{type:mh.ElevationBandType,uniforms:{heights:mh.DefaultImageId,colors:mh.DefaultImageId},source:"uniform sampler2D heights;\nuniform sampler2D colors;\n\n// This material expects heights to be sorted from lowest to highest.\n\nfloat getHeight(int idx, float invTexSize)\n{\n vec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);\n#ifdef OES_texture_float\n return texture(heights, uv).x;\n#else\n return czm_unpackFloat(texture(heights, uv));\n#endif\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n float height = materialInput.height;\n float invTexSize = 1.0 / float(heightsDimensions.x);\n\n float minHeight = getHeight(0, invTexSize);\n float maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);\n\n // early-out when outside the height range\n if (height < minHeight || height > maxHeight) {\n material.diffuse = vec3(0.0);\n material.alpha = 0.0;\n return material;\n }\n\n // Binary search to find heights above and below.\n int idxBelow = 0;\n int idxAbove = heightsDimensions.x;\n float heightBelow = minHeight;\n float heightAbove = maxHeight;\n\n // while loop not allowed, so use for loop with max iterations.\n // maxIterations of 16 supports a texture size up to 65536 (2^16).\n const int maxIterations = 16;\n for (int i = 0; i < maxIterations; i++) {\n if (idxBelow >= idxAbove - 1) {\n break;\n }\n\n int idxMid = (idxBelow + idxAbove) / 2;\n float heightTex = getHeight(idxMid, invTexSize);\n\n if (height > heightTex) {\n idxBelow = idxMid;\n heightBelow = heightTex;\n } else {\n idxAbove = idxMid;\n heightAbove = heightTex;\n }\n }\n\n float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);\n vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);\n vec4 color = texture(colors, colorUv);\n\n // undo preumultiplied alpha\n if (color.a > 0.0) \n {\n color.rgb /= color.a;\n }\n \n color.rgb = czm_gammaCorrect(color.rgb);\n\n material.diffuse = color.rgb;\n material.alpha = color.a;\n return material;\n}\n"},translucent:!0}),Object.defineProperties(Sh.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}}}),Sh.prototype.getFragmentShaderSource=fh.prototype.getFragmentShaderSource,Sh.prototype.isTranslucent=fh.prototype.isTranslucent,Sh.prototype.getRenderState=fh.prototype.getRenderState,Sh.MaterialSupport={BASIC:Object.freeze({vertexFormat:Bd.POSITION_AND_NORMAL,vertexShaderSource:"in vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 normal;\nin float batchId;\n\nout vec3 v_positionEC;\nout vec3 v_normalEC;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",fragmentShaderSource:"in vec3 v_positionEC;\nin vec3 v_normalEC;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n"}),TEXTURED:Object.freeze({vertexFormat:Bd.POSITION_NORMAL_AND_ST,vertexShaderSource:"in vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 normal;\nin vec2 st;\nin float batchId;\n\nout vec3 v_positionEC;\nout vec3 v_normalEC;\nout vec2 v_st;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n v_st = st;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",fragmentShaderSource:"in vec3 v_positionEC;\nin vec3 v_normalEC;\nin vec2 v_st;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n materialInput.st = v_st;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n"}),ALL:Object.freeze({vertexFormat:Bd.ALL,vertexShaderSource:"in vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 normal;\nin vec3 tangent;\nin vec3 bitangent;\nin vec2 st;\nin float batchId;\n\nout vec3 v_positionEC;\nout vec3 v_normalEC;\nout vec3 v_tangentEC;\nout vec3 v_bitangentEC;\nout vec2 v_st;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n v_tangentEC = czm_normal * tangent; // tangent in eye coordinates\n v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates\n v_st = st;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",fragmentShaderSource:"in vec3 v_positionEC;\nin vec3 v_normalEC;\nin vec3 v_tangentEC;\nin vec3 v_bitangentEC;\nin vec2 v_st;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = tangentToEyeMatrix;\n materialInput.positionToEyeEC = positionToEyeEC;\n materialInput.st = v_st;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n"})};const Ch="in vec4 v_color;\n\nvoid main()\n{\n out_FragColor = czm_gammaCorrect(v_color);\n}\n";function Ih(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.translucent,!0),n=M(e.closed,!1),i=M(e.flat,!1),o=i?"in vec3 position3DHigh;\nin vec3 position3DLow;\nin vec4 color;\nin float batchId;\n\nout vec4 v_color;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_color = color;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n":"in vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 normal;\nin vec4 color;\nin float batchId;\n\nout vec3 v_positionEC;\nout vec3 v_normalEC;\nout vec4 v_color;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n v_color = color;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",r=i?Ch:"in vec3 v_positionEC;\nin vec3 v_normalEC;\nin vec4 v_color;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n vec4 color = czm_gammaCorrect(v_color);\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n}\n",s=i?Ih.FLAT_VERTEX_FORMAT:Ih.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=M(e.vertexShaderSource,o),this._fragmentShaderSource=M(e.fragmentShaderSource,r),this._renderState=fh.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=M(e.faceForward,!n)}function Oh(e){this._definitionChanged=new gi,this._color=void 0,this._colorSubscription=void 0,this.color=e}function Dh(e){e=M(e,M.EMPTY_OBJECT),this._ellipsoid=M(e.ellipsoid,on.WGS84),this._rectangle=M(e.rectangle,Ir.MAX_VALUE),this._projection=new fn(this._ellipsoid),this._numberOfLevelZeroTilesX=M(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=M(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(Ih.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}}}),Ih.VERTEX_FORMAT=Bd.POSITION_AND_NORMAL,Ih.FLAT_VERTEX_FORMAT=Bd.POSITION_ONLY,Ih.prototype.getFragmentShaderSource=fh.prototype.getFragmentShaderSource,Ih.prototype.isTranslucent=fh.prototype.isTranslucent,Ih.prototype.getRenderState=fh.prototype.getRenderState,Object.defineProperties(Oh.prototype,{isConstant:{get:function(){return Ou.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:gu("color")}),Oh.prototype.getType=function(e){return"Color"},Oh.prototype.getValue=function(e,t){return D(t)||(t={}),t.color=Ou.getValueOrClonedDefault(this._color,e,Ot.WHITE,t.color),t},Oh.prototype.equals=function(e){return this===e||e instanceof Oh&&Ou.equals(this._color,e._color)},Object.defineProperties(Dh.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),Dh.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},Dh.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},Dh.prototype.rectangleToNativeRectangle=function(e,t){L.defined("rectangle",e);const n=V.toDegrees(e.west),i=V.toDegrees(e.south),o=V.toDegrees(e.east),r=V.toDegrees(e.north);return D(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new Ir(n,i,o,r)},Dh.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.tileXYToRectangle(e,t,n,i);return o.west=V.toDegrees(o.west),o.south=V.toDegrees(o.south),o.east=V.toDegrees(o.east),o.north=V.toDegrees(o.north),o},Dh.prototype.tileXYToRectangle=function(e,t,n,i){const o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,c=e*a+o.west,l=(e+1)*a+o.west,u=o.height/s,d=o.north-t*u,h=o.north-(t+1)*u;return D(i)||(i=new Ir(c,h,l,d)),i.west=c,i.south=h,i.east=l,i.north=d,i},Dh.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!Ir.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=i.width/o,a=i.height/r;let c=e.longitude;i.east<i.west&&(c+=V.TWO_PI);let l=(c-i.west)/s|0;l>=o&&(l=o-1);let u=(i.north-e.latitude)/a|0;return u>=r&&(u=r-1),D(n)?(n.x=l,n.y=u,n):new kt(l,u)};const Ph=new H,Nh=new H,Rh=new Qt,Lh=new H,Mh=new H,Fh=new $u,Bh=new Dh,zh=[new Qt,new Qt,new Qt,new Qt],Uh=new kt,kh={};function Vh(e){Qt.fromRadians(e.east,e.north,0,zh[0]),Qt.fromRadians(e.west,e.north,0,zh[1]),Qt.fromRadians(e.east,e.south,0,zh[2]),Qt.fromRadians(e.west,e.south,0,zh[3]);let t=0,n=0,i=0,o=0;const r=kh._terrainHeightsMaxLevel;let s;for(s=0;s<=r;++s){let e=!1;for(let t=0;t<4;++t){const n=zh[t];if(Bh.positionToTileXY(n,s,Uh),0===t)i=Uh.x,o=Uh.y;else if(i!==Uh.x||o!==Uh.y){e=!0;break}}if(e)break;t=i,n=o}if(0!==s)return{x:t,y:n,level:s>r?r:s-1}}kh.initialize=function(){let e=kh._initPromise;return D(e)||(e=Bi.fetchJson(lo("Assets/approximateTerrainHeights.json")).then((function(e){kh._terrainHeights=e})),kh._initPromise=e),e},kh.getMinimumMaximumHeights=function(e,t){if(L.defined("rectangle",e),!D(kh._terrainHeights))throw new P("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=M(t,on.WGS84);const n=Vh(e);let i=kh._defaultMinTerrainHeight,o=kh._defaultMaxTerrainHeight;if(D(n)){const r=`${n.level}-${n.x}-${n.y}`,s=kh._terrainHeights[r];D(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(Ir.northeast(e,Rh),Ph),t.cartographicToCartesian(Ir.southwest(e,Rh),Nh),H.midpoint(Nh,Ph,Lh);const a=t.scaleToGeodeticSurface(Lh,Mh);if(D(a)){const e=H.distance(Lh,a);i=Math.min(i,-e)}else i=kh._defaultMinTerrainHeight}return i=Math.max(kh._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}},kh.getBoundingSphere=function(e,t){if(L.defined("rectangle",e),!D(kh._terrainHeights))throw new P("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=M(t,on.WGS84);const n=Vh(e);let i=kh._defaultMaxTerrainHeight;if(D(n)){const e=`${n.level}-${n.x}-${n.y}`,t=kh._terrainHeights[e];D(t)&&(i=t[1])}const o=$u.fromRectangle3D(e,t,0);return $u.fromRectangle3D(e,t,i,Fh),$u.union(o,Fh,o)},kh._terrainHeightsMaxLevel=6,kh._defaultMaxTerrainHeight=9e3,kh._defaultMinTerrainHeight=-1e5,kh._terrainHeights=void 0,kh._initPromise=void 0,Object.defineProperties(kh,{initialized:{get:function(){return D(kh._terrainHeights)}}});const Hh=kh;function Gh(e,t,n){this.minimum=H.clone(M(e,H.ZERO)),this.maximum=H.clone(M(t,H.ZERO)),n=D(n)?H.clone(n):H.midpoint(this.minimum,this.maximum,new H),this.center=n}Gh.fromCorners=function(e,t,n){return L.defined("minimum",e),L.defined("maximum",t),D(n)||(n=new Gh),n.minimum=H.clone(e,n.minimum),n.maximum=H.clone(t,n.maximum),n.center=H.midpoint(e,t,n.center),n},Gh.fromPoints=function(e,t){if(D(t)||(t=new Gh),!D(e)||0===e.length)return t.minimum=H.clone(H.ZERO,t.minimum),t.maximum=H.clone(H.ZERO,t.maximum),t.center=H.clone(H.ZERO,t.center),t;let n=e[0].x,i=e[0].y,o=e[0].z,r=e[0].x,s=e[0].y,a=e[0].z;const c=e.length;for(let d=1;d<c;d++){const t=e[d],c=t.x,l=t.y,u=t.z;n=Math.min(c,n),r=Math.max(c,r),i=Math.min(l,i),s=Math.max(l,s),o=Math.min(u,o),a=Math.max(u,a)}const l=t.minimum;l.x=n,l.y=i,l.z=o;const u=t.maximum;return u.x=r,u.y=s,u.z=a,t.center=H.midpoint(l,u,t.center),t},Gh.clone=function(e,t){if(D(e))return D(t)?(t.minimum=H.clone(e.minimum,t.minimum),t.maximum=H.clone(e.maximum,t.maximum),t.center=H.clone(e.center,t.center),t):new Gh(e.minimum,e.maximum,e.center)},Gh.equals=function(e,t){return e===t||D(e)&&D(t)&&H.equals(e.center,t.center)&&H.equals(e.minimum,t.minimum)&&H.equals(e.maximum,t.maximum)};let jh=new H;Gh.intersectPlane=function(e,t){L.defined("box",e),L.defined("plane",t),jh=H.subtract(e.maximum,e.minimum,jh);const n=H.multiplyByScalar(jh,.5,jh),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=H.dot(e.center,i)+t.distance;return r-o>0?mn.INSIDE:r+o<0?mn.OUTSIDE:mn.INTERSECTING},Gh.prototype.clone=function(e){return Gh.clone(this,e)},Gh.prototype.intersectPlane=function(e){return Gh.intersectPlane(this,e)},Gh.prototype.equals=function(e){return Gh.equals(this,e)};const Wh={};function qh(e,t,n){const i=e+t;return V.sign(e)!==V.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}Wh.computeDiscriminant=function(e,t,n){if("number"!=typeof e)throw new P("a is a required number.");if("number"!=typeof t)throw new P("b is a required number.");if("number"!=typeof n)throw new P("c is a required number.");return t*t-4*e*n},Wh.computeRealRoots=function(e,t,n){if("number"!=typeof e)throw new P("a is a required number.");if("number"!=typeof t)throw new P("b is a required number.");if("number"!=typeof n)throw new P("c is a required number.");let i;if(0===e)return 0===t?[]:[-n/t];if(0===t){if(0===n)return[0,0];const t=Math.abs(n),o=Math.abs(e);if(t<o&&t/o<V.EPSILON14)return[0,0];if(t>o&&o/t<V.EPSILON14)return[];if(i=-n/e,i<0)return[];const r=Math.sqrt(i);return[-r,r]}if(0===n)return i=-t/e,i<0?[i,0]:[0,i];const o=qh(t*t,-(4*e*n),V.EPSILON14);if(o<0)return[];const r=-.5*qh(t,V.sign(t)*Math.sqrt(o),V.EPSILON14);return t>0?[r/e,n/r]:[n/r,r/e]};const Yh=Wh,Xh={};function Qh(e,t,n,i){const o=e,r=t/3,s=n/3,a=i,c=o*s,l=r*a,u=r*r,d=s*s,h=o*s-u,p=o*a-r*s,f=r*a-d,m=4*h*f-p*p;let _,g;if(m<0){let e,t,n;u*l>=c*d?(e=o,t=h,n=-2*r*h+o*p):(e=a,t=f,n=-a*p+2*s*f);const i=-(n<0?-1:1)*Math.abs(e)*Math.sqrt(-m);g=-n+i;const y=g/2,b=y<0?-Math.pow(-y,1/3):Math.pow(y,1/3),v=g===i?-b:-t/b;return _=t<=0?b+v:-n/(b*b+v*v+t),u*l>=c*d?[(_-r)/o]:[-a/(_+s)]}const y=h,b=-2*r*h+o*p,v=f,A=-a*p+2*s*f,T=Math.sqrt(m),w=Math.sqrt(3)/2;let E=Math.abs(Math.atan2(o*T,-b)/3);_=2*Math.sqrt(-y);let x=Math.cos(E);g=_*x;let S=_*(-x/2-w*Math.sin(E));const C=g+S>2*r?g-r:S-r,I=o,O=C/I;E=Math.abs(Math.atan2(a*T,-A)/3),_=2*Math.sqrt(-v),x=Math.cos(E),g=_*x,S=_*(-x/2-w*Math.sin(E));const D=-a,P=g+S<2*s?g+s:S+s,N=D/P,R=-C*P-I*D,L=(s*R-r*(C*D))/(-r*R+s*(I*P));return O<=L?O<=N?L<=N?[O,L,N]:[O,N,L]:[N,O,L]:O<=N?[L,O,N]:L<=N?[L,N,O]:[N,L,O]}Xh.computeDiscriminant=function(e,t,n,i){if("number"!=typeof e)throw new P("a is a required number.");if("number"!=typeof t)throw new P("b is a required number.");if("number"!=typeof n)throw new P("c is a required number.");if("number"!=typeof i)throw new P("d is a required number.");const o=t*t,r=n*n;return 18*e*t*n*i+o*r-27*(e*e)*(i*i)-4*(e*r*n+o*t*i)},Xh.computeRealRoots=function(e,t,n,i){if("number"!=typeof e)throw new P("a is a required number.");if("number"!=typeof t)throw new P("b is a required number.");if("number"!=typeof n)throw new P("c is a required number.");if("number"!=typeof i)throw new P("d is a required number.");let o,r;if(0===e)return Yh.computeRealRoots(t,n,i);if(0===t){if(0===n){if(0===i)return[0,0,0];r=-i/e;const t=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[t,t,t]}return 0===i?(o=Yh.computeRealRoots(e,0,n),0===o.Length?[0]:[o[0],0,o[1]]):Qh(e,0,n,i)}return 0===n?0===i?(r=-t/e,r<0?[r,0,0]:[0,0,r]):Qh(e,t,0,i):0===i?(o=Yh.computeRealRoots(e,t,n),0===o.length?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]):Qh(e,t,n,i)};const $h=Xh,Kh={};function Zh(e,t,n,i){const o=e*e,r=t-3*o/8,s=n-t*e/2+o*e/8,a=i-n*e/4+t*o/16-3*o*o/256,c=$h.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(c.length>0){const t=-e/4,n=c[c.length-1];if(Math.abs(n)<V.EPSILON14){const e=Yh.computeRealRoots(1,r,a);if(2===e.length){const n=e[0],i=e[1];let o;if(n>=0&&i>=0){const e=Math.sqrt(n),o=Math.sqrt(i);return[t-o,t-e,t+e,t+o]}if(n>=0&&i<0)return o=Math.sqrt(n),[t-o,t+o];if(n<0&&i>=0)return o=Math.sqrt(i),[t-o,t+o]}return[]}if(n>0){const e=Math.sqrt(n),i=(r+n-s/e)/2,o=(r+n+s/e)/2,a=Yh.computeRealRoots(1,e,i),c=Yh.computeRealRoots(1,-e,o);return 0!==a.length?(a[0]+=t,a[1]+=t,0!==c.length?(c[0]+=t,c[1]+=t,a[1]<=c[0]?[a[0],a[1],c[0],c[1]]:c[1]<=a[0]?[c[0],c[1],a[0],a[1]]:a[0]>=c[0]&&a[1]<=c[1]?[c[0],a[0],a[1],c[1]]:c[0]>=a[0]&&c[1]<=a[1]?[a[0],c[0],c[1],a[1]]:a[0]>c[0]&&a[0]<c[1]?[c[0],a[0],c[1],a[1]]:[a[0],c[0],a[1],c[1]]):a):0!==c.length?(c[0]+=t,c[1]+=t,c):[]}}return[]}function Jh(e,t,n,i){const o=e*e,r=-2*t,s=n*e+t*t-4*i,a=o*i-n*t*e+n*n,c=$h.computeRealRoots(1,r,s,a);if(c.length>0){const r=c[0],s=t-r,a=s*s,l=e/2,u=s/2,d=a-4*i,h=a+4*Math.abs(i),p=o-4*r,f=o+4*Math.abs(r);let m,_,g,y,b,v;if(r<0||d*f<p*h){const t=Math.sqrt(p);m=t/2,_=0===t?0:(e*u-n)/t}else{const t=Math.sqrt(d);m=0===t?0:(e*u-n)/t,_=t/2}0===l&&0===m?(g=0,y=0):V.sign(l)===V.sign(m)?(g=l+m,y=r/g):(y=l-m,g=r/y),0===u&&0===_?(b=0,v=0):V.sign(u)===V.sign(_)?(b=u+_,v=i/b):(v=u-_,b=i/v);const A=Yh.computeRealRoots(1,g,b),T=Yh.computeRealRoots(1,y,v);if(0!==A.length)return 0!==T.length?A[1]<=T[0]?[A[0],A[1],T[0],T[1]]:T[1]<=A[0]?[T[0],T[1],A[0],A[1]]:A[0]>=T[0]&&A[1]<=T[1]?[T[0],A[0],A[1],T[1]]:T[0]>=A[0]&&T[1]<=A[1]?[A[0],T[0],T[1],A[1]]:A[0]>T[0]&&A[0]<T[1]?[T[0],A[0],T[1],A[1]]:[A[0],T[0],A[1],T[1]]:A;if(0!==T.length)return T}return[]}Kh.computeDiscriminant=function(e,t,n,i,o){if("number"!=typeof e)throw new P("a is a required number.");if("number"!=typeof t)throw new P("b is a required number.");if("number"!=typeof n)throw new P("c is a required number.");if("number"!=typeof i)throw new P("d is a required number.");if("number"!=typeof o)throw new P("e is a required number.");const r=e*e,s=t*t,a=s*t,c=n*n,l=c*n,u=i*i,d=u*i,h=o*o;return s*c*u-4*a*d-4*e*l*u+18*e*t*n*d-27*r*u*u+256*(r*e)*(h*o)+o*(18*a*n*i-4*s*l+16*e*c*c-80*e*t*c*i-6*e*s*u+144*r*n*u)+h*(144*e*s*n-27*s*s-128*r*c-192*r*t*i)},Kh.computeRealRoots=function(e,t,n,i,o){if("number"!=typeof e)throw new P("a is a required number.");if("number"!=typeof t)throw new P("b is a required number.");if("number"!=typeof n)throw new P("c is a required number.");if("number"!=typeof i)throw new P("d is a required number.");if("number"!=typeof o)throw new P("e is a required number.");if(Math.abs(e)<V.EPSILON15)return $h.computeRealRoots(t,n,i,o);const r=t/e,s=n/e,a=i/e,c=o/e;let l=r<0?1:0;switch(l+=s<0?l+1:l,l+=a<0?l+1:l,l+=c<0?l+1:l,l){case 0:case 3:case 4:case 6:case 7:case 9:case 10:case 12:case 13:case 14:case 15:return Zh(r,s,a,c);case 1:case 2:case 5:case 8:case 11:return Jh(r,s,a,c);default:return}};const ep=Kh;function tp(e,t){t=H.clone(M(t,H.ZERO)),H.equals(t,H.ZERO)||H.normalize(t,t),this.origin=H.clone(M(e,H.ZERO)),this.direction=t}tp.clone=function(e,t){if(D(e))return D(t)?(t.origin=H.clone(e.origin),t.direction=H.clone(e.direction),t):new tp(e.origin,e.direction)},tp.getPoint=function(e,t,n){return L.typeOf.object("ray",e),L.typeOf.number("t",t),D(n)||(n=new H),n=H.multiplyByScalar(e.direction,t,n),H.add(e.origin,n,n)};const np={rayPlane:function(e,t,n){if(!D(e))throw new P("ray is required.");if(!D(t))throw new P("plane is required.");D(n)||(n=new H);const i=e.origin,o=e.direction,r=t.normal,s=H.dot(r,o);if(Math.abs(s)<V.EPSILON15)return;const a=(-t.distance-H.dot(r,i))/s;return a<0?void 0:(n=H.multiplyByScalar(o,a,n),H.add(i,n,n))}},ip=new H,op=new H,rp=new H,sp=new H,ap=new H;np.rayTriangleParametric=function(e,t,n,i,o){if(!D(e))throw new P("ray is required.");if(!D(t))throw new P("p0 is required.");if(!D(n))throw new P("p1 is required.");if(!D(i))throw new P("p2 is required.");o=M(o,!1);const r=e.origin,s=e.direction,a=H.subtract(n,t,ip),c=H.subtract(i,t,op),l=H.cross(s,c,rp),u=H.dot(a,l);let d,h,p,f,m;if(o){if(u<V.EPSILON6)return;if(d=H.subtract(r,t,sp),p=H.dot(d,l),p<0||p>u)return;if(h=H.cross(d,a,ap),f=H.dot(s,h),f<0||p+f>u)return;m=H.dot(c,h)/u}else{if(Math.abs(u)<V.EPSILON6)return;const e=1/u;if(d=H.subtract(r,t,sp),p=H.dot(d,l)*e,p<0||p>1)return;if(h=H.cross(d,a,ap),f=H.dot(s,h)*e,f<0||p+f>1)return;m=H.dot(c,h)*e}return m},np.rayTriangle=function(e,t,n,i,o,r){const s=np.rayTriangleParametric(e,t,n,i,o);if(D(s)&&!(s<0))return D(r)||(r=new H),H.multiplyByScalar(e.direction,s,r),H.add(e.origin,r,r)};const cp=new tp;np.lineSegmentTriangle=function(e,t,n,i,o,r,s){if(!D(e))throw new P("v0 is required.");if(!D(t))throw new P("v1 is required.");if(!D(n))throw new P("p0 is required.");if(!D(i))throw new P("p1 is required.");if(!D(o))throw new P("p2 is required.");const a=cp;H.clone(e,a.origin),H.subtract(t,e,a.direction),H.normalize(a.direction,a.direction);const c=np.rayTriangleParametric(a,n,i,o,r);if(!(!D(c)||c<0||c>H.distance(e,t)))return D(s)||(s=new H),H.multiplyByScalar(a.direction,c,s),H.add(a.origin,s,s)};const lp={root0:0,root1:0};function up(e,t,n){D(n)||(n=new Qu);const i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=H.subtract(i,r,rp),c=function(e,t,n,i){const o=t*t-4*e*n;if(o<0)return;if(o>0){const n=1/(2*e),r=Math.sqrt(o),s=(-t+r)*n,a=(-t-r)*n;return s<a?(i.root0=s,i.root1=a):(i.root0=a,i.root1=s),i}const r=-t/(2*e);return 0!==r?(i.root0=i.root1=r,i):void 0}(H.dot(o,o),2*H.dot(o,a),H.magnitudeSquared(a)-s,lp);if(D(c))return n.start=c.root0,n.stop=c.root1,n}np.raySphere=function(e,t,n){if(!D(e))throw new P("ray is required.");if(!D(t))throw new P("sphere is required.");if(D(n=up(e,t,n))&&!(n.stop<0))return n.start=Math.max(n.start,0),n};const dp=new tp;np.lineSegmentSphere=function(e,t,n,i){if(!D(e))throw new P("p0 is required.");if(!D(t))throw new P("p1 is required.");if(!D(n))throw new P("sphere is required.");const o=dp;H.clone(e,o.origin);const r=H.subtract(t,e,o.direction),s=H.magnitude(r);if(H.normalize(r,r),!(!D(i=up(o,n,i))||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};const hp=new H,pp=new H;function fp(e,t,n){const i=e+t;return V.sign(e)!==V.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}np.rayEllipsoid=function(e,t){if(!D(e))throw new P("ray is required.");if(!D(t))throw new P("ellipsoid is required.");const n=t.oneOverRadii,i=H.multiplyComponents(n,e.origin,hp),o=H.multiplyComponents(n,e.direction,pp),r=H.magnitudeSquared(i),s=H.dot(i,o);let a,c,l,u,d;if(r>1){if(s>=0)return;const e=s*s;if(a=r-1,c=H.magnitudeSquared(o),l=c*a,e<l)return;if(e>l){u=s*s-l,d=-s+Math.sqrt(u);const e=d/c,t=a/d;return e<t?new Qu(e,t):{start:t,stop:e}}const t=Math.sqrt(a/c);return new Qu(t,t)}return r<1?(a=r-1,c=H.magnitudeSquared(o),l=c*a,u=s*s-l,d=-s+Math.sqrt(u),new Qu(0,d/c)):s<0?(c=H.magnitudeSquared(o),new Qu(0,-s/c)):void 0},np.quadraticVectorExpression=function(e,t,n,i,o){const r=i*i,s=o*o,a=(e[re.COLUMN1ROW1]-e[re.COLUMN2ROW2])*s,c=o*(i*fp(e[re.COLUMN1ROW0],e[re.COLUMN0ROW1],V.EPSILON15)+t.y),l=e[re.COLUMN0ROW0]*r+e[re.COLUMN2ROW2]*s+i*t.x+n,u=s*fp(e[re.COLUMN2ROW1],e[re.COLUMN1ROW2],V.EPSILON15),d=o*(i*fp(e[re.COLUMN2ROW0],e[re.COLUMN0ROW2])+t.z);let h;const p=[];if(0===d&&0===u){if(h=Yh.computeRealRoots(a,c,l),0===h.length)return p;const e=h[0],t=Math.sqrt(Math.max(1-e*e,0));if(p.push(new H(i,o*e,o*-t)),p.push(new H(i,o*e,o*t)),2===h.length){const e=h[1],t=Math.sqrt(Math.max(1-e*e,0));p.push(new H(i,o*e,o*-t)),p.push(new H(i,o*e,o*t))}return p}const f=d*d,m=u*u,_=d*u,g=a*a+m,y=2*(c*a+_),b=2*l*a+c*c-m+f,v=2*(l*c-_),A=l*l-f;if(0===g&&0===y&&0===b&&0===v)return p;h=ep.computeRealRoots(g,y,b,v,A);const T=h.length;if(0===T)return p;for(let w=0;w<T;++w){const e=h[w],t=e*e,n=Math.max(1-t,0),r=Math.sqrt(n);let s;s=V.sign(a)===V.sign(l)?fp(a*t+l,c*e,V.EPSILON12):V.sign(l)===V.sign(c*e)?fp(a*t,c*e+l,V.EPSILON12):fp(a*t+c*e,l,V.EPSILON12);const f=s*fp(u*e,d,V.EPSILON15);f<0?p.push(new H(i,o*e,o*r)):f>0?p.push(new H(i,o*e,o*-r)):0!==r?(p.push(new H(i,o*e,o*-r)),p.push(new H(i,o*e,o*r)),++w):p.push(new H(i,o*e,o*r))}return p};const mp=new H,_p=new H,gp=new H,yp=new H,bp=new H,vp=new re,Ap=new re,Tp=new re,wp=new re,Ep=new re,xp=new re,Sp=new re,Cp=new H,Ip=new H,Op=new Qt;np.grazingAltitudeLocation=function(e,t){if(!D(e))throw new P("ray is required.");if(!D(t))throw new P("ellipsoid is required.");const n=e.origin,i=e.direction;if(!H.equals(n,H.ZERO)){const e=t.geodeticSurfaceNormal(n,mp);if(H.dot(i,e)>=0)return n}const o=D(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,mp),s=H.normalize(r,r),a=H.mostOrthogonalAxis(r,yp),c=H.normalize(H.cross(a,s,_p),_p),l=H.normalize(H.cross(s,c,gp),gp),u=vp;u[0]=s.x,u[1]=s.y,u[2]=s.z,u[3]=c.x,u[4]=c.y,u[5]=c.z,u[6]=l.x,u[7]=l.y,u[8]=l.z;const d=re.transpose(u,Ap),h=re.fromScale(t.radii,Tp),p=re.fromScale(t.oneOverRadii,wp),f=Ep;f[0]=0,f[1]=-i.z,f[2]=i.y,f[3]=i.z,f[4]=0,f[5]=-i.x,f[6]=-i.y,f[7]=i.x,f[8]=0;const m=re.multiply(re.multiply(d,p,xp),f,xp),_=re.multiply(re.multiply(m,h,Sp),u,Sp),g=re.multiplyByVector(m,n,bp),y=np.quadraticVectorExpression(_,H.negate(g,mp),0,0,1);let b,v;const A=y.length;if(A>0){let e=H.clone(H.ZERO,Ip),r=Number.NEGATIVE_INFINITY;for(let t=0;t<A;++t){b=re.multiplyByVector(h,re.multiplyByVector(u,y[t],Cp),Cp);const o=H.normalize(H.subtract(b,n,yp),yp),s=H.dot(o,i);s>r&&(r=s,e=H.clone(b,e))}const s=t.cartesianToCartographic(e,Op);return r=V.clamp(r,0,1),v=H.magnitude(H.subtract(e,n,yp))*Math.sqrt(1-r*r),v=o?-v:v,s.height=v,t.cartographicToCartesian(s,new H)}};const Dp=new H;np.lineSegmentPlane=function(e,t,n,i){if(!D(e))throw new P("endPoint0 is required.");if(!D(t))throw new P("endPoint1 is required.");if(!D(n))throw new P("plane is required.");D(i)||(i=new H);const o=H.subtract(t,e,Dp),r=n.normal,s=H.dot(r,o);if(Math.abs(s)<V.EPSILON6)return;const a=H.dot(r,e),c=-(n.distance+a)/s;return c<0||c>1?void 0:(H.multiplyByScalar(o,c,i),H.add(e,i,i),i)},np.trianglePlaneIntersection=function(e,t,n,i){if(!(D(e)&&D(t)&&D(n)&&D(i)))throw new P("p0, p1, p2, and plane are required.");const o=i.normal,r=i.distance,s=H.dot(o,e)+r<0,a=H.dot(o,t)+r<0,c=H.dot(o,n)+r<0;let l,u,d=0;if(d+=s?1:0,d+=a?1:0,d+=c?1:0,1!==d&&2!==d||(l=new H,u=new H),1===d){if(s)return np.lineSegmentPlane(e,t,i,l),np.lineSegmentPlane(e,n,i,u),{positions:[e,t,n,l,u],indices:[0,3,4,1,2,4,1,4,3]};if(a)return np.lineSegmentPlane(t,n,i,l),np.lineSegmentPlane(t,e,i,u),{positions:[e,t,n,l,u],indices:[1,3,4,2,0,4,2,4,3]};if(c)return np.lineSegmentPlane(n,e,i,l),np.lineSegmentPlane(n,t,i,u),{positions:[e,t,n,l,u],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===d){if(!s)return np.lineSegmentPlane(t,e,i,l),np.lineSegmentPlane(n,e,i,u),{positions:[e,t,n,l,u],indices:[1,2,4,1,4,3,0,3,4]};if(!a)return np.lineSegmentPlane(n,t,i,l),np.lineSegmentPlane(e,t,i,u),{positions:[e,t,n,l,u],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return np.lineSegmentPlane(e,n,i,l),np.lineSegmentPlane(t,n,i,u),{positions:[e,t,n,l,u],indices:[0,1,4,0,4,3,2,3,4]}}};const Pp=np,Np=new K;function Rp(e,t){if(L.defined("origin",e),!D(e=(t=M(t,on.WGS84)).scaleToGeodeticSurface(e)))throw new P("origin must not be at the center of the ellipsoid.");const n=Cr.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=H.fromCartesian4(ve.getColumn(n,0,Np)),this._yAxis=H.fromCartesian4(ve.getColumn(n,1,Np));const i=H.fromCartesian4(ve.getColumn(n,2,Np));this._plane=Pc.fromPointNormal(e,i)}Object.defineProperties(Rp.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});const Lp=new Gh;Rp.fromPoints=function(e,t){L.defined("cartesians",e);return new Rp(Gh.fromPoints(e,Lp).center,t)};const Mp=new tp,Fp=new H;Rp.prototype.projectPointOntoPlane=function(e,t){L.defined("cartesian",e);const n=Mp;n.origin=e,H.normalize(e,n.direction);let i=Pp.rayPlane(n,this._plane,Fp);if(D(i)||(H.negate(n.direction,n.direction),i=Pp.rayPlane(n,this._plane,Fp)),D(i)){const e=H.subtract(i,this._origin,i),n=H.dot(this._xAxis,e),o=H.dot(this._yAxis,e);return D(t)?(t.x=n,t.y=o,t):new kt(n,o)}},Rp.prototype.projectPointsOntoPlane=function(e,t){L.defined("cartesians",e),D(t)||(t=[]);let n=0;const i=e.length;for(let o=0;o<i;o++){const i=this.projectPointOntoPlane(e[o],t[n]);D(i)&&(t[n]=i,n++)}return t.length=n,t},Rp.prototype.projectPointToNearestOnPlane=function(e,t){L.defined("cartesian",e),D(t)||(t=new kt);const n=Mp;n.origin=e,H.clone(this._plane.normal,n.direction);let i=Pp.rayPlane(n,this._plane,Fp);D(i)||(H.negate(n.direction,n.direction),i=Pp.rayPlane(n,this._plane,Fp));const o=H.subtract(i,this._origin,i),r=H.dot(this._xAxis,o),s=H.dot(this._yAxis,o);return t.x=r,t.y=s,t},Rp.prototype.projectPointsToNearestOnPlane=function(e,t){L.defined("cartesians",e),D(t)||(t=[]);const n=e.length;t.length=n;for(let i=0;i<n;i++)t[i]=this.projectPointToNearestOnPlane(e[i],t[i]);return t};const Bp=new H;function zp(e,t){this.center=H.clone(M(e,H.ZERO)),this.halfAxes=re.clone(M(t,re.ZERO))}Rp.prototype.projectPointOntoEllipsoid=function(e,t){L.defined("cartesian",e),D(t)||(t=new H);const n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=Bp;return H.multiplyByScalar(o,e.x,s),t=H.add(i,s,t),H.multiplyByScalar(r,e.y,s),H.add(t,s,t),n.scaleToGeocentricSurface(t,t),t},Rp.prototype.projectPointsOntoEllipsoid=function(e,t){L.defined("cartesians",e);const n=e.length;D(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.projectPointOntoEllipsoid(e[i],t[i]);return t},zp.packedLength=H.packedLength+re.packedLength,zp.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),H.pack(e.center,t,n),re.pack(e.halfAxes,t,n+H.packedLength),t},zp.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new zp),H.unpack(e,t,n.center),re.unpack(e,t+H.packedLength,n.halfAxes),n};const Up=new H,kp=new H,Vp=new H,Hp=new H,Gp=new H,jp=new H,Wp=new re,qp={unitary:new re,diagonal:new re};zp.fromPoints=function(e,t){if(D(t)||(t=new zp),!D(e)||0===e.length)return t.halfAxes=re.ZERO,t.center=H.ZERO,t;let n;const i=e.length,o=H.clone(e[0],Up);for(n=1;n<i;n++)H.add(o,e[n],o);const r=1/i;H.multiplyByScalar(o,r,o);let s,a=0,c=0,l=0,u=0,d=0,h=0;for(n=0;n<i;n++)s=H.subtract(e[n],o,kp),a+=s.x*s.x,c+=s.x*s.y,l+=s.x*s.z,u+=s.y*s.y,d+=s.y*s.z,h+=s.z*s.z;a*=r,c*=r,l*=r,u*=r,d*=r,h*=r;const p=Wp;p[0]=a,p[1]=c,p[2]=l,p[3]=c,p[4]=u,p[5]=d,p[6]=l,p[7]=d,p[8]=h;const f=re.computeEigenDecomposition(p,qp),m=re.clone(f.unitary,t.halfAxes);let _=re.getColumn(m,0,Hp),g=re.getColumn(m,1,Gp),y=re.getColumn(m,2,jp),b=-Number.MAX_VALUE,v=-Number.MAX_VALUE,A=-Number.MAX_VALUE,T=Number.MAX_VALUE,w=Number.MAX_VALUE,E=Number.MAX_VALUE;for(n=0;n<i;n++)s=e[n],b=Math.max(H.dot(_,s),b),v=Math.max(H.dot(g,s),v),A=Math.max(H.dot(y,s),A),T=Math.min(H.dot(_,s),T),w=Math.min(H.dot(g,s),w),E=Math.min(H.dot(y,s),E);_=H.multiplyByScalar(_,.5*(T+b),_),g=H.multiplyByScalar(g,.5*(w+v),g),y=H.multiplyByScalar(y,.5*(E+A),y);const x=H.add(_,g,t.center);H.add(x,y,x);const S=Vp;return S.x=b-T,S.y=v-w,S.z=A-E,H.multiplyByScalar(S,.5,S),re.multiplyByScale(t.halfAxes,S,t.halfAxes),t};const Yp=new H,Xp=new H;function Qp(e,t,n,i,o,r,s,a,c,l,u){if(!(D(o)&&D(r)&&D(s)&&D(a)&&D(c)&&D(l)))throw new P("all extents (minimum/maximum X/Y/Z) are required.");D(u)||(u=new zp);const d=u.halfAxes;re.setColumn(d,0,t,d),re.setColumn(d,1,n,d),re.setColumn(d,2,i,d);let h=Yp;h.x=(o+r)/2,h.y=(s+a)/2,h.z=(c+l)/2;const p=Xp;p.x=(r-o)/2,p.y=(a-s)/2,p.z=(l-c)/2;const f=u.center;return h=re.multiplyByVector(d,h,h),H.add(e,h,f),re.multiplyByScale(d,p,d),u}const $p=new Qt,Kp=new H,Zp=new Qt,Jp=new Qt,ef=new Qt,tf=new Qt,nf=new Qt,of=new H,rf=new H,sf=new H,af=new H,cf=new H,lf=new kt,uf=new kt,df=new kt,hf=new kt,pf=new kt,ff=new H,mf=new H,_f=new H,gf=new H,yf=new kt,bf=new H,vf=new H,Af=new H,Tf=new Pc(H.UNIT_X,0);zp.fromRectangle=function(e,t,n,i,o){if(!D(e))throw new P("rectangle is required");if(e.width<0||e.width>V.TWO_PI)throw new P("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>V.PI)throw new P("Rectangle height must be between 0 and pi");if(D(i)&&!V.equalsEpsilon(i.radii.x,i.radii.y,V.EPSILON15))throw new P("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");let r,s,a,c,l,u,d;if(t=M(t,0),n=M(n,0),i=M(i,on.WGS84),e.width<=V.PI){const h=Ir.center(e,$p),p=new Rp(i.cartographicToCartesian(h,Kp),i);d=p.plane;const f=h.longitude,m=e.south<0&&e.north>0?0:h.latitude,_=Qt.fromRadians(f,e.north,n,Zp),g=Qt.fromRadians(e.west,e.north,n,Jp),y=Qt.fromRadians(e.west,m,n,ef),b=Qt.fromRadians(e.west,e.south,n,tf),v=Qt.fromRadians(f,e.south,n,nf),A=i.cartographicToCartesian(_,of);let T=i.cartographicToCartesian(g,rf);const w=i.cartographicToCartesian(y,sf);let E=i.cartographicToCartesian(b,af);const x=i.cartographicToCartesian(v,cf),S=p.projectPointToNearestOnPlane(A,lf),C=p.projectPointToNearestOnPlane(T,uf),I=p.projectPointToNearestOnPlane(w,df),O=p.projectPointToNearestOnPlane(E,hf),D=p.projectPointToNearestOnPlane(x,pf);return r=Math.min(C.x,I.x,O.x),s=-r,c=Math.max(C.y,S.y),a=Math.min(O.y,D.y),g.height=b.height=t,T=i.cartographicToCartesian(g,rf),E=i.cartographicToCartesian(b,af),l=Math.min(Pc.getPointDistance(d,T),Pc.getPointDistance(d,E)),u=n,Qp(p.origin,p.xAxis,p.yAxis,p.zAxis,r,s,a,c,l,u,o)}const h=e.south>0,p=e.north<0,f=h?e.south:p?e.north:0,m=Ir.center(e,$p).longitude,_=H.fromRadians(m,f,n,i,ff);_.z=0;const g=Math.abs(_.x)<V.EPSILON10&&Math.abs(_.y)<V.EPSILON10?H.UNIT_X:H.normalize(_,mf),y=H.UNIT_Z,b=H.cross(g,y,_f);d=Pc.fromPointNormal(_,g,Tf);const v=H.fromRadians(m+V.PI_OVER_TWO,f,n,i,gf);s=H.dot(Pc.projectPointOntoPlane(d,v,yf),b),r=-s,c=H.fromRadians(0,e.north,p?t:n,i,bf).z,a=H.fromRadians(0,e.south,h?t:n,i,vf).z;const A=H.fromRadians(e.east,f,n,i,Af);return l=Pc.getPointDistance(d,A),u=0,Qp(_,b,y,g,r,s,a,c,l,u,o)},zp.fromTransformation=function(e,t){return L.typeOf.object("transformation",e),D(t)||(t=new zp),t.center=ve.getTranslation(e,t.center),t.halfAxes=ve.getMatrix3(e,t.halfAxes),t.halfAxes=re.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t},zp.clone=function(e,t){if(D(e))return D(t)?(H.clone(e.center,t.center),re.clone(e.halfAxes,t.halfAxes),t):new zp(e.center,e.halfAxes)},zp.intersectPlane=function(e,t){if(!D(e))throw new P("box is required.");if(!D(t))throw new P("plane is required.");const n=e.center,i=t.normal,o=e.halfAxes,r=i.x,s=i.y,a=i.z,c=Math.abs(r*o[re.COLUMN0ROW0]+s*o[re.COLUMN0ROW1]+a*o[re.COLUMN0ROW2])+Math.abs(r*o[re.COLUMN1ROW0]+s*o[re.COLUMN1ROW1]+a*o[re.COLUMN1ROW2])+Math.abs(r*o[re.COLUMN2ROW0]+s*o[re.COLUMN2ROW1]+a*o[re.COLUMN2ROW2]),l=H.dot(i,n)+t.distance;return l<=-c?mn.OUTSIDE:l>=c?mn.INSIDE:mn.INTERSECTING};const wf=new H,Ef=new H,xf=new H,Sf=new H,Cf=new H,If=new H;zp.distanceSquaredTo=function(e,t){if(!D(e))throw new P("box is required.");if(!D(t))throw new P("cartesian is required.");const n=H.subtract(t,e.center,Yp),i=e.halfAxes;let o=re.getColumn(i,0,wf),r=re.getColumn(i,1,Ef),s=re.getColumn(i,2,xf);const a=H.magnitude(o),c=H.magnitude(r),l=H.magnitude(s);let u=!0,d=!0,h=!0;a>0?H.divideByScalar(o,a,o):u=!1,c>0?H.divideByScalar(r,c,r):d=!1,l>0?H.divideByScalar(s,l,s):h=!1;const p=!u+!d+!h;let f,m,_;if(1===p){let e=o;f=r,m=s,d?h||(e=s,m=o):(e=r,f=o),_=H.cross(f,m,Cf),e===o?o=_:e===r?r=_:e===s&&(s=_)}else if(2===p){f=o,d?f=r:h&&(f=s);let e=H.UNIT_Y;e.equalsEpsilon(f,V.EPSILON3)&&(e=H.UNIT_X),m=H.cross(f,e,Sf),H.normalize(m,m),_=H.cross(f,m,Cf),H.normalize(_,_),f===o?(r=m,s=_):f===r?(s=m,o=_):f===s&&(o=m,r=_)}else 3===p&&(o=H.UNIT_X,r=H.UNIT_Y,s=H.UNIT_Z);const g=If;g.x=H.dot(n,o),g.y=H.dot(n,r),g.z=H.dot(n,s);let y,b=0;return g.x<-a?(y=g.x+a,b+=y*y):g.x>a&&(y=g.x-a,b+=y*y),g.y<-c?(y=g.y+c,b+=y*y):g.y>c&&(y=g.y-c,b+=y*y),g.z<-l?(y=g.z+l,b+=y*y):g.z>l&&(y=g.z-l,b+=y*y),b};const Of=new H,Df=new H;zp.computePlaneDistances=function(e,t,n,i){if(!D(e))throw new P("box is required.");if(!D(t))throw new P("position is required.");if(!D(n))throw new P("direction is required.");D(i)||(i=new Qu);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=e.center,a=e.halfAxes,c=re.getColumn(a,0,wf),l=re.getColumn(a,1,Ef),u=re.getColumn(a,2,xf),d=H.add(c,l,Of);H.add(d,u,d),H.add(d,s,d);const h=H.subtract(d,t,Df);let p=H.dot(n,h);return o=Math.min(p,o),r=Math.max(p,r),H.add(s,c,d),H.add(d,l,d),H.subtract(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),H.add(s,c,d),H.subtract(d,l,d),H.add(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),H.add(s,c,d),H.subtract(d,l,d),H.subtract(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),H.subtract(s,c,d),H.add(d,l,d),H.add(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),H.subtract(s,c,d),H.add(d,l,d),H.subtract(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),H.subtract(s,c,d),H.subtract(d,l,d),H.add(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),H.subtract(s,c,d),H.subtract(d,l,d),H.subtract(d,u,d),H.subtract(d,t,h),p=H.dot(n,h),o=Math.min(p,o),r=Math.max(p,r),i.start=o,i.stop=r,i};const Pf=new H,Nf=new H,Rf=new H;zp.computeCorners=function(e,t){L.typeOf.object("box",e),D(t)||(t=[new H,new H,new H,new H,new H,new H,new H,new H]);const n=e.center,i=e.halfAxes,o=re.getColumn(i,0,Pf),r=re.getColumn(i,1,Nf),s=re.getColumn(i,2,Rf);return H.clone(n,t[0]),H.subtract(t[0],o,t[0]),H.subtract(t[0],r,t[0]),H.subtract(t[0],s,t[0]),H.clone(n,t[1]),H.subtract(t[1],o,t[1]),H.subtract(t[1],r,t[1]),H.add(t[1],s,t[1]),H.clone(n,t[2]),H.subtract(t[2],o,t[2]),H.add(t[2],r,t[2]),H.subtract(t[2],s,t[2]),H.clone(n,t[3]),H.subtract(t[3],o,t[3]),H.add(t[3],r,t[3]),H.add(t[3],s,t[3]),H.clone(n,t[4]),H.add(t[4],o,t[4]),H.subtract(t[4],r,t[4]),H.subtract(t[4],s,t[4]),H.clone(n,t[5]),H.add(t[5],o,t[5]),H.subtract(t[5],r,t[5]),H.add(t[5],s,t[5]),H.clone(n,t[6]),H.add(t[6],o,t[6]),H.add(t[6],r,t[6]),H.subtract(t[6],s,t[6]),H.clone(n,t[7]),H.add(t[7],o,t[7]),H.add(t[7],r,t[7]),H.add(t[7],s,t[7]),t};const Lf=new re;zp.computeTransformation=function(e,t){L.typeOf.object("box",e),D(t)||(t=new ve);const n=e.center,i=re.multiplyByUniformScale(e.halfAxes,2,Lf);return ve.fromRotationTranslation(i,n,t)};const Mf=new $u;zp.isOccluded=function(e,t){if(!D(e))throw new P("box is required.");if(!D(t))throw new P("occluder is required.");const n=$u.fromOrientedBoundingBox(e,Mf);return!t.isBoundingSphereVisible(n)},zp.prototype.intersectPlane=function(e){return zp.intersectPlane(this,e)},zp.prototype.distanceSquaredTo=function(e){return zp.distanceSquaredTo(this,e)},zp.prototype.computePlaneDistances=function(e,t,n){return zp.computePlaneDistances(this,e,t,n)},zp.prototype.computeCorners=function(e){return zp.computeCorners(this,e)},zp.prototype.computeTransformation=function(e){return zp.computeTransformation(this,e)},zp.prototype.isOccluded=function(e){return zp.isOccluded(this,e)},zp.equals=function(e,t){return e===t||D(e)&&D(t)&&H.equals(e.center,t.center)&&re.equals(e.halfAxes,t.halfAxes)},zp.prototype.clone=function(e){return zp.clone(this,e)},zp.prototype.equals=function(e){return zp.equals(this,e)};const Ff={getHeight:function(e,t,n){if(!Number.isFinite(t))throw new P("scale must be a finite number.");if(!Number.isFinite(n))throw new P("relativeHeight must be a finite number.");return(e-n)*t+n}},Bf=new Qt;Ff.getPosition=function(e,t,n,i,o){const r=t.cartesianToCartographic(e,Bf);if(!D(r))return H.clone(e,o);const s=Ff.getHeight(r.height,n,i);return H.fromRadians(r.longitude,r.latitude,s,t,o)};const zf=Ff,Uf="#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\n\nvoid main(void)\n{\n#ifdef VECTOR_TILE\n out_FragColor = czm_gammaCorrect(u_highlightColor);\n#else\n out_FragColor = vec4(1.0);\n#endif\n czm_writeDepthClamp();\n}\n",kf={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2,NUMBER_OF_CLASSIFICATION_TYPES:3},Vf=Object.freeze(kf),Hf={NEVER:Me.NEVER,LESS:Me.LESS,EQUAL:Me.EQUAL,LESS_OR_EQUAL:Me.LEQUAL,GREATER:Me.GREATER,NOT_EQUAL:Me.NOTEQUAL,GREATER_OR_EQUAL:Me.GEQUAL,ALWAYS:Me.ALWAYS},Gf=Object.freeze(Hf);function jf(e,t,n){if(!D(e))throw new P("context is required");if(!D(t))throw new P("attributes is required");if(!D(n))throw new P("numberOfInstances is required");if(this._attributes=t,this._numberOfInstances=n,0===t.length)return;const i=function(e){let t=!1;const n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==Ca.UNSIGNED_BYTE){t=!0;break}return t?ts.FLOAT:ts.UNSIGNED_BYTE}(t),o=e.floatingPointTexture,r=i===ts.FLOAT&&!o,s=function(e,t){const n=new Array(e.length);let i=0;const o=e.length;for(let r=0;r<o;++r){const o=e[r].componentDatatype;n[r]=i,o!==Ca.UNSIGNED_BYTE&&t?i+=4:++i}return n}(t,r),a=function(e,t,n){const i=e.length,o=e[i-1],r=t[i-1];if(r.componentDatatype!==Ca.UNSIGNED_BYTE&&n)return o+4;return o+1}(s,t,r),c=Math.floor(rs.maximumTextureSize/a),l=Math.min(n,c),u=a*l,d=Math.ceil(n/l),h=1/u,p=.5*h,f=1/d,m=.5*f;this._textureDimensions=new kt(u,d),this._textureStep=new K(h,p,f,m),this._pixelDatatype=r?ts.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;const _=4*u*d;this._batchValues=i!==ts.FLOAT||r?new Uint8Array(_):new Float32Array(_),this._batchValuesDirty=!1}function Wf(e,t){const n=e[t].componentsPerAttribute;return 2===n?kt:3===n?H:4===n?K:Number}Object.defineProperties(jf.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});const qf=new K;const Yf=new K;jf.prototype.getBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new P("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new P("attributeIndex is out of range");const i=this._attributes,o=this._offsets[t],r=4*this._stride*e+4*o;let s;s=this._packFloats&&i[t].componentDatatype!==ts.UNSIGNED_BYTE?function(e,t,n){let i=K.unpack(e,t,qf);const o=K.unpackFloat(i);i=K.unpack(e,t+4,qf);const r=K.unpackFloat(i);i=K.unpack(e,t+8,qf);const s=K.unpackFloat(i);i=K.unpack(e,t+12,qf);const a=K.unpackFloat(i);return K.fromElements(o,r,s,a,n)}(this._batchValues,r,Yf):K.unpack(this._batchValues,r,Yf);const a=Wf(i,t);return D(a.fromCartesian4)?a.fromCartesian4(s,n):D(a.clone)?a.clone(s,n):s.x};const Xf=[void 0,void 0,new kt,new H,new K],Qf=new K;function $f(e,t){const n=e._attributes[t],i=n.componentsPerAttribute,o=n.functionName,r=function(e){return 1===e?"float":`vec${e}`}(i),s=function(e){return 1===e?".x":2===e?".xy":3===e?".xyz":""}(i);let a=`${r} ${o}(float batchId) \n{ \n vec2 st = computeSt(batchId); \n st.x += batchTextureStep.x * float(${e._offsets[t]}); \n`;return e._packFloats&&n.componentDatatype!==ts.UNSIGNED_BYTE?a+="vec4 textureValue; \ntextureValue.x = czm_unpackFloat(texture(batchTexture, st)); \ntextureValue.y = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \ntextureValue.z = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \ntextureValue.w = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n":a+=" vec4 textureValue = texture(batchTexture, st); \n",a+=` ${r} value = textureValue${s}; \n`,e._pixelDatatype!==ts.UNSIGNED_BYTE||n.componentDatatype!==Ca.UNSIGNED_BYTE||n.normalize?e._pixelDatatype===ts.FLOAT&&n.componentDatatype===Ca.UNSIGNED_BYTE&&n.normalize&&(a+="value /= 255.0; \n"):a+="value *= 255.0; \n",a+=" return value; \n} \n",a}jf.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new P("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new P("attributeIndex is out of range");if(!D(n))throw new P("value is required.");const i=this._attributes,o=Xf[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=Wf(this._attributes,t);if(D(s.equals)?s.equals(r,n):r===n)return;const a=Qf;a.x=D(n.x)?n.x:n,a.y=D(n.y)?n.y:0,a.z=D(n.z)?n.z:0,a.w=D(n.w)?n.w:0;const c=this._offsets[t],l=4*this._stride*e+4*c;this._packFloats&&i[t].componentDatatype!==ts.UNSIGNED_BYTE?function(e,t,n){let i=K.packFloat(e.x,qf);K.pack(i,t,n),i=K.packFloat(e.y,i),K.pack(i,t,n+4),i=K.packFloat(e.z,i),K.pack(i,t,n+8),i=K.packFloat(e.w,i),K.pack(i,t,n+12)}(a,this._batchValues,l):K.pack(a,this._batchValues,l),this._batchValuesDirty=!0},jf.prototype.update=function(e){D(this._texture)&&!this._batchValuesDirty||0===this._attributes.length||(this._batchValuesDirty=!1,D(this._texture)||function(e,t){const n=e._textureDimensions;e._texture=new Sc({context:t,pixelFormat:is.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:uc.NEAREST,flipY:!1})}(this,e.context),function(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}(this))},jf.prototype.getUniformMapCallback=function(){const e=this;return function(t){if(0===e._attributes.length)return t;return ni(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}},jf.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(0===e.length)return function(e){return e};let t="uniform highp sampler2D batchTexture; \n";t+=`${function(e){const 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`}(this)}\n`;const n=e.length;for(let i=0;i<n;++i)t+=$f(this,i);return function(e){const n=e.indexOf("void main"),i=e.substring(0,n),o=e.substring(n);return`${i}\n${t}\n${o}`}},jf.prototype.isDestroyed=function(){return!1},jf.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),He(this)};const Kf={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",getMathType:function(e){switch(e){case Kf.SCALAR:return Number;case Kf.VEC2:return kt;case Kf.VEC3:return H;case Kf.VEC4:return K;case Kf.MAT2:return Ms;case Kf.MAT3:return re;case Kf.MAT4:return ve;default:throw new P("attributeType is not a valid value.")}},getNumberOfComponents:function(e){switch(e){case Kf.SCALAR:return 1;case Kf.VEC2:return 2;case Kf.VEC3:return 3;case Kf.VEC4:case Kf.MAT2:return 4;case Kf.MAT3:return 9;case Kf.MAT4:return 16;default:throw new P("attributeType is not a valid value.")}},getAttributeLocationCount:function(e){switch(e){case Kf.SCALAR:case Kf.VEC2:case Kf.VEC3:case Kf.VEC4:return 1;case Kf.MAT2:return 2;case Kf.MAT3:return 3;case Kf.MAT4:return 4;default:throw new P("attributeType is not a valid value.")}},getGlslType:function(e){switch(L.typeOf.string("attributeType",e),e){case Kf.SCALAR:return"float";case Kf.VEC2:return"vec2";case Kf.VEC3:return"vec3";case Kf.VEC4:return"vec4";case Kf.MAT2:return"mat2";case Kf.MAT3:return"mat3";case Kf.MAT4:return"mat4";default:throw new P("attributeType is not a valid value.")}}},Zf=Object.freeze(Kf),Jf=1/256,em={octEncodeInRange:function(e,t,n){L.defined("vector",e),L.defined("result",n);const i=H.magnitudeSquared(e);if(Math.abs(i-1)>V.EPSILON6)throw new P("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){const e=n.x,t=n.y;n.x=(1-Math.abs(t))*V.signNotZero(e),n.y=(1-Math.abs(e))*V.signNotZero(t)}return n.x=V.toSNorm(n.x,t),n.y=V.toSNorm(n.y,t),n},octEncode:function(e,t){return em.octEncodeInRange(e,255,t)}},tm=new kt,nm=new Uint8Array(1);function im(e){return nm[0]=e,nm[0]}em.octEncodeToCartesian4=function(e,t){return em.octEncodeInRange(e,65535,tm),t.x=im(tm.x*Jf),t.y=im(tm.x),t.z=im(tm.y*Jf),t.w=im(tm.y),t},em.octDecodeInRange=function(e,t,n,i){if(L.defined("result",i),e<0||e>n||t<0||t>n)throw new P(`x and y must be unsigned normalized integers between 0 and ${n}`);if(i.x=V.fromSNorm(e,n),i.y=V.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){const e=i.x;i.x=(1-Math.abs(i.y))*V.signNotZero(e),i.y=(1-Math.abs(e))*V.signNotZero(i.y)}return H.normalize(i,i)},em.octDecode=function(e,t,n){return em.octDecodeInRange(e,t,255,n)},em.octDecodeFromCartesian4=function(e,t){L.typeOf.object("encoded",e),L.typeOf.object("result",t);const n=e.x,i=e.y,o=e.z,r=e.w;if(n<0||n>255||i<0||i>255||o<0||o>255||r<0||r>255)throw new P("x, y, z, and w must be unsigned normalized integers between 0 and 255");const s=256*n+i,a=256*o+r;return em.octDecodeInRange(s,a,65535,t)},em.octPackFloat=function(e){return L.defined("encoded",e),256*e.x+e.y};const om=new kt;function rm(e){return e>>1^-(1&e)}em.octEncodeFloat=function(e){return em.octEncode(e,om),em.octPackFloat(om)},em.octDecodeFloat=function(e,t){L.defined("value",e);const n=e/256,i=Math.floor(n),o=256*(n-i);return em.octDecode(i,o,t)},em.octPack=function(e,t,n,i){L.defined("v1",e),L.defined("v2",t),L.defined("v3",n),L.defined("result",i);const o=em.octEncodeFloat(e),r=em.octEncodeFloat(t),s=em.octEncode(n,om);return i.x=65536*s.x+o,i.y=65536*s.y+r,i},em.octUnpack=function(e,t,n,i){L.defined("packed",e),L.defined("v1",t),L.defined("v2",n),L.defined("v3",i);let o=e.x/65536;const r=Math.floor(o),s=65536*(o-r);o=e.y/65536;const a=Math.floor(o),c=65536*(o-a);em.octDecodeFloat(s,t),em.octDecodeFloat(c,n),em.octDecode(r,a,i)},em.compressTextureCoordinates=function(e){L.defined("textureCoordinates",e);return 4096*(4095*e.x|0)+(4095*e.y|0)},em.decompressTextureCoordinates=function(e,t){L.defined("compressed",e),L.defined("result",t);const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-4096*i)/4095,t},em.zigZagDeltaDecode=function(e,t,n){L.defined("uBuffer",e),L.defined("vBuffer",t),L.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),D(n)&&L.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);const i=e.length;let o=0,r=0,s=0;for(let a=0;a<i;++a)o+=rm(e[a]),r+=rm(t[a]),e[a]=o,t[a]=r,D(n)&&(s+=rm(n[a]),n[a]=s)},em.dequantize=function(e,t,n,i){L.defined("typedArray",e),L.defined("componentDatatype",t),L.defined("type",n),L.defined("count",i);const o=Zf.getNumberOfComponents(n);let r;switch(t){case Ca.BYTE:r=127;break;case Ca.UNSIGNED_BYTE:r=255;break;case Ca.SHORT:r=32767;break;case Ca.UNSIGNED_SHORT:r=65535;break;case Ca.INT:r=2147483647;break;case Ca.UNSIGNED_INT:r=4294967295;break;default:throw new P(`Cannot dequantize component datatype: ${t}`)}const s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let t=0;t<o;t++){const n=a*o+t;s[n]=Math.max(e[n]/r,-1)}return s},em.decodeRGB565=function(e,t){L.defined("typedArray",e);const n=3*e.length;D(t)&&L.typeOf.number.equals("result.length","typedArray.length * 3",t.length,n);const i=e.length;D(t)||(t=new Float32Array(3*i));const o=1/31,r=1/63;for(let s=0;s<i;s++){const n=e[s],i=n>>11,a=n>>5&63,c=31&n,l=3*s;t[l]=i*o,t[l+1]=a*r,t[l+2]=c*o}return t};const sm=em,am=new H,cm=new H,lm=new H;const um={calculateACMR:function(e){const t=(e=M(e,M.EMPTY_OBJECT)).indices;let n=e.maximumIndex;const i=M(e.cacheSize,24);if(!D(t))throw new P("indices is required.");const o=t.length;if(o<3||o%3!=0)throw new P("indices length must be a multiple of three.");if(n<=0)throw new P("maximumIndex must be greater than zero.");if(i<3)throw new P("cacheSize must be greater than two.");if(!D(n)){n=0;let e=0,i=t[e];for(;e<o;)i>n&&(n=i),++e,i=t[e]}const r=[];for(let a=0;a<n+1;a++)r[a]=0;let s=i+1;for(let a=0;a<o;++a)s-r[t[a]]>i&&(r[t[a]]=s,++s);return(s-i+1)/(o/3)}};um.tipsify=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).indices,n=e.maximumIndex,i=M(e.cacheSize,24);let o;function r(e,t,n,i,r,s,a){let c,l=-1,u=-1,d=0;for(;d<n.length;){const e=n[d];i[e].numLiveTriangles&&(c=0,r-i[e].timeStamp+2*i[e].numLiveTriangles<=t&&(c=r-i[e].timeStamp),(c>u||-1===u)&&(u=c,l=e)),++d}return-1===l?function(e,t,n,i){for(;t.length>=1;){const n=t[t.length-1];if(t.splice(t.length-1,1),e[n].numLiveTriangles>0)return n}for(;o<i;){if(e[o].numLiveTriangles>0)return++o,o-1;++o}return-1}(i,s,0,a):l}if(!D(t))throw new P("indices is required.");const s=t.length;if(s<3||s%3!=0)throw new P("indices length must be a multiple of three.");if(n<=0)throw new P("maximumIndex must be greater than zero.");if(i<3)throw new P("cacheSize must be greater than two.");let a=0,c=0,l=t[c];const u=s;if(D(n))a=n+1;else{for(;c<u;)l>a&&(a=l),++c,l=t[c];if(-1===a)return 0;++a}const d=[];let h;for(h=0;h<a;h++)d[h]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};c=0;let p=0;for(;c<u;)d[t[c]].vertexTriangles.push(p),++d[t[c]].numLiveTriangles,d[t[c+1]].vertexTriangles.push(p),++d[t[c+1]].numLiveTriangles,d[t[c+2]].vertexTriangles.push(p),++d[t[c+2]].numLiveTriangles,++p,c+=3;let f=0,m=i+1;o=1;let _=[];const g=[];let y,b,v=0;const A=[],T=s/3,w=[];for(h=0;h<T;h++)w[h]=!1;let E,x;for(;-1!==f;){_=[],b=d[f],x=b.vertexTriangles.length;for(let e=0;e<x;++e)if(p=b.vertexTriangles[e],!w[p]){w[p]=!0,c=p+p+p;for(let e=0;e<3;++e)E=t[c],_.push(E),g.push(E),A[v]=E,++v,y=d[E],--y.numLiveTriangles,m-y.timeStamp>i&&(y.timeStamp=m,++m),++c}f=r(0,i,_,d,m,g,a)}return A};const dm=um,hm={};function pm(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function fm(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&D(e[n])&&D(e[n].values)){const i=e[n];t[n]=new Ga({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function mm(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&D(t[i])&&D(t[i].values)){const o=t[i];for(let t=0;t<o.componentsPerAttribute;++t)e[i].values.push(o.values[n*o.componentsPerAttribute+t])}}hm.toWireframe=function(e){if(!D(e))throw new P("geometry is required.");const t=e.indices;if(D(t)){switch(e.primitiveType){case Vr.TRIANGLES:e.indices=function(e){const t=e.length,n=t/3*6,i=je.createTypedArray(t,n);let o=0;for(let r=0;r<t;r+=3,o+=6)pm(i,o,e[r],e[r+1],e[r+2]);return i}(t);break;case Vr.TRIANGLE_STRIP:e.indices=function(e){const t=e.length;if(t>=3){const n=6*(t-2),i=je.createTypedArray(t,n);pm(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)pm(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}(t);break;case Vr.TRIANGLE_FAN:e.indices=function(e){if(e.length>0){const t=e.length-1,n=6*(t-1),i=je.createTypedArray(t,n),o=e[0];let r=0;for(let s=1;s<t;++s,r+=6)pm(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}(t);break;default:throw new P("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=Vr.LINES}return e},hm.createLineSegmentsForVectors=function(e,t,n){if(t=M(t,"normal"),!D(e))throw new P("geometry is required.");if(!D(e.attributes.position))throw new P("geometry.attributes.position is required.");if(!D(e.attributes[t]))throw new P(`geometry.attributes must have an attribute with the same name as the attributeName parameter, ${t}.`);n=M(n,1e4);const i=e.attributes.position.values,o=e.attributes[t].values,r=i.length,s=new Float64Array(2*r);let a,c=0;for(let u=0;u<r;u+=3)s[c++]=i[u],s[c++]=i[u+1],s[c++]=i[u+2],s[c++]=i[u]+o[u]*n,s[c++]=i[u+1]+o[u+1]*n,s[c++]=i[u+2]+o[u+2]*n;const l=e.boundingSphere;return D(l)&&(a=new $u(l.center,l.radius+n)),new Na({attributes:{position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:Vr.LINES,boundingSphere:a})},hm.createAttributeLocations=function(e){if(!D(e))throw new P("geometry is required.");const t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,i={};let o,r=0;const s=t.length;for(o=0;o<s;++o){const e=t[o];D(n[e])&&(i[e]=r++)}for(const a in n)n.hasOwnProperty(a)&&!D(i[a])&&(i[a]=r++);return i},hm.reorderForPreVertexCache=function(e){if(!D(e))throw new P("geometry is required.");const t=Na.computeNumberOfVertices(e),n=e.indices;if(D(n)){const i=new Int32Array(t);for(let e=0;e<t;e++)i[e]=-1;const o=n,r=o.length,s=je.createTypedArray(t,r);let a,c=0,l=0,u=0;for(;c<r;)a=i[o[c]],-1!==a?s[l]=a:(a=o[c],i[a]=u,s[l]=u,++u),++c,++l;e.indices=s;const d=e.attributes;for(const e in d)if(d.hasOwnProperty(e)&&D(d[e])&&D(d[e].values)){const n=d[e],o=n.values;let r=0;const s=n.componentsPerAttribute,a=Ca.createTypedArray(n.componentDatatype,u*s);for(;r<t;){const e=i[r];if(-1!==e)for(let t=0;t<s;t++)a[s*e+t]=o[s*r+t];++r}n.values=a}}return e},hm.reorderForPostVertexCache=function(e,t){if(!D(e))throw new P("geometry is required.");const n=e.indices;if(e.primitiveType===Vr.TRIANGLES&&D(n)){const i=n.length;let o=0;for(let e=0;e<i;e++)n[e]>o&&(o=n[e]);e.indices=dm.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e},hm.fitToUnsignedShortIndices=function(e){if(!D(e))throw new P("geometry is required.");if(D(e.indices)&&e.primitiveType!==Vr.TRIANGLES&&e.primitiveType!==Vr.LINES&&e.primitiveType!==Vr.POINTS)throw new P("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");const t=[],n=Na.computeNumberOfVertices(e);if(D(e.indices)&&n>=V.SIXTY_FOUR_KILOBYTES){let n=[],i=[],o=0,r=fm(e.attributes);const s=e.indices,a=s.length;let c;e.primitiveType===Vr.TRIANGLES?c=3:e.primitiveType===Vr.LINES?c=2:e.primitiveType===Vr.POINTS&&(c=1);for(let l=0;l<a;l+=c){for(let t=0;t<c;++t){const a=s[l+t];let c=n[a];D(c)||(c=o++,n[a]=c,mm(r,e.attributes,a)),i.push(c)}o+c>=V.SIXTY_FOUR_KILOBYTES&&(t.push(new Na({attributes:r,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),n=[],i=[],o=0,r=fm(e.attributes))}0!==i.length&&t.push(new Na({attributes:r,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const _m=new H,gm=new Qt;hm.projectTo2D=function(e,t,n,i,o){if(!D(e))throw new P("geometry is required.");if(!D(t))throw new P("attributeName is required.");if(!D(n))throw new P("attributeName3D is required.");if(!D(i))throw new P("attributeName2D is required.");if(!D(e.attributes[t]))throw new P(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==Ca.DOUBLE)throw new P("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const r=e.attributes[t],s=(o=D(o)?o:new fn).ellipsoid,a=r.values,c=new Float64Array(a.length);let l=0;for(let u=0;u<a.length;u+=3){const e=H.fromArray(a,u,_m),t=s.cartesianToCartographic(e,gm);if(!D(t))throw new P(`Could not project point (${e.x}, ${e.y}, ${e.z}) to 2D.`);const n=o.project(t,_m);c[l++]=n.x,c[l++]=n.y,c[l++]=n.z}return e.attributes[n]=r,e.attributes[i]=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:c}),delete e.attributes[t],e};const ym={high:0,low:0};hm.encodeAttribute=function(e,t,n,i){if(!D(e))throw new P("geometry is required.");if(!D(t))throw new P("attributeName is required.");if(!D(n))throw new P("attributeHighName is required.");if(!D(i))throw new P("attributeLowName is required.");if(!D(e.attributes[t]))throw new P(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==Ca.DOUBLE)throw new P("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const o=e.attributes[t],r=o.values,s=r.length,a=new Float32Array(s),c=new Float32Array(s);for(let u=0;u<s;++u)Ic.encode(r[u],ym),a[u]=ym.high,c[u]=ym.low;const l=o.componentsPerAttribute;return e.attributes[n]=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:l,values:a}),e.attributes[i]=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:l,values:c}),delete e.attributes[t],e};let bm=new H;function vm(e,t){if(D(t)){const n=t.values,i=n.length;for(let t=0;t<i;t+=3)H.unpack(n,t,bm),ve.multiplyByPoint(e,bm,bm),H.pack(bm,n,t)}}function Am(e,t){if(D(t)){const n=t.values,i=n.length;for(let t=0;t<i;t+=3)H.unpack(n,t,bm),re.multiplyByVector(e,bm,bm),bm=H.normalize(bm,bm),H.pack(bm,n,t)}}const Tm=new ve,wm=new re;hm.transformToWorldCoordinates=function(e){if(!D(e))throw new P("instance is required.");const t=e.modelMatrix;if(ve.equals(t,ve.IDENTITY))return e;const n=e.geometry.attributes;vm(t,n.position),vm(t,n.prevPosition),vm(t,n.nextPosition),(D(n.normal)||D(n.tangent)||D(n.bitangent))&&(ve.inverse(t,Tm),ve.transpose(Tm,Tm),ve.getMatrix3(Tm,wm),Am(wm,n.normal),Am(wm,n.tangent),Am(wm,n.bitangent));const i=e.geometry.boundingSphere;return D(i)&&(e.geometry.boundingSphere=$u.transform(i,t,i)),e.modelMatrix=ve.clone(ve.IDENTITY),e};const Em=new H;function xm(e,t){const n=e.length;let i,o,r,s;const a=e[0].modelMatrix,c=D(e[0][t].indices),l=e[0][t].primitiveType;for(o=1;o<n;++o){if(!ve.equals(e[o].modelMatrix,a))throw new P("All instances must have the same modelMatrix.");if(D(e[o][t].indices)!==c)throw new P("All instance geometries must have an indices or not have one.");if(e[o][t].primitiveType!==l)throw new P("All instance geometries must have the same primitiveType.")}const u=function(e,t){const n=e.length,i={},o=e[0][t].attributes;let r;for(r in o)if(o.hasOwnProperty(r)&&D(o[r])&&D(o[r].values)){const s=o[r];let a=s.values.length,c=!0;for(let i=1;i<n;++i){const n=e[i][t].attributes[r];if(!D(n)||s.componentDatatype!==n.componentDatatype||s.componentsPerAttribute!==n.componentsPerAttribute||s.normalize!==n.normalize){c=!1;break}a+=n.values.length}c&&(i[r]=new Ga({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:Ca.createTypedArray(s.componentDatatype,a)}))}return i}(e,t);let d,h,p,f;for(i in u)if(u.hasOwnProperty(i))for(d=u[i].values,s=0,o=0;o<n;++o)for(h=e[o][t].attributes[i].values,p=h.length,r=0;r<p;++r)d[s++]=h[r];if(c){let i=0;for(o=0;o<n;++o)i+=e[o][t].indices.length;const r=Na.computeNumberOfVertices(new Na({attributes:u,primitiveType:Vr.POINTS})),a=je.createTypedArray(r,i);let c=0,l=0;for(o=0;o<n;++o){const n=e[o][t].indices,i=n.length;for(s=0;s<i;++s)a[c++]=l+n[s];l+=Na.computeNumberOfVertices(e[o][t])}f=a}let m,_=new H,g=0;for(o=0;o<n;++o){if(m=e[o][t].boundingSphere,!D(m)){_=void 0;break}H.add(m.center,_,_)}if(D(_))for(H.divideByScalar(_,n,_),o=0;o<n;++o){m=e[o][t].boundingSphere;const n=H.magnitude(H.subtract(m.center,_,Em))+m.radius;n>g&&(g=n)}return new Na({attributes:u,indices:f,primitiveType:l,boundingSphere:D(_)?new $u(_,g):void 0})}hm.combineInstances=function(e){if(!D(e)||e.length<1)throw new P("instances is required and must have length greater than zero.");const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const i=e[r];D(i.geometry)?t.push(i):D(i.westHemisphereGeometry)&&D(i.eastHemisphereGeometry)&&n.push(i)}const o=[];return t.length>0&&o.push(xm(t,"geometry")),n.length>0&&(o.push(xm(n,"westHemisphereGeometry")),o.push(xm(n,"eastHemisphereGeometry"))),o};const Sm=new H,Cm=new H,Im=new H,Om=new H;hm.computeNormal=function(e){if(!D(e))throw new P("geometry is required.");if(!D(e.attributes.position)||!D(e.attributes.position.values))throw new P("geometry.attributes.position.values is required.");if(!D(e.indices))throw new P("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!=0)throw new P("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==Vr.TRIANGLES)throw new P("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const t=e.indices,n=e.attributes,i=n.position.values,o=n.position.values.length/3,r=t.length,s=new Array(o),a=new Array(r/3),c=new Array(r);let l;for(l=0;l<o;l++)s[l]={indexOffset:0,count:0,currentCount:0};let u=0;for(l=0;l<r;l+=3){const e=t[l],n=t[l+1],o=t[l+2],r=3*e,c=3*n,d=3*o;Cm.x=i[r],Cm.y=i[r+1],Cm.z=i[r+2],Im.x=i[c],Im.y=i[c+1],Im.z=i[c+2],Om.x=i[d],Om.y=i[d+1],Om.z=i[d+2],s[e].count++,s[n].count++,s[o].count++,H.subtract(Im,Cm,Im),H.subtract(Om,Cm,Om),a[u]=H.cross(Im,Om,new H),u++}let d,h=0;for(l=0;l<o;l++)s[l].indexOffset+=h,h+=s[l].count;for(u=0,l=0;l<r;l+=3){d=s[t[l]];let e=d.indexOffset+d.currentCount;c[e]=u,d.currentCount++,d=s[t[l+1]],e=d.indexOffset+d.currentCount,c[e]=u,d.currentCount++,d=s[t[l+2]],e=d.indexOffset+d.currentCount,c[e]=u,d.currentCount++,u++}const p=new Float32Array(3*o);for(l=0;l<o;l++){const e=3*l;if(d=s[l],H.clone(H.ZERO,Sm),d.count>0){for(u=0;u<d.count;u++)H.add(Sm,a[c[d.indexOffset+u]],Sm);H.equalsEpsilon(H.ZERO,Sm,V.EPSILON10)&&H.clone(a[c[d.indexOffset]],Sm)}H.equalsEpsilon(H.ZERO,Sm,V.EPSILON10)&&(Sm.z=1),H.normalize(Sm,Sm),p[e]=Sm.x,p[e+1]=Sm.y,p[e+2]=Sm.z}return e.attributes.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:p}),e};const Dm=new H,Pm=new H,Nm=new H;hm.computeTangentAndBitangent=function(e){if(!D(e))throw new P("geometry is required.");const t=e.attributes,n=e.indices;if(!D(t.position)||!D(t.position.values))throw new P("geometry.attributes.position.values is required.");if(!D(t.normal)||!D(t.normal.values))throw new P("geometry.attributes.normal.values is required.");if(!D(t.st)||!D(t.st.values))throw new P("geometry.attributes.st.values is required.");if(!D(n))throw new P("geometry.indices is required.");if(n.length<2||n.length%3!=0)throw new P("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==Vr.TRIANGLES)throw new P("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const i=e.attributes.position.values,o=e.attributes.normal.values,r=e.attributes.st.values,s=e.attributes.position.values.length/3,a=n.length,c=new Array(3*s);let l,u,d,h;for(l=0;l<c.length;l++)c[l]=0;for(l=0;l<a;l+=3){const e=n[l],t=n[l+1],o=n[l+2];u=3*e,d=3*t,h=3*o;const s=2*e,a=2*t,p=2*o,f=i[u],m=i[u+1],_=i[u+2],g=r[s],y=r[s+1],b=r[a+1]-y,v=r[p+1]-y,A=1/((r[a]-g)*v-(r[p]-g)*b),T=(v*(i[d]-f)-b*(i[h]-f))*A,w=(v*(i[d+1]-m)-b*(i[h+1]-m))*A,E=(v*(i[d+2]-_)-b*(i[h+2]-_))*A;c[u]+=T,c[u+1]+=w,c[u+2]+=E,c[d]+=T,c[d+1]+=w,c[d+2]+=E,c[h]+=T,c[h+1]+=w,c[h+2]+=E}const p=new Float32Array(3*s),f=new Float32Array(3*s);for(l=0;l<s;l++){u=3*l,d=u+1,h=u+2;const e=H.fromArray(o,u,Dm),t=H.fromArray(c,u,Nm),n=H.dot(e,t);H.multiplyByScalar(e,n,Pm),H.normalize(H.subtract(t,Pm,t),t),p[u]=t.x,p[d]=t.y,p[h]=t.z,H.normalize(H.cross(e,t,t),t),f[u]=t.x,f[d]=t.y,f[h]=t.z}return e.attributes.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:p}),e.attributes.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:f}),e};const Rm=new kt,Lm=new H,Mm=new H,Fm=new H;let Bm=new kt;function zm(e){switch(e.primitiveType){case Vr.TRIANGLE_FAN:return function(e){const t=Na.computeNumberOfVertices(e);if(t<3)throw new P("The number of vertices must be at least three.");const n=je.createTypedArray(t,3*(t-2));n[0]=1,n[1]=0,n[2]=2;let i=3;for(let o=3;o<t;++o)n[i++]=o-1,n[i++]=0,n[i++]=o;return e.indices=n,e.primitiveType=Vr.TRIANGLES,e}(e);case Vr.TRIANGLE_STRIP:return function(e){const t=Na.computeNumberOfVertices(e);if(t<3)throw new P("The number of vertices must be at least 3.");const n=je.createTypedArray(t,3*(t-2));n[0]=0,n[1]=1,n[2]=2,t>3&&(n[3]=0,n[4]=2,n[5]=3);let i=6;for(let o=3;o<t-1;o+=2)n[i++]=o,n[i++]=o-1,n[i++]=o+1,o+2<t&&(n[i++]=o,n[i++]=o+1,n[i++]=o+2);return e.indices=n,e.primitiveType=Vr.TRIANGLES,e}(e);case Vr.TRIANGLES:return function(e){if(D(e.indices))return e;const t=Na.computeNumberOfVertices(e);if(t<3)throw new P("The number of vertices must be at least three.");if(t%3!=0)throw new P("The number of vertices must be a multiple of three.");const n=je.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}(e);case Vr.LINE_STRIP:return function(e){const t=Na.computeNumberOfVertices(e);if(t<2)throw new P("The number of vertices must be at least two.");const n=je.createTypedArray(t,2*(t-1));n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return e.indices=n,e.primitiveType=Vr.LINES,e}(e);case Vr.LINE_LOOP:return function(e){const t=Na.computeNumberOfVertices(e);if(t<2)throw new P("The number of vertices must be at least two.");const n=je.createTypedArray(t,2*t);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return n[i++]=t-1,n[i]=0,e.indices=n,e.primitiveType=Vr.LINES,e}(e);case Vr.LINES:return function(e){if(D(e.indices))return e;const t=Na.computeNumberOfVertices(e);if(t<2)throw new P("The number of vertices must be at least two.");if(t%2!=0)throw new P("The number of vertices must be a multiple of 2.");const n=je.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}(e)}return e}function Um(e,t){Math.abs(e.y)<V.EPSILON6&&(e.y=t?-V.EPSILON6:V.EPSILON6)}hm.compressVertices=function(e){if(!D(e))throw new P("geometry is required.");const t=e.attributes.extrudeDirection;let n,i;if(D(t)){const o=t.values;i=o.length/3;const r=new Float32Array(2*i);let s=0;for(n=0;n<i;++n)H.fromArray(o,3*n,Lm),H.equals(Lm,H.ZERO)?s+=2:(Bm=sm.octEncodeInRange(Lm,65535,Bm),r[s++]=Bm.x,r[s++]=Bm.y);return e.attributes.compressedAttributes=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:r}),delete e.attributes.extrudeDirection,e}const o=e.attributes.normal,r=e.attributes.st,s=D(o),a=D(r);if(!s&&!a)return e;const c=e.attributes.tangent,l=e.attributes.bitangent,u=D(c),d=D(l);let h,p,f,m;s&&(h=o.values),a&&(p=r.values),u&&(f=c.values),d&&(m=l.values);i=(s?h.length:p.length)/(s?3:2);let _=i,g=a&&s?2:1;g+=u||d?1:0,_*=g;const y=new Float32Array(_);let b=0;for(n=0;n<i;++n){a&&(kt.fromArray(p,2*n,Rm),y[b++]=sm.compressTextureCoordinates(Rm));const e=3*n;s&&D(f)&&D(m)?(H.fromArray(h,e,Lm),H.fromArray(f,e,Mm),H.fromArray(m,e,Fm),sm.octPack(Lm,Mm,Fm,Rm),y[b++]=Rm.x,y[b++]=Rm.y):(s&&(H.fromArray(h,e,Lm),y[b++]=sm.octEncodeFloat(Lm)),u&&(H.fromArray(f,e,Lm),y[b++]=sm.octEncodeFloat(Lm)),d&&(H.fromArray(m,e,Lm),y[b++]=sm.octEncodeFloat(Lm)))}return e.attributes.compressedAttributes=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:g,values:y}),s&&delete e.attributes.normal,a&&delete e.attributes.st,d&&delete e.attributes.bitangent,u&&delete e.attributes.tangent,e};const km=new H;function Vm(e,t,n,i){H.add(e,H.multiplyByScalar(H.subtract(t,e,km),e.y/(e.y-t.y),km),n),H.clone(n,i),Um(n,!0),Um(i,!1)}const Hm=new H,Gm=new H,jm=new H,Wm=new H,qm={positions:new Array(7),indices:new Array(9)};function Ym(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;!function(e,t,n){if(0!==e.y&&0!==t.y&&0!==n.y)return Um(e,e.y<0),Um(t,t.y<0),void Um(n,n.y<0);const i=Math.abs(e.y),o=Math.abs(t.y),r=Math.abs(n.y);let s;s=i>o?i>r?V.sign(e.y):V.sign(n.y):o>r?V.sign(t.y):V.sign(n.y);const a=s<0;Um(e,a),Um(t,a),Um(n,a)}(e,t,n);const i=e.y<0,o=t.y<0,r=n.y<0;let s=0;s+=i?1:0,s+=o?1:0,s+=r?1:0;const a=qm.indices;1===s?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(Vm(e,t,Hm,jm),Vm(e,n,Gm,Wm),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(Vm(t,n,Hm,jm),Vm(t,e,Gm,Wm),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(Vm(n,e,Hm,jm),Vm(n,t,Gm,Wm),a[0]=2,a[3]=0,a[4]=1,a[6]=0)):2===s&&(a[2]=4,a[4]=4,a[5]=3,a[7]=5,a[8]=6,i?o?r||(Vm(n,e,Hm,jm),Vm(n,t,Gm,Wm),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(Vm(t,n,Hm,jm),Vm(t,e,Gm,Wm),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(Vm(e,t,Hm,jm),Vm(e,n,Gm,Wm),a[0]=1,a[1]=2,a[3]=1,a[6]=0));const c=qm.positions;return c[0]=e,c[1]=t,c[2]=n,c.length=3,1!==s&&2!==s||(c[3]=Hm,c[4]=Gm,c[5]=jm,c[6]=Wm,c.length=7),qm}function Xm(e,t){const n=e.attributes;if(0===n.position.values.length)return;for(const o in n)if(n.hasOwnProperty(o)&&D(n[o])&&D(n[o].values)){const e=n[o];e.values=Ca.createTypedArray(e.componentDatatype,e.values)}const i=Na.computeNumberOfVertices(e);return e.indices=je.createTypedArray(i,e.indices),t&&(e.boundingSphere=$u.fromVertices(n.position.values)),e}function Qm(e){const t=e.attributes,n={};for(const i in t)if(t.hasOwnProperty(i)&&D(t[i])&&D(t[i].values)){const e=t[i];n[i]=new Ga({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:[]})}return new Na({attributes:n,indices:[],primitiveType:e.primitiveType})}function $m(e,t,n){const i=D(e.geometry.boundingSphere);t=Xm(t,i),D(n=Xm(n,i))&&!D(t)?e.geometry=n:!D(n)&&D(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function Km(e,t){const n=new e,i=new e,o=new e;return function(r,s,a,c,l,u,d,h){const p=e.fromArray(l,r*t,n),f=e.fromArray(l,s*t,i),m=e.fromArray(l,a*t,o);e.multiplyByScalar(p,c.x,p),e.multiplyByScalar(f,c.y,f),e.multiplyByScalar(m,c.z,m);const _=e.add(p,f,p);e.add(_,m,_),h&&e.normalize(_,_),e.pack(_,u,d*t)}}const Zm=Km(K,4),Jm=Km(H,3),e_=Km(kt,2),t_=new H,n_=new H,i_=new H,o_=new H;function r_(e,t,n,i,o,r,s,a,c,l,u,d,h,p,f,m){if(!(D(r)||D(s)||D(a)||D(c)||D(l)||0!==p))return;const _=function(e,t,n,i,o){let r,s,a,c,l,u,d,h;if(L.defined("point",e),L.defined("p0",t),L.defined("p1",n),L.defined("p2",i),D(o)||(o=new H),D(t.z)){if(H.equalsEpsilon(e,t,V.EPSILON14))return H.clone(H.UNIT_X,o);if(H.equalsEpsilon(e,n,V.EPSILON14))return H.clone(H.UNIT_Y,o);if(H.equalsEpsilon(e,i,V.EPSILON14))return H.clone(H.UNIT_Z,o);r=H.subtract(n,t,am),s=H.subtract(i,t,cm),a=H.subtract(e,t,lm),c=H.dot(r,r),l=H.dot(r,s),u=H.dot(r,a),d=H.dot(s,s),h=H.dot(s,a)}else{if(kt.equalsEpsilon(e,t,V.EPSILON14))return H.clone(H.UNIT_X,o);if(kt.equalsEpsilon(e,n,V.EPSILON14))return H.clone(H.UNIT_Y,o);if(kt.equalsEpsilon(e,i,V.EPSILON14))return H.clone(H.UNIT_Z,o);r=kt.subtract(n,t,am),s=kt.subtract(i,t,cm),a=kt.subtract(e,t,lm),c=kt.dot(r,r),l=kt.dot(r,s),u=kt.dot(r,a),d=kt.dot(s,s),h=kt.dot(s,a)}o.y=d*u-l*h,o.z=c*h-l*u;const p=c*d-l*l;if(0!==p)return o.y/=p,o.z/=p,o.x=1-o.y-o.z,o}(i,H.fromArray(o,3*e,t_),H.fromArray(o,3*t,n_),H.fromArray(o,3*n,i_),o_);if(D(_)){if(D(r)&&Jm(e,t,n,_,r,d.normal.values,m,!0),D(l)){const i=H.fromArray(l,3*e,t_),o=H.fromArray(l,3*t,n_),r=H.fromArray(l,3*n,i_);let s;H.multiplyByScalar(i,_.x,i),H.multiplyByScalar(o,_.y,o),H.multiplyByScalar(r,_.z,r),H.equals(i,H.ZERO)&&H.equals(o,H.ZERO)&&H.equals(r,H.ZERO)?(s=t_,s.x=0,s.y=0,s.z=0):(s=H.add(i,o,i),H.add(s,r,s),H.normalize(s,s)),H.pack(s,d.extrudeDirection.values,3*m)}if(D(u)&&function(e,t,n,i,o,r,s){const a=o[e]*i.x,c=o[t]*i.y,l=o[n]*i.z;r[s]=a+c+l>V.EPSILON6?1:0}(e,t,n,_,u,d.applyOffset.values,m),D(s)&&Jm(e,t,n,_,s,d.tangent.values,m,!0),D(a)&&Jm(e,t,n,_,a,d.bitangent.values,m,!0),D(c)&&e_(e,t,n,_,c,d.st.values,m),p>0)for(let i=0;i<p;i++){const o=h[i];s_(e,t,n,_,m,f[o],d[o])}}}function s_(e,t,n,i,o,r,s){const a=r.componentsPerAttribute,c=r.values,l=s.values;switch(a){case 4:Zm(e,t,n,i,c,l,o,!1);break;case 3:Jm(e,t,n,i,c,l,o,!1);break;case 2:e_(e,t,n,i,c,l,o,!1);break;default:l[o]=c[e]*i.x+c[t]*i.y+c[n]*i.z}}function a_(e,t,n,i,o,r){const s=e.position.values.length/3;if(-1!==o){const a=i[o],c=n[a];return-1===c?(n[a]=s,e.position.values.push(r.x,r.y,r.z),t.push(s),s):(t.push(c),c)}return e.position.values.push(r.x,r.y,r.z),t.push(s),s}const c_={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function l_(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=D(n.normal)?n.normal.values:void 0,r=D(n.bitangent)?n.bitangent.values:void 0,s=D(n.tangent)?n.tangent.values:void 0,a=D(n.st)?n.st.values:void 0,c=D(n.extrudeDirection)?n.extrudeDirection.values:void 0,l=D(n.applyOffset)?n.applyOffset.values:void 0,u=t.indices,d=[];for(const w in n)n.hasOwnProperty(w)&&!c_[w]&&D(n[w])&&d.push(w);const h=d.length,p=Qm(t),f=Qm(t);let m,_,g,y,b;const v=[];v.length=i.length/3;const A=[];for(A.length=i.length/3,b=0;b<v.length;++b)v[b]=-1,A[b]=-1;const T=u.length;for(b=0;b<T;b+=3){const e=u[b],t=u[b+1],T=u[b+2];let w=H.fromArray(i,3*e),E=H.fromArray(i,3*t),x=H.fromArray(i,3*T);const S=Ym(w,E,x);if(D(S)&&S.positions.length>3){const w=S.positions,E=S.indices,x=E.length;for(let S=0;S<x;++S){const x=E[S],C=w[x];C.y<0?(m=f.attributes,_=f.indices,g=v):(m=p.attributes,_=p.indices,g=A),y=a_(m,_,g,u,x<3?b+x:-1,C),r_(e,t,T,C,i,o,s,r,a,c,l,m,d,h,n,y)}}else D(S)&&(w=S.positions[0],E=S.positions[1],x=S.positions[2]),w.y<0?(m=f.attributes,_=f.indices,g=v):(m=p.attributes,_=p.indices,g=A),y=a_(m,_,g,u,b,w),r_(e,t,T,w,i,o,s,r,a,c,l,m,d,h,n,y),y=a_(m,_,g,u,b+1,E),r_(e,t,T,E,i,o,s,r,a,c,l,m,d,h,n,y),y=a_(m,_,g,u,b+2,x),r_(e,t,T,x,i,o,s,r,a,c,l,m,d,h,n,y)}$m(e,f,p)}const u_=Pc.fromPointNormal(H.ZERO,H.UNIT_Y),d_=new H,h_=new H;function p_(e,t,n,i,o,r,s){if(!D(s))return;const a=H.fromArray(i,3*e,t_);H.equalsEpsilon(a,n,V.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function f_(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=D(n.applyOffset)?n.applyOffset.values:void 0,r=t.indices,s=Qm(t),a=Qm(t);let c;const l=r.length,u=[];u.length=i.length/3;const d=[];for(d.length=i.length/3,c=0;c<u.length;++c)u[c]=-1,d[c]=-1;for(c=0;c<l;c+=2){const e=r[c],t=r[c+1],n=H.fromArray(i,3*e,t_),l=H.fromArray(i,3*t,n_);let h;Math.abs(n.y)<V.EPSILON6&&(n.y<0?n.y=-V.EPSILON6:n.y=V.EPSILON6),Math.abs(l.y)<V.EPSILON6&&(l.y<0?l.y=-V.EPSILON6:l.y=V.EPSILON6);let p=s.attributes,f=s.indices,m=d,_=a.attributes,g=a.indices,y=u;const b=Pp.lineSegmentPlane(n,l,u_,i_);if(D(b)){const v=H.multiplyByScalar(H.UNIT_Y,5*V.EPSILON9,d_);n.y<0&&(H.negate(v,v),p=a.attributes,f=a.indices,m=u,_=s.attributes,g=s.indices,y=d);const A=H.add(b,v,h_);h=a_(p,f,m,r,c,n),p_(e,t,n,i,h,p,o),h=a_(p,f,m,r,-1,A),p_(e,t,A,i,h,p,o),H.negate(v,v),H.add(b,v,A),h=a_(_,g,y,r,-1,A),p_(e,t,A,i,h,_,o),h=a_(_,g,y,r,c+1,l),p_(e,t,l,i,h,_,o)}else{let p,f,m;n.y<0?(p=a.attributes,f=a.indices,m=u):(p=s.attributes,f=s.indices,m=d),h=a_(p,f,m,r,c,n),p_(e,t,n,i,h,p,o),h=a_(p,f,m,r,c+1,l),p_(e,t,l,i,h,p,o)}}$m(e,a,s)}const m_=new kt,__=new kt,g_=new H,y_=new H,b_=new H,v_=new H,A_=new H,T_=new H,w_=new K;function E_(e){const t=e.attributes,n=t.position.values,i=t.prevPosition.values,o=t.nextPosition.values,r=n.length;for(let s=0;s<r;s+=3){const e=H.unpack(n,s,g_);if(e.x>0)continue;const t=H.unpack(i,s,y_);(e.y<0&&t.y>0||e.y>0&&t.y<0)&&(s-3>0?(i[s]=n[s-3],i[s+1]=n[s-2],i[s+2]=n[s-1]):H.pack(e,i,s));const a=H.unpack(o,s,b_);(e.y<0&&a.y>0||e.y>0&&a.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):H.pack(e,o,s))}}const x_=5*V.EPSILON9,S_=V.EPSILON6;hm.splitLongitude=function(e){if(!D(e))throw new P("instance is required.");const t=e.geometry,n=t.boundingSphere;if(D(n)){if(n.center.x-n.radius>0||$u.intersectPlane(n,Pc.ORIGIN_ZX_PLANE)!==mn.INTERSECTING)return e}if(t.geometryType!==Pa.NONE)switch(t.geometryType){case Pa.POLYLINES:!function(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=n.prevPosition.values,r=n.nextPosition.values,s=n.expandAndWidth.values,a=D(n.st)?n.st.values:void 0,c=D(n.color)?n.color.values:void 0,l=Qm(t),u=Qm(t);let d,h,p,f=!1;const m=i.length/3;for(d=0;d<m;d+=4){const e=d,t=d+2,n=H.fromArray(i,3*e,g_),m=H.fromArray(i,3*t,y_);if(Math.abs(n.y)<S_)for(n.y=S_*(m.y<0?-1:1),i[3*d+1]=n.y,i[3*(d+1)+1]=n.y,h=3*e;h<3*e+12;h+=3)o[h]=i[3*d],o[h+1]=i[3*d+1],o[h+2]=i[3*d+2];if(Math.abs(m.y)<S_)for(m.y=S_*(n.y<0?-1:1),i[3*(d+2)+1]=m.y,i[3*(d+3)+1]=m.y,h=3*e;h<3*e+12;h+=3)r[h]=i[3*(d+2)],r[h+1]=i[3*(d+2)+1],r[h+2]=i[3*(d+2)+2];let _=l.attributes,g=l.indices,y=u.attributes,b=u.indices;const v=Pp.lineSegmentPlane(n,m,u_,v_);if(D(v)){f=!0;const i=H.multiplyByScalar(H.UNIT_Y,x_,A_);n.y<0&&(H.negate(i,i),_=u.attributes,g=u.indices,y=l.attributes,b=l.indices);const A=H.add(v,i,T_);_.position.values.push(n.x,n.y,n.z,n.x,n.y,n.z),_.position.values.push(A.x,A.y,A.z),_.position.values.push(A.x,A.y,A.z),_.prevPosition.values.push(o[3*e],o[3*e+1],o[3*e+2]),_.prevPosition.values.push(o[3*e+3],o[3*e+4],o[3*e+5]),_.prevPosition.values.push(n.x,n.y,n.z,n.x,n.y,n.z),_.nextPosition.values.push(A.x,A.y,A.z),_.nextPosition.values.push(A.x,A.y,A.z),_.nextPosition.values.push(A.x,A.y,A.z),_.nextPosition.values.push(A.x,A.y,A.z),H.negate(i,i),H.add(v,i,A),y.position.values.push(A.x,A.y,A.z),y.position.values.push(A.x,A.y,A.z),y.position.values.push(m.x,m.y,m.z,m.x,m.y,m.z),y.prevPosition.values.push(A.x,A.y,A.z),y.prevPosition.values.push(A.x,A.y,A.z),y.prevPosition.values.push(A.x,A.y,A.z),y.prevPosition.values.push(A.x,A.y,A.z),y.nextPosition.values.push(m.x,m.y,m.z,m.x,m.y,m.z),y.nextPosition.values.push(r[3*t],r[3*t+1],r[3*t+2]),y.nextPosition.values.push(r[3*t+3],r[3*t+4],r[3*t+5]);const T=kt.fromArray(s,2*e,m_),w=Math.abs(T.y);_.expandAndWidth.values.push(-1,w,1,w),_.expandAndWidth.values.push(-1,-w,1,-w),y.expandAndWidth.values.push(-1,w,1,w),y.expandAndWidth.values.push(-1,-w,1,-w);let E=H.magnitudeSquared(H.subtract(v,n,b_));if(E/=H.magnitudeSquared(H.subtract(m,n,b_)),D(c)){const n=K.fromArray(c,4*e,w_),i=K.fromArray(c,4*t,w_),o=V.lerp(n.x,i.x,E),r=V.lerp(n.y,i.y,E),s=V.lerp(n.z,i.z,E),a=V.lerp(n.w,i.w,E);for(h=4*e;h<4*e+8;++h)_.color.values.push(c[h]);for(_.color.values.push(o,r,s,a),_.color.values.push(o,r,s,a),y.color.values.push(o,r,s,a),y.color.values.push(o,r,s,a),h=4*t;h<4*t+8;++h)y.color.values.push(c[h])}if(D(a)){const n=kt.fromArray(a,2*e,m_),i=kt.fromArray(a,2*(d+3),__),o=V.lerp(n.x,i.x,E);for(h=2*e;h<2*e+4;++h)_.st.values.push(a[h]);for(_.st.values.push(o,n.y),_.st.values.push(o,i.y),y.st.values.push(o,n.y),y.st.values.push(o,i.y),h=2*t;h<2*t+4;++h)y.st.values.push(a[h])}p=_.position.values.length/3-4,g.push(p,p+2,p+1),g.push(p+1,p+2,p+3),p=y.position.values.length/3-4,b.push(p,p+2,p+1),b.push(p+1,p+2,p+3)}else{let e,t;for(n.y<0?(e=u.attributes,t=u.indices):(e=l.attributes,t=l.indices),e.position.values.push(n.x,n.y,n.z),e.position.values.push(n.x,n.y,n.z),e.position.values.push(m.x,m.y,m.z),e.position.values.push(m.x,m.y,m.z),h=3*d;h<3*d+12;++h)e.prevPosition.values.push(o[h]),e.nextPosition.values.push(r[h]);for(h=2*d;h<2*d+8;++h)e.expandAndWidth.values.push(s[h]),D(a)&&e.st.values.push(a[h]);if(D(c))for(h=4*d;h<4*d+16;++h)e.color.values.push(c[h]);p=e.position.values.length/3-4,t.push(p,p+2,p+1),t.push(p+1,p+2,p+3)}}f&&(E_(u),E_(l)),$m(e,u,l)}(e);break;case Pa.TRIANGLES:l_(e);break;case Pa.LINES:f_(e)}else zm(t),t.primitiveType===Vr.TRIANGLES?l_(e):t.primitiveType===Vr.LINES&&f_(e);return e};const C_=hm;function I_(e){this._ellipsoid=M(e,on.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}function O_(e,t){const n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});const r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function D_(e){const t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix;let c,l,u,d=t.length;for(c=0;c<d;++c)if(D(t[c].geometry)){u=t[c].geometry.primitiveType;break}for(c=1;c<d;++c)if(D(t[c].geometry)&&t[c].geometry.primitiveType!==u)throw new P("All instance geometries must have the same primitiveType.");if(function(e,t,n){let i=!n;const o=e.length;let r;if(!i&&o>1){const t=e[0].modelMatrix;for(r=1;r<o;++r)if(!ve.equals(t,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)D(e[r].geometry)&&C_.transformToWorldCoordinates(e[r]);else ve.multiplyTransformation(t,e[0].modelMatrix,t)}(t,a,o),!o)for(c=0;c<d;++c)D(t[c].geometry)&&C_.splitLongitude(t[c]);if(function(e){const t=e.length;for(let n=0;n<t;++n){const t=e[n];D(t.geometry)?O_(t.geometry,n):D(t.westHemisphereGeometry)&&D(t.eastHemisphereGeometry)&&(O_(t.westHemisphereGeometry,n),O_(t.eastHemisphereGeometry,n))}}(t),r)for(c=0;c<d;++c){const e=t[c];D(e.geometry)?(C_.reorderForPostVertexCache(e.geometry),C_.reorderForPreVertexCache(e.geometry)):D(e.westHemisphereGeometry)&&D(e.eastHemisphereGeometry)&&(C_.reorderForPostVertexCache(e.westHemisphereGeometry),C_.reorderForPreVertexCache(e.westHemisphereGeometry),C_.reorderForPostVertexCache(e.eastHemisphereGeometry),C_.reorderForPreVertexCache(e.eastHemisphereGeometry))}let h=C_.combineInstances(t);for(d=h.length,c=0;c<d;++c){l=h[c];const e=l.attributes;if(o)for(const t in e)e.hasOwnProperty(t)&&e[t].componentDatatype===Ca.DOUBLE&&C_.encodeAttribute(l,t,`${t}3DHigh`,`${t}3DLow`);else for(const t in e)if(e.hasOwnProperty(t)&&e[t].componentDatatype===Ca.DOUBLE){const e=`${t}3D`,i=`${t}2D`;C_.projectTo2D(l,t,e,i,n),D(l.boundingSphere)&&"position"===t&&(l.boundingSphereCV=$u.fromVertices(l.attributes.position2D.values)),C_.encodeAttribute(l,e,`${e}High`,`${e}Low`),C_.encodeAttribute(l,i,`${i}High`,`${i}Low`)}s&&C_.compressVertices(l)}if(!i){let e=[];for(d=h.length,c=0;c<d;++c)l=h[c],e=e.concat(C_.fitToUnsignedShortIndices(l));h=e}return h}function P_(e,t,n,i){let o,r,s;const a=i.length-1;if(a>=0){const e=i[a];o=e.offset+e.count,s=e.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;const c=e.length;for(let l=0;l<c;++l){const a=e[l][t];if(!D(a))continue;const c=a.indices.length;o+c>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:c}),o+=c}}Object.defineProperties(I_.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),I_.mercatorAngleToGeodeticLatitude=function(e){return V.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},I_.geodeticLatitudeToMercatorAngle=function(e){e>I_.MaximumLatitude?e=I_.MaximumLatitude:e<-I_.MaximumLatitude&&(e=-I_.MaximumLatitude);const t=Math.sin(e);return.5*Math.log((1+t)/(1-t))},I_.MaximumLatitude=I_.mercatorAngleToGeodeticLatitude(Math.PI),I_.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=I_.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return D(t)?(t.x=i,t.y=o,t.z=r,t):new H(i,o,r)},I_.prototype.unproject=function(e,t){if(!D(e))throw new P("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=I_.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return D(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new Qt(i,o,r)};const N_={};function R_(e,t){const n=e.attributes;for(const i in n)if(n.hasOwnProperty(i)){const e=n[i];D(e)&&D(e.values)&&t.push(e.values.buffer)}D(e.indices)&&t.push(e.indices.buffer)}function L_(e,t){const n=e.length,i=new Float64Array(1+19*n);let o=0;i[o++]=n;for(let r=0;r<n;r++){const t=e[r];if(ve.pack(t.modelMatrix,i,o),o+=ve.packedLength,D(t.attributes)&&D(t.attributes.offset)){const e=t.attributes.offset.value;i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2]}o+=3}return t.push(i.buffer),i}function M_(e){const t=e.length,n=1+($u.packedLength+1)*t,i=new Float32Array(n);let o=0;i[o++]=t;for(let r=0;r<t;++r){D(e[r])?(i[o++]=1,$u.pack(e[r],i,o)):i[o++]=0,o+=$u.packedLength}return i}function F_(e){const t=new Array(e[0]);let n=0,i=1;for(;i<e.length;)1===e[i++]&&(t[n]=$u.unpack(e,i)),++n,i+=$u.packedLength;return t}N_.combineGeometry=function(e){let t,n;const i=e.instances,o=i.length;let r,s,a=!1;o>0&&(t=D_(e),t.length>0&&(n=C_.createAttributeLocations(t[0]),e.createPickOffsets&&(r=function(e,t){const n=[];return P_(e,"geometry",t,n),P_(e,"westHemisphereGeometry",t,n),P_(e,"eastHemisphereGeometry",t,n),n}(i,t))),D(i[0].attributes)&&D(i[0].attributes.offset)&&(s=new Array(o),a=!0));const c=new Array(o),l=new Array(o);for(let u=0;u<o;++u){const e=i[u],t=e.geometry;D(t)&&(c[u]=t.boundingSphere,l[u]=t.boundingSphereCV,a&&(s[u]=e.geometry.offsetAttribute));const n=e.eastHemisphereGeometry,o=e.westHemisphereGeometry;D(n)&&D(o)&&(D(n.boundingSphere)&&D(o.boundingSphere)&&(c[u]=$u.union(n.boundingSphere,o.boundingSphere)),D(n.boundingSphereCV)&&D(o.boundingSphereCV)&&(l[u]=$u.union(n.boundingSphereCV,o.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:c,boundingSpheresCV:l}},N_.packCreateGeometryResults=function(e,t){const n=new Float64Array(function(e){let t=1;const n=e.length;for(let i=0;i<n;i++){const n=e[i];if(++t,!D(n))continue;const o=n.attributes;t+=7+2*$u.packedLength+(D(n.indices)?n.indices.length:0);for(const e in o)o.hasOwnProperty(e)&&D(o[e])&&(t+=5+o[e].values.length)}return t}(e)),i=[],o={},r=e.length;let s=0;n[s++]=r;for(let a=0;a<r;a++){const t=e[a],r=D(t);if(n[s++]=r?1:0,!r)continue;n[s++]=t.primitiveType,n[s++]=t.geometryType,n[s++]=M(t.offsetAttribute,-1);const c=D(t.boundingSphere)?1:0;n[s++]=c,c&&$u.pack(t.boundingSphere,n,s),s+=$u.packedLength;const l=D(t.boundingSphereCV)?1:0;n[s++]=l,l&&$u.pack(t.boundingSphereCV,n,s),s+=$u.packedLength;const u=t.attributes,d=[];for(const e in u)u.hasOwnProperty(e)&&D(u[e])&&(d.push(e),D(o[e])||(o[e]=i.length,i.push(e)));n[s++]=d.length;for(let e=0;e<d.length;e++){const t=d[e],i=u[t];n[s++]=o[t],n[s++]=i.componentDatatype,n[s++]=i.componentsPerAttribute,n[s++]=i.normalize?1:0,n[s++]=i.values.length,n.set(i.values,s),s+=i.values.length}const h=D(t.indices)?t.indices.length:0;n[s++]=h,h>0&&(n.set(t.indices,s),s+=h)}return t.push(n.buffer),{stringTable:i,packedData:n}},N_.unpackCreateGeometryResults=function(e){const t=e.stringTable,n=e.packedData;let i;const o=new Array(n[0]);let r=0,s=1;for(;s<n.length;){if(!(1===n[s++])){o[r++]=void 0;continue}const e=n[s++],a=n[s++];let c,l,u=n[s++];-1===u&&(u=void 0);1===n[s++]&&(c=$u.unpack(n,s)),s+=$u.packedLength;let d,h,p;1===n[s++]&&(l=$u.unpack(n,s)),s+=$u.packedLength;const f=new Md,m=n[s++];for(i=0;i<m;i++){const e=t[n[s++]],i=n[s++];p=n[s++];const o=0!==n[s++];d=n[s++],h=Ca.createTypedArray(i,d);for(let t=0;t<d;t++)h[t]=n[s++];f[e]=new Ga({componentDatatype:i,componentsPerAttribute:p,normalize:o,values:h})}let _;if(d=n[s++],d>0){const e=h.length/p;for(_=je.createTypedArray(e,d),i=0;i<d;i++)_[i]=n[s++]}o[r++]=new Na({primitiveType:e,geometryType:a,boundingSphere:c,boundingSphereCV:l,indices:_,attributes:f,offsetAttribute:u})}return o},N_.packCombineGeometryParameters=function(e,t){const n=e.createGeometryResults,i=n.length;for(let o=0;o<i;o++)t.push(n[o].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:L_(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof fn,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}},N_.unpackCombineGeometryParameters=function(e){const t=function(e){const t=e,n=new Array(t[0]);let i=0,o=1;for(;o<t.length;){const e=ve.unpack(t,o);let r;o+=ve.packedLength,D(t[o])&&(r={offset:new oh(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:e,attributes:r}}return n}(e.packedInstances),n=e.createGeometryResults,i=n.length;let o=0;for(let s=0;s<i;s++){const e=N_.unpackCreateGeometryResults(n[s]),i=e.length;for(let n=0;n<i;n++){const i=e[n];t[o].geometry=i,++o}}const r=on.clone(e.ellipsoid);return{instances:t,ellipsoid:r,projection:e.isGeographic?new fn(r):new I_(r),elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:ve.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}},N_.packCombineGeometryResults=function(e,t){D(e.geometries)&&function(e,t){const n=e.length;for(let i=0;i<n;++i)R_(e[i],t)}(e.geometries,t);const n=M_(e.boundingSpheres),i=M_(e.boundingSpheresCV);return t.push(n.buffer,i.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:n,boundingSpheresCV:i}},N_.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:F_(e.boundingSpheres),boundingSpheresCV:F_(e.boundingSpheresCV)}};const B_=N_,z_=Object.freeze({READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6}),U_={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3,NUMBER_OF_SHADOW_MODES:4,castShadows:function(e){return e===U_.ENABLED||e===U_.CAST_ONLY},receiveShadows:function(e){return e===U_.ENABLED||e===U_.RECEIVE_ONLY},fromCastReceive:function(e,t){return e&&t?U_.ENABLED:e?U_.CAST_ONLY:t?U_.RECEIVE_ONLY:U_.DISABLED}},k_=Object.freeze(U_);function V_(e){if(e=M(e,M.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=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._modelMatrix=new ve,this.show=M(e.show,!0),this._vertexCacheOptimize=M(e.vertexCacheOptimize,!1),this._interleave=M(e.interleave,!1),this._releaseGeometryInstances=M(e.releaseGeometryInstances,!0),this._allowPicking=M(e.allowPicking,!0),this._asynchronous=M(e.asynchronous,!0),this._compressVertices=M(e.compressVertices,!0),this.cull=M(e.cull,!0),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,D(this.rtcCenter)&&(!D(this.geometryInstances)||Array.isArray(this.geometryInstances)&&1!==this.geometryInstances.length))throw new P("Relative-to-center rendering only supports one geometry instance.");this.shadows=M(e.shadows,k_.DISABLED),this._translucent=void 0,this._state=z_.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=new Map,this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1,this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}Object.defineProperties(V_.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}}});const H_=new kt,G_=new H,j_=new K;function W_(e){const t=e.length;return 1===t?e[0]:2===t?kt.unpack(e,0,H_):3===t?H.unpack(e,0,G_):4===t?K.unpack(e,0,j_):void 0}function q_(e,t){const n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(0===o)return;const r=function(e){const t=e.length,n=[],i=e[0].attributes;let o;for(o in i)if(i.hasOwnProperty(o)&&D(i[o])){const r=i[o];let s=!0;for(let n=1;n<t;++n){const t=e[n].attributes[o];if(!D(t)||r.componentDatatype!==t.componentDatatype||r.componentsPerAttribute!==t.componentsPerAttribute||r.normalize!==t.normalize){s=!1;break}}s&&n.push(o)}return n}(i),s=r.length,a=[],c={},l={};let u;let d,h,p,f=i[0].attributes;for(d=0;d<s;++d)h=r[d],p=f[h],c[h]=d,a.push({functionName:`czm_batchTable_${h}`,componentDatatype:p.componentDatatype,componentsPerAttribute:p.componentsPerAttribute,normalize:p.normalize});-1!==r.indexOf("distanceDisplayCondition")&&(a.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:Ca.FLOAT,componentsPerAttribute:1}),l.center3DHigh=a.length-5,l.center3DLow=a.length-4,l.center2DHigh=a.length-3,l.center2DLow=a.length-2,l.radius=a.length-1),-1!==r.indexOf("offset")&&(a.push({functionName:"czm_batchTable_offset2D",componentDatatype:Ca.FLOAT,componentsPerAttribute:3}),u=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const m=a.length,_=new jf(t,a,o);for(d=0;d<o;++d){const n=i[d];f=n.attributes;for(let e=0;e<s;++e){h=r[e],p=f[h];const t=W_(p.value),n=c[h];_.setBatchedAttribute(d,n,t)}const o={primitive:M(n.pickPrimitive,e)};D(n.id)&&(o.id=n.id);const a=t.createPickId(o);e._pickIds.push(a);const l=a.color,u=j_;u.x=Ot.floatToByte(l.red),u.y=Ot.floatToByte(l.green),u.z=Ot.floatToByte(l.blue),u.w=Ot.floatToByte(l.alpha),_.setBatchedAttribute(d,m-1,u)}e._batchTable=_,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=l,e._batchTableOffsetAttribute2DIndex=u}function Y_(e){let t;return t=Array.isArray(e.values)?e.values.slice(0):new e.values.constructor(e.values),new Ga({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function X_(e){const t=e.attributes,n=new Md;for(const o in t)t.hasOwnProperty(o)&&D(t[o])&&(n[o]=Y_(t[o]));let i;if(D(e.indices)){const t=e.indices;i=Array.isArray(t)?t.slice(0):new t.constructor(t)}return new Na({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:$u.clone(e.boundingSphere)})}function Q_(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:ve.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const $_=/in\s+vec(?:3|4)\s+(.*)3DHigh;/g;function K_(e){return`${bc.replaceMain(e,"czm_non_pick_main")}\nout vec4 v_pickColor; \nvoid main() \n{ \n czm_non_pick_main(); \n v_pickColor = czm_batchTable_pickColor(batchId); \n}`}function Z_(e){return`in vec4 v_pickColor;\n${e}`}function J_(e,t){if(!e.compressVertices)return t;const n=-1!==t.search(/in\s+vec3\s+normal;/g),i=-1!==t.search(/in\s+vec2\s+st;/g);if(!n&&!i)return t;const o=-1!==t.search(/in\s+vec3\s+tangent;/g),r=-1!==t.search(/in\s+vec3\s+bitangent;/g);let s=i&&n?2:1;s+=o||r?1:0;const a="compressedAttributes",c=`in ${s>1?`vec${s}`:"float"} ${a};`;let l="",u="";if(i){l+="vec2 st;\n";u+=` st = czm_decompressTextureCoordinates(${s>1?`${a}.x`:a});\n`}n&&o&&r?(l+="vec3 normal;\nvec3 tangent;\nvec3 bitangent;\n",u+=` czm_octDecode(${a}.${i?"yz":"xy"}, normal, tangent, bitangent);\n`):(n&&(l+="vec3 normal;\n",u+=` normal = czm_octDecode(${a}${s>1?"."+(i?"y":"x"):""});\n`),o&&(l+="vec3 tangent;\n",u+=` tangent = czm_octDecode(${a}.${i&&n?"z":"y"});\n`),r&&(l+="vec3 bitangent;\n",u+=` bitangent = czm_octDecode(${a}.${i&&n?"z":"y"});\n`));let d=t;d=d.replace(/in\s+vec3\s+normal;/g,""),d=d.replace(/in\s+vec2\s+st;/g,""),d=d.replace(/in\s+vec3\s+tangent;/g,""),d=d.replace(/in\s+vec3\s+bitangent;/g,""),d=bc.replaceMain(d,"czm_non_compressed_main");return[c,l,d,`void main() \n{ \n${u} czm_non_compressed_main(); \n}`].join("\n")}function eg(e,t){const n=e.vertexAttributes;for(const i in n)if(n.hasOwnProperty(i)&&!D(t[i]))throw new P(`Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`)}function tg(e,t){return function(){return e[t]}}V_._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;null!==(i=$_.exec(t));){const a=i[1],c=`vec4 czm_compute${a[0].toUpperCase()}${a.substr(1)}()`;"vec4 czm_computePosition()"!==c&&(o+=`${c};\n`),D(e.rtcCenter)?(o+="uniform mat4 u_modifiedModelView;\n",r+="in vec4 position;\n",s+=`${c}\n{\n return u_modifiedModelView * position;\n}\n\n`,t=(t=(t=(t=t.replace(/in\s+vec(?:3|4)\s+position3DHigh;/g,"")).replace(/in\s+vec(?:3|4)\s+position3DLow;/g,"")).replace(/czm_modelViewRelativeToEye\s+\*\s+/g,"")).replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?s+=`${c}\n{\n return czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);\n}\n\n`:(r+=`in vec3 ${a}2DHigh;\nin vec3 ${a}2DLow;\n`,s+=`${c}\n{\n vec4 p;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy),\n czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow),\n czm_morphTime);\n }\n return p;\n}\n\n`)}return[o,r,t,s].join("\n")},V_._appendShowToShader=function(e,t){if(!D(e._batchTableAttributeIndices.show))return t;return`${bc.replaceMain(t,"czm_non_show_main")}\nvoid main() \n{ \n czm_non_show_main(); \n gl_Position *= czm_batchTable_show(batchId); \n}`},V_._updateColorAttribute=function(e,t,n){if(!D(e._batchTableAttributeIndices.color)&&!D(e._batchTableAttributeIndices.depthFailColor))return t;if(-1===t.search(/in\s+vec4\s+color;/g))return t;if(n&&!D(e._batchTableAttributeIndices.depthFailColor))throw new P("A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute.");let i=t;return i=i.replace(/in\s+vec4\s+color;/g,""),i=n?i.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):i.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),i},V_._updatePickColorAttribute=function(e){let t=e.replace(/in\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t},V_._appendOffsetToShader=function(e,t){if(!D(e._batchTableAttributeIndices.offset))return t;let n="in float batchId;\n";n+="in float applyOffset;";let i=t.replace(/in\s+float\s+batchId;/g,"in float batchId;\nin float applyOffset;"),o="vec4 $1 = czm_computePosition();\n";return o+=" if (czm_sceneMode == czm_sceneMode3D)\n",o+=" {\n",o+=" $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",o+=" }\n",o+=" else\n",o+=" {\n",o+=" $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",o+=" }\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"),i},V_._appendDistanceDisplayConditionToShader=function(e,t,n){if(!D(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let i="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 i+=n?" 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",i+=" 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}",`${bc.replaceMain(t,"czm_non_distanceDisplayCondition_main")}\n${i}`};const ng=Math.max(Ct.hardwareConcurrency-1,1);let ig;const og=new Qa("combineGeometry");function rg(e,t){let n,i,o,r;const s=e._instanceIds;if(e._state===z_.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const a=e._numberOfInstances=n.length,c=[];let l,u=[];for(o=0;o<a;++o){if(i=n[o].geometry,s.push(n[o].id),D(i._workerName)&&D(i._workerPath)||!D(i._workerName)&&!D(i._workerPath))throw new P("Must define either _workerName or _workerPath for asynchronous geometry.");u.push({moduleName:i._workerName,modulePath:i._workerPath,geometry:i})}if(!D(ig))for(ig=new Array(ng),o=0;o<ng;o++)ig[o]=new Qa("createGeometry");for(u=function(e,t){if(!D(e))throw new P("array is required.");if(!D(t)||t<1)throw new P("numberOfArrays must be greater than 0.");const n=[],i=e.length;let o=0;for(;o<i;){const r=Math.ceil((i-o)/t--);n.push(e.slice(o,o+r)),o+=r}return n}(u,ng),o=0;o<u.length;o++){let e=0;const t=u[o],n=t.length;for(r=0;r<n;++r)l=t[r],i=l.geometry,D(i.constructor.pack)&&(l.offset=e,e+=M(i.constructor.packedLength,i.packedLength));let s;if(e>0){const o=new Float64Array(e);for(s=[o.buffer],r=0;r<n;++r)l=t[r],i=l.geometry,D(i.constructor.pack)&&(i.constructor.pack(i,o,l.offset),l.geometry=o)}c.push(ig[o].scheduleTask({subTasks:u[o]},s))}e._state=z_.CREATING,Promise.all(c).then((function(t){e._createGeometryResults=t,e._state=z_.CREATED})).catch((function(n){Sg(e,t,z_.FAILED,n)}))}else if(e._state===z_.CREATED){const i=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const o=t.scene3DOnly,r=t.mapProjection,s=og.scheduleTask(B_.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:r.ellipsoid,projection:r,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:o,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},i),i);e._createGeometryResults=void 0,e._state=z_.COMBINING,Promise.resolve(s).then((function(n){const i=B_.unpackCombineGeometryResults(n);e._geometries=i.geometries,e._attributeLocations=i.attributeLocations,e.modelMatrix=ve.clone(i.modelMatrix,e.modelMatrix),e._pickOffsets=i.pickOffsets,e._offsetInstanceExtend=i.offsetInstanceExtend,e._instanceBoundingSpheres=i.boundingSpheres,e._instanceBoundingSpheresCV=i.boundingSpheresCV,D(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=z_.COMBINED):Sg(e,t,z_.FAILED,void 0)})).catch((function(n){Sg(e,t,z_.FAILED,n)}))}}const sg=new Ic,ag=new Qt,cg=new H,lg=new $u;const ug=new H,dg=new H;function hg(e,t){if(!D(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;const n=e._batchTableOffsetAttribute2DIndex,i=t.mapProjection,o=i.ellipsoid,r=e._batchTable,s=e._instanceBoundingSpheres,a=s.length;for(let c=0;c<a;++c){let t=s[c];if(!D(t))continue;const a=r.getBatchedAttribute(c,e._batchTableAttributeIndices.offset);if(H.equals(a,H.ZERO)){r.setBatchedAttribute(c,n,H.ZERO);continue}const l=e.modelMatrix;D(l)&&(t=$u.transform(t,l,lg));let u=t.center;u=o.scaleToGeodeticSurface(u,dg);let d=o.cartesianToCartographic(u,ag);const h=i.project(d,cg),p=H.add(a,u,ug);d=o.cartesianToCartographic(p,d);const f=i.project(d,ug),m=H.subtract(f,h,ug),_=m.x;m.x=m.z,m.z=m.y,m.y=_,r.setBatchedAttribute(c,n,m)}e._batchTableOffsetsUpdated=!0}function pg(e,t,n,i){let o,r=n.getRenderState();i?(o=ti(r,!1),o.cull={enabled:!0,face:ph.BACK},e._frontFaceRS=_s.fromCache(o),o.cull.face=ph.FRONT,e._backFaceRS=_s.fromCache(o)):(e._frontFaceRS=_s.fromCache(r),e._backFaceRS=e._frontFaceRS),o=ti(r,!1),D(e._depthFailAppearance)&&(o.depthTest.enabled=!1),D(e._depthFailAppearance)&&(r=e._depthFailAppearance.getRenderState(),o=ti(r,!1),o.depthTest.func=Gf.GREATER,i?(o.cull={enabled:!0,face:ph.BACK},e._frontFaceDepthFailRS=_s.fromCache(o),o.cull.face=ph.FRONT,e._backFaceDepthFailRS=_s.fromCache(o)):(e._frontFaceDepthFailRS=_s.fromCache(o),e._backFaceDepthFailRS=e._frontFaceRS))}function fg(e,t,n){const i=t.context,o=e._attributeLocations;let r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=V_._appendOffsetToShader(e,r),r=V_._appendShowToShader(e,r),r=V_._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=K_(r),r=V_._updateColorAttribute(e,r,!1),r=J_(e,r),r=V_._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=Z_(s),e._sp=ya.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),eg(e._sp,o),D(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=V_._appendShowToShader(e,r),r=V_._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=K_(r),r=V_._updateColorAttribute(e,r,!0),r=J_(e,r),r=V_._modifyShaderPosition(e,r,t.scene3DOnly),r=function(e){let t=bc.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n gl_Position = czm_depthClamp(gl_Position);}\n",t}(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=Z_(s),s=function(e){let t=bc.replaceMain(e,"czm_non_depth_clamp_main");return t+="void main() {\n czm_non_depth_clamp_main();\n #if defined(LOG_DEPTH)\n czm_writeLogDepth();\n #else\n czm_writeDepthClamp();\n #endif\n}\n",t}(s),e._spDepthFail=ya.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),eg(e._spDepthFail,o))}const mg=new ve,_g=new H;function gg(e,t,n,i){const o=D(n)?n._uniforms:void 0,r={},s=t.uniforms;if(D(s))for(const c in s)if(s.hasOwnProperty(c)){if(D(o)&&D(o[c]))throw new P(`Appearance and material have a uniform with the same name: ${c}`);r[c]=tg(s,c)}let a=ni(r,o);return a=e._batchTable.getUniformMapCallback()(a),D(e.rtcCenter)&&(a.u_modifiedModelView=function(){const t=i.context.uniformState.view;return ve.multiply(t,e._modelMatrix,mg),ve.multiplyByPoint(mg,e.rtcCenter,_g),ve.setTranslation(mg,_g,mg),mg}),a}function yg(e,t,n,i,o,r,s,a){const c=gg(e,t,n,a);let l;D(e._depthFailAppearance)&&(l=gg(e,e._depthFailAppearance,e._depthFailAppearance.material,a));const u=i?zt.TRANSLUCENT:zt.OPAQUE;let d=o?2:1;d*=D(e._depthFailAppearance)?2:1,r.length=e._va.length*d;const h=r.length;let p=0;for(let f=0;f<h;++f){let t;o&&(t=r[f],D(t)||(t=r[f]=new Kr({owner:e,primitiveType:e._primitiveType})),t.vertexArray=e._va[p],t.renderState=e._backFaceRS,t.shaderProgram=e._sp,t.uniformMap=c,t.pass=u,++f),t=r[f],D(t)||(t=r[f]=new Kr({owner:e,primitiveType:e._primitiveType})),t.vertexArray=e._va[p],t.renderState=e._frontFaceRS,t.shaderProgram=e._sp,t.uniformMap=c,t.pass=u,D(e._depthFailAppearance)&&(o&&(++f,t=r[f],D(t)||(t=r[f]=new Kr({owner:e,primitiveType:e._primitiveType})),t.vertexArray=e._va[p],t.renderState=e._backFaceDepthFailRS,t.shaderProgram=e._spDepthFail,t.uniformMap=l,t.pass=u),++f,t=r[f],D(t)||(t=r[f]=new Kr({owner:e,primitiveType:e._primitiveType})),t.vertexArray=e._va[p],t.renderState=e._frontFaceDepthFailRS,t.shaderProgram=e._spDepthFail,t.uniformMap=l,t.pass=u),++p}}function bg(e,t,n,i,o,r,s,a){if(t.mode!==gl.SCENE3D&&!ve.equals(o,ve.IDENTITY))throw new P("Primitive.modelMatrix is only supported in 3D mode.");let c;V_._updateBoundingVolumes(e,t,o),t.mode===gl.SCENE3D?c=e._boundingSphereWC:t.mode===gl.COLUMBUS_VIEW?c=e._boundingSphereCV:t.mode===gl.SCENE2D&&D(e._boundingSphere2D)?c=e._boundingSphere2D:D(e._boundingSphereMorph)&&(c=e._boundingSphereMorph);const l=t.commandList,u=t.passes;if(u.render||u.pick){const t=e.allowPicking,i=k_.castShadows(e.shadows),u=k_.receiveShadows(e.shadows),d=n.length;let h=a?2:1;h*=D(e._depthFailAppearance)?2:1;for(let e=0;e<d;++e){const a=Math.floor(e/h),d=n[e];d.modelMatrix=o,d.boundingVolume=c[a],d.cull=r,d.debugShowBoundingVolume=s,d.castShadows=i,d.receiveShadows=u,d.pickId=t?"v_pickColor":void 0,l.push(d)}}}V_._updateBoundingVolumes=function(e,t,n,i){let o,r,s;if(i||!ve.equals(n,e._modelMatrix))for(ve.clone(n,e._modelMatrix),r=e._boundingSpheres.length,o=0;o<r;++o)s=e._boundingSpheres[o],D(s)&&(e._boundingSphereWC[o]=$u.transform(s,n,e._boundingSphereWC[o]),t.scene3DOnly||(e._boundingSphere2D[o]=$u.clone(e._boundingSphereCV[o],e._boundingSphere2D[o]),e._boundingSphere2D[o].center.x=0,e._boundingSphereMorph[o]=$u.union(e._boundingSphereWC[o],e._boundingSphereCV[o])));const a=e.appearance.pixelSize;if(D(a))for(r=e._boundingSpheres.length,o=0;o<r;++o){s=e._boundingSpheres[o];const n=e._boundingSphereWC[o],i=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;n.radius=s.radius+i}},V_.prototype.update=function(e){if(!D(this.geometryInstances)&&0===this._va.length||D(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&0===this.geometryInstances.length||!D(this.appearance)||e.mode!==gl.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(D(this._error))throw this._error;if(D(this.rtcCenter)&&!e.scene3DOnly)throw new P("RTC rendering is only available for 3D only scenes.");if(this._state===z_.FAILED)return;const t=e.context;if(D(this._batchTable)||q_(this,t),this._batchTable.attributes.length>0){if(0===rs.maximumVertexTextureImageUnits)throw new be("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!==z_.COMPLETE&&this._state!==z_.COMBINED&&(this.asynchronous?rg(this,e):function(e,t){const n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds;let s,a,c=0;for(a=0;a<i;a++){s=n[a];const e=s.geometry;let t;t=D(e.attributes)&&D(e.primitiveType)?X_(e):e.constructor.createGeometry(e),o[c++]=Q_(s,t),r.push(s.id)}o.length=c;const l=t.scene3DOnly,u=t.mapProjection,d=B_.combineGeometry({instances:o,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=d.geometries,e._attributeLocations=d.attributeLocations,e.modelMatrix=ve.clone(d.modelMatrix,e.modelMatrix),e._pickOffsets=d.pickOffsets,e._offsetInstanceExtend=d.offsetInstanceExtend,e._instanceBoundingSpheres=d.boundingSpheres,e._instanceBoundingSpheresCV=d.boundingSpheresCV,D(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=z_.COMBINED):Sg(e,t,z_.FAILED,void 0)}(this,e)),this._state===z_.COMBINED&&(function(e,t){if(!D(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;const n=e._batchTableBoundingSphereAttributeIndices,i=n.center3DHigh,o=n.center3DLow,r=n.center2DHigh,s=n.center2DLow,a=n.radius,c=t.mapProjection,l=c.ellipsoid,u=e._batchTable,d=e._instanceBoundingSpheres,h=d.length;for(let p=0;p<h;++p){let n=d[p];if(!D(n))continue;const h=e.modelMatrix;D(h)&&(n=$u.transform(n,h,lg));const f=n.center,m=n.radius;let _=Ic.fromCartesian(f,sg);if(u.setBatchedAttribute(p,i,_.high),u.setBatchedAttribute(p,o,_.low),!t.scene3DOnly){const e=l.cartesianToCartographic(f,ag),t=c.project(e,cg);_=Ic.fromCartesian(t,sg),u.setBatchedAttribute(p,r,_.high),u.setBatchedAttribute(p,s,_.low)}u.setBatchedAttribute(p,a,m)}e._batchTableBoundingSpheresUpdated=!0}(this,e),hg(this,e),function(e,t){const n=e._attributeLocations,i=e._geometries,o=t.scene3DOnly,r=t.context,s=[],a=i.length;for(let c=0;c<a;++c){const a=i[c];if(s.push(kl.fromGeometry({context:r,geometry:a,attributeLocations:n,bufferUsage:qe.STATIC_DRAW,interleave:e._interleave})),D(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,a);else if(e._boundingSpheres.push($u.clone(a.boundingSphere)),e._boundingSphereWC.push(new $u),!o){const t=a.boundingSphereCV.center,n=t.x,i=t.y,o=t.z;t.x=o,t.y=n,t.z=i,e._boundingSphereCV.push($u.clone(a.boundingSphereCV)),e._boundingSphere2D.push(new $u),e._boundingSphereMorph.push(new $u)}}e._va=s,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,Sg(e,t,z_.COMPLETE,void 0)}(this,e)),!this.show||this._state!==z_.COMPLETE)return;this._batchTableOffsetsUpdated||hg(this,e),this._recomputeBoundingSpheres&&function(e,t){const n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!D(n))return void(e._recomputeBoundingSpheres=!1);let i;const o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length;let a=e._tempBoundingSpheres;if(!D(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new $u;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let t=a[i];const s=e._batchTable.getBatchedAttribute(i,n,new H);t=r[i].clone(t),Tg(t,s,o[i])}const c=[],l=[],u=[];for(i=0;i<s;++i){const e=a[i];e.center.x-e.radius>0||$u.intersectPlane(e,Pc.ORIGIN_ZX_PLANE)!==mn.INTERSECTING?c.push(e):(l.push(e),u.push(e))}let d=c[0],h=u[0],p=l[0];for(i=1;i<c.length;i++)d=$u.union(d,c[i]);for(i=1;i<u.length;i++)h=$u.union(h,u[i]);for(i=1;i<l.length;i++)p=$u.union(p,l[i]);const f=[];for(D(d)&&f.push(d),D(h)&&f.push(h),D(p)&&f.push(p),i=0;i<f.length;i++){const n=f[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=n,e._boundingSphereCV[i]=$u.projectTo2D(n,t.mapProjection,e._boundingSphereCV[i])}V_._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}(this,e);const n=this.appearance,i=n.material;let o=!1,r=!1;this._appearance!==n?(this._appearance=n,this._material=i,o=!0,r=!0):this._material!==i&&(this._material=i,r=!0);const s=this.depthFailAppearance,a=D(s)?s.material:void 0;this._depthFailAppearance!==s?(this._depthFailAppearance=s,this._depthFailMaterial=a,o=!0,r=!0):this._depthFailMaterial!==a&&(this._depthFailMaterial=a,r=!0);const c=this._appearance.isTranslucent();this._translucent!==c&&(this._translucent=c,o=!0),D(this._material)&&this._material.update(t);const l=n.closed&&c;if(o){M(this._createRenderStatesFunction,pg)(this,t,n,l)}if(r){M(this._createShaderProgramFunction,fg)(this,e,n)}if(o||r){M(this._createCommandsFunction,yg)(this,n,i,c,l,this._colorCommands,this._pickCommands,e)}M(this._updateAndQueueCommandsFunction,bg)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,l)};const vg=new $u,Ag=new $u;function Tg(e,t,n){if(n===Fd.TOP){const n=$u.clone(e,vg),i=$u.clone(e,Ag);i.center=H.add(i.center,t,i.center),e=$u.union(n,i,e)}else n===Fd.ALL&&(e.center=H.add(e.center,t,e.center));return e}function wg(e,t,n){return function(){const i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=Ca.createTypedArray(o.componentDatatype,r);return D(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function Eg(e,t,n,i,o){return function(r){if(!D(r)||!D(r.length)||r.length<1||r.length>4)throw new P("value must be and array with length between 1 and 4.");const s=W_(r);e.setBatchedAttribute(t,n,s),"offset"===o&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const xg=new H;function Sg(e,t,n,i){e._error=i,e._state=n,t.afterRender.push((function(){e._ready=e._state===z_.COMPLETE||e._state===z_.FAILED}))}function Cg(e){if(!D((e=M(e,M.EMPTY_OBJECT)).componentDatatype))throw new P("options.componentDatatype is required.");if(!D(e.componentsPerAttribute))throw new P("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new P("options.componentsPerAttribute must be between 1 and 4.");if(!D(e.value))throw new P("options.value is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=M(e.normalize,!1),this.value=e.value}V_.prototype.getGeometryInstanceAttributes=function(e){if(!D(e))throw new P("id is required");if(!D(this._batchTable))throw new P("must call update before calling getGeometryInstanceAttributes");let t=this._perInstanceAttributeCache.get(e);if(D(t))return t;let n=-1;const i=this._lastPerInstanceAttributeIndex,o=this._instanceIds,r=o.length;for(let l=0;l<r;++l){const t=(i+l)%r;if(e===o[t]){n=t;break}}if(-1===n)return;const s=this._batchTable,a=this._batchTableAttributeIndices;t={};const c={};for(const l in a)if(a.hasOwnProperty(l)){const e=a[l];c[l]={get:wg(s,n,e),set:Eg(s,n,e,this,l)}}return function(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(D(i)){i=i.clone();const o=e.modelMatrix,r=t.offset;D(r)&&Tg(i,H.fromArray(r.get(),0,xg),e._offsetInstanceExtend[n]),D(o)&&(i=$u.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}(this,c,n),function(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}(this,c,n),Object.defineProperties(t,c),this._lastPerInstanceAttributeIndex=n,this._perInstanceAttributeCache.set(e,t),t},V_.prototype.isDestroyed=function(){return!1},V_.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();const n=this._va;for(e=n.length,t=0;t<e;++t)n[t].destroy();this._va=void 0;const i=this._pickIds;for(e=i.length,t=0;t<e;++t)i[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,He(this)};const Ig="#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nin vec4 v_sphericalExtents;\n#else // SPHERICAL\nin vec2 v_inversePlaneExtents;\nin vec4 v_westPlane;\nin vec4 v_southPlane;\n#endif // SPHERICAL\nin vec3 v_uvMinAndSphericalLongitudeRotation;\nin vec3 v_uMaxAndInverseDistance;\nin vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n\n#ifdef PER_INSTANCE_COLOR\nin vec4 v_color;\n#endif\n\n#ifdef NORMAL_EC\nvec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\n return eyeCoordinate.xyz / eyeCoordinate.w;\n}\n\nvec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {\n vec2 glFragCoordXY = gl_FragCoord.xy;\n // Sample depths at both offset and negative offset\n float upOrRightLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\n float downOrLeftLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\n // Explicitly evaluate both paths\n // Necessary for multifrustum and for edges of the screen\n bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\n float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\n float useDownOrLeft = float(useUpOrRight == 0.0);\n vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\n vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\n return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n}\n#endif // NORMAL_EC\n\nvoid main(void)\n{\n#ifdef REQUIRES_EC\n float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n#endif\n\n#ifdef REQUIRES_WC\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n#endif\n\n#ifdef TEXTURE_COORDINATES\n vec2 uv;\n#ifdef SPHERICAL\n // Treat world coords as a sphere normal for spherical coordinates\n vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);\n sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;\n sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\n uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;\n uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;\n#else // SPHERICAL\n // Unpack planes and transform to eye space\n uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;\n uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;\n#endif // SPHERICAL\n#endif // TEXTURE_COORDINATES\n\n#ifdef PICK\n#ifdef CULL_FRAGMENTS\n // When classifying translucent geometry, logDepthOrDepth == 0.0\n // indicates a region that should not be classified, possibly due to there\n // being opaque pixels there in another buffer.\n // Check for logDepthOrDepth != 0.0 to make sure this should be classified.\n if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {\n out_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource\n czm_writeDepthClamp();\n }\n#else // CULL_FRAGMENTS\n out_FragColor.a = 1.0;\n#endif // CULL_FRAGMENTS\n#else // PICK\n\n#ifdef CULL_FRAGMENTS\n // When classifying translucent geometry, logDepthOrDepth == 0.0\n // indicates a region that should not be classified, possibly due to there\n // being opaque pixels there in another buffer.\n if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {\n discard;\n }\n#endif\n\n#ifdef NORMAL_EC\n // Compute normal by sampling adjacent pixels in 2x2 block in screen space\n vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));\n vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));\n vec3 normalEC = normalize(cross(leftRight, downUp));\n#endif\n\n\n#ifdef PER_INSTANCE_COLOR\n\n vec4 color = czm_gammaCorrect(v_color);\n#ifdef FLAT\n out_FragColor = color;\n#else // FLAT\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = -eyeCoordinate.xyz;\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\n\n // Premultiply alpha. Required for classification primitives on translucent globe.\n out_FragColor.rgb *= out_FragColor.a;\n\n#else // PER_INSTANCE_COLOR\n\n // Material support.\n // USES_ is distinct from REQUIRES_, because some things are dependencies of each other or\n // dependencies for culling but might not actually be used by the material.\n\n czm_materialInput materialInput;\n\n#ifdef USES_NORMAL_EC\n materialInput.normalEC = normalEC;\n#endif\n\n#ifdef USES_POSITION_TO_EYE_EC\n materialInput.positionToEyeEC = -eyeCoordinate.xyz;\n#endif\n\n#ifdef USES_TANGENT_TO_EYE\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);\n#endif\n\n#ifdef USES_ST\n // Remap texture coordinates from computed (approximately aligned with cartographic space) to the desired\n // texture coordinate system, which typically forms a tight oriented bounding box around the geometry.\n // Shader is provided a set of reference points for remapping.\n materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;\n materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;\n#endif\n\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else // FLAT\n out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\n\n // Premultiply alpha. Required for classification primitives on translucent globe.\n out_FragColor.rgb *= out_FragColor.a;\n\n#endif // PER_INSTANCE_COLOR\n czm_writeDepthClamp();\n#endif // PICK\n}\n";function Og(e,t,n){L.typeOf.bool("extentsCulling",e),L.typeOf.bool("planarExtents",t),L.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new Lg;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const o=new Lg;if(o.requiresTextureCoordinates=e,n instanceof Ih)i.requiresNormalEC=!n.flat;else{const e=`${n.material.shaderSource}\n${n.fragmentShaderSource}`;i.normalEC=-1!==e.indexOf("materialInput.normalEC")||-1!==e.indexOf("czm_getDefaultMaterial"),i.positionToEyeEC=-1!==e.indexOf("materialInput.positionToEyeEC"),i.tangentToEyeMatrix=-1!==e.indexOf("materialInput.tangentToEyeMatrix"),i.st=-1!==e.indexOf("materialInput.st")}this._colorShaderDependencies=i,this._pickShaderDependencies=o,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}Og.prototype.createFragmentShader=function(e){L.typeOf.bool("columbusView2D",e);const t=this._appearance,n=this._colorShaderDependencies,i=[];e||this._planarExtents||i.push("SPHERICAL"),n.requiresEC&&i.push("REQUIRES_EC"),n.requiresWC&&i.push("REQUIRES_WC"),n.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),n.requiresNormalEC&&i.push("NORMAL_EC"),t instanceof Ih&&i.push("PER_INSTANCE_COLOR"),n.normalEC&&i.push("USES_NORMAL_EC"),n.positionToEyeEC&&i.push("USES_POSITION_TO_EYE_EC"),n.tangentToEyeMatrix&&i.push("USES_TANGENT_TO_EYE"),n.st&&i.push("USES_ST"),t.flat&&i.push("FLAT");let o="";return t instanceof Ih||(o=t.material.shaderSource),new bc({defines:i,sources:[o,Ig]})},Og.prototype.createPickFragmentShader=function(e){L.typeOf.bool("columbusView2D",e);const t=this._pickShaderDependencies,n=["PICK"];return e||this._planarExtents||n.push("SPHERICAL"),t.requiresEC&&n.push("REQUIRES_EC"),t.requiresWC&&n.push("REQUIRES_WC"),t.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),new bc({defines:n,sources:[Ig],pickColorQualifier:"in"})},Og.prototype.createVertexShader=function(e,t,n,i){return L.defined("defines",e),L.typeOf.string("vertexShaderSource",t),L.typeOf.bool("columbusView2D",n),L.defined("mapProjection",i),Rg(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)},Og.prototype.createPickVertexShader=function(e,t,n,i){return L.defined("defines",e),L.typeOf.string("vertexShaderSource",t),L.typeOf.bool("columbusView2D",n),L.defined("mapProjection",i),Rg(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const Dg=new H,Pg=new Qt,Ng={high:0,low:0};function Rg(e,t,n,i,o,r,s,a){const c=i.slice();if(""===a.eastMostYhighDefine){const e=Pg;e.longitude=V.PI,e.latitude=0,e.height=0;const t=s.project(e,Dg);let n=Ic.encode(t.x,Ng);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${n.high.toFixed(`${n.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${n.low.toFixed(`${n.low}`.length+1)}`;const i=Pg;i.longitude=-V.PI,i.latitude=0,i.height=0;const o=s.project(i,Dg);n=Ic.encode(o.x,Ng),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${n.high.toFixed(`${n.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${n.low.toFixed(`${n.low}`.length+1)}`}return n&&(c.push(a.eastMostYhighDefine),c.push(a.eastMostYlowDefine),c.push(a.westMostYhighDefine),c.push(a.westMostYlowDefine)),D(r)&&r instanceof Ih&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new bc({defines:c,sources:[o]})}function Lg(){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 Mg(e,t,n){return Math.abs((t.y-e.y)*n.x-(t.x-e.x)*n.y+t.x*e.y-t.y*e.x)/kt.distance(t,e)}Object.defineProperties(Lg.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}}});const Fg=[new kt,new kt,new kt,new kt];function Bg(e,t){const n=Fg,i=kt.unpack(t,0,n[0]),o=kt.unpack(t,2,n[1]),r=kt.unpack(t,4,n[2]);e.uMaxVmax=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});const s=1/Mg(i,o,r),a=1/Mg(i,r,o);e.uvMinAndExtents=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}const zg=new Qt,Ug=new H,kg=new H,Vg=new H,Hg={high:0,low:0};function Gg(e,t,n){const i=zg;i.height=0,i.longitude=e.west,i.latitude=e.south;const o=t.project(i,Ug);i.latitude=e.north;const r=t.project(i,kg);i.longitude=e.east,i.latitude=e.south;const s=t.project(i,Vg),a=[0,0,0,0],c=[0,0,0,0];let l=Ic.encode(o.x,Hg);a[0]=l.high,c[0]=l.low,l=Ic.encode(o.y,Hg),a[1]=l.high,c[1]=l.low,l=Ic.encode(r.y,Hg),a[2]=l.high,c[2]=l.low,l=Ic.encode(s.x,Hg),a[3]=l.high,c[3]=l.low,n.planes2D_HIGH=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}const jg=new ve,Wg=new ve,qg=new H,Yg=new Qt,Xg=[new Qt,new Qt,new Qt,new Qt,new Qt,new Qt,new Qt,new Qt];const Qg=new H,$g=new H,Kg=new Ic;Og.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){L.typeOf.object("boundingRectangle",e),L.defined("textureCoordinateRotationPoints",t),L.typeOf.object("ellipsoid",n),L.typeOf.object("projection",i);const r=Ug,s=Qg,a=$g;!function(e,t,n,i,o,r){const s=Ir.center(e,Yg);s.height=n;const a=Qt.toCartesian(s,t,qg),c=Cr.eastNorthUpToFixedFrame(a,t,jg),l=ve.inverse(c,Wg),u=e.west,d=e.east,h=e.north,p=e.south,f=Xg;f[0].latitude=p,f[0].longitude=u,f[1].latitude=h,f[1].longitude=u,f[2].latitude=h,f[2].longitude=d,f[3].latitude=p,f[3].longitude=d;const m=.5*(u+d),_=.5*(h+p);f[4].latitude=p,f[4].longitude=m,f[5].latitude=h,f[5].longitude=m,f[6].latitude=_,f[6].longitude=u,f[7].latitude=_,f[7].longitude=d;let g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;for(let E=0;E<8;E++){f[E].height=n;const e=Qt.toCartesian(f[E],t,qg);ve.multiplyByPoint(l,e,e),e.z=0,g=Math.min(g,e.x),y=Math.max(y,e.x),b=Math.min(b,e.y),v=Math.max(v,e.y)}const A=i;A.x=g,A.y=b,A.z=0,ve.multiplyByPoint(c,A,A);const T=o;T.x=y,T.y=b,T.z=0,ve.multiplyByPoint(c,T,T),H.subtract(T,A,o);const w=r;w.x=g,w.y=v,w.z=0,ve.multiplyByPoint(c,w,w),H.subtract(w,A,r)}(e,n,M(o,0),r,s,a);const c={};Bg(c,t);const l=Ic.fromCartesian(r,Kg);return c.southWest_HIGH=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,normalize:!1,value:H.pack(l.high,[0,0,0])}),c.southWest_LOW=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,normalize:!1,value:H.pack(l.low,[0,0,0])}),c.eastward=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,normalize:!1,value:H.pack(s,[0,0,0])}),c.northward=new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,normalize:!1,value:H.pack(a,[0,0,0])}),Gg(e,i,c),c};const Zg=new H;function Jg(e,t,n,i){const o=zg;o.latitude=e,o.longitude=t,o.height=0;const r=Qt.toCartesian(o,n,Zg),s=Math.sqrt(r.x*r.x+r.y*r.y),a=V.fastApproximateAtan2(s,r.z),c=V.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=c,i}const ey=new kt;Og.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){L.typeOf.object("boundingRectangle",e),L.defined("textureCoordinateRotationPoints",t),L.typeOf.object("ellipsoid",n),L.typeOf.object("projection",i);const o=Jg(e.south,e.west,n,ey);let r=o.x,s=o.y;const a=Jg(e.north,e.east,n,ey);let c=a.x,l=a.y,u=0;s>l&&(u=V.PI-s,s=-V.PI,l+=u),r-=V.EPSILON5,s-=V.EPSILON5,c+=V.EPSILON5,l+=V.EPSILON5;const d=1/(l-s),h=1/(c-r),p={sphericalExtents:new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,h,d]}),longitudeRotation:new Cg({componentDatatype:Ca.FLOAT,componentsPerAttribute:1,normalize:!1,value:[u]})};return Bg(p,t),Gg(e,i,p),p},Og.hasAttributesForTextureCoordinatePlanes=function(e){return D(e.southWest_HIGH)&&D(e.southWest_LOW)&&D(e.northward)&&D(e.eastward)&&D(e.planes2D_HIGH)&&D(e.planes2D_LOW)&&D(e.uMaxVmax)&&D(e.uvMinAndExtents)},Og.hasAttributesForSphericalExtents=function(e){return D(e.sphericalExtents)&&D(e.longitudeRotation)&&D(e.planes2D_HIGH)&&D(e.planes2D_LOW)&&D(e.uMaxVmax)&&D(e.uvMinAndExtents)},Og.shouldUseSphericalCoordinates=function(e){return L.typeOf.object("rectangle",e),function(e){return Math.max(e.width,e.height)>Og.MAX_WIDTH_FOR_PLANAR_EXTENTS}(e)},Og.MAX_WIDTH_FOR_PLANAR_EXTENTS=V.toRadians(1);const ty={NEVER:Me.NEVER,LESS:Me.LESS,EQUAL:Me.EQUAL,LESS_OR_EQUAL:Me.LEQUAL,GREATER:Me.GREATER,NOT_EQUAL:Me.NOTEQUAL,GREATER_OR_EQUAL:Me.GEQUAL,ALWAYS:Me.ALWAYS},ny=Object.freeze(ty),iy={ZERO:Me.ZERO,KEEP:Me.KEEP,REPLACE:Me.REPLACE,INCREMENT:Me.INCR,DECREMENT:Me.DECR,INVERT:Me.INVERT,INCREMENT_WRAP:Me.INCR_WRAP,DECREMENT_WRAP:Me.DECR_WRAP},oy=Object.freeze(iy),ry={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15,setCesium3DTileBit:function(){return{enabled:!0,frontFunction:ny.ALWAYS,frontOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.REPLACE},backFunction:ny.ALWAYS,backOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.REPLACE},reference:ry.CESIUM_3D_TILE_MASK,mask:ry.CESIUM_3D_TILE_MASK}}},sy=Object.freeze(ry);function ay(e){const t=(e=M(e,M.EMPTY_OBJECT)).geometryInstances;this.geometryInstances=t,this.show=M(e.show,!0),this.classificationType=M(e.classificationType,Vf.BOTH),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=M(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=M(e._extruded,!1),this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:M(e.vertexCacheOptimize,!1),interleave:M(e.interleave,!1),releaseGeometryInstances:M(e.releaseGeometryInstances,!0),allowPicking:M(e.allowPicking,!0),asynchronous:M(e.asynchronous,!0),compressVertices:M(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}function cy(e,t){const n=t?ny.EQUAL:ny.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:oy.KEEP,zFail:oy.DECREMENT_WRAP,zPass:oy.KEEP},backFunction:n,backOperation:{fail:oy.KEEP,zFail:oy.INCREMENT_WRAP,zPass:oy.KEEP},reference:sy.CESIUM_3D_TILE_MASK,mask:sy.CESIUM_3D_TILE_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Gf.LESS_OR_EQUAL},depthMask:!1}}function ly(e){return{stencilTest:{enabled:e,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},backFunction:ny.NOT_EQUAL,backOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},reference:0,mask:sy.CLASSIFICATION_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:dh.PRE_MULTIPLIED_ALPHA_BLEND}}Object.defineProperties(ay.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}}),ay.isSupported=function(e){return e.context.stencilBuffer};const uy={stencilTest:{enabled:!0,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},backFunction:ny.NOT_EQUAL,backOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},reference:0,mask:sy.CLASSIFICATION_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function dy(e,t){const n=t.context,i=e._primitive;let o='in vec3 position3DHigh;\nin vec3 position3DLow;\nin float batchId;\n\n#ifdef EXTRUDED_GEOMETRY\nin vec3 extrudeDirection;\n\nuniform float u_globeMinimumAltitude;\n#endif // EXTRUDED_GEOMETRY\n\n#ifdef PER_INSTANCE_COLOR\nout vec4 v_color;\n#endif // PER_INSTANCE_COLOR\n\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nout vec4 v_sphericalExtents;\n#else // SPHERICAL\nout vec2 v_inversePlaneExtents;\nout vec4 v_westPlane;\nout vec4 v_southPlane;\n#endif // SPHERICAL\nout vec3 v_uvMinAndSphericalLongitudeRotation;\nout vec3 v_uMaxAndInverseDistance;\nout vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n\nvoid main()\n{\n vec4 position = czm_computePosition();\n\n#ifdef EXTRUDED_GEOMETRY\n float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\n delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\n\n //extrudeDirection is zero for the top layer\n position = position + vec4(extrudeDirection * delta, 0.0);\n#endif\n\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\n v_sphericalExtents = czm_batchTable_sphericalExtents(batchId);\n v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);\n#else // SPHERICAL\n#ifdef COLUMBUS_VIEW_2D\n vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);\n vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);\n\n // If the primitive is split across the IDL (planes2D_high.x > planes2D_high.w):\n // - If this vertex is on the east side of the IDL (position3DLow.y > 0.0, comparison with position3DHigh may produce artifacts)\n // - existing "east" is on the wrong side of the world, far away (planes2D_high/low.w)\n // - so set "east" as beyond the eastmost extent of the projection (idlSplitNewPlaneHiLow)\n vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));\n bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;\n planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);\n planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);\n\n // - else, if this vertex is on the west side of the IDL (position3DLow.y < 0.0)\n // - existing "west" is on the wrong side of the world, far away (planes2D_high/low.x)\n // - so set "west" as beyond the westmost extent of the projection (idlSplitNewPlaneHiLow)\n idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;\n idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));\n planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);\n planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);\n\n vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;\n vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;\n vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;\n#else // COLUMBUS_VIEW_2D\n // 3D case has smaller "plane extents," so planes encoded as a 64 bit position and 2 vec3s for distances/direction\n vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;\n vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;\n vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;\n#endif // COLUMBUS_VIEW_2D\n\n vec3 eastWard = southEastCorner - southWestCorner;\n float eastExtent = length(eastWard);\n eastWard /= eastExtent;\n\n vec3 northWard = northWestCorner - southWestCorner;\n float northExtent = length(northWard);\n northWard /= northExtent;\n\n v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));\n v_southPlane = vec4(northWard, -dot(northWard, southWestCorner));\n v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);\n#endif // SPHERICAL\n vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);\n vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);\n\n v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);\n v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);\n v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;\n#endif // TEXTURE_COORDINATES\n\n#ifdef PER_INSTANCE_COLOR\n v_color = czm_batchTable_color(batchId);\n#endif\n\n gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);\n}\n';o=e._primitive._batchTable.getVertexShaderCallback()(o),o=V_._appendDistanceDisplayConditionToShader(i,o),o=V_._modifyShaderPosition(e,o,t.scene3DOnly),o=V_._updateColorAttribute(i,o);const r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=function(e,t){if(!e.compressVertices)return t;if(-1!==t.search(/in\s+vec3\s+extrudeDirection;/g)){const e="compressedAttributes",n=`in vec2 ${e};`,i="vec3 extrudeDirection;\n",o=` extrudeDirection = czm_octDecode(${e}, 65535.0);\n`;let r=t;return r=r.replace(/in\s+vec3\s+extrudeDirection;/g,""),r=bc.replaceMain(r,"czm_non_compressed_main"),[n,i,r,`void main() \n{ \n${o} czm_non_compressed_main(); \n}`].join("\n")}}(i,o));const a=e._extruded?"EXTRUDED_GEOMETRY":"";let c=new bc({defines:[a],sources:[o]});const l=new bc({sources:[Uf]}),u=e._primitive._attributeLocations,d=new Og(s,r,e.appearance);if(e._spStencil=ya.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u}),e._primitive.allowPicking){let r=bc.createPickVertexShaderSource(o);r=V_._appendShowToShader(i,r),r=V_._updatePickColorAttribute(r);const c=d.createPickFragmentShader(!1),l=d.createPickVertexShader([a],r,!1,t.mapProjection);if(e._spPick=ya.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:l,fragmentShaderSource:c,attributeLocations:u}),s){let i=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!D(i)){const o=d.createPickFragmentShader(!0),s=d.createPickVertexShader([a],r,!0,t.mapProjection);i=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:u})}e._spPick2D=i}}else e._spPick=ya.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u});o=V_._appendShowToShader(i,o),c=new bc({defines:[a],sources:[o]}),e._sp=ya.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:u});const h=d.createFragmentShader(!1),p=d.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=ya.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:p,fragmentShaderSource:h,attributeLocations:u}),s){let i=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!D(i)){const r=d.createFragmentShader(!0),s=d.createVertexShader([a],o,!0,t.mapProjection);i=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:s,fragmentShaderSource:r,attributeLocations:u})}e._spColor2D=i}}function hy(e,t,n,i,o,r,s){!function(e,t){const n=e._primitive;let i,o,r,s=2*n._va.length;t.length=s;let a=0,c=n._batchTable.getUniformMapCallback()(e._uniformMap);const l=e._needs2DShader;for(i=0;i<s;i+=2){const s=n._va[a++];o=t[i],D(o)||(o=t[i]=new Kr({owner:e,primitiveType:n._primitiveType})),o.vertexArray=s,o.renderState=e._rsStencilDepthPass,o.shaderProgram=e._sp,o.uniformMap=c,o.pass=zt.TERRAIN_CLASSIFICATION,r=Kr.shallowClone(o,o.derivedCommands.tileset),r.renderState=e._rsStencilDepthPass3DTiles,r.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,o.derivedCommands.tileset=r,o=t[i+1],D(o)||(o=t[i+1]=new Kr({owner:e,primitiveType:n._primitiveType})),o.vertexArray=s,o.renderState=e._rsColorPass,o.shaderProgram=e._spColor,o.pass=zt.TERRAIN_CLASSIFICATION;const u=e.appearance.material;if(D(u)&&(c=ni(c,u._uniforms)),o.uniformMap=c,r=Kr.shallowClone(o,o.derivedCommands.tileset),r.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,o.derivedCommands.tileset=r,l){let t=Kr.shallowClone(o,o.derivedCommands.appearance2D);t.shaderProgram=e._spColor2D,o.derivedCommands.appearance2D=t,t=Kr.shallowClone(r,r.derivedCommands.appearance2D),t.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=t}}const u=e._commandsIgnoreShow,d=e._spStencil;let h=0;s=u.length=s/2;for(let p=0;p<s;++p){const e=u[p]=Kr.shallowClone(t[h],u[p]);e.shaderProgram=d,e.pass=zt.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,h+=2}}(e,r),function(e,t){const n=e._usePickOffsets,i=e._primitive;let o,r,s,a,c,l=2*i._va.length,u=0;n&&(o=i._pickOffsets,l=2*o.length),t.length=l;let d=0;const h=i._batchTable.getUniformMapCallback()(e._uniformMap),p=e._needs2DShader;for(s=0;s<l;s+=2){let l=i._va[d++];if(n&&(r=o[u++],l=i._va[r.index]),a=t[s],D(a)||(a=t[s]=new Kr({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),a.vertexArray=l,a.renderState=e._rsStencilDepthPass,a.shaderProgram=e._sp,a.uniformMap=h,a.pass=zt.TERRAIN_CLASSIFICATION,n&&(a.offset=r.offset,a.count=r.count),c=Kr.shallowClone(a,a.derivedCommands.tileset),c.renderState=e._rsStencilDepthPass3DTiles,c.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=c,a=t[s+1],D(a)||(a=t[s+1]=new Kr({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),a.vertexArray=l,a.renderState=e._rsPickPass,a.shaderProgram=e._spPick,a.uniformMap=h,a.pass=zt.TERRAIN_CLASSIFICATION,n&&(a.offset=r.offset,a.count=r.count),c=Kr.shallowClone(a,a.derivedCommands.tileset),c.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,a.derivedCommands.tileset=c,p){let t=Kr.shallowClone(a,a.derivedCommands.pick2D);t.shaderProgram=e._spPick2D,a.derivedCommands.pick2D=t,t=Kr.shallowClone(c,c.derivedCommands.pick2D),t.shaderProgram=e._spPick2D,c.derivedCommands.pick2D=t}}}(e,s)}function py(e,t){return Math.floor(e%t/2)}function fy(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function my(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}ay.prototype.update=function(e){if(!D(this._primitive)&&!D(this.geometryInstances))return;let t=this.appearance;D(t)&&D(t.material)&&t.material.update(e.context);const n=this,i=this._primitiveOptions;if(!D(this._primitive)){const e=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],o=e.length;let r,s,a,c,l=!1,u=!0,d=!1,h=!1;for(o>0&&(a=e[0].attributes,d=Og.hasAttributesForSphericalExtents(a),h=Og.hasAttributesForTextureCoordinatePlanes(a),c=a.color),r=0;r<o;r++){s=e[r];const t=s.attributes.color;if(D(t))l=!0;else if(l)throw new P("All GeometryInstances must have color attributes to use per-instance color.");u=u&&D(t)&&$d.equals(c,t)}if(!u&&!d&&!h)throw new P("All GeometryInstances must have the same color attribute except via GroundPrimitives");if(l&&!D(t)&&(t=new Ih({flat:!0}),this.appearance=t),!l&&t instanceof Ih)throw new P("PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances");if(D(t.material)&&!d&&!h)throw new P("Materials on ClassificationPrimitives are not supported except via GroundPrimitives");this._usePickOffsets=!d&&!h,this._hasSphericalExtentsAttribute=d,this._hasPlanarExtentsAttributes=h,this._hasPerColorAttribute=l;const p=new Array(o);for(r=0;r<o;++r)s=e[r],p[r]=new Zd({geometry:s.geometry,attributes:s.attributes,modelMatrix:s.modelMatrix,id:s.id,pickPrimitive:M(this._pickPrimitive,n)});i.appearance=t,i.geometryInstances=p,D(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(e,t){n._createBoundingVolumeFunction(e,t)}),i._createRenderStatesFunction=function(e,t,i,o){!function(e){if(D(e._rsStencilDepthPass))return;const t=!e.debugShowShadowVolume;e._rsStencilDepthPass=_s.fromCache(cy(t,!1)),e._rsStencilDepthPass3DTiles=_s.fromCache(cy(t,!0)),e._rsColorPass=_s.fromCache(ly(t)),e._rsPickPass=_s.fromCache(uy)}(n)},i._createShaderProgramFunction=function(e,t,i){dy(n,t)},i._createCommandsFunction=function(e,t,i,o,r,s,a){hy(n,0,0,0,0,s,a)},D(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(e,t,i,o,r,s,a,c){n._updateAndQueueCommandsFunction(e,t,i,o,r,s,a,c)}:i._updateAndQueueCommandsFunction=function(e,t,i,o,r,s,a,c){!function(e,t,n,i,o,r,s){const a=e._primitive;let c;V_._updateBoundingVolumes(a,t,o),t.mode===gl.SCENE3D?c=a._boundingSphereWC:t.mode===gl.COLUMBUS_VIEW?c=a._boundingSphereCV:t.mode===gl.SCENE2D&&D(a._boundingSphere2D)?c=a._boundingSphere2D:D(a._boundingSphereMorph)&&(c=a._boundingSphereMorph);const l=e.classificationType,u=l!==Vf.CESIUM_3D_TILE,d=l!==Vf.TERRAIN,h=t.passes;let p,f,m;if(h.render){const i=n.length;for(p=0;p<i;++p)f=c[py(p,i)],u&&(m=n[p],fy(m,t,o,r,f,s)),d&&(m=n[p].derivedCommands.tileset,fy(m,t,o,r,f,s));if(t.invertClassification){const n=e._commandsIgnoreShow,i=n.length;for(p=0;p<i;++p)f=c[p],m=n[p],fy(m,t,o,r,f,s)}}if(h.pick){const e=i.length,n=a._pickOffsets;for(p=0;p<e;++p)f=c[n[py(p,e)].index],u&&(m=i[p],my(m,t,o,r,f)),d&&(m=i[p].derivedCommands.tileset,my(m,t,o,r,f))}}(n,t,i,o,r,s,a)},this._primitive=new V_(i)}if(this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=_s.fromCache(cy(!1,!1)),this._rsStencilDepthPass3DTiles=_s.fromCache(cy(!1,!0)),this._rsColorPass=_s.fromCache(ly(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=_s.fromCache(cy(!0,!1)),this._rsStencilDepthPass3DTiles=_s.fromCache(cy(!0,!0)),this._rsColorPass=_s.fromCache(ly(!0))),this._primitive.appearance!==t){if(!this._hasSphericalExtentsAttribute&&!this._hasPlanarExtentsAttributes&&D(t.material))throw new P("Materials on ClassificationPrimitives are not supported except via GroundPrimitive");if(!this._hasPerColorAttribute&&t instanceof Ih)throw new P("PerInstanceColorAppearance requires color GeometryInstanceAttribute");this._primitive.appearance=t}this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push((()=>{D(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))}))},ay.prototype.getGeometryInstanceAttributes=function(e){if(!D(this._primitive))throw new P("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)},ay.prototype.isDestroyed=function(){return!1},ay.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,He(this)};const _y={u_globeMinimumAltitude:function(){return 55e3}};function gy(e){let t=(e=M(e,M.EMPTY_OBJECT)).appearance;const n=e.geometryInstances;if(!D(t)&&D(n)){const e=Array.isArray(n)?n:[n],i=e.length;for(let n=0;n<i;n++){const i=e[n].attributes;if(D(i)&&D(i.color)){t=new Ih({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=M(e.show,!0),this.classificationType=M(e.classificationType,Vf.BOTH),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=M(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=Hh._defaultMaxTerrainHeight,this._minTerrainHeight=Hh._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:M(e.vertexCacheOptimize,!1),interleave:M(e.interleave,!1),releaseGeometryInstances:M(e.releaseGeometryInstances,!0),allowPicking:M(e.allowPicking,!0),asynchronous:M(e.asynchronous,!0),compressVertices:M(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:this,_extruded:!0,_uniformMap:_y}}function yy(e){return function(t,n){const i=n.maximumRadius,o=i/Math.cos(.5*t)-i;return e._maxHeight+o}}function by(e){return function(t,n){return e._minHeight}}Object.defineProperties(gy.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}}}),gy.isSupported=ay.isSupported;const vy=new H,Ay=new H,Ty=new H,wy=new Qt,Ey=new Ir;function xy(e,t){const n=e.mapProjection.ellipsoid;if(!D(t.attributes)||!D(t.attributes.position3DHigh))return D(t.rectangle)?t.rectangle:void 0;const i=t.attributes.position3DHigh.values,o=t.attributes.position3DLow.values,r=i.length;let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let d=0;d<r;d+=3){const e=H.unpack(i,d,vy),t=H.unpack(o,d,Ay),r=H.add(e,t,Ty),u=n.cartesianToCartographic(r,wy),h=u.latitude,p=u.longitude;s=Math.min(s,h),a=Math.min(a,p),c=Math.max(c,h),l=Math.max(l,p)}const u=Ey;return u.north=c,u.south=s,u.east=l,u.west=a,u}function Sy(e,t){return Math.floor(e%t/2)}function Cy(e,t,n,i,o,r,s){const a=e._primitive;n.mode!==gl.SCENE3D&&t.shaderProgram===a._spColor&&a._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function Iy(e,t,n,i,o,r){const s=e._primitive;n.mode!==gl.SCENE3D&&t.shaderProgram===s._spPick&&s._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,n.commandList.push(t)}function Oy(){P.throwInstantiationError()}function Dy(e,t,n){L.defined("geometryUpdater",e),L.defined("primitives",t),L.defined("orderedGroundPrimitives",n),this._primitives=t,this._orderedGroundPrimitives=n,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}gy.initializeTerrainHeights=function(){return Hh.initialize()},gy.prototype.update=function(e){if(!D(this._primitive)&&!D(this.geometryInstances))return;if(!Hh.initialized){if(!this.asynchronous)throw new P("For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.");return void gy.initializeTerrainHeights()}const t=this,n=this._classificationPrimitiveOptions;if(!D(this._primitive)){const i=e.mapProjection.ellipsoid;let o,r,s;const a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=a.length,l=new Array(c);let u,d;for(u=0;u<c;++u){o=a[u],r=o.geometry;const t=xy(e,r);D(d)?D(t)&&Ir.union(d,t,d):d=Ir.clone(t);const n=o.id;if(D(n)&&D(t)){const e=Hh.getBoundingSphere(t,i);this._boundingSpheresKeys.push(n),this._boundingSpheres.push(e)}if(s=r.constructor,!D(s)||!D(s.createShadowVolume))throw new P("Not all of the geometry instances have GroundPrimitive support.")}!function(e,t,n){const i=Hh.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}(this,d,i);const h=e.verticalExaggeration,p=e.verticalExaggerationRelativeHeight;this._minHeight=zf.getHeight(this._minTerrainHeight,h,p),this._maxHeight=zf.getHeight(this._maxTerrainHeight,h,p);const f=gy._supportsMaterials(e.context);if(this._useFragmentCulling=f,f){let t,n=!0;for(u=0;u<c;++u)if(o=a[u],r=o.geometry,d=xy(e,r),Og.shouldUseSphericalCoordinates(d)){n=!1;break}for(u=0;u<c;++u){o=a[u],r=o.geometry,s=r.constructor;const c=xy(e,r),d=r.textureCoordinateRotationPoints;t=n?Og.getPlanarTextureCoordinateAttributes(c,d,i,e.mapProjection,this._maxHeight):Og.getSphericalExtentGeometryInstanceAttributes(c,d,i,e.mapProjection);const h=o.attributes;for(const e in h)h.hasOwnProperty(e)&&(t[e]=h[e]);l[u]=new Zd({geometry:s.createShadowVolume(r,by(this),yy(this)),attributes:t,id:o.id})}}else for(u=0;u<c;++u)o=a[u],r=o.geometry,s=r.constructor,l[u]=new Zd({geometry:s.createShadowVolume(r,by(this),yy(this)),attributes:o.attributes,id:o.id});n.geometryInstances=l,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(e,n){!function(e,t,n){const i=t.mapProjection.ellipsoid,o=xy(t,n),r=zp.fromRectangle(o,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(r),!t.scene3DOnly){const n=t.mapProjection,i=$u.fromRectangleWithHeights2D(o,n,e._maxHeight,e._minHeight);H.fromElements(i.center.z,i.center.x,i.center.y,i.center),e._boundingVolumes2D.push(i)}}(t,e,n)},n._updateAndQueueCommandsFunction=function(e,n,i,o,r,s,a,c){!function(e,t,n,i,o,r,s){let a;a=t.mode===gl.SCENE3D?e._boundingVolumes:e._boundingVolumes2D;const c=e.classificationType,l=c!==Vf.CESIUM_3D_TILE,u=c!==Vf.TERRAIN,d=t.passes,h=e._primitive;let p,f,m;if(d.render){const i=n.length;for(p=0;p<i;++p)f=a[Sy(p,i)],l&&(m=n[p],Cy(e,m,t,o,r,f,s)),u&&(m=n[p].derivedCommands.tileset,Cy(e,m,t,o,r,f,s));if(t.invertClassification){const n=h._commandsIgnoreShow,i=n.length;for(p=0;p<i;++p)f=a[p],m=n[p],Cy(e,m,t,o,r,f,s)}}if(d.pick){const n=i.length;let s;for(e._useFragmentCulling||(s=h._primitive._pickOffsets),p=0;p<n;++p)f=a[Sy(p,n)],e._useFragmentCulling||(f=a[s[Sy(p,n)].index]),l&&(m=i[p],Iy(e,m,t,o,r,f)),u&&(m=i[p].derivedCommands.tileset,Iy(e,m,t,o,r,f))}}(t,n,i,o,r,s,a)},this._primitive=new ay(n)}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push((()=>{!this._ready&&D(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))}))},gy.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(-1!==t)return this._boundingSpheres[t]},gy.prototype.getGeometryInstanceAttributes=function(e){if(!D(this._primitive))throw new P("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)},gy.prototype.isDestroyed=function(){return!1},gy.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),He(this)},gy._supportsMaterials=function(e){return e.depthTexture},gy.supportsMaterials=function(e){return L.typeOf.object("scene",e),gy._supportsMaterials(e.frameState.context)},Object.defineProperties(Oy.prototype,{isConstant:{get:P.throwInstantiationError},definitionChanged:{get:P.throwInstantiationError}}),Oy.prototype.getType=P.throwInstantiationError,Oy.prototype.getValue=P.throwInstantiationError,Oy.prototype.equals=P.throwInstantiationError,Oy.getValue=function(e,t,n){let i;return D(t)&&(i=t.getType(e),D(i))?(D(n)&&n.type===i||(n=mh.fromType(i)),t.getValue(e,n.uniforms),n):(D(n)&&n.type===mh.ColorType||(n=mh.fromType(mh.ColorType)),Ot.clone(Ot.WHITE,n.uniforms.color),n)},Dy.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!Ou.getValueOrDefault(t.show,n,!0)},Dy.prototype._setOptions=P.throwInstantiationError,Dy.prototype.update=function(e){L.defined("time",e);const t=this._geometryUpdater,n=t._onTerrain,i=this._primitives,o=this._orderedGroundPrimitives;n?o.remove(this._primitive):(i.removeAndDestroy(this._primitive),i.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;const r=this._entity,s=r[this._geometryUpdater._geometryPropertyName];if(this._setOptions(r,s,e),this._isHidden(r,s,e))return;const a=this._geometryUpdater.shadowsProperty.getValue(e),c=this._options;if(!D(s.fill)||s.fill.getValue(e)){const r=t.fillMaterialProperty,s=r instanceof Oh;let l;const u=t._getIsClosed(c);if(s)l=new Ih({closed:u,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const t=Oy.getValue(e,r,this._material);this._material=t,l=new Sh({material:t,translucent:t.isTranslucent(),closed:u})}if(n)c.vertexFormat=Ih.VERTEX_FORMAT,this._primitive=o.add(new gy({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:l,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Ou.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{c.vertexFormat=l.vertexFormat;const t=this._geometryUpdater.createFillGeometryInstance(e);s&&(l.translucent=255!==t.attributes.color.value[3]),this._primitive=i.add(new V_({geometryInstances:t,appearance:l,asynchronous:!1,shadows:a}))}}if(!n&&D(s.outline)&&s.outline.getValue(e)){const n=this._geometryUpdater.createOutlineGeometryInstance(e),o=Ou.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new V_({geometryInstances:n,appearance:new Ih({flat:!0,translucent:255!==n.attributes.color.value[3],renderState:{lineWidth:t._scene.clampLineWidth(o)}}),asynchronous:!1,shadows:a}))}},Dy.prototype.getBoundingSphere=function(e){if(!D(e))throw new P("result is required.");const t=this._entity,n=this._primitive,i=this._outlinePrimitive;let o;return D(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),D(o)&&D(o.boundingSphere))||D(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),D(o)&&D(o.boundingSphere))?($u.clone(o.boundingSphere,e),Iu.DONE):D(n)&&!n.ready||D(i)&&!i.ready?Iu.PENDING:Iu.FAILED},Dy.prototype.isDestroyed=function(){return!1},Dy.prototype.destroy=function(){const e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),He(this)};const Py=Object.freeze({NONE:0,GEODESIC:1,RHUMB:2}),Ny=V.EPSILON10;function Ry(e,t,n,i){if(L.defined("equalsEpsilon",t),!D(e))return;n=M(n,!1);const o=D(i),r=e.length;if(r<2)return e;let s,a,c,l=e[0],u=0,d=-1;for(s=1;s<r;++s)a=e[s],t(l,a,Ny)?(D(c)||(c=e.slice(0,s),u=s-1,d=0),o&&i.push(s)):(D(c)&&(c.push(a),u=s,o&&(d=i.length)),l=a);return n&&t(e[0],e[r-1],Ny)&&(o&&(D(c)?i.splice(d,0,u):i.push(r-1)),D(c)?c.length-=1:c=e.slice(0,-1)),D(c)?c:e}function Ly(e,t,n,i,o,r,s){const a=function(e,t){return e*t*(4+e*(4-3*t))/16}(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}const My=new H,Fy=new H;function By(e,t,n,i){const o=H.normalize(i.cartographicToCartesian(t,Fy),My),r=H.normalize(i.cartographicToCartesian(n,Fy),Fy);L.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(H.angleBetween(o,r))-Math.PI),.0125),function(e,t,n,i,o,r,s){const a=(t-n)/t,c=r-i,l=Math.atan((1-a)*Math.tan(o)),u=Math.atan((1-a)*Math.tan(s)),d=Math.cos(l),h=Math.sin(l),p=Math.cos(u),f=Math.sin(u),m=d*p,_=d*f,g=h*f,y=h*p;let b,v,A,T,w,E=c,x=V.TWO_PI,S=Math.cos(E),C=Math.sin(E);do{S=Math.cos(E),C=Math.sin(E);const e=_-y*S;let t;A=Math.sqrt(p*p*C*C+e*e),v=g+m*S,b=Math.atan2(A,v),0===A?(t=0,T=1):(t=m*C/A,T=1-t*t),x=E,w=v-2*g/T,isFinite(w)||(w=0),E=c+Ly(a,t,T,b,A,v,w)}while(Math.abs(E-x)>V.EPSILON12);const I=T*(t*t-n*n)/(n*n),O=I*(256+I*(I*(74-47*I)-128))/1024,D=w*w,P=n*(1+I*(4096+I*(I*(320-175*I)-768))/16384)*(b-O*A*(w+O*(v*(2*D-1)-O*w*(4*A*A-3)*(4*D-3)/6)/4)),N=Math.atan2(p*C,_-y*S),R=Math.atan2(d*C,_*S-y);e._distance=P,e._startHeading=N,e._endHeading=R,e._uSquared=I}(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=Qt.clone(t,e._start),e._end=Qt.clone(n,e._end),e._start.height=0,e._end.height=0,function(e){const t=e._uSquared,n=e._ellipsoid.maximumRadius,i=e._ellipsoid.minimumRadius,o=(n-i)/n,r=Math.cos(e._startHeading),s=Math.sin(e._startHeading),a=(1-o)*Math.tan(e._start.latitude),c=1/Math.sqrt(1+a*a),l=c*a,u=Math.atan2(a,r),d=c*s,h=d*d,p=1-h,f=Math.sqrt(p),m=t/4,_=m*m,g=_*m,y=_*_,b=1+m-3*_/4+5*g/4-175*y/64,v=1-m+15*_/8-35*g/8,A=1-3*m+35*_/4,T=1-5*m,w=b*u-v*Math.sin(2*u)*m/2-A*Math.sin(4*u)*_/16-T*Math.sin(6*u)*g/48-5*Math.sin(8*u)*y/512,E=e._constants;E.a=n,E.b=i,E.f=o,E.cosineHeading=r,E.sineHeading=s,E.tanU=a,E.cosineU=c,E.sineU=l,E.sigma=u,E.sineAlpha=d,E.sineSquaredAlpha=h,E.cosineSquaredAlpha=p,E.cosineAlpha=f,E.u2Over4=m,E.u4Over16=_,E.u6Over64=g,E.u8Over256=y,E.a0=b,E.a1=v,E.a2=A,E.a3=T,E.distanceRatio=w}(e)}function zy(e,t,n){const i=M(n,on.WGS84);this._ellipsoid=i,this._start=new Qt,this._end=new Qt,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,D(e)&&D(t)&&By(this,e,t,i)}function Uy(e,t,n){if(0===e)return t*n;const i=e*e,o=i*i,r=o*i,s=r*i,a=s*i,c=a*i,l=n;return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*c/1048576)*l-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*c/524288)*Math.sin(2*l)+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*c/8388608)*Math.sin(4*l)-(35*r/3072+175*s/12288+3675*a/262144+13475*c/1048576)*Math.sin(6*l)+(315*s/131072+2205*a/524288+43659*c/8388608)*Math.sin(8*l)-(693*a/1310720+6237*c/5242880)*Math.sin(10*l)+1001*c/8388608*Math.sin(12*l))}function ky(e,t){if(0===e)return Math.log(Math.tan(.5*(V.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(V.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}Object.defineProperties(zy.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return L.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return L.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return L.defined("distance",this._distance),this._endHeading}}}),zy.prototype.setEndPoints=function(e,t){L.defined("start",e),L.defined("end",t),By(this,e,t,this._ellipsoid)},zy.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)},zy.prototype.interpolateUsingSurfaceDistance=function(e,t){L.defined("distance",this._distance);const n=this._constants,i=n.distanceRatio+e/n.b,o=Math.cos(2*i),r=Math.cos(4*i),s=Math.cos(6*i),a=Math.sin(2*i),c=Math.sin(4*i),l=Math.sin(6*i),u=Math.sin(8*i),d=i*i,h=i*d,p=n.u8Over256,f=n.u2Over4,m=n.u6Over64,_=n.u4Over16;let g=2*h*p*o/3+i*(1-f+7*_/4-15*m/4+579*p/64-(_-15*m/4+187*p/16)*o-(5*m/4-115*p/16)*r-29*p*s/16)+(f/2-_+71*m/32-85*p/16)*a+(5*_/16-5*m/4+383*p/96)*c-d*((m-11*p/2)*a+5*p*c/2)+(29*m/96-29*p/16)*l+539*p*u/1536;const y=Math.asin(Math.sin(g)*n.cosineAlpha),b=Math.atan(n.a/n.b*Math.tan(y));g-=n.sigma;const v=Math.cos(2*n.sigma+g),A=Math.sin(g),T=Math.cos(g),w=n.cosineU*T,E=n.sineU*A,x=Math.atan2(A*n.sineHeading,w-E*n.cosineHeading)-Ly(n.f,n.sineAlpha,n.cosineSquaredAlpha,g,A,T,v);return D(t)?(t.longitude=this._start.longitude+x,t.latitude=b,t.height=0,t):new Qt(this._start.longitude+x,b,0)};const Vy=new H,Hy=new H;function Gy(e,t,n,i){const o=H.normalize(i.cartographicToCartesian(t,Hy),Vy),r=H.normalize(i.cartographicToCartesian(n,Hy),Hy);L.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(H.angleBetween(o,r))-Math.PI),.0125);const s=i.maximumRadius,a=i.minimumRadius,c=s*s,l=a*a;e._ellipticitySquared=(c-l)/c,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=Qt.clone(t,e._start),e._start.height=0,e._end=Qt.clone(n,e._end),e._end.height=0,e._heading=function(e,t,n,i,o){const r=ky(e._ellipticity,n),s=ky(e._ellipticity,o);return Math.atan2(V.negativePiToPi(i-t),s-r)}(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=function(e,t,n,i,o,r,s){const a=e._heading,c=r-i;let l=0;if(V.equalsEpsilon(Math.abs(a),V.PI_OVER_TWO,V.EPSILON8))if(t===n)l=t*Math.cos(o)*V.negativePiToPi(c);else{const n=Math.sin(o);l=t*Math.cos(o)*V.negativePiToPi(c)/Math.sqrt(1-e._ellipticitySquared*n*n)}else{const n=Uy(e._ellipticity,t,o);l=(Uy(e._ellipticity,t,s)-n)/Math.cos(a)}return Math.abs(l)}(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function jy(e,t,n,i,o,r){if(0===n)return Qt.clone(e,r);const s=o*o;let a,c,l;if(Math.abs(V.PI_OVER_TWO-Math.abs(t))>V.EPSILON8){if(c=function(e,t,n){const i=e/n;if(0===t)return i;const o=i*i,r=o*i,s=r*i,a=t*t,c=a*a,l=c*a,u=l*a,d=u*a,h=d*a,p=Math.sin(2*i),f=Math.cos(2*i),m=Math.sin(4*i),_=Math.cos(4*i),g=Math.sin(6*i),y=Math.cos(6*i),b=Math.sin(8*i),v=Math.cos(8*i),A=Math.sin(10*i);return i+i*a/4+7*i*c/64+15*i*l/256+579*i*u/16384+1515*i*d/65536+16837*i*h/1048576+(3*i*c/16+45*i*l/256-i*(32*o-561)*u/4096-i*(232*o-1677)*d/16384+i*(399985-90560*o+512*s)*h/5242880)*f+(21*i*l/256+483*i*u/4096-i*(224*o-1969)*d/16384-i*(33152*o-112599)*h/1048576)*_+(151*i*u/4096+4681*i*d/65536+1479*i*h/16384-453*r*h/32768)*y+(1097*i*d/65536+42783*i*h/1048576)*v+8011*i*h/1048576*Math.cos(10*i)+(3*a/8+3*c/16+213*l/2048-3*o*l/64+255*u/4096-33*o*u/512+20861*d/524288-33*o*d/512+s*d/1024+28273*h/1048576-471*o*h/8192+9*s*h/4096)*p+(21*c/256+21*l/256+533*u/8192-21*o*u/512+197*d/4096-315*o*d/4096+584039*h/16777216-12517*o*h/131072+7*s*h/2048)*m+(151*l/6144+151*u/4096+5019*d/131072-453*o*d/16384+26965*h/786432-8607*o*h/131072)*g+(1097*u/131072+1097*d/65536+225797*h/10485760-1097*o*h/65536)*b+(8011*d/2621440+8011*h/1048576)*A+293393*h/251658240*Math.sin(12*i)}(Uy(o,i,e.latitude)+n*Math.cos(t),o,i),Math.abs(t)<V.EPSILON10)a=V.negativePiToPi(e.longitude);else{const n=ky(o,e.latitude),i=ky(o,c);l=Math.tan(t)*(i-n),a=V.negativePiToPi(e.longitude+l)}}else{let r;if(c=e.latitude,0===o)r=i*Math.cos(e.latitude);else{const t=Math.sin(e.latitude);r=i*Math.cos(e.latitude)/Math.sqrt(1-s*t*t)}l=n/r,a=t>0?V.negativePiToPi(e.longitude+l):V.negativePiToPi(e.longitude-l)}return D(r)?(r.longitude=a,r.latitude=c,r.height=0,r):new Qt(a,c,0)}function Wy(e,t,n){const i=M(n,on.WGS84);this._ellipsoid=i,this._start=new Qt,this._end=new Qt,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,D(e)&&D(t)&&Gy(this,e,t,i)}Object.defineProperties(Wy.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return L.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return L.defined("distance",this._distance),this._heading}}}),Wy.fromStartHeadingDistance=function(e,t,n,i,o){L.defined("start",e),L.defined("heading",t),L.defined("distance",n),L.typeOf.number.greaterThan("distance",n,0);const r=M(i,on.WGS84),s=r.maximumRadius,a=r.minimumRadius,c=s*s,l=a*a,u=Math.sqrt((c-l)/c),d=jy(e,t=V.negativePiToPi(t),n,r.maximumRadius,u);return!D(o)||D(i)&&!i.equals(o.ellipsoid)?new Wy(e,d,r):(o.setEndPoints(e,d),o)},Wy.prototype.setEndPoints=function(e,t){L.defined("start",e),L.defined("end",t),Gy(this,e,t,this._ellipsoid)},Wy.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)},Wy.prototype.interpolateUsingSurfaceDistance=function(e,t){if(L.typeOf.number("distance",e),!D(this._distance)||0===this._distance)throw new P("EllipsoidRhumbLine must have distinct start and end set.");return jy(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)},Wy.prototype.findIntersectionWithLongitude=function(e,t){if(L.typeOf.number("intersectionLongitude",e),!D(this._distance)||0===this._distance)throw new P("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=V.negativePiToPi(e),V.equalsEpsilon(Math.abs(e),Math.PI,V.EPSILON14)&&(e=V.sign(r.longitude)*Math.PI),D(t)||(t=new Qt),Math.abs(V.PI_OVER_TWO-o)<=V.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(V.equalsEpsilon(Math.abs(V.PI_OVER_TWO-o),V.PI_OVER_TWO,V.EPSILON8)){if(V.equalsEpsilon(e,r.longitude,V.EPSILON12))return;return t.longitude=e,t.latitude=V.PI_OVER_TWO*V.sign(V.PI_OVER_TWO-i),t.height=0,t}const s=r.latitude,a=n*Math.sin(s),c=Math.tan(.5*(V.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),l=(1+a)/(1-a);let u,d=r.latitude;do{u=d;const e=n*Math.sin(u),t=(1+e)/(1-e);d=2*Math.atan(c*Math.pow(t/l,n/2))-V.PI_OVER_TWO}while(!V.equalsEpsilon(d,u,V.EPSILON12));return t.longitude=e,t.latitude=d,t.height=0,t},Wy.prototype.findIntersectionWithLatitude=function(e,t){if(L.typeOf.number("intersectionLatitude",e),!D(this._distance)||0===this._distance)throw new P("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=this._start;if(V.equalsEpsilon(Math.abs(i),V.PI_OVER_TWO,V.EPSILON8))return;const r=ky(n,o.latitude),s=ky(n,e),a=Math.tan(i)*(s-r),c=V.negativePiToPi(o.longitude+a);return D(t)?(t.longitude=c,t.latitude=e,t.height=0,t):new Qt(c,e,0)};const qy=[fn,I_],Yy=qy.length,Xy=Math.cos(V.toRadians(30)),Qy=Math.cos(V.toRadians(150));function $y(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions;if(!D(t)||t.length<2)throw new P("At least two positions are required.");if(D(e.arcType)&&e.arcType!==Py.GEODESIC&&e.arcType!==Py.RHUMB)throw new P("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=M(e.width,1),this._positions=t,this.granularity=M(e.granularity,9999),this.loop=M(e.loop,!1),this.arcType=M(e.arcType,Py.GEODESIC),this._ellipsoid=on.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties($y.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+on.packedLength+1+1}}}),$y.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<Yy;i++)if(t instanceof qy[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};const Ky=new H,Zy=new H,Jy=new H;function eb(e,t,n,i,o){const r=ab(i,e,0,Ky),s=ab(i,e,n,Zy),a=ab(i,t,0,Jy),c=cb(s,r,Zy),l=cb(a,r,Jy);return H.cross(l,c,o),H.normalize(o,o)}const tb=new Qt,nb=new H,ib=new H,ob=new H;function rb(e,t,n,i,o,r,s,a,c,l,u){if(0===o)return;let d;r===Py.GEODESIC?d=new zy(e,t,s):r===Py.RHUMB&&(d=new Wy(e,t,s));const h=d.surfaceDistance;if(h<o)return;const p=eb(e,t,i,s,ob),f=Math.ceil(h/o),m=h/f;let _=m;const g=f-1;let y=a.length;for(let b=0;b<g;b++){const e=d.interpolateUsingSurfaceDistance(_,tb),t=ab(s,e,n,nb),o=ab(s,e,i,ib);H.pack(p,a,y),H.pack(t,c,y),H.pack(o,l,y),u.push(e.latitude),u.push(e.longitude),y+=3,_+=m}}const sb=new Qt;function ab(e,t,n,i){return Qt.clone(t,sb),sb.height=n,Qt.toCartesian(sb,e,i)}function cb(e,t,n){return H.subtract(e,t,n),H.normalize(n,n),n}function lb(e,t,n,i){return i=cb(e,t,i),i=H.cross(i,n,i),i=H.normalize(i,i),i=H.cross(n,i,i)}$y.pack=function(e,t,n){L.typeOf.object("value",e),L.defined("array",t);let i=M(n,0);const o=e._positions,r=o.length;t[i++]=r;for(let s=0;s<r;++s){const e=o[s];H.pack(e,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,on.pack(e._ellipsoid,t,i),i+=on.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t},$y.unpack=function(e,t,n){L.defined("array",e);let i=M(t,0);const o=e[i++],r=new Array(o);for(let h=0;h<o;h++)r[h]=H.unpack(e,i),i+=3;const s=e[i++],a=1===e[i++],c=e[i++],l=on.unpack(e,i);i+=on.packedLength;const u=e[i++],d=1===e[i++];return D(n)||(n=new $y({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=c,n._ellipsoid=l,n._projectionIndex=u,n._scene3DOnly=d,n};const ub=new H,db=new H,hb=new H,pb=new H;function fb(e,t,n,i,o){const r=cb(n,t,pb),s=lb(e,t,r,ub),a=lb(i,t,r,db);if(V.equalsEpsilon(H.dot(s,a),-1,V.EPSILON5))return o=H.cross(r,s,o),o=H.normalize(o,o);o=H.add(a,s,o),o=H.normalize(o,o);const c=H.cross(r,o,hb);return H.dot(a,c)<0&&(o=H.negate(o,o)),o}const mb=Pc.fromPointNormal(H.ZERO,H.UNIT_Y),_b=new H,gb=new H,yb=new H,bb=new H,vb=new H,Ab=new H,Tb=new Qt,wb=new Qt,Eb=new Qt;$y.createGeometry=function(e){const t=!e._scene3DOnly;let n=e.loop;const i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new qy[e._projectionIndex](i),a=1e3;let c,l;const u=e._positions,d=u.length;let h,p,f,m;2===d&&(n=!1);const _=new Wy(void 0,void 0,i);let g,y,b;const v=[u[0]];for(l=0;l<d-1;l++)h=u[l],p=u[l+1],g=Pp.lineSegmentPlane(h,p,mb,Ab),!D(g)||H.equalsEpsilon(g,h,V.EPSILON7)||H.equalsEpsilon(g,p,V.EPSILON7)||(e.arcType===Py.GEODESIC?v.push(H.clone(g)):e.arcType===Py.RHUMB&&(b=i.cartesianToCartographic(g,Tb).longitude,f=i.cartesianToCartographic(h,Tb),m=i.cartesianToCartographic(p,wb),_.setEndPoints(f,m),y=_.findIntersectionWithLongitude(b,Eb),g=i.cartographicToCartesian(y,Ab),!D(g)||H.equalsEpsilon(g,h,V.EPSILON7)||H.equalsEpsilon(g,p,V.EPSILON7)||v.push(H.clone(g)))),v.push(p);n&&(h=u[d-1],p=u[0],g=Pp.lineSegmentPlane(h,p,mb,Ab),!D(g)||H.equalsEpsilon(g,h,V.EPSILON7)||H.equalsEpsilon(g,p,V.EPSILON7)||(e.arcType===Py.GEODESIC?v.push(H.clone(g)):e.arcType===Py.RHUMB&&(b=i.cartesianToCartographic(g,Tb).longitude,f=i.cartesianToCartographic(h,Tb),m=i.cartesianToCartographic(p,wb),_.setEndPoints(f,m),y=_.findIntersectionWithLongitude(b,Eb),g=i.cartographicToCartesian(y,Ab),!D(g)||H.equalsEpsilon(g,h,V.EPSILON7)||H.equalsEpsilon(g,p,V.EPSILON7)||v.push(H.clone(g)))));let A=v.length,T=new Array(A);for(l=0;l<A;l++){const e=Qt.fromCartesian(v[l],i);e.height=0,T[l]=e}if(T=Ry(T,Qt.equalsEpsilon),A=T.length,A<2)return;const w=[],E=[],x=[],S=[];let C=_b,I=gb,O=yb,P=bb,N=vb;const R=T[0],L=T[1];for(C=ab(i,T[A-1],0,C),P=ab(i,L,0,P),I=ab(i,R,0,I),O=ab(i,R,a,O),N=n?fb(C,I,O,P,N):eb(R,L,a,i,N),H.pack(N,E,0),H.pack(I,x,0),H.pack(O,S,0),w.push(R.latitude),w.push(R.longitude),rb(R,L,0,a,o,r,i,E,x,S,w),l=1;l<A-1;++l){C=H.clone(I,C),I=H.clone(P,I);const e=T[l];ab(i,e,a,O),ab(i,T[l+1],0,P),fb(C,I,O,P,N),c=E.length,H.pack(N,E,c),H.pack(I,x,c),H.pack(O,S,c),w.push(e.latitude),w.push(e.longitude),rb(T[l],T[l+1],0,a,o,r,i,E,x,S,w)}const M=T[A-1],F=T[A-2];if(I=ab(i,M,0,I),O=ab(i,M,a,O),n){const e=T[0];C=ab(i,F,0,C),P=ab(i,e,0,P),N=fb(C,I,O,P,N)}else N=eb(F,M,a,i,N);if(c=E.length,H.pack(N,E,c),H.pack(I,x,c),H.pack(O,S,c),w.push(M.latitude),w.push(M.longitude),n){for(rb(M,R,0,a,o,r,i,E,x,S,w),c=E.length,l=0;l<3;++l)E[c+l]=E[l],x[c+l]=x[l],S[c+l]=S[l];w.push(R.latitude),w.push(R.longitude)}return function(e,t,n,i,o,r,s){let a,c;const l=t._ellipsoid,u=n.length/3-1,d=8*u,h=4*d,p=36*u,f=d>65535?new Uint32Array(p):new Uint16Array(p),m=new Float64Array(3*d),_=new Float32Array(h),g=new Float32Array(h),y=new Float32Array(h),b=new Float32Array(h),v=new Float32Array(h);let A,T,w,E;s&&(A=new Float32Array(h),T=new Float32Array(h),w=new Float32Array(h),E=new Float32Array(2*d));const x=r.length/2;let S=0;const C=Ub;C.height=0;const I=kb;I.height=0;let O=Vb,D=Hb;if(s)for(c=0,a=1;a<x;a++)C.latitude=r[c],C.longitude=r[c+1],I.latitude=r[c+2],I.longitude=r[c+3],O=t.project(C,O),D=t.project(I,D),S+=H.distance(O,D),c+=2;const P=i.length/3;D=H.unpack(i,0,D);let N,R=0;for(c=3,a=1;a<P;a++)O=H.clone(D,O),D=H.unpack(i,c,D),R+=H.distance(O,D),c+=3;c=3;let L=0,M=0,F=0,B=0,z=!1,U=H.unpack(n,0,jb),k=H.unpack(i,0,Hb),G=H.unpack(o,0,qb);if(e){Ib(G,H.unpack(n,n.length-6,Gb),U,k)&&(G=H.negate(G,G))}let j=0,W=0,q=0;for(a=0;a<u;a++){const e=H.clone(U,Gb),a=H.clone(k,Vb);let u,d,h,p,f=H.clone(G,Wb);if(z&&(f=H.negate(f,f)),U=H.unpack(n,c,jb),k=H.unpack(i,c,Hb),G=H.unpack(o,c,qb),z=Ib(G,e,U,k),C.latitude=r[L],C.longitude=r[L+1],I.latitude=r[L+2],I.longitude=r[L+3],s){const e=zb(C,I);u=t.project(C,Jb),d=t.project(I,ev);const n=cb(d,u,dv);n.y=Math.abs(n.y),h=tv,p=nv,0===e||H.dot(n,H.UNIT_Y)>Xy?(h=Nb(t,C,f,u,tv),p=Nb(t,I,G,d,nv)):1===e?(p=Nb(t,I,G,d,nv),h.x=0,h.y=V.sign(C.longitude-Math.abs(I.longitude)),h.z=0):(h=Nb(t,C,f,u,tv),p.x=0,p.y=V.sign(C.longitude-I.longitude),p.z=0)}const x=H.distance(a,k),O=Ic.fromCartesian(e,lv),D=H.subtract(U,e,iv),P=H.normalize(D,sv);let Y=H.subtract(a,e,ov);Y=H.normalize(Y,Y);let X=H.cross(P,Y,sv);X=H.normalize(X,X);let Q=H.cross(Y,f,av);Q=H.normalize(Q,Q);let $=H.subtract(k,U,rv);$=H.normalize($,$);let K=H.cross(G,$,cv);K=H.normalize(K,K);const Z=x/R,J=j/R;let ee,te,ne,ie=0,oe=0,re=0;if(s){ie=H.distance(u,d),ee=Ic.fromCartesian(u,uv),te=H.subtract(d,u,dv),ne=H.normalize(te,hv);const e=ne.x;ne.x=ne.y,ne.y=-e,oe=ie/S,re=W/S}for(N=0;N<8;N++){const e=B+4*N,t=M+2*N,n=e+3,i=N<4?1:-1,o=2===N||3===N||6===N||7===N?1:-1;H.pack(O.high,_,e),_[n]=D.x,H.pack(O.low,g,e),g[n]=D.y,H.pack(Q,y,e),y[n]=D.z,H.pack(K,b,e),b[n]=Z*i,H.pack(X,v,e);let r=J*o;0===r&&o<0&&(r=9),v[n]=r,s&&(A[e]=ee.high.x,A[e+1]=ee.high.y,A[e+2]=ee.low.x,A[e+3]=ee.low.y,w[e]=-h.y,w[e+1]=h.x,w[e+2]=p.y,w[e+3]=-p.x,T[e]=te.x,T[e+1]=te.y,T[e+2]=ne.x,T[e+3]=ne.y,E[t]=oe*i,r=re*o,0===r&&o<0&&(r=9),E[t+1]=r)}const se=Kb,ae=Zb,ce=Qb,le=$b,ue=Ir.fromCartographicArray(Yb,Xb),de=Hh.getMinimumMaximumHeights(ue,l),he=de.minimumTerrainHeight,pe=de.maximumTerrainHeight;q+=Math.abs(he),q+=Math.abs(pe),Mb(e,a,he,pe,se,ce),Mb(U,k,he,pe,ae,le);let fe=H.multiplyByScalar(X,V.EPSILON5,pv);H.add(se,fe,se),H.add(ae,fe,ae),H.add(ce,fe,ce),H.add(le,fe,le),Bb(se,ae),Bb(ce,le),H.pack(se,m,F),H.pack(ae,m,F+3),H.pack(le,m,F+6),H.pack(ce,m,F+9),fe=H.multiplyByScalar(X,-2*V.EPSILON5,pv),H.add(se,fe,se),H.add(ae,fe,ae),H.add(ce,fe,ce),H.add(le,fe,le),Bb(se,ae),Bb(ce,le),H.pack(se,m,F+12),H.pack(ae,m,F+15),H.pack(le,m,F+18),H.pack(ce,m,F+21),L+=2,c+=3,M+=16,F+=24,B+=32,j+=x,W+=ie}c=0;let Y=0;for(a=0;a<u;a++){for(N=0;N<_v;N++)f[c+N]=mv[N]+Y;Y+=8,c+=_v}const X=fv;$u.fromVertices(n,H.ZERO,3,X[0]),$u.fromVertices(i,H.ZERO,3,X[1]);const Q=$u.fromBoundingSpheres(X);Q.radius+=q/(2*u);const $={position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,normalize:!1,values:m}),startHiAndForwardOffsetX:gv(_),startLoAndForwardOffsetY:gv(g),startNormalAndForwardOffsetZ:gv(y),endNormalAndTextureCoordinateNormalizationX:gv(b),rightNormalAndTextureCoordinateNormalizationY:gv(v)};s&&($.startHiLo2D=gv(A),$.offsetAndRight2D=gv(T),$.startEndNormals2D=gv(w),$.texcoordNormalization2D=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,normalize:!1,values:E}));return new Na({attributes:$,indices:f,boundingSphere:Q})}(n,s,x,S,E,w,t)};const xb=new H,Sb=new re,Cb=new _o;function Ib(e,t,n,i){const o=cb(n,t,xb),r=H.dot(o,e);if(r>Xy||r<Qy){const t=cb(i,n,pb),o=r<Qy?V.PI_OVER_TWO:-V.PI_OVER_TWO,s=_o.fromAxisAngle(t,o,Cb),a=re.fromQuaternion(s,Sb);return re.multiplyByVector(a,e,e),!0}return!1}const Ob=new Qt,Db=new H,Pb=new H;function Nb(e,t,n,i,o){const r=Qt.toCartesian(t,e._ellipsoid,Db);let s=H.add(r,n,Pb),a=!1;const c=e._ellipsoid;let l=c.cartesianToCartographic(s,Ob);Math.abs(t.longitude-l.longitude)>V.PI_OVER_TWO&&(a=!0,s=H.subtract(r,n,Pb),l=c.cartesianToCartographic(s,Ob)),l.height=0;const u=e.project(l,o);return(o=H.subtract(u,i,o)).z=0,o=H.normalize(o,o),a&&H.negate(o,o),o}const Rb=new H,Lb=new H;function Mb(e,t,n,i,o,r){const s=H.subtract(t,e,Rb);H.normalize(s,s);const a=n-0;let c=H.multiplyByScalar(s,a,Lb);H.add(e,c,o);const l=i-1e3;c=H.multiplyByScalar(s,l,Lb),H.add(t,c,r)}const Fb=new H;function Bb(e,t){const n=Pc.getPointDistance(mb,e),i=Pc.getPointDistance(mb,t);let o=Fb;V.equalsEpsilon(n,0,V.EPSILON2)?(o=cb(t,e,o),H.multiplyByScalar(o,V.EPSILON2,o),H.add(e,o,e)):V.equalsEpsilon(i,0,V.EPSILON2)&&(o=cb(e,t,o),H.multiplyByScalar(o,V.EPSILON2,o),H.add(t,o,t))}function zb(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(V.equalsEpsilon(n,V.PI,V.EPSILON11)){const i=V.sign(t.longitude);return e.longitude=i*(n-V.EPSILON11),1}if(V.equalsEpsilon(i,V.PI,V.EPSILON11)){const n=V.sign(e.longitude);return t.longitude=n*(i-V.EPSILON11),2}return 0}const Ub=new Qt,kb=new Qt,Vb=new H,Hb=new H,Gb=new H,jb=new H,Wb=new H,qb=new H,Yb=[Ub,kb],Xb=new Ir,Qb=new H,$b=new H,Kb=new H,Zb=new H,Jb=new H,ev=new H,tv=new H,nv=new H,iv=new H,ov=new H,rv=new H,sv=new H,av=new H,cv=new H,lv=new Ic,uv=new Ic,dv=new H,hv=new H,pv=new H,fv=[new $u,new $u],mv=[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],_v=mv.length;function gv(e){return new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}$y._projectNormal=Nb;const yv="void clipLineSegmentToNearPlane(\n vec3 p0,\n vec3 p1,\n out vec4 positionWC,\n out bool clipped,\n out bool culledByNearPlane,\n out vec4 clippedPositionEC)\n{\n culledByNearPlane = false;\n clipped = false;\n\n vec3 p0ToP1 = p1 - p0;\n float magnitude = length(p0ToP1);\n vec3 direction = normalize(p0ToP1);\n\n // Distance that p0 is behind the near plane. Negative means p0 is\n // in front of the near plane.\n float endPoint0Distance = czm_currentFrustum.x + p0.z;\n\n // Camera looks down -Z.\n // When moving a point along +Z: LESS VISIBLE\n // * Points in front of the camera move closer to the camera.\n // * Points behind the camrea move farther away from the camera.\n // When moving a point along -Z: MORE VISIBLE\n // * Points in front of the camera move farther away from the camera.\n // * Points behind the camera move closer to the camera.\n\n // Positive denominator: -Z, becoming more visible\n // Negative denominator: +Z, becoming less visible\n // Nearly zero: parallel to near plane\n float denominator = -direction.z;\n\n if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)\n {\n // p0 is behind the near plane and the line to p1 is nearly parallel to\n // the near plane, so cull the segment completely.\n culledByNearPlane = true;\n }\n else if (endPoint0Distance > 0.0)\n {\n // p0 is behind the near plane, and the line to p1 is moving distinctly\n // toward or away from it.\n\n // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)\n float t = endPoint0Distance / denominator;\n if (t < 0.0 || t > magnitude)\n {\n // Near plane intersection is not between the two points.\n // We already confirmed p0 is behind the naer plane, so now\n // we know the entire segment is behind it.\n culledByNearPlane = true;\n }\n else\n {\n // Segment crosses the near plane, update p0 to lie exactly on it.\n p0 = p0 + t * direction;\n\n // Numerical noise might put us a bit on the wrong side of the near plane.\n // Don't let that happen.\n p0.z = min(p0.z, -czm_currentFrustum.x);\n\n clipped = true;\n }\n }\n\n clippedPositionEC = vec4(p0, 1.0);\n positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);\n}\n\nvec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n{\n // expandDirection +1 is to the _left_ when looking from positionEC toward nextEC.\n\n#ifdef POLYLINE_DASH\n // Compute the window coordinates of the points.\n vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\n vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\n vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\n\n // Determine the relative screen space direction of the line.\n vec2 lineDir;\n if (usePrevious) {\n lineDir = normalize(positionWindow.xy - previousWindow.xy);\n }\n else {\n lineDir = normalize(nextWindow.xy - positionWindow.xy);\n }\n angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0)\n\n // Quantize the angle so it doesn't change rapidly between segments.\n angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n#endif\n\n vec4 clippedPrevWC, clippedPrevEC;\n bool prevSegmentClipped, prevSegmentCulled;\n clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);\n\n vec4 clippedNextWC, clippedNextEC;\n bool nextSegmentClipped, nextSegmentCulled;\n clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);\n\n bool segmentClipped, segmentCulled;\n vec4 clippedPositionWC, clippedPositionEC;\n clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);\n\n if (segmentCulled)\n {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n\n vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);\n vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);\n\n // If a segment was culled, we can't use the corresponding direction\n // computed above. We should never see both of these be true without\n // `segmentCulled` above also being true.\n if (prevSegmentCulled)\n {\n directionToPrevWC = -directionToNextWC;\n }\n else if (nextSegmentCulled)\n {\n directionToNextWC = -directionToPrevWC;\n }\n\n vec2 thisSegmentForwardWC, otherSegmentForwardWC;\n if (usePrevious)\n {\n thisSegmentForwardWC = -directionToPrevWC;\n otherSegmentForwardWC = directionToNextWC;\n }\n else\n {\n thisSegmentForwardWC = directionToNextWC;\n otherSegmentForwardWC = -directionToPrevWC;\n }\n\n vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);\n\n vec2 leftWC = thisSegmentLeftWC;\n float expandWidth = width * 0.5;\n\n // When lines are split at the anti-meridian, the position may be at the\n // same location as the next or previous position, and we need to handle\n // that to avoid producing NaNs.\n if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n {\n vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);\n\n vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;\n float leftSumLength = length(leftSumWC);\n leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);\n\n // The sine of the angle between the two vectors is given by the formula\n // |a x b| = |a||b|sin(theta)\n // which is\n // float sinAngle = length(cross(vec3(leftWC, 0.0), vec3(-thisSegmentForwardWC, 0.0)));\n // Because the z components of both vectors are zero, the x and y coordinate will be zero.\n // Therefore, the sine of the angle is just the z component of the cross product.\n vec2 u = -thisSegmentForwardWC;\n vec2 v = leftWC;\n float sinAngle = abs(u.x * v.y - u.y * v.x);\n expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n }\n\n vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;\n return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;\n}\n\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n{\n vec4 positionEC = czm_modelViewRelativeToEye * position;\n vec4 prevEC = czm_modelViewRelativeToEye * previous;\n vec4 nextEC = czm_modelViewRelativeToEye * next;\n return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n}\n";let bv=`${yv}\nin vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 prevPosition3DHigh;\nin vec3 prevPosition3DLow;\nin vec3 nextPosition3DHigh;\nin vec3 nextPosition3DLow;\nin vec2 expandAndWidth;\nin vec4 color;\nin float batchId;\n\nout vec4 v_color;\n\nvoid main()\n{\n float expandDir = expandAndWidth.x;\n float width = abs(expandAndWidth.y) + 0.5;\n bool usePrev = expandAndWidth.y < 0.0;\n\n vec4 p = czm_computePosition();\n vec4 prev = czm_computePrevPosition();\n vec4 next = czm_computeNextPosition();\n\n float angle;\n vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n gl_Position = czm_viewportOrthographic * positionWC;\n\n v_color = color;\n}\n`;const vv=Ch;function Av(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.translucent,!0),n=!1,i=Av.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=M(e.vertexShaderSource,bv),this._fragmentShaderSource=M(e.fragmentShaderSource,vv),this._renderState=fh.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Ct.isInternetExplorer()||(bv=`#define CLIP_POLYLINE \n${bv}`),Object.defineProperties(Av.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}}}),Av.VERTEX_FORMAT=Bd.POSITION_ONLY,Av.prototype.getFragmentShaderSource=fh.prototype.getFragmentShaderSource,Av.prototype.isTranslucent=fh.prototype.isTranslucent,Av.prototype.getRenderState=fh.prototype.getRenderState;const Tv="#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\n\nin vec2 v_st;\n\nvoid main()\n{\n czm_materialInput materialInput;\n\n vec2 st = v_st;\n st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);\n\n materialInput.s = st.s;\n materialInput.st = st;\n materialInput.str = vec3(st, 0.0);\n\n czm_material material = czm_getMaterial(materialInput);\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#ifdef VECTOR_TILE\n out_FragColor *= u_highlightColor;\n#endif\n\n czm_writeLogDepth();\n}\n";let wv=`${yv}\nin vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 prevPosition3DHigh;\nin vec3 prevPosition3DLow;\nin vec3 nextPosition3DHigh;\nin vec3 nextPosition3DLow;\nin vec2 expandAndWidth;\nin vec2 st;\nin float batchId;\n\nout float v_width;\nout vec2 v_st;\nout float v_polylineAngle;\n\nvoid main()\n{\n float expandDir = expandAndWidth.x;\n float width = abs(expandAndWidth.y) + 0.5;\n bool usePrev = expandAndWidth.y < 0.0;\n\n vec4 p = czm_computePosition();\n vec4 prev = czm_computePrevPosition();\n vec4 next = czm_computeNextPosition();\n\n float angle;\n vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n gl_Position = czm_viewportOrthographic * positionWC;\n\n v_width = width;\n v_st.s = st.s;\n v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\n v_polylineAngle = angle;\n}\n`;const Ev=Tv;function xv(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.translucent,!0),n=!1,i=xv.VERTEX_FORMAT;this.material=D(e.material)?e.material:mh.fromType(mh.ColorType),this.translucent=t,this._vertexShaderSource=M(e.vertexShaderSource,wv),this._fragmentShaderSource=M(e.fragmentShaderSource,Ev),this._renderState=fh.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}function Sv(e){e=M(e,M.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;D(t)||(t=new xv),this.appearance=t,this.show=M(e.show,!0),this.classificationType=M(e.classificationType,Vf.BOTH),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=M(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:M(e.interleave,!1),releaseGeometryInstances:M(e.releaseGeometryInstances,!0),allowPicking:M(e.allowPicking,!0),asynchronous:M(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=Cv(!1),this._renderState3DTiles=Cv(!0),this._renderStateMorph=_s.fromCache({cull:{enabled:!0,face:ph.FRONT},depthTest:{enabled:!0},blending:dh.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}function Cv(e){return _s.fromCache({cull:{enabled:!0},blending:dh.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:ny.EQUAL,frontOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},backFunction:ny.EQUAL,backOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},reference:sy.CESIUM_3D_TILE_MASK,mask:sy.CESIUM_3D_TILE_MASK}})}function Iv(e,t,n,i,o,r,s){n.mode===gl.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==gl.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}Ct.isInternetExplorer()||(wv=`#define CLIP_POLYLINE \n${wv}`),Object.defineProperties(xv.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return-1!==this.material.shaderSource.search(/in\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}}}),xv.VERTEX_FORMAT=Bd.POSITION_AND_ST,xv.prototype.getFragmentShaderSource=fh.prototype.getFragmentShaderSource,xv.prototype.isTranslucent=fh.prototype.isTranslucent,xv.prototype.getRenderState=fh.prototype.getRenderState,Object.defineProperties(Sv.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}}),Sv.initializeTerrainHeights=function(){return Hh.initialize()},Sv.prototype.update=function(e){if(!D(this._primitive)&&!D(this.geometryInstances))return;if(!Hh.initialized){if(!this.asynchronous)throw new P("For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.");return void Sv.initializeTerrainHeights()}let t;const n=this,i=this._primitiveOptions;if(!D(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s=new Array(r);let a;for(t=0;t<r;++t)if(a=o[t].attributes,!D(a)||!D(a.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<r;++t){const i=o[t];a={};const r=i.attributes;for(const e in r)r.hasOwnProperty(e)&&(a[e]=r[e]);D(a.width)||(a.width=new Cg({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,value:[i.geometry.width]})),i.geometry._scene3DOnly=e.scene3DOnly,$y.setProjectionAndEllipsoid(i.geometry,e.mapProjection),s[t]=new Zd({geometry:i.geometry,attributes:a,id:i.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(e,t,i){!function(e,t,n){const i=t.context,o=e._primitive,r=o._attributeLocations;let s=o._batchTable.getVertexShaderCallback()('in vec3 position3DHigh;\nin vec3 position3DLow;\n\n// In 2D and in 3D, texture coordinate normalization component signs encodes:\n// * X sign - sidedness relative to right plane\n// * Y sign - is negative OR magnitude is greater than 1.0 if vertex is on bottom of volume\n#ifndef COLUMBUS_VIEW_2D\nin vec4 startHiAndForwardOffsetX;\nin vec4 startLoAndForwardOffsetY;\nin vec4 startNormalAndForwardOffsetZ;\nin vec4 endNormalAndTextureCoordinateNormalizationX;\nin vec4 rightNormalAndTextureCoordinateNormalizationY;\n#else\nin vec4 startHiLo2D;\nin vec4 offsetAndRight2D;\nin vec4 startEndNormals2D;\nin vec2 texcoordNormalization2D;\n#endif\n\nin float batchId;\n\nout vec4 v_startPlaneNormalEcAndHalfWidth;\nout vec4 v_endPlaneNormalEcAndBatchId;\nout vec4 v_rightPlaneEC;\nout vec4 v_endEcAndStartEcX;\nout vec4 v_texcoordNormalizationAndStartEcYZ;\n\n// For materials\n#ifdef WIDTH_VARYING\nout float v_width;\n#endif\n#ifdef ANGLE_VARYING\nout float v_polylineAngle;\n#endif\n\n#ifdef PER_INSTANCE_COLOR\nout vec4 v_color;\n#endif\n\nvoid main()\n{\n#ifdef COLUMBUS_VIEW_2D\n vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;\n\n vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);\n vec3 ecEnd = forwardDirectionEC + ecStart;\n forwardDirectionEC = normalize(forwardDirectionEC);\n\n // Right plane\n v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\n v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\n\n // start plane\n vec4 startPlaneEC;\n startPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\n startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\n\n // end plane\n vec4 endPlaneEC;\n endPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\n endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\n\n v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);\n v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;\n\n#else // COLUMBUS_VIEW_2D\n vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;\n vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);\n vec3 ecEnd = ecStart + offset;\n\n vec3 forwardDirectionEC = normalize(offset);\n\n // start plane\n vec4 startPlaneEC;\n startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\n startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\n\n // end plane\n vec4 endPlaneEC;\n endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\n endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\n\n // Right plane\n v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\n v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\n\n v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\n v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;\n\n#endif // COLUMBUS_VIEW_2D\n\n v_endEcAndStartEcX.xyz = ecEnd;\n v_endEcAndStartEcX.w = ecStart.x;\n v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;\n\n#ifdef PER_INSTANCE_COLOR\n v_color = czm_batchTable_color(batchId);\n#endif // PER_INSTANCE_COLOR\n\n // Compute a normal along which to "push" the position out, extending the miter depending on view distance.\n // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.\n // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.\n vec4 positionRelativeToEye = czm_computePosition();\n\n // Check distance to the end plane and start plane, pick the plane that is closer\n vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye; // w = 1.0, see czm_computePosition\n float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));\n float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));\n vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);\n vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.\n vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.\n\n // Extrude bottom vertices downward for far view distances, like for GroundPrimitives\n upOrDown = cross(forwardDirectionEC, normalEC);\n upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;\n upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;\n upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;\n positionEC.xyz += upOrDown;\n\n v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));\n\n // Determine distance along normalEC to push for a volume of appropriate width.\n // Make volumes about double pixel width for a conservative fit - in practice the\n // extra cost here is minimal compared to the loose volume heights.\n //\n // N = normalEC (guaranteed "right-facing")\n // R = rightEC\n // p = angle between N and R\n // w = distance to push along R if R == N\n // d = distance to push along N\n //\n // N R\n // { p| } * cos(p) = dot(N, R) = w / d\n // d | |w * d = w / dot(N, R)\n // { | }\n // o---------- polyline segment ----\x3e\n //\n float width = czm_batchTable_width(batchId);\n#ifdef WIDTH_VARYING\n v_width = width;\n#endif\n\n v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;\n v_startPlaneNormalEcAndHalfWidth.w = width * 0.5;\n\n v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;\n v_endPlaneNormalEcAndBatchId.w = batchId;\n\n width = width * max(0.0, czm_metersPerPixel(positionEC)); // width = distance to push along R\n width = width / dot(normalEC, v_rightPlaneEC.xyz); // width = distance to push along N\n\n // Determine if this vertex is on the "left" or "right"\n#ifdef COLUMBUS_VIEW_2D\n normalEC *= sign(texcoordNormalization2D.x);\n#else\n normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n#endif\n\n positionEC.xyz += width * normalEC;\n gl_Position = czm_depthClamp(czm_projection * positionEC);\n\n#ifdef ANGLE_VARYING\n // Approximate relative screen space direction of the line.\n vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));\n approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\n v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n');s=V_._appendShowToShader(o,s),s=V_._appendDistanceDisplayConditionToShader(o,s),s=V_._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()('in vec3 position3DHigh;\nin vec3 position3DLow;\n\nin vec4 startHiAndForwardOffsetX;\nin vec4 startLoAndForwardOffsetY;\nin vec4 startNormalAndForwardOffsetZ;\nin vec4 endNormalAndTextureCoordinateNormalizationX;\nin vec4 rightNormalAndTextureCoordinateNormalizationY;\nin vec4 startHiLo2D;\nin vec4 offsetAndRight2D;\nin vec4 startEndNormals2D;\nin vec2 texcoordNormalization2D;\n\nin float batchId;\n\nout vec3 v_forwardDirectionEC;\nout vec3 v_texcoordNormalizationAndHalfWidth;\nout float v_batchId;\n\n// For materials\n#ifdef WIDTH_VARYING\nout float v_width;\n#endif\n#ifdef ANGLE_VARYING\nout float v_polylineAngle;\n#endif\n\n#ifdef PER_INSTANCE_COLOR\nout vec4 v_color;\n#else\nout vec2 v_alignedPlaneDistances;\nout float v_texcoordT;\n#endif\n\n// Morphing planes using SLERP or NLERP doesn\'t seem to work, so instead draw the material directly on the shadow volume.\n// Morph views are from very far away and aren\'t meant to be used precisely, so this should be sufficient.\nvoid main()\n{\n v_batchId = batchId;\n\n // Start position\n vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));\n vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);\n vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\n vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\n vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\n vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\n\n // Start plane\n vec4 startPlane2D;\n vec4 startPlane3D;\n startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\n startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\n startPlane2D.w = -dot(startPlane2D.xyz, posEc2D);\n startPlane3D.w = -dot(startPlane3D.xyz, posEc3D);\n\n // Right plane\n vec4 rightPlane2D;\n vec4 rightPlane3D;\n rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\n rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\n rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);\n rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);\n\n // End position\n posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);\n posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);\n posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);\n posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;\n posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;\n vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;\n vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));\n vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));\n\n // End plane\n vec4 endPlane2D;\n vec4 endPlane3D;\n endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\n endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\n endPlane2D.w = -dot(endPlane2D.xyz, posEc2D);\n endPlane3D.w = -dot(endPlane3D.xyz, posEc3D);\n\n // Forward direction\n v_forwardDirectionEC = normalize(endEC - startEC);\n\n vec2 cleanTexcoordNormalization2D;\n cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);\n cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));\n vec2 cleanTexcoordNormalization3D;\n cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\n cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;\n cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));\n\n v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);\n\n#ifdef PER_INSTANCE_COLOR\n v_color = czm_batchTable_color(batchId);\n#else // PER_INSTANCE_COLOR\n // For computing texture coordinates\n\n v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);\n v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);\n#endif // PER_INSTANCE_COLOR\n\n#ifdef WIDTH_VARYING\n float width = czm_batchTable_width(batchId);\n float halfWidth = width * 0.5;\n v_width = width;\n v_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#else\n float halfWidth = 0.5 * czm_batchTable_width(batchId);\n v_texcoordNormalizationAndHalfWidth.z = halfWidth;\n#endif\n\n // Compute a normal along which to "push" the position out, extending the miter depending on view distance.\n // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.\n // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.\n // Since this is morphing, compute both 3D and 2D positions and then blend.\n\n // ****** 3D ******\n // Check distance to the end plane and start plane, pick the plane that is closer\n vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow); // w = 1.0, see czm_computePosition\n float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));\n float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));\n vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);\n vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.\n vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.\n\n // Nudge the top vertex upwards to prevent flickering\n vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));\n geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);\n geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\n positionEc3D.xyz += geodeticSurfaceNormal;\n\n // Determine if this vertex is on the "left" or "right"\n normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n\n // A "perfect" implementation would push along normals according to the angle against forward.\n // In practice, just pushing the normal out by halfWidth is sufficient for morph views.\n positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)\n\n // ****** 2D ******\n // Check distance to the end plane and start plane, pick the plane that is closer\n vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); // w = 1.0, see czm_computePosition\n absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));\n absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));\n planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);\n upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.\n normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.\n\n // Nudge the top vertex upwards to prevent flickering\n geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));\n geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);\n geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;\n positionEc2D.xyz += geodeticSurfaceNormal;\n\n // Determine if this vertex is on the "left" or "right"\n normalEC *= sign(texcoordNormalization2D.x);\n#ifndef PER_INSTANCE_COLOR\n // Use vertex\'s sidedness to compute its texture coordinate.\n v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);\n#endif\n\n // A "perfect" implementation would push along normals according to the angle against forward.\n // In practice, just pushing the normal out by halfWidth is sufficient for morph views.\n positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)\n\n // Blend for actual position\n gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);\n\n#ifdef ANGLE_VARYING\n // Approximate relative screen space direction of the line.\n vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));\n approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\n v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n');a=V_._appendShowToShader(o,a),a=V_._appendDistanceDisplayConditionToShader(o,a),a=V_._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()('in vec4 v_startPlaneNormalEcAndHalfWidth;\nin vec4 v_endPlaneNormalEcAndBatchId;\nin vec4 v_rightPlaneEC; // Technically can compute distance for this here\nin vec4 v_endEcAndStartEcX;\nin vec4 v_texcoordNormalizationAndStartEcYZ;\n\n#ifdef PER_INSTANCE_COLOR\nin vec4 v_color;\n#endif\n\nvoid main(void)\n{\n float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\n vec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);\n\n // Discard for sky\n if (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n out_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n eyeCoordinate /= eyeCoordinate.w;\n\n float halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);\n // Check distance of the eye coordinate against the right-facing plane\n float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\n\n // Check eye coordinate against the mitering planes\n float distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);\n float distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);\n\n if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n out_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n\n // Check distance of the eye coordinate against start and end planes with normals in the right plane.\n // For computing unskewed lengthwise texture coordinate.\n // Can also be used for clipping extremely pointy miters, but in practice unnecessary because of miter breaking.\n\n // aligned plane: cross the right plane normal with miter plane normal, then cross the result with right again to point it more "forward"\n vec3 alignedPlaneNormal;\n\n // start aligned plane\n alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);\n alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\n distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);\n\n // end aligned plane\n alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);\n alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\n distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);\n\n#ifdef PER_INSTANCE_COLOR\n out_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\n // Clamp - distance to aligned planes may be negative due to mitering,\n // so fragment texture coordinate might be out-of-bounds.\n float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);\n s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;\n float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);\n\n czm_materialInput materialInput;\n\n materialInput.s = s;\n materialInput.st = vec2(s, t);\n materialInput.str = vec3(s, t, 0.0);\n\n czm_material material = czm_getMaterial(materialInput);\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n\n // Premultiply alpha. Required for classification primitives on translucent globe.\n out_FragColor.rgb *= out_FragColor.a;\n\n czm_writeDepthClamp();\n}\n');const l=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let u="",d="";D(n.material)?(d=D(n.material)?n.material.shaderSource:"",-1!==d.search(/in\s+float\s+v_polylineAngle;/g)&&l.push("ANGLE_VARYING"),-1!==d.search(/in\s+float\s+v_width;/g)&&l.push("WIDTH_VARYING")):u="PER_INSTANCE_COLOR",l.push(u);const h=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",u]:[u],p=new bc({defines:l,sources:[s]}),f=new bc({defines:h,sources:[d,c]});e._sp=ya.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:r});let m=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!D(m)){const t=new bc({defines:l.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});m=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:t,fragmentShaderSource:f,attributeLocations:r})}e._sp2D=m;let _=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!D(_)){const t=new bc({defines:l.concat([`MAX_TERRAIN_HEIGHT ${Hh._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});c=o._batchTable.getVertexShaderCallback()("in vec3 v_forwardDirectionEC;\nin vec3 v_texcoordNormalizationAndHalfWidth;\nin float v_batchId;\n\n#ifdef PER_INSTANCE_COLOR\nin vec4 v_color;\n#else\nin vec2 v_alignedPlaneDistances;\nin float v_texcoordT;\n#endif\n\nfloat rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {\n // We don't expect the ray to ever be parallel to the plane\n return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);\n}\n\nvoid main(void)\n{\n vec4 eyeCoordinate = gl_FragCoord;\n eyeCoordinate /= eyeCoordinate.w;\n\n#ifdef PER_INSTANCE_COLOR\n out_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\n // Use distances for planes aligned with segment to prevent skew in dashing\n float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);\n float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);\n\n // Clamp - distance to aligned planes may be negative due to mitering\n distanceFromStart = max(0.0, distanceFromStart);\n distanceFromEnd = max(0.0, distanceFromEnd);\n\n float s = distanceFromStart / (distanceFromStart + distanceFromEnd);\n s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;\n\n czm_materialInput materialInput;\n\n materialInput.s = s;\n materialInput.st = vec2(s, v_texcoordT);\n materialInput.str = vec3(s, v_texcoordT, 0.0);\n\n czm_material material = czm_getMaterial(materialInput);\n out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n}\n");const n=new bc({defines:h,sources:[d,c]});_=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:t,fragmentShaderSource:n,attributeLocations:r})}e._spMorph=_}(n,t,i)},i._createCommandsFunction=function(e,t,i,o,r,s,a){!function(e,t,n,i,o,r){const s=e._primitive,a=s._va.length;o.length=a,r.length=a;const c=t instanceof Av?{}:n._uniforms,l=s._batchTable.getUniformMapCallback()(c);for(let u=0;u<a;u++){const t=s._va[u];let n=o[u];D(n)||(n=o[u]=new Kr({owner:e,primitiveType:s._primitiveType})),n.vertexArray=t,n.renderState=e._renderState,n.shaderProgram=e._sp,n.uniformMap=l,n.pass=zt.TERRAIN_CLASSIFICATION,n.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const i=Kr.shallowClone(n,n.derivedCommands.tileset);i.renderState=e._renderState3DTiles,i.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=i;const r=Kr.shallowClone(n,n.derivedCommands.color2D);r.shaderProgram=e._sp2D,n.derivedCommands.color2D=r;const a=Kr.shallowClone(i,i.derivedCommands.color2D);a.shaderProgram=e._sp2D,i.derivedCommands.color2D=a;const c=Kr.shallowClone(n,n.derivedCommands.colorMorph);c.renderState=e._renderStateMorph,c.shaderProgram=e._spMorph,c.pickId="czm_batchTable_pickColor(v_batchId)",n.derivedCommands.colorMorph=c}}(n,t,i,0,s,a)},i._updateAndQueueCommandsFunction=function(e,t,i,o,r,s,a,c){!function(e,t,n,i,o,r,s){const a=e._primitive;let c;V_._updateBoundingVolumes(a,t,o),t.mode===gl.SCENE3D?c=a._boundingSphereWC:t.mode===gl.COLUMBUS_VIEW?c=a._boundingSphereCV:t.mode===gl.SCENE2D&&D(a._boundingSphere2D)?c=a._boundingSphere2D:D(a._boundingSphereMorph)&&(c=a._boundingSphereMorph);const l=t.mode===gl.MORPHING,u=e.classificationType,d=u!==Vf.CESIUM_3D_TILE,h=u!==Vf.TERRAIN&&!l;let p;const f=t.passes;if(f.render||f.pick&&a.allowPicking){const e=n.length;for(let i=0;i<e;++i){const e=c[i];d&&(p=n[i],Iv(0,p,t,o,r,e,s)),h&&(p=n[i].derivedCommands.tileset,Iv(0,p,t,o,r,e,s))}}}(n,t,i,0,r,s,a)},this._primitive=new V_(i)}if(this.appearance instanceof Av&&!this._hasPerInstanceColors)throw new P("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push((()=>{!this._ready&&D(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))}))},Sv.prototype.getGeometryInstanceAttributes=function(e){if(!D(this._primitive))throw new P("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)},Sv.isSupported=function(e){return e.frameState.context.depthTexture},Sv.prototype.isDestroyed=function(){return!1},Sv.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,He(this)};const Ov=new kt(1,1),Dv=Ot.WHITE;function Pv(e){e=M(e,M.EMPTY_OBJECT),this._definitionChanged=new gi,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 Nv(e){if(e instanceof Ot)return new Oh(e);if("string"==typeof e||e instanceof Bi||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new Pv;return t.image=e,t}throw new P(`Unable to infer material type: ${e}`)}function Rv(e,t){return gu(e,t,Nv)}function Lv(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}Object.defineProperties(Pv.prototype,{isConstant:{get:function(){return Ou.isConstant(this._image)&&Ou.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:gu("image"),repeat:gu("repeat"),color:gu("color"),transparent:gu("transparent")}),Pv.prototype.getType=function(e){return"Image"},Pv.prototype.getValue=function(e,t){return D(t)||(t={}),t.image=Ou.getValueOrUndefined(this._image,e),t.repeat=Ou.getValueOrClonedDefault(this._repeat,e,Ov,t.repeat),t.color=Ou.getValueOrClonedDefault(this._color,e,Dv,t.color),Ou.getValueOrDefault(this._transparent,e,false)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t},Pv.prototype.equals=function(e){return this===e||e instanceof Pv&&Ou.equals(this._image,e._image)&&Ou.equals(this._repeat,e._repeat)&&Ou.equals(this._color,e._color)&&Ou.equals(this._transparent,e._transparent)},Object.defineProperties(Lv.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),dimensions:gu("dimensions"),heightReference:gu("heightReference"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition")}),Lv.prototype.clone=function(e){return D(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 Lv(this)},Lv.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.dimensions=M(this.dimensions,e.dimensions),this.heightReference=M(this.heightReference,e.heightReference),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)};const Mv=Object.freeze({FIXED:0,INERTIAL:1});function Fv(){P.throwInstantiationError()}Object.defineProperties(Fv.prototype,{isConstant:{get:P.throwInstantiationError},definitionChanged:{get:P.throwInstantiationError},referenceFrame:{get:P.throwInstantiationError}}),Fv.prototype.getValue=P.throwInstantiationError,Fv.prototype.getValueInReferenceFrame=P.throwInstantiationError,Fv.prototype.equals=P.throwInstantiationError;const Bv=new re;function zv(e,t){this._definitionChanged=new gi,this._value=H.clone(e),this._referenceFrame=M(t,Mv.FIXED)}function Uv(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function kv(e){return e}function Vv(e,t){return gu(e,t,kv)}function Hv(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function Gv(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function jv(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function Wv(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}Fv.convertToReferenceFrame=function(e,t,n,i,o){if(!D(t))return t;if(D(o)||(o=new H),n===i)return H.clone(t,o);let r=Cr.computeIcrfToFixedMatrix(e,Bv);return D(r)||(r=Cr.computeTemeToPseudoFixedMatrix(e,Bv)),n===Mv.INERTIAL?re.multiplyByVector(r,t,o):n===Mv.FIXED?re.multiplyByVector(re.transpose(r,Bv),t,o):void 0},Object.defineProperties(zv.prototype,{isConstant:{get:function(){return!D(this._value)||this._referenceFrame===Mv.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}}),zv.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Mv.FIXED,t)},zv.prototype.setValue=function(e,t){let n=!1;H.equals(this._value,e)||(n=!0,this._value=H.clone(e)),D(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)},zv.prototype.getValueInReferenceFrame=function(e,t,n){if(!D(e))throw new P("time is required.");if(!D(t))throw new P("referenceFrame is required.");return Fv.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)},zv.prototype.equals=function(e){return this===e||e instanceof zv&&H.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame},Object.defineProperties(Uv.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),positions:gu("positions"),width:gu("width"),height:gu("height"),heightReference:gu("heightReference"),extrudedHeight:gu("extrudedHeight"),extrudedHeightReference:gu("extrudedHeightReference"),cornerType:gu("cornerType"),granularity:gu("granularity"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition"),classificationType:gu("classificationType"),zIndex:gu("zIndex")}),Uv.prototype.clone=function(e){return D(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 Uv(this)},Uv.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.positions=M(this.positions,e.positions),this.width=M(this.width,e.width),this.height=M(this.height,e.height),this.heightReference=M(this.heightReference,e.heightReference),this.extrudedHeight=M(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=M(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=M(this.cornerType,e.cornerType),this.granularity=M(this.granularity,e.granularity),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=M(this.classificationType,e.classificationType),this.zIndex=M(this.zIndex,e.zIndex)},Object.defineProperties(Hv.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),length:gu("length"),topRadius:gu("topRadius"),bottomRadius:gu("bottomRadius"),heightReference:gu("heightReference"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),numberOfVerticalLines:gu("numberOfVerticalLines"),slices:gu("slices"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition")}),Hv.prototype.clone=function(e){return D(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 Hv(this)},Hv.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.length=M(this.length,e.length),this.topRadius=M(this.topRadius,e.topRadius),this.bottomRadius=M(this.bottomRadius,e.bottomRadius),this.heightReference=M(this.heightReference,e.heightReference),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=M(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=M(this.slices,e.slices),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(Gv.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),semiMajorAxis:gu("semiMajorAxis"),semiMinorAxis:gu("semiMinorAxis"),height:gu("height"),heightReference:gu("heightReference"),extrudedHeight:gu("extrudedHeight"),extrudedHeightReference:gu("extrudedHeightReference"),rotation:gu("rotation"),stRotation:gu("stRotation"),granularity:gu("granularity"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),numberOfVerticalLines:gu("numberOfVerticalLines"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition"),classificationType:gu("classificationType"),zIndex:gu("zIndex")}),Gv.prototype.clone=function(e){return D(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 Gv(this)},Gv.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.semiMajorAxis=M(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=M(this.semiMinorAxis,e.semiMinorAxis),this.height=M(this.height,e.height),this.heightReference=M(this.heightReference,e.heightReference),this.extrudedHeight=M(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=M(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=M(this.rotation,e.rotation),this.stRotation=M(this.stRotation,e.stRotation),this.granularity=M(this.granularity,e.granularity),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=M(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=M(this.classificationType,e.classificationType),this.zIndex=M(this.zIndex,e.zIndex)},Object.defineProperties(jv.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),radii:gu("radii"),innerRadii:gu("innerRadii"),minimumClock:gu("minimumClock"),maximumClock:gu("maximumClock"),minimumCone:gu("minimumCone"),maximumCone:gu("maximumCone"),heightReference:gu("heightReference"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),stackPartitions:gu("stackPartitions"),slicePartitions:gu("slicePartitions"),subdivisions:gu("subdivisions"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition")}),jv.prototype.clone=function(e){return D(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 jv(this)},jv.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.radii=M(this.radii,e.radii),this.innerRadii=M(this.innerRadii,e.innerRadii),this.minimumClock=M(this.minimumClock,e.minimumClock),this.maximumClock=M(this.maximumClock,e.maximumClock),this.minimumCone=M(this.minimumCone,e.minimumCone),this.maximumCone=M(this.maximumCone,e.maximumCone),this.heightReference=M(this.heightReference,e.heightReference),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.stackPartitions=M(this.stackPartitions,e.stackPartitions),this.slicePartitions=M(this.slicePartitions,e.slicePartitions),this.subdivisions=M(this.subdivisions,e.subdivisions),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(Wv.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),text:gu("text"),font:gu("font"),style:gu("style"),scale:gu("scale"),showBackground:gu("showBackground"),backgroundColor:gu("backgroundColor"),backgroundPadding:gu("backgroundPadding"),pixelOffset:gu("pixelOffset"),eyeOffset:gu("eyeOffset"),horizontalOrigin:gu("horizontalOrigin"),verticalOrigin:gu("verticalOrigin"),heightReference:gu("heightReference"),fillColor:gu("fillColor"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),translucencyByDistance:gu("translucencyByDistance"),pixelOffsetScaleByDistance:gu("pixelOffsetScaleByDistance"),scaleByDistance:gu("scaleByDistance"),distanceDisplayCondition:gu("distanceDisplayCondition"),disableDepthTestDistance:gu("disableDepthTestDistance")}),Wv.prototype.clone=function(e){return D(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 Wv(this)},Wv.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.text=M(this.text,e.text),this.font=M(this.font,e.font),this.style=M(this.style,e.style),this.scale=M(this.scale,e.scale),this.showBackground=M(this.showBackground,e.showBackground),this.backgroundColor=M(this.backgroundColor,e.backgroundColor),this.backgroundPadding=M(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=M(this.pixelOffset,e.pixelOffset),this.eyeOffset=M(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=M(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=M(this.verticalOrigin,e.verticalOrigin),this.heightReference=M(this.heightReference,e.heightReference),this.fillColor=M(this.fillColor,e.fillColor),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=M(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=M(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=M(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=M(this.disableDepthTestDistance,e.disableDepthTestDistance)};const qv=new H(1,1,1),Yv=H.ZERO,Xv=_o.IDENTITY;function Qv(e,t,n){this.translation=H.clone(M(e,Yv)),this.rotation=_o.clone(M(t,Xv)),this.scale=H.clone(M(n,qv))}Qv.prototype.equals=function(e){return this===e||D(e)&&H.equals(this.translation,e.translation)&&_o.equals(this.rotation,e.rotation)&&H.equals(this.scale,e.scale)};const $v=new Qv;function Kv(e){e=M(e,M.EMPTY_OBJECT),this._definitionChanged=new gi,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}function Zv(e,t){this._propertyNames=[],this._definitionChanged=new gi,D(e)&&this.merge(e,t)}function Jv(e){return new mu(e)}function eA(e){return new Kv(e)}function tA(e){this._definitionChanged=new gi,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this._customShader=void 0,this._customShaderSubscription=void 0,this.merge(M(e,M.EMPTY_OBJECT))}function nA(e){this._definitionChanged=new gi,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(M(e,M.EMPTY_OBJECT))}function iA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function oA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function rA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function sA(e,t){this.positions=D(e)?e:[],this.holes=D(t)?t:[]}function aA(e){this._definitionChanged=new gi,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this._textureCoordinates=void 0,this._textureCoordinatesSubscription=void 0,this.merge(M(e,M.EMPTY_OBJECT))}function cA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function lA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function uA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}function dA(e){this._definitionChanged=new gi,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(M(e,M.EMPTY_OBJECT))}Object.defineProperties(Kv.prototype,{isConstant:{get:function(){return Ou.isConstant(this._translation)&&Ou.isConstant(this._rotation)&&Ou.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:gu("translation"),rotation:gu("rotation"),scale:gu("scale")}),Kv.prototype.getValue=function(e,t){return D(t)||(t=new Qv),t.translation=Ou.getValueOrClonedDefault(this._translation,e,$v.translation,t.translation),t.rotation=Ou.getValueOrClonedDefault(this._rotation,e,$v.rotation,t.rotation),t.scale=Ou.getValueOrClonedDefault(this._scale,e,$v.scale,t.scale),t},Kv.prototype.equals=function(e){return this===e||e instanceof Kv&&Ou.equals(this._translation,e._translation)&&Ou.equals(this._rotation,e._rotation)&&Ou.equals(this._scale,e._scale)},Object.defineProperties(Zv.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,n=e.length;t<n;t++)if(!Ou.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}}),Zv.prototype.hasProperty=function(e){return-1!==this._propertyNames.indexOf(e)},Zv.prototype.addProperty=function(e,t,n){const i=this._propertyNames;if(!D(e))throw new P("propertyName is required.");if(-1!==i.indexOf(e))throw new P(`${e} is already a registered property.`);i.push(e),Object.defineProperty(this,e,gu(e,!0,M(n,Jv))),D(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)},Zv.prototype.removeProperty=function(e){const t=this._propertyNames.indexOf(e);if(!D(e))throw new P("propertyName is required.");if(-1===t)throw new P(`${e} is not a registered property.`);this._propertyNames.splice(t,1),delete this[e],this._definitionChanged.raiseEvent(this)},Zv.prototype.getValue=function(e,t){if(!D(e))throw new P("time is required.");D(t)||(t={});const n=this._propertyNames;for(let i=0,o=n.length;i<o;i++){const o=n[i];t[o]=Ou.getValueOrUndefined(this[o],e,t[o])}return t},Zv.prototype.merge=function(e,t){if(!D(e))throw new P("source is required.");const n=this._propertyNames,i=D(e._propertyNames)?e._propertyNames:Object.keys(e);for(let o=0,r=i.length;o<r;o++){const r=i[o],s=this[r],a=e[r];void 0===s&&-1===n.indexOf(r)&&this.addProperty(r,void 0,t),void 0!==a&&(void 0!==s?D(s)&&D(s.merge)&&s.merge(a):D(a)&&D(a.merge)&&D(a.clone)?this[r]=a.clone():this[r]=a)}},Zv.prototype.equals=function(e){return this===e||e instanceof Zv&&function(e,t){const n=e._propertyNames,i=t._propertyNames,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;++r){const o=n[r];if(-1===i.indexOf(o))return!1;if(!Ou.equals(e[o],t[o]))return!1}return!0}(this,e)},Object.defineProperties(tA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),uri:gu("uri"),scale:gu("scale"),minimumPixelSize:gu("minimumPixelSize"),maximumScale:gu("maximumScale"),incrementallyLoadTextures:gu("incrementallyLoadTextures"),runAnimations:gu("runAnimations"),clampAnimations:gu("clampAnimations"),shadows:gu("shadows"),heightReference:gu("heightReference"),silhouetteColor:gu("silhouetteColor"),silhouetteSize:gu("silhouetteSize"),color:gu("color"),colorBlendMode:gu("colorBlendMode"),colorBlendAmount:gu("colorBlendAmount"),imageBasedLightingFactor:gu("imageBasedLightingFactor"),lightColor:gu("lightColor"),distanceDisplayCondition:gu("distanceDisplayCondition"),nodeTransformations:gu("nodeTransformations",void 0,(function(e){return new Zv(e,eA)})),articulations:gu("articulations",void 0,(function(e){return new Zv(e)})),clippingPlanes:gu("clippingPlanes"),customShader:gu("customShader")}),tA.prototype.clone=function(e){return D(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e.customShader=this.customShader,e):new tA(this)},tA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.uri=M(this.uri,e.uri),this.scale=M(this.scale,e.scale),this.minimumPixelSize=M(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=M(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=M(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=M(this.runAnimations,e.runAnimations),this.clampAnimations=M(this.clampAnimations,e.clampAnimations),this.shadows=M(this.shadows,e.shadows),this.heightReference=M(this.heightReference,e.heightReference),this.silhouetteColor=M(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=M(this.silhouetteSize,e.silhouetteSize),this.color=M(this.color,e.color),this.colorBlendMode=M(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=M(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=M(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=M(this.lightColor,e.lightColor),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=M(this.clippingPlanes,e.clippingPlanes),this.customShader=M(this.customShader,e.customShader);const t=e.nodeTransformations;if(D(t)){const e=this.nodeTransformations;D(e)?e.merge(t):this.nodeTransformations=new Zv(t,eA)}const n=e.articulations;if(D(n)){const e=this.articulations;D(e)?e.merge(n):this.articulations=new Zv(n)}},Object.defineProperties(nA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),uri:gu("uri"),maximumScreenSpaceError:gu("maximumScreenSpaceError")}),nA.prototype.clone=function(e){return D(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new nA(this)},nA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.uri=M(this.uri,e.uri),this.maximumScreenSpaceError=M(this.maximumScreenSpaceError,e.maximumScreenSpaceError)},Object.defineProperties(iA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),leadTime:gu("leadTime"),trailTime:gu("trailTime"),width:gu("width"),resolution:gu("resolution"),material:Rv("material"),distanceDisplayCondition:gu("distanceDisplayCondition")}),iA.prototype.clone=function(e){return D(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 iA(this)},iA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.leadTime=M(this.leadTime,e.leadTime),this.trailTime=M(this.trailTime,e.trailTime),this.width=M(this.width,e.width),this.resolution=M(this.resolution,e.resolution),this.material=M(this.material,e.material),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(oA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),plane:gu("plane"),dimensions:gu("dimensions"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition")}),oA.prototype.clone=function(e){return D(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 oA(this)},oA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.plane=M(this.plane,e.plane),this.dimensions=M(this.dimensions,e.dimensions),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(rA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),pixelSize:gu("pixelSize"),heightReference:gu("heightReference"),color:gu("color"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),scaleByDistance:gu("scaleByDistance"),translucencyByDistance:gu("translucencyByDistance"),distanceDisplayCondition:gu("distanceDisplayCondition"),disableDepthTestDistance:gu("disableDepthTestDistance")}),rA.prototype.clone=function(e){return D(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 rA(this)},rA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.pixelSize=M(this.pixelSize,e.pixelSize),this.heightReference=M(this.heightReference,e.heightReference),this.color=M(this.color,e.color),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.scaleByDistance=M(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=M(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=M(this.disableDepthTestDistance,e.disableDepthTestDistance)},Object.defineProperties(aA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),hierarchy:gu("hierarchy",void 0,(function(e){return Array.isArray(e)&&(e=new sA(e)),new mu(e)})),height:gu("height"),heightReference:gu("heightReference"),extrudedHeight:gu("extrudedHeight"),extrudedHeightReference:gu("extrudedHeightReference"),stRotation:gu("stRotation"),granularity:gu("granularity"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),perPositionHeight:gu("perPositionHeight"),closeTop:gu("closeTop"),closeBottom:gu("closeBottom"),arcType:gu("arcType"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition"),classificationType:gu("classificationType"),zIndex:gu("zIndex"),textureCoordinates:gu("textureCoordinates")}),aA.prototype.clone=function(e){return D(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e.textureCoordinates=this.textureCoordinates,e):new aA(this)},aA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.hierarchy=M(this.hierarchy,e.hierarchy),this.height=M(this.height,e.height),this.heightReference=M(this.heightReference,e.heightReference),this.extrudedHeight=M(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=M(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=M(this.stRotation,e.stRotation),this.granularity=M(this.granularity,e.granularity),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.perPositionHeight=M(this.perPositionHeight,e.perPositionHeight),this.closeTop=M(this.closeTop,e.closeTop),this.closeBottom=M(this.closeBottom,e.closeBottom),this.arcType=M(this.arcType,e.arcType),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=M(this.classificationType,e.classificationType),this.zIndex=M(this.zIndex,e.zIndex),this.textureCoordinates=M(this.textureCoordinates,e.textureCoordinates)},Object.defineProperties(cA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),positions:gu("positions"),width:gu("width"),granularity:gu("granularity"),material:Rv("material"),depthFailMaterial:Rv("depthFailMaterial"),arcType:gu("arcType"),clampToGround:gu("clampToGround"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition"),classificationType:gu("classificationType"),zIndex:gu("zIndex")}),cA.prototype.clone=function(e){return D(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 cA(this)},cA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.positions=M(this.positions,e.positions),this.width=M(this.width,e.width),this.granularity=M(this.granularity,e.granularity),this.material=M(this.material,e.material),this.depthFailMaterial=M(this.depthFailMaterial,e.depthFailMaterial),this.arcType=M(this.arcType,e.arcType),this.clampToGround=M(this.clampToGround,e.clampToGround),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=M(this.classificationType,e.classificationType),this.zIndex=M(this.zIndex,e.zIndex)},Object.defineProperties(lA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),positions:gu("positions"),shape:gu("shape"),cornerType:gu("cornerType"),granularity:gu("granularity"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition")}),lA.prototype.clone=function(e){return D(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 lA(this)},lA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.positions=M(this.positions,e.positions),this.shape=M(this.shape,e.shape),this.cornerType=M(this.cornerType,e.cornerType),this.granularity=M(this.granularity,e.granularity),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)},Object.defineProperties(uA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),coordinates:gu("coordinates"),height:gu("height"),heightReference:gu("heightReference"),extrudedHeight:gu("extrudedHeight"),extrudedHeightReference:gu("extrudedHeightReference"),rotation:gu("rotation"),stRotation:gu("stRotation"),granularity:gu("granularity"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition"),classificationType:gu("classificationType"),zIndex:gu("zIndex")}),uA.prototype.clone=function(e){return D(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 uA(this)},uA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.coordinates=M(this.coordinates,e.coordinates),this.height=M(this.height,e.height),this.heightReference=M(this.heightReference,e.heightReference),this.extrudedHeight=M(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=M(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=M(this.rotation,e.rotation),this.stRotation=M(this.stRotation,e.stRotation),this.granularity=M(this.granularity,e.granularity),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=M(this.classificationType,e.classificationType),this.zIndex=M(this.zIndex,e.zIndex)},Object.defineProperties(dA.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:gu("show"),positions:gu("positions"),minimumHeights:gu("minimumHeights"),maximumHeights:gu("maximumHeights"),granularity:gu("granularity"),fill:gu("fill"),material:Rv("material"),outline:gu("outline"),outlineColor:gu("outlineColor"),outlineWidth:gu("outlineWidth"),shadows:gu("shadows"),distanceDisplayCondition:gu("distanceDisplayCondition")}),dA.prototype.clone=function(e){return D(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 dA(this)},dA.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.show=M(this.show,e.show),this.positions=M(this.positions,e.positions),this.minimumHeights=M(this.minimumHeights,e.minimumHeights),this.maximumHeights=M(this.maximumHeights,e.maximumHeights),this.granularity=M(this.granularity,e.granularity),this.fill=M(this.fill,e.fill),this.material=M(this.material,e.material),this.outline=M(this.outline,e.outline),this.outlineColor=M(this.outlineColor,e.outlineColor),this.outlineWidth=M(this.outlineWidth,e.outlineWidth),this.shadows=M(this.shadows,e.shadows),this.distanceDisplayCondition=M(this.distanceDisplayCondition,e.distanceDisplayCondition)};const hA=new Qt,pA=[];function fA(e){return new zv(e)}function mA(e,t){return gu(e,void 0,(function(e){return e instanceof t?e:new t(e)}))}function _A(e){let t=(e=M(e,M.EMPTY_OBJECT)).id;D(t)||(t=ke()),this._availability=void 0,this._id=t,this._definitionChanged=new gi,this._name=e.name,this._show=M(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall",...pA],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function gA(e,t,n){const i=t.length;for(let o=0;o<i;o++){const e=t[o],i=e._show;(!n&&i)!==(n&&i)&&gA(e,e._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}var yA;Object.defineProperties(_A.prototype,{availability:Vv("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:Vv("name"),show:{get:function(){return this._show},set:function(e){if(!D(e))throw new P("value is required.");if(e===this._show)return;const t=this.isShowing;this._show=e;const n=this.isShowing;t!==n&&gA(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!D(this.entityCollection)||this.entityCollection.show)&&(!D(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){const t=this._parent;if(t===e)return;const n=this.isShowing;if(D(t)){const e=t._children.indexOf(this);t._children.splice(e,1)}this._parent=e,D(e)&&e._children.push(this);const i=this.isShowing;n!==i&&gA(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:mA("billboard",yu),box:mA("box",Lv),corridor:mA("corridor",Uv),cylinder:mA("cylinder",Hv),description:gu("description"),ellipse:mA("ellipse",Gv),ellipsoid:mA("ellipsoid",jv),label:mA("label",Wv),model:mA("model",tA),tileset:mA("tileset",nA),orientation:gu("orientation"),path:mA("path",iA),plane:mA("plane",oA),point:mA("point",rA),polygon:mA("polygon",aA),polyline:mA("polyline",cA),polylineVolume:mA("polylineVolume",lA),properties:mA("properties",Zv),position:(yA="position",gu(yA,void 0,fA)),rectangle:mA("rectangle",uA),viewFrom:gu("viewFrom"),wall:mA("wall",dA)}),_A.registerEntityType=function(e,t){Object.defineProperties(_A.prototype,{[e]:mA(e,t)}),pA.includes(e)||pA.push(e)},_A.prototype.isAvailable=function(e){if(!D(e))throw new P("time is required.");const t=this._availability;return!D(t)||t.contains(e)},_A.prototype.addProperty=function(e){const t=this._propertyNames;if(!D(e))throw new P("propertyName is required.");if(-1!==t.indexOf(e))throw new P(`${e} is already a registered property.`);if(e in this)throw new P(`${e} is a reserved property name.`);t.push(e),Object.defineProperty(this,e,Vv(e,!0))},_A.prototype.removeProperty=function(e){const t=this._propertyNames.indexOf(e);if(!D(e))throw new P("propertyName is required.");if(-1===t)throw new P(`${e} is not a registered property.`);this._propertyNames.splice(t,1),delete this[e]},_A.prototype.merge=function(e){if(!D(e))throw new P("source is required.");this.name=M(this.name,e.name),this.availability=M(this.availability,e.availability);const t=this._propertyNames,n=D(e._propertyNames)?e._propertyNames:Object.keys(e),i=n.length;for(let o=0;o<i;o++){const i=n[o];if("parent"===i||"name"===i||"availability"===i||"children"===i)continue;const r=this[i],s=e[i];D(r)||-1!==t.indexOf(i)||this.addProperty(i),D(s)&&(D(r)?D(r.merge)&&r.merge(s):D(s.merge)&&D(s.clone)?this[i]=s.clone():this[i]=s)}};const bA=new re,vA=new H,AA=new _o;_A.prototype.computeModelMatrix=function(e,t){L.typeOf.object("time",e);const n=Ou.getValueOrUndefined(this._position,e,vA);if(!D(n))return;const i=Ou.getValueOrUndefined(this._orientation,e,AA);return t=D(i)?ve.fromRotationTranslation(re.fromQuaternion(i,bA),n,t):Cr.eastNorthUpToFixedFrame(n,void 0,t)},_A.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){L.typeOf.object("time",e);const r=Ou.getValueOrDefault(t,e,wu.NONE);let s=Ou.getValueOrUndefined(this._position,e,vA);if(r===wu.NONE||!D(s)||H.equalsEpsilon(s,H.ZERO,V.EPSILON8))return this.computeModelMatrix(e,o);const a=i.cartesianToCartographic(s,hA);Eu(r)?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);const c=Ou.getValueOrUndefined(this._orientation,e,AA);return o=D(c)?ve.fromRotationTranslation(re.fromQuaternion(c,bA),s,o):Cr.eastNorthUpToFixedFrame(s,void 0,o)},_A.supportsMaterialsforEntitiesOnTerrain=function(e){return gy.supportsMaterials(e)},_A.supportsPolylinesOnTerrain=function(e){return Sv.isSupported(e)};const TA=new Oh(Ot.WHITE),wA=new mu(!0),EA=new mu(!0),xA=new mu(!1),SA=new mu(Ot.BLACK),CA=new mu(k_.DISABLED),IA=new mu(new vu),OA=new mu(Vf.BOTH);function DA(e){L.defined("options.entity",e.entity),L.defined("options.scene",e.scene),L.defined("options.geometryOptions",e.geometryOptions),L.defined("options.geometryPropertyName",e.geometryPropertyName),L.defined("options.observedPropertyNames",e.observedPropertyNames);const t=e.entity,n=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new gi,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=n,this._id=`${n}-${t.id}`,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=_A.supportsMaterialsforEntitiesOnTerrain(e.scene)}function PA(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new gi,this.setCallback(e,t)}Object.defineProperties(DA.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||!D(this._entity.availability)&&Ou.isConstant(this._showProperty)&&Ou.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!D(this._entity.availability)&&Ou.isConstant(this._showProperty)&&Ou.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}}}),DA.prototype.isOutlineVisible=function(e){const t=this._entity;return M(this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e),!1)},DA.prototype.isFilled=function(e){const t=this._entity;return M(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e),!1)},DA.prototype.createFillGeometryInstance=P.throwInstantiationError,DA.prototype.createOutlineGeometryInstance=P.throwInstantiationError,DA.prototype.isDestroyed=function(){return!1},DA.prototype.destroy=function(){He(this)},DA.prototype._isHidden=function(e,t){const n=t.show;return D(n)&&n.isConstant&&!n.getValue(ih.MINIMUM_VALUE)},DA.prototype._isOnTerrain=function(e,t){return!1},DA.prototype._getIsClosed=function(e){return!0},DA.prototype._isDynamic=P.throwInstantiationError,DA.prototype._setStaticOptions=P.throwInstantiationError,DA.prototype._onEntityPropertyChanged=function(e,t,n,i){if(-1===this._observedPropertyNames.indexOf(t))return;const o=this._entity[this._geometryPropertyName];if(!D(o))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));const r=o.fill,s=!D(r)||!r.isConstant||r.getValue(ih.MINIMUM_VALUE),a=o.outline;let c=D(a);if(c&&a.isConstant&&(c=a.getValue(ih.MINIMUM_VALUE)),!s&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));const l=o.show;if(this._isHidden(e,o))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));this._materialProperty=M(o.material,TA),this._fillProperty=M(r,EA),this._showProperty=M(l,wA),this._showOutlineProperty=M(o.outline,xA),this._outlineColorProperty=c?M(o.outlineColor,SA):void 0,this._shadowsProperty=M(o.shadows,CA),this._distanceDisplayConditionProperty=M(o.distanceDisplayCondition,IA),this._classificationTypeProperty=M(o.classificationType,OA),this._fillEnabled=s;const u=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof Oh);if(c&&u&&(Oa(Oa.geometryOutlines),c=!1),this._onTerrain=u,this._outlineEnabled=c,this._isDynamic(e,o))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,o),this._isClosed=this._getIsClosed(this._options);const t=o.outlineWidth;this._outlineWidth=D(t)?t.getValue(ih.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}},DA.prototype.createDynamicUpdater=function(e,t){if(L.defined("primitives",e),L.defined("groundPrimitives",t),!this._dynamic)throw new P("This instance does not represent dynamic geometry.");return new this.constructor.DynamicGeometryUpdater(this,e,t)},Object.defineProperties(PA.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}}),PA.prototype.getValue=function(e,t){return this._callback(e,t)},PA.prototype.setCallback=function(e,t){if(!D(e))throw new P("callback is required.");if(!D(t))throw new P("isConstant is required.");const n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)},PA.prototype.equals=function(e){return this===e||e instanceof PA&&this._callback===e._callback&&this._isConstant===e._isConstant};const NA=new H;function RA(e,t,n,i){L.defined("scene",e),L.defined("positionProperty",t),this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new H,this._cartographicPosition=new Qt,this._normal=new H,this._definitionChanged=new gi,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;const o=this;if(D(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener((function(){o._updateClamping()})),this._removeModeListener=e.morphComplete.addEventListener((function(){o._updateClamping()}))),t.isConstant){const n=t.getValue(ih.MINIMUM_VALUE,NA);if(!D(n)||H.equals(n,H.ZERO)||!D(e.globe))return;this._position=H.clone(n,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(n,this._normal)}}function LA(e,t,n,i){if(DA.prototype._onEntityPropertyChanged.call(this,e,t,n,i),-1===this._observedPropertyNames.indexOf(t))return;const o=this._entity[this._geometryPropertyName];if(!D(o))return;D(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference;if(D(r)){const e=new PA(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new RA(this._scene,e,r)}}Object.defineProperties(RA.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}}),RA.prototype._updateClamping=function(){D(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,n=this._position;if(H.equals(n,H.ZERO))return void(this._terrainHeight=0);const i=t.ellipsoid.cartesianToCartographic(n,this._cartographicPosition),o=e.getHeight(i,this._heightReference);D(o)?this._terrainHeight=o:this._terrainHeight=0;this._removeCallbackFunc=e.updateHeight(i,(e=>{this._terrainHeight=e.height,this.definitionChanged.raiseEvent()}),this._heightReference)},RA.prototype.getValue=function(e,t){const n=Ou.getValueOrDefault(this._heightReference,e,wu.NONE),i=Ou.getValueOrDefault(this._extrudedHeightReference,e,wu.NONE);if(n===wu.NONE&&!xu(i))return this._position=H.clone(H.ZERO,this._position),H.clone(H.ZERO,t);if(this._positionProperty.isConstant)return H.multiplyByScalar(this._normal,this._terrainHeight,t);const o=this._scene,r=this._positionProperty.getValue(e,NA);if(!D(r)||H.equals(r,H.ZERO)||!D(o.globe))return H.clone(H.ZERO,t);if(H.equalsEpsilon(this._position,r,V.EPSILON10))return H.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=H.clone(r,this._position),this._updateClamping();const s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return H.multiplyByScalar(s,this._terrainHeight,t)},RA.prototype.isDestroyed=function(){return!1},RA.prototype.destroy=function(){return D(this._removeEventListener)&&this._removeEventListener(),D(this._removeModeListener)&&this._removeModeListener(),D(this._removeCallbackFunc)&&this._removeCallbackFunc(),He(this)};const MA=H.ZERO,FA=new H,BA=new H,zA=new Ot;function UA(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function kA(e,t){DA.call(this,{entity:e,scene:t,geometryOptions:new UA(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}function VA(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(kA.prototype=Object.create(DA.prototype),kA.prototype.constructor=kA),Object.defineProperties(kA.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),kA.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r={show:i,distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o),color:void 0,offset:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,zA)),D(t)||(t=Ot.WHITE),r.color=$d.fromColor(t)}return D(this._options.offsetAttribute)&&(r.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,MA,FA))),new Zd({id:t,geometry:Ud.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:r})},kA.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,zA),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o),offset:void 0};return D(this._options.offsetAttribute)&&(r.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,MA,FA))),new Zd({id:t,geometry:qd.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,.5*this._options.dimensions.z,this._scene.mapProjection.ellipsoid),attributes:r})},kA.prototype._computeCenter=function(e,t){return Ou.getValueOrUndefined(this._entity.position,e,t)},kA.prototype._isHidden=function(e,t){return!D(t.dimensions)||!D(e.position)||DA.prototype._isHidden.call(this,e,t)},kA.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Ou.isConstant(e.orientation)&&t.dimensions.isConstant&&Ou.isConstant(t.outlineWidth))},kA.prototype._setStaticOptions=function(e,t){const n=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Oh?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(ih.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==wu.NONE?Fd.ALL:void 0},kA.prototype._onEntityPropertyChanged=LA,kA.DynamicGeometryUpdater=VA,D(Object.create)&&(VA.prototype=Object.create(Dy.prototype),VA.prototype.constructor=VA),VA.prototype._isHidden=function(e,t,n){const i=Ou.getValueOrUndefined(e.position,n,BA),o=this._options.dimensions;return!D(i)||!D(o)||Dy.prototype._isHidden.call(this,e,t,n)},VA.prototype._setOptions=function(e,t,n){const i=Ou.getValueOrDefault(t.heightReference,n,wu.NONE),o=this._options;o.dimensions=Ou.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==wu.NONE?Fd.ALL:void 0};
|
||
/*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */
|
||
const{entries:HA,setPrototypeOf:GA,isFrozen:jA,getPrototypeOf:WA,getOwnPropertyDescriptor:qA}=Object;let{freeze:YA,seal:XA,create:QA}=Object,{apply:$A,construct:KA}="undefined"!=typeof Reflect&&Reflect;YA||(YA=function(e){return e}),XA||(XA=function(e){return e}),$A||($A=function(e,t,n){return e.apply(t,n)}),KA||(KA=function(e,t){return new e(...t)});const ZA=hT(Array.prototype.forEach),JA=hT(Array.prototype.pop),eT=hT(Array.prototype.push),tT=hT(String.prototype.toLowerCase),nT=hT(String.prototype.toString),iT=hT(String.prototype.match),oT=hT(String.prototype.replace),rT=hT(String.prototype.indexOf),sT=hT(String.prototype.trim),aT=hT(Object.prototype.hasOwnProperty),cT=hT(RegExp.prototype.test),lT=(uT=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return KA(uT,t)});var uT;function dT(e){return"number"==typeof e&&isNaN(e)}function hT(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return $A(e,t,i)}}function pT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tT;GA&&GA(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(jA(t)||(t[i]=e),o=e)}e[o]=!0}return e}function fT(e){for(let t=0;t<e.length;t++){aT(e,t)||(e[t]=null)}return e}function mT(e){const t=QA(null);for(const[n,i]of HA(e)){aT(e,n)&&(Array.isArray(i)?t[n]=fT(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=mT(i):t[n]=i)}return t}function _T(e,t){for(;null!==e;){const n=qA(e,t);if(n){if(n.get)return hT(n.get);if("function"==typeof n.value)return hT(n.value)}e=WA(e)}return function(){return null}}const gT=YA(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yT=YA(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bT=YA(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),vT=YA(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),AT=YA(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),TT=YA(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wT=YA(["#text"]),ET=YA(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xT=YA(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ST=YA(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),CT=YA(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),IT=XA(/\{\{[\w\W]*|[\w\W]*\}\}/gm),OT=XA(/<%[\w\W]*|[\w\W]*%>/gm),DT=XA(/\${[\w\W]*}/gm),PT=XA(/^data-[\-\w.\u00B7-\uFFFF]/),NT=XA(/^aria-[\-\w]+$/),RT=XA(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),LT=XA(/^(?:\w+script|data):/i),MT=XA(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),FT=XA(/^html$/i),BT=XA(/^[a-z][.\w]*(-[.\w]+)+$/i);var zT=Object.freeze({__proto__:null,MUSTACHE_EXPR:IT,ERB_EXPR:OT,TMPLIT_EXPR:DT,DATA_ATTR:PT,ARIA_ATTR:NT,IS_ALLOWED_URI:RT,IS_SCRIPT_OR_DATA:LT,ATTR_WHITESPACE:MT,DOCTYPE_NAME:FT,CUSTOM_ELEMENT:BT});const UT=1,kT=3,VT=7,HT=8,GT=9;var jT=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.1.4",n.removed=[],!t||!t.document||t.document.nodeType!==GT)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:c,Element:l,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,m=l.prototype,_=_T(m,"cloneNode"),g=_T(m,"nextSibling"),y=_T(m,"childNodes"),b=_T(m,"parentNode");if("function"==typeof a){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let v,A="";const{implementation:T,createNodeIterator:w,createDocumentFragment:E,getElementsByTagName:x}=i,{importNode:S}=o;let C={};n.isSupported="function"==typeof HA&&"function"==typeof b&&T&&void 0!==T.createHTMLDocument;const{MUSTACHE_EXPR:I,ERB_EXPR:O,TMPLIT_EXPR:D,DATA_ATTR:P,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:M}=zT;let{IS_ALLOWED_URI:F}=zT,B=null;const z=pT({},[...gT,...yT,...bT,...AT,...wT]);let U=null;const k=pT({},[...ET,...xT,...ST,...CT]);let V=Object.seal(QA(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),H=null,G=null,j=!0,W=!0,q=!1,Y=!0,X=!1,Q=!0,$=!1,K=!1,Z=!1,J=!1,ee=!1,te=!1,ne=!0,ie=!1,oe=!0,re=!1,se={},ae=null;const ce=pT({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const ue=pT({},["audio","video","img","source","image","track"]);let de=null;const he=pT({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",fe="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let _e=me,ge=!1,ye=null;const be=pT({},[pe,fe,me],nT);let ve=null;const Ae=["application/xhtml+xml","text/html"];let Te=null,we=null;const Ee=i.createElement("form"),xe=function(e){return e instanceof RegExp||e instanceof Function},Se=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!we||we!==e){if(e&&"object"==typeof e||(e={}),e=mT(e),ve=-1===Ae.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Te="application/xhtml+xml"===ve?nT:tT,B=aT(e,"ALLOWED_TAGS")?pT({},e.ALLOWED_TAGS,Te):z,U=aT(e,"ALLOWED_ATTR")?pT({},e.ALLOWED_ATTR,Te):k,ye=aT(e,"ALLOWED_NAMESPACES")?pT({},e.ALLOWED_NAMESPACES,nT):be,de=aT(e,"ADD_URI_SAFE_ATTR")?pT(mT(he),e.ADD_URI_SAFE_ATTR,Te):he,le=aT(e,"ADD_DATA_URI_TAGS")?pT(mT(ue),e.ADD_DATA_URI_TAGS,Te):ue,ae=aT(e,"FORBID_CONTENTS")?pT({},e.FORBID_CONTENTS,Te):ce,H=aT(e,"FORBID_TAGS")?pT({},e.FORBID_TAGS,Te):{},G=aT(e,"FORBID_ATTR")?pT({},e.FORBID_ATTR,Te):{},se=!!aT(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,X=e.SAFE_FOR_TEMPLATES||!1,Q=!1!==e.SAFE_FOR_XML,$=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,ee=e.RETURN_DOM_FRAGMENT||!1,te=e.RETURN_TRUSTED_TYPE||!1,Z=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||RT,_e=e.NAMESPACE||me,V=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(W=!1),ee&&(J=!0),se&&(B=pT({},wT),U=[],!0===se.html&&(pT(B,gT),pT(U,ET)),!0===se.svg&&(pT(B,yT),pT(U,xT),pT(U,CT)),!0===se.svgFilters&&(pT(B,bT),pT(U,xT),pT(U,CT)),!0===se.mathMl&&(pT(B,AT),pT(U,ST),pT(U,CT))),e.ADD_TAGS&&(B===z&&(B=mT(B)),pT(B,e.ADD_TAGS,Te)),e.ADD_ATTR&&(U===k&&(U=mT(U)),pT(U,e.ADD_ATTR,Te)),e.ADD_URI_SAFE_ATTR&&pT(de,e.ADD_URI_SAFE_ATTR,Te),e.FORBID_CONTENTS&&(ae===ce&&(ae=mT(ae)),pT(ae,e.FORBID_CONTENTS,Te)),oe&&(B["#text"]=!0),$&&pT(B,["html","head","body"]),B.table&&(pT(B,["tbody"]),delete H.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw lT('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw lT('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(r){return null}}(f,r)),null!==v&&"string"==typeof A&&(A=v.createHTML(""));YA&&YA(e),we=e}},Ce=pT({},["mi","mo","mn","ms","mtext"]),Ie=pT({},["foreignobject","annotation-xml"]),Oe=pT({},["title","style","font","a","script"]),De=pT({},[...yT,...bT,...vT]),Pe=pT({},[...AT,...TT]),Ne=function(e){eT(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Re=function(e,t){try{eT(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(i){eT(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!U[e])if(J||ee)try{Ne(t)}catch(i){}else try{t.setAttribute(e,"")}catch(i){}},Le=function(e){let t=null,n=null;if(Z)e="<remove></remove>"+e;else{const t=iT(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ve&&_e===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(_e===me)try{t=(new p).parseFromString(o,ve)}catch(s){}if(!t||!t.documentElement){t=T.createDocument(_e,"template",null);try{t.documentElement.innerHTML=ge?A:o}catch(s){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),_e===me?x.call(t,$?"html":"body")[0]:$?t.documentElement:r},Me=function(e){return w.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Fe=function(e){return e instanceof h&&(void 0!==e.__depth&&"number"!=typeof e.__depth||void 0!==e.__removalCount&&"number"!=typeof e.__removalCount||"string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof c&&e instanceof c},ze=function(e,t,i){C[e]&&ZA(C[e],(e=>{e.call(n,t,i,we)}))},Ue=function(e){let t=null;if(ze("beforeSanitizeElements",e,null),Fe(e))return Ne(e),!0;const i=Te(e.nodeName);if(ze("uponSanitizeElement",e,{tagName:i,allowedTags:B}),e.hasChildNodes()&&!Be(e.firstElementChild)&&cT(/<[/\w]/g,e.innerHTML)&&cT(/<[/\w]/g,e.textContent))return Ne(e),!0;if(e.nodeType===VT)return Ne(e),!0;if(Q&&e.nodeType===HT&&cT(/<[/\w]/g,e.data))return Ne(e),!0;if(!B[i]||H[i]){if(!H[i]&&Ve(i)){if(V.tagNameCheck instanceof RegExp&&cT(V.tagNameCheck,i))return!1;if(V.tagNameCheck instanceof Function&&V.tagNameCheck(i))return!1}if(oe&&!ae[i]){const t=b(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=_(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,g(e))}}}return Ne(e),!0}return e instanceof l&&!function(e){let t=b(e);t&&t.tagName||(t={namespaceURI:_e,tagName:"template"});const n=tT(e.tagName),i=tT(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===fe?t.namespaceURI===me?"svg"===n:t.namespaceURI===pe?"svg"===n&&("annotation-xml"===i||Ce[i]):Boolean(De[n]):e.namespaceURI===pe?t.namespaceURI===me?"math"===n:t.namespaceURI===fe?"math"===n&&Ie[i]:Boolean(Pe[n]):e.namespaceURI===me?!(t.namespaceURI===fe&&!Ie[i])&&!(t.namespaceURI===pe&&!Ce[i])&&!Pe[n]&&(Oe[n]||!De[n]):!("application/xhtml+xml"!==ve||!ye[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!cT(/<\/no(script|embed|frames)/i,e.innerHTML)?(X&&e.nodeType===kT&&(t=e.textContent,ZA([I,O,D],(e=>{t=oT(t,e," ")})),e.textContent!==t&&(eT(n.removed,{element:e.cloneNode()}),e.textContent=t)),ze("afterSanitizeElements",e,null),!1):(Ne(e),!0)},ke=function(e,t,n){if(ne&&("id"===t||"name"===t)&&(n in i||n in Ee||"__depth"===n||"__removalCount"===n))return!1;if(W&&!G[t]&&cT(P,t));else if(j&&cT(N,t));else if(!U[t]||G[t]){if(!(Ve(e)&&(V.tagNameCheck instanceof RegExp&&cT(V.tagNameCheck,e)||V.tagNameCheck instanceof Function&&V.tagNameCheck(e))&&(V.attributeNameCheck instanceof RegExp&&cT(V.attributeNameCheck,t)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(t))||"is"===t&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&cT(V.tagNameCheck,n)||V.tagNameCheck instanceof Function&&V.tagNameCheck(n))))return!1}else if(de[t]);else if(cT(F,oT(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==rT(n,"data:")||!le[e]){if(q&&!cT(R,oT(n,L,"")));else if(n)return!1}else;return!0},Ve=function(e){return"annotation-xml"!==e&&iT(e,M)},He=function(e){ze("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U};let o=t.length;for(;o--;){const s=t[o],{name:a,namespaceURI:c,value:l}=s,u=Te(a);let d="value"===a?l:sT(l);if(i.attrName=u,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,ze("uponSanitizeAttribute",e,i),d=i.attrValue,i.forceKeepAttr)continue;if(Re(a,e),!i.keepAttr)continue;if(!Y&&cT(/\/>/i,d)){Re(a,e);continue}if(Q&&cT(/((--!?|])>)|<\/(style|title)/i,d)){Re(a,e);continue}X&&ZA([I,O,D],(e=>{d=oT(d,e," ")}));const h=Te(e.nodeName);if(ke(h,u,d)){if(!ie||"id"!==u&&"name"!==u||(Re(a,e),d="user-content-"+d),v&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(c);else switch(f.getAttributeType(h,u)){case"TrustedHTML":d=v.createHTML(d);break;case"TrustedScriptURL":d=v.createScriptURL(d)}try{c?e.setAttributeNS(c,a,d):e.setAttribute(a,d),Fe(e)?Ne(e):JA(n.removed)}catch(r){}}}ze("afterSanitizeAttributes",e,null)},Ge=function e(t){let n=null;const i=Me(t);for(ze("beforeSanitizeShadowDOM",t,null);n=i.nextNode();){if(ze("uponSanitizeShadowNode",n,null),Ue(n))continue;const t=b(n);n.nodeType===UT&&(t&&t.__depth?n.__depth=(n.__removalCount||0)+t.__depth+1:n.__depth=1),(n.__depth>=255||n.__depth<0||dT(n.__depth))&&Ne(n),n.content instanceof s&&(n.content.__depth=n.__depth,e(n.content)),He(n)}ze("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,a=null,l=null;if(ge=!e,ge&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw lT("toString is not a function");if("string"!=typeof(e=e.toString()))throw lT("dirty is not a string, aborting")}if(!n.isSupported)return e;if(K||Se(t),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=Te(e.nodeName);if(!B[t]||H[t])throw lT("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)i=Le("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===UT&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!J&&!X&&!$&&-1===e.indexOf("<"))return v&&te?v.createHTML(e):e;if(i=Le(e),!i)return J?null:te?A:""}i&&Z&&Ne(i.firstChild);const u=Me(re?e:i);for(;a=u.nextNode();){if(Ue(a))continue;const e=b(a);a.nodeType===UT&&(e&&e.__depth?a.__depth=(a.__removalCount||0)+e.__depth+1:a.__depth=1),(a.__depth>=255||a.__depth<0||dT(a.__depth))&&Ne(a),a.content instanceof s&&(a.content.__depth=a.__depth,Ge(a.content)),He(a)}if(re)return e;if(J){if(ee)for(l=E.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(U.shadowroot||U.shadowrootmode)&&(l=S.call(o,l,!0)),l}let d=$?i.outerHTML:i.innerHTML;return $&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&cT(FT,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),X&&ZA([I,O,D],(e=>{d=oT(d,e," ")})),v&&te?v.createHTML(d):d},n.setConfig=function(){Se(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),K=!0},n.clearConfig=function(){we=null,K=!1},n.isValidAttribute=function(e,t,n){we||Se({});const i=Te(e),o=Te(t);return ke(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&(C[e]=C[e]||[],eT(C[e],t))},n.removeHook=function(e){if(C[e])return JA(C[e])},n.removeHooks=function(e){C[e]&&(C[e]=[])},n.removeAllHooks=function(){C={}},n}();let WT=0;const qT={};function YT(e,t){let n;L.typeOf.string("html",e);const i=e;D(qT[i])?n=qT[i]:(n=WT++,qT[i]=n),t=M(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(YT.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen},set:function(e){this._showOnScreen=e}},element:{get:function(){if(!D(this._element)){const e=jT.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;const n=t.querySelectorAll("a");for(let i=0;i<n.length;i++)n[i].setAttribute("target","_blank");this._element=t}return this._element}}}),YT.equals=function(e,t){return e===t||D(e)&&D(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen},YT.prototype.equals=function(e){return YT.equals(this,e)},YT.prototype.isIon=function(){return-1!==this.html.indexOf("ion-credit.png")},YT.getIonCredit=function(e){const t=D(e.collapsible)&&!e.collapsible;return new YT(e.html,t)},YT.clone=function(e){if(D(e))return new YT(e.html,e.showOnScreen)};function XT(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._errorEvent=new gi}Object.defineProperties(XT.prototype,{url:{get:function(){return this._url}},errorEvent:{get:function(){return this._errorEvent}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}}}),XT.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const QT=new H(1,0,0),$T=new H(0,0,1),KT=new H(-1,0,0),ZT=new H(0,0,-1),JT=new H(0,1,0),ew=[JT,KT,$T,new H(0,-1,0),QT,JT,ZT,JT,JT],tw=ew.length,nw=new Float32Array(3*tw);let iw=0;for(let ko=0;ko<tw;++ko,iw+=3)H.pack(ew[ko],nw,iw);const ow=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),rw=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 sw(e){return function(){return e}}function aw(e){let t,n;e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();const i=e._cubeMaps;if(D(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();const o=e._mipTextures;if(D(o))for(n=o.length,t=0;t<n;++t)o[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}function cw(e){const t=D((e=M(e,M.EMPTY_OBJECT)).imageBasedLightingFactor)?kt.clone(e.imageBasedLightingFactor):new kt(1,1);L.typeOf.object("options.imageBasedLightingFactor",t),L.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),L.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1),L.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.y",t.y,0),L.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.y",t.y,1),this._imageBasedLightingFactor=t;const n=M(e.luminanceAtZenith,.2);L.typeOf.number("options.luminanceAtZenith",n),this._luminanceAtZenith=n;const i=e.sphericalHarmonicCoefficients;if(D(i)&&(!Array.isArray(i)||9!==i.length))throw new P("options.sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._sphericalHarmonicCoefficients=i,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapAtlas=void 0,this._specularEnvironmentMapAtlasDirty=!0,this._specularEnvironmentMapLoaded=!1,this._previousSpecularEnvironmentMapLoaded=!1,this._useDefaultSpecularMaps=!1,this._useDefaultSphericalHarmonics=!1,this._shouldRegenerateShaders=!1,this._previousFrameNumber=void 0,this._previousImageBasedLightingFactor=kt.clone(t),this._previousLuminanceAtZenith=n,this._previousSphericalHarmonicCoefficients=i,this._removeErrorListener=void 0}let lw;XT.prototype.update=function(e){const t=e.context;if(!XT.isSupported(t))return;if(D(this._texture)&&D(this._va)&&aw(this),D(this._texture))return;if(!D(this._texture)&&!this._loading){const t=e.context.textureCache.getTexture(this._url);D(t)&&(aw(this),this._texture=t,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0)}const n=this._cubeMapBuffers;if(!D(n)&&!this._loading){const e=this;ec(this._url).then((function(t){e._cubeMapBuffers=t,e._loading=!1})).catch((function(t){e.isDestroyed()||e._errorEvent.raiseEvent(t)})),this._loading=!0}if(!D(this._cubeMapBuffers))return;const i=[];let o=n[0].positiveX.pixelDatatype;D(o)?i.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?ts.HALF_FLOAT:ts.FLOAT;const r=is.RGBA,s=new bc({defines:i,sources:["in vec3 v_cubeMapCoordinates;\nuniform samplerCube cubeMap;\n\nvoid main()\n{\n vec4 rgba = czm_textureCube(cubeMap, v_cubeMapCoordinates);\n #ifdef RGBA_NORMALIZED\n out_FragColor = vec4(rgba.rgb, 1.0);\n #else\n float m = rgba.a * 16.0;\n vec3 r = rgba.rgb * m;\n out_FragColor = vec4(r * r, 1.0);\n #endif\n}\n"]});this._va=function(e){const t=Ye.createVertexBuffer({context:e,typedArray:ow,usage:qe.STATIC_DRAW}),n=Ye.createVertexBuffer({context:e,typedArray:nw,usage:qe.STATIC_DRAW}),i=Ye.createIndexBuffer({context:e,typedArray:rw,usage:qe.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});return new kl({context:e,attributes:[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:Ca.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:Ca.FLOAT}],indexBuffer:i})}(t),this._sp=ya.fromCache({context:t,vertexShaderSource:"in vec4 position;\nin vec3 cubeMapCoordinates;\n\nout vec3 v_cubeMapCoordinates;\n\nvoid main()\n{\n gl_Position = position;\n v_cubeMapCoordinates = cubeMapCoordinates;\n}\n",fragmentShaderSource:s,attributeLocations:{position:0,cubeMapCoordinates:1}});const a=Math.min(n.length,6);this._maximumMipmapLevel=a-1;const c=this._cubeMaps=new Array(a),l=this._mipTextures=new Array(a),u=2*n[0].positiveX.width,d={originalSize:function(){return u}};for(let p=0;p<a;++p){const i=n[p].positiveY;n[p].positiveY=n[p].negativeY,n[p].negativeY=i;const s=c[p]=new dc({context:t,source:n[p],pixelDatatype:o}),a=2*c[p].width,u=l[p]=new Sc({context:t,width:a,height:a,pixelDatatype:o,pixelFormat:r}),h=new Ut({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:sw(s)},outputTexture:u,persists:!0,owner:this});e.commandList.push(h),d[`texture${p}`]=sw(u)}this._texture=new Sc({context:t,width:1.5*u+2,height:u,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const h=new Ut({fragmentShaderSource:"in vec2 v_textureCoordinates;\n\nuniform float originalSize;\nuniform sampler2D texture0;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\n\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));\n\nvoid main()\n{\n vec2 uv = v_textureCoordinates;\n vec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);\n vec2 pixel = 1.0 / textureSize;\n\n float mipLevel = 0.0;\n\n if (uv.x - pixel.x > (textureSize.y / textureSize.x))\n {\n mipLevel = 1.0;\n if (uv.y - pixel.y > yMipLevel1)\n {\n mipLevel = 2.0;\n if (uv.y - pixel.y * 3.0 > yMipLevel2)\n {\n mipLevel = 3.0;\n if (uv.y - pixel.y * 5.0 > yMipLevel3)\n {\n mipLevel = 4.0;\n if (uv.y - pixel.y * 7.0 > yMipLevel4)\n {\n mipLevel = 5.0;\n }\n }\n }\n }\n }\n\n if (mipLevel > 0.0)\n {\n float scale = pow(2.0, mipLevel);\n\n uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);\n uv.x *= ((textureSize.x - 2.0) / textureSize.y);\n\n uv.x -= 1.0 + pixel.x;\n uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));\n uv *= scale;\n }\n else\n {\n uv.x *= (textureSize.x / textureSize.y);\n }\n\n if(mipLevel == 0.0)\n {\n out_FragColor = texture(texture0, uv);\n }\n else if(mipLevel == 1.0)\n {\n out_FragColor = texture(texture1, uv);\n }\n else if(mipLevel == 2.0)\n {\n out_FragColor = texture(texture2, uv);\n }\n else if(mipLevel == 3.0)\n {\n out_FragColor = texture(texture3, uv);\n }\n else if(mipLevel == 4.0)\n {\n out_FragColor = texture(texture4, uv);\n }\n else if(mipLevel == 5.0)\n {\n out_FragColor = texture(texture5, uv);\n }\n else\n {\n out_FragColor = vec4(0.0);\n }\n}\n",uniformMap:d,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(h),this._ready=!0},XT.prototype.isDestroyed=function(){return!1},XT.prototype.destroy=function(){return aw(this),this._texture=this._texture&&this._texture.destroy(),He(this)},Object.defineProperties(cw.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){L.typeOf.object("imageBasedLightingFactor",e),L.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.x",e.x,0),L.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.x",e.x,1),L.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.y",e.y,0),L.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.y",e.y,1),this._previousImageBasedLightingFactor=kt.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=kt.clone(e,this._imageBasedLightingFactor)}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){this._previousLuminanceAtZenith=this._luminanceAtZenith,this._luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){if(D(e)&&(!Array.isArray(e)||9!==e.length))throw new P("sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._specularEnvironmentMapAtlasDirty=this._specularEnvironmentMapAtlasDirty||e!==this._specularEnvironmentMaps,this._specularEnvironmentMapLoaded=!1),this._specularEnvironmentMaps=e}},enabled:{get:function(){return this._imageBasedLightingFactor.x>0||this._imageBasedLightingFactor.y>0}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useSphericalHarmonicCoefficients:{get:function(){return D(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return D(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}}),cw.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;const t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;const n=this._imageBasedLightingFactor,i=this._previousImageBasedLightingFactor;kt.equals(n,i)||(this._shouldRegenerateShaders=n.x>0&&0===i.x||0===n.x&&i.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||n.y>0&&0===i.y||0===n.y&&i.y>0,this._previousImageBasedLightingFactor=kt.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||D(this._luminanceAtZenith)!==D(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||D(this._previousSphericalHarmonicCoefficients)!==D(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(!function(e,t){if(XT.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),D(e._specularEnvironmentMaps)){const t=new XT(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=t,e._removeErrorListener=t.errorEvent.addEventListener((e=>{}))}e._shouldRegenerateShaders=!0}}(this,t),this._specularEnvironmentMapAtlasDirty=!1),D(this._specularEnvironmentMapAtlas)&&(this._specularEnvironmentMapAtlas.update(e),this._specularEnvironmentMapAtlas.ready&&(this._specularEnvironmentMapLoaded=!0));const o=!D(this._specularEnvironmentMapAtlas)&&D(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!D(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!D(this._sphericalHarmonicCoefficients)&&D(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!D(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!D(this._specularEnvironmentMapAtlas)&&D(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!D(this._sphericalHarmonicCoefficients)&&D(e.sphericalHarmonicCoefficients)},cw.prototype.isDestroyed=function(){return!1},cw.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),this._removeErrorListener=this._removeErrorListener&&this._removeErrorListener(),He(this)};const uw="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYzAzYzE4NS0yZmJiLTQ5NzUtOWJlYS0zNjdkMzc2ODBmZDgiLCJpZCI6MjU5LCJpYXQiOjE3MTQ1NzE1MDN9.tIhlyfC7MHSWrQmoAqkvQdXMbg3igaC2HIbQp1HKCVM",dw={};dw.defaultAccessToken=uw,dw.defaultServer=new Bi({url:"https://api.cesium.com/"}),dw.getDefaultTokenCredit=function(e){if(e===uw){if(!D(lw)){lw=new YT('<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 lw}};const hw=dw;function pw(e,t){let n;L.defined("endpoint",e),L.defined("endpointResource",t);const i=e.externalType,o=D(i);if(o){if("3DTILES"!==i&&"STK_TERRAIN_SERVER"!==i)throw new be("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");n={url:e.options.url}}else n={url:e.url,retryAttempts:1,retryCallback:fw};Bi.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new ei(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}function fw(e,t){const n=M(e._ionRoot,e),i=n._ionEndpointResource,o="undefined"!=typeof Image;return D(t)&&(401===t.statusCode||o&&t.target instanceof Image)?(D(n._pendingPromise)||(n._pendingPromise=i.fetchJson().then((function(e){return n._ionEndpoint=e,e})).finally((function(e){return n._pendingPromise=void 0,e}))),n._pendingPromise.then((function(t){return e._ionEndpoint=t,!0}))):Promise.resolve(!1)}function mw(e){e=M(e,0),this._array=new Array(e),this._length=e}D(Object.create)&&(pw.prototype=Object.create(Bi.prototype),pw.prototype.constructor=pw),pw.fromAssetId=function(e,t){const n=pw._createEndpointResource(e,t);return n.fetchJson().then((function(e){return new pw(e,n)}))},Object.defineProperties(pw.prototype,{credits:{get:function(){return D(this._ionRoot)?this._ionRoot.credits:(D(this._credits)||(this._credits=pw.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource)),this._credits)}}}),pw.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(YT.getIonCredit),i=hw.getDefaultTokenCredit(t.queryParameters.access_token);return D(i)&&n.push(YT.clone(i)),n},pw.prototype.clone=function(e){const t=M(this._ionRoot,this);return D(e)||(e=new pw(t._ionEndpoint,t._ionEndpointResource)),(e=Bi.prototype.clone.call(this,e))._ionRoot=t,e._isExternal=this._isExternal,e},pw.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},D(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Bi.prototype.fetchImage.call(this,e)},pw.prototype._makeRequest=function(e){return this._isExternal||new ei(this.url).authority()!==this._ionEndpointDomain||(D(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,e.headers["X-Cesium-Client"]="CesiumJS","undefined"!=typeof CESIUM_VERSION&&(e.headers["X-Cesium-Client-Version"]=CESIUM_VERSION)),Bi.prototype._makeRequest.call(this,e)},pw._createEndpointResource=function(e,t){L.defined("assetId",e),t=M(t,M.EMPTY_OBJECT);let n=M(t.server,hw.defaultServer);const i=M(t.accessToken,hw.defaultAccessToken);n=Bi.createIfNeeded(n);const o={url:`v1/assets/${e}/endpoint`};return D(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)},Object.defineProperties(mw.prototype,{length:{get:function(){return this._length},set:function(e){L.typeOf.number.greaterThanOrEquals("length",e,0);const t=this._array,n=this._length;if(e<n)for(let i=e;i<n;++i)t[i]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}}),mw.prototype.get=function(e){return L.typeOf.number.lessThan("index",e,this._array.length),this._array[e]},mw.prototype.set=function(e,t){L.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t},mw.prototype.peek=function(){return this._array[this._length-1]},mw.prototype.push=function(e){const t=this.length++;this._array[t]=e},mw.prototype.pop=function(){if(0===this._length)return;const e=this._array[this._length-1];return--this.length,e},mw.prototype.reserve=function(e){L.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)},mw.prototype.resize=function(e){L.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e},mw.prototype.trim=function(e){e=M(e,this._length),this._array.length=e};const _w={X:0,Y:1,Z:2};_w.Y_UP_TO_Z_UP=ve.fromRotationTranslation(re.fromArray([1,0,0,0,0,1,0,-1,0])),_w.Z_UP_TO_Y_UP=ve.fromRotationTranslation(re.fromArray([1,0,0,0,0,-1,0,1,0])),_w.X_UP_TO_Z_UP=ve.fromRotationTranslation(re.fromArray([0,0,1,0,1,0,-1,0,0])),_w.Z_UP_TO_X_UP=ve.fromRotationTranslation(re.fromArray([0,0,-1,0,1,0,1,0,0])),_w.X_UP_TO_Y_UP=ve.fromRotationTranslation(re.fromArray([0,1,0,-1,0,0,0,0,1])),_w.Y_UP_TO_X_UP=ve.fromRotationTranslation(re.fromArray([0,-1,0,1,0,0,0,0,1])),_w.fromName=function(e){return L.typeOf.string("name",e),_w[e]};const gw=Object.freeze(_w);function yw(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}function bw(e,t,n){if(!D(e))throw new P("uint8Array is required.");if(t<0)throw new P("byteOffset cannot be negative.");if(n<0)throw new P("byteLength cannot be negative.");if(t+n>e.byteLength)throw new P("sub-region exceeds array bounds.");return t=M(t,0),n=M(n,e.byteLength-t),e=e.subarray(t,t+n),bw.decode(e)}function vw(e,t,n){return t<=e&&e<=n}function Aw(e,t){return bw(e,t=M(t,0),Math.min(4,e.length))}function Tw(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,D(i)||(i=[]),this._contents=i,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(yw.prototype,{metadata:{get:function(){return this._metadata}}}),bw.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)},bw.decodeWithFromCharCode=function(e){let t="";const n=function(e){let t=0,n=0,i=0,o=128,r=191;const s=[],a=e.length;for(let c=0;c<a;++c){const a=e[c];if(0===i){if(vw(a,0,127)){s.push(a);continue}if(vw(a,194,223)){i=1,t=31&a;continue}if(vw(a,224,239)){224===a&&(o=160),237===a&&(r=159),i=2,t=15&a;continue}if(vw(a,240,244)){240===a&&(o=144),244===a&&(r=143),i=3,t=7&a;continue}throw new be("String decoding failed.")}vw(a,o,r)?(o=128,r=191,t=t<<6|63&a,++n,n===i&&(s.push(t),t=i=n=0)):(t=i=n=0,o=128,r=191,--c)}return s}(e),i=n.length;for(let o=0;o<i;++o){let e=n[o];e<=65535?t+=String.fromCharCode(e):(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(1023&e)))}return t},"undefined"!=typeof TextDecoder?bw.decode=bw.decodeWithTextDecoder:bw.decode=bw.decodeWithFromCharCode,Object.defineProperties(Tw.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].metadata=e}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].group=e}}});const ww=Uint32Array.BYTES_PER_ELEMENT;function Ew(e,t,n){return JSON.parse(bw(e,t,n))}function xw(e){L.typeOf.number("options.featuresLength",e.featuresLength),L.typeOf.object("options.owner",e.owner),this._id=ke();const t=e.featuresLength;let n,i;if(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=[],t>0){const e=Math.min(t,rs.maximumTextureSize),o=Math.ceil(t/rs.maximumTextureSize),r=1/e,s=.5*r,a=1/o,c=.5*a;n=new kt(e,o),i=new K(r,s,a,c)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}function Sw(e){const t=e._textureDimensions;return t.x*t.y*4}function Cw(e){if(!D(e._batchValues)){const t=Sw(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function Iw(e){if(!D(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function Ow(e,t){if(!D(e)||e<0||e>=t)throw new P(`batchId is required and between zero and featuresLength - 1 (${t}`-NaN)}Tw.fromTileType=async function(e,t,n,i,o,r){o=M(o,0);const s=new Uint8Array(i),a=new DataView(i);o+=ww;const c=a.getUint32(o,!0);if(1!==c)throw new be(`Only Composite Tile version 1 is supported. Version ${c} is not.`);o+=ww,o+=ww;const l=a.getUint32(o,!0);o+=ww;let u=n.queryParameters.compositeIndex;u=D(u)?`${u}_`:"";const d=[];d.length=l;for(let h=0;h<l;++h){const c=Aw(s,o),l=a.getUint32(o+2*ww,!0),p=r[c],f=`${u}${h}`,m=n.getDerivedResource({queryParameters:{compositeIndex:f}});if(!D(p))throw new be(`Unknown tile content type, ${c}, inside Composite tile`);d[h]=Promise.resolve(p(e,t,m,i,o)),o+=l}return new Tw(e,t,n,await Promise.all(d))},Tw.prototype.hasProperty=function(e,t){return!1},Tw.prototype.getFeature=function(e){},Tw.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)},Tw.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)},Tw.prototype.update=function(e,t){const n=this._contents,i=n.length;let o=!0;for(let r=0;r<i;++r)n[r].update(e,t),o=o&&n[r].ready;!this._ready&&o&&(this._ready=!0)},Tw.prototype.pick=function(e,t,n){if(!this._ready)return;let i,o=Number.POSITIVE_INFINITY;const r=this._contents,s=r.length;for(let a=0;a<s;++a){const s=r[a].pick(e,t,n);if(!D(s))continue;const c=H.distance(e.origin,s);c<o&&(i=s,o=c)}return D(i)?n:void 0},Tw.prototype.isDestroyed=function(){return!1},Tw.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)},Object.defineProperties(xw.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return D(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),D(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}}),xw.DEFAULT_COLOR_VALUE=Ot.WHITE,xw.DEFAULT_SHOW_VALUE=!0,xw.prototype.setShow=function(e,t){if(Ow(e,this._featuresLength),L.typeOf.bool("show",t),t&&!D(this._showAlphaProperties))return;const n=Iw(this),i=2*e,o=t?255:0;if(n[i]!==o){n[i]=o;Cw(this)[4*e+3]=t?n[i+1]:0,this._batchValuesDirty=!0}},xw.prototype.setAllShow=function(e){L.typeOf.bool("show",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)},xw.prototype.getShow=function(e){if(Ow(e,this._featuresLength),!D(this._showAlphaProperties))return!0;const t=2*e;return 255===this._showAlphaProperties[t]};const Dw=new Array(4);function Pw(e,t,n){const i=e._textureDimensions;return new Sc({context:t,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:uc.NEAREST})}xw.prototype.setColor=function(e,t){if(Ow(e,this._featuresLength),L.typeOf.object("color",t),Ot.equals(t,xw.DEFAULT_COLOR_VALUE)&&!D(this._batchValues))return;const n=t.toBytes(Dw),i=n[3],o=Cw(this),r=4*e,s=Iw(this),a=2*e;if(o[r]!==n[0]||o[r+1]!==n[1]||o[r+2]!==n[2]||s[a+1]!==i){o[r]=n[0],o[r+1]=n[1],o[r+2]=n[2];const c=255!==s[a+1],l=0!==s[a];o[r+3]=l?i:0,s[a+1]=i;const u=255!==i;u&&!c?++this._translucentFeaturesLength:!u&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,D(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}},xw.prototype.setAllColor=function(e){L.typeOf.object("color",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)},xw.prototype.getColor=function(e,t){if(Ow(e,this._featuresLength),L.typeOf.object("result",t),!D(this._batchValues))return Ot.clone(xw.DEFAULT_COLOR_VALUE,t);const n=this._batchValues,i=4*e,o=this._showAlphaProperties,r=2*e;return Ot.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)},xw.prototype.getPickColor=function(e){return Ow(e,this._featuresLength),this._pickIds[e]},xw.prototype.update=function(e,t){const n=t.context;this._defaultTexture=n.defaultTexture;const i=t.passes;(i.pick||i.postProcess)&&function(e,t){const n=e._featuresLength;if(!D(e._pickTexture)&&n>0){const i=e._pickIds,o=Sw(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let e=0;e<n;++e){const n=t.createPickId(s.getFeature(e));i.push(n);const o=n.color,a=4*e;r[a]=Ot.floatToByte(o.red),r[a+1]=Ot.floatToByte(o.green),r[a+2]=Ot.floatToByte(o.blue),r[a+3]=Ot.floatToByte(o.alpha)}e._pickTexture=Pw(e,t,r),D(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,D(this._batchTexture)||(this._batchTexture=Pw(this,n,this._batchValues),D(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),function(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}(this))},xw.prototype.isDestroyed=function(){return!1},xw.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();const e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};const Nw={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Rw={SCALAR:void 0,VEC2:kt,VEC3:H,VEC4:K,MAT2:Ms,MAT3:re,MAT4:ve};function Lw(e){const t=e.componentType;let n;n="string"==typeof t?Ca.fromName(t):t;const i=Nw[e.type],o=Rw[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(e,t,o){return Ca.createArrayBufferView(n,e,t,i*o)}}}function Mw(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,this._byteLength=0,L.typeOf.object("options.extension",e.extension),function(e,t,n){let i,o,r;const s=t.instancesLength,a=t.classes;let c,l=t.classIds,u=t.parentCounts,d=t.parentIds,h=s,p=0;D(l.byteOffset)&&(l.componentType=M(l.componentType,Ca.UNSIGNED_SHORT),l.type=Zf.SCALAR,r=Lw(l),l=r.createArrayBufferView(n.buffer,n.byteOffset+l.byteOffset,s),p+=l.byteLength);if(D(u)){for(D(u.byteOffset)&&(u.componentType=M(u.componentType,Ca.UNSIGNED_SHORT),u.type=Zf.SCALAR,r=Lw(u),u=r.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,s),p+=u.byteLength),c=new Uint16Array(s),h=0,i=0;i<s;++i)c[i]=h,h+=u[i];p+=c.byteLength}D(d)&&D(d.byteOffset)&&(d.componentType=M(d.componentType,Ca.UNSIGNED_SHORT),d.type=Zf.SCALAR,r=Lw(d),d=r.createArrayBufferView(n.buffer,n.byteOffset+d.byteOffset,h),p+=d.byteLength);const f=a.length;for(i=0;i<f;++i){const e=a[i].length,t=a[i].instances,o=Fw(e,t,n);p+=Bw(o),a[i].instances=ni(o,t)}const m=new Array(f).fill(0),_=new Uint16Array(s);for(i=0;i<s;++i)o=l[i],_[i]=m[o],++m[o];p+=_.byteLength,e._classes=a,e._classIds=l,e._classIndexes=_,e._parentCounts=u,e._parentIndexes=c,e._parentIds=d,e._byteLength=p}(this,e.extension,e.binaryBody),function(e){const t=zw;t.length=0;const n=e._classIds.length;for(let i=0;i<n;++i)Uw(e,i,t)}(this)}function Fw(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(D(s)){const t=r.componentType,a=r.type;if(!D(t))throw new be("componentType is required.");if(!D(a))throw new be("type is required.");if(!D(n))throw new be(`Property ${o} requires a batch table binary.`);const c=Lw(r),l=c.componentsPerAttribute,u=c.classType,d=c.createArrayBufferView(n.buffer,n.byteOffset+s,e);D(i)||(i={}),i[o]={typedArray:d,componentCount:l,type:u}}}return i}function Bw(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}Object.defineProperties(Mw.prototype,{byteLength:{get:function(){return this._byteLength}}});const zw=[];function Uw(e,t,n){const i=e._parentCounts,o=e._parentIds,r=e._parentIndexes,s=e._classIds.length;if(!D(o))return;if(t>=s)throw new P(`Parent index ${t} exceeds the total number of instances: ${s}`);if(n.indexOf(t)>-1)throw new P("Circular dependency detected in the batch table hierarchy.");n.push(t);const a=D(i)?i[t]:1,c=D(i)?r[t]:t;for(let l=0;l<a;++l){const i=o[c+l];i!==t&&Uw(e,i,n)}n.pop(t)}const kw=[],Vw=[];let Hw=0;function Gw(e,t,n){const i=e._parentCounts;return D(e._parentIds)?D(i)?function(e,t,n){const i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,c=kw;c.length=Math.max(c.length,a);const l=++Hw,u=Vw;for(u.length=0,u.push(t);u.length>0;){if(c[t=u.pop()]===l)continue;c[t]=l;const i=n(e,t);if(D(i))return i;const a=o[t],d=s[t];for(let e=0;e<a;++e){const n=r[d+e];n!==t&&u.push(n)}}}(e,t,n):function(e,t,n){let i=!0;for(;i;){const o=n(e,t);if(D(o))return o;const r=e._parentIds[t];i=r!==t,t=r}}(e,t,n):n(e,t)}Mw.prototype.hasProperty=function(e,t){const n=Gw(this,e,(function(e,n){const i=e._classIds[n];if(D(e._classes[i].instances[t]))return!0}));return D(n)},Mw.prototype.propertyExists=function(e){const t=this._classes,n=t.length;for(let i=0;i<n;++i){if(D(t[i].instances[e]))return!0}return!1},Mw.prototype.getPropertyIds=function(e,t){return(t=D(t)?t:[]).length=0,Gw(this,e,(function(e,n){const i=e._classIds[n],o=e._classes[i].instances;for(const r in o)o.hasOwnProperty(r)&&-1===t.indexOf(r)&&t.push(r)})),t},Mw.prototype.getProperty=function(e,t){return Gw(this,e,(function(e,n){const i=e._classIds[n],o=e._classes[i],r=e._classIndexes[n],s=o.instances[t];if(D(s))return D(s.typedArray)?function(e,t){const n=e.typedArray,i=e.componentCount;if(1===i)return n[t];return e.type.unpack(n,t*i)}(s,r):ti(s[r],!0)}))},Mw.prototype.setProperty=function(e,t,n){const i=Gw(this,e,(function(i,o){const r=i._classIds[o],s=i._classes[r],a=i._classIndexes[o],c=s.instances[t];if(D(c)){if(o!==e)throw new P(`Inherited property "${t}" is read-only.`);return D(c.typedArray)?function(e,t,n){const i=e.typedArray,o=e.componentCount;1===o?i[t]=n:e.type.pack(n,i,t*o)}(c,a,n):c[a]=ti(n,!0),!0}}));return D(i)},Mw.prototype.isClass=function(e,t){return D(Gw(this,e,(function(e,n){const i=e._classIds[n];if(e._classes[i].name===t)return!0})))},Mw.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const jw=Object.freeze({HIGHLIGHT:0,REPLACE:1,MIX:2}),Ww=xw.DEFAULT_COLOR_VALUE,qw=xw.DEFAULT_SHOW_VALUE;function Yw(e,t,n,i,o){let r;this.featuresLength=t,D(n)&&(r=n.extensions),this._extensions=M(r,{});const s=function(e){const t={};if(!D(e))return t;for(const n in e)e.hasOwnProperty(n)&&"HIERARCHY"!==n&&"extensions"!==n&&"extras"!==n&&(t[n]=ti(e[n],!0));return t}(n);this._properties=s,this._batchTableHierarchy=function(e,t,n){if(!D(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"];const o=t.HIERARCHY;D(o)&&(Yw._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=o,i=o);if(!D(i))return;return new Mw({extension:i,binaryBody:n})}(this,n,i);const a=Xw(t,s,i);this._binaryPropertiesByteLength=function(e){if(!D(e))return 0;let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new xw({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}function Xw(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(D(s)){const t=r.componentType,a=r.type;if(!D(t))throw new be("componentType is required.");if(!D(a))throw new be("type is required.");if(!D(n))throw new be(`Property ${o} requires a batch table binary.`);const c=Lw(r),l=c.componentsPerAttribute,u=c.classType,d=c.createArrayBufferView(n.buffer,n.byteOffset+s,e);D(i)||(i={}),i[o]={typedArray:d,componentCount:l,type:u}}}return i}Yw._deprecationWarning=Da,Object.defineProperties(Yw.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return D(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}}),Yw.getBinaryProperties=function(e,t,n){return Xw(e,t,n)},Yw.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},Yw.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},Yw.prototype.getShow=function(e){return this._batchTexture.getShow(e)},Yw.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},Yw.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},Yw.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},Yw.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const Qw=new Ot;function $w(e,t){if(!D(e)||e<0||e>=t)throw new P(`batchId is required and must be between zero and featuresLength - 1 (${t}`-NaN)}function Kw(e,t){return e=bc.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 out_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n out_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 Zw(e,t,n){if(!D(t))return Kw(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`);const o=e.match(i);if(!D(o))return Kw(e,n);const r=o[0],s=o[2];e=(e=bc.replaceMain(e,"tile_main")).replace(r,"");let a;if("vec3"===s||"vec4"===s){const n="vec3"===s?`vec4(${t}, 1.0)`:t,o="vec3"===s?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,o),a=` vec4 source = ${n}; \n tile_diffuse = tile_diffuse_final(source, tile_featureColor); \n tile_main(); \n`}else"sampler2D"===s&&(e=function(e,t){const n=`texture(${t}`;let i,o=0,r=e.indexOf(n,o);for(;r>-1;){let t=0;for(let n=r;n<e.length;++n){const o=e.charAt(n);if("("===o)++t;else if(")"===o&&(--t,0===t)){i=n+1;break}}const s=`tile_diffuse_final(${e.slice(r,i)}, tile_diffuse)`;e=e.slice(0,r)+s+e.slice(i),o=r+s.length,r=e.indexOf(n,o)}return e}(e,t),a=" 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${r}\n${e}\nvoid tile_color(vec4 tile_featureColor) \n{ \n${a}`,n&&(e+=" tile_featureColor = czm_gammaCorrect(tile_featureColor); \n out_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n"),e+="} \n"}Yw.prototype.applyStyle=function(e){if(!D(e))return this.setAllColor(Ww),void this.setAllShow(qw);const t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){const n=t.getFeature(i),o=D(e.color)?M(e.color.evaluateColor(n,Qw),Ww):Ww,r=D(e.show)?M(e.show.evaluate(n),qw):qw;this.setColor(i,o),this.setShow(i,r)}},Yw.prototype.isClass=function(e,t){$w(e,this.featuresLength),L.typeOf.string("className",t);const n=this._batchTableHierarchy;return!!D(n)&&n.isClass(e,t)},Yw.prototype.isExactClass=function(e,t){return L.typeOf.string("className",t),this.getExactClassName(e)===t},Yw.prototype.getExactClassName=function(e){$w(e,this.featuresLength);const t=this._batchTableHierarchy;if(D(t))return t.getClassName(e)},Yw.prototype.hasProperty=function(e,t){return $w(e,this.featuresLength),L.typeOf.string("name",t),D(this._properties[t])||D(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)},Yw.prototype.hasPropertyBySemantic=function(){return!1},Yw.prototype.getPropertyIds=function(e,t){$w(e,this.featuresLength),(t=D(t)?t:[]).length=0;const n=Object.keys(this._properties);return t.push.apply(t,n),D(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t},Yw.prototype.getPropertyBySemantic=function(e,t){},Yw.prototype.getProperty=function(e,t){if($w(e,this.featuresLength),L.typeOf.string("name",t),D(this._batchTableBinaryProperties)){const n=this._batchTableBinaryProperties[t];if(D(n))return function(e,t){const n=e.typedArray,i=e.componentCount;return 1===i?n[t]:e.type.unpack(n,t*i)}(n,e)}const n=this._properties[t];if(D(n))return ti(n[e],!0);if(D(this._batchTableHierarchy)){const n=this._batchTableHierarchy.getProperty(e,t);if(D(n))return n}},Yw.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if($w(e,i),L.typeOf.string("name",t),D(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(D(i))return void function(e,t,n){const i=e.typedArray,o=e.componentCount;1===o?i[t]=n:e.type.pack(n,i,t*o)}(i,e,n)}if(D(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];D(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=ti(n,!0)},Yw.prototype.getVertexShaderCallback=function(e,t,n){if(0===this.featuresLength)return;const i=this;return function(o){const r=Zw(o,n,!1);let s;return rs.maximumVertexTextureImageUnits>0?(s="",e&&(s+="uniform bool tile_translucentCommand; \n"),s+=`uniform sampler2D tile_batchTexture; \nout vec4 tile_featureColor; \nout vec2 tile_featureSt; \nvoid main() \n{ \n vec2 st = computeSt(${t}); \n vec4 featureProperties = texture(tile_batchTexture, st); \n tile_color(featureProperties); \n float show = ceil(featureProperties.a); \n gl_Position *= show; \n`,e&&(s+=" 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"),s+=" tile_featureColor = featureProperties; \n tile_featureSt = st; \n}"):s=`out vec2 tile_featureSt; \nvoid main() \n{ \n tile_color(vec4(1.0)); \n tile_featureSt = computeSt(${t}); \n}`,`${r}\n${a=i,1===a._batchTexture.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"}${s}`;var a}},Yw.prototype.getFragmentShaderCallback=function(e,t,n){if(0!==this.featuresLength)return function(i){return i=Zw(i,t,!0),rs.maximumVertexTextureImageUnits>0?(i+="uniform sampler2D tile_pickTexture; \nin vec2 tile_featureSt; \nin vec4 tile_featureColor; \nvoid main() \n{ \n tile_color(tile_featureColor); \n",n&&(i+=" out_FragColor.rgb *= out_FragColor.a; \n"),i+="}"):(e&&(i+="uniform bool tile_translucentCommand; \n"),i+="uniform sampler2D tile_pickTexture; \nuniform sampler2D tile_batchTexture; \nin vec2 tile_featureSt; \nvoid main() \n{ \n vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n",e&&(i+=" 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"),i+=" tile_color(featureProperties); \n",n&&(i+=" out_FragColor.rgb *= out_FragColor.a; \n"),i+="} \n"),i}},Yw.prototype.getClassificationFragmentShaderCallback=function(){if(0!==this.featuresLength)return function(e){return e=bc.replaceMain(e,"tile_main"),rs.maximumVertexTextureImageUnits>0?e+="uniform sampler2D tile_pickTexture;\nin vec2 tile_featureSt; \nin vec4 tile_featureColor; \nvoid main() \n{ \n tile_main(); \n out_FragColor = tile_featureColor; \n out_FragColor.rgb *= out_FragColor.a; \n}":e+="uniform sampler2D tile_batchTexture; \nuniform sampler2D tile_pickTexture;\nin vec2 tile_featureSt; \nvoid main() \n{ \n tile_main(); \n vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n out_FragColor = featureProperties; \n out_FragColor.rgb *= out_FragColor.a; \n} \n",e}},Yw.prototype.getUniformMapCallback=function(){if(0===this.featuresLength)return;const e=this;return function(t){return ni(t,{tile_batchTexture:function(){return M(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return function(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===jw.HIGHLIGHT)return 0;if(n===jw.REPLACE)return 1;if(n===jw.MIX)return V.clamp(i,V.EPSILON4,1);throw new P(`Invalid color blend mode "${n}".`)}(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}},Yw.prototype.getPickId=function(){return"texture(tile_pickTexture, tile_featureSt)"};const Jw=0,eE=1,tE=2;function nE(e){const t=Kr.shallowClone(e),n=t.pass===zt.TRANSLUCENT;return t.uniformMap=D(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function iE(e){const t=Kr.shallowClone(e);return t.pass=zt.TRANSLUCENT,t.renderState=function(e){const t=ti(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=dh.ALPHA_BLEND,t.stencilTest=sy.setCesium3DTileBit(),t.stencilMask=sy.CESIUM_3D_TILE_MASK,_s.fromCache(t)}(e.renderState),t}function oE(e){const t=Kr.shallowClone(e);return t.renderState=function(e){const t=ti(e,!0);return t.stencilTest=sy.setCesium3DTileBit(),t.stencilMask=sy.CESIUM_3D_TILE_MASK,_s.fromCache(t)}(e.renderState),t}function rE(e,t){const n=Kr.shallowClone(t),i=ti(n.renderState,!0);i.cull.enabled=!0,i.cull.face=ph.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=sy.setCesium3DTileBit(),i.stencilMask=sy.CESIUM_3D_TILE_MASK,n.renderState=_s.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=ti(t.uniformMap);const o=new kt(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=function(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!D(n)){const i=t.fragmentShaderSource.clone();i.defines=D(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}(e,t.shaderProgram),n}function sE(e,t){const n=Kr.shallowClone(e),i=ti(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=sy.SKIP_LOD_MASK,i.stencilTest.reference=sy.CESIUM_3D_TILE_MASK|t<<sy.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=ny.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=oy.REPLACE,i.stencilTest.backFunction=ny.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=oy.REPLACE,i.stencilMask=sy.CESIUM_3D_TILE_MASK|sy.SKIP_LOD_MASK,n.renderState=_s.fromCache(i),n}function aE(e){return(e.renderState.stencilTest.reference&sy.SKIP_LOD_MASK)>>>sy.SKIP_LOD_BIT_SHIFT}function cE(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}Yw.prototype.addDerivedCommands=function(e,t){const n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s.isSkippingLevelOfDetail&&s.hasMixedContent&&e.context.stencilBuffer,c=function(e){const t=e._batchTexture.translucentFeaturesLength;if(0===t)return Jw;if(t===e.featuresLength)return eE;return tE}(this);for(let l=t;l<i;++l){const t=n[l];if(t.pass===zt.COMPUTE)continue;let i=t.derivedCommands.tileset;D(i)&&!t.dirty||(i={},t.derivedCommands.tileset=i,i.originalCommand=nE(t),t.dirty=!1);const u=i.originalCommand;c!==Jw&&t.pass!==zt.TRANSLUCENT&&(D(i.translucent)||(i.translucent=iE(u))),c!==eE&&t.pass!==zt.TRANSLUCENT&&(D(i.opaque)||(i.opaque=oE(u)),a&&(r||(D(i.zback)||(i.zback=rE(e.context,u)),s._backfaceCommands.push(i.zback)),D(i.stencil)&&o._selectionDepth===aE(i.stencil)||(t.renderState.depthMask?i.stencil=sE(u,o._selectionDepth):i.stencil=i.opaque)));const d=a?i.stencil:i.opaque,h=i.translucent;t.pass!==zt.TRANSLUCENT?(c===Jw&&(n[l]=d),c===eE&&(n[l]=h),c===tE&&(n[l]=d,n.push(h))):n[l]=u}},Yw.prototype.update=function(e,t){this._batchTexture.update(e,t)},Yw.prototype.isDestroyed=function(){return!1},Yw.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),He(this)};const lE="in vec3 position;\nin float a_batchId;\n\nuniform mat4 u_modifiedModelViewProjection;\n\nvoid main()\n{\n gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));\n}\n";function uE(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(uE.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 D(this._color)||(this._color=new Ot),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(D(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}}),uE.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},uE.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)},uE.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},uE.getPropertyInherited=function(e,t,n){const i=e.batchTable;if(D(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}const o=e.metadata;if(D(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}const r=e.tile,s=r.metadata;if(D(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(D(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),D(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}const c=D(e.group)?e.group.metadata:void 0;if(D(c)){if(c.hasPropertyBySemantic(n))return c.getPropertyBySemantic(n);if(c.hasProperty(n))return c.getProperty(n)}const l=e.tileset.metadata;if(D(l)){if(l.hasPropertyBySemantic(n))return l.getPropertyBySemantic(n);if(l.hasProperty(n))return l.getProperty(n)}},uE.prototype.getPropertyInherited=function(e){return uE.getPropertyInherited(this._content,this._batchId,e)},uE.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},uE.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},uE.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},uE.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};class dE{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+dE.version}static addUnaryOp(e){return dE.max_unop_len=Math.max(e.length,dE.max_unop_len),dE.unary_ops[e]=1,dE}static addBinaryOp(e,t,n){return dE.max_binop_len=Math.max(e.length,dE.max_binop_len),dE.binary_ops[e]=t,n?dE.right_associative.add(e):dE.right_associative.delete(e),dE}static addIdentifierChar(e){return dE.additional_identifier_chars.add(e),dE}static addLiteral(e,t){return dE.literals[e]=t,dE}static removeUnaryOp(e){return delete dE.unary_ops[e],e.length===dE.max_unop_len&&(dE.max_unop_len=dE.getMaxKeyLen(dE.unary_ops)),dE}static removeAllUnaryOps(){return dE.unary_ops={},dE.max_unop_len=0,dE}static removeIdentifierChar(e){return dE.additional_identifier_chars.delete(e),dE}static removeBinaryOp(e){return delete dE.binary_ops[e],e.length===dE.max_binop_len&&(dE.max_binop_len=dE.getMaxKeyLen(dE.binary_ops)),dE.right_associative.delete(e),dE}static removeAllBinaryOps(){return dE.binary_ops={},dE.max_binop_len=0,dE}static removeLiteral(e){return delete dE.literals[e],dE}static removeAllLiterals(){return dE.literals={},dE}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new dE(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map((e=>e.length)))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return dE.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!dE.binary_ops[String.fromCharCode(e)]||dE.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return dE.isIdentifierStart(e)||dE.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(dE.hooks[e]){const n={context:this,node:t};return dE.hooks.run(e,n),n.node}return t}searchHook(e){if(dE.hooks[e]){const t={context:this};return dE.hooks[e].find((function(e){return e.call(t.context,t),t.node})),t.node}}gobbleSpaces(){let e=this.code;for(;e===dE.SPACE_CODE||e===dE.TAB_CODE||e===dE.LF_CODE||e===dE.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:dE.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,n,i=[];for(;this.index<this.expr.length;)if(t=this.code,t===dE.SEMCOL_CODE||t===dE.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())i.push(n);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,dE.max_binop_len),t=e.length;for(;t>0;){if(dE.binary_ops.hasOwnProperty(e)&&(!dE.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!dE.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,i,o,r,s,a,c;if(r=this.gobbleToken(),!r)return r;if(t=this.gobbleBinaryOp(),!t)return r;for(o={value:t,prec:dE.binaryPrecedence(t),right_a:dE.right_associative.has(t)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+t),i=[r,o,s];t=this.gobbleBinaryOp();){if(n=dE.binaryPrecedence(t),0===n){this.index-=t.length;break}o={value:t,prec:n,right_a:dE.right_associative.has(t)},c=t;const a=e=>o.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;i.length>2&&a(i[i.length-2]);)s=i.pop(),t=i.pop().value,r=i.pop(),e={type:dE.BINARY_EXP,operator:t,left:r,right:s},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+c),i.push(o,e)}for(a=i.length-1,e=i[a];a>1;)e={type:dE.BINARY_EXP,operator:i[a-1].value,left:i[a-2],right:e},a-=2;return e}gobbleToken(){let e,t,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,dE.isDecimalDigit(e)||e===dE.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===dE.SQUOTE_CODE||e===dE.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===dE.OBRACK_CODE)i=this.gobbleArray();else{for(t=this.expr.substr(this.index,dE.max_unop_len),n=t.length;n>0;){if(dE.unary_ops.hasOwnProperty(t)&&(!dE.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!dE.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:dE.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}dE.isIdentifierStart(e)?(i=this.gobbleIdentifier(),dE.literals.hasOwnProperty(i.name)?i={type:dE.LITERAL,value:dE.literals[i.name],raw:i.name}:i.name===dE.this_str&&(i={type:dE.THIS_EXP})):e===dE.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===dE.PERIOD_CODE||t===dE.OBRACK_CODE||t===dE.OPAREN_CODE||t===dE.QUMARK_CODE;){let n;if(t===dE.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==dE.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===dE.OBRACK_CODE?(e={type:dE.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),t=this.code,t!==dE.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===dE.OPAREN_CODE?e={type:dE.CALL_EXP,arguments:this.gobbleArguments(dE.CPAREN_CODE),callee:e}:(t===dE.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:dE.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,n="";for(;dE.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===dE.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);dE.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(n+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(n+=this.expr.charAt(this.index++));dE.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);dE.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return t=this.code,dE.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(t===dE.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===dE.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:dE.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let e="";const t=this.index,n=this.expr.charAt(this.index++);let i=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){i=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:dE.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(dE.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,dE.isIdentifierPart(e));)this.index++;return{type:dE.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){n=!0,this.index++,e===dE.CPAREN_CODE&&i&&i>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===dE.COMMA_CODE){if(this.index++,i++,i!==t.length)if(e===dE.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===dE.CBRACK_CODE)for(let e=t.length;e<i;e++)t.push(null)}else if(t.length!==i&&0!==i)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==dE.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(dE.CPAREN_CODE);if(this.code===dE.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:dE.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:dE.ARRAY_EXP,elements:this.gobbleArguments(dE.CBRACK_CODE)}}}const hE=new class{add(e,t,n){if("string"!=typeof arguments[0])for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)}),this)}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}};Object.assign(dE,{hooks:hE,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach((e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)}))}}(dE),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),dE.max_unop_len=dE.getMaxKeyLen(dE.unary_ops),dE.max_binop_len=dE.getMaxKeyLen(dE.binary_ops);const pE=e=>new dE(e).parse();Object.getOwnPropertyNames(dE).forEach((e=>{void 0===pE[e]&&"prototype"!==e&&(pE[e]=dE[e])})),pE.Jsep=dE;var fE={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const n=t.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:i,alternate:o},n.operator&&e.binary_ops[n.operator]<=.9){let i=n;for(;i.right.operator&&e.binary_ops[i.right.operator]<=.9;)i=i.right;t.node.test=i.right,i.right=t.node,t.node=n}}else this.throwError("Expected :")}}))}};pE.plugins.register(fE);const mE=Object.freeze({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});function _E(e,t){let n;L.typeOf.string("expression",e),this._expression=e,e=function(e,t){if(!D(t))return e;for(const n in t)if(t.hasOwnProperty(n)){const i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;D(o)&&(e=e.replace(i,o))}return e}(e,t),e=function(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){const e=t.indexOf("'"),o=t.indexOf('"');let r;if(e>=0&&e<i)r=t.indexOf("'",e+1),n+=t.substr(0,r+1),t=t.substr(r+1),i=t.indexOf("${");else if(o>=0&&o<i)r=t.indexOf('"',o+1),n+=t.substr(0,r+1),t=t.substr(r+1),i=t.indexOf("${");else{n+=t.substr(0,i);const e=t.indexOf("}");if(e<0)throw new be("Unmatched {.");n+=`czm_${t.substr(i+2,e-(i+2))}`,t=t.substr(e+1),i=t.indexOf("${")}}return n+=t,n}(function(e){return e.replace(AE,TE)}(e)),pE.addBinaryOp("=~",0),pE.addBinaryOp("!~",0);try{n=pE(e)}catch(i){throw new be(i)}this._runtimeAst=FE(this,n)}Object.defineProperties(_E.prototype,{expression:{get:function(){return this._expression}}});const gE={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new kt],cartesian3Array:[new H],cartesian4Array:[new K],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);const e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new kt),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new H),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new K),this.cartesian4Array[this.cartesian4Index++]}};_E.prototype.evaluate=function(e,t){gE.reset();const n=this._runtimeAst.evaluate(e);return t instanceof Ot&&n instanceof K?Ot.fromCartesian4(n,t):n instanceof kt||n instanceof H||n instanceof K?n.clone(t):n},_E.prototype.evaluateColor=function(e,t){gE.reset();const n=this._runtimeAst.evaluate(e);return Ot.fromCartesian4(n,t)},_E.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}\n{\n return ${o};\n}\n`,o},_E.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)},_E.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter((function(e,t,n){return n.indexOf(e)===t})),e};const yE=["!","-","+"],bE=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],vE=/\${(.*?)}/g,AE=/\\/g,TE="@#%",wE=/@#%/g,EE=new Ot,xE={abs:IE(Math.abs),sqrt:IE(Math.sqrt),cos:IE(Math.cos),sin:IE(Math.sin),tan:IE(Math.tan),acos:IE(Math.acos),asin:IE(Math.asin),atan:IE(Math.atan),radians:IE(V.toRadians),degrees:IE(V.toDegrees),sign:IE(V.sign),floor:IE(Math.floor),ceil:IE(Math.ceil),round:IE(Math.round),exp:IE(Math.exp),exp2:IE((function(e){return Math.pow(2,e)})),log:IE(Math.log),log2:IE((function(e){return V.log2(e)})),fract:IE((function(e){return e-Math.floor(e)})),length:function(e,t){if("number"==typeof t)return Math.abs(t);if(t instanceof kt)return kt.magnitude(t);if(t instanceof H)return H.magnitude(t);if(t instanceof K)return K.magnitude(t);throw new be(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)},normalize:function(e,t){if("number"==typeof t)return 1;if(t instanceof kt)return kt.normalize(t,gE.getCartesian2());if(t instanceof H)return H.normalize(t,gE.getCartesian3());if(t instanceof K)return K.normalize(t,gE.getCartesian4());throw new be(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}},SE={atan2:OE(Math.atan2,!1),pow:OE(Math.pow,!1),min:OE(Math.min,!0),max:OE(Math.max,!0),distance:function(e,t,n){if("number"==typeof t&&"number"==typeof n)return Math.abs(t-n);if(t instanceof kt&&n instanceof kt)return kt.distance(t,n);if(t instanceof H&&n instanceof H)return H.distance(t,n);if(t instanceof K&&n instanceof K)return K.distance(t,n);throw new be(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)},dot:function(e,t,n){if("number"==typeof t&&"number"==typeof n)return t*n;if(t instanceof kt&&n instanceof kt)return kt.dot(t,n);if(t instanceof H&&n instanceof H)return H.dot(t,n);if(t instanceof K&&n instanceof K)return K.dot(t,n);throw new be(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)},cross:function(e,t,n){if(t instanceof H&&n instanceof H)return H.cross(t,n,gE.getCartesian3());throw new be(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}},CE={clamp:DE(V.clamp,!0),mix:DE(V.lerp,!0)};function IE(e){return function(t,n){if("number"==typeof n)return e(n);if(n instanceof kt)return kt.fromElements(e(n.x),e(n.y),gE.getCartesian2());if(n instanceof H)return H.fromElements(e(n.x),e(n.y),e(n.z),gE.getCartesian3());if(n instanceof K)return K.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),gE.getCartesian4());throw new be(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function OE(e,t){return function(n,i,o){if(t&&"number"==typeof o){if("number"==typeof i)return e(i,o);if(i instanceof kt)return kt.fromElements(e(i.x,o),e(i.y,o),gE.getCartesian2());if(i instanceof H)return H.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),gE.getCartesian3());if(i instanceof K)return K.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),gE.getCartesian4())}if("number"==typeof i&&"number"==typeof o)return e(i,o);if(i instanceof kt&&o instanceof kt)return kt.fromElements(e(i.x,o.x),e(i.y,o.y),gE.getCartesian2());if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),gE.getCartesian3());if(i instanceof K&&o instanceof K)return K.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),gE.getCartesian4());throw new be(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function DE(e,t){return function(n,i,o,r){if(t&&"number"==typeof r){if("number"==typeof i&&"number"==typeof o)return e(i,o,r);if(i instanceof kt&&o instanceof kt)return kt.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),gE.getCartesian2());if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),gE.getCartesian3());if(i instanceof K&&o instanceof K)return K.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),e(i.w,o.w,r),gE.getCartesian4())}if("number"==typeof i&&"number"==typeof o&&"number"==typeof r)return e(i,o,r);if(i instanceof kt&&o instanceof kt&&r instanceof kt)return kt.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),gE.getCartesian2());if(i instanceof H&&o instanceof H&&r instanceof H)return H.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),gE.getCartesian3());if(i instanceof K&&o instanceof K&&r instanceof K)return K.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),e(i.w,o.w,r.w),gE.getCartesian4());throw new be(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function PE(e,t,n,i,o){var r;this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,(r=this)._type===mE.CONDITIONAL?r.evaluate=r._evaluateConditional:r._type===mE.FUNCTION_CALL?"test"===r._value?r.evaluate=r._evaluateRegExpTest:"exec"===r._value?r.evaluate=r._evaluateRegExpExec:"toString"===r._value&&(r.evaluate=r._evaluateToString):r._type===mE.UNARY?"!"===r._value?r.evaluate=r._evaluateNot:"-"===r._value?r.evaluate=r._evaluateNegative:"+"===r._value?r.evaluate=r._evaluatePositive:"isNaN"===r._value?r.evaluate=r._evaluateNaN:"isFinite"===r._value?r.evaluate=r._evaluateIsFinite:"isExactClass"===r._value?r.evaluate=r._evaluateIsExactClass:"isClass"===r._value?r.evaluate=r._evaluateIsClass:"getExactClassName"===r._value?r.evaluate=r._evaluateGetExactClassName:"Boolean"===r._value?r.evaluate=r._evaluateBooleanConversion:"Number"===r._value?r.evaluate=r._evaluateNumberConversion:"String"===r._value?r.evaluate=r._evaluateStringConversion:D(xE[r._value])&&(r.evaluate=function(e){const t=xE[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}(r._value)):r._type===mE.BINARY?"+"===r._value?r.evaluate=r._evaluatePlus:"-"===r._value?r.evaluate=r._evaluateMinus:"*"===r._value?r.evaluate=r._evaluateTimes:"/"===r._value?r.evaluate=r._evaluateDivide:"%"===r._value?r.evaluate=r._evaluateMod:"==="===r._value?r.evaluate=r._evaluateEqualsStrict:"!=="===r._value?r.evaluate=r._evaluateNotEqualsStrict:"<"===r._value?r.evaluate=r._evaluateLessThan:"<="===r._value?r.evaluate=r._evaluateLessThanOrEquals:">"===r._value?r.evaluate=r._evaluateGreaterThan:">="===r._value?r.evaluate=r._evaluateGreaterThanOrEquals:"&&"===r._value?r.evaluate=r._evaluateAnd:"||"===r._value?r.evaluate=r._evaluateOr:"=~"===r._value?r.evaluate=r._evaluateRegExpMatch:"!~"===r._value?r.evaluate=r._evaluateRegExpNotMatch:D(SE[r._value])&&(r.evaluate=function(e){const t=SE[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}(r._value)):r._type===mE.TERNARY?r.evaluate=function(e){const t=CE[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n),r=this._test.evaluate(n);return t(e,i,o,r)}}(r._value):r._type===mE.MEMBER?"brackets"===r._value?r.evaluate=r._evaluateMemberBrackets:r.evaluate=r._evaluateMemberDot:r._type===mE.ARRAY?r.evaluate=r._evaluateArray:r._type===mE.VARIABLE?r.evaluate=r._evaluateVariable:r._type===mE.VARIABLE_IN_STRING?r.evaluate=r._evaluateVariableString:r._type===mE.LITERAL_COLOR?r.evaluate=r._evaluateLiteralColor:r._type===mE.LITERAL_VECTOR?r.evaluate=r._evaluateLiteralVector:r._type===mE.LITERAL_STRING?r.evaluate=r._evaluateLiteralString:r._type===mE.REGEX?r.evaluate=r._evaluateRegExp:r._type===mE.BUILTIN_VARIABLE?"tiles3d_tileset_time"===r._value&&(r.evaluate=BE):r.evaluate=r._evaluateLiteral}function NE(e){return e.replace(wE,"\\")}function RE(e,t){const n=t.arguments,i=n.length;let o,r,s,a;if("MemberExpression"===t.callee.type){o=t.callee.property.name;const c=t.callee.object;if("test"===o||"exec"===o){if(!D(c.callee)||"regExp"!==c.callee.name)throw new be(`${o} is not a function.`);return 0===i?"test"===o?new PE(mE.LITERAL_BOOLEAN,!1):new PE(mE.LITERAL_NULL,null):(s=FE(e,c),a=FE(e,n[0]),new PE(mE.FUNCTION_CALL,o,s,a))}if("toString"===o)return r=FE(e,c),new PE(mE.FUNCTION_CALL,o,r);throw new be(`Unexpected function call "${o}".`)}if(o=t.callee.name,"color"===o){if(0===i)return new PE(mE.LITERAL_COLOR,o);if(r=FE(e,n[0]),D(n[1])){const t=FE(e,n[1]);return new PE(mE.LITERAL_COLOR,o,[r,t])}return new PE(mE.LITERAL_COLOR,o,[r])}if("rgb"===o||"hsl"===o){if(i<3)throw new be(`${o} requires three arguments.`);return r=[FE(e,n[0]),FE(e,n[1]),FE(e,n[2])],new PE(mE.LITERAL_COLOR,o,r)}if("rgba"===o||"hsla"===o){if(i<4)throw new be(`${o} requires four arguments.`);return r=[FE(e,n[0]),FE(e,n[1]),FE(e,n[2]),FE(e,n[3])],new PE(mE.LITERAL_COLOR,o,r)}if("vec2"===o||"vec3"===o||"vec4"===o){r=new Array(i);for(let t=0;t<i;++t)r[t]=FE(e,n[t]);return new PE(mE.LITERAL_VECTOR,o,r)}if("isNaN"===o||"isFinite"===o)return 0===i?new PE(mE.LITERAL_BOOLEAN,"isNaN"===o):(r=FE(e,n[0]),new PE(mE.UNARY,o,r));if("isExactClass"===o||"isClass"===o){if(i<1||i>1)throw new be(`${o} requires exactly one argument.`);return r=FE(e,n[0]),new PE(mE.UNARY,o,r)}if("getExactClassName"===o){if(i>0)throw new be(`${o} does not take any argument.`);return new PE(mE.UNARY,o)}if(D(xE[o])){if(1!==i)throw new be(`${o} requires exactly one argument.`);return r=FE(e,n[0]),new PE(mE.UNARY,o,r)}if(D(SE[o])){if(2!==i)throw new be(`${o} requires exactly two arguments.`);return s=FE(e,n[0]),a=FE(e,n[1]),new PE(mE.BINARY,o,s,a)}if(D(CE[o])){if(3!==i)throw new be(`${o} requires exactly three arguments.`);s=FE(e,n[0]),a=FE(e,n[1]);const t=FE(e,n[2]);return new PE(mE.TERNARY,o,s,a,t)}if("Boolean"===o)return 0===i?new PE(mE.LITERAL_BOOLEAN,!1):(r=FE(e,n[0]),new PE(mE.UNARY,o,r));if("Number"===o)return 0===i?new PE(mE.LITERAL_NUMBER,0):(r=FE(e,n[0]),new PE(mE.UNARY,o,r));if("String"===o)return 0===i?new PE(mE.LITERAL_STRING,""):(r=FE(e,n[0]),new PE(mE.UNARY,o,r));if("regExp"===o)return function(e,t){const n=t.arguments;if(0===n.length)return new PE(mE.LITERAL_REGEX,new RegExp);const i=FE(e,n[0]);let o;if(n.length>1){const t=FE(e,n[1]);if(ME(i)&&ME(t)){try{o=new RegExp(NE(String(i._value)),t._value)}catch(r){throw new be(r)}return new PE(mE.LITERAL_REGEX,o)}return new PE(mE.REGEX,i,t)}if(ME(i)){try{o=new RegExp(NE(String(i._value)))}catch(r){throw new be(r)}return new PE(mE.LITERAL_REGEX,o)}return new PE(mE.REGEX,i)}(e,t);throw new be(`Unexpected function call "${o}".`)}function LE(e,t){if("Math"===t.object.name)return function(e){const t=e.property.name;return"PI"===t?new PE(mE.LITERAL_NUMBER,Math.PI):"E"===t?new PE(mE.LITERAL_NUMBER,Math.E):void 0}(t);if("Number"===t.object.name)return function(e){if("POSITIVE_INFINITY"===e.property.name)return new PE(mE.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}(t);let n;const i=FE(e,t.object);return t.computed?(n=FE(e,t.property),new PE(mE.MEMBER,"brackets",i,n)):(n=new PE(mE.LITERAL_STRING,t.property.name),new PE(mE.MEMBER,"dot",i,n))}function ME(e){return e._type>=mE.LITERAL_NULL}function FE(e,t){let n,i,o,r;if("Literal"===t.type)n=function(e){const t=typeof e.value;return null===e.value?new PE(mE.LITERAL_NULL,null):"boolean"===t?new PE(mE.LITERAL_BOOLEAN,e.value):"number"===t?new PE(mE.LITERAL_NUMBER,e.value):"string"===t?e.value.indexOf("${")>=0?new PE(mE.VARIABLE_IN_STRING,e.value):new PE(mE.LITERAL_STRING,NE(e.value)):void 0}(t);else if("CallExpression"===t.type)n=RE(e,t);else if("Identifier"===t.type)n=function(e){if(function(e){return"czm_"===e.substr(0,4)}(e.name)){const t=e.name.substr(4);return"tiles3d_"===t.substr(0,8)?new PE(mE.BUILTIN_VARIABLE,t):new PE(mE.VARIABLE,t)}if("NaN"===e.name)return new PE(mE.LITERAL_NUMBER,NaN);if("Infinity"===e.name)return new PE(mE.LITERAL_NUMBER,1/0);if("undefined"===e.name)return new PE(mE.LITERAL_UNDEFINED,void 0);throw new be(`${e.name} is not defined.`)}(t);else if("UnaryExpression"===t.type){i=t.operator;const o=FE(e,t.argument);if(!(yE.indexOf(i)>-1))throw new be(`Unexpected operator "${i}".`);n=new PE(mE.UNARY,i,o)}else if("BinaryExpression"===t.type){if(i=t.operator,o=FE(e,t.left),r=FE(e,t.right),!(bE.indexOf(i)>-1))throw new be(`Unexpected operator "${i}".`);n=new PE(mE.BINARY,i,o,r)}else if("LogicalExpression"===t.type)i=t.operator,o=FE(e,t.left),r=FE(e,t.right),bE.indexOf(i)>-1&&(n=new PE(mE.BINARY,i,o,r));else if("ConditionalExpression"===t.type){const i=FE(e,t.test);o=FE(e,t.consequent),r=FE(e,t.alternate),n=new PE(mE.CONDITIONAL,"?",o,r,i)}else if("MemberExpression"===t.type)n=LE(e,t);else{if("ArrayExpression"!==t.type)throw"Compound"===t.type?new be("Provide exactly one expression."):new be("Cannot parse expression.");{const i=[];for(let n=0;n<t.elements.length;n++)i[n]=FE(e,t.elements[n]);n=new PE(mE.ARRAY,i)}}return n}function BE(e){return D(e)?e.content.tileset.timeSinceLoad:0}function zE(e,t){if(D(e))return e.getPropertyInherited(t)}function UE(e){return"feature"===e._value}function kE(e){const t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==mE.LITERAL_NUMBER)return;const i=t[0]._value,o=t[1]._value,r=t[2]._value,s=4===n?t[3]._value:1;return Ot.fromHsl(i,o,r,s,EE)}function VE(e){const t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==mE.LITERAL_NUMBER)return;const i=EE;return i.red=t[0]._value/255,i.green=t[1]._value/255,i.blue=t[2]._value/255,i.alpha=4===n?t[3]._value:1,i}function HE(e){return e%1==0?e.toFixed(1):e.toString()}function GE(e){return`vec4(${HE(e.red)}, ${HE(e.green)}, ${HE(e.blue)}, ${HE(e.alpha)})`}function jE(e,t,n,i){const o=e.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=e[s].getShaderExpression(t,n,i);return r}function WE(e,t){return D(t[e])?t[e]:_E.NULL_SENTINEL}function qE(e){e=M(e,M.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=M(e.center,H.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=Ot.clone(Ot.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=M(e.classificationType,Vf.BOTH),this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};const t=this._batchIds.length;for(let n=0;n<t;++n){const e=this._batchIds[n];this._batchIdLookUp[e]=n}}PE.prototype._evaluateLiteral=function(){return this._value},PE.prototype._evaluateLiteralColor=function(e){const t=EE,n=this._left;if("color"===this._value)D(n)?n.length>1?(Ot.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):Ot.fromCssColorString(n[0].evaluate(e),t):Ot.fromBytes(255,255,255,255,t);else if("rgb"===this._value)Ot.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if("rgba"===this._value){const i=255*n[3].evaluate(e);Ot.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else"hsl"===this._value?Ot.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):"hsla"===this._value&&Ot.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return K.fromColor(t,gE.getCartesian4())},PE.prototype._evaluateLiteralVector=function(e){const t=gE.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a<o;++a){const o=i[a].evaluate(e);if("number"==typeof o)t.push(o);else if(o instanceof kt)t.push(o.x,o.y);else if(o instanceof H)t.push(o.x,o.y,o.z);else{if(!(o instanceof K))throw new be(`${n} argument must be a vector or number. Argument is ${o}.`);t.push(o.x,o.y,o.z,o.w)}}const r=t.length,s=parseInt(n.charAt(3));if(0===r)throw new be(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new be(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new be(`Invalid ${n} constructor. Too many arguments.`);if(1===r){const e=t[0];t.push(e,e,e)}return"vec2"===n?kt.fromArray(t,0,gE.getCartesian2()):"vec3"===n?H.fromArray(t,0,gE.getCartesian3()):"vec4"===n?K.fromArray(t,0,gE.getCartesian4()):void 0},PE.prototype._evaluateLiteralString=function(){return this._value},PE.prototype._evaluateVariableString=function(e){let t=this._value,n=vE.exec(t);for(;null!==n;){const i=n[0];let o=zE(e,n[1]);D(o)||(o=""),t=t.replace(i,o),n=vE.exec(t)}return t},PE.prototype._evaluateVariable=function(e){return zE(e,this._value)},PE.prototype._evaluateMemberDot=function(e){if(UE(this._left))return zE(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!D(t))return;const n=this._right.evaluate(e);if(t instanceof kt||t instanceof H||t instanceof K){if("r"===n)return t.x;if("g"===n)return t.y;if("b"===n)return t.z;if("a"===n)return t.w}return t[n]},PE.prototype._evaluateMemberBrackets=function(e){if(UE(this._left))return zE(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!D(t))return;const n=this._right.evaluate(e);if(t instanceof kt||t instanceof H||t instanceof K){if(0===n||"r"===n)return t.x;if(1===n||"g"===n)return t.y;if(2===n||"b"===n)return t.z;if(3===n||"a"===n)return t.w}return t[n]},PE.prototype._evaluateArray=function(e){const t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t},PE.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new be(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t},PE.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof kt)return kt.negate(t,gE.getCartesian2());if(t instanceof H)return H.negate(t,gE.getCartesian3());if(t instanceof K)return K.negate(t,gE.getCartesian4());if("number"==typeof t)return-t;throw new be(`Operator "-" requires a vector or number argument. Argument is ${t}.`)},PE.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof kt||t instanceof H||t instanceof K||"number"==typeof t))throw new be(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t},PE.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new be(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n},PE.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new be(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n},PE.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new be(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n},PE.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if("number"!=typeof t||"number"!=typeof n)throw new be(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n},PE.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new be(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const n=this._right.evaluate(e);if("boolean"!=typeof n)throw new be(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n},PE.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if("boolean"!=typeof t)throw new be(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const n=this._right.evaluate(e);if("boolean"!=typeof n)throw new be(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n},PE.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof kt&&t instanceof kt)return kt.add(t,n,gE.getCartesian2());if(n instanceof H&&t instanceof H)return H.add(t,n,gE.getCartesian3());if(n instanceof K&&t instanceof K)return K.add(t,n,gE.getCartesian4());if("string"==typeof t||"string"==typeof n)return t+n;if("number"==typeof t&&"number"==typeof n)return t+n;throw new be(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof kt&&t instanceof kt)return kt.subtract(t,n,gE.getCartesian2());if(n instanceof H&&t instanceof H)return H.subtract(t,n,gE.getCartesian3());if(n instanceof K&&t instanceof K)return K.subtract(t,n,gE.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t-n;throw new be(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof kt&&t instanceof kt)return kt.multiplyComponents(t,n,gE.getCartesian2());if(n instanceof kt&&"number"==typeof t)return kt.multiplyByScalar(n,t,gE.getCartesian2());if(t instanceof kt&&"number"==typeof n)return kt.multiplyByScalar(t,n,gE.getCartesian2());if(n instanceof H&&t instanceof H)return H.multiplyComponents(t,n,gE.getCartesian3());if(n instanceof H&&"number"==typeof t)return H.multiplyByScalar(n,t,gE.getCartesian3());if(t instanceof H&&"number"==typeof n)return H.multiplyByScalar(t,n,gE.getCartesian3());if(n instanceof K&&t instanceof K)return K.multiplyComponents(t,n,gE.getCartesian4());if(n instanceof K&&"number"==typeof t)return K.multiplyByScalar(n,t,gE.getCartesian4());if(t instanceof K&&"number"==typeof n)return K.multiplyByScalar(t,n,gE.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t*n;throw new be(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof kt&&t instanceof kt)return kt.divideComponents(t,n,gE.getCartesian2());if(t instanceof kt&&"number"==typeof n)return kt.divideByScalar(t,n,gE.getCartesian2());if(n instanceof H&&t instanceof H)return H.divideComponents(t,n,gE.getCartesian3());if(t instanceof H&&"number"==typeof n)return H.divideByScalar(t,n,gE.getCartesian3());if(n instanceof K&&t instanceof K)return K.divideComponents(t,n,gE.getCartesian4());if(t instanceof K&&"number"==typeof n)return K.divideByScalar(t,n,gE.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t/n;throw new be(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof kt&&t instanceof kt)return kt.fromElements(t.x%n.x,t.y%n.y,gE.getCartesian2());if(n instanceof H&&t instanceof H)return H.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,gE.getCartesian3());if(n instanceof K&&t instanceof K)return K.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,gE.getCartesian4());if("number"==typeof t&&"number"==typeof n)return t%n;throw new be(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof kt&&t instanceof kt||n instanceof H&&t instanceof H||n instanceof K&&t instanceof K?t.equals(n):t===n},PE.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof kt&&t instanceof kt||n instanceof H&&t instanceof H||n instanceof K&&t instanceof K?!t.equals(n):t!==n},PE.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if("boolean"!=typeof t)throw new be(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)},PE.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))},PE.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))},PE.prototype._evaluateIsExactClass=function(e){return!!D(e)&&e.isExactClass(this._left.evaluate(e))},PE.prototype._evaluateIsClass=function(e){return!!D(e)&&e.isClass(this._left.evaluate(e))},PE.prototype._evaluateGetExactClassName=function(e){if(D(e))return e.getExactClassName()},PE.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))},PE.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))},PE.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))},PE.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let n,i="";D(this._left)&&(i=this._left.evaluate(e));try{n=new RegExp(t,i)}catch(o){throw new be(o)}return n},PE.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof n))throw new be(`RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);return t.test(n)},PE.prototype._evaluateRegExpMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof n)return t.test(n);if(n instanceof RegExp&&"string"==typeof t)return n.test(t);throw new be(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateRegExpNotMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&"string"==typeof n)return!t.test(n);if(n instanceof RegExp&&"string"==typeof t)return!n.test(t);throw new be(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)},PE.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&"string"==typeof n))throw new be(`RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);const i=t.exec(n);return D(i)?i[1]:null},PE.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof kt||t instanceof H||t instanceof K)return String(t);throw new be(`Unexpected function call "${this._value}".`)},_E.NULL_SENTINEL="czm_infinity",PE.prototype.getShaderExpression=function(e,t,n){let i,o,r,s;const a=this._type;let c,l,u,d=this._value;switch(D(this._left)&&(o=Array.isArray(this._left)?jE(this._left,e,t,this):this._left.getShaderExpression(e,t,this)),D(this._right)&&(r=this._right.getShaderExpression(e,t,this)),D(this._test)&&(s=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(d=jE(this._value,e,t,this)),a){case mE.VARIABLE:if(UE(this))return;return WE(d,e);case mE.UNARY:if("Boolean"===d)return`bool(${o})`;if("Number"===d)return`float(${o})`;if("round"===d)return`floor(${o} + 0.5)`;if(D(xE[d]))return`${d}(${o})`;if("isNaN"===d)return`(${o} != ${o})`;if("isFinite"===d)return`(abs(${o}) < czm_infinity)`;if("String"===d||"isExactClass"===d||"isClass"===d||"getExactClassName"===d)throw new be(`Error generating style shader: "${d}" is not supported.`);return d+o;case mE.BINARY:return"%"===d?`mod(${o}, ${r})`:"==="===d?`(${o} == ${r})`:"!=="===d?`(${o} != ${r})`:"atan2"===d?`atan(${o}, ${r})`:D(SE[d])?`${d}(${o}, ${r})`:`(${o} ${d} ${r})`;case mE.TERNARY:if(D(CE[d]))return`${d}(${o}, ${r}, ${s})`;break;case mE.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case mE.MEMBER:return UE(this._left)?WE(r,e):"r"===r||"x"===r||"0.0"===r?`${o}[0]`:"g"===r||"y"===r||"1.0"===r?`${o}[1]`:"b"===r||"z"===r||"2.0"===r?`${o}[2]`:"a"===r||"w"===r||"3.0"===r?`${o}[3]`:`${o}[int(${r})]`;case mE.FUNCTION_CALL:throw new be(`Error generating style shader: "${d}" is not supported.`);case mE.ARRAY:if(4===d.length)return`vec4(${d[0]}, ${d[1]}, ${d[2]}, ${d[3]})`;if(3===d.length)return`vec3(${d[0]}, ${d[1]}, ${d[2]})`;if(2===d.length)return`vec2(${d[0]}, ${d[1]})`;throw new be("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case mE.REGEX:throw new be("Error generating style shader: Regular expressions are not supported.");case mE.VARIABLE_IN_STRING:throw new be("Error generating style shader: Converting a variable to a string is not supported.");case mE.LITERAL_NULL:return _E.NULL_SENTINEL;case mE.LITERAL_BOOLEAN:return d?"true":"false";case mE.LITERAL_NUMBER:return HE(d);case mE.LITERAL_STRING:if(D(n)&&n._type===mE.MEMBER&&("r"===d||"g"===d||"b"===d||"a"===d||"x"===d||"y"===d||"z"===d||"w"===d||UE(n._left)))return d;if(i=Ot.fromCssColorString(d,EE),D(i))return function(e){return`vec3(${HE(e.red)}, ${HE(e.green)}, ${HE(e.blue)})`}(i);throw new be("Error generating style shader: String literals are not supported.");case mE.LITERAL_COLOR:if(c=o,"color"===d){if(!D(c))return"vec4(1.0)";if(c.length>1){const e=c[0],n=c[1];return"1.0"!==n&&(t.translucent=!0),`vec4(${e}, ${n})`}return`vec4(${c[0]}, 1.0)`}if("rgb"===d)return i=VE(this),D(i)?GE(i):`vec4(${c[0]} / 255.0, ${c[1]} / 255.0, ${c[2]} / 255.0, 1.0)`;if("rgba"===d)return"1.0"!==c[3]&&(t.translucent=!0),i=VE(this),D(i)?GE(i):`vec4(${c[0]} / 255.0, ${c[1]} / 255.0, ${c[2]} / 255.0, ${c[3]})`;if("hsl"===d)return i=kE(this),D(i)?GE(i):`vec4(czm_HSLToRGB(vec3(${c[0]}, ${c[1]}, ${c[2]})), 1.0)`;if("hsla"===d)return i=kE(this),D(i)?(1!==i.alpha&&(t.translucent=!0),GE(i)):("1.0"!==c[3]&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${c[0]}, ${c[1]}, ${c[2]})), ${c[3]})`);break;case mE.LITERAL_VECTOR:if(!D(o))throw new P("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");l=o.length,u=`${d}(`;for(let e=0;e<l;++e)u+=o[e],e<l-1&&(u+=", ");return u+=")",u;case mE.LITERAL_REGEX:throw new be("Error generating style shader: Regular expressions are not supported.");case mE.LITERAL_UNDEFINED:return _E.NULL_SENTINEL;case mE.BUILTIN_VARIABLE:if("tiles3d_tileset_time"===d)return d}},PE.prototype.getVariables=function(e,t){let n,i,o;const r=this._type,s=this._value;if(D(this._left))if(Array.isArray(this._left))for(n=this._left,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);else this._left.getVariables(e,this);if(D(this._right)&&this._right.getVariables(e,this),D(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(n=this._value,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);let a;switch(r){case mE.VARIABLE:UE(this)||e.push(s);break;case mE.VARIABLE_IN_STRING:for(a=vE.exec(s);null!==a;)e.push(a[1]),a=vE.exec(s);break;case mE.LITERAL_STRING:D(t)&&t._type===mE.MEMBER&&UE(t._left)&&e.push(s)}},Object.defineProperties(qE.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const YE={position:0,a_batchId:1};function XE(e){const t=e?ny.EQUAL:ny.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:oy.KEEP,zFail:oy.DECREMENT_WRAP,zPass:oy.KEEP},backFunction:t,backOperation:{fail:oy.KEEP,zFail:oy.INCREMENT_WRAP,zPass:oy.KEEP},reference:sy.CESIUM_3D_TILE_MASK,mask:sy.CESIUM_3D_TILE_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Gf.LESS_OR_EQUAL},depthMask:!1}}const QE={stencilTest:{enabled:!0,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},backFunction:ny.NOT_EQUAL,backOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},reference:0,mask:sy.CLASSIFICATION_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:dh.PRE_MULTIPLIED_ALPHA_BLEND},$E={stencilTest:{enabled:!0,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},backFunction:ny.NOT_EQUAL,backOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},reference:0,mask:sy.CLASSIFICATION_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};const KE=new ve,ZE=new H;function JE(e,t,n,i,o,r,s){const a=e.constructor.BYTES_PER_ELEMENT,c=r.length;for(let l=0;l<c;++l){const c=s[r[l]],u=i[c],d=o[c],h=new e.constructor(e.buffer,a*u,d);t.set(h,n),i[c]=n,n+=d}return n}function ex(e,t,n,i,o,r,s){const a=e.bytesPerIndex,c=r.length;for(let l=0;l<c;++l){const c=s[r[l]],u=i[c],d=o[c];t.copyFromBuffer(e,u*a,n*a,d*a),i[c]=n,n+=d}return n}function tx(e,t){return t.color.toRgba()-e.color.toRgba()}function nx(e,t){if(!e._batchDirty)return!1;const n=e._batchedIndices,i=n.length;let o=!1;const r={};for(let s=0;s<i;++s){const e=n[s].color.toRgba();if(D(r[e])){o=!0;break}r[e]=!0}return o?o&&!e.forceRebatch&&e._framesSinceLastRebatch<120?void++e._framesSinceLastRebatch:(n.sort(tx),t.webgl2?function(e,t){const n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp;let r=t.pop();const s=[r],a=e._va.indexBuffer,c=e._vaSwap.indexBuffer;let l=ex(a,c,0,n,i,r.batchIds,o);for(r.offset=0,r.count=l;t.length>0;){const e=t.pop();if(Ot.equals(e.color,r.color))l=ex(a,c,l,n,i,e.batchIds,o),r.batchIds=r.batchIds.concat(e.batchIds),r.count=l-r.offset;else{const t=l;l=ex(a,c,l,n,i,e.batchIds,o),e.offset=t,e.count=l-t,s.push(e),r=e}}const u=e._va;e._va=e._vaSwap,e._vaSwap=u,e._batchedIndices=s}(e,n):function(e,t){const n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length);let a=t.pop();const c=[a];let l=JE(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=l;t.length>0;){const e=t.pop();if(Ot.equals(e.color,a.color))l=JE(n,s,l,i,o,e.batchIds,r),a.batchIds=a.batchIds.concat(e.batchIds),a.count=l-a.offset;else{const t=l;l=JE(n,s,l,i,o,e.batchIds,r),e.offset=t,e.count=l-t,c.push(e),a=e}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=c}(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0):(e._batchDirty=!1,!1)}qE.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const i=n[o];t[i]=new uE(e,i)}},qE.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const ix=new Ot,ox=Ot.WHITE,rx=/\$/;function sx(e,t,n,i){const o=e.classificationType,r=o!==Vf.CESIUM_3D_TILE,s=o!==Vf.TERRAIN,a=t.commandList;let c,l,u=n.length;for(l=0;l<u;++l)r&&(c=n[l],c.pass=zt.TERRAIN_CLASSIFICATION,a.push(c)),s&&(c=n[l].derivedCommands.tileset,c.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,a.push(c));if(t.invertClassification&&D(i))for(u=i.length,l=0;l<u;++l)a.push(i[l])}function ax(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,D(this._center)||(D(this._boundingVolume)?this._center=H.clone(this._boundingVolume.center):this._center=H.clone(H.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._promise=void 0,this._error=void 0,this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Vf.BOTH}qE.prototype.applyStyle=function(e,t){if(!D(e))return void function(e,t){e._updatingAllCommands=!0;const n=e._batchIds;let i,o=n.length;for(i=0;i<o;++i){const e=t[n[i]];e.show=!0,e.color=Ot.WHITE}const r=e._batchedIndices;for(o=r.length,i=0;i<o;++i)r[i].color=Ot.clone(Ot.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}(this,t);const n=e.color,i=n instanceof _E&&!rx.test(n.expression);this._updatingAllCommands=i;const o=this._batchIds;let r,s=o.length;for(r=0;r<s;++r){const n=t[o[r]];n.color=D(e.color)?e.color.evaluateColor(n,ix):ox,n.show=!D(e.show)||e.show.evaluate(n)}if(i){const e=this._batchedIndices;for(s=e.length,r=0;r<s;++r)e[r].color=Ot.clone(Ot.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}},qE.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;const n=this._batchIdLookUp,i=n[e];if(!D(i))return;const o=this._indexOffsets,r=this._indexCounts,s=o[i],a=r[i],c=this._batchedIndices,l=c.length;let u;for(u=0;u<l;++u){const e=c[u].offset,t=c[u].count;if(s>=e&&s<e+t)break}c.push(new cE({color:Ot.clone(t),offset:s,count:a,batchIds:[e]}));const d=[],h=[],p=c[u].batchIds,f=p.length;for(let m=0;m<f;++m){const t=p[m];if(t===e)continue;o[n[t]]<s?d.push(t):h.push(t)}0!==h.length&&c.push(new cE({color:Ot.clone(c[u].color),offset:s+a,count:c[u].offset+c[u].count-(s+a),batchIds:h})),0!==d.length?(c[u].count=s-c[u].offset,c[u].batchIds=d):c.splice(u,1),this._batchDirty=!0},qE.prototype.update=function(e){const t=e.context;var n;!function(e,t){if(D(e._va))return;const n=Ye.createVertexBuffer({context:t,typedArray:e._positions,usage:qe.STATIC_DRAW}),i=Ye.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:qe.STATIC_DRAW}),o=Ye.createIndexBuffer({context:t,typedArray:e._indices,usage:qe.DYNAMIC_DRAW,indexDatatype:2===e._indices.BYTES_PER_ELEMENT?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),r=[{index:0,vertexBuffer:n,componentDatatype:Ca.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:Ca.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new kl({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new kl({context:t,attributes:r,indexBuffer:Ye.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:qe.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0}(this,t),function(e,t){if(D(e._sp))return;const n=e._batchTable,i=M(e._attributeLocations,YE);let o=e._pickId;const r=e._vertexShaderSource;let s=e._fragmentShaderSource;if(D(r))return e._sp=ya.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=bc.replaceMain(s,"czm_non_pick_main"),s=`${s}void main() \n{ \n czm_non_pick_main(); \n out_FragColor = ${o}; \n} \n`,void(e._spPick=ya.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}));const a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(lE);let c=n.getFragmentShaderCallback(!1,void 0,!0)(Uf);o=n.getPickId();let l=new bc({sources:[a]}),u=new bc({defines:["VECTOR_TILE"],sources:[c]});e._sp=ya.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:i}),l=new bc({sources:[lE]}),u=new bc({defines:["VECTOR_TILE"],sources:[Uf]}),e._spStencil=ya.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:i}),c=bc.replaceMain(c,"czm_non_pick_main"),c=`${c}\nvoid main() \n{ \n czm_non_pick_main(); \n out_FragColor = ${o}; \n} \n`;const d=new bc({sources:[a]}),h=new bc({defines:["VECTOR_TILE"],sources:[c]});e._spPick=ya.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:i})}(this,t),D((n=this)._rsStencilDepthPass)||(n._rsStencilDepthPass=_s.fromCache(XE(!1)),n._rsStencilDepthPass3DTiles=_s.fromCache(XE(!0)),n._rsColorPass=_s.fromCache(QE),n._rsPickPass=_s.fromCache($E)),function(e,t){if(D(e._uniformMap))return;const n={u_modifiedModelViewProjection:function(){const n=t.uniformState.view,i=t.uniformState.projection;return ve.clone(n,KE),ve.multiplyByPoint(KE,e._center,ZE),ve.setTranslation(KE,ZE,KE),ve.multiply(i,KE,KE),KE},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}(this,t);const i=e.passes;i.render&&(function(e,t){const n=nx(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=2*r;if(D(i)&&!n&&i.length===s)return;i.length=s;const a=e._va,c=e._sp,l=M(e._modelMatrix,ve.IDENTITY),u=e._uniformMap,d=e._boundingVolume;for(let h=0;h<r;++h){const t=o[h].offset,n=o[h].count;let r=i[2*h];D(r)||(r=i[2*h]=new Kr({owner:e})),r.vertexArray=a,r.modelMatrix=l,r.offset=t,r.count=n,r.renderState=e._rsStencilDepthPass,r.shaderProgram=c,r.uniformMap=u,r.boundingVolume=d,r.cull=!1,r.pass=zt.TERRAIN_CLASSIFICATION;const s=Kr.shallowClone(r,r.derivedCommands.tileset);s.renderState=e._rsStencilDepthPass3DTiles,s.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s;let p=i[2*h+1];D(p)||(p=i[2*h+1]=new Kr({owner:e})),p.vertexArray=a,p.modelMatrix=l,p.offset=t,p.count=n,p.renderState=e._rsColorPass,p.shaderProgram=c,p.uniformMap=u,p.boundingVolume=d,p.cull=!1,p.pass=zt.TERRAIN_CLASSIFICATION;const f=Kr.shallowClone(p,p.derivedCommands.tileset);f.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=f}e._commandsDirty=!0}(this,t),function(e,t){if(e.classificationType===Vf.TERRAIN||!t.invertClassification||D(e._commandsIgnoreShow)&&!e._commandsDirty)return;const n=e._commands,i=e._commandsIgnoreShow,o=e._spStencil,r=n.length,s=i.length=r/2;let a=0;for(let c=0;c<s;++c){const e=i[c]=Kr.shallowClone(n[a],i[c]);e.shaderProgram=o,e.pass=zt.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}(this,e),function(e){let t,n,i=e.debugWireframe===e._debugWireframe;if(i=i&&!(e.debugWireframe&&e._wireframeDirty),i)return;D(e._rsWireframe)||(e._rsWireframe=_s.fromCache({})),e.debugWireframe?(t=e._rsWireframe,n=Vr.LINES):(t=e._rsColorPass,n=Vr.TRIANGLES);const o=e._commands,r=o.length;for(let s=0;s<r;s+=2){const e=o[s+1];e.renderState=t,e.primitiveType=n}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}(this),this._debugWireframe?function(e,t){const n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){const e=t[o+1];e.pass=zt.OPAQUE,n.push(e)}}(e,this._commands):sx(this,e,this._commands,this._commandsIgnoreShow)),i.pick&&(!function(e){if(!e._pickCommandsDirty)return;const t=e._indexOffsets.length,n=e._pickCommands;n.length=2*t;const i=e._va,o=e._spStencil,r=e._spPick,s=M(e._modelMatrix,ve.IDENTITY),a=e._uniformMap;for(let c=0;c<t;++c){const t=e._indexOffsets[c],l=e._indexCounts[c],u=D(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume;let d=n[2*c];D(d)||(d=n[2*c]=new Kr({owner:e,pickOnly:!0})),d.vertexArray=i,d.modelMatrix=s,d.offset=t,d.count=l,d.renderState=e._rsStencilDepthPass,d.shaderProgram=o,d.uniformMap=a,d.boundingVolume=u,d.pass=zt.TERRAIN_CLASSIFICATION;const h=Kr.shallowClone(d,d.derivedCommands.tileset);h.renderState=e._rsStencilDepthPass3DTiles,h.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,d.derivedCommands.tileset=h;let p=n[2*c+1];D(p)||(p=n[2*c+1]=new Kr({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=s,p.offset=t,p.count=l,p.renderState=e._rsPickPass,p.shaderProgram=r,p.uniformMap=a,p.boundingVolume=u,p.pass=zt.TERRAIN_CLASSIFICATION;const f=Kr.shallowClone(p,p.derivedCommands.tileset);f.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=f}e._pickCommandsDirty=!1}(this),sx(this,e,this._pickCommands))},qE.prototype.isDestroyed=function(){return!1},qE.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(),He(this)},Object.defineProperties(ax.prototype,{trianglesLength:{get:function(){return D(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return D(this._primitive)?this._primitive.geometryByteLength:0}},ready:{get:function(){return this._ready}}}),ax.packedBoxLength=ve.packedLength+H.packedLength,ax.packedCylinderLength=ve.packedLength+2,ax.packedEllipsoidLength=ve.packedLength+H.packedLength,ax.packedSphereLength=H.packedLength+1;const cx=new Qa("createVectorTileGeometries",5),lx=new Ot;function ux(e){if(!D(e._primitive)&&!D(e._verticesPromise)){let t=e._boxes,n=e._boxBatchIds,i=e._cylinders,o=e._cylinderBatchIds,r=e._ellipsoids,s=e._ellipsoidBatchIds,a=e._spheres,c=e._sphereBatchIds,l=e._batchTableColors,u=e._packedBuffer;if(!D(l)){let d=0;D(e._boxes)&&(t=e._boxes=t.slice(),n=e._boxBatchIds=n.slice(),d+=n.length),D(e._cylinders)&&(i=e._cylinders=i.slice(),o=e._cylinderBatchIds=o.slice(),d+=o.length),D(e._ellipsoids)&&(r=e._ellipsoids=r.slice(),s=e._ellipsoidBatchIds=s.slice(),d+=s.length),D(e._spheres)&&(a=e._sphere=a.slice(),c=e._sphereBatchIds=c.slice(),d+=c.length),l=e._batchTableColors=new Uint32Array(d);const h=e._batchTable;for(let e=0;e<d;++e){const t=h.getColor(e,lx);l[e]=t.toRgba()}u=e._packedBuffer=function(e){const t=new Float64Array(ve.packedLength+H.packedLength);let n=0;return H.pack(e._center,t,n),n+=H.packedLength,ve.pack(e._modelMatrix,t,n),t}(e)}const d=[];D(t)&&d.push(t.buffer,n.buffer),D(i)&&d.push(i.buffer,o.buffer),D(r)&&d.push(r.buffer,s.buffer),D(a)&&d.push(a.buffer,c.buffer),d.push(l.buffer,u.buffer);const h={boxes:D(t)?t.buffer:void 0,boxBatchIds:D(t)?n.buffer:void 0,cylinders:D(i)?i.buffer:void 0,cylinderBatchIds:D(i)?o.buffer:void 0,ellipsoids:D(r)?r.buffer:void 0,ellipsoidBatchIds:D(r)?s.buffer:void 0,spheres:D(a)?a.buffer:void 0,sphereBatchIds:D(a)?c.buffer:void 0,batchTableColors:l.buffer,packedBuffer:u.buffer},p=e._verticesPromise=cx.scheduleTask(h,d);if(!D(p))return;return p.then((function(t){if(e.isDestroyed())return;const n=new Float64Array(t.packedBuffer),i=function(e,t){let n=0;const i=t[n++],o=t[n++],r=e._boundingVolumes=new Array(o);for(let c=0;c<o;++c)r[c]=$u.unpack(t,n),n+=$u.packedLength;const s=t[n++],a=e._batchedIndices=new Array(s);for(let c=0;c<s;++c){const e=Ot.unpack(t,n);n+=Ot.packedLength;const i=t[n++],o=t[n++],r=t[n++],s=new Array(r);for(let a=0;a<r;++a)s[a]=t[n++];a[c]=new cE({color:e,offset:i,count:o,batchIds:s})}return i}(e,n);e._indices=2===i?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._positions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.vertexBatchIds),e._batchIds=new Uint16Array(t.batchIds),function(e){D(e._primitive)||(e._primitive=new qE({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:M(e._pickObject,e)}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0)}(e),e._ready=!0})).catch((t=>{e.isDestroyed()||(e._error=t)}))}}function dx(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._geometries=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,function(e,t,n){n=M(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=hx;const r=o.getUint32(n,!0);if(1!==r)throw new be(`Only Geometry tile version 1 is supported. Version ${r} is not.`);n+=hx;const s=o.getUint32(n,!0);if(n+=hx,0===s)return void(e._ready=!0);const a=o.getUint32(n,!0);if(n+=hx,0===a)throw new be("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=hx;const l=o.getUint32(n,!0);n+=hx;const u=o.getUint32(n,!0);n+=hx;const d=Ew(i,n,a);n+=a;const h=new Uint8Array(t,n,c);let p,f;n+=c,l>0&&(p=Ew(i,n,l),n+=l,u>0&&(f=new Uint8Array(t,n,u),f=new Uint8Array(f)));const m=M(d.BOXES_LENGTH,0),_=M(d.CYLINDERS_LENGTH,0),g=M(d.ELLIPSOIDS_LENGTH,0),y=M(d.SPHERES_LENGTH,0),b=m+_+g+y,v=new Yw(e,b,p,f,function(e){return function(t,n){D(e._geometries)&&e._geometries.updateCommands(t,n)}}(e));if(e._batchTable=v,0===b)return;const A=e.tile.computedTransform;let T;D(d.RTC_CENTER)&&(T=H.unpack(d.RTC_CENTER),ve.multiplyByPoint(A,T,T));const w=function(e,t){let n,i,o,r,s;const a=M(e.BOXES_LENGTH,0),c=M(e.CYLINDERS_LENGTH,0),l=M(e.ELLIPSOIDS_LENGTH,0),u=M(e.SPHERES_LENGTH,0);if(a>0&&D(e.BOX_BATCH_IDS)){const i=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,i,a)}if(c>0&&D(e.CYLINDER_BATCH_IDS)){const n=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,n,c)}if(l>0&&D(e.ELLIPSOID_BATCH_IDS)){const n=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,n,l)}if(u>0&&D(e.SPHERE_BATCH_IDS)){const n=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,n,u)}const d=D(n)||D(i)||D(o)||D(r),h=a>0&&!D(n)||c>0&&!D(i)||l>0&&!D(o)||u>0&&!D(r);if(d&&h)throw new be("If one group of batch ids is defined, then all batch ids must be defined");if(!(D(n)||D(i)||D(o)||D(r))){let e=0;if(!D(n)&&a>0)for(n=new Uint16Array(a),s=0;s<a;++s)n[s]=e++;if(!D(i)&&c>0)for(i=new Uint16Array(c),s=0;s<c;++s)i[s]=e++;if(!D(o)&&l>0)for(o=new Uint16Array(l),s=0;s<l;++s)o[s]=e++;if(!D(r)&&u>0)for(r=new Uint16Array(u),s=0;s<u;++s)r[s]=e++}return{boxes:n,cylinders:i,ellipsoids:o,spheres:r}}(d,h);if(m>0||_>0||g>0||y>0){let t,n,i,o;if(m>0){const e=h.byteOffset+d.BOXES.byteOffset;t=new Float32Array(h.buffer,e,ax.packedBoxLength*m)}if(_>0){const e=h.byteOffset+d.CYLINDERS.byteOffset;n=new Float32Array(h.buffer,e,ax.packedCylinderLength*_)}if(g>0){const e=h.byteOffset+d.ELLIPSOIDS.byteOffset;i=new Float32Array(h.buffer,e,ax.packedEllipsoidLength*g)}if(y>0){const e=h.byteOffset+d.SPHERES.byteOffset;o=new Float32Array(h.buffer,e,ax.packedSphereLength*y)}return e._geometries=new ax({boxes:t,boxBatchIds:w.boxes,cylinders:n,cylinderBatchIds:w.cylinders,ellipsoids:i,ellipsoidBatchIds:w.ellipsoids,spheres:o,sphereBatchIds:w.spheres,center:T,modelMatrix:A,batchTable:v,boundingVolume:e.tile.boundingVolume.boundingVolume}),e}Promise.resolve(e)}(this,i,o)}ax.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},ax.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},ax.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},ax.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},ax.prototype.update=function(e){if(this._ready)this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e);else if(D(this._promise)||(this._promise=ux(this)),D(this._error)){const e=this._error;throw this._error=void 0,e}},ax.prototype.isDestroyed=function(){return!1},ax.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),He(this)},Object.defineProperties(dx.prototype,{featuresLength:{get:function(){return D(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return D(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return D(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return D(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});const hx=Uint32Array.BYTES_PER_ELEMENT;function px(e){const t=e.featuresLength;if(!D(e._features)&&t>0){const n=new Array(t);D(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}dx.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},dx.prototype.getFeature=function(e){const t=this.featuresLength;if(!D(e)||e<0||e>=t)throw new P(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return px(this),this._features[e]},dx.prototype.applyDebugSettings=function(e,t){D(this._geometries)&&this._geometries.applyDebugSettings(e,t)},dx.prototype.applyStyle=function(e){px(this),D(this._geometries)&&this._geometries.applyStyle(e,this._features)},dx.prototype.update=function(e,t){D(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),D(this._batchTable)&&this._geometries.ready&&(this._batchTable.update(e,t),this._ready=!0)},dx.prototype.pick=function(e,t,n){},dx.prototype.isDestroyed=function(){return!1},dx.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),He(this)};const fx={};function mx(e,t,n,i){if(0!==i)return;1===n&&(t.x=e-1-t.x,t.y=e-1-t.y);const o=t.x;t.x=t.y,t.y=o}fx.encode2D=function(e,t,n){const i=Math.pow(2,e);if(L.typeOf.number("level",e),L.typeOf.number("x",t),L.typeOf.number("y",n),e<1)throw new P("Hilbert level cannot be less than 1.");if(t<0||t>=i||n<0||n>=i)throw new P("Invalid coordinates for given level.");const o={x:t,y:n};let r,s,a,c=BigInt(0);for(a=i/2;a>0;a/=2)r=(o.x&a)>0?1:0,s=(o.y&a)>0?1:0,c+=BigInt((3*r^s)*a*a),mx(i,o,r,s);return c},fx.decode2D=function(e,t){if(L.typeOf.number("level",e),L.typeOf.bigint("index",t),e<1)throw new P("Hilbert level cannot be less than 1.");if(t<BigInt(0)||t>=BigInt(Math.pow(4,e)))throw new P("Hilbert index exceeds valid maximum for given level.");const n=Math.pow(2,e),i={x:0,y:0};let o,r,s,a;for(s=1,a=t;s<n;s*=2)o=1&Number(a/BigInt(2)),r=1&Number(a^BigInt(o)),mx(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};const _x=fx,gx=30,yx=[],bx=[],vx=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],Ax=[1,0,0,3];function Tx(e){if(!Ct.supportsBigInt())throw new be("S2 required BigInt support");if(!D(e))throw new P("cell ID is required.");if(!Tx.isValidId(e))throw new P("cell ID is invalid.");this._cellId=e,this._level=Tx.getLevel(e)}function wx(e){0===yx.length&&(Ix(0,0,0,0,0,0),Ix(0,0,0,1,0,1),Ix(0,0,0,2,0,2),Ix(0,0,0,3,0,3));const t=Number(e>>BigInt(61));let n=1&t;let i=0,o=0;for(let r=7;r>=0;r--){const t=(1<<2*(7===r?2:4))-1;n+=Number(e>>BigInt(2*r*4+1)&BigInt(t))<<2,n=bx[n];const s=4*r;i+=n>>6<<s,o+=(n>>2&15)<<s,n&=3}return[t,i,o]}function Ex(e,t,n){switch(e){case 0:return new H(1,t,n);case 1:return new H(-t,1,n);case 2:return new H(-t,-n,1);case 3:return new H(-1,-n,-t);case 4:return new H(n,-1,-t);default:return new H(n,t,-1)}}function xx(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Sx(e){return 1/2147483648*e}function Cx(e){return 1/1073741824*e}function Ix(e,t,n,i,o,r){if(4===e){const e=(t<<4)+n;yx[(e<<2)+i]=(o<<2)+r,bx[(o<<2)+i]=(e<<2)+r}else{e++,n<<=1,o<<=2;const s=vx[r];Ix(e,(t<<=1)+(s[0]>>1),n+(1&s[0]),i,o,r^Ax[0]),Ix(e,t+(s[1]>>1),n+(1&s[1]),i,o+1,r^Ax[1]),Ix(e,t+(s[2]>>1),n+(1&s[2]),i,o+2,r^Ax[2]),Ix(e,t+(s[3]>>1),n+(1&s[3]),i,o+3,r^Ax[3])}}function Ox(e){return e&~e+BigInt(1)}Tx.fromToken=function(e){if(L.typeOf.string("token",e),!Tx.isValidToken(e))throw new P("token is invalid.");return new Tx(Tx.getIdFromToken(e))},Tx.isValidId=function(e){if(L.typeOf.bigint("cellId",e),e<=0)return!1;if(e>>BigInt(61)>5)return!1;return!!(e&~e+BigInt(1)&BigInt("0x1555555555555555"))},Tx.isValidToken=function(e){return L.typeOf.string("token",e),!!/^[0-9a-fA-F]{1,16}$/.test(e)&&Tx.isValidId(Tx.getIdFromToken(e))},Tx.getIdFromToken=function(e){return L.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))},Tx.getTokenFromId=function(e){L.typeOf.bigint("cellId",e);const t=Math.floor(Dx[(-(n=e)&n)%BigInt(67)]/4);var n;const i=e.toString(16).replace(/0*$/,"");return Array(17-t-i.length).join("0")+i},Tx.getLevel=function(e){if(L.typeOf.bigint("cellId",e),!Tx.isValidId(e))throw new P;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e>>=BigInt(1);return gx-(t>>1)},Tx.prototype.getChild=function(e){if(L.typeOf.number("index",e),e<0||e>3)throw new P("child index must be in the range [0-3].");if(30===this._level)throw new P("cannot get child of leaf cell.");const t=Ox(this._cellId)>>BigInt(2);return new Tx(this._cellId+BigInt(2*e+1-4)*t)},Tx.prototype.getParent=function(){if(0===this._level)throw new P("cannot get parent of root cell.");const e=Ox(this._cellId)<<BigInt(2);return new Tx(this._cellId&~e+BigInt(1)|e)},Tx.prototype.getParentAtLevel=function(e){if(0===this._level||e<0||this._level<e)throw new P("cannot get parent at invalid level.");const t=function(e){return BigInt(1)<<BigInt(2*(gx-e))}(e);return new Tx(this._cellId&-t|t)},Tx.prototype.getCenter=function(e){e=M(e,on.WGS84);let t=function(e,t){const n=function(e,t){const n=wx(e),i=n[0],o=n[1],r=n[2],s=30===t,a=!s&&(BigInt(o)^e>>BigInt(2))&BigInt(1),c=s?1:a?2:0;return[i,(o<<1)+c,(r<<1)+c]}(e,t);return function(e,t,n){const i=Sx(t),o=Sx(n),r=xx(i),s=xx(o);return Ex(e,r,s)}(n[0],n[1],n[2])}(this._cellId,this._level);t=H.normalize(t,t);const n=new Qt.fromCartesian(t,on.UNIT_SPHERE);return Qt.toCartesian(n,e,new H)},Tx.prototype.getVertex=function(e,t){if(L.typeOf.number("index",e),e<0||e>3)throw new P("vertex index must be in the range [0-3].");t=M(t,on.WGS84);let n=function(e,t,n){const i=wx(e),o=function(e,t){const n=[[],[]],i=function(e){return 1<<gx-e>>>0}(t);for(let o=0;o<2;++o){const t=e[o]&-i,r=t+i;n[o][0]=xx(Cx(t)),n[o][1]=xx(Cx(r))}return n}([i[1],i[2]],t),r=n>>1&1;return Ex(i[0],o[0][r^1&n],o[1][r])}(this._cellId,this._level,e);n=H.normalize(n,n);const i=new Qt.fromCartesian(n,on.UNIT_SPHERE);return Qt.toCartesian(i,t,new H)},Tx.fromFacePositionLevel=function(e,t,n){if(L.typeOf.bigint("position",t),e<0||e>5)throw new P("Invalid S2 Face (must be within 0-5)");if(n<0||n>gx)throw new P("Invalid level (must be within 0-30)");if(t<0||t>=Math.pow(4,n))throw new P("Invalid Hilbert position for level");const i=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),o=t.toString(2),r=Array(2*n-o.length+1).join("0"),s=Array(61-2*n).join("0");return new Tx(BigInt(`0b${i}${r}${o}1${s}`))};const Dx=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function Px(e,t){return D(e)&&D(e.extensions)&&D(e.extensions[t])}function Nx(e){const t=e.lengthBits;let n=e.availableCount;L.typeOf.number("options.lengthBits",t);const i=e.constant,o=e.bitstream;if(D(i))n=t;else{const i=Math.ceil(t/8);if(o.length!==i)throw new be(`Availability bitstream must be exactly ${i} bytes long to store ${t} bits. Actual bitstream was ${o.length} bytes long.`);const r=M(e.computeAvailableCountEnabled,!1);!D(n)&&r&&(n=function(e,t){let n=0;for(let i=0;i<t;i++){const t=i%8;n+=e[i>>3]>>t&1}return n}(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function Rx(e){const t=(e=M(e,M.EMPTY_OBJECT)).metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;L.typeOf.object("options.metadataTable",t),L.typeOf.object("options.class",n),L.typeOf.number("options.entityId",i),L.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(Nx.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}}),Nx.prototype.getBit=function(e){if(e<0||e>=this._lengthBits)throw new P("Bit index out of bounds.");if(D(this._constant))return this._constant;const t=e>>3,n=e%8;return 1==(this._bitstream[t]>>n&1)},Object.defineProperties(Rx.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Rx.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)},Rx.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)},Rx.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)},Rx.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)},Rx.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)},Rx.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)},Rx.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const Lx={QUADTREE:"QUADTREE",OCTREE:"OCTREE",getBranchingFactor:function(e){switch(e){case Lx.OCTREE:return 8;case Lx.QUADTREE:return 4;default:throw new P("subdivisionScheme is not a valid value.")}}},Mx=Object.freeze(Lx);function Fx(){}function Bx(e){const t=(e=M(e,M.EMPTY_OBJECT)).subtreeMetadata,n=e.class;L.typeOf.object("options.subtreeMetadata",t),L.typeOf.object("options.class",n);const i=D(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(Fx.prototype,{class:{get:function(){P.throwInstantiationError()}}}),Fx.prototype.hasProperty=function(e){P.throwInstantiationError()},Fx.prototype.hasPropertyBySemantic=function(e){P.throwInstantiationError()},Fx.prototype.getPropertyIds=function(e){P.throwInstantiationError()},Fx.prototype.getProperty=function(e){P.throwInstantiationError()},Fx.prototype.setProperty=function(e,t){P.throwInstantiationError()},Fx.prototype.getPropertyBySemantic=function(e){P.throwInstantiationError()},Fx.prototype.setPropertyBySemantic=function(e,t){P.throwInstantiationError()},Fx.hasProperty=function(e,t,n){if(L.typeOf.string("propertyId",e),L.typeOf.object("properties",t),L.typeOf.object("classDefinition",n),D(t[e]))return!0;const i=n.properties;if(!D(i))return!1;const o=i[e];return!(!D(o)||!D(o.default))},Fx.hasPropertyBySemantic=function(e,t,n){L.typeOf.string("semantic",e),L.typeOf.object("properties",t),L.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!D(i))return!1;return D(i[e])},Fx.getPropertyIds=function(e,t,n){L.typeOf.object("properties",e),L.typeOf.object("classDefinition",t),(n=D(n)?n:[]).length=0;for(const o in e)e.hasOwnProperty(o)&&D(e[o])&&n.push(o);const i=t.properties;if(D(i))for(const o in i)i.hasOwnProperty(o)&&!D(e[o])&&D(i[o].default)&&n.push(o);return n},Fx.getProperty=function(e,t,n){if(L.typeOf.string("propertyId",e),L.typeOf.object("properties",t),L.typeOf.object("classDefinition",n),!D(n.properties[e]))throw new P(`Class definition missing property ${e}`);const i=n.properties[e];let o=t[e];Array.isArray(o)&&(o=o.slice());const r=!0;return o=i.handleNoData(o),!D(o)&&D(i.default)?(o=ti(i.default,!0),i.unpackVectorAndMatrixTypes(o,r)):D(o)?(o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)):void 0},Fx.setProperty=function(e,t,n,i){if(L.typeOf.string("propertyId",e),L.defined("value",t),L.typeOf.object("properties",n),L.typeOf.object("classDefinition",i),!D(n[e]))return!1;let o;Array.isArray(t)&&(t=t.slice());const r=i.properties;D(r)&&(o=r[e]);return D(o)&&(t=o.packVectorAndMatrixTypes(t,true),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0},Fx.getPropertyBySemantic=function(e,t,n){L.typeOf.string("semantic",e),L.typeOf.object("properties",t),L.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!D(i))return;const o=i[e];return D(o)?Fx.getProperty(o.id,t,n):void 0},Fx.setPropertyBySemantic=function(e,t,n,i){L.typeOf.string("semantic",e),L.defined("value",t),L.typeOf.object("properties",n),L.typeOf.object("classDefinition",i);if(!D(i.propertiesBySemantic))return!1;const o=i.propertiesBySemantic[e];return!!D(o)&&Fx.setProperty(o.id,t,n,i)},Object.defineProperties(Bx.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Bx.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,this._class)},Bx.prototype.hasPropertyBySemantic=function(e){return Fx.hasPropertyBySemantic(e,this._properties,this._class)},Bx.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,this._class,e)},Bx.prototype.getProperty=function(e){return Fx.getProperty(e,this._properties,this._class)},Bx.prototype.setProperty=function(e,t){return Fx.setProperty(e,t,this._properties,this._class)},Bx.prototype.getPropertyBySemantic=function(e){return Fx.getPropertyBySemantic(e,this._properties,this._class)},Bx.prototype.setPropertyBySemantic=function(e,t){return Fx.setPropertyBySemantic(e,t,this._properties,this._class)};const zx={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64",getMinimum:function(e){switch(L.typeOf.string("type",e),e){case zx.INT8:return-128;case zx.UINT8:return 0;case zx.INT16:return-32768;case zx.UINT16:return 0;case zx.INT32:return-2147483648;case zx.UINT32:return 0;case zx.INT64:return Ct.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case zx.UINT64:return Ct.supportsBigInt()?BigInt(0):0;case zx.FLOAT32:return-34028234663852886e22;case zx.FLOAT64:return-Number.MAX_VALUE}},getMaximum:function(e){switch(L.typeOf.string("type",e),e){case zx.INT8:return 127;case zx.UINT8:return 255;case zx.INT16:return 32767;case zx.UINT16:return 65535;case zx.INT32:return 2147483647;case zx.UINT32:return 4294967295;case zx.INT64:return Ct.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case zx.UINT64:return Ct.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case zx.FLOAT32:return 34028234663852886e22;case zx.FLOAT64:return Number.MAX_VALUE}},isIntegerType:function(e){switch(L.typeOf.string("type",e),e){case zx.INT8:case zx.UINT8:case zx.INT16:case zx.UINT16:case zx.INT32:case zx.UINT32:case zx.INT64:case zx.UINT64:return!0;default:return!1}},isUnsignedIntegerType:function(e){switch(L.typeOf.string("type",e),e){case zx.UINT8:case zx.UINT16:case zx.UINT32:case zx.UINT64:return!0;default:return!1}},isVectorCompatible:function(e){switch(L.typeOf.string("type",e),e){case zx.INT8:case zx.UINT8:case zx.INT16:case zx.UINT16:case zx.INT32:case zx.UINT32:case zx.FLOAT32:case zx.FLOAT64:return!0;default:return!1}},normalize:function(e,t){if("number"!=typeof e&&"bigint"!=typeof e)throw new P("value must be a number or a BigInt");if(!zx.isIntegerType(t))throw new P("type must be an integer type");return Math.max(Number(e)/Number(zx.getMaximum(t)),-1)},unnormalize:function(e,t){if(L.typeOf.number("value",e),!zx.isIntegerType(t))throw new P("type must be an integer type");const n=zx.getMaximum(t),i=zx.isUnsignedIntegerType(t)?0:-n;return e=V.sign(e)*Math.round(Math.abs(e)*Number(n)),t!==zx.INT64&&t!==zx.UINT64||!Ct.supportsBigInt()||(e=BigInt(e)),e>n?n:e<i?i:e},applyValueTransform:function(e,t,n){return n*e+t},unapplyValueTransform:function(e,t,n){return 0===n?0:(e-t)/n},getSizeInBytes:function(e){switch(L.typeOf.string("type",e),e){case zx.INT8:case zx.UINT8:return 1;case zx.INT16:case zx.UINT16:return 2;case zx.INT32:case zx.UINT32:return 4;case zx.INT64:case zx.UINT64:return 8;case zx.FLOAT32:return 4;case zx.FLOAT64:return 8}},fromComponentDatatype:function(e){switch(L.typeOf.number("componentDatatype",e),e){case Ca.BYTE:return zx.INT8;case Ca.UNSIGNED_BYTE:return zx.UINT8;case Ca.SHORT:return zx.INT16;case Ca.UNSIGNED_SHORT:return zx.UINT16;case Ca.INT:return zx.INT32;case Ca.UNSIGNED_INT:return zx.UINT32;case Ca.FLOAT:return zx.FLOAT32;case Ca.DOUBLE:return zx.FLOAT64}},toComponentDatatype:function(e){switch(L.typeOf.string("type",e),e){case zx.INT8:return Ca.BYTE;case zx.UINT8:return Ca.UNSIGNED_BYTE;case zx.INT16:return Ca.SHORT;case zx.UINT16:return Ca.UNSIGNED_SHORT;case zx.INT32:return Ca.INT;case zx.UINT32:return Ca.UNSIGNED_INT;case zx.FLOAT32:return Ca.FLOAT;case zx.FLOAT64:return Ca.DOUBLE}}},Ux=Object.freeze(zx),kx={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM",isVectorType:function(e){switch(L.typeOf.string("type",e),e){case kx.VEC2:case kx.VEC3:case kx.VEC4:return!0;default:return!1}},isMatrixType:function(e){switch(L.typeOf.string("type",e),e){case kx.MAT2:case kx.MAT3:case kx.MAT4:return!0;default:return!1}},getComponentCount:function(e){switch(L.typeOf.string("type",e),e){case kx.SCALAR:case kx.STRING:case kx.ENUM:case kx.BOOLEAN:return 1;case kx.VEC2:return 2;case kx.VEC3:return 3;case kx.VEC4:case kx.MAT2:return 4;case kx.MAT3:return 9;case kx.MAT4:return 16;default:throw new P(`Invalid metadata type ${e}`)}},getMathType:function(e){switch(e){case kx.VEC2:return kt;case kx.VEC3:return H;case kx.VEC4:return K;case kx.MAT2:return Ms;case kx.MAT3:return re;case kx.MAT4:return ve;default:return}}},Vx=Object.freeze(kx);function Hx(e){const t=(e=M(e,M.EMPTY_OBJECT)).id,n=e.type;L.typeOf.string("options.id",t),L.typeOf.string("options.type",n);const i=e.componentType,o=e.enumType,r=D(i)&&Ux.isIntegerType(i)&&M(e.normalized,!1);this._id=t,this._name=e.name,this._description=e.description,this._semantic=e.semantic,this._isLegacyExtension=e.isLegacyExtension,this._type=n,this._componentType=i,this._enumType=o,this._valueType=D(o)?o.valueType:i,this._isArray=M(e.isArray,!1),this._isVariableLengthArray=M(e.isVariableLengthArray,!1),this._arrayLength=e.arrayLength,this._min=ti(e.min,!0),this._max=ti(e.max,!0),this._normalized=r;let s=ti(e.offset,!0),a=ti(e.scale,!0);const c=D(s)||D(a),l=!0;D(s)||(s=this.expandConstant(0,l)),D(a)||(a=this.expandConstant(1,l)),this._offset=s,this._scale=a,this._hasValueTransform=c,this._noData=ti(e.noData,!0),this._default=ti(e.default,!0),this._required=M(e.required,!0),this._extras=ti(e.extras,!0),this._extensions=ti(e.extensions,!0)}function Gx(e,t){if(!Array.isArray(e))return e===t;if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Gx(e[n],t[n]))return!1;return!0}function jx(e,t){const n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return Vx.isVectorType(n)?function(e,t,n){if(!Ux.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===Vx.VEC2&&!(e instanceof kt))return`vector value ${e} must be a Cartesian2`;if(t===Vx.VEC3&&!(e instanceof H))return`vector value ${e} must be a Cartesian3`;if(t===Vx.VEC4&&!(e instanceof K))return`vector value ${e} must be a Cartesian4`}(t,n,i):Vx.isMatrixType(n)?function(e,t,n){if(!Ux.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===Vx.MAT2&&!(e instanceof Ms))return`matrix value ${e} must be a Matrix2`;if(t===Vx.MAT3&&!(e instanceof re))return`matrix value ${e} must be a Matrix3`;if(t===Vx.MAT4&&!(e instanceof ve))return`matrix value ${e} must be a Matrix4`}(t,n,i):n===Vx.STRING?function(e){if("string"!=typeof e)return Wx(e,Vx.STRING)}(t):n===Vx.BOOLEAN?function(e){if("boolean"!=typeof e)return Wx(e,Vx.BOOLEAN)}(t):n===Vx.ENUM?function(e,t){const n=typeof e;if(D(t))return"string"===n&&D(t.valuesByName[e])?void 0:`value ${e} is not a valid enum name for ${t.id}`}(t,o):function(e,t,n){const i=typeof e;switch(t){case Ux.INT8:case Ux.UINT8:case Ux.INT16:case Ux.UINT16:case Ux.INT32:case Ux.UINT32:case Ux.FLOAT32:case Ux.FLOAT64:return"number"!==i?Wx(e,t):isFinite(e)?Yx(e,t,n):Xx(e,t);case Ux.INT64:case Ux.UINT64:return"number"!==i&&"bigint"!==i?Wx(e,t):"number"!==i||isFinite(e)?Yx(e,t,n):Xx(e,t)}}(t,i,r)}function Wx(e,t){return`value ${e} does not match type ${t}`}function qx(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function Yx(e,t,n){if(n){return e<(Ux.isUnsignedIntegerType(t)?0:-1)||e>1?qx(e,t,n):void 0}if(e<Ux.getMinimum(t)||e>Ux.getMaximum(t))return qx(e,t,n)}function Xx(e,t){return`value ${e} of type ${t} must be finite`}function Qx(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=Qx(e[i],t,n);return e}function $x(e){const t=(e=M(e,M.EMPTY_OBJECT)).count,n=e.property,i=e.classProperty,o=e.bufferViews;L.typeOf.number.greaterThan("options.count",t,0),L.typeOf.object("options.property",n),L.typeOf.object("options.classProperty",i),L.typeOf.object("options.bufferViews",o);const r=i.type,s=i.isArray,a=i.isVariableLengthArray;let c=i.valueType;const l=i.enumType,u=r===Vx.STRING,d=r===Vx.BOOLEAN;let h,p=0;if(a){let e=M(n.arrayOffsetType,n.offsetType);e=M(Ux[e],Ux.UINT32);h=new nS(o[M(n.arrayOffsets,n.arrayOffsetBufferView)],e,t+1),p+=h.typedArray.byteLength}const f=Vx.getComponentCount(r);let m;m=a?h.get(t)-h.get(0):s?t*i.arrayLength:t;const _=f*m;let g,y;if(u){let e=M(n.stringOffsetType,n.offsetType);e=M(Ux[e],Ux.UINT32);g=new nS(o[M(n.stringOffsets,n.stringOffsetBufferView)],e,_+1),p+=g.typedArray.byteLength}(u||d)&&(c=Ux.UINT8),y=u?g.get(_)-g.get(0):d?Math.ceil(_/8):_;const b=new nS(o[M(n.values,n.bufferView)],c,y);p+=b.typedArray.byteLength;let v=n.offset,A=n.scale;const T=i.hasValueTransform||D(v)||D(A);let w,E;v=M(v,i.offset),A=M(A,i.scale),v=Kx(v),A=Kx(A);const x=this;u?w=function(e){return function(e,t,n){const i=n.get(e),o=n.get(e+1)-i;return bw(t.typedArray,i,o)}(e,x._values,x._stringOffsets)}:d?(w=function(e){return function(e,t){const n=e>>3,i=e%8;return 1==(t.typedArray[n]>>i&1)}(e,x._values)},E=function(e,t){!function(e,t,n){const i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}(e,x._values,t)}):D(l)?(w=function(e){const t=x._values.get(e);return l.namesByValue[t]},E=function(e,t){const n=l.valuesByName[t];x._values.set(e,n)}):(w=function(e){return x._values.get(e)},E=function(e,t){x._values.set(e,t)}),this._arrayOffsets=h,this._stringOffsets=g,this._values=b,this._classProperty=i,this._count=t,this._vectorComponentCount=f,this._min=n.min,this._max=n.max,this._offset=v,this._scale=A,this._hasValueTransform=T,this._getValue=w,this._setValue=E,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=p}function Kx(e){if(!Array.isArray(e))return e;const t=[];for(let n=0;n<e.length;n++){const i=e[n];Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}function Zx(e,t){const n=e._count;if(!D(t)||t<0||t>=n){throw new P(`index is required and between zero and count - 1. Actual value: ${n-1}`)}}function Jx(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;const r=Vx.getComponentCount(t.type);i*=r,o*=r}else{const r=M(t.arrayLength,1)*e._vectorComponentCount;i=n*r,o=r}const r=new Array(o);for(let s=0;s<o;s++)r[s]=e._getValue(i+s);return r}function eS(e){if(D(e._unpackedValues))return!1;const t=e._classProperty,n=t.type,i=t.valueType;return n===Vx.STRING||(i===Ux.INT64&&!Ct.supportsBigInt64Array()||i===Ux.UINT64&&!Ct.supportsBigUint64Array())}function tS(e){e._unpackedValues=function(e){const t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=Vx.getComponentCount(r);if(!o&&1===s){for(let i=0;i<t;++i)n[i]=e._getValue(i);return n}for(let a=0;a<t;a++)n[a]=Jx(e,i,a);return n}(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function nS(e,t,n){const i=this;let o,r,s;if(t===Ux.INT64)Ct.supportsBigInt()?Ct.supportsBigInt64Array()?(o=new BigInt64Array(e.buffer,e.byteOffset,n),s=function(e,t){i.typedArray[e]=BigInt(t)}):(o=new Uint8Array(e.buffer,e.byteOffset,8*n),r=function(e){return function(e,t){const n=t.dataView,i=8*e;let o=BigInt(0);const r=(128&n.getUint8(i+7))>0;let s=!0;for(let a=0;a<8;++a){let e=n.getUint8(i+a);r&&(s?0!==e&&(e=255&~(e-1),s=!1):e=255&~e),o+=BigInt(e)*(BigInt(1)<<BigInt(8*a))}return r&&(o=-o),o}(e,i)}):(Oa("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,8*n),r=function(e){return function(e,t){const n=t.dataView,i=8*e;let o=0;const r=(128&n.getUint8(i+7))>0;let s=!0;for(let a=0;a<8;++a){let e=n.getUint8(i+a);r&&(s?0!==e&&(e=255&~(e-1),s=!1):e=255&~e),o+=e*Math.pow(256,a)}return r&&(o=-o),o}(e,i)});else if(t===Ux.UINT64)Ct.supportsBigInt()?Ct.supportsBigUint64Array()?(o=new BigUint64Array(e.buffer,e.byteOffset,n),s=function(e,t){i.typedArray[e]=BigInt(t)}):(o=new Uint8Array(e.buffer,e.byteOffset,8*n),r=function(e){return function(e,t){const n=t.dataView,i=8*e,o=BigInt(n.getUint32(i,!0)),r=BigInt(n.getUint32(i+4,!0));return o+BigInt(4294967296)*r}(e,i)}):(Oa("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,8*n),r=function(e){return function(e,t){const n=t.dataView,i=8*e;return n.getUint32(i,!0)+4294967296*n.getUint32(i+4,!0)}(e,i)});else{const r=function(e){switch(e){case Ux.INT8:return Ca.BYTE;case Ux.UINT8:return Ca.UNSIGNED_BYTE;case Ux.INT16:return Ca.SHORT;case Ux.UINT16:return Ca.UNSIGNED_SHORT;case Ux.INT32:return Ca.INT;case Ux.UINT32:return Ca.UNSIGNED_INT;case Ux.FLOAT32:return Ca.FLOAT;case Ux.FLOAT64:return Ca.DOUBLE}}(t);o=Ca.createArrayBufferView(r,e.buffer,e.byteOffset,n),s=function(e,t){i.typedArray[e]=t}}D(r)||(r=function(e){return i.typedArray[e]}),this.typedArray=o,this.dataView=new DataView(o.buffer,o.byteOffset),this.get=r,this.set=s,this._componentType=t}function iS(e){const t=(e=M(e,M.EMPTY_OBJECT)).count,n=e.class;L.typeOf.number.greaterThan("options.count",t,0),L.typeOf.object("options.class",n);let i=0;const o={};if(D(e.properties))for(const r in e.properties)if(e.properties.hasOwnProperty(r)){const s=new $x({count:t,property:e.properties[r],classProperty:n.properties[r],bufferViews:e.bufferViews});o[r]=s,i+=s.byteLength}this._count=t,this._class=n,this._properties=o,this._byteLength=i}function oS(){}Hx.fromJson=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).id,n=e.property;L.typeOf.string("options.id",t),L.typeOf.object("options.property",n),L.typeOf.string("options.property.type",n.type);const i=function(e){if("ARRAY"===e.type)return!0;const t=e.type;if(t===Vx.SCALAR||Vx.isMatrixType(t)||Vx.isVectorType(t))return!1;if(D(Ux[t]))return!0;if(D(e.noData)||D(e.scale)||D(e.offset)||D(e.required)||D(e.count)||D(e.array))return!1;if(D(e.optional))return!1;return}(n),o=function(e,t){const n=e.type,i=e.componentType,o="ARRAY"===n;let r,s,a,c;o?(r=!0,s=e.componentCount,a=!D(s)):e.array?(r=!0,s=e.count,a=!D(e.count)):(r=!1,s=void 0,a=!1);D(e.enumType)&&(c=t[e.enumType]);if(n===Vx.ENUM)return{type:n,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===Vx.ENUM)return{type:i,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===Vx.SCALAR||Vx.isMatrixType(n)||Vx.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===Vx.BOOLEAN||n===Vx.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===Vx.BOOLEAN||i===Vx.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(D(i)&&D(Ux[i]))return{type:Vx.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(D(Ux[n]))return{type:Vx.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s};throw new P(`unknown metadata type {type: ${n}, componentType: ${i})`)}(n,e.enums);let r;return r=!!D(i)&&(i?!D(n.optional)||!n.optional:M(n.required,!1)),new Hx({id:t,type:o.type,componentType:o.componentType,enumType:o.enumType,isArray:o.isArray,isVariableLengthArray:o.isVariableLengthArray,arrayLength:o.arrayLength,normalized:n.normalized,min:n.min,max:n.max,offset:n.offset,scale:n.scale,noData:n.noData,default:n.default,required:r,name:n.name,description:n.description,semantic:n.semantic,extras:n.extras,extensions:n.extensions,isLegacyExtension:i})},Object.defineProperties(Hx.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},isArray:{get:function(){return this._isArray}},isVariableLengthArray:{get:function(){return this._isVariableLengthArray}},arrayLength:{get:function(){return this._arrayLength}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},noData:{get:function(){return this._noData}},default:{get:function(){return this._default}},required:{get:function(){return this._required}},semantic:{get:function(){return this._semantic}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Hx.prototype.normalize=function(e){return this._normalized?Qx(e,this._valueType,Ux.normalize):e},Hx.prototype.unnormalize=function(e){return this._normalized?Qx(e,this._valueType,Ux.unnormalize):e},Hx.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Hx.valueTransformInPlace(e,this._offset,this._scale,Ux.applyValueTransform)},Hx.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Hx.valueTransformInPlace(e,this._offset,this._scale,Ux.unapplyValueTransform)},Hx.prototype.expandConstant=function(e,t){t=M(t,!1);const n=this._isArray,i=this._arrayLength,o=Vx.getComponentCount(this._type),r=n&&o>1;if(!n&&1===o)return e;if(!n)return new Array(o).fill(e);if(!r)return new Array(i).fill(e);if(!t)return new Array(this._arrayLength*o).fill(e);const s=new Array(o).fill(e);return new Array(this._arrayLength).fill(s)},Hx.prototype.handleNoData=function(e){const t=this._noData;return D(t)&&Gx(e,t)?void 0:e},Hx.prototype.unpackVectorAndMatrixTypes=function(e,t){t=M(t,!1);const n=Vx.getMathType(this._type),i=this._isArray,o=Vx.getComponentCount(this._type),r=i&&o>1;return D(n)?t&&r?e.map((function(e){return n.unpack(e)})):i?n.unpackArray(e):n.unpack(e):e},Hx.prototype.packVectorAndMatrixTypes=function(e,t){t=M(t,!1);const n=Vx.getMathType(this._type),i=this._isArray,o=Vx.getComponentCount(this._type),r=i&&o>1;return D(n)?t&&r?e.map((function(e){return n.pack(e,[])})):i?n.packArray(e,[]):n.pack(e,[]):e},Hx.prototype.validate=function(e){if(D(e)||!D(this._default))return this._required&&!D(e)?"required property must have a value":this._isArray?function(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;const n=t.length;if(!e._isVariableLengthArray&&n!==e._arrayLength)return"Array length does not match property.arrayLength";for(let i=0;i<n;i++){const n=jx(e,t[i]);if(D(n))return n}}(this,e):jx(this,e)},Hx.valueTransformInPlace=function(e,t,n,i){if(!Array.isArray(e))return i(e,t,n);for(let o=0;o<e.length;o++)e[o]=Hx.valueTransformInPlace(e[o],t[o],n[o],i);return e},Object.defineProperties($x.prototype,{hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){return this._byteLength}}}),$x.prototype.get=function(e){Zx(this,e);let t=function(e,t){eS(e)&&tS(e);const n=e._classProperty,i=n.isArray,o=n.type,r=Vx.getComponentCount(o);if(D(e._unpackedValues)){const n=e._unpackedValues[t];return i?ti(n,!0):n}if(!i&&1===r)return e._getValue(t);return Jx(e,n,t)}(this,e);return t=this._classProperty.handleNoData(t),D(t)?(t=this._classProperty.normalize(t),t=function(e,t){const n=e._classProperty.isVariableLengthArray;if(!e._hasValueTransform||n)return t;return Hx.valueTransformInPlace(t,e._offset,e._scale,Ux.applyValueTransform)}(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))},$x.prototype.set=function(e,t){const n=this._classProperty;L.defined("value",t),Zx(this,e);const i=n.validate(t);if(D(i))throw new P(i);t=function(e,t){const n=e._classProperty,i=n.isVariableLengthArray;if(!e._hasValueTransform||i)return t;return Hx.valueTransformInPlace(t,e._offset,e._scale,Ux.unapplyValueTransform)}(this,t=n.packVectorAndMatrixTypes(t)),function(e,t,n){(function(e,t,n){if(eS(e))return!0;const i=e._arrayOffsets;if(D(i)){if(i.get(t+1)-i.get(t)!==n.length)return!0}return!1})(e,t,n)&&tS(e);const i=e._classProperty,o=i.isArray,r=i.type,s=Vx.getComponentCount(r);if(D(e._unpackedValues))return i.isArray&&(n=ti(n,!0)),void(e._unpackedValues[t]=n);if(!o&&1===s)return void e._setValue(t,n);let a,c;if(i.isVariableLengthArray)a=e._arrayOffsets.get(t),c=e._arrayOffsets.get(t+1)-a;else{const n=M(i.arrayLength,1)*e._vectorComponentCount;a=t*n,c=n}for(let l=0;l<c;++l)e._setValue(a+l,n[l])}(this,e,t=n.unnormalize(t))},$x.prototype.getTypedArray=function(){if(D(this._values))return this._values.typedArray},Object.defineProperties(iS.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}}),iS.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,this._class)},iS.prototype.hasPropertyBySemantic=function(e){return Fx.hasPropertyBySemantic(e,this._properties,this._class)},iS.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,this._class,e)},iS.prototype.getProperty=function(e,t){L.typeOf.string("propertyId",t);const n=this._properties[t];let i;return i=D(n)?n.get(e):function(e,t){const n=e.properties;if(!D(n))return;const i=n[t];if(D(i)&&D(i.default)){let e=i.default;return i.isArray&&(e=ti(e,!0)),e=i.normalize(e),i.unpackVectorAndMatrixTypes(e)}}(this._class,t),i},iS.prototype.setProperty=function(e,t,n){L.typeOf.string("propertyId",t);const i=this._properties[t];return!!D(i)&&(i.set(e,n),!0)},iS.prototype.getPropertyBySemantic=function(e,t){let n;L.typeOf.string("semantic",t);const i=this._class.propertiesBySemantic;if(D(i)&&(n=i[t]),D(n))return this.getProperty(e,n.id)},iS.prototype.setPropertyBySemantic=function(e,t,n){let i;L.typeOf.string("semantic",t);const o=this._class.propertiesBySemantic;return D(o)&&(i=o[t]),!!D(i)&&this.setProperty(e,i.id,n)},iS.prototype.getPropertyTypedArray=function(e){L.typeOf.string("propertyId",e);const t=this._properties[e];if(D(t))return t.getTypedArray()},iS.prototype.getPropertyTypedArrayBySemantic=function(e){let t;L.typeOf.string("semantic",e);const n=this._class.propertiesBySemantic;if(D(n)&&(t=n[e]),D(t))return this.getPropertyTypedArray(t.id)},Object.defineProperties(oS.prototype,{cacheKey:{get:function(){P.throwInstantiationError()}}}),oS.prototype.load=function(){P.throwInstantiationError()},oS.prototype.unload=function(){},oS.prototype.process=function(e){return!1},oS.prototype.getError=function(e,t){L.typeOf.string("errorMessage",e),D(t)&&D(t.message)&&(e+=`\n${t.message}`);const n=new be(e);return D(t)&&(n.stack=`Original stack:\n${t.stack}\nHandler stack:\n${n.stack}`),n},oS.prototype.isDestroyed=function(){return!1},oS.prototype.destroy=function(){return this.unload(),He(this)};const rS=Object.freeze({UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,READY:4,FAILED:5});function sS(e){const t=(e=M(e,M.EMPTY_OBJECT)).typedArray,n=e.resource,i=e.cacheKey;if(D(t)===D(n))throw new P("One of options.typedArray and options.resource must be defined.");this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=rS.UNLOADED,this._promise=void 0}D(Object.create)&&(sS.prototype=Object.create(oS.prototype),sS.prototype.constructor=sS),Object.defineProperties(sS.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),sS.prototype.load=async function(){return D(this._promise)?this._promise:D(this._typedArray)?(this._promise=Promise.resolve(this),this._promise):(this._promise=async function(e){const t=e._resource;e._state=rS.LOADING;try{const n=await sS._fetchArrayBuffer(t);if(e.isDestroyed())return;return e._typedArray=new Uint8Array(n),e._state=rS.READY,e}catch(n){if(e.isDestroyed())return;e._state=rS.FAILED;const i=`Failed to load external buffer: ${t.url}`;throw e.getError(i,n)}}(this),this._promise)},sS._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()},sS.prototype.unload=function(){this._typedArray=void 0},function(){var e,t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};function n(e){if(!e)throw new Error("Assertion failed")}function i(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function o(t,n,o,r,s){var a=e.exports.sbrk,c=a(n),l=a(r*s),u=new Uint8Array(e.exports.memory.buffer);u.set(i(o),l);var d=t(c,n,l,r,s),h=new Uint8Array(d);return h.set(u.subarray(c,c+d)),a(c-a(0)),h}function r(e){for(var t=0,n=0;n<e.length;++n){var i=e[n];0}return t}function s(e,t){if(n(2==t||4==t),4==t)return new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4);var i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);return new Uint32Array(i)}function a(t,n,o,r,s,a,c){var l=e.exports.sbrk,u=l(o*r),d=l(o*a),h=new Uint8Array(e.exports.memory.buffer);h.set(i(n),d),t(u,o,r,s,d,c);var p=new Uint8Array(o*r);return p.set(h.subarray(u,u+o*r)),l(u-l(0)),p}WebAssembly.instantiate(function(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var o=e.charCodeAt(i);n[i]=o>96?o-97:o>64?o-39:o+4}var r=0;for(i=0;i<e.length;++i)n[r++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,r)}("b9H79TebbbeJq9Geueu9Geub9Gbb9Gvuuuuueu9Gduueu9Gluuuueu9Gvuuuuub9Gouuuuuub9Gluuuub9GiuuueuiKLdilevlevlooroowwvwbDDbelve9Weiiviebeoweuec:W;kekr;RiOo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWVbe8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9c9V919U9KbdE9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949wWV79P9V9UbiY9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWVbl8E9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWV9c9V919U9Kbv8A9TW79O9V9Wt9FW9U9J9V9KW69U9KW949wWV79P9V9UboE9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JWbra9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JW9c9V919U9KbwL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9p9JtbDK9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9r919HtbqL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVT949WbkE9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OWbPa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OW9ttV9P9Wbsa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9WbzK9TW79O9V9Wt9F79W9Ht9P9H29t9VVt9sW9T9H9WbHl79IV9RbODwebcekdQXq:g9sLdbk;3keYu8Jjjjjbcjo9Rgv8Kjjjjbcbhodnalcefae0mbabcbRb:S:kjjbc:GeV86bbavcjdfcbcjdzNjjjb8AdnaiTmbavcjdfadalz:tjjjb8Akabaefhrabcefhwavalfcbcbcjdal9RalcFe0EzNjjjb8Aavavcjdfalz:tjjjbhDcj;abal9UhodndndndndnalTmbaoc;WFbGgecjdaecjd6Ehqcbhkdninakai9pmiaDcjlfcbcjdzNjjjb8Aaqaiak9Rakaqfai6Egxcsfgecl4cifcd4hmadakal2fhPdndndndndnaec9WGgsTmbcbhzcehHaPhOawhAxekdnaxTmbcbhAcehHaPhCinaDaAfRbbhXaDcjlfheaChoaxhQinaeaoRbbgLaX9RgXcetaX;acr4786bbaoalfhoaecefheaLhXaQcufgQmbkaraw9Ram6miawcbamzNjjjbgeTmiaCcefhCaeamfhwaAcefgAal6hHaAal9hmbxvkkaraw9Ram6mvawcbamzNjjjb8AceheinawgXamfhwalaegoSmldnaraw9Ram6mbaocefheawcbamzNjjjb8AaXmekkaoal6hHxekindnaxTmbaDazfRbbhXaDcjlfheaOhoaxhQinaeaoRbbgLaX9RgXcetaX;acr4786bbaoalfhoaecefheaLhXaQcufgQmbkkaraA9Ram6mearaAcbamzNjjjbgKamfgw9RcK6mdcbhYaDcjlfhAinaDcjlfaYfh8AcwhCczhLcehQindndnaQce9hmbcuhoa8ARbbmecbhodninaogecsSmeaecefhoaAaefcefRbbTmbkkcucbaecs6EhoxekaQcetc;:FFFeGhocuaQtcu7cFeGhXcbheinaoaXaAaefRbb9nfhoaecefgecz9hmbkkaoaLaoaL6geEhLaQaCaeEhCaQcetgQcw6mbkdndndndnaCcufPdiebkaKaYco4fgeaeRbbcdciaCclSEaYci4coGtV86bbaCcw9hmeawa8A8Pbb83bbawcwfa8Acwf8Pbb83bbawczfhwxdkaKaYco4fgeaeRbbceaYci4coGtV86bbkdncwaC9TgEmbinawcb86bbawcefhwxbkkcuaCtcu7h8Acbh3aAh5ina5heaEhQcbhoinaeRbbgLa8AcFeGgXaLaX6EaoaCtVhoaecefheaQcufgQmbkawao86bba5aEfh5awcefhwa3aEfg3cz6mbkcbheindnaAaefRbbgoaX6mbawao86bbawcefhwkaecefgecz9hmbkkdnaYczfgYas9pmbaAczfhAaraw9RcL0mekkaYas6meawTmeaOcefhOazcefgzal6hHawhAazalSmixbkkcbhwaHceGTmexikcbhwaHceGmdkaDaPaxcufal2falz:tjjjb8AaxakfhkawmbkcbhoxokcbhoxvkaiTmekcbhoaraw9Ralcaalca0E6mialc8F9nmexdkcbhoaecufca6mdkawcbcaal9RgezNjjjbaefhwkawaDcjdfalz:tjjjbalfab9Rhokavcjof8Kjjjjbaok9heeuaecaaeca0Eabcj;abae9Uc;WFbGgdcjdadcjd6Egdfcufad9Uae2adcl4cifcd4adV2fcefkmbcbabBd:S:kjjbk;rse3u8Jjjjjbc;ae9Rgl8Kjjjjbcbhvdnaici9UgocHfae0mbabcbyd:C:kjjbgrc;GeV86bbalc;abfcFecjezNjjjb8AalcUfgw9cu83ibalc8WfgD9cu83ibalcyfgq9cu83ibalcafgk9cu83ibalcKfgx9cu83ibalczfgm9cu83ibal9cu83iwal9cu83ibabaefc9WfhPabcefgsaofhednaiTmbcmcsarcb9kgzEhHcbhOcbhAcbhCcbhXcbhQindnaeaP9nmbcbhvxikaQcufhvadaCcdtfgoydbhLaocwfydbhKaoclfydbhYcbh8Adndninalc;abfavcsGcitfgoydlhEdndndnaoydbgoaL9hmbaEaYSmekdnaoaY9hmbaEaK9hmba8Acefh8AxekaoaK9hmeaEaL9hmea8Acdfh8Aka8Ac870mdaXcufhvada8AciGcx2goc:y1jjbfydbaCfcdtfydbhEadaocN1jjbfydbaCfcdtfydbhKadaoc:q1jjbfydbaCfcdtfydbhLcbhodnindnalavcsGcdtfydbaE9hmbaohYxdkcuhYavcufhvaocefgocz9hmbkkaEaOSgvaYce9iaYaH9oVgoGh3dndndndndncbcsavEaYaoEgvcs9hmbarce9imbaEaEaAaEcefaASgvEgAcefSmecmcsavEhvkasava8Acdtc;WeGV86bbavcs9hmeaEaA9Rgvcetavc8F917hvinaeavcFb0crtavcFbGV86bbaecefheavcje6hoavcr4hvaoTmbkaEhAxdkcPhvasa8AcdtcPV86bbaEhAkavTmbavaH9imekalaXcdtfaEBdbaXcefcsGhXkaOa3fhOalc;abfaQcitfgvaKBdlavaEBdbalc;abfaQcefcsGgvcitfgoaEBdlaoaLBdbavcefhoxikavcufhva8Aclfg8Ac;ab9hmbkkdnadceaKaOScetaYaOSEcx2gvc:q1jjbfydbaCfcdtfydbgLTadavcN1jjbfydbaCfcdtfydbg8AceSGadavc:y1jjbfydbaCfcdtfydbgYcdSGaOcb9hGazGg5ce9hmbaw9cu83ibaD9cu83ibaq9cu83ibak9cu83ibax9cu83ibam9cu83ibal9cu83iwal9cu83ibcbhOkcbhEaXcufgvhodnindnalaocsGcdtfydba8A9hmbaEhKxdkcuhKaocufhoaEcefgEcz9hmbkkcbhodnindnalavcsGcdtfydbaY9hmbaohExdkcuhEavcufhvaocefgocz9hmbkkaOaLaOSg8Efh3dndnaKcm0mbaKcefhKxekcbcsa8Aa3SgvEhKa3avfh3kdndnaEcm0mbaEcefhExekcbcsaYa3SgvEhEa3avfh3kc9:cua8EEh8FaEaKcltVhocbhvdndndninavcj1jjbfRbbaocFeGSmeavcefgvcz9hmbxdkka5aLaO9havcm0VVmbasavc;WeV86bbxekasa8F86bbaeao86bbaecefhekdna8EmbaLaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombkaLhAkdnaKcs9hmba8AaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombka8AhAkdnaEcs9hmbaYaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombkaYhAkalaXcdtfaLBdbaXcefcsGhvdndnaKPzbeeeeeeeeeeeeeebekalavcdtfa8ABdbaXcdfcsGhvkdndnaEPzbeeeeeeeeeeeeeebekalavcdtfaYBdbavcefcsGhvkalc;abfaQcitfgoaLBdlaoa8ABdbalc;abfaQcefcsGcitfgoa8ABdlaoaYBdbalc;abfaQcdfcsGcitfgoaYBdlaoaLBdbaQcifhoavhXa3hOkascefhsaocsGhQaCcifgCai6mbkkcbhvaeaP0mbcbhvinaeavfavcj1jjbfRbb86bbavcefgvcz9hmbkaeab9Ravfhvkalc;aef8KjjjjbavkZeeucbhddninadcefgdc8F0meceadtae6mbkkadcrfcFeGcr9Uci2cdfabci9U2cHfkmbcbabBd:C:kjjbk:ydewu8Jjjjjbcz9Rhlcbhvdnaicvfae0mbcbhvabcbRb:C:kjjbc;qeV86bbal9cb83iwabcefhoabaefc98fhrdnaiTmbcbhwcbhDindnaoar6mbcbskadaDcdtfydbgqalcwfawaqav9Rgvavc8F91gv7av9Rc507gwcdtfgkydb9Rgvc8E91c9:Gavcdt7awVhvinaoavcFb0gecrtavcFbGV86bbavcr4hvaocefhoaembkakaqBdbaqhvaDcefgDai9hmbkkcbhvaoar0mbaocbBbbaoab9RclfhvkavkBeeucbhddninadcefgdc8F0meceadtae6mbkkadcwfcFeGcr9Uab2cvfk:dvli99dui99ludnaeTmbcuadcetcuftcu7:Yhvdndncuaicuftcu7:YgoJbbbZMgr:lJbbb9p9DTmbar:Ohwxekcjjjj94hwkcbhicbhDinalclfIdbgrJbbbbJbbjZalIdbgq:lar:lMalcwfIdbgk:lMgr:varJbbbb9BEgrNhxaqarNhralcxfIdbhqdndnakJbbbb9GTmbaxhkxekJbbjZar:l:tgkak:maxJbbbb9GEhkJbbjZax:l:tgxax:marJbbbb9GEhrkdndnaqJbbj:;aqJbbj:;9GEgxJbbjZaxJbbjZ9FEavNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohmxekcjjjj94hmkdndnakJbbj:;akJbbj:;9GEgqJbbjZaqJbbjZ9FEaoNJbbbZJbbb:;akJbbbb9GEMgq:lJbbb9p9DTmbaq:OhPxekcjjjj94hPkdndnarJbbj:;arJbbj:;9GEgqJbbjZaqJbbjZ9FEaoNJbbbZJbbb:;arJbbbb9GEMgr:lJbbb9p9DTmbar:Ohsxekcjjjj94hskdndnadcl9hmbabaifgzas86bbazcifam86bbazcdfaw86bbazcefaP86bbxekabaDfgzas87ebazcofam87ebazclfaw87ebazcdfaP87ebkalczfhlaiclfhiaDcwfhDaecufgembkkk;klld99eud99eudnaeTmbdndncuaicuftcu7:YgvJbbbZMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikaic;8FiGhrinabcofcicdalclfIdb:lalIdb:l9EgialcwfIdb:lalaicdtfIdb:l9EEgialcxfIdb:lalaicdtfIdb:l9EEgiarV87ebdndnalaicefciGcdtfIdbJ;Zl:1ZNJbbj:;JbbjZalaicdtfIdbJbbbb9DEgoNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabaq87ebdndnaoalaicdfciGcdtfIdbJ;Zl:1ZNNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabcdfaq87ebdndnaoalaicufciGcdtfIdbJ;Zl:1ZNNgoJbbj:;aoJbbj:;9GEgwJbbjZawJbbjZ9FEavNJbbbZJbbb:;aoJbbbb9GEMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikabclfai87ebabcwfhbalczfhlaecufgembkkk:Hvdxue998Jjjjjbcjd9Rgo8Kjjjjbadcd4hrdndndndnavcd9hmbadcl6mearcearce0EhwaohDinaDc:CuBdbaDclfhDawcufgwmbkaeTmiadcl6mdarcearce0EhqarcdthkalhxcbhminaohDaxhwaqhPinaDaDydbgsawydbgzcL4cFeGc:cufcbazEgzasaz9kEBdbawclfhwaDclfhDaPcufgPmbkaxakfhxamcefgmae9hmbkkaeTmdxekaeTmekavcb9hadcl6gqVhHarcearce0Ehkarcdthrceai9Rhmcbhdindndndnavce9hmbaqmdc:CuhwalhDakhPinawaDydbgscL4cFeGc:cufcbasEgsawas9kEhwaDclfhDaPcufgPmbxdkkc:CuhwaHmbaohDalhPakhsinaDaPydbgzcL4cFeGgxc8Aaxc8A9kEc:cufcbazEBdbaPclfhPaDclfhDascufgsmbkkaqmbcbhDakhsinawhPdnavceSmbaoaDfydbhPkdndnalaDfIdbgOcjjj;8iamaPfgPcLt9R::NJbbbZJbbb:;aOJbbbb9GEMgO:lJbbb9p9DTmbaO:Ohzxekcjjjj94hzkabaDfazcFFFrGaPcKtVBdbaDclfhDascufgsmbkkabarfhbalarfhladcefgdae9hmbkkaocjdf8KjjjjbkFkdCui998Jjjjjbc:Gd9Rgv8Kjjjjbavc:4efcbc;KbzNjjjb8AcbhodnadTmbcbhoaiTmbdnabae9hmbavcuadcdtgoadcFFFFi0Ecbyd:K:kjjbHjjjjbbgeBd:4eavceBd:ydaeabaoz:tjjjb8Akavc:OefcwfcbBdbav9cb83i:Oeavc:Oefaeadaiavc:4efz:njjjbcuaicdtgraicFFFFi0Egwcbyd:K:kjjbHjjjjbbhoavc:4efavyd:ydgDcdtfaoBdbavaDcefgqBd:ydaoavyd:Oegkarz:tjjjbhxavc:4efaqcdtfadci9Ugmcbyd:K:kjjbHjjjjbbgoBdbavaDcdfgrBd:ydaocbamzNjjjbhPavc:4efarcdtfawcbyd:K:kjjbHjjjjbbgsBdbavaDcifgqBd:ydaxhoashrinaralIdbalaoydbgwcwawcw6Ecdtfc;ebfIdbMUdbaoclfhoarclfhraicufgimbkavc:4efaqcdtfcuamcdtadcFFFF970Ecbyd:K:kjjbHjjjjbbgqBdbavaDclfBd:yddnadci6mbamceamce0EhiaehoaqhrinarasaoydbcdtfIdbasaoclfydbcdtfIdbMasaocwfydbcdtfIdbMUdbaocxfhoarclfhraicufgimbkkavc;qbfhzavhoavyd:SehHavyd:WehOcbhwcbhrcbhAcehCinaohXcihQaearci2gLcdtfgocwfydbhdaoydbhDabaAcx2fgiclfaoclfydbgKBdbaiaDBdbaicwfadBdbaParfce86bbazadBdwazaKBdlazaDBdbaqarcdtfcbBdbdnawTmbcihQaXhiinazaQcdtfaiydbgoBdbaQaoaD9haoaK9hGaoad9hGfhQaiclfhiawcufgwmbkkaAcefhAaxaDcdtfgoaoydbcufBdbaxaKcdtfgoaoydbcufBdbaxadcdtfgoaoydbcufBdbcbhwinaOaHaeawaLfcdtfydbcdtgifydbcdtfgKhoakaifgDydbgdhidnadTmbdninaoydbarSmeaoclfhoaicufgiTmdxbkkaoadcdtaKfc98fydbBdbaDaDydbcufBdbkawcefgwci9hmbkdndndnaQTmbcuhrJbbbbhYcbhDavyd:SehKavyd:WehLindndnakazaDcdtfydbcdtgofydbgimbaDcefhDxekaDcs0hwasaofgdIdbh8AadalcbaDcefgDawEcdtfIdbalaxaofydbgwcwawcw6Ecdtfc;ebfIdbMgEUdbaEa8A:thEaicdthiaLaKaofydbcdtfhoinaqaoydbgwcdtfgdaEadIdbMg8AUdba8AaYaYa8A9DgdEhYawaradEhraoclfhoaic98fgimbkkaDaQ9hmbkarcu9hmekaCam9pmeindnaPaCfRbbmbaChrxdkamaCcefgC9hmbxdkkaQczaQcz6EhwazhoaXhzarcu9hmekkavyd:ydhokaocdtavc:4effc98fhrdninaoTmearydbcbyd:G:kjjbH:bjjjbbarc98fhraocufhoxbkkavc:Gdf8Kjjjjbk;UlevucuaicdtgvaicFFFFi0Egocbyd:K:kjjbHjjjjbbhralalyd9GgwcdtfarBdbalawcefBd9GabarBdbaocbyd:K:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdlcuadcdtadcFFFFi0Ecbyd:K:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdwabydbcbavzNjjjb8Aadci9UhwdnadTmbabydbhoaehladhrinaoalydbcdtfgvavydbcefBdbalclfhlarcufgrmbkkdnaiTmbabydbhlabydlhrcbhvaihoinaravBdbarclfhralydbavfhvalclfhlaocufgombkkdnadci6mbawceawce0EhDabydlhrabydwhvcbhlinaecwfydbhoaeclfydbhdaraeydbcdtfgwawydbgwcefBdbavawcdtfalBdbaradcdtfgdadydbgdcefBdbavadcdtfalBdbaraocdtfgoaoydbgocefBdbavaocdtfalBdbaecxfheaDalcefgl9hmbkkdnaiTmbabydlheabydbhlinaeaeydbalydb9RBdbalclfhlaeclfheaicufgimbkkkQbabaeadaic:01jjbz:mjjjbkQbabaeadaic:C:jjjbz:mjjjbk9DeeuabcFeaicdtzNjjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk;:kivuo99lu8Jjjjjbcj;Hb9Rgl8Kjjjjbcbhvalc1;Gbfcbc;KbzNjjjb8AalcuadcdtadcFFFFi0Egocbyd:K:kjjbHjjjjbbgrBd19GalceBd;O9Galcwfcbyd:m:kjjbBdbalcb8Pd:e:kjjb83ibalc;W;Gbfcwfcbyd:y:kjjbBdbalcb8Pd:q:kjjb83i;W9Gaicd4hwdndnadmbJFFuFhDJFFuuhqJFFuuhkJFFuFhxJFFuuhmJFFuFhPxekawcdthsaehzincbhiinalaifgHazaifIdbgDaHIdbgxaxaD9EEUdbalc;W;GbfaifgHaDaHIdbgxaxaD9DEUdbaiclfgicx9hmbkazasfhzavcefgvad9hmbkalIdwhqalId;49GhDalIdlhkalId;09GhxalIdbhmalId;W9GhPkdndnadTmbJbbbbJbbjZaPam:tJbbbb:xgPaxak:tgxaxaP9DEgxaDaq:tgDaDax9DEgD:vaDJbbbb9BEhDawcdthsarhHadhzindndnaDaeIdbam:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcv2c;j:KM;jbGhvdndnaDaeclfIdbak:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcq2cM;j:KMeGavVhvdndnaDaecwfIdbaq:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaHavaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcC2c:KM;j:KdGVBdbaeasfheaHclfhHazcufgzmbkalcbcj;GbzNjjjbhiarhHadheinaiaHydbgzcFrGcx2fgvavydbcefBdbaiazcq4cFrGcx2fgvavydlcefBdlaiazcC4cFrGcx2fgzazydwcefBdwaHclfhHaecufgembxdkkalcbcj;GbzNjjjb8AkcbhHcbhzcbhecbhvinalaHfgiydbhsaiazBdbaicwfgwydbhOawavBdbaiclfgiydbhwaiaeBdbasazfhzaOavfhvawaefheaHcxfgHcj;Gb9hmbkcbhialaocbyd:K:kjjbHjjjjbbgzBd:m9GdnadTmbabhHinaHaiBdbaHclfhHadaicefgi9hmbkadTmbabhiadhHinalaraiydbgecdtfydbcFrGcx2fgvavydbgvcefBdbazavcdtfaeBdbaiclfhiaHcufgHmbkazhiadhHinalaraiydbgecdtfydbcq4cFrGcx2fgvavydlgvcefBdlabavcdtfaeBdbaiclfhiaHcufgHmbkabhiadhHinalaraiydbgecdtfydbcC4cFrGcx2fgvavydwgvcefBdwazavcdtfaeBdbaiclfhiaHcufgHmbkadTmbcbhiinabazydbcdtfaiBdbazclfhzadaicefgi9hmbkkclhidninaic98Smealc1;Gbfaifydbcbyd:G:kjjbH:bjjjbbaic98fhixbkkalcj;Hbf8Kjjjjbk9teiucbcbyd:O:kjjbgeabcifc98GfgbBd:O:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:O:kjjbgeabcrfc94GfgbBd:O:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:O:kjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:O:kjjbfgdBd:O:kjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akkk:6ddbcjwk:Cdb4:h9w9N94:P:gW:j9O:ye9Pbbbbbbebbbdbbbebbbdbbbbbbbdbbbbbbbebbbbbbb:l29hZ;69:9kZ;N;76Z;rg97Z;z;o9xZ8J;B85Z;:;u9yZ;b;k9HZ:2;Z9DZ9e:l9mZ59A8KZ:r;T3Z:A:zYZ79OHZ;j4::8::Y:D9V8:bbbb9s:49:Z8R:hBZ9M9M;M8:L;z;o8:;8:PG89q;x:J878R:hQ8::M:B;e87bbbbbbjZbbjZbbjZ:E;V;N8::Y:DsZ9i;H;68:xd;R8:;h0838:;W:NoZbbbb:WV9O8:uf888:9i;H;68:9c9G;L89;n;m9m89;D8Ko8:bbbbf:8tZ9m836ZS:2AZL;zPZZ818EZ9e:lxZ;U98F8:819E;68:FFuuFFuuFFuuFFuFFFuFFFuFbc:Cqkzebbbebbbdbbb8WWbb"),{}).then((function(t){(e=t.instance).exports.__wasm_call_ctors(),e.exports.meshopt_encodeVertexVersion(0),e.exports.meshopt_encodeIndexVersion(1)}))}();var aS=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n,i=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;b9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;e8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincbhHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAcd0hHalhOaAcefgAclSmdxekkcbhlaHceGTmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;d8Yqdbk:yzeHu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlcbhOinalgic9WfgAawcj;cbffhldndndndndnaHaAco4fRbbaOcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgAco4gCaCciSgCE86bbawcj;cbfaifglcGfaoclfaCfgCRbbaAcl4ciGgXaXciSgXE86bbalcVfaCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc7faCaXfgCRbbaAciGgAaAciSgAE86bbalctfaCaAfgCRbbaoRbegAco4gXaXciSgXE86bbalc91faCaXfgCRbbaAcl4ciGgXaXciSgXE86bbalc4faCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc93faCaXfgCRbbaAciGgAaAciSgAE86bbalc94faCaAfgCRbbaoRbdgAco4gXaXciSgXE86bbalc95faCaXfgCRbbaAcl4ciGgXaXciSgXE86bbalc96faCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc97faCaXfgCRbbaAciGgAaAciSgAE86bbalc98faCaAfgARbbaoRbigoco4gCaCciSgCE86bbalc99faAaCfgARbbaocl4ciGgCaCciSgCE86bbalc9:faAaCfgARbbaocd4ciGgCaCciSgCE86bbalcufaAaCfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgAcl4gCaCcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgCRbbaAcsGgAaAcsSgAE86bbalcVfaCaAfgARbbaoRbegCcl4gXaXcsSgXE86bbalc7faAaXfgARbbaCcsGgCaCcsSgCE86bbalctfaAaCfgARbbaoRbdgCcl4gXaXcsSgXE86bbalc91faAaXfgARbbaCcsGgCaCcsSgCE86bbalc4faAaCfgARbbaoRbigCcl4gXaXcsSgXE86bbalc93faAaXfgARbbaCcsGgCaCcsSgCE86bbalc94faAaCfgARbbaoRblgCcl4gXaXcsSgXE86bbalc95faAaXfgARbbaCcsGgCaCcsSgCE86bbalc96faAaCfgARbbaoRbvgCcl4gXaXcsSgXE86bbalc97faAaXfgARbbaCcsGgCaCcsSgCE86bbalc98faAaCfgARbbaoRbogCcl4gXaXcsSgXE86bbalc99faAaXfgARbbaCcsGgCaCcsSgCE86bbalc9:faAaCfgARbbaoRbrgocl4gCaCcsSgCE86bbalcufaAaCfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaOcdfhOaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhAinaialRbbgHce4cbaHceG9R7aOfgO86bbaiadfhialcefhlaAcufgAmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhXdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhAinaialRbbgHce4cbaHceG9R7aOfgO86bbaiadfhialcefhlaAcufgAmbkaCcefhCamcefgmad6hsamad9hmbkaXhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaXhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabaiavcdfciGfcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabaiavcufciGfcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabaiavciGfcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",o=WebAssembly.instantiate(r(i),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));function r(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var o=e.charCodeAt(i);n[i]=o>96?o-97:o>64?o-39:o+4}var r=0;for(i=0;i<e.length;++i)n[r++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,r)}function s(e,t,n,i,o,r,s){var a=e.exports.sbrk,c=i+3&-4,l=a(c*o),u=a(r.length),d=new Uint8Array(e.exports.memory.buffer);d.set(r,u);var h=t(l,i,o,u,r.length);if(0==h&&s&&s(l,c,o),n.set(d.subarray(l,l+i*o)),a(l-a(0)),0!=h)throw new Error("Malformed buffer data: "+h)}var a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],u=0;function d(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function h(e){var t=e.data;if(!t.id)return self.close();self.ready.then((function(e){try{var n=new Uint8Array(t.count*t.size);s(e,e.exports[t.mode],n,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(i){self.postMessage({id:t.id,count:t.count,action:"reject",value:i})}}))}return{ready:o,supported:!0,useWorkers:function(e){!function(e){for(var t="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(r(i))+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+h.name+";"+s.toString()+h.toString(),n=new Blob([t],{type:"text/javascript"}),o=URL.createObjectURL(n),a=l.length;a<e;++a)l[a]=d(o);for(a=e;a<l.length;++a)l[a].object.postMessage({});l.length=e,URL.revokeObjectURL(o)}(e)},decodeVertexBuffer:function(e,t,i,o,r){s(n,n.exports.meshopt_decodeVertexBuffer,e,t,i,o,n.exports[a[r]])},decodeIndexBuffer:function(e,t,i,o){s(n,n.exports.meshopt_decodeIndexBuffer,e,t,i,o)},decodeIndexSequence:function(e,t,i,o){s(n,n.exports.meshopt_decodeIndexSequence,e,t,i,o)},decodeGltfBuffer:function(e,t,i,o,r,l){s(n,n.exports[c[r]],e,t,i,o,n.exports[a[l]])},decodeGltfBufferAsync:function(e,t,i,r,d){return l.length>0?function(e,t,n,i,o){for(var r=l[0],s=1;s<l.length;++s)l[s].pending<r.pending&&(r=l[s]);return new Promise((function(s,a){var c=new Uint8Array(n),l=++u;r.pending+=e,r.requests[l]={resolve:s,reject:a},r.object.postMessage({id:l,count:e,size:t,source:c,mode:i,filter:o},[c.buffer])}))}(e,t,i,c[r],a[d]):o.then((function(){var o=new Uint8Array(e*t);return s(n,n.exports[c[r]],o,e,t,i,n.exports[a[d]]),o}))}}}();function cS(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltf",n),L.typeOf.number("options.bufferViewId",i),L.typeOf.object("options.gltfResource",o),L.typeOf.object("options.baseResource",r);const a=n.bufferViews[i];let c,l,u,d,h=a.buffer,p=a.byteOffset,f=a.byteLength,m=!1;if(Px(a,"EXT_meshopt_compression")){const e=a.extensions.EXT_meshopt_compression;h=e.buffer,p=M(e.byteOffset,0),f=e.byteLength,m=!0,c=e.byteStride,l=e.count,u=e.mode,d=M(e.filter,"NONE")}const _=n.buffers[h];this._hasMeshopt=m,this._meshoptByteStride=c,this._meshoptCount=l,this._meshoptMode=u,this._meshoptFilter=d,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=_,this._bufferId=h,this._byteOffset=p,this._byteLength=f,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=rS.UNLOADED,this._promise=void 0}async function lS(e){try{const t=function(e){const t=e._resourceCache,n=e._buffer;if(D(n.uri)){const i=e._baseResource.getDerivedResource({url:n.uri});return t.getExternalBufferLoader({resource:i})}return t.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:e._bufferId})}(e);if(e._bufferLoader=t,await t.load(),e.isDestroyed())return;const n=t.typedArray,i=new Uint8Array(n.buffer,n.byteOffset+e._byteOffset,e._byteLength);if(e.unload(),e._typedArray=i,e._hasMeshopt){const t=e._meshoptCount,n=e._meshoptByteStride,i=new Uint8Array(t*n);aS.decodeGltfBuffer(i,t,n,e._typedArray,e._meshoptMode,e._meshoptFilter),e._typedArray=i}return e._state=rS.READY,e}catch(t){if(e.isDestroyed())return;e.unload(),e._state=rS.FAILED;const n="Failed to load buffer view";throw e.getError(n,t)}}function uS(){}function dS(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.draco,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltf",n),L.typeOf.object("options.draco",i),L.typeOf.object("options.gltfResource",o),L.typeOf.object("options.baseResource",r),this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._draco=i,this._cacheKey=s,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=rS.UNLOADED,this._promise=void 0,this._dracoError=void 0}function hS(e,t){e.unload(),e._state=rS.FAILED;throw e.getError("Failed to load Draco",t)}function pS(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltf",n),L.typeOf.number("options.imageId",i),L.typeOf.object("options.gltfResource",o),L.typeOf.object("options.baseResource",r);const a=n.images[i],c=a.bufferView,l=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=c,this._uri=l,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=rS.UNLOADED,this._promise=void 0}function fS(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map((function(e){return e.bufferView})),e=e[0]),{image:e,mipLevels:t}}function mS(e,t,n){return e.unload(),e._state=rS.FAILED,Promise.reject(e.getError(n,t))}!function(){var e,t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n=WebAssembly.instantiate(function(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var o=e.charCodeAt(i);n[i]=o>96?o-97:o>64?o-39:o+4}var r=0;for(i=0;i<e.length;++i)n[r++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,r)}("b9H79Tebbbe9Ek9Geueu9Geub9Gbb9GPuuuuuuuuuuu99uueu9Gvuuuuub9Gluuuub9Gquuuuuuu99uueu9Gwuuuuuu99ueu9Giuuue999Gluuuueu9GiuuueuizsdilvoirwDbqqbeqlve9Weiiviebeoweuec:G;jekr:Tewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bbz9TW79O9V9Wt9F79P9T9W29P9M95bl8E9TW79O9V9Wt9F79P9T9W29P9M959x9Pt9OcttV9P9I91tW7bvQ9TW79O9V9Wt9F79P9T9W29P9M959q9V9P9Ut7boX9TW79O9V9Wt9F79P9T9W29P9M959t9J9H2Wbra9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9Wbwl79IV9RbDDwebcekdxmq::9Usdbk;i6iKuY99Ou8Jjjjjbc;W;ab9RgP8KjjjjbaPcwfcbc;Kbz:ljjjb8AaPcualcefgscdtascFFFFi0Ecbyd1:jjjbHjjjjbbgzBdwaPceBd9OaPazBdbaPcuadcitadcFFFFe0Ecbyd1:jjjbHjjjjbbgHBdxaPcdBd9OaPaHBdlaPaeadalcbz:cjjjbaPcualcdtgOalcFFFFi0EgAcbyd1:jjjbHjjjjbbgCBdzaPciBd9OaPaAcbyd1:jjjbHjjjjbbgXBdCaPclBd9Oalcd4alfhQcehLinaLgscethLasaQ6mbkcbhKaPcuascdtgLascFFFFi0Ecbyd1:jjjbHjjjjbbgQBdKaPcvBd9OaQcFeaLz:ljjjbhYdnalTmbavcd4h8AascufhEinaiaKa8A2cdtfg3ydlgscH4as7c:F:b:DD2a3ydbgscH4as7c;D;O:B8J27a3ydwgscH4as7c:3F;N8N27hQcbhsdndninaYaQaEGgQcdtfg5ydbgLcuSmeaiaLa8A2cdtfa3cxz:ojjjbTmdascefgsaQfhQasaE9nmbxdkka5aKBdbaKhLkaCaKcdtfaLBdbaKcefgKal9hmbkcbhsaXhLinaLasBdbaLclfhLalascefgs9hmbkcbhsaChLaXhQindnasaLydbgESmbaQaXaEcdtfgEydbBdbaEasBdbkaLclfhLaQclfhQalascefgs9hmbkkcbh8EaYcbyd:m:jjjbH:bjjjbbaPclBd9OaPalcbyd1:jjjbHjjjjbbgEBdKaPcvBd9OaPaAcbyd1:jjjbHjjjjbbgsBd3aPcoBd9OaPaAcbyd1:jjjbHjjjjbbgLBdaaPcrBd9OascFeaOz:ljjjbh8FaLcFeaOz:ljjjbhadnalTmbaHcwfhhindnaza8EgQcefg8Ecdtfydbg3azaQcdtgsfydbgLSmba3aL9RhOaHaLcitfhgaaasfh8Ja8FasfhKcbh8Aindndnaga8Acitfydbg5aQ9hmbaKaQBdba8JaQBdbxekdnaza5cdtg8KfgsclfydbgLasydbgsSmbaHascitg3fydbaQSmeaLas9Rh8Lascu7aLfhYaha3fhLcbhsinaYasSmeascefhsaLydbh3aLcwfhLa3aQ9hmbkasa8L6mekaaa8KfgsaQa5asydbcuSEBdbaKa5aQaKydbcuSEBdbka8Acefg8AaO9hmbkka8Eal9hmbkaChLaXhQaah3a8Fh8AcbhsindndnasaLydbg59hmbdnasaQydbg59hmba8Aydbh5dna3ydbgYcu9hmba5cu9hmbaEasfcb86bbxikaEasfhKdnasaYSmbasa5SmbaKce86bbxikaKcl86bbxdkdnasaXa5cdtgYfydb9hmbdna3ydbgKcuSmbasaKSmba8AydbgOcuSmbasaOSmbaaaYfydbggcuSmbaga5Smba8FaYfydbgYcuSmbaYa5SmbdnaCaKcdtfydbaCaYcdtfydb9hmbaCaOcdtfydbaCagcdtfydb9hmbaEasfcd86bbxlkaEasfcl86bbxikaEasfcl86bbxdkaEasfcl86bbxekaEasfaEa5fRbb86bbkaLclfhLaQclfhQa3clfh3a8Aclfh8Aalascefgs9hmbkaxceGTmbaEhsalhLindnasRbbce9hmbascl86bbkascefhsaLcufgLmbkkcualcx2alc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbh8JaPcwfaPyd9Ogscdtfa8JBdbaPascefgOBd9Oa8Jaialavz:djjjbdndnaDmbcbhvxekcbh5aPcwfaOcdtfcuaDal2gLcdtaLcFFFFi0Ecbyd1:jjjbHjjjjbbgvBdbaPascdfgOBd9OalTmbarcd4cdthYaDcdthKavh8AinaohsawhLa8AhQaDh3inaQasIdbaLIdbNUdbasclfhsaLclfhLaQclfhQa3cufg3mbkaoaYfhoa8AaKfh8Aa5cefg5al9hmbkkaPcwfaOcdtfcualc8S2gsalc;D;O;f8U0EgQcbyd1:jjjbHjjjjbbgLBdbaPaOcefg3Bd9OaLcbasz:ljjjbh8EdndndnaDTmbaPcwfa3cdtfaQcbyd1:jjjbHjjjjbbgoBdbaPaOcdfgLBd9Oaocbasz:ljjjb8AaPcwfaLcdtfcuaDal2gscltgLascFFFFb0Ecbyd1:jjjbHjjjjbbgwBdbaPaOcifBd9OawcbaLz:ljjjb8AadmexdkcbhocbhwadTmekcbh8AaehLindna8JaLclfydbg5cx2fgsIdba8JaLydbgYcx2fgQIdbg8M:tg8Na8JaLcwfydbgKcx2fg3IdlaQIdlgy:tg8PNa3Idba8M:tgIasIdlay:tg8RN:tg8Sa8SNa8Ra3IdwaQIdwgR:tg8UNa8PasIdwaR:tg8RN:tg8Pa8PNa8RaINa8Ua8NN:tg8Na8NNMM:rgIJbbbb9ETmba8SaI:vh8Sa8NaI:vh8Na8PaI:vh8Pka8EaCaYcdtfydbc8S2fgsa8PaI:rgIa8PNNg8RasIdbMUdbasa8NaIa8NNg8VNg8UasIdlMUdlasa8SaIa8SNg8WNg8XasIdwMUdwasa8Va8PNg8VasIdxMUdxasa8Wa8PNg8YasIdzMUdzasa8Wa8NNg8WasIdCMUdCasa8PaIa8SaRNa8Pa8MNaya8NNMM:mgyNg8MNg8PasIdKMUdKasa8Na8MNg8NasId3MUd3asa8Sa8MNg8SasIdaMUdaasa8MayNg8MasId8KMUd8KasaIasIdyMUdya8EaCa5cdtfydbc8S2fgsa8RasIdbMUdbasa8UasIdlMUdlasa8XasIdwMUdwasa8VasIdxMUdxasa8YasIdzMUdzasa8WasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asa8SasIdaMUdaasa8MasId8KMUd8KasaIasIdyMUdya8EaCaKcdtfydbc8S2fgsa8RasIdbMUdbasa8UasIdlMUdlasa8XasIdwMUdwasa8VasIdxMUdxasa8YasIdzMUdzasa8WasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asa8SasIdaMUdaasa8MasId8KMUd8KasaIasIdyMUdyaLcxfhLa8Acifg8Aad6mbkcbh5aehYincbhLinaEaeaLc:G1jjbfydba5fcdtfydbgQfRbbhsdndnaEaYaLfydbg3fRbbg8Ac99fcFeGcpe0mbasceSmbascd9hmekdna8AcufcFeGce0mba8Fa3cdtfydbaQ9hmekdnascufcFeGce0mbaaaQcdtfydba39hmekdna8Acv2asfc:W1jjbfRbbTmbaCaQcdtfydbaCa3cdtfydb0mekJbbacJbbjZasceSEhIa8AceShOa8JaeaLc:K1jjbfydba5fcdtfydbcx2fhsdna8JaQcx2fg8AIdwa8Ja3cx2fgKIdwgy:tg8Pa8PNa8AIdbaKIdbgR:tg8Na8NNa8AIdlaKIdlg8R:tg8Sa8SNMM:rg8MJbbbb9ETmba8Pa8M:vh8Pa8Sa8M:vh8Sa8Na8M:vh8NkJbbacaIaOEh8WdnasIdway:tgIa8PaIa8PNasIdbaR:tg8Xa8NNa8SasIdla8R:tg8VNMMg8UN:tgIaINa8Xa8Na8UN:tg8Pa8PNa8Va8Sa8UN:tg8Na8NNMM:rg8SJbbbb9ETmbaIa8S:vhIa8Na8S:vh8Na8Pa8S:vh8Pka8EaCa3cdtfydbc8S2fgsa8Pa8Wa8MNg8Sa8PNNg8UasIdbMUdbasa8Na8Sa8NNg8WNg8XasIdlMUdlasaIa8SaINg8MNg8VasIdwMUdwasa8Wa8PNg8WasIdxMUdxasa8Ma8PNg8YasIdzMUdzasa8Ma8NNg8ZasIdCMUdCasa8Pa8SaIayNa8PaRNa8Ra8NNMM:mgyNg8MNg8PasIdKMUdKasa8Na8MNg8NasId3MUd3asaIa8MNgIasIdaMUdaasa8MayNg8MasId8KMUd8Kasa8SasIdyMUdya8EaCaQcdtfydbc8S2fgsa8UasIdbMUdbasa8XasIdlMUdlasa8VasIdwMUdwasa8WasIdxMUdxasa8YasIdzMUdzasa8ZasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asaIasIdaMUdaasa8MasId8KMUd8Kasa8SasIdyMUdykaLclfgLcx9hmbkaYcxfhYa5cifg5ad6mbkaDTmbcbhYinJbbbbhRa8JaeaYcdtfgsclfydbgKcx2fgLIdwa8JasydbgOcx2fgQIdwg8V:tg8Na8NNaLIdbaQIdbg8Y:tgIaINaLIdlaQIdlg8Z:tg8Sa8SNMMg8Wa8Jascwfydbggcx2fgsIdwa8V:tg8MNa8Na8Na8MNaIasIdba8Y:tgyNa8SasIdla8Z:tg8RNMMg8PN:tJbbbbJbbjZa8Wa8Ma8MNayayNa8Ra8RNMMg8XNa8Pa8PN:tg8U:va8UJbbbb9BEg8UNh80a8Xa8NNa8Ma8PN:ta8UNh81a8Wa8RNa8Sa8PN:ta8UNhBa8Xa8SNa8Ra8PN:ta8UNh83a8WayNaIa8PN:ta8UNhUa8XaINaya8PN:ta8UNh85aIa8RNaya8SN:tg8Pa8PNa8Sa8MNa8Ra8NN:tg8Pa8PNa8NayNa8MaIN:tg8Pa8PNMM:r:rh8PavaOaD2cdtfhLavagaD2cdtfhQavaKaD2cdtfh3a8V:mh86a8Z:mh87a8Y:mh88cbh8AaDh5Jbbbbh8RJbbbbh8UJbbbbh8WJbbbbh8XJbbbbh8VJbbbbh8YJbbbbh8ZJbbbbh89Jbbbbh8:inaPc;Wbfa8Afgscwfa8Pa81a3IdbaLIdbg8M:tg8SNa80aQIdba8M:tgyNMg8NNUdbasclfa8Pa83a8SNaBayNMgINUdbasa8Pa85a8SNaUayNMg8SNUdbascxfa8Pa86a8NNa87aINa8Ma88a8SNMMMg8MNUdba8Pa8NaINNa8XMh8Xa8Pa8Na8SNNa8VMh8Va8PaIa8SNNa8YMh8Ya8Pa8Ma8MNNaRMhRa8Pa8Na8MNNa8RMh8Ra8PaIa8MNNa8UMh8Ua8Pa8Sa8MNNa8WMh8Wa8Pa8Na8NNNa8ZMh8Za8PaIaINNa89Mh89a8Pa8Sa8SNNa8:Mh8:aLclfhLa3clfh3aQclfhQa8Aczfh8Aa5cufg5mbkaoaCaOcdtfydbgLc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyaoaCaKcdtfydbgKc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyaoaCagcdtfydbgOc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyawaLaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkawaKaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkawaOaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkaYcifgYad6mbkkdnabaeSmbabaeadcdtz:kjjjb8AkaPydbhZcbhsdnalTmbaZclfhsaZydbh3aEhLalh8AcbhQincbasydbg5a39RaLRbbcpeGEaQfhQaLcefhLasclfhsa5h3a8Acufg8AmbkaQce4hskcuadas9Rcifgrcx2arc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbh8LaPcwfaPyd9Ogscdtfa8LBdbaPascefgLBd9OaPcwfaLcdtfcuarcdtarcFFFFi0Ecbyd1:jjjbHjjjjbbgxBdbaPascdfgLBd9OaPcwfaLcdtfaAcbyd1:jjjbHjjjjbbgHBdbaPascifgLBd9OaPcwfaLcdtfalcbyd1:jjjbHjjjjbbgnBdbaPasclfBd9OJbbbbh8Ydnadaq9nmbdnarci6mbakakNh8VaDclthca8Lcwfh9cJbbbbh8YinaPabadghalaCz:cjjjbabhOcbhzcbhKincbhsindnaCaOasfydbgQcdtgYfydbg8AaCabasc;m1jjbfydbaKfcdtfydbgLcdtfydbg5SmbaEaLfRbbgecv2aEaQfRbbg3fc;G1jjbfRbbg8Ka3cv2aefggc;G1jjbfRbbgiVcFeGTmbdnagc:W1jjbfRbbTmba5a8A0mekdna3ae9hmba3cufcFeGce0mba8FaYfydbaL9hmeka8Lazcx2fg3aLaQaicFeGg8AEBdla3aQaLa8AEBdba3a8Aa8KGcb9hBdwazcefhzkasclfgscx9hmbkdnaKcifgKah9pmbaOcxfhOazcifar9nmekkdnazmbahhdxikcbheinJbbbbJbbjZa8EaCa8Laecx2fg3ydlg8Aa3ydbg5a3ydwgLEgKcdtfydbg8Kc8S2gifgsIdyg8P:va8PJbbbb9BEasIdwa8Ja5a8AaLEgYcx2fgLIdwg8SNasIdzaLIdbg8MNasIdaMg8Pa8PMMa8SNasIdlaLIdlgyNasIdCa8SNasId3Mg8Pa8PMMayNasIdba8MNasIdxayNasIdKMg8Pa8PMMa8MNasId8KMMM:lNh8WJbbbbJbbjZa8EaCa5cdtfydbgdc8S2gQfgsIdyg8P:va8PJbbbb9BEasIdwa8Ja8Acx2fgLIdwgINasIdzaLIdbgRNasIdaMg8Pa8PMMaINasIdlaLIdlg8RNasIdCaINasId3Mg8Pa8PMMa8RNasIdbaRNasIdxa8RNasIdKMg8Pa8PMMaRNasId8KMMM:lNh8Xa3cwfhOa3clfhgdnaDTmbaoaQfgQIdwaINaQIdzaRNaQIdaMg8Pa8PMMaINaQIdla8RNaQIdCaINaQId3Mg8Pa8PMMa8RNaQIdbaRNaQIdxa8RNaQIdKMg8Pa8PMMaRNaQId8KMMMh8Nava8AaD2cdtfhLawadaD2cltfhsaQIdyh8UaDhQinaLIdbg8PJbbb;aNascxfIdbaIascwfIdbNaRasIdbNa8RasclfIdbNMMMNa8Pa8PNa8UNa8NMMh8NaLclfhLasczfhsaQcufgQmbkaoaifgQIdwa8SNaQIdza8MNaQIdaMg8Pa8PMMa8SNaQIdlayNaQIdCa8SNaQId3Mg8Pa8PMMayNaQIdba8MNaQIdxayNaQIdKMg8Pa8PMMa8MNaQId8KMMMhIavaYaD2cdtfhLawa8KaD2cltfhsaQIdyhRaDhQinaLIdbg8PJbbb;aNascxfIdba8SascwfIdbNa8MasIdbNayasclfIdbNMMMNa8Pa8PNaRNaIMMhIaLclfhLasczfhsaQcufgQmbka8WaI:lMh8Wa8Xa8N:lMh8Xkaga8AaYa8Xa8W9FgsEBdba3a5aKasEBdbaOa8Xa8WasEUdbaecefgeaz9hmbkaPc;Wbfcbcj;abz:ljjjb8Aa9chsazhLinaPc;WbfasydbcO4c;8ZGfgQaQydbcefBdbascxfhsaLcufgLmbkcbhscbhLinaPc;WbfasfgQydbh3aQaLBdba3aLfhLasclfgscj;ab9hmbkcbhsa9chLinaPc;WbfaLydbcO4c;8ZGfgQaQydbgQcefBdbaxaQcdtfasBdbaLcxfhLazascefgs9hmbkahaq9RgQci9UhJdnalTmbcbhsaHhLinaLasBdbaLclfhLalascefgs9hmbkkcbh9eancbalz:ljjjbhTaQcO9UhSaJce4h9haPydlh9icbhicbhgdnina8Laxagcdtfydbcx2fgOIdwg8Na8V9EmeaiaJ9pmeJFFuuh8Pdna9haz9pmba8Laxa9hcdtfydbcx2fIdwJbb;aZNh8Pkdna8Na8P9ETmbaiaS0mdkdnaTaCaOydlg6cdtg9kfydbg3fg0RbbaTaCaOydbgKcdtg9mfydbg9nfg9oRbbVmbdnaZa9ncdtfgsclfydbgLasydbgsSmbaLas9Rh5a9iascitfhsa8Ja3cx2fgYcwfhdaYclfhAa8Ja9ncx2fg8Kcwfh9pa8Kclfh9qcbhLcehednindnaHasydbcdtfydbgQa3SmbaHasclfydbcdtfydbg8Aa3SmbaQa8ASmba8Ja8Acx2fg8AIdba8JaQcx2fgQIdbgI:tg8Pa9qIdbaQIdlg8S:tg8MNa8KIdbaI:tgya8AIdla8S:tg8NN:ta8PaAIdba8S:tgRNaYIdbaI:tg8Ra8NN:tNa8Na9pIdbaQIdwg8S:tg8UNa8Ma8AIdwa8S:tgIN:ta8NadIdba8S:tg8SNaRaIN:tNaIayNa8Ua8PN:taIa8RNa8Sa8PN:tNMMJbbbb9FmdkascwfhsaLcefgLa56hea5aL9hmbkkaeceGTmba9hcefh9hxeka8Ea3c8S2gQfgsa8Ea9nc8S2g8AfgLIdbasIdbMUdbasaLIdlasIdlMUdlasaLIdwasIdwMUdwasaLIdxasIdxMUdxasaLIdzasIdzMUdzasaLIdCasIdCMUdCasaLIdKasIdKMUdKasaLId3asId3MUd3asaLIdaasIdaMUdaasaLId8KasId8KMUd8KasaLIdyasIdyMUdydnaDTmbaoaQfgsaoa8AfgLIdbasIdbMUdbasaLIdlasIdlMUdlasaLIdwasIdwMUdwasaLIdxasIdxMUdxasaLIdzasIdzMUdzasaLIdCasIdCMUdCasaLIdKasIdKMUdKasaLId3asId3MUd3asaLIdaasIdaMUdaasaLId8KasId8KMUd8KasaLIdyasIdyMUdyaca9n2heaca32hYawhLaDh8AinaLaYfgsaLaefgQIdbasIdbMUdbasclfg5aQclfIdba5IdbMUdbascwfg5aQcwfIdba5IdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa8Acufg8AmbkkaOcwfhLdndndndnaEaKfgQRbbc9:fPdebdkaKhsinaHascdtgsfa3BdbaXasfydbgsaK9hmbxikkaXa9kfydbhsaXa9mfydbhKaHa9mfa6Bdbash6kaHaKcdtfa6Bdbka9oce86bba0ce86bbaLIdbg8Pa8Ya8Ya8P9DEh8Ya9ecefh9ececdaQRbbceSEaifhikagcefggaz9hmbkkdna9embahhdxikdnalTmbcbhLa8FhsindnasydbgQcuSmbdnaLaHaQcdtg3fydbgQ9hmba8Fa3fydbhQkasaQBdbkasclfhsalaLcefgL9hmbkcbhLaahsindnasydbgQcuSmbdnaLaHaQcdtg3fydbgQ9hmbaaa3fydbhQkasaQBdbkasclfhsalaLcefgL9hmbkkcbhdabhscbh8AindnaHasydbcdtfydbgLaHasclfydbcdtfydbgQSmbaLaHascwfydbcdtfydbg3SmbaQa3Smbabadcdtfg5aLBdba5clfaQBdba5cwfa3Bdbadcifhdkascxfhsa8Acifg8Aah6mbkadaq9nmdxbkkaPabadalaCz:cjjjbkdnamTmbama8Y:rUdbkaPyd9OgscdtaPcwffc98fhCdninasTmeaCydbcbyd:m:jjjbH:bjjjbbaCc98fhCascufhsxbkkaPc;W;abf8Kjjjjbadk;:ieouabydlhvabydbclfcbaicdtz:ljjjbhoadci9UhrdnadTmbdnalTmbaehwadhDinaoalawydbcdtfydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbxdkkaehwadhDinaoawydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbkkdnaiTmbcbhDaohwinawydbhqawaDBdbawclfhwaqaDfhDaicufgimbkkdnadci6mbarcearce0EhdinaecwfydbhwaeclfydbhDaeydbhidnalTmbalawcdtfydbhwalaDcdtfydbhDalaicdtfydbhikavaoaicdtfgqydbcitfaDBdbavaqydbcitfawBdlaqaqydbcefBdbavaoaDcdtfgqydbcitfawBdbavaqydbcitfaiBdlaqaqydbcefBdbavaoawcdtfgwydbcitfaiBdbavawydbcitfaDBdlawawydbcefBdbaecxfheadcufgdmbkkabydbcbBdbk:Zldouv998Jjjjjbca9Rglczfcwfcbyd11jjbBdbalcb8Pdj1jjb83izalcwfcbydN1jjbBdbalcb8Pd:m1jjb83ibdnadTmbaicd4hvdnabTmbavcdthocbhraehwinabarcx2fgiaearav2cdtfgDIdbUdbaiaDIdlUdlaiaDIdwUdwcbhiinalczfaifgDawaifIdbgqaDIdbgkakaq9EEUdbalaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkawaofhwarcefgrad9hmbxdkkavcdthrcbhwincbhiinalczfaifgDaeaifIdbgqaDIdbgkakaq9EEUdbalaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkaearfheawcefgwad9hmbkkdnabTmbadTmbJbbbbJbbjZalIdbalIdzgk:tJbbbb:xgqalIdlalIdCgx:tgmamaq9DEgqalIdwalIdKgm:tgPaPaq9DEgq:vaqJbbbb9BEhqinabaqabIdbak:tNUdbabclfgiaqaiIdbax:tNUdbabcwfgiaqaiIdbam:tNUdbabcxfhbadcufgdmbkkk8KbabaeadaialavcbcbcbcbaoarawaDz:bjjjbk8KbabaeadaialavaoarawaDaqakaxamz:bjjjbk;lOowud99wue99iul998Jjjjjbc;Wb9Rgw8KjjjjbdndnarmbcbhDxekawcwfcbc;Kbz:ljjjb8Aawcuadcx2adc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbgqBdwawceBd9Oaqaeadaiz:djjjbawcuadcdtadcFFFFi0Egkcbyd1:jjjbHjjjjbbgxBdxawcdBd9Oadcd4adfhmceheinaegicetheaiam6mbkcbhmawcuaicdtgPaicFFFFi0Ecbyd1:jjjbHjjjjbbgsBdzawciBd9Odndnar:Zgz:rJbbbZMgH:lJbbb9p9DTmbaH:Ohexekcjjjj94hekaicufhOc:bwhAcbhCcbhXadhQinaChLaeaAgKcufaeaK9iEamgDcefaeaD9kEhYdndnadTmbaYcuf:YhHaqhiaxheadhmindndnaiIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhAxekcjjjj94hAkaAcCthAdndnaiclfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcqtaAVhAdndnaicwfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaeaAaCVBdbaicxfhiaeclfheamcufgmmbkascFeaPz:ljjjbhEcbh3cbh5indnaEaxa5cdtfydbgAcm4aA7c:v;t;h;Ev2gics4ai7aOGgmcdtfgCydbgecuSmbaeaASmbcehiinaEamaifaOGgmcdtfgCydbgecuSmeaicefhiaeaA9hmbkkaCaABdba3aecuSfh3a5cefg5ad9hmbxdkkascFeaPz:ljjjb8Acbh3kaDaYa3ar0giEhmaLa3aiEhCdna3arSmbaYaKaiEgAam9Rcd9imbdndnaXcl0mbdnaQ:ZgHaL:Zg8A:taY:Yg8EaD:Y:tg8Fa8EaK:Y:tgaa3:Zghaz:tNNNaHaz:taaNa8Aah:tNa8Aaz:ta8FNahaH:tNM:va8EMJbbbZMgH:lJbbb9p9DTmbaH:Ohexdkcjjjj94hexekamaAfcd9Theka3aQaiEhQaXcefgXcs9hmekkdndnaCmbcihicbhDxekcbhiawakcbyd1:jjjbHjjjjbbg5BdCawclBd9OdndnadTmbamcuf:YhHaqhiaxheadhmindndnaiIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhAxekcjjjj94hAkaAcCthAdndnaiclfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcqtaAVhAdndnaicwfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaeaAaCVBdbaicxfhiaeclfheamcufgmmbkascFeaPz:ljjjbhEcbhDcbh3inaxa3cdtgYfydbgAcm4aA7c:v;t;h;Ev2gics4ai7hecbhidndninaEaeaOGgmcdtfgCydbgecuSmednaxaecdtgCfydbaASmbaicefgiamfheaiaO9nmekka5aCfydbhixekaCa3BdbaDhiaDcefhDka5aYfaiBdba3cefg3ad9hmbkcuaDc32giaDc;j:KM;jb0EhexekascFeaPz:ljjjb8AcbhDcbhekawaecbyd1:jjjbHjjjjbbgeBdKawcvBd9Oaecbaiz:ljjjbhOavcd4hxdnadTmbaxcdth3a5hmalhAaqheadhEinaOamydbc32fgiaeIdbaiIdbMUdbaiaeclfIdbaiIdlMUdlaiaecwfIdbaiIdwMUdwaiaAc;81jjbalEgCIdbaiIdxMUdxaiaCIdlaiIdzMUdzaiaCIdwaiIdCMUdCaiaiIdKJbbjZMUdKamclfhmaAa3fhAaecxfheaEcufgEmbkkdnaDTmbaOcxfhiaDheinaictfgmamIdbJbbbbJbbjZaicxfIdbgH:vaHJbbbb9BEgHNUdbaic94fgmaHamIdbNUdbaic98fgmaHamIdbNUdbaiaHaiIdbNUdbaiclfgmaHamIdbNUdbaicwfgmaHamIdbNUdbaic3fhiaecufgembkkcbhAawcuaDcdtgYaDcFFFFi0Egicbyd1:jjjbHjjjjbbgeBd3awcoBd9Oawaicbyd1:jjjbHjjjjbbgEBdaaecFeaYz:ljjjbh3dnadTmbaoaoNh8Aaxcdthxalheina8Aaec;81jjbalEgmIdwaOa5ydbgCc32fgiIdC:tgHaHNamIdbaiIdx:tgHaHNamIdlaiIdz:tgHaHNMMNaqcwfIdbaiIdw:tgHaHNaqIdbaiIdb:tgHaHNaqclfIdbaiIdl:tgHaHNMMMhHdndna3aCcdtgifgmydbcuSmbaEaifIdbaH9ETmekamaABdbaEaifaHUdbka5clfh5aeaxfheaqcxfhqadaAcefgA9hmbkkaba3aYz:kjjjb8AcrhikaicdthiinaiTmeaic98fgiawcwffydbcbyd:m:jjjbH:bjjjbbxbkkawc;Wbf8KjjjjbaDk:Qdidui99ducbhi8Jjjjjbca9Rglczfcwfcbyd11jjbBdbalcb8Pdj1jjb83izalcwfcbydN1jjbBdbalcb8Pd:m1jjb83ibdndnaembJbbjFhvJbbjFhoJbbjFhrxekadcd4cdthwincbhdinalczfadfgDabadfIdbgoaDIdbgrarao9EEUdbaladfgDaoaDIdbgrarao9DEUdbadclfgdcx9hmbkabawfhbaicefgiae9hmbkalIdwalIdK:thralIdlalIdC:thoalIdbalIdz:thvkavJbbbb:xgvaoaoav9DEgoararao9DEk9DeeuabcFeaicdtz:ljjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk9teiucbcbyd:q:jjjbgeabcifc98GfgbBd:q:jjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:q:jjjbgeabcrfc94GfgbBd:q:jjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:q:jjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:q:jjjbfgdBd:q:jjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk6eiucbhidnadTmbdninabRbbglaeRbbgv9hmeaecefheabcefhbadcufgdmbxdkkalav9Rhikaikk:Iedbcjwk1eFFuuFFuuFFuuFFuFFFuFFFuFbbbbbbbbebbbdbbbbbbbebbbeeebeebebbeeebebbbbbebebbbbbebbbdbbbbbbbbbbbbbbbeeeeebebbbbbebbbbbeebbbbbbbbbbbbbbbbbbbbbc1Dkxebbbdbbb:G9Kbb"),{}).then((function(t){(e=t.instance).exports.__wasm_call_ctors()}));function i(e){if(!e)throw new Error("Assertion failed")}function o(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function r(t,n,i,r,s,a,c,l){var u=e.exports.sbrk,d=u(4*l),h=u(i*r),p=u(i*a),f=new Uint8Array(e.exports.memory.buffer);f.set(o(n),h),s&&f.set(o(s),p);var m=t(d,h,i,r,p,a,c,l);new Uint8Array(e.exports.memory.buffer);var _=new Uint32Array(m);return o(_).set(f.subarray(d,d+4*m)),u(d-u(0)),_}var s={LockBorder:1}}(),D(Object.create)&&(cS.prototype=Object.create(oS.prototype),cS.prototype.constructor=cS),Object.defineProperties(cS.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}}),cS.prototype.load=async function(){return D(this._promise)||(this._state=rS.LOADING,this._promise=lS(this)),this._promise},cS.prototype.unload=function(){D(this._bufferLoader)&&!this._bufferLoader.isDestroyed()&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0},uS._maxDecodingConcurrency=Math.max(Ct.hardwareConcurrency-1,1),uS._decoderTaskProcessor=void 0,uS._taskProcessorReady=!1,uS._error=void 0,uS._getDecoderTaskProcessor=function(){if(!D(uS._decoderTaskProcessor)){const e=new Qa("decodeDraco",uS._maxDecodingConcurrency);e.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then((function(e){e?uS._taskProcessorReady=!0:uS._error=new be("Draco decoder could not be initialized.")})).catch((e=>{uS._error=e})),uS._decoderTaskProcessor=e}return uS._decoderTaskProcessor},uS.decodePointCloud=function(e){const t=uS._getDecoderTaskProcessor();if(D(uS._error))throw uS._error;if(uS._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])},uS.decodeBufferView=function(e){const t=uS._getDecoderTaskProcessor();if(D(uS._error))throw uS._error;if(uS._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])},D(Object.create)&&(dS.prototype=Object.create(oS.prototype),dS.prototype.constructor=dS),Object.defineProperties(dS.prototype,{cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}}),dS.prototype.load=async function(){return D(this._promise)||(this._state=rS.LOADING,this._promise=async function(e){const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._draco.bufferView,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;return e._bufferViewTypedArray=n.typedArray,e._state=rS.PROCESSING,e}catch(n){if(e.isDestroyed())return;hS(e,n)}}(this)),this._promise},dS.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===rS.READY)return!0;if(this._state!==rS.PROCESSING)return!1;if(D(this._dracoError)&&hS(this,this._dracoError),!D(this._bufferViewTypedArray))return!1;if(D(this._decodePromise))return!1;const t=this._draco,n=this._gltf.bufferViews[t.bufferView],i=t.attributes,o={array:new Uint8Array(this._bufferViewTypedArray),bufferView:n,compressedAttributes:i,dequantizeInShader:!0},r=uS.decodeBufferView(o);if(!D(r))return!1;this._decodePromise=async function(e,t){try{const n=await t;if(e.isDestroyed())return;return e.unload(),e._decodedData={indices:n.indexArray,vertexAttributes:n.attributeData},e._state=rS.READY,e._baseResource}catch(n){if(e.isDestroyed())return;e._dracoError=n}}(this,r)},dS.prototype.unload=function(){D(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0},D(Object.create)&&(pS.prototype=Object.create(oS.prototype),pS.prototype.constructor=pS),Object.defineProperties(pS.prototype,{cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}}),pS.prototype.load=function(){return D(this._promise)?this._promise:D(this._bufferViewId)?(this._promise=async function(e){e._state=rS.LOADING;const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;const i=n.typedArray,o=await async function(e){const t=function(e){const t=e.subarray(0,2),n=e.subarray(0,4),i=e.subarray(8,12);if(255===t[0]&&216===t[1])return"image/jpeg";if(137===t[0]&&80===t[1])return"image/png";if(171===t[0]&&75===t[1])return"image/ktx2";if(82===n[0]&&73===n[1]&&70===n[2]&&70===n[3]&&87===i[0]&&69===i[1]&&66===i[2]&&80===i[3])return"image/webp";throw new be("Image format is not recognized")}(e);if("image/ktx2"===t){return ec(new Uint8Array(e))}return pS._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}(i);if(e.isDestroyed())return;const r=fS(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=rS.READY,e}catch(n){if(e.isDestroyed())return;return mS(e,n,"Failed to load embedded image")}}(this),this._promise):(this._promise=async function(e){e._state=rS.LOADING;const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});try{const t=await function(e){const t=e.getUrlComponent(!1,!0);if(_S.test(t))return ec(e);return e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}(i);if(e.isDestroyed())return;const n=fS(t);return e.unload(),e._image=n.image,e._mipLevels=n.mipLevels,e._state=rS.READY,e}catch(o){if(e.isDestroyed())return;return mS(e,o,`Failed to load image: ${n}`)}}(this),this._promise)};const _S=/(^data:image\/ktx2)|(\.ktx2$)/i;pS.prototype.unload=function(){D(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0},pS._loadImageFromTypedArray=function(e){const t=e.uint8Array,n=e.format,i=e.request,o=M(e.flipY,!1),r=M(e.skipColorSpaceConversion,!1);L.typeOf.object("uint8Array",t),L.typeOf.string("format",n);const s=new Blob([t],{type:n});let a;return Bi.supportsImageBitmapOptions().then((function(e){if(e)return Promise.resolve(Bi.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r}));a=window.URL.createObjectURL(s);return new Bi({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r})})).then((function(e){return D(a)&&window.URL.revokeObjectURL(a),e})).catch((function(e){return D(a)&&window.URL.revokeObjectURL(a),Promise.reject(e)}))};const gS=Object.freeze({TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3});function yS(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.draco,a=e.cacheKey,c=M(e.asynchronous,!0),l=M(e.loadBuffer,!1),u=M(e.loadTypedArray,!1);if(L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltf",n),L.typeOf.number("options.accessorId",i),L.typeOf.object("options.gltfResource",o),L.typeOf.object("options.baseResource",r),!l&&!u)throw new P("At least one of loadBuffer and loadTypedArray must be true.");const d=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=d,this._draco=s,this._cacheKey=a,this._asynchronous=c,this._loadBuffer=l,this._loadTypedArray=u,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=rS.UNLOADED,this._promise=void 0}D(Object.create)&&(yS.prototype=Object.create(oS.prototype),yS.prototype.constructor=yS),Object.defineProperties(yS.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}});const bS=new AS;function vS(e,t){e.unload(),e._state=rS.FAILED;throw e.getError("Failed to load index buffer",t)}function AS(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}function TS(e,t,n){const i=Ye.createIndexBuffer({typedArray:e,context:n,usage:qe.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}function wS(e,t,n){if(n=M(n,!1)){const n=e.indexOf(t);if(n>-1)return n}return e.push(t),e.length-1}function ES(e,t){return D(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function xS(){}function SS(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 CS(e,t){const n=t.bufferView;if(D(n)){const t=e.bufferViews[n];if(D(t.byteStride)&&t.byteStride>0)return t.byteStride}return Ca.getSizeInBytes(t.componentType)*SS(t.type)}function IS(e){xS.accessor(e,(function(e){D(e.bufferView)&&(e.byteOffset=M(e.byteOffset,0))})),xS.bufferView(e,(function(e){D(e.buffer)&&(e.byteOffset=M(e.byteOffset,0))})),xS.mesh(e,(function(t){xS.meshPrimitive(t,(function(t){if(t.mode=M(t.mode,Me.TRIANGLES),!D(t.material)){D(e.materials)||(e.materials=[]);const n={name:"default"};t.material=wS(e.materials,n)}}))})),xS.accessorContainingVertexAttributeData(e,(function(t){const n=e.accessors[t],i=n.bufferView;if(n.normalized=M(n.normalized,!1),D(i)){const t=e.bufferViews[i];t.byteStride=CS(e,n),t.target=Me.ARRAY_BUFFER}})),xS.accessorContainingIndexData(e,(function(t){const n=e.accessors[t].bufferView;if(D(n)){e.bufferViews[n].target=Me.ELEMENT_ARRAY_BUFFER}})),xS.material(e,(function(e){const t=M(e.extensions,M.EMPTY_OBJECT),n=t.KHR_materials_common;if(D(n)){const e=n.technique,t=D(n.values)?n.values:{};return n.values=t,t.ambient=D(t.ambient)?t.ambient:[0,0,0,1],t.emission=D(t.emission)?t.emission:[0,0,0,1],t.transparency=M(t.transparency,1),"CONSTANT"!==e&&(t.diffuse=D(t.diffuse)?t.diffuse:[0,0,0,1],"LAMBERT"!==e&&(t.specular=D(t.specular)?t.specular:[0,0,0,1],t.shininess=M(t.shininess,0))),n.transparent=M(n.transparent,!1),void(n.doubleSided=M(n.doubleSided,!1))}e.emissiveFactor=M(e.emissiveFactor,[0,0,0]),e.alphaMode=M(e.alphaMode,"OPAQUE"),e.doubleSided=M(e.doubleSided,!1),"MASK"===e.alphaMode&&(e.alphaCutoff=M(e.alphaCutoff,.5));D(t.KHR_techniques_webgl)&&xS.materialValue(e,(function(e){D(e.index)&&OS(e)})),OS(e.emissiveTexture),OS(e.normalTexture),OS(e.occlusionTexture);const i=e.pbrMetallicRoughness;D(i)&&(i.baseColorFactor=M(i.baseColorFactor,[1,1,1,1]),i.metallicFactor=M(i.metallicFactor,1),i.roughnessFactor=M(i.roughnessFactor,1),OS(i.baseColorTexture),OS(i.metallicRoughnessTexture));const o=t.KHR_materials_pbrSpecularGlossiness;D(o)&&(o.diffuseFactor=M(o.diffuseFactor,[1,1,1,1]),o.specularFactor=M(o.specularFactor,[1,1,1]),o.glossinessFactor=M(o.glossinessFactor,1),OS(o.specularGlossinessTexture))})),xS.animation(e,(function(e){xS.animationSampler(e,(function(e){e.interpolation=M(e.interpolation,"LINEAR")}))}));const t=function(e){const t={};return xS.animation(e,(function(e){xS.animationChannel(e,(function(e){const n=e.target,i=n.node,o=n.path;"translation"!==o&&"rotation"!==o&&"scale"!==o||(t[i]=!0)}))})),t}(e);return xS.node(e,(function(e,n){D(t[n])||D(e.translation)||D(e.rotation)||D(e.scale)?(e.translation=M(e.translation,[0,0,0]),e.rotation=M(e.rotation,[0,0,0,1]),e.scale=M(e.scale,[1,1,1])):e.matrix=M(e.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])})),xS.sampler(e,(function(e){e.wrapS=M(e.wrapS,Me.REPEAT),e.wrapT=M(e.wrapT,Me.REPEAT)})),D(e.scenes)&&!D(e.scene)&&(e.scene=0),e}function OS(e){D(e)&&(e.texCoord=M(e.texCoord,0))}function DS(e){return xS.shader(e,(function(e){PS(e)})),xS.buffer(e,(function(e){PS(e)})),xS.image(e,(function(e){PS(e)})),PS(e),e}function PS(e){e.extras=D(e.extras)?e.extras:{},e.extras._pipeline=D(e.extras._pipeline)?e.extras._pipeline:{}}function NS(e,t){const n=e.extensionsUsed;if(D(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),function(e,t){const n=e.extensionsRequired;if(D(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),0===n.length&&delete e.extensionsRequired}}(e,t),0===n.length&&delete e.extensionsUsed}}yS.prototype.load=async function(){return D(this._promise)?this._promise:D(this._draco)?(this._promise=async function(e){e._state=rS.LOADING;const t=e._resourceCache;try{const n=t.getDracoLoader({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._dracoLoader=n,await n.load(),e.isDestroyed())return;return e._state=rS.LOADED,e}catch(n){if(e.isDestroyed())return;vS(e,n)}}(this),this._promise):(this._promise=async function(e){const t=e._gltf,n=e._accessorId,i=t.accessors[n].bufferView;e._state=rS.LOADING;const o=e._resourceCache;try{const n=o.getBufferViewLoader({gltf:t,bufferViewId:i,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;const r=n.typedArray;return e._typedArray=function(e,t){const n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=je.getSizeInBytes(s);let c,l=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!=0){const e=new Uint8Array(l,u,r*a);l=new Uint8Array(e).buffer,u=0,Da("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}s===je.UNSIGNED_BYTE?c=new Uint8Array(l,u,r):s===je.UNSIGNED_SHORT?c=new Uint16Array(l,u,r):s===je.UNSIGNED_INT&&(c=new Uint32Array(l,u,r));return c}(e,r),e._state=rS.PROCESSING,e}catch(r){if(e.isDestroyed())return;vS(e,r)}}(this),this._promise)},AS.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n},AS.prototype.execute=function(){this.buffer=TS(this.typedArray,this.indexDatatype,this.context)},yS.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===rS.READY)return!0;if(this._state!==rS.LOADED&&this._state!==rS.PROCESSING)return!1;let t,n=this._typedArray,i=this._indexDatatype;if(D(this._dracoLoader))try{if(this._dracoLoader.process(e)){n=this._dracoLoader.decodedData.indices.typedArray,this._typedArray=n,i=Ca.fromTypedArray(n),this._indexDatatype=i}}catch(o){vS(this,o)}if(!D(n))return!1;if(this._loadBuffer&&this._asynchronous){const o=bS;o.set(n,i,e.context);if(!e.jobScheduler.execute(o,gS.BUFFER))return!1;t=o.buffer}else this._loadBuffer&&(t=TS(n,i,e.context));return this.unload(),this._buffer=t,this._typedArray=this._loadTypedArray?n:void 0,this._state=rS.READY,this._resourceCache.statistics.addGeometryLoader(this),!0},yS.prototype.unload=function(){D(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;D(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),D(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},xS.objectLegacy=function(e,t){if(D(e))for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=t(e[n],n);if(D(i))return i}},xS.object=function(e,t){if(D(e)){const n=e.length;for(let i=0;i<n;i++){const n=t(e[i],i);if(D(n))return n}}},xS.topLevel=function(e,t,n){const i=e[t];return D(i)&&!Array.isArray(i)?xS.objectLegacy(i,n):xS.object(i,n)},xS.accessor=function(e,t){return xS.topLevel(e,"accessors",t)},xS.accessorWithSemantic=function(e,t,n){const i={};return xS.mesh(e,(function(e){return xS.meshPrimitive(e,(function(e){const o=xS.meshPrimitiveAttribute(e,(function(e,o){if(0===o.indexOf(t)&&!D(i[e])){i[e]=!0;const t=n(e);if(D(t))return t}}));return D(o)?o:xS.meshPrimitiveTarget(e,(function(e){return xS.meshPrimitiveTargetAttribute(e,(function(e,o){if(0===o.indexOf(t)&&!D(i[e])){i[e]=!0;const t=n(e);if(D(t))return t}}))}))}))}))},xS.accessorContainingVertexAttributeData=function(e,t){const n={};return xS.mesh(e,(function(e){return xS.meshPrimitive(e,(function(e){const i=xS.meshPrimitiveAttribute(e,(function(e){if(!D(n[e])){n[e]=!0;const i=t(e);if(D(i))return i}}));return D(i)?i:xS.meshPrimitiveTarget(e,(function(e){return xS.meshPrimitiveTargetAttribute(e,(function(e){if(!D(n[e])){n[e]=!0;const i=t(e);if(D(i))return i}}))}))}))}))},xS.accessorContainingIndexData=function(e,t){const n={};return xS.mesh(e,(function(e){return xS.meshPrimitive(e,(function(e){const i=e.indices;if(D(i)&&!D(n[i])){n[i]=!0;const e=t(i);if(D(e))return e}}))}))},xS.animation=function(e,t){return xS.topLevel(e,"animations",t)},xS.animationChannel=function(e,t){const n=e.channels;return xS.object(n,t)},xS.animationSampler=function(e,t){const n=e.samplers;return xS.object(n,t)},xS.buffer=function(e,t){return xS.topLevel(e,"buffers",t)},xS.bufferView=function(e,t){return xS.topLevel(e,"bufferViews",t)},xS.camera=function(e,t){return xS.topLevel(e,"cameras",t)},xS.image=function(e,t){return xS.topLevel(e,"images",t)},xS.material=function(e,t){return xS.topLevel(e,"materials",t)},xS.materialValue=function(e,t){let n=e.values;D(e.extensions)&&D(e.extensions.KHR_techniques_webgl)&&(n=e.extensions.KHR_techniques_webgl.values);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const e=t(n[i],i);if(D(e))return e}},xS.mesh=function(e,t){return xS.topLevel(e,"meshes",t)},xS.meshPrimitive=function(e,t){const n=e.primitives;if(D(n)){const e=n.length;for(let i=0;i<e;i++){const e=t(n[i],i);if(D(e))return e}}},xS.meshPrimitiveAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const e=t(n[i],i);if(D(e))return e}},xS.meshPrimitiveTarget=function(e,t){const n=e.targets;if(D(n)){const e=n.length;for(let i=0;i<e;++i){const e=t(n[i],i);if(D(e))return e}}},xS.meshPrimitiveTargetAttribute=function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=t(e[n],n);if(D(i))return i}},xS.node=function(e,t){return xS.topLevel(e,"nodes",t)},xS.nodeInTree=function(e,t,n){const i=e.nodes;if(D(i)){const o=t.length;for(let r=0;r<o;r++){const o=t[r],s=i[o];if(D(s)){let t=n(s,o);if(D(t))return t;const i=s.children;if(D(i)&&(t=xS.nodeInTree(e,i,n),D(t)))return t}}}},xS.nodeInScene=function(e,t,n){const i=t.nodes;if(D(i))return xS.nodeInTree(e,i,n)},xS.program=function(e,t){return ES(e,"KHR_techniques_webgl")?xS.object(e.extensions.KHR_techniques_webgl.programs,t):xS.topLevel(e,"programs",t)},xS.sampler=function(e,t){return xS.topLevel(e,"samplers",t)},xS.scene=function(e,t){return xS.topLevel(e,"scenes",t)},xS.shader=function(e,t){return ES(e,"KHR_techniques_webgl")?xS.object(e.extensions.KHR_techniques_webgl.shaders,t):xS.topLevel(e,"shaders",t)},xS.skin=function(e,t){return xS.topLevel(e,"skins",t)},xS.skinJoint=function(e,t){const n=e.joints;if(D(n)){const e=n.length;for(let i=0;i<e;i++){const e=t(n[i]);if(D(e))return e}}},xS.techniqueAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const e=t(n[i],i);if(D(e))return e}},xS.techniqueUniform=function(e,t){const n=e.uniforms;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const e=t(n[i],i);if(D(e))return e}},xS.techniqueParameter=function(e,t){const n=e.parameters;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const e=t(n[i],i);if(D(e))return e}},xS.technique=function(e,t){return ES(e,"KHR_techniques_webgl")?xS.object(e.extensions.KHR_techniques_webgl.techniques,t):xS.topLevel(e,"techniques",t)},xS.texture=function(e,t){return xS.topLevel(e,"textures",t)};function RS(e){if("glTF"!==Aw(e))throw new be("File is not valid binary glTF");const t=LS(e,0,5),n=t[1];if(1!==n&&2!==n)throw new be("Binary glTF version is not 1 or 2");return 1===n?function(e,t){const n=t[2],i=t[3],o=t[4];if(0!==o)throw new be("Binary glTF scene format is not JSON");const r=20,s=r+i,a=bw(e,r,i),c=JSON.parse(a);DS(c);const l=e.subarray(s,n),u=c.buffers;if(D(u)&&Object.keys(u).length>0){const e=M(u.binary_glTF,u.KHR_binary_glTF);D(e)&&(e.extras._pipeline.source=l,delete e.uri)}return NS(c,"KHR_binary_glTF"),c}(e,t):function(e,t){const n=t[2];let i,o,r=12;for(;r<n;){const t=LS(e,r,2),n=t[0],s=t[1];r+=8;const a=e.subarray(r,r+n);if(r+=n,1313821514===s){const e=bw(a);i=JSON.parse(e),DS(i)}else 5130562===s&&(o=a)}if(D(i)&&D(o)){const e=i.buffers;if(D(e)&&e.length>0){e[0].extras._pipeline.source=o}}return i}(e,t)}function LS(e,t,n){const i=new DataView(e.buffer),o=new Array(n);for(let r=0;r<n;++r)o[r]=i.getUint32(e.byteOffset+t+4*r,!0);return o}function MS(e){D(e.extras)&&(D(e.extras._pipeline)&&delete e.extras._pipeline,0===Object.keys(e.extras).length&&delete e.extras)}function FS(e,t){let n=e.extensionsUsed;D(n)||(n=[],e.extensionsUsed=n),wS(n,t,!0)}function BS(e){switch(e){case Ca.BYTE:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getInt8(t+r*i)};case Ca.UNSIGNED_BYTE:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getUint8(t+r*i)};case Ca.SHORT:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getInt16(t+r*i,!0)};case Ca.UNSIGNED_SHORT:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getUint16(t+r*i,!0)};case Ca.INT:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getInt32(t+r*i,!0)};case Ca.UNSIGNED_INT:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getUint32(t+r*i,!0)};case Ca.FLOAT:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getFloat32(t+r*i,!0)};case Ca.DOUBLE:return function(e,t,n,i,o){for(let r=0;r<n;++r)o[r]=e.getFloat64(t+r*i,!0)}}}function zS(e,t){const n=e.bufferViews,i=e.buffers,o=t.bufferView,r=SS(t.type);if(!D(t.bufferView))return{min:new Array(r).fill(0),max:new Array(r).fill(0)};const s=new Array(r).fill(Number.POSITIVE_INFINITY),a=new Array(r).fill(Number.NEGATIVE_INFINITY),c=n[o],l=i[c.buffer].extras._pipeline.source,u=t.count,d=CS(e,t);let h=t.byteOffset+c.byteOffset+l.byteOffset;const p=t.componentType,f=Ca.getSizeInBytes(p),m=new DataView(l.buffer),_=new Array(r),g=BS(p);for(let y=0;y<u;y++){g(m,h,r,f,_);for(let e=0;e<r;e++){const t=_[e];s[e]=Math.min(s[e],t),a[e]=Math.max(a[e],t)}h+=d}return{min:s,max:a}}const US=[Me.FUNC_ADD,Me.FUNC_ADD],kS=[Me.ONE,Me.ZERO,Me.ONE,Me.ZERO];function VS(e,t){const n=e.enable;return!!D(n)&&n.indexOf(t)>-1}const HS=[Me.ZERO,Me.ONE,Me.SRC_COLOR,Me.ONE_MINUS_SRC_COLOR,Me.SRC_ALPHA,Me.ONE_MINUS_SRC_ALPHA,Me.DST_ALPHA,Me.ONE_MINUS_DST_ALPHA,Me.DST_COLOR,Me.ONE_MINUS_DST_COLOR];function GS(e,t){if(!D(e))return t;for(let n=0;n<4;n++)if(-1===HS.indexOf(e[n]))return t;return e}function jS(e){const t=e.techniques,n={},i={},o={};if(D(t)){const t={programs:[],shaders:[],techniques:[]},r=e.glExtensionsUsed;delete e.glExtensionsUsed,xS.technique(e,(function(s,a){const c={name:s.name,program:void 0,attributes:{},uniforms:{}};let l;if(xS.techniqueAttribute(s,(function(e,t){l=s.parameters[e],c.attributes[t]={semantic:l.semantic}})),xS.techniqueUniform(s,(function(e,t){l=s.parameters[e],c.uniforms[t]={count:l.count,node:l.node,type:l.type,semantic:l.semantic,value:l.value},D(n[a])||(n[a]={}),n[a][e]=t})),D(o[s.program]))c.program=o[s.program];else{const n=e.programs[s.program],i={name:n.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:r},a=e.shaders[n.fragmentShader];i.fragmentShader=wS(t.shaders,a,!0);const l=e.shaders[n.vertexShader];i.vertexShader=wS(t.shaders,l,!0),c.program=wS(t.programs,i),o[s.program]=c.program}i[a]=wS(t.techniques,c)})),t.techniques.length>0&&(D(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t,FS(e,"KHR_techniques_webgl"),function(e,t){let n=e.extensionsRequired;D(n)||(n=[],e.extensionsRequired=n),wS(n,t,!0),FS(e,t)}(e,"KHR_techniques_webgl"))}return xS.material(e,(function(e){if(D(e.technique)){const t={technique:i[e.technique]};xS.objectLegacy(e.values,(function(i,o){D(t.values)||(t.values={});const r=n[e.technique][o];D(r)&&(t.values[r]=i)})),D(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=t}delete e.technique,delete e.values})),delete e.techniques,delete e.programs,delete e.shaders,e}function WS(e,t){L.typeOf.object("material",e),L.defined("handler",t);const n=e.pbrMetallicRoughness;if(D(n)){if(D(n.baseColorTexture)){const e=n.baseColorTexture,i=t(e.index,e);if(D(i))return i}if(D(n.metallicRoughnessTexture)){const e=n.metallicRoughnessTexture,i=t(e.index,e);if(D(i))return i}}if(D(e.extensions)){const n=e.extensions.KHR_materials_pbrSpecularGlossiness;if(D(n)){if(D(n.diffuseTexture)){const e=n.diffuseTexture,i=t(e.index,e);if(D(i))return i}if(D(n.specularGlossinessTexture)){const e=n.specularGlossinessTexture,i=t(e.index,e);if(D(i))return i}}const i=e.extensions.KHR_materials_common;if(D(i)&&D(i.values)){const e=i.values.diffuse,n=i.values.ambient,o=i.values.emission,r=i.values.specular;if(D(e)&&D(e.index)){const n=t(e.index,e);if(D(n))return n}if(D(n)&&D(n.index)){const e=t(n.index,n);if(D(e))return e}if(D(o)&&D(o.index)){const e=t(o.index,o);if(D(e))return e}if(D(r)&&D(r.index)){const e=t(r.index,r);if(D(e))return e}}}const i=xS.materialValue(e,(function(e){if(D(e.index)){const n=t(e.index,e);if(D(n))return n}}));if(D(i))return i;if(D(e.emissiveTexture)){const n=e.emissiveTexture,i=t(n.index,n);if(D(i))return i}if(D(e.normalTexture)){const n=e.normalTexture,i=t(n.index,n);if(D(i))return i}if(D(e.occlusionTexture)){const n=e.occlusionTexture,i=t(n.index,n);if(D(i))return i}}const qS=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function YS(e,t){return t=M(t,qS),qS.forEach((function(n){t.indexOf(n)>-1&&function(e,t){const n=XS[t],i=e[n];if(D(i)){let n=0;const o=$S[t](e),r=i.length;for(let i=0;i<r;++i)o[i]||(QS[t](e,i-n),n++)}}(e,n)})),e}const XS={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function QS(){}function $S(){}function KS(e,t,n){const i=e.nodes[t];return!(D(i.mesh)||D(i.camera)||D(i.skin)||D(i.weights)||D(i.extras)||D(i.extensions)&&0!==Object.keys(i.extensions).length||D(n[t]))&&(!D(i.children)||0===i.children.filter((function(t){return!KS(e,t,n)})).length)}function ZS(e,t,n){const i=Ca.createTypedArray(n,function(e,t){const n=CS(e,t),i=Ca.getSizeInBytes(t.componentType),o=SS(t.type),r=t.count,s=new Array(o*r);if(!D(t.bufferView))return s.fill(0);const a=e.bufferViews[t.bufferView],c=e.buffers[a.buffer].extras._pipeline.source;let l=t.byteOffset+a.byteOffset+c.byteOffset;const u=new DataView(c.buffer),d=new Array(o),h=BS(t.componentType);for(let p=0;p<r;++p){h(u,l,o,i,d);for(let e=0;e<o;++e)s[p*o+e]=d[e];l+=n}return s}(e,t)),o=new Uint8Array(i.buffer);t.bufferView=function(e,t){const n={byteLength:t.length,extras:{_pipeline:{source:t}}},i={buffer:wS(e.buffers,n),byteOffset:0,byteLength:t.length};return wS(e.bufferViews,i)}(e,o),t.componentType=n,t.byteOffset=0}function JS(e,t){return NS(e,t),"CESIUM_RTC"===t&&function(e){xS.technique(e,(function(e){xS.techniqueUniform(e,(function(e){"CESIUM_RTC_MODELVIEW"===e.semantic&&(e.semantic="MODELVIEW")}))}))}(e),eC(e,t)}function eC(e,t){if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;++i)eC(e[i],t)}else if(null!==e&&"object"==typeof e&&e.constructor===Object){const n=e.extensions;let i;D(n)&&(i=n[t],D(i)&&(delete n[t],0===Object.keys(n).length&&delete e.extensions));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&eC(e[o],t);return i}}QS.accessor=function(e,t){e.accessors.splice(t,1),xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){xS.meshPrimitiveAttribute(e,(function(n,i){n>t&&e.attributes[i]--})),xS.meshPrimitiveTarget(e,(function(e){xS.meshPrimitiveTargetAttribute(e,(function(n,i){n>t&&e[i]--}))}));const n=e.indices;D(n)&&n>t&&e.indices--;const i=e.extensions;D(i)&&D(i.CESIUM_primitive_outline)&&i.CESIUM_primitive_outline.indices>t&&--i.CESIUM_primitive_outline.indices}))})),xS.skin(e,(function(e){D(e.inverseBindMatrices)&&e.inverseBindMatrices>t&&e.inverseBindMatrices--})),xS.animation(e,(function(e){xS.animationSampler(e,(function(e){D(e.input)&&e.input>t&&e.input--,D(e.output)&&e.output>t&&e.output--}))}))},QS.buffer=function(e,t){e.buffers.splice(t,1),xS.bufferView(e,(function(e){D(e.buffer)&&e.buffer>t&&e.buffer--,D(e.extensions)&&D(e.extensions.EXT_meshopt_compression)&&e.extensions.EXT_meshopt_compression.buffer--}))},QS.bufferView=function(e,t){if(e.bufferViews.splice(t,1),xS.accessor(e,(function(e){D(e.bufferView)&&e.bufferView>t&&e.bufferView--})),xS.shader(e,(function(e){D(e.bufferView)&&e.bufferView>t&&e.bufferView--})),xS.image(e,(function(e){D(e.bufferView)&&e.bufferView>t&&e.bufferView--})),ES(e,"KHR_draco_mesh_compression")&&xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){D(e.extensions)&&D(e.extensions.KHR_draco_mesh_compression)&&e.extensions.KHR_draco_mesh_compression.bufferView>t&&e.extensions.KHR_draco_mesh_compression.bufferView--}))})),ES(e,"EXT_feature_metadata")){const n=e.extensions.EXT_feature_metadata.featureTables;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(D(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e];D(n.bufferView)&&n.bufferView>t&&n.bufferView--,D(n.arrayOffsetBufferView)&&n.arrayOffsetBufferView>t&&n.arrayOffsetBufferView--,D(n.stringOffsetBufferView)&&n.stringOffsetBufferView>t&&n.stringOffsetBufferView--}}}if(ES(e,"EXT_structural_metadata")){const n=e.extensions.EXT_structural_metadata.propertyTables;if(D(n)){const e=n.length;for(let i=0;i<e;++i){const e=n[i].properties;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];D(i.values)&&i.values>t&&i.values--,D(i.arrayOffsets)&&i.arrayOffsets>t&&i.arrayOffsets--,D(i.stringOffsets)&&i.stringOffsets>t&&i.stringOffsets--}}}}},QS.image=function(e,t){e.images.splice(t,1),xS.texture(e,(function(e){D(e.source)&&e.source>t&&--e.source;const n=e.extensions;D(n)&&D(n.EXT_texture_webp)&&n.EXT_texture_webp.source>t?--e.extensions.EXT_texture_webp.source:D(n)&&D(n.KHR_texture_basisu)&&n.KHR_texture_basisu.source>t&&--e.extensions.KHR_texture_basisu.source}))},QS.mesh=function(e,t){e.meshes.splice(t,1),xS.node(e,(function(e){D(e.mesh)&&(e.mesh>t?e.mesh--:e.mesh===t&&delete e.mesh)}))},QS.node=function(e,t){e.nodes.splice(t,1),xS.skin(e,(function(e){D(e.skeleton)&&e.skeleton>t&&e.skeleton--,e.joints=e.joints.map((function(e){return e>t?e-1:e}))})),xS.animation(e,(function(e){xS.animationChannel(e,(function(e){D(e.target)&&D(e.target.node)&&e.target.node>t&&e.target.node--}))})),xS.technique(e,(function(e){xS.techniqueUniform(e,(function(e){D(e.node)&&e.node>t&&e.node--}))})),xS.node(e,(function(e){D(e.children)&&(e.children=e.children.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e})))})),xS.scene(e,(function(e){e.nodes=e.nodes.filter((function(e){return e!==t})).map((function(e){return e>t?e-1:e}))}))},QS.material=function(e,t){e.materials.splice(t,1),xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){D(e.material)&&e.material>t&&e.material--}))}))},QS.sampler=function(e,t){e.samplers.splice(t,1),xS.texture(e,(function(e){D(e.sampler)&&e.sampler>t&&--e.sampler}))},QS.texture=function(e,t){if(e.textures.splice(t,1),xS.material(e,(function(e){WS(e,(function(e,n){n.index>t&&--n.index}))})),ES(e,"EXT_feature_metadata")){xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){const n=e.extensions;if(D(n)&&D(n.EXT_feature_metadata)){const e=n.EXT_feature_metadata.featureIdTextures;if(D(e)){const n=e.length;for(let i=0;i<n;++i){const n=e[i].featureIds.texture;n.index>t&&--n.index}}}}))}));const n=e.extensions.EXT_feature_metadata.featureTextures;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(D(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].texture;n.index>t&&--n.index}}}if(ES(e,"EXT_mesh_features")&&xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){const n=e.extensions;if(D(n)&&D(n.EXT_mesh_features)){const e=n.EXT_mesh_features.featureIds;if(D(e)){const n=e.length;for(let i=0;i<n;++i){const n=e[i];D(n.texture)&&n.texture.index>t&&--n.texture.index}}}}))})),ES(e,"EXT_structural_metadata")){const n=e.extensions.EXT_structural_metadata.propertyTextures;if(D(n)){const e=n.length;for(let i=0;i<e;++i){const e=n[i].properties;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];i.index>t&&--i.index}}}}},$S.accessor=function(e){const t={};return xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){xS.meshPrimitiveAttribute(e,(function(e){t[e]=!0})),xS.meshPrimitiveTarget(e,(function(e){xS.meshPrimitiveTargetAttribute(e,(function(e){t[e]=!0}))}));const n=e.indices;D(n)&&(t[n]=!0)}))})),xS.skin(e,(function(e){D(e.inverseBindMatrices)&&(t[e.inverseBindMatrices]=!0)})),xS.animation(e,(function(e){xS.animationSampler(e,(function(e){D(e.input)&&(t[e.input]=!0),D(e.output)&&(t[e.output]=!0)}))})),ES(e,"EXT_mesh_gpu_instancing")&&xS.node(e,(function(e){D(e.extensions)&&D(e.extensions.EXT_mesh_gpu_instancing)&&Object.keys(e.extensions.EXT_mesh_gpu_instancing.attributes).forEach((function(n){const i=e.extensions.EXT_mesh_gpu_instancing.attributes[n];t[i]=!0}))})),ES(e,"CESIUM_primitive_outline")&&xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){const n=e.extensions;if(D(n)&&D(n.CESIUM_primitive_outline)){const e=n.CESIUM_primitive_outline.indices;D(e)&&(t[e]=!0)}}))})),t},$S.buffer=function(e){const t={};return xS.bufferView(e,(function(e){D(e.buffer)&&(t[e.buffer]=!0),D(e.extensions)&&D(e.extensions.EXT_meshopt_compression)&&(t[e.extensions.EXT_meshopt_compression.buffer]=!0)})),t},$S.bufferView=function(e){const t={};if(xS.accessor(e,(function(e){D(e.bufferView)&&(t[e.bufferView]=!0)})),xS.shader(e,(function(e){D(e.bufferView)&&(t[e.bufferView]=!0)})),xS.image(e,(function(e){D(e.bufferView)&&(t[e.bufferView]=!0)})),ES(e,"KHR_draco_mesh_compression")&&xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){D(e.extensions)&&D(e.extensions.KHR_draco_mesh_compression)&&(t[e.extensions.KHR_draco_mesh_compression.bufferView]=!0)}))})),ES(e,"EXT_feature_metadata")){const n=e.extensions.EXT_feature_metadata.featureTables;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(D(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e];D(n.bufferView)&&(t[n.bufferView]=!0),D(n.arrayOffsetBufferView)&&(t[n.arrayOffsetBufferView]=!0),D(n.stringOffsetBufferView)&&(t[n.stringOffsetBufferView]=!0)}}}if(ES(e,"EXT_structural_metadata")){const n=e.extensions.EXT_structural_metadata.propertyTables;if(D(n)){const e=n.length;for(let i=0;i<e;++i){const e=n[i].properties;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];D(i.values)&&(t[i.values]=!0),D(i.arrayOffsets)&&(t[i.arrayOffsets]=!0),D(i.stringOffsets)&&(t[i.stringOffsets]=!0)}}}}return t},$S.image=function(e){const t={};return xS.texture(e,(function(e){D(e.source)&&(t[e.source]=!0),D(e.extensions)&&D(e.extensions.EXT_texture_webp)?t[e.extensions.EXT_texture_webp.source]=!0:D(e.extensions)&&D(e.extensions.KHR_texture_basisu)&&(t[e.extensions.KHR_texture_basisu.source]=!0)})),t},$S.mesh=function(e){const t={};return xS.node(e,(function(n){if(D(n.mesh&&D(e.meshes))){const i=e.meshes[n.mesh];D(i)&&D(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}})),t},$S.node=function(e){const t={};return xS.skin(e,(function(e){D(e.skeleton)&&(t[e.skeleton]=!0),xS.skinJoint(e,(function(e){t[e]=!0}))})),xS.animation(e,(function(e){xS.animationChannel(e,(function(e){D(e.target)&&D(e.target.node)&&(t[e.target.node]=!0)}))})),xS.technique(e,(function(e){xS.techniqueUniform(e,(function(e){D(e.node)&&(t[e.node]=!0)}))})),xS.node(e,(function(n,i){KS(e,i,t)||(t[i]=!0)})),t},$S.material=function(e){const t={};return xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){D(e.material)&&(t[e.material]=!0)}))})),t},$S.texture=function(e){const t={};if(xS.material(e,(function(e){WS(e,(function(e){t[e]=!0}))})),ES(e,"EXT_feature_metadata")){xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){const n=e.extensions;if(D(n)&&D(n.EXT_feature_metadata)){const e=n.EXT_feature_metadata.featureIdTextures;if(D(e)){const n=e.length;for(let i=0;i<n;++i){const n=e[i].featureIds.texture;t[n.index]=!0}}}}))}));const n=e.extensions.EXT_feature_metadata.featureTextures;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e].properties;if(D(i))for(const e in i)if(i.hasOwnProperty(e)){const n=i[e].texture;t[n.index]=!0}}}if(ES(e,"EXT_mesh_features")&&xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){const n=e.extensions;if(D(n)&&D(n.EXT_mesh_features)){const e=n.EXT_mesh_features.featureIds;if(D(e)){const n=e.length;for(let i=0;i<n;++i){const n=e[i];D(n.texture)&&(t[n.texture.index]=!0)}}}}))})),ES(e,"EXT_structural_metadata")){const n=e.extensions.EXT_structural_metadata.propertyTextures;if(D(n)){const e=n.length;for(let i=0;i<e;++i){const e=n[i].properties;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t[i.index]=!0}}}}return t},$S.sampler=function(e){const t={};return xS.texture(e,(function(e){D(e.sampler)&&(t[e.sampler]=!0)})),t};const tC={.8:function(e){D(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0","string"==typeof t.profile){const e=t.profile.split(" ");t.profile={api:e[0],version:e[1]}}else t.profile={};D(e.version)&&delete e.version;iC(e),oC(e),rC(e),sC(e),aC(e),D(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions);if(D(e.lights)){const t=M(e.extensions,{});e.extensions=t;const n=M(t.KHR_materials_common,{});t.KHR_materials_common=n,n.lights=e.lights,delete e.lights,FS(e,"KHR_materials_common")}},"1.0":function(e){e.asset=M(e.asset,{}),e.asset.version="2.0",iC(e),function(e){const t=e.animations;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const e=t[n],i=e.parameters;if(D(i)){const t=e.samplers;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];n.input=i[n.input],n.output=i[n.output]}delete e.parameters}}}(e),function(e){xS.node(e,(function(t,n){pC(t)&&fC(e,n)}))}(e),function(e){let t;const n={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let i;const o={},r=e.nodes;for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i=r[s].jointName,D(i)&&(o[i]=s));for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&D(n[s])){const t={},i=e[s];e[s]=cC(i,t),n[s]=t}for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(o[i]=n.nodes[o[i]]);D(e.scene)&&(e.scene=n.scenes[e.scene]);xS.bufferView(e,(function(e){D(e.buffer)&&(e.buffer=n.buffers[e.buffer])})),xS.accessor(e,(function(e){D(e.bufferView)&&(e.bufferView=n.bufferViews[e.bufferView])})),xS.shader(e,(function(e){const t=e.extensions;if(D(t)){const i=t.KHR_binary_glTF;D(i)&&(e.bufferView=n.bufferViews[i.bufferView],delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),xS.program(e,(function(e){D(e.vertexShader)&&(e.vertexShader=n.shaders[e.vertexShader]),D(e.fragmentShader)&&(e.fragmentShader=n.shaders[e.fragmentShader])})),xS.technique(e,(function(e){D(e.program)&&(e.program=n.programs[e.program]),xS.techniqueParameter(e,(function(e){D(e.node)&&(e.node=n.nodes[e.node]);const t=e.value;"string"==typeof t&&(e.value={index:n.textures[t]})}))})),xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){D(e.indices)&&(e.indices=n.accessors[e.indices]),xS.meshPrimitiveAttribute(e,(function(t,i){e.attributes[i]=n.accessors[t]})),D(e.material)&&(e.material=n.materials[e.material])}))})),xS.node(e,(function(i){let o=i.children;if(D(o)){const e=o.length;for(t=0;t<e;++t)o[t]=n.nodes[o[t]]}if(D(i.meshes)){const r=i.meshes,s=r.length;if(s>0)for(i.mesh=n.meshes[r[0]],t=1;t<s;++t){const s={mesh:n.meshes[r[t]]},a=wS(e.nodes,s);D(o)||(o=[],i.children=o),o.push(a)}delete i.meshes}if(D(i.camera)&&(i.camera=n.cameras[i.camera]),D(i.skin)&&(i.skin=n.skins[i.skin]),D(i.skeletons)){const t=i.skeletons;if(t.length>0&&D(i.skin)){e.skins[i.skin].skeleton=n.nodes[t[0]]}delete i.skeletons}D(i.jointName)&&delete i.jointName})),xS.skin(e,(function(e){D(e.inverseBindMatrices)&&(e.inverseBindMatrices=n.accessors[e.inverseBindMatrices]);const i=e.jointNames;if(D(i)){const n=[],r=i.length;for(t=0;t<r;++t)n[t]=o[i[t]];e.joints=n,delete e.jointNames}})),xS.scene(e,(function(e){const i=e.nodes;if(D(i)){const e=i.length;for(t=0;t<e;++t)i[t]=n.nodes[i[t]]}})),xS.animation(e,(function(e){const t={};e.samplers=cC(e.samplers,t),xS.animationSampler(e,(function(e){e.input=n.accessors[e.input],e.output=n.accessors[e.output]})),xS.animationChannel(e,(function(e){e.sampler=t[e.sampler];const i=e.target;D(i)&&(i.node=n.nodes[i.id],delete i.id)}))})),xS.material(e,(function(e){D(e.technique)&&(e.technique=n.techniques[e.technique]),xS.materialValue(e,(function(t,i){"string"==typeof t&&(e.values[i]={index:n.textures[t]})}));const t=e.extensions;if(D(t)){const e=t.KHR_materials_common;D(e)&&D(e.values)&&xS.materialValue(e,(function(t,i){"string"==typeof t&&(e.values[i]={index:n.textures[t]})}))}})),xS.image(e,(function(e){const t=e.extensions;if(D(t)){const i=t.KHR_binary_glTF;D(i)&&(e.bufferView=n.bufferViews[i.bufferView],e.mimeType=i.mimeType,delete t.KHR_binary_glTF),0===Object.keys(t).length&&delete e.extensions}})),xS.texture(e,(function(e){D(e.sampler)&&(e.sampler=n.samplers[e.sampler]),D(e.source)&&(e.source=n.images[e.source])}))}(e),function(e){xS.animation(e,(function(e){xS.animationSampler(e,(function(e){delete e.name}))}))}(e),function(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}(e),function(e){const t=e.extensionsUsed;if(e.extensionsRequired=M(e.extensionsRequired,[]),D(t)){const n=t.length;for(let i=0;i<n;++i){const n=t[i];D(lC[n])&&e.extensionsRequired.push(n)}}}(e),function(e){xS.buffer(e,(function(e){D(e.byteLength)||(e.byteLength=e.extras._pipeline.source.length)})),xS.accessor(e,(function(t){const n=t.bufferView;if(D(n)){const i=e.bufferViews[n],o=hC(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(M(i.byteLength,0),r)}}))}(e),function(e){let t,n,i;const o=e.bufferViews,r={};xS.accessorContainingVertexAttributeData(e,(function(t){const n=e.accessors[t];D(n.bufferView)&&(r[n.bufferView]=!0)}));const s={};xS.accessor(e,(function(e){D(e.bufferView)&&(s[e.bufferView]=M(s[e.bufferView],[]),s[e.bufferView].push(e))}));for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];const c=s[a];c.sort((function(e,t){return e.byteOffset-t.byteOffset}));let l=0,u=0;const d=c.length;for(t=0;t<d;++t){let s=c[t];const h=hC(e,s),p=s.byteOffset,f=s.count*h;delete s.byteStride;const m=t<d-1;if(h!==(m?hC(e,c[t+1]):void 0)){const e=ti(i,!0);r[a]&&(e.byteStride=h),e.byteOffset+=l,e.byteLength=p+f-l;const d=wS(o,e);for(n=u;n<=t;++n)s=c[n],s.bufferView=d,s.byteOffset=s.byteOffset-l;l=m?c[t+1].byteOffset:void 0,u=t+1}}}YS(e,["accessor","bufferView","buffer"])}(e),function(e){xS.accessorWithSemantic(e,"POSITION",(function(t){const n=e.accessors[t];if(!D(n.min)||!D(n.max)){const t=zS(e,n);n.min=t.min,n.max=t.max}}))}(e),function(e){xS.animation(e,(function(t){xS.animationSampler(t,(function(t){const n=e.accessors[t.input];if(!D(n.min)||!D(n.max)){const t=zS(e,n);n.min=t.min,n.max=t.max}}))}))}(e),function(e){xS.accessor(e,(function(t){if(D(t.min)||D(t.max)){const n=zS(e,t);D(t.min)&&(t.min=n.min),D(t.max)&&(t.max=n.max)}}))}(e),function(e){xS.buffer(e,(function(e){delete e.type}))}(e),function(e){xS.texture(e,(function(e){delete e.format,delete e.internalFormat,delete e.target,delete e.type}))}(e),function(e){xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){xS.meshPrimitiveAttribute(e,(function(t,n){"TEXCOORD"===n?e.attributes.TEXCOORD_0=t:"COLOR"===n&&(e.attributes.COLOR_0=t)})),delete e.attributes.TEXCOORD,delete e.attributes.COLOR}))})),xS.technique(e,(function(e){xS.techniqueParameter(e,(function(e){const t=e.semantic;D(t)&&("TEXCOORD"===t?e.semantic="TEXCOORD_0":"COLOR"===t&&(e.semantic="COLOR_0"))}))}))}(e),function(e){const t={};xS.mesh(e,(function(e){xS.meshPrimitive(e,(function(e){xS.meshPrimitiveAttribute(e,(function(e,n){if("_"!==n.charAt(0)){const e=n.search(/_[0-9]+/g);let i,o=n,r="_0";e>=0&&(o=n.substring(0,e),r=n.substring(e));const s=dC[o];D(s)?(i=s+r,t[n]=i):D(uC[o])||(i=`_${n}`,t[n]=i)}}));for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=e.attributes[n];D(o)&&(delete e.attributes[n],e.attributes[i]=o)}}))})),xS.technique(e,(function(e){xS.techniqueParameter(e,(function(e){const n=t[e.semantic];D(n)&&(e.semantic=n)}))}))}(e),function(e){let t;xS.accessorWithSemantic(e,"JOINTS_0",(function(n){const i=e.accessors[n];t=i.componentType,t===Me.BYTE?ZS(e,i,Ca.UNSIGNED_BYTE):t!==Me.UNSIGNED_BYTE&&t!==Me.UNSIGNED_SHORT&&ZS(e,i,Ca.UNSIGNED_SHORT)})),xS.accessorWithSemantic(e,"WEIGHTS_0",(function(n){const i=e.accessors[n];t=i.componentType,t===Me.BYTE?ZS(e,i,Ca.UNSIGNED_BYTE):t===Me.SHORT&&ZS(e,i,Ca.UNSIGNED_SHORT)}))}(e),function(e){xS.camera(e,(function(e){const t=e.perspective;if(D(t)){const e=t.aspectRatio;D(e)&&0===e&&delete t.aspectRatio;const n=t.yfov;D(n)&&0===n&&(t.yfov=1)}}))}(e),function(e){const t={},n={};D(e.techniques)&&(xS.technique(e,(function(e,i){const o=e.states;if(D(o)){const r=n[i]={};if(VS(o,Me.BLEND)){r.alphaMode="BLEND";const e=o.functions;D(e)&&(D(e.blendEquationSeparate)||D(e.blendFuncSeparate))&&(t[i]={blendEquation:M(e.blendEquationSeparate,US),blendFactors:GS(e.blendFuncSeparate,kS)})}VS(o,Me.CULL_FACE)||(r.doubleSided=!0),delete e.states}})),Object.keys(t).length>0&&(D(e.extensions)||(e.extensions={}),FS(e,"KHR_blend")),xS.material(e,(function(e){if(D(e.technique)){const i=n[e.technique];xS.objectLegacy(i,(function(t,n){e[n]=t}));const o=t[e.technique];D(o)&&(D(e.extensions)||(e.extensions={}),e.extensions.KHR_blend=o)}})))}(e),jS(e),function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];Array.isArray(n)&&0===n.length&&delete e[t]}xS.node(e,(function(e){D(e.children)&&0===e.children.length&&delete e.children}))}(e)},"2.0":void 0};function nC(e,t){const n=(t=M(t,M.EMPTY_OBJECT)).targetVersion;let i=e.version;e.asset=M(e.asset,{version:"1.0"}),e.asset.version=M(e.asset.version,"1.0"),i=M(i,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(tC,i)||(D(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(tC,i)||(i="1.0"));let o=tC[i];for(;D(o)&&i!==n;)o(e,t),i=e.asset.version,o=tC[i];return t.keepLegacyExtensions||(function(e,t){t=M(t,M.EMPTY_OBJECT);const n=M(t.baseColorTextureNames,mC),i=M(t.baseColorFactorNames,_C);xS.material(e,(function(e){xS.materialValue(e,(function(t,o){-1!==n.indexOf(o)&&yC(t)?(gC(e),e.pbrMetallicRoughness.baseColorTexture=t):-1!==i.indexOf(o)&&bC(t)&&(gC(e),e.pbrMetallicRoughness.baseColorFactor=vC(t))}))})),JS(e,"KHR_techniques_webgl"),JS(e,"KHR_blend")}(e,t),function(e){xS.material(e,(function(t){const n=M(t.extensions,M.EMPTY_OBJECT).KHR_materials_common;if(!D(n))return;const i=M(n.values,{}),o=i.ambient,r=i.diffuse,s=i.emission,a=i.transparency,c=n.doubleSided,l=n.transparent;gC(t);"CONSTANT"===n.technique?(FS(e,"KHR_materials_unlit"),t.extensions=D(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={},AC(t,s),AC(t,o)):(AC(t,r),TC(t,o),TC(t,s)),D(c)&&(t.doubleSided=c),D(a)&&(D(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=a:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,a]),D(l)&&(t.alphaMode=l?"BLEND":"OPAQUE")})),JS(e,"KHR_materials_common")}(e)),e}function iC(e){const t=e.materials;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const e=t[n],i=e.instanceTechnique;D(i)&&(e.technique=i.technique,e.values=i.values,delete e.instanceTechnique)}}function oC(e){const t=e.meshes;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const e=t[n].primitives;if(D(e)){const t=e.length;for(let n=0;n<t;++n){const t=e[n],i=M(t.primitive,Me.TRIANGLES);t.mode=M(t.mode,i),delete t.primitive}}}}function rC(e){const t=e.nodes,n=new H,i=new _o;for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];if(D(e.rotation)){const t=e.rotation;H.fromArray(t,0,n),_o.fromAxisAngle(n,t[3],i),e.rotation=[i.x,i.y,i.z,i.w]}const r=e.instanceSkin;D(r)&&(e.skeletons=r.skeletons,e.skin=r.skin,e.meshes=r.meshes,delete e.instanceSkin)}}function sC(e){const t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new H,a=new _o;for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const e=t[c],l=e.channels,u=e.parameters,d=e.samplers;if(D(l)){const e=l.length;for(let t=0;t<e;++t){const e=l[t];if("rotation"===e.target.path){const t=u[d[e.sampler].output];if(D(r[t]))continue;r[t]=!0;const c=n[t],l=i[c.bufferView],h=o[l.buffer].extras._pipeline.source,p=h.byteOffset+l.byteOffset+c.byteOffset,f=c.componentType,m=c.count,_=SS(c.type),g=c.count*_,y=Ca.createArrayBufferView(f,h.buffer,p,g);for(let e=0;e<m;e++){const t=e*_;H.unpack(y,t,s);const n=y[t+3];_o.fromAxisAngle(s,n,a),_o.pack(a,y,t)}}}}}}function aC(e){const t=e.techniques;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const e=t[n],i=e.passes;if(D(i)){const t=M(e.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(i,t)){const n=i[t],o=n.instanceProgram;e.attributes=M(e.attributes,o.attributes),e.program=M(e.program,o.program),e.uniforms=M(e.uniforms,o.uniforms),e.states=M(e.states,n.states)}delete e.passes,delete e.pass}}}function cC(e,t){const n=[];for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=e[i];t[i]=n.length,n.push(o),D(o.name)||(o.name=i)}return n}const lC={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};const uC={POSITION:!0,NORMAL:!0,TANGENT:!0},dC={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function hC(e,t){return D(t.byteStride)&&0!==t.byteStride?t.byteStride:CS(e,t)}function pC(e){return(!D(e.children)||0===e.children.length)&&(!D(e.meshes)||0===e.meshes.length)&&!D(e.camera)&&!D(e.skin)&&!D(e.skeletons)&&!D(e.jointName)&&(!D(e.translation)||H.fromArray(e.translation).equals(H.ZERO))&&(!D(e.scale)||H.fromArray(e.scale).equals(new H(1,1,1)))&&(!D(e.rotation)||K.fromArray(e.rotation).equals(new K(0,0,0,1)))&&(!D(e.matrix)||ve.fromColumnMajorArray(e.matrix).equals(ve.IDENTITY))&&!D(e.extensions)&&!D(e.extras)}function fC(e,t){xS.scene(e,(function(e){const n=e.nodes;if(D(n)){for(let e=n.length;e>=0;--e)if(n[e]===t)return void n.splice(e,1)}})),xS.node(e,(function(n,i){if(D(n.children)){const o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),pC(n)&&fC(e,i))}})),delete e.nodes[t]}const mC=["u_tex","u_diffuse","u_emission","u_diffuse_tex"],_C=["u_diffuse","u_diffuse_mat"];function gC(e){e.pbrMetallicRoughness=D(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function yC(e){return D(e.index)}function bC(e){return Array.isArray(e)&&4===e.length}function vC(e){const t=new Array(4);t[3]=e[3];for(let n=0;n<3;n++){const i=e[n];t[n]=i<=.04045?.07739938080495357*e[n]:Math.pow(.9478672985781991*(i+.055),2.4)}return t}function AC(e,t){D(t)&&(bC(t)?e.pbrMetallicRoughness.baseColorFactor=vC(t):yC(t)&&(e.pbrMetallicRoughness.baseColorTexture=t))}function TC(e,t){D(t)&&(bC(t)?e.emissiveFactor=t.slice(0,3):yC(t)&&(e.emissiveTexture=t))}const wC={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};wC.hasSetIndex=function(e){switch(L.typeOf.string("semantic",e),e){case wC.POSITION:case wC.NORMAL:case wC.TANGENT:return!1;case wC.TEXCOORD:case wC.COLOR:case wC.JOINTS:case wC.WEIGHTS:case wC.FEATURE_ID:return!0;default:throw new P("semantic is not a valid value.")}},wC.fromGltfSemantic=function(e){L.typeOf.string("gltfSemantic",e);let t=e;const n=/^(\w+)_\d+$/.exec(e);switch(null!==n&&(t=n[1]),t){case"POSITION":return wC.POSITION;case"NORMAL":return wC.NORMAL;case"TANGENT":return wC.TANGENT;case"TEXCOORD":return wC.TEXCOORD;case"COLOR":return wC.COLOR;case"JOINTS":return wC.JOINTS;case"WEIGHTS":return wC.WEIGHTS;case"_FEATURE_ID":return wC.FEATURE_ID}},wC.fromPntsSemantic=function(e){switch(L.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return wC.POSITION;case"RGBA":case"RGB":case"RGB565":return wC.COLOR;case"NORMAL":case"NORMAL_OCT16P":return wC.NORMAL;case"BATCH_ID":return wC.FEATURE_ID;default:throw new P("pntsSemantic is not a valid value.")}},wC.getGlslType=function(e){switch(L.typeOf.string("semantic",e),e){case wC.POSITION:case wC.NORMAL:case wC.TANGENT:return"vec3";case wC.TEXCOORD:return"vec2";case wC.COLOR:return"vec4";case wC.JOINTS:return"ivec4";case wC.WEIGHTS:return"vec4";case wC.FEATURE_ID:return"int";default:throw new P("semantic is not a valid value.")}},wC.getVariableName=function(e,t){L.typeOf.string("semantic",e);let n=function(e){switch(e){case wC.POSITION:return"positionMC";case wC.NORMAL:return"normalMC";case wC.TANGENT:return"tangentMC";case wC.TEXCOORD:return"texCoord";case wC.COLOR:return"color";case wC.JOINTS:return"joints";case wC.WEIGHTS:return"weights";case wC.FEATURE_ID:return"featureId";default:throw new P("semantic is not a valid value.")}}(e);return D(t)&&(n+=`_${t}`),n};const EC=Object.freeze(wC);function xC(){}xC.getError=function(e,t,n){let i=`Failed to load ${e}: ${t}`;D(n)&&D(n.message)&&(i+=`\n${n.message}`);const o=new be(i);return D(n)&&(o.stack=`Original stack:\n${n.stack}\nHandler stack:\n${o.stack}`),o},xC.getNodeTransform=function(e){return D(e.matrix)?e.matrix:ve.fromTranslationQuaternionRotationScale(D(e.translation)?e.translation:H.ZERO,D(e.rotation)?e.rotation:_o.IDENTITY,D(e.scale)?e.scale:H.ONE)},xC.getAttributeBySemantic=function(e,t,n){const i=e.attributes,o=i.length;for(let r=0;r<o;++r){const e=i[r],o=!D(n)||e.setIndex===n;if(e.semantic===t&&o)return e}},xC.getAttributeByName=function(e,t){const n=e.attributes,i=n.length;for(let o=0;o<i;++o){const e=n[o];if(e.name===t)return e}},xC.getFeatureIdsByLabel=function(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.positionalLabel===t||i.label===t)return i}},xC.hasQuantizedAttributes=function(e){if(!D(e))return!1;for(let t=0;t<e.length;t++){if(D(e[t].quantization))return!0}return!1},xC.getAttributeInfo=function(e){const t=e.semantic,n=e.setIndex;let i,o=!1;D(t)?(i=EC.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());const r=/^color_\d+$/.test(i),s=e.type;let a=Zf.getGlslType(s);r&&(a="vec4");const c=D(e.quantization);let l;return c&&(l=r?"vec4":Zf.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:l}};const SC=new H,CC=new H;xC.getPositionMinMax=function(e,t,n){const i=xC.getAttributeBySemantic(e,"POSITION");let o=i.max,r=i.min;return D(n)&&D(t)&&(r=H.add(r,t,CC),o=H.add(o,n,SC)),{min:r,max:o}},xC.getAxisCorrectionMatrix=function(e,t,n){return n=ve.clone(ve.IDENTITY,n),e===gw.Y?n=ve.clone(gw.Y_UP_TO_Z_UP,n):e===gw.X&&(n=ve.clone(gw.X_UP_TO_Z_UP,n)),t===gw.Z&&(n=ve.multiplyTransformation(n,gw.Z_UP_TO_X_UP,n)),n};const IC=new re;function OC(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltfResource",n),L.typeOf.object("options.baseResource",i),this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=o,this._gltfJson=r,this._cacheKey=s,this._gltf=void 0,this._bufferLoaders=[],this._state=rS.UNLOADED,this._promise=void 0}function DC(e,t){e.unload(),e._state=rS.FAILED;const n=`Failed to load glTF: ${e._gltfResource.url}`;throw e.getError(n,t)}async function PC(e,t){try{DS(t),await function(e){const t=[];return xS.buffer(e,(function(e){const n=e.uri;!D(e.extras._pipeline.source)&&D(n)&&hi(n)&&(delete e.uri,t.push(Bi.fetchArrayBuffer(n).then((function(t){e.extras._pipeline.source=new Uint8Array(t)}))))})),Promise.all(t)}(t),await async function(e,t){if(D(t.asset)&&"2.0"===t.asset.version&&!ES(t,"KHR_techniques_webgl")&&!ES(t,"KHR_materials_common"))return Promise.resolve();const n=[];xS.buffer(t,(function(t){if(!D(t.extras._pipeline.source)&&D(t.uri)){const i=e._baseResource.getDerivedResource({url:t.uri}),o=e._resourceCache.getExternalBufferLoader({resource:i});e._bufferLoaders.push(o),n.push(o.load().then((function(){o.isDestroyed()||(t.extras._pipeline.source=o.typedArray)})))}})),await Promise.all(n),nC(t)}(e,t),IS(t),await function(e,t){const n=[];return xS.buffer(t,(function(t,i){const o=t.extras._pipeline.source;if(D(o)&&!D(t.uri)){const t=e._resourceCache.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:i,typedArray:o});e._bufferLoaders.push(t),n.push(t.load())}})),Promise.all(n)}(e,t),function(e){xS.shader(e,(function(e){MS(e)})),xS.buffer(e,(function(e){MS(e)})),xS.image(e,(function(e){MS(e)})),MS(e)}(t);const n=t.asset.version;if("1.0"!==n&&"2.0"!==n)throw new be(`Unsupported glTF version: ${n}`);const i=t.extensionsRequired;return D(i)&&xC.checkSupportedExtensions(i),e._gltf=t,e._state=rS.READY,e}catch(n){if(e.isDestroyed())return;DC(e,n)}}async function NC(e,t){let n;try{n="glTF"===Aw(t)?RS(t):Ew(t)}catch(i){if(e.isDestroyed())return;DC(e,i)}return PC(e,n)}xC.getCullFace=function(e,t){if(!Vr.isTriangles(t))return ph.BACK;const n=ve.getMatrix3(e,IC);return re.determinant(n)<0?ph.FRONT:ph.BACK},xC.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t},xC.supportedExtensions={AGI_articulations:!0,CESIUM_primitive_outline:!0,CESIUM_RTC:!0,EXT_feature_metadata:!0,EXT_instance_features:!0,EXT_mesh_features:!0,EXT_mesh_gpu_instancing:!0,EXT_meshopt_compression:!0,EXT_structural_metadata:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_draco_mesh_compression:!0,KHR_techniques_webgl:!0,KHR_materials_common:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_materials_unlit:!0,KHR_mesh_quantization:!0,KHR_texture_basisu:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0},xC.checkSupportedExtensions=function(e){const t=e.length;for(let n=0;n<t;n++){const t=e[n];if(!xC.supportedExtensions[t])throw new be(`Unsupported glTF Extension: ${t}`)}},D(Object.create)&&(OC.prototype=Object.create(oS.prototype),OC.prototype.constructor=OC),Object.defineProperties(OC.prototype,{cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}}),OC.prototype.load=async function(){return D(this._promise)?this._promise:(this._state=rS.LOADING,D(this._gltfJson)?(this._promise=PC(this,this._gltfJson),this._promise):D(this._typedArray)?(this._promise=NC(this,this._typedArray),this._promise):(this._promise=async function(e){let t;try{const n=await e._fetchGltf();if(e.isDestroyed())return;t=new Uint8Array(n)}catch(n){if(e.isDestroyed())return;DC(e,n)}return NC(e,t)}(this),this._promise))},OC.prototype.unload=function(){const e=this._bufferLoaders,t=e.length;for(let n=0;n<t;++n)e[n]=!e[n].isDestroyed()&&this._resourceCache.unload(e[n]);this._bufferLoaders.length=0,this._gltf=void 0},OC.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const RC=Object.freeze({OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"}),LC={};function MC(){this.credits=[]}function FC(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=K.clone(FC.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=FC.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=FC.DEFAULT_ROUGHNESS_FACTOR}function BC(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=K.clone(BC.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=H.clone(BC.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=BC.DEFAULT_GLOSSINESS_FACTOR}function zC(){this.metallicRoughness=new FC,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=H.clone(zC.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=RC.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}FC.DEFAULT_BASE_COLOR_FACTOR=K.ONE,FC.DEFAULT_METALLIC_FACTOR=1,FC.DEFAULT_ROUGHNESS_FACTOR=1,BC.DEFAULT_DIFFUSE_FACTOR=K.ONE,BC.DEFAULT_SPECULAR_FACTOR=H.ONE,BC.DEFAULT_GLOSSINESS_FACTOR=1,zC.DEFAULT_EMISSIVE_FACTOR=H.ZERO,LC.Quantization=function(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0},LC.Attribute=function(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.typedArray=void 0,this.buffer=void 0,this.byteOffset=0,this.byteStride=void 0},LC.Indices=function(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0},LC.FeatureIdAttribute=function(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.setIndex=void 0,this.label=void 0,this.positionalLabel=void 0},LC.FeatureIdTexture=function(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.textureReader=void 0,this.label=void 0,this.positionalLabel=void 0},LC.FeatureIdImplicitRange=function(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.offset=0,this.repeat=void 0,this.label=void 0,this.positionalLabel=void 0},LC.MorphTarget=function(){this.attributes=[]},LC.Primitive=function(){this.attributes=[],this.morphTargets=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIds=[],this.propertyTextureIds=[],this.propertyAttributeIds=[],this.outlineCoordinates=void 0},LC.Instances=function(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1},LC.Skin=function(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]},LC.Node=function(){this.name=void 0,this.index=void 0,this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0,this.morphWeights=[],this.articulationName=void 0},LC.Scene=function(){this.nodes=[]},LC.AnimatedPropertyType=Object.freeze({TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"}),LC.AnimationSampler=function(){this.input=[],this.interpolation=void 0,this.output=[]},LC.AnimationTarget=function(){this.node=void 0,this.path=void 0},LC.AnimationChannel=function(){this.sampler=void 0,this.target=void 0},LC.Animation=function(){this.name=void 0,this.samplers=[],this.channels=[]},LC.ArticulationStage=function(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0},LC.Articulation=function(){this.name=void 0,this.stages=[]},LC.Asset=MC,LC.Components=function(){this.asset=new MC,this.scene=void 0,this.nodes=[],this.skins=[],this.animations=[],this.articulations=[],this.structuralMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=ve.clone(ve.IDENTITY)},LC.TextureReader=function(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=re.clone(re.IDENTITY),this.channels=void 0},LC.MetallicRoughness=FC,LC.SpecularGlossiness=BC,LC.Material=zC;const UC=LC,kC={getImageIdFromTexture:function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.textureId,i=e.supportedImageFormats;L.typeOf.object("options.gltf",t),L.typeOf.number("options.textureId",n),L.typeOf.object("options.supportedImageFormats",i);const o=t.textures[n],r=o.extensions;if(D(r)){if(i.webp&&D(r.EXT_texture_webp))return r.EXT_texture_webp.source;if(i.basis&&D(r.KHR_texture_basisu))return r.KHR_texture_basisu.source}return o.source},createSampler:function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.textureInfo,i=M(e.compressedTextureNoMipmap,!1);L.typeOf.object("options.gltf",t),L.typeOf.object("options.textureInfo",n);let o=lc.REPEAT,r=lc.REPEAT,s=ac.LINEAR,a=rc.LINEAR;const c=n.index,l=t.textures[c].sampler;if(D(l)){const e=t.samplers[l];o=M(e.wrapS,o),r=M(e.wrapT,r),s=M(e.minFilter,s),a=M(e.magFilter,a)}return i&&s!==ac.LINEAR&&s!==ac.NEAREST&&(s=s===ac.NEAREST_MIPMAP_NEAREST||s===ac.NEAREST_MIPMAP_LINEAR?ac.NEAREST:ac.LINEAR),new uc({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})}},VC=new kt(1,1);kC.createModelTextureReader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).textureInfo,n=e.channels,i=e.texture;L.typeOf.object("options.textureInfo",t);let o,r=M(t.texCoord,0);const s=M(t.extensions,M.EMPTY_OBJECT).KHR_texture_transform;if(D(s)){r=M(s.texCoord,r);const e=D(s.offset)?kt.unpack(s.offset):kt.ZERO;let t=M(s.rotation,0);const n=D(s.scale)?kt.unpack(s.scale):VC;t=-t,o=new re(Math.cos(t)*n.x,-Math.sin(t)*n.y,e.x,Math.sin(t)*n.x,Math.cos(t)*n.y,e.y,0,0,1)}const a=new UC.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=r,a.transform=o,a.channels=n,a};const HC=kC;function GC(e){const t=document.createElement("canvas");t.width=V.nextPowerOfTwo(e.width),t.height=V.nextPowerOfTwo(e.height);return t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function jC(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.textureInfo,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.cacheKey,c=M(e.asynchronous,!0);L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltf",n),L.typeOf.object("options.textureInfo",i),L.typeOf.object("options.gltfResource",o),L.typeOf.object("options.baseResource",r),L.typeOf.object("options.supportedImageFormats",s);const l=i.index,u=HC.getImageIdFromTexture({gltf:n,textureId:l,supportedImageFormats:s});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=u,this._gltfResource=o,this._baseResource=r,this._cacheKey=a,this._asynchronous=c,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=rS.UNLOADED,this._promise=void 0}D(Object.create)&&(jC.prototype=Object.create(oS.prototype),jC.prototype.constructor=jC),Object.defineProperties(jC.prototype,{cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});const WC=new qC;function qC(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}function YC(e,t,n,i,o){const r=n.internalFormat;let s=!1;is.isCompressedFormat(r)&&!D(i)&&(s=!0);const a=HC.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:s}),c=a.minificationFilter,l=a.wrapS,u=a.wrapT,d=c===ac.NEAREST_MIPMAP_NEAREST||c===ac.NEAREST_MIPMAP_LINEAR||c===ac.LINEAR_MIPMAP_NEAREST||c===ac.LINEAR_MIPMAP_LINEAR,h=!D(r)&&d,p=h||l===lc.REPEAT||l===lc.MIRRORED_REPEAT||u===lc.REPEAT||u===lc.MIRRORED_REPEAT,f=!V.isPowerOfTwo(n.width)||!V.isPowerOfTwo(n.height),m=p&&f;let _;return D(r)?(!o.webgl2&&is.isCompressedFormat(r),_=Sc.create({context:o,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:a})):(m&&(n=GC(n)),_=Sc.create({context:o,source:n,sampler:a,flipY:!1,skipColorSpaceConversion:!0})),h&&_.generateMipmap(),_}function XC(e){const t=(e=M(e,M.EMPTY_OBJECT)).resourceCache,n=e.gltf,i=e.gltfResource,o=e.baseResource,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,l=e.cacheKey,u=M(e.asynchronous,!0),d=M(e.loadBuffer,!1),h=M(e.loadTypedArray,!1);if(L.typeOf.func("options.resourceCache",t),L.typeOf.object("options.gltf",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o),!d&&!h)throw new P("At least one of loadBuffer and loadTypedArray must be true.");const p=D(r),f=QC(s,a),m=D(a),_=D(c);if(p===f)throw new P("One of options.bufferViewId and options.draco must be defined.");if(f&&!m)throw new P("When options.draco is defined options.attributeSemantic must also be defined.");if(f&&!_)throw new P("When options.draco is defined options.accessorId must also be defined.");f&&(L.typeOf.object("options.draco",s),L.typeOf.string("options.attributeSemantic",a),L.typeOf.number("options.accessorId",c)),this._resourceCache=t,this._gltfResource=i,this._baseResource=o,this._gltf=n,this._bufferViewId=r,this._draco=s,this._attributeSemantic=a,this._accessorId=c,this._cacheKey=l,this._asynchronous=u,this._loadBuffer=d,this._loadTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=rS.UNLOADED,this._promise=void 0}function QC(e,t){return D(e)&&D(e.attributes)&&D(e.attributes[t])}function $C(e){e._state=rS.PROCESSING;const t=e._dracoLoader.decodedData.vertexAttributes[e._attributeSemantic],n=e._accessorId,i=e._gltf.accessors[n].type,o=t.array,r=t.data.quantization;D(r)&&(e._quantization=function(e,t,n,i){const o=(1<<e.quantizationBits)-1,r=1/o,s=new UC.Quantization;if(s.componentDatatype=t,s.octEncoded=e.octEncoded,s.octEncodedZXY=!0,s.type=i,s.octEncoded)s.type=Zf.VEC2,s.normalizationRange=o;else{const t=Zf.getMathType(i);if(t===Number){const t=e.range;s.quantizedVolumeOffset=e.minValues[0],s.quantizedVolumeDimensions=t,s.normalizationRange=o,s.quantizedVolumeStepSize=t*r}else{s.quantizedVolumeOffset=t.unpack(e.minValues),s.normalizationRange=t.unpack(new Array(n).fill(o));const i=new Array(n).fill(e.range);s.quantizedVolumeDimensions=t.unpack(i);const a=i.map((function(e){return e*r}));s.quantizedVolumeStepSize=t.unpack(a)}}return s}(r,t.data.componentDatatype,t.data.componentsPerAttribute,i)),e._typedArray=new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}function KC(e,t){e.unload(),e._state=rS.FAILED;throw e.getError("Failed to load vertex buffer",t)}function ZC(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}function JC(e,t){const n=Ye.createVertexBuffer({typedArray:e,context:t,usage:qe.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}jC.prototype.load=async function(){return D(this._promise)||(this._state=rS.LOADING,this._promise=async function(e){const t=e._resourceCache;try{const n=t.getImageLoader({gltf:e._gltf,imageId:e._imageId,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._imageLoader=n,await n.load(),e.isDestroyed())return;return e._image=n.image,e._mipLevels=n.mipLevels,e._state=rS.LOADED,e}catch(n){if(e.isDestroyed())return;e.unload(),e._state=rS.FAILED;const t="Failed to load texture";throw e.getError(t,n)}}(this)),this._promise},qC.prototype.set=function(e,t,n,i,o){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=o},qC.prototype.execute=function(){this.texture=YC(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)},jC.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===rS.READY)return!0;if(this._state!==rS.LOADED&&this._state!==rS.PROCESSING)return!1;if(D(this._texture))return!1;if(!D(this._image))return!1;let t;if(this._state=rS.PROCESSING,this._asynchronous){const n=WC;n.set(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);if(!e.jobScheduler.execute(n,gS.TEXTURE))return;t=n.texture}else t=YC(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);return this.unload(),this._texture=t,this._state=rS.READY,this._resourceCache.statistics.addTextureLoader(this),!0},jC.prototype.unload=function(){D(this._texture)&&this._texture.destroy(),D(this._imageLoader)&&!this._imageLoader.isDestroyed()&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0},D(Object.create)&&(XC.prototype=Object.create(oS.prototype),XC.prototype.constructor=XC),Object.defineProperties(XC.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}}),XC.prototype.load=async function(){return D(this._promise)?this._promise:QC(this._draco,this._attributeSemantic)?(this._promise=async function(e){e._state=rS.LOADING;const t=e._resourceCache;try{const n=t.getDracoLoader({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._dracoLoader=n,await n.load(),e.isDestroyed())return;return e._state=rS.LOADED,e}catch{if(e.isDestroyed())return;KC(e)}}(this),this._promise):(this._promise=async function(e){e._state=rS.LOADING;const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;return e._typedArray=n.typedArray,e._state=rS.PROCESSING,e}catch(n){if(e.isDestroyed())return;KC(e,n)}}(this),this._promise)},ZC.prototype.set=function(e,t){this.typedArray=e,this.context=t},ZC.prototype.execute=function(){this.buffer=JC(this.typedArray,this.context)};const eI=new ZC;function tI(e){const t=(e=M(e,M.EMPTY_OBJECT)).id;L.typeOf.string("options.id",t);const n=M(e.properties,{}),i={};for(const o in n)if(n.hasOwnProperty(o)){const e=n[o];D(e.semantic)&&(i[e.semantic]=e)}this._id=t,this._name=e.name,this._description=e.description,this._properties=n,this._propertiesBySemantic=i,this._extras=ti(e.extras,!0),this._extensions=ti(e.extensions,!0)}function nI(e){const t=(e=M(e,M.EMPTY_OBJECT)).value,n=e.name;L.typeOf.number("options.value",t),L.typeOf.string("options.name",n),this._value=t,this._name=n,this._description=e.description,this._extras=ti(e.extras,!0),this._extensions=ti(e.extensions,!0)}function iI(e){const t=(e=M(e,M.EMPTY_OBJECT)).id,n=e.values;L.typeOf.string("options.id",t),L.defined("options.values",n);const i={},o={},r=n.length;for(let a=0;a<r;++a){const e=n[a];i[e.value]=e.name,o[e.name]=e.value}const s=M(e.valueType,Ux.UINT16);this._values=n,this._namesByValue=i,this._valuesByName=o,this._valueType=s,this._id=t,this._name=e.name,this._description=e.description,this._extras=ti(e.extras,!0),this._extensions=ti(e.extensions,!0)}function oI(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.classes,{}),n=M(e.enums,{});this._classes=t,this._enums=n,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=ti(e.extras,!0),this._extensions=ti(e.extensions,!0)}function rI(e){const t=(e=M(e,M.EMPTY_OBJECT)).schema,n=e.resource,i=e.cacheKey;if(D(t)===D(n))throw new P("One of options.schema and options.resource must be defined.");this._schema=D(t)?oI.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=rS.UNLOADED,this._promise=void 0}XC.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===rS.READY)return!0;if(this._state!==rS.LOADED&&this._state!==rS.PROCESSING)return!1;if(D(this._dracoLoader)){try{if(!this._dracoLoader.process(e))return!1}catch(i){KC(this,i)}$C(this)}let t;const n=this._typedArray;if(this._loadBuffer&&this._asynchronous){const i=eI;i.set(n,e.context);if(!e.jobScheduler.execute(i,gS.BUFFER))return!1;t=i.buffer}else this._loadBuffer&&(t=JC(n,e.context));return this.unload(),this._buffer=t,this._typedArray=this._loadTypedArray?n:void 0,this._state=rS.READY,this._resourceCache.statistics.addGeometryLoader(this),!0},XC.prototype.unload=function(){D(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;D(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),D(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0},tI.fromJson=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).id,n=e.class;L.typeOf.string("options.id",t),L.typeOf.object("options.class",n);const i={};for(const o in n.properties)if(n.properties.hasOwnProperty(o)){const t=Hx.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=t}return new tI({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})},Object.defineProperties(tI.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),tI.BATCH_TABLE_CLASS_NAME="_batchTable",nI.fromJson=function(e){return L.typeOf.object("value",e),new nI({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})},Object.defineProperties(nI.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),iI.fromJson=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).id,n=e.enum;L.typeOf.string("options.id",t),L.typeOf.object("options.enum",n);return new iI({id:t,values:n.values.map((function(e){return nI.fromJson(e)})),valueType:Ux[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})},Object.defineProperties(iI.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),oI.fromJson=function(e){L.typeOf.object("schema",e);const t={};if(D(e.enums))for(const i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=iI.fromJson({id:i,enum:e.enums[i]}));const n={};if(D(e.classes))for(const i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=tI.fromJson({id:i,class:e.classes[i],enums:t}));return new oI({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})},Object.defineProperties(oI.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),D(Object.create)&&(rI.prototype=Object.create(oS.prototype),rI.prototype.constructor=rI),Object.defineProperties(rI.prototype,{cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}}),rI.prototype.load=async function(){return D(this._promise)?this._promise:D(this._schema)?(this._promise=Promise.resolve(this),this._promise):(this._promise=async function(e){const t=e._resource;e._state=rS.LOADING;try{const n=await t.fetchJson();if(e.isDestroyed())return;return e._schema=oI.fromJson(n),e._state=rS.READY,e}catch(n){if(e.isDestroyed())return;e._state=rS.FAILED;const i=`Failed to load schema: ${t.url}`;throw e.getError(i,n)}}(this),this._promise)},rI.prototype.unload=function(){this._schema=void 0};const sI={};function aI(e){return oi(e.url)}function cI(e){let t=e.byteOffset,n=e.byteLength;if(Px(e,"EXT_meshopt_compression")){const i=e.extensions.EXT_meshopt_compression;t=M(i.byteOffset,0),n=i.byteLength}return`${t}-${t+n}`}function lI(e){return aI(e)}function uI(e,t){return`${aI(e)}-buffer-id-${t}`}function dI(e,t,n,i){if(D(e.uri)){return lI(i.getDerivedResource({url:e.uri}))}return uI(n,t)}function hI(e,t,n,i){const o=t.bufferView,r=e.bufferViews[o],s=r.buffer;return`${dI(e.buffers[s],s,n,i)}-range-${cI(r)}`}function pI(e,t,n,i){const o=e.images[t],r=o.bufferView,s=o.uri;if(D(s)){return aI(i.getDerivedResource({url:s}))}const a=e.bufferViews[r],c=a.buffer;return`${dI(e.buffers[c],c,n,i)}-range-${cI(a)}`}sI.getSchemaCacheKey=function(e){const t=e.schema,n=e.resource;if(D(t)===D(n))throw new P("One of options.schema and options.resource must be defined.");return D(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${aI(n)}`},sI.getExternalBufferCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).resource;return L.typeOf.object("options.resource",t),`external-buffer:${lI(t)}`},sI.getEmbeddedBufferCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).parentResource,n=e.bufferId;return L.typeOf.object("options.parentResource",t),L.typeOf.number("options.bufferId",n),`embedded-buffer:${uI(t,n)}`},sI.getGltfCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltfResource;return L.typeOf.object("options.gltfResource",t),`gltf:${aI(t)}`},sI.getBufferViewCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;L.typeOf.object("options.gltf",t),L.typeOf.number("options.bufferViewId",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o);const r=t.bufferViews[n];let s=r.buffer;const a=t.buffers[s];if(Px(r,"EXT_meshopt_compression")){s=r.extensions.EXT_meshopt_compression.buffer}return`buffer-view:${dI(a,s,i,o)}-range-${cI(r)}`},sI.getDracoCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;return L.typeOf.object("options.gltf",t),L.typeOf.object("options.draco",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o),`draco:${hI(t,n,i,o)}`},sI.getVertexBufferCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=M(e.dequantize,!1),l=M(e.loadBuffer,!1),u=M(e.loadTypedArray,!1);L.typeOf.object("options.gltf",t),L.typeOf.object("options.gltfResource",n),L.typeOf.object("options.baseResource",i),L.typeOf.object("options.frameState",o);const d=D(r),h=function(e,t){return D(e)&&D(e.attributes)&&D(e.attributes[t])}(s,a),p=D(a);if(d===h)throw new P("One of options.bufferViewId and options.draco must be defined.");if(h&&!p)throw new P("When options.draco is defined options.attributeSemantic must also be defined.");if(h&&(L.typeOf.object("options.draco",s),L.typeOf.string("options.attributeSemantic",a)),!l&&!u)throw new P("At least one of loadBuffer and loadTypedArray must be true.");let f="";if(c&&(f+="-dequantize"),l&&(f+="-buffer",f+=`-context-${o.context.id}`),u&&(f+="-typed-array"),D(s)){return`vertex-buffer:${hI(t,s,n,i)}-draco-${a}${f}`}const m=t.bufferViews[r],_=m.buffer;return`vertex-buffer:${dI(t.buffers[_],_,n,i)}-range-${cI(m)}${f}`},sI.getIndexBufferCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=M(e.loadBuffer,!1),c=M(e.loadTypedArray,!1);if(L.typeOf.object("options.gltf",t),L.typeOf.number("options.accessorId",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o),L.typeOf.object("options.frameState",r),!a&&!c)throw new P("At least one of loadBuffer and loadTypedArray must be true.");let l="";if(a&&(l+="-buffer",l+=`-context-${r.context.id}`),c&&(l+="-typed-array"),D(s)){return`index-buffer:${hI(t,s,i,o)}-draco${l}`}const u=t.accessors[n],d=u.bufferView,h=t.bufferViews[d],p=h.buffer,f=dI(t.buffers[p],p,i,o),m=function(e,t){return`${t.byteOffset+e.byteOffset}-${e.componentType}-${e.type}-${e.count}`}(u,h);return`index-buffer:${f}-accessor-${m}${l}`},sI.getImageCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;L.typeOf.object("options.gltf",t),L.typeOf.number("options.imageId",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o);return`image:${pI(t,n,i,o)}`},sI.getTextureCacheKey=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState;L.typeOf.object("options.gltf",t),L.typeOf.object("options.textureInfo",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o),L.typeOf.object("options.supportedImageFormats",r),L.typeOf.object("options.frameState",s);const a=n.index,c=pI(t,HC.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),i,o),l=function(e,t){const n=HC.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}(t,n);return`texture:${c}-sampler-${l}-context-${s.context.id}`};const fI=sI;function mI(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}function _I(){}function gI(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}function yI(e,t,n){L.typeOf.object("resource",e),L.typeOf.object("implicitTileset",t),L.typeOf.object("implicitCoordinates",n),this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._implicitCoordinates=n,this._subtreeLevels=t.subtreeLevels,this._subdivisionScheme=t.subdivisionScheme,this._branchingFactor=t.branchingFactor,this._metadata=void 0,this._tileMetadataTable=void 0,this._tilePropertyTableJson=void 0,this._contentMetadataTables=[],this._contentPropertyTableJsons=[],this._tileJumpBuffer=void 0,this._contentJumpBuffers=[],this._ready=!1}function bI(e,t){const n=e.properties;let i;for(const o in n)if(n.hasOwnProperty(o)){const e=n[o];i=t[M(e.values,e.bufferView)],i.isActive=!0,i.bufferHeader.isActive=!0;const r=M(e.stringOffsets,e.stringOffsetBufferView);D(r)&&(i=t[r],i.isActive=!0,i.bufferHeader.isActive=!0);const s=M(e.arrayOffsets,e.arrayOffsetBufferView);D(s)&&(i=t[s],i.isActive=!0,i.bufferHeader.isActive=!0)}}async function vI(e,t){const n=e._resource.getDerivedResource({url:t.uri}),i=_I.getExternalBufferLoader({resource:n});e._bufferLoader=i;try{await i.load()}catch(o){if(i.isDestroyed())return;throw o}return i.typedArray}function AI(e,t,n,i){if(D(e.constant))return new Nx({constant:Boolean(e.constant),lengthBits:n,availableCount:e.availableCount});let o;return D(e.bitstream)?o=t[e.bitstream]:D(e.bufferView)&&(o=t[e.bufferView]),new Nx({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function TI(e){let t=0;const n=e.lengthBits,i=e.availableCount;let o;o=i<256?new Uint8Array(n):i<65536?new Uint16Array(n):new Uint32Array(n);for(let r=0;r<e.lengthBits;r++)e.getBit(r)&&(o[r]=t,t++);return o}mI.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}},mI.prototype.addGeometryLoader=function(e){L.typeOf.object("loader",e);const t=e.cacheKey;if(this._geometrySizes.hasOwnProperty(t))return;this._geometrySizes[t]=0;const n=e.buffer,i=e.typedArray;let o=0;D(n)&&(o+=n.sizeInBytes),D(i)&&(o+=i.byteLength),this.geometryByteLength+=o,this._geometrySizes[t]=o},mI.prototype.addTextureLoader=function(e){L.typeOf.object("loader",e);const t=e.cacheKey;if(this._textureSizes.hasOwnProperty(t))return;this._textureSizes[t]=0;const n=e.texture.sizeInBytes;this.texturesByteLength+=e.texture.sizeInBytes,this._textureSizes[t]=n},mI.prototype.removeLoader=function(e){L.typeOf.object("loader",e);const t=e.cacheKey,n=this._geometrySizes[t];delete this._geometrySizes[t],D(n)&&(this.geometryByteLength-=n);const i=this._textureSizes[t];delete this._textureSizes[t],D(i)&&(this.texturesByteLength-=i)},_I.cacheEntries={},_I.statistics=new mI,_I.get=function(e){L.typeOf.string("cacheKey",e);const t=_I.cacheEntries[e];if(D(t))return++t.referenceCount,t.resourceLoader},_I.add=function(e){L.typeOf.object("resourceLoader",e);const t=e.cacheKey;if(L.typeOf.string("options.resourceLoader.cacheKey",t),D(_I.cacheEntries[t]))throw new P(`Resource with this cacheKey is already in the cache: ${t}`);return _I.cacheEntries[t]=new gI(e),e},_I.unload=function(e){L.typeOf.object("resourceLoader",e);const t=e.cacheKey,n=_I.cacheEntries[t];if(!D(n))throw new P(`Resource is not in the cache: ${t}`);--n.referenceCount,0===n.referenceCount&&(_I.statistics.removeLoader(e),e.destroy(),delete _I.cacheEntries[t])},_I.getSchemaLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).schema,n=e.resource;if(D(t)===D(n))throw new P("One of options.schema and options.resource must be defined.");const i=fI.getSchemaCacheKey({schema:t,resource:n});let o=_I.get(i);return D(o)?o:(o=new rI({schema:t,resource:n,cacheKey:i}),_I.add(o))},_I.getEmbeddedBufferLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).parentResource,n=e.bufferId,i=e.typedArray;L.typeOf.object("options.parentResource",t),L.typeOf.number("options.bufferId",n);const o=fI.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n});let r=_I.get(o);return D(r)?r:(L.typeOf.object("options.typedArray",i),r=new sS({typedArray:i,cacheKey:o}),_I.add(r))},_I.getExternalBufferLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).resource;L.typeOf.object("options.resource",t);const n=fI.getExternalBufferCacheKey({resource:t});let i=_I.get(n);return D(i)?i:(i=new sS({resource:t,cacheKey:n}),_I.add(i))},_I.getGltfJsonLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltfResource,n=e.baseResource,i=e.typedArray,o=e.gltfJson;L.typeOf.object("options.gltfResource",t),L.typeOf.object("options.baseResource",n);const r=fI.getGltfCacheKey({gltfResource:t});let s=_I.get(r);return D(s)?s:(s=new OC({resourceCache:_I,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),_I.add(s))},_I.getBufferViewLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;L.typeOf.object("options.gltf",t),L.typeOf.number("options.bufferViewId",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o);const r=fI.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o});let s=_I.get(r);return D(s)?s:(s=new cS({resourceCache:_I,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),_I.add(s))},_I.getDracoLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;L.typeOf.object("options.gltf",t),L.typeOf.object("options.draco",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o);const r=fI.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:o});let s=_I.get(r);return D(s)?s:(s=new dS({resourceCache:_I,gltf:t,draco:n,gltfResource:i,baseResource:o,cacheKey:r}),_I.add(s))},_I.getVertexBufferLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,l=M(e.asynchronous,!0),u=M(e.dequantize,!1),d=M(e.loadBuffer,!1),h=M(e.loadTypedArray,!1);if(L.typeOf.object("options.gltf",t),L.typeOf.object("options.gltfResource",n),L.typeOf.object("options.baseResource",i),L.typeOf.object("options.frameState",o),!d&&!h)throw new P("At least one of loadBuffer and loadTypedArray must be true.");const p=D(r),f=function(e,t){return D(e)&&D(e.attributes)&&D(e.attributes[t])}(s,a),m=D(a),_=D(c);if(p===f)throw new P("One of options.bufferViewId and options.draco must be defined.");if(f&&!m)throw new P("When options.draco is defined options.attributeSemantic must also be defined.");if(f&&!_)throw new P("When options.draco is defined options.haAccessorId must also be defined.");f&&(L.typeOf.object("options.draco",s),L.typeOf.string("options.attributeSemantic",a),L.typeOf.number("options.accessorId",c));const g=fI.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:u,loadBuffer:d,loadTypedArray:h});let y=_I.get(g);return D(y)?y:(y=new XC({resourceCache:_I,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:s,attributeSemantic:a,accessorId:c,cacheKey:g,asynchronous:l,dequantize:u,loadBuffer:d,loadTypedArray:h}),_I.add(y))},_I.getIndexBufferLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=M(e.asynchronous,!0),c=M(e.loadBuffer,!1),l=M(e.loadTypedArray,!1);if(L.typeOf.object("options.gltf",t),L.typeOf.number("options.accessorId",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o),L.typeOf.object("options.frameState",r),!c&&!l)throw new P("At least one of loadBuffer and loadTypedArray must be true.");const u=fI.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:c,loadTypedArray:l});let d=_I.get(u);return D(d)?d:(d=new yS({resourceCache:_I,gltf:t,accessorId:n,gltfResource:i,baseResource:o,draco:s,cacheKey:u,asynchronous:a,loadBuffer:c,loadTypedArray:l}),_I.add(d))},_I.getImageLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;L.typeOf.object("options.gltf",t),L.typeOf.number("options.imageId",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o);const r=fI.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o});let s=_I.get(r);return D(s)?s:(s=new pS({resourceCache:_I,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),_I.add(s))},_I.getTextureLoader=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=M(e.asynchronous,!0);L.typeOf.object("options.gltf",t),L.typeOf.object("options.textureInfo",n),L.typeOf.object("options.gltfResource",i),L.typeOf.object("options.baseResource",o),L.typeOf.object("options.supportedImageFormats",r),L.typeOf.object("options.frameState",s);const c=fI.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s});let l=_I.get(c);return D(l)?l:(l=new jC({resourceCache:_I,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:c,asynchronous:a}),_I.add(l))},_I.clearForSpecs=function(){const e=[XC,yS,dS,jC,pS,cS,sS,rI,OC];let t;const n=_I.cacheEntries,i=[];for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);i.sort((function(t,n){return e.indexOf(t.resourceLoader.constructor)-e.indexOf(n.resourceLoader.constructor)}));const o=i.length;for(let r=0;r<o;++r){const e=i[r];t=e.resourceLoader.cacheKey,D(n[t])&&(e.resourceLoader.destroy(),delete n[t])}_I.statistics.clear()},Object.defineProperties(yI.prototype,{ready:{get:function(){return this._ready}},metadata:{get:function(){return this._metadata}},tileMetadataTable:{get:function(){return this._tileMetadataTable}},tilePropertyTableJson:{get:function(){return this._tilePropertyTableJson}},contentMetadataTables:{get:function(){return this._contentMetadataTables}},contentPropertyTableJsons:{get:function(){return this._contentPropertyTableJsons}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}}),yI.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)},yI.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)},yI.prototype.contentIsAvailableAtIndex=function(e,t){if((t=M(t,0))<0||t>=this._contentAvailabilityBitstreams.length)throw new P("contentIndex out of bounds.");return this._contentAvailabilityBitstreams[t].getBit(e)},yI.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)},yI.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)},yI.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)},yI.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)},yI.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===Mx.OCTREE&&(t=3),e>>t},yI.fromSubtreeJson=async function(e,t,n,i,o){if(L.typeOf.object("resource",e),D(t)===D(n))throw new P("One of json and subtreeView must be defined.");L.typeOf.object("implicitTileset",i),L.typeOf.object("implicitCoordinates",o);const r=new yI(e,i,o);let s;s=D(t)?{json:t,binary:void 0}:function(e){const t=!0,n=new DataView(e.buffer,e.byteOffset);let i=8;const o=n.getUint32(i,t);i+=8;const r=n.getUint32(i,t);i+=8;const s=Ew(e,i,o);i+=o;const a=e.subarray(i,i+r);return{json:s,binary:a}}(n);const a=s.json;let c;if(r._subtreeJson=a,Px(a,"3DTILES_metadata"))c=a.extensions["3DTILES_metadata"];else if(D(a.tileMetadata)){const e=a.tileMetadata;c=a.propertyTables[e]}const l=[];if(D(a.contentMetadata)){const e=a.contentMetadata.length;for(let t=0;t<e;t++){const e=a.contentMetadata[t];l.push(a.propertyTables[e])}}let u;const d=i.metadataSchema,h=a.subtreeMetadata;if(D(h)){const e=h.class;u=new Bx({subtreeMetadata:h,class:d.classes[e]})}r._metadata=u,r._tilePropertyTableJson=c,r._contentPropertyTableJsons=l;const p={constant:0};a.contentAvailabilityHeaders=[],Px(a,"3DTILES_multiple_contents")?a.contentAvailabilityHeaders=a.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(a.contentAvailability)?a.contentAvailabilityHeaders=a.contentAvailability:a.contentAvailabilityHeaders.push(M(a.contentAvailability,p));const f=function(e){e=D(e)?e:[];for(let t=0;t<e.length;t++){const n=e[t];n.isExternal=D(n.uri),n.isActive=!1}return e}(a.buffers),m=function(e,t){e=D(e)?e:[];for(let n=0;n<e.length;n++){const i=e[n],o=t[i.buffer];i.bufferHeader=o,i.isActive=!1}return e}(a.bufferViews,f);!function(e,t){let n;const i=e.tileAvailability;D(i.bitstream)?n=t[i.bitstream]:D(i.bufferView)&&(n=t[i.bufferView]);D(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);const o=e.contentAvailabilityHeaders;for(let s=0;s<o.length;s++)n=void 0,D(o[s].bitstream)?n=t[o[s].bitstream]:D(o[s].bufferView)&&(n=t[o[s].bufferView]),D(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);n=void 0;const r=e.childSubtreeAvailability;D(r.bitstream)?n=t[r.bitstream]:D(r.bufferView)&&(n=t[r.bufferView]);D(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0)}(a,m),D(c)&&bI(c,m);for(let y=0;y<l.length;y++){bI(l[y],m)}const _=await function(e,t,n){const i=[];for(let o=0;o<t.length;o++){const r=t[o];if(r.isActive)if(r.isExternal){const t=vI(e,r);i.push(t)}else i.push(Promise.resolve(n));else i.push(Promise.resolve(void 0))}return Promise.all(i).then((function(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];D(i)&&(t[n]=i)}return t}))}(r,f,s.binary),g=function(e,t){const n={};for(let i=0;i<e.length;i++){const o=e[i];if(!o.isActive)continue;const r=o.byteOffset,s=r+o.byteLength,a=t[o.buffer].subarray(r,s);n[i]=a}return n}(m,_);return function(e,t,n,i){const o=n.branchingFactor,r=n.subtreeLevels,s=(Math.pow(o,r)-1)/(o-1),a=Math.pow(o,r),c=Px(t,"3DTILES_metadata"),l=D(e._tilePropertyTableJson);let u=c||l;e._tileAvailability=AI(t.tileAvailability,i,s,u);const d=e._contentPropertyTableJsons.length>0;u=u||d;for(let h=0;h<t.contentAvailabilityHeaders.length;h++){const n=AI(t.contentAvailabilityHeaders[h],i,s,u);e._contentAvailabilityBitstreams.push(n)}e._childSubtreeAvailability=AI(t.childSubtreeAvailability,i,a)}(r,a,i,g),D(c)&&(function(e,t,n){const i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new iS({class:a,count:o,properties:i.properties,bufferViews:n})}(r,i,g),function(e){const t=TI(e._tileAvailability);e._tileJumpBuffer=t}(r)),function(e,t,n){const i=e._contentPropertyTableJsons,o=e._contentAvailabilityBitstreams,r=t.metadataSchema,s=e._contentMetadataTables;for(let a=0;a<i.length;a++){const e=i[a],t=o[a].availableCount,c=e.class,l=new iS({class:r.classes[c],count:t,properties:e.properties,bufferViews:n});s.push(l)}}(r,i,g),function(e){const t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){const e=TI(n[i]);t.push(e)}}(r),r._ready=!0,r},yI.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new be("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex},yI.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new be("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex},yI.prototype.getTileMetadataView=function(e){const t=function(e,t){if(!D(e._tileMetadataTable))return;const n=e.getTileIndex(t);return e._tileAvailability.getBit(n)?e._tileJumpBuffer[n]:void 0}(this,e);if(!D(t))return;const n=this._tileMetadataTable;return new Rx({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})},yI.prototype.getContentMetadataView=function(e,t){const n=function(e,t,n){const i=e._contentMetadataTables;if(!D(i))return;if(!D(i[n]))return;const o=e._contentAvailabilityBitstreams[n],r=e.getTileIndex(t);if(o.getBit(r))return e._contentJumpBuffers[n][r]}(this,e,t);if(!D(n))return;const i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new Rx({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})},yI.prototype.isDestroyed=function(){return!1},yI.prototype.destroy=function(){return D(this._bufferLoader)&&_I.unload(this._bufferLoader),He(this)};const wI=Object.freeze({ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILESET_TILE_COUNT:"TILESET_TILE_COUNT",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"}),EI={parseAllBoundingVolumeSemantics:function(e){return L.typeOf.object("tileMetadata",e),{tile:{boundingVolume:EI.parseBoundingVolumeSemantic("TILE",e),minimumHeight:EI._parseMinimumHeight("TILE",e),maximumHeight:EI._parseMaximumHeight("TILE",e)},content:{boundingVolume:EI.parseBoundingVolumeSemantic("CONTENT",e),minimumHeight:EI._parseMinimumHeight("CONTENT",e),maximumHeight:EI._parseMaximumHeight("CONTENT",e)}}},parseBoundingVolumeSemantic:function(e,t){if(L.typeOf.string("prefix",e),"TILE"!==e&&"CONTENT"!==e)throw new P("prefix must be either 'TILE' or 'CONTENT'");L.typeOf.object("tileMetadata",t);const n=`${e}_BOUNDING_BOX`,i=t.getPropertyBySemantic(n);if(D(i))return{box:i};const o=`${e}_BOUNDING_REGION`,r=t.getPropertyBySemantic(o);if(D(r))return{region:r};const s=`${e}_BOUNDING_SPHERE`,a=t.getPropertyBySemantic(s);return D(a)?{sphere:a}:void 0},_parseMinimumHeight:function(e,t){if(L.typeOf.string("prefix",e),"TILE"!==e&&"CONTENT"!==e)throw new P("prefix must be either 'TILE' or 'CONTENT'");L.typeOf.object("tileMetadata",t);const n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)},_parseMaximumHeight:function(e,t){if(L.typeOf.string("prefix",e),"TILE"!==e&&"CONTENT"!==e)throw new P("prefix must be either 'TILE' or 'CONTENT'");L.typeOf.object("tileMetadata",t);const n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}},xI=EI;function SI(e,t,n){L.defined("tile.implicitTileset",t.implicitTileset),L.defined("tile.implicitCoordinates",t.implicitCoordinates);const i=t.implicitTileset,o=t.implicitCoordinates;this._implicitTileset=i,this._implicitCoordinates=o,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=n,this._metadata=void 0,this.featurePropertiesDirty=!1,this._group=void 0;const r=o.getTemplateValues(),s=i.subtreeUriTemplate.getDerivedResource({templateValues:r});this._url=s.getUrlComponent(!0),this._ready=!1}function CI(e,t,n){const i=wI.TILE_GEOMETRIC_ERROR;return D(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function II(e,t,n,i,o,r){const s=e._implicitTileset;let a,c,l,u;if(a=M(r,!1)?n.implicitCoordinates:n.implicitCoordinates.getChildCoordinates(i),D(t.tilePropertyTableJson)){c=t.getTileMetadataView(a);const e=xI.parseAllBoundingVolumeSemantics(c);l=e.tile,u=e.content}const d=t.contentPropertyTableJsons.length;let h=!1;for(let v=0;v<d;v++)if(t.contentIsAvailableAtCoordinates(a,v)){h=!0;break}const p=function(e,t,n,i,o,r){let s;s=!D(r)||!D(r.boundingVolume)||!OI(r.boundingVolume,r)&&OI(e.boundingVolume,r)?NI(e,t,n,M(i,!1),o):r.boundingVolume;return DI(s,r),s}(s,a,i,r,n,l),f=[];for(let v=0;v<s.contentCount;v++){if(!t.contentIsAvailableAtIndex(o,v))continue;const e={uri:s.contentUriTemplates[v].getDerivedResource({templateValues:a.getTemplateValues()}).url},n=PI(p,u);D(n)&&(e.boundingVolume=n),f.push(ni(e,s.contentHeaders[v]))}const m={boundingVolume:p,geometricError:CI(c,s,a),refine:s.refine,contents:f},_=!0,g=ti(s.tileHeader,_);delete g.boundingVolume,delete g.transform,delete g.metadata;const y=ni(m,g,_),b=HI(e,s.baseResource,y,n);return b.implicitCoordinates=a,b.implicitSubtree=t,b.metadata=c,b.hasImplicitContentMetadata=h,b}function OI(e,t){return D(e)&&D(t)&&(D(t.minimumHeight)||D(t.maximumHeight))&&(Px(e,"3DTILES_bounding_volume_S2")||D(e.region))}function DI(e,t){D(t)&&(Px(e,"3DTILES_bounding_volume_S2")?function(e,t,n){D(t)&&(e.minimumHeight=t);D(n)&&(e.maximumHeight=n)}(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):D(e.region)&&function(e,t,n){D(t)&&(e[4]=t);D(n)&&(e[5]=n)}(e.region,t.minimumHeight,t.maximumHeight))}function PI(e,t){let n;return D(t)&&(n=t.boundingVolume),OI(n,t)?DI(n,t):OI(e,t)&&(n=ti(e,!0),DI(n,t)),n}function NI(e,t,n,i,o){const r=e.boundingVolume;if(Px(r,"3DTILES_bounding_volume_S2"))return RI(i,o,n,t.level,t.x,t.y,t.z);if(D(r.region)){return{region:kI(r.region,t.level,t.x,t.y,t.z)}}return{box:zI(r.box,t.level,t.x,t.y,t.z)}}function RI(e,t,n,i,o,r,s){L.typeOf.bool("parentIsPlaceholderTile",e),L.typeOf.object("parentTile",t),L.typeOf.number("childIndex",n),L.typeOf.number("level",i),L.typeOf.number("x",o),L.typeOf.number("y",r),D(s)&&L.typeOf.number("z",s);const a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:Tx.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};const c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),l=c%2==0?_x.encode2D(i,o,r):_x.encode2D(i,r,o),u=Tx.fromFacePositionLevel(c,BigInt(l),i);let d,h;if(D(s)){const e=(a.maximumHeight+a.minimumHeight)/2;d=n<4?a.minimumHeight:e,h=n<4?e:a.maximumHeight}else d=a.minimumHeight,h=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:Tx.getTokenFromId(u._cellId),minimumHeight:d,maximumHeight:h}}}}Object.defineProperties(SI.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},metadata:{get:function(){},set:function(){throw new P("Implicit3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),SI.fromSubtreeJson=async function(e,t,n,i,o,r){if(L.defined("tile.implicitTileset",t.implicitTileset),L.defined("tile.implicitCoordinates",t.implicitCoordinates),D(i)===D(o))throw new P("One of json and arrayBuffer must be defined.");let s;r=M(r,0),D(o)&&(s=new Uint8Array(o,r));const a=t.implicitTileset,c=t.implicitCoordinates,l=await yI.fromSubtreeJson(n,i,s,a,c),u=new SI(e,t,n);return u._implicitSubtree=l,function(e,t){const n=e._tile,i=e._implicitCoordinates.childIndex,o=function(e,t,n,i){const o=II(e,t,n,i,0,!0),r=e._tileset.statistics;let s=[o],a=[];const c=e._implicitTileset;for(let l=1;l<c.subtreeLevels;l++){const n=t.getLevelOffset(l),i=c.branchingFactor*s.length;for(let o=0;o<i;o++){const i=n+o;if(!t.tileIsAvailableAtIndex(i)){a.push(void 0);continue}const l=s[t.getParentMortonIndex(o)],u=II(e,t,l,o%c.branchingFactor,i);l.children.push(u),r.numberOfTilesTotal++,a.push(u)}s=a,a=[]}return{rootTile:o,bottomRow:s}}(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;const s=function(e,t,n){const i=[],o=e._implicitTileset.branchingFactor;for(let r=0;r<n.length;r++){const e=n[r];if(D(e))for(let n=0;n<o;n++){const s=r*o+n;t.childSubtreeIsAvailableAtIndex(s)&&i.push({tile:e,childIndex:n})}}return i}(e,t,o.bottomRow);for(let a=0;a<s.length;a++){const t=s[a],n=t.tile,i=VI(e,n,t.childIndex);n.children.push(i),r.numberOfTilesTotal++}}(u,l),u._ready=!0,u};const LI=new H,MI=new H,FI=new H,BI=new re;function zI(e,t,n,i,o){if(L.typeOf.object("rootBox",e),L.typeOf.number("level",t),L.typeOf.number("x",n),L.typeOf.number("y",i),D(o)&&L.typeOf.number("z",o),0===t)return e;const r=H.unpack(e,0,MI),s=re.unpack(e,3,BI),a=Math.pow(2,-t),c=(2*n+1)*a-1,l=(2*i+1)*a-1;let u=0;const d=H.fromElements(a,a,1,LI);D(o)&&(u=(2*o+1)*a-1,d.z=a);let h=H.fromElements(c,l,u,FI);h=re.multiplyByVector(s,h,FI),h=H.add(h,r,FI);let p=re.clone(s);p=re.multiplyByScale(p,d,p);const f=new Array(12);return H.pack(h,f),re.pack(p,f,3),f}const UI=new Ir;function kI(e,t,n,i,o){if(L.typeOf.object("rootRegion",e),L.typeOf.number("level",t),L.typeOf.number("x",n),L.typeOf.number("y",i),D(o)&&L.typeOf.number("z",o),0===t)return e.slice();const r=Ir.unpack(e,0,UI),s=e[4],a=e[5],c=Math.pow(2,-t),l=c*r.width,u=V.negativePiToPi(r.west+n*l),d=V.negativePiToPi(u+l),h=c*r.height,p=V.negativePiToPi(r.south+i*h),f=V.negativePiToPi(p+h);let m=s,_=a;if(D(o)){const e=c*(a-s);m+=o*e,_=m+e}return[u,p,d,f,m,_]}function VI(e,t,n){const i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=NI(i,o,n,!1,t),s=CI(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,c={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},l=HI(e,i.baseResource,c,t);return l.implicitTileset=i,l.implicitCoordinates=o,l}function HI(e,t,n,i){return new(0,e._tile.constructor)(e._tileset,t,n,i)}SI.prototype.hasProperty=function(e,t){return!1},SI.prototype.getFeature=function(e){},SI.prototype.applyDebugSettings=function(e,t){},SI.prototype.applyStyle=function(e){},SI.prototype.update=function(e,t){},SI.prototype.pick=function(e,t,n){},SI.prototype.isDestroyed=function(){return!1},SI.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),He(this)},SI._deriveBoundingBox=zI,SI._deriveBoundingRegion=kI,SI._deriveBoundingVolumeS2=RI;const GI=Object.freeze({NONE:0,REPEAT:1,MIRRORED_REPEAT:2});function jI(e,t){L.typeOf.object("normal",e),L.typeOf.number("distance",t),this._distance=t,this._normal=new WI(e,this),this.onChangeCallback=void 0,this.index=-1}function WI(e,t){this._clippingPlane=t,this._cartesian3=H.clone(e)}function qI(e){e=M(e,M.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=M(e.enabled,!0),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this.edgeColor=Ot.clone(M(e.edgeColor,Ot.WHITE)),this.edgeWidth=M(e.edgeWidth,0),this.planeAdded=new gi,this.planeRemoved=new gi,this._owner=void 0;const t=M(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?YI:XI,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const n=e.planes;if(D(n)){const e=n.length;for(let t=0;t<e;++t)this.add(n[t])}}function YI(e){return e===mn.OUTSIDE}function XI(e){return e===mn.INSIDE}function QI(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||-1!==e._dirtyIndex&&e._dirtyIndex!==t,e._dirtyIndex=t}function $I(e,t){const n=e.length;for(let i=0;i<n;++i)if(Pc.equals(e[i],t))return i;return-1}Object.defineProperties(jI.prototype,{distance:{get:function(){return this._distance},set:function(e){L.typeOf.number("value",e),D(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){L.typeOf.object("value",e),D(this.onChangeCallback)&&!H.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),H.clone(e,this._normal._cartesian3)}}}),jI.fromPlane=function(e,t){return L.typeOf.object("plane",e),D(t)?(t.normal=e.normal,t.distance=e.distance):t=new jI(e.normal,e.distance),t},jI.clone=function(e,t){return D(t)?(t.normal=e.normal,t.distance=e.distance,t):new jI(e.normal,e.distance)},Object.defineProperties(WI.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){L.typeOf.number("value",e),D(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){L.typeOf.number("value",e),D(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){L.typeOf.number("value",e),D(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}}),Object.defineProperties(qI.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?YI:XI)}},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}}}),qI.prototype.add=function(e){const t=this._planes.length,n=this;e.onChangeCallback=function(e){QI(n,e)},e.index=t,QI(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)},qI.prototype.get=function(e){return L.typeOf.number("index",e),this._planes[e]},qI.prototype.contains=function(e){return-1!==$I(this._planes,e)},qI.prototype.remove=function(e){const t=this._planes,n=$I(t,e);if(-1===n)return!1;e instanceof jI&&(e.onChangeCallback=void 0,e.index=-1);const i=t.length-1;for(let o=n;o<i;++o){const e=t[o+1];t[o]=e,e instanceof jI&&(e.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0},qI.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let n=0;n<t;++n){const t=e[n];t instanceof jI&&(t.onChangeCallback=void 0,t.index=-1),this.planeRemoved.raiseEvent(t,n)}this._multipleDirtyPlanes=!0,this._planes=[]};const KI=new K,ZI=new K;function JI(e,t,n){const i=e._uint8View,o=e._planes;let r=0;for(let s=t;s<n;++s){const e=o[s],t=sm.octEncodeToCartesian4(e.normal,ZI);i[r]=t.x,i[r+1]=t.y,i[r+2]=t.z,i[r+3]=t.w;const n=K.packFloat(e.distance,KI);i[r+4]=n.x,i[r+5]=n.y,i[r+6]=n.z,i[r+7]=n.w,r+=8}}function eO(e,t,n){const i=e._float32View,o=e._planes;let r=0;for(let s=t;s<n;++s){const e=o[s],t=e.normal;i[r]=t.x,i[r+1]=t.y,i[r+2]=t.z,i[r+3]=e.distance,r+=4}}function tO(e,t){const n=rs.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}const nO=new kt;qI.prototype.update=function(e){let t=this._clippingPlanesTexture;const n=e.context,i=qI.useFloatTexture(n),o=i?this.length:2*this.length;if(D(t)){const e=t.width*t.height;(e<o||o<.25*e)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(0===this.length)return;if(!D(t)){const e=tO(o,nO);e.y*=2,i?(t=new Sc({context:n,width:e.x,height:e.y,pixelFormat:is.RGBA,pixelDatatype:ts.FLOAT,sampler:uc.NEAREST,flipY:!1}),this._float32View=new Float32Array(e.x*e.y*4)):(t=new Sc({context:n,width:e.x,height:e.y,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,sampler:uc.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(e.x*e.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}const r=this._dirtyIndex;if(this._multipleDirtyPlanes||-1!==r){if(this._multipleDirtyPlanes)i?(eO(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(JI(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{let e=0,n=0;i?(n=Math.floor(r/t.width),e=Math.floor(r-n*t.width),eO(this,r,r+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:e,yOffset:n})):(n=Math.floor(2*r/t.width),e=Math.floor(2*r-n*t.width),JI(this,r,r+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:e,yOffset:n}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};const iO=new ve,oO=new Pc(H.UNIT_X,0);qI.prototype.computeIntersectionWithBoundingVolume=function(e,t){const n=this._planes,i=n.length;let o=this.modelMatrix;D(t)&&(o=ve.multiply(t,o,iO));let r=mn.INSIDE;!this.unionClippingRegions&&i>0&&(r=mn.OUTSIDE);for(let s=0;s<i;++s){const t=n[s];Pc.transform(t,o,oO);const i=e.intersectPlane(oO);if(i===mn.INTERSECTING)r=i;else if(this._testIntersection(i))return i}return r},qI.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),D(e))){if(D(e._owner))throw new P("ClippingPlaneCollection should only be assigned to one object");e._owner=t,t[n]=e}},qI.useFloatTexture=function(e){return e.floatingPointTexture},qI.getTextureResolution=function(e,t,n){const i=e.texture;if(D(i))return n.x=i.width,n.y=i.height,n;const o=tO(qI.useFloatTexture(t)?e.length:2*e.length,n);return o.y*=2,o},qI.prototype.isDestroyed=function(){return!1},qI.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),He(this)};var rO={exports:{}};function sO(e,t,n){n=n||2;var i,o,r,s,a,c,l,u=t&&t.length,d=u?t[0]*n:e.length,h=aO(e,0,d,n,!0),p=[];if(!h||h.next===h.prev)return p;if(u&&(h=function(e,t,n,i){var o,r,s,a=[];for(o=0,r=t.length;o<r;o++)(s=aO(e,t[o]*i,o<r-1?t[o+1]*i:e.length,i,!1))===s.next&&(s.steiner=!0),a.push(yO(s));for(a.sort(fO),o=0;o<a.length;o++)n=mO(a[o],n);return n}(e,t,h,n)),e.length>80*n){i=r=e[0],o=s=e[1];for(var f=n;f<d;f+=n)(a=e[f])<i&&(i=a),(c=e[f+1])<o&&(o=c),a>r&&(r=a),c>s&&(s=c);l=0!==(l=Math.max(r-i,s-o))?32767/l:0}return lO(h,p,n,i,o,l,0),p}function aO(e,t,n,i,o){var r,s;if(o===PO(e,t,n,i)>0)for(r=t;r<n;r+=i)s=IO(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=IO(r,e[r],e[r+1],s);return s&&TO(s,s.next)&&(OO(s),s=s.next),s}function cO(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!TO(i,i.next)&&0!==AO(i.prev,i,i.next))i=i.next;else{if(OO(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function lO(e,t,n,i,o,r,s){if(e){!s&&r&&function(e,t,n,i){var o=e;do{0===o.z&&(o.z=gO(o.x,o.y,t,n,i)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,i,o,r,s,a,c,l=1;do{for(n=e,e=null,r=null,s=0;n;){for(s++,i=n,a=0,t=0;t<l&&(a++,i=i.nextZ);t++);for(c=l;a>0||c>0&&i;)0!==a&&(0===c||!i||n.z<=i.z)?(o=n,n=n.nextZ,a--):(o=i,i=i.nextZ,c--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;n=i}r.nextZ=null,l*=2}while(s>1)}(o)}(e,i,o,r);for(var a,c,l=e;e.prev!==e.next;)if(a=e.prev,c=e.next,r?dO(e,i,o,r):uO(e))t.push(a.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),OO(e),e=c.next,l=c.next;else if((e=c)===l){s?1===s?lO(e=hO(cO(e),t,n),t,n,i,o,r,2):2===s&&pO(e,t,n,i,o,r):lO(cO(e),t,n,i,o,r,1);break}}}function uO(e){var t=e.prev,n=e,i=e.next;if(AO(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,c=n.y,l=i.y,u=o<r?o<s?o:s:r<s?r:s,d=a<c?a<l?a:l:c<l?c:l,h=o>r?o>s?o:s:r>s?r:s,p=a>c?a>l?a:l:c>l?c:l,f=i.next;f!==t;){if(f.x>=u&&f.x<=h&&f.y>=d&&f.y<=p&&bO(o,a,r,c,s,l,f.x,f.y)&&AO(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function dO(e,t,n,i){var o=e.prev,r=e,s=e.next;if(AO(o,r,s)>=0)return!1;for(var a=o.x,c=r.x,l=s.x,u=o.y,d=r.y,h=s.y,p=a<c?a<l?a:l:c<l?c:l,f=u<d?u<h?u:h:d<h?d:h,m=a>c?a>l?a:l:c>l?c:l,_=u>d?u>h?u:h:d>h?d:h,g=gO(p,f,t,n,i),y=gO(m,_,t,n,i),b=e.prevZ,v=e.nextZ;b&&b.z>=g&&v&&v.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=_&&b!==o&&b!==s&&bO(a,u,c,d,l,h,b.x,b.y)&&AO(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==o&&v!==s&&bO(a,u,c,d,l,h,v.x,v.y)&&AO(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;b&&b.z>=g;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=_&&b!==o&&b!==s&&bO(a,u,c,d,l,h,b.x,b.y)&&AO(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==o&&v!==s&&bO(a,u,c,d,l,h,v.x,v.y)&&AO(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function hO(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!TO(o,r)&&wO(o,i,i.next,r)&&SO(o,r)&&SO(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),OO(i),OO(i.next),i=e=r),i=i.next}while(i!==e);return cO(i)}function pO(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&vO(s,a)){var c=CO(s,a);return s=cO(s,s.next),c=cO(c,c.next),lO(s,t,n,i,o,r,0),void lO(c,t,n,i,o,r,0)}a=a.next}s=s.next}while(s!==e)}function fO(e,t){return e.x-t.x}function mO(e,t){var n=function(e,t){var n,i=t,o=e.x,r=e.y,s=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){var a=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=o&&a>s&&(s=a,n=i.x<i.next.x?i:i.next,a===o))return n}i=i.next}while(i!==t);if(!n)return null;var c,l=n,u=n.x,d=n.y,h=1/0;i=n;do{o>=i.x&&i.x>=u&&o!==i.x&&bO(r<d?o:s,r,u,d,r<d?s:o,r,i.x,i.y)&&(c=Math.abs(r-i.y)/(o-i.x),SO(i,e)&&(c<h||c===h&&(i.x>n.x||i.x===n.x&&_O(n,i)))&&(n=i,h=c)),i=i.next}while(i!==l);return n}(e,t);if(!n)return t;var i=CO(n,e);return cO(i,i.next),cO(n,n.next)}function _O(e,t){return AO(e.prev,e,t.prev)<0&&AO(t.next,e,e.next)<0}function gO(e,t,n,i,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function yO(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function bO(e,t,n,i,o,r,s,a){return(o-s)*(t-a)>=(e-s)*(r-a)&&(e-s)*(i-a)>=(n-s)*(t-a)&&(n-s)*(r-a)>=(o-s)*(i-a)}function vO(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&wO(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(SO(e,t)&&SO(t,e)&&function(e,t){var n=e,i=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do{n.y>r!=n.next.y>r&&n.next.y!==n.y&&o<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(AO(e.prev,e,t.prev)||AO(e,t.prev,t))||TO(e,t)&&AO(e.prev,e,e.next)>0&&AO(t.prev,t,t.next)>0)}function AO(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function TO(e,t){return e.x===t.x&&e.y===t.y}function wO(e,t,n,i){var o=xO(AO(e,t,n)),r=xO(AO(e,t,i)),s=xO(AO(n,i,e)),a=xO(AO(n,i,t));return o!==r&&s!==a||(!(0!==o||!EO(e,n,t))||(!(0!==r||!EO(e,i,t))||(!(0!==s||!EO(n,e,i))||!(0!==a||!EO(n,t,i)))))}function EO(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function xO(e){return e>0?1:e<0?-1:0}function SO(e,t){return AO(e.prev,e,e.next)<0?AO(e,t,e.next)>=0&&AO(e,e.prev,t)>=0:AO(e,t,e.prev)<0||AO(e,e.next,t)<0}function CO(e,t){var n=new DO(e.i,e.x,e.y),i=new DO(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function IO(e,t,n,i){var o=new DO(e,t,n);return i?(o.next=i.next,o.prev=i,i.next.prev=o,i.next=o):(o.prev=o,o.next=o),o}function OO(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 DO(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function PO(e,t,n,i){for(var o=0,r=t,s=n-i;r<n;r+=i)o+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return o}rO.exports=sO,rO.exports.default=sO,sO.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(PO(e,0,r,n));if(o)for(var a=0,c=t.length;a<c;a++){var l=t[a]*n,u=a<c-1?t[a+1]*n:e.length;s-=Math.abs(PO(e,l,u,n))}var d=0;for(a=0;a<i.length;a+=3){var h=i[a]*n,p=i[a+1]*n,f=i[a+2]*n;d+=Math.abs((e[h]-e[f])*(e[p+1]-e[h+1])-(e[h]-e[p])*(e[f+1]-e[h+1]))}return 0===s&&0===d?0:Math.abs((d-s)/s)},sO.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,o=0;o<e.length;o++){for(var r=0;r<e[o].length;r++)for(var s=0;s<t;s++)n.vertices.push(e[o][r][s]);o>0&&(i+=e[o-1].length,n.holes.push(i))}return n};const NO=new H,RO=new H,LO={computeArea2D:function(e){L.defined("positions",e),L.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);const t=e.length;let n=0;for(let i=t-1,o=0;o<t;i=o++){const t=e[i],r=e[o];n+=t.x*r.y-r.x*t.y}return.5*n},computeWindingOrder2D:function(e){return LO.computeArea2D(e)>0?us.COUNTER_CLOCKWISE:us.CLOCKWISE},triangulate:function(e,t){L.defined("positions",e);const n=kt.packArray(e);return rO.exports(n,t,2)}},MO=new H,FO=new H,BO=new H,zO=new H,UO=new H,kO=new H,VO=new H,HO=new kt,GO=new kt,jO=new kt,WO=new kt;LO.computeSubdivision=function(e,t,n,i,o){o=M(o,V.RADIANS_PER_DEGREE);const r=D(i);L.typeOf.object("ellipsoid",e),L.defined("positions",t),L.defined("indices",n),L.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),L.typeOf.number.equals("indices.length % 3","0",n.length%3,0),L.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,l=new Array(3*c),u=new Array(2*c);let d=0,h=0;for(a=0;a<c;a++){const e=t[a];if(l[d++]=e.x,l[d++]=e.y,l[d++]=e.z,r){const e=i[a];u[h++]=e.x,u[h++]=e.y}}const p=[],f={},m=e.maximumRadius,_=V.chordLength(o,m),g=_*_;for(;s.length>0;){const e=s.pop(),t=s.pop(),n=s.pop(),i=H.fromArray(l,3*n,MO),o=H.fromArray(l,3*t,FO),c=H.fromArray(l,3*e,BO);let d,h,_;r&&(d=kt.fromArray(u,2*n,HO),h=kt.fromArray(u,2*t,GO),_=kt.fromArray(u,2*e,jO));const y=H.multiplyByScalar(H.normalize(i,zO),m,zO),b=H.multiplyByScalar(H.normalize(o,UO),m,UO),v=H.multiplyByScalar(H.normalize(c,kO),m,kO),A=H.magnitudeSquared(H.subtract(y,b,VO)),T=H.magnitudeSquared(H.subtract(b,v,VO)),w=H.magnitudeSquared(H.subtract(v,y,VO)),E=Math.max(A,T,w);let x,S,C;E>g?A===E?(x=`${Math.min(n,t)} ${Math.max(n,t)}`,a=f[x],D(a)||(S=H.add(i,o,VO),H.multiplyByScalar(S,.5,S),l.push(S.x,S.y,S.z),a=l.length/3-1,f[x]=a,r&&(C=kt.add(d,h,WO),kt.multiplyByScalar(C,.5,C),u.push(C.x,C.y))),s.push(n,a,e),s.push(a,t,e)):T===E?(x=`${Math.min(t,e)} ${Math.max(t,e)}`,a=f[x],D(a)||(S=H.add(o,c,VO),H.multiplyByScalar(S,.5,S),l.push(S.x,S.y,S.z),a=l.length/3-1,f[x]=a,r&&(C=kt.add(h,_,WO),kt.multiplyByScalar(C,.5,C),u.push(C.x,C.y))),s.push(t,a,n),s.push(a,e,n)):w===E&&(x=`${Math.min(e,n)} ${Math.max(e,n)}`,a=f[x],D(a)||(S=H.add(c,i,VO),H.multiplyByScalar(S,.5,S),l.push(S.x,S.y,S.z),a=l.length/3-1,f[x]=a,r&&(C=kt.add(_,d,WO),kt.multiplyByScalar(C,.5,C),u.push(C.x,C.y))),s.push(e,a,t),s.push(a,n,t)):(p.push(n),p.push(t),p.push(e))}const y={attributes:{position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:l})},indices:p,primitiveType:Vr.TRIANGLES};return r&&(y.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:u})),new Na(y)};const qO=new Qt,YO=new Qt,XO=new Qt,QO=new Qt;LO.computeRhumbLineSubdivision=function(e,t,n,i,o){o=M(o,V.RADIANS_PER_DEGREE);const r=D(i);L.typeOf.object("ellipsoid",e),L.defined("positions",t),L.defined("indices",n),L.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),L.typeOf.number.equals("indices.length % 3","0",n.length%3,0),L.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,l=new Array(3*c),u=new Array(2*c);let d=0,h=0;for(a=0;a<c;a++){const e=t[a];if(l[d++]=e.x,l[d++]=e.y,l[d++]=e.z,r){const e=i[a];u[h++]=e.x,u[h++]=e.y}}const p=[],f={},m=e.maximumRadius,_=V.chordLength(o,m),g=new Wy(void 0,void 0,e),y=new Wy(void 0,void 0,e),b=new Wy(void 0,void 0,e);for(;s.length>0;){const t=s.pop(),n=s.pop(),i=s.pop(),o=H.fromArray(l,3*i,MO),c=H.fromArray(l,3*n,FO),d=H.fromArray(l,3*t,BO);let h,m,v;r&&(h=kt.fromArray(u,2*i,HO),m=kt.fromArray(u,2*n,GO),v=kt.fromArray(u,2*t,jO));const A=e.cartesianToCartographic(o,qO),T=e.cartesianToCartographic(c,YO),w=e.cartesianToCartographic(d,XO);g.setEndPoints(A,T);const E=g.surfaceDistance;y.setEndPoints(T,w);const x=y.surfaceDistance;b.setEndPoints(w,A);const S=b.surfaceDistance,C=Math.max(E,x,S);let I,O,P,N,R;C>_?E===C?(I=`${Math.min(i,n)} ${Math.max(i,n)}`,a=f[I],D(a)||(O=g.interpolateUsingFraction(.5,QO),P=.5*(A.height+T.height),N=H.fromRadians(O.longitude,O.latitude,P,e,VO),l.push(N.x,N.y,N.z),a=l.length/3-1,f[I]=a,r&&(R=kt.add(h,m,WO),kt.multiplyByScalar(R,.5,R),u.push(R.x,R.y))),s.push(i,a,t),s.push(a,n,t)):x===C?(I=`${Math.min(n,t)} ${Math.max(n,t)}`,a=f[I],D(a)||(O=y.interpolateUsingFraction(.5,QO),P=.5*(T.height+w.height),N=H.fromRadians(O.longitude,O.latitude,P,e,VO),l.push(N.x,N.y,N.z),a=l.length/3-1,f[I]=a,r&&(R=kt.add(m,v,WO),kt.multiplyByScalar(R,.5,R),u.push(R.x,R.y))),s.push(n,a,i),s.push(a,t,i)):S===C&&(I=`${Math.min(t,i)} ${Math.max(t,i)}`,a=f[I],D(a)||(O=b.interpolateUsingFraction(.5,QO),P=.5*(w.height+A.height),N=H.fromRadians(O.longitude,O.latitude,P,e,VO),l.push(N.x,N.y,N.z),a=l.length/3-1,f[I]=a,r&&(R=kt.add(v,h,WO),kt.multiplyByScalar(R,.5,R),u.push(R.x,R.y))),s.push(t,a,n),s.push(a,i,n)):(p.push(i),p.push(n),p.push(t))}const v={attributes:{position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:l})},indices:p,primitiveType:Vr.TRIANGLES};return r&&(v.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:u})),new Na(v)},LO.scaleToGeodeticHeight=function(e,t,n,i){n=M(n,on.WGS84);let o=NO,r=RO;if(t=M(t,0),i=M(i,!0),D(e)){const s=e.length;for(let a=0;a<s;a+=3)H.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),0!==t&&(o=n.geodeticSurfaceNormal(r,o),H.multiplyByScalar(o,t,o),H.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};const $O=LO;function KO(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(KO.prototype,{length:{get:function(){return this._length}}}),KO.prototype.enqueue=function(e){this._array.push(e),this._length++},KO.prototype.dequeue=function(){if(0===this._length)return;const e=this._array;let t=this._offset;const n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n},KO.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},KO.prototype.contains=function(e){return-1!==this._array.indexOf(e)},KO.prototype.clear=function(){this._array.length=this._offset=this._length=0},KO.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const ZO={computeHierarchyPackedLength:function(e,t){let n=0;const i=[e];for(;i.length>0;){const e=i.pop();if(!D(e))continue;n+=2;const o=e.positions,r=e.holes;if(D(o)&&o.length>0&&(n+=o.length*t.packedLength),D(r)){const e=r.length;for(let t=0;t<e;++t)i.push(r[t])}}return n},packPolygonHierarchy:function(e,t,n,i){const o=[e];for(;o.length>0;){const e=o.pop();if(!D(e))continue;const r=e.positions,s=e.holes;if(t[n++]=D(r)?r.length:0,t[n++]=D(s)?s.length:0,D(r)){const e=r.length;for(let o=0;o<e;++o,n+=i.packedLength)i.pack(r[o],t,n)}if(D(s)){const e=s.length;for(let t=0;t<e;++t)o.push(s[t])}}return n},unpackPolygonHierarchy:function(e,t,n){const i=e[t++],o=e[t++],r=new Array(i),s=o>0?new Array(o):void 0;for(let a=0;a<i;++a,t+=n.packedLength)r[a]=n.unpack(e,t);for(let a=0;a<o;++a)s[a]=ZO.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}}},JO=new kt;function eD(e,t,n,i){return kt.subtract(t,e,JO),kt.multiplyByScalar(JO,n/i,JO),kt.add(e,JO,JO),[JO.x,JO.y]}const tD=new H;function nD(e,t,n,i){return H.subtract(t,e,tD),H.multiplyByScalar(tD,n/i,tD),H.add(e,tD,tD),[tD.x,tD.y,tD.z]}ZO.subdivideLineCount=function(e,t,n){const i=H.distance(e,t)/n,o=Math.max(0,Math.ceil(V.log2(i)));return Math.pow(2,o)};const iD=new Qt,oD=new Qt,rD=new Qt,sD=new H,aD=new Wy;ZO.subdivideRhumbLineCount=function(e,t,n,i){const o=new Wy(e.cartesianToCartographic(t,iD),e.cartesianToCartographic(n,oD),e).surfaceDistance/i,r=Math.max(0,Math.ceil(V.log2(o)));return Math.pow(2,r)},ZO.subdivideTexcoordLine=function(e,t,n,i,o,r){const s=ZO.subdivideLineCount(n,i,o),a=kt.distance(e,t),c=a/s,l=r;l.length=2*s;let u=0;for(let d=0;d<s;d++){const n=eD(e,t,d*c,a);l[u++]=n[0],l[u++]=n[1]}return l},ZO.subdivideLine=function(e,t,n,i){const o=ZO.subdivideLineCount(e,t,n),r=H.distance(e,t),s=r/o;D(i)||(i=[]);const a=i;a.length=3*o;let c=0;for(let l=0;l<o;l++){const n=nD(e,t,l*s,r);a[c++]=n[0],a[c++]=n[1],a[c++]=n[2]}return a},ZO.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){const a=n.cartesianToCartographic(i,iD),c=n.cartesianToCartographic(o,oD);aD.setEndPoints(a,c);const l=aD.surfaceDistance/r,u=Math.max(0,Math.ceil(V.log2(l))),d=Math.pow(2,u),h=kt.distance(e,t),p=h/d,f=s;f.length=2*d;let m=0;for(let _=0;_<d;_++){const n=eD(e,t,_*p,h);f[m++]=n[0],f[m++]=n[1]}return f},ZO.subdivideRhumbLine=function(e,t,n,i,o){const r=new Wy(e.cartesianToCartographic(t,iD),e.cartesianToCartographic(n,oD),e),s=r.surfaceDistance/i,a=Math.max(0,Math.ceil(V.log2(s))),c=Math.pow(2,a),l=r.surfaceDistance/c;D(o)||(o=[]);const u=o;u.length=3*c;let d=0;for(let h=0;h<c;h++){const t=r.interpolateUsingSurfaceDistance(h*l,rD),n=e.cartographicToCartesian(t,sD);u[d++]=n.x,u[d++]=n.y,u[d++]=n.z}return u};const cD=new H,lD=new H,uD=new H,dD=new H;ZO.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=M(i,on.WGS84);const r=cD;let s=lD;const a=uD;let c=dD;if(D(e)&&D(e.attributes)&&D(e.attributes.position)){const l=e.attributes.position.values,u=l.length/2;for(let e=0;e<u;e+=3)H.fromArray(l,e,a),i.geodeticSurfaceNormal(a,r),c=i.scaleToGeodeticSurface(a,c),s=H.multiplyByScalar(r,n,s),s=H.add(c,s,s),l[e+u]=s.x,l[e+1+u]=s.y,l[e+2+u]=s.z,o&&(c=H.clone(a,c)),s=H.multiplyByScalar(r,t,s),s=H.add(c,s,s),l[e]=s.x,l[e+1]=s.y,l[e+2]=s.z}return e},ZO.polygonOutlinesFromHierarchy=function(e,t,n){const i=[],o=new KO;let r,s,a;for(o.enqueue(e);0!==o.length;){const e=o.dequeue();let c=e.positions;if(t)for(a=c.length,r=0;r<a;r++)n.scaleToGeodeticSurface(c[r],c[r]);if(c=Ry(c,H.equalsEpsilon,!0),c.length<3)continue;const l=e.holes?e.holes.length:0;for(r=0;r<l;r++){const c=e.holes[r];let l=c.positions;if(t)for(a=l.length,s=0;s<a;++s)n.scaleToGeodeticSurface(l[s],l[s]);if(l=Ry(l,H.equalsEpsilon,!0),l.length<3)continue;i.push(l);let u=0;for(D(c.holes)&&(u=c.holes.length),s=0;s<u;s++)o.enqueue(c.holes[s])}i.push(c)}return i};const hD=new Qt;function pD(e,t,n,i){if(i===Py.RHUMB)return function(e,t,n){const i=n.cartesianToCartographic(e,iD),o=n.cartesianToCartographic(t,oD);if(Math.sign(i.latitude)===Math.sign(o.latitude))return;aD.setEndPoints(i,o);const r=aD.findIntersectionWithLatitude(0,hD);if(!D(r))return;let s=Math.min(i.longitude,o.longitude),a=Math.max(i.longitude,o.longitude);if(Math.abs(a-s)>V.PI){const e=s;s=a,a=e}return r.longitude<s||r.longitude>a?void 0:n.cartographicToCartesian(r)}(e,t,n);const o=Pp.lineSegmentPlane(e,t,Pc.ORIGIN_XY_PLANE);return D(o)?n.scaleToGeodeticSurface(o,o):void 0}const fD=new Qt;function mD(e,t,n){const i=[];let o,r,s,a,c,l=0;for(;l<e.length;){o=e[l],r=e[(l+1)%e.length],s=V.sign(o.z),a=V.sign(r.z);const u=e=>t.cartesianToCartographic(e,fD).longitude;if(0===s)i.push({position:l,type:s,visited:!1,next:a,theta:u(o)});else if(0!==a){if(c=pD(o,r,t,n),++l,!D(c))continue;e.splice(l,0,c),i.push({position:l,type:s,visited:!1,next:a,theta:u(c)})}++l}return i}function _D(e,t,n,i,o,r,s){const a=[];let c=r;const l=e=>t=>t.position===e,u=[];do{const e=n[c];a.push(e);const t=i.findIndex(l(c)),o=i[t];if(!D(o)){++c;continue}const{visited:d,type:h,next:p}=o;if(o.visited=!0,0===h){if(0===p){const e=i[t-(s?1:-1)];if((null==e?void 0:e.position)!==c+1){++c;continue}e.visited=!0}if(!d&&s&&p>0||r===c&&!s&&p<0){++c;continue}}if(!(s?h>=0:h<=0)){++c;continue}d||u.push(c);const f=i[t+(s?1:-1)];D(f)?c=f.position:++c}while(c<n.length&&c>=0&&c!==r&&a.length<n.length);e.splice(t,o,a);for(const d of u)t=_D(e,++t,n,i,0,d,!s);return t}ZO.splitPolygonsOnEquator=function(e,t,n,i){D(i)||(i=[]),i.splice(0,0,...e),i.length=e.length;let o=0;for(;o<i.length;){const e=i[o],r=e.slice();if(e.length<3){i[o]=r,++o;continue}const s=mD(r,t,n);if(r.length===e.length||s.length<=1){i[o]=r,++o;continue}s.sort(((e,t)=>e.theta-t.theta));o=_D(i,o,r,s,1,0,r[0].z>=0)}return i},ZO.polygonsFromHierarchy=function(e,t,n,i,o,r){const s=[],a=[],c=new KO;c.enqueue(e);let l=D(r);for(;0!==c.length;){const e=c.dequeue();let u=e.positions;const d=e.holes;let h,p;if(i)for(p=u.length,h=0;h<p;h++)o.scaleToGeodeticSurface(u[h],u[h]);if(t||(u=Ry(u,H.equalsEpsilon,!0)),u.length<3)continue;let f=n(u);if(!D(f))continue;const m=[];let _=$O.computeWindingOrder2D(f);if(_===us.CLOCKWISE&&(f.reverse(),u=u.slice().reverse()),l){l=!1;let e=[u];if(e=r(e,e),e.length>1){for(const t of e)c.enqueue(new sA(t,d));continue}}let g=u.slice();const y=D(d)?d.length:0,b=[];let v;for(h=0;h<y;h++){const e=d[h];let r=e.positions;if(i)for(p=r.length,v=0;v<p;++v)o.scaleToGeodeticSurface(r[v],r[v]);if(t||(r=Ry(r,H.equalsEpsilon,!0)),r.length<3)continue;const s=n(r);if(!D(s))continue;_=$O.computeWindingOrder2D(s),_===us.CLOCKWISE&&(s.reverse(),r=r.slice().reverse()),b.push(r),m.push(g.length),g=g.concat(r),f=f.concat(s);let a=0;for(D(e.holes)&&(a=e.holes.length),v=0;v<a;v++)c.enqueue(e.holes[v])}s.push({outerRing:u,holes:b}),a.push({positions:g,positions2D:f,holes:m})}return{hierarchy:s,polygons:a}};const gD=new kt,yD=new H,bD=new _o,vD=new re;ZO.computeBoundingRectangle=function(e,t,n,i,o){const r=_o.fromAxisAngle(e,i,bD),s=re.fromQuaternion(r,vD);let a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;const d=n.length;for(let h=0;h<d;++h){const e=H.clone(n[h],yD);re.multiplyByVector(s,e,e);const i=t(e,gD);D(i)&&(a=Math.min(a,i.x),c=Math.max(c,i.x),l=Math.min(l,i.y),u=Math.max(u,i.y))}return o.x=a,o.y=l,o.width=c-a,o.height=u-l,o},ZO.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=$O.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);const c=t.positions,l=D(n),u=l?n.positions:void 0;if(o){const e=c.length,t=new Array(3*e);let n=0;for(let r=0;r<e;r++){const e=c[r];t[n++]=e.x,t[n++]=e.y,t[n++]=e.z}const i={attributes:{position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:t})},indices:a,primitiveType:Vr.TRIANGLES};l&&(i.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:kt.packArray(u)}));const o=new Na(i);return r.normal?C_.computeNormal(o):o}return s===Py.GEODESIC?$O.computeSubdivision(e,c,a,u,i):s===Py.RHUMB?$O.computeRhumbLineSubdivision(e,c,a,u,i):void 0};const AD=[],TD=[],wD=new H,ED=new H;ZO.computeWallGeometry=function(e,t,n,i,o,r){let s,a,c,l,u,d,h,p,f,m=e.length,_=0,g=0;const y=D(t),b=y?t.positions:void 0;if(o)for(a=3*m*2,s=new Array(2*a),y&&(f=2*m*2,p=new Array(2*f)),c=0;c<m;c++)l=e[c],u=e[(c+1)%m],s[_]=s[_+a]=l.x,++_,s[_]=s[_+a]=l.y,++_,s[_]=s[_+a]=l.z,++_,s[_]=s[_+a]=u.x,++_,s[_]=s[_+a]=u.y,++_,s[_]=s[_+a]=u.z,++_,y&&(d=b[c],h=b[(c+1)%m],p[g]=p[g+f]=d.x,++g,p[g]=p[g+f]=d.y,++g,p[g]=p[g+f]=h.x,++g,p[g]=p[g+f]=h.y,++g);else{const t=V.chordLength(i,n.maximumRadius);let o=0;if(r===Py.GEODESIC)for(c=0;c<m;c++)o+=ZO.subdivideLineCount(e[c],e[(c+1)%m],t);else if(r===Py.RHUMB)for(c=0;c<m;c++)o+=ZO.subdivideRhumbLineCount(n,e[c],e[(c+1)%m],t);for(a=3*(o+m),s=new Array(2*a),y&&(f=2*(o+m),p=new Array(2*f)),c=0;c<m;c++){let i,o;l=e[c],u=e[(c+1)%m],y&&(d=b[c],h=b[(c+1)%m]),r===Py.GEODESIC?(i=ZO.subdivideLine(l,u,t,TD),y&&(o=ZO.subdivideTexcoordLine(d,h,l,u,t,AD))):r===Py.RHUMB&&(i=ZO.subdivideRhumbLine(n,l,u,t,TD),y&&(o=ZO.subdivideTexcoordRhumbLine(d,h,n,l,u,t,AD)));const v=i.length;for(let e=0;e<v;++e,++_)s[_]=i[e],s[_+a]=i[e];if(s[_]=u.x,s[_+a]=u.x,++_,s[_]=u.y,s[_+a]=u.y,++_,s[_]=u.z,s[_+a]=u.z,++_,y){const e=o.length;for(let t=0;t<e;++t,++g)p[g]=o[t],p[g+f]=o[t];p[g]=h.x,p[g+f]=h.x,++g,p[g]=h.y,p[g+f]=h.y,++g}}}m=s.length;const v=je.createTypedArray(m/3,m-6*e.length);let A=0;for(m/=6,c=0;c<m;c++){const e=c,t=e+1,n=e+m,i=n+1;l=H.fromArray(s,3*e,wD),u=H.fromArray(s,3*t,ED),H.equalsEpsilon(l,u,V.EPSILON10,V.EPSILON10)||(v[A++]=e,v[A++]=n,v[A++]=t,v[A++]=t,v[A++]=n,v[A++]=i)}const T={attributes:new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s})}),indices:v,primitiveType:Vr.TRIANGLES};y&&(T.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:p}));return new Na(T)};const xD=ZO;function SD(e,t){this.position=e,D(this.position)||(this.position=new kt),this.tangentPlane=t,D(this.tangentPlane)||(this.tangentPlane=SD.NORTH_POLE_TANGENT_PLANE)}Object.defineProperties(SD.prototype,{ellipsoid:{get:function(){return this.tangentPlane.ellipsoid}},x:{get:function(){return this.position.x}},y:{get:function(){return this.position.y}},conformalLatitude:{get:function(){const e=kt.magnitude(this.position),t=2*this.ellipsoid.maximumRadius;return this.tangentPlane.plane.normal.z*(V.PI_OVER_TWO-2*Math.atan2(e,t))}},longitude:{get:function(){let e=V.PI_OVER_TWO+Math.atan2(this.y,this.x);return e>Math.PI&&(e-=V.TWO_PI),e}}});const CD=new Qt,ID=new H;SD.prototype.getLatitude=function(e){D(e)||(e=on.WGS84),CD.latitude=this.conformalLatitude,CD.longitude=this.longitude,CD.height=0;const t=this.ellipsoid.cartographicToCartesian(CD,ID);return e.cartesianToCartographic(t,CD),CD.latitude};const OD=new tp,DD=new H,PD=new H;SD.fromCartesian=function(e,t){L.defined("cartesian",e);const n=V.signNotZero(e.z);let i=SD.NORTH_POLE_TANGENT_PLANE,o=SD.SOUTH_POLE;n<0&&(i=SD.SOUTH_POLE_TANGENT_PLANE,o=SD.NORTH_POLE);const r=OD;r.origin=i.ellipsoid.scaleToGeocentricSurface(e,r.origin),r.direction=H.subtract(r.origin,o,DD),H.normalize(r.direction,r.direction);const s=Pp.rayPlane(r,i.plane,PD),a=H.subtract(s,o,s),c=H.dot(i.xAxis,a),l=n*H.dot(i.yAxis,a);return D(t)?(t.position=new kt(c,l),t.tangentPlane=i,t):new SD(new kt(c,l),i)},SD.fromCartesianArray=function(e,t){L.defined("cartesians",e);const n=e.length;D(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=SD.fromCartesian(e[i],t[i]);return t},SD.clone=function(e,t){if(D(e))return D(t)?(t.position=e.position,t.tangentPlane=e.tangentPlane,t):new SD(e.position,e.tangentPlane)},SD.HALF_UNIT_SPHERE=Object.freeze(new on(.5,.5,.5)),SD.NORTH_POLE=Object.freeze(new H(0,0,.5)),SD.SOUTH_POLE=Object.freeze(new H(0,0,-.5)),SD.NORTH_POLE_TANGENT_PLANE=Object.freeze(new Rp(SD.NORTH_POLE,SD.HALF_UNIT_SPHERE)),SD.SOUTH_POLE_TANGENT_PLANE=Object.freeze(new Rp(SD.SOUTH_POLE,SD.HALF_UNIT_SPHERE));const ND=new Qt,RD=new Qt;function LD(e,t,n,i){const o=i.cartesianToCartographic(e,ND).height,r=i.cartesianToCartographic(t,RD);r.height=o,i.cartographicToCartesian(r,t);const s=i.cartesianToCartographic(n,RD);s.height=o-100,i.cartographicToCartesian(s,n)}const MD=new Fr,FD=new H,BD=new H,zD=new H,UD=new H,kD=new H,VD=new H;let HD=new H,GD=new H,jD=new H;const WD=new kt,qD=new kt,YD=new H,XD=new _o,QD=new re,$D=new re;function KD(e){const t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,o=n.attributes.position.values,r=D(n.attributes.st)?n.attributes.st.values:void 0;let s=o.length;const a=e.wall,c=e.top||a,l=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){const u=e.boundingRectangle,d=e.rotationAxis,h=e.projectTo2d,p=e.ellipsoid,f=e.stRotation,m=e.perPositionHeight,_=WD;_.x=u.x,_.y=u.y;const g=t.st?new Float32Array(s/3*2):void 0;let y;t.normal&&(y=m&&c&&!a?n.attributes.normal.values:new Float32Array(s));const b=t.tangent?new Float32Array(s):void 0,v=t.bitangent?new Float32Array(s):void 0,A=i?new Float32Array(s):void 0;let T=0,w=0,E=BD,x=zD,S=UD,C=!0,I=QD,O=$D;if(0!==f){let e=_o.fromAxisAngle(d,f,XD);I=re.fromQuaternion(e,I),e=_o.fromAxisAngle(d,-f,XD),O=re.fromQuaternion(e,O)}else I=re.clone(re.IDENTITY,I),O=re.clone(re.IDENTITY,O);let P=0,N=0;c&&l&&(P=s/2,N=s/3,s/=2);for(let n=0;n<s;n+=3){const d=H.fromArray(o,n,YD);if(t.st&&!D(r)){let e=re.multiplyByVector(I,d,FD);e=p.scaleToGeodeticSurface(e,e);const t=h([e],qD)[0];kt.subtract(t,_,t);const n=V.clamp(t.x/u.width,0,1),i=V.clamp(t.y/u.height,0,1);l&&(g[T+N]=n,g[T+1+N]=i),c&&(g[T]=n,g[T+1]=i),T+=2}if(t.normal||t.tangent||t.bitangent||i){const r=w+1,u=w+2;if(a){if(n+3<s){const e=H.fromArray(o,n+3,kD);if(C){const t=H.fromArray(o,n+s,VD);m&&LD(d,e,t,p),H.subtract(e,d,e),H.subtract(t,d,t),E=H.normalize(H.cross(t,e,E),E),C=!1}H.equalsEpsilon(e,d,V.EPSILON10)&&(C=!0)}(t.tangent||t.bitangent)&&(S=p.geodeticSurfaceNormal(d,S),t.tangent&&(x=H.normalize(H.cross(S,E,x),x)))}else E=p.geodeticSurfaceNormal(d,E),(t.tangent||t.bitangent)&&(m&&(HD=H.fromArray(y,w,HD),GD=H.cross(H.UNIT_Z,HD,GD),GD=H.normalize(re.multiplyByVector(O,GD,GD),GD),t.bitangent&&(jD=H.normalize(H.cross(HD,GD,jD),jD))),x=H.cross(H.UNIT_Z,E,x),x=H.normalize(re.multiplyByVector(O,x,x),x),t.bitangent&&(S=H.normalize(H.cross(E,x,S),S)));t.normal&&(e.wall?(y[w+P]=E.x,y[r+P]=E.y,y[u+P]=E.z):l&&(y[w+P]=-E.x,y[r+P]=-E.y,y[u+P]=-E.z),(c&&!m||a)&&(y[w]=E.x,y[r]=E.y,y[u]=E.z)),i&&(a&&(E=p.geodeticSurfaceNormal(d,E)),A[w+P]=-E.x,A[r+P]=-E.y,A[u+P]=-E.z),t.tangent&&(e.wall?(b[w+P]=x.x,b[r+P]=x.y,b[u+P]=x.z):l&&(b[w+P]=-x.x,b[r+P]=-x.y,b[u+P]=-x.z),c&&(m?(b[w]=GD.x,b[r]=GD.y,b[u]=GD.z):(b[w]=x.x,b[r]=x.y,b[u]=x.z))),t.bitangent&&(l&&(v[w+P]=S.x,v[r+P]=S.y,v[u+P]=S.z),c&&(m?(v[w]=jD.x,v[r]=jD.y,v[u]=jD.z):(v[w]=S.x,v[r]=S.y,v[u]=S.z))),w+=3}}t.st&&!D(r)&&(n.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:g})),t.normal&&(n.attributes.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:y})),t.tangent&&(n.attributes.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:b})),t.bitangent&&(n.attributes.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:v})),i&&(n.attributes.extrudeDirection=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:A}))}if(e.extrude&&D(e.offsetAttribute)){const t=o.length/3;let i=new Uint8Array(t);if(e.offsetAttribute===Fd.TOP)c&&l||a?i=i.fill(1,0,t/2):c&&(i=i.fill(1));else{const t=e.offsetAttribute===Fd.NONE?0:1;i=i.fill(t)}n.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return n}const ZD=[];function JD(e,t,n,i,o,r,s,a,c,l){const u={walls:[]};let d;if(s||a){const o=xD.createGeometryFromPositions(e,t,n,i,r,c,l),h=o.attributes.position.values,p=o.indices;let f,m;if(s&&a){const e=h.concat(h);f=e.length/3,m=je.createTypedArray(f,2*p.length),m.set(p);const t=p.length,i=f/2;for(d=0;d<t;d+=3){const e=m[d]+i,n=m[d+1]+i,o=m[d+2]+i;m[d+t]=o,m[d+1+t]=n,m[d+2+t]=e}if(o.attributes.position.values=e,r&&c.normal){const t=o.attributes.normal.values;o.attributes.normal.values=new Float32Array(e.length),o.attributes.normal.values.set(t)}if(c.st&&D(n)){const e=o.attributes.st.values;o.attributes.st.values=new Float32Array(2*f),o.attributes.st.values=e.concat(e)}o.indices=m}else if(a){for(f=h.length/3,m=je.createTypedArray(f,p.length),d=0;d<p.length;d+=3)m[d]=p[d+2],m[d+1]=p[d+1],m[d+2]=p[d];o.indices=m}u.topAndBottom=new Zd({geometry:o})}let h=o.outerRing;const p=Rp.fromPoints(h,e);let f=p.projectPointsOntoPlane(h,ZD),m=$O.computeWindingOrder2D(f);m===us.CLOCKWISE&&(h=h.slice().reverse());let _=xD.computeWallGeometry(h,n,e,i,r,l);u.walls.push(new Zd({geometry:_}));const g=o.holes;for(d=0;d<g.length;d++){let t=g[d];f=p.projectPointsOntoPlane(t,ZD),m=$O.computeWindingOrder2D(f),m===us.COUNTER_CLOCKWISE&&(t=t.slice().reverse()),_=xD.computeWallGeometry(t,n,e,i,r,l),u.walls.push(new Zd({geometry:_}))}return u}function eP(e){if(L.typeOf.object("options",e),L.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),D(e.perPositionHeight)&&e.perPositionHeight&&D(e.height))throw new P("Cannot use both options.perPositionHeight and options.height");if(D(e.arcType)&&e.arcType!==Py.GEODESIC&&e.arcType!==Py.RHUMB)throw new P("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=M(e.vertexFormat,Bd.DEFAULT),i=M(e.ellipsoid,on.WGS84),o=M(e.granularity,V.RADIANS_PER_DEGREE),r=M(e.stRotation,0),s=e.textureCoordinates,a=M(e.perPositionHeight,!1),c=a&&D(e.extrudedHeight);let l=M(e.height,0),u=M(e.extrudedHeight,l);if(!c){const e=Math.max(l,u);u=Math.min(l,u),l=e}this._vertexFormat=Bd.clone(n),this._ellipsoid=on.clone(i),this._granularity=o,this._stRotation=r,this._height=l,this._extrudedHeight=u,this._closeTop=M(e.closeTop,!0),this._closeBottom=M(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=c,this._shadowVolume=M(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=M(e.arcType,Py.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=xD.computeHierarchyPackedLength(t,H)+on.packedLength+Bd.packedLength+(s?xD.computeHierarchyPackedLength(s,kt):1)+12}eP.fromPositions=function(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.positions",e.positions);return new eP({polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType,textureCoordinates:e.textureCoordinates})},eP.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),n=xD.packPolygonHierarchy(e._polygonHierarchy,t,n,H),on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._stRotation,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._closeTop?1:0,t[n++]=e._closeBottom?1:0,t[n++]=e._shadowVolume?1:0,t[n++]=M(e._offsetAttribute,-1),t[n++]=e._arcType,D(e._textureCoordinates)?n=xD.packPolygonHierarchy(e._textureCoordinates,t,n,kt):t[n++]=-1,t[n++]=e.packedLength,t};const tP=on.clone(on.UNIT_SPHERE),nP=new Bd,iP={polygonHierarchy:{}};eP.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=xD.unpackPolygonHierarchy(e,t,H);t=i.startingIndex,delete i.startingIndex;const o=on.unpack(e,t,tP);t+=on.packedLength;const r=Bd.unpack(e,t,nP);t+=Bd.packedLength;const s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=1===e[t++],d=1===e[t++],h=1===e[t++],p=1===e[t++],f=1===e[t++],m=e[t++],_=e[t++],g=-1===e[t]?void 0:xD.unpackPolygonHierarchy(e,t,kt);D(g)?(t=g.startingIndex,delete g.startingIndex):t++;const y=e[t++];return D(n)||(n=new eP(iP)),n._polygonHierarchy=i,n._ellipsoid=on.clone(o,n._ellipsoid),n._vertexFormat=Bd.clone(r,n._vertexFormat),n._height=s,n._extrudedHeight=a,n._granularity=c,n._stRotation=l,n._perPositionHeightExtrude=u,n._perPositionHeight=d,n._closeTop=h,n._closeBottom=p,n._shadowVolume=f,n._offsetAttribute=-1===m?void 0:m,n._arcType=_,n._textureCoordinates=g,n.packedLength=y,n};const oP=new kt,rP=new kt,sP=new SD;function aP(e,t,n,i,o,r){const s=e.longitude,a=s>=0?s:s+V.TWO_PI;o.westOverIdl=Math.min(o.westOverIdl,a),o.eastOverIdl=Math.max(o.eastOverIdl,a),r.west=Math.min(r.west,s),r.east=Math.max(r.east,s);const c=e.getLatitude(n);let l=c;if(r.south=Math.min(r.south,c),r.north=Math.max(r.north,c),i!==Py.RHUMB){const i=kt.subtract(t.position,e.position,oP),o=kt.dot(t.position,i)/kt.dot(i,i);if(o>0&&o<1){const e=kt.add(t.position,kt.multiplyByScalar(i,-o,i),rP),s=SD.clone(t,sP);s.position=e;const a=s.getLatitude(n);r.south=Math.min(r.south,a),r.north=Math.max(r.north,a),Math.abs(c)>Math.abs(a)&&(l=a)}}const u=t.x*e.y-e.x*t.y;let d=Math.sign(u);0!==d&&(d*=kt.angleBetween(t.position,e.position)),l>=0&&(o.northAngle+=d),l<=0&&(o.southAngle+=d)}const cP=new SD,lP=new SD,uP={northAngle:0,southAngle:0,westOverIdl:0,eastOverIdl:0};eP.computeRectangleFromPositions=function(e,t,n,i){if(L.defined("positions",e),D(i)||(i=new Ir),e.length<3)return i;i.west=Number.POSITIVE_INFINITY,i.east=Number.NEGATIVE_INFINITY,i.south=Number.POSITIVE_INFINITY,i.north=Number.NEGATIVE_INFINITY,uP.northAngle=0,uP.southAngle=0,uP.westOverIdl=Number.POSITIVE_INFINITY,uP.eastOverIdl=Number.NEGATIVE_INFINITY;const o=e.length;let r=SD.fromCartesian(e[0],lP);for(let s=1;s<o;s++){const o=SD.fromCartesian(e[s],cP);aP(o,r,t,n,uP,i),r=SD.clone(o,r)}return aP(SD.fromCartesian(e[0],cP),r,t,n,uP,i),i.east-i.west>uP.eastOverIdl-uP.westOverIdl&&(i.west=uP.westOverIdl,i.east=uP.eastOverIdl,i.east>V.PI&&(i.east=i.east-V.TWO_PI),i.west>V.PI&&(i.west=i.west-V.TWO_PI)),V.equalsEpsilon(Math.abs(uP.northAngle),V.TWO_PI,V.EPSILON10)&&(i.north=V.PI_OVER_TWO,i.east=V.PI,i.west=-V.PI),V.equalsEpsilon(Math.abs(uP.southAngle),V.TWO_PI,V.EPSILON10)&&(i.south=-V.PI_OVER_TWO,i.east=V.PI,i.west=-V.PI),i};const dP=new SD;function hP(e,t,n){if(e.height>=V.PI||e.width>=V.PI){return SD.fromCartesian(t[0],dP).tangentPlane}return Rp.fromPoints(t,n)}const pP=new Qt;function fP(e,t,n){if(e.height>=V.PI||e.width>=V.PI)return(t,i)=>{if(e.south<0&&e.north>0){const e=n.cartesianToCartographic(t,pP);return D(i)||(i=new kt),i.x=e.longitude/V.PI,i.y=e.latitude/V.PI_OVER_TWO,i}return SD.fromCartesian(t,i)};const i=Rp.fromPoints(t,n);return(e,t)=>i.projectPointsOntoPlane(e,t)}function mP(e){L.typeOf.object("options",e),L.typeOf.object("options.positions",e.positions),L.typeOf.number.greaterThanOrEquals("options.positions.length",e.positions.length,3),this._ellipsoid=M(e.ellipsoid,on.WGS84),this._positions=[...e.positions]}eP.createGeometry=function(e){const t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,o=e._stRotation,r=e._polygonHierarchy,s=e._perPositionHeight,a=e._closeTop,c=e._closeBottom,l=e._arcType,u=e._textureCoordinates,d=D(u),h=r.positions;if(h.length<3)return;const p=e.rectangle,f=xD.polygonsFromHierarchy(r,d,function(e,t,n){return(i,o)=>{if(e.height>=V.PI||e.width>=V.PI){if(e.south<0&&e.north>0){D(o)||(o=[]);for(let e=0;e<i.length;++e){const t=n.cartesianToCartographic(i[e],pP);o[e]=new kt(t.longitude/V.PI,t.latitude/V.PI_OVER_TWO)}return o.length=i.length,o}return SD.fromCartesianArray(i,o)}return Rp.fromPoints(t,n).projectPointsOntoPlane(i,o)}}(p,h,n),!s,n,function(e,t,n,i){return(o,r)=>!i&&(e.height>=V.PI_OVER_TWO||e.width>=2*V.PI_OVER_THREE)?xD.splitPolygonsOnEquator(o,t,n,r):o}(p,n,l,s)),m=f.hierarchy,_=f.polygons,g=d?xD.polygonsFromHierarchy(u,!0,(function(e){return e}),!1,n).polygons:void 0;if(0===m.length)return;const y=m[0].outerRing,b=function(e,t,n,i){if(t.height>=V.PI||t.width>=V.PI)return Fr.fromRectangle(t,void 0,MD);const o=e,r=Rp.fromPoints(o,n);return xD.computeBoundingRectangle(r.plane.normal,r.projectPointOntoPlane.bind(r),o,i,MD)}(y,p,n,o),v=[],A=e._height,T=e._extrudedHeight,w=e._perPositionHeightExtrude||!V.equalsEpsilon(A,T,0,V.EPSILON2),E={perPositionHeight:s,vertexFormat:t,geometry:void 0,rotationAxis:hP(p,y,n).plane.normal,projectTo2d:fP(p,y,n),boundingRectangle:b,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:l};let x;if(w)for(E.extrude=!0,E.top=a,E.bottom=c,E.shadowVolume=e._shadowVolume,E.offsetAttribute=e._offsetAttribute,x=0;x<_.length;x++){const e=JD(n,_[x],d?g[x]:void 0,i,m[x],s,a,c,t,l);let o;a&&c?(o=e.topAndBottom,E.geometry=xD.scaleToGeodeticHeightExtruded(o.geometry,A,T,n,s)):a?(o=e.topAndBottom,o.geometry.attributes.position.values=$O.scaleToGeodeticHeight(o.geometry.attributes.position.values,A,n,!s),E.geometry=o.geometry):c&&(o=e.topAndBottom,o.geometry.attributes.position.values=$O.scaleToGeodeticHeight(o.geometry.attributes.position.values,T,n,!0),E.geometry=o.geometry),(a||c)&&(E.wall=!1,o.geometry=KD(E),v.push(o));const r=e.walls;E.wall=!0;for(let t=0;t<r.length;t++){const e=r[t];E.geometry=xD.scaleToGeodeticHeightExtruded(e.geometry,A,T,n,s),e.geometry=KD(E),v.push(e)}}else for(x=0;x<_.length;x++){const o=new Zd({geometry:xD.createGeometryFromPositions(n,_[x],d?g[x]:void 0,i,s,t,l)});if(o.geometry.attributes.position.values=$O.scaleToGeodeticHeight(o.geometry.attributes.position.values,A,n,!s),E.geometry=o.geometry,o.geometry=KD(E),D(e._offsetAttribute)){const t=o.geometry.attributes.position.values.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);o.geometry.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}v.push(o)}const S=C_.combineInstances(v)[0];S.attributes.position.values=new Float64Array(S.attributes.position.values),S.indices=je.createTypedArray(S.attributes.position.values.length/3,S.indices);const C=S.attributes,I=$u.fromVertices(C.position.values);return t.position||delete C.position,new Na({attributes:C,indices:S.indices,primitiveType:S.primitiveType,boundingSphere:I,offsetAttribute:e._offsetAttribute})},eP.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new eP({polygonHierarchy:e._polygonHierarchy,ellipsoid:o,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:s,vertexFormat:Bd.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})},Object.defineProperties(eP.prototype,{rectangle:{get:function(){if(!D(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=eP.computeRectangleFromPositions(e,this._ellipsoid,this._arcType)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return D(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(e){const t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];const n=e._ellipsoid,i=e._polygonHierarchy.positions,o=e.rectangle;return Na._textureCoordinateRotationPoints(i,t,n,o)}(this)),this._textureCoordinateRotationPoints}}}),Object.defineProperties(mP.prototype,{length:{get:function(){return this._positions.length}},positions:{get:function(){return this._positions}},ellipsoid:{get:function(){return this._ellipsoid}}}),mP.clone=function(e,t){return L.typeOf.object("polygon",e),D(t)?(t._ellipsoid=e.ellipsoid,t._positions.length=0,t._positions.push(...e.positions),t):new mP({positions:e.positions,ellipsoid:e.ellipsoid})},mP.equals=function(e,t){return L.typeOf.object("left",e),L.typeOf.object("right",t),e.ellipsoid.equals(t.ellipsoid)&&e.positions===t.positions},mP.prototype.computeRectangle=function(e){return eP.computeRectangleFromPositions(this.positions,this.ellipsoid,void 0,e)};const _P=new Ir,gP=new H;mP.prototype.computeSphericalExtents=function(e){D(e)||(e=new Ir);const t=this.computeRectangle(_P);let n=Qt.toCartesian(Ir.southwest(t),this.ellipsoid,gP),i=Math.sqrt(n.x*n.x+n.y*n.y),o=V.fastApproximateAtan2(i,n.z),r=V.fastApproximateAtan2(n.x,n.y);return e.south=o,e.west=r,n=Qt.toCartesian(Ir.northeast(t),this.ellipsoid,gP),i=Math.sqrt(n.x*n.x+n.y*n.y),o=V.fastApproximateAtan2(i,n.z),r=V.fastApproximateAtan2(n.x,n.y),e.north=o,e.east=r,e};const yP="in vec2 v_textureCoordinates;\n\nuniform int u_polygonsLength;\nuniform int u_extentsLength;\nuniform highp sampler2D u_polygonTexture;\nuniform highp sampler2D u_extentsTexture;\n\nint getPolygonIndex(float dimension, vec2 coord) {\n vec2 uv = coord.xy * dimension;\n return int(floor(uv.y) * dimension + floor(uv.x));\n}\n\nvec2 getLookupUv(ivec2 dimensions, int i) {\n int pixY = i / dimensions.x;\n int pixX = i - (pixY * dimensions.x);\n float pixelWidth = 1.0 / float(dimensions.x);\n float pixelHeight = 1.0 / float(dimensions.y);\n float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel\n float v = (float(pixY) + 0.5) * pixelHeight;\n return vec2(u, v);\n}\n\nvec4 getExtents(int i) {\n return texture(u_extentsTexture, getLookupUv(textureSize(u_extentsTexture, 0), i));\n}\n\nivec2 getPositionsLengthAndExtentsIndex(int i) {\n vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);\n vec4 value = texture(u_polygonTexture, uv);\n return ivec2(int(value.x), int(value.y));\n}\n\nvec2 getPolygonPosition(int i) {\n vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);\n return texture(u_polygonTexture, uv).xy;\n}\n\nvec2 getCoordinates(vec2 textureCoordinates, vec4 extents) {\n float latitude = mix(extents.x, extents.x + 1.0 / extents.z, textureCoordinates.y);\n float longitude = mix(extents.y, extents.y + 1.0 / extents.w, textureCoordinates.x);\n return vec2(latitude, longitude);\n}\n\nvoid main() {\n int lastPolygonIndex = 0;\n out_FragColor = vec4(1.0);\n\n // Get the relevant region of the texture\n float dimension = float(u_extentsLength);\n if (u_extentsLength > 2) {\n dimension = ceil(log2(float(u_extentsLength)));\n }\n int regionIndex = getPolygonIndex(dimension, v_textureCoordinates);\n\n for (int polygonIndex = 0; polygonIndex < u_polygonsLength; polygonIndex++) {\n ivec2 positionsLengthAndExtents = getPositionsLengthAndExtentsIndex(lastPolygonIndex);\n int positionsLength = positionsLengthAndExtents.x;\n int polygonExtentsIndex = positionsLengthAndExtents.y;\n lastPolygonIndex += 1;\n\n // Only compute signed distance for the relevant part of the atlas\n if (polygonExtentsIndex == regionIndex) {\n float clipAmount = czm_infinity;\n vec4 extents = getExtents(polygonExtentsIndex);\n vec2 textureOffset = vec2(mod(float(polygonExtentsIndex), dimension), floor(float(polygonExtentsIndex) / dimension)) / dimension;\n vec2 p = getCoordinates((v_textureCoordinates - textureOffset) * dimension, extents);\n float s = 1.0;\n\n // Check each edge for absolute distance\n for (int i = 0, j = positionsLength - 1; i < positionsLength; j = i, i++) {\n vec2 a = getPolygonPosition(lastPolygonIndex + i);\n vec2 b = getPolygonPosition(lastPolygonIndex + j);\n \n vec2 ab = b - a;\n vec2 pa = p - a;\n float t = dot(pa, ab) / dot(ab, ab);\n t = clamp(t, 0.0, 1.0);\n\n vec2 pq = pa - t * ab;\n float d = length(pq);\n\n // Inside / outside computation to determine sign\n bvec3 cond = bvec3(p.y >= a.y, \n p.y < b.y, \n ab.x * pa.y > ab.y * pa.x);\n if (all(cond) || all(not(cond))) s = -s;\n if (abs(d) < abs(clipAmount)) {\n clipAmount = d;\n }\n }\n\n // Normalize the range to [0,1]\n vec4 result = (s * vec4(clipAmount * length(extents.zw))) / 2.0 + 0.5;\n // In the case where we've iterated through multiple polygons, take the minimum\n out_FragColor = min(out_FragColor, result);\n }\n\n lastPolygonIndex += positionsLength;\n }\n}";function bP(e){e=M(e,M.EMPTY_OBJECT),this._polygons=[],this._totalPositions=0,this.enabled=M(e.enabled,!0),this.inverse=M(e.inverse,!1),this.polygonAdded=new gi,this.polygonRemoved=new gi,this._owner=void 0,this._float32View=void 0,this._extentsFloat32View=void 0,this._extentsCount=0,this._polygonsTexture=void 0,this._extentsTexture=void 0,this._signedDistanceTexture=void 0,this._signedDistanceComputeCommand=void 0;const t=e.polygons;if(D(t)){const e=t.length;for(let n=0;n<e;++n)this._polygons.push(t[n])}}Object.defineProperties(bP.prototype,{length:{get:function(){return this._polygons.length}},totalPositions:{get:function(){return this._totalPositions}},extentsTexture:{get:function(){return this._extentsTexture}},extentsCount:{get:function(){return this._extentsCount}},pixelsNeededForExtents:{get:function(){return this.length}},pixelsNeededForPolygonPositions:{get:function(){return this.totalPositions+this.length}},clippingTexture:{get:function(){return this._signedDistanceTexture}},owner:{get:function(){return this._owner}},clippingPolygonsState:{get:function(){return this.inverse?-this.extentsCount:this.extentsCount}}}),bP.prototype.add=function(e){L.typeOf.object("polygon",e);const t=this._polygons.length;return this._polygons.push(e),this.polygonAdded.raiseEvent(e,t),e},bP.prototype.get=function(e){return L.typeOf.number("index",e),this._polygons[e]},bP.prototype.contains=function(e){return L.typeOf.object("polygon",e),this._polygons.some((t=>mP.equals(t,e)))},bP.prototype.remove=function(e){L.typeOf.object("polygon",e);const t=this._polygons,n=t.findIndex((t=>mP.equals(t,e)));return-1!==n&&(t.splice(n,1),this.polygonRemoved.raiseEvent(e,n),!0)};const vP=new Ir;function AP(e){const t=e._float32View,n=e._extentsFloat32View,i=e._polygons,{extentsList:o,extentsIndexByPolygon:r}=function(e){const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const i=e[r].computeSphericalExtents();let o=Math.max(2.5*i.height,.001),s=Math.max(2.5*i.width,.001),a=Ir.clone(i);a.south-=o,a.west-=s,a.north+=o,a.east+=s,a.south=Math.max(a.south,-Math.PI),a.west=Math.max(a.west,-Math.PI),a.north=Math.min(a.north,Math.PI),a.east=Math.min(a.east,Math.PI);const c=[r];for(let r=0;r<t.length;++r){const l=t[r];if(D(l)&&D(Ir.simpleIntersection(l,a))&&!Ir.equals(l,a)){const l=n[r];c.push(...l),l.reduce(((t,n)=>Ir.union(e[n].computeSphericalExtents(vP),t,t)),i),t[r]=void 0,n[r]=void 0,o=Math.max(2.5*i.height,.001),s=Math.max(2.5*i.width,.001),a=Ir.clone(i,a),a.south-=o,a.west-=s,a.north+=o,a.east+=s,a.south=Math.max(a.south,-Math.PI),a.west=Math.max(a.west,-Math.PI),a.north=Math.min(a.north,Math.PI),a.east=Math.min(a.east,Math.PI),r=-1}}t.push(a),n.push(c)}const o=new Map;return n.filter(D).forEach(((e,t)=>e.forEach((e=>o.set(e,t))))),{extentsList:t.filter(D),extentsIndexByPolygon:o}}(i);let s=0;for(const[c,l]of i.entries()){const e=l.length;t[s++]=e,t[s++]=r.get(c);for(let n=0;n<e;++n){const e=l.positions[n],i=Math.hypot(e.x,e.y),o=V.fastApproximateAtan2(i,e.z),r=V.fastApproximateAtan2(e.x,e.y);t[s++]=o,t[s++]=r}}let a=0;for(const c of o){const e=1/(c.east-c.west),t=1/(c.north-c.south);n[a++]=c.south,n[a++]=c.west,n[a++]=t,n[a++]=e}e._extentsCount=o.length}bP.prototype.removeAll=function(){const e=this._polygons,t=e.length;for(let n=0;n<t;++n){const t=e[n];this.polygonRemoved.raiseEvent(t,n)}this._polygons=[]};const TP=new kt;bP.prototype.update=function(e){const t=e.context;if(!bP.isSupported(e))throw new be("ClippingPolygonCollections are only supported for WebGL 2.");const n=this._polygons.reduce(((e,t)=>e+t.length),0);if(n===this.totalPositions)return;if(this._totalPositions=n,0===this.length)return;D(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0,this._signedDistanceComputeCommand=void 0);let i=this._polygonsTexture,o=this._extentsTexture,r=this._signedDistanceTexture;if(D(i)){const e=i.width*i.height;(e<this.pixelsNeededForPolygonPositions||this.pixelsNeededForPolygonPositions<.25*e)&&(i.destroy(),i=void 0,this._polygonsTexture=void 0)}if(!D(i)){const e=bP.getTextureResolution(i,this.pixelsNeededForPolygonPositions,TP);i=new Sc({context:t,width:e.x,height:e.y,pixelFormat:is.RG,pixelDatatype:ts.FLOAT,sampler:uc.NEAREST,flipY:!1}),this._float32View=new Float32Array(e.x*e.y*2),this._polygonsTexture=i}if(D(o)){const e=o.width*o.height;(e<this.pixelsNeededForExtents||this.pixelsNeededForExtents<.25*e)&&(o.destroy(),o=void 0,this._extentsTexture=void 0)}if(!D(o)){const e=bP.getTextureResolution(o,this.pixelsNeededForExtents,TP);o=new Sc({context:t,width:e.x,height:e.y,pixelFormat:is.RGBA,pixelDatatype:ts.FLOAT,sampler:uc.NEAREST,flipY:!1}),this._extentsFloat32View=new Float32Array(e.x*e.y*4),this._extentsTexture=o}if(AP(this),o.copyFrom({source:{width:o.width,height:o.height,arrayBufferView:this._extentsFloat32View}}),i.copyFrom({source:{width:i.width,height:i.height,arrayBufferView:this._float32View}}),!D(r)){const e=bP.getClippingDistanceTextureResolution(this,TP);r=new Sc({context:t,width:e.x,height:e.y,pixelFormat:t.webgl2?is.RED:is.LUMINANCE,pixelDatatype:ts.FLOAT,sampler:new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:ac.LINEAR,magnificationFilter:rc.LINEAR}),flipY:!1}),this._signedDistanceTexture=r}this._signedDistanceComputeCommand=function(e){const t=e._polygonsTexture,n=e._extentsTexture;return new Ut({fragmentShaderSource:yP,outputTexture:e._signedDistanceTexture,uniformMap:{u_polygonsLength:function(){return e.length},u_extentsLength:function(){return e.extentsCount},u_extentsTexture:function(){return n},u_polygonTexture:function(){return t}},persists:!1,owner:e,postExecute:()=>{e._signedDistanceComputeCommand=void 0}})}(this)},bP.prototype.queueCommands=function(e){D(this._signedDistanceComputeCommand)&&e.commandList.push(this._signedDistanceComputeCommand)};const wP=new Ir,EP=new Ir;bP.prototype.computeIntersectionWithBoundingVolume=function(e,t){var n;const i=this._polygons,o=i.length;let r=mn.OUTSIDE;this.inverse&&(r=mn.INSIDE);for(let s=0;s<o;++s){const o=i[s].computeRectangle();let a=e.rectangle;if(!D(a)&&D(null==(n=e.boundingVolume)?void 0:n.computeCorners)){const n=e.boundingVolume.computeCorners();a=Ir.fromCartesianArray(n,t,wP)}D(a)||(a=Ir.fromBoundingSphere(e.boundingSphere,t,wP));D(Ir.simpleIntersection(a,o,EP))&&(r=mn.INTERSECTING)}return r},bP.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),D(e))){if(D(e._owner))throw new P("ClippingPolygonCollection should only be assigned to one object");e._owner=t,t[n]=e}},bP.isSupported=function(e){return null==e?void 0:e.context.webgl2},bP.getTextureResolution=function(e,t,n){if(D(e))return n.x=e.width,n.y=e.height,n;const i=rs.maximumTextureSize;return n.x=Math.min(t,i),n.y=Math.ceil(t/n.x),n.y*=2,n},bP.getClippingDistanceTextureResolution=function(e,t){const n=e.signedDistanceTexture;return D(n)?(t.x=n.width,t.y=n.height,t):(t.x=Math.min(rs.maximumTextureSize,4096),t.y=Math.min(rs.maximumTextureSize,4096),t)},bP.getClippingExtentsTextureResolution=function(e,t){const n=e.extentsTexture;return D(n)?(t.x=n.width,t.y=n.height,t):bP.getTextureResolution(n,e.pixelsNeededForExtents,t)},bP.prototype.isDestroyed=function(){return!1},bP.prototype.destroy=function(){return D(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0),this._polygonsTexture=this._polygonsTexture&&this._polygonsTexture.destroy(),this._extentsTexture=this._extentsTexture&&this._extentsTexture.destroy(),this._signedDistanceTexture=this._signedDistanceTexture&&this._signedDistanceTexture.destroy(),He(this)};const xP={HIGHLIGHT:0,REPLACE:1,MIX:2,getColorBlend:function(e,t){return e===xP.HIGHLIGHT?0:e===xP.REPLACE?1:e===xP.MIX?V.clamp(t,V.EPSILON4,1):void 0}},SP=Object.freeze(xP),CP=Object.freeze({XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"}),IP=Object.freeze({STEP:0,LINEAR:1,CUBICSPLINE:2}),OP={};function DP(e){L.typeOf.number.greaterThan("options.count",e.count,0),L.typeOf.object("options.properties",e.properties),this._count=e.count,this._properties=ti(e.properties,!0)}function PP(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.number("options.count",e.count),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}DP.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,OP)},DP.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,OP,e)},DP.prototype.getProperty=function(e,t){if(L.typeOf.number("index",e),L.typeOf.string("propertyId",t),e<0||e>=this._count)throw new P(`index must be in the range [0, ${this._count})`);const n=this._properties[t];if(D(n))return ti(n[e],!0)},DP.prototype.setProperty=function(e,t,n){if(L.typeOf.number("index",e),L.typeOf.string("propertyId",t),e<0||e>=this._count)throw new P(`index must be in the range [0, ${this._count})`);let i=this._properties[t];D(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=ti(n,!0)},Object.defineProperties(PP.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(D(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){let e=0;return D(this._metadataTable)&&(e+=this._metadataTable.byteLength),D(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}}),PP.prototype.hasProperty=function(e,t){return L.typeOf.number("index",e),L.typeOf.string("propertyId",t),!(!D(this._metadataTable)||!this._metadataTable.hasProperty(t))||(!(!D(this._batchTableHierarchy)||!this._batchTableHierarchy.hasProperty(e,t))||!(!D(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(t)))},PP.prototype.hasPropertyBySemantic=function(e,t){return L.typeOf.number("index",e),L.typeOf.string("semantic",t),!!D(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(t)},PP.prototype.propertyExists=function(e){return L.typeOf.string("propertyId",e),!(!D(this._metadataTable)||!this._metadataTable.hasProperty(e))||(!(!D(this._batchTableHierarchy)||!this._batchTableHierarchy.propertyExists(e))||!(!D(this._jsonMetadataTable)||!this._jsonMetadataTable.hasProperty(e)))},PP.prototype.propertyExistsBySemantic=function(e){return L.typeOf.string("semantic",e),!!D(this._metadataTable)&&this._metadataTable.hasPropertyBySemantic(e)};const NP=[];function RP(e,t){if(!D(e)||e<0||e>=t)throw new P(`featureId is required and must be between zero and featuresLength - 1 (${t}`-NaN)}function LP(e){const t=(e=M(e,M.EMPTY_OBJECT)).property,n=e.classProperty,i=e.textures;L.typeOf.object("options.property",t),L.typeOf.object("options.classProperty",n),L.typeOf.object("options.textures",i);const o=D(t.channels)?t.channels:[0],r=t,s=HC.createModelTextureReader({textureInfo:r,channels:BP(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,c=t.scale;const l=n.hasValueTransform||D(a)||D(c);a=M(a,n.offset),c=M(c,n.scale),a=n.unpackVectorAndMatrixTypes(a),c=n.unpackVectorAndMatrixTypes(c),this._offset=a,this._scale=c,this._hasValueTransform=l,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}PP.prototype.getPropertyIds=function(e,t){return(t=D(t)?t:[]).length=0,D(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(NP)),D(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,NP)),D(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(NP)),t},PP.prototype.getProperty=function(e,t){let n;return D(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),D(n))||D(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),D(n))||D(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),D(n))?n:void 0},PP.prototype.setProperty=function(e,t,n){D(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||D(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(D(this._jsonMetadataTable)||(this._jsonMetadataTable=new DP({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))},PP.prototype.getPropertyBySemantic=function(e,t){if(D(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)},PP.prototype.setPropertyBySemantic=function(e,t,n){return!!D(this._metadataTable)&&this._metadataTable.setPropertyBySemantic(e,t,n)},PP.prototype.getPropertyTypedArray=function(e){if(L.typeOf.string("propertyId",e),D(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)},PP.prototype.getPropertyTypedArrayBySemantic=function(e){if(L.typeOf.string("semantic",e),D(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)},PP.prototype.isClass=function(e,t){RP(e,this.count),L.typeOf.string("className",t);const n=this._batchTableHierarchy;return!!D(n)&&n.isClass(e,t)},PP.prototype.isExactClass=function(e,t){return RP(e,this.count),L.typeOf.string("className",t),this.getExactClassName(e)===t},PP.prototype.getExactClassName=function(e){RP(e,this.count);const t=this._batchTableHierarchy;if(D(t))return t.getClassName(e)},Object.defineProperties(LP.prototype,{textureReader:{get:function(){return this._textureReader}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),LP.prototype.isGpuCompatible=function(){const e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===Vx.SCALAR&&n===Ux.UINT8:!(!Vx.isVectorType(t)&&t!==Vx.SCALAR)&&n===Ux.UINT8};const MP=[void 0,"float","vec2","vec3","vec4"],FP=[void 0,"int","ivec2","ivec3","ivec4"];function BP(e){return e.map((function(e){return"rgba".charAt(e)})).join("")}function zP(e){const t=(e=M(e,M.EMPTY_OBJECT)).propertyTexture,n=e.class,i=e.textures;L.typeOf.object("options.propertyTexture",t),L.typeOf.object("options.class",n),L.typeOf.object("options.textures",i);const o=t.extensions,r=t.extras,s={};if(D(t.properties))for(const a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new LP({property:t.properties[a],classProperty:n.properties[a],textures:i}));this._name=e.name,this._id=e.id,this._class=n,this._properties=s,this._extras=r,this._extensions=o}function UP(e){const t=(e=M(e,M.EMPTY_OBJECT)).property,n=e.classProperty;L.typeOf.object("options.property",t),L.typeOf.object("options.classProperty",n),this._attribute=t.attribute,this._classProperty=n,this._min=t.min,this._max=t.max;let i=t.offset,o=t.scale;const r=n.hasValueTransform||D(i)||D(o);i=M(i,n.offset),o=M(o,n.scale),i=n.unpackVectorAndMatrixTypes(i),o=n.unpackVectorAndMatrixTypes(o),this._offset=i,this._scale=o,this._hasValueTransform=r,this._extras=t.extras,this._extensions=t.extensions}function kP(e){const t=(e=M(e,M.EMPTY_OBJECT)).propertyAttribute,n=e.class;L.typeOf.object("options.propertyAttribute",t),L.typeOf.object("options.class",n);const i={};if(D(t.properties))for(const o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new UP({property:t.properties[o],classProperty:n.properties[o]}));this._name=e.name,this._id=e.id,this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}function VP(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.schema",e.schema),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=D(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._propertyAttributes=e.propertyAttributes,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}function HP(e){const t={class:e.class,properties:{}},n=e.properties;for(const i in n)if(n.hasOwnProperty(i)){const e=n[i],o={channels:GP(e.channels),extras:e.extras,extensions:e.extensions};t.properties[i]=ni(e.texture,o,!0)}return t}function GP(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]="rgba".indexOf(e[i]);return n}function jP(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltf,n=e.extension,i=e.extensionLegacy,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.frameState,c=e.cacheKey,l=M(e.asynchronous,!0);if(L.typeOf.object("options.gltf",t),L.typeOf.object("options.gltfResource",o),L.typeOf.object("options.baseResource",r),L.typeOf.object("options.supportedImageFormats",s),L.typeOf.object("options.frameState",a),!D(e.extension)&&!D(e.extensionLegacy))throw new P("One of options.extension or options.extensionLegacy must be specified");this._gltfResource=o,this._baseResource=r,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=s,this._frameState=a,this._cacheKey=c,this._asynchronous=l,this._bufferViewLoaders=[],this._bufferViewIds=[],this._textureLoaders=[],this._textureIds=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=rS.UNLOADED,this._promise=void 0}async function WP(e){try{const t=async function(e){let t;t=D(e._extension)?function(e){const t=e.propertyTables,n={};if(D(t))for(let i=0;i<t.length;i++){qP(t[i].properties,n)}return n}(e._extension):function(e){const t=e.featureTables,n={};if(D(t))for(const i in t)if(t.hasOwnProperty(i)){const e=t[i].properties;D(e)&&YP(e,n)}return n}(e._extensionLegacy);const n=[];for(const i in t)if(t.hasOwnProperty(i)){const t=_I.getBufferViewLoader({gltf:e._gltf,bufferViewId:parseInt(i),gltfResource:e._gltfResource,baseResource:e._baseResource});e._bufferViewLoaders.push(t),e._bufferViewIds.push(i),n.push(t.load())}return Promise.all(n)}(e),n=function(e){let t;t=D(e._extension)?function(e){const t={},n=e.propertyTextures;if(D(n))for(let i=0;i<n.length;i++){const e=n[i].properties;D(e)&&XP(e,t)}return t}(e._extension):function(e){const t={},n=e.featureTextures;if(D(n))for(const i in n)if(n.hasOwnProperty(i)){const e=n[i].properties;D(e)&&QP(e,t)}return t}(e._extensionLegacy);const n=e._gltf,i=e._gltfResource,o=e._baseResource,r=e._supportedImageFormats,s=e._frameState,a=e._asynchronous,c=[];for(const l in t)if(t.hasOwnProperty(l)){const u=_I.getTextureLoader({gltf:n,textureInfo:t[l],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});e._textureLoaders.push(u),e._textureIds.push(l),c.push(u.load())}return Promise.all(c)}(e),i=async function(e){const t=M(e._extension,e._extensionLegacy);let n;if(D(t.schemaUri)){const i=e._baseResource.getDerivedResource({url:t.schemaUri});n=_I.getSchemaLoader({resource:i})}else n=_I.getSchemaLoader({schema:t.schema});if(e._schemaLoader=n,await n.load(),!n.isDestroyed())return n.schema}(e);if(await Promise.all([t,n,i]),e.isDestroyed())return;return e._gltf=void 0,e._state=rS.LOADED,e}catch(t){if(e.isDestroyed())return;e.unload(),e._state=rS.FAILED;const n="Failed to load structural metadata";throw e.getError(n,t)}}function qP(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.values,r=i.arrayOffsets,s=i.stringOffsets;D(o)&&(t[o]=!0),D(r)&&(t[r]=!0),D(s)&&(t[s]=!0)}}function YP(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.bufferView,r=i.arrayOffsetBufferView,s=i.stringOffsetBufferView;D(o)&&(t[o]=!0),D(r)&&(t[r]=!0),D(s)&&(t[s]=!0)}}function XP(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t[i.index]=i}}function QP(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n].texture;t[i.index]=i}}function $P(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)_I.unload(t[i]);e._bufferViewLoaders.length=0,e._bufferViewIds.length=0}LP.prototype.getGlslType=function(){const e=this._classProperty;let t=Vx.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?MP[t]:FP[t]},LP.prototype.unpackInShader=function(e){if(this._classProperty.normalized)return e;return`${this.getGlslType()}(255.0 * ${e})`},Object.defineProperties(zP.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),zP.prototype.getProperty=function(e){return L.typeOf.string("propertyId",e),this._properties[e]},Object.defineProperties(UP.prototype,{attribute:{get:function(){return this._attribute}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Object.defineProperties(kP.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),kP.prototype.getProperty=function(e){return L.typeOf.string("propertyId",e),this._properties[e]},Object.defineProperties(VP.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}},propertyTextures:{get:function(){return this._propertyTextures}},propertyAttributes:{get:function(){return this._propertyAttributes}},propertyTablesByteLength:{get:function(){if(!D(this._propertyTables))return 0;let e=0;const t=this._propertyTables.length;for(let n=0;n<t;n++)e+=this._propertyTables[n].byteLength;return e}}}),VP.prototype.getPropertyTable=function(e){return L.typeOf.number("propertyTableId",e),this._propertyTables[e]},VP.prototype.getPropertyTexture=function(e){return L.typeOf.number("propertyTextureId",e),this._propertyTextures[e]},VP.prototype.getPropertyAttribute=function(e){return L.typeOf.number("propertyAttributeId",e),this._propertyAttributes[e]},D(Object.create)&&(jP.prototype=Object.create(oS.prototype),jP.prototype.constructor=jP),Object.defineProperties(jP.prototype,{cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}}),jP.prototype.load=function(){return D(this._promise)||(this._state=rS.LOADING,this._promise=WP(this)),this._promise},jP.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===rS.READY)return!0;if(this._state!==rS.LOADED)return!1;const t=this._textureLoaders,n=t.length;let i=!0;for(let a=0;a<n;++a){const n=t[a].process(e);i=i&&n}if(!i)return!1;const o=this._schemaLoader.schema,r={};for(let a=0;a<this._bufferViewIds.length;++a){const e=this._bufferViewIds[a],t=this._bufferViewLoaders[a];if(!t.isDestroyed()){const n=new Uint8Array(t.typedArray);r[e]=n}}const s={};for(let a=0;a<this._textureIds.length;++a){const e=this._textureIds[a],n=t[a];n.isDestroyed()||(s[e]=n.texture)}return D(this._extension)?this._structuralMetadata=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).extension,n=e.schema;L.typeOf.object("options.extension",t),L.typeOf.object("options.schema",n);const i=[];if(D(t.propertyTables))for(let s=0;s<t.propertyTables.length;s++){const o=t.propertyTables[s],r=n.classes[o.class],a=new iS({count:o.count,properties:o.properties,class:r,bufferViews:e.bufferViews});i.push(new PP({id:s,name:o.name,count:o.count,metadataTable:a,extras:o.extras,extensions:o.extensions}))}const o=[];if(D(t.propertyTextures))for(let s=0;s<t.propertyTextures.length;s++){const i=t.propertyTextures[s];o.push(new zP({id:s,name:i.name,propertyTexture:i,class:n.classes[i.class],textures:e.textures}))}const r=[];if(D(t.propertyAttributes))for(let s=0;s<t.propertyAttributes.length;s++){const e=t.propertyAttributes[s];r.push(new kP({id:s,name:e.name,class:n.classes[e.class],propertyAttribute:e}))}return new VP({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}({extension:this._extension,schema:o,bufferViews:r,textures:s}):this._structuralMetadata=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).extension,n=e.schema;let i;L.typeOf.object("options.extension",t),L.typeOf.object("options.schema",n);const o=[];let r;if(D(t.featureTables))for(r=Object.keys(t.featureTables).sort(),i=0;i<r.length;i++){const s=r[i],a=t.featureTables[s],c=n.classes[a.class],l=new iS({count:a.count,properties:a.properties,class:c,bufferViews:e.bufferViews});o.push(new PP({id:s,count:a.count,metadataTable:l,extras:a.extras,extensions:a.extensions}))}const s=[];if(D(t.featureTextures))for(r=Object.keys(t.featureTextures).sort(),i=0;i<r.length;i++){const o=r[i],a=t.featureTextures[o];s.push(new zP({id:o,propertyTexture:HP(a),class:n.classes[a.class],textures:e.textures}))}return new VP({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}({extension:this._extensionLegacy,schema:o,bufferViews:r,textures:s}),$P(this),this._state=rS.READY,!0},jP.prototype.unload=function(){$P(this),function(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)_I.unload(t[i]);e._textureLoaders.length=0,e._textureIds.length=0}(this),D(this._schemaLoader)&&_I.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};const KP={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID",fromGltfSemantic:function(e){L.typeOf.string("gltfSemantic",e);let t=e;const n=/^(\w+)_\d+$/.exec(e);switch(null!==n&&(t=n[1]),t){case"TRANSLATION":return KP.TRANSLATION;case"ROTATION":return KP.ROTATION;case"SCALE":return KP.SCALE;case"_FEATURE_ID":return KP.FEATURE_ID}}},ZP=Object.freeze(KP);function JP(e){const t=(e=M(e,M.EMPTY_OBJECT)).triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;L.typeOf.object("options.triangleIndices",t),L.typeOf.object("options.outlineIndices",n),L.typeOf.number("options.originalVertexCount",i),this._triangleIndices=t,this._originalVertexCount=i,this._edges=new oN(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],function(e){let t=e._triangleIndices;const n=e._edges,i=[],o=e._extraVertices,r=e._originalVertexCount,s={};for(let a=0;a<t.length;a+=3){let e=t[a],c=t[a+1],l=t[a+2];const u=n.hasEdge(e,c),d=n.hasEdge(c,l),h=n.hasEdge(l,e);let p=eN(i,e,c,l,u,d,h);for(;D(p);){let n=s[p];if(!D(n)){n=r+o.length;let e=p;for(;e>=r;)e=o[e-r];o.push(e),s[p]=n}n>65534&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):n>255&&t instanceof Uint8Array&&(t=new Uint16Array(t)),p===e?(e=n,t[a]=n):p===c?(c=n,t[a+1]=n):(l=n,t[a+2]=n),p=eN(i,e,c,l,u,d,h)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}(this)}function eN(e,t,n,i,o,r,s){const a=s?1:0,c=o?1:0,l=tN(e,t,a,c,0);if(0===l)return t;const u=o?1:0,d=r?1:0,h=tN(e,n,0,u,d);if(0===h)return n;const p=s?1:0,f=r?1:0,m=tN(e,i,p,0,f);if(0===m)return i;const _=l&h&m;let g,y,b;if(1&_)g=0,y=1,b=2;else if(2&_)g=0,b=1,y=2;else if(4&_)y=0,g=1,b=2;else if(8&_)y=0,b=1,g=2;else if(16&_)b=0,g=1,y=2;else{if(!(32&_)){const e=nN(l),o=nN(h),r=nN(m);return e<o&&e<r?t:o<r?n:i}b=0,y=1,g=2}const v=3*t;e[v+g]=a,e[v+y]=c,e[v+b]=0;const A=3*n;e[A+g]=0,e[A+y]=u,e[A+b]=d;const T=3*i;e[T+g]=p,e[T+y]=0,e[T+b]=f}function tN(e,t,n,i,o){const r=3*t,s=e[r],a=e[r+1],c=e[r+2];return D(s)?(s===n&&a===i&&c===o)|(s===n&&a===o&&c===i)<<1|(s===i&&a===n&&c===o)<<2|(s===i&&a===o&&c===n)<<3|(s===o&&a===n&&c===i)<<4|(s===o&&a===i&&c===n)<<5:63}function nN(e){return(1&e)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}function iN(e){const t=new Uint8Array(e);return t[e-1]=192,8===e?t[e-1]=96:4===e?t[e-1]=48:2===e?t[e-1]=24:1===e&&(t[e-1]=12),t}function oN(e,t){this._originalVertexCount=t,this._edges=new Set;for(let n=0;n<e.length;n+=2){const t=e[n],i=e[n+1],o=Math.min(t,i),r=Math.max(t,i),s=o*this._originalVertexCount+r;this._edges.add(s)}}function rN(e){L.typeOf.object("attribute",e),this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function sN(e){L.typeOf.object("primitive",e),this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}function aN(e){e=M(e,M.EMPTY_OBJECT),this.webp=M(e.webp,!1),this.basis=M(e.basis,!1)}Object.defineProperties(JP.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}}),JP.prototype.updateAttribute=function(e){const t=this._extraVertices,n=e.length,i=n/this._originalVertexCount,o=t.length,r=new(0,e.constructor)(e.length+o*i);r.set(e);for(let s=0;s<o;s++){const e=t[s]*i,o=n+s*i;for(let t=0;t<i;t++)r[o+t]=r[e+t]}return r},JP.createTexture=function(e){let t=e.cache.modelOutliningCache;if(D(t)||(t=e.cache.modelOutliningCache={}),D(t.outlineTexture))return t.outlineTexture;const n=Math.min(4096,rs.maximumTextureSize);let i=n;const o=iN(i),r=[];for(;i>1;)i>>=1,r.push(iN(i));const s=new Sc({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:is.LUMINANCE,sampler:new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:ac.LINEAR_MIPMAP_LINEAR,magnificationFilter:rc.LINEAR})});return t.outlineTexture=s,s},oN.prototype.hasEdge=function(e,t){const n=Math.min(e,t),i=Math.max(e,t),o=n*this._originalVertexCount+i;return this._edges.has(o)},sN.prototype.postProcess=function(e){this.needsOutlines&&(function(e){const t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new JP({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=je.fromTypedArray(n.typedArray);const r=new rN(function(e){const t=new UC.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=Ca.FLOAT,t.type=Zf.VEC3,t.normalized=!1,t.count=e.length/3,t}(o.outlineCoordinates));r.loadBuffer=!0,r.loadTypedArray=!1,e.attributePlans.push(r),t.outlineCoordinates=r.attribute;const s=e.attributePlans,a=e.attributePlans.length;for(let c=0;c<a;c++){const e=s[c].attribute;e.typedArray=o.updateAttribute(e.typedArray)}}(this),function(e,t){(function(e,t){const n=e.length;for(let i=0;i<n;i++){const n=e[i],o=n.attribute,r=o.typedArray;if(n.loadBuffer){const e=Ye.createVertexBuffer({typedArray:r,context:t,usage:qe.STATIC_DRAW});e.vertexArrayDestroyable=!1,o.buffer=e}n.loadTypedArray||(o.typedArray=void 0)}})(e.attributePlans,t),D(e.indicesPlan)&&function(e,t){const n=e.indices;if(e.loadBuffer){const e=Ye.createIndexBuffer({typedArray:n.typedArray,context:t,usage:qe.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=e,e.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}(e.indicesPlan,t)}(this,e))},sN.AttributeLoadPlan=rN,sN.IndicesLoadPlan=function(e){L.typeOf.object("indices",e),this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1};const cN=UC.Attribute,lN=UC.Indices,uN=UC.FeatureIdAttribute,dN=UC.FeatureIdTexture,hN=UC.FeatureIdImplicitRange,pN=UC.MorphTarget,fN=UC.Primitive,mN=UC.Instances,_N=UC.Skin,gN=UC.Node,yN=UC.AnimatedPropertyType,bN=UC.AnimationSampler,vN=UC.AnimationTarget,AN=UC.AnimationChannel,TN=UC.Animation,wN=UC.ArticulationStage,EN=UC.Articulation,xN=UC.Asset,SN=UC.Scene,CN=UC.Components,IN=UC.MetallicRoughness,ON=UC.SpecularGlossiness,DN=UC.Material,PN=0,NN=1,RN=2,LN=3,MN=4,FN=5,BN=6,zN=7,UN=8;function kN(e){const t=(e=M(e,M.EMPTY_OBJECT)).gltfResource;let n=e.baseResource;const i=e.typedArray,o=M(e.releaseGltfJson,!1),r=M(e.asynchronous,!0),s=M(e.incrementallyLoadTextures,!0),a=M(e.upAxis,gw.Y),c=M(e.forwardAxis,gw.Z),l=M(e.loadAttributesAsTypedArray,!1),u=M(e.loadAttributesFor2D,!1),d=M(e.enablePick),h=M(e.loadIndicesForWireframe,!1),p=M(e.loadPrimitiveOutline,!0),f=M(e.loadForClassification,!1),m=M(e.renameBatchIdSemantic,!1);L.typeOf.object("options.gltfResource",t),n=D(n)?n:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=n,this._typedArray=i,this._releaseGltfJson=o,this._asynchronous=r,this._incrementallyLoadTextures=s,this._upAxis=a,this._forwardAxis=c,this._loadAttributesAsTypedArray=l,this._loadAttributesFor2D=u,this._enablePick=d,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=p,this._loadForClassification=f,this._renameBatchIdSemantic=m,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=PN,this._textureState=PN,this._promise=void 0,this._processError=void 0,this._textureErrors=[],this._primitiveLoadPlans=[],this._loaderPromises=[],this._textureLoaders=[],this._texturesPromises=[],this._textureCallbacks=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._geometryCallbacks=[],this._structuralMetadataLoader=void 0,this._loadResourcesPromise=void 0,this._resourcesLoaded=!1,this._texturesLoaded=!1,this._postProcessBuffers=[],this._components=void 0}async function VN(e,t){Ct.supportsWebP.initialized||await Ct.supportsWebP.initialize();const n=new aN({webp:Ct.supportsWebP(),basis:t.context.supportsBasis}),i=function(e,t,n,i){const o=M(t.extensions,M.EMPTY_OBJECT),r=o.EXT_structural_metadata,s=o.EXT_feature_metadata,a=o.CESIUM_RTC;if(D(s)){const t=s.featureTables,n=s.featureTextures,i=D(t)?t:[],o=D(n)?n:[];e._sortedPropertyTableIds=Object.keys(i).sort(),e._sortedFeatureTextureIds=Object.keys(o).sort()}const c=function(e,t,n,i){if(!D(t.nodes))return[];let o,r;const s=t.nodes.length,a=new Array(s);for(o=0;o<s;++o){const r=mR(e,t,t.nodes[o],n,i);r.index=o,a[o]=r}for(o=0;o<s;++o){const e=t.nodes[o].children;if(D(e)){const t=e.length;for(r=0;r<t;++r)a[o].children.push(a[e[r]])}}return a}(e,t,n,i),l=function(e,t,n){const i=t.skins;if(e._loadForClassification||!D(i))return[];const o=t.skins.length,r=new Array(o);for(let a=0;a<o;++a){const i=_R(e,t,t.skins[a],n);i.index=a,r[a]=i}const s=n.length;for(let a=0;a<s;++a){const e=t.nodes[a].skin;D(e)&&(n[a].skin=r[e])}return r}(e,t,c),u=function(e,t,n){const i=t.animations;if(e._loadForClassification||!D(i))return[];const o=t.animations.length,r=new Array(o);for(let s=0;s<o;++s){const i=bR(e,t,t.animations[s],n);i.index=s,r[s]=i}return r}(e,t,c),d=function(e){const t=M(e.extensions,M.EMPTY_OBJECT),n=t.AGI_articulations;if(!D(n))return[];const i=n.articulations;if(!D(i))return[];const o=i.length,r=new Array(o);for(let s=0;s<o;s++){const e=AR(i[s]);r[s]=e}return r}(t),h=function(e,t){const n=new SN,i=function(e){let t;D(e.scenes)&&D(e.scene)&&(t=e.scenes[e.scene].nodes);return t=M(t,e.nodes),t=D(t)?t:[],t}(e);return n.nodes=i.map((function(e){return t[e]})),n}(t,c),p=new CN,f=new xN,m=t.asset.copyright;if(D(m)){const e=m.split(";").map((function(e){return new YT(e.trim())}));f.credits=e}if(p.asset=f,p.scene=h,p.nodes=c,p.skins=l,p.animations=u,p.articulations=d,p.upAxis=e._upAxis,p.forwardAxis=e._forwardAxis,D(a)){const e=H.fromArray(a.center,0,TR);p.transform=ve.fromTranslation(e,p.transform)}if(e._components=p,D(r)||D(s)){const o=async function(e,t,n,i,o,r){const s=new jP({gltf:t,extension:n,extensionLegacy:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:o,frameState:r,asynchronous:e._asynchronous});return e._structuralMetadataLoader=s,s.load()}(e,t,r,s,n,i);e._loaderPromises.push(o)}const _=[];_.push.apply(_,e._loaderPromises),e._incrementallyLoadTextures||_.push.apply(_,e._texturesPromises);return Promise.all(_)}(e,e.gltfJson,n,t);return e._state=LN,e._textureState=LN,D(e._gltfJsonLoader)&&e._releaseGltfJson&&(_I.unload(e._gltfJsonLoader),e._gltfJsonLoader=void 0),i}function HN(e,t){e.unload();throw e.getError("Failed to load glTF",t)}function GN(e,t){const n=e._postProcessBuffers,i=t.primitive,o=i.outlineCoordinates;D(o)&&n.push(o.buffer);const r=i.attributes,s=r.length;for(let c=0;c<s;c++){const e=r[c];D(e.buffer)&&n.push(e.buffer)}const a=i.indices;D(a)&&D(a.buffer)&&n.push(a.buffer)}function jN(e,t,n){let i=t.byteOffset;const o=CS(e,t),r=t.count,s=SS(t.type),a=t.componentType,c=Ca.getSizeInBytes(a),l=r*s;if(o===c*s)return n=new Uint8Array(n),Ca.createArrayBufferView(a,n.buffer,n.byteOffset+i,l);const u=Ca.createTypedArray(a,l),d=new DataView(n.buffer),h=new Array(s),p=BS(t.componentType);i=n.byteOffset+i;for(let f=0;f<r;++f){p(d,i,s,c,h);for(let e=0;e<s;++e)u[f*s+e]=h[e];i+=o}return u}async function WN(e,t,n,i,o,r){if(await t.load(),e.isDestroyed())return;!function(e,t,n,i){const o=e.type,r=e.count;if(o===Zf.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===Zf.VEC4&&i)for(let s=0;s<r;s++)n[s]=_o.unpack(t,4*s);else{const e=Zf.getMathType(o),i=Zf.getNumberOfComponents(o);for(let o=0;o<r;o++)n[o]=e.unpack(t,o*i)}}(i,jN(n,i,t.typedArray),r,o=M(o,!1))}function qN(e,t,n,i){const o=t.accessors[n],r=o.count,s=new Array(r),a=o.bufferView;if(D(a)){const n=function(e,t,n){const i=_I.getBufferViewLoader({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}(e,t,a),r=WN(e,n,t,o,i,s);return e._loaderPromises.push(r),s}return function(e,t){const n=e.type;if(n===Zf.SCALAR)return t.fill(0);const i=Zf.getMathType(n);return t.fill(i.clone(i.ZERO))}(o,s)}function YN(e,t){if(D(t))return e===Number?t[0]:e.unpack(t)}D(Object.create)&&(kN.prototype=Object.create(oS.prototype),kN.prototype.constructor=kN),Object.defineProperties(kN.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}},gltfJson:{get:function(){return D(this._gltfJsonLoader)?this._gltfJsonLoader.gltf:this._gltfJson}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},texturesLoaded:{get:function(){return this._texturesLoaded}}}),kN.prototype.load=async function(){return D(this._promise)||(this._promise=async function(e){e._state=NN,e._textureState=NN;try{const t=_I.getGltfJsonLoader({gltfResource:e._gltfResource,baseResource:e._baseResource,typedArray:e._typedArray,gltfJson:e._gltfJson});if(e._gltfJsonLoader=t,await t.load(),e.isDestroyed()||e.isUnloaded()||t.isDestroyed())return;return e._state=RN,e._textureState=RN,e}catch(t){if(e.isDestroyed())return;e._state=zN,e._textureState=zN,HN(e,t)}}(this)),this._promise},kN.prototype._process=function(e){return this._state===BN||(this._state===LN&&function(e,t){let n,i=!0;const o=e._geometryLoaders,r=o.length;for(n=0;n<r;++n){const r=o[n].process(t);r&&D(e._geometryCallbacks[n])&&(e._geometryCallbacks[n](),e._geometryCallbacks[n]=void 0),i=i&&r}const s=e._structuralMetadataLoader;if(D(s)){const n=s.process(t);n&&(e._components.structuralMetadata=s.structuralMetadata),i=i&&n}i&&(e._state=MN)}(this,e),this._resourcesLoaded&&this._state===MN&&(!function(e,t){const n=e._primitiveLoadPlans,i=n.length;for(let o=0;o<i;o++){const i=n[o];i.postProcess(t),i.needsOutlines&&GN(e,i)}}(this,e.context),this._state=FN),!(!this._resourcesLoaded||this._state!==FN)&&(wR(this),this._typedArray=void 0,this._state=BN,!0))},kN.prototype._processTextures=function(e){if(this._textureState===BN)return!0;if(this._textureState!==LN)return!1;let t,n=!0;const i=this._textureLoaders,o=i.length;for(t=0;t<o;++t){const o=i[t].process(e);o&&D(this._textureCallbacks[t])&&(this._textureCallbacks[t](),this._textureCallbacks[t]=void 0),n=n&&o}return!!n&&(this._textureState=BN,this._texturesLoaded=!0,!0)},kN.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state!==RN||D(this._loadResourcesPromise)||(this._loadResourcesPromise=VN(this,e).then((()=>{this._resourcesLoaded=!0})).catch((e=>{this._processError=e}))),D(this._processError)){this._state=zN;const e=this._processError;this._processError=void 0,HN(this,e)}const t=this._textureErrors.pop();if(D(t)){const e=this.getError("Failed to load glTF texture",t);throw e.name="TextureError",e}if(this._state===zN)return!1;let n=!1;try{n=this._process(e)}catch(o){this._state=zN,HN(this,o)}let i=!1;try{i=this._processTextures(e)}catch(o){this._textureState=zN,HN(this,o)}return this._incrementallyLoadTextures?n:n&&i};const XN={VEC2:new kt(-1,-1),VEC3:new H(-1,-1,-1),VEC4:new K(-1,-1,-1,-1)};function QN(e,t){const n=function(e){switch(e){case Ca.BYTE:return 127;case Ca.UNSIGNED_BYTE:return 255;case Ca.SHORT:return 32767;case Ca.UNSIGNED_SHORT:return 65535;default:return 1}}(e.componentDatatype),i=XN[e.type];let o=e.min;D(o)&&(o=t.divideByScalar(o,n,o),o=t.maximumByComponent(o,i,o));let r=e.max;D(r)&&(r=t.divideByScalar(r,n,r),r=t.maximumByComponent(r,i,r)),e.min=o,e.max=r}function $N(e,t,n,i,o){var r;const s=e.accessors[t],a=Zf.getMathType(s.type),c=M(s.normalized,!1),l=new cN;l.name=n,l.semantic=i,l.setIndex=o,l.constant=function(e){return e===Number?0:new e}(a),l.componentDatatype=s.componentType,l.normalized=c,l.count=s.count,l.type=s.type,l.min=YN(a,s.min),l.max=YN(a,s.max),l.byteOffset=s.byteOffset,l.byteStride=CS(e,s),Px(s,"WEB3D_quantized_attributes")&&function(e,t,n){const i=e.decodeMatrix,o=YN(n,e.decodedMin),r=YN(n,e.decodedMax);D(o)&&D(r)&&(t.min=o,t.max=r);const s=new UC.Quantization;s.componentDatatype=t.componentDatatype,s.type=t.type,4===i.length?(s.quantizedVolumeOffset=i[2],s.quantizedVolumeStepSize=i[0]):9===i.length?(s.quantizedVolumeOffset=new kt(i[6],i[7]),s.quantizedVolumeStepSize=new kt(i[0],i[4])):16===i.length?(s.quantizedVolumeOffset=new H(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new H(i[0],i[5],i[10])):25===i.length&&(s.quantizedVolumeOffset=new K(i[20],i[21],i[22],i[23]),s.quantizedVolumeStepSize=new K(i[0],i[6],i[12],i[18])),t.quantization=s}(s.extensions.WEB3D_quantized_attributes,l,a);const u=l.semantic===EC.POSITION||l.semantic===EC.NORMAL||l.semantic===EC.TANGENT||l.semantic===EC.TEXCOORD;return(null==(r=e.extensionsRequired)?void 0:r.includes("KHR_mesh_quantization"))&&c&&u&&QN(l,a),l}function KN(e){const t=/^\w+_(\d+)$/.exec(e);if(null!==t)return parseInt(t[1])}const ZN={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function JN(e,t,n){let i=n;!e._renameBatchIdSemantic||"_BATCHID"!==n&&"BATCHID"!==n||(i="_FEATURE_ID_0");const o=t.fromGltfSemantic(i),r=ZN;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function eR(e){const t=e===EC.POSITION,n=e===EC.FEATURE_ID,i=e===EC.TEXCOORD;return t||n||i}function tR(e,t,n,i,o,r,s,a){const c=t.accessors[n],l=c.bufferView,u=i.gltfSemantic,d=i.renamedSemantic,h=i.modelSemantic,p=D(h)?KN(d):void 0,f=$N(t,n,u,h,p);if(!D(o)&&!D(l))return f;const m=function(e,t,n,i,o,r,s,a){const c=t.accessors[n].bufferView;return _I.getVertexBufferLoader({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:c,draco:o,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s})}(e,t,n,u,o,r,s,a),_=e._geometryLoaders.length;e._geometryLoaders.push(m);const g=m.load();return e._loaderPromises.push(g),e._geometryCallbacks[_]=()=>{D(o)&&D(o.attributes)&&D(o.attributes[u])?function(e,t,n,i){if(e.byteOffset=0,e.byteStride=void 0,e.quantization=t.quantization,n&&(e.buffer=t.buffer),i){const n=D(t.quantization)?t.quantization.componentDatatype:e.componentDatatype;e.typedArray=Ca.createArrayBufferView(n,t.typedArray.buffer)}}(f,m,r,s):function(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){const r=i.typedArray;n.typedArray=jN(e,t,r),o||(n.byteOffset=0,n.byteStride=void 0)}}(t,c,f,m,r,s)},f}function nR(e,t,n,i,o,r,s,a){const c=i.modelSemantic,l=c===EC.POSITION,u=c===EC.FEATURE_ID,d=l&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,h=l&&e._enablePick&&!a.context.webgl2,p=e._loadForClassification&&u,f=e._loadAttributesAsTypedArray,m=!f,_=f||d||h||p,g=tR(e,t,n,i,o,!s&&m,!!s||_,a),y=new sN.AttributeLoadPlan(g);return y.loadBuffer=m,y.loadTypedArray=_,y}function iR(e,t,n,i,o,r){const s=D(i.ROTATION),a=D(i.TRANSLATION)&&D(t.accessors[i.TRANSLATION].min)&&D(t.accessors[i.TRANSLATION].max),c=JN(e,ZP,o),l=c.modelSemantic,u=l===ZP.TRANSLATION||l===ZP.ROTATION||l===ZP.SCALE,d=l===ZP.TRANSLATION,h=e._loadAttributesAsTypedArray||s&&u||!r.context.instancedArrays,p=e._enablePick&&!r.context.webgl2,f=!h,m=e._loadAttributesFor2D&&!r.scene3DOnly;return tR(e,t,n,c,void 0,f,h||d&&(!a||m||p),r)}function oR(e,t,n,i,o,r,s){const a=t.accessors[n],c=a.bufferView;if(!D(i)&&!D(c))return;const l=new lN;l.count=a.count;const u=e._loadAttributesAsTypedArray,d=(e._loadIndicesForWireframe||e._enablePick)&&!s.context.webgl2,h=e._loadForClassification&&o,p=!u,f=u||d||h,m=function(e,t,n,i,o,r,s){return _I.getIndexBufferLoader({gltf:t,accessorId:n,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:s,draco:i,asynchronous:e._asynchronous,loadBuffer:o,loadTypedArray:r})}(e,t,n,i,!r&&p,!!r||f,s),_=e._geometryLoaders.length;e._geometryLoaders.push(m);const g=m.load();e._loaderPromises.push(g),e._geometryCallbacks[_]=()=>{l.indexDatatype=m.indexDatatype,l.buffer=m.buffer,l.typedArray=m.typedArray};const y=new sN.IndicesLoadPlan(l);return y.loadBuffer=p,y.loadTypedArray=f,y}function rR(e,t,n,i,o,r){if(!D(HC.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i})))return;const s=_I.getTextureLoader({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous}),a=HC.createModelTextureReader({textureInfo:n}),c=e._textureLoaders.length;e._textureLoaders.push(s);const l=s.load().catch((t=>{if(!e.isDestroyed()){if(!e._incrementallyLoadTextures)throw t;e._textureState=zN,e._textureErrors.push(t)}}));return e._texturesPromises.push(l),e._textureCallbacks[c]=()=>{a.texture=s.texture,D(r)&&(a.texture.sampler=r)},a}function sR(e,t){const n=new uN;return n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.propertyTableId=e.propertyTable,n.setIndex=e.attribute,n.label=e.label,n.positionalLabel=t,n}function aR(e,t,n,i){const o=new uN,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=KN(r.attribute),o.positionalLabel=i,o}function cR(e,t){const n=new hN;return n.propertyTableId=e.propertyTable,n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.label=e.label,n.positionalLabel=t,n.offset=0,n.repeat=1,n}function lR(e,t,n,i){const o=new hN,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=M(r.constant,0);const s=M(r.divisor,0);return o.repeat=0===s?void 0:s,o.positionalLabel=i,o}function uR(e,t,n,i,o,r){const s=new dN;s.featureCount=n.featureCount,s.nullFeatureId=n.nullFeatureId,s.propertyTableId=n.propertyTable,s.label=n.label,s.positionalLabel=r;const a=n.texture;s.textureReader=rR(e,t,a,i,o,uc.NEAREST);const c=(D(a.channels)?a.channels:[0]).map((function(e){return"rgba".charAt(e)})).join("");return s.textureReader.channels=c,s}function dR(e,t,n,i,o,r,s,a){const c=new dN,l=n.featureIds,u=l.texture;return c.featureCount=s,c.propertyTableId=i,c.textureReader=rR(e,t,u,o,r,uc.NEAREST),c.textureReader.channels=l.channels,c.positionalLabel=a,c}function hR(e,t,n,i,o,r){const s=new pN;for(const a in n)if(n.hasOwnProperty(a)){const c=nR(e,t,n[a],JN(e,EC,a),undefined,false,i,r);s.attributes.push(c.attribute),o.attributePlans.push(c)}return s}function pR(e,t,n,i,o,r){const s=new fN,a=new sN(s);e._primitiveLoadPlans.push(a);const c=n.material;D(c)&&(s.material=function(e,t,n,i,o){const r=new DN,s=M(n.extensions,M.EMPTY_OBJECT),a=s.KHR_materials_pbrSpecularGlossiness,c=n.pbrMetallicRoughness;if(r.unlit=D(s.KHR_materials_unlit),D(a)){const n=new ON;r.specularGlossiness=n,D(a.diffuseTexture)&&(n.diffuseTexture=rR(e,t,a.diffuseTexture,i,o)),D(a.specularGlossinessTexture)&&D(a.specularGlossinessTexture)&&(n.specularGlossinessTexture=rR(e,t,a.specularGlossinessTexture,i,o)),n.diffuseFactor=YN(K,a.diffuseFactor),n.specularFactor=YN(H,a.specularFactor),n.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(D(c)){const n=new IN;D(c.baseColorTexture)&&(n.baseColorTexture=rR(e,t,c.baseColorTexture,i,o)),D(c.metallicRoughnessTexture)&&(n.metallicRoughnessTexture=rR(e,t,c.metallicRoughnessTexture,i,o)),n.baseColorFactor=YN(K,c.baseColorFactor),n.metallicFactor=c.metallicFactor,n.roughnessFactor=c.roughnessFactor,r.metallicRoughness=n}return D(n.emissiveTexture)&&(r.emissiveTexture=rR(e,t,n.emissiveTexture,i,o)),D(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=rR(e,t,n.normalTexture,i,o)),D(n.occlusionTexture)&&(r.occlusionTexture=rR(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=YN(H,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}(e,t,t.materials[c],o,r));const l=M(n.extensions,M.EMPTY_OBJECT);let u=!1;const d=l.CESIUM_primitive_outline;e._loadPrimitiveOutline&&D(d)&&(u=!0,a.needsOutlines=!0,a.outlineIndices=function(e,t,n){const i=n.indices;return qN(e,t,i,!1)}(e,t,d));const h=e._loadForClassification,p=l.KHR_draco_mesh_compression;let f=!1;const m=n.attributes;if(D(m))for(const w in m)if(m.hasOwnProperty(w)){const n=m[w],o=JN(e,EC,w),c=o.modelSemantic;if(h&&!eR(c))continue;c===EC.FEATURE_ID&&(f=!0);const l=nR(e,t,n,o,p,i,u,r);a.attributePlans.push(l),s.attributes.push(l.attribute)}const _=n.targets;if(D(_)&&!h){const n=_.length;for(let i=0;i<n;++i)s.morphTargets.push(hR(e,t,_[i],u,a,r))}const g=n.indices;if(D(g)){const n=oR(e,t,g,p,f,u,r);D(n)&&(a.indicesPlan=n,s.indices=n.indices)}const y=l.EXT_structural_metadata,b=l.EXT_mesh_features,v=l.EXT_feature_metadata,A=D(v);D(b)?function(e,t,n,i,o,r){let s;s=D(i)&&D(i.featureIds)?i.featureIds:[];for(let a=0;a<s.length;a++){const i=s[a],c=`featureId_${a}`;let l;l=D(i.texture)?uR(e,t,i,o,r,c):D(i.attribute)?sR(i,c):cR(i,c),n.featureIds.push(l)}}(e,t,s,b,o,r):A&&function(e,t,n,i,o,r){const s=t.extensions.EXT_feature_metadata.featureTables;let a=0;const c=i.featureIdAttributes;if(D(c)){const t=c.length;for(let i=0;i<t;++i){const t=c[i],o=t.featureTable,r=e._sortedPropertyTableIds.indexOf(o),l=s[o].count,u=`featureId_${a}`;let d;a++,d=D(t.featureIds.attribute)?aR(t,r,l,u):lR(t,r,l,u),n.featureIds.push(d)}}const l=i.featureIdTextures;if(D(l)){const i=l.length;for(let c=0;c<i;++c){const i=l[c],u=i.featureTable,d=e._sortedPropertyTableIds.indexOf(u),h=`featureId_${a}`;a++;const p=dR(e,t,i,d,o,r,s[u].count,h);n.featureIds.push(p)}}}(e,t,s,v,o,r),D(y)?function(e,t){if(!D(t))return;D(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures);D(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes)}(s,y):A&&function(e,t,n){D(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map((function(t){return e._sortedFeatureTextureIds.indexOf(t)})))}(e,s,v);const T=n.mode;if(h&&T!==Vr.TRIANGLES)throw new be("Only triangle meshes can be used for classification.");return s.primitiveType=T,s}function fR(e,t,n,i){const o=n.EXT_mesh_gpu_instancing,r=new mN,s=o.attributes;if(D(s))for(const u in s)if(s.hasOwnProperty(u)){const n=s[u];r.attributes.push(iR(e,t,n,s,u,i))}const a=M(o.extensions,M.EMPTY_OBJECT),c=n.EXT_instance_features,l=a.EXT_feature_metadata;return D(c)?function(e,t){const n=t.featureIds;for(let i=0;i<n.length;i++){const t=n[i],o=`instanceFeatureId_${i}`;let r;r=D(t.attribute)?sR(t,o):cR(t,o),e.featureIds.push(r)}}(r,c):D(l)&&function(e,t,n,i){const o=e.extensions.EXT_feature_metadata.featureTables,r=n.featureIdAttributes;if(D(r)){const e=r.length;for(let n=0;n<e;++n){const e=r[n],s=e.featureTable,a=i.indexOf(s),c=o[s].count,l=`instanceFeatureId_${n}`;let u;u=D(e.featureIds.attribute)?aR(e,a,c,l):lR(e,a,c,l),t.featureIds.push(u)}}}(t,r,l,e._sortedPropertyTableIds),r}function mR(e,t,n,i,o){const r=new gN;r.name=n.name,r.matrix=YN(ve,n.matrix),r.translation=YN(H,n.translation),r.rotation=YN(_o,n.rotation),r.scale=YN(H,n.scale);const s=M(n.extensions,M.EMPTY_OBJECT),a=s.EXT_mesh_gpu_instancing,c=s.AGI_articulations;if(D(a)){if(e._loadForClassification)throw new be("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");r.instances=fR(e,t,s,o)}D(c)&&(r.articulationName=c.articulationName);const l=n.mesh;if(D(l)){const s=t.meshes[l],a=s.primitives,c=a.length;for(let n=0;n<c;++n)r.primitives.push(pR(e,t,a[n],D(r.instances),i,o));const u=M(n.weights,s.weights),d=r.primitives[0].morphTargets.length;r.morphWeights=D(u)?u.slice():new Array(d).fill(0)}return r}function _R(e,t,n,i){const o=new _N,r=n.joints,s=r.length,a=new Array(s);for(let l=0;l<s;++l)a[l]=i[r[l]];o.joints=a;const c=n.inverseBindMatrices;return D(c)?o.inverseBindMatrices=qN(e,t,c):o.inverseBindMatrices=new Array(s).fill(ve.IDENTITY),o}function gR(e,t,n){const i=new bN,o=n.input;i.input=qN(e,t,o);const r=n.interpolation;i.interpolation=M(IP[r],IP.LINEAR);const s=n.output;return i.output=qN(e,t,s,!0),i}function yR(e,t,n){const i=new AN,o=e.sampler;return i.sampler=t[o],i.target=function(e,t){const n=new vN,i=e.node;if(!D(i))return;n.node=t[i];const o=e.path.toUpperCase();return n.path=yN[o],n}(e.target,n),i}function bR(e,t,n,i){let o;const r=new TN;r.name=n.name;const s=n.samplers,a=s.length,c=new Array(a);for(o=0;o<a;o++){const n=gR(e,t,s[o]);n.index=o,c[o]=n}const l=n.channels,u=l.length,d=new Array(u);for(o=0;o<u;o++)d[o]=yR(l[o],c,i);return r.samplers=c,r.channels=d,r}function vR(e){const t=new wN;t.name=e.name;const n=e.type.toUpperCase();return t.type=CP[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function AR(e){const t=new EN;t.name=e.name;const n=e.stages,i=n.length,o=new Array(i);for(let r=0;r<i;r++){const e=vR(n[r]);o[r]=e}return t.stages=o,t}const TR=new H;function wR(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)t[i]=!t[i].isDestroyed()&&_I.unload(t[i]);e._bufferViewLoaders.length=0}kN.prototype.isUnloaded=function(){return this._state===UN},kN.prototype.unload=function(){var e;D(this._gltfJsonLoader)&&!this._gltfJsonLoader.isDestroyed()&&_I.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,function(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)t[i]=!t[i].isDestroyed()&&_I.unload(t[i]);e._textureLoaders.length=0}(this),wR(this),function(e){const t=e._geometryLoaders,n=t.length;for(let i=0;i<n;++i)t[i]=!t[i].isDestroyed()&&_I.unload(t[i]);e._geometryLoaders.length=0}(this),function(e){const t=e._postProcessBuffers,n=t.length;for(let i=0;i<n;i++){const e=t[i];e.isDestroyed()||e.destroy()}t.length=0}(this),D((e=this)._structuralMetadataLoader)&&!e._structuralMetadataLoader.isDestroyed()&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0),this._components=void 0,this._typedArray=void 0,this._state=UN};function ER(){this._framebuffer=new ou({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(ER.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});const xR=new kt;function SR(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),function(e,t){const n=new bc({defines:["LOG_DEPTH_WRITE"],sources:["uniform sampler2D u_pointCloud_colorGBuffer;\nuniform sampler2D u_pointCloud_depthGBuffer;\nuniform vec2 u_distanceAndEdlStrength;\nin vec2 v_textureCoordinates;\n\nvec2 neighborContribution(float log2Depth, vec2 offset)\n{\n float dist = u_distanceAndEdlStrength.x;\n vec2 texCoordOrig = v_textureCoordinates + offset * dist;\n vec2 texCoord0 = v_textureCoordinates + offset * floor(dist);\n vec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);\n\n float depthOrLogDepth0 = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, texCoord0));\n float depthOrLogDepth1 = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, texCoord1));\n\n // ignore depth values that are the clear depth\n if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {\n return vec2(0.0);\n }\n\n // interpolate the two adjacent depth values\n float depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);\n return vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);\n}\n\nvoid main()\n{\n float depthOrLogDepth = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, v_textureCoordinates));\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);\n eyeCoordinate /= eyeCoordinate.w;\n\n float log2Depth = log2(-eyeCoordinate.z);\n\n if (depthOrLogDepth == 0.0) // 0.0 is the clear value for the gbuffer\n {\n discard;\n }\n\n vec4 color = texture(u_pointCloud_colorGBuffer, v_textureCoordinates);\n\n // sample from neighbors left, right, down, up\n vec2 texelSize = 1.0 / czm_viewport.zw;\n\n vec2 responseAndCount = vec2(0.0);\n\n responseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));\n responseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));\n responseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));\n responseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));\n\n float response = responseAndCount.x / responseAndCount.y;\n float strength = u_distanceAndEdlStrength.y;\n float shade = exp(-response * 300.0 * strength);\n color.rgb *= shade;\n out_FragColor = vec4(color);\n\n // Input and output depth are the same.\n gl_FragDepth = depthOrLogDepth;\n}\n"]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return xR.x=e._radius,xR.y=e._strength,xR}},o=_s.fromCache({blending:dh.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:sy.setCesium3DTileBit(),stencilMask:sy.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:zt.CESIUM_3D_TILE,owner:e}),e._clearCommand=new Bt({framebuffer:e.framebuffer,color:new Ot(0,0,0,0),depth:1,renderState:_s.fromCache(),pass:zt.CESIUM_3D_TILE,owner:e})}(e,t)}function CR(e){return e.drawBuffers&&e.fragmentDepth}function IR(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!D(n)){const i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources.splice(0,0,"layout (location = 0) out vec4 out_FragData_0;\nlayout (location = 1) out vec4 out_FragData_1;"),o.sources=o.sources.map((function(e){return e=(e=bc.replaceMain(e,"czm_point_cloud_post_process_main")).replaceAll(/out_FragColor/g,"out_FragData_0")})),o.sources.push("void main() \n{ \n czm_point_cloud_post_process_main(); \n#ifdef LOG_DEPTH\n czm_writeLogDepth();\n out_FragData_1 = czm_packDepth(gl_FragDepth); \n#else\n out_FragData_1 = czm_packDepth(gl_FragCoord.z);\n#endif\n}"),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function OR(e){const t=M(e,{});this.attenuation=M(t.attenuation,!1),this.geometricErrorScale=M(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=M(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=M(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=M(t.eyeDomeLightingRadius,1),this.backFaceCulling=M(t.backFaceCulling,!1),this.normalShading=M(t.normalShading,!0)}ER.isSupported=CR,ER.prototype.update=function(e,t,n,i){if(!CR(e.context))return;let o;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,SR(this,e.context);const r=e.commandList,s=r.length;for(o=t;o<s;++o){const t=r[o];if(t.primitiveType!==Vr.POINTS||t.pass===zt.TRANSLUCENT)continue;let n,i,s=t.derivedCommands.pointCloudProcessor;D(s)&&(n=s.command,i=s.originalShaderProgram),D(n)&&!t.dirty&&i===t.shaderProgram&&n.framebuffer===this.framebuffer||(n=Kr.shallowClone(t,n),n.framebuffer=this.framebuffer,n.shaderProgram=IR(e.context,t.shaderProgram),n.castShadows=!1,n.receiveShadows=!1,D(s)||(s={command:n,originalShaderProgram:t.shaderProgram},t.derivedCommands.pointCloudProcessor=s),s.originalShaderProgram=t.shaderProgram),r[o]=n}const a=this._clearCommand,c=this._drawCommand;c.boundingVolume=i,r.push(c),r.push(a)},ER.prototype.isDestroyed=function(){return!1},ER.prototype.destroy=function(){var e;return(e=this)._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0,He(this)},OR.isSupported=function(e){return ER.isSupported(e.context)};const DR={},PR=new K(0,0,0,1);let NR=new K;const RR=new Fr,LR=new kt,MR=new kt;DR.wgs84ToWindowCoordinates=function(e,t,n){return DR.wgs84WithEyeOffsetToWindowCoordinates(e,t,H.ZERO,n)};const FR=new K,BR=new H;function zR(e,t,n,i){const o=n.viewMatrix,r=ve.multiplyByVector(o,K.fromElements(e.x,e.y,e.z,1,FR),FR),s=H.multiplyComponents(t,H.normalize(r,BR),BR);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,ve.multiplyByVector(n.frustum.projectionMatrix,r,i)}const UR=new Qt(Math.PI,V.PI_OVER_TWO),kR=new H,VR=new H;DR.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){if(!D(e))throw new P("scene is required.");if(!D(t))throw new P("position is required.");const o=e.frameState,r=DR.computeActualWgs84Position(o,t,PR);if(!D(r))return;const s=e.canvas,a=RR;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;const c=e.camera;let l=!1;if(o.mode===gl.SCENE2D){const t=e.mapProjection,o=UR,u=t.project(o,kR),d=H.clone(c.position,VR),h=c.frustum.clone(),p=ve.computeViewportTransformation(a,0,1,new ve),f=c.frustum.projectionMatrix,m=c.positionWC.y,_=H.fromElements(V.sign(m)*u.x-m,0,-c.positionWC.x),g=Cr.pointToGLWindowCoordinates(f,p,_);if(0===m||g.x<=0||g.x>=s.clientWidth)l=!0;else{if(g.x>.5*s.clientWidth){a.width=g.x,c.frustum.right=u.x-m,NR=zR(r,n,c,NR),DR.clipToGLWindowCoordinates(a,NR,LR),a.x+=g.x,c.position.x=-c.position.x;const e=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-e,NR=zR(r,n,c,NR),DR.clipToGLWindowCoordinates(a,NR,MR)}else{a.x+=g.x,a.width-=g.x,c.frustum.left=-u.x-m,NR=zR(r,n,c,NR),DR.clipToGLWindowCoordinates(a,NR,LR),a.x=a.x-a.width,c.position.x=-c.position.x;const e=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-e,NR=zR(r,n,c,NR),DR.clipToGLWindowCoordinates(a,NR,MR)}H.clone(d,c.position),c.frustum=h.clone(),((i=kt.clone(LR,i)).x<0||i.x>s.clientWidth)&&(i.x=MR.x)}}if(o.mode!==gl.SCENE2D||l){if(NR=zR(r,n,c,NR),NR.z<0&&!(c.frustum instanceof Xc)&&!(c.frustum instanceof Hc))return;i=DR.clipToGLWindowCoordinates(a,NR,i)}return i.y=s.clientHeight-i.y,i},DR.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(D(n=DR.wgs84ToWindowCoordinates(e,t,n)))return DR.transformWindowToDrawingBuffer(e,n,n)};const HR=new H,GR=new Qt;DR.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===gl.SCENE3D)return H.clone(t,n);const o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,GR);if(!D(r))return;if(o.project(r,HR),i===gl.COLUMBUS_VIEW)return H.fromElements(HR.z,HR.x,HR.y,n);if(i===gl.SCENE2D)return H.fromElements(0,HR.x,HR.y,n);const s=e.morphTime;return H.fromElements(V.lerp(HR.z,t.x,s),V.lerp(HR.x,t.y,s),V.lerp(HR.y,t.z,s),n)};const jR=new H,WR=new H,qR=new ve;DR.clipToGLWindowCoordinates=function(e,t,n){return H.divideByScalar(t,t.w,jR),ve.computeViewportTransformation(e,0,1,qR),ve.multiplyByPoint(qR,jR,WR),kt.fromCartesian3(WR,n)},DR.transformWindowToDrawingBuffer=function(e,t,n){const i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return kt.fromElements(t.x*o,t.y*r,n)};const YR=new K,XR=new K;DR.drawingBufferToWgs84Coordinates=function(e,t,n,i){const o=e.context.uniformState,r=o.currentFrustum,s=r.x,a=r.y;if(e.frameState.useLogDepth){const e=n*o.log2FarDepthFromNearPlusOne;n=a*(1-s/(Math.pow(2,e)-1+s))/(a-s)}const c=e.view.passState.viewport,l=K.clone(K.UNIT_W,YR);let u;l.x=(t.x-c.x)/c.width*2-1,l.y=(t.y-c.y)/c.height*2-1,l.z=2*n-1,l.w=1;let d=e.camera.frustum;if(D(d.fovy)){u=ve.multiplyByVector(o.inverseViewProjection,l,XR);const e=1/u.w;H.multiplyByScalar(u,e,u)}else{const e=d.offCenterFrustum;D(e)&&(d=e),u=XR,u.x=.5*(l.x*(d.right-d.left)+d.left+d.right),u.y=.5*(l.y*(d.top-d.bottom)+d.bottom+d.top),u.z=.5*(l.z*(s-a)-s-a),u.w=1,u=ve.multiplyByVector(o.inverseView,u,u)}return H.fromCartesian4(u,i)};const QR=DR,$R=Object.freeze({LEFT:-1,NONE:0,RIGHT:1}),KR={};KR._deprecationWarning=Da;const ZR=Uint32Array.BYTES_PER_ELEMENT;KR.parse=function(e,t){const n=M(t,0);L.defined("arrayBuffer",e),t=n;const i=new Uint8Array(e),o=new DataView(e);t+=ZR;const r=o.getUint32(t,!0);if(1!==r)throw new be(`Only Batched 3D Model version 1 is supported. Version ${r} is not.`);t+=ZR;const s=o.getUint32(t,!0);t+=ZR;let a=o.getUint32(t,!0);t+=ZR;let c=o.getUint32(t,!0);t+=ZR;let l=o.getUint32(t,!0);t+=ZR;let u,d,h=o.getUint32(t,!0);t+=ZR,l>=570425344?(t-=2*ZR,u=a,l=c,h=0,a=0,c=0,KR._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):h>=570425344&&(t-=ZR,u=l,l=a,h=c,a=0,c=0,KR._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")),0===a?d={BATCH_LENGTH:M(u,0)}:(d=Ew(i,t,a),t+=a);const p=new Uint8Array(e,t,c);let f,m;t+=c,l>0&&(f=Ew(i,t,l),t+=l,h>0&&(m=new Uint8Array(e,t,h),m=new Uint8Array(m),t+=h));const _=n+s-t;if(0===_)throw new be("glTF byte length must be greater than 0.");let g;return t%4==0?g=new Uint8Array(e,t,_):(KR._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),g=new Uint8Array(i.subarray(t,t+_))),{batchLength:u,featureTableJson:d,featureTableBinary:p,batchTableJson:f,batchTableBinary:m,gltf:g}};const JR=KR;function eL(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function tL(e,t,n,i,o,r){const s=e._cachedTypedArrays;let a=s[t];return D(a)||(a=Ca.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function nL(e){L.typeOf.number("options.count",e.count),L.typeOf.object("options.batchTable",e.batchTable);const t=e.count,n=e.batchTable,i=e.binaryBody,o=M(e.parseAsPropertyAttributes,!1),r=e.customAttributeOutput;if(o&&!D(r))throw new P("customAttributeOutput is required when parsing batch table as property attributes");const s=function(e){const t=e.HIERARCHY,n=e.extras,i=e.extensions;let o,r;D(t)?(nL._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),o=t):D(i)&&(o=i["3DTILES_batch_table_hierarchy"]);const s={};for(const a in e){if(!e.hasOwnProperty(a)||"HIERARCHY"===a||"extensions"===a||"extras"===a)continue;const t=e[a];Array.isArray(t)?(r=D(r)?r:{},r[a]=t):s[a]=t}return{binaryProperties:s,jsonProperties:r,hierarchy:o,extras:n,extensions:i}}(n);let a,c;D(s.jsonProperties)&&(a=new DP({count:t,properties:s.jsonProperties})),D(s.hierarchy)&&(c=new Mw({extension:s.hierarchy,binaryBody:i}));const l=tI.BATCH_TABLE_CLASS_NAME,u=s.binaryProperties;let d,h,p;if(o){const e=function(e,t,n,i,o){const r={},s={};let a=0;for(const u in n){if(!n.hasOwnProperty(u))continue;const t=n[u];if(!D(i)&&!D(t.typedArray))throw new be(`Property ${u} requires a batch table binary.`);let c=xC.sanitizeGlslIdentifier(u);(""===c||r.hasOwnProperty(c))&&(c=`property_${a}`,a++);const l=iL(t);l.name=u,r[c]=l;let d=c.toUpperCase();d.startsWith("_")||(d=`_${d}`);let h=t.typedArray;if(!D(h)){h=Lw(t).createArrayBufferView(i.buffer,i.byteOffset+t.byteOffset,e)}const p=new UC.Attribute;p.name=d,p.count=e,p.type=t.type;const f=Ca.fromTypedArray(h);f!==Ca.INT&&f!==Ca.UNSIGNED_INT&&f!==Ca.DOUBLE||(nL._oneTimeWarning("Cast pnts property to floats",`Point cloud property "${d}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),h=new Float32Array(h)),p.componentDatatype=Ca.fromTypedArray(h),p.typedArray=h,o.push(p),s[c]={attribute:d}}const c={classes:{}};c.classes[t]={properties:r};const l=oI.fromJson(c);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:l,transcodedClass:l.classes[t]}}(t,l,u,i,r);p=e.transcodedSchema;h=[new kP({propertyAttribute:e.propertyAttributeJson,class:e.transcodedClass})]}else{const e=function(e,t,n,i){const o={},r={},s={};let a=0;for(const d in n){if(!n.hasOwnProperty(d))continue;if(!D(i))throw new be(`Property ${d} requires a batch table binary.`);const t=n[d],c=Lw(t);r[d]={bufferView:a},o[d]=iL(t),s[a]=c.createArrayBufferView(i.buffer,i.byteOffset+t.byteOffset,e),a++}const c={classes:{}};c.classes[t]={properties:o};const l=oI.fromJson(c),u={class:t,count:e,properties:r};return{featureTableJson:u,bufferViewsTypedArrays:s,transcodedSchema:l,transcodedClass:l.classes[t]}}(t,l,u,i);p=e.transcodedSchema;const n=e.featureTableJson;d=new iS({count:n.count,properties:n.properties,class:e.transcodedClass,bufferViews:e.bufferViewsTypedArrays}),h=[]}const f=[];if(D(d)||D(a)||D(c)){const e=new PP({id:0,name:"Batch Table",count:t,metadataTable:d,jsonMetadataTable:a,batchTableHierarchy:c});f.push(e)}return new VP({schema:p,propertyTables:f,propertyAttributes:h,extensions:s.extensions,extras:s.extras})}function iL(e){const t=function(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}(e.componentType);return{type:e.type,componentType:t}}eL.prototype.getGlobalProperty=function(e,t,n){const i=this.json[e];if(D(i))return D(i.byteOffset)?tL(this,e,t=M(t,Ca.UNSIGNED_INT),n=M(n,1),1,i.byteOffset):i},eL.prototype.hasProperty=function(e){return D(this.json[e])},eL.prototype.getPropertyArray=function(e,t,n){const i=this.json[e];if(D(i))return D(i.byteOffset)?(D(i.componentType)&&(t=Ca.fromName(i.componentType)),tL(this,e,t,n,this.featuresLength,i.byteOffset)):function(e,t,n,i){const o=e._cachedTypedArrays;let r=o[t];return D(r)||(r=Ca.createTypedArray(n,i),o[t]=r),r}(this,e,t,i)},eL.prototype.getProperty=function(e,t,n,i,o){if(!D(this.json[e]))return;const r=this.getPropertyArray(e,t,n);if(1===n)return r[i];for(let s=0;s<n;++s)o[s]=r[n*i+s];return o},nL._deprecationWarning=Da,nL._oneTimeWarning=Oa;const oL=0,rL=1,sL=2,aL=3,cL=4,lL=UC.FeatureIdAttribute;function uL(e){const t=(e=M(e,M.EMPTY_OBJECT)).b3dmResource;let n=e.baseResource;const i=e.arrayBuffer,o=M(e.byteOffset,0),r=M(e.releaseGltfJson,!1),s=M(e.asynchronous,!0),a=M(e.incrementallyLoadTextures,!0),c=M(e.upAxis,gw.Y),l=M(e.forwardAxis,gw.X),u=M(e.loadAttributesAsTypedArray,!1),d=M(e.loadAttributesFor2D,!1),h=M(e.enablePick,!1),p=M(e.loadIndicesForWireframe,!1),f=M(e.loadPrimitiveOutline,!0),m=M(e.loadForClassification,!1);L.typeOf.object("options.b3dmResource",t),L.typeOf.object("options.arrayBuffer",i),n=D(n)?n:t.clone(),this._b3dmResource=t,this._baseResource=n,this._arrayBuffer=i,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=c,this._forwardAxis=l,this._loadAttributesAsTypedArray=u,this._loadAttributesFor2D=d,this._enablePick=h,this._loadIndicesForWireframe=p,this._loadPrimitiveOutline=f,this._loadForClassification=m,this._state=oL,this._promise=void 0,this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=ve.IDENTITY}function dL(e){const t=e.children.length;for(let i=0;i<t;i++)dL(e.children[i]);const n=e.primitives.length;for(let i=0;i<n;i++){const t=e.primitives[i],n=xC.getAttributeBySemantic(t,EC.FEATURE_ID);if(D(n)){n.setIndex=0;const e=new lL;e.propertyTableId=0,e.setIndex=0,e.positionalLabel="featureId_0",t.featureIds.push(e)}}}function hL(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.geoJson",e.geoJson),this._geoJson=e.geoJson,this._components=void 0}function pL(){this.lines=void 0,this.points=void 0,this.properties=void 0}function fL(){this.features=[]}function mL(e){return new H(e[0],e[1],M(e[2],0))}function _L(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=mL(e[i]);return[n]}function gL(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=_L(e[i])[0];return n}D(Object.create)&&(uL.prototype=Object.create(oS.prototype),uL.prototype.constructor=uL),Object.defineProperties(uL.prototype,{texturesLoaded:{get:function(){var e;return null==(e=this._gltfLoader)?void 0:e.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),uL.prototype.load=function(){if(D(this._promise))return this._promise;const e=JR.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new eL(n,i);t=s.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;const a=s.getGlobalProperty("RTC_CENTER",Ca.FLOAT,3);D(a)&&(this._transform=ve.fromTranslation(H.fromArray(a))),this._batchTable={json:o,binary:r};const c=new kN({typedArray:e.gltf,upAxis:this._upAxis,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,loadAttributesFor2D:this._loadAttributesFor2D,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline,loadForClassification:this._loadForClassification,renameBatchIdSemantic:!0});this._gltfLoader=c,this._state=rL;const l=this;return this._promise=c.load().then((function(){if(!l.isDestroyed())return l._state=sL,l})).catch((function(e){if(!l.isDestroyed())return function(e,t){e.unload(),e._state=cL;const n="Failed to load b3dm";return t=e.getError(n,t),Promise.reject(t)}(l,e)})),this._promise},uL.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===aL)return!0;if(this._state!==sL)return!1;if(!this._gltfLoader.process(e))return!1;const t=this._gltfLoader.components;return t.transform=ve.multiplyTransformation(this._transform,t.transform,t.transform),function(e,t){const n=e._batchTable,i=e._batchLength;if(0===i)return;let o;if(D(n.json))o=nL({count:i,batchTable:n.json,binaryBody:n.binary});else{o=new VP({schema:{},propertyTables:[new PP({name:tI.BATCH_TABLE_CLASS_NAME,count:i})]})}const r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)dL(r[a]);t.structuralMetadata=o}(this,t),this._components=t,this._arrayBuffer=void 0,this._state=aL,!0},uL.prototype.unload=function(){D(this._gltfLoader)&&!this._gltfLoader.isDestroyed()&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0},D(Object.create)&&(hL.prototype=Object.create(oS.prototype),hL.prototype.constructor=hL),Object.defineProperties(hL.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),hL.prototype.load=function(){return Promise.resolve(this)},hL.prototype.process=function(e){return L.typeOf.object("frameState",e),D(this._components)||(this._components=function(e,t){const n=new fL,i=AL[e.type];D(i)&&i(e,n);const o=n.features,r=o.length;if(0===r)throw new be("GeoJSON must have at least one feature");const s={};for(let w=0;w<r;w++){const e=M(o[w].properties,M.EMPTY_OBJECT);for(const t in e)e.hasOwnProperty(t)&&(D(s[t])||(s[t]=new Array(r)))}for(let w=0;w<r;w++){const e=o[w];for(const t in s)if(s.hasOwnProperty(t)){const n=M(e.properties[t],"");s[t][w]=n}}const a=new DP({count:r,properties:s}),c=[new PP({id:0,count:r,jsonMetadataTable:a})],l=new VP({schema:oI.fromJson({}),propertyTables:c}),u=new H(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),d=new H(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let h=!1,p=!1;for(let w=0;w<r;w++){const e=o[w];if(D(e.lines)){h=!0;const t=e.lines.length;for(let n=0;n<t;n++){const t=e.lines[n],i=t.length;for(let e=0;e<i;e++)H.minimumByComponent(u,t[e],u),H.maximumByComponent(d,t[e],d)}}if(D(e.points)){p=!0;const t=e.points.length;for(let n=0;n<t;n++){const t=e.points[n];H.minimumByComponent(u,t,u),H.maximumByComponent(d,t,d)}}}const f=H.midpoint(u,d,new H),m=H.fromDegrees(f.x,f.y,f.z,on.WGS84,new H),_=Cr.eastNorthUpToFixedFrame(m,on.WGS84,new ve),g=ve.inverseTransformation(_,new ve),y=[];h&&y.push(function(e,t,n){let i=0,o=0;const r=e.length;for(let x=0;x<r;x++){const t=e[x];if(D(t.lines)){const e=t.lines.length;for(let n=0;n<e;n++){const e=t.lines[n];i+=e.length,o+=2*(e.length-1)}}}const s=new Float32Array(3*i),a=new Float32Array(i),c=je.createTypedArray(i,o),l=je.fromTypedArray(c),u=new H(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),d=new H(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let h=0,p=0;for(let x=0;x<r;x++){const n=e[x];if(!D(n.lines))continue;const i=n.lines.length;for(let e=0;e<i;e++){const i=n.lines[e],o=i.length;for(let e=0;e<o;e++){const n=i[e],r=H.fromDegrees(n.x,n.y,n.z,on.WGS84,TL),l=ve.multiplyByPoint(t,r,TL);H.minimumByComponent(u,l,u),H.maximumByComponent(d,l,d),H.pack(l,s,3*h),a[h]=x,e<o-1&&(c[2*p]=h,c[2*p+1]=h+1,p++),h++}}}const f=Ye.createVertexBuffer({typedArray:s,context:n.context,usage:qe.STATIC_DRAW});f.vertexArrayDestroyable=!1;const m=Ye.createVertexBuffer({typedArray:a,context:n.context,usage:qe.STATIC_DRAW});m.vertexArrayDestroyable=!1;const _=Ye.createIndexBuffer({typedArray:c,context:n.context,usage:qe.STATIC_DRAW,indexDatatype:l});_.vertexArrayDestroyable=!1;const g=new UC.Attribute;g.semantic=EC.POSITION,g.componentDatatype=Ca.FLOAT,g.type=Zf.VEC3,g.count=i,g.min=u,g.max=d,g.buffer=f;const y=new UC.Attribute;y.semantic=EC.FEATURE_ID,y.setIndex=0,y.componentDatatype=Ca.FLOAT,y.type=Zf.SCALAR,y.count=i,y.buffer=m;const b=[g,y],v=new UC.Material;v.unlit=!0;const A=new UC.Indices;A.indexDatatype=l,A.count=c.length,A.buffer=_;const T=new UC.FeatureIdAttribute;T.featureCount=r,T.propertyTableId=0,T.setIndex=0,T.positionalLabel="featureId_0";const w=[T],E=new UC.Primitive;return E.attributes=b,E.indices=A,E.featureIds=w,E.primitiveType=Vr.LINES,E.material=v,E}(o,g,t));p&&y.push(function(e,t,n){let i=0;const o=e.length;for(let b=0;b<o;b++){const t=e[b];D(t.points)&&(i+=t.points.length)}const r=new Float32Array(3*i),s=new Float32Array(i),a=new H(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),c=new H(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let l=0;for(let b=0;b<o;b++){const n=e[b];if(!D(n.points))continue;const i=n.points.length;for(let e=0;e<i;e++){const i=n.points[e],o=H.fromDegrees(i.x,i.y,i.z,on.WGS84,TL),u=ve.multiplyByPoint(t,o,TL);H.minimumByComponent(a,u,a),H.maximumByComponent(c,u,c),H.pack(u,r,3*l),s[l]=b,l++}}const u=Ye.createVertexBuffer({typedArray:r,context:n.context,usage:qe.STATIC_DRAW});u.vertexArrayDestroyable=!1;const d=Ye.createVertexBuffer({typedArray:s,context:n.context,usage:qe.STATIC_DRAW});d.vertexArrayDestroyable=!1;const h=new UC.Attribute;h.semantic=EC.POSITION,h.componentDatatype=Ca.FLOAT,h.type=Zf.VEC3,h.count=i,h.min=a,h.max=c,h.buffer=u;const p=new UC.Attribute;p.semantic=EC.FEATURE_ID,p.setIndex=0,p.componentDatatype=Ca.FLOAT,p.type=Zf.SCALAR,p.count=i,p.buffer=d;const f=[h,p],m=new UC.Material;m.unlit=!0;const _=new UC.FeatureIdAttribute;_.featureCount=o,_.propertyTableId=0,_.setIndex=0,_.positionalLabel="featureId_0";const g=[_],y=new UC.Primitive;return y.attributes=f,y.featureIds=g,y.primitiveType=Vr.POINTS,y.material=m,y}(o,g,t));const b=new UC.Node;b.index=0,b.primitives=y;const v=[b],A=new UC.Scene;A.nodes=v;const T=new UC.Components;return T.scene=A,T.nodes=v,T.transform=_,T.structuralMetadata=l,T}(this._geoJson,e),this._geoJson=void 0),!0};const yL={LineString:_L,MultiLineString:function(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=_L(e[i])[0];return n},MultiPolygon:function(e){const t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,gL(e[i]));return n},Polygon:gL,MultiPoint:function(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=mL(e[i]);return n},Point:function(e){return[mL(e)]}},bL={LineString:Vr.LINES,MultiLineString:Vr.LINES,MultiPolygon:Vr.LINES,Polygon:Vr.LINES,MultiPoint:Vr.POINTS,Point:Vr.POINTS};function vL(e,t){if(!D(e.geometry))return;const n=e.geometry.type,i=yL[n],o=bL[n],r=e.geometry.coordinates;if(!D(i))return;if(!D(r))return;const s=new pL;o===Vr.LINES?s.lines=i(r):o===Vr.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}const AL={FeatureCollection:function(e,t){const n=e.features,i=n.length;for(let o=0;o<i;o++)vL(n[o],t)},Feature:vL},TL=new H;hL.prototype.unload=function(){this._components=void 0};const wL={};wL._deprecationWarning=Da;const EL=Uint32Array.BYTES_PER_ELEMENT;wL.parse=function(e,t){L.defined("arrayBuffer",e);const n=M(t,0);t=n;const i=new Uint8Array(e),o=new DataView(e);t+=EL;const r=o.getUint32(t,!0);if(1!==r)throw new be(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=EL;const s=o.getUint32(t,!0);t+=EL;const a=o.getUint32(t,!0);if(0===a)throw new be("featureTableJsonByteLength is zero, the feature table must be defined.");t+=EL;const c=o.getUint32(t,!0);t+=EL;const l=o.getUint32(t,!0);t+=EL;const u=o.getUint32(t,!0);t+=EL;const d=o.getUint32(t,!0);if(1!==d&&0!==d)throw new be(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${d} is not.`);const h=Ew(i,t+=EL,a);t+=a;const p=new Uint8Array(e,t,c);let f,m;t+=c,l>0&&(f=Ew(i,t,l),t+=l,u>0&&(m=new Uint8Array(e,t,u),m=new Uint8Array(m),t+=u));const _=n+s-t;if(0===_)throw new be("glTF byte length must be greater than 0.");let g;return t%4==0?g=new Uint8Array(e,t,_):(wL._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),g=new Uint8Array(i.subarray(t,t+_))),{gltfFormat:d,featureTableJson:h,featureTableBinary:p,batchTableJson:f,batchTableBinary:m,gltf:g}};const xL=wL,SL=0,CL=1,IL=2,OL=4,DL=5,PL=6,NL=UC.Attribute,RL=UC.FeatureIdAttribute,LL=UC.Instances;function ML(e){const t=(e=M(e,M.EMPTY_OBJECT)).i3dmResource,n=e.arrayBuffer;let i=e.baseResource;const o=M(e.byteOffset,0),r=M(e.releaseGltfJson,!1),s=M(e.asynchronous,!0),a=M(e.incrementallyLoadTextures,!0),c=M(e.upAxis,gw.Y),l=M(e.forwardAxis,gw.X),u=M(e.loadAttributesAsTypedArray,!1),d=M(e.loadIndicesForWireframe,!1),h=M(e.loadPrimitiveOutline,!0),p=M(e.enablePick,!1);L.typeOf.object("options.i3dmResource",t),L.typeOf.object("options.arrayBuffer",n),i=D(i)?i:t.clone(),this._i3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=c,this._forwardAxis=l,this._loadAttributesAsTypedArray=u,this._loadIndicesForWireframe=d,this._loadPrimitiveOutline=h,this._enablePick=p,this._state=SL,this._promise=void 0,this._gltfLoader=void 0,this._buffers=[],this._components=void 0,this._transform=ve.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}D(Object.create)&&(ML.prototype=Object.create(oS.prototype),ML.prototype.constructor=ML),Object.defineProperties(ML.prototype,{texturesLoaded:{get:function(){var e;return null==(e=this._gltfLoader)?void 0:e.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}}),ML.prototype.load=function(){if(D(this._promise))return this._promise;const e=xL.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new eL(t,n);this._featureTable=s;const a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!D(a))throw new be("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;const c=s.getGlobalProperty("RTC_CENTER",Ca.FLOAT,3);D(c)&&(this._transform=ve.fromTranslation(H.fromArray(c))),this._batchTable={json:i,binary:o};const l={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline};if(0===r){let t=bw(e.gltf);t=t.replace(/[\s\0]+$/,"");const n=this._baseResource.getDerivedResource({url:t});l.gltfResource=n,l.baseResource=n}else l.gltfResource=this._i3dmResource,l.typedArray=e.gltf;const u=new kN(l);return this._gltfLoader=u,this._state=CL,this._promise=u.load().then((()=>{if(!this.isDestroyed())return this._state=IL,this})).catch((e=>{if(!this.isDestroyed())throw function(e,t){e.unload(),e._state=DL;const n="Failed to load i3dm";return e.getError(n,t)}(this,e)})),this._promise},ML.prototype.process=function(e){if(L.typeOf.object("frameState",e),this._state===OL)return!0;const t=this._gltfLoader;let n=!1;if(this._state===IL&&(n=t.process(e)),!n)return!1;const i=t.components;return i.transform=ve.multiplyTransformation(this._transform,i.transform,i.transform),function(e,t,n){let i;const o=e._featureTable,r=e._instancesLength;if(0===r)return;const s=o.getGlobalProperty("RTC_CENTER",Ca.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),c=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,l=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),u=function(e){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",Ca.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){const t=e.getPropertyArray("POSITION_QUANTIZED",Ca.UNSIGNED_SHORT,3),n=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Ca.FLOAT,3);if(!D(n))throw new be("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Ca.FLOAT,3);if(!D(i))throw new be("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=new Float32Array(t.length);for(let e=0;e<t.length/3;e++)for(let r=0;r<3;r++){const s=3*e+r;o[s]=t[s]/65535*i[r]+n[r]}return o}throw new be("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}(o);let d,h;c&&(d=new Float32Array(4*r));l&&(h=new Float32Array(3*r));const p=new Float32Array(r),f=H.unpackArray(u);let m=new H;const _=new H,g=new H,y=new H,b=new re,v=new _o,A=new Array(4),T=new H,w=new Array(3),E=new ve;if(!D(s)||H.equals(H.unpack(s),H.ZERO)){const e=$u.fromPoints(f);for(i=0;i<f.length;i++)H.subtract(f[i],e.center,FL),u[3*i+0]=FL.x,u[3*i+1]=FL.y,u[3*i+2]=FL.z;const n=ve.fromTranslation(e.center,zL);t.transform=ve.multiplyTransformation(n,t.transform,t.transform)}for(i=0;i<r;i++){m=H.clone(f[i]),D(s)&&H.add(m,H.unpack(s),m),c&&(VL(o,a,i,v,m,g,_,y,b,E),_o.pack(v,A,0),d[4*i+0]=A[0],d[4*i+1]=A[1],d[4*i+2]=A[2],d[4*i+3]=A[3]),l&&(HL(o,i,T),H.pack(T,w,0),h[3*i+0]=w[0],h[3*i+1]=w[1],h[3*i+2]=w[2]);let e=o.getProperty("BATCH_ID",Ca.UNSIGNED_SHORT,1,i);D(e)||(e=i),p[i]=e}const x=new LL;x.transformInWorldSpace=!0;const S=e._buffers,C=new NL;if(C.name="Instance Translation",C.semantic=ZP.TRANSLATION,C.componentDatatype=Ca.FLOAT,C.type=Zf.VEC3,C.count=r,C.typedArray=u,!c){const e=Ye.createVertexBuffer({context:n.context,typedArray:u,usage:qe.STATIC_DRAW});e.vertexArrayDestroyable=!1,S.push(e),C.buffer=e}if(x.attributes.push(C),c){const e=new NL;e.name="Instance Rotation",e.semantic=ZP.ROTATION,e.componentDatatype=Ca.FLOAT,e.type=Zf.VEC4,e.count=r,e.typedArray=d,x.attributes.push(e)}if(l){const e=new NL;if(e.name="Instance Scale",e.semantic=ZP.SCALE,e.componentDatatype=Ca.FLOAT,e.type=Zf.VEC3,e.count=r,c)e.typedArray=h;else{const t=Ye.createVertexBuffer({context:n.context,typedArray:h,usage:qe.STATIC_DRAW});t.vertexArrayDestroyable=!1,S.push(t),e.buffer=t}x.attributes.push(e)}const I=new NL;I.name="Instance Feature ID",I.setIndex=0,I.semantic=ZP.FEATURE_ID,I.componentDatatype=Ca.FLOAT,I.type=Zf.SCALAR,I.count=r;const O=Ye.createVertexBuffer({context:n.context,typedArray:p,usage:qe.STATIC_DRAW});O.vertexArrayDestroyable=!1,S.push(O),I.buffer=O,x.attributes.push(I);const P=new RL;P.propertyTableId=0,P.setIndex=0,P.positionalLabel="instanceFeatureId_0",x.featureIds.push(P);const N=t.nodes,R=N.length;let L=!1;for(i=0;i<R;i++){const e=N[i];e.primitives.length>0&&(e.instances=L?UL(x):x,L=!0)}}(this,i,e),function(e,t){const n=e._batchTable,i=e._instancesLength;if(0===i)return;let o;if(D(n.json))o=nL({count:i,batchTable:n.json,binaryBody:n.binary});else{o=new VP({schema:{},propertyTables:[new PP({name:tI.BATCH_TABLE_CLASS_NAME,count:i})]})}t.structuralMetadata=o}(this,i),this._components=i,this._arrayBuffer=void 0,this._state=OL,!0};const FL=new H,BL=new Array(4),zL=new ve;function UL(e){const t=new LL;t.transformInWorldSpace=e.transformInWorldSpace;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const e=ti(n[o],!1);t.attributes.push(e)}return t.featureIds=e.featureIds,t}const kL=new Array(4);function VL(e,t,n,i,o,r,s,a,c,l){const u=e.getProperty("NORMAL_UP",Ca.FLOAT,3,n,BL),d=e.getProperty("NORMAL_RIGHT",Ca.FLOAT,3,n,kL);let h=!1;if(D(u)){if(!D(d))throw new be("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");H.unpack(u,0,r),H.unpack(d,0,s),h=!0}else{const i=e.getProperty("NORMAL_UP_OCT32P",Ca.UNSIGNED_SHORT,2,n,BL),a=e.getProperty("NORMAL_RIGHT_OCT32P",Ca.UNSIGNED_SHORT,2,n,kL);if(D(i)){if(!D(a))throw new be("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");sm.octDecodeInRange(i[0],i[1],65535,r),sm.octDecodeInRange(a[0],a[1],65535,s),h=!0}else t?(Cr.eastNorthUpToFixedFrame(o,on.WGS84,l),ve.getMatrix3(l,c)):re.clone(re.IDENTITY,c)}h&&(H.cross(s,r,a),H.normalize(a,a),re.setColumn(c,0,s,c),re.setColumn(c,1,r,c),re.setColumn(c,2,a,c)),_o.fromRotationMatrix(c,i)}function HL(e,t,n){n=H.fromElements(1,1,1,n);const i=e.getProperty("SCALE",Ca.FLOAT,1,t);D(i)&&H.multiplyByScalar(n,i,n);const o=e.getProperty("SCALE_NON_UNIFORM",Ca.FLOAT,3,t,BL);D(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}ML.prototype.isUnloaded=function(){return this._state===PL},ML.prototype.unload=function(){D(this._gltfLoader)&&!this._gltfLoader.isDestroyed()&&this._gltfLoader.unload(),function(e){const t=e._buffers,n=t.length;for(let i=0;i<n;i++){const e=t[i];e.isDestroyed()||e.destroy()}t.length=0}(this),this._components=void 0,this._arrayBuffer=void 0,this._state=PL};const GL=Object.freeze({STOPPED:0,ANIMATING:1});function jL(){this.times=void 0,this.points=void 0,P.throwInstantiationError()}function WL(e){this._value=e,this._valueType=jL.getPointType(e)}function qL(e){const t=(e=M(e,M.EMPTY_OBJECT)).points,n=e.times;if(!D(t)||!D(n))throw new P("points and times are required.");if(t.length<2)throw new P("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new P("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=jL.getPointType(t[0]),this._lastTimeIndex=0}jL.getPointType=function(e){if("number"==typeof e)return Number;if(e instanceof H)return H;if(e instanceof _o)return _o;throw new P("point must be a Cartesian3, Quaternion, or number.")},jL.prototype.evaluate=P.throwInstantiationError,jL.prototype.findTimeInterval=function(e,t){const n=this.times,i=n.length;if(L.typeOf.number("time",e),e<n[0]||e>n[i-1])throw new P("time is out of range.");if(e>=n[t=M(t,0)]){if(t+1<i&&e<n[t+1])return t;if(t+2<i&&e<n[t+2])return t+1}else if(t-1>=0&&e>=n[t-1])return t-1;let o;if(e>n[t])for(o=t;o<i-1&&!(e>=n[o]&&e<n[o+1]);++o);else for(o=t-1;o>=0&&!(e>=n[o]&&e<n[o+1]);--o);return o===i-1&&(o=i-2),o},jL.prototype.wrapTime=function(e){L.typeOf.number("time",e);const t=this.times,n=t[t.length-1],i=t[0],o=n-i;let r;return e<i&&(r=Math.floor((i-e)/o)+1,e+=r*o),e>n&&(r=Math.floor((e-n)/o)+1,e-=r*o),e},jL.prototype.clampTime=function(e){L.typeOf.number("time",e);const t=this.times;return V.clamp(e,t[0],t[t.length-1])},Object.defineProperties(WL.prototype,{value:{get:function(){return this._value}}}),WL.prototype.findTimeInterval=function(e){throw new P("findTimeInterval cannot be called on a ConstantSpline.")},WL.prototype.wrapTime=function(e){return L.typeOf.number("time",e),0},WL.prototype.clampTime=function(e){return L.typeOf.number("time",e),0},WL.prototype.evaluate=function(e,t){L.typeOf.number("time",e);const n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)},Object.defineProperties(qL.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),qL.prototype.findTimeInterval=jL.prototype.findTimeInterval,qL.prototype.wrapTime=jL.prototype.wrapTime,qL.prototype.clampTime=jL.prototype.clampTime,qL.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=(e-i[o])/(i[o+1]-i[o]);return this._pointType===Number?(1-r)*n[o]+r*n[o+1]:(D(t)||(t=new H),H.lerp(n[o],n[o+1],r,t))};const YL={solve:function(e,t,n,i){if(!(D(e)&&e instanceof Array))throw new P("The array lower is required.");if(!(D(t)&&t instanceof Array))throw new P("The array diagonal is required.");if(!(D(n)&&n instanceof Array))throw new P("The array upper is required.");if(!(D(i)&&i instanceof Array))throw new P("The array right is required.");if(t.length!==i.length)throw new P("diagonal and right must have the same lengths.");if(e.length!==n.length)throw new P("lower and upper must have the same lengths.");if(e.length!==t.length-1)throw new P("lower and upper must be one less than the length of diagonal.");const o=new Array(n.length),r=new Array(i.length),s=new Array(i.length);let a,c;for(a=0;a<r.length;a++)r[a]=new H,s[a]=new H;for(o[0]=n[0]/t[0],r[0]=H.multiplyByScalar(i[0],1/t[0],r[0]),a=1;a<o.length;++a)c=1/(t[a]-o[a-1]*e[a-1]),o[a]=n[a]*c,r[a]=H.subtract(i[a],H.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=H.multiplyByScalar(r[a],c,r[a]);for(c=1/(t[a]-o[a-1]*e[a-1]),r[a]=H.subtract(i[a],H.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=H.multiplyByScalar(r[a],c,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=H.subtract(r[a],H.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s}},XL=YL,QL=[],$L=[],KL=[],ZL=[];function JL(e){const t=(e=M(e,M.EMPTY_OBJECT)).points,n=e.times,i=e.inTangents,o=e.outTangents;if(!(D(t)&&D(n)&&D(i)&&D(o)))throw new P("times, points, inTangents, and outTangents are required.");if(t.length<2)throw new P("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new P("times.length must be equal to points.length.");if(i.length!==o.length||i.length!==t.length-1)throw new P("inTangents and outTangents must have a length equal to points.length - 1.");if(this._times=n,this._points=t,this._pointType=jL.getPointType(t[0]),this._pointType!==jL.getPointType(i[0])||this._pointType!==jL.getPointType(o[0]))throw new P("inTangents and outTangents must be of the same type as points.");this._inTangents=i,this._outTangents=o,this._lastTimeIndex=0}Object.defineProperties(JL.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}}}),JL.createC1=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).times,n=e.points,i=e.tangents;if(!D(n)||!D(t)||!D(i))throw new P("points, times and tangents are required.");if(n.length<2)throw new P("points.length must be greater than or equal to 2.");if(t.length!==n.length||t.length!==i.length)throw new P("times, points and tangents must have the same length.");const o=i.slice(0,i.length-1);return new JL({times:t,points:n,inTangents:i.slice(1,i.length),outTangents:o})},JL.createNaturalCubic=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).times,n=e.points;if(!D(n)||!D(t))throw new P("points and times are required.");if(n.length<2)throw new P("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new P("times.length must be equal to points.length.");if(n.length<3)return new qL({points:n,times:t});const i=function(e){const t=QL,n=KL,i=$L,o=ZL;let r;t.length=n.length=e.length-1,i.length=o.length=e.length,t[0]=n[0]=1,i[0]=2;let s=o[0];for(D(s)||(s=o[0]=new H),H.subtract(e[1],e[0],s),H.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],D(s)||(s=o[r]=new H),H.subtract(e[r+1],e[r-1],s),H.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],D(s)||(s=o[r]=new H),H.subtract(e[r],e[r-1],s),H.multiplyByScalar(s,3,s),XL.solve(t,i,n,o)}(n),o=i.slice(0,i.length-1);return new JL({times:t,points:n,inTangents:i.slice(1,i.length),outTangents:o})},JL.createClampedCubic=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).times,n=e.points,i=e.firstTangent,o=e.lastTangent;if(!(D(n)&&D(t)&&D(i)&&D(o)))throw new P("points, times, firstTangent and lastTangent are required.");if(n.length<2)throw new P("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new P("times.length must be equal to points.length.");const r=jL.getPointType(n[0]);if(r!==jL.getPointType(i)||r!==jL.getPointType(o))throw new P("firstTangent and lastTangent must be of the same type as points.");if(n.length<3)return new qL({points:n,times:t});const s=function(e,t,n){const i=QL,o=KL,r=$L,s=ZL;let a;i.length=o.length=e.length-1,r.length=s.length=e.length,i[0]=r[0]=1,o[0]=0;let c=s[0];for(D(c)||(c=s[0]=new H),H.clone(t,c),a=1;a<i.length-1;++a)i[a]=o[a]=1,r[a]=4,c=s[a],D(c)||(c=s[a]=new H),H.subtract(e[a+1],e[a-1],c),H.multiplyByScalar(c,3,c);return i[a]=0,o[a]=1,r[a]=4,c=s[a],D(c)||(c=s[a]=new H),H.subtract(e[a+1],e[a-1],c),H.multiplyByScalar(c,3,c),r[a+1]=1,c=s[a+1],D(c)||(c=s[a+1]=new H),H.clone(n,c),XL.solve(i,r,o,s)}(n,i,o),a=s.slice(0,s.length-1);return new JL({times:t,points:n,inTangents:s.slice(1,s.length),outTangents:a})},JL.hermiteCoefficientMatrix=new ve(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0),JL.prototype.findTimeInterval=jL.prototype.findTimeInterval;const eM=new K,tM=new H;function nM(e){const t=(e=M(e,M.EMPTY_OBJECT)).points,n=e.times;if(!D(t)||!D(n))throw new P("points and times are required.");if(t.length<2)throw new P("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new P("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=jL.getPointType(t[0]),this._lastTimeIndex=0}function iM(e){const t=(e=M(e,M.EMPTY_OBJECT)).points,n=e.times;if(!D(t)||!D(n))throw new P("points and times are required.");if(t.length<2)throw new P("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new P("times.length must be equal to points.length.");this._times=n,this._points=t,this._evaluateFunction=function(e){const t=e.points,n=e.times;return function(i,o){D(o)||(o=new _o);const r=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),s=(i-n[r])/(n[r+1]-n[r]),a=t[r],c=t[r+1];return _o.fastSlerp(a,c,s,o)}}(this),this._lastTimeIndex=0}JL.prototype.wrapTime=jL.prototype.wrapTime,JL.prototype.clampTime=jL.prototype.clampTime,JL.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this.inTangents,r=this.outTangents;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const s=this._lastTimeIndex,a=i[s+1]-i[s],c=(e-i[s])/a,l=eM;l.z=c,l.y=c*c,l.x=l.y*c,l.w=1;const u=ve.multiplyByVector(JL.hermiteCoefficientMatrix,l,l);u.z*=a,u.w*=a;const d=this._pointType;return d===Number?n[s]*u.x+n[s+1]*u.y+r[s]*u.z+o[s]*u.w:(D(t)||(t=new d),t=d.multiplyByScalar(n[s],u.x,t),d.multiplyByScalar(n[s+1],u.y,tM),d.add(t,tM,t),d.multiplyByScalar(r[s],u.z,tM),d.add(t,tM,t),d.multiplyByScalar(o[s],u.w,tM),d.add(t,tM,t))},Object.defineProperties(nM.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),nM.prototype.findTimeInterval=jL.prototype.findTimeInterval,nM.prototype.wrapTime=jL.prototype.wrapTime,nM.prototype.clampTime=jL.prototype.clampTime,nM.prototype.evaluate=function(e,t){const n=this.points;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const i=this._lastTimeIndex,o=this._pointType;return o===Number?n[i]:(D(t)||(t=new o),o.clone(n[i],t))},Object.defineProperties(iM.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}}),iM.prototype.findTimeInterval=jL.prototype.findTimeInterval,iM.prototype.wrapTime=jL.prototype.wrapTime,iM.prototype.clampTime=jL.prototype.clampTime,iM.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};const oM=UC.AnimatedPropertyType;function rM(e){const t=(e=M(e,M.EMPTY_OBJECT)).channel,n=e.runtimeAnimation,i=e.runtimeNode;L.typeOf.object("options.channel",t),L.typeOf.object("options.runtimeAnimation",n),L.typeOf.object("options.runtimeNode",i),this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,function(e){const t=e._channel,n=t.sampler,i=n.input,o=n.output,r=n.interpolation,s=t.target,a=s.path,c=e._runtimeNode,l=D(c.morphWeights)?c.morphWeights.length:1,u=function(e,t,n,i,o){const r=[];if(i===oM.WEIGHTS){const s=t.length/o;let a,c;for(a=0;a<o;a++){const l=new Array(s);let u=a;if(n===IP.CUBICSPLINE)for(c=0;c<s;c+=3)l[c]=t[u],l[c+1]=t[u+o],l[c+2]=t[u+2*o],u+=3*o;else for(c=0;c<s;c++)l[c]=t[u],u+=o;r.push(sM(e,l,n,i))}}else r.push(sM(e,t,n,i));return r}(i,o,r,a,l);e._splines=u,e._path=a}(this)}function sM(e,t,n,i){if(1===e.length&&1===t.length)return new WL(t[0]);switch(n){case IP.STEP:return new nM({times:e,points:t});case IP.CUBICSPLINE:return function(e,t){const n=[],i=[],o=[],r=t.length;for(let s=0;s<r;s+=3)i.push(t[s]),n.push(t[s+1]),o.push(t[s+2]);return i.splice(0,1),o.length=o.length-1,new JL({times:e,points:n,inTangents:i,outTangents:o})}(e,t);case IP.LINEAR:return i===oM.ROTATION?new iM({times:e,points:t}):new qL({times:e,points:t})}}Object.defineProperties(rM.prototype,{channel:{get:function(){return this._channel}},runtimeAnimation:{get:function(){return this._runtimeAnimation}},runtimeNode:{get:function(){return this._runtimeNode}},splines:{get:function(){return this._splines}}});const aM=new H,cM=new _o;function lM(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=Hn.clone(n.startTime),this._delay=M(n.delay,0),this._stopTime=Hn.clone(n.stopTime),this.removeOnStop=M(n.removeOnStop,!1),this._multiplier=M(n.multiplier,1),this._reverse=M(n.reverse,!1),this._loop=M(n.loop,GI.NONE),this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new gi,this.update=new gi,this.stop=new gi,this._state=GL.STOPPED,this._computedStartTime=void 0,this._duration=void 0;const i=this;this._raiseStartEvent=function(){i.start.raiseEvent(e,i)},this._updateEventTime=0,this._raiseUpdateEvent=function(){i.update.raiseEvent(e,i,i._updateEventTime)},this._raiseStopEvent=function(){i.stop.raiseEvent(e,i)},this._model=e,this._localStartTime=void 0,this._localStopTime=void 0,function(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE;const i=e._model.sceneGraph,o=e._animation,r=o.channels,s=r.length,a=[];for(let c=0;c<s;c++){const o=r[c],s=o.target;if(!D(s))continue;const l=s.node.index,u=new rM({channel:o,runtimeAnimation:e,runtimeNode:i._runtimeNodes[l]}),d=o.sampler.input;t=Math.min(t,d[0]),n=Math.max(n,d[d.length-1]),a.push(u)}e._runtimeChannels=a,e._localStartTime=t,e._localStopTime=n}(this)}function uM(e){this.animationAdded=new gi,this.animationRemoved=new gi,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}function dM(e,t,n){const i=e._model,o=new lM(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}rM.prototype.animate=function(e){const t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===oM.WEIGHTS){const n=o.morphWeights,r=n.length;for(let o=0;o<r;o++){const r=t[o],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);n[o]=r.evaluate(s)}}else{if(o.userAnimated)return;{const r=t[0],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);n===oM.TRANSLATION||n===oM.SCALE?o[n]=r.evaluate(s,aM):n===oM.ROTATION&&(o[n]=r.evaluate(s,cM))}}},Object.defineProperties(lM.prototype,{animation:{get:function(){return this._animation}},name:{get:function(){return this._name}},runtimeChannels:{get:function(){return this._runtimeChannels}},model:{get:function(){return this._model}},localStartTime:{get:function(){return this._localStartTime}},localStopTime:{get:function(){return this._localStopTime}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}},animationTime:{get:function(){return this._animationTime}}}),lM.prototype.animate=function(e){const t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)},Object.defineProperties(uM.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}}),uM.prototype.add=function(e){e=M(e,M.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new P("Animations are not loaded. Wait for Model.ready to be true.");const n=t.sceneGraph.components.animations;if(!D(e.name)&&!D(e.index))throw new P("Either options.name or options.index must be defined.");if(D(e.multiplier)&&e.multiplier<=0)throw new P("options.multiplier must be greater than zero.");if(D(e.index)&&(e.index>=n.length||e.index<0))throw new P("options.index must be a valid animation index.");let i=e.index;if(D(i))return dM(this,n[i],e);const o=n.length;for(let r=0;r<o;++r)if(n[r].name===e.name){i=r;break}if(!D(i))throw new P("options.name must be a valid animation name.");return dM(this,n[i],e)},uM.prototype.addAll=function(e){e=M(e,M.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new P("Animations are not loaded. Wait for Model.ready to be true.");if(D(e.multiplier)&&e.multiplier<=0)throw new P("options.multiplier must be greater than zero.");const n=t.sceneGraph.components.animations,i=[],o=n.length;for(let r=0;r<o;++r){const t=dM(this,n[r],e);i.push(t)}return i},uM.prototype.remove=function(e){if(!D(e))return!1;const t=this._runtimeAnimations,n=t.indexOf(e);return-1!==n&&(t.splice(n,1),this.animationRemoved.raiseEvent(this._model,e),!0)},uM.prototype.removeAll=function(){const e=this._model,t=this._runtimeAnimations,n=t.length;this._runtimeAnimations.length=0;for(let i=0;i<n;++i)this.animationRemoved.raiseEvent(e,t[i])},uM.prototype.contains=function(e){return!!D(e)&&-1!==this._runtimeAnimations.indexOf(e)},uM.prototype.get=function(e){if(!D(e))throw new P("index is required.");if(e>=this._runtimeAnimations.length||e<0)throw new P("index must be valid within the range of the collection");return this._runtimeAnimations[e]};const hM=[];function pM(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}function fM(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}uM.prototype.update=function(e){const t=this._runtimeAnimations;let n=t.length;if(0===n)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&Hn.equals(e.time,this._previousTime))return!1;this._previousTime=Hn.clone(e.time,this._previousTime);let i=!1;const o=e.time,r=this._model;for(let s=0;s<n;++s){const n=t[s];D(n._computedStartTime)||(n._computedStartTime=Hn.addSeconds(M(n.startTime,o),n.delay,new Hn)),D(n._duration)||(n._duration=n.localStopTime*(1/n.multiplier));const r=n._computedStartTime,a=n._duration,c=n.stopTime,l=Hn.lessThanOrEquals(r,o),u=D(c)&&Hn.greaterThan(o,c);let d=0;if(0!==a){const e=Hn.secondsDifference(u?c:o,r);d=D(n._animationTime)?n._animationTime(a,e):e/a}const h=n.loop===GI.REPEAT||n.loop===GI.MIRRORED_REPEAT,p=(l||h&&!D(n.startTime))&&(d<=1||h)&&!u;if(d===n._prevAnimationDelta){if(p!==(n._state===GL.STOPPED))continue}if(n._prevAnimationDelta=d,p||n._state===GL.ANIMATING){if(p&&n._state===GL.STOPPED&&(n._state=GL.ANIMATING,n.start.numberOfListeners>0&&e.afterRender.push(n._raiseStartEvent)),n.loop===GI.REPEAT)d-=Math.floor(d);else if(n.loop===GI.MIRRORED_REPEAT){const e=Math.floor(d),t=d-e;d=e%2==1?1-t:t}n.reverse&&(d=1-d);let t=d*a*n.multiplier;t=V.clamp(t,n.localStartTime,n.localStopTime),n.animate(t),n.update.numberOfListeners>0&&(n._updateEventTime=t,e.afterRender.push(n._raiseUpdateEvent)),i=!0,p||(n._state=GL.STOPPED,n.stop.numberOfListeners>0&&e.afterRender.push(n._raiseStopEvent),n.removeOnStop&&hM.push(n))}}n=hM.length;for(let s=0;s<n;++s){const n=hM[s];t.splice(t.indexOf(n),1),e.afterRender.push(pM(this,r,n))}return hM.length=0,i},Object.defineProperties(fM.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return D(this._color)||(this._color=new Ot),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}},featureId:{get:function(){return this._featureId}}}),fM.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)},fM.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)},fM.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)},fM.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)},fM.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};const mM={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2,getStyleCommandsNeeded:function(e,t){return 0===t?mM.ALL_OPAQUE:t===e?mM.ALL_TRANSLUCENT:mM.OPAQUE_AND_TRANSLUCENT}},_M=Object.freeze(mM),gM={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON",is3DTiles:function(e){switch(L.typeOf.string("modelType",e),e){case gM.TILE_GLTF:case gM.TILE_B3DM:case gM.TILE_I3DM:case gM.TILE_PNTS:case gM.TILE_GEOJSON:return!0;case gM.GLTF:return!1;default:throw new P("modelType is not a valid value.")}}},yM=Object.freeze(gM);function bM(e){const t=e.model,n=e.propertyTable;L.typeOf.object("propertyTable",n),L.typeOf.object("model",t),this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=_M.ALL_OPAQUE,function(e){const t=e._model,n=yM.is3DTiles(t.type),i=e._propertyTable.count;if(0===i)return;let o;const r=new Array(i);if(n){const e=t.content;for(o=0;o<i;o++)r[o]=new uE(e,o)}else for(o=0;o<i;o++)r[o]=new fM({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new xw({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}(this)}Object.defineProperties(bM.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},batchTextureByteLength:{get:function(){return D(this._batchTexture)?this._batchTexture.byteLength:0}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}}),bM.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=_M.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)},bM.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)},bM.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)},bM.prototype.getShow=function(e){return this._batchTexture.getShow(e)},bM.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)},bM.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)},bM.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)},bM.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)},bM.prototype.getFeature=function(e){return this._features[e]},bM.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)},bM.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)},bM.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)},bM.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)},bM.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)},bM.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)},bM.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)},bM.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)},bM.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};const vM=new Ot;bM.prototype.applyStyle=function(e){if(!D(e))return this.setAllColor(xw.DEFAULT_COLOR_VALUE),void this.setAllShow(xw.DEFAULT_SHOW_VALUE);for(let t=0;t<this._featuresLength;t++){const n=this.getFeature(t),i=D(e.color)?M(e.color.evaluateColor(n,vM),xw.DEFAULT_COLOR_VALUE):xw.DEFAULT_COLOR_VALUE,o=D(e.show)?M(e.show.evaluate(n),xw.DEFAULT_SHOW_VALUE):xw.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}},bM.prototype.isDestroyed=function(){return!1},bM.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),He(this)};function AM(e){const t=(e=M(e,M.EMPTY_OBJECT)).command,n=e.primitiveRenderResources;L.typeOf.object("options.command",t),L.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._command=t,this._model=i,this._runtimePrimitive=n.runtimePrimitive,this._modelMatrix=t.modelMatrix,this._boundingVolume=t.boundingVolume,this._cullFace=t.renderState.cull.face;const o=i.classificationType;this._classificationType=o,this._classifiesTerrain=o!==Vf.CESIUM_3D_TILE,this._classifies3DTiles=o!==Vf.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],function(e){const t=e._command,n=EM;if(e._useDebugWireframe){t.pass=zt.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=xM(e,n,e._commandListDebugWireframe);const i=e._commandListDebugWireframe,o=i.length;for(let e=0;e<o;e++){const t=i[e];t.count*=2,t.offset*=2}return}const i=e.model,o=i.allowPicking;if(e._classifiesTerrain){const i=zt.TERRAIN_CLASSIFICATION,r=SM(t,i),s=CM(t,i);n.length=0,n.push(r,s),e._commandListTerrain=xM(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=OM(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){const i=zt.CESIUM_3D_TILE_CLASSIFICATION,r=SM(t,i),s=CM(t,i);n.length=0,n.push(r,s),e._commandList3DTiles=xM(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=OM(e,n,e._commandList3DTilesPicking))}}(this)}const TM={stencilTest:{enabled:!0,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},backFunction:ny.NOT_EQUAL,backOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},reference:0,mask:sy.CLASSIFICATION_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:dh.PRE_MULTIPLIED_ALPHA_BLEND},wM={stencilTest:{enabled:!0,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},backFunction:ny.NOT_EQUAL,backOperation:{fail:oy.ZERO,zFail:oy.ZERO,zPass:oy.ZERO},reference:0,mask:sy.CLASSIFICATION_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},EM=[];function xM(e,t,n){const i=e._runtimePrimitive,o=i.batchLengths,r=i.batchOffsets,s=o.length,a=t.length;for(let c=0;c<s;c++){const e=o[c],i=r[c];for(let o=0;o<a;o++){const r=t[o],s=Kr.shallowClone(r);s.count=e,s.offset=i,n.push(s)}}return n}function SM(e,t){const n=Kr.shallowClone(e);n.cull=!1,n.pass=t;const i=function(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:oy.KEEP,zFail:oy.DECREMENT_WRAP,zPass:oy.KEEP},backFunction:e,backOperation:{fail:oy.KEEP,zFail:oy.INCREMENT_WRAP,zPass:oy.KEEP},reference:sy.CESIUM_3D_TILE_MASK,mask:sy.CESIUM_3D_TILE_MASK},stencilMask:sy.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Gf.LESS_OR_EQUAL},depthMask:!1}}(t===zt.TERRAIN_CLASSIFICATION?ny.ALWAYS:ny.EQUAL);return n.renderState=_s.fromCache(i),n}function CM(e,t){const n=Kr.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=_s.fromCache(TM),n}const IM=[];function OM(e,t,n){const i=_s.fromCache(wM),o=t[0],r=t[1],s=Kr.shallowClone(o);s.cull=!0,s.pickOnly=!0;const a=Kr.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;const c=IM;return c.length=0,c.push(s,a),xM(e,c,n)}function DM(e){const t=(e=M(e,M.EMPTY_OBJECT)).command,n=e.primitiveRenderResources;L.typeOf.object("options.command",t),L.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._model=i;const o=n.runtimePrimitive;this._runtimePrimitive=o;const r=t.pass===zt.TRANSLUCENT,s=!o.primitive.material.doubleSided&&!r,a=n.hasSilhouette,c=!r&&!a,l=n.hasSkipLevelOfDetail&&!r,u=a;this._command=t,this._modelMatrix=ve.clone(t.modelMatrix),this._boundingVolume=$u.clone(t.boundingVolume),this._modelMatrix2D=new ve,this._boundingVolume2D=new $u,this._modelMatrix2DDirty=!1,this._backFaceCulling=t.renderState.cull.enabled,this._cullFace=t.renderState.cull.face,this._shadows=i.shadows,this._debugShowBoundingVolume=t.debugShowBoundingVolume,this._usesBackFaceCulling=s,this._needsTranslucentCommand=c,this._needsSkipLevelOfDetailCommands=l,this._needsSilhouetteCommands=u,this._originalCommand=void 0,this._translucentCommand=void 0,this._skipLodBackfaceCommand=void 0,this._skipLodStencilCommand=void 0,this._silhouetteModelCommand=void 0,this._silhouetteColorCommand=void 0,this._derivedCommands=[],this._has2DCommands=!1,function(e){const t=e._command;t.modelMatrix=e._modelMatrix,t.boundingVolume=e._boundingVolume;const n=e._model,i=e._usesBackFaceCulling,o=e._derivedCommands;e._originalCommand=new PM({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new PM({command:MM(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand));e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new PM({command:zM(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new PM({command:UM(t),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand));e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new PM({command:FM(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new PM({command:BM(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}(this)}function PM(e){this.command=e.command,this.updateShadows=e.updateShadows,this.updateBackFaceCulling=e.updateBackFaceCulling,this.updateCullFace=e.updateCullFace,this.updateDebugShowBoundingVolume=e.updateDebugShowBoundingVolume,this.is2D=M(e.is2D,!1),this.derivedCommand2D=void 0}function NM(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function RM(e,t){if(t.mode!==gl.SCENE2D||e.model._projectTo2D)return!1;const n=e.model.sceneGraph._boundingSphere2D,i=n.center.y-n.radius,o=n.center.y+n.radius,r=t.mapProjection.ellipsoid.maximumRadius*V.PI;return i<r&&o>r||i<-r&&o>-r}function LM(e,t){if(!D(t))return;const n=PM.clone(t),i=Kr.shallowClone(t.command);return i.modelMatrix=e._modelMatrix2D,i.boundingVolume=e._boundingVolume2D,n.command=i,n.updateShadows=!1,n.is2D=!0,t.derivedCommand2D=n,e._derivedCommands.push(n),n}function MM(e){const t=Kr.shallowClone(e);t.pass=zt.TRANSLUCENT;const n=ti(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=dh.ALPHA_BLEND,t.renderState=_s.fromCache(n),t}function FM(e,t){const n=t._silhouetteId%255,i=Kr.shallowClone(e),o=ti(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:Me.ALWAYS,backFunction:Me.ALWAYS,reference:n,mask:-1,frontOperation:{fail:Me.KEEP,zFail:Me.KEEP,zPass:Me.REPLACE},backOperation:{fail:Me.KEEP,zFail:Me.KEEP,zPass:Me.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=_s.fromCache(o),i}function BM(e,t){const n=t._silhouetteId%255,i=Kr.shallowClone(e),o=ti(e.renderState,!0);o.cull.enabled=!1;(e.pass===zt.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=zt.TRANSLUCENT,o.depthMask=!1,o.blending=dh.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:Me.NOTEQUAL,backFunction:Me.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:Me.KEEP,zFail:Me.KEEP,zPass:Me.KEEP},backOperation:{fail:Me.KEEP,zFail:Me.KEEP,zPass:Me.KEEP}};const r=ti(e.uniformMap);return r.model_silhouettePass=function(){return!0},i.renderState=_s.fromCache(o),i.uniformMap=r,i.castShadows=!1,i.receiveShadows=!1,i}function zM(e){const t=Kr.shallowClone(e),n=ti(e.renderState,!0);n.cull.enabled=!0,n.cull.face=ph.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};const i=ti(t.uniformMap),o=new kt(5,5);return i.u_polygonOffset=function(){return o},t.renderState=_s.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function UM(e){const t=Kr.shallowClone(e),n=ti(e.renderState,!0),{stencilTest:i}=n;return i.enabled=!0,i.mask=sy.SKIP_LOD_MASK,i.reference=sy.CESIUM_3D_TILE_MASK,i.frontFunction=ny.GREATER_OR_EQUAL,i.frontOperation.zPass=oy.REPLACE,i.backFunction=ny.GREATER_OR_EQUAL,i.backOperation.zPass=oy.REPLACE,n.stencilMask=sy.CESIUM_3D_TILE_MASK|sy.SKIP_LOD_MASK,t.renderState=_s.fromCache(n),t}function kM(e,t){const n=e.shaderBuilder;n.addVertexLines("precision highp float;\n\nczm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {\n czm_modelVertexOutput vsOutput;\n vsOutput.positionMC = positionMC;\n vsOutput.pointSize = 1.0;\n return vsOutput;\n}\n\nvoid main()\n{\n // Initialize the attributes struct with all\n // attributes except quantized ones.\n ProcessedAttributes attributes;\n initializeAttributes(attributes);\n\n // Dequantize the quantized ones and add them to the\n // attributes struct.\n #ifdef USE_DEQUANTIZATION\n dequantizationStage(attributes);\n #endif\n\n #ifdef HAS_MORPH_TARGETS\n morphTargetsStage(attributes);\n #endif\n\n #ifdef HAS_SKINNING\n skinningStage(attributes);\n #endif\n\n #ifdef HAS_PRIMITIVE_OUTLINE\n primitiveOutlineStage();\n #endif\n\n // Compute the bitangent according to the formula in the glTF spec.\n // Normal and tangents can be affected by morphing and skinning, so\n // the bitangent should not be computed until their values are finalized.\n #ifdef HAS_BITANGENTS\n attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);\n #endif\n\n FeatureIds featureIds;\n featureIdStage(featureIds, attributes);\n\n #ifdef HAS_SELECTED_FEATURE_ID\n SelectedFeature feature;\n selectedFeatureIdStage(feature, featureIds);\n // Handle any show properties that come from the style.\n cpuStylingStage(attributes.positionMC, feature);\n #endif\n\n #if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)\n // The scene mode 2D pipeline stage and instancing stage add a different\n // model view matrix to accurately project the model to 2D. However, the\n // output positions and normals should be transformed by the 3D matrices\n // to keep the data the same for the fragment shader.\n mat4 modelView = czm_modelView3D;\n mat3 normal = czm_normal3D;\n #else\n // These are used for individual model projection because they will\n // automatically change based on the scene mode.\n mat4 modelView = czm_modelView;\n mat3 normal = czm_normal;\n #endif\n\n // Update the position for this instance in place\n #ifdef HAS_INSTANCING\n\n // The legacy instance stage is used when rendering i3dm models that\n // encode instances transforms in world space, as opposed to glTF models\n // that use EXT_mesh_gpu_instancing, where instance transforms are encoded\n // in object space.\n #ifdef USE_LEGACY_INSTANCING\n mat4 instanceModelView;\n mat3 instanceModelViewInverseTranspose;\n\n legacyInstancingStage(attributes, instanceModelView, instanceModelViewInverseTranspose);\n\n modelView = instanceModelView;\n normal = instanceModelViewInverseTranspose;\n #else\n instancingStage(attributes);\n #endif\n\n #ifdef USE_PICKING\n v_pickColor = a_pickColor;\n #endif\n\n #endif\n\n Metadata metadata;\n MetadataClass metadataClass;\n MetadataStatistics metadataStatistics;\n metadataStage(metadata, metadataClass, metadataStatistics, attributes);\n\n #ifdef HAS_VERTICAL_EXAGGERATION\n verticalExaggerationStage(attributes);\n #endif\n\n #ifdef HAS_CUSTOM_VERTEX_SHADER\n czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);\n customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass, metadataStatistics);\n #endif\n\n // Compute the final position in each coordinate system needed.\n // This returns the value that will be assigned to gl_Position.\n vec4 positionClip = geometryStage(attributes, modelView, normal);\n\n // This must go after the geometry stage as it needs v_positionWC\n #ifdef HAS_ATMOSPHERE\n atmosphereStage(attributes);\n #endif\n\n #ifdef ENABLE_CLIPPING_POLYGONS\n modelClippingPolygonsStage(attributes);\n #endif\n\n #ifdef HAS_SILHOUETTE\n silhouetteStage(attributes, positionClip);\n #endif\n\n #ifdef HAS_POINT_CLOUD_SHOW_STYLE\n float show = pointCloudShowStylingStage(attributes, metadata);\n #else\n float show = 1.0;\n #endif\n\n #ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING\n show *= pointCloudBackFaceCullingStage();\n #endif\n\n #ifdef HAS_POINT_CLOUD_COLOR_STYLE\n v_pointCloudColor = pointCloudColorStylingStage(attributes, metadata);\n #endif\n\n #ifdef PRIMITIVE_TYPE_POINTS\n #ifdef HAS_CUSTOM_VERTEX_SHADER\n gl_PointSize = vsOutput.pointSize;\n #elif defined(HAS_POINT_CLOUD_POINT_SIZE_STYLE) || defined(HAS_POINT_CLOUD_ATTENUATION)\n gl_PointSize = pointCloudPointSizeStylingStage(attributes, metadata);\n #else\n gl_PointSize = 1.0;\n #endif\n\n gl_PointSize *= show;\n #endif\n\n gl_Position = show * positionClip;\n}\n"),n.addFragmentLines("\nprecision highp float;\nczm_modelMaterial defaultModelMaterial()\n{\n czm_modelMaterial material;\n material.diffuse = vec3(0.0);\n material.specular = vec3(1.0);\n material.roughness = 1.0;\n material.occlusion = 1.0;\n material.normalEC = vec3(0.0, 0.0, 1.0);\n material.emissive = vec3(0.0);\n material.alpha = 1.0;\n return material;\n}\n\nvec4 handleAlpha(vec3 color, float alpha)\n{\n #ifdef ALPHA_MODE_MASK\n if (alpha < u_alphaCutoff) {\n discard;\n }\n #endif\n\n return vec4(color, alpha);\n}\n\nSelectedFeature selectedFeature;\n\nvoid main()\n{\n #ifdef HAS_MODEL_SPLITTER\n modelSplitterStage();\n #endif\n\n czm_modelMaterial material = defaultModelMaterial();\n\n ProcessedAttributes attributes;\n geometryStage(attributes);\n\n FeatureIds featureIds;\n featureIdStage(featureIds, attributes);\n\n Metadata metadata;\n MetadataClass metadataClass;\n MetadataStatistics metadataStatistics;\n metadataStage(metadata, metadataClass, metadataStatistics, attributes);\n\n #ifdef HAS_SELECTED_FEATURE_ID\n selectedFeatureIdStage(selectedFeature, featureIds);\n #endif\n\n #ifndef CUSTOM_SHADER_REPLACE_MATERIAL\n materialStage(material, attributes, selectedFeature);\n #endif\n\n #ifdef HAS_CUSTOM_FRAGMENT_SHADER\n customShaderStage(material, attributes, featureIds, metadata, metadataClass, metadataStatistics);\n #endif\n\n lightingStage(material, attributes);\n\n #ifdef HAS_SELECTED_FEATURE_ID\n cpuStylingStage(material, selectedFeature);\n #endif\n\n #ifdef HAS_MODEL_COLOR\n modelColorStage(material);\n #endif\n\n #ifdef HAS_PRIMITIVE_OUTLINE\n primitiveOutlineStage(material);\n #endif\n\n vec4 color = handleAlpha(material.diffuse, material.alpha);\n\n #ifdef HAS_CLIPPING_PLANES\n modelClippingPlanesStage(color);\n #endif\n\n #ifdef ENABLE_CLIPPING_POLYGONS\n modelClippingPolygonsStage();\n #endif\n\n #if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)\n silhouetteStage(color);\n #endif\n\n #ifdef HAS_ATMOSPHERE\n atmosphereStage(color, attributes);\n #endif\n\n out_FragColor = color;\n}\n");const i=function(e){const t=e.wireframeIndexBuffer;if(D(t))return t;const n=e.indices;if(!D(n))return;if(!D(n.buffer))throw new P("Indices must be provided as a Buffer");return n.buffer}(e),o=new kl({context:t.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);const s=n.buildShaderProgram(t.context);r._pipelineResources.push(s);const a=e.alphaOptions.pass,c=r.sceneGraph,l=t.mode===gl.SCENE3D;let u,d;if(l||t.scene3DOnly||!r._projectTo2D){const t=l?c._computedModelMatrix:c._computedModelMatrix2D;u=ve.multiplyTransformation(t,e.runtimeNode.computedTransform,new ve),d=$u.transform(e.boundingSphere,u,e.boundingSphere)}else{u=ve.multiplyTransformation(c._computedModelMatrix,e.runtimeNode.computedTransform,new ve);d=e.runtimePrimitive.boundingSphere2D}let h=ti(_s.fromCache(e.renderStateOptions),!0);h.cull.face=xC.getCullFace(u,e.primitiveType),h=_s.fromCache(h);const p=D(r.classificationType),f=!p&&k_.castShadows(r.shadows),m=!p&&k_.receiveShadows(r.shadows),_=p?void 0:e.pickId,g=new Kr({boundingVolume:d,modelMatrix:u,uniformMap:e.uniformMap,renderState:h,vertexArray:o,shaderProgram:s,cull:r.cull,pass:a,count:e.count,owner:r,pickId:_,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:f,receiveShadows:m});return p?new AM({primitiveRenderResources:e,command:g}):new DM({primitiveRenderResources:e,command:g})}Object.defineProperties(AM.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},batchLengths:{get:function(){return this._runtimePrimitive.batchLengths}},batchOffsets:{get:function(){return this._runtimePrimitive.batchOffsets}},model:{get:function(){return this._model}},classificationType:{get:function(){return this._classificationType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=ve.clone(e,this._modelMatrix);const t=this._runtimePrimitive.boundingSphere;this._boundingVolume=$u.transform(t,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace=e}}}),AM.prototype.pushCommands=function(e,t){const n=e.passes;if(n.render){if(this._useDebugWireframe)return void t.push.apply(t,this._commandListDebugWireframe);this._classifiesTerrain&&t.push.apply(t,this._commandListTerrain),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTiles);if(e.invertClassification&&this._classifies3DTiles){if(0===this._commandListIgnoreShow.length){const e=zt.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,t=SM(this._command,e),n=EM;n.length=0,n.push(t),this._commandListIgnoreShow=xM(this,n,this._commandListIgnoreShow)}t.push.apply(t,this._commandListIgnoreShow)}}return n.pick&&(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrainPicking),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTilesPicking)),t},PM.clone=function(e){return new PM({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})},Object.defineProperties(DM.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},model:{get:function(){return this._model}},primitiveType:{get:function(){return this._command.primitiveType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=ve.clone(e,this._modelMatrix),this._modelMatrix2DDirty=!0,this._boundingVolume=$u.transform(this.runtimePrimitive.boundingSphere,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},shadows:{get:function(){return this._shadows},set:function(e){this._shadows=e,function(e){const t=e.shadows,n=k_.castShadows(t),i=k_.receiveShadows(t),o=e._derivedCommands;for(let r=0;r<o.length;++r){const e=o[r];if(e.updateShadows){const t=e.command;t.castShadows=n,t.receiveShadows=i}}}(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,function(e){const t=e.backFaceCulling,n=e._derivedCommands;for(let i=0;i<n.length;++i){const e=n[i];if(e.updateBackFaceCulling){const n=e.command,i=ti(n.renderState,!0);i.cull.enabled=t,n.renderState=_s.fromCache(i)}}}(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,function(e){const t=e.cullFace,n=e._derivedCommands;for(let i=0;i<n.length;++i){const e=n[i];if(e.updateCullFace){const n=e.command,i=ti(n.renderState,!0);i.cull.face=t,n.renderState=_s.fromCache(i)}}}(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,function(e){const t=e.debugShowBoundingVolume,n=e._derivedCommands;for(let i=0;i<n.length;++i){const e=n[i];if(e.updateDebugShowBoundingVolume){e.command.debugShowBoundingVolume=t}}}(this))}}}),DM.prototype.pushCommands=function(e,t){const n=RM(this,e);var i;n&&!this._has2DCommands&&(LM(i=this,i._originalCommand),LM(i,i._translucentCommand),LM(i,i._skipLodBackfaceCommand),LM(i,i._skipLodStencilCommand),LM(i,i._silhouetteModelCommand),LM(i,i._silhouetteColorCommand),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(!function(e,t){const n=e._modelMatrix;e._modelMatrix2D=ve.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=2*V.sign(n[13])*V.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=$u.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}(this,e),this._modelMatrix2DDirty=!1);const o=this.model.styleCommandsNeeded;if(!this._needsTranslucentCommand||!D(o)||(o!==_M.ALL_OPAQUE&&NM(t,this._translucentCommand,n),o!==_M.ALL_TRANSLUCENT)){if(this._needsSkipLevelOfDetailCommands){const{tileset:e,tile:i}=this._model.content;if(e.hasMixedContent)return i._finalResolution||NM(e._backfaceCommands,this._skipLodBackfaceCommand,n),function(e,t,n){const i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=function(e){const t=e.renderState.stencilTest.reference;return(t&sy.SKIP_LOD_MASK)>>>sy.SKIP_LOD_BIT_SHIFT}(o);if(r!==s){const e=function(e){return sy.CESIUM_3D_TILE_MASK|e<<sy.SKIP_LOD_BIT_SHIFT}(r),t=ti(o.renderState,!0);t.stencilTest.reference=e,o.renderState=_s.fromCache(t),n&&(i.derivedCommand2D.renderState=t)}}(this,i,n),void NM(t,this._skipLodStencilCommand,n)}if(!this._needsSilhouetteCommands)return NM(t,this._originalCommand,n),t;NM(t,this._silhouetteModelCommand,n)}},DM.prototype.pushSilhouetteCommands=function(e,t){const n=RM(this,e);return NM(t,this._silhouetteColorCommand,n),t};const VM={name:"TilesetPipelineStage",process:function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,su.FRAGMENT);const t={u_polygonOffset:function(){return kt.ZERO}};e.uniformMap=ni(t,e.uniformMap),e.hasSkipLevelOfDetail=!0}const i=e.renderStateOptions;i.stencilTest=sy.setCesium3DTileBit(),i.stencilMask=sy.CESIUM_3D_TILE_MASK}},HM=VM,GM={name:"AtmospherePipelineStage",process:function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_ATMOSPHERE",void 0,su.BOTH),i.addDefine("COMPUTE_POSITION_WC_ATMOSPHERE",void 0,su.BOTH),i.addVarying("vec3","v_atmosphereRayleighColor"),i.addVarying("vec3","v_atmosphereMieColor"),i.addVarying("float","v_atmosphereOpacity"),i.addVertexLines(["void atmosphereStage(ProcessedAttributes attributes) {\n vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_positionWC, czm_atmosphereDynamicLighting);\n\n czm_computeGroundAtmosphereScattering(\n // This assumes the geometry stage came before this.\n v_positionWC,\n lightDirection,\n v_atmosphereRayleighColor,\n v_atmosphereMieColor,\n v_atmosphereOpacity\n );\n}\n"]),i.addFragmentLines(["// robust iterative solution without trig functions\n// https://github.com/0xfaded/ellipse_demo/issues/1\n// https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse\n//\n// This version uses only a single iteration for best performance. For fog\n// rendering, the difference is negligible.\nvec2 nearestPointOnEllipseFast(vec2 pos, vec2 radii) {\n vec2 p = abs(pos);\n vec2 inverseRadii = 1.0 / radii;\n vec2 evoluteScale = (radii.x * radii.x - radii.y * radii.y) * vec2(1.0, -1.0) * inverseRadii;\n\n // We describe the ellipse parametrically: v = radii * vec2(cos(t), sin(t))\n // but store the cos and sin of t in a vec2 for efficiency.\n // Initial guess: t = cos(pi/4)\n vec2 tTrigs = vec2(0.70710678118);\n vec2 v = radii * tTrigs;\n\n // Find the evolute of the ellipse (center of curvature) at v.\n vec2 evolute = evoluteScale * tTrigs * tTrigs * tTrigs;\n // Find the (approximate) intersection of p - evolute with the ellipsoid.\n vec2 q = normalize(p - evolute) * length(v - evolute);\n // Update the estimate of t.\n tTrigs = (q + evolute) * inverseRadii;\n tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));\n v = radii * tTrigs;\n\n return v * sign(pos);\n}\n\nvec3 computeEllipsoidPositionWC(vec3 positionMC) {\n // Get the world-space position and project onto a meridian plane of\n // the ellipsoid\n vec3 positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;\n\n vec2 positionEllipse = vec2(length(positionWC.xy), positionWC.z);\n vec2 nearestPoint = nearestPointOnEllipseFast(positionEllipse, czm_ellipsoidRadii.xz);\n\n // Reconstruct a 3D point in world space\n return vec3(nearestPoint.x * normalize(positionWC.xy), nearestPoint.y);\n}\n\nvoid applyFog(inout vec4 color, vec4 groundAtmosphereColor, vec3 lightDirection, float distanceToCamera) {\n\n vec3 fogColor = groundAtmosphereColor.rgb;\n\n // If there is dynamic lighting, apply that to the fog.\n const float NONE = 0.0;\n if (czm_atmosphereDynamicLighting != NONE) {\n float darken = clamp(dot(normalize(czm_viewerPositionWC), lightDirection), czm_fogMinimumBrightness, 1.0);\n fogColor *= darken;\n }\n\n // Tonemap if HDR rendering is disabled\n #ifndef HDR\n fogColor.rgb = czm_acesTonemapping(fogColor.rgb);\n fogColor.rgb = czm_inverseGamma(fogColor.rgb);\n #endif\n\n // Matches the constant in GlobeFS.glsl. This makes the fog falloff\n // more gradual.\n const float fogModifier = 0.15;\n vec3 withFog = czm_fog(distanceToCamera, color.rgb, fogColor, fogModifier);\n color = vec4(withFog, color.a);\n}\n\nvoid atmosphereStage(inout vec4 color, in ProcessedAttributes attributes) {\n vec3 rayleighColor;\n vec3 mieColor;\n float opacity;\n\n vec3 positionWC;\n vec3 lightDirection;\n\n // When the camera is in space, compute the position per-fragment for\n // more accurate ground atmosphere. All other cases will use\n //\n // The if condition will be added in https://github.com/CesiumGS/cesium/issues/11717\n if (false) {\n positionWC = computeEllipsoidPositionWC(attributes.positionMC);\n lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);\n\n // The fog color is derived from the ground atmosphere color\n czm_computeGroundAtmosphereScattering(\n positionWC,\n lightDirection,\n rayleighColor,\n mieColor,\n opacity\n );\n } else {\n positionWC = attributes.positionWC;\n lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);\n rayleighColor = v_atmosphereRayleighColor;\n mieColor = v_atmosphereMieColor;\n opacity = v_atmosphereOpacity;\n }\n\n //color correct rayleigh and mie colors\n const bool ignoreBlackPixels = true;\n rayleighColor = czm_applyHSBShift(rayleighColor, czm_atmosphereHsbShift, ignoreBlackPixels);\n mieColor = czm_applyHSBShift(mieColor, czm_atmosphereHsbShift, ignoreBlackPixels);\n\n vec4 groundAtmosphereColor = czm_computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);\n\n if (u_isInFog) {\n float distanceToCamera = length(attributes.positionEC);\n applyFog(color, groundAtmosphereColor, lightDirection, distanceToCamera);\n } else {\n // Ground atmosphere\n }\n}\n"]),i.addUniform("bool","u_isInFog",su.FRAGMENT),e.uniformMap.u_isInFog=function(){const e=H.distance(n.camera.positionWC,t.boundingSphere.center);return V.fog(e,n.fog.density)>V.EPSILON3}}},jM=GM,WM={name:"ImageBasedLightingPipelineStage",process:function(e,t,n){const i=t.imageBasedLighting,o=e.shaderBuilder;if(o.addDefine("USE_IBL_LIGHTING",void 0,su.FRAGMENT),o.addUniform("vec2","model_iblFactor",su.FRAGMENT),XT.isSupported(n.context)){(i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",su.FRAGMENT),D(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,su.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,su.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",su.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,su.FRAGMENT),D(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,su.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,su.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",su.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",su.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",su.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,su.FRAGMENT)}D(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,su.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",su.FRAGMENT)),o.addFragmentLines("vec3 proceduralIBL(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n vec3 lightColorHdr,\n czm_pbrParameters pbrParameters\n) {\n vec3 v = -positionEC;\n vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));\n vec3 vWC = -normalize(positionWC);\n vec3 l = normalize(lightDirectionEC);\n vec3 n = normalEC;\n vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n\n float NdotL = clamp(dot(n, l), 0.001, 1.0);\n float NdotV = abs(dot(n, v)) + 0.001;\n\n // Figure out if the reflection vector hits the ellipsoid\n float vertexRadius = length(positionWC);\n float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n float reflectionDotNadir = dot(r, normalize(positionWC));\n // Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z.\n r.x = -r.x;\n r = -normalize(czm_temeToPseudoFixed * r);\n r.x = -r.x;\n\n vec3 diffuseColor = pbrParameters.diffuseColor;\n float roughness = pbrParameters.roughness;\n vec3 specularColor = pbrParameters.f0;\n\n float inverseRoughness = 1.04 - roughness;\n inverseRoughness *= inverseRoughness;\n vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n\n float atmosphereHeight = 0.05;\n float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n float blendRegionOffset = roughness * -1.0;\n float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n vec3 nadirColor = belowHorizonColor * 0.5;\n vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9); \n float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight; \n float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n\n // Luminance model from page 40 of http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\n #ifdef USE_SUN_LUMINANCE \n // Angle between sun and zenith\n float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);\n float S = acos(LdotZenith);\n // Angle between zenith and current pixel\n float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);\n // Angle between sun and current pixel\n float gamma = acos(NdotL);\n float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n float luminance = model_luminanceAtZenith * (numerator / denominator);\n #endif \n\n vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;\n vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);\n float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\n vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\n iblColor *= lightColor;\n\n #ifdef USE_SUN_LUMINANCE \n iblColor *= luminance;\n #endif\n\n return iblColor;\n}\n\n#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\nvec3 textureIBL(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n czm_pbrParameters pbrParameters\n) {\n vec3 diffuseColor = pbrParameters.diffuseColor;\n float roughness = pbrParameters.roughness;\n vec3 specularColor = pbrParameters.f0;\n\n vec3 v = -positionEC;\n vec3 n = normalEC;\n vec3 l = normalize(lightDirectionEC);\n vec3 h = normalize(v + l);\n\n float NdotV = abs(dot(n, v)) + 0.001;\n float VdotH = clamp(dot(v, h), 0.0, 1.0);\n\n const mat3 yUpToZUp = mat3(\n -1.0, 0.0, 0.0,\n 0.0, 0.0, -1.0, \n 0.0, 1.0, 0.0\n ); \n vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n))); \n\n #ifdef DIFFUSE_IBL \n #ifdef CUSTOM_SPHERICAL_HARMONICS\n vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients); \n #else\n vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n #endif \n #else \n vec3 diffuseIrradiance = vec3(0.0); \n #endif \n\n #ifdef SPECULAR_IBL\n vec3 r0 = specularColor.rgb;\n float reflectance = max(max(r0.r, r0.g), r0.b);\n vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n vec3 F = fresnelSchlick2(r0, r90, VdotH);\n \n vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;\n #ifdef CUSTOM_SPECULAR_IBL \n vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);\n #else \n vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n #endif \n specularIBL *= F * brdfLut.x + brdfLut.y;\n #else \n vec3 specularIBL = vec3(0.0); \n #endif\n\n return diffuseColor * diffuseIrradiance + specularColor * specularIBL;\n}\n#endif\n\nvec3 imageBasedLightingStage(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n vec3 lightColorHdr,\n czm_pbrParameters pbrParameters\n) {\n #if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\n // Environment maps were provided, use them for IBL\n return textureIBL(\n positionEC,\n normalEC,\n lightDirectionEC,\n pbrParameters\n );\n #else\n // Use the procedural IBL if there are no environment maps\n return proceduralIBL(\n positionEC,\n normalEC,\n lightDirectionEC,\n lightColorHdr,\n pbrParameters\n );\n #endif\n}");const r={model_iblFactor:function(){return i.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return i.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return i.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return i.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return i.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=ni(r,e.uniformMap)}},qM=WM,YM=V.EPSILON16;function XM(e){const t=(e=M(e,M.EMPTY_OBJECT)).stage,n=e.runtimeArticulation;L.typeOf.object("options.stage",t),L.typeOf.object("options.runtimeArticulation",n),this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties(XM.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){L.typeOf.number("value",e),e=V.clamp(e,this.minimumValue,this.maximumValue),V.equalsEpsilon(this._currentValue,e,YM)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});const QM=new H,$M=new re;function KM(e){const t=(e=M(e,M.EMPTY_OBJECT)).articulation,n=e.sceneGraph;L.typeOf.object("options.articulation",t),L.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,function(e){const t=e.articulation,n=t.stages,i=n.length,o=e._runtimeStages,r=e._runtimeStagesByName;for(let s=0;s<i;s++){const t=n[s],i=new XM({stage:t,runtimeArticulation:e});o.push(i);r[t.name]=i}}(this)}XM.prototype.applyStageToMatrix=function(e){L.typeOf.object("result",e);const t=this.type,n=this.currentValue,i=QM;let o;switch(t){case CP.XROTATE:o=re.fromRotationX(V.toRadians(n),$M),e=ve.multiplyByMatrix3(e,o,e);break;case CP.YROTATE:o=re.fromRotationY(V.toRadians(n),$M),e=ve.multiplyByMatrix3(e,o,e);break;case CP.ZROTATE:o=re.fromRotationZ(V.toRadians(n),$M),e=ve.multiplyByMatrix3(e,o,e);break;case CP.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=ve.multiplyByTranslation(e,i,e);break;case CP.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=ve.multiplyByTranslation(e,i,e);break;case CP.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=ve.multiplyByTranslation(e,i,e);break;case CP.XSCALE:i.x=n,i.y=1,i.z=1,e=ve.multiplyByScale(e,i,e);break;case CP.YSCALE:i.x=1,i.y=n,i.z=1,e=ve.multiplyByScale(e,i,e);break;case CP.ZSCALE:i.x=1,i.y=1,i.z=n,e=ve.multiplyByScale(e,i,e);break;case CP.UNIFORMSCALE:e=ve.multiplyByUniformScale(e,n,e)}return e},Object.defineProperties(KM.prototype,{articulation:{get:function(){return this._articulation}},sceneGraph:{get:function(){return this._sceneGraph}},name:{get:function(){return this._name}},runtimeStages:{get:function(){return this._runtimeStages}},runtimeNodes:{get:function(){return this._runtimeNodes}}}),KM.prototype.setArticulationStage=function(e,t){const n=this._runtimeStagesByName[e];D(n)&&(n.currentValue=t)};const ZM=new ve,JM=new ve;KM.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e,t=ve.clone(ve.IDENTITY,ZM);const n=this._runtimeStages,i=n.length;for(e=0;e<i;e++){t=n[e].applyStageToMatrix(t)}const o=this._runtimeNodes,r=o.length;for(e=0;e<r;e++){const n=o[e],i=ve.multiplyTransformation(n.originalTransform,t,JM);n.transform=i}};const eF={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend",process:function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,su.FRAGMENT),i.addFragmentLines("void modelColorStage(inout czm_modelMaterial material)\n{\n material.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);\n float highlight = ceil(model_colorBlend);\n material.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);\n material.alpha *= model_color.a;\n}\n");const o={},r=t.color;0!==r.alpha||t.hasSilhouette(n)||(e.renderStateOptions.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),r.alpha<1&&(e.alphaOptions.pass=zt.TRANSLUCENT),i.addUniform("vec4",eF.COLOR_UNIFORM_NAME,su.FRAGMENT),o[eF.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",eF.COLOR_BLEND_UNIFORM_NAME,su.FRAGMENT),o[eF.COLOR_BLEND_UNIFORM_NAME]=function(){return SP.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=ni(o,e.uniformMap)}},tF=eF,nF={name:"ModelClippingPlanesPipelineStage"},iF=new kt;nF.process=function(e,t,n){const i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,su.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,su.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,su.FRAGMENT),qI.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,su.FRAGMENT);const s=qI.getTextureResolution(i,o,iF);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,su.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,su.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",su.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",su.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",su.FRAGMENT),r.addFragmentLines("#ifdef USE_CLIPPING_PLANES_FLOAT_TEXTURE\nvec4 getClippingPlane(\n highp sampler2D packedClippingPlanes,\n int clippingPlaneNumber,\n mat4 transform\n) {\n int pixY = clippingPlaneNumber / CLIPPING_PLANES_TEXTURE_WIDTH;\n int pixX = clippingPlaneNumber - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);\n float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel\n float v = (float(pixY) + 0.5) * pixelHeight;\n vec4 plane = texture(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n#else\n// Handle uint8 clipping texture instead\nvec4 getClippingPlane(\n highp sampler2D packedClippingPlanes,\n int clippingPlaneNumber,\n mat4 transform\n) {\n int clippingPlaneStartIndex = clippingPlaneNumber * 2; // clipping planes are two pixels each\n int pixY = clippingPlaneStartIndex / CLIPPING_PLANES_TEXTURE_WIDTH;\n int pixX = clippingPlaneStartIndex - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);\n float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel\n float v = (float(pixY) + 0.5) * pixelHeight;\n vec4 oct32 = texture(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(texture(packedClippingPlanes, vec2(u + pixelWidth, v)));\n return czm_transformPlane(plane, transform);\n}\n#endif\n\nfloat clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix) {\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float pixelWidth = czm_metersPerPixel(position);\n \n #ifdef UNION_CLIPPING_REGIONS\n float clipAmount; // For union planes, we want to get the min distance. So we set the initial value to the first plane distance in the loop below.\n #else\n float clipAmount = 0.0;\n bool clipped = true;\n #endif\n\n for (int i = 0; i < CLIPPING_PLANES_LENGTH; ++i) {\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 \n #ifdef UNION_CLIPPING_REGIONS\n clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));\n if (amount <= 0.0) {\n discard;\n }\n #else\n clipAmount = max(amount, clipAmount);\n clipped = clipped && (amount <= 0.0);\n #endif\n }\n\n #ifndef UNION_CLIPPING_REGIONS\n if (clipped) {\n discard;\n }\n #endif\n \n return clipAmount;\n}\n\nvoid modelClippingPlanesStage(inout vec4 color)\n{\n float clipDistance = clip(gl_FragCoord, model_clippingPlanes, model_clippingPlanesMatrix);\n vec4 clippingPlanesEdgeColor = vec4(1.0);\n clippingPlanesEdgeColor.rgb = model_clippingPlanesEdgeStyle.rgb;\n float clippingPlanesEdgeWidth = model_clippingPlanesEdgeStyle.a;\n \n if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) {\n color = clippingPlanesEdgeColor;\n }\n}\n");const a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){const e=Ot.clone(i.edgeColor);return e.alpha=i.edgeWidth,e},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=ni(a,e.uniformMap)};const oF=nF,rF={name:"ModelClippingPolygonsPipelineStage",process:function(e,t,n){const i=t.clippingPolygons,o=e.shaderBuilder;o.addDefine("ENABLE_CLIPPING_POLYGONS",void 0,su.BOTH),i.inverse&&o.addDefine("CLIPPING_INVERSE",void 0,su.FRAGMENT),o.addDefine("CLIPPING_POLYGON_REGIONS_LENGTH",i.extentsCount,su.BOTH),o.addUniform("sampler2D","model_clippingDistance",su.FRAGMENT),o.addUniform("sampler2D","model_clippingExtents",su.VERTEX),o.addVarying("vec2","v_clippingPosition"),o.addVarying("int","v_regionIndex","flat"),o.addVertexLines("void modelClippingPolygonsStage(ProcessedAttributes attributes)\n{\n vec2 sphericalLatLong = czm_approximateSphericalCoordinates(v_positionWC);\n sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\n\n vec2 minDistance = vec2(czm_infinity);\n v_regionIndex = -1;\n v_clippingPosition = vec2(czm_infinity);\n\n for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {\n vec4 extents = czm_unpackClippingExtents(model_clippingExtents, regionIndex);\n vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;\n\n vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));\n vec2 distance = abs(rectUv - clamped) * extents.wz;\n \n if (minDistance.x > distance.x || minDistance.y > distance.y) {\n minDistance = distance;\n v_clippingPosition = rectUv;\n }\n\n float threshold = 0.01;\n if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {\n v_regionIndex = regionIndex;\n }\n }\n}\n"),o.addFragmentLines("void modelClippingPolygonsStage()\n{\n vec2 clippingPosition = v_clippingPosition;\n int regionIndex = v_regionIndex;\n czm_clipPolygons(model_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);\n}\n");const r={model_clippingDistance:function(){return i.clippingTexture},model_clippingExtents:function(){return i.extentsTexture}};e.uniformMap=ni(r,e.uniformMap)}},sF=rF;function aF(e,t){L.typeOf.object("model",e),L.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(aF.prototype,{name:{get:function(){return this._runtimeNode._name}},id:{get:function(){return this._runtimeNode._id}},show:{get:function(){return this._runtimeNode.show},set:function(e){this._runtimeNode.show=e}},matrix:{get:function(){return this._runtimeNode.transform},set:function(e){D(e)?(this._runtimeNode.transform=e,this._runtimeNode.userAnimated=!0,this._model._userAnimationDirty=!0):(this._runtimeNode.transform=this.originalMatrix,this._runtimeNode.userAnimated=!1)}},originalMatrix:{get:function(){return this._runtimeNode.originalTransform}}});const cF=new ve,lF=new ve,uF=new ve,dF={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:xF,_transformsToTypedArray:EF};dF.process=function(e,t,n){const i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines("mat4 getInstancingTransform()\n{\n mat4 instancingTransform;\n\n #ifdef HAS_INSTANCE_MATRICES\n instancingTransform = mat4(\n a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0, // Column 1\n a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0, // Column 2\n a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0, // Column 3\n a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0 // Column 4\n );\n #else\n vec3 translation = vec3(0.0, 0.0, 0.0);\n vec3 scale = vec3(1.0, 1.0, 1.0);\n \n #ifdef HAS_INSTANCE_TRANSLATION\n translation = a_instanceTranslation;\n #endif\n #ifdef HAS_INSTANCE_SCALE\n scale = a_instanceScale;\n #endif\n\n instancingTransform = mat4(\n scale.x, 0.0, 0.0, 0.0,\n 0.0, scale.y, 0.0, 0.0,\n 0.0, 0.0, scale.z, 0.0,\n translation.x, translation.y, translation.z, 1.0\n ); \n #endif\n\n return instancingTransform;\n}\n\n#ifdef USE_2D_INSTANCING\nmat4 getInstancingTransform2D()\n{\n mat4 instancingTransform2D;\n\n #ifdef HAS_INSTANCE_MATRICES\n instancingTransform2D = mat4(\n a_instancingTransform2DRow0.x, a_instancingTransform2DRow1.x, a_instancingTransform2DRow2.x, 0.0, // Column 1\n a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0, // Column 2\n a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0, // Column 3\n a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0 // Column 4\n );\n #else\n vec3 translation2D = vec3(0.0, 0.0, 0.0);\n vec3 scale = vec3(1.0, 1.0, 1.0);\n \n #ifdef HAS_INSTANCE_TRANSLATION\n translation2D = a_instanceTranslation2D;\n #endif\n #ifdef HAS_INSTANCE_SCALE\n scale = a_instanceScale;\n #endif\n\n instancingTransform2D = mat4(\n scale.x, 0.0, 0.0, 0.0,\n 0.0, scale.y, 0.0, 0.0,\n 0.0, 0.0, scale.z, 0.0,\n translation2D.x, translation2D.y, translation2D.z, 1.0\n ); \n #endif\n\n return instancingTransform2D;\n}\n#endif\n");const s=e.model,a=s.sceneGraph,c=e.runtimeNode,l=n.mode!==gl.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,u=s._enablePick&&!n.context.webgl2,d=[];!function(e,t,n,i,o,r){const s=xC.getAttributeBySemantic(n,ZP.ROTATION);D(s)?function(e,t,n,i,o,r){const s=e.shaderBuilder,a=t.attributes[0].count,c=e.model,l=e.runtimeNode;s.addDefine("HAS_INSTANCE_MATRICES");const u="Transform";let d,h=l.instancingTransformsBuffer;if(!D(h)){d=xF(t,a,e);const n=EF(d);h=SF(n,i),c._modelResources.push(h),r&&(l.transformsTypedArray=n),l.instancingTransformsBuffer=h}if(CF(e,h,n,u),!o)return;const p=ti(i);p.mode=gl.COLUMBUS_VIEW,wF(e,p);let f=l.instancingTransformsBuffer2D;if(!D(f)){const t=function(e,t,n,i){const o=gF,r=yF;_F(t,o,r);const s=t.runtimeNode,a=s.instancingReferencePoint2D,c=e.length;for(let l=0;l<c;l++){const t=fF(e[l],o,r,n,bF),s=ve.getTranslation(t,vF),c=H.subtract(s,a,s);i[l]=ve.setTranslation(t,c,i[l])}return i}(d,e,p,d);f=SF(EF(t),i),c._modelResources.push(f),l.instancingTransformsBuffer2D=f}CF(e,f,n,"Transform2D")}(e,n,i,t,o,r):function(e,t,n,i,o,r){const s=e.shaderBuilder,a=e.runtimeNode,c=xC.getAttributeBySemantic(t,ZP.TRANSLATION),l=xC.getAttributeBySemantic(t,ZP.SCALE);if(D(l)){s.addDefine("HAS_INSTANCE_SCALE");const t="Scale";IF(e,l.buffer,l.byteOffset,l.byteStride,n,t)}if(!D(c))return;let u;D(c.typedArray)?u=function(e,t,n){const i=new Array(t),o=e.typedArray,r=new H(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new H(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let c=0;c<t;c++){const e=new H(o[3*c],o[3*c+1],o[3*c+2]);i[c]=e,H.minimumByComponent(r,e,r),H.maximumByComponent(s,e,s)}const a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}(c,c.count,e):D(a.instancingTranslationMin)||(a.instancingTranslationMin=c.min,a.instancingTranslationMax=c.max);s.addDefine("HAS_INSTANCE_TRANSLATION");const d="Translation";if(IF(e,c.buffer,c.byteOffset,c.byteStride,n,d),!o&&!r)return;const h=ti(i);h.mode=gl.COLUMBUS_VIEW,wF(e,h);let p=a.instancingTranslationBuffer2D;if(!D(p)){const t=function(e,t,n,i){const o=gF,r=yF;_F(t,o,r);const s=t.runtimeNode,a=s.instancingReferencePoint2D,c=e.length;for(let l=0;l<c;l++){const t=e[l],s=mF(t,o,r,n,t);i[l]=H.subtract(s,a,i[l])}return i}(u,e,h,u),n=function(e){const t=3,n=e.length,i=new Float32Array(n*t);for(let o=0;o<n;o++){const n=e[o],r=t*o;i[r+0]=n[0],i[r+1]=n[4],i[r+2]=n[8]}return i}(t);r&&(a.transformsTypedArray=n),p=SF(n,i),e.model._modelResources.push(p),a.instancingTranslationBuffer2D=p}if(!o)return;IF(e,p,0,void 0,n,"Translation2D")}(e,n,i,t,o)}(e,n,i,d,l,u),function(e,t,n,i){const o=n.attributes,r=e.shaderBuilder;for(let s=0;s<o.length;s++){const t=o[s];t.semantic===ZP.FEATURE_ID&&(t.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=t.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:t.buffer,componentsPerAttribute:Zf.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,normalize:!1,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${t.setIndex}`))}}(e,0,i,d);const h={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,su.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",su.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",su.VERTEX),h.u_instance_modifiedModelView=function(){let e=ve.multiplyTransformation(s.modelMatrix,a.components.transform,cF);return l?ve.multiplyTransformation(n.context.uniformState.view3D,e,cF):(n.mode!==gl.SCENE3D&&(e=Cr.basisTo2D(n.mapProjection,e,cF)),ve.multiplyTransformation(n.context.uniformState.view,e,cF))},h.u_instance_nodeTransform=function(){return ve.multiplyTransformation(a.axisCorrectionMatrix,c.computedTransform,lF)},r.addVertexLines("void legacyInstancingStage(\n inout ProcessedAttributes attributes,\n out mat4 instanceModelView,\n out mat3 instanceModelViewInverseTranspose)\n{\n vec3 positionMC = attributes.positionMC;\n\n mat4 instancingTransform = getInstancingTransform();\n \n mat4 instanceModel = instancingTransform * u_instance_nodeTransform;\n instanceModelView = u_instance_modifiedModelView;\n instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);\n\n attributes.positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;\n \n #ifdef USE_2D_INSTANCING\n mat4 instancingTransform2D = getInstancingTransform2D();\n attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;\n #endif\n}\n")):r.addVertexLines("void instancingStage(inout ProcessedAttributes attributes) \n{\n vec3 positionMC = attributes.positionMC;\n \n mat4 instancingTransform = getInstancingTransform();\n \n attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;\n\n #ifdef HAS_NORMALS\n vec3 normalMC = attributes.normalMC;\n attributes.normalMC = (instancingTransform * vec4(normalMC, 0.0)).xyz;\n #endif\n\n #ifdef USE_2D_INSTANCING\n mat4 instancingTransform2D = getInstancingTransform2D();\n attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;\n #endif\n}\n"),l){r.addDefine("USE_2D_INSTANCING",void 0,su.VERTEX),r.addUniform("mat4","u_modelView2D",su.VERTEX);const e=n.context,t=ve.fromTranslation(c.instancingReferencePoint2D,new ve);h.u_modelView2D=function(){return ve.multiplyTransformation(e.uniformState.view,t,uF)}}e.uniformMap=ni(h,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,d)};const hF=new ve,pF=new H;function fF(e,t,n,i,o){let r=ve.multiplyTransformation(t,e,hF);return r=ve.multiplyTransformation(r,n,hF),o=Cr.basisTo2D(i.mapProjection,r,o)}function mF(e,t,n,i,o){const r=ve.fromTranslation(e,hF);let s=ve.multiplyTransformation(t,r,hF);s=ve.multiplyTransformation(s,n,hF);const a=ve.getTranslation(s,pF);return o=QR.computeActualWgs84Position(i,a,o)}function _F(e,t,n){const i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=ve.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=ve.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=ve.clone(o.computedModelMatrix,t),t=ve.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=ve.clone(ve.IDENTITY,n))}const gF=new ve,yF=new ve,bF=new ve,vF=new H;const AF=new H,TF=new H;function wF(e,t){const n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=ve.multiplyByPoint(i,n.instancingTranslationMin,AF),r=QR.computeActualWgs84Position(t,o,o),s=ve.multiplyByPoint(i,n.instancingTranslationMax,TF),a=QR.computeActualWgs84Position(t,s,s);n.instancingReferencePoint2D=H.lerp(r,a,.5,new H)}function EF(e){const t=e.length,n=new Float32Array(12*t);for(let i=0;i<t;i++){const t=e[i],o=12*i;n[o+0]=t[0],n[o+1]=t[4],n[o+2]=t[8],n[o+3]=t[12],n[o+4]=t[1],n[o+5]=t[5],n[o+6]=t[9],n[o+7]=t[13],n[o+8]=t[2],n[o+9]=t[6],n[o+10]=t[10],n[o+11]=t[14]}return n}function xF(e,t,n){const i=new Array(t),o=xC.getAttributeBySemantic(e,ZP.TRANSLATION),r=xC.getAttributeBySemantic(e,ZP.ROTATION),s=xC.getAttributeBySemantic(e,ZP.SCALE),a=new H(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new H(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),l=D(o),u=D(r),d=D(s),h=l?o.typedArray:new Float32Array(3*t);let p,f=u?r.typedArray:new Float32Array(4*t);u&&r.normalized&&(f=sm.dequantize(f,r.componentDatatype,r.type,t)),d?p=s.typedArray:(p=new Float32Array(3*t),p.fill(1));for(let _=0;_<t;_++){const e=new H(h[3*_],h[3*_+1],h[3*_+2]);H.maximumByComponent(a,e,a),H.minimumByComponent(c,e,c);const t=new _o(f[4*_],f[4*_+1],f[4*_+2],u?f[4*_+3]:1),n=new H(p[3*_],p[3*_+1],p[3*_+2]),o=ve.fromTranslationQuaternionRotationScale(e,t,n,new ve);i[_]=o}const m=n.runtimeNode;return m.instancingTranslationMin=c,m.instancingTranslationMax=a,l&&(o.typedArray=void 0),u&&(r.typedArray=void 0),d&&(s.typedArray=void 0),i}function SF(e,t){const n=Ye.createVertexBuffer({context:t.context,typedArray:e,usage:qe.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function CF(e,t,n,i){const o=Ca.getSizeInBytes(Ca.FLOAT),r=12*o,s=[{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:r,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,normalize:!1,offsetInBytes:4*o,strideInBytes:r,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,normalize:!1,offsetInBytes:8*o,strideInBytes:r,instanceDivisor:1}],a=e.shaderBuilder;a.addAttribute("vec4",`a_instancing${i}Row0`),a.addAttribute("vec4",`a_instancing${i}Row1`),a.addAttribute("vec4",`a_instancing${i}Row2`),n.push.apply(n,s)}function IF(e,t,n,i,o,r){o.push({index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,normalize:!1,offsetInBytes:n,strideInBytes:i,instanceDivisor:1});e.shaderBuilder.addAttribute("vec3",`a_instance${r}`)}new H,new _o,new H;const OF=dF,DF={};function PF(e,t,n,i){let o;i=ve.multiplyTransformation(i,e.transform,new ve),e.updateComputedTransform();const r=e.runtimePrimitives.length;for(o=0;o<r;o++){const t=e.runtimePrimitives[o].drawCommand;t.modelMatrix=ve.multiplyTransformation(n,i,t.modelMatrix),t.cullFace=xC.getCullFace(t.modelMatrix,t.primitiveType)}const s=e.children.length;for(o=0;o<s;o++){const r=t._runtimeNodes[e.children[o]];r._transformToRoot=ve.clone(i,r._transformToRoot),PF(r,t,n,i),r._transformDirty=!1}}DF.name="ModelMatrixUpdateStage",DF.update=function(e,t,n){const i=n.mode!==gl.SCENE3D;if((!i||!t._model._projectTo2D)&&e._transformDirty){PF(e,t,i?t._computedModelMatrix2D:t._computedModelMatrix,e.transformToRoot),e._transformDirty=!1}};const NF=DF,RF={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:LF,_countGeneratedBuffers:MF};function LF(e,t){if(!D(t))return;const n=t.attributes,i=n.length;for(let o=0;o<i;o++){const t=n[o];if(D(t.buffer)){const n=!1;e.addBuffer(t.buffer,n)}}}function MF(e,t){if(D(t.instancingTransformsBuffer)){const n=!1;e.addBuffer(t.instancingTransformsBuffer,n)}if(D(t.instancingTransformsBuffer2D)){const n=!1;e.addBuffer(t.instancingTransformsBuffer2D,n)}if(D(t.instancingTranslationBuffer2D)){const n=!1;e.addBuffer(t.instancingTranslationBuffer2D,n)}}RF.process=function(e,t,n){const i=e.model.statistics,o=t.instances,r=e.runtimeNode;LF(i,o),MF(i,r)};const FF=RF;function BF(e){const t=(e=M(e,M.EMPTY_OBJECT)).node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;L.typeOf.object("options.node",t),L.typeOf.object("options.transform",n),L.typeOf.object("options.transformToRoot",i),L.typeOf.object("options.sceneGraph",o),L.typeOf.object("options.children",r),this._node=t,this._name=t.name,this._id=t.index,this._sceneGraph=o,this._children=r,this._originalTransform=ve.clone(n,this._originalTransform),this._transform=ve.clone(n,this._transform),this._transformToRoot=ve.clone(i,this._transformToRoot),this._computedTransform=new ve,this._transformDirty=!1,this._transformParameters=void 0,this._morphWeights=[],this._runtimeSkin=void 0,this._computedJointMatrices=[],this.show=!0,this.userAnimated=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.instancingTranslationMin=void 0,this.instancingTranslationMax=void 0,this.instancingTransformsBuffer=void 0,this.instancingTransformsBuffer2D=void 0,this.instancingTranslationBuffer2D=void 0,this.instancingReferencePoint2D=void 0,function(e){const t=e.transform,n=e.transformToRoot,i=e._computedTransform;e._computedTransform=ve.multiply(n,t,i);const o=e.node;D(o.matrix)||(e._transformParameters=new Qv(o.translation,o.rotation,o.scale));D(o.morphWeights)&&(e._morphWeights=o.morphWeights.slice());const r=o.articulationName;if(D(r)){const t=e.sceneGraph._runtimeArticulations[r];D(t)&&t.runtimeNodes.push(e)}}(this)}function zF(e,t){e._transformDirty=!0,e._transform=ve.fromTranslationRotationScale(t,e._transform)}Object.defineProperties(BF.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){this._transformDirty=!0,this._transform=ve.clone(e,this._transform)}},transformToRoot:{get:function(){return this._transformToRoot}},computedTransform:{get:function(){return this._computedTransform}},originalTransform:{get:function(){return this._originalTransform}},translation:{get:function(){return D(this._transformParameters)?this._transformParameters.translation:void 0},set:function(e){const t=this._transformParameters;if(!D(t))throw new P("The translation of a node cannot be set if it was defined using a matrix in the model.");const n=t.translation;H.equals(n,e)||(t.translation=H.clone(e,t.translation),zF(this,t))}},rotation:{get:function(){return D(this._transformParameters)?this._transformParameters.rotation:void 0},set:function(e){const t=this._transformParameters;if(!D(t))throw new P("The rotation of a node cannot be set if it was defined using a matrix in the model.");const n=t.rotation;_o.equals(n,e)||(t.rotation=_o.clone(e,t.rotation),zF(this,t))}},scale:{get:function(){return D(this._transformParameters)?this._transformParameters.scale:void 0},set:function(e){const t=this._transformParameters;if(!D(t))throw new P("The scale of a node cannot be set if it was defined using a matrix in the model.");const n=t.scale;H.equals(n,e)||(t.scale=H.clone(e,t.scale),zF(this,t))}},morphWeights:{get:function(){return this._morphWeights},set:function(e){const t=e.length;if(this._morphWeights.length!==t)throw new P("value must have the same length as the original weights array.");for(let n=0;n<t;n++)this._morphWeights[n]=e[n]}},runtimeSkin:{get:function(){return this._runtimeSkin}},computedJointMatrices:{get:function(){return this._computedJointMatrices}}}),BF.prototype.getChild=function(e){if(L.typeOf.number("index",e),e<0||e>=this.children.length)throw new P("index must be greater than or equal to 0 and less than the number of children.");return this.sceneGraph._runtimeNodes[this.children[e]]},BF.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const n=this.updateStages;n.length=0,D(e.instances)&&t.push(OF),t.push(FF),n.push(NF)},BF.prototype.updateComputedTransform=function(){this._computedTransform=ve.multiply(this._transformToRoot,this._transform,this._computedTransform)},BF.prototype.updateJointMatrices=function(){const e=this._runtimeSkin;if(!D(e))return;e.updateJointMatrices();const t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o<i;o++){D(t[o])||(t[o]=new ve);const e=ve.multiplyTransformation(this.transformToRoot,this.transform,t[o]),i=ve.inverseTransformation(e,t[o]);t[o]=ve.multiplyTransformation(i,n[o],t[o])}};const UF={name:"AlphaPipelineStage",process:function(e,t,n){const i=e.alphaOptions,o=e.model;i.pass=M(i.pass,o.opaquePass);const r=e.renderStateOptions;i.pass===zt.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=dh.ALPHA_BLEND);const s=e.shaderBuilder,a=e.uniformMap;D(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,su.FRAGMENT),s.addUniform("float","u_alphaCutoff",su.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})}},kF=UF,VF={name:"BatchTexturePipelineStage",process:function(e,t,n){const i=e.shaderBuilder,o={},r=e.model,s=r.featureTables[r.featureTableId],a=s.featuresLength;i.addUniform("int","model_featuresLength"),o.model_featuresLength=function(){return a};const c=s.batchTexture;i.addUniform("sampler2D","model_batchTexture"),o.model_batchTexture=function(){return M(c.batchTexture,c.defaultTexture)},i.addUniform("vec4","model_textureStep"),o.model_textureStep=function(){return c.textureStep},c.textureDimensions.y>1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),o.model_textureDimensions=function(){return c.textureDimensions}),e.uniformMap=ni(o,e.uniformMap)}},HF=VF,GF={name:"ClassificationPipelineStage"};GF.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,su.BOTH);const i=e.runtimePrimitive;D(i.batchLengths)||function(e,t){const n=xC.getAttributeBySemantic(e,EC.POSITION);if(!D(n))throw new be("Primitives must have a position attribute to be used for classification.");let i;const o=e.indices,r=D(o);r&&(i=o.typedArray,o.typedArray=void 0);const s=r?o.count:n.count,a=xC.getAttributeBySemantic(e,EC.FEATURE_ID,0);if(!D(a))return t.batchLengths=[s],void(t.batchOffsets=[0]);const c=a.typedArray;a.typedArray=void 0;const l=[],u=[0],d=r?i[0]:0;let h=c[d],p=0;for(let m=1;m<s;m++){const e=c[r?i[m]:m];if(e!==h){const t=m-p,n=m;l.push(t),u.push(n),p=n,h=e}}const f=s-p;l.push(f),t.batchLengths=l,t.batchOffsets=u}(t,i)};const jF=GF,WF={name:"CPUStylingPipelineStage",process:function(e,t,n){const i=e.model,o=e.shaderBuilder;o.addVertexLines("void filterByPassType(inout vec3 positionMC, vec4 featureColor)\n{\n bool styleTranslucent = (featureColor.a != 1.0);\n // Only render translucent features in the translucent pass (if the style or the original command has translucency).\n if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n {\n // If the model has a translucent silhouette, it needs to render during the silhouette color command,\n // (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.\n #ifdef HAS_SILHOUETTE\n positionMC *= float(model_silhouettePass);\n #else\n positionMC *= 0.0;\n #endif\n }\n // If the current pass is not the translucent pass and the style is not translucent, don't render the feature.\n else if (czm_pass != czm_passTranslucent && styleTranslucent)\n {\n positionMC *= 0.0;\n }\n}\n\nvoid cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)\n{\n float show = ceil(feature.color.a);\n positionMC *= show;\n\n #if defined(HAS_SELECTED_FEATURE_ID_ATTRIBUTE) && !defined(HAS_CLASSIFICATION)\n filterByPassType(positionMC, feature.color);\n #endif\n}\n"),o.addFragmentLines("void filterByPassType(vec4 featureColor)\n{\n bool styleTranslucent = (featureColor.a != 1.0);\n // Only render translucent features in the translucent pass (if the style or the original command has translucency).\n if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n { \n // If the model has a translucent silhouette, it needs to render during the silhouette color command,\n // (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.\n #ifdef HAS_SILHOUETTE\n if(!model_silhouettePass) {\n discard;\n }\n #else\n discard;\n #endif\n }\n // If the current pass is not the translucent pass and the style is not translucent, don't render the feature.\n else if (czm_pass != czm_passTranslucent && styleTranslucent)\n {\n discard;\n }\n}\n\nvoid cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)\n{\n vec4 featureColor = feature.color;\n if (featureColor.a == 0.0)\n {\n discard;\n }\n\n // If a feature ID vertex attribute is used, the pass type filter is applied in the vertex shader.\n // So, we only apply in in the fragment shader if the feature ID texture is used.\n #if defined(HAS_SELECTED_FEATURE_ID_TEXTURE) && !defined(HAS_CLASSIFICATION)\n filterByPassType(featureColor);\n #endif\n\n featureColor = czm_gammaCorrect(featureColor);\n\n // Classification models compute the diffuse differently.\n #ifdef HAS_CLASSIFICATION\n material.diffuse = featureColor.rgb * featureColor.a;\n #else\n float highlight = ceil(model_colorBlend);\n material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);\n #endif\n \n material.alpha *= featureColor.a;\n}\n"),o.addDefine("USE_CPU_STYLING",void 0,su.BOTH),D(i.color)||(o.addUniform("float",tF.COLOR_BLEND_UNIFORM_NAME,su.FRAGMENT),e.uniformMap[tF.COLOR_BLEND_UNIFORM_NAME]=function(){return SP.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",su.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===zt.TRANSLUCENT}}},qF=WF,YF={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL",getDefineName:function(e){return`CUSTOM_SHADER_${e}`}},XF=Object.freeze(YF),QF="void customShaderStage(\n inout czm_modelVertexOutput vsOutput, \n inout ProcessedAttributes attributes, \n FeatureIds featureIds,\n Metadata metadata,\n MetadataClass metadataClass,\n MetadataStatistics metadataStatistics\n) {\n // VertexInput and initializeInputStruct() are dynamically generated in JS, \n // see CustomShaderPipelineStage.js\n VertexInput vsInput;\n initializeInputStruct(vsInput, attributes);\n vsInput.featureIds = featureIds;\n vsInput.metadata = metadata;\n vsInput.metadataClass = metadataClass;\n vsInput.metadataStatistics = metadataStatistics;\n vertexMain(vsInput, vsOutput);\n attributes.positionMC = vsOutput.positionMC;\n}\n",$F="void customShaderStage(\n inout czm_modelMaterial material,\n ProcessedAttributes attributes,\n FeatureIds featureIds,\n Metadata metadata,\n MetadataClass metadataClass,\n MetadataStatistics metadataStatistics\n) {\n // FragmentInput and initializeInputStruct() are dynamically generated in JS, \n // see CustomShaderPipelineStage.js\n FragmentInput fsInput;\n initializeInputStruct(fsInput, attributes);\n fsInput.featureIds = featureIds;\n fsInput.metadata = metadata;\n fsInput.metadataClass = metadataClass;\n fsInput.metadataStatistics = metadataStatistics;\n fragmentMain(fsInput, material);\n}\n",KF={name:"FeatureIdPipelineStage",STRUCT_ID_FEATURE_IDS_VS:"FeatureIdsVS",STRUCT_ID_FEATURE_IDS_FS:"FeatureIdsFS",STRUCT_NAME_FEATURE_IDS:"FeatureIds",FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS:"initializeFeatureIdsVS",FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS:"initializeFeatureIdsFS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS:"initializeFeatureIdAliasesVS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS:"initializeFeatureIdAliasesFS",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS:"void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES:"void initializeFeatureIdAliases(inout FeatureIds featureIds)",FUNCTION_ID_SET_FEATURE_ID_VARYINGS:"setFeatureIdVaryings",FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS:"void setFeatureIdVaryings()"};function ZF(e,t,n){const i=e.shaderBuilder;i.addStructField(KF.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(KF.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,c=`featureIds.${n} = int(czm_round(${s}));`,l=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[l]),i.addVarying("float",a),i.addFunctionLines(KF.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function JF(e,t,n){const i=e.shaderBuilder;i.addStructField(KF.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(KF.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=[`featureIds.${n} = int(czm_round(attributes.${r}${o}));`];i.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function eB(e,t,n,i,o,r){!function(e,t,n,i,o){const r=e.model;let s,a;if(D(t.repeat)){const e=function(e,t){const n=e.offset,i=e.repeat,o=new Float32Array(t);for(let r=0;r<t;r++)o[r]=n+Math.floor(r/i);return o}(t,n);s=Ye.createVertexBuffer({context:o.context,typedArray:e,usage:qe.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s);const i=!1;r.statistics.addBuffer(s,i)}else a=[t.offset];const c={index:e.attributeIndex++,instanceDivisor:i,value:a,vertexBuffer:s,normalize:!1,componentsPerAttribute:1,componentDatatype:Ca.FLOAT,strideInBytes:Ca.getSizeInBytes(Ca.FLOAT),offsetInBytes:0};e.attributes.push(c)}(e,t,i,o,r);const s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);const c=`v_implicit_${n}`;s.addVarying("float",c),s.addStructField(KF.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(KF.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(KF.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function tB(e,t,n,i,o){const r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return M(a.texture,o.context.defaultTexture)};const c=a.channels,l=e.shaderBuilder;l.addStructField(KF.STRUCT_ID_FEATURE_IDS_FS,"int",n),l.addUniform("sampler2D",r,su.FRAGMENT);const u=`v_texCoord_${a.texCoord}`;let d=u;const h=a.transform;if(D(h)&&!re.equals(h,re.IDENTITY)){const e=`${r}Transform`;l.addUniform("mat3",e,su.FRAGMENT),s[e]=function(){return h},d=`vec2(${e} * vec3(${u}, 1.0))`}const p=`featureIds.${n} = czm_unpackUint(${`texture(${r}, ${d}).${c}`});`;l.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[p])}function nB(e,t,n,i){const o=e.shaderBuilder,r=su.includesVertexShader(i);r&&o.addStructField(KF.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(KF.STRUCT_ID_FEATURE_IDS_FS,"int",n);const s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(KF.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}KF.process=function(e,t,n){const i=e.shaderBuilder;!function(e){e.addStruct(KF.STRUCT_ID_FEATURE_IDS_VS,KF.STRUCT_NAME_FEATURE_IDS,su.VERTEX),e.addStruct(KF.STRUCT_ID_FEATURE_IDS_FS,KF.STRUCT_NAME_FEATURE_IDS,su.FRAGMENT),e.addFunction(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,KF.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,su.VERTEX),e.addFunction(KF.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,KF.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,su.FRAGMENT),e.addFunction(KF.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,KF.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,su.VERTEX),e.addFunction(KF.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,KF.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,su.FRAGMENT),e.addFunction(KF.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,KF.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,su.VERTEX)}(i);const o=e.runtimeNode.node.instances;D(o)&&function(e,t,n){const i=t.featureIds,o=t.attributes[0].count;for(let r=0;r<i.length;r++){const t=i[r],s=t.positionalLabel;if(t instanceof UC.FeatureIdAttribute)ZF(e,t,s);else{eB(e,t,s,o,1,n)}const a=t.label;D(a)&&nB(e,s,a,su.BOTH)}}(e,o,n),function(e,t,n){const i=t.featureIds,o=xC.getAttributeBySemantic(t,EC.POSITION),r=o.count;for(let s=0;s<i.length;s++){const t=i[s],o=t.positionalLabel;let a=su.BOTH;t instanceof UC.FeatureIdAttribute?JF(e,t,o):t instanceof UC.FeatureIdImplicitRange?eB(e,t,o,r,void 0,n):(tB(e,t,o,s,n),a=su.FRAGMENT);const c=t.label;D(c)&&nB(e,o,c,a)}}(e,t,n),i.addVertexLines("void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) \n{\n initializeFeatureIds(featureIds, attributes);\n initializeFeatureIdAliases(featureIds);\n setFeatureIdVaryings();\n}\n"),i.addFragmentLines("void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {\n initializeFeatureIds(featureIds, attributes);\n initializeFeatureIdAliases(featureIds);\n}\n")};const iB=KF,oB={name:"MetadataPipelineStage",STRUCT_ID_METADATA_VS:"MetadataVS",STRUCT_ID_METADATA_FS:"MetadataFS",STRUCT_NAME_METADATA:"Metadata",STRUCT_ID_METADATA_CLASS_VS:"MetadataClassVS",STRUCT_ID_METADATA_CLASS_FS:"MetadataClassFS",STRUCT_NAME_METADATA_CLASS:"MetadataClass",STRUCT_ID_METADATA_STATISTICS_VS:"MetadataStatisticsVS",STRUCT_ID_METADATA_STATISTICS_FS:"MetadataStatisticsFS",STRUCT_NAME_METADATA_STATISTICS:"MetadataStatistics",FUNCTION_ID_INITIALIZE_METADATA_VS:"initializeMetadataVS",FUNCTION_ID_INITIALIZE_METADATA_FS:"initializeMetadataFS",FUNCTION_SIGNATURE_INITIALIZE_METADATA:"void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",FUNCTION_ID_SET_METADATA_VARYINGS:"setMetadataVaryings",FUNCTION_SIGNATURE_SET_METADATA_VARYINGS:"void setMetadataVaryings()",METADATA_CLASS_FIELDS:[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}],METADATA_STATISTICS_FIELDS:[{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"},{specName:"mean",shaderName:"mean",type:"float"},{specName:"median",shaderName:"median"},{specName:"standardDeviation",shaderName:"standardDeviation",type:"float"},{specName:"variance",shaderName:"variance",type:"float"},{specName:"sum",shaderName:"sum"}]};oB.process=function(e,t,n){var i;const{shaderBuilder:o,model:r}=e,{structuralMetadata:s={},content:a}=r,c=null==(i=null==a?void 0:a.tileset.metadataExtension)?void 0:i.statistics,l=function(e,t,n){if(!D(e))return[];return e.flatMap((e=>function(e,t,n){const{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=xC,s=e.class.id,a=null==n?void 0:n.classes[s],c=Object.entries(e.properties),l=new Array(c.length);for(let u=0;u<c.length;u++){const[e,n]=c[u],s=i(t,n.attribute),{glslType:d,variableName:h}=o(s);l[u]={metadataVariable:r(e),property:n,type:n.classProperty.type,glslType:d,variableName:h,propertyStatistics:null==a?void 0:a.properties[e],shaderDestination:su.BOTH}}return l}(e,t,n)))}(s.propertyAttributes,t,c),u=function(e,t){if(!D(e))return[];return e.flatMap((e=>function(e,t){const{sanitizeGlslIdentifier:n}=xC,i=e.class.id,o=null==t?void 0:t.classes[i],r=Object.entries(e.properties).filter((([e,t])=>t.isGpuCompatible())),s=new Array(r.length);for(let a=0;a<r.length;a++){const[e,t]=r[a];s[a]={metadataVariable:n(e),property:t,type:t.classProperty.type,glslType:t.getGlslType(),propertyStatistics:null==o?void 0:o.properties[e],shaderDestination:su.FRAGMENT}}return s}(e,t)))}(s.propertyTextures,c);!function(e,t){const n=new Set,i=new Set;for(let a=0;a<t.length;a++){const{type:e,glslType:o,propertyStatistics:r}=t[a];n.add(o),D(r)&&(e!==Vx.ENUM&&i.add(o))}const o=oB.METADATA_CLASS_FIELDS;for(const a of n){s(`${a}MetadataClass`,a,o)}const r=oB.METADATA_STATISTICS_FIELDS;for(const a of i){s(`${a}MetadataStatistics`,a,r)}function s(t,n,i){e.addStruct(t,t,su.BOTH);for(let o=0;o<i.length;o++){const{shaderName:r}=i[o],s="float"===i[o].type?sB(n):n;e.addStructField(t,s,r)}}}(o,l.concat(u)),function(e){e.addStruct(oB.STRUCT_ID_METADATA_VS,oB.STRUCT_NAME_METADATA,su.VERTEX),e.addStruct(oB.STRUCT_ID_METADATA_FS,oB.STRUCT_NAME_METADATA,su.FRAGMENT),e.addStruct(oB.STRUCT_ID_METADATA_CLASS_VS,oB.STRUCT_NAME_METADATA_CLASS,su.VERTEX),e.addStruct(oB.STRUCT_ID_METADATA_CLASS_FS,oB.STRUCT_NAME_METADATA_CLASS,su.FRAGMENT),e.addStruct(oB.STRUCT_ID_METADATA_STATISTICS_VS,oB.STRUCT_NAME_METADATA_STATISTICS,su.VERTEX),e.addStruct(oB.STRUCT_ID_METADATA_STATISTICS_FS,oB.STRUCT_NAME_METADATA_STATISTICS,su.FRAGMENT),e.addFunction(oB.FUNCTION_ID_INITIALIZE_METADATA_VS,oB.FUNCTION_SIGNATURE_INITIALIZE_METADATA,su.VERTEX),e.addFunction(oB.FUNCTION_ID_INITIALIZE_METADATA_FS,oB.FUNCTION_SIGNATURE_INITIALIZE_METADATA,su.FRAGMENT),e.addFunction(oB.FUNCTION_ID_SET_METADATA_VARYINGS,oB.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,su.VERTEX)}(o),o.addVertexLines("void metadataStage(\n out Metadata metadata,\n out MetadataClass metadataClass,\n out MetadataStatistics metadataStatistics,\n ProcessedAttributes attributes\n )\n{\n initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);\n setMetadataVaryings();\n}\n"),o.addFragmentLines("void metadataStage(\n out Metadata metadata,\n out MetadataClass metadataClass,\n out MetadataStatistics metadataStatistics,\n ProcessedAttributes attributes\n )\n{\n initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);\n}\n");for(let d=0;d<l.length;d++){aB(e,l[d])}for(let d=0;d<u.length;d++){cB(e,u[d])}};const rB={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function sB(e){const t=rB[e];return D(t)?t:e}function aB(e,t){!function(e,t){const{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=hB({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:su.BOTH,property:o});n.addStructField(oB.STRUCT_ID_METADATA_VS,r,i),n.addStructField(oB.STRUCT_ID_METADATA_FS,r,i);const a=`metadata.${i} = ${s};`;n.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}(e,t),lB(e.shaderBuilder,t),uB(e.shaderBuilder,t)}function cB(e,t){!function(e,t){const{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:c,index:l,texture:u,transform:d}=s.textureReader,h=`u_propertyTexture_${l}`;i.hasOwnProperty(h)||(n.addUniform("sampler2D",h,su.FRAGMENT),i[h]=()=>u);n.addStructField(oB.STRUCT_ID_METADATA_FS,r,o);const p=`attributes.texCoord_${a}`;let f=p;if(D(d)&&!re.equals(d,re.IDENTITY)){const e=`${h}Transform`;n.addUniform("mat3",e,su.FRAGMENT),i[e]=function(){return d},f=`vec2(${e} * vec3(${p}, 1.0))`}const m=`texture(${h}, ${f}).${c}`,_=hB({valueExpression:s.unpackInShader(m),renderResources:e,glslType:r,metadataVariable:o,shaderDestination:su.FRAGMENT,property:s}),g=`metadata.${o} = ${_};`;n.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_FS,[g])}(e,t),lB(e.shaderBuilder,t),uB(e.shaderBuilder,t)}function lB(e,t){const{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=dB(oB.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(oB.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_FS,s),su.includesVertexShader(r)&&(e.addStructField(oB.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function uB(e,t){const{propertyStatistics:n}=t;if(!D(n))return;const{metadataVariable:i,type:o,glslType:r}=t;if(o===Vx.ENUM)return;const s=dB(oB.METADATA_STATISTICS_FIELDS,n,`metadataStatistics.${i}`,r),a=`${r}MetadataStatistics`;e.addStructField(oB.STRUCT_ID_METADATA_STATISTICS_FS,a,i),e.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_FS,s),su.includesVertexShader(t.shaderDestination)&&(e.addStructField(oB.STRUCT_ID_METADATA_STATISTICS_VS,a,i),e.addFunctionLines(oB.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function dB(e,t,n,i){return D(t)?e.map((function(e){const o=t[e.specName];if(D(o))return`${n}.${e.shaderName} = ${i}(${o});`})).filter(D):[]}function hB(e){const{valueExpression:t,property:n}=e;if(!n.hasValueTransform)return t;const i=e.metadataVariable,o=`u_${i}_offset`,r=`u_${i}_scale`,{shaderBuilder:s,uniformMap:a}=e.renderResources,{glslType:c,shaderDestination:l}=e;s.addUniform(c,o,l),s.addUniform(c,r,l);const{offset:u,scale:d}=n;return a[o]=()=>u,a[r]=()=>d,`czm_valueTransform(${o}, ${r}, ${t})`}const pB=oB,fB=Object.freeze({INHERIT:0,OPAQUE:1,TRANSLUCENT:2}),mB={name:"CustomShaderPipelineStage",STRUCT_ID_ATTRIBUTES_VS:"AttributesVS",STRUCT_ID_ATTRIBUTES_FS:"AttributesFS",STRUCT_NAME_ATTRIBUTES:"Attributes",STRUCT_ID_VERTEX_INPUT:"VertexInput",STRUCT_NAME_VERTEX_INPUT:"VertexInput",STRUCT_ID_FRAGMENT_INPUT:"FragmentInput",STRUCT_NAME_FRAGMENT_INPUT:"FragmentInput",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS:"initializeInputStructVS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS:"void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS:"initializeInputStructFS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS:"void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",_oneTimeWarning:Oa};mB.process=function(e,t,n){const{shaderBuilder:i,model:o,alphaOptions:r}=e,{customShader:s}=o,{lightingModel:a,translucencyMode:c}=s;D(a)&&(e.lightingOptions.lightingModel=a),c===fB.TRANSLUCENT?r.pass=zt.TRANSLUCENT:c===fB.OPAQUE&&(r.pass=void 0);const l=function(e,t){const n=function(e){const t={};for(let n=0;n<e.length;n++){const i=xC.getAttributeInfo(e[n]);t[i.variableName]=i}return t}(t.attributes),i=function(e,t){if(!D(e.vertexShaderText))return{enabled:!1};const n=e.usedVariablesVertex.attributeSet,i=vB(t,n,!1),o=AB(t,n,!1);let r;const s=[],a=[];for(const c in i){if(!i.hasOwnProperty(c))continue;const e=[i[c].glslType,c];s.push(e),r=`vsInput.attributes.${c} = attributes.${c};`,a.push(r)}for(let c=0;c<o.length;c++){const e=o[c],t=yB(e);if(!D(t))return mB._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${e}, disabling custom vertex shader`),{enabled:!1};s.push(t.attributeField),r=`vsInput.attributes.${e} = ${t.value};`,a.push(r)}return{enabled:!0,attributeFields:s,initializationLines:a}}(e,n),o=function(e,t){if(!D(e.fragmentShaderText))return{enabled:!1};const n=e.usedVariablesFragment.attributeSet,i=vB(t,n,!0),o=AB(t,n,!0);let r;const s=[],a=[];for(const l in i){if(!i.hasOwnProperty(l))continue;const e=[i[l].glslType,l];s.push(e),r=`fsInput.attributes.${l} = attributes.${l};`,a.push(r)}for(let l=0;l<o.length;l++){const e=o[l],t=yB(e);if(!D(t))return mB._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${e}, disabling custom fragment shader.`),{enabled:!1};s.push(t.attributeField),r=`fsInput.attributes.${e} = ${t.value};`,a.push(r)}const c=function(e){const t=[],n=[],i=e.usedVariablesFragment.attributeSet;i.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),n.push("fsInput.attributes.positionWC = attributes.positionWC;"));i.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),n.push("fsInput.attributes.positionEC = attributes.positionEC;"));return{attributeFields:t,initializationLines:n}}(e);return{enabled:!0,attributeFields:s.concat(c.attributeFields),initializationLines:c.initializationLines.concat(a)}}(e,n),r=e.usedVariablesFragment.attributeSet,s=r.hasOwnProperty("positionWC")&&o.enabled;return{vertexLines:i,fragmentLines:o,customShaderEnabled:i.enabled||o.enabled,shouldComputePositionWC:s}}(s,t);if(!l.customShaderEnabled)return;if(function(e,t,n){const{vertexLines:i,fragmentLines:o}=n,r=TB;i.enabled&&(!function(e,t){let n=mB.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(n,mB.STRUCT_NAME_ATTRIBUTES,su.VERTEX);const{attributeFields:i,initializationLines:o}=t;for(let s=0;s<i.length;s++){const[t,o]=i[s];e.addStructField(n,t,o)}n=mB.STRUCT_ID_VERTEX_INPUT,e.addStruct(n,mB.STRUCT_NAME_VERTEX_INPUT,su.VERTEX),e.addStructField(n,mB.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,iB.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(n,pB.STRUCT_NAME_METADATA,"metadata"),e.addStructField(n,pB.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(n,pB.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=mB.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,mB.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,su.VERTEX),e.addFunctionLines(r,o)}(e,i),r.length=0,r.push("#line 0",t.vertexShaderText,QF),e.addVertexLines(r));o.enabled&&(!function(e,t){let n=mB.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(n,mB.STRUCT_NAME_ATTRIBUTES,su.FRAGMENT);const{attributeFields:i,initializationLines:o}=t;for(let s=0;s<i.length;s++){const[t,o]=i[s];e.addStructField(n,t,o)}n=mB.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(n,mB.STRUCT_NAME_FRAGMENT_INPUT,su.FRAGMENT),e.addStructField(n,mB.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,iB.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(n,pB.STRUCT_NAME_METADATA,"metadata"),e.addStructField(n,pB.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(n,pB.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=mB.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(r,mB.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,su.FRAGMENT),e.addFunctionLines(r,o)}(e,o),r.length=0,r.push("#line 0",t.fragmentShaderText,$F),e.addFragmentLines(r))}(i,s,l),l.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,su.BOTH),D(s.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,su.VERTEX),D(s.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,su.FRAGMENT);const e=XF.getDefineName(s.mode);i.addDefine(e,void 0,su.FRAGMENT)}const u=s.uniforms;for(const h in u)if(u.hasOwnProperty(h)){const e=u[h];i.addUniform(e.type,h)}const d=s.varyings;for(const h in d)if(d.hasOwnProperty(h)){const e=d[h];i.addVarying(e,h)}e.uniformMap=ni(e.uniformMap,s.uniformMap)};const _B={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},gB={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function yB(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const n=_B[t],i=gB[t];if(D(n))return{attributeField:[n,e],value:i}}const bB={positionWC:!0,positionEC:!0};function vB(e,t,n){const i={};for(const o in e){if(!e.hasOwnProperty(o))continue;const r=e[o];let s=o;n&&"normalMC"===o?s="normalEC":n&&"tangentMC"===o&&(s="tangentEC",r.glslType="vec3"),t.hasOwnProperty(s)&&(i[s]=r)}return i}function AB(e,t,n){const i=[];for(const o in t){if(!t.hasOwnProperty(o))continue;if(bB.hasOwnProperty(o))continue;let r=o;n&&"normalEC"===o?r="normalMC":n&&"tangentEC"===o&&(r="tangentMC"),e.hasOwnProperty(r)||i.push(o)}return i}const TB=[];const wB=mB,EB={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};function xB(e,t){const n=e.shaderBuilder,i=e.uniformMap,o=t.variableName,r=t.attribute.quantization;if(r.octEncoded){const e=`model_normalizationRange_${o}`;n.addUniform("float",e,su.VERTEX),i[e]=function(){return r.normalizationRange}}else{const e=`model_quantizedVolumeOffset_${o}`,s=`model_quantizedVolumeStepSize_${o}`,a=t.glslType;n.addUniform(a,e,su.VERTEX),n.addUniform(a,s,su.VERTEX);let c=r.quantizedVolumeOffset,l=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(c=SB(c,0),l=SB(l,1)),i[e]=function(){return c},i[s]=function(){return l}}}function SB(e,t){return e instanceof K?e:new K(e.x,e.y,e.z,t)}function CB(e,t){const n=t.variableName,i=t.attribute.quantization;let o;o=i.octEncoded?function(e,t){const n=`attributes.${e}`,i=`a_quantized_${e}`,o=`model_normalizationRange_${e}`,r=t.octEncodedZXY?".zxy":".xyz";return`${n} = czm_octDecode(${i}, ${o})${r};`}(n,i):function(e){const t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}(n),e.addFunctionLines(EB.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}EB.process=function(e,t,n){const i=e.shaderBuilder,o=D(e.model.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,su.VERTEX),i.addFunction(EB.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,EB.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,su.VERTEX);const r=t.attributes;for(let s=0;s<r.length;s++){const t=r[s];if(!D(t.quantization))continue;const n=t.semantic===EC.POSITION,a=t.semantic===EC.TEXCOORD;if(o&&!n&&!a)continue;const c=xC.getAttributeInfo(t);CB(i,c),xB(e,c)}};const IB=EB,OB="vec2 computeSt(float featureId)\n{\n float stepX = model_textureStep.x;\n float centerX = model_textureStep.y;\n\n #ifdef MULTILINE_BATCH_TEXTURE\n float stepY = model_textureStep.z;\n float centerY = model_textureStep.w;\n\n float xId = mod(featureId, model_textureDimensions.x); \n float yId = floor(featureId / model_textureDimensions.x);\n \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY));\n #else\n return vec2(centerX + (featureId * stepX), 0.5);\n #endif\n}\n\nvoid selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)\n{ \n int featureId = featureIds.SELECTED_FEATURE_ID;\n\n\n if (featureId < model_featuresLength)\n {\n vec2 featureSt = computeSt(float(featureId));\n\n feature.id = featureId;\n feature.st = featureSt;\n feature.color = texture(model_batchTexture, featureSt);\n }\n // Floating point comparisons can be unreliable in GLSL, so we\n // increment the feature ID to make sure it's always greater\n // then the model_featuresLength - a condition we check for in the\n // pick ID, to avoid sampling the pick texture if the feature ID is\n // greater than the number of features.\n else\n {\n feature.id = model_featuresLength + 1;\n feature.st = vec2(0.0);\n feature.color = vec4(1.0);\n }\n\n #ifdef HAS_NULL_FEATURE_ID\n if (featureId == model_nullFeatureId) {\n feature.id = featureId;\n feature.st = vec2(0.0);\n feature.color = vec4(1.0);\n }\n #endif\n}\n",DB={name:"SelectedFeatureIdPipelineStage",STRUCT_ID_SELECTED_FEATURE:"SelectedFeature",STRUCT_NAME_SELECTED_FEATURE:"SelectedFeature",FUNCTION_ID_FEATURE_VARYINGS_VS:"updateFeatureStructVS",FUNCTION_ID_FEATURE_VARYINGS_FS:"updateFeatureStructFS",FUNCTION_SIGNATURE_UPDATE_FEATURE:"void updateFeatureStruct(inout SelectedFeature feature)"};function PB(e){return e instanceof UC.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function NB(e){return e instanceof UC.FeatureIdTexture?su.FRAGMENT:su.BOTH}DB.process=function(e,t,n){const i=e.shaderBuilder;e.hasPropertyTable=!0;const o=function(e,t,n){let i,o;if(D(t.instances)&&(o=xC.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),D(o)))return i=M(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:NB(o),featureIdDefine:PB(o)};return o=xC.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=M(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:NB(o),featureIdDefine:PB(o)}}(e.model,e.runtimeNode.node,t),r=o.shaderDestination;i.addDefine("HAS_SELECTED_FEATURE_ID",void 0,r),i.addDefine("SELECTED_FEATURE_ID",o.variableName,r),i.addDefine(o.featureIdDefine,void 0,r),function(e){e.addStructField(DB.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(DB.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(DB.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}(i);const s=o.featureIds.nullFeatureId,a=e.uniformMap;D(s)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,r),i.addUniform("int","model_nullFeatureId",r),a.model_nullFeatureId=function(){return s}),o.shaderDestination===su.BOTH&&i.addVertexLines(OB),i.addFragmentLines(OB)};const RB=DB,LB={name:"GeometryPipelineStage",STRUCT_ID_PROCESSED_ATTRIBUTES_VS:"ProcessedAttributesVS",STRUCT_ID_PROCESSED_ATTRIBUTES_FS:"ProcessedAttributesFS",STRUCT_NAME_PROCESSED_ATTRIBUTES:"ProcessedAttributes",FUNCTION_ID_INITIALIZE_ATTRIBUTES:"initializeAttributes",FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES:"void initializeAttributes(out ProcessedAttributes attributes)",FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS:"setDynamicVaryingsVS",FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS:"setDynamicVaryingsFS",FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS:"void setDynamicVaryings(inout ProcessedAttributes attributes)"};function MB(e,t,n,i,o,r){const s=e.shaderBuilder,a=xC.getAttributeInfo(t),c=o&&!r;i>1?function(e,t,n,i){const o=t.quantization;let r,s;D(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.normalized,c=Zf.getNumberOfComponents(r)/i,l=Ca.getSizeInBytes(s),u=c*l,d=t.byteStride;for(let h=0;h<i;h++){const i=t.byteOffset+h*u,o={index:n+h,vertexBuffer:t.buffer,componentsPerAttribute:c,componentDatatype:s,offsetInBytes:i,strideInBytes:d,normalize:a};e.attributes.push(o)}}(e,t,n,i):function(e,t,n,i){const o=t.quantization;let r,s;D(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.semantic,c=t.setIndex;a===EC.FEATURE_ID&&c>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=c+1);const l=a===EC.POSITION,u=l?0:n,d=Zf.getNumberOfComponents(r),h={index:u,value:D(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:d,componentDatatype:s,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(h),!l||!i)return;const p=e.runtimePrimitive.positionBuffer2D,f={index:n,vertexBuffer:p,count:t.count,componentsPerAttribute:d,componentDatatype:Ca.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(f)}(e,t,n,c),function(e,t,n){const i=t.attribute.semantic,o=t.variableName;let r,s;t.isQuantized?(r=`a_quantized_${o}`,s=t.quantizedGlslType):(r=`a_${o}`,s=t.glslType);const a=i===EC.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r);a&&n&&e.addAttribute("vec3","a_position2D")}(s,a,c),function(e,t){const n=t.variableName;let i,o=`v_${n}`;"normalMC"===n?(o="v_normalEC",i=t.glslType):"tangentMC"===n?(i="vec3",o="v_tangentEC"):i=t.glslType;e.addVarying(i,o)}(s,a),D(t.semantic)&&function(e,t){const n=t.semantic,i=t.setIndex;switch(n){case EC.NORMAL:e.addDefine("HAS_NORMALS");break;case EC.TANGENT:e.addDefine("HAS_TANGENTS");break;case EC.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case EC.TEXCOORD:case EC.COLOR:e.addDefine(`HAS_${n}_${i}`)}}(s,t),function(e,t,n){const i=LB.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=LB.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,r=t.variableName;"tangentMC"===r?(e.addStructField(i,"vec3","tangentMC"),e.addStructField(i,"float","tangentSignMC"),e.addStructField(o,"vec3","tangentEC")):"normalMC"===r?(e.addStructField(i,"vec3","normalMC"),e.addStructField(o,"vec3","normalEC")):(e.addStructField(i,t.glslType,r),e.addStructField(o,t.glslType,r));"positionMC"===r&&n&&e.addStructField(i,"vec3","position2D")}(s,a,o),function(e,t,n){const i=LB.FUNCTION_ID_INITIALIZE_ATTRIBUTES,o=t.variableName,r="positionMC"===o&&n;if(r){const t="attributes.position2D = a_position2D;";e.addFunctionLines(i,[t])}if(t.isQuantized)return;const s=[];"tangentMC"===o?(s.push("attributes.tangentMC = a_tangentMC.xyz;"),s.push("attributes.tangentSignMC = a_tangentMC.w;")):s.push(`attributes.${o} = a_${o};`);e.addFunctionLines(i,s)}(s,a,c),function(e,t){const n=t.attribute.semantic,i=t.attribute.setIndex;if(D(n)&&!D(i))return;let o=LB.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const r=t.variableName;let s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=LB.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}(s,a)}LB.process=function(e,t,n){const i=e.shaderBuilder,o=e.model;i.addStruct(LB.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",su.VERTEX),i.addStruct(LB.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",su.FRAGMENT),i.addStruct(RB.STRUCT_ID_SELECTED_FEATURE,RB.STRUCT_NAME_SELECTED_FEATURE,su.BOTH),i.addFunction(LB.FUNCTION_ID_INITIALIZE_ATTRIBUTES,LB.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,su.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(LB.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(LB.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(LB.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,LB.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,su.VERTEX),i.addFunction(LB.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,LB.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,su.FRAGMENT);o.type===yM.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,su.FRAGMENT);const r=n.mode!==gl.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,s=D(e.runtimeNode.node.instances),a=r&&!s,c=t.attributes.length;for(let l=0;l<c;l++){const n=t.attributes[l],i=Zf.getAttributeLocationCount(n.type);if(!D(n.buffer)&&!D(n.constant))throw new P("Attributes must be provided as a Buffer or constant value");const o=n.semantic===EC.POSITION;let c;i>1?(c=e.attributeIndex,e.attributeIndex+=i):c=o&&!a?0:e.attributeIndex++,MB(e,n,c,i,r,s)}!function(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){const e=t[o];e.semantic===EC.NORMAL?n=!0:e.semantic===EC.TANGENT&&(i=!0)}if(!n||!i)return;e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(LB.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(LB.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC")}(i,t.attributes),t.primitiveType===Vr.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines("vec4 geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)\n{\n vec4 computedPosition;\n\n // Compute positions in different coordinate systems\n vec3 positionMC = attributes.positionMC;\n v_positionMC = positionMC;\n v_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;\n\n #if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)\n vec3 position2D = attributes.position2D;\n vec3 positionEC = (u_modelView2D * vec4(position2D, 1.0)).xyz;\n computedPosition = czm_projection * vec4(positionEC, 1.0);\n #else\n computedPosition = czm_projection * vec4(v_positionEC, 1.0);\n #endif\n\n // Sometimes the custom shader and/or style needs this\n #if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE) || defined(ENABLE_CLIPPING_POLYGONS)\n // Note that this is a 32-bit position which may result in jitter on small\n // scales.\n v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;\n #endif\n\n #ifdef HAS_NORMALS\n v_normalEC = normalize(normal * attributes.normalMC);\n #endif\n\n #ifdef HAS_TANGENTS\n v_tangentEC = normalize(normal * attributes.tangentMC);\n #endif\n\n #ifdef HAS_BITANGENTS\n v_bitangentEC = normalize(normal * attributes.bitangentMC);\n #endif\n\n // All other varyings need to be dynamically generated in\n // GeometryPipelineStage\n setDynamicVaryings(attributes);\n\n return computedPosition;\n}\n"),i.addFragmentLines("void geometryStage(out ProcessedAttributes attributes)\n{\n attributes.positionMC = v_positionMC;\n attributes.positionEC = v_positionEC;\n\n #if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE)\n attributes.positionWC = v_positionWC;\n #endif\n\n #ifdef HAS_NORMALS\n // renormalize after interpolation\n attributes.normalEC = normalize(v_normalEC);\n #endif\n\n #ifdef HAS_TANGENTS\n attributes.tangentEC = normalize(v_tangentEC);\n #endif\n\n #ifdef HAS_BITANGENTS\n attributes.bitangentEC = normalize(v_bitangentEC);\n #endif\n\n // Everything else is dynamically generated in GeometryPipelineStage\n setDynamicVaryings(attributes);\n}\n")};const FB=LB,BB=Object.freeze({UNLIT:0,PBR:1}),zB={name:"LightingPipelineStage",process:function(e,t){const n=e.model,i=e.lightingOptions,o=e.shaderBuilder;if(D(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,su.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",su.FRAGMENT);e.uniformMap.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===BB.PBR?o.addDefine("LIGHTING_PBR",void 0,su.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,su.FRAGMENT),o.addFragmentLines("#ifdef LIGHTING_PBR\nvec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)\n{\n czm_pbrParameters pbrParameters;\n pbrParameters.diffuseColor = inputMaterial.diffuse;\n pbrParameters.f0 = inputMaterial.specular;\n pbrParameters.roughness = inputMaterial.roughness;\n \n #ifdef USE_CUSTOM_LIGHT_COLOR\n vec3 lightColorHdr = model_lightColorHdr;\n #else\n vec3 lightColorHdr = czm_lightColorHdr;\n #endif\n\n vec3 color = inputMaterial.diffuse;\n #ifdef HAS_NORMALS\n color = czm_pbrLighting(\n attributes.positionEC,\n inputMaterial.normalEC,\n czm_lightDirectionEC,\n lightColorHdr,\n pbrParameters\n );\n\n #ifdef USE_IBL_LIGHTING\n color += imageBasedLightingStage(\n attributes.positionEC,\n inputMaterial.normalEC,\n czm_lightDirectionEC,\n lightColorHdr,\n pbrParameters\n );\n #endif\n #endif\n\n color *= inputMaterial.occlusion;\n color += inputMaterial.emissive;\n\n // In HDR mode, the frame buffer is in linear color space. The\n // post-processing stages (see PostProcessStageCollection) will handle\n // tonemapping. However, if HDR is not enabled, we must tonemap else large\n // values may be clamped to 1.0\n #ifndef HDR \n color = czm_acesTonemapping(color);\n #endif \n\n return color;\n}\n#endif\n\nvoid lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)\n{\n // Even though the lighting will only set the diffuse color,\n // pass all other properties so further stages have access to them.\n vec3 color = vec3(0.0);\n\n #ifdef LIGHTING_PBR\n color = computePbrLighting(material, attributes);\n #else // unlit\n color = material.diffuse;\n #endif\n\n #ifdef HAS_POINT_CLOUD_COLOR_STYLE\n // The colors resulting from point cloud styles are adjusted differently.\n color = czm_gammaCorrect(color);\n #elif !defined(HDR)\n // If HDR is not enabled, the frame buffer stores sRGB colors rather than\n // linear colors so the linear value must be converted.\n color = czm_linearToSrgb(color);\n #endif\n\n material.diffuse = color;\n}\n")}},UB=zB,kB=UC.Material,VB=UC.MetallicRoughness,HB=UC.SpecularGlossiness,GB={name:"MaterialPipelineStage",_processTexture:WB,_processTextureTransform:jB};function jB(e,t,n,i,o){const r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,su.FRAGMENT);const s=`${i}Transform`;e.addUniform("mat3",s,su.FRAGMENT),t[s]=function(){return n.transform}}function WB(e,t,n,i,o,r){e.addUniform("sampler2D",i,su.FRAGMENT),t[i]=function(){return M(n.texture,r)};const s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,su.FRAGMENT);const a=`v_texCoord_${n.texCoord}`,c=`TEXCOORD_${o}`;e.addDefine(c,a,su.FRAGMENT);const l=n.transform;D(l)&&!re.equals(l,re.IDENTITY)&&jB(e,t,n,i,o)}GB.process=function(e,t,n){const i=t.material,o=e.model,r=D(o.classificationType),s=r,a=e.uniformMap,c=e.shaderBuilder,l=n.context.defaultTexture;!function(e,t,n,i,o,r,s){const a=e.emissiveFactor;if(D(a)&&!H.equals(a,kB.DEFAULT_EMISSIVE_FACTOR)){n.addUniform("vec3","u_emissiveFactor",su.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,su.FRAGMENT);const i=e.emissiveTexture;D(i)&&!s&&WB(n,t,i,"u_emissiveTexture","EMISSIVE",r)}const c=e.normalTexture;D(c)&&!s&&WB(n,t,c,"u_normalTexture","NORMAL",o);const l=e.occlusionTexture;D(l)&&!s&&WB(n,t,l,"u_occlusionTexture","OCCLUSION",i)}(i,a,c,l,n.context.defaultNormalTexture,n.context.defaultEmissiveTexture,s),D(i.specularGlossiness)?function(e,t,n,i,o){const r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,su.FRAGMENT);const s=r.diffuseTexture;D(s)&&!o&&WB(n,t,s,"u_diffuseTexture","DIFFUSE",i);const a=r.diffuseFactor;D(a)&&!K.equals(a,HB.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",su.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,su.FRAGMENT));const c=r.specularGlossinessTexture;D(c)&&!o&&WB(n,t,c,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);const l=r.specularFactor;D(l)&&!H.equals(l,HB.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",su.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,su.FRAGMENT));const u=r.glossinessFactor;D(u)&&u!==HB.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",su.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,su.FRAGMENT))}(i,a,c,l,s):function(e,t,n,i,o){const r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,su.FRAGMENT);const s=r.baseColorTexture;D(s)&&!o&&WB(n,t,s,"u_baseColorTexture","BASE_COLOR",i);const a=r.baseColorFactor;D(a)&&!K.equals(a,VB.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",su.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,su.FRAGMENT));const c=r.metallicRoughnessTexture;D(c)&&!o&&WB(n,t,c,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);const l=r.metallicFactor;D(l)&&l!==VB.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",su.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,su.FRAGMENT));const u=r.roughnessFactor;D(u)&&u!==VB.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",su.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,su.FRAGMENT))}(i,a,c,l,s);const u=xC.getAttributeBySemantic(t,EC.NORMAL),d=e.lightingOptions;i.unlit||!u||r?d.lightingModel=BB.UNLIT:d.lightingModel=BB.PBR;const h=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=h;const p=e.alphaOptions;i.alphaMode===RC.BLEND?p.pass=zt.TRANSLUCENT:i.alphaMode===RC.MASK&&(p.alphaCutoff=i.alphaCutoff),c.addFragmentLines("// If the style color is white, it implies the feature has not been styled.\nbool isDefaultStyleColor(vec3 color)\n{\n return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));\n}\n\nvec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)\n{\n vec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);\n vec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;\n return color;\n}\n\nvec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)\n{\n return vec2(textureTransform * vec3(texCoord, 1.0));\n}\n\n#ifdef HAS_NORMALS\nvec3 computeNormal(ProcessedAttributes attributes)\n{\n // Geometry normal. This is already normalized \n vec3 ng = attributes.normalEC;\n\n vec3 normal = ng;\n #if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)\n vec2 normalTexCoords = TEXCOORD_NORMAL;\n #ifdef HAS_NORMAL_TEXTURE_TRANSFORM\n normalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);\n #endif\n\n // If HAS_BITANGENTS is set, then HAS_TANGENTS is also set\n #ifdef HAS_BITANGENTS\n vec3 t = attributes.tangentEC;\n vec3 b = attributes.bitangentEC;\n mat3 tbn = mat3(t, b, ng);\n vec3 n = texture(u_normalTexture, normalTexCoords).rgb;\n normal = normalize(tbn * (2.0 * n - 1.0));\n #elif (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n // If derivatives are available (not IE 10), compute tangents\n vec3 positionEC = attributes.positionEC;\n vec3 pos_dx = dFdx(positionEC);\n vec3 pos_dy = dFdy(positionEC);\n vec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));\n vec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));\n 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 t = normalize(t - ng * dot(ng, t));\n vec3 b = normalize(cross(ng, t));\n mat3 tbn = mat3(t, b, ng);\n vec3 n = texture(u_normalTexture, normalTexCoords).rgb;\n normal = normalize(tbn * (2.0 * n - 1.0));\n #endif\n #endif\n\n #ifdef HAS_DOUBLE_SIDED_MATERIAL\n if (czm_backFacing()) {\n normal = -normal;\n }\n #endif\n\n return normal;\n}\n#endif\n\nvoid materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)\n{\n #ifdef HAS_NORMALS\n material.normalEC = computeNormal(attributes);\n #endif\n\n vec4 baseColorWithAlpha = vec4(1.0);\n // Regardless of whether we use PBR, set a base color\n #ifdef HAS_BASE_COLOR_TEXTURE\n vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;\n\n #ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM\n baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);\n #endif\n\n baseColorWithAlpha = czm_srgbToLinear(texture(u_baseColorTexture, baseColorTexCoords));\n\n #ifdef HAS_BASE_COLOR_FACTOR\n baseColorWithAlpha *= u_baseColorFactor;\n #endif\n #elif defined(HAS_BASE_COLOR_FACTOR)\n baseColorWithAlpha = u_baseColorFactor;\n #endif\n\n #ifdef HAS_POINT_CLOUD_COLOR_STYLE\n baseColorWithAlpha = v_pointCloudColor;\n #elif defined(HAS_COLOR_0)\n vec4 color = attributes.color_0;\n // .pnts files store colors in the sRGB color space\n #ifdef HAS_SRGB_COLOR\n color = czm_srgbToLinear(color);\n #endif\n baseColorWithAlpha *= color;\n #endif\n\n material.diffuse = baseColorWithAlpha.rgb;\n material.alpha = baseColorWithAlpha.a;\n\n #ifdef USE_CPU_STYLING\n material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);\n #endif\n\n #ifdef HAS_OCCLUSION_TEXTURE\n vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;\n #ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM\n occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);\n #endif\n material.occlusion = texture(u_occlusionTexture, occlusionTexCoords).r;\n #endif\n\n #ifdef HAS_EMISSIVE_TEXTURE\n vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;\n #ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM\n emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);\n #endif\n\n vec3 emissive = czm_srgbToLinear(texture(u_emissiveTexture, emissiveTexCoords).rgb);\n #ifdef HAS_EMISSIVE_FACTOR\n emissive *= u_emissiveFactor;\n #endif\n material.emissive = emissive;\n #elif defined(HAS_EMISSIVE_FACTOR)\n material.emissive = u_emissiveFactor;\n #endif\n\n #if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)\n #ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE\n vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;\n #ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM\n specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);\n #endif\n\n vec4 specularGlossiness = czm_srgbToLinear(texture(u_specularGlossinessTexture, specularGlossinessTexCoords));\n vec3 specular = specularGlossiness.rgb;\n float glossiness = specularGlossiness.a;\n #ifdef HAS_SPECULAR_FACTOR\n specular *= u_specularFactor;\n #endif\n\n #ifdef HAS_GLOSSINESS_FACTOR\n glossiness *= u_glossinessFactor;\n #endif\n #else\n #ifdef HAS_SPECULAR_FACTOR\n vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n #else\n vec3 specular = vec3(1.0);\n #endif\n\n #ifdef HAS_GLOSSINESS_FACTOR\n float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n #else\n float glossiness = 1.0;\n #endif\n #endif\n\n #ifdef HAS_DIFFUSE_TEXTURE\n vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;\n #ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM\n diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);\n #endif\n\n vec4 diffuse = czm_srgbToLinear(texture(u_diffuseTexture, diffuseTexCoords));\n #ifdef HAS_DIFFUSE_FACTOR\n diffuse *= u_diffuseFactor;\n #endif\n #elif defined(HAS_DIFFUSE_FACTOR)\n vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n #else\n vec4 diffuse = vec4(1.0);\n #endif\n czm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(\n diffuse.rgb,\n specular,\n glossiness\n );\n material.diffuse = parameters.diffuseColor;\n // the specular glossiness extension's alpha overrides anything set\n // by the base material.\n material.alpha = diffuse.a;\n material.specular = parameters.f0;\n material.roughness = parameters.roughness;\n #elif defined(LIGHTING_PBR)\n #ifdef HAS_METALLIC_ROUGHNESS_TEXTURE\n vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;\n #ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM\n metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);\n #endif\n\n vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;\n float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n #ifdef HAS_METALLIC_FACTOR\n metalness *= u_metallicFactor;\n #endif\n\n #ifdef HAS_ROUGHNESS_FACTOR\n roughness *= u_roughnessFactor;\n #endif\n #else\n #ifdef HAS_METALLIC_FACTOR\n float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n #else\n float metalness = 1.0;\n #endif\n\n #ifdef HAS_ROUGHNESS_FACTOR\n float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n #else\n float roughness = 1.0;\n #endif\n #endif\n czm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(\n material.diffuse,\n metalness,\n roughness\n );\n material.diffuse = parameters.diffuseColor;\n material.specular = parameters.f0;\n material.roughness = parameters.roughness;\n #endif\n}\n"),i.doubleSided&&c.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,su.BOTH)};const qB=GB,YB={name:"MorphTargetsPipelineStage",FUNCTION_ID_GET_MORPHED_POSITION:"getMorphedPosition",FUNCTION_SIGNATURE_GET_MORPHED_POSITION:"vec3 getMorphedPosition(in vec3 position)",FUNCTION_ID_GET_MORPHED_NORMAL:"getMorphedNormal",FUNCTION_SIGNATURE_GET_MORPHED_NORMAL:"vec3 getMorphedNormal(in vec3 normal)",FUNCTION_ID_GET_MORPHED_TANGENT:"getMorphedTangent",FUNCTION_SIGNATURE_GET_MORPHED_TANGENT:"vec3 getMorphedTangent(in vec3 tangent)"};YB.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,su.VERTEX),function(e){e.addFunction(YB.FUNCTION_ID_GET_MORPHED_POSITION,YB.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,su.VERTEX);const t="vec3 morphedPosition = position;";e.addFunctionLines(YB.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(YB.FUNCTION_ID_GET_MORPHED_NORMAL,YB.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,su.VERTEX);const n="vec3 morphedNormal = normal;";e.addFunctionLines(YB.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(YB.FUNCTION_ID_GET_MORPHED_TANGENT,YB.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,su.VERTEX);const i="vec3 morphedTangent = tangent;";e.addFunctionLines(YB.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}(n);const i=t.morphTargets.length;for(let s=0;s<i;s++){const n=t.morphTargets[s].attributes,i=n.length;for(let t=0;t<i;t++){const i=n[t],o=i.semantic;o!==EC.POSITION&&o!==EC.NORMAL&&o!==EC.TANGENT||(QB(e,i,e.attributeIndex,s),e.attributeIndex++)}}!function(e){const t="return morphedPosition;";e.addFunctionLines(YB.FUNCTION_ID_GET_MORPHED_POSITION,[t]);const n="return morphedNormal;";e.addFunctionLines(YB.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);const i="return morphedTangent;";e.addFunctionLines(YB.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}(n);const o=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${o}]`,su.VERTEX),n.addVertexLines("void morphTargetsStage(inout ProcessedAttributes attributes) \n{\n vec3 positionMC = attributes.positionMC;\n attributes.positionMC = getMorphedPosition(positionMC);\n\n #ifdef HAS_NORMALS\n vec3 normalMC = attributes.normalMC;\n attributes.normalMC = getMorphedNormal(normalMC);\n #endif\n\n #ifdef HAS_TANGENTS\n vec3 tangentMC = attributes.tangentMC;\n attributes.tangentMC = getMorphedTangent(tangentMC);\n #endif\n}");const r={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=ni(r,e.uniformMap)};const XB={attributeString:void 0,functionId:void 0};function QB(e,t,n,i){const o=e.shaderBuilder;!function(e,t,n){const i={index:n,value:D(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:Zf.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}(e,t,n);const r=function(e,t){switch(e.semantic){case EC.POSITION:t.attributeString="Position",t.functionId=YB.FUNCTION_ID_GET_MORPHED_POSITION;break;case EC.NORMAL:t.attributeString="Normal",t.functionId=YB.FUNCTION_ID_GET_MORPHED_NORMAL;break;case EC.TANGENT:t.attributeString="Tangent",t.functionId=YB.FUNCTION_ID_GET_MORPHED_TANGENT}return t}(t,XB);!function(e,t,n){const i=t.attributeString,o=`a_target${i}_${n}`,r=`morphed${i} += u_morphWeights[${n}] * a_target${i}_${n};`;e.addAttribute("vec3",o),e.addFunctionLines(t.functionId,[r])}(o,r,i)}const $B=YB,KB={name:"PickingPipelineStage"};function ZB(e,t){const n=e.model;if(D(n.pickObject))return n.pickObject;const i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive};let o;if(yM.is3DTiles(n.type)){const e=n.content;o={content:e,primitive:e.tileset,detail:i}}else o={primitive:n,detail:i};return o.id=n.id,D(t)&&(o.instanceId=t),o}KB.process=function(e,t,n){const i=n.context,o=e.runtimeNode,r=e.shaderBuilder,s=e.model,a=o.node.instances;if(e.hasPropertyTable)!function(e,t,n){const i=e.model;let o,r;const s=i.featureIdLabel,a=i.instanceFeatureIdLabel;D(i.featureTableId)?o=i.featureTableId:D(n)?(r=xC.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=xC.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);const c=i.featureTables[o],l=e.shaderBuilder;l.addUniform("sampler2D","model_pickTexture",su.FRAGMENT);const u=c.batchTexture;e.uniformMap.model_pickTexture=function(){return M(u.pickTexture,u.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture(model_pickTexture, selectedFeature.st) : vec4(0.0))"}(e,t,a);else if(D(a))!function(e,t){const n=e.instanceCount,i=new Array(n),o=new Uint8Array(4*n),r=e.model,s=r._pipelineResources;for(let d=0;d<n;d++){const n=ZB(e,d),r=t.createPickId(n);s.push(r),i[d]=r;const a=r.color;o[4*d+0]=Ot.floatToByte(a.red),o[4*d+1]=Ot.floatToByte(a.green),o[4*d+2]=Ot.floatToByte(a.blue),o[4*d+3]=Ot.floatToByte(a.alpha)}r._pickIds=i;const a=Ye.createVertexBuffer({context:t,typedArray:o,usage:qe.STATIC_DRAW});a.vertexArrayDestroyable=!1;const c=!1;r.statistics.addBuffer(a,c),s.push(a);const l={index:e.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:Ca.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(l);const u=e.shaderBuilder;u.addDefine("USE_PICKING",void 0,su.BOTH),u.addAttribute("vec4","a_pickColor"),u.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}(e,i);else{const t=ZB(e),n=i.createPickId(t);s._pipelineResources.push(n),s._pickIds.push(n),r.addUniform("vec4","czm_pickColor",su.FRAGMENT);e.uniformMap.czm_pickColor=function(){return n.color},e.pickId="czm_pickColor"}};const JB=KB,ez=Object.freeze({ADD:0,REPLACE:1}),tz=new K,nz={name:"PointCloudStylingPipelineStage"};nz.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=D(s)?s.propertyAttributes:void 0,c=D(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,l=!D(a)&&c;if(D(r)&&!l){const n=function(e){const t=ti(rz);if(!D(e))return t;for(let n=0;n<e.length;n++){const i=e[n].properties;for(const e in i)i.hasOwnProperty(e)&&(t[e]=`metadata.${e}`)}return t}(a),o=function(e,t){const n=oz,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${sz})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${sz})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${sz})`,t,i),n.styleTranslucent=D(n.colorStyleFunction)&&i.translucent,n}(r,n);!function(e,t){const n=t.colorStyleFunction;D(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,su.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));const i=t.showStyleFunction;D(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,su.VERTEX),e.addVertexLines(i));const o=t.pointSizeStyleFunction;D(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,su.VERTEX),e.addVertexLines(o))}(i,o);const s=function(e){const t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];D(t)&&az(t,o);D(n)&&az(n,o);D(i)&&az(i,o);return o}(o),c=s.indexOf("normalMC")>=0,l=xC.getAttributeBySemantic(t,EC.NORMAL);if(c&&!l)throw new be("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,su.VERTEX);o.styleTranslucent&&(e.alphaOptions.pass=zt.TRANSLUCENT)}const u=o.pointCloudShading;let d,h,p;u.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,su.VERTEX),u.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,su.VERTEX),yM.is3DTiles(o.type)&&(h=!0,d=o.content,p=d.tile.refine===ez.ADD),i.addUniform("vec4","model_pointCloudParameters",su.VERTEX),i.addVertexLines("float getPointSizeFromAttenuation(vec3 positionEC) {\n // Variables are packed into a single vector to minimize gl.uniformXXX() calls\n float pointSize = model_pointCloudParameters.x;\n float geometricError = model_pointCloudParameters.y;\n float depthMultiplier = model_pointCloudParameters.z;\n\n float depth = -positionEC.z;\n return min((geometricError / depth) * depthMultiplier, pointSize);\n}\n\n#ifdef HAS_POINT_CLOUD_SHOW_STYLE\nfloat pointCloudShowStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {\n float tiles3d_tileset_time = model_pointCloudParameters.w;\n return float(getShowFromStyle(attributes, metadata, tiles3d_tileset_time));\n}\n#endif\n\n#ifdef HAS_POINT_CLOUD_COLOR_STYLE\nvec4 pointCloudColorStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {\n float tiles3d_tileset_time = model_pointCloudParameters.w;\n return getColorFromStyle(attributes, metadata, tiles3d_tileset_time);\n}\n#endif\n\n#ifdef HAS_POINT_CLOUD_POINT_SIZE_STYLE\nfloat pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {\n float tiles3d_tileset_time = model_pointCloudParameters.w;\n return float(getPointSizeFromStyle(attributes, metadata, tiles3d_tileset_time));\n}\n#elif defined(HAS_POINT_CLOUD_ATTENUATION)\nfloat pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {\n return getPointSizeFromAttenuation(v_positionEC);\n}\n#endif\n\n#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING\nfloat pointCloudBackFaceCullingStage() {\n #if defined(HAS_NORMALS) && !defined(HAS_DOUBLE_SIDED_MATERIAL)\n // This needs to be computed in eye coordinates so we can't use attributes.normalMC\n return step(-v_normalEC.z, 0.0);\n #else\n return 1.0;\n #endif\n}\n#endif");e.uniformMap.model_pointCloudParameters=function(){const i=tz;let o=1;h&&(o=p?5:d.tileset.memoryAdjustedScreenSpaceError),i.x=M(u.maximumAttenuation,o),i.x*=n.pixelRatio;const r=function(e,t,n,i){if(D(i)){const e=i.tile.geometricError;if(e>0)return e}if(D(n.baseResolution))return n.baseResolution;const o=xC.getAttributeBySemantic(t,EC.POSITION),r=o.count,s=e.runtimeNode.transform;let a=H.subtract(o.max,o.min,iz);a=ve.multiplyByPointAsVector(s,a,iz);const c=a.x*a.y*a.z;return V.cbrt(c/r)}(e,t,u,d);i.y=r*u.geometricErrorScale;const s=n.context,a=n.camera.frustum;let c;return c=n.mode===gl.SCENE2D||a instanceof Xc?Number.POSITIVE_INFINITY:s.drawingBufferHeight/n.camera.frustum.sseDenominator,i.z=c,h&&(i.w=d.tileset.timeSinceLoad),i}};const iz=new H;const oz={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},rz={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};const sz="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function az(e,t){const n=/attributes\.(\w+)/g;let i=n.exec(e);for(;null!==i;){const o=i[1];-1===t.indexOf(o)&&t.push(o),i=n.exec(e)}}const cz=nz,lz={name:"PrimitiveOutlinePipelineStage",process:function(e,t,n){const i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,su.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");const r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:Zf.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",su.FRAGMENT);const a=JP.createTexture(n.context);o.model_outlineTexture=function(){return a};const c=e.model;i.addUniform("vec4","model_outlineColor",su.FRAGMENT),o.model_outlineColor=function(){return c.outlineColor},i.addUniform("bool","model_showOutline",su.FRAGMENT),o.model_showOutline=function(){return c.showOutline},i.addVertexLines("void primitiveOutlineStage() {\n v_outlineCoordinates = a_outlineCoordinates;\n}\n"),i.addFragmentLines("void primitiveOutlineStage(inout czm_modelMaterial material) {\n if (!model_showOutline) {\n return;\n }\n\n float outlineX = \n texture(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;\n float outlineY = \n texture(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;\n float outlineZ = \n texture(model_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r;\n float outlineness = max(outlineX, max(outlineY, outlineZ));\n\n material.diffuse = mix(material.diffuse, model_outlineColor.rgb, model_outlineColor.a * outlineness);\n}\n\n")}},uz=lz,dz={name:"PrimitiveStatisticsPipelineStage",_countGeometry:hz,_count2DPositions:pz,_countMorphTargetAttributes:fz,_countMaterialTextures:mz,_countFeatureIdTextures:_z,_countBinaryMetadata:gz};function hz(e,t){const n=D(t.indices)?t.indices.count:xC.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===Vr.POINTS?e.pointsLength+=n:Vr.isTriangles(i)&&(e.trianglesLength+=function(e,t){switch(e){case Vr.TRIANGLES:return t/3;case Vr.TRIANGLE_STRIP:case Vr.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}(i,n));const o=t.attributes,r=o.length;for(let c=0;c<r;c++){const t=o[c];if(D(t.buffer)){const n=D(t.typedArray);e.addBuffer(t.buffer,n)}}const s=t.outlineCoordinates;if(D(s)&&D(s.buffer)){const t=!1;e.addBuffer(s.buffer,t)}const a=t.indices;if(D(a)&&D(a.buffer)){const t=D(a.typedArray);e.addBuffer(a.buffer,t)}}function pz(e,t){const n=t.positionBuffer2D;if(D(n)){const t=!0;e.addBuffer(n,t)}}function fz(e,t){const n=t.morphTargets;if(!D(n))return;const i=n.length;for(let o=0;o<i;o++){const t=n[o].attributes,i=t.length;for(let n=0;n<i;n++){const i=t[n];D(i.buffer)&&e.addBuffer(i.buffer,false)}}}function mz(e,t){const n=function(e){const t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;D(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture));return n}(t),i=n.length;for(let o=0;o<i;o++){const t=n[o];D(t)&&D(t.texture)&&e.addTexture(t.texture)}}function _z(e,t){const n=t.length;for(let i=0;i<n;i++){const n=t[i];if(n instanceof UC.FeatureIdTexture){const t=n.textureReader;D(t.texture)&&e.addTexture(t.texture)}}}function gz(e,t){const n=t.structuralMetadata;D(n)&&(!function(e,t){const n=t.propertyTextures;if(!D(n))return;const i=n.length;for(let o=0;o<i;o++){const t=n[o].properties;for(const n in t)if(t.hasOwnProperty(n)){const i=t[n].textureReader;D(i.texture)&&e.addTexture(i.texture)}}}(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);const i=t.featureTables;if(!D(i))return;const o=i.length;for(let r=0;r<o;r++){const t=i[r];e.addBatchTexture(t.batchTexture)}}dz.process=function(e,t,n){const i=e.model,o=i.statistics;hz(o,t),pz(o,e.runtimePrimitive),fz(o,t),mz(o,t.material),_z(o,t.featureIds),gz(o,i)};const yz=dz,bz=new ve,vz=new ve,Az={name:"SceneMode2DPipelineStage"};Az.process=function(e,t,n){const i=xC.getAttributeBySemantic(t,EC.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=ve.multiplyTransformation(s,a,bz),l=function(e,t,n){const i=ve.multiplyByPoint(t,e.positionMin,Tz),o=QR.computeActualWgs84Position(n,i,i),r=ve.multiplyByPoint(t,e.positionMax,wz),s=QR.computeActualWgs84Position(n,r,r);return $u.fromCornerPoints(o,s,new $u)}(e,c,n),u=e.runtimePrimitive;u.boundingSphere2D=l;if(D(e.runtimeNode.node.instances))return;if(D(i.typedArray)){const e=function(e,t,n,i){const o=ti(i);o.mode=gl.COLUMBUS_VIEW;const r=n.center,s=function(e,t,n,i){let o;o=D(e.quantization)?function(e,t){const n=e.length,i=new Float32Array(n),o=t.quantizedVolumeOffset,r=t.quantizedVolumeStepSize;for(let s=0;s<n;s+=3){const t=H.fromArray(e,s,Ez),n=H.multiplyComponents(t,r,t),a=H.add(n,o,n);i[s]=a.x,i[s+1]=a.y,i[s+2]=a.z}return i}(e.typedArray,e.quantization):e.typedArray.slice();const r=e.byteOffset/Float32Array.BYTES_PER_ELEMENT,s=o.length,a=D(e.byteStride)?e.byteStride/Float32Array.BYTES_PER_ELEMENT:3;for(let c=r;c<s;c+=a){const e=H.fromArray(o,c,Ez);if(isNaN(e.x)||isNaN(e.y)||isNaN(e.z))continue;const r=ve.multiplyByPoint(t,e,e),s=QR.computeActualWgs84Position(i,r,r),a=H.subtract(s,n,s);o[c]=a.x,o[c+1]=a.y,o[c+2]=a.z}return o}(e,t,r,o),a=Ye.createVertexBuffer({context:i.context,typedArray:s,usage:qe.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}(i,c,l,n);u.positionBuffer2D=e,r._modelResources.push(e),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,su.VERTEX),o.addUniform("mat4","u_modelView2D",su.VERTEX);const d=ve.fromTranslation(l.center,new ve),h=n.context,p={u_modelView2D:function(){return ve.multiplyTransformation(h.uniformState.view,d,vz)}};e.uniformMap=ni(p,e.uniformMap)};const Tz=new H,wz=new H;const Ez=new H;const xz=Az,Sz={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};Sz.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,su.VERTEX),function(e,t){e.addFunction(Sz.FUNCTION_ID_GET_SKINNING_MATRIX,Sz.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,su.VERTEX);const n="mat4 skinnedMatrix = mat4(0);";let i,o;e.addFunctionLines(Sz.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);const r=["x","y","z","w"],s=function(e){let t=-1;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const e=n[o];(e.semantic===EC.JOINTS||e.semantic===EC.WEIGHTS)&&(t=Math.max(t,e.setIndex))}return t}(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){const t=r[o],n=`skinnedMatrix += a_weights_${i}.${t} * u_jointMatrices[int(a_joints_${i}.${t})];`;e.addFunctionLines(Sz.FUNCTION_ID_GET_SKINNING_MATRIX,[n])}const a="return skinnedMatrix;";e.addFunctionLines(Sz.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}(n,t);const i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,su.VERTEX),n.addVertexLines("void skinningStage(inout ProcessedAttributes attributes) \n{\n mat4 skinningMatrix = getSkinningMatrix();\n mat3 skinningMatrixMat3 = mat3(skinningMatrix);\n\n vec4 positionMC = vec4(attributes.positionMC, 1.0);\n attributes.positionMC = vec3(skinningMatrix * positionMC);\n\n #ifdef HAS_NORMALS\n vec3 normalMC = attributes.normalMC;\n attributes.normalMC = skinningMatrixMat3 * normalMC;\n #endif\n\n #ifdef HAS_TANGENTS\n vec3 tangentMC = attributes.tangentMC;\n attributes.tangentMC = skinningMatrixMat3 * tangentMC;\n #endif\n}");const r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=ni(r,e.uniformMap)};const Cz=Sz,Iz={name:"VerticalExaggerationPipelineStage"},Oz=new kt;Iz.process=function(e,t,n){const{shaderBuilder:i,uniformMap:o}=e;i.addVertexLines("void verticalExaggerationStage(\n inout ProcessedAttributes attributes\n) {\n // Compute the distance from the camera to the local center of curvature.\n vec4 vertexPositionENU = czm_modelToEnu * vec4(attributes.positionMC, 1.0);\n vec2 vertexAzimuth = normalize(vertexPositionENU.xy);\n // Curvature = 1 / radius of curvature.\n float azimuthalCurvature = dot(vertexAzimuth * vertexAzimuth, czm_eyeEllipsoidCurvature);\n float eyeToCenter = 1.0 / azimuthalCurvature + czm_eyeHeight;\n\n // Compute the approximate ellipsoid normal at the vertex position.\n // Uses a circular approximation for the Earth curvature along the geodesic.\n vec3 vertexPositionEC = (czm_modelView * vec4(attributes.positionMC, 1.0)).xyz;\n vec3 centerToVertex = eyeToCenter * czm_eyeEllipsoidNormalEC + vertexPositionEC;\n vec3 vertexNormal = normalize(centerToVertex);\n\n // Estimate the (sine of the) angle between the camera direction and the vertex normal\n float verticalDistance = dot(vertexPositionEC, czm_eyeEllipsoidNormalEC);\n float horizontalDistance = length(vertexPositionEC - verticalDistance * czm_eyeEllipsoidNormalEC);\n float sinTheta = horizontalDistance / (eyeToCenter + verticalDistance);\n bool isSmallAngle = clamp(sinTheta, 0.0, 0.05) == sinTheta;\n\n // Approximate the change in height above the ellipsoid, from camera to vertex position.\n float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC, vertexNormal);\n float smallAngleVersine = 0.5 * sinTheta * sinTheta;\n float versine = isSmallAngle ? smallAngleVersine : exactVersine;\n float dHeight = dot(vertexPositionEC, vertexNormal) - eyeToCenter * versine;\n float vertexHeight = czm_eyeHeight + dHeight;\n\n // Transform the approximate vertex normal to model coordinates.\n vec3 vertexNormalMC = (czm_inverseModelView * vec4(vertexNormal, 0.0)).xyz;\n vertexNormalMC = normalize(vertexNormalMC);\n\n // Compute the exaggeration and apply it along the approximate vertex normal.\n float stretch = u_verticalExaggerationAndRelativeHeight.x;\n float shift = u_verticalExaggerationAndRelativeHeight.y;\n float exaggeration = (vertexHeight - shift) * (stretch - 1.0);\n attributes.positionMC += exaggeration * vertexNormalMC;\n}\n"),i.addDefine("HAS_VERTICAL_EXAGGERATION",void 0,su.VERTEX),i.addUniform("vec2","u_verticalExaggerationAndRelativeHeight",su.VERTEX),o.u_verticalExaggerationAndRelativeHeight=function(){return kt.fromElements(n.verticalExaggeration,n.verticalExaggerationRelativeHeight,Oz)}};const Dz=Iz,Pz={};Pz.createWireframeIndices=function(e,t,n){const i=D(n);return e===Vr.TRIANGLES?i?function(e,t){const n=t.length,i=je.createTypedArray(e,2*n);let o=0;for(let r=0;r<n;r+=3){const e=t[r],n=t[r+1],s=t[r+2];i[o++]=e,i[o++]=n,i[o++]=n,i[o++]=s,i[o++]=s,i[o++]=e}return i}(t,n):function(e){const t=je.createTypedArray(e,2*e),n=e;let i=0;for(let o=0;o<n;o+=3)t[i++]=o,t[i++]=o+1,t[i++]=o+1,t[i++]=o+2,t[i++]=o+2,t[i++]=o;return t}(t):e===Vr.TRIANGLE_STRIP?i?function(e,t){const n=t.length-2,i=2+4*n,o=je.createTypedArray(e,i);let r=0;o[r++]=t[0],o[r++]=t[1];for(let s=0;s<n;s++){const e=t[s],n=t[s+1],i=t[s+2];o[r++]=n,o[r++]=i,o[r++]=i,o[r++]=e}return o}(t,n):function(e){const t=e-2,n=2+4*t,i=je.createTypedArray(e,n);let o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=r;return i}(t):e===Vr.TRIANGLE_FAN?i?function(e,t){const n=t.length-2,i=2+4*n,o=je.createTypedArray(e,i);let r=0;const s=t[0];o[r++]=s,o[r++]=t[1];for(let a=0;a<n;a++){const e=t[a+1],n=t[a+2];o[r++]=e,o[r++]=n,o[r++]=n,o[r++]=s}return o}(t,n):function(e){const t=e-2,n=2+4*t,i=je.createTypedArray(e,n);let o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=0;return i}(t):void 0},Pz.getWireframeIndicesCount=function(e,t){if(e===Vr.TRIANGLES)return 2*t;if(e===Vr.TRIANGLE_STRIP||e===Vr.TRIANGLE_FAN){return 2+4*(t-2)}return t};const Nz=Pz,Rz={name:"WireframePipelineStage"};Rz.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,su.FRAGMENT);const i=e.model,o=function(e,t,n){const i=xC.getAttributeBySemantic(e,EC.POSITION),o=i.count,r=n.context.webgl2;let s;if(D(t)){const e=t.buffer,n=t.count;if(D(e)&&r){s=e.sizeInBytes===n?new Uint8Array(n):je.createTypedArray(o,n),e.getBufferData(s)}else s=t.typedArray}const a=e.primitiveType,c=Nz.createWireframeIndices(a,o,s),l=je.fromSizeInBytes(c.BYTES_PER_ELEMENT);return Ye.createIndexBuffer({context:n.context,typedArray:c,usage:qe.STATIC_DRAW,indexDatatype:l})}(t,e.indices,n);i._pipelineResources.push(o),e.wireframeIndexBuffer=o;i.statistics.addBuffer(o,!1);const r=e.primitiveType,s=e.count;e.primitiveType=Vr.LINES,e.count=Nz.getWireframeIndicesCount(r,s)};const Lz=Rz;function Mz(e){const t=(e=M(e,M.EMPTY_OBJECT)).primitive,n=e.node,i=e.model;L.typeOf.object("options.primitive",t),L.typeOf.object("options.node",n),L.typeOf.object("options.model",i),this.primitive=t,this.node=n,this.model=i,this.pipelineStages=[],this.drawCommand=void 0,this.boundingSphere=void 0,this.boundingSphere2D=void 0,this.positionBuffer2D=void 0,this.batchLengths=void 0,this.batchOffsets=void 0,this.updateStages=[]}function Fz(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.skin",e.skin),L.typeOf.object("options.sceneGraph",e.sceneGraph),this._sceneGraph=e.sceneGraph;const t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],function(e){const t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;const i=t.joints,o=i.length,r=e.sceneGraph._runtimeNodes,s=e.joints,a=e._jointMatrices;for(let c=0;c<o;c++){const e=r[i[c].index];s.push(e);const t=Bz(e,n[c],new ve);a.push(t)}}(this)}function Bz(e,t,n){const i=ve.multiplyTransformation(e.transformToRoot,e.transform,n);return n=ve.multiplyTransformation(i,t,n)}function zz(){this.pass=void 0,this.alphaCutoff=void 0}function Uz(e){L.typeOf.object("model",e),this.shaderBuilder=new lu,this.model=e,this.uniformMap={},this.alphaOptions=new zz,this.renderStateOptions=_s.getState(_s.fromCache({depthTest:{enabled:!0,func:Gf.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}Mz.prototype.configurePipeline=function(e){const t=this.pipelineStages;t.length=0;const n=this.primitive,i=this.node,o=this.model,r=o.customShader,s=o.style,a=e.context.webgl2,c=e.mode!==gl.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,l=1!==e.verticalExaggeration,u=D(n.morphTargets)&&n.morphTargets.length>0,d=D(i.skin),h=D(r),p=!(h&&D(r.fragmentShaderText))||r.mode!==XF.REPLACE_MATERIAL,f=xC.hasQuantizedAttributes(n.attributes),m=o.debugWireframe&&Vr.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),_=o.pointCloudShading,g=D(_)&&_.attenuation,y=D(_)&&_.backFaceCulling,b=n.primitiveType===Vr.POINTS&&(D(s)||g||y),v=o._enableShowOutline&&D(n.outlineCoordinates),A=function(e,t,n){let i;if(D(t.instances)&&(i=xC.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),D(i)))return{hasFeatureIds:!0,hasPropertyTable:D(i.propertyTableId)};if(i=xC.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),D(i))return{hasFeatureIds:!0,hasPropertyTable:D(i.propertyTableId)};return{hasFeatureIds:!1,hasPropertyTable:!1}}(o,i,n),T=D(o.classificationType);c&&t.push(xz),t.push(FB),m&&t.push(Lz),T&&t.push(jF),u&&t.push($B),d&&t.push(Cz),b&&t.push(cz),f&&t.push(IB),p&&t.push(qB),t.push(iB),t.push(pB),A.hasPropertyTable&&(t.push(RB),t.push(HF),t.push(qF)),l&&t.push(Dz),h&&t.push(wB),t.push(UB),o.allowPicking&&t.push(JB),v&&t.push(uz),t.push(kF),t.push(yz)},Object.defineProperties(Fz.prototype,{skin:{get:function(){return this._skin}},sceneGraph:{get:function(){return this._sceneGraph}},inverseBindMatrices:{get:function(){return this._inverseBindMatrices}},joints:{get:function(){return this._joints}},jointMatrices:{get:function(){return this._jointMatrices}}}),Fz.prototype.updateJointMatrices=function(){const e=this._jointMatrices,t=e.length;for(let n=0;n<t;n++){const t=this.joints[n],i=this.inverseBindMatrices[n];e[n]=Bz(t,i,e[n])}};const kz={name:"ModelSilhouettePipelineStage",silhouettesLength:0,process:function(e,t,n){D(t._silhouetteId)||(t._silhouetteId=++kz.silhouettesLength);const i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,su.BOTH),i.addVertexLines("void silhouetteStage(in ProcessedAttributes attributes, inout vec4 positionClip) {\n #ifdef HAS_NORMALS\n if(model_silhouettePass) {\n vec3 normal = normalize(czm_normal3D * attributes.normalMC);\n normal.x *= czm_projection[0][0];\n normal.y *= czm_projection[1][1];\n positionClip.xy += normal.xy * positionClip.w * model_silhouetteSize * czm_pixelRatio / czm_viewport.z;\n }\n #endif\n}\n"),i.addFragmentLines("void silhouetteStage(inout vec4 color) {\n if(model_silhouettePass) {\n color = czm_gammaCorrect(model_silhouetteColor);\n }\n}"),i.addUniform("vec4","model_silhouetteColor",su.FRAGMENT),i.addUniform("float","model_silhouetteSize",su.VERTEX),i.addUniform("bool","model_silhouettePass",su.BOTH);const o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=ni(o,e.uniformMap),e.hasSilhouette=!0}},Vz=kz,Hz={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection",process:function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,su.FRAGMENT),i.addFragmentLines("void modelSplitterStage()\n{\n // Don't split when rendering the shadow map, because it is rendered from\n // the perspective of a totally different camera.\n#ifndef SHADOW_MAP\n if (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;\n if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;\n#endif\n}\n");const o={};i.addUniform("float",Hz.SPLIT_DIRECTION_UNIFORM_NAME,su.FRAGMENT),o[Hz.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=ni(o,e.uniformMap)}},Gz=Hz;function jz(e,t){L.typeOf.object("modelRenderResources",e),L.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=ti(e.uniformMap),this.alphaOptions=ti(e.alphaOptions),this.renderStateOptions=ti(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0}function Wz(e){e=M(e,M.EMPTY_OBJECT),this.lightingModel=M(e.lightingModel,BB.UNLIT)}function qz(e,t){L.typeOf.object("nodeRenderResources",e),L.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=ti(e.uniformMap),this.alphaOptions=ti(e.alphaOptions),this.renderStateOptions=ti(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const n=t.primitive;this.count=D(n.indices)?n.indices.count:xC.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;const i=xC.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=H.clone(i.min,new H),this.positionMax=H.clone(i.max,new H),this.boundingSphere=$u.fromCornerPoints(this.positionMin,this.positionMax,new $u),this.lightingOptions=new Wz,this.pickId=void 0}function Yz(e){const t=(e=M(e,M.EMPTY_OBJECT)).modelComponents;L.typeOf.object("options.model",e.model),L.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=ve.clone(ve.IDENTITY),this._computedModelMatrix2D=ve.clone(ve.IDENTITY),this._axisCorrectionMatrix=xC.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new ve),this._runtimeArticulations={},function(e){const t=e._components,n=t.scene,i=e._model.modelMatrix;Xz(e,i);const o=t.articulations,r=o.length,s=e._runtimeArticulations;for(let _=0;_<r;_++){const t=new KM({articulation:o[_],sceneGraph:e});s[t.name]=t}const a=t.nodes,c=a.length;e._runtimeNodes=new Array(c);const l=n.nodes.length,u=ve.IDENTITY;for(let _=0;_<l;_++){const t=$z(e,n.nodes[_],u);e._rootNodes.push(t)}const d=t.skins,h=e._runtimeSkins,p=d.length;for(let _=0;_<p;_++){const t=d[_];h.push(new Fz({skin:t,sceneGraph:e}))}const f=e._skinnedNodes,m=f.length;for(let _=0;_<m;_++){const t=f[_],n=e._runtimeNodes[t],i=a[t].skin.index;n._runtimeSkin=h[i],n.updateJointMatrices()}e.applyArticulations()}(this)}function Xz(e,t){const n=e._components,i=e._model;e._computedModelMatrix=ve.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=ve.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=ve.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}Object.defineProperties(Yz.prototype,{components:{get:function(){return this._components}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},axisCorrectionMatrix:{get:function(){return this._axisCorrectionMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}});const Qz=new H;function $z(e,t,n){const i=[],o=xC.getNodeTransform(t),r=t.children.length;for(let u=0;u<r;u++){const r=$z(e,t.children[u],ve.multiplyTransformation(n,o,new ve));i.push(r)}const s=new BF({node:t,transform:o,transformToRoot:n,children:i,sceneGraph:e}),a=t.primitives.length;for(let u=0;u<a;u++)s.runtimePrimitives.push(new Mz({primitive:t.primitives[u],node:t,model:e._model}));const c=t.index;e._runtimeNodes[c]=s,D(t.skin)&&e._skinnedNodes.push(c);const l=t.name;if(D(l)){const t=e._model,n=new aF(t,s);t._nodesByName[l]=n}return c}const Kz=new H,Zz=new H,Jz=new H,eU=new H;function tU(e,t,n,i,o){if(n&&!t.show)return;const r=t.children.length;for(let c=0;c<r;c++){tU(e,t.getChild(c),n,i,o)}const s=t.runtimePrimitives,a=s.length;for(let c=0;c<a;c++){i(s[c],o)}}function nU(e,t,n,i){const o=e._rootNodes,r=o.length;for(let s=0;s<r;s++){const r=o[s];tU(e,e._runtimeNodes[r],t,n,i)}}Yz.prototype.buildDrawCommands=function(e){const t=this._model,n=new Uz(t);t.statistics.clear(),this.configurePipeline(e);const i=this.modelPipelineStages;let o,r,s;for(o=0;o<i.length;o++){i[o].process(n,t,e)}const a=H.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Kz),c=H.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Zz);for(o=0;o<this._runtimeNodes.length;o++){const t=this._runtimeNodes[o];if(!D(t))continue;t.configurePipeline();const i=t.pipelineStages,l=new jz(n,t);for(r=0;r<i.length;r++){i[r].process(l,t.node,e)}const u=t.computedTransform;for(r=0;r<t.runtimePrimitives.length;r++){const n=t.runtimePrimitives[r];n.configurePipeline(e);const i=n.pipelineStages,o=new qz(l,n);for(s=0;s<i.length;s++){i[s].process(o,n.primitive,e)}n.boundingSphere=$u.clone(o.boundingSphere,new $u);const d=ve.multiplyByPoint(u,o.positionMin,Jz),h=ve.multiplyByPoint(u,o.positionMax,eU);H.minimumByComponent(a,d,a),H.maximumByComponent(c,h,c);const p=kM(o,e);n.drawCommand=p}}this._boundingSphere=$u.fromCornerPoints(a,c,new $u),this._boundingSphere=$u.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=$u.transform(this._boundingSphere,this._components.transform,this._boundingSphere),t._boundingSphere=$u.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale},Yz.prototype.configurePipeline=function(e){const t=this.modelPipelineStages;t.length=0;const n=this._model,i=e.fog.enabled&&e.fog.renderable;D(n.color)&&t.push(tF),D(n.classificationType)||(n.imageBasedLighting.enabled&&t.push(qM),n.isClippingEnabled()&&t.push(oF),n.isClippingPolygonsEnabled()&&t.push(sF),n.hasSilhouette(e)&&t.push(Vz),D(n.splitDirection)&&n.splitDirection!==$R.NONE&&t.push(Gz),yM.is3DTiles(n.type)&&t.push(HM),i&&t.push(jM))},Yz.prototype.update=function(e,t){let n,i,o;for(n=0;n<this._runtimeNodes.length;n++){const r=this._runtimeNodes[n];if(!D(r))continue;for(i=0;i<r.updateStages.length;i++){r.updateStages[i].update(r,this,e)}const s=e.mode!==gl.SCENE3D&&this._model._projectTo2D;for(t&&!s&&this.updateJointMatrices(),i=0;i<r.runtimePrimitives.length;i++){const e=r.runtimePrimitives[i];for(o=0;o<e.updateStages.length;o++){e.updateStages[o].update(e,this)}}}},Yz.prototype.updateModelMatrix=function(e,t){Xz(this,e),t.mode!==gl.SCENE3D&&function(e,t){const n=e._computedModelMatrix,i=ve.getTranslation(n,Qz);if(H.equals(i,H.ZERO)){const i=e.boundingSphere.center,o=Cr.wgs84To2DModelMatrix(t.mapProjection,i,e._computedModelMatrix2D);e._computedModelMatrix2D=ve.multiply(o,n,e._computedModelMatrix2D)}else e._computedModelMatrix2D=Cr.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);e._boundingSphere2D=$u.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}(this,t);const n=this._rootNodes;for(let i=0;i<n.length;i++){this._runtimeNodes[n[i]]._transformDirty=!0}},Yz.prototype.updateJointMatrices=function(){const e=this._skinnedNodes,t=e.length;for(let n=0;n<t;n++){const t=e[n];this._runtimeNodes[t].updateJointMatrices()}};const iU={backFaceCulling:void 0};function oU(e,t){e.drawCommand.backFaceCulling=t.backFaceCulling}Yz.prototype.updateBackFaceCulling=function(e){const t=iU;t.backFaceCulling=e,nU(this,!1,oU,t)};const rU={shadowMode:void 0};function sU(e,t){e.drawCommand.shadows=t.shadowMode}Yz.prototype.updateShadows=function(e){const t=rU;t.shadowMode=e,nU(this,!1,sU,t)};const aU={debugShowBoundingVolume:void 0};function cU(e,t){e.drawCommand.debugShowBoundingVolume=t.debugShowBoundingVolume}Yz.prototype.updateShowBoundingVolume=function(e){const t=aU;t.debugShowBoundingVolume=e,nU(this,!1,cU,t)};const lU=[],uU={frameState:void 0,hasSilhouette:void 0};function dU(e,t){const n=t.frameState,i=t.hasSilhouette,o=n.passes,r=lU,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}function hU(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap=new bu}Yz.prototype.pushDrawCommands=function(e){const t=lU;t.length=0;const n=uU;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,nU(this,!0,dU,n),e.commandList.push.apply(e.commandList,t)},Yz.prototype.setArticulationStage=function(e,t){const n=e.split(" ");if(2!==n.length)return;const i=n[0],o=n[1],r=this._runtimeArticulations[i];D(r)&&r.setArticulationStage(o,t)},Yz.prototype.applyArticulations=function(){const e=this._runtimeArticulations;for(const t in e)if(e.hasOwnProperty(t)){e[t].apply()}},Object.defineProperties(hU.prototype,{batchTexturesByteLength:{get:function(){const e=this._batchTextureIdMap.length,t=this._batchTextureIdMap.values;let n=0;for(let i=0;i<e;i++)n+=t[i].byteLength;return n}}}),hU.prototype.clear=function(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap.removeAll()},hU.prototype.addBuffer=function(e,t){if(L.typeOf.object("buffer",e),L.typeOf.bool("hasCpuCopy",t),!this._bufferIdSet.hasOwnProperty(e._id)){const n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0},hU.prototype.addTexture=function(e){L.typeOf.object("texture",e),this._textureIdSet.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes),this._textureIdSet[e._id]=!0},hU.prototype.addBatchTexture=function(e){L.typeOf.object("batchTexture",e),this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};const pU={},fU=Uint32Array.BYTES_PER_ELEMENT;pU.parse=function(e,t){t=M(t,0),L.defined("arrayBuffer",e);const n=new Uint8Array(e),i=new DataView(e);t+=fU;const o=i.getUint32(t,!0);if(1!==o)throw new be(`Only Point Cloud tile version 1 is supported. Version ${o} is not.`);t+=fU,t+=fU;const r=i.getUint32(t,!0);if(0===r)throw new be("Feature table must have a byte length greater than zero");t+=fU;const s=i.getUint32(t,!0);t+=fU;const a=i.getUint32(t,!0);t+=fU;const c=i.getUint32(t,!0),l=Ew(n,t+=fU,r);t+=r;const u=new Uint8Array(e,t,s);let d,h;t+=s,a>0&&(d=Ew(n,t,a),t+=a,c>0&&(h=new Uint8Array(e,t,c),t+=c));const p=new eL(l,u),f=p.getGlobalProperty("POINTS_LENGTH");if(p.featuresLength=f,!D(f))throw new be("Feature table global property: POINTS_LENGTH must be defined");let m=p.getGlobalProperty("RTC_CENTER",Ca.FLOAT,3);D(m)&&(m=H.unpack(m));const _=function(e,t){const n=e.json;let i,o,r;const s=D(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=D(t)&&D(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;D(a)&&(r=a.properties);let c,l,u,d,h,p;if(D(s)){o=s.properties;const t=s.byteOffset,n=s.byteLength;if(!D(o)||!D(t)||!D(n))throw new be("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(t,t+n),c=D(o.POSITION),l=D(o.RGB)||D(o.RGBA),u=D(o.NORMAL),d=D(o.BATCH_ID),h=D(o.RGBA)}D(i)&&(p={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:ni(o,r),dequantizeInShader:!0});return{draco:p,hasPositions:c,hasColors:l,isTranslucent:h,hasNormals:u,hasBatchIds:d}}(p,d);if(_.rtcCenter=m,_.pointsLength=f,!_.hasPositions){const e=function(e){const t=e.json;let n;if(D(t.POSITION))return n=e.getPropertyArray("POSITION",Ca.FLOAT,3),{name:EC.POSITION,semantic:EC.POSITION,typedArray:n,isQuantized:!1,componentDatatype:Ca.FLOAT,type:Zf.VEC3};if(D(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",Ca.UNSIGNED_SHORT,3);const t=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Ca.FLOAT,3);if(!D(t))throw new be("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const i=65535,o=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Ca.FLOAT,3);if(!D(o))throw new be("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:EC.POSITION,semantic:EC.POSITION,typedArray:n,isQuantized:!0,componentDatatype:Ca.FLOAT,type:Zf.VEC3,quantizedRange:i,quantizedVolumeOffset:H.unpack(o),quantizedVolumeScale:H.unpack(t),quantizedComponentDatatype:Ca.UNSIGNED_SHORT,quantizedType:Zf.VEC3}}}(p);_.positions=e,_.hasPositions=_.hasPositions||D(e)}if(!_.hasPositions)throw new be("Either POSITION or POSITION_QUANTIZED must be defined.");if(!_.hasNormals){const e=function(e){const t=e.json;let n;if(D(t.NORMAL))return n=e.getPropertyArray("NORMAL",Ca.FLOAT,3),{name:EC.NORMAL,semantic:EC.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:Ca.FLOAT,type:Zf.VEC3};if(D(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",Ca.UNSIGNED_BYTE,2);const t=8;return{name:EC.NORMAL,semantic:EC.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<t)-1,quantizedType:Zf.VEC2,quantizedComponentDatatype:Ca.UNSIGNED_BYTE,componentDatatype:Ca.FLOAT,type:Zf.VEC3}}return}(p);_.normals=e,_.hasNormals=_.hasNormals||D(e)}if(!_.hasColors){const e=function(e){const t=e.json;let n;if(D(t.RGBA))return n=e.getPropertyArray("RGBA",Ca.UNSIGNED_BYTE,4),{name:EC.COLOR,semantic:EC.COLOR,setIndex:0,typedArray:n,componentDatatype:Ca.UNSIGNED_BYTE,type:Zf.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(D(t.RGB))return n=e.getPropertyArray("RGB",Ca.UNSIGNED_BYTE,3),{name:"COLOR",semantic:EC.COLOR,setIndex:0,typedArray:n,componentDatatype:Ca.UNSIGNED_BYTE,type:Zf.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(D(t.RGB565))return n=e.getPropertyArray("RGB565",Ca.UNSIGNED_SHORT,1),{name:"COLOR",semantic:EC.COLOR,setIndex:0,typedArray:n,componentDatatype:Ca.FLOAT,type:Zf.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(D(t.CONSTANT_RGBA)){const t=e.getGlobalProperty("CONSTANT_RGBA",Ca.UNSIGNED_BYTE,4),n=t[3],i=Ot.fromBytes(t[0],t[1],t[2],n),o=n<255;return{name:EC.COLOR,semantic:EC.COLOR,setIndex:0,constantColor:i,componentDatatype:Ca.FLOAT,type:Zf.VEC4,isQuantized:!1,isTranslucent:o}}return}(p);_.colors=e,_.hasColors=_.hasColors||D(e),_.hasConstantColor=D(_.constantColor),_.isTranslucent=D(e)&&e.isTranslucent}if(!_.hasBatchIds){const e=function(e){const t=e.json;if(D(t.BATCH_ID)){const t=e.getPropertyArray("BATCH_ID",Ca.UNSIGNED_SHORT,1);return{name:EC.FEATURE_ID,semantic:EC.FEATURE_ID,setIndex:0,typedArray:t,componentDatatype:Ca.fromTypedArray(t),type:Zf.SCALAR}}return}(p);_.batchIds=e,_.hasBatchIds=_.hasBatchIds||D(e)}if(_.hasBatchIds){const e=p.getGlobalProperty("BATCH_LENGTH");if(!D(e))throw new be("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");_.batchLength=e}return D(h)&&(h=new Uint8Array(h),_.batchTableJson=d,_.batchTableBinary=h),_};const mU=pU,_U=UC.Components,gU=UC.Scene,yU=UC.Node,bU=UC.Primitive,vU=UC.Attribute,AU=UC.Quantization,TU=UC.FeatureIdAttribute,wU=UC.Material,EU=UC.MetallicRoughness;function xU(e){const t=(e=M(e,M.EMPTY_OBJECT)).arrayBuffer,n=M(e.byteOffset,0);L.typeOf.object("options.arrayBuffer",t),this._arrayBuffer=t,this._byteOffset=n,this._loadAttributesFor2D=M(e.loadAttributesFor2D,!1),this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=void 0,this._error=void 0,this._state=rS.UNLOADED,this._buffers=[],this._components=void 0,this._transform=ve.IDENTITY}function SU(e){switch(e){case 1:return"SCALAR";case 2:return"VEC2";case 3:return"VEC3";case 4:return"VEC4";default:throw new P("componentsPerAttribute must be a number from 1-4")}}function CU(e){switch(e){case Me.BYTE:return"BYTE";case Me.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case Me.SHORT:return"SHORT";case Me.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case Me.INT:return"INT";case Me.UNSIGNED_INT:return"UNSIGNED_INT";case Me.DOUBLE:return"DOUBLE";case Me.FLOAT:return"FLOAT";default:throw new P("value is not a valid WebGL constant")}}function IU(e,t,n){let i,o=t.typedArray;if(t.octEncoded&&(i=new AU,i.octEncoded=t.octEncoded,i.octEncodedZXY=t.octEncodedZXY,i.normalizationRange=t.quantizedRange,i.type=t.quantizedType,i.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){i=new AU;const e=t.quantizedRange;i.normalizationRange=e,i.quantizedVolumeOffset=H.ZERO;const n=t.quantizedVolumeScale;i.quantizedVolumeDimensions=n,i.quantizedVolumeStepSize=H.divideByScalar(n,e,new H),i.componentDatatype=t.quantizedComponentDatatype,i.type=t.quantizedType}const r=new vU;if(r.name=t.name,r.semantic=t.semantic,r.setIndex=t.setIndex,r.componentDatatype=t.componentDatatype,r.type=t.type,r.normalized=M(t.normalized,!1),r.min=t.min,r.max=t.max,r.quantization=i,t.isRGB565&&(o=sm.decodeRGB565(o)),D(t.constantColor)){const e=new Array(4);r.constant=Ot.pack(t.constantColor,e)}else{const t=Ye.createVertexBuffer({typedArray:o,context:n,usage:qe.STATIC_DRAW});t.vertexArrayDestroyable=!1,e._buffers.push(t),r.buffer=t}const s=e._loadAttributesFor2D;return r.semantic===EC.POSITION&&s&&(r.typedArray=o),r}let OU,DU;D(Object.create)&&(xU.prototype=Object.create(oS.prototype),xU.prototype.constructor=xU),Object.defineProperties(xU.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}}),xU.prototype.load=function(){if(D(this._promise))return this._promise;this._parsedContent=mU.parse(this._arrayBuffer,this._byteOffset),this._state=rS.PROCESSING,this._promise=Promise.resolve(this)},xU.prototype.process=function(e){if(D(this._error)){const e=this._error;throw this._error=void 0,e}if(this._state===rS.READY)return!0;if(this._state===rS.PROCESSING){if(D(this._decodePromise))return!1;this._decodePromise=function(e,t){const n=e._parsedContent.draco;let i;i=D(n)?uS.decodePointCloud(n,t):Promise.resolve();if(!D(i))return;return e._decodePromise=i,i.then((function(i){if(!e.isDestroyed())return D(i)&&function(e,t,n){e._state=rS.READY;const i=e._parsedContent;let o;if(D(n.POSITION)){if(o={name:"POSITION",semantic:EC.POSITION,typedArray:n.POSITION.array,componentDatatype:Ca.FLOAT,type:Zf.VEC3,isQuantized:!1},D(n.POSITION.data.quantization)){const e=n.POSITION.data.quantization,t=e.range,i=H.fromElements(t,t,t),r=H.unpack(e.minValues),s=(1<<e.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=s,o.quantizedVolumeOffset=r,o.quantizedVolumeScale=i,o.quantizedComponentDatatype=s<=255?Ca.UNSIGNED_BYTE:Ca.UNSIGNED_SHORT,o.quantizedType=Zf.VEC3}i.positions=o}if(D(n.NORMAL)){if(o={name:"NORMAL",semantic:EC.NORMAL,typedArray:n.NORMAL.array,componentDatatype:Ca.FLOAT,type:Zf.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},D(n.NORMAL.data.quantization)){const e=(1<<n.NORMAL.data.quantization.quantizationBits)-1;o.quantizedRange=e,o.octEncoded=!0,o.octEncodedZXY=!0,o.quantizedComponentDatatype=Ca.UNSIGNED_BYTE,o.quantizedType=Zf.VEC2}i.normals=o}D(n.RGBA)?i.colors={name:"COLOR",semantic:EC.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:Ca.UNSIGNED_BYTE,type:Zf.VEC4,normalized:!0,isTranslucent:!0}:D(n.RGB)&&(i.colors={name:"COLOR",semantic:EC.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:Ca.UNSIGNED_BYTE,type:Zf.VEC3,normalized:!0,isTranslucent:!1});if(D(n.BATCH_ID)){const e=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:EC.FEATURE_ID,setIndex:0,typedArray:e,componentDatatype:Ca.fromTypedArray(e),type:Zf.SCALAR}}let r=i.batchTableJson;const s=t.batchTableProperties;for(const a in s)if(s.hasOwnProperty(a)){const e=n[a];D(r)||(r={}),i.hasDracoBatchTable=!0;const t=e.data;r[a]={byteOffset:t.byteOffset,type:SU(t.componentsPerAttribute),componentType:CU(t.componentDatatype),typedArray:e.array}}i.batchTableJson=r}(e,n,i),function(e,t){const n=e._parsedContent,i=new EU;i.metallicFactor=0,i.roughnessFactor=.9;const o=new wU;o.metallicRoughness=i;const r=n.colors;D(r)&&r.isTranslucent&&(o.alphaMode=RC.BLEND);const s=!D(n.normals);o.unlit=s;const a=new bU;if(a.attributes=function(e,t,n){const i=[];let o;const r=t.positions;D(r)&&(!function(e){const t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=function(e){if(!D(DU)){OU=new B(0),DU=new Array(e);for(let t=0;t<e;++t)DU[t]=OU.random()}return DU}(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE;let c,l,u,d=H.fromElements(s,s,s,PU),h=H.fromElements(a,a,a,NU);if(e.isQuantized)d=H.ZERO,h=e.quantizedVolumeScale;else for(c=0;c<o;++c)l=Math.floor(r[c]*i),u=H.unpack(t,3*l,RU),H.minimumByComponent(d,u,d),H.maximumByComponent(h,u,h);e.min=H.clone(d),e.max=H.clone(h)}(r),o=IU(e,r,n),o.count=t.pointsLength,i.push(o));D(t.normals)&&(o=IU(e,t.normals,n),i.push(o));D(t.colors)?(o=IU(e,t.colors,n),i.push(o)):(o=IU(e,LU,n),i.push(o));D(t.batchIds)&&(o=IU(e,t.batchIds,n),i.push(o));return i}(e,n,t),a.primitiveType=Vr.POINTS,a.material=o,D(n.batchIds)){const e=new TU;e.propertyTableId=0,e.setIndex=0,e.positionalLabel="featureId_0",a.featureIds.push(e)}const c=new yU;c.index=0,c.primitives=[a];const l=new gU;l.nodes=[c],l.upAxis=gw.Z,l.forwardAxis=gw.X;const u=new _U;u.scene=l,u.nodes=[c];const d=[];u.structuralMetadata=function(e,t){const n=e.batchLength,i=e.pointsLength,o=e.batchTableBinary,r=!D(e.batchIds);if(D(o)||e.hasDracoBatchTable){return nL({count:M(n,i),batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t})}return new VP({schema:{},propertyTables:[]})}(n,d),d.length>0&&function(e,t,n,i){const o=t.attributes,r=n.length;for(let s=0;s<r;s++){const t=n[s],r=Ye.createVertexBuffer({typedArray:t.typedArray,context:i,usage:qe.STATIC_DRAW});r.vertexArrayDestroyable=!1,e._buffers.push(r),t.buffer=r,t.typedArray=void 0,o.push(t)}t.propertyAttributeIds=[0]}(e,a,d,t);D(n.rtcCenter)&&(u.transform=ve.multiplyByTranslation(u.transform,n.rtcCenter,u.transform));const h=n.positions;D(h)&&h.isQuantized&&(u.transform=ve.multiplyByTranslation(u.transform,h.quantizedVolumeOffset,u.transform));e._components=u,e._parsedContent=void 0,e._arrayBuffer=void 0}(e,t),e._state=rS.READY,e})).catch((function(t){e.unload(),e._state=rS.FAILED;const n="Failed to load Draco pnts";e._error=e.getError(n,t)}))}(this,e.context)}return!1};const PU=new H,NU=new H,RU=new H;const LU={name:EC.COLOR,semantic:EC.COLOR,setIndex:0,constantColor:Ot.DARKGRAY,componentDatatype:Ca.FLOAT,type:Zf.VEC4,isQuantized:!1,isTranslucent:!1};xU.prototype.unload=function(){const e=this._buffers;for(let t=0;t<e.length;t++)e[t].destroy();e.length=0,this._components=void 0,this._parsedContent=void 0,this._arrayBuffer=void 0};const MU=new H,FU=new H,BU=new H,zU=new ve,UU=new ve,kU=new ve,VU=new Qt,HU=new $u;function GU(e,t,n,i,o,r,s,a,c,l){const u=n+t*i;if(l.x=e[u],l.y=e[u+1],l.z=e[u+2],D(o))if(o.octEncoded){if(l=sm.octDecodeInRange(l,o.normalizationRange,l),o.octEncodedZXY){const e=l.x;l.x=l.z,l.z=l.y,l.y=e}}else l=H.multiplyComponents(l,o.quantizedVolumeStepSize,l),l=H.add(l,o.quantizedVolumeOffset,l);return l=ve.multiplyByPoint(r,l,l),1!==s&&zf.getPosition(l,c,s,a,l),l}function jU(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.loader",e.loader),L.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=M(e.type,yM.GLTF),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._modelMatrix=ve.clone(this.modelMatrix),this._scale=M(e.scale,1),this._minimumPixelSize=M(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=D(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=re.clone(re.IDENTITY),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1,this._defaultTexture=void 0,this._activeAnimations=new uM(this),this._clampAnimations=M(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=Ot.clone(e.color),this._colorBlendMode=M(e.colorBlendMode,SP.HIGHLIGHT),this._colorBlendAmount=M(e.colorBlendAmount,.5);const t=M(e.silhouetteColor,Ot.RED);this._silhouetteColor=Ot.clone(t),this._silhouetteSize=M(e.silhouetteSize,0),this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=M(e.cull,!0),this._opaquePass=M(e.opaquePass,zt.OPAQUE),this._allowPicking=M(e.allowPicking,!0),this._show=M(e.show,!0),this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=M(e.featureIdLabel,"featureId_0");"number"==typeof n&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=M(e.instanceFeatureIdLabel,"instanceFeatureId_0");"number"==typeof i&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i,this._featureTables=[],this._featureTableId=void 0,this._featureTableIdDirty=!0,this._pipelineResources=[],this._modelResources=[],this._pickIds=[],this._boundingSphere=new $u,this._initialRadius=void 0,this._heightReference=M(e.heightReference,wu.NONE),this._heightDirty=this._heightReference!==wu.NONE,this._removeUpdateHeightCallback=void 0,this._verticalExaggerationOn=!1,this._clampedModelMatrix=void 0;const o=e.scene;D(o)&&D(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener((()=>{this._heightDirty=!0}))),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;const r=new OR(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;const s=e.clippingPlanes;D(s)&&void 0===s.owner?qI.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=ve.clone(ve.IDENTITY);const a=e.clippingPolygons;D(a)&&void 0===a.owner?bP.setOwner(a,this,"_clippingPolygons"):this._clippingPolygons=a,this._clippingPolygonsState=0,this._lightColor=H.clone(e.lightColor),this._imageBasedLighting=D(e.imageBasedLighting)?e.imageBasedLighting:new cw,this._shouldDestroyImageBasedLighting=!D(e.imageBasedLighting),this._backFaceCulling=M(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=M(e.shadows,k_.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this._enableDebugWireframe=M(e.enableDebugWireframe,!1),this._enableShowOutline=M(e.enableShowOutline,!0),this._debugWireframe=M(e.debugWireframe,!1),!0===this._debugWireframe&&!1===this._enableDebugWireframe&&this.type===yM.GLTF&&Oa("model-debug-wireframe-ignored");let c=e.credit;"string"==typeof c&&(c=new YT(c)),this._credits=[],this._credit=c,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=M(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=M(e.splitDirection,$R.NONE),this._enableShowOutline=M(e.enableShowOutline,!0),this.showOutline=M(e.showOutline,!0),this.outlineColor=M(e.outlineColor,Ot.BLACK),this._classificationType=e.classificationType,this._statistics=new hU,this._sceneMode=void 0,this._projectTo2D=M(e.projectTo2D,!1),this._enablePick=M(e.enablePick,!1),this._fogRenderable=void 0,this._skipLevelOfDetail=!1,this._ignoreCommands=M(e.ignoreCommands,!1),this._errorEvent=new gi,this._readyEvent=new gi,this._texturesReadyEvent=new gi,this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function WU(e,t){e._errorEvent.numberOfListeners>0&&e._errorEvent.raiseEvent(t)}function qU(e,t){if(!D(e)&&!D(t))return!1;if(D(e)!==D(t))return!0;const n=e.alpha,i=t.alpha;return Math.floor(n)!==Math.floor(i)||Math.ceil(n)!==Math.ceil(i)}Object.defineProperties(jU.prototype,{ready:{get:function(){return this._ready}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},incrementallyLoadTextures:{get:function(){return M(this._loader.incrementallyLoadTextures,!1)}},texturesReadyEvent:{get:function(){return this._texturesReadyEvent}},loader:{get:function(){return this._loader}},statistics:{get:function(){return this._statistics}},activeAnimations:{get:function(){return this._activeAnimations}},clampAnimations:{get:function(){return this._clampAnimations},set:function(e){this._clampAnimations=e}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){L.defined("pointCloudShading",e),e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightDirty=!0),this._heightReference=e}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far must be greater than near");this._distanceDisplayCondition=vu.clone(e,this._distanceDisplayCondition)}},structuralMetadata:{get:function(){return this._sceneGraph.components.structuralMetadata}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},id:{get:function(){return this._id},set:function(e){e!==this._id&&(this._idDirty=!0),this._id=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){this._style=e,this._styleDirty=!0}},color:{get:function(){return this._color},set:function(e){qU(e,this._color)&&this.resetDrawCommands(),this._color=Ot.clone(e,this._color)}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},silhouetteColor:{get:function(){return this._silhouetteColor},set:function(e){if(!Ot.equals(e,this._silhouetteColor)){const t=qU(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=Ot.clone(e,this._silhouetteColor)}},silhouetteSize:{get:function(){return this._silhouetteSize},set:function(e){if(e!==this._silhouetteSize){const t=this._silhouetteSize,n=e>0&&0===t||0===e&&t>0;this._silhouetteDirty=this._silhouetteDirty||n,this._backFaceCullingDirty=this._backFaceCullingDirty||n}this._silhouetteSize=e}},boundingSphere:{get:function(){if(!this._ready)throw new P("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");return JU(this,D(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix),this._boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},debugWireframe:{get:function(){return this._debugWireframe},set:function(e){this._debugWireframe!==e&&this.resetDrawCommands(),this._debugWireframe=e,!0===this._debugWireframe&&!1===this._enableDebugWireframe&&this.type===yM.GLTF&&Oa("model-debug-wireframe-ignored")}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){"number"==typeof e&&(e=`featureId_${e}`),L.typeOf.string("value",e),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){"number"==typeof e&&(e=`instanceFeatureId_${e}`),L.typeOf.string("value",e),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(qI.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){e!==this._clippingPolygons&&(bP.setOwner(e,this,"_clippingPolygons"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){D(e)!==D(this._lightColor)&&this.resetDrawCommands(),this._lightColor=H.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){L.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this.resetDrawCommands())}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){e!==this._backFaceCulling&&(this._backFaceCullingDirty=!0),this._backFaceCulling=e}},scale:{get:function(){return this._scale},set:function(e){e!==this._scale&&(this._updateModelMatrix=!0),this._scale=e}},computedScale:{get:function(){return this._computedScale}},minimumPixelSize:{get:function(){return this._minimumPixelSize},set:function(e){e!==this._minimumPixelSize&&(this._updateModelMatrix=!0),this._minimumPixelSize=e}},maximumScale:{get:function(){return this._maximumScale},set:function(e){e!==this._maximumScale&&(this._updateModelMatrix=!0),this._maximumScale=e}},shadows:{get:function(){return this._shadows},set:function(e){e!==this._shadows&&(this._shadowsDirty=!0),this._shadows=e}},credit:{get:function(){return this._credit}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen!==e&&(this._showCreditsOnScreenDirty=!0),this._showCreditsOnScreen=e}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&this.resetDrawCommands(),this._splitDirection=e}},classificationType:{get:function(){return this._classificationType}},pickIds:{get:function(){return this._pickIds}},styleCommandsNeeded:{get:function(){return this._styleCommandsNeeded}}}),jU.prototype.getNode=function(e){if(!this._ready)throw new P("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");return L.typeOf.string("name",e),this._nodesByName[e]},jU.prototype.setArticulationStage=function(e,t){if(L.typeOf.number("value",t),!this._ready)throw new P("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.setArticulationStage(e,t)},jU.prototype.applyArticulations=function(){if(!this._ready)throw new P("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.applyArticulations()},jU.prototype.makeStyleDirty=function(){this._styleDirty=!0},jU.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};const YU=new ve,XU=new re,QU=new ve;function $U(e){const t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=_M.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}jU.prototype.update=function(e){let t=!1;try{t=function(e,t){if(!e._resourcesLoaded||e._loader.incrementallyLoadTextures&&!e._texturesLoaded)return t.afterRender.push((()=>!0)),e._loader.process(t);return!0}(this,e)}catch(i){if(this._loader.incrementallyLoadTextures||"TextureError"!==i.name){WU(this,xC.getError("model",this._resource,i))}else WU(this,i)}if(function(e,t){D(e._customShader)&&e._customShader.update(t)}(this,e),function(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}(this,e),!this._resourcesLoaded&&t){this._resourcesLoaded=!0;const e=this._loader.components;if(!D(e)){if(this._loader.isUnloaded())return;const e=xC.getError("model",this._resource,new be("Failed to load model."));WU(e),this._rejectLoad=this._rejectLoad&&this._rejectLoad(e)}const t=e.structuralMetadata;D(t)&&t.propertyTableCount>0&&function(e,t){const n=e._featureTables,i=t.propertyTables,o=i.length;for(let r=0;r<o;r++){const t=new bM({model:e,propertyTable:i[r]});n.push(t)}}(this,t);const n=new Yz({model:this,modelComponents:e});this._sceneGraph=n,this._gltfCredits=n.components.asset.credits}var n;this._resourcesLoaded&&e.mode!==gl.MORPHING&&(!function(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;const t=e._sceneGraph.components,n=t.structuralMetadata;D(n)&&n.propertyTableCount>0&&(e.featureTableId=function(e,t){const n=t._featureIdLabel,i=t._instanceFeatureIdLabel;let o,r,s,a;for(o=0;o<e.nodes.length;o++)if(a=e.nodes[o],D(a.instances)&&(s=xC.getFeatureIdsByLabel(a.instances.featureIds,i),D(s)&&D(s.propertyTableId)))return s.propertyTableId;for(o=0;o<e.nodes.length;o++)for(a=e.nodes[o],r=0;r<a.primitives.length;r++){const e=a.primitives[r],t=xC.getFeatureIdsByLabel(e.featureIds,n);if(D(t))return t.propertyTableId}if(1===t._featureTables.length)return 0}(t,e),e._styleDirty=!0,e.resetDrawCommands())}(this),(n=this)._styleDirty&&(n.applyStyle(n._style),n._styleDirty=!1),function(e,t){const n=e._featureTables,i=n.length;let o=!1;for(let r=0;r<i;r++)n[r].update(t),n[r].styleCommandsNeededDirty&&(o=!0);o&&$U(e)}(this,e),function(e){const t=e.pointCloudShading;t.attenuation!==e._attenuation&&(e.resetDrawCommands(),e._attenuation=t.attenuation);t.backFaceCulling!==e._pointCloudBackFaceCulling&&(e.resetDrawCommands(),e._pointCloudBackFaceCulling=t.backFaceCulling)}(this),function(e,t){e._silhouetteDirty&&(ok(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}(this,e),function(e,t){const n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}(this,e),function(e,t){let n=0;e.isClippingEnabled()&&(e._clippingPlanes.owner===e&&e._clippingPlanes.update(t),n=e._clippingPlanes.clippingPlanesState);n!==e._clippingPlanesState&&(e.resetDrawCommands(),e._clippingPlanesState=n)}(this,e),function(e,t){let n=0;e.isClippingPolygonsEnabled()&&(e._clippingPolygons.owner===e&&(e._clippingPolygons.update(t),e._clippingPolygons.queueCommands(t)),n=e._clippingPolygons.clippingPolygonsState);n!==e._clippingPolygonsState&&(e.resetDrawCommands(),e._clippingPolygonsState=n)}(this,e),function(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}(this,e),function(e,t){const n=t.fog.enabled&&t.fog.renderable;n!==e._fogRenderable&&(e.resetDrawCommands(),e._fogRenderable=n)}(this,e),function(e,t){const n=1!==t.verticalExaggeration;e._verticalExaggerationOn!==n&&(e.resetDrawCommands(),e._verticalExaggerationOn=n)}(this,e),this._defaultTexture=e.context.defaultTexture,function(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}(this,e),function(e,t){if(!ve.equals(e.modelMatrix,e._modelMatrix)){if(t.mode!==gl.SCENE3D&&e._projectTo2D)throw new P("Model.modelMatrix cannot be changed in 2D or Columbus View if projectTo2D is true.");e._updateModelMatrix=!0,e._modelMatrix=ve.clone(e.modelMatrix,e._modelMatrix)}}(this,e),function(e){if(!e._updateModelMatrix&&!e._heightDirty&&0===e._minimumPixelSize)return;D(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);const t=e._scene;if(!D(t)||e.heightReference===wu.NONE){if(e.heightReference!==wu.NONE)throw new P("Height reference is not supported without a scene.");return void(e._clampedModelMatrix=void 0)}const n=t.globe,i=M(null==n?void 0:n.ellipsoid,on.WGS84),o=e.modelMatrix;KU.x=o[12],KU.y=o[13],KU.z=o[14];const r=i.cartesianToCartographic(KU);D(e._clampedModelMatrix)||(e._clampedModelMatrix=ve.clone(o,new ve));e._removeUpdateHeightCallback=t.updateHeight(r,nk(e,i,r),e.heightReference);const s=t.getHeight(r,e.heightReference);if(D(s)){const t=nk(e,i,r);Qt.clone(r,ZU),ZU.height=s,t(ZU)}e._heightDirty=!1,e._updateModelMatrix=!0}(this),function(e,t){if(!e._updateModelMatrix&&0===e._minimumPixelSize)return;const n=D(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;JU(e,n),function(e,t,n){let i=e.scale;if(0!==e.minimumPixelSize&&!e._projectTo2D){const o=n.context,r=Math.max(o.drawingBufferWidth,o.drawingBufferHeight);ve.getTranslation(t,KU),e._sceneMode!==gl.SCENE3D&&QR.computeActualWgs84Position(n,KU,KU);const s=e._boundingSphere.radius,a=function(e,t,n){return ek.center=e,ek.radius=t,n.camera.getPixelSize(ek,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}(KU,s,n),c=1/a;Math.min(c*(2*s),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*a/(2*e._initialRadius))}e._computedScale=D(e.maximumScale)?Math.min(e.maximumScale,i):i}(e,n,t)}(this,e),function(e,t){const n=D(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix,i=M(e.referenceMatrix,n),o=t.context,r=e._imageBasedLighting;if(r.useSphericalHarmonicCoefficients||r.useSpecularEnvironmentMaps){let t=XU,n=YU;n=ve.multiply(o.uniformState.view3D,i,n),t=ve.getMatrix3(n,t),t=re.getRotation(t,t),e._iblReferenceFrameMatrix=re.transpose(t,e._iblReferenceFrameMatrix)}if(e.isClippingEnabled()){let t=QU;t=ve.multiply(o.uniformState.view3D,i,t),t=ve.multiply(t,e._clippingPlanes.modelMatrix,t),e._clippingPlanesMatrix=ve.inverseTranspose(t,e._clippingPlanesMatrix)}}(this,e),this._ready?(this._loader.incrementallyLoadTextures&&!this._texturesLoaded&&this._loader.texturesLoaded&&(this.resetDrawCommands(),this._texturesLoaded=!0,this._texturesReadyEvent.raiseEvent(this)),function(e){if(!e._idDirty)return;e._idDirty=!1;const t=e._id,n=e._pickIds,i=n.length;for(let o=0;o<i;++o)n[o].object.id=t}(this),function(e,t){const n=e._sceneGraph;if(e._updateModelMatrix||0!==e._minimumPixelSize){const i=D(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;n.updateModelMatrix(i,t),e._updateModelMatrix=!1}e._backFaceCullingDirty&&(n.updateBackFaceCulling(e._backFaceCulling),e._backFaceCullingDirty=!1);e._shadowsDirty&&(n.updateShadows(e._shadows),e._shadowsDirty=!1);e._debugShowBoundingVolumeDirty&&(n.updateShowBoundingVolume(e._debugShowBoundingVolume),e._debugShowBoundingVolumeDirty=!1);let i=!1;D(e.classificationType)||(i=e._userAnimationDirty||e._activeAnimations.update(t));n.update(t,i),e._userAnimationDirty=!1}(this,e),function(e){if(!e._showCreditsOnScreenDirty)return;e._showCreditsOnScreenDirty=!1,e._credits.length=0;const t=e._showCreditsOnScreen;if(D(e._credit)){const n=YT.clone(e._credit);n.showOnScreen=n.showOnScreen||t,e._credits.push(n)}const n=e._resourceCredits,i=n.length;for(let s=0;s<i;s++){const i=YT.clone(n[s]);i.showOnScreen=i.showOnScreen||t,e._credits.push(i)}const o=e._gltfCredits,r=o.length;for(let s=0;s<r;s++){const n=YT.clone(o[s]);n.showOnScreen=n.showOnScreen||t,e._credits.push(n)}}(this),function(e,t){const n=function(e,t){const n=e.distanceDisplayCondition;if(!D(n))return!0;const i=n.near*n.near,o=n.far*n.far;let r;if(t.mode===gl.SCENE2D){const e=.5*(t.camera.frustum.right-t.camera.frustum.left);r=e*e}else{const n=ve.getTranslation(e.modelMatrix,ik);QR.computeActualWgs84Position(t,n,n),r=H.distanceSquared(n,t.camera.positionWC)}return r>=i&&r<=o}(e,t),i=e.isInvisible(),o=e.hasSilhouette(t),r=e._show&&0!==e._computedScale&&n&&(!i||o),s=t.passes,a=s.render||s.pick&&e.allowPicking;r&&!e._ignoreCommands&&a&&(!function(e,t){const n=t.creditDisplay,i=e._credits,o=i.length;for(let r=0;r<o;r++)n.addCreditToNextFrame(i[r])}(e,t),e._sceneGraph.pushDrawCommands(t))}(this,e)):e.afterRender.push((()=>{this._ready=!0,this._readyEvent.raiseEvent(this)})))};const KU=new H,ZU=new Qt;function JU(e,t){e._clampedScale=D(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=H.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=$u.transform(e._boundingSphere,t,e._boundingSphere)}const ek=new $u;const tk=new H;function nk(e,t,n){return function(i){xu(e.heightReference)&&(i.height+=n.height),t.cartographicToCartesian(i,tk);const o=e._clampedModelMatrix;ve.clone(e.modelMatrix,o),o[12]=tk.x,o[13]=tk.y,o[14]=tk.z,e._heightDirty=!0}}const ik=new H;function ok(e){return e.context.stencilBuffer}jU.prototype.isTranslucent=function(){const e=this.color;return D(e)&&e.alpha>0&&e.alpha<1},jU.prototype.isInvisible=function(){const e=this.color;return D(e)&&0===e.alpha},jU.prototype.hasSilhouette=function(e){return ok(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!D(this._classificationType)},jU.prototype.hasSkipLevelOfDetail=function(e){if(!yM.is3DTiles(this.type))return!1;const t=e.context.stencilBuffer,n=this._content.tileset;return t&&n.isSkippingLevelOfDetail},jU.prototype.isClippingEnabled=function(){const e=this._clippingPlanes;return D(e)&&e.enabled&&0!==e.length},jU.prototype.pick=function(e,t,n,i,o){return function(e,t,n,i,o,r,s){if(L.typeOf.object("model",e),L.typeOf.object("ray",t),L.typeOf.object("frameState",n),!e._ready||n.mode===gl.MORPHING)return;let a=Number.MAX_VALUE;const c=e.sceneGraph,l=c._runtimeNodes;for(let u=0;u<l.length;u++){const s=l[u],d=s.node;let h=ve.clone(s.computedTransform,zU),p=ve.clone(c.computedModelMatrix,UU);const f=d.instances;D(f)&&f.transformInWorldSpace&&(p=ve.multiplyTransformation(e.modelMatrix,c.components.transform,p),h=ve.multiplyTransformation(c.axisCorrectionMatrix,s.computedTransform,h));let m=ve.multiplyTransformation(p,h,kU);n.mode!==gl.SCENE3D&&(m=Cr.basisTo2D(n.mapProjection,m,m));const _=[];if(D(f)){const e=f.attributes[0].count,t=f.attributes[0].componentDatatype,i=12;let o=s.transformsTypedArray;if(!D(o)){const r=s.instancingTransformsBuffer;D(r)&&n.context.webgl2&&(o=Ca.createTypedArray(t,e*i),r.getBufferData(o))}if(D(o))for(let n=0;n<e;n++){const e=n*i,t=new ve(o[e],o[e+1],o[e+2],o[e+3],o[e+4],o[e+5],o[e+6],o[e+7],o[e+8],o[e+9],o[e+10],o[e+11],0,0,0,1);f.transformInWorldSpace?(ve.multiplyTransformation(t,h,t),ve.multiplyTransformation(p,t,t)):ve.multiplyTransformation(t,m,t),_.push(t)}}0===_.length&&_.push(m);const g=s.runtimePrimitives.length;for(let c=0;c<g;c++){const l=s.runtimePrimitives[c],u=l.primitive;if(D(l.boundingSphere)&&!D(f)){const e=$u.transform(l.boundingSphere,m,HU);if(!D(Pp.raySphere(t,e)))continue}const d=xC.getAttributeBySemantic(u,EC.POSITION),h=d.byteOffset,p=d.byteStride,g=d.count;if(!D(u.indices))continue;let y=u.indices.typedArray;if(!D(y)){const e=u.indices.buffer,t=u.indices.count,i=u.indices.indexDatatype;D(e)&&n.context.webgl2&&(i===je.UNSIGNED_BYTE?y=new Uint8Array(t):i===je.UNSIGNED_SHORT?y=new Uint16Array(t):i===je.UNSIGNED_INT&&(y=new Uint32Array(t)),e.getBufferData(y))}let b=d.typedArray,v=d.componentDatatype,A=d.type;const T=d.quantization;D(T)&&(v=d.quantization.componentDatatype,A=d.quantization.type);const w=Zf.getNumberOfComponents(A),E=Ca.getSizeInBytes(v),x=!D(b)&&D(p)&&p!==w*E;let S=w,C=0;x&&(S=p/E,C=h/E);const I=g*S;if(!D(b)){const e=d.buffer;D(e)&&n.context.webgl2&&(b=Ca.createTypedArray(v,I),e.getBufferData(b,x?0:h,0,I)),T&&d.normalized&&(b=sm.dequantize(b,v,A,g))}if(!D(y)||!D(b))return;r=M(r,on.WGS84),i=M(i,1),o=M(o,0);const O=y.length;for(let n=0;n<O;n+=3){const s=y[n],c=y[n+1],l=y[n+2];for(const n of _){const u=GU(b,s,C,S,T,n,i,o,r,MU),d=GU(b,c,C,S,T,n,i,o,r,FU),h=GU(b,l,C,S,T,n,i,o,r,BU),p=Pp.rayTriangleParametric(t,u,d,h,M(e.backFaceCulling,!0));D(p)&&p<a&&p>=0&&(a=p)}}}}if(a!==Number.MAX_VALUE){if(s=tp.getPoint(t,a,s),n.mode!==gl.SCENE3D){H.fromElements(s.y,s.z,s.x,s);const e=n.mapProjection,t=e.ellipsoid,i=e.unproject(s,VU);t.cartographicToCartesian(i,s)}return s}}(this,e,t,n,i,o)},jU.prototype.isClippingPolygonsEnabled=function(){const e=this._clippingPolygons;return D(e)&&e.enabled&&0!==e.length},jU.prototype.isDestroyed=function(){return!1},jU.prototype.destroy=function(){const e=this._loader;D(e)&&e.destroy();const t=this._featureTables;if(D(t)){const e=t.length;for(let n=0;n<e;n++)t[n].destroy()}this.destroyPipelineResources(),this.destroyModelResources(),D(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),D(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0);const n=this._clippingPlanes;D(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0;const i=this._clippingPolygons;D(i)&&!i.isDestroyed()&&i.owner===this&&i.destroy(),this._clippingPolygons=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,He(this)},jU.prototype.destroyPipelineResources=function(){const e=this._pipelineResources;for(let t=0;t<e.length;t++)e[t].destroy();this._pipelineResources.length=0,this._pickIds.length=0},jU.prototype.destroyModelResources=function(){const e=this._modelResources;for(let t=0;t<e.length;t++)e[t].destroy();this._modelResources.length=0},jU.fromGltfAsync=async function(e){if(!D((e=M(e,M.EMPTY_OBJECT)).url)&&!D(e.gltf))throw new P("options.url is required.");const t=M(e.url,e.gltf),n={releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:D(e.classificationType)},i=M(e.basePath,""),o=Bi.createIfNeeded(i);D(t.asset)?(n.gltfJson=t,n.baseResource=o,n.gltfResource=o):t instanceof Uint8Array?(n.typedArray=t,n.baseResource=o,n.gltfResource=o):n.gltfResource=Bi.createIfNeeded(t);const r=new kN(n),s=D(e.content)?yM.TILE_GLTF:yM.GLTF,a=n.gltfResource,c=sk(r,s,e);c.resource=a;try{await r.load()}catch(h){throw r.destroy(),xC.getError("model",a,h)}const l=e.gltfCallback;D(l)&&(L.typeOf.func("options.gltfCallback",l),l(r.gltfJson));const u=new jU(c),d=u._resource.credits;if(D(d)){const e=d.length;for(let t=0;t<e;t++)u._resourceCredits.push(YT.clone(d[t]))}return u},jU.fromB3dm=async function(e){const t=new uL({b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:D(e.classificationType)});try{await t.load();const n=sk(t,yM.TILE_B3DM,e);return new jU(n)}catch(n){throw t.destroy(),n}},jU.fromPnts=async function(e){const t=new xU({arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D});try{await t.load();const n=sk(t,yM.TILE_PNTS,e);return new jU(n)}catch(n){throw t.destroy(),n}},jU.fromI3dm=async function(e){const t=new ML({i3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline});try{await t.load();const n=sk(t,yM.TILE_I3DM,e);return new jU(n)}catch(n){throw t.destroy(),n}},jU.fromGeoJson=async function(e){return new jU(sk(new hL({geoJson:e.geoJson}),yM.TILE_GEOJSON,e))};const rk=new Ot;function sk(e,t,n){return{loader:e,type:t,resource:n.resource,show:n.show,modelMatrix:n.modelMatrix,scale:n.scale,minimumPixelSize:n.minimumPixelSize,maximumScale:n.maximumScale,id:n.id,allowPicking:n.allowPicking,clampAnimations:n.clampAnimations,shadows:n.shadows,debugShowBoundingVolume:n.debugShowBoundingVolume,enableDebugWireframe:n.enableDebugWireframe,debugWireframe:n.debugWireframe,cull:n.cull,opaquePass:n.opaquePass,customShader:n.customShader,content:n.content,heightReference:n.heightReference,scene:n.scene,distanceDisplayCondition:n.distanceDisplayCondition,color:n.color,colorBlendAmount:n.colorBlendAmount,colorBlendMode:n.colorBlendMode,silhouetteColor:n.silhouetteColor,silhouetteSize:n.silhouetteSize,enableShowOutline:n.enableShowOutline,showOutline:n.showOutline,outlineColor:n.outlineColor,clippingPlanes:n.clippingPlanes,clippingPolygons:n.clippingPolygons,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,credit:n.credit,showCreditsOnScreen:n.showCreditsOnScreen,splitDirection:n.splitDirection,projectTo2D:n.projectTo2D,enablePick:n.enablePick,featureIdLabel:n.featureIdLabel,instanceFeatureIdLabel:n.instanceFeatureIdLabel,pointCloudShading:n.pointCloudShading,classificationType:n.classificationType,pickObject:n.pickObject}}function ak(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._metadata=void 0,this._group=void 0,this._ready=!1}function ck(e,t,n,i){return ni(i,{cull:!1,releaseGltfJson:!0,opaquePass:zt.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._modelUpAxis,forwardAxis:e._modelForwardAxis,incrementallyLoadTextures:!1,customShader:e.customShader,content:n,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount,lightColor:e.lightColor,imageBasedLighting:e.imageBasedLighting,featureIdLabel:e.featureIdLabel,instanceFeatureIdLabel:e.instanceFeatureIdLabel,pointCloudShading:e.pointCloudShading,clippingPlanes:e.clippingPlanes,backFaceCulling:e.backFaceCulling,shadows:e.shadows,showCreditsOnScreen:e.showCreditsOnScreen,splitDirection:e.splitDirection,enableDebugWireframe:e._enableDebugWireframe,debugWireframe:e.debugWireframe,projectTo2D:e._projectTo2D,enablePick:e._enablePick,enableShowOutline:e._enableShowOutline,showOutline:e.showOutline,outlineColor:e.outlineColor})}function lk(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._ready=!1}jU.prototype.applyColorAndShow=function(e){const t=Ot.clone(this._color,rk),n=D(e)&&D(e.color),i=D(e)&&D(e.show);this._color=n?e.color.evaluateColor(void 0,this._color):Ot.clone(Ot.WHITE,this._color),this._show=!i||e.show.evaluate(void 0),qU(t,this._color)&&this.resetDrawCommands()},jU.prototype.applyStyle=function(e){const t=this.type===yM.TILE_PNTS,n=D(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0,i=D(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=D(i)&&D(i[0]);if(!t||n&&!o)if(n){this.featureTables[this.featureTableId].applyStyle(e),$U(this)}else this.applyColorAndShow(e),this._styleCommandsNeeded=void 0;else this.resetDrawCommands()},Object.defineProperties(ak.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;return D(t)&&D(t[n])?t[n].featuresLength:0}},pointsLength:{get:function(){return this._model.statistics.pointsLength}},trianglesLength:{get:function(){return this._model.statistics.trianglesLength}},geometryByteLength:{get:function(){return this._model.statistics.geometryByteLength}},texturesByteLength:{get:function(){return this._model.statistics.texturesByteLength}},batchTableByteLength:{get:function(){const e=this._model.statistics;return e.propertyTablesByteLength+e.batchTexturesByteLength}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;if(D(t)&&D(t[n]))return t[n]}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),ak.prototype.getFeature=function(e){const t=this._model,n=t.featureTableId;if(!D(n))throw new P("No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined");const i=t.featureTables[n];if(!D(i))throw new P("No feature table found for the selected feature ID set");const o=i.featuresLength;if(!D(e)||e<0||e>=o)throw new P(`featureId is required and must be between 0 and featuresLength - 1 (${o-1}).`);return i.getFeature(e)},ak.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;if(!D(i))return!1;return n.featureTables[i].hasProperty(e,t)},ak.prototype.applyDebugSettings=function(e,t){t=e?t:Ot.WHITE,0===this.featuresLength?this._model.color=t:D(this.batchTable)&&this.batchTable.setAllColor(t)},ak.prototype.applyStyle=function(e){this._model.style=e},ak.prototype.update=function(e,t){const n=this._model,i=this._tile;n.colorBlendAmount=e.colorBlendAmount,n.colorBlendMode=e.colorBlendMode,n.modelMatrix=i.computedTransform,n.customShader=e.customShader,n.featureIdLabel=e.featureIdLabel,n.instanceFeatureIdLabel=e.instanceFeatureIdLabel,n.lightColor=e.lightColor,n.imageBasedLighting=e.imageBasedLighting,n.backFaceCulling=e.backFaceCulling,n.shadows=e.shadows,n.showCreditsOnScreen=e.showCreditsOnScreen,n.splitDirection=e.splitDirection,n.debugWireframe=e.debugWireframe,n.showOutline=e.showOutline,n.outlineColor=e.outlineColor,n.pointCloudShading=e.pointCloudShading;const o=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,D(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0),D(o)&&D(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0);const r=e.clippingPolygons;D(r)&&i.clippingPolygonsDirty&&(n._clippingPolygons=r.enabled&&i._isClippedByPolygon?r:void 0),D(r)&&D(n._clippingPolygons)&&n._clippingPolygons!==r&&(n._clippingPolygons=r,n._clippingPolygonsState=0),n.update(t),!this._ready&&n.ready&&(n.activeAnimations.addAll({loop:GI.REPEAT}),this._ready=!0)},ak.prototype.isDestroyed=function(){return!1},ak.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),He(this)},ak.fromGltf=async function(e,t,n,i){const o=new ak(e,t,n),r=ck(e,t,o,{gltf:i,basePath:n}),s=e.vectorClassificationOnly?void 0:e.classificationType;r.classificationType=s;const a=await jU.fromGltfAsync(r);return o._model=a,o},ak.fromB3dm=async function(e,t,n,i,o){const r=new ak(e,t,n),s=ck(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;const c=await jU.fromB3dm(s);return r._model=c,r},ak.fromI3dm=async function(e,t,n,i,o){const r=new ak(e,t,n),s=ck(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),a=await jU.fromI3dm(s);return r._model=a,r},ak.fromPnts=async function(e,t,n,i,o){const r=new ak(e,t,n),s=ck(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),a=await jU.fromPnts(s);return r._model=a,r},ak.fromGeoJson=async function(e,t,n,i){const o=new ak(e,t,n),r=ck(e,t,o,{geoJson:i,resource:n}),s=await jU.fromGeoJson(r);return o._model=s,o},ak.prototype.pick=function(e,t,n){if(!D(this._model)||!this._ready)return;const i=t.verticalExaggeration,o=t.verticalExaggerationRelativeHeight;return this._model.pick(e,t,i,o,on.WGS84,n)},Object.defineProperties(lk.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}}),lk.fromJson=function(e,t,n,i){const o=new lk(e,t,n);return o._tileset.loadTileset(o._resource,i,o._tile),o._ready=!0,o},lk.prototype.hasProperty=function(e,t){return!1},lk.prototype.getFeature=function(e){},lk.prototype.applyDebugSettings=function(e,t){},lk.prototype.applyStyle=function(e){},lk.prototype.update=function(e,t){},lk.prototype.pick=function(e,t,n){},lk.prototype.isDestroyed=function(){return!1},lk.prototype.destroy=function(){return He(this)};function uk(e,t){if(D((e=M(e,M.EMPTY_OBJECT)).disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new P("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(D(n)){if(n.far<=n.near)throw new P("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Au.clone(n)}if(D(i)){if(i.far<=i.near)throw new P("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Au.clone(i)}if(D(o)){if(o.far<=o.near)throw new P("scaleByDistance.far must be greater than scaleByDistance.near.");o=Au.clone(o)}if(D(r)){if(r.far<=r.near)throw new P("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=vu.clone(r)}this._show=M(e.show,!0),this._position=H.clone(M(e.position,H.ZERO)),this._actualPosition=H.clone(this._position),this._pixelOffset=kt.clone(M(e.pixelOffset,kt.ZERO)),this._translate=new kt(0,0),this._eyeOffset=H.clone(M(e.eyeOffset,H.ZERO)),this._heightReference=M(e.heightReference,wu.NONE),this._verticalOrigin=M(e.verticalOrigin,Cu.CENTER),this._horizontalOrigin=M(e.horizontalOrigin,Su.CENTER),this._scale=M(e.scale,1),this._color=Ot.clone(M(e.color,Ot.WHITE)),this._rotation=M(e.rotation,0),this._alignedAxis=H.clone(M(e.alignedAxis,H.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=M(e.sizeInMeters,!1),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=M(e.collection,t),this._pickId=void 0,this._pickPrimitive=M(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;const s=e.image;let a=e.imageId;D(s)&&(D(a)||(a="string"==typeof s?s:D(s.src)?s.src:ke()),this._imageId=a,this._image=s),D(e.imageSubRegion)&&(this._imageId=a,this._imageSubRegion=e.imageSubRegion),D(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=gl.SCENE3D,this._clusterShow=!0,this._outlineColor=Ot.clone(M(e.outlineColor,Ot.BLACK)),this._outlineWidth=M(e.outlineWidth,0),this._updateClamping()}const dk=uk.SHOW_INDEX=0,hk=uk.POSITION_INDEX=1,pk=uk.PIXEL_OFFSET_INDEX=2,fk=uk.EYE_OFFSET_INDEX=3,mk=uk.HORIZONTAL_ORIGIN_INDEX=4,_k=uk.VERTICAL_ORIGIN_INDEX=5,gk=uk.SCALE_INDEX=6,yk=uk.IMAGE_INDEX_INDEX=7,bk=uk.COLOR_INDEX=8,vk=uk.ROTATION_INDEX=9,Ak=uk.ALIGNED_AXIS_INDEX=10,Tk=uk.SCALE_BY_DISTANCE_INDEX=11,wk=uk.TRANSLUCENCY_BY_DISTANCE_INDEX=12,Ek=uk.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,xk=uk.DISTANCE_DISPLAY_CONDITION=14,Sk=uk.DISABLE_DEPTH_DISTANCE=15;uk.TEXTURE_COORDINATE_BOUNDS=16;const Ck=uk.SDF_INDEX=17;function Ik(e,t){const n=e._billboardCollection;D(n)&&(n._updateBillboard(e,t),e._dirty=!0)}uk.NUMBER_OF_PROPERTIES=18,Object.defineProperties(uk.prototype,{show:{get:function(){return this._show},set:function(e){L.typeOf.bool("value",e),this._show!==e&&(this._show=e,Ik(this,dk))}},position:{get:function(){return this._position},set:function(e){L.typeOf.object("value",e);const t=this._position;H.equals(t,e)||(H.clone(e,t),H.clone(e,this._actualPosition),this._updateClamping(),Ik(this,hk))}},heightReference:{get:function(){return this._heightReference},set:function(e){L.typeOf.number("value",e);e!==this._heightReference&&(this._heightReference=e,this._updateClamping(),Ik(this,hk))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){L.typeOf.object("value",e);const t=this._pixelOffset;kt.equals(t,e)||(kt.clone(e,t),Ik(this,pk))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(D(e)&&(L.typeOf.object("value",e),e.far<=e.near))throw new P("far distance must be greater than near distance.");const t=this._scaleByDistance;Au.equals(t,e)||(this._scaleByDistance=Au.clone(e,t),Ik(this,Tk))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(D(e)&&(L.typeOf.object("value",e),e.far<=e.near))throw new P("far distance must be greater than near distance.");const t=this._translucencyByDistance;Au.equals(t,e)||(this._translucencyByDistance=Au.clone(e,t),Ik(this,wk))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(D(e)&&(L.typeOf.object("value",e),e.far<=e.near))throw new P("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;Au.equals(t,e)||(this._pixelOffsetScaleByDistance=Au.clone(e,t),Ik(this,Ek))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){L.typeOf.object("value",e);const t=this._eyeOffset;H.equals(t,e)||(H.clone(e,t),Ik(this,fk))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){L.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,Ik(this,mk))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){L.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,Ik(this,_k))}},scale:{get:function(){return this._scale},set:function(e){L.typeOf.number("value",e),this._scale!==e&&(this._scale=e,Ik(this,gk))}},color:{get:function(){return this._color},set:function(e){L.typeOf.object("value",e);const t=this._color;Ot.equals(t,e)||(Ot.clone(e,t),Ik(this,bk))}},rotation:{get:function(){return this._rotation},set:function(e){L.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,Ik(this,vk))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){L.typeOf.object("value",e);const t=this._alignedAxis;H.equals(t,e)||(H.clone(e,t),Ik(this,Ak))}},width:{get:function(){return M(this._width,this._imageWidth)},set:function(e){D(e)&&L.typeOf.number("value",e),this._width!==e&&(this._width=e,Ik(this,yk))}},height:{get:function(){return M(this._height,this._imageHeight)},set:function(e){D(e)&&L.typeOf.number("value",e),this._height!==e&&(this._height=e,Ik(this,yk))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){L.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,Ik(this,bk))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!vu.equals(e,this._distanceDisplayCondition)){if(D(e)&&(L.typeOf.object("value",e),e.far<=e.near))throw new P("far distance must be greater than near distance.");this._distanceDisplayCondition=vu.clone(e,this._distanceDisplayCondition),Ik(this,xk)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(D(e)&&(L.typeOf.number("value",e),e<0))throw new P("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,Ik(this,Sk))}},id:{get:function(){return this._id},set:function(e){this._id=e,D(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,D(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){D(e)?"string"==typeof e?this.setImage(e,e):e instanceof Bi?this.setImage(e.url,e):D(e.src)?this.setImage(e.src,e):this.setImage(ke(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,Ik(this,yk))}},ready:{get:function(){return-1!==this._imageIndex}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=H.clone(e,this._actualClampedPosition),Ik(this,hk)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,Ik(this,dk))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!D(e))throw new P("value is required.");const t=this._outlineColor;Ot.equals(t,e)||(Ot.clone(e,t),Ik(this,Ck))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,Ik(this,Ck))}}}),uk.prototype.getPickId=function(e){return D(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId},uk.prototype._updateClamping=function(){uk._updateClamping(this._billboardCollection,this)};const Ok=new Qt;uk._updateClamping=function(e,t){const n=e._scene;if(!D(n)){if(t._heightReference!==wu.NONE)throw new P("Height reference is not supported without a scene.");return}const i=n.globe,o=M(null==i?void 0:i.ellipsoid,on.WGS84),r=n.frameState.mode,s=r!==t._mode;if(t._mode=r,(t._heightReference===wu.NONE||s)&&D(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===wu.NONE||!D(t._position))return;D(t._removeCallbackFunc)&&t._removeCallbackFunc();const a=o.cartesianToCartographic(t._position);if(!D(a))return void(t._actualClampedPosition=void 0);function c(e){const n=o.cartographicToCartesian(e,t._clampedPosition);xu(t._heightReference)&&(t._mode===gl.SCENE3D?(e.height+=a.height,o.cartographicToCartesian(e,n)):n.x+=a.height),t._clampedPosition=n}t._removeCallbackFunc=n.updateHeight(a,c,t._heightReference),Qt.clone(a,Ok);const l=n.getHeight(a,t._heightReference);D(l)&&(Ok.height=l),c(Ok)},uk.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion;let o;const r=this;function s(o){if(r._imageId!==t||r._image!==n||!Fr.equals(r._imageSubRegion,i))return;const s=e.textureCoordinates[o];r._imageWidth=e.texture.width*s.width,r._imageHeight=e.texture.height*s.height,r._imageIndex=o,r._ready=!0,r._image=void 0,r._imageIndexPromise=void 0,Ik(r,yk);const a=r._billboardCollection._scene;D(a)&&a.frameState.afterRender.push((()=>!0))}if(D(n)&&(o=e.addImage(t,n)),D(i)&&(o=e.addSubRegion(t,i)),this._imageIndexPromise=o,!D(o))return;const a=e.getImageIndex(t);!D(a)||D(i)?o.then(s).catch((function(e){r._imageIndexPromise=void 0})):s(a)},uk.prototype.setImage=function(e,t){if(!D(e))throw new P("id is required.");if(!D(t))throw new P("image is required.");this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,D(this._billboardCollection._textureAtlas)&&this._loadImage())},uk.prototype.setImageSubRegion=function(e,t){if(!D(e))throw new P("id is required.");if(!D(t))throw new P("subRegion is required.");this._imageId===e&&Fr.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=Fr.clone(t),D(this._billboardCollection._textureAtlas)&&this._loadImage())},uk.prototype._setTranslate=function(e){if(!D(e))throw new P("value is required.");const t=this._translate;kt.equals(t,e)||(kt.clone(e,t),Ik(this,pk))},uk.prototype._getActualPosition=function(){return D(this._clampedPosition)?this._clampedPosition:this._actualPosition},uk.prototype._setActualPosition=function(e){D(this._clampedPosition)||H.clone(e,this._actualPosition),Ik(this,hk)};const Dk=new K;uk._computeActualPosition=function(e,t,n,i){return D(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===gl.SCENE3D?t:(ve.multiplyByPoint(i,t,Dk),QR.computeActualWgs84Position(n,Dk))};const Pk=new H;uk._computeScreenSpacePosition=function(e,t,n,i,o,r){const s=ve.multiplyByPoint(e,t,Pk),a=QR.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(D(a))return kt.add(a,i,a),a};const Nk=new kt(0,0);uk.prototype.computeScreenSpacePosition=function(e,t){const n=this._billboardCollection;if(D(t)||(t=new kt),!D(n))throw new P("Billboard must be in a collection. Was it removed?");if(!D(e))throw new P("scene is required.");kt.clone(this._pixelOffset,Nk),kt.add(Nk,this._translate,Nk);let i=n.modelMatrix,o=this._position;if(D(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==gl.SCENE3D)){const t=e.mapProjection,n=t.ellipsoid,r=t.unproject(o,Ok);o=n.cartographicToCartesian(r,Pk),i=ve.IDENTITY}return uk._computeScreenSpacePosition(i,o,this._eyeOffset,Nk,e,t)},uk.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,o=e.height;const r=e.scale;i*=r,o*=r;let s=t.x;e.horizontalOrigin===Su.RIGHT?s-=i:e.horizontalOrigin===Su.CENTER&&(s-=.5*i);let a=t.y;return e.verticalOrigin===Cu.BOTTOM||e.verticalOrigin===Cu.BASELINE?a-=o:e.verticalOrigin===Cu.CENTER&&(a-=.5*o),D(n)||(n=new Fr),n.x=s,n.y=a,n.width=i,n.height=o,n},uk.prototype.equals=function(e){return this===e||D(e)&&this._id===e._id&&H.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&&Fr.equals(this._imageSubRegion,e._imageSubRegion)&&Ot.equals(this._color,e._color)&&kt.equals(this._pixelOffset,e._pixelOffset)&&kt.equals(this._translate,e._translate)&&H.equals(this._eyeOffset,e._eyeOffset)&&Au.equals(this._scaleByDistance,e._scaleByDistance)&&Au.equals(this._translucencyByDistance,e._translucencyByDistance)&&Au.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&vu.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},uk.prototype._destroy=function(){D(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),D(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const Rk=Object.freeze({OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2}),Lk=Object.freeze({FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25});function Mk(e,t,n,i,o){this.bottomLeft=M(e,kt.ZERO),this.topRight=M(t,kt.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=o}const Fk=new kt(16,16);function Bk(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.borderWidthInPixels,1),n=M(e.initialSize,Fk);if(!D(e.context))throw new P("context is required.");if(t<0)throw new P("borderWidthInPixels must be greater than or equal to zero.");if(n.x<1||n.y<1)throw new P("initialSize must be greater than zero.");this._context=e.context,this._pixelFormat=M(e.pixelFormat,is.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=ke(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}function zk(e,t,n){if(D(t)){if(!D(t.childNode1)&&!D(t.childNode2)){if(D(t.imageIndex))return;const i=t.topRight.x-t.bottomLeft.x,o=t.topRight.y-t.bottomLeft.y,r=i-n.width,s=o-n.height;if(r<0||s<0)return;if(0===r&&0===s)return t;if(r>s){t.childNode1=new Mk(new kt(t.bottomLeft.x,t.bottomLeft.y),new kt(t.bottomLeft.x+n.width,t.topRight.y));const i=t.bottomLeft.x+n.width+e._borderWidthInPixels;i<t.topRight.x&&(t.childNode2=new Mk(new kt(i,t.bottomLeft.y),new kt(t.topRight.x,t.topRight.y)))}else{t.childNode1=new Mk(new kt(t.bottomLeft.x,t.bottomLeft.y),new kt(t.topRight.x,t.bottomLeft.y+n.height));const i=t.bottomLeft.y+n.height+e._borderWidthInPixels;i<t.topRight.y&&(t.childNode2=new Mk(new kt(t.bottomLeft.x,i),new kt(t.topRight.x,t.topRight.y)))}return zk(e,t.childNode1,n)}return zk(e,t.childNode1,n)||zk(e,t.childNode2,n)}}function Uk(e,t,n){const i=zk(e,e._root,t);if(D(i)){i.imageIndex=n;const o=e._texture.width,r=e._texture.height,s=i.topRight.x-i.bottomLeft.x,a=i.topRight.y-i.bottomLeft.y,c=i.bottomLeft.x/o,l=i.bottomLeft.y/r,u=s/o,d=a/r;e._textureCoordinates[n]=new Fr(c,l,u,d),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else!function(e,t){const n=e._context,i=e.numberOfImages,o=e._borderWidthInPixels;if(i>0){const i=e._texture.width,r=e._texture.height,s=2*(i+t.width+o),a=2*(r+t.height+o),c=i/s,l=r/a,u=new Mk(new kt(i+o,o),new kt(s,r)),d=new Mk(new kt,new kt(s,r),e._root,u),h=new Mk(new kt(o,r+o),new kt(s,a)),p=new Mk(new kt,new kt(s,a),d,h);for(let t=0;t<e._textureCoordinates.length;t++){const n=e._textureCoordinates[t];D(n)&&(n.x*=c,n.y*=l,n.width*=c,n.height*=l)}const f=new Sc({context:e._context,width:s,height:a,pixelFormat:e._pixelFormat}),m=new cs({context:n,colorTextures:[e._texture],destroyAttachments:!1});m._bind(),f.copyFromFramebuffer(0,0,0,0,s,a),m._unBind(),m.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=f,e._root=p}else{let n=2*(t.width+2*o),i=2*(t.height+2*o);n<e._initialSize.x&&(n=e._initialSize.x),i<e._initialSize.y&&(i=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new Sc({context:e._context,width:n,height:i,pixelFormat:e._pixelFormat}),e._root=new Mk(new kt(o,o),new kt(n,i))}}(e,t),Uk(e,t,n);e._guid=ke()}function kk(e,t){if(!D(e)||e.isDestroyed())return-1;const n=e.numberOfImages;return Uk(e,t,n),n}Object.defineProperties(Bk.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return D(this._texture)||(this._texture=new Sc({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}}}),Bk.prototype.getImageIndex=function(e){if(!D(e))throw new P("id is required.");return this._indexHash[e]},Bk.prototype.addImageSync=function(e,t){if(!D(e))throw new P("id is required.");if(!D(t))throw new P("image is required.");let n=this._indexHash[e];return D(n)||(n=kk(this,t),this._idHash[e]=Promise.resolve(n),this._indexHash[e]=n),n},Bk.prototype.addImage=function(e,t){if(!D(e))throw new P("id is required.");if(!D(t))throw new P("image is required.");let n=this._idHash[e];if(D(n))return n;if("function"==typeof t){if(!D(t=t(e)))throw new P("image is required.")}else if("string"==typeof t||t instanceof Bi){t=Bi.createIfNeeded(t).fetchImage()}const i=this;return n=Promise.resolve(t).then((function(t){const n=kk(i,t);return i._indexHash[e]=n,n})),this._idHash[e]=n,n},Bk.prototype.addSubRegion=function(e,t){if(!D(e))throw new P("id is required.");if(!D(t))throw new P("subRegion is required.");const n=this._idHash[e];if(!D(n))throw new be(`image with id "${e}" not found in the atlas.`);const i=this;return Promise.resolve(n).then((function(n){if(-1===n)return-1;const o=i._texture.width,r=i._texture.height,s=i._textureCoordinates[n],a=s.x+t.x/o,c=s.y+t.y/r,l=t.width/o,u=t.height/r,d=i._textureCoordinates.push(new Fr(a,c,l,u))-1;return i._indexHash[e]=d,i._guid=ke(),d}))},Bk.prototype.isDestroyed=function(){return!1},Bk.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),He(this)};const Vk=uk.SHOW_INDEX,Hk=uk.POSITION_INDEX,Gk=uk.PIXEL_OFFSET_INDEX,jk=uk.EYE_OFFSET_INDEX,Wk=uk.HORIZONTAL_ORIGIN_INDEX,qk=uk.VERTICAL_ORIGIN_INDEX,Yk=uk.SCALE_INDEX,Xk=uk.IMAGE_INDEX_INDEX,Qk=uk.COLOR_INDEX,$k=uk.ROTATION_INDEX,Kk=uk.ALIGNED_AXIS_INDEX,Zk=uk.SCALE_BY_DISTANCE_INDEX,Jk=uk.TRANSLUCENCY_BY_DISTANCE_INDEX,eV=uk.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,tV=uk.DISTANCE_DISPLAY_CONDITION,nV=uk.DISABLE_DEPTH_DISTANCE,iV=uk.TEXTURE_COORDINATE_BOUNDS,oV=uk.SDF_INDEX,rV=uk.NUMBER_OF_PROPERTIES;let sV;const aV={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},cV={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12};function lV(e){e=M(e,M.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(rV),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new $u,this._baseVolumeWC=new $u,this._baseVolume2D=new $u,this._boundingVolume=new $u,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=M(e.show,!0),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._modelMatrix=ve.clone(ve.IDENTITY),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=M(e.debugShowTextureAtlas,!1),this.blendOption=M(e.blendOption,Rk.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=gl.SCENE3D,this._buffersUsage=[qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW],this._highlightColor=Ot.clone(Ot.WHITE);const t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};const n=this._scene;D(n)&&D(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener((function(){const e=this._billboards,t=e.length;for(let n=0;n<t;++n)D(e[n])&&e[n]._updateClamping()}),this))}function uV(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}function dV(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;const t=[],n=e._billboards,i=n.length;for(let e=0,o=0;e<i;++e){const i=n[e];D(i)&&(i._index=o++,t.push(i))}e._billboards=t}}let hV;function pV(e){let t=e.cache.billboardCollection_indexBufferBatched;if(D(t))return t;const n=new Uint16Array(98298);for(let i=0,o=0;i<98298;i+=6,o+=4)n[i]=o,n[i+1]=o+1,n[i+2]=o+2,n[i+3]=o+0,n[i+4]=o+2,n[i+5]=o+3;return t=Ye.createIndexBuffer({context:e,typedArray:n,usage:qe.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=t,t}function fV(e){let t=e.cache.billboardCollection_indexBufferInstanced;return D(t)||(t=Ye.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:qe.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function mV(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return D(t)||(t=Ye.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:qe.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}Object.defineProperties(lV.prototype,{length:{get:function(){return dV(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}}}),lV.prototype.add=function(e){const t=new uk(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t},lV.prototype.remove=function(e){return!!this.contains(e)&&(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},lV.prototype.removeAll=function(){uV(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0},lV.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]},lV.prototype.contains=function(e){return D(e)&&e._billboardCollection===this},lV.prototype.get=function(e){return L.typeOf.number("index",e),dV(this),this._billboards[e]},lV.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<rV;++i){const o=0===n[i]?qe.STATIC_DRAW:qe.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};const _V=new Ic;function gV(e,t,n,i,o){let r;const s=i[sV.positionHighAndScale],a=i[sV.positionLowAndRotation],c=o._getActualPosition();e._mode===gl.SCENE3D&&($u.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),Ic.fromCartesian(c,_V);const l=o.scale,u=o.rotation;0!==u&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,l);const d=_V.high,h=_V.low;e._instanced?(r=o._index,s(r,d.x,d.y,d.z,l),a(r,h.x,h.y,h.z,u)):(r=4*o._index,s(r+0,d.x,d.y,d.z,l),s(r+1,d.x,d.y,d.z,l),s(r+2,d.x,d.y,d.z,l),s(r+3,d.x,d.y,d.z,l),a(r+0,h.x,h.y,h.z,u),a(r+1,h.x,h.y,h.z,u),a(r+2,h.x,h.y,h.z,u),a(r+3,h.x,h.y,h.z,u))}const yV=new kt,bV=32768,vV=65536,AV=4096,TV=256,wV=1/256;function EV(e,t,n,i,o){let r;const s=i[sV.compressedAttribute0],a=o.pixelOffset,c=a.x,l=a.y,u=o._translate,d=u.x,h=u.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+d),Math.abs(-l+h));const p=o.horizontalOrigin;let f=o._verticalOrigin,m=o.show&&o.clusterShow;0===o.color.alpha&&(m=!1),f===Cu.BASELINE&&(f=Cu.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&p===Su.CENTER,e._allVerticalCenter=e._allVerticalCenter&&f===Cu.CENTER;let _=0,g=0,y=0,b=0;const v=o._imageIndex;if(-1!==v){const e=n[v];if(!D(e))throw new P(`Invalid billboard image index: ${v}`);_=e.x,g=e.y,y=e.width,b=e.height}const A=_+y,T=g+b;let w=128*Math.floor(V.clamp(c,-32768,bV)+bV);w+=32*(p+1),w+=8*(f+1),w+=4*(m?1:0);let E=Math.floor(V.clamp(l,-32768,bV)+bV)*TV,x=Math.floor(V.clamp(d,-32768,bV)+bV)*TV;const S=(V.clamp(h,-32768,bV)+bV)*wV,C=Math.floor(S);E+=C,x+=Math.floor((S-C)*TV),yV.x=_,yV.y=g;const I=sm.compressTextureCoordinates(yV);yV.x=A;const O=sm.compressTextureCoordinates(yV);yV.y=T;const N=sm.compressTextureCoordinates(yV);yV.x=_;const R=sm.compressTextureCoordinates(yV);e._instanced?(r=o._index,s(r,w,E,x,I)):(r=4*o._index,s(r+0,w+0,E,x,I),s(r+1,w+2,E,x,O),s(r+2,w+3,E,x,N),s(r+3,w+1,E,x,R))}function xV(e,t,n,i,o){let r;const s=i[sV.compressedAttribute1],a=o.alignedAxis;H.equals(a,H.ZERO)||(e._shaderAlignedAxis=!0);let c=0,l=1,u=1,d=1;const h=o.translucencyByDistance;D(h)&&(c=h.near,l=h.nearValue,u=h.far,d=h.farValue,1===l&&1===d||(e._shaderTranslucencyByDistance=!0));let p=0;const f=o._imageIndex;if(-1!==f){const e=n[f];if(!D(e))throw new P(`Invalid billboard image index: ${f}`);p=e.width}const m=e._textureAtlas.texture.width,_=Math.round(M(o.width,m*p));e._maxSize=Math.max(e._maxSize,_);let g=V.clamp(_,0,vV),y=0;Math.abs(H.magnitudeSquared(a)-1)<V.EPSILON6&&(y=sm.octEncodeFloat(a)),l=V.clamp(l,0,1),l=1===l?255:255*l|0,g=g*TV+l,d=V.clamp(d,0,1),d=1===d?255:255*d|0,y=y*TV+d,e._instanced?(r=o._index,s(r,g,y,c,u)):(r=4*o._index,s(r+0,g,y,c,u),s(r+1,g,y,c,u),s(r+2,g,y,c,u),s(r+3,g,y,c,u))}function SV(e,t,n,i,o){let r;const s=i[sV.compressedAttribute2],a=o.color,c=D(e._batchTable)?Ot.WHITE:o.getPickId(t.context).color,l=o.sizeInMeters?1:0,u=Math.abs(H.magnitudeSquared(o.alignedAxis)-1)<V.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&1===l;let d=0;const h=o._imageIndex;if(-1!==h){const e=n[h];if(!D(e))throw new P(`Invalid billboard image index: ${h}`);d=e.height}const p=e._textureAtlas.texture.dimensions,f=Math.round(M(o.height,p.y*d));e._maxSize=Math.max(e._maxSize,f);let m=M(o._labelHorizontalOrigin,-2);m+=2;const _=4*f+m;let g=Ot.floatToByte(a.red),y=Ot.floatToByte(a.green),b=Ot.floatToByte(a.blue);const v=g*vV+y*TV+b;g=Ot.floatToByte(c.red),y=Ot.floatToByte(c.green),b=Ot.floatToByte(c.blue);const A=g*vV+y*TV+b;let T=Ot.floatToByte(a.alpha)*vV+Ot.floatToByte(c.alpha)*TV;T+=2*l+u,e._instanced?(r=o._index,s(r,v,A,T,_)):(r=4*o._index,s(r+0,v,A,T,_),s(r+1,v,A,T,_),s(r+2,v,A,T,_),s(r+3,v,A,T,_))}function CV(e,t,n,i,o){let r;const s=i[sV.eyeOffset],a=o.eyeOffset;let c=a.z;if(o._heightReference!==wu.NONE&&(c*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(a.x),Math.abs(a.y),Math.abs(c)),e._instanced){let e=0,t=0;const i=o._imageIndex;if(-1!==i){const o=n[i];if(!D(o))throw new P(`Invalid billboard image index: ${i}`);e=o.width,t=o.height}yV.x=e,yV.y=t;const l=sm.compressTextureCoordinates(yV);r=o._index,s(r,a.x,a.y,c,l)}else r=4*o._index,s(r+0,a.x,a.y,c,0),s(r+1,a.x,a.y,c,0),s(r+2,a.x,a.y,c,0),s(r+3,a.x,a.y,c,0)}function IV(e,t,n,i,o){let r;const s=i[sV.scaleByDistance];let a=0,c=1,l=1,u=1;const d=o.scaleByDistance;D(d)&&(a=d.near,c=d.nearValue,l=d.far,u=d.farValue,1===c&&1===u||(e._shaderScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,l,u)):(r=4*o._index,s(r+0,a,c,l,u),s(r+1,a,c,l,u),s(r+2,a,c,l,u),s(r+3,a,c,l,u))}function OV(e,t,n,i,o){let r;const s=i[sV.pixelOffsetScaleByDistance];let a=0,c=1,l=1,u=1;const d=o.pixelOffsetScaleByDistance;D(d)&&(a=d.near,c=d.nearValue,l=d.far,u=d.farValue,1===c&&1===u||(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,l,u)):(r=4*o._index,s(r+0,a,c,l,u),s(r+1,a,c,l,u),s(r+2,a,c,l,u),s(r+3,a,c,l,u))}function DV(e,t,n,i,o){let r;const s=i[sV.compressedAttribute3];let a=0,c=Number.MAX_VALUE;const l=o.distanceDisplayCondition;D(l)&&(a=l.near,c=l.far,a*=a,c*=c,e._shaderDistanceDisplayCondition=!0);let u=o.disableDepthTestDistance;const d=Eu(o.heightReference)&&t.context.depthTexture;let h,p;if(D(u)||(u=d?5e3:0),u*=u,(d||u>0)&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),D(o._labelDimensions))p=o._labelDimensions.x,h=o._labelDimensions.y;else{let t=0,i=0;const r=o._imageIndex;if(-1!==r){const e=n[r];if(!D(e))throw new P(`Invalid billboard image index: ${r}`);t=e.height,i=e.width}h=Math.round(M(o.height,e._textureAtlas.texture.dimensions.y*t));const s=e._textureAtlas.texture.width;p=Math.round(M(o.width,s*i))}const f=Math.floor(V.clamp(p,0,AV)),m=Math.floor(V.clamp(h,0,AV)),_=f*AV+m;e._instanced?(r=o._index,s(r,a,c,u,_)):(r=4*o._index,s(r+0,a,c,u,_),s(r+1,a,c,u,_),s(r+2,a,c,u,_),s(r+3,a,c,u,_))}function PV(e,t,n,i,o){if(Eu(o.heightReference)){const n=e._scene,i=t.context,o=t.globeTranslucencyState.translucent,r=D(n.globe)&&n.globe.depthTestAgainstTerrain;e._shaderClampToGround=i.depthTexture&&!o&&r}let r;const s=i[sV.textureCoordinateBoundsOrLabelTranslate];if(rs.maximumVertexTextureImageUnits>0){let t=0,n=0;return D(o._labelTranslate)&&(t=o._labelTranslate.x,n=o._labelTranslate.y),void(e._instanced?(r=o._index,s(r,t,n,0,0)):(r=4*o._index,s(r+0,t,n,0,0),s(r+1,t,n,0,0),s(r+2,t,n,0,0),s(r+3,t,n,0,0)))}let a=0,c=0,l=0,u=0;const d=o._imageIndex;if(-1!==d){const e=n[d];if(!D(e))throw new P(`Invalid billboard image index: ${d}`);a=e.x,c=e.y,l=e.width,u=e.height}const h=a+l,p=c+u;e._instanced?(r=o._index,s(r,a,c,h,p)):(r=4*o._index,s(r+0,a,c,h,p),s(r+1,a,c,h,p),s(r+2,a,c,h,p),s(r+3,a,c,h,p))}function NV(e,t,n,i,o){if(!e._sdf)return;let r;const s=i[sV.sdf],a=o.outlineColor,c=o.outlineWidth,l=Ot.floatToByte(a.red),u=Ot.floatToByte(a.green),d=Ot.floatToByte(a.blue),h=l*vV+u*TV+d,p=c/Lk.RADIUS,f=Ot.floatToByte(a.alpha)*vV+Ot.floatToByte(p)*TV;e._instanced?(r=o._index,s(r,h,f)):(r=4*o._index,s(r+0,h+0,f),s(r+1,h+2,f),s(r+2,h+3,f),s(r+3,h+1,f))}function RV(e,t,n,i,o){gV(e,0,0,i,o),EV(e,0,n,i,o),xV(e,0,n,i,o),SV(e,t,n,i,o),CV(e,0,n,i,o),IV(e,0,0,i,o),OV(e,0,0,i,o),DV(e,t,n,i,o),PV(e,t,n,i,o),function(e,t,n,i,o){if(!D(e._batchTable))return;const r=i[sV.a_batchId],s=o._batchIndex;let a;e._instanced?(a=o._index,r(a,s)):(a=4*o._index,r(a+0,s),r(a+1,s),r(a+2,s),r(a+3,s))}(e,0,0,i,o),NV(e,0,0,i,o)}function LV(e,t,n,i,o,r){let s;i.mode===gl.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let c=0;c<n;++c){const e=t[c],n=e.position,l=uk._computeActualPosition(e,n,i,o);D(l)&&(e._setActualPosition(l),r?a.push(l):$u.expand(s,l,s))}r&&$u.fromPoints(a,s)}const MV=[];function FV(e,t,n,i,o){return function(){const r=document.createElement("canvas"),s=o+2*i;r.height=r.width=s;const a=r.getContext("2d");return a.clearRect(0,0,s,s),0!==i&&(a.beginPath(),a.arc(s/2,s/2,s/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=n,a.fill(),e<1&&(a.save(),a.globalCompositeOperation="destination-out",a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle="black",a.fill(),a.restore())),a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=t,a.fill(),r}}function BV(e,t,n,i,o){this._content=e,this._billboard=n,this._label=i,this._polyline=o,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),UV(this)}lV.prototype.update=function(e){if(dV(this),!this.show)return;let t=this._billboards,n=t.length;const i=e.context;this._instanced=i.instancedArrays,sV=this._instanced?cV:aV,hV=this._instanced?fV:pV;let o=this._textureAtlas;if(!D(o)){o=this._textureAtlas=new Bk({context:i});for(let e=0;e<n;++e)t[e]._loadImage()}const r=o.textureCoordinates;if(0===r.length)return;!function(e,t){const n=t.mode,i=e._billboards,o=e._billboardsToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==gl.SCENE3D&&!ve.equals(r,e.modelMatrix)?(e._mode=n,ve.clone(e.modelMatrix,r),e._createVertexArray=!0,n!==gl.SCENE3D&&n!==gl.SCENE2D&&n!==gl.COLUMBUS_VIEW||LV(e,i,i.length,t,r,!0)):n===gl.MORPHING?LV(e,i,i.length,t,r,!0):n!==gl.SCENE2D&&n!==gl.COLUMBUS_VIEW||LV(e,o,e._billboardsToUpdateIndex,t,r,!1)}(this,e),t=this._billboards,n=t.length;const s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,c=this._propertiesChanged,l=o.guid,u=this._createVertexArray||this._textureAtlasGUID!==l;let d;this._textureAtlasGUID=l;const h=e.passes,p=h.pick;if(u||!p&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let e=0;e<rV;++e)c[e]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=function(e,t,n,i,o,r){const s=[{index:sV.positionHighAndScale,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[Hk]},{index:sV.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[Hk]},{index:sV.compressedAttribute0,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[Gk]},{index:sV.compressedAttribute1,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[Jk]},{index:sV.compressedAttribute2,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[Qk]},{index:sV.eyeOffset,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[jk]},{index:sV.scaleByDistance,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[Zk]},{index:sV.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[eV]},{index:sV.compressedAttribute3,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[tV]},{index:sV.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[iV]}];return i&&s.push({index:sV.direction,componentsPerAttribute:2,componentDatatype:Ca.FLOAT,vertexBuffer:mV(e)}),D(o)&&s.push({index:sV.a_batchId,componentsPerAttribute:1,componentDatatype:Ca.FLOAT,bufferUsage:qe.STATIC_DRAW}),r&&s.push({index:sV.sdf,componentsPerAttribute:2,componentDatatype:Ca.FLOAT,usage:n[oV]}),new uu(e,s,i?t:4*t,i)}(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),d=this._vaf.writers;for(let t=0;t<n;++t){const n=this._billboards[t];n._dirty=!1,RV(this,e,r,d,n)}this._vaf.commit(hV(i))}this._billboardsToUpdateIndex=0}else if(a>0){const t=MV;t.length=0,(c[Hk]||c[$k]||c[Yk])&&t.push(gV),(c[Xk]||c[Gk]||c[Wk]||c[qk]||c[Vk])&&(t.push(EV),this._instanced&&t.push(CV)),(c[Xk]||c[Kk]||c[Jk])&&(t.push(xV),t.push(SV)),(c[Xk]||c[Qk])&&t.push(SV),c[jk]&&t.push(CV),c[Zk]&&t.push(IV),c[eV]&&t.push(OV),(c[tV]||c[nV]||c[Xk]||c[Hk])&&t.push(DV),(c[Xk]||c[Hk])&&t.push(PV),c[oV]&&t.push(NV);const o=t.length;if(d=this._vaf.writers,a/n>.1){for(let n=0;n<a;++n){const i=s[n];i._dirty=!1;for(let n=0;n<o;++n)t[n](this,e,r,d,i)}this._vaf.commit(hV(i))}else{for(let n=0;n<a;++n){const i=s[n];i._dirty=!1;for(let n=0;n<o;++n)t[n](this,e,r,d,i);this._instanced?this._vaf.subCommit(i._index,1):this._vaf.subCommit(4*i._index,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>1.5*n&&(s.length=n),!D(this._vaf)||!D(this._vaf.va))return;let f;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,$u.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m=ve.IDENTITY;e.mode===gl.SCENE3D?(m=this.modelMatrix,f=$u.clone(this._baseVolumeWC,this._boundingVolume)):f=$u.clone(this._baseVolume2D,this._boundingVolume),function(e,t,n){let i=1;e._allSizedInMeters&&0===e._maxPixelOffset||(i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight));let o=i*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(o*=.5);const r=i*e._maxPixelOffset+e._maxEyeOffset;n.radius+=o+r}(this,e,f);const _=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,_){this._blendOption===Rk.OPAQUE||this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=_s.fromCache({depthTest:{enabled:!0,func:Me.LESS},depthMask:!0}):this._rsOpaque=void 0;const e=this._blendOption===Rk.TRANSLUCENT;this._blendOption===Rk.TRANSLUCENT||this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=_s.fromCache({depthTest:{enabled:!0,func:e?Me.LEQUAL:Me.LESS},depthMask:e,blending:dh.ALPHA_BLEND}):this._rsTranslucent=void 0}let g,y,b,v,A;this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance;const T=rs.maximumVertexTextureImageUnits>0;if(_||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){g="#ifdef INSTANCED\nin vec2 direction;\n#endif\nin vec4 positionHighAndScale;\nin vec4 positionLowAndRotation;\nin vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)\nin vec4 compressedAttribute1; // aligned axis, translucency by distance, image width\nin vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free\nin vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)\nin vec4 scaleByDistance; // near, nearScale, far, farScale\nin vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale\nin vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions\nin vec2 sdf; // sdf outline color (rgb) and width (w)\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\nin vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates\n#endif\n#ifdef VECTOR_TILE\nin float a_batchId;\n#endif\n\nout vec2 v_textureCoordinates;\n#ifdef FRAGMENT_DEPTH_CHECK\nout vec4 v_textureCoordinateBounds;\nout vec4 v_originTextureCoordinateAndTranslate;\nout vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize\nout mat2 v_rotationMatrix;\n#endif\n\nout vec4 v_pickColor;\nout vec4 v_color;\n#ifdef SDF\nout vec4 v_outlineColor;\nout float v_outlineWidth;\n#endif\n\nconst float UPPER_BOUND = 32768.0;\n\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;\n\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;\n\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{\n // Note the halfSize cannot be computed in JavaScript because it is sent via\n // compressed vertex attributes that coerce it to an integer.\n vec2 halfSize = imageSize * scale * 0.5;\n halfSize *= ((direction * 2.0) - 1.0);\n\n vec2 originTranslate = origin * abs(halfSize);\n\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\n if (validAlignedAxis || rotation != 0.0)\n {\n float angle = rotation;\n if (validAlignedAxis)\n {\n vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0);\n angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /\n (projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));\n }\n\n float cosTheta = cos(angle);\n float sinTheta = sin(angle);\n rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n halfSize = rotationMatrix * halfSize;\n }\n else\n {\n rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n }\n#endif\n\n mpp = czm_metersPerPixel(positionEC);\n positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);\n positionEC.xy += (translate + pixelOffset) * mpp;\n\n return positionEC;\n}\n\n#ifdef VERTEX_DEPTH_CHECK\nfloat getGlobeDepth(vec4 positionEC)\n{\n vec4 posWC = czm_eyeToWindowCoordinates(positionEC);\n\n float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));\n\n if (globeDepth == 0.0)\n {\n return 0.0; // not on the globe\n }\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);\n return eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\nvoid main()\n{\n // Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition\n\n // unpack attributes\n vec3 positionHigh = positionHighAndScale.xyz;\n vec3 positionLow = positionLowAndRotation.xyz;\n float scale = positionHighAndScale.w;\n\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\n float rotation = positionLowAndRotation.w;\n#else\n float rotation = 0.0;\n#endif\n\n float compressed = compressedAttribute0.x;\n\n vec2 pixelOffset;\n pixelOffset.x = floor(compressed * SHIFT_RIGHT7);\n compressed -= pixelOffset.x * SHIFT_LEFT7;\n pixelOffset.x -= UPPER_BOUND;\n\n vec2 origin;\n origin.x = floor(compressed * SHIFT_RIGHT5);\n compressed -= origin.x * SHIFT_LEFT5;\n\n origin.y = floor(compressed * SHIFT_RIGHT3);\n compressed -= origin.y * SHIFT_LEFT3;\n\n#ifdef FRAGMENT_DEPTH_CHECK\n vec2 depthOrigin = origin.xy;\n#endif\n origin -= vec2(1.0);\n\n float show = floor(compressed * SHIFT_RIGHT2);\n compressed -= show * SHIFT_LEFT2;\n\n#ifdef INSTANCED\n vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\n vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\n vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n#else\n vec2 direction;\n direction.x = floor(compressed * SHIFT_RIGHT1);\n direction.y = compressed - direction.x * SHIFT_LEFT1;\n\n vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n#endif\n\n float temp = compressedAttribute0.y * SHIFT_RIGHT8;\n pixelOffset.y = -(floor(temp) - UPPER_BOUND);\n\n vec2 translate;\n translate.y = (temp - floor(temp)) * SHIFT_LEFT16;\n\n temp = compressedAttribute0.z * SHIFT_RIGHT8;\n translate.x = floor(temp) - UPPER_BOUND;\n\n translate.y += (temp - floor(temp)) * SHIFT_LEFT8;\n translate.y -= UPPER_BOUND;\n\n temp = compressedAttribute1.x * SHIFT_RIGHT8;\n float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\n\n vec2 imageSize = vec2(floor(temp), temp2);\n\n#ifdef FRAGMENT_DEPTH_CHECK\n float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\n float applyTranslate = 0.0;\n if (labelHorizontalOrigin != 0.0) // is a billboard, so set apply translate to false\n {\n applyTranslate = 1.0;\n labelHorizontalOrigin -= 2.0;\n depthOrigin.x = labelHorizontalOrigin + 1.0;\n }\n\n depthOrigin = vec2(1.0) - (depthOrigin * 0.5);\n#endif\n\n#ifdef EYE_DISTANCE_TRANSLUCENCY\n vec4 translucencyByDistance;\n translucencyByDistance.x = compressedAttribute1.z;\n translucencyByDistance.z = compressedAttribute1.w;\n\n translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n\n temp = compressedAttribute1.y * SHIFT_RIGHT8;\n translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\n\n#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\n temp = compressedAttribute3.w;\n temp = temp * SHIFT_RIGHT12;\n\n vec2 dimensions;\n dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\n dimensions.x = floor(temp);\n#endif\n\n#ifdef ALIGNED_AXIS\n vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\n temp = compressedAttribute2.z * SHIFT_RIGHT5;\n bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;\n#else\n vec3 alignedAxis = vec3(0.0);\n bool validAlignedAxis = false;\n#endif\n\n vec4 pickColor;\n vec4 color;\n\n temp = compressedAttribute2.y;\n temp = temp * SHIFT_RIGHT8;\n pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n pickColor.r = floor(temp);\n\n temp = compressedAttribute2.x;\n temp = temp * SHIFT_RIGHT8;\n color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n color.r = floor(temp);\n\n temp = compressedAttribute2.z * SHIFT_RIGHT8;\n bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\n temp = floor(temp) * SHIFT_RIGHT8;\n\n pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n pickColor /= 255.0;\n\n color.a = floor(temp);\n color /= 255.0;\n\n ///////////////////////////////////////////////////////////////////////////\n\n vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n vec4 positionEC = czm_modelViewRelativeToEye * p;\n\n#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)\n float eyeDepth = positionEC.z;\n#endif\n\n positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);\n positionEC.xyz *= show;\n\n ///////////////////////////////////////////////////////////////////////////\n\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\n float lengthSq;\n if (czm_sceneMode == czm_sceneMode2D)\n {\n // 2D camera distance is a special case\n // treat all billboards as flattened to the z=0.0 plane\n lengthSq = czm_eyeHeight2D.y;\n }\n else\n {\n lengthSq = dot(positionEC.xyz, positionEC.xyz);\n }\n#endif\n\n#ifdef EYE_DISTANCE_SCALING\n float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);\n scale *= distanceScale;\n translate *= distanceScale;\n // push vertex behind near plane for clipping\n if (scale == 0.0)\n {\n positionEC.xyz = vec3(0.0);\n }\n#endif\n\n float translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\n translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\n // push vertex behind near plane for clipping\n if (translucency == 0.0)\n {\n positionEC.xyz = vec3(0.0);\n }\n#endif\n\n#ifdef EYE_DISTANCE_PIXEL_OFFSET\n float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\n pixelOffset *= pixelOffsetScale;\n#endif\n\n#ifdef DISTANCE_DISPLAY_CONDITION\n float nearSq = compressedAttribute3.x;\n float farSq = compressedAttribute3.y;\n if (lengthSq < nearSq || lengthSq > farSq)\n {\n positionEC.xyz = vec3(0.0);\n }\n#endif\n\n mat2 rotationMatrix;\n float mpp;\n\n#ifdef DISABLE_DEPTH_DISTANCE\n float disableDepthTestDistance = compressedAttribute3.z;\n#endif\n\n#ifdef VERTEX_DEPTH_CHECK\nif (lengthSq < disableDepthTestDistance) {\n float depthsilon = 10.0;\n\n vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;\n vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n float globeDepth1 = getGlobeDepth(pEC1);\n\n if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)\n {\n vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n float globeDepth2 = getGlobeDepth(pEC2);\n\n if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)\n {\n vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n float globeDepth3 = getGlobeDepth(pEC3);\n if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)\n {\n positionEC.xyz = vec3(0.0);\n }\n }\n }\n}\n#endif\n\n positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n gl_Position = czm_projection * positionEC;\n v_textureCoordinates = textureCoordinates;\n\n#ifdef LOG_DEPTH\n czm_vertexLogDepth();\n#endif\n\n#ifdef DISABLE_DEPTH_DISTANCE\n if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n {\n disableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n }\n\n if (disableDepthTestDistance != 0.0)\n {\n // Don't try to \"multiply both sides\" by w. Greater/less-than comparisons won't work for negative values of w.\n float zclip = gl_Position.z / gl_Position.w;\n bool clipped = (zclip < -1.0 || zclip > 1.0);\n if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n {\n // Position z on the near plane.\n gl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\n v_depthFromNearPlusOne = 1.0;\n#endif\n }\n }\n#endif\n\n#ifdef FRAGMENT_DEPTH_CHECK\n if (sizeInMeters) {\n translate /= mpp;\n dimensions /= mpp;\n imageSize /= mpp;\n }\n\n#if defined(ROTATION) || defined(ALIGNED_AXIS)\n v_rotationMatrix = rotationMatrix;\n#else\n v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n#endif\n\n float enableDepthCheck = 0.0;\n if (lengthSq < disableDepthTestDistance)\n {\n enableDepthCheck = 1.0;\n }\n\n float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));\n float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));\n\n float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));\n float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));\n\n v_compressed.x = eyeDepth;\n v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;\n v_compressed.z = dw * SHIFT_LEFT12 + dh;\n v_compressed.w = iw * SHIFT_LEFT12 + ih;\n v_originTextureCoordinateAndTranslate.xy = depthOrigin;\n v_originTextureCoordinateAndTranslate.zw = translate;\n v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;\n\n#endif\n\n#ifdef SDF\n vec4 outlineColor;\n float outlineWidth;\n\n temp = sdf.x;\n temp = temp * SHIFT_RIGHT8;\n outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n outlineColor.r = floor(temp);\n\n temp = sdf.y;\n temp = temp * SHIFT_RIGHT8;\n float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\n outlineColor.a = floor(temp);\n outlineColor /= 255.0;\n\n v_outlineWidth = outlineWidth / 255.0;\n v_outlineColor = outlineColor;\n v_outlineColor.a *= translucency;\n#endif\n\n v_pickColor = pickColor;\n\n v_color = color;\n v_color.a *= translucency;\n\n}\n",y='uniform sampler2D u_atlas;\n\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\n\nin vec2 v_textureCoordinates;\nin vec4 v_pickColor;\nin vec4 v_color;\n\n#ifdef SDF\nin vec4 v_outlineColor;\nin float v_outlineWidth;\n#endif\n\n#ifdef FRAGMENT_DEPTH_CHECK\nin vec4 v_textureCoordinateBounds; // the min and max x and y values for the texture coordinates\nin vec4 v_originTextureCoordinateAndTranslate; // texture coordinate at the origin, billboard translate (used for label glyphs)\nin vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize\nin mat2 v_rotationMatrix;\n\nconst float SHIFT_LEFT12 = 4096.0;\nconst float SHIFT_LEFT1 = 2.0;\n\nconst float SHIFT_RIGHT12 = 1.0 / 4096.0;\nconst float SHIFT_RIGHT1 = 1.0 / 2.0;\n\nfloat getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)\n{\n vec2 lookupVector = imageSize * (depthLookupST - adjustedST);\n lookupVector = v_rotationMatrix * lookupVector;\n vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y)); // aligns label glyph with bounding rectangle. Will be zero for billboards because dimensions and imageSize will be equal\n\n vec2 translation = v_originTextureCoordinateAndTranslate.zw;\n\n if (applyTranslate)\n {\n // this is only needed for labels where the horizontal origin is not LEFT\n // it moves the label back to where the "origin" should be since all label glyphs are set to HorizontalOrigin.LEFT\n translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));\n }\n\n vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;\n float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st));\n\n if (logDepthOrDepth == 0.0)\n {\n return 0.0; // not on the globe\n }\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n return eyeCoordinate.z / eyeCoordinate.w;\n}\n#endif\n\n\n#ifdef SDF\n\n// Get the distance from the edge of a glyph at a given position sampling an SDF texture.\nfloat getDistance(vec2 position)\n{\n return texture(u_atlas, position).r;\n}\n\n// Samples the sdf texture at the given position and produces a color based on the fill color and the outline.\nvec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)\n{\n float distance = getDistance(position);\n\n if (outlineWidth > 0.0)\n {\n // Don\'t get the outline edge exceed the SDF_EDGE\n float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);\n float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\n vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);\n float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);\n return vec4(sdfColor.rgb, sdfColor.a * alpha);\n }\n else\n {\n float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\n return vec4(v_color.rgb, v_color.a * alpha);\n }\n}\n#endif\n\nvoid main()\n{\n vec4 color = texture(u_atlas, v_textureCoordinates);\n\n#ifdef SDF\n float outlineWidth = v_outlineWidth;\n vec4 outlineColor = v_outlineColor;\n\n // Get the current distance\n float distance = getDistance(v_textureCoordinates);\n\n#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n float smoothing = fwidth(distance);\n // Get an offset that is approximately half the distance to the neighbor pixels\n // 0.354 is approximately half of 1/sqrt(2)\n vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));\n\n // Sample the center point\n vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n\n // Sample the 4 neighbors\n vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\n vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\n vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\n vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\n\n // Equally weight the center sample and the 4 neighboring samples\n color = (center + color1 + color2 + color3 + color4)/5.0;\n#else\n // If no derivatives available (IE 10?), just do a single sample\n float smoothing = 1.0/32.0;\n color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n#endif\n\n color = czm_gammaCorrect(color);\n#else\n color = czm_gammaCorrect(color);\n color *= czm_gammaCorrect(v_color);\n#endif\n\n// Fully transparent parts of the billboard are not pickable.\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\n if (color.a < 0.005) // matches 0/255 and 1/255\n {\n discard;\n }\n#else\n// The billboard is rendered twice. The opaque pass discards translucent fragments\n// and the translucent pass discards opaque fragments.\n#ifdef OPAQUE\n if (color.a < 0.995) // matches < 254/255\n {\n discard;\n }\n#else\n if (color.a >= 0.995) // matches 254/255 and 255/255\n {\n discard;\n }\n#endif\n#endif\n\n#ifdef VECTOR_TILE\n color *= u_highlightColor;\n#endif\n out_FragColor = color;\n\n#ifdef LOG_DEPTH\n czm_writeLogDepth();\n#endif\n\n#ifdef FRAGMENT_DEPTH_CHECK\n float temp = v_compressed.y;\n\n temp = temp * SHIFT_RIGHT1;\n\n float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\n bool enableDepthTest = temp2 != 0.0;\n bool applyTranslate = floor(temp) != 0.0;\n\n if (enableDepthTest) {\n temp = v_compressed.z;\n temp = temp * SHIFT_RIGHT12;\n\n vec2 dimensions;\n dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\n dimensions.x = floor(temp);\n\n temp = v_compressed.w;\n temp = temp * SHIFT_RIGHT12;\n\n vec2 imageSize;\n imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;\n imageSize.x = floor(temp);\n\n vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;\n adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);\n\n float epsilonEyeDepth = v_compressed.x + czm_epsilon1;\n float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);\n\n // negative values go into the screen\n if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)\n {\n float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize); // top left corner\n if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)\n {\n float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner\n if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)\n {\n discard;\n }\n }\n }\n }\n#endif\n\n}\n',A=[],D(this._batchTable)&&(A.push("VECTOR_TILE"),g=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(g),y=this._batchTable.getFragmentShaderCallback(!1,void 0)(y)),b=new bc({defines:A,sources:[g]}),this._instanced&&b.defines.push("INSTANCED"),this._shaderRotation&&b.defines.push("ROTATION"),this._shaderAlignedAxis&&b.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&b.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&b.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&b.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&b.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&b.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(T?b.defines.push("VERTEX_DEPTH_CHECK"):b.defines.push("FRAGMENT_DEPTH_CHECK"));const e=1-Lk.CUTOFF;this._sdf&&b.defines.push("SDF");const t=D(this._batchTable)?"VECTOR_TILE":"";this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT&&(v=new bc({defines:["OPAQUE",t],sources:[y]}),this._shaderClampToGround&&(T?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${e}`)),this._sp=ya.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:b,fragmentShaderSource:v,attributeLocations:sV}),v=new bc({defines:["TRANSLUCENT",t],sources:[y]}),this._shaderClampToGround&&(T?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${e}`)),this._spTranslucent=ya.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:b,fragmentShaderSource:v,attributeLocations:sV})),this._blendOption===Rk.OPAQUE&&(v=new bc({defines:[t],sources:[y]}),this._shaderClampToGround&&(T?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${e}`)),this._sp=ya.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:b,fragmentShaderSource:v,attributeLocations:sV})),this._blendOption===Rk.TRANSLUCENT&&(v=new bc({defines:[t],sources:[y]}),this._shaderClampToGround&&(T?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${e}`)),this._spTranslucent=ya.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:b,fragmentShaderSource:v,attributeLocations:sV})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}const w=e.commandList;if(h.render||h.pick){const t=this._colorCommands,i=this._blendOption===Rk.OPAQUE,o=this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT,r=this._vaf.va,s=r.length;let a,c=this._uniforms;D(this._batchTable)?(c=this._batchTable.getUniformMapCallback()(c),a=this._batchTable.getPickId()):a="v_pickColor",t.length=s;const l=o?2*s:s;for(let e=0;e<l;++e){let s=t[e];D(s)||(s=t[e]=new Kr);const l=i||o&&e%2==0;s.pass=l||!o?zt.OPAQUE:zt.TRANSLUCENT,s.owner=this;const u=o?Math.floor(e/2):e;s.boundingVolume=f,s.modelMatrix=m,s.count=r[u].indicesCount,s.shaderProgram=l?this._sp:this._spTranslucent,s.uniformMap=c,s.vertexArray=r[u].va,s.renderState=l?this._rsOpaque:this._rsTranslucent,s.debugShowBoundingVolume=this.debugShowBoundingVolume,s.pickId=a,this._instanced&&(s.count=6,s.instanceCount=n),w.push(s)}this.debugShowTextureAtlas&&(D(this.debugCommand)||(this.debugCommand=function(e,t){const n=t.createViewportQuadCommand("uniform sampler2D billboard_texture; \nin vec2 v_textureCoordinates; \nvoid main() \n{ \n out_FragColor = texture(billboard_texture, v_textureCoordinates); \n} \n",{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return n.pass=zt.OVERLAY,n}(this,e.context)),w.push(this.debugCommand))}},lV.prototype.isDestroyed=function(){return!1},lV.prototype.destroy=function(){return D(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(),uV(this._billboards),He(this)};const zV=new Qt;function UV(e){const t=e._billboard;if(D(e._billboardImage)&&e._billboardImage!==t.image)return void(t.image=e._billboardImage);if(D(e._billboardImage))return;const n=M(e._color,BV.defaultColor),i=M(e._pointOutlineColor,BV.defaultPointOutlineColor),o=M(e._pointOutlineWidth,BV.defaultPointOutlineWidth),r=M(e._pointSize,BV.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,c=e._billboardOutlineWidth,l=e._billboardSize;if(Ot.equals(n,s)&&Ot.equals(i,a)&&o===c&&r===l)return;e._billboardColor=Ot.clone(n,e._billboardColor),e._billboardOutlineColor=Ot.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;const u=n.alpha,d=n.toCssColorString(),h=i.toCssColorString(),p=JSON.stringify([d,r,h,o]);t.setImage(p,FV(u,d,h,o,r))}let kV;function VV(e,t){if(!D(e))throw new P("text is required.");if(""===e)return;t=M(t,M.EMPTY_OBJECT);const n=M(t.font,"10px sans-serif"),i=M(t.stroke,!1),o=M(t.fill,!0),r=M(t.strokeWidth,1),s=M(t.backgroundColor,Ot.TRANSPARENT),a=M(t.padding,0),c=2*a,l=document.createElement("canvas");l.width=1,l.height=1,l.style.font=n;const u=l.getContext("2d",{willReadFrequently:!0});D(kV)||(D(u.imageSmoothingEnabled)?kV="imageSmoothingEnabled":D(u.mozImageSmoothingEnabled)?kV="mozImageSmoothingEnabled":D(u.webkitImageSmoothingEnabled)?kV="webkitImageSmoothingEnabled":D(u.msImageSmoothingEnabled)&&(kV="msImageSmoothingEnabled")),u.font=n,u.lineJoin="round",u.lineWidth=r,u[kV]=!1,l.style.visibility="hidden",document.body.appendChild(l);const d=function(e,t,n,i,o){const r=e.measureText(t);if(/\S/.test(t)){const s=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),a=document.createElement("canvas"),c=100,l=r.width+c|0,u=3*s,d=u/2;a.width=l,a.height=u;const h=a.getContext("2d");h.font=n,h.fillStyle="white",h.fillRect(0,0,a.width+1,a.height+1),i&&(h.strokeStyle="black",h.lineWidth=e.lineWidth,h.strokeText(t,c/2,d)),o&&(h.fillStyle="black",h.fillText(t,c/2,d));const p=h.getImageData(0,0,l,u).data,f=p.length,m=4*l;let _,g,y,b;for(_=0;_<f;++_)if(255!==p[_]){y=_/m|0;break}for(_=f-1;_>=0;--_)if(255!==p[_]){b=_/m|0;break}let v=-1;for(_=0;_<l&&-1===v;++_)for(g=0;g<u;++g){const e=4*_+g*m;if(255!==p[e]||255!==p[e+1]||255!==p[e+2]||255!==p[e+3]){v=_;break}}return{width:r.width,height:b-y,ascent:d-y,descent:b-d,minx:v-c/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}(u,e,n,i,o);l.dimensions=d,document.body.removeChild(l),l.style.visibility="";const h=-d.minx,p=Math.ceil(d.width)+h+c,f=d.height+c,m=f-(f-d.ascent+a)+c;if(l.width=p,l.height=f,u.font=n,u.lineJoin="round",u.lineWidth=r,u[kV]=!1,s!==Ot.TRANSPARENT&&(u.fillStyle=s.toCssColorString(),u.fillRect(0,0,l.width,l.height)),i){const n=M(t.strokeColor,Ot.BLACK);u.strokeStyle=n.toCssColorString(),u.strokeText(e,h+a,m)}if(o){const n=M(t.fillColor,Ot.WHITE);u.fillStyle=n.toCssColorString(),u.fillText(e,h+a,m)}return l}Object.defineProperties(BV.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=Ot.clone(e,this._color),UV(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,UV(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Ot.clone(e,this._pointOutlineColor),UV(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,UV(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){D(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){const t=M(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,zV);i.height=i.height-t+e;const o=n.cartographicToCartesian(i);this._billboard.position=o,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],o],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=Ot.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){const t=this._billboardImage!==e;this._billboardImage=e,t&&UV(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){const e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}}),BV.defaultColor=Ot.WHITE,BV.defaultPointOutlineColor=Ot.BLACK,BV.defaultPointOutlineWidth=0,BV.defaultPointSize=8,BV.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)},BV.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)},BV.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)},BV.prototype.getPropertyInherited=function(e){return uE.getPropertyInherited(this._content,this._batchId,e)},BV.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0},BV.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)},BV.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)},BV.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var HV=function(e,t){t||(t={});var n,i,o,r,s,a,c,l,u,d,h,p=null==t.cutoff?.25:t.cutoff,f=null==t.radius?8:t.radius,m=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");n=t.width,i=t.height,r=e,a=t.stride?t.stride:Math.floor(e.length/n/i)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(c=(l=e).getContext("2d"),n=l.width,i=l.height,r=(u=c.getImageData(0,0,n,i)).data,a=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(c=e,n=(l=e.canvas).width,i=l.height,r=(u=c.getImageData(0,0,n,i)).data,a=4):window.ImageData&&e instanceof window.ImageData&&(u=e,n=e.width,i=e.height,r=u.data,a=4);if(o=Math.max(n,i),window.Uint8ClampedArray&&r instanceof window.Uint8ClampedArray||window.Uint8Array&&r instanceof window.Uint8Array)for(s=r,r=Array(n*i),d=0,h=Math.floor(s.length/a);d<h;d++)r[d]=s[d*a+m]/255;else if(1!==a)throw Error("Raw data can have only 1 value per pixel");var _=Array(n*i),g=Array(n*i),y=Array(o),b=Array(o),v=Array(o+1),A=Array(o);for(d=0,h=n*i;d<h;d++){var T=r[d];_[d]=1===T?0:0===T?GV:Math.pow(Math.max(0,.5-T),2),g[d]=1===T?GV:0===T?0:Math.pow(Math.max(0,T-.5),2)}jV(_,n,i,y,b,A,v),jV(g,n,i,y,b,A,v);var w=window.Float32Array?new Float32Array(n*i):new Array(n*i);for(d=0,h=n*i;d<h;d++)w[d]=Math.min(Math.max(1-((_[d]-g[d])/f+p),0),1);return w},GV=1e20;function jV(e,t,n,i,o,r,s){for(var a=0;a<t;a++){for(var c=0;c<n;c++)i[c]=e[c*t+a];for(WV(i,o,r,s,n),c=0;c<n;c++)e[c*t+a]=o[c]}for(c=0;c<n;c++){for(a=0;a<t;a++)i[a]=e[c*t+a];for(WV(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function WV(e,t,n,i,o){n[0]=0,i[0]=-GV,i[1]=+GV;for(var r=1,s=0;r<o;r++){for(var a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);a<=i[s];)s--,a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);n[++s]=r,i[s]=a,i[s+1]=+GV}for(r=0,s=0;r<o;r++){for(;i[s+1]<r;)s++;t[r]=(r-n[s])*(r-n[s])+e[n[s]]}}const qV=Object.freeze({FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2}),YV={};let XV=0;const QV=new Ot(.165,.165,.165,.8),$V=new kt(7,5),KV=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function ZV(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function JV(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function eH(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function tH(e){let t=YV[e._font];if(!D(t)){const n=document.createElement("div");n.style.position="absolute",n.style.opacity=0,n.style.font=e._font,document.body.appendChild(n);let i=parseFloat(eH(n,"line-height"));isNaN(i)&&(i=void 0),t={family:eH(n,"font-family"),size:eH(n,"font-size").replace("px",""),style:eH(n,"font-style"),weight:eH(n,"font-weight"),lineHeight:i},document.body.removeChild(n),XV<256&&(YV[e._font]=t,XV++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function nH(e,t){if(D((e=M(e,M.EMPTY_OBJECT)).disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new P("disableDepthTestDistance must be greater than 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(D(n)){if(n.far<=n.near)throw new P("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Au.clone(n)}if(D(i)){if(i.far<=i.near)throw new P("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Au.clone(i)}if(D(o)){if(o.far<=o.near)throw new P("scaleByDistance.far must be greater than scaleByDistance.near.");o=Au.clone(o)}if(D(r)){if(r.far<=r.near)throw new P("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=vu.clone(r)}this._renderedText=void 0,this._text=void 0,this._show=M(e.show,!0),this._font=M(e.font,"30px sans-serif"),this._fillColor=Ot.clone(M(e.fillColor,Ot.WHITE)),this._outlineColor=Ot.clone(M(e.outlineColor,Ot.BLACK)),this._outlineWidth=M(e.outlineWidth,1),this._showBackground=M(e.showBackground,!1),this._backgroundColor=Ot.clone(M(e.backgroundColor,QV)),this._backgroundPadding=kt.clone(M(e.backgroundPadding,$V)),this._style=M(e.style,qV.FILL),this._verticalOrigin=M(e.verticalOrigin,Cu.BASELINE),this._horizontalOrigin=M(e.horizontalOrigin,Su.LEFT),this._pixelOffset=kt.clone(M(e.pixelOffset,kt.ZERO)),this._eyeOffset=H.clone(M(e.eyeOffset,H.ZERO)),this._position=H.clone(M(e.position,H.ZERO)),this._scale=M(e.scale,1),this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=o,this._heightReference=M(e.heightReference,wu.NONE),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=M(e.text,""),this._relativeSize=1,tH(this),this._updateClamping()}function iH(e,t){const n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[];let r="",s=KV.LTR,a="";const c=e.length;for(let l=0;l<c;++l){const c=e.charAt(l);a=t.test(c)?KV.RTL:n.test(c)?KV.LTR:i.test(c)?KV.BRACKETS:KV.WEAK,0===l&&(s=a),s===a&&a!==KV.BRACKETS?r+=c:(""!==r&&o.push({Type:s,Word:r}),s=a,r=c)}return o.push({Type:a,Word:r}),o}function oH(e){return e.split("").reverse().join("")}function rH(e,t,n){return e.slice(0,t)+n+e.slice(t)}function sH(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}Object.defineProperties(nH.prototype,{show:{get:function(){return this._show},set:function(e){if(!D(e))throw new P("value is required.");if(this._show!==e){this._show=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i].billboard;D(n)&&(n.show=e)}const n=this._backgroundBillboard;D(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){if(!D(e))throw new P("value is required.");const t=this._position;if(!H.equals(t,e)){H.clone(e,t);const n=this._glyphs;for(let t=0,o=n.length;t<o;t++){const i=n[t].billboard;D(i)&&(i.position=e)}const i=this._backgroundBillboard;D(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(!D(e))throw new P("value is required.");if(e!==this._heightReference){this._heightReference=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i].billboard;D(n)&&(n.heightReference=e)}const n=this._backgroundBillboard;D(n)&&(n.heightReference=e),JV(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(!D(e))throw new P("value is required.");if(this._text!==e){this._text=e;const t=e.replace(/\u00ad/g,"");this._renderedText=nH.enableRightToLeftDetection?function(e){const t=e.split("\n");let n="";for(let i=0;i<t.length;i++){const e=t[i],o=aH.test(e.charAt(0)),r=iH(e,aH);let s=0,a="";for(let t=0;t<r.length;++t){const e=r[t],n=e.Type===KV.BRACKETS?sH(e.Word):oH(e.Word);o?e.Type===KV.RTL?(a=n+a,s=0):e.Type===KV.LTR?(a=rH(a,s,e.Word),s+=e.Word.length):e.Type!==KV.WEAK&&e.Type!==KV.BRACKETS||(e.Type===KV.WEAK&&r[t-1].Type===KV.BRACKETS?a=n+a:r[t-1].Type===KV.RTL?(a=n+a,s=0):r.length>t+1?r[t+1].Type===KV.RTL?(a=n+a,s=0):(a=rH(a,s,e.Word),s+=e.Word.length):a=rH(a,0,n)):e.Type===KV.RTL?a=rH(a,s,n):e.Type===KV.LTR?(a+=e.Word,s=a.length):e.Type!==KV.WEAK&&e.Type!==KV.BRACKETS||(t>0&&r[t-1].Type===KV.RTL?r.length>t+1?r[t+1].Type===KV.RTL?a=rH(a,s,n):(a+=e.Word,s=a.length):a+=e.Word:(a+=e.Word,s=a.length))}n+=a,i<t.length-1&&(n+="\n")}return n}(t):t,ZV(this)}}},font:{get:function(){return this._font},set:function(e){if(!D(e))throw new P("value is required.");this._font!==e&&(this._font=e,ZV(this),tH(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){if(!D(e))throw new P("value is required.");const t=this._fillColor;Ot.equals(t,e)||(Ot.clone(e,t),ZV(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!D(e))throw new P("value is required.");const t=this._outlineColor;Ot.equals(t,e)||(Ot.clone(e,t),ZV(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!D(e))throw new P("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,ZV(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){if(!D(e))throw new P("value is required.");this._showBackground!==e&&(this._showBackground=e,ZV(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){if(!D(e))throw new P("value is required.");const t=this._backgroundColor;if(!Ot.equals(t,e)){Ot.clone(e,t);const n=this._backgroundBillboard;D(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){if(!D(e))throw new P("value is required.");const t=this._backgroundPadding;kt.equals(t,e)||(kt.clone(e,t),JV(this))}},style:{get:function(){return this._style},set:function(e){if(!D(e))throw new P("value is required.");this._style!==e&&(this._style=e,ZV(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){if(!D(e))throw new P("value is required.");const t=this._pixelOffset;if(!kt.equals(t,e)){kt.clone(e,t);const n=this._glyphs;for(let t=0,o=n.length;t<o;t++){const i=n[t];D(i.billboard)&&(i.billboard.pixelOffset=e)}const i=this._backgroundBillboard;D(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far distance must be greater than near distance.");const t=this._translucencyByDistance;if(!Au.equals(t,e)){this._translucencyByDistance=Au.clone(e,t);const n=this._glyphs;for(let t=0,o=n.length;t<o;t++){const i=n[t];D(i.billboard)&&(i.billboard.translucencyByDistance=e)}const i=this._backgroundBillboard;D(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;if(!Au.equals(t,e)){this._pixelOffsetScaleByDistance=Au.clone(e,t);const n=this._glyphs;for(let t=0,o=n.length;t<o;t++){const i=n[t];D(i.billboard)&&(i.billboard.pixelOffsetScaleByDistance=e)}const i=this._backgroundBillboard;D(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far distance must be greater than near distance.");const t=this._scaleByDistance;if(!Au.equals(t,e)){this._scaleByDistance=Au.clone(e,t);const n=this._glyphs;for(let t=0,o=n.length;t<o;t++){const i=n[t];D(i.billboard)&&(i.billboard.scaleByDistance=e)}const i=this._backgroundBillboard;D(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){if(!D(e))throw new P("value is required.");const t=this._eyeOffset;if(!H.equals(t,e)){H.clone(e,t);const n=this._glyphs;for(let t=0,o=n.length;t<o;t++){const i=n[t];D(i.billboard)&&(i.billboard.eyeOffset=e)}const i=this._backgroundBillboard;D(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){if(!D(e))throw new P("value is required.");this._horizontalOrigin!==e&&(this._horizontalOrigin=e,JV(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(!D(e))throw new P("value is required.");if(this._verticalOrigin!==e){this._verticalOrigin=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard.verticalOrigin=e)}const n=this._backgroundBillboard;D(n)&&(n.verticalOrigin=e),JV(this)}}},scale:{get:function(){return this._scale},set:function(e){if(!D(e))throw new P("value is required.");if(this._scale!==e){this._scale=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard.scale=e*this._relativeSize)}const n=this._backgroundBillboard;D(n)&&(n.scale=e*this._relativeSize),JV(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far must be greater than near");if(!vu.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=vu.clone(e,this._distanceDisplayCondition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard.distanceDisplayCondition=e)}const n=this._backgroundBillboard;D(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(D(e)&&e<0)throw new P("disableDepthTestDistance must be greater than 0.0.");this._disableDepthTestDistance=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard.disableDepthTestDistance=e)}const n=this._backgroundBillboard;D(n)&&(n.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard.id=e)}const n=this._backgroundBillboard;D(n)&&(n.id=e)}}},pickId:{get:function(){if(0!==this._glyphs.length&&D(this._glyphs[0].billboard))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=H.clone(e,this._actualClampedPosition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard._clampedPosition=e)}const n=this._backgroundBillboard;D(n)&&(n._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const n=t[i];D(n.billboard)&&(n.billboard.clusterShow=e)}const n=this._backgroundBillboard;D(n)&&(n.clusterShow=e)}}}}),nH.prototype._updateClamping=function(){uk._updateClamping(this._labelCollection,this)},nH.prototype.computeScreenSpacePosition=function(e,t){if(!D(e))throw new P("scene is required.");D(t)||(t=new kt);const n=this._labelCollection.modelMatrix,i=D(this._actualClampedPosition)?this._actualClampedPosition:this._position;return uk._computeScreenSpacePosition(n,i,this._eyeOffset,this._pixelOffset,e,t)},nH.getScreenSpaceBoundingBox=function(e,t,n){let i=0,o=0,r=0,s=0;const a=e.totalScale,c=e._backgroundBillboard;if(D(c))i=t.x+c._translate.x,o=t.y-c._translate.y,r=c.width*a,s=c.height*a,e.verticalOrigin===Cu.BOTTOM||e.verticalOrigin===Cu.BASELINE?o-=s:e.verticalOrigin===Cu.CENTER&&(o-=.5*s);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let n=0,c=0;const l=e._glyphs,u=l.length;for(let r=0;r<u;++r){const s=l[r],u=s.billboard;if(!D(u))continue;const d=t.x+u._translate.x;let h=t.y-u._translate.y;const p=s.dimensions.width*a,f=s.dimensions.height*a;e.verticalOrigin===Cu.BOTTOM||e.verticalOrigin===Cu.BASELINE?h-=f:e.verticalOrigin===Cu.CENTER&&(h-=.5*f),e._verticalOrigin===Cu.TOP?h+=Lk.PADDING*a:e._verticalOrigin!==Cu.BOTTOM&&e._verticalOrigin!==Cu.BASELINE||(h-=Lk.PADDING*a),i=Math.min(i,d),o=Math.min(o,h),n=Math.max(n,d+p),c=Math.max(c,h+f)}r=n-i,s=c-o}return D(n)||(n=new Fr),n.x=i,n.y=o,n.width=r,n.height=s,n},nH.prototype.equals=function(e){return this===e||D(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&&H.equals(this._position,e._position)&&Ot.equals(this._fillColor,e._fillColor)&&Ot.equals(this._outlineColor,e._outlineColor)&&Ot.equals(this._backgroundColor,e._backgroundColor)&&kt.equals(this._backgroundPadding,e._backgroundPadding)&&kt.equals(this._pixelOffset,e._pixelOffset)&&H.equals(this._eyeOffset,e._eyeOffset)&&Au.equals(this._translucencyByDistance,e._translucencyByDistance)&&Au.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Au.equals(this._scaleByDistance,e._scaleByDistance)&&vu.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id},nH.prototype.isDestroyed=function(){return!1},nH.enableRightToLeftDetection=!1;const aH=new RegExp("[א-ת-ۿݐ-ݿࢠ-ࣿ]");var cH={exports:{}};!function(e){e.exports&&(e.exports=function(){var e=3,t=4,n=12,i=13,o=16,r=17;function s(e,t){void 0===t&&(t=0);var n=e.charCodeAt(t);if(55296<=n&&n<=56319&&t<e.length-1){var i=n;return 56320<=(o=e.charCodeAt(t+1))&&o<=57343?1024*(i-55296)+(o-56320)+65536:i}if(56320<=n&&n<=57343&&t>=1){var o=n;return 55296<=(i=e.charCodeAt(t-1))&&i<=56319?1024*(i-55296)+(o-56320)+65536:o}return n}function a(s,a,c){var l=[s].concat(a).concat([c]),u=l[l.length-2],d=c,h=l.lastIndexOf(14);if(h>1&&l.slice(1,h).every((function(t){return t==e}))&&-1==[e,i,r].indexOf(s))return 2;var p=l.lastIndexOf(t);if(p>0&&l.slice(1,p).every((function(e){return e==t}))&&-1==[n,t].indexOf(u))return l.filter((function(e){return e==t})).length%2==1?3:4;if(0==u&&1==d)return 0;if(2==u||0==u||1==u)return 14==d&&a.every((function(t){return t==e}))?2:1;if(2==d||0==d||1==d)return 1;if(6==u&&(6==d||7==d||9==d||10==d))return 0;if(!(9!=u&&7!=u||7!=d&&8!=d))return 0;if((10==u||8==u)&&8==d)return 0;if(d==e||15==d)return 0;if(5==d)return 0;if(u==n)return 0;var f=-1!=l.indexOf(e)?l.lastIndexOf(e)-1:l.length-2;return-1!=[i,r].indexOf(l[f])&&l.slice(f+1,-1).every((function(t){return t==e}))&&14==d||15==u&&-1!=[o,r].indexOf(d)?0:-1!=a.indexOf(t)?2:u==t&&d==t?0:1}function c(s){return 1536<=s&&s<=1541||1757==s||1807==s||2274==s||3406==s||69821==s||70082<=s&&s<=70083||72250==s||72326<=s&&s<=72329||73030==s?n:13==s?0:10==s?1:0<=s&&s<=9||11<=s&&s<=12||14<=s&&s<=31||127<=s&&s<=159||173==s||1564==s||6158==s||8203==s||8206<=s&&s<=8207||8232==s||8233==s||8234<=s&&s<=8238||8288<=s&&s<=8292||8293==s||8294<=s&&s<=8303||55296<=s&&s<=57343||65279==s||65520<=s&&s<=65528||65529<=s&&s<=65531||113824<=s&&s<=113827||119155<=s&&s<=119162||917504==s||917505==s||917506<=s&&s<=917535||917632<=s&&s<=917759||918e3<=s&&s<=921599?2:768<=s&&s<=879||1155<=s&&s<=1159||1160<=s&&s<=1161||1425<=s&&s<=1469||1471==s||1473<=s&&s<=1474||1476<=s&&s<=1477||1479==s||1552<=s&&s<=1562||1611<=s&&s<=1631||1648==s||1750<=s&&s<=1756||1759<=s&&s<=1764||1767<=s&&s<=1768||1770<=s&&s<=1773||1809==s||1840<=s&&s<=1866||1958<=s&&s<=1968||2027<=s&&s<=2035||2070<=s&&s<=2073||2075<=s&&s<=2083||2085<=s&&s<=2087||2089<=s&&s<=2093||2137<=s&&s<=2139||2260<=s&&s<=2273||2275<=s&&s<=2306||2362==s||2364==s||2369<=s&&s<=2376||2381==s||2385<=s&&s<=2391||2402<=s&&s<=2403||2433==s||2492==s||2494==s||2497<=s&&s<=2500||2509==s||2519==s||2530<=s&&s<=2531||2561<=s&&s<=2562||2620==s||2625<=s&&s<=2626||2631<=s&&s<=2632||2635<=s&&s<=2637||2641==s||2672<=s&&s<=2673||2677==s||2689<=s&&s<=2690||2748==s||2753<=s&&s<=2757||2759<=s&&s<=2760||2765==s||2786<=s&&s<=2787||2810<=s&&s<=2815||2817==s||2876==s||2878==s||2879==s||2881<=s&&s<=2884||2893==s||2902==s||2903==s||2914<=s&&s<=2915||2946==s||3006==s||3008==s||3021==s||3031==s||3072==s||3134<=s&&s<=3136||3142<=s&&s<=3144||3146<=s&&s<=3149||3157<=s&&s<=3158||3170<=s&&s<=3171||3201==s||3260==s||3263==s||3266==s||3270==s||3276<=s&&s<=3277||3285<=s&&s<=3286||3298<=s&&s<=3299||3328<=s&&s<=3329||3387<=s&&s<=3388||3390==s||3393<=s&&s<=3396||3405==s||3415==s||3426<=s&&s<=3427||3530==s||3535==s||3538<=s&&s<=3540||3542==s||3551==s||3633==s||3636<=s&&s<=3642||3655<=s&&s<=3662||3761==s||3764<=s&&s<=3769||3771<=s&&s<=3772||3784<=s&&s<=3789||3864<=s&&s<=3865||3893==s||3895==s||3897==s||3953<=s&&s<=3966||3968<=s&&s<=3972||3974<=s&&s<=3975||3981<=s&&s<=3991||3993<=s&&s<=4028||4038==s||4141<=s&&s<=4144||4146<=s&&s<=4151||4153<=s&&s<=4154||4157<=s&&s<=4158||4184<=s&&s<=4185||4190<=s&&s<=4192||4209<=s&&s<=4212||4226==s||4229<=s&&s<=4230||4237==s||4253==s||4957<=s&&s<=4959||5906<=s&&s<=5908||5938<=s&&s<=5940||5970<=s&&s<=5971||6002<=s&&s<=6003||6068<=s&&s<=6069||6071<=s&&s<=6077||6086==s||6089<=s&&s<=6099||6109==s||6155<=s&&s<=6157||6277<=s&&s<=6278||6313==s||6432<=s&&s<=6434||6439<=s&&s<=6440||6450==s||6457<=s&&s<=6459||6679<=s&&s<=6680||6683==s||6742==s||6744<=s&&s<=6750||6752==s||6754==s||6757<=s&&s<=6764||6771<=s&&s<=6780||6783==s||6832<=s&&s<=6845||6846==s||6912<=s&&s<=6915||6964==s||6966<=s&&s<=6970||6972==s||6978==s||7019<=s&&s<=7027||7040<=s&&s<=7041||7074<=s&&s<=7077||7080<=s&&s<=7081||7083<=s&&s<=7085||7142==s||7144<=s&&s<=7145||7149==s||7151<=s&&s<=7153||7212<=s&&s<=7219||7222<=s&&s<=7223||7376<=s&&s<=7378||7380<=s&&s<=7392||7394<=s&&s<=7400||7405==s||7412==s||7416<=s&&s<=7417||7616<=s&&s<=7673||7675<=s&&s<=7679||8204==s||8400<=s&&s<=8412||8413<=s&&s<=8416||8417==s||8418<=s&&s<=8420||8421<=s&&s<=8432||11503<=s&&s<=11505||11647==s||11744<=s&&s<=11775||12330<=s&&s<=12333||12334<=s&&s<=12335||12441<=s&&s<=12442||42607==s||42608<=s&&s<=42610||42612<=s&&s<=42621||42654<=s&&s<=42655||42736<=s&&s<=42737||43010==s||43014==s||43019==s||43045<=s&&s<=43046||43204<=s&&s<=43205||43232<=s&&s<=43249||43302<=s&&s<=43309||43335<=s&&s<=43345||43392<=s&&s<=43394||43443==s||43446<=s&&s<=43449||43452==s||43493==s||43561<=s&&s<=43566||43569<=s&&s<=43570||43573<=s&&s<=43574||43587==s||43596==s||43644==s||43696==s||43698<=s&&s<=43700||43703<=s&&s<=43704||43710<=s&&s<=43711||43713==s||43756<=s&&s<=43757||43766==s||44005==s||44008==s||44013==s||64286==s||65024<=s&&s<=65039||65056<=s&&s<=65071||65438<=s&&s<=65439||66045==s||66272==s||66422<=s&&s<=66426||68097<=s&&s<=68099||68101<=s&&s<=68102||68108<=s&&s<=68111||68152<=s&&s<=68154||68159==s||68325<=s&&s<=68326||69633==s||69688<=s&&s<=69702||69759<=s&&s<=69761||69811<=s&&s<=69814||69817<=s&&s<=69818||69888<=s&&s<=69890||69927<=s&&s<=69931||69933<=s&&s<=69940||70003==s||70016<=s&&s<=70017||70070<=s&&s<=70078||70090<=s&&s<=70092||70191<=s&&s<=70193||70196==s||70198<=s&&s<=70199||70206==s||70367==s||70371<=s&&s<=70378||70400<=s&&s<=70401||70460==s||70462==s||70464==s||70487==s||70502<=s&&s<=70508||70512<=s&&s<=70516||70712<=s&&s<=70719||70722<=s&&s<=70724||70726==s||70832==s||70835<=s&&s<=70840||70842==s||70845==s||70847<=s&&s<=70848||70850<=s&&s<=70851||71087==s||71090<=s&&s<=71093||71100<=s&&s<=71101||71103<=s&&s<=71104||71132<=s&&s<=71133||71219<=s&&s<=71226||71229==s||71231<=s&&s<=71232||71339==s||71341==s||71344<=s&&s<=71349||71351==s||71453<=s&&s<=71455||71458<=s&&s<=71461||71463<=s&&s<=71467||72193<=s&&s<=72198||72201<=s&&s<=72202||72243<=s&&s<=72248||72251<=s&&s<=72254||72263==s||72273<=s&&s<=72278||72281<=s&&s<=72283||72330<=s&&s<=72342||72344<=s&&s<=72345||72752<=s&&s<=72758||72760<=s&&s<=72765||72767==s||72850<=s&&s<=72871||72874<=s&&s<=72880||72882<=s&&s<=72883||72885<=s&&s<=72886||73009<=s&&s<=73014||73018==s||73020<=s&&s<=73021||73023<=s&&s<=73029||73031==s||92912<=s&&s<=92916||92976<=s&&s<=92982||94095<=s&&s<=94098||113821<=s&&s<=113822||119141==s||119143<=s&&s<=119145||119150<=s&&s<=119154||119163<=s&&s<=119170||119173<=s&&s<=119179||119210<=s&&s<=119213||119362<=s&&s<=119364||121344<=s&&s<=121398||121403<=s&&s<=121452||121461==s||121476==s||121499<=s&&s<=121503||121505<=s&&s<=121519||122880<=s&&s<=122886||122888<=s&&s<=122904||122907<=s&&s<=122913||122915<=s&&s<=122916||122918<=s&&s<=122922||125136<=s&&s<=125142||125252<=s&&s<=125258||917536<=s&&s<=917631||917760<=s&&s<=917999?e:127462<=s&&s<=127487?t:2307==s||2363==s||2366<=s&&s<=2368||2377<=s&&s<=2380||2382<=s&&s<=2383||2434<=s&&s<=2435||2495<=s&&s<=2496||2503<=s&&s<=2504||2507<=s&&s<=2508||2563==s||2622<=s&&s<=2624||2691==s||2750<=s&&s<=2752||2761==s||2763<=s&&s<=2764||2818<=s&&s<=2819||2880==s||2887<=s&&s<=2888||2891<=s&&s<=2892||3007==s||3009<=s&&s<=3010||3014<=s&&s<=3016||3018<=s&&s<=3020||3073<=s&&s<=3075||3137<=s&&s<=3140||3202<=s&&s<=3203||3262==s||3264<=s&&s<=3265||3267<=s&&s<=3268||3271<=s&&s<=3272||3274<=s&&s<=3275||3330<=s&&s<=3331||3391<=s&&s<=3392||3398<=s&&s<=3400||3402<=s&&s<=3404||3458<=s&&s<=3459||3536<=s&&s<=3537||3544<=s&&s<=3550||3570<=s&&s<=3571||3635==s||3763==s||3902<=s&&s<=3903||3967==s||4145==s||4155<=s&&s<=4156||4182<=s&&s<=4183||4228==s||6070==s||6078<=s&&s<=6085||6087<=s&&s<=6088||6435<=s&&s<=6438||6441<=s&&s<=6443||6448<=s&&s<=6449||6451<=s&&s<=6456||6681<=s&&s<=6682||6741==s||6743==s||6765<=s&&s<=6770||6916==s||6965==s||6971==s||6973<=s&&s<=6977||6979<=s&&s<=6980||7042==s||7073==s||7078<=s&&s<=7079||7082==s||7143==s||7146<=s&&s<=7148||7150==s||7154<=s&&s<=7155||7204<=s&&s<=7211||7220<=s&&s<=7221||7393==s||7410<=s&&s<=7411||7415==s||43043<=s&&s<=43044||43047==s||43136<=s&&s<=43137||43188<=s&&s<=43203||43346<=s&&s<=43347||43395==s||43444<=s&&s<=43445||43450<=s&&s<=43451||43453<=s&&s<=43456||43567<=s&&s<=43568||43571<=s&&s<=43572||43597==s||43755==s||43758<=s&&s<=43759||43765==s||44003<=s&&s<=44004||44006<=s&&s<=44007||44009<=s&&s<=44010||44012==s||69632==s||69634==s||69762==s||69808<=s&&s<=69810||69815<=s&&s<=69816||69932==s||70018==s||70067<=s&&s<=70069||70079<=s&&s<=70080||70188<=s&&s<=70190||70194<=s&&s<=70195||70197==s||70368<=s&&s<=70370||70402<=s&&s<=70403||70463==s||70465<=s&&s<=70468||70471<=s&&s<=70472||70475<=s&&s<=70477||70498<=s&&s<=70499||70709<=s&&s<=70711||70720<=s&&s<=70721||70725==s||70833<=s&&s<=70834||70841==s||70843<=s&&s<=70844||70846==s||70849==s||71088<=s&&s<=71089||71096<=s&&s<=71099||71102==s||71216<=s&&s<=71218||71227<=s&&s<=71228||71230==s||71340==s||71342<=s&&s<=71343||71350==s||71456<=s&&s<=71457||71462==s||72199<=s&&s<=72200||72249==s||72279<=s&&s<=72280||72343==s||72751==s||72766==s||72873==s||72881==s||72884==s||94033<=s&&s<=94078||119142==s||119149==s?5:4352<=s&&s<=4447||43360<=s&&s<=43388?6:4448<=s&&s<=4519||55216<=s&&s<=55238?7:4520<=s&&s<=4607||55243<=s&&s<=55291?8:44032==s||44060==s||44088==s||44116==s||44144==s||44172==s||44200==s||44228==s||44256==s||44284==s||44312==s||44340==s||44368==s||44396==s||44424==s||44452==s||44480==s||44508==s||44536==s||44564==s||44592==s||44620==s||44648==s||44676==s||44704==s||44732==s||44760==s||44788==s||44816==s||44844==s||44872==s||44900==s||44928==s||44956==s||44984==s||45012==s||45040==s||45068==s||45096==s||45124==s||45152==s||45180==s||45208==s||45236==s||45264==s||45292==s||45320==s||45348==s||45376==s||45404==s||45432==s||45460==s||45488==s||45516==s||45544==s||45572==s||45600==s||45628==s||45656==s||45684==s||45712==s||45740==s||45768==s||45796==s||45824==s||45852==s||45880==s||45908==s||45936==s||45964==s||45992==s||46020==s||46048==s||46076==s||46104==s||46132==s||46160==s||46188==s||46216==s||46244==s||46272==s||46300==s||46328==s||46356==s||46384==s||46412==s||46440==s||46468==s||46496==s||46524==s||46552==s||46580==s||46608==s||46636==s||46664==s||46692==s||46720==s||46748==s||46776==s||46804==s||46832==s||46860==s||46888==s||46916==s||46944==s||46972==s||47e3==s||47028==s||47056==s||47084==s||47112==s||47140==s||47168==s||47196==s||47224==s||47252==s||47280==s||47308==s||47336==s||47364==s||47392==s||47420==s||47448==s||47476==s||47504==s||47532==s||47560==s||47588==s||47616==s||47644==s||47672==s||47700==s||47728==s||47756==s||47784==s||47812==s||47840==s||47868==s||47896==s||47924==s||47952==s||47980==s||48008==s||48036==s||48064==s||48092==s||48120==s||48148==s||48176==s||48204==s||48232==s||48260==s||48288==s||48316==s||48344==s||48372==s||48400==s||48428==s||48456==s||48484==s||48512==s||48540==s||48568==s||48596==s||48624==s||48652==s||48680==s||48708==s||48736==s||48764==s||48792==s||48820==s||48848==s||48876==s||48904==s||48932==s||48960==s||48988==s||49016==s||49044==s||49072==s||49100==s||49128==s||49156==s||49184==s||49212==s||49240==s||49268==s||49296==s||49324==s||49352==s||49380==s||49408==s||49436==s||49464==s||49492==s||49520==s||49548==s||49576==s||49604==s||49632==s||49660==s||49688==s||49716==s||49744==s||49772==s||49800==s||49828==s||49856==s||49884==s||49912==s||49940==s||49968==s||49996==s||50024==s||50052==s||50080==s||50108==s||50136==s||50164==s||50192==s||50220==s||50248==s||50276==s||50304==s||50332==s||50360==s||50388==s||50416==s||50444==s||50472==s||50500==s||50528==s||50556==s||50584==s||50612==s||50640==s||50668==s||50696==s||50724==s||50752==s||50780==s||50808==s||50836==s||50864==s||50892==s||50920==s||50948==s||50976==s||51004==s||51032==s||51060==s||51088==s||51116==s||51144==s||51172==s||51200==s||51228==s||51256==s||51284==s||51312==s||51340==s||51368==s||51396==s||51424==s||51452==s||51480==s||51508==s||51536==s||51564==s||51592==s||51620==s||51648==s||51676==s||51704==s||51732==s||51760==s||51788==s||51816==s||51844==s||51872==s||51900==s||51928==s||51956==s||51984==s||52012==s||52040==s||52068==s||52096==s||52124==s||52152==s||52180==s||52208==s||52236==s||52264==s||52292==s||52320==s||52348==s||52376==s||52404==s||52432==s||52460==s||52488==s||52516==s||52544==s||52572==s||52600==s||52628==s||52656==s||52684==s||52712==s||52740==s||52768==s||52796==s||52824==s||52852==s||52880==s||52908==s||52936==s||52964==s||52992==s||53020==s||53048==s||53076==s||53104==s||53132==s||53160==s||53188==s||53216==s||53244==s||53272==s||53300==s||53328==s||53356==s||53384==s||53412==s||53440==s||53468==s||53496==s||53524==s||53552==s||53580==s||53608==s||53636==s||53664==s||53692==s||53720==s||53748==s||53776==s||53804==s||53832==s||53860==s||53888==s||53916==s||53944==s||53972==s||54e3==s||54028==s||54056==s||54084==s||54112==s||54140==s||54168==s||54196==s||54224==s||54252==s||54280==s||54308==s||54336==s||54364==s||54392==s||54420==s||54448==s||54476==s||54504==s||54532==s||54560==s||54588==s||54616==s||54644==s||54672==s||54700==s||54728==s||54756==s||54784==s||54812==s||54840==s||54868==s||54896==s||54924==s||54952==s||54980==s||55008==s||55036==s||55064==s||55092==s||55120==s||55148==s||55176==s?9:44033<=s&&s<=44059||44061<=s&&s<=44087||44089<=s&&s<=44115||44117<=s&&s<=44143||44145<=s&&s<=44171||44173<=s&&s<=44199||44201<=s&&s<=44227||44229<=s&&s<=44255||44257<=s&&s<=44283||44285<=s&&s<=44311||44313<=s&&s<=44339||44341<=s&&s<=44367||44369<=s&&s<=44395||44397<=s&&s<=44423||44425<=s&&s<=44451||44453<=s&&s<=44479||44481<=s&&s<=44507||44509<=s&&s<=44535||44537<=s&&s<=44563||44565<=s&&s<=44591||44593<=s&&s<=44619||44621<=s&&s<=44647||44649<=s&&s<=44675||44677<=s&&s<=44703||44705<=s&&s<=44731||44733<=s&&s<=44759||44761<=s&&s<=44787||44789<=s&&s<=44815||44817<=s&&s<=44843||44845<=s&&s<=44871||44873<=s&&s<=44899||44901<=s&&s<=44927||44929<=s&&s<=44955||44957<=s&&s<=44983||44985<=s&&s<=45011||45013<=s&&s<=45039||45041<=s&&s<=45067||45069<=s&&s<=45095||45097<=s&&s<=45123||45125<=s&&s<=45151||45153<=s&&s<=45179||45181<=s&&s<=45207||45209<=s&&s<=45235||45237<=s&&s<=45263||45265<=s&&s<=45291||45293<=s&&s<=45319||45321<=s&&s<=45347||45349<=s&&s<=45375||45377<=s&&s<=45403||45405<=s&&s<=45431||45433<=s&&s<=45459||45461<=s&&s<=45487||45489<=s&&s<=45515||45517<=s&&s<=45543||45545<=s&&s<=45571||45573<=s&&s<=45599||45601<=s&&s<=45627||45629<=s&&s<=45655||45657<=s&&s<=45683||45685<=s&&s<=45711||45713<=s&&s<=45739||45741<=s&&s<=45767||45769<=s&&s<=45795||45797<=s&&s<=45823||45825<=s&&s<=45851||45853<=s&&s<=45879||45881<=s&&s<=45907||45909<=s&&s<=45935||45937<=s&&s<=45963||45965<=s&&s<=45991||45993<=s&&s<=46019||46021<=s&&s<=46047||46049<=s&&s<=46075||46077<=s&&s<=46103||46105<=s&&s<=46131||46133<=s&&s<=46159||46161<=s&&s<=46187||46189<=s&&s<=46215||46217<=s&&s<=46243||46245<=s&&s<=46271||46273<=s&&s<=46299||46301<=s&&s<=46327||46329<=s&&s<=46355||46357<=s&&s<=46383||46385<=s&&s<=46411||46413<=s&&s<=46439||46441<=s&&s<=46467||46469<=s&&s<=46495||46497<=s&&s<=46523||46525<=s&&s<=46551||46553<=s&&s<=46579||46581<=s&&s<=46607||46609<=s&&s<=46635||46637<=s&&s<=46663||46665<=s&&s<=46691||46693<=s&&s<=46719||46721<=s&&s<=46747||46749<=s&&s<=46775||46777<=s&&s<=46803||46805<=s&&s<=46831||46833<=s&&s<=46859||46861<=s&&s<=46887||46889<=s&&s<=46915||46917<=s&&s<=46943||46945<=s&&s<=46971||46973<=s&&s<=46999||47001<=s&&s<=47027||47029<=s&&s<=47055||47057<=s&&s<=47083||47085<=s&&s<=47111||47113<=s&&s<=47139||47141<=s&&s<=47167||47169<=s&&s<=47195||47197<=s&&s<=47223||47225<=s&&s<=47251||47253<=s&&s<=47279||47281<=s&&s<=47307||47309<=s&&s<=47335||47337<=s&&s<=47363||47365<=s&&s<=47391||47393<=s&&s<=47419||47421<=s&&s<=47447||47449<=s&&s<=47475||47477<=s&&s<=47503||47505<=s&&s<=47531||47533<=s&&s<=47559||47561<=s&&s<=47587||47589<=s&&s<=47615||47617<=s&&s<=47643||47645<=s&&s<=47671||47673<=s&&s<=47699||47701<=s&&s<=47727||47729<=s&&s<=47755||47757<=s&&s<=47783||47785<=s&&s<=47811||47813<=s&&s<=47839||47841<=s&&s<=47867||47869<=s&&s<=47895||47897<=s&&s<=47923||47925<=s&&s<=47951||47953<=s&&s<=47979||47981<=s&&s<=48007||48009<=s&&s<=48035||48037<=s&&s<=48063||48065<=s&&s<=48091||48093<=s&&s<=48119||48121<=s&&s<=48147||48149<=s&&s<=48175||48177<=s&&s<=48203||48205<=s&&s<=48231||48233<=s&&s<=48259||48261<=s&&s<=48287||48289<=s&&s<=48315||48317<=s&&s<=48343||48345<=s&&s<=48371||48373<=s&&s<=48399||48401<=s&&s<=48427||48429<=s&&s<=48455||48457<=s&&s<=48483||48485<=s&&s<=48511||48513<=s&&s<=48539||48541<=s&&s<=48567||48569<=s&&s<=48595||48597<=s&&s<=48623||48625<=s&&s<=48651||48653<=s&&s<=48679||48681<=s&&s<=48707||48709<=s&&s<=48735||48737<=s&&s<=48763||48765<=s&&s<=48791||48793<=s&&s<=48819||48821<=s&&s<=48847||48849<=s&&s<=48875||48877<=s&&s<=48903||48905<=s&&s<=48931||48933<=s&&s<=48959||48961<=s&&s<=48987||48989<=s&&s<=49015||49017<=s&&s<=49043||49045<=s&&s<=49071||49073<=s&&s<=49099||49101<=s&&s<=49127||49129<=s&&s<=49155||49157<=s&&s<=49183||49185<=s&&s<=49211||49213<=s&&s<=49239||49241<=s&&s<=49267||49269<=s&&s<=49295||49297<=s&&s<=49323||49325<=s&&s<=49351||49353<=s&&s<=49379||49381<=s&&s<=49407||49409<=s&&s<=49435||49437<=s&&s<=49463||49465<=s&&s<=49491||49493<=s&&s<=49519||49521<=s&&s<=49547||49549<=s&&s<=49575||49577<=s&&s<=49603||49605<=s&&s<=49631||49633<=s&&s<=49659||49661<=s&&s<=49687||49689<=s&&s<=49715||49717<=s&&s<=49743||49745<=s&&s<=49771||49773<=s&&s<=49799||49801<=s&&s<=49827||49829<=s&&s<=49855||49857<=s&&s<=49883||49885<=s&&s<=49911||49913<=s&&s<=49939||49941<=s&&s<=49967||49969<=s&&s<=49995||49997<=s&&s<=50023||50025<=s&&s<=50051||50053<=s&&s<=50079||50081<=s&&s<=50107||50109<=s&&s<=50135||50137<=s&&s<=50163||50165<=s&&s<=50191||50193<=s&&s<=50219||50221<=s&&s<=50247||50249<=s&&s<=50275||50277<=s&&s<=50303||50305<=s&&s<=50331||50333<=s&&s<=50359||50361<=s&&s<=50387||50389<=s&&s<=50415||50417<=s&&s<=50443||50445<=s&&s<=50471||50473<=s&&s<=50499||50501<=s&&s<=50527||50529<=s&&s<=50555||50557<=s&&s<=50583||50585<=s&&s<=50611||50613<=s&&s<=50639||50641<=s&&s<=50667||50669<=s&&s<=50695||50697<=s&&s<=50723||50725<=s&&s<=50751||50753<=s&&s<=50779||50781<=s&&s<=50807||50809<=s&&s<=50835||50837<=s&&s<=50863||50865<=s&&s<=50891||50893<=s&&s<=50919||50921<=s&&s<=50947||50949<=s&&s<=50975||50977<=s&&s<=51003||51005<=s&&s<=51031||51033<=s&&s<=51059||51061<=s&&s<=51087||51089<=s&&s<=51115||51117<=s&&s<=51143||51145<=s&&s<=51171||51173<=s&&s<=51199||51201<=s&&s<=51227||51229<=s&&s<=51255||51257<=s&&s<=51283||51285<=s&&s<=51311||51313<=s&&s<=51339||51341<=s&&s<=51367||51369<=s&&s<=51395||51397<=s&&s<=51423||51425<=s&&s<=51451||51453<=s&&s<=51479||51481<=s&&s<=51507||51509<=s&&s<=51535||51537<=s&&s<=51563||51565<=s&&s<=51591||51593<=s&&s<=51619||51621<=s&&s<=51647||51649<=s&&s<=51675||51677<=s&&s<=51703||51705<=s&&s<=51731||51733<=s&&s<=51759||51761<=s&&s<=51787||51789<=s&&s<=51815||51817<=s&&s<=51843||51845<=s&&s<=51871||51873<=s&&s<=51899||51901<=s&&s<=51927||51929<=s&&s<=51955||51957<=s&&s<=51983||51985<=s&&s<=52011||52013<=s&&s<=52039||52041<=s&&s<=52067||52069<=s&&s<=52095||52097<=s&&s<=52123||52125<=s&&s<=52151||52153<=s&&s<=52179||52181<=s&&s<=52207||52209<=s&&s<=52235||52237<=s&&s<=52263||52265<=s&&s<=52291||52293<=s&&s<=52319||52321<=s&&s<=52347||52349<=s&&s<=52375||52377<=s&&s<=52403||52405<=s&&s<=52431||52433<=s&&s<=52459||52461<=s&&s<=52487||52489<=s&&s<=52515||52517<=s&&s<=52543||52545<=s&&s<=52571||52573<=s&&s<=52599||52601<=s&&s<=52627||52629<=s&&s<=52655||52657<=s&&s<=52683||52685<=s&&s<=52711||52713<=s&&s<=52739||52741<=s&&s<=52767||52769<=s&&s<=52795||52797<=s&&s<=52823||52825<=s&&s<=52851||52853<=s&&s<=52879||52881<=s&&s<=52907||52909<=s&&s<=52935||52937<=s&&s<=52963||52965<=s&&s<=52991||52993<=s&&s<=53019||53021<=s&&s<=53047||53049<=s&&s<=53075||53077<=s&&s<=53103||53105<=s&&s<=53131||53133<=s&&s<=53159||53161<=s&&s<=53187||53189<=s&&s<=53215||53217<=s&&s<=53243||53245<=s&&s<=53271||53273<=s&&s<=53299||53301<=s&&s<=53327||53329<=s&&s<=53355||53357<=s&&s<=53383||53385<=s&&s<=53411||53413<=s&&s<=53439||53441<=s&&s<=53467||53469<=s&&s<=53495||53497<=s&&s<=53523||53525<=s&&s<=53551||53553<=s&&s<=53579||53581<=s&&s<=53607||53609<=s&&s<=53635||53637<=s&&s<=53663||53665<=s&&s<=53691||53693<=s&&s<=53719||53721<=s&&s<=53747||53749<=s&&s<=53775||53777<=s&&s<=53803||53805<=s&&s<=53831||53833<=s&&s<=53859||53861<=s&&s<=53887||53889<=s&&s<=53915||53917<=s&&s<=53943||53945<=s&&s<=53971||53973<=s&&s<=53999||54001<=s&&s<=54027||54029<=s&&s<=54055||54057<=s&&s<=54083||54085<=s&&s<=54111||54113<=s&&s<=54139||54141<=s&&s<=54167||54169<=s&&s<=54195||54197<=s&&s<=54223||54225<=s&&s<=54251||54253<=s&&s<=54279||54281<=s&&s<=54307||54309<=s&&s<=54335||54337<=s&&s<=54363||54365<=s&&s<=54391||54393<=s&&s<=54419||54421<=s&&s<=54447||54449<=s&&s<=54475||54477<=s&&s<=54503||54505<=s&&s<=54531||54533<=s&&s<=54559||54561<=s&&s<=54587||54589<=s&&s<=54615||54617<=s&&s<=54643||54645<=s&&s<=54671||54673<=s&&s<=54699||54701<=s&&s<=54727||54729<=s&&s<=54755||54757<=s&&s<=54783||54785<=s&&s<=54811||54813<=s&&s<=54839||54841<=s&&s<=54867||54869<=s&&s<=54895||54897<=s&&s<=54923||54925<=s&&s<=54951||54953<=s&&s<=54979||54981<=s&&s<=55007||55009<=s&&s<=55035||55037<=s&&s<=55063||55065<=s&&s<=55091||55093<=s&&s<=55119||55121<=s&&s<=55147||55149<=s&&s<=55175||55177<=s&&s<=55203?10:9757==s||9977==s||9994<=s&&s<=9997||127877==s||127938<=s&&s<=127940||127943==s||127946<=s&&s<=127948||128066<=s&&s<=128067||128070<=s&&s<=128080||128110==s||128112<=s&&s<=128120||128124==s||128129<=s&&s<=128131||128133<=s&&s<=128135||128170==s||128372<=s&&s<=128373||128378==s||128400==s||128405<=s&&s<=128406||128581<=s&&s<=128583||128587<=s&&s<=128591||128675==s||128692<=s&&s<=128694||128704==s||128716==s||129304<=s&&s<=129308||129310<=s&&s<=129311||129318==s||129328<=s&&s<=129337||129341<=s&&s<=129342||129489<=s&&s<=129501?i:127995<=s&&s<=127999?14:8205==s?15:9792==s||9794==s||9877<=s&&s<=9878||9992==s||10084==s||127752==s||127806==s||127859==s||127891==s||127908==s||127912==s||127979==s||127981==s||128139==s||128187<=s&&s<=128188||128295==s||128300==s||128488==s||128640==s||128658==s?o:128102<=s&&s<=128105?r: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 n,i,o=c(s(e,t)),r=[],l=t+1;l<e.length;l++)if(i=l-1,!(55296<=(n=e).charCodeAt(i)&&n.charCodeAt(i)<=56319&&56320<=n.charCodeAt(i+1)&&n.charCodeAt(i+1)<=57343)){var u=c(s(e,l));if(a(o,r,u))return l;r.push(u)}return e.length},this.splitGraphemes=function(e){for(var t,n=[],i=0;(t=this.nextBreak(e,i))<e.length;)n.push(e.slice(i,t)),i=t;return i<e.length&&n.push(e.slice(i)),n},this.iterateGraphemes=function(e){var t=0,n={next:function(){var n,i;return(i=this.nextBreak(e,t))<e.length?(n=e.slice(t,i),t=i,{value:n,done:!1}):t<e.length?(n=e.slice(t),t=e.length,{value:n,done:!1}):{value:void 0,done:!0}}.bind(this)};return"undefined"!=typeof Symbol&&Symbol.iterator&&(n[Symbol.iterator]=function(){return n}),n},this.countGraphemes=function(e){for(var t,n=0,i=0;(t=this.nextBreak(e,i))<e.length;)i=t,n++;return i<e.length&&n++,n},this})}(cH);const lH=cH.exports;function uH(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function dH(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}const hH="ID_WHITE_PIXEL",pH=new kt(4,4),fH=new Fr(1,1,1,1);const mH={};function _H(e,t,n,i,o,r,s){return mH.font=t,mH.fillColor=n,mH.strokeColor=i,mH.strokeWidth=o,mH.padding=Lk.PADDING,s===Cu.CENTER?mH.textBaseline="middle":s===Cu.TOP?mH.textBaseline="top":mH.textBaseline="bottom",mH.fill=r===qV.FILL||r===qV.FILL_AND_OUTLINE,mH.stroke=r===qV.OUTLINE||r===qV.FILL_AND_OUTLINE,mH.backgroundColor=Ot.BLACK,VV(e,mH)}function gH(e,t){t.textureInfo=void 0,t.dimensions=void 0;const n=t.billboard;D(n)&&(n.show=!1,n.image=void 0,D(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function yH(e,t,n,i){i.index=e.addImageSync(t,n)}const bH=new lH;function vH(e,t){const n=t._renderedText,i=bH.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;let a,c,l;if(t._relativeSize=t._fontSize/Lk.FONT_SIZE,o<s)for(c=o;c<s;++c)gH(e,r[c]);r.length=o;const u=t.show&&t._showBackground&&n.split("\n").join("").length>0;let d=t._backgroundBillboard;const h=e._backgroundBillboardCollection;u?(D(d)||(d=h.add({collection:e,image:hH,imageSubRegion:fH}),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=Su.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,d.clusterShow=t.clusterShow):D(d)&&(h.remove(d),t._backgroundBillboard=d=void 0);const p=e._glyphTextureCache;for(l=0;l<o;++l){const n=i[l],o=t._verticalOrigin,s=JSON.stringify([n,t._fontFamily,t._fontStyle,t._fontWeight,+o]);let c=p[s];if(!D(c)){const i=_H(n,`${t._fontStyle} ${t._fontWeight} ${Lk.FONT_SIZE}px ${t._fontFamily}`,Ot.WHITE,Ot.WHITE,0,qV.FILL,o);if(c=new dH(e,-1,i.dimensions),p[s]=c,i.width>0&&i.height>0){const t=HV(i,{cutoff:Lk.CUTOFF,radius:Lk.RADIUS}),o=i.getContext("2d"),r=i.width,a=i.height,l=o.getImageData(0,0,r,a);for(let e=0;e<r;e++)for(let n=0;n<a;n++){const i=n*r+e,o=255*t[i],s=4*i;l.data[s+0]=o,l.data[s+1]=o,l.data[s+2]=o,l.data[s+3]=o}o.putImageData(l,0,0)," "!==n&&yH(e._textureAtlas,s,i,c)}}if(a=r[l],D(a)?-1===c.index?gH(e,a):D(a.textureInfo)&&(a.textureInfo=void 0):(a=new uH,r[l]=a),a.textureInfo=c,a.dimensions=c.dimensions,-1!==c.index){let n=a.billboard;const i=e._spareBillboards;D(n)||(i.length>0?n=i.pop():(n=e._billboardCollection.add({collection:e}),n._labelDimensions=new kt,n._labelTranslate=new kt),a.billboard=n),n.show=t._show,n.position=t._position,n.eyeOffset=t._eyeOffset,n.pixelOffset=t._pixelOffset,n.horizontalOrigin=Su.LEFT,n.verticalOrigin=t._verticalOrigin,n.heightReference=t._heightReference,n.scale=t.totalScale,n.pickPrimitive=t,n.id=t._id,n.image=s,n.translucencyByDistance=t._translucencyByDistance,n.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,n.scaleByDistance=t._scaleByDistance,n.distanceDisplayCondition=t._distanceDisplayCondition,n.disableDepthTestDistance=t._disableDepthTestDistance,n._batchIndex=t._batchIndex,n.outlineColor=t.outlineColor,t.style===qV.FILL_AND_OUTLINE?(n.color=t._fillColor,n.outlineWidth=t.outlineWidth):t.style===qV.FILL?(n.color=t._fillColor,n.outlineWidth=0):t.style===qV.OUTLINE&&(n.color=Ot.TRANSPARENT,n.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function AH(e,t,n){return t===Su.CENTER?-e/2:t===Su.RIGHT?-(e+n.x):n.x}const TH=new kt,wH=new kt;function EH(e){const t=e._glyphs,n=e._renderedText;let i,o,r=0,s=0;const a=[];let c,l=Number.NEGATIVE_INFINITY,u=0,d=1;const h=t.length,p=e._backgroundBillboard,f=kt.clone(D(p)?e._backgroundPadding:kt.ZERO,wH);for(f.x/=e._relativeSize,f.y/=e._relativeSize,c=0;c<h;++c)"\n"===n.charAt(c)?(a.push(r),++d,r=0):(i=t[c],o=i.dimensions,u=Math.max(u,o.height-o.descent),l=Math.max(l,o.descent),r+=o.width-o.minx,c<h-1&&(r+=t[c+1].dimensions.minx),s=Math.max(s,r));a.push(r);const m=u+l,_=e.totalScale,g=e._horizontalOrigin,y=e._verticalOrigin;let b=0,v=a[b],A=AH(v,g,f);const T=(D(e._lineHeight)?e._lineHeight:1.2*e._fontSize)/e._relativeSize,w=T*(d-1);let E=s,x=m+w;D(p)&&(E+=2*f.x,x+=2*f.y,p._labelHorizontalOrigin=g),TH.x=A*_,TH.y=0;let S=!0,C=0;for(c=0;c<h;++c)if("\n"===n.charAt(c))++b,C+=T,v=a[b],A=AH(v,g,f),TH.x=A*_,S=!0;else if(i=t[c],o=i.dimensions,y===Cu.TOP?(TH.y=o.height-u-f.y,TH.y+=Lk.PADDING):y===Cu.CENTER?TH.y=(w+o.height-u)/2:y===Cu.BASELINE?(TH.y=w,TH.y-=Lk.PADDING):(TH.y=w+l+f.y,TH.y-=Lk.PADDING),TH.y=(TH.y-o.descent-C)*_,S&&(TH.x-=Lk.PADDING*_,S=!1),D(i.billboard)&&(i.billboard._setTranslate(TH),i.billboard._labelDimensions.x=E,i.billboard._labelDimensions.y=x,i.billboard._labelHorizontalOrigin=g),c<h-1){const e=t[c+1];TH.x+=(o.width-o.minx+e.dimensions.minx)*_}if(D(p)&&n.split("\n").join("").length>0&&(A=g===Su.CENTER?-s/2-f.x:g===Su.RIGHT?-(s+2*f.x):0,TH.x=A*_,y===Cu.TOP?TH.y=m-u-l:y===Cu.CENTER?TH.y=(m-u)/2-l:y===Cu.BASELINE?TH.y=-f.y-l:TH.y=0,TH.y=TH.y*_,p.width=E,p.height=x,p._setTranslate(TH),p._labelTranslate=kt.clone(TH,p._labelTranslate)),Eu(e.heightReference))for(c=0;c<h;++c){i=t[c];const e=i.billboard;D(e)&&(e._labelTranslate=kt.clone(TH,e._labelTranslate))}}function xH(e,t){const n=t._glyphs;for(let i=0,o=n.length;i<o;++i)gH(e,n[i]);D(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,D(t._removeCallbackFunc)&&t._removeCallbackFunc(),He(t)}function SH(e){e=M(e,M.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._backgroundBillboardCollection=new lV({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new lV({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=Ot.clone(Ot.WHITE),this.show=M(e.show,!0),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.blendOption=M(e.blendOption,Rk.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(SH.prototype,{length:{get:function(){return this._labels.length}}}),SH.prototype.add=function(e){const t=new nH(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},SH.prototype.remove=function(e){if(D(e)&&e._labelCollection===this){const t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),xH(this,e),!0}return!1},SH.prototype.removeAll=function(){const e=this._labels;for(let t=0,n=e.length;t<n;++t)xH(this,e[t]);e.length=0},SH.prototype.contains=function(e){return D(e)&&e._labelCollection===this},SH.prototype.get=function(e){if(!D(e))throw new P("index is required.");return this._labels[e]},SH.prototype.update=function(e){if(!this.show)return;const t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;const i=e.context;D(this._textureAtlas)||(this._textureAtlas=new Bk({context:i}),t.textureAtlas=this._textureAtlas),D(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new Bk({context:i,initialSize:pH}),n.textureAtlas=this._backgroundTextureAtlas,function(e){const t=document.createElement("canvas");t.width=pH.x,t.height=pH.y;const n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(hH,t)}(this._backgroundTextureAtlas));const o=this._labelsToUpdate.length;for(let s=0;s<o;++s){const e=this._labelsToUpdate[s];if(e.isDestroyed())continue;const t=e._glyphs.length;e._rebindAllGlyphs&&(vH(this,e),e._rebindAllGlyphs=!1),e._repositionAllGlyphs&&(EH(e),e._repositionAllGlyphs=!1);const n=e._glyphs.length-t;this._totalGlyphCount+=n}const r=n.length>0?Rk.TRANSLUCENT:this.blendOption;t.blendOption=r,n.blendOption=r,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)},SH.prototype.isDestroyed=function(){return!1},SH.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(),He(this)};const CH={numberOfPoints:function(e,t,n){const i=H.distance(e,t);return Math.ceil(i/n)},numberOfPointsRhumbLine:function(e,t,n){const i=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(i/(n*n))))}},IH=new Qt;CH.extractHeights=function(e,t){const n=e.length,i=new Array(n);for(let o=0;o<n;o++){const n=e[o];i[o]=t.cartesianToCartographic(n,IH).height}return i};const OH=new ve,DH=new H,PH=new H,NH=new Pc(H.UNIT_X,0),RH=new H,LH=new Pc(H.UNIT_X,0),MH=new H,FH=new H,BH=[];function zH(e,t,n){const i=BH;let o;if(i.length=e,t===n){for(o=0;o<e;o++)i[o]=t;return i}const r=(n-t)/e;for(o=0;o<e;o++){const e=t+o*r;i[o]=e}return i}const UH=new Qt,kH=new Qt,VH=new H,HH=new H,GH=new H,jH=new zy;let WH=new Wy;function qH(e,t,n,i,o,r,s,a){const c=i.scaleToGeodeticSurface(e,HH),l=i.scaleToGeodeticSurface(t,GH),u=CH.numberOfPoints(e,t,n),d=i.cartesianToCartographic(c,UH),h=i.cartesianToCartographic(l,kH),p=zH(u,o,r);jH.setEndPoints(d,h);const f=jH.surfaceDistance/u;let m=a;d.height=o;let _=i.cartographicToCartesian(d,VH);H.pack(_,s,m),m+=3;for(let g=1;g<u;g++){const e=jH.interpolateUsingSurfaceDistance(g*f,kH);e.height=p[g],_=i.cartographicToCartesian(e,VH),H.pack(_,s,m),m+=3}return m}function YH(e,t,n,i,o,r,s,a){const c=i.cartesianToCartographic(e,UH),l=i.cartesianToCartographic(t,kH),u=CH.numberOfPointsRhumbLine(c,l,n);c.height=0,l.height=0;const d=zH(u,o,r);WH.ellipsoid.equals(i)||(WH=new Wy(void 0,void 0,i)),WH.setEndPoints(c,l);const h=WH.surfaceDistance/u;let p=a;c.height=o;let f=i.cartographicToCartesian(c,VH);H.pack(f,s,p),p+=3;for(let m=1;m<u;m++){const e=WH.interpolateUsingSurfaceDistance(m*h,kH);e.height=d[m],f=i.cartographicToCartesian(e,VH),H.pack(f,s,p),p+=3}return p}CH.wrapLongitude=function(e,t){const n=[],i=[];if(D(e)&&e.length>0){t=M(t,ve.IDENTITY);const o=ve.inverseTransformation(t,OH),r=ve.multiplyByPoint(o,H.ZERO,DH),s=H.normalize(ve.multiplyByPointAsVector(o,H.UNIT_Y,PH),PH),a=Pc.fromPointNormal(r,s,NH),c=H.normalize(ve.multiplyByPointAsVector(o,H.UNIT_X,RH),RH),l=Pc.fromPointNormal(r,c,LH);let u=1;n.push(H.clone(e[0]));let d=n[0];const h=e.length;for(let t=1;t<h;++t){const o=e[t];if(Pc.getPointDistance(l,d)<0||Pc.getPointDistance(l,o)<0){const e=Pp.lineSegmentPlane(d,o,a,MH);if(D(e)){const t=H.multiplyByScalar(s,5e-9,FH);Pc.getPointDistance(a,d)<0&&H.negate(t,t),n.push(H.add(e,t,new H)),i.push(u+1),H.negate(t,t),n.push(H.add(e,t,new H)),u=1}}n.push(H.clone(e[t])),u++,d=o}i.push(u)}return{positions:n,lengths:i}},CH.generateArc=function(e){D(e)||(e={});const t=e.positions;if(!D(t))throw new P("options.positions is required.");const n=t.length,i=M(e.ellipsoid,on.WGS84);let o=M(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(1===n){const e=i.scaleToGeodeticSurface(t[0],HH);if(o=r?o[0]:o,0!==o){const t=i.geodeticSurfaceNormal(e,VH);H.multiplyByScalar(t,o,t),H.add(e,t,e)}return[e.x,e.y,e.z]}let s=e.minDistance;if(!D(s)){const t=M(e.granularity,V.RADIANS_PER_DEGREE);s=V.chordLength(t,i.maximumRadius)}let a,c=0;for(a=0;a<n-1;a++)c+=CH.numberOfPoints(t[a],t[a+1],s);const l=3*(c+1),u=new Array(l);let d=0;for(a=0;a<n-1;a++){d=qH(t[a],t[a+1],s,i,r?o[a]:o,r?o[a+1]:o,u,d)}BH.length=0;const h=t[n-1],p=i.cartesianToCartographic(h,UH);p.height=r?o[n-1]:o;const f=i.cartographicToCartesian(p,VH);return H.pack(f,u,l-3),u};const XH=new Qt,QH=new Qt;CH.generateRhumbArc=function(e){D(e)||(e={});const t=e.positions;if(!D(t))throw new P("options.positions is required.");const n=t.length,i=M(e.ellipsoid,on.WGS84);let o=M(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(1===n){const e=i.scaleToGeodeticSurface(t[0],HH);if(o=r?o[0]:o,0!==o){const t=i.geodeticSurfaceNormal(e,VH);H.multiplyByScalar(t,o,t),H.add(e,t,e)}return[e.x,e.y,e.z]}const s=M(e.granularity,V.RADIANS_PER_DEGREE);let a,c,l=0,u=i.cartesianToCartographic(t[0],XH);for(a=0;a<n-1;a++)c=i.cartesianToCartographic(t[a+1],QH),l+=CH.numberOfPointsRhumbLine(u,c,s),u=Qt.clone(c,XH);const d=3*(l+1),h=new Array(d);let p=0;for(a=0;a<n-1;a++){p=YH(t[a],t[a+1],s,i,r?o[a]:o,r?o[a+1]:o,h,p)}BH.length=0;const f=t[n-1],m=i.cartesianToCartographic(f,UH);m.height=r?o[n-1]:o;const _=i.cartographicToCartesian(m,VH);return H.pack(_,h,d-3),h},CH.generateCartesianArc=function(e){const t=CH.generateArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=H.unpack(t,3*o);return i},CH.generateCartesianRhumbArc=function(e){const t=CH.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=H.unpack(t,3*o);return i};const $H=CH;function KH(e,t){e=M(e,M.EMPTY_OBJECT),this._show=M(e.show,!0),this._width=M(e.width,1),this._loop=M(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,D(this._material)||(this._material=mh.fromType(mh.ColorType,{color:new Ot(1,1,1,1)}));let n,i=e.positions;D(i)||(i=[]),this._positions=i,this._actualPositions=Ry(i,H.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=i.slice()),this._actualPositions.push(H.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id,D(t)&&(n=ve.clone(t.modelMatrix)),this._modelMatrix=n,this._segments=$H.wrapLongitude(this._actualPositions,n),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(oG),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=$u.fromPoints(this._actualPositions),this._boundingVolumeWC=$u.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new $u}const ZH=KH.POSITION_INDEX=0,JH=KH.SHOW_INDEX=1,eG=KH.WIDTH_INDEX=2,tG=KH.MATERIAL_INDEX=3,nG=KH.POSITION_SIZE_INDEX=4,iG=KH.DISTANCE_DISPLAY_CONDITION=5,oG=KH.NUMBER_OF_PROPERTIES=6;function rG(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;D(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(KH.prototype,{show:{get:function(){return this._show},set:function(e){if(!D(e))throw new P("value is required.");e!==this._show&&(this._show=e,rG(this,JH))}},positions:{get:function(){return this._positions},set:function(e){if(!D(e))throw new P("value is required.");let t=Ry(e,H.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(H.clone(t[0]))),this._actualPositions.length===t.length&&this._actualPositions.length===this._length||rG(this,nG),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=$u.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=$u.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),rG(this,ZH),this.update()}},material:{get:function(){return this._material},set:function(e){if(!D(e))throw new P("material is required.");this._material!==e&&(this._material=e,rG(this,tG))}},width:{get:function(){return this._width},set:function(e){if(!D(e))throw new P("value is required.");e!==this._width&&(this._width=e,rG(this,eG))}},loop:{get:function(){return this._loop},set:function(e){if(!D(e))throw new P("value is required.");if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!H.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(H.clone(t[0]))):t.length>2&&H.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,rG(this,nG)}}},id:{get:function(){return this._id},set:function(e){this._id=e,D(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!D(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far distance must be greater than near distance.");vu.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=vu.clone(e,this._distanceDisplayCondition),rG(this,iG))}}}),KH.prototype.update=function(){let e=ve.IDENTITY;D(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[ZH]>0||this._propertiesChanged[nG]>0;if(ve.equals(e,this._modelMatrix)&&!i||(this._segments=$H.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=$u.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=ve.clone(e,this._modelMatrix),this._segments.positions.length!==t)rG(this,nG);else{const e=n.length;for(let t=0;t<e;++t)if(n[t]!==this._segments.lengths[t]){rG(this,nG);break}}},KH.prototype.getPickId=function(e){return D(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},KH.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<oG-1;++t)e[t]=0},KH.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const sG=KH.SHOW_INDEX,aG=KH.WIDTH_INDEX,cG=KH.POSITION_INDEX,lG=KH.MATERIAL_INDEX,uG=KH.POSITION_SIZE_INDEX,dG=KH.DISTANCE_DISPLAY_CONDITION,hG=KH.NUMBER_OF_PROPERTIES,pG={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 fG(e){e=M(e,M.EMPTY_OBJECT),this.show=M(e.show,!0),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._modelMatrix=ve.clone(ve.IDENTITY),this.debugShowBoundingVolume=M(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(hG),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:qe.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=Ot.clone(Ot.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(fG.prototype,{length:{get:function(){return xG(this),this._polylines.length}}}),fG.prototype.add=function(e){const t=new KH(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t},fG.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,D(e._bucket)){const t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1},fG.prototype.removeAll=function(){SG(this),IG(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},fG.prototype.contains=function(e){return D(e)&&e._polylineCollection===this},fG.prototype.get=function(e){if(!D(e))throw new P("index is required.");return xG(this),this._polylines[e]};const mG=new Ic,_G=new K,gG=new kt;fG.prototype.update=function(e){if(xG(this),0===this._polylines.length||!this.show)return;!function(e,t){const n=t.mode;e._mode===n&&ve.equals(e._modelMatrix,e.modelMatrix)||(e._mode=n,e._modelMatrix=ve.clone(e.modelMatrix),e._createVertexArray=!0)}(this,e);const t=e.context,n=e.mapProjection;let i,o=this._propertiesChanged;if(this._createBatchTable){if(0===rs.maximumVertexTextureImageUnits)throw new be("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");!function(e,t){D(e._batchTable)&&e._batchTable.destroy();const n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:Ca.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:Ca.FLOAT,componentsPerAttribute:2}];e._batchTable=new jf(t,n,e._polylines.length)}(this,t),this._createBatchTable=!1}if(this._createVertexArray||function(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;n[cG]?i.bufferUsage!==qe.STREAM_DRAW?(t=!0,i.bufferUsage=qe.STREAM_DRAW,i.frameCount=100):i.frameCount=100:i.bufferUsage!==qe.STATIC_DRAW&&(0===i.frameCount?(t=!0,i.bufferUsage=qe.STATIC_DRAW):i.frameCount--);return t}(this))AG(this,t,n);else if(this._polylinesUpdated){const r=this._polylinesToUpdate;if(this._mode!==gl.SCENE3D){const e=r.length;for(let t=0;t<e;++t)i=r[t],i.update()}if(o[uG]||o[lG])AG(this,t,n);else{const t=r.length,s=this._polylineBuckets;for(let a=0;a<t;++a){i=r[a],o=i._propertiesChanged;const t=i._bucket;let c=0;for(const e in s)if(s.hasOwnProperty(e)){if(s[e]===t){o[cG]&&t.writeUpdate(c,i,this._positionBuffer,n);break}c+=s[e].lengthOfPositions}if((o[sG]||o[aG])&&this._batchTable.setBatchedAttribute(i._index,0,new kt(i._width,i._show)),this._batchTable.attributes.length>2){if(o[cG]||o[uG]){const t=e.mode===gl.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,n=Ic.fromCartesian(t.center,mG),o=K.fromElements(n.low.x,n.low.y,n.low.z,t.radius,_G);this._batchTable.setBatchedAttribute(i._index,2,n.high),this._batchTable.setBatchedAttribute(i._index,3,o)}if(o[dG]){const e=gG;e.x=0,e.y=Number.MAX_VALUE;const t=i.distanceDisplayCondition;D(t)&&(e.x=t.near,e.y=t.far),this._batchTable.setBatchedAttribute(i._index,4,e)}}i._clean()}}r.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let c=0;c<hG;++c)o[c]=0;let r=ve.IDENTITY;e.mode===gl.SCENE3D&&(r=this.modelMatrix);const s=e.passes,a=0!==e.morphTime;if(D(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===a||(this._opaqueRS=_s.fromCache({depthMask:a,depthTest:{enabled:a}})),D(this._translucentRS)&&this._translucentRS.depthTest.enabled===a||(this._translucentRS=_s.fromCache({blending:dh.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){!function(e,t,n,i){const o=t.context,r=t.commandList,s=n.length;let a=0,c=!0;const l=e._vertexArrays,u=e.debugShowBoundingVolume,d=e._batchTable.getUniformMapCallback(),h=l.length;for(let p=0;p<h;++p){const h=l[p],f=h.buckets,m=f.length;for(let l=0;l<m;++l){const p=f[l];let m=p.offset;const _=p.bucket.shaderProgram,g=p.bucket.polylines,y=g.length;let b,v,A,T,w=0;for(let l=0;l<y;++l){const f=g[l],y=EG(f._material);if(y!==b){if(D(b)&&w>0){const t=v.isTranslucent();a>=s?(A=new Kr({owner:e}),n.push(A)):A=n[a],++a,T=ni(d(v._uniforms),e._uniformMap),A.boundingVolume=$u.clone(yG,A.boundingVolume),A.modelMatrix=i,A.shaderProgram=_,A.vertexArray=h.va,A.renderState=t?e._translucentRS:e._opaqueRS,A.pass=t?zt.TRANSLUCENT:zt.OPAQUE,A.debugShowBoundingVolume=u,A.pickId="v_pickColor",A.uniformMap=T,A.count=w,A.offset=m,m+=w,w=0,c=!0,r.push(A)}v=f._material,v.update(o),b=y}const E=f._locatorBuckets,x=E.length;for(let e=0;e<x;++e){const t=E[e];t.locator===p&&(w+=t.count)}let S;t.mode===gl.SCENE3D?S=f._boundingVolumeWC:t.mode===gl.COLUMBUS_VIEW?S=f._boundingVolume2D:t.mode===gl.SCENE2D?D(f._boundingVolume2D)&&(S=$u.clone(f._boundingVolume2D,bG),S.center.x=0):D(f._boundingVolumeWC)&&D(f._boundingVolume2D)&&(S=$u.union(f._boundingVolumeWC,f._boundingVolume2D,bG)),c?(c=!1,$u.clone(S,yG)):$u.union(S,yG,yG)}D(b)&&w>0&&(a>=s?(A=new Kr({owner:e}),n.push(A)):A=n[a],++a,T=ni(d(v._uniforms),e._uniformMap),A.boundingVolume=$u.clone(yG,A.boundingVolume),A.modelMatrix=i,A.shaderProgram=_,A.vertexArray=h.va,A.renderState=v.isTranslucent()?e._translucentRS:e._opaqueRS,A.pass=v.isTranslucent()?zt.TRANSLUCENT:zt.OPAQUE,A.debugShowBoundingVolume=u,A.pickId="v_pickColor",A.uniformMap=T,A.count=w,A.offset=m,c=!0,r.push(A)),b=void 0}}n.length=a}(this,e,this._colorCommands,r)}};const yG=new $u,bG=new $u;fG.prototype.isDestroyed=function(){return!1},fG.prototype.destroy=function(){return CG(this),SG(this),IG(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),He(this)};const vG=[0,0,0];function AG(e,t,n){e._createVertexArray=!1,SG(e),CG(e),function(e){const t=e._mode,n=e._modelMatrix,i=e._polylineBuckets={},o=e._polylines,r=o.length;for(let s=0;s<r;++s){const e=o[s];if(e._actualPositions.length>1){e.update();const o=e.material;let r=i[o.type];D(r)||(r=i[o.type]=new DG(o,t,n)),r.addPolyline(e)}}}(e);const i=[[]];let o=i[0];const r=e._batchTable,s=e._useHighlightColor,a=[0];let c=0;const l=[[]];let u=0;const d=e._polylineBuckets;let h,p;for(h in d)d.hasOwnProperty(h)&&(p=d[h],p.updateShader(t,r,s),u+=p.lengthOfPositions);if(u>0){const s=e._mode,f=new Float32Array(6*u*3),m=new Float32Array(4*u);let _,g=0,y=0,b=0;for(h in d)if(d.hasOwnProperty(h)){p=d[h],p.write(f,m,g,y,b,r,t,n),s===gl.MORPHING&&(D(_)||(_=new Float32Array(6*u*3)),p.writeForMorph(_,g));const e=p.lengthOfPositions;g+=6*e*3,y+=4*e,b+=4*e,c=p.updateIndices(i,a,l,c)}const v=e._positionBufferUsage.bufferUsage,A=qe.STATIC_DRAW;let T;e._positionBuffer=Ye.createVertexBuffer({context:t,typedArray:f,usage:v}),D(_)&&(T=Ye.createVertexBuffer({context:t,typedArray:_,usage:v})),e._texCoordExpandAndBatchIndexBuffer=Ye.createVertexBuffer({context:t,typedArray:m,usage:A});const w=3*Float32Array.BYTES_PER_ELEMENT,E=4*Float32Array.BYTES_PER_ELEMENT;let x=0;const S=i.length;for(let n=0;n<S;++n)if(o=i[n],o.length>0){const i=new Uint16Array(o),r=Ye.createIndexBuffer({context:t,typedArray:i,usage:qe.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});x+=a[n];const c=6*(n*(w*V.SIXTY_FOUR_KILOBYTES)-x*w),u=w+c,d=w+u,h=w+d,p=w+h,f=w+p,m=n*(E*V.SIXTY_FOUR_KILOBYTES)-x*E,_=[{index:pG.position3DHigh,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:c,strideInBytes:6*w},{index:pG.position3DLow,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:u,strideInBytes:6*w},{index:pG.position2DHigh,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:c,strideInBytes:6*w},{index:pG.position2DLow,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:u,strideInBytes:6*w},{index:pG.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:d,strideInBytes:6*w},{index:pG.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:h,strideInBytes:6*w},{index:pG.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:d,strideInBytes:6*w},{index:pG.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:h,strideInBytes:6*w},{index:pG.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:p,strideInBytes:6*w},{index:pG.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:f,strideInBytes:6*w},{index:pG.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:p,strideInBytes:6*w},{index:pG.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,offsetInBytes:f,strideInBytes:6*w},{index:pG.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:m}];let g,y,b,v;s===gl.SCENE3D?(y=e._positionBuffer,g="vertexBuffer",b=vG,v="value"):s===gl.SCENE2D||s===gl.COLUMBUS_VIEW?(y=vG,g="value",b=e._positionBuffer,v="vertexBuffer"):(y=T,g="vertexBuffer",b=e._positionBuffer,v="vertexBuffer"),_[0][g]=y,_[1][g]=y,_[2][v]=b,_[3][v]=b,_[4][g]=y,_[5][g]=y,_[6][v]=b,_[7][v]=b,_[8][g]=y,_[9][g]=y,_[10][v]=b,_[11][v]=b;const A=new kl({context:t,attributes:_,indexBuffer:r});e._vertexArrays.push({va:A,buckets:l[n]})}}}function TG(e,t){return t instanceof Sc?t.id:t}const wG=[];function EG(e){const t=mh._uniformList[e.type],n=t.length;wG.length=2*n;let i=0;for(let o=0;o<n;++o){const n=t[o];wG[i]=n,wG[i+1]=e._uniforms[n](),i+=2}return`${e.type}:${JSON.stringify(wG,TG)}`}function xG(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],n=[];let i,o=0;const r=e._polylines.length;for(let s=0;s<r;++s)i=e._polylines[s],i.isDestroyed||(i._index=o++,n.push(i),t.push(i));e._polylines=t,e._polylinesToUpdate=n}}function SG(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)if(!t[i].isDestroyed){const e=t[i]._bucket;D(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy())}}function CG(e){const t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}function IG(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function OG(e,t,n){this.count=e,this.offset=t,this.bucket=n}function DG(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}function PG(e){return H.dot(H.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Pc.ORIGIN_ZX_PLANE)===mn.INTERSECTING}fG.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},DG.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},DG.prototype.updateShader=function(e,t,n){if(D(this.shaderProgram))return;const i=["DISTANCE_DISPLAY_CONDITION"];n&&i.push("VECTOR_TILE"),-1!==this.material.shaderSource.search(/in\s+float\s+v_polylineAngle;/g)&&i.push("POLYLINE_DASH"),Ct.isInternetExplorer()||i.push("CLIP_POLYLINE");const o=new bc({defines:i,sources:["in vec4 v_pickColor;\n",this.material.shaderSource,Tv]}),r=t.getVertexShaderCallback()("in vec3 position3DHigh;\nin vec3 position3DLow;\nin vec3 position2DHigh;\nin vec3 position2DLow;\nin vec3 prevPosition3DHigh;\nin vec3 prevPosition3DLow;\nin vec3 prevPosition2DHigh;\nin vec3 prevPosition2DLow;\nin vec3 nextPosition3DHigh;\nin vec3 nextPosition3DLow;\nin vec3 nextPosition2DHigh;\nin vec3 nextPosition2DLow;\nin vec4 texCoordExpandAndBatchIndex;\n\nout vec2 v_st;\nout float v_width;\nout vec4 v_pickColor;\nout float v_polylineAngle;\n\nvoid main()\n{\n float texCoord = texCoordExpandAndBatchIndex.x;\n float expandDir = texCoordExpandAndBatchIndex.y;\n bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\n float batchTableIndex = texCoordExpandAndBatchIndex.w;\n\n vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\n float width = widthAndShow.x + 0.5;\n float show = widthAndShow.y;\n\n if (width < 1.0)\n {\n show = 0.0;\n }\n\n vec4 pickColor = batchTable_getPickColor(batchTableIndex);\n\n vec4 p, prev, next;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\n prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\n next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\n prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\n next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\n czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\n czm_morphTime);\n prev = czm_columbusViewMorph(\n czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\n czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\n czm_morphTime);\n next = czm_columbusViewMorph(\n czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\n czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\n czm_morphTime);\n }\n\n #ifdef DISTANCE_DISPLAY_CONDITION\n vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\n vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\n vec3 centerLow = centerLowAndRadius.xyz;\n float radius = centerLowAndRadius.w;\n vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\n\n float lengthSq;\n if (czm_sceneMode == czm_sceneMode2D)\n {\n lengthSq = czm_eyeHeight2D.y;\n }\n else\n {\n vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\n lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n }\n\n float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\n float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\n if (lengthSq < nearSq || lengthSq > farSq)\n {\n show = 0.0;\n }\n #endif\n\n float polylineAngle;\n vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);\n gl_Position = czm_viewportOrthographic * positionWC * show;\n\n v_st.s = texCoord;\n v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);\n\n v_width = width;\n v_pickColor = pickColor;\n v_polylineAngle = polylineAngle;\n}\n"),s=new bc({defines:i,sources:[yv,r]});this.shaderProgram=ya.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:pG})},DG.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===gl.SCENE3D||!PG(e))return t=e._actualPositions.length,4*t-4;let n=0;const i=e._segments.lengths;t=i.length;for(let o=0;o<t;++o)n+=4*i[o]-4;return n};const NG=new H,RG=new H,LG=new H,MG=new H,FG=new K,BG=new kt;DG.prototype.write=function(e,t,n,i,o,r,s,a){const c=this.mode,l=a.ellipsoid.maximumRadius*V.PI,u=this.polylines,d=u.length;for(let h=0;h<d;++h){const i=u[h],d=i.width,p=i.show&&d>0,f=i._index,m=this.getSegments(i,a),_=m.positions,g=m.lengths,y=_.length,b=i.getPickId(s).color;let v,A=0,T=0;for(let r=0;r<y;++r){0===r?i._loop?v=_[y-2]:(v=MG,H.subtract(_[0],_[1],v),H.add(_[0],v,v)):v=_[r-1],H.clone(v,RG),H.clone(_[r],NG),r===y-1?i._loop?v=_[1]:(v=MG,H.subtract(_[y-1],_[y-2],v),H.add(_[y-1],v,v)):v=_[r+1],H.clone(v,LG);const s=g[A];r===T+s&&(T+=s,++A);const a=r-T==0,u=r===T+g[A]-1;c===gl.SCENE2D&&(RG.z=0,NG.z=0,LG.z=0),c!==gl.SCENE2D&&c!==gl.MORPHING||(a||u)&&l-Math.abs(NG.x)<1&&((NG.x<0&&RG.x>0||NG.x>0&&RG.x<0)&&H.clone(NG,RG),(NG.x<0&&LG.x>0||NG.x>0&&LG.x<0)&&H.clone(NG,LG));const d=u?2:4;for(let i=a?2:0;i<d;++i){Ic.writeElements(NG,e,n),Ic.writeElements(RG,e,n+6),Ic.writeElements(LG,e,n+12);const s=i-2<0?-1:1;t[o]=r/(y-1),t[o+1]=i%2*2-1,t[o+2]=s,t[o+3]=f,n+=18,o+=4}}const w=FG;w.x=Ot.floatToByte(b.red),w.y=Ot.floatToByte(b.green),w.z=Ot.floatToByte(b.blue),w.w=Ot.floatToByte(b.alpha);const E=BG;E.x=d,E.y=p?1:0;const x=c===gl.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,S=Ic.fromCartesian(x.center,mG),C=S.high,I=K.fromElements(S.low.x,S.low.y,S.low.z,x.radius,_G),O=gG;O.x=0,O.y=Number.MAX_VALUE;const P=i.distanceDisplayCondition;D(P)&&(O.x=P.near,O.y=P.far),r.setBatchedAttribute(f,0,E),r.setBatchedAttribute(f,1,w),r.attributes.length>2&&(r.setBatchedAttribute(f,2,C),r.setBatchedAttribute(f,3,I),r.setBatchedAttribute(f,4,O))}};const zG=new H,UG=new H,kG=new H,VG=new H;DG.prototype.writeForMorph=function(e,t){const n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r<o;++r){const o=i[r],s=o._segments.positions,a=o._segments.lengths,c=s.length;let l=0,u=0;for(let i=0;i<c;++i){let r;0===i?o._loop?r=s[c-2]:(r=VG,H.subtract(s[0],s[1],r),H.add(s[0],r,r)):r=s[i-1],r=ve.multiplyByPoint(n,r,UG);const d=ve.multiplyByPoint(n,s[i],zG);let h;i===c-1?o._loop?h=s[1]:(h=VG,H.subtract(s[c-1],s[c-2],h),H.add(s[c-1],h,h)):h=s[i+1],h=ve.multiplyByPoint(n,h,kG);const p=a[l];i===u+p&&(u+=p,++l);const f=i-u==0,m=i===u+a[l]-1?2:4;for(let n=f?2:0;n<m;++n)Ic.writeElements(d,e,t),Ic.writeElements(r,e,t+6),Ic.writeElements(h,e,t+12),t+=18}}};const HG=new Array(1);DG.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new OG(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],c=0;a.length>0&&(c=a[a.length-1]+1);const l=this.polylines,u=l.length;for(let d=0;d<u;++d){const u=l[d];let h;if(u._locatorBuckets=[],this.mode===gl.SCENE3D){h=HG;const e=u._actualPositions.length;if(!(e>0))continue;h[0]=e}else h=u._segments.lengths;const p=h.length;if(p>0){let l=0;for(let d=0;d<p;++d){const p=h[d]-1;for(let d=0;d<p;++d)c+4>V.SIXTY_FOUR_KILOBYTES&&(u._locatorBuckets.push({locator:r,count:l}),l=0,t.push(4),a=[],e.push(a),c=0,r.count=s,s=0,i=0,r=new OG(0,0,this),n[++o]=[r]),a.push(c,c+2,c+1),a.push(c+1,c+2,c+3),l+=6,s+=6,i+=6,c+=4}u._locatorBuckets.push({locator:r,count:l}),c+4>V.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),c=0,r.count=s,i=0,s=0,r=new OG(0,0,this),n[++o]=[r])}u._clean()}return r.count=s,i},DG.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let n=0;const i=t.length;for(let o=0;o<i;++o){const i=t[o];if(i===e)break;n+=i._actualLength}return n};const GG={positions:void 0,lengths:void 0},jG=new Array(1),WG=new H,qG=new Qt;let YG;function XG(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=new lV({batchTable:e.batchTable}),this._labelCollection=new SH({batchTable:e.batchTable}),this._polylineCollection=new fG,this._polylineCollection._useHighlightColor=!0,this._packedBuffer=void 0,this._ready=!1,this._promise=void 0,this._error=void 0}DG.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===gl.SCENE3D)return jG[0]=n.length,GG.positions=n,GG.lengths=jG,GG;PG(e)&&(n=e._segments.positions);const i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length;let a,c=WG;for(let l=0;l<s;++l)a=n[l],c=ve.multiplyByPoint(r,a,c),o.push(t.project(i.cartesianToCartographic(c,qG)));if(o.length>0){e._boundingVolume2D=$u.fromPoints(o,e._boundingVolume2D);const t=e._boundingVolume2D.center;e._boundingVolume2D.center=new H(t.z,t.x,t.y)}return GG.positions=o,GG.lengths=e._segments.lengths,GG},DG.prototype.writeUpdate=function(e,t,n,i){const o=this.mode,r=i.ellipsoid.maximumRadius*V.PI;let s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=YG;const c=6*s*3;!D(a)||a.length<c?a=YG=new Float32Array(c):a.length>c&&(a=new Float32Array(a.buffer,0,c));const l=this.getSegments(t,i),u=l.positions,d=l.lengths;let h,p=0,f=0,m=0;s=u.length;for(let e=0;e<s;++e){0===e?t._loop?h=u[s-2]:(h=MG,H.subtract(u[0],u[1],h),H.add(u[0],h,h)):h=u[e-1],H.clone(h,RG),H.clone(u[e],NG),e===s-1?t._loop?h=u[1]:(h=MG,H.subtract(u[s-1],u[s-2],h),H.add(u[s-1],h,h)):h=u[e+1],H.clone(h,LG);const n=d[f];e===m+n&&(m+=n,++f);const i=e-m==0,c=e===m+d[f]-1;o===gl.SCENE2D&&(RG.z=0,NG.z=0,LG.z=0),o!==gl.SCENE2D&&o!==gl.MORPHING||(i||c)&&r-Math.abs(NG.x)<1&&((NG.x<0&&RG.x>0||NG.x>0&&RG.x<0)&&H.clone(NG,RG),(NG.x<0&&LG.x>0||NG.x>0&&LG.x<0)&&H.clone(NG,LG));const l=c?2:4;for(let e=i?2:0;e<l;++e)Ic.writeElements(NG,a,p),Ic.writeElements(RG,a,p+6),Ic.writeElements(LG,a,p+12),p+=18}n.copyFromArrayView(a,18*Float32Array.BYTES_PER_ELEMENT*e)}},Object.defineProperties(XG.prototype,{ready:{get:function(){return this._ready}},pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){return this._billboardCollection.textureAtlas.texture.sizeInBytes+this._labelCollection._textureAtlas.texture.sizeInBytes}}});const QG=new Qa("createVectorTilePoints",5),$G=new H;function KG(e,t){let n=e._positions,i=e._packedBuffer;D(i)||(n=e._positions=n.slice(),e._batchIds=e._batchIds.slice(),i=e._packedBuffer=function(e,t){const n=e._rectangle,i=e._minHeight,o=e._maxHeight,r=2+Ir.packedLength+on.packedLength,s=new Float64Array(r);let a=0;return s[a++]=i,s[a++]=o,Ir.pack(n,s,a),a+=Ir.packedLength,on.pack(t,s,a),s}(e,t));const o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=QG.scheduleTask(r,o);if(D(s))return s.then((t=>{if(e.isDestroyed())return;e._positions=new Float64Array(t.positions);const i=e._billboardCollection,o=e._labelCollection,r=e._polylineCollection;n=e._positions;const s=e._batchIds,a=n.length/3;for(let e=0;e<a;++e){const t=s[e],a=H.unpack(n,3*e,$G),c=i.add();c.position=a,c._batchIndex=t;const l=o.add();l.text=" ",l.position=a,l._batchIndex=t;r.add().positions=[H.clone(a),H.clone(a)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0})).catch((t=>{e.isDestroyed()||(e._error=t)}))}XG.prototype.createFeatures=function(e,t){const n=this._billboardCollection,i=this._labelCollection,o=this._polylineCollection,r=this._batchIds,s=r.length;for(let a=0;a<s;++a){const s=r[a],c=n.get(a),l=i.get(a),u=o.get(a);t[s]=new BV(e,s,c,l,u)}},XG.prototype.applyDebugSettings=function(e,t){e?(Ot.clone(t,this._billboardCollection._highlightColor),Ot.clone(t,this._labelCollection._highlightColor),Ot.clone(t,this._polylineCollection._highlightColor)):(Ot.clone(Ot.WHITE,this._billboardCollection._highlightColor),Ot.clone(Ot.WHITE,this._labelCollection._highlightColor),Ot.clone(Ot.WHITE,this._polylineCollection._highlightColor))};const ZG=new Ot,JG=new Ot,ej=new Ot,tj=new Ot,nj=new Ot,ij=new Ot,oj=new Au,rj=new Au,sj=new vu;function aj(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=M(e.ellipsoid,on.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=M(e.center,H.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._promise=void 0,this._error=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Vf.BOTH}XG.prototype.applyStyle=function(e,t){if(!D(e))return void function(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const e=t[n[o]];e.show=!0,e.pointSize=BV.defaultPointSize,e.color=BV.defaultColor,e.pointOutlineColor=BV.defaultPointOutlineColor,e.pointOutlineWidth=BV.defaultPointOutlineWidth,e.labelColor=Ot.WHITE,e.labelOutlineColor=Ot.WHITE,e.labelOutlineWidth=1,e.font="30px sans-serif",e.labelStyle=qV.FILL,e.labelText=void 0,e.backgroundColor=new Ot(.165,.165,.165,.8),e.backgroundPadding=new kt(7,5),e.backgroundEnabled=!1,e.scaleByDistance=void 0,e.translucencyByDistance=void 0,e.distanceDisplayCondition=void 0,e.heightOffset=0,e.anchorLineEnabled=!1,e.anchorLineColor=Ot.WHITE,e.image=void 0,e.disableDepthTestDistance=0,e.horizontalOrigin=Su.CENTER,e.verticalOrigin=Cu.CENTER,e.labelHorizontalOrigin=Su.RIGHT,e.labelVerticalOrigin=Cu.BASELINE}}(this,t);const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const i=t[n[o]];if(D(e.show)&&(i.show=e.show.evaluate(i)),D(e.pointSize)&&(i.pointSize=e.pointSize.evaluate(i)),D(e.color)&&(i.color=e.color.evaluateColor(i,ZG)),D(e.pointOutlineColor)&&(i.pointOutlineColor=e.pointOutlineColor.evaluateColor(i,JG)),D(e.pointOutlineWidth)&&(i.pointOutlineWidth=e.pointOutlineWidth.evaluate(i)),D(e.labelColor)&&(i.labelColor=e.labelColor.evaluateColor(i,ej)),D(e.labelOutlineColor)&&(i.labelOutlineColor=e.labelOutlineColor.evaluateColor(i,tj)),D(e.labelOutlineWidth)&&(i.labelOutlineWidth=e.labelOutlineWidth.evaluate(i)),D(e.font)&&(i.font=e.font.evaluate(i)),D(e.labelStyle)&&(i.labelStyle=e.labelStyle.evaluate(i)),D(e.labelText)?i.labelText=e.labelText.evaluate(i):i.labelText=void 0,D(e.backgroundColor)&&(i.backgroundColor=e.backgroundColor.evaluateColor(i,nj)),D(e.backgroundPadding)&&(i.backgroundPadding=e.backgroundPadding.evaluate(i)),D(e.backgroundEnabled)&&(i.backgroundEnabled=e.backgroundEnabled.evaluate(i)),D(e.scaleByDistance)){const t=e.scaleByDistance.evaluate(i);D(t)?(oj.near=t.x,oj.nearValue=t.y,oj.far=t.z,oj.farValue=t.w,i.scaleByDistance=oj):i.scaleByDistance=void 0}else i.scaleByDistance=void 0;if(D(e.translucencyByDistance)){const t=e.translucencyByDistance.evaluate(i);D(t)?(rj.near=t.x,rj.nearValue=t.y,rj.far=t.z,rj.farValue=t.w,i.translucencyByDistance=rj):i.translucencyByDistance=void 0}else i.translucencyByDistance=void 0;if(D(e.distanceDisplayCondition)){const t=e.distanceDisplayCondition.evaluate(i);D(t)?(sj.near=t.x,sj.far=t.y,i.distanceDisplayCondition=sj):i.distanceDisplayCondition=void 0}else i.distanceDisplayCondition=void 0;D(e.heightOffset)&&(i.heightOffset=e.heightOffset.evaluate(i)),D(e.anchorLineEnabled)&&(i.anchorLineEnabled=e.anchorLineEnabled.evaluate(i)),D(e.anchorLineColor)&&(i.anchorLineColor=e.anchorLineColor.evaluateColor(i,ij)),D(e.image)?i.image=e.image.evaluate(i):i.image=void 0,D(e.disableDepthTestDistance)&&(i.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(i)),D(e.horizontalOrigin)&&(i.horizontalOrigin=e.horizontalOrigin.evaluate(i)),D(e.verticalOrigin)&&(i.verticalOrigin=e.verticalOrigin.evaluate(i)),D(e.labelHorizontalOrigin)&&(i.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(i)),D(e.labelVerticalOrigin)&&(i.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(i))}},XG.prototype.update=function(e){if(this._ready)this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e);else if(D(this._promise)||(this._promise=KG(this,e.mapProjection.ellipsoid)),D(this._error)){const e=this._error;throw this._error=void 0,e}},XG.prototype.isDestroyed=function(){return!1},XG.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(),He(this)},Object.defineProperties(aj.prototype,{trianglesLength:{get:function(){return D(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return D(this._primitive)?this._primitive.geometryByteLength:0}},ready:{get:function(){return this._ready}}});const cj=new Qa("createVectorTilePolygons",5),lj=new Ot;function uj(e){if(D(e._primitive))return;let t=e._positions,n=e._counts,i=e._indexCounts,o=e._indices,r=e._transferrableBatchIds,s=e._batchTableColors,a=e._packedBuffer;if(!D(s)){t=e._positions=e._positions.slice(),n=e._counts=e._counts.slice(),i=e._indexCounts=e._indexCounts.slice(),o=e._indices=e._indices.slice(),e._center=e._ellipsoid.cartographicToCartesian(Ir.center(e._rectangle)),r=e._transferrableBatchIds=new Uint32Array(e._batchIds),s=e._batchTableColors=new Uint32Array(r.length);const c=e._batchTable,l=s.length;for(let e=0;e<l;++e){const t=c.getColor(e,lj);s[e]=t.toRgba()}a=e._packedBuffer=function(e){const t=new Float64Array(3+H.packedLength+on.packedLength+Ir.packedLength);let n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,H.pack(e._center,t,n),n+=H.packedLength,on.pack(e._ellipsoid,t,n),n+=on.packedLength,Ir.pack(e._rectangle,t,n),t}(e)}const c=[t.buffer,n.buffer,i.buffer,o.buffer,r.buffer,s.buffer,a.buffer],l={packedBuffer:a.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:o.buffer,batchIds:r.buffer,batchTableColors:s.buffer};let u=e._polygonMinimumHeights,d=e._polygonMaximumHeights;D(u)&&D(d)&&(u=u.slice(),d=d.slice(),c.push(u.buffer,d.buffer),l.minimumHeights=u,l.maximumHeights=d);const h=cj.scheduleTask(l,c);return D(h)?h.then((t=>{if(e.isDestroyed())return;e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const n=new Float64Array(t.packedBuffer),i=n[0];!function(e,t){let n=1;const i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=zp.unpack(t,n),n+=zp.packedLength;const r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){const e=Ot.unpack(t,n);n+=Ot.packedLength;const i=t[n++],o=t[n++],r=t[n++],c=new Array(r);for(let s=0;s<r;++s)c[s]=t[n++];s[a]=new cE({color:e,offset:i,count:o,batchIds:c})}}(e,n),e._indices=2===je.getSizeInBytes(i)?new Uint16Array(t.indices):new Uint32Array(t.indices),e._indexOffsets=new Uint32Array(t.indexOffsets),e._indexCounts=new Uint32Array(t.indexCounts),e._batchedPositions=new Float32Array(t.positions),e._vertexBatchIds=new Uint16Array(t.batchIds),function(e){D(e._primitive)||(e._primitive=new qE({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0)}(e),e._ready=!0})).catch((t=>{e.isDestroyed()||(e._error=t)})):void 0}aj.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)},aj.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)},aj.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)},aj.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)},aj.prototype.update=function(e){if(this._ready)this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e);else if(D(this._promise)||(this._promise=uj(this)),D(this._error)){const e=this._error;throw this._error=void 0,e}},aj.prototype.isDestroyed=function(){return!1},aj.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),He(this)};function dj(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=M(e.ellipsoid,on.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Ot.clone(Ot.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(dj.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});const hj=new Qa("createVectorTilePolylines",5),pj={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function fj(e,t){if(D(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;D(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=function(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+Ir.packedLength+on.packedLength+H.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,Ir.pack(t,a,c),c+=Ir.packedLength,on.pack(o,a,c),c+=on.packedLength,H.pack(r,a,c),a}(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},l=hj.scheduleTask(c,a);return D(l)?l.then((function(n){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(n.decodedPositions),e._decodedPositionOffsets=new Uint32Array(n.decodedPositionOffsets)),e._currentPositions=new Float32Array(n.currentPositions),e._previousPositions=new Float32Array(n.previousPositions),e._nextPositions=new Float32Array(n.nextPositions),e._expandAndWidth=new Float32Array(n.expandAndWidth),e._vertexBatchIds=new Uint16Array(n.batchIds);const i=n.indexDatatype;e._indices=i===je.UNSIGNED_SHORT?new Uint16Array(n.indices):new Uint32Array(n.indices),function(e,t){if(!D(e._va)){const n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices;let c=i.byteLength+n.byteLength+o.byteLength;c+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=c;const l=Ye.createVertexBuffer({context:t,typedArray:i,usage:qe.STATIC_DRAW}),u=Ye.createVertexBuffer({context:t,typedArray:n,usage:qe.STATIC_DRAW}),d=Ye.createVertexBuffer({context:t,typedArray:o,usage:qe.STATIC_DRAW}),h=Ye.createVertexBuffer({context:t,typedArray:r,usage:qe.STATIC_DRAW}),p=Ye.createVertexBuffer({context:t,typedArray:s,usage:qe.STATIC_DRAW}),f=Ye.createIndexBuffer({context:t,typedArray:a,usage:qe.STATIC_DRAW,indexDatatype:2===a.BYTES_PER_ELEMENT?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),m=[{index:pj.previousPosition,vertexBuffer:l,componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{index:pj.currentPosition,vertexBuffer:u,componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{index:pj.nextPosition,vertexBuffer:d,componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{index:pj.expandAndWidth,vertexBuffer:h,componentDatatype:Ca.FLOAT,componentsPerAttribute:2},{index:pj.a_batchId,vertexBuffer:p,componentDatatype:Ca.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new kl({context:t,attributes:m,indexBuffer:f}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}(e,t),e._ready=!0})).catch((t=>{e.isDestroyed()||(e._error=t)})):void 0}const mj=new ve,_j=new H;dj.getPolylinePositions=function(e,t){const n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!D(n)||!D(i))return;let r,s;const a=n.length;let c=0,l=0;for(r=0;r<a;++r)n[r]===t&&(c+=o[r+1]-o[r]);if(0===c)return;const u=new Float64Array(3*c);for(r=0;r<a;++r)if(n[r]===t){const e=o[r],t=o[r+1]-e;for(s=0;s<t;++s){const t=3*(e+s);u[l++]=i[t],u[l++]=i[t+1],u[l++]=i[t+2]}}return u},dj.prototype.getPositions=function(e){return dj.getPolylinePositions(this,e)},dj.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const i=n[o];t[i]=new uE(e,i)}},dj.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const gj=new Ot,yj=Ot.WHITE;dj.prototype.applyStyle=function(e,t){if(!D(e))return void function(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const e=t[n[o]];e.show=!0,e.color=Ot.WHITE}}(this,t);const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const i=t[n[o]];i.color=D(e.color)?e.color.evaluateColor(i,gj):yj,i.show=!D(e.show)||e.show.evaluate(i)}},dj.prototype.update=function(e){const t=e.context;if(!this._ready){if(D(this._promise)||(this._promise=fj(this,t)),D(this._error)){const e=this._error;throw this._error=void 0,e}return}!function(e,t){D(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return ve.clone(n,mj),ve.multiplyByPoint(mj,e._center,_j),ve.setTranslation(mj,_j,mj),mj},u_highlightColor:function(){return e._highlightColor}})}(this,t),function(e,t){if(D(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)("in vec4 currentPosition;\nin vec4 previousPosition;\nin vec4 nextPosition;\nin vec2 expandAndWidth;\nin float a_batchId;\n\nuniform mat4 u_modifiedModelView;\n\nvoid main()\n{\n float expandDir = expandAndWidth.x;\n float width = abs(expandAndWidth.y) + 0.5;\n bool usePrev = expandAndWidth.y < 0.0;\n\n vec4 p = u_modifiedModelView * currentPosition;\n vec4 prev = u_modifiedModelView * previousPosition;\n vec4 next = u_modifiedModelView * nextPosition;\n\n float angle;\n vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);\n gl_Position = czm_viewportOrthographic * positionWC;\n}\n"),o=n.getFragmentShaderCallback(!1,void 0,!1)("uniform vec4 u_highlightColor; \nvoid main()\n{\n out_FragColor = u_highlightColor;\n}\n"),r=new bc({defines:["VECTOR_TILE",Ct.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[yv,i]}),s=new bc({defines:["VECTOR_TILE"],sources:[o]});e._sp=ya.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:pj})}(this,t),function(e){if(D(e._rs))return;e._rs=_s.fromCache({blending:dh.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:{enabled:!0,factor:-5,units:-5}})}(this);const n=e.passes;(n.render||n.pick)&&function(e,t){if(!D(e._command)){const t=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new Kr({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:t,boundingVolume:e._boundingVolume,pass:zt.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}(this,e)},dj.prototype.isDestroyed=function(){return!1},dj.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),He(this)};function bj(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=M(e.ellipsoid,on.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new kt(Hh._defaultMinTerrainHeight,Hh._defaultMaxTerrainHeight),this._boundingVolume=zp.fromRectangle(e.rectangle,Hh._defaultMinTerrainHeight,Hh._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=Ot.clone(Ot.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(bj.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});const vj=new Qa("createVectorTileClampedPolylines"),Aj={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function Tj(e,t){if(D(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;D(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=function(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+Ir.packedLength+on.packedLength+H.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,Ir.pack(t,a,c),c+=Ir.packedLength,on.pack(o,a,c),c+=on.packedLength,H.pack(r,a,c),a}(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},l=vj.scheduleTask(c,a);return D(l)?l.then((function(n){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(n.decodedPositions),e._decodedPositionOffsets=new Uint32Array(n.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(n.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(n.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(n.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(n.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(n.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(n.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(n.vertexBatchIds);const i=n.indexDatatype;e._indices=i===je.UNSIGNED_SHORT?new Uint16Array(n.indices):new Uint32Array(n.indices),function(e,t){if(!D(e._va)){const n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,l=e._indices;let u=n.byteLength+i.byteLength;u+=o.byteLength+r.byteLength,u+=s.byteLength+a.byteLength,u+=c.byteLength+l.byteLength,e._trianglesLength=l.length/3,e._geometryByteLength=u;const d=Ye.createVertexBuffer({context:t,typedArray:n,usage:qe.STATIC_DRAW}),h=Ye.createVertexBuffer({context:t,typedArray:i,usage:qe.STATIC_DRAW}),p=Ye.createVertexBuffer({context:t,typedArray:o,usage:qe.STATIC_DRAW}),f=Ye.createVertexBuffer({context:t,typedArray:r,usage:qe.STATIC_DRAW}),m=Ye.createVertexBuffer({context:t,typedArray:s,usage:qe.STATIC_DRAW}),_=Ye.createVertexBuffer({context:t,typedArray:a,usage:qe.STATIC_DRAW}),g=Ye.createVertexBuffer({context:t,typedArray:c,usage:qe.STATIC_DRAW}),y=Ye.createIndexBuffer({context:t,typedArray:l,usage:qe.STATIC_DRAW,indexDatatype:2===l.BYTES_PER_ELEMENT?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),b=[{index:Aj.startEllipsoidNormal,vertexBuffer:d,componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{index:Aj.endEllipsoidNormal,vertexBuffer:h,componentDatatype:Ca.FLOAT,componentsPerAttribute:3},{index:Aj.startPositionAndHeight,vertexBuffer:p,componentDatatype:Ca.FLOAT,componentsPerAttribute:4},{index:Aj.endPositionAndHeight,vertexBuffer:f,componentDatatype:Ca.FLOAT,componentsPerAttribute:4},{index:Aj.startFaceNormalAndVertexCorner,vertexBuffer:m,componentDatatype:Ca.FLOAT,componentsPerAttribute:4},{index:Aj.endFaceNormalAndHalfWidth,vertexBuffer:_,componentDatatype:Ca.FLOAT,componentsPerAttribute:4},{index:Aj.a_batchId,vertexBuffer:g,componentDatatype:Ca.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new kl({context:t,attributes:b,indexBuffer:y}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}(e,t),e._ready=!0})).catch((t=>{e.isDestroyed()||(e._error=t)})):void 0}const wj=new ve,Ej=new H;function xj(e){return _s.fromCache({cull:{enabled:!0,face:ph.FRONT},blending:dh.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:ny.EQUAL,frontOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},backFunction:ny.EQUAL,backOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},reference:sy.CESIUM_3D_TILE_MASK,mask:sy.CESIUM_3D_TILE_MASK}})}bj.prototype.getPositions=function(e){return dj.getPolylinePositions(this,e)},bj.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const i=n[o];t[i]=new uE(e,i)}},bj.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};const Sj=new Ot,Cj=Ot.WHITE;function Ij(e){return Hh.initialize().then((function(){!function(e,t,n){const i=Hh.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;const a=e._boundingVolume,c=e._rectangle;zp.fromRectangle(c,o,r,n,a)}(e,e._rectangle,e._ellipsoid)})).catch((t=>{e.isDestroyed()||(e._error=t)}))}bj.prototype.applyStyle=function(e,t){if(!D(e))return void function(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const e=t[n[o]];e.show=!0,e.color=Ot.WHITE}}(this,t);const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const i=t[n[o]];i.color=D(e.color)?e.color.evaluateColor(i,Sj):Cj,i.show=!D(e.show)||e.show.evaluate(i)}},bj.prototype.update=function(e){const t=e.context;if(!this._ready){if(D(this._promise)||(this._promise=Ij(this).then(Tj(this,t))),D(this._error)){const e=this._error;throw this._error=void 0,e}return}var n;!function(e,t){D(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return ve.clone(n,wj),ve.multiplyByPoint(wj,e._center,Ej),ve.setTranslation(wj,Ej,wj),wj},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}(this,t),function(e,t){if(D(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)('in vec3 startEllipsoidNormal;\nin vec3 endEllipsoidNormal;\nin vec4 startPositionAndHeight;\nin vec4 endPositionAndHeight;\nin vec4 startFaceNormalAndVertexCorner;\nin vec4 endFaceNormalAndHalfWidth;\nin float a_batchId;\n\nuniform mat4 u_modifiedModelView;\nuniform vec2 u_minimumMaximumVectorHeights;\n\nout vec4 v_startPlaneEC;\nout vec4 v_endPlaneEC;\nout vec4 v_rightPlaneEC;\nout float v_halfWidth;\nout vec3 v_volumeUpEC;\n\nvoid main()\n{\n // vertex corner IDs\n // 3-----------7\n // /| left /|\n // / | 1 / |\n // 2-----------6 5 end\n // | / | /\n // start |/ right |/\n // 0-----------4\n //\n float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251); // 0 for front, 1 for end\n float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd)); // 0 for bottom, 1 for top\n\n vec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;\n vec3 right = normalize(cross(forward, startEllipsoidNormal));\n\n vec4 position = vec4(startPositionAndHeight.xyz, 1.0);\n position.xyz += forward * isEnd;\n\n v_volumeUpEC = czm_normal * normalize(cross(right, forward));\n\n // Push for volume height\n float offset;\n vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);\n\n // offset height to create volume\n offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);\n offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;\n position.xyz += offset * ellipsoidNormal;\n\n // move from RTC to EC\n position = u_modifiedModelView * position;\n right = czm_normal * right;\n\n // Push for width in a direction that is in the start or end plane and in a plane with right\n // N = normalEC ("right-facing" direction for push)\n // R = right\n // p = angle between N and R\n // w = distance to push along R if R == N\n // d = distance to push along N\n //\n // N R\n // { p| } * cos(p) = dot(N, R) = w / d\n // d | |w * d = w / dot(N, R)\n // { | }\n // o---------- polyline segment ----\x3e\n //\n vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);\n scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));\n vec3 miterPushNormal = czm_normal * normalize(scratchNormal);\n\n offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position)); // offset = widthEC\n offset = offset / dot(miterPushNormal, right);\n position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));\n\n gl_Position = czm_depthClamp(czm_projection * position);\n\n position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);\n vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;\n v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));\n v_rightPlaneEC = vec4(right, -dot(right, position.xyz));\n\n position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);\n vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;\n v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));\n v_halfWidth = endFaceNormalAndHalfWidth.w;\n}\n'),o=n.getFragmentShaderCallback(!1,void 0,!0)("in vec4 v_startPlaneEC;\nin vec4 v_endPlaneEC;\nin vec4 v_rightPlaneEC;\nin float v_halfWidth;\nin vec3 v_volumeUpEC;\n\nuniform vec4 u_highlightColor;\nvoid main()\n{\n float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\n\n // Discard for sky\n if (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n out_FragColor = vec4(0.0, 0.0, 1.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n eyeCoordinate /= eyeCoordinate.w;\n\n float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);\n\n // Expand halfMaxWidth if direction to camera is almost perpendicular with the volume's up direction\n halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));\n\n // Check distance of the eye coordinate against the right-facing plane\n float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\n\n // Check eye coordinate against the mitering planes\n float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);\n float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);\n\n if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n out_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n out_FragColor = u_highlightColor;\n\n czm_writeDepthClamp();\n}\n"),r=new bc({defines:["VECTOR_TILE",Ct.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[yv,i]}),s=new bc({defines:["VECTOR_TILE"],sources:[o]});e._sp=ya.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:Aj})}(this,t),D((n=this)._rs)||(n._rs=xj(!1),n._rs3DTiles=xj(!0));const i=e.passes;(i.render||i.pick)&&function(e,t){let n=e._command;if(!D(e._command)){const t=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new Kr({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:t,boundingVolume:e._boundingVolume,pass:zt.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const i=Kr.shallowClone(n,n.derivedCommands.tileset);i.renderState=e._rs3DTiles,i.pass=zt.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=i}const i=e._classificationType;i!==Vf.TERRAIN&&i!==Vf.BOTH||t.commandList.push(n),i!==Vf.CESIUM_3D_TILE&&i!==Vf.BOTH||t.commandList.push(n.derivedCommands.tileset)}(this,e)},bj.prototype.isDestroyed=function(){return!1},bj.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),He(this)};const Oj=32767,Dj=new Qt,Pj=new H;function Nj(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,function(e,t,n){n=M(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=Rj;const r=o.getUint32(n,!0);if(1!==r)throw new be(`Only Vector tile version 1 is supported. Version ${r} is not.`);n+=Rj;const s=o.getUint32(n,!0);if(n+=Rj,0===s)return void(e._ready=!0);const a=o.getUint32(n,!0);if(n+=Rj,0===a)throw new be("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=Rj;const l=o.getUint32(n,!0);n+=Rj;const u=o.getUint32(n,!0);n+=Rj;const d=o.getUint32(n,!0);n+=Rj;const h=o.getUint32(n,!0);n+=Rj;const p=o.getUint32(n,!0);n+=Rj;const f=o.getUint32(n,!0);n+=Rj;const m=Ew(i,n,a);n+=a;const _=new Uint8Array(t,n,c);let g,y;n+=c,l>0&&(g=Ew(i,n,l),n+=l,u>0&&(y=new Uint8Array(t,n,u),y=new Uint8Array(y),n+=u));const b=M(m.POLYGONS_LENGTH,0),v=M(m.POLYLINES_LENGTH,0),A=M(m.POINTS_LENGTH,0),T=b+v+A,w=new Yw(e,T,g,y,function(e){return function(t,n){D(e._polygons)&&e._polygons.updateCommands(t,n)}}(e));if(e._batchTable=w,0===T)return;const E=new eL(m,_),x=E.getGlobalProperty("REGION");if(!D(x))throw new be("Feature table global property: REGION must be defined");const S=Ir.unpack(x),C=x[4],I=x[5],O=e._tile.computedTransform;let P=E.getGlobalProperty("RTC_CENTER",Ca.FLOAT,3);D(P)?(P=H.unpack(P),ve.multiplyByPoint(O,P,P)):(P=Ir.center(S),P.height=V.lerp(C,I,.5),P=on.WGS84.cartographicToCartesian(P));const N=function(e,t){let n,i,o,r;const s=M(e.POLYGONS_LENGTH,0),a=M(e.POLYLINES_LENGTH,0),c=M(e.POINTS_LENGTH,0);if(s>0&&D(e.POLYGON_BATCH_IDS)){const i=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,i,s)}if(a>0&&D(e.POLYLINE_BATCH_IDS)){const n=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,n,a)}if(c>0&&D(e.POINT_BATCH_IDS)){const n=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,n,c)}const l=D(n)||D(i)||D(o),u=s>0&&!D(n)||a>0&&!D(i)||c>0&&!D(o);if(l&&u)throw new be("If one group of batch ids is defined, then all batch ids must be defined");if(!D(n)&&!D(i)&&!D(o)){let e=0;if(!D(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=e++;if(!D(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=e++;if(!D(o)&&c>0)for(o=new Uint16Array(c),r=0;r<c;++r)o[r]=e++}return{polygons:n,polylines:i,points:o}}(m,_);if(n+=(4-n%4)%4,b>0){E.featuresLength=b;const i=M(E.getPropertyArray("POLYGON_COUNTS",Ca.UNSIGNED_INT,1),E.getPropertyArray("POLYGON_COUNT",Ca.UNSIGNED_INT,1));if(!D(i))throw new be("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const o=M(E.getPropertyArray("POLYGON_INDEX_COUNTS",Ca.UNSIGNED_INT,1),E.getPropertyArray("POLYGON_INDEX_COUNT",Ca.UNSIGNED_INT,1));if(!D(o))throw new be("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const r=i.reduce((function(e,t){return e+2*t}),0),s=o.reduce((function(e,t){return e+t}),0),a=new Uint32Array(t,n,s);n+=d;const c=new Uint16Array(t,n,r);let l,u;n+=h,D(m.POLYGON_MINIMUM_HEIGHTS)&&D(m.POLYGON_MAXIMUM_HEIGHTS)&&(l=E.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",Ca.FLOAT,1),u=E.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",Ca.FLOAT,1)),e._polygons=new aj({positions:c,counts:i,indexCounts:o,indices:a,minimumHeight:C,maximumHeight:I,polygonMinimumHeights:l,polygonMaximumHeights:u,center:P,rectangle:S,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:w,batchIds:N.polygons,modelMatrix:O})}if(v>0){E.featuresLength=v;const i=M(E.getPropertyArray("POLYLINE_COUNTS",Ca.UNSIGNED_INT,1),E.getPropertyArray("POLYLINE_COUNT",Ca.UNSIGNED_INT,1));if(!D(i))throw new be("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let o=E.getPropertyArray("POLYLINE_WIDTHS",Ca.UNSIGNED_SHORT,1);if(!D(o)){o=new Uint16Array(v);for(let e=0;e<v;++e)o[e]=2}const r=i.reduce((function(e,t){return e+3*t}),0),s=new Uint16Array(t,n,r);n+=p;const a=e._tileset,c=a.examineVectorLinesFunction;if(D(c)){const t=function(e,t,n,i,o){const r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),c=e.subarray(2*r,3*r);sm.zigZagDeltaDecode(s,a,c);const l=new Float64Array(e.length);for(let u=0;u<r;++u){const e=s[u],r=a[u],d=c[u],h=V.lerp(t.west,t.east,e/Oj),p=V.lerp(t.south,t.north,r/Oj),f=V.lerp(n,i,d/Oj),m=Qt.fromRadians(h,p,f,Dj),_=o.cartographicToCartesian(m,Pj);H.pack(_,l,3*u)}return l}(new Uint16Array(s),S,C,I,on.WGS84);!function(e,t,n,i,o,r){const s=t.length;let a=0;for(let c=0;c<s;c++){const s=3*t[c],l=e.slice(a,a+s);a+=s,r(l,n[c],o,i)}}(t,i,N.polylines,w,e.url,c)}let l=Lj;D(a.classificationType)&&(l=Mj),e._polylines=l({positions:s,widths:o,counts:i,batchIds:N.polylines,minimumHeight:C,maximumHeight:I,center:P,rectangle:S,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:w,classificationType:a.classificationType,keepDecodedPositions:a.vectorKeepDecodedPositions})}if(A>0){const i=new Uint16Array(t,n,3*A);n+=f,e._points=new XG({positions:i,batchIds:N.points,minimumHeight:C,maximumHeight:I,rectangle:S,batchTable:w})}}(this,i,o)}Object.defineProperties(Nj.prototype,{featuresLength:{get:function(){return D(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return D(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return D(this._polygons)&&(e+=this._polygons.trianglesLength),D(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return D(this._polygons)&&(e+=this._polygons.geometryByteLength),D(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return D(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return D(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});const Rj=Uint32Array.BYTES_PER_ELEMENT;function Lj(e){return new dj(e)}function Mj(e){return new bj(e)}function Fj(e){const t=e.featuresLength;if(!D(e._features)&&t>0){const n=new Array(t);D(e._polygons)&&e._polygons.createFeatures(e,n),D(e._polylines)&&e._polylines.createFeatures(e,n),D(e._points)&&e._points.createFeatures(e,n),e._features=n}}Nj.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)},Nj.prototype.getFeature=function(e){const t=this.featuresLength;if(!D(e)||e<0||e>=t)throw new P(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return D(this._features)||Fj(this),this._features[e]},Nj.prototype.applyDebugSettings=function(e,t){D(this._polygons)&&this._polygons.applyDebugSettings(e,t),D(this._polylines)&&this._polylines.applyDebugSettings(e,t),D(this._points)&&this._points.applyDebugSettings(e,t)},Nj.prototype.applyStyle=function(e){D(this._features)||Fj(this),D(this._polygons)&&this._polygons.applyStyle(e,this._features),D(this._polylines)&&this._polylines.applyStyle(e,this._features),D(this._points)&&this._points.applyStyle(e,this._features)},Nj.prototype.update=function(e,t){let n=!0;D(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons.ready),D(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines.ready),D(this._points)&&(this._points.update(t),n=n&&this._points.ready),D(this._batchTable)&&n&&(D(this._features)||Fj(this),this._batchTable.update(e,t),this._ready=!0)},Nj.prototype.pick=function(e,t,n){},Nj.prototype.getPolylinePositions=function(e){const t=this._polylines;if(D(t))return t.getPositions(e)},Nj.prototype.isDestroyed=function(){return!1},Nj.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(),He(this)};const Bj={b3dm:function(e,t,n,i,o){return ak.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return ak.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return ak.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return Tw.fromTileType(e,t,n,i,o,Bj)},externalTileset:function(e,t,n,i){return lk.fromJson(e,t,n,i)},geom:function(e,t,n,i,o){return new dx(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new Nj(e,t,n,i,o)},subt:function(e,t,n,i,o){return SI.fromSubtreeJson(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return SI.fromSubtreeJson(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new be("Invalid glb content");const r=new DataView(i,o).getUint32(8,!0),s=new Uint8Array(i,o,r);return ak.fromGltf(e,t,n,s)},gltf:function(e,t,n,i){return ak.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return ak.fromGeoJson(e,t,n,i)}},zj=Bj,Uj=Object.freeze({UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5}),kj={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",IMPLICIT_SUBTREE_JSON:"subtreeJson",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",GEOJSON:"geoJson",VOXEL_BINARY:"voxl",VOXEL_JSON:"voxelJson",isBinaryFormat:function(e){switch(e){case kj.BATCHED_3D_MODEL:case kj.INSTANCED_3D_MODEL:case kj.COMPOSITE:case kj.POINT_CLOUD:case kj.VECTOR:case kj.GEOMETRY:case kj.IMPLICIT_SUBTREE:case kj.VOXEL_BINARY:case kj.GLTF_BINARY:return!0;default:return!1}}},Vj=Object.freeze(kj),Hj=Object.freeze({NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0}),Gj={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},jj=new Array(Gj.NUMBER_OF_PASSES);jj[Gj.RENDER]=Object.freeze({pass:Gj.RENDER,isRender:!0,requestTiles:!0,ignoreCommands:!1}),jj[Gj.PICK]=Object.freeze({pass:Gj.PICK,isRender:!1,requestTiles:!1,ignoreCommands:!1}),jj[Gj.SHADOW]=Object.freeze({pass:Gj.SHADOW,isRender:!1,requestTiles:!0,ignoreCommands:!1}),jj[Gj.PRELOAD]=Object.freeze({pass:Gj.PRELOAD,isRender:!1,requestTiles:!0,ignoreCommands:!0}),jj[Gj.PRELOAD_FLIGHT]=Object.freeze({pass:Gj.PRELOAD_FLIGHT,isRender:!1,requestTiles:!0,ignoreCommands:!0}),jj[Gj.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({pass:Gj.REQUEST_RENDER_MODE_DEFER_CHECK,isRender:!1,requestTiles:!0,ignoreCommands:!0}),jj[Gj.MOST_DETAILED_PRELOAD]=Object.freeze({pass:Gj.MOST_DETAILED_PRELOAD,isRender:!1,requestTiles:!0,ignoreCommands:!0}),jj[Gj.MOST_DETAILED_PICK]=Object.freeze({pass:Gj.MOST_DETAILED_PICK,isRender:!1,requestTiles:!1,ignoreCommands:!1}),Gj.getPassOptions=function(e){return jj[e]};const Wj=Object.freeze(Gj);function qj(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}function Yj(e){const t=(e=M(e,M.EMPTY_OBJECT)).content,n=e.class;L.typeOf.object("options.content",t),L.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}function Xj(e,t){const n=Px(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!D(n))return;if(!D(e.schema))return void Xj._oneTimeWarning("findContentMetadata-missing-root-schema","Could not find a metadata schema for content metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");const i=M(e.schema.classes,M.EMPTY_OBJECT);if(D(n.class)){return new Yj({content:n,class:i[n.class]})}}function Qj(e,t){const n=e.metadataExtension;if(!D(n))return;const i=n.groups,o=Px(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"].group:t.group;if("number"==typeof o)return i[o];const r=n.groupIds.findIndex((function(e){return e===o}));return r>=0?i[r]:void 0}function $j(e){const t=(e=M(e,M.EMPTY_OBJECT)).tile,n=e.class;L.typeOf.object("options.tile",t),L.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}function Kj(e,t){const n=Px(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!D(n))return;if(!D(e.schema))return void Kj._oneTimeWarning("findTileMetadata-missing-root-schema","Could not find a metadata schema for tile metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");const i=M(e.schema.classes,M.EMPTY_OBJECT);if(D(n.class)){return new $j({tile:n,class:i[n.class]})}}function Zj(e){const t=new Uint8Array(e);let n=Aw(t);if("glTF"===n&&(n="glb"),Vj.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=function(e){let t;try{t=Ew(e)}catch(n){throw new be("Invalid tile content.")}return t}(t);if(D(i.root))return{contentType:Vj.EXTERNAL_TILESET,jsonPayload:i};if(D(i.asset))return{contentType:Vj.GLTF,jsonPayload:i};if(D(i.tileAvailability))return{contentType:Vj.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(D(i.type))return{contentType:Vj.GEOJSON,jsonPayload:i};if(D(i.voxelTable))return{contentType:Vj.VOXEL_JSON,jsonPayload:i};throw new be("Invalid tile content.")}function Jj(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;const o=D(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0;const r=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(r),this._requests=new Array(r),this._ready=!1,this._innerContentResources=new Array(r),this._serverKeys=new Array(r);for(let s=0;s<r;s++){const e=n.getDerivedResource({url:o[s].uri}),t=Ii.getServerKey(e.getUrlComponent());this._innerContentResources[s]=e,this._serverKeys[s]=t}}function eW(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function tW(e,t){e._cancelCount++,e._tile._contentState=t;const n=e.tileset.statistics;n.numberOfPendingRequests-=e._requestsInFlight,n.numberOfAttemptedRequests+=e._requestsInFlight,e._requestsInFlight=0;const i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}function nW(e,t,n,i){const o=e._innerContentResources[t].clone(),r=e.tile,s=e._serverKeys[t],a=new mi({throttle:!0,throttleByServer:!0,type:fi.TILES3D,priorityFunction:function(){return r._priority},serverKey:s});o.request=a,e._requests[t]=a;const c=o.fetchArrayBuffer();if(D(c))return c.then((function(t){if(!(n<e._cancelCount)){if(!o.request.cancelled&&o.request.state!==pi.CANCELLED)return eW(e,-1),t;tW(e,i)}})).catch((function(r){n<e._cancelCount||(o.request.cancelled||o.request.state===pi.CANCELLED?tW(e,i):(eW(e,-1),iW(e,t,r)))}))}function iW(e,t,n){const i=e._tileset,o=e._innerContentResources[t].url,r=D(n.message)?n.message:n.toString();i.tileFailed.numberOfListeners>0&&i.tileFailed.raiseEvent({url:o,message:r})}Object.defineProperties(qj.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return!0}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(e){throw new P("Empty3DTileContent cannot have content metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){throw new P("Empty3DTileContent cannot have group metadata")}}}),qj.prototype.hasProperty=function(e,t){return!1},qj.prototype.getFeature=function(e){},qj.prototype.applyDebugSettings=function(e,t){},qj.prototype.applyStyle=function(e){},qj.prototype.update=function(e,t){},qj.prototype.pick=function(e,t,n){},qj.prototype.isDestroyed=function(){return!1},qj.prototype.destroy=function(){return He(this)},Object.defineProperties(Yj.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),Yj.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,this._class)},Yj.prototype.hasPropertyBySemantic=function(e){return Fx.hasPropertyBySemantic(e,this._properties,this._class)},Yj.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,this._class,e)},Yj.prototype.getProperty=function(e){return Fx.getProperty(e,this._properties,this._class)},Yj.prototype.setProperty=function(e,t){return Fx.setProperty(e,t,this._properties,this._class)},Yj.prototype.getPropertyBySemantic=function(e){return Fx.getPropertyBySemantic(e,this._properties,this._class)},Yj.prototype.setPropertyBySemantic=function(e,t){return Fx.setPropertyBySemantic(e,t,this._properties,this._class)},Xj._oneTimeWarning=Oa,Object.defineProperties($j.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),$j.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,this._class)},$j.prototype.hasPropertyBySemantic=function(e){return Fx.hasPropertyBySemantic(e,this._properties,this._class)},$j.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,this._class,e)},$j.prototype.getProperty=function(e){return Fx.getProperty(e,this._properties,this._class)},$j.prototype.setProperty=function(e,t){return Fx.setProperty(e,t,this._properties,this._class)},$j.prototype.getPropertyBySemantic=function(e){return Fx.getPropertyBySemantic(e,this._properties,this._class)},$j.prototype.setPropertyBySemantic=function(e,t){return Fx.setPropertyBySemantic(e,t,this._properties,this._class)},Kj._oneTimeWarning=Oa,Object.defineProperties(Jj.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},ready:{get:function(){return!!this._contentsCreated&&this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(){throw new P("Multiple3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(){throw new P("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map((function(e){return e.uri}))}}}),Jj.prototype.requestInnerContents=function(){if(!function(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];D(t[i])?t[i]++:t[i]=1}for(const n in t)if(t.hasOwnProperty(n)&&!Ii.serverHasOpenSlots(n,t[n]))return!1;return Ii.heapHasOpenSlots(e.length)}(this._serverKeys))return void(this.tileset.statistics.numberOfAttemptedRequests+=this._serverKeys.length);const e=this._innerContentHeaders;eW(this,e.length);const t=this._cancelCount;for(let n=0;n<e.length;n++)this._arrayFetchPromises[n]=nW(this,n,t,this._tile._contentState);return async function(e){const t=e._cancelCount,n=await Promise.all(e._arrayFetchPromises);if(t<e._cancelCount)return;const i=n.map(((t,n)=>async function(e,t,n){if(!D(t))return;try{const i=Zj(t);if(i.contentType===Vj.EXTERNAL_TILESET)throw new be("External tilesets are disallowed inside multiple contents");e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===Vj.GEOMETRY||i.contentType===Vj.VECTOR;const o=e._tileset,r=e._innerContentResources[n],s=e._tile;let a;const c=zj[i.contentType];a=D(i.binaryPayload)?await Promise.resolve(c(o,s,r,i.binaryPayload.buffer,0)):await Promise.resolve(c(o,s,r,i.jsonPayload));const l=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){const e=s.implicitSubtree,t=s.implicitCoordinates;a.metadata=e.getContentMetadataView(t,n)}else s.hasImplicitContent||(a.metadata=Xj(o,l));const u=Qj(o,l);return D(u)&&(a.group=new yw({metadata:u})),a}catch(i){iW(e,n,i)}}(e,t,n))),o=await Promise.all(i);return e._contentsCreated=!0,e._contents=o.filter(D),o}(this)},Jj.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];D(t)&&t.cancel()}},Jj.prototype.hasProperty=function(e,t){return!1},Jj.prototype.getFeature=function(e){},Jj.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)},Jj.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)},Jj.prototype.update=function(e,t){const n=this._contents,i=n.length;let o=!0;for(let r=0;r<i;++r)n[r].update(e,t),o=o&&n[r].ready;!this._ready&&o&&(this._ready=!0)},Jj.prototype.pick=function(e,t,n){if(!this._ready)return;let i,o=Number.POSITIVE_INFINITY;const r=this._contents,s=r.length;for(let a=0;a<s;++a){const s=r[a].pick(e,t,n);if(!D(s))continue;const c=H.distance(e.origin,s);c<o&&(i=s,o=c)}return D(i)?n:void 0},Jj.prototype.isDestroyed=function(){return!1},Jj.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};const oW=Math.cos,rW=Math.sin,sW=Math.sqrt,aW={computePosition:function(e,t,n,i,o,r,s){const a=t.radiiSquared,c=e.nwCorner,l=e.boundingRectangle;let u=c.latitude-e.granYCos*i+o*e.granXSin;const d=oW(u),h=rW(u),p=a.z*h;let f=c.longitude+i*e.granYSin+o*e.granXCos;const m=d*oW(f),_=d*rW(f),g=a.x*m,y=a.y*_,b=sW(g*m+y*_+p*h);if(r.x=g/b,r.y=y/b,r.z=p/b,n){const t=e.stNwCorner;D(t)?(u=t.latitude-e.stGranYCos*i+o*e.stGranXSin,f=t.longitude+i*e.stGranYSin+o*e.stGranXCos,s.x=(f-e.stWest)*e.lonScalar,s.y=(u-e.stSouth)*e.latScalar):(s.x=(f-l.west)*e.lonScalar,s.y=(u-l.south)*e.latScalar)}}},cW=new Ms;let lW=new H;const uW=new Qt;let dW=new H;const hW=new fn;function pW(e,t,n,i,o,r,s){const a=Math.cos(t),c=i*a,l=n*a,u=Math.sin(t),d=i*u,h=n*u;lW=hW.project(e,lW),lW=H.subtract(lW,dW,lW);const p=Ms.fromRotation(t,cW);lW=Ms.multiplyByVector(p,lW,lW),lW=H.add(lW,dW,lW),r-=1,s-=1;const f=(e=hW.unproject(lW,e)).latitude,m=f+r*h,_=f-c*s,g=f-c*s+r*h,y=Math.max(f,m,_,g),b=Math.min(f,m,_,g),v=e.longitude,A=v+r*l,T=v+s*d,w=v+s*d+r*l;return{north:y,south:b,east:Math.max(v,A,T,w),west:Math.min(v,A,T,w),granYCos:c,granYSin:d,granXCos:l,granXSin:h,nwCorner:e}}aW.computeOptions=function(e,t,n,i,o,r,s){let a,c=e.east,l=e.west,u=e.north,d=e.south,h=!1,p=!1;u===V.PI_OVER_TWO&&(h=!0),d===-V.PI_OVER_TWO&&(p=!0);const f=u-d;a=l>c?V.TWO_PI-l+c:c-l;const m=Math.ceil(a/t)+1,_=Math.ceil(f/t)+1,g=a/(m-1),y=f/(_-1),b=Ir.northwest(e,r),v=Ir.center(e,uW);0===n&&0===i||(v.longitude<b.longitude&&(v.longitude+=V.TWO_PI),dW=hW.project(v,dW));const A=y,T=g,w=Ir.clone(e,o),E={granYCos:A,granYSin:0,granXCos:T,granXSin:0,nwCorner:b,boundingRectangle:w,width:m,height:_,northCap:h,southCap:p};if(0!==n){const e=pW(b,n,g,y,0,m,_);if(u=e.north,d=e.south,c=e.east,l=e.west,u<-V.PI_OVER_TWO||u>V.PI_OVER_TWO||d<-V.PI_OVER_TWO||d>V.PI_OVER_TWO)throw new P("Rotated rectangle is invalid. It crosses over either the north or south pole.");E.granYCos=e.granYCos,E.granYSin=e.granYSin,E.granXCos=e.granXCos,E.granXSin=e.granXSin,w.north=u,w.south=d,w.east=c,w.west=l}if(0!==i){n-=i;const e=Ir.northwest(w,s),t=pW(e,n,g,y,0,m,_);E.stGranYCos=t.granYCos,E.stGranXCos=t.granXCos,E.stGranYSin=t.granYSin,E.stGranXSin=t.granXSin,E.stNwCorner=e,E.stWest=t.west,E.stSouth=t.south}return E};const fW=aW,mW=new $u,_W=new $u,gW=new H,yW=new Ir;function bW(e,t){const n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap;let a=i,c=2,l=0,u=4;r&&(c-=1,a-=1,l+=1,u-=2),s&&(c-=1,a-=1,l+=1,u-=2),l+=c*o+2*a-u;const d=new Float64Array(3*l);let h,p=0,f=0;const m=gW;if(r)fW.computePosition(t,n,!1,f,0,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;else for(h=0;h<o;h++)fW.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;for(h=o-1,f=1;f<i;f++)fW.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;if(f=i-1,!s)for(h=o-2;h>=0;h--)fW.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;for(h=0,f=i-2;f>0;f--)fW.computePosition(t,n,!1,f,h,m),d[p++]=m.x,d[p++]=m.y,d[p++]=m.z;const _=d.length/3*2,g=je.createTypedArray(d.length/3,_);let y=0;for(let v=0;v<d.length/3-1;v++)g[y++]=v,g[y++]=v+1;g[y++]=d.length/3-1,g[y++]=0;const b=new Na({attributes:new Md,primitiveType:Vr.LINES});return b.attributes.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:d}),b.indices=g,b}function vW(e){const t=(e=M(e,M.EMPTY_OBJECT)).rectangle,n=M(e.granularity,V.RADIANS_PER_DEGREE),i=M(e.ellipsoid,on.WGS84),o=M(e.rotation,0);if(!D(t))throw new P("rectangle is required.");if(Ir.validate(t),t.north<t.south)throw new P("options.rectangle.north must be greater than options.rectangle.south");const r=M(e.height,0),s=M(e.extrudedHeight,r);this._rectangle=Ir.clone(t),this._granularity=n,this._ellipsoid=i,this._surfaceHeight=Math.max(r,s),this._rotation=o,this._extrudedHeight=Math.min(r,s),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}vW.packedLength=Ir.packedLength+on.packedLength+5,vW.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),Ir.pack(e._rectangle,t,n),n+=Ir.packedLength,on.pack(e._ellipsoid,t,n),n+=on.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._extrudedHeight,t[n]=M(e._offsetAttribute,-1),t};const AW=new Ir,TW=on.clone(on.UNIT_SPHERE),wW={rectangle:AW,ellipsoid:TW,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};vW.unpack=function(e,t,n){if(!D(e))throw new P("array is required");t=M(t,0);const i=Ir.unpack(e,t,AW);t+=Ir.packedLength;const o=on.unpack(e,t,TW);t+=on.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],l=e[t];return D(n)?(n._rectangle=Ir.clone(i,n._rectangle),n._ellipsoid=on.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=c,n._offsetAttribute=-1===l?void 0:l,n):(wW.granularity=r,wW.height=s,wW.rotation=a,wW.extrudedHeight=c,wW.offsetAttribute=-1===l?void 0:l,new vW(wW))};const EW=new Qt;function xW(e){L.typeOf.object("options",e),L.typeOf.object("options.rectangle",e.rectangle),this.rectangle=Ir.clone(e.rectangle),this.minimumHeight=M(e.minimumHeight,0),this.maximumHeight=M(e.maximumHeight,0),this.southwestCornerCartesian=new H,this.northeastCornerCartesian=new H,this.westNormal=new H,this.southNormal=new H,this.eastNormal=new H,this.northNormal=new H;const t=M(e.ellipsoid,on.WGS84);!function(e,t,n){n.cartographicToCartesian(Ir.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(Ir.northeast(t),e.northeastCornerCartesian),RW.longitude=t.west,RW.latitude=.5*(t.south+t.north),RW.height=0;const i=n.cartographicToCartesian(RW,PW),o=H.cross(i,H.UNIT_Z,OW);H.normalize(o,e.westNormal),RW.longitude=t.east;const r=n.cartographicToCartesian(RW,NW),s=H.cross(H.UNIT_Z,r,SW);H.normalize(s,e.eastNormal);let a=H.subtract(i,r,SW);0===H.magnitude(a)&&(a=H.clone(o,a));const c=H.normalize(a,DW),l=t.south;let u;if(l>0){RW.longitude=.5*(t.west+t.east),RW.latitude=l;const i=n.cartographicToCartesian(RW,MW.origin);H.clone(c,MW.direction);const o=Pc.fromPointNormal(e.southwestCornerCartesian,e.westNormal,LW);Pp.rayPlane(MW,o,e.southwestCornerCartesian),u=n.geodeticSurfaceNormal(i,CW)}else u=n.geodeticSurfaceNormalCartographic(Ir.southeast(t),CW);const d=H.cross(u,a,IW);H.normalize(d,e.southNormal);const h=t.north;let p;if(h<0){RW.longitude=.5*(t.west+t.east),RW.latitude=h;const i=n.cartographicToCartesian(RW,MW.origin);H.negate(c,MW.direction);const o=Pc.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,LW);Pp.rayPlane(MW,o,e.northeastCornerCartesian),p=n.geodeticSurfaceNormal(i,CW)}else p=n.geodeticSurfaceNormalCartographic(Ir.northwest(t),CW);const f=H.cross(a,p,IW);H.normalize(f,e.northNormal)}(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,M(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}vW.createGeometry=function(e){const t=e._rectangle,n=e._ellipsoid,i=fW.computeOptions(t,e._granularity,e._rotation,0,yW,EW);let o,r;if(V.equalsEpsilon(t.north,t.south,V.EPSILON10)||V.equalsEpsilon(t.east,t.west,V.EPSILON10))return;const s=e._surfaceHeight,a=e._extrudedHeight;let c;if(!V.equalsEpsilon(s,a,0,V.EPSILON2)){if(o=function(e,t){const n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=bW(e,t),s=t.height,a=t.width,c=$O.scaleToGeodeticHeight(r.attributes.position.values,n,o,!1);let l=c.length;const u=new Float64Array(2*l);u.set(c);const d=$O.scaleToGeodeticHeight(r.attributes.position.values,i,o);u.set(d,l),r.attributes.position.values=u;const h=t.northCap,p=t.southCap;let f=4;h&&(f-=1),p&&(f-=1);const m=2*(u.length/3+f),_=je.createTypedArray(u.length/3,m);l=u.length/6;let g,y=0;for(let b=0;b<l-1;b++)_[y++]=b,_[y++]=b+1,_[y++]=b+l,_[y++]=b+l+1;if(_[y++]=l-1,_[y++]=0,_[y++]=l+l-1,_[y++]=l,_[y++]=0,_[y++]=l,h)g=s-1;else{const e=a-1;_[y++]=e,_[y++]=e+l,g=a+s-2}if(_[y++]=g,_[y++]=g+l,!p){const e=a+g-1;_[y++]=e,_[y]=e+l}return r.indices=_,r}(e,i),D(e._offsetAttribute)){const t=o.attributes.position.values.length/3;let n=new Uint8Array(t);e._offsetAttribute===Fd.TOP?n=n.fill(1,0,t/2):(c=e._offsetAttribute===Fd.NONE?0:1,n=n.fill(c)),o.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}const l=$u.fromRectangle3D(t,n,s,_W),u=$u.fromRectangle3D(t,n,a,mW);r=$u.union(l,u)}else{if(o=bW(e,i),o.attributes.position.values=$O.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),D(e._offsetAttribute)){const t=o.attributes.position.values.length;c=e._offsetAttribute===Fd.NONE?0:1;const n=new Uint8Array(t/3).fill(c);o.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}r=$u.fromRectangle3D(t,n,s)}return new Na({attributes:o.attributes,indices:o.indices,primitiveType:Vr.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})},Object.defineProperties(xW.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),xW.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=zp.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=$u.fromOrientedBoundingBox(this._orientedBoundingBox)};const SW=new H,CW=new H,IW=new H,OW=new H,DW=new H,PW=new H,NW=new H,RW=new Qt,LW=new Pc(H.UNIT_X,0),MW=new tp;const FW=new H,BW=new H,zW=new H(0,-1,0),UW=new H(0,0,-1),kW=new H;xW.prototype.distanceToCamera=function(e){L.defined("frameState",e);const t=function(e,t){const n=t.camera,i=n.positionWC,o=n.positionCartographic;let r,s,a,c=0;if(!Ir.contains(e.rectangle,o)){let n=e.southwestCornerCartesian,o=e.northeastCornerCartesian,r=e.westNormal,s=e.southNormal,a=e.eastNormal,l=e.northNormal;t.mode!==gl.SCENE3D&&(n=t.mapProjection.project(Ir.southwest(e.rectangle),FW),n.z=n.y,n.y=n.x,n.x=0,o=t.mapProjection.project(Ir.northeast(e.rectangle),BW),o.z=o.y,o.y=o.x,o.x=0,r=zW,a=H.UNIT_Y,s=UW,l=H.UNIT_Z);const u=H.subtract(i,n,kW),d=H.dot(u,r),h=H.dot(u,s),p=H.subtract(i,o,kW),f=H.dot(p,a),m=H.dot(p,l);d>0?c+=d*d:f>0&&(c+=f*f),h>0?c+=h*h:m>0&&(c+=m*m)}if(t.mode===gl.SCENE3D?(r=o.height,s=e.minimumHeight,a=e.maximumHeight):(r=i.x,s=0,a=0),r>a){const e=r-a;c+=e*e}else if(r<s){const e=s-r;c+=e*e}return Math.sqrt(c)}(this,e);if(e.mode===gl.SCENE3D&&D(this._orientedBoundingBox)){const n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t},xW.prototype.intersectPlane=function(e){return L.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)},xW.prototype.createDebugVolume=function(e){L.defined("color",e);const t=new ve.clone(ve.IDENTITY);return new V_({geometryInstances:new Zd({geometry:new vW({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),id:"outline",modelMatrix:t,attributes:{color:$d.fromColor(e)}}),appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1})};const VW={},HW=new H,GW=new H,jW=new H,WW=new H,qW=new zp;function YW(e,t,n,i,o){const r=H.subtract(e,t,HW),s=H.dot(n,r),a=H.dot(i,r);return kt.fromElements(s,a,o)}VW.validOutline=function(e){L.defined("positions",e);const t=zp.fromPoints(e,qW).halfAxes,n=re.getColumn(t,0,GW),i=re.getColumn(t,1,jW),o=re.getColumn(t,2,WW),r=H.magnitude(n),s=H.magnitude(i),a=H.magnitude(o);return!(0===r&&(0===s||0===a)||0===s&&0===a)},VW.computeProjectTo2DArguments=function(e,t,n,i){L.defined("positions",e),L.defined("centerResult",t),L.defined("planeAxis1Result",n),L.defined("planeAxis2Result",i);const o=zp.fromPoints(e,qW),r=o.halfAxes,s=re.getColumn(r,0,GW),a=re.getColumn(r,1,jW),c=re.getColumn(r,2,WW),l=H.magnitude(s),u=H.magnitude(a),d=H.magnitude(c),h=Math.min(l,u,d);if(0===l&&(0===u||0===d)||0===u&&0===d)return!1;let p,f;return h!==u&&h!==d||(p=s),h===l?p=a:h===d&&(f=a),h!==l&&h!==u||(f=c),H.normalize(p,n),H.normalize(f,i),H.clone(o.center,t),!0},VW.createProjectPointsTo2DFunction=function(e,t,n){return function(i){const o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=YW(i[r],e,t,n);return o}},VW.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return YW(i,e,t,n,o)}};const XW=VW;function QW(e){const t=e.length,n=new Float64Array(3*t),i=je.createTypedArray(t,2*t);let o=0,r=0;for(let s=0;s<t;s++){const a=e[s];n[o++]=a.x,n[o++]=a.y,n[o++]=a.z,i[r++]=s,i[r++]=(s+1)%t}return new Na({attributes:new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:n})}),indices:i,primitiveType:Vr.LINES})}function $W(e){const t=(e=M(e,M.EMPTY_OBJECT)).polygonHierarchy;L.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=xD.computeHierarchyPackedLength(t,H)+1}$W.fromPositions=function(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.positions",e.positions);return new $W({polygonHierarchy:{positions:e.positions}})},$W.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n=xD.packPolygonHierarchy(e._polygonHierarchy,t,n,H)]=e.packedLength,t};const KW={polygonHierarchy:{}};$W.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=xD.unpackPolygonHierarchy(e,t,H);t=i.startingIndex,delete i.startingIndex;const o=e[t];return D(n)||(n=new $W(KW)),n._polygonHierarchy=i,n.packedLength=o,n},$W.createGeometry=function(e){const t=e._polygonHierarchy;let n=t.positions;if(n=Ry(n,H.equalsEpsilon,!0),n.length<3)return;if(!XW.validOutline(n))return;const i=xD.polygonOutlinesFromHierarchy(t,!1);if(0===i.length)return;const o=[];for(let a=0;a<i.length;a++){const e=new Zd({geometry:QW(i[a])});o.push(e)}const r=C_.combineInstances(o)[0],s=$u.fromPoints(t.positions);return new Na({attributes:r.attributes,indices:r.indices,primitiveType:r.primitiveType,boundingSphere:s})};let ZW=new Qt;function JW(e){L.typeOf.object("options",e),L.typeOf.string("options.token",e.token);const t=Tx.fromToken(e.token),n=M(e.minimumHeight,0),i=M(e.maximumHeight,0),o=M(e.ellipsoid,on.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;const r=function(e,t,n,i){const o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,eq),a=i.cartesianToCartographic(r,tq);a.height=n;const c=i.cartographicToCartesian(a,nq),l=Pc.fromPointNormal(c,s);o[0]=l;let u,d=0;const h=[];let p,f;for(u=0;u<4;u++){p=e.getVertex(u),h[u]=p,f=i.cartesianToCartographic(p,iq),f.height=t;const n=Pc.getPointDistance(l,i.cartographicToCartesian(f,oq));n<d&&(d=n)}const m=Pc.clone(l);for(m.normal=H.negate(m.normal,m.normal),m.distance=-1*m.distance+d,o[1]=m,u=0;u<4;u++){p=h[u];const e=h[(u+1)%4],t=i.geodeticSurfaceNormal(p,rq),n=H.subtract(e,p,aq);let r=H.cross(n,t,sq);r=H.normalize(r,r),o[2+u]=Pc.fromPointNormal(p,r)}return o}(t,n,i,o);this._boundingPlanes=r;const s=function(e){const t=new Array(8);for(let n=0;n<4;n++)t[n]=Tq(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=Tq(e[1],e[2+(n+3)%4],e[2+n%4]);return t}(r);let a;for(this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=xq(r[0],s.slice(0,4)),a=0;a<4;a++)this._edgeNormals[0][a]=H.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=xq(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=xq(r[2+a],[s[a%4],s[(a+1)%4],s[4+(a+1)%4],s[4+a]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],a=0;a<4;a++)this._planeVertices.push([this._vertices[a%4],this._vertices[(a+1)%4],this._vertices[4+(a+1)%4],this._vertices[4+a]]);const c=t.getCenter();ZW=o.cartesianToCartographic(c,ZW),ZW.height=(i+n)/2,this.center=o.cartographicToCartesian(ZW,c),this._boundingSphere=$u.fromPoints(s)}const eq=new H,tq=new Qt,nq=new H,iq=new Qt,oq=new H,rq=new H,sq=new H,aq=new H;let cq=new H,lq=new H,uq=new H,dq=new H,hq=new H,pq=new H;const fq=new H,mq=new H,_q=new H;let gq=new H,yq=new H,bq=new H,vq=new H;const Aq=new re;function Tq(e,t,n){cq=e.normal,lq=t.normal,uq=n.normal,dq=H.multiplyByScalar(e.normal,-e.distance,dq),hq=H.multiplyByScalar(t.normal,-t.distance,hq),pq=H.multiplyByScalar(n.normal,-n.distance,pq),gq=H.multiplyByScalar(H.cross(lq,uq,fq),H.dot(dq,cq),gq),yq=H.multiplyByScalar(H.cross(uq,cq,mq),H.dot(hq,lq),yq),bq=H.multiplyByScalar(H.cross(cq,lq,_q),H.dot(pq,uq),bq),Aq[0]=cq.x,Aq[1]=lq.x,Aq[2]=uq.x,Aq[3]=cq.y,Aq[4]=lq.y,Aq[5]=uq.y,Aq[6]=cq.z,Aq[7]=lq.z,Aq[8]=uq.z;const i=re.determinant(Aq);return vq=H.add(gq,yq,vq),vq=H.add(vq,bq,vq),new H(vq.x/i,vq.y/i,vq.z/i)}let wq=new H,Eq=new H;function xq(e,t){const n=[];for(let i=0;i<4;i++)wq=H.subtract(t[(i+1)%4],t[i],wq),Eq=H.cross(e.normal,wq,Eq),Eq=H.normalize(Eq,Eq),n[i]=H.clone(Eq);return n}Object.defineProperties(JW.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const Sq=new H;JW.prototype.distanceToCamera=function(e){L.defined("frameState",e);const t=e.camera.positionWC,n=[],i=[];let o,r,s,a,c;for(Pc.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):Pc.getPointDistance(this._boundingPlanes[1],t)>0&&(n.push(1),i.push(this._planeVertices[1]),o=this._edgeNormals[1]),r=0;r<4;r++)s=2+r,Pc.getPointDistance(this._boundingPlanes[s],t)>0&&(n.push(s),i.push(this._planeVertices[s]),o=this._edgeNormals[s]);if(0===n.length)return 0;if(1===n.length)return c=this._boundingPlanes[n[0]],a=Pq(Pc.projectPointOntoPlane(c,t,Sq),i[0],c,o),H.distance(a,t);if(2===n.length){if(0===n[0]){const e=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=Oq(t,e[0],e[1]),H.distance(a,t)}let e,o=Number.MAX_VALUE;for(r=0;r<2;r++)c=this._boundingPlanes[n[r]],a=Pq(Pc.projectPointOntoPlane(c,t,Sq),i[r],c,this._edgeNormals[n[r]]),e=H.distanceSquared(a,t),e<o&&(o=e);return Math.sqrt(o)}if(n.length>3)return a=Pq(Pc.projectPointOntoPlane(this._boundingPlanes[1],t,Sq),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),H.distance(a,t);const l=2===n[1]&&5===n[2]?0:1;return 0===n[0]?H.distance(t,this._vertices[(n[1]-2+l)%4]):H.distance(t,this._vertices[4+(n[1]-2+l)%4])};const Cq=new H,Iq=new H;function Oq(e,t,n){const i=H.subtract(n,t,Cq),o=H.subtract(e,t,Iq);let r=H.dot(i,o);if(r<=0)return t;const s=H.dot(i,i);return r>=s?n:(r/=s,new H((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}const Dq=new Pc(H.UNIT_X,0);function Pq(e,t,n,i){let o,r,s,a=Number.MAX_VALUE;for(let c=0;c<t.length;c++){const n=Pc.fromPointNormal(t[c],i[c],Dq);Pc.getPointDistance(n,e)<0||(s=Oq(e,t[c],t[(c+1)%4]),o=H.distance(e,s),o<a&&(a=o,r=s))}return D(r)?r:e}JW.prototype.intersectPlane=function(e){L.defined("plane",e);let t=0,n=0;for(let i=0;i<this._vertices.length;i++){H.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++}return t===this._vertices.length?mn.INSIDE:n===this._vertices.length?mn.OUTSIDE:mn.INTERSECTING},JW.prototype.createDebugVolume=function(e){L.defined("color",e);const t=new ve.clone(ve.IDENTITY),n=new $W({polygonHierarchy:{positions:this._planeVertices[0]}}),i=new Zd({geometry:$W.createGeometry(n),id:"outline",modelMatrix:t,attributes:{color:$d.fromColor(e)}}),o=new $W({polygonHierarchy:{positions:this._planeVertices[1]}}),r=new Zd({geometry:$W.createGeometry(o),id:"outline",modelMatrix:t,attributes:{color:$d.fromColor(e)}}),s=[];for(let a=0;a<4;a++){const n=new $W({polygonHierarchy:{positions:this._planeVertices[2+a]}}),i=$W.createGeometry(n);s[a]=new Zd({geometry:i,id:"outline",modelMatrix:t,attributes:{color:$d.fromColor(e)}})}return new V_({geometryInstances:[s[0],s[1],s[2],s[3],r,i],appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1})};const Nq=new H(1,1,1),Rq=Math.cos,Lq=Math.sin;function Mq(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.radii,Nq),n=M(e.innerRadii,t),i=M(e.minimumClock,0),o=M(e.maximumClock,V.TWO_PI),r=M(e.minimumCone,0),s=M(e.maximumCone,V.PI),a=Math.round(M(e.stackPartitions,10)),c=Math.round(M(e.slicePartitions,8)),l=Math.round(M(e.subdivisions,128));if(a<1)throw new P("options.stackPartitions cannot be less than 1");if(c<0)throw new P("options.slicePartitions cannot be less than 0");if(l<0)throw new P("options.subdivisions must be greater than or equal to zero.");if(D(e.offsetAttribute)&&e.offsetAttribute===Fd.TOP)throw new P("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._radii=H.clone(t),this._innerRadii=H.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._subdivisions=l,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}Mq.packedLength=2*H.packedLength+8,Mq.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),H.pack(e._radii,t,n),n+=H.packedLength,H.pack(e._innerRadii,t,n),n+=H.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n++]=e._subdivisions,t[n]=M(e._offsetAttribute,-1),t};const Fq=new H,Bq=new H,zq={radii:Fq,innerRadii:Bq,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 Uq(e){const t=M(e.radius,1),n={radii:new H(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new Mq(n),this._workerName="createSphereOutlineGeometry"}Mq.unpack=function(e,t,n){if(!D(e))throw new P("array is required");t=M(t,0);const i=H.unpack(e,t,Fq);t+=H.packedLength;const o=H.unpack(e,t,Bq);t+=H.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t];return D(n)?(n._radii=H.clone(i,n._radii),n._innerRadii=H.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=c,n._stackPartitions=l,n._slicePartitions=u,n._subdivisions=d,n._offsetAttribute=-1===h?void 0:h,n):(zq.minimumClock=r,zq.maximumClock=s,zq.minimumCone=a,zq.maximumCone=c,zq.stackPartitions=l,zq.slicePartitions=u,zq.subdivisions=d,zq.offsetAttribute=-1===h?void 0:h,new Mq(zq))},Mq.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._subdivisions,c=on.fromCartesian3(t);let l=e._slicePartitions+1,u=e._stackPartitions+1;l=Math.round(l*Math.abs(o-i)/V.TWO_PI),u=Math.round(u*Math.abs(s-r)/V.PI),l<2&&(l=2),u<2&&(u=2);let d=0,h=1;const p=n.x!==t.x||n.y!==t.y||n.z!==t.z;let f=!1,m=!1;p&&(h=2,r>0&&(f=!0,d+=l),s<Math.PI&&(m=!0,d+=l));const _=a*h*(u+l),g=new Float64Array(3*_),y=2*(_+d-(l+u)*h),b=je.createTypedArray(_,y);let v,A,T,w,E=0;const x=new Array(u),S=new Array(u);for(v=0;v<u;v++)w=r+v*(s-r)/(u-1),x[v]=Lq(w),S[v]=Rq(w);const C=new Array(a),I=new Array(a);for(v=0;v<a;v++)T=i+v*(o-i)/(a-1),C[v]=Lq(T),I[v]=Rq(T);for(v=0;v<u;v++)for(A=0;A<a;A++)g[E++]=t.x*x[v]*I[A],g[E++]=t.y*x[v]*C[A],g[E++]=t.z*S[v];if(p)for(v=0;v<u;v++)for(A=0;A<a;A++)g[E++]=n.x*x[v]*I[A],g[E++]=n.y*x[v]*C[A],g[E++]=n.z*S[v];for(x.length=a,S.length=a,v=0;v<a;v++)w=r+v*(s-r)/(a-1),x[v]=Lq(w),S[v]=Rq(w);for(C.length=l,I.length=l,v=0;v<l;v++)T=i+v*(o-i)/(l-1),C[v]=Lq(T),I[v]=Rq(T);for(v=0;v<a;v++)for(A=0;A<l;A++)g[E++]=t.x*x[v]*I[A],g[E++]=t.y*x[v]*C[A],g[E++]=t.z*S[v];if(p)for(v=0;v<a;v++)for(A=0;A<l;A++)g[E++]=n.x*x[v]*I[A],g[E++]=n.y*x[v]*C[A],g[E++]=n.z*S[v];for(E=0,v=0;v<u*h;v++){const e=v*a;for(A=0;A<a-1;A++)b[E++]=e+A,b[E++]=e+A+1}let O=u*a*h;for(v=0;v<l;v++)for(A=0;A<a-1;A++)b[E++]=O+v+A*l,b[E++]=O+v+(A+1)*l;if(p)for(O=u*a*h+l*a,v=0;v<l;v++)for(A=0;A<a-1;A++)b[E++]=O+v+A*l,b[E++]=O+v+(A+1)*l;if(p){let e=u*a*h,t=e+a*l;if(f)for(v=0;v<l;v++)b[E++]=e+v,b[E++]=t+v;if(m)for(e+=a*l-l,t+=a*l-l,v=0;v<l;v++)b[E++]=e+v,b[E++]=t+v}const P=new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:g})});if(D(e._offsetAttribute)){const t=g.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);P.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:P,indices:b,primitiveType:Vr.LINES,boundingSphere:$u.fromEllipsoid(c),offsetAttribute:e._offsetAttribute})},Uq.packedLength=Mq.packedLength,Uq.pack=function(e,t,n){return L.typeOf.object("value",e),Mq.pack(e._ellipsoidGeometry,t,n)};const kq=new Mq,Vq={radius:void 0,radii:new H,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};function Hq(e,t){0===t&&(t=V.EPSILON7),this._boundingSphere=new $u(e,t)}Uq.unpack=function(e,t,n){const i=Mq.unpack(e,t,kq);return Vq.stackPartitions=i._stackPartitions,Vq.slicePartitions=i._slicePartitions,Vq.subdivisions=i._subdivisions,D(n)?(H.clone(i._radii,Vq.radii),n._ellipsoidGeometry=new Mq(Vq),n):(Vq.radius=i._radii.x,new Uq(Vq))},Uq.createGeometry=function(e){return Mq.createGeometry(e._ellipsoidGeometry)},Object.defineProperties(Hq.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}}}),Hq.prototype.distanceToCamera=function(e){L.defined("frameState",e);const t=this._boundingSphere;return Math.max(0,H.distance(t.center,e.camera.positionWC)-t.radius)},Hq.prototype.intersectPlane=function(e){return L.defined("plane",e),$u.intersectPlane(this._boundingSphere,e)},Hq.prototype.update=function(e,t){H.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t},Hq.prototype.createDebugVolume=function(e){L.defined("color",e);return new V_({geometryInstances:new Zd({geometry:new Uq({radius:this.radius}),id:"outline",modelMatrix:ve.fromTranslation(this.center,new ve.clone(ve.IDENTITY)),attributes:{color:$d.fromColor(e)}}),appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1})};const Gq=new H,jq=new H,Wq=new H,qq=new H;function Yq(e,t,n){n=H.cross(e,t,n);const i=H.magnitude(n);return H.multiplyByScalar(n,V.EPSILON7/i,n)}function Xq(e,t){const n=H.normalize(e,qq);return Yq(e,H.equalsEpsilon(n,H.UNIT_X,V.EPSILON6)?H.UNIT_Y:H.UNIT_X,t)}function Qq(e){let t=re.getColumn(e,0,Gq),n=re.getColumn(e,1,jq),i=re.getColumn(e,2,Wq);const o=H.equals(t,H.ZERO),r=H.equals(n,H.ZERO),s=H.equals(i,H.ZERO);return o||r||s?o&&r&&s?(e[0]=V.EPSILON7,e[4]=V.EPSILON7,e[8]=V.EPSILON7,e):(!o||r||s?o||!r||s?o||r||!s?o?r?s||(t=Xq(i,t),n=Yq(i,t,n)):(t=Xq(n,t),i=Yq(n,t,i)):(n=Xq(t,n),i=Yq(n,t,i)):i=Yq(n,t,i):n=Yq(t,i,n):t=Yq(n,i,t),re.setColumn(e,0,t,e),re.setColumn(e,1,n,e),re.setColumn(e,2,i,e),e):e}function $q(e,t){t=Qq(t),this._orientedBoundingBox=new zp(e,t),this._boundingSphere=$u.fromOrientedBoundingBox(this._orientedBoundingBox)}function Kq(e,t,n,i){this._tileset=e,this._header=n;const o=D(n.contents),r=o&&n.contents.length>1||Px(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=D(n.transform)?ve.unpack(n.transform):ve.clone(ve.IDENTITY);const a=D(i)?i.computedTransform:e.modelMatrix,c=ve.multiply(a,this.transform,new ve),l=D(i)?i._initialTransform:ve.IDENTITY;let u,d,h,p;this._initialTransform=ve.multiply(l,this.transform,new ve),this.computedTransform=c,this.metadata=Kj(e,n),this._verticalExaggeration=1,this._verticalExaggerationRelativeHeight=0,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,c),this._boundingVolume2D=void 0,D(s)&&D(s.boundingVolume)&&(u=this.createBoundingVolume(s.boundingVolume,c)),this._contentBoundingVolume=u,this._contentBoundingVolume2D=void 0,D(n.viewerRequestVolume)&&(d=this.createBoundingVolume(n.viewerRequestVolume,c)),this._viewerRequestVolume=d,this.geometricError=n.geometricError,this._geometricError=n.geometricError,D(this._geometricError)||(this._geometricError=D(i)?i._geometricError:e._geometricError,Kq._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale(),D(n.refine)?("replace"!==n.refine&&"add"!==n.refine||Kq._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),h="REPLACE"===n.refine.toUpperCase()?ez.REPLACE:ez.ADD):h=D(i)?i.refine:ez.REPLACE,this.refine=h,this.children=[],this.parent=i;let f,m,_,g=!1;if(t=Bi.createIfNeeded(t),r)f=Uj.UNLOADED,m=t.clone();else if(D(s)){let n=s.uri;D(s.url)&&(Kq._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),n=s.url),""===n?(Kq._deprecationWarning("contentUriEmpty","content.uri property is an empty string, which creates a circular dependency, making this tileset invalid. Omit the content property instead"),p=new qj(e,this),g=!0,f=Uj.READY):(f=Uj.UNLOADED,m=t.getDerivedResource({url:n}),_=Ii.getServerKey(m.getUrlComponent()))}else p=new qj(e,this),g=!0,f=Uj.READY;this._content=p,this._contentResource=m,this._contentState=f,this._expiredContent=void 0,this._serverKey=_,this.hasEmptyContent=g,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.cacheNode=void 0;const y=n.expire;let b,v;D(y)&&(b=y.duration,D(y.date)&&(v=Hn.fromIso8601(y.date))),this.expireDuration=b,this.expireDate=v,this.lastStyleTime=0,this._optimChildrenWithinParent=Hj.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._wasSelectedLastFrame=!1,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._isClippedByPolygon=!1,this._clippingPlanesState=0,this._clippingPolygonsState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=Ot.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new Hn,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Object.defineProperties($q.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}}),$q.prototype.distanceToCamera=function(e){return L.defined("frameState",e),Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))},$q.prototype.intersectPlane=function(e){return L.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)},$q.prototype.update=function(e,t){H.clone(e,this._orientedBoundingBox.center),t=Qq(t),re.clone(t,this._orientedBoundingBox.halfAxes),$u.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)},$q.prototype.createDebugVolume=function(e){L.defined("color",e);return new V_({geometryInstances:new Zd({geometry:new qd({minimum:new H(-1,-1,-1),maximum:new H(1,1,1)}),id:"outline",modelMatrix:ve.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),attributes:{color:$d.fromColor(e)}}),appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1})},Kq._deprecationWarning=Da,Object.defineProperties(Kq.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return M(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},isVisible:{get:function(){return this._visible&&this._inRequestVolume}},extras:{get:function(){return this._header.extras}},color:{get:function(){return D(this._color)||(this._color=new Ot),Ot.clone(this._color)},set:function(e){this._color=Ot.clone(e,this._color),this._colorDirty=!0}},hasRenderableContent:{get:function(){return!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent}},contentAvailable:{get:function(){return this.contentReady&&this.hasRenderableContent||D(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Uj.READY}},contentUnloaded:{get:function(){return this._contentState===Uj.UNLOADED}},hasUnloadedRenderableContent:{get:function(){return this.hasRenderableContent&&this.contentUnloaded}},contentExpired:{get:function(){return this._contentState===Uj.EXPIRED}},contentFailed:{get:function(){return this._contentState===Uj.FAILED}},commandsLength:{get:function(){return this._commandsLength}}});const Zq=new H;const Jq=new Hn;function eY(e){return function(){return e._priority}}Kq.prototype.getScreenSpaceError=function(e,t,n){const i=this._tileset,o=M(n,1),r=D(this.parent)?this.parent.geometricError:i._scaledGeometricError,s=t?r:this.geometricError;if(0===s)return 0;const{camera:a,context:c}=e;let l=a.frustum;const u=c.drawingBufferWidth,d=c.drawingBufferHeight*o;let h;if(e.mode===gl.SCENE2D||l instanceof Xc){const e=l.offCenterFrustum;D(e)&&(l=e);h=s/(Math.max(l.top-l.bottom,l.right-l.left)/Math.max(u,d))}else{const e=Math.max(this._distanceToCamera,V.EPSILON7);if(h=s*d/(e*l.sseDenominator),i.dynamicScreenSpaceError){const t=i._dynamicScreenSpaceErrorComputedDensity,n=i.dynamicScreenSpaceErrorFactor;h-=V.fog(e,t)*n}}return h/=e.pixelRatio,h},Kq.prototype.updateVisibility=function(e){const{parent:t,tileset:n}=this;if(this._updatedVisibilityFrame===n._updatedVisibilityFrame)return;const i=D(t)?t.computedTransform:n.modelMatrix,o=D(t)?t._visibilityPlaneMask:Bc.MASK_INDETERMINATE;this.updateTransform(i,e),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,n.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,o),this._visible=this._visibilityPlaneMask!==Bc.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=function(e,t){const n=t.parent,i=D(n)&&(!e.isSkippingLevelOfDetail||0===t._screenSpaceError||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-i}(n,this),this._priorityProgressiveResolution=function(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;const n=e.memoryAdjustedScreenSpaceError;let i=t._screenSpaceErrorProgressiveResolution>n;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const o=t.parent,r=t._screenSpaceErrorProgressiveResolution<=n,s=D(o)&&o._screenSpaceErrorProgressiveResolution>n;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,i=!0),i}(n,this),this.priorityDeferred=function(e,t){const{tileset:n,boundingSphere:i}=e,{radius:o,center:r}=i,{camera:s}=t,a=H.multiplyByScalar(s.directionWC,e._centerZDepth,Zq),c=H.add(s.positionWC,a,Zq),l=H.subtract(c,r,Zq);if(H.magnitude(l)>o){const t=H.normalize(l,Zq),n=H.multiplyByScalar(t,o,Zq),i=H.add(r,n,Zq),a=H.subtract(i,s.positionWC,Zq),c=H.normalize(a,Zq);e._foveatedFactor=1-Math.abs(H.dot(s.directionWC,c))}else e._foveatedFactor=0;const u=e.refine===ez.REPLACE,d=n.isSkippingLevelOfDetail;if(u&&!d||!n.foveatedScreenSpaceError||1===n.foveatedConeSize||e._priorityProgressiveResolution&&u&&d||n._pass===Wj.PRELOAD_FLIGHT||n._pass===Wj.PRELOAD)return!1;const h=1-Math.cos(.5*s.frustum.fov),p=n.foveatedConeSize*h;if(e._foveatedFactor<=p)return!1;const f=h-p,m=V.clamp((e._foveatedFactor-p)/f,0,1),_=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.memoryAdjustedScreenSpaceError,m),g=0===e._screenSpaceError&&D(e.parent)?.5*e.parent._screenSpaceError:e._screenSpaceError;return n.memoryAdjustedScreenSpaceError-_<=g}(this,e),this._updatedVisibilityFrame=n._updatedVisibilityFrame},Kq.prototype.updateExpiration=function(){if(D(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=Hn.now(Jq);Hn.lessThan(this.expireDate,e)&&(this._contentState=Uj.EXPIRED,this._expiredContent=this._content)}},Kq.prototype.requestContent=function(){if(!this.hasEmptyContent)return this.hasMultipleContents?function(e){let t=e._content;const n=e._tileset;if(!D(t)){const i=Px(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new Jj(n,e,e._contentResource.clone(),i),e._content=t}const i=t.requestInnerContents();if(!D(i))return;return e._contentState=Uj.LOADING,i.then((n=>{if(!e.isDestroyed()&&D(n))return e._contentState=Uj.PROCESSING,t})).catch((t=>{if(!e.isDestroyed())throw e._contentState=Uj.FAILED,t}))}(this):function(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new mi({throttle:!0,throttleByServer:!0,type:fi.TILES3D,priorityFunction:eY(e),serverKey:e._serverKey});e._request=i,t.request=i;const o=e._tileset,r=t.fetchArrayBuffer();if(!D(r))return void++o.statistics.numberOfAttemptedRequests;return async function(e,t,n,i,o){const r=e._contentState;let s;e._contentState=Uj.LOADING,++t.statistics.numberOfPendingRequests;try{s=await o}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;if(n.cancelled||n.state===pi.CANCELLED)return e._contentState=r,void++t.statistics.numberOfAttemptedRequests;throw e._contentState=Uj.FAILED,a}if(e.isDestroyed())return void--t.statistics.numberOfPendingRequests;if(n.cancelled||n.state===pi.CANCELLED)return e._contentState=r,--t.statistics.numberOfPendingRequests,void++t.statistics.numberOfAttemptedRequests;try{const n=await async function(e,t){const n=Zj(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===Vj.GEOMETRY||n.contentType===Vj.VECTOR,(n.contentType===Vj.IMPLICIT_SUBTREE||n.contentType===Vj.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0);n.contentType===Vj.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o;const r=zj[n.contentType];if(e.isDestroyed())return;o=D(n.binaryPayload)?await Promise.resolve(r(i,e,e._contentResource,n.binaryPayload.buffer,0)):await Promise.resolve(r(i,e,e._contentResource,n.jsonPayload));const s=e._contentHeader;if(e.hasImplicitContentMetadata){const t=e.implicitSubtree,n=e.implicitCoordinates;o.metadata=t.getContentMetadataView(n,0)}else e.hasImplicitContent||(o.metadata=Xj(i,s));const a=Qj(i,s);D(a)&&(o.group=new yw({metadata:a}));return o}(e,s);if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;return i&&(e.expireDate=void 0),e._content=n,e._contentState=Uj.PROCESSING,n}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;throw e._contentState=Uj.FAILED,a}}(e,o,i,n,r)}(this)},Kq.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()},Kq.prototype.unloadContent=function(){this.hasRenderableContent&&(this._content=this._content&&this._content.destroy(),this._contentState=Uj.UNLOADED,this.lastStyleTime=0,this.clippingPlanesDirty=0===this._clippingPlanesState,this._clippingPlanesState=0,this.clippingPolygonsDirty=0===this._clippingPolygonsState,this._clippingPolygonsState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};const tY=new $u;function nY(e,t){if(t.mode!==gl.SCENE3D&&!D(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=$u.projectTo2D(n,t.mapProjection,tY);e._boundingVolume2D=new Hq(i.center,i.radius)}return t.mode!==gl.SCENE3D?e._boundingVolume2D:e._boundingVolume}Kq.prototype.visibility=function(e,t){const n=e.cullingVolume,i=nY(this,e),o=this._tileset,r=o.clippingPlanes;if(D(r)&&r.enabled){const e=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=e!==mn.INSIDE,e===mn.OUTSIDE)return Bc.MASK_OUTSIDE}const s=o.clippingPolygons;if(D(s)&&s.enabled){const e=s.computeIntersectionWithBoundingVolume(i);this._isClippedByPolygon=e!==mn.OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)},Kq.prototype.contentVisibility=function(e){if(!D(this._contentBoundingVolume))return mn.INSIDE;if(this._visibilityPlaneMask===Bc.MASK_INSIDE)return mn.INSIDE;const t=e.cullingVolume,n=function(e,t){if(t.mode!==gl.SCENE3D&&!D(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=$u.projectTo2D(n,t.mapProjection,tY);e._contentBoundingVolume2D=new Hq(i.center,i.radius)}return t.mode!==gl.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}(this,e),i=this._tileset,o=i.clippingPlanes;if(D(o)&&o.enabled){const e=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=e!==mn.INSIDE,e===mn.OUTSIDE)return mn.OUTSIDE}const r=i.clippingPolygons;if(D(r)&&r.enabled){const e=r.computeIntersectionWithBoundingVolume(n);if(this._isClippedByPolygon=e!==mn.OUTSIDE,e===mn.INSIDE)return mn.OUTSIDE}return t.computeVisibility(n)},Kq.prototype.distanceToTile=function(e){return nY(this,e).distanceToCamera(e)};const iY=new H;Kq.prototype.distanceToTileCenter=function(e){const t=nY(this,e).boundingVolume,n=H.subtract(t.center,e.camera.positionWC,iY);return H.dot(e.camera.directionWC,n)},Kq.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!D(t)||0===t.distanceToCamera(e)};const oY=new re,rY=new H,sY=new re,aY=new H,cY=new Ir,lY=new zp,uY=new ve;function dY(e,t,n,i){if(!ve.equalsEpsilon(t,n,V.EPSILON8))return function(e,t,n,i){const o=Ir.unpack(e,0,cY),r=e[4],s=e[5],a=zp.fromRectangle(o,r,s,on.WGS84,lY);let c=a.center,l=a.halfAxes;t=ve.multiplyTransformation(t,ve.inverseTransformation(n,uY),uY),c=ve.multiplyByPoint(t,c,c);const u=ve.getMatrix3(t,oY);return l=re.multiply(u,l,l),D(i)&&i instanceof $q?(i.update(c,l),i):new $q(c,l)}(e,t,n,i);const o=Ir.unpack(e,0,cY);return D(i)?(i.rectangle=Ir.clone(o,i.rectangle),i.minimumHeight=e[4],i.maximumHeight=e[5],i.computeBoundingVolumes(on.WGS84),i):new xW({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}Kq.prototype.createBoundingVolume=function(e,t,n){const i=this.metadata;let o;if(D(i)&&(o=xI.parseBoundingVolumeSemantic("TILE",i)),D(o)&&(e=o),!D(e))throw new be("boundingVolume must be defined");if(Px(e,"3DTILES_bounding_volume_S2"))return new JW(e.extensions["3DTILES_bounding_volume_S2"]);const{box:r,region:s,sphere:a}=e;if(D(r)){const e=function(e,t,n){let i=H.fromElements(e[0],e[1],e[2],aY),o=re.fromArray(e,3,sY);i=ve.multiplyByPoint(t,i,i);const r=ve.getMatrix3(t,oY);return o=re.multiply(r,o,o),D(n)?(n.update(i,o),n):new $q(i,o)}(r,t,n);return 1!==this._verticalExaggeration&&pY(e,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),e}if(D(s)){const e=dY(s,t,this._initialTransform,n);return 1===this._verticalExaggeration||(e instanceof $q?pY(e,this._verticalExaggeration,this._verticalExaggerationRelativeHeight):(e.minimumHeight=zf.getHeight(e.minimumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),e.maximumHeight=zf.getHeight(e.maximumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),e.computeBoundingVolumes(on.WGS84))),e}if(D(a)){const e=function(e,t,n){let i=H.fromElements(e[0],e[1],e[2],aY),o=e[3];i=ve.multiplyByPoint(t,i,i);const r=ve.getScale(t,rY);return o*=H.maximumComponent(r),D(n)?(n.update(i,o),n):new Hq(i,o)}(a,t,n);if(1!==this._verticalExaggeration){const t=zf.getPosition(e.center,on.WGS84,this._verticalExaggeration,this._verticalExaggerationRelativeHeight,aY),n=e.radius*this._verticalExaggeration;e.update(t,n)}return e}throw new be("boundingVolume must contain a sphere, region, or box")};const hY=H.unpackArray(new Array(24).fill(0));function pY(e,t,n){const i=e.boundingVolume.computeCorners(hY).map((e=>zf.getPosition(e,on.WGS84,t,n,e))),o=zp.fromPoints(i,lY);e.update(o.center,o.halfAxes)}Kq.prototype.updateTransform=function(e,t){e=M(e,ve.IDENTITY);const n=ve.multiplyTransformation(e,this.transform,uY),i=!ve.equals(n,this.computedTransform),o=D(t)&&(this._verticalExaggeration!==t.verticalExaggeration||this._verticalExaggerationRelativeHeight!==t.verticalExaggerationRelativeHeight);if(!i&&!o)return;i&&ve.clone(n,this.computedTransform),o&&(this._verticalExaggeration=t.verticalExaggeration,this._verticalExaggerationRelativeHeight=t.verticalExaggerationRelativeHeight);const r=this._header,s=this._contentHeader;this._boundingVolume=this.createBoundingVolume(r.boundingVolume,this.computedTransform,this._boundingVolume),D(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(s.boundingVolume,this.computedTransform,this._contentBoundingVolume)),D(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(r.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()},Kq.prototype.updateGeometricErrorScale=function(){const e=ve.getScale(this.computedTransform,rY),t=H.maximumComponent(e);if(this.geometricError=this._geometricError*t,!D(this.parent)){const e=this._tileset;e._scaledGeometricError=e._geometricError*t}},Kq.prototype.update=function(e,t,n){const{commandList:i}=t,o=i.length;!function(e,t){const n=t.clippingPlanes;let i=0;D(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}(this,e),function(e,t){const n=t.clippingPolygons;let i=0;D(n)&&e._isClippedByPolygon&&n.enabled&&(i=n.clippingPolygonsState),i!==e._clippingPolygonsState&&(e._clippingPolygonsState=i,e.clippingPolygonsDirty=!0)}(this,e),function(e,t,n,i){if(!i.isRender)return;const o=D(e._contentHeader)&&D(e._contentHeader.boundingVolume),r=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(r){let t;t=e._finalResolution?e.hasRenderableContent?Ot.WHITE:Ot.DARKGRAY:Ot.YELLOW,D(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(t)),e._debugBoundingVolume.update(n);const i=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");i.color=$d.toValue(t,i.color)}else!r&&D(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(D(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(Ot.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&D(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&D(e._viewerRequestVolume)?(D(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(Ot.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&D(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const s=t.debugColorizeTiles&&!e._debugColorizeTiles||D(t._heatmap.tilePropertyName),a=!t.debugColorizeTiles&&e._debugColorizeTiles;s?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):a&&(e._debugColorizeTiles=!1,e.color=Ot.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),a&&t.makeStyleDirty()}(this,e,t,n),function(e,t,n){const i=e._expiredContent;if(!e.hasMultipleContents&&D(i)){if(!e.contentReady){try{i.update(t,n)}catch(o){}return}e._expiredContent.destroy(),e._expiredContent=void 0}if(D(e.content))try{e.content.update(t,n)}catch(o){throw e._contentState=Uj.FAILED,o}}(this,e,t);const r=i.length;this._commandsLength=r-o;for(let s=o;s<r;++s){const e=i[s],t=e.pass===zt.TRANSLUCENT;e.depthForTranslucentClassification=t}this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!1};const fY=[];function mY(e,t,n){const i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function _Y(e,t,n){return Math.max(V.normalize(e,t,n)-V.EPSILON7,0)}function gY(e){const t=(e=M(e,M.EMPTY_OBJECT)).id,n=e.group,i=e.class;L.typeOf.object("options.group",n),L.typeOf.object("options.class",i);const o=D(n.properties)?n.properties:{};this._class=i,this._properties=o,this._id=t,this._extras=n.extras,this._extensions=n.extensions}function yY(e){const t=(e=M(e,M.EMPTY_OBJECT)).tileset,n=e.class;L.typeOf.object("options.tileset",t),L.typeOf.object("options.class",n);const i=D(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}function bY(e){const t=(e=M(e,M.EMPTY_OBJECT)).metadataJson,n=e.schema;L.typeOf.object("options.metadataJson",t),L.typeOf.object("options.schema",n);const i=M(t.metadata,t.tileset);let o;D(i)&&(o=new yY({tileset:i,class:n.classes[i.class]}));let r=[];const s=[],a=t.groups;if(Array.isArray(a)){const e=a.length;for(let t=0;t<e;t++){const e=a[t];s.push(new gY({group:e,class:n.classes[e.class]}))}}else if(D(a)){r=Object.keys(a).sort();const e=r.length;for(let t=0;t<e;t++){const e=r[t];if(a.hasOwnProperty(e)){const t=a[e];s.push(new gY({id:e,group:a[e],class:n.classes[t.class]}))}}}this._schema=n,this._groups=s,this._groupIds=r,this._tileset=o,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Kq.prototype.process=function(e,t){this.contentExpired||this.contentReady||!this._content.ready||(!function(e){if(!D(e.expireDuration))return;const t=Hn.now(Jq);Hn.addSeconds(t,e.expireDuration,t),D(e.expireDate)?Hn.lessThan(e.expireDate,t)&&Hn.clone(t,e.expireDate):e.expireDate=Hn.clone(t)}(this),this._selectedFrame=0,this.lastStyleTime=0,Hn.now(this._loadTimestamp),this._contentState=Uj.READY,this.hasTilesetContent||this.hasImplicitContent||(e._statistics.incrementLoadCounts(this.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(this)));const n=t.commandList;t.commandList=fY;try{this._content.update(e,t)}catch(i){throw this._contentState=Uj.FAILED,i}fY.length=0,t.commandList=n},Kq.prototype.updatePriority=function(){const e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,o=Math.pow(10,8),r=Math.pow(10,9),s=Math.pow(10,10);let a=_Y(this._depth,n.depth,i.depth);a=t?1-a:a;const c=mY(!e.isSkippingLevelOfDetail&&this.refine===ez.REPLACE?_Y(this._priorityHolder._distanceToCamera,n.distance,i.distance):_Y(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),4,0),l=this._priorityProgressiveResolution?0:o,u=mY(_Y(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),4,4),d=this.priorityDeferred?r:0,h=e._pass===Wj.PRELOAD_FLIGHT?0:s;this._priority=a+c+l+u+d+h},Kq.prototype.isDestroyed=function(){return!1},Kq.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(),He(this)},Object.defineProperties(gY.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),gY.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,this._class)},gY.prototype.hasPropertyBySemantic=function(e){return Fx.hasPropertyBySemantic(e,this._properties,this._class)},gY.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,this._class,e)},gY.prototype.getProperty=function(e){return Fx.getProperty(e,this._properties,this._class)},gY.prototype.setProperty=function(e,t){return Fx.setProperty(e,t,this._properties,this._class)},gY.prototype.getPropertyBySemantic=function(e){return Fx.getPropertyBySemantic(e,this._properties,this._class)},gY.prototype.setPropertyBySemantic=function(e,t){return Fx.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(yY.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}}),yY.prototype.hasProperty=function(e){return Fx.hasProperty(e,this._properties,this._class)},yY.prototype.hasPropertyBySemantic=function(e){return Fx.hasPropertyBySemantic(e,this._properties,this._class)},yY.prototype.getPropertyIds=function(e){return Fx.getPropertyIds(this._properties,this._class,e)},yY.prototype.getProperty=function(e){return Fx.getProperty(e,this._properties,this._class)},yY.prototype.setProperty=function(e,t){return Fx.setProperty(e,t,this._properties,this._class)},yY.prototype.getPropertyBySemantic=function(e){return Fx.getPropertyBySemantic(e,this._properties,this._class)},yY.prototype.setPropertyBySemantic=function(e,t){return Fx.setPropertyBySemantic(e,t,this._properties,this._class)},Object.defineProperties(bY.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},groupIds:{get:function(){return this._groupIds}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});const vY={},AY=new H;vY.checkChildrenWithinParent=function(e){L.typeOf.object("tile",e);const t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof $q||i instanceof xW){const o=i._orientedBoundingBox;e._optimChildrenWithinParent=Hj.USE_OPTIMIZATION;for(let i=0;i<n;++i){const n=t[i].boundingVolume;if(!(n instanceof $q||n instanceof xW)){e._optimChildrenWithinParent=Hj.SKIP_OPTIMIZATION;break}const r=n._orientedBoundingBox,s=H.subtract(r.center,o.center,AY),a=H.magnitude(s);H.divideByScalar(s,a,s);if(Math.abs(o.halfAxes[0]*s.x)+Math.abs(o.halfAxes[1]*s.y)+Math.abs(o.halfAxes[2]*s.z)+Math.abs(o.halfAxes[3]*s.x)+Math.abs(o.halfAxes[4]*s.y)+Math.abs(o.halfAxes[5]*s.z)+Math.abs(o.halfAxes[6]*s.x)+Math.abs(o.halfAxes[7]*s.y)+Math.abs(o.halfAxes[8]*s.z)<=Math.abs(r.halfAxes[0]*s.x)+Math.abs(r.halfAxes[1]*s.y)+Math.abs(r.halfAxes[2]*s.z)+Math.abs(r.halfAxes[3]*s.x)+Math.abs(r.halfAxes[4]*s.y)+Math.abs(r.halfAxes[5]*s.z)+Math.abs(r.halfAxes[6]*s.x)+Math.abs(r.halfAxes[7]*s.y)+Math.abs(r.halfAxes[8]*s.z)+a){e._optimChildrenWithinParent=Hj.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Hj.USE_OPTIMIZATION};const TY=vY;function wY(){this.head=void 0,this.tail=void 0,this._length=0}function EY(e,t,n){this.item=e,this.previous=t,this.next=n}function xY(e,t){D(t.previous)&&D(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):D(t.previous)?(t.previous.next=void 0,e.tail=t.previous):D(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}function SY(){this._list=new wY,this._sentinel=this._list.add(),this._trimTiles=!1}function CY(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 IY(e,t){let n;return n="_loadTimestamp"===t?Hn.toDate(e).getTime():e,n}Object.defineProperties(wY.prototype,{length:{get:function(){return this._length}}}),wY.prototype.add=function(e){const t=new EY(e,this.tail,void 0);return D(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t},wY.prototype.remove=function(e){D(e)&&(xY(this,e),--this._length)},wY.prototype.splice=function(e,t){if(e===t)return;xY(this,t);const n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e},SY.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)},SY.prototype.touch=function(e){const t=e.cacheNode;D(t)&&this._list.splice(this._sentinel,t)},SY.prototype.add=function(e){D(e.cacheNode)||(e.cacheNode=this._list.add(e))},SY.prototype.unloadTile=function(e,t,n){const i=t.cacheNode;D(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))},SY.prototype.unloadTiles=function(e,t){const n=this._trimTiles;this._trimTiles=!1;const i=this._list,o=this._sentinel;let r=i.head;for(;r!==o&&(e.totalMemoryUsageInBytes>e.cacheBytes||n);){const n=r.item;r=r.next,this.unloadTile(e,n,t)}},SY.prototype.trim=function(){this._trimTiles=!0},CY.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=IY(e,n),this._referenceMaximum[n]=IY(t,n)};const OY=[new Ot(.1,.1,.1,1),new Ot(.153,.278,.878,1),new Ot(.827,.231,.49,1),new Ot(.827,.188,.22,1),new Ot(1,.592,.259,1),new Ot(1,.843,0,1)];function DY(){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 PY(e,t,n,i){const o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,c=t.geometryByteLength,l=t.texturesByteLength,u=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-c:c,e.texturesByteLength+=n?-l:l,e.batchTableByteLength+=n?-u:u):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),D(o)){const t=o.length;for(let r=0;r<t;++r)PY(e,o[r],n,i)}}function NY(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}function RY(e,t,n){const i=Px(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;L.typeOf.object("implicitTiling",i),this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n;const o=t.boundingVolume;if(!(D(o.box)||D(o.region)||Px(o,"3DTILES_bounding_volume_S2")||Px(o,"3DTILES_bounding_volume_cylinder")))throw new be("Only box, region, 3DTILES_bounding_volume_S2, and 3DTILES_bounding_volume_cylinder are supported for implicit tiling");this.boundingVolume=o,this.refine=t.refine,this.subtreeUriTemplate=new Bi({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const r=function(e){if(Px(e,"3DTILES_multiple_contents")){const t=e.extensions["3DTILES_multiple_contents"];return D(t.contents)?t.contents:t.content}if(D(e.contents))return e.contents;if(D(e.content))return[e.content];return[]}(t);for(let s=0;s<r.length;s++){const e=r[s];this.contentHeaders.push(ti(e,!0));const t=new Bi({url:e.uri});this.contentUriTemplates.push(t)}this.contentCount=this.contentHeaders.length,this.tileHeader=function(e){const t=ti(e,!0);D(t.extensions)&&(delete t.extensions["3DTILES_implicit_tiling"],delete t.extensions["3DTILES_multiple_contents"],0===Object.keys(t.extensions).length&&delete t.extensions);return delete t.implicitTiling,delete t.contents,delete t.content,t}(t),this.subdivisionScheme=Mx[i.subdivisionScheme],this.branchingFactor=Mx.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,D(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}CY.prototype.colorize=function(e,t){if(!D(this.tilePropertyName)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const n=function(e,t){const n=e.tilePropertyName;if(D(n)){const i=IY(t[n],n);return D(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}(this,e),i=this._previousMinimum,o=this._previousMaximum;if(i===Number.MAX_VALUE||o===-Number.MAX_VALUE)return;const r=o-i+V.EPSILON7,s=V.clamp(n-i,0,r)/r*(OY.length-1),a=Math.floor(s),c=Math.ceil(s),l=s-a,u=OY[a],d=OY[c],h=Ot.clone(Ot.WHITE);h.red=V.lerp(u.red,d.red,l),h.green=V.lerp(u.green,d.green,l),h.blue=V.lerp(u.blue,d.blue,l),e._debugColor=h},CY.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(D(e)){const t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=D(t)&&D(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}},DY.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},DY.prototype.incrementSelectionCounts=function(e){PY(this,e,!1,!1)},DY.prototype.incrementLoadCounts=function(e){PY(this,e,!1,!0)},DY.prototype.decrementLoadCounts=function(e){PY(this,e,!0,!0)},DY.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},Object.defineProperties(NY.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}}),NY.prototype.makeDirty=function(){this._styleDirty=!0},NY.prototype.resetDirty=function(){this._styleDirty=!1},NY.prototype.applyStyle=function(e){if(!D(e.root))return;if(D(this._style)&&!this._style._ready)return;const t=this._styleDirty;t&&++this._lastStyleTime;const n=this._lastStyleTime,i=e._statistics,o=t?e._selectedTiles:e._selectedTilesToStyle,r=o.length;for(let s=0;s<r;++s){const e=o[s];if(e.lastStyleTime!==n){const t=e.content;e.lastStyleTime=n,t.applyStyle(this._style),i.numberOfFeaturesStyled+=t.featuresLength,++i.numberOfTilesStyled}}};const LY={};function MY(e){return e=1431655765&((e=858993459&((e=252645135&((e=16711935&(e^e<<8))^e<<4))^e<<2))^e<<1)}function FY(e){return e=153391689&((e=51130563&((e=50393103&((e=50331903&(e^e<<16))^e<<8))^e<<4))^e<<2)}function BY(e){return e=65535&((e=16711935&((e=252645135&((e=858993459&((e&=1431655765)^e>>1))^e>>2))^e>>4))^e>>8)}function zY(e){return e=1023&((e=4278190335&((e=50393103&((e=51130563&((e&=153391689)^e>>2))^e>>4))^e>>8))^e>>16)}LY.encode2D=function(e,t){if(L.typeOf.number("x",e),L.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new P("inputs must be 16-bit unsigned integers");return(MY(e)|MY(t)<<1)>>>0},LY.decode2D=function(e,t){if(L.typeOf.number("mortonIndex",e),e<0||e>4294967295)throw new P("input must be a 32-bit unsigned integer");return D(t)||(t=new Array(2)),t[0]=BY(e),t[1]=BY(e>>1),t},LY.encode3D=function(e,t,n){if(L.typeOf.number("x",e),L.typeOf.number("y",t),L.typeOf.number("z",n),e<0||e>1023||t<0||t>1023||n<0||n>1023)throw new P("inputs must be 10-bit unsigned integers");return FY(e)|FY(t)<<1|FY(n)<<2},LY.decode3D=function(e,t){if(L.typeOf.number("mortonIndex",e),e<0||e>1073741823)throw new P("input must be a 30-bit unsigned integer");return D(t)||(t=new Array(3)),t[0]=zY(e),t[1]=zY(e>>1),t[2]=zY(e>>2),t};const UY=LY;function kY(e){if(L.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),L.typeOf.number("options.subtreeLevels",e.subtreeLevels),L.typeOf.number("options.level",e.level),L.typeOf.number("options.x",e.x),L.typeOf.number("options.y",e.y),e.subdivisionScheme===Mx.OCTREE&&L.typeOf.number("options.z",e.z),e.level<0)throw new P("level must be non-negative");if(e.x<0)throw new P("x must be non-negative");if(e.y<0)throw new P("y must be non-negative");if(e.subdivisionScheme===Mx.OCTREE&&e.z<0)throw new P("z must be non-negative");const t=1<<e.level;if(e.x>=t)throw new P("x is out of range");if(e.y>=t)throw new P("y is out of range");if(e.subdivisionScheme===Mx.OCTREE&&e.z>=t)throw new P("z is out of range");this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===Mx.OCTREE&&(this.z=e.z)}function VY(e,t){if(e.subdivisionScheme!==t.subdivisionScheme)throw new P("coordinates must have same subdivisionScheme");if(e.subtreeLevels!==t.subtreeLevels)throw new P("coordinates must have same subtreeLevels")}Object.defineProperties(kY.prototype,{childIndex:{get:function(){let e=0;return e|=1&this.x,e|=(1&this.y)<<1,this.subdivisionScheme===Mx.OCTREE&&(e|=(1&this.z)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===Mx.OCTREE?UY.encode3D(this.x,this.y,this.z):UY.encode2D(this.x,this.y)}},tileIndex:{get:function(){return(this.subdivisionScheme===Mx.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3)+this.mortonIndex}}}),kY.prototype.getDescendantCoordinates=function(e){L.typeOf.object("offsetCoordinates",e),VY(this,e);const t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===Mx.OCTREE){const o=(this.z<<e.level)+e.z;return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})},kY.prototype.getAncestorCoordinates=function(e){if(L.typeOf.number("offsetLevels",e),e<0)throw new P("offsetLevels must be non-negative");if(e>this.level)throw new P("ancestor cannot be above the tileset root");const t=1<<e,n=this.level-e,i=Math.floor(this.x/t),o=Math.floor(this.y/t);if(this.subdivisionScheme===Mx.OCTREE){const e=Math.floor(this.z/t);return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:e})}return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})},kY.prototype.getOffsetCoordinates=function(e){if(L.typeOf.object("descendantCoordinates",e),!this.isEqual(e)&&!this.isAncestor(e))throw new P("this is not an ancestor of descendant");VY(this,e);const t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===Mx.OCTREE){const r=e.z%n;return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o,z:r})}return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o})},kY.prototype.getChildCoordinates=function(e){L.typeOf.number("childIndex",e);const t=Mx.getBranchingFactor(this.subdivisionScheme);if(e<0||t<=e)throw new P(`childIndex must be at least 0 and less than ${t}`);const n=this.level+1,i=2*this.x+e%2,o=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===Mx.OCTREE){const t=2*this.z+Math.floor(e/4)%2;return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:t})}return new kY({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})},kY.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)},kY.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)},kY.prototype.isAncestor=function(e){L.typeOf.object("descendantCoordinates",e),VY(this,e);const t=e.level-this.level;if(t<=0)return!1;const n=e.x>>t,i=e.y>>t,o=this.x===n,r=this.y===i;if(this.subdivisionScheme===Mx.OCTREE){const n=e.z>>t,i=this.z===n;return o&&r&&i}return o&&r},kY.prototype.isEqual=function(e){return L.typeOf.object("otherCoordinates",e),this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme!==Mx.OCTREE||this.z===e.z)},kY.prototype.isImplicitTilesetRoot=function(){return 0===this.level},kY.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels==0},kY.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels==this.subtreeLevels-1},kY.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===Mx.OCTREE&&(e.z=this.z),e};const HY=[0,0,0];function GY(){}function jY(e,t){if(e.updateVisibility(t),!e.isVisible)return;const n=e.children.length>0;if((e.hasTilesetContent||e.hasImplicitContent)&&n){const n=e.children[0];return jY(n,t),void(e._visible=n._visible)}if(function(e,t){const{parent:n,tileset:i}=e;if(!D(n)||n.hasTilesetContent||n.hasImplicitContent||n.refine!==ez.ADD)return!1;return e.getScreenSpaceError(t,!0)<=i.memoryAdjustedScreenSpaceError}(e,t))return void(e._visible=!1);const i=e.refine===ez.REPLACE,o=e._optimChildrenWithinParent===Hj.USE_OPTIMIZATION;return i&&o&&n&&!function(e,t){let n=!1;const i=e.children;for(let o=0;o<i.length;++o){const e=i[o];e.updateVisibility(t),n=n||e.isVisible}return n}(e,t)?(++e.tileset._statistics.numberOfTilesCulledWithChildrenUnion,void(e._visible=!1)):void 0}function WY(){}kY.fromMortonIndex=function(e,t,n,i){let o;return e===Mx.OCTREE?(o=UY.decode3D(i,HY),new kY({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=UY.decode2D(i,HY),new kY({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))},kY.fromTileIndex=function(e,t,n){let i,o,r;return e===Mx.OCTREE?(i=Math.floor(V.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(V.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),kY.fromMortonIndex(e,t,i,r)},GY.selectTiles=function(e,t){P.throwInstantiationError()},GY.sortChildrenByDistanceToCamera=function(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera},GY.canTraverse=function(e){return 0!==e.children.length&&(e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:e._screenSpaceError>e.tileset.memoryAdjustedScreenSpaceError)},GY.selectTile=function(e,t){if(e.contentVisibility(t)===mn.OUTSIDE)return;e._wasSelectedLastFrame=!0;const{content:n,tileset:i}=e;n.featurePropertiesDirty?(n.featurePropertiesDirty=!1,e.lastStyleTime=0,i._selectedTilesToStyle.push(e)):e._selectedFrame<t.frameNumber-1&&(i._selectedTilesToStyle.push(e),e._wasSelectedLastFrame=!1),e._selectedFrame=t.frameNumber,i._selectedTiles.push(e)},GY.visitTile=function(e,t){++e.tileset._statistics.visited,e._visitedFrame=t.frameNumber},GY.touchTile=function(e,t){e._touchedFrame!==t.frameNumber&&(e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber)},GY.loadTile=function(e,t){const{tileset:n}=e;if(e._requestedFrame===t.frameNumber||!e.hasUnloadedRenderableContent&&!e.contentExpired)return;if(!function(e,t){const{tileset:n}=e;if(!n._cullRequestsWhileMoving)return!0;const{positionWCDeltaMagnitude:i,positionWCDeltaMagnitudeLastFrame:o}=t.camera,r=0!==i?i:o,s=Math.max(2*e.boundingSphere.radius,1),a=n.cullRequestsWhileMovingMultiplier*r/s;return a<1}(e,t))return;const i=t.camera.timeSinceMoved<n.foveatedTimeDelay;e.priorityDeferred&&i||(e._requestedFrame=t.frameNumber,n._requestedTiles.push(e))},GY.updateTile=function(e,t){jY(e,t),e.updateExpiration(),e._wasMinPriorityChild=!1,e._priorityHolder=e,function(e){const t=e.tileset._minimumPriority,n=e.tileset._maximumPriority,i=e._priorityHolder;n.distance=Math.max(i._distanceToCamera,n.distance),t.distance=Math.min(i._distanceToCamera,t.distance),n.depth=Math.max(e._depth,n.depth),t.depth=Math.min(e._depth,t.depth),n.foveatedFactor=Math.max(i._foveatedFactor,n.foveatedFactor),t.foveatedFactor=Math.min(i._foveatedFactor,t.foveatedFactor),n.reverseScreenSpaceError=Math.max(e._priorityReverseScreenSpaceError,n.reverseScreenSpaceError),t.reverseScreenSpaceError=Math.min(e._priorityReverseScreenSpaceError,t.reverseScreenSpaceError)}(e),e._shouldSelect=!1,e._finalResolution=!0};const qY={stack:new mw,stackMaximumLength:0};function YY(e){return 0!==e.children.length&&(e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:(e.hasEmptyContent,!0))}function XY(e,t,n){const{children:i}=e;for(let o=0;o<i.length;++o){const e=i[o];e.updateVisibility(n),e.isVisible&&t.push(e)}}function QY(e,t){(t.hasUnloadedRenderableContent||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function $Y(e,t){e.contentAvailable&&e.contentVisibility(t)!==mn.OUTSIDE&&e.tileset._selectedTiles.push(e)}function KY(){}WY.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e.hasMixedContent=!1;let n=!0;const i=e.root;if(i.updateVisibility(t),!i.isVisible)return n;const{touchTile:o,visitTile:r}=GY,s=qY.stack;for(s.push(i);s.length>0;){qY.stackMaximumLength=Math.max(qY.stackMaximumLength,s.length);const i=s.pop(),a=i.refine===ez.ADD,c=i.refine===ez.REPLACE,l=YY(i);l&&XY(i,s,t),(a||c&&!l)&&(QY(e,i),o(i,t),$Y(i,t),i.hasRenderableContent&&!i.contentAvailable&&(n=!1)),r(i,t)}return qY.stack.trim(qY.stackMaximumLength),n};const ZY={stack:new mw,stackMaximumLength:0},JY={stack:new mw,stackMaximumLength:0};function eX(e,t){e.contentAvailable&&GY.selectTile(e,t)}function tX(e,t,n){const i=e.refine===ez.REPLACE,{tileset:o,children:r}=e,{updateTile:s,loadTile:a,touchTile:c}=GY;for(let f=0;f<r.length;++f)s(r[f],n);r.sort(GY.sortChildrenByDistanceToCamera);const l=i&&e.hasRenderableContent;let u=!0,d=!1,h=-1,p=Number.MAX_VALUE;for(let f=0;f<r.length;++f){const e=r[f];if(e.isVisible?(t.push(e),e._foveatedFactor<p&&(h=f,p=e._foveatedFactor),d=!0):(l||o.loadSiblings)&&(e._foveatedFactor<p&&(h=f,p=e._foveatedFactor),a(e,n),c(e,n)),l){let t;t=!!e._inRequestVolume&&(e.hasRenderableContent?e.contentAvailable:nX(e,n)),u=u&&t}}if(d||(u=!1),-1!==h&&i){const t=r[h];t._wasMinPriorityChild=!0;const n=(e._wasMinPriorityChild||e===o.root)&&p<=e._priorityHolder._foveatedFactor?e._priorityHolder:e;n._foveatedFactor=Math.min(t._foveatedFactor,n._foveatedFactor),n._distanceToCamera=Math.min(t._distanceToCamera,n._distanceToCamera);for(let e=0;e<r.length;++e)r[e]._priorityHolder=n}return u}function nX(e,t){const{canTraverse:n,updateTile:i,loadTile:o,touchTile:r}=GY;let s=!0;const a=JY.stack;for(a.push(e);a.length>0;){JY.stackMaximumLength=Math.max(JY.stackMaximumLength,a.length);const e=a.pop(),c=e.children,l=c.length,u=!e.hasRenderableContent&&n(e);if(u||e.contentAvailable||(s=!1),i(e,t),e.isVisible||(o(e,t),r(e,t)),u)for(let t=0;t<l;++t){const e=c[t];a.push(e)}}return e.hasEmptyContent||s}function iX(){}KY.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e.hasMixedContent=!1;const n=e.root;if(GY.updateTile(n,t),!n.isVisible)return;if(n.getScreenSpaceError(t,!0)<=e.memoryAdjustedScreenSpaceError)return;!function(e,t){const{tileset:n}=e,{canTraverse:i,loadTile:o,visitTile:r,touchTile:s}=GY,a=ZY.stack;a.push(e);for(;a.length>0;){ZY.stackMaximumLength=Math.max(ZY.stackMaximumLength,a.length);const e=a.pop(),c=e.parent,l=!D(c)||c._refines;e._refines=!!i(e)&&(tX(e,a,t)&&l);const u=!e._refines&&l;e.hasRenderableContent?e.refine===ez.ADD?(eX(e,t),o(e,t)):e.refine===ez.REPLACE&&(o(e,t),u&&eX(e,t)):(n._emptyTiles.push(e),o(e,t),u&&eX(e,t)),r(e,t),s(e,t)}}(n,t),ZY.stack.trim(ZY.stackMaximumLength),JY.stack.trim(JY.stackMaximumLength);const i=e._requestedTiles;for(let o=0;o<i.length;++o)i[o].updatePriority()};const oX={stack:new mw,stackMaximumLength:0},rX={stack:new mw,stackMaximumLength:0},sX={stack:new mw,stackMaximumLength:0,ancestorStack:new mw,ancestorStackMaximumLength:0};function aX(e,t){const n=e.contentAvailable?e:e._ancestorWithContentAvailable;D(n)?n._shouldSelect=!0:function(e,t){const{updateTile:n,touchTile:i,selectTile:o}=GY,r=rX.stack;for(r.push(e);r.length>0;){rX.stackMaximumLength=Math.max(rX.stackMaximumLength,r.length);const s=r.pop().children;for(let a=0;a<s.length;++a){const c=s[a];c.isVisible&&(c.contentAvailable?(n(c,t),i(c,t),o(c,t)):c._depth-e._depth<2&&r.push(c))}}}(e,t)}function cX(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const{parent:n}=e;if(!D(n))return;const i=!n.hasUnloadedRenderableContent||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}function lX(e,t){const n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||D(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function uX(e,t,n){const{tileset:i,children:o}=e,{updateTile:r,loadTile:s,touchTile:a}=GY;for(let l=0;l<o.length;++l)r(o[l],n);o.sort(GY.sortChildrenByDistanceToCamera);let c=!1;for(let l=0;l<o.length;++l){const e=o[l];e.isVisible?(t.push(e),c=!0):i.loadSiblings&&(s(e,n),a(e,n))}return c}function dX(e,t){const{tileset:n}=e;return!n.immediatelyLoadDesiredLevelOfDetail&&(!D(e._ancestorWithContent)||(0===e._screenSpaceError?e.parent._screenSpaceError>t:e._screenSpaceError>t))}function hX(e){e=M(e,M.EMPTY_OBJECT),this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._scaledGeometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._modelUpAxis=void 0,this._modelForwardAxis=void 0,this._cache=new SY,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._showCreditsOnScreen=M(e.showCreditsOnScreen,!1),this._cullWithChildrenBounds=M(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new mw,this._maximumScreenSpaceError=M(e.maximumScreenSpaceError,16),this._memoryAdjustedScreenSpaceError=this._maximumScreenSpaceError,this._cacheBytes=M(e.cacheBytes,536870912),L.typeOf.number.greaterThanOrEquals("cacheBytes",this._cacheBytes,0);const t=M(e.maximumCacheOverflowBytes,536870912);L.typeOf.number.greaterThanOrEquals("maximumCacheOverflowBytes",t,0),this._maximumCacheOverflowBytes=t,this._styleEngine=new NY,this._styleApplied=!1,this._modelMatrix=D(e.modelMatrix)?ve.clone(e.modelMatrix):ve.clone(ve.IDENTITY),this._addHeightCallbacks=[],this._statistics=new DY,this._statisticsLast=new DY,this._statisticsPerPass=new Array(Wj.NUMBER_OF_PASSES);for(let o=0;o<Wj.NUMBER_OF_PASSES;++o)this._statisticsPerPass[o]=new DY;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 CY(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=M(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=M(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=V.clamp(M(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=M(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._classificationType=e.classificationType,this._ellipsoid=M(e.ellipsoid,on.WGS84),this._initialClippingPlanesOriginMatrix=ve.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=M(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=M(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=M(e.preloadWhenHidden,!1),this.preloadFlightDestinations=M(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=M(e.dynamicScreenSpaceError,!0),this.foveatedScreenSpaceError=M(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=M(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=M(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=M(e.foveatedInterpolationCallback,V.lerp),this.foveatedTimeDelay=M(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=M(e.dynamicScreenSpaceErrorDensity,2e-4),this.dynamicScreenSpaceErrorFactor=M(e.dynamicScreenSpaceErrorFactor,24),this.dynamicScreenSpaceErrorHeightFalloff=M(e.dynamicScreenSpaceErrorHeightFalloff,.25),this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=M(e.shadows,k_.ENABLED),this.show=M(e.show,!0),this.colorBlendMode=jw.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new OR(e.pointCloudShading),this._pointCloudEyeDomeLighting=new ER,this.loadProgress=new gi,this.allTilesLoaded=new gi,this.initialTilesLoaded=new gi,this.tileLoad=new gi,this.tileUnload=new gi,this.tileFailed=new gi,this.tileVisible=new gi,this.skipLevelOfDetail=M(e.skipLevelOfDetail,!1),this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=M(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=M(e.skipScreenSpaceErrorFactor,16),this.skipLevels=M(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=M(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=M(e.loadSiblings,!1),this._clippingPlanes=void 0,D(e.clippingPlanes)&&qI.setOwner(e.clippingPlanes,this,"_clippingPlanes"),this._clippingPolygons=void 0,D(e.clippingPolygons)&&bP.setOwner(e.clippingPolygons,this,"_clippingPolygons"),D(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new cw,this._shouldDestroyImageBasedLighting=!0),this.lightColor=e.lightColor,this.backFaceCulling=M(e.backFaceCulling,!0),this._enableShowOutline=M(e.enableShowOutline,!0),this.showOutline=M(e.showOutline,!0),this.outlineColor=M(e.outlineColor,Ot.BLACK),this.splitDirection=M(e.splitDirection,$R.NONE),this.enableCollision=M(e.enableCollision,!1),this._projectTo2D=M(e.projectTo2D,!1),this._enablePick=M(e.enablePick,!1),this.debugFreezeFrame=M(e.debugFreezeFrame,!1),this.debugColorizeTiles=M(e.debugColorizeTiles,!1),this._enableDebugWireframe=M(e.enableDebugWireframe,!1),this.debugWireframe=M(e.debugWireframe,!1),!0===this.debugWireframe&&!1===this._enableDebugWireframe&&Oa("tileset-debug-wireframe-ignored"),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=M(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=M(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=M(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=M(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=M(e.debugShowMemoryUsage,!1),this.debugShowUrl=M(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader;let n=M(e.featureIdLabel,"featureId_0");"number"==typeof n&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=M(e.instanceFeatureIdLabel,"instanceFeatureId_0");"number"==typeof i&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i}function pX(e,t,n,i){if(!(D(n.implicitTiling)||Px(n,"3DTILES_implicit_tiling")))return new Kq(e,t,n,i);const o=new RY(t,n,e.schema),r=new kY({subdivisionScheme:o.subdivisionScheme,subtreeLevels:o.subtreeLevels,level:0,x:0,y:0,z:0}),s=o.subtreeUriTemplate.getDerivedResource({templateValues:r.getTemplateValues()}).url,a=ti(n,!0);a.contents=[{uri:s}],delete a.content,delete a.extensions;const c=new Kq(e,t,a,i);return c.implicitTileset=o,c.implicitCoordinates=r,c}iX.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e.hasMixedContent=!1;const n=e.root;if(GY.updateTile(n,t),!n.isVisible)return;if(n.getScreenSpaceError(t,!0)<=e.memoryAdjustedScreenSpaceError)return;!function(e,t){const{tileset:n}=e,i=n.immediatelyLoadDesiredLevelOfDetail?Number.MAX_VALUE:Math.max(n.baseScreenSpaceError,n.memoryAdjustedScreenSpaceError),{canTraverse:o,loadTile:r,visitTile:s,touchTile:a}=GY,c=oX.stack;c.push(e);for(;c.length>0;){oX.stackMaximumLength=Math.max(oX.stackMaximumLength,c.length);const e=c.pop();cX(e,t);const l=e.parent,u=!D(l)||l._refines;e._refines=!!o(e)&&(uX(e,c,t)&&u);const d=!e._refines&&u;e.hasRenderableContent?e.refine===ez.ADD?(aX(e,t),r(e,t)):e.refine===ez.REPLACE&&(dX(e,i)?(r(e,t),d&&aX(e,t)):d?(aX(e,t),r(e,t)):lX(n,e)&&r(e,t)):(n._emptyTiles.push(e),r(e,t),d&&aX(e,t)),s(e,t),a(e,t)}}(n,t),function(e,t){const{selectTile:n,canTraverse:i}=GY,{stack:o,ancestorStack:r}=sX;let s;o.push(e);for(;o.length>0||r.length>0;){if(sX.stackMaximumLength=Math.max(sX.stackMaximumLength,o.length),sX.ancestorStackMaximumLength=Math.max(sX.ancestorStackMaximumLength,r.length),r.length>0){const e=r.peek();if(e._stackLength===o.length){r.pop(),e!==s&&(e._finalResolution=!1),n(e,t);continue}}const e=o.pop();if(!D(e))continue;const a=i(e);if(e._shouldSelect)if(e.refine===ez.ADD)n(e,t);else{if(e._selectionDepth=r.length,e._selectionDepth>0&&(e.tileset.hasMixedContent=!0),s=e,!a){n(e,t);continue}r.push(e),e._stackLength=o.length}if(a){const t=e.children;for(let e=0;e<t.length;++e){const n=t[e];n.isVisible&&o.push(n)}}}}(n,t),oX.stack.trim(oX.stackMaximumLength),rX.stack.trim(rX.stackMaximumLength),sX.stack.trim(sX.stackMaximumLength),sX.ancestorStack.trim(sX.ancestorStackMaximumLength);const i=e._requestedTiles;for(let o=0;o<i.length;++o)i[o].updatePriority()},Object.defineProperties(hX.prototype,{isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){return this._asset}},extensions:{get:function(){return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){qI.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){bP.setOwner(e,this,"_clippingPolygons")}},properties:{get:function(){return this._properties}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return Da("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},customShader:{get:function(){return this._customShader},set:function(e){this._customShader=e}},hasMixedContent:{get:function(){return this._hasMixedContent},set:function(e){L.typeOf.bool("value",e),this._hasMixedContent=e}},isSkippingLevelOfDetail:{get:function(){return this.skipLevelOfDetail&&!D(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive}},metadataExtension:{get:function(){return this._metadataExtension}},metadata:{get:function(){if(D(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(D(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){L.typeOf.number.greaterThanOrEquals("maximumScreenSpaceError",e,0),this._maximumScreenSpaceError=e,this._memoryAdjustedScreenSpaceError=e}},cacheBytes:{get:function(){return this._cacheBytes},set:function(e){L.typeOf.number.greaterThanOrEquals("value",e,0),this._cacheBytes=e}},maximumCacheOverflowBytes:{get:function(){return this._maximumCacheOverflowBytes},set:function(e){L.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumCacheOverflowBytes=e}},memoryAdjustedScreenSpaceError:{get:function(){return this._memoryAdjustedScreenSpaceError}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){L.defined("pointCloudShading",e),this._pointCloudShading=e}},root:{get:function(){return this._root}},boundingSphere:{get:function(){return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=ve.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){const e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return D(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(ve.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):ve.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){L.typeOf.number.greaterThanOrEquals("foveatedConeSize",e,0),L.typeOf.number.lessThanOrEquals("foveatedConeSize",e,1),this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){L.typeOf.number.greaterThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,0),L.typeOf.number.lessThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,this.maximumScreenSpaceError),this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){L.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e,zX(this)}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){"number"==typeof e&&(e=`featureId_${e}`),L.typeOf.string("value",e),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){"number"==typeof e&&(e=`instanceFeatureId_${e}`),L.typeOf.string("value",e),this._instanceFeatureIdLabel=e}}}),hX.fromIonAssetId=async function(e,t){L.defined("assetId",e);const n=await pw.fromAssetId(e);return hX.fromUrl(n,t)},hX.fromUrl=async function(e,t){L.defined("url",e),t=M(t,M.EMPTY_OBJECT);const n=Bi.createIfNeeded(e);let i;"json"===n.extension?i=n.getBaseUri(!0):n.isDataUri&&(i="");const o=await hX.loadJson(n),r=await async function(e,t){const n=Px(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t;let i;if(D(n.schemaUri))e=e.getDerivedResource({url:n.schemaUri}),i=_I.getSchemaLoader({resource:e});else{if(!D(n.schema))return;i=_I.getSchemaLoader({schema:n.schema})}await i.load();const o=new bY({schema:i.schema,metadataJson:n});return _I.unload(i),o}(n,o),s=new hX(t);s._resource=n,s._url=n.url,s._basePath=i,s._metadataExtension=r,s._geometricError=o.geometricError,s._scaledGeometricError=o.geometricError;const a=o.asset;s._asset=a,s._extras=o.extras,zX(s);const c=D(o.asset.gltfUpAxis)?gw.fromName(o.asset.gltfUpAxis):gw.Y,l=M(t.modelUpAxis,c),u=M(t.modelForwardAxis,gw.X);s._properties=o.properties,s._extensionsUsed=o.extensionsUsed,s._extensions=o.extensions,s._modelUpAxis=l,s._modelForwardAxis=u,s._root=s.loadTileset(n,o);const d=s._root.createBoundingVolume(o.root.boundingVolume,ve.IDENTITY).boundingSphere.center,h=s._ellipsoid.cartesianToCartographic(d);return D(h)&&h.height>Hh._defaultMinTerrainHeight&&(s._initialClippingPlanesOriginMatrix=Cr.eastNorthUpToFixedFrame(d)),s._clippingPlanesOriginMatrix=ve.clone(s._initialClippingPlanesOriginMatrix),s},hX.loadJson=function(e){return Bi.createIfNeeded(e).fetchJson()},hX.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()},hX.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!D(i))throw new be("Tileset must have an asset property.");if("0.0"!==i.version&&"1.0"!==i.version&&"1.1"!==i.version)throw new be("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");D(t.extensionsRequired)&&hX.checkSupportedExtensions(t.extensionsRequired);const o=this._statistics,r=i.tilesetVersion;D(r)&&(this._basePath+=`?v=${r}`,(e=e.clone()).setQueryParameters({v:r}));const s=pX(this,e,t.root,n);D(n)&&(n.children.push(s),s._depth=n._depth+1);const a=[];for(a.push(s);a.length>0;){const t=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&t.refine===ez.ADD;const n=t._header.children;if(D(n))for(let i=0;i<n.length;++i){const o=pX(this,e,n[i],t);t.children.push(o),o._depth=t._depth+1,a.push(o)}this._cullWithChildrenBounds&&TY.checkChildrenWithinParent(t)}return s};const fX=new H,mX=new Qt,_X=new ve,gX=new H,yX=new H,bX=new H,vX=new H;function AX(e,t){if(t.hasEmptyContent)return;const{statistics:n}=e,i=t.contentExpired,o=t.requestContent();D(o)&&(o.then((i=>{!D(i)||t.isDestroyed()||e.isDestroyed()||(e._processingQueue.push(t),++n.numberOfTilesProcessing)})).catch((n=>{wX(n,e,t)})),i&&(t.hasTilesetContent||t.hasImplicitContent?function(e,t){const n=t,i=LX;i.push(t);for(;i.length>0;){const o=(t=i.pop()).children;for(let e=0;e<o.length;++e)i.push(o[e]);t!==n&&(FX(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t))}function TX(e,t){return e._priority-t._priority}function wX(e,t,n){if(t.isDestroyed())return;let i;n.isDestroyed()||(i=n._contentResource.url);const o=D(e.message)?e.message:e.toString();t.tileFailed.numberOfListeners>0&&t.tileFailed.raiseEvent({url:i,message:o})}hX.prototype.postPassesUpdate=function(e){D(this._root)&&(!function(e,t){const n=e._requestedTilesInFlight;let i=0;for(let o=0;o<n.length;++o){const e=n[o],r=t.frameNumber-e._touchedFrame>=1;e._contentState===Uj.LOADING?r?(e.cancelRequests(),++i):i>0&&(n[o-i]=e):++i}n.length-=i}(this,e),function(e,t){const n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;DY.clone(n,i);const c=o!==s||r!==a;c&&t.afterRender.push((function(){return e.loadProgress.raiseEvent(o,r),!0}));e._tilesLoaded=0===n.numberOfPendingRequests&&0===n.numberOfTilesProcessing&&0===n.numberOfAttemptedRequests,c&&e._tilesLoaded&&(t.afterRender.push((function(){return e.allTilesLoaded.raiseEvent(),!0})),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push((function(){return e.initialTilesLoaded.raiseEvent(),!0}))))}(this,e),this._cache.unloadTiles(this,MX),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)},hX.prototype.prePassesUpdate=function(e){if(!D(this._root))return;!function(e,t){!function(e){const t=e._processingQueue;let n=0;for(let i=0;i<t.length;++i){const e=t[i];e.isDestroyed()||e._contentState!==Uj.PROCESSING?++n:n>0&&(t[i-n]=e)}t.length-=n}(e);const n=e._processingQueue,{cacheBytes:i,maximumCacheOverflowBytes:o,statistics:r}=e,s=i+o;let a=!1;for(let l=0;l<n.length;++l){if(e.totalMemoryUsageInBytes>s){a=!0;break}const i=n[l];try{i.process(e,t),i.contentReady&&(--r.numberOfTilesProcessing,e.tileLoad.raiseEvent(i))}catch(c){--r.numberOfTilesProcessing,wX(c,e,i)}}e.totalMemoryUsageInBytes<i?function(e){e._memoryAdjustedScreenSpaceError=Math.max(e.memoryAdjustedScreenSpaceError/1.02,e.maximumScreenSpaceError)}(e):a&&n.length>0&&function(e){Oa("increase-screenSpaceError"),e._memoryAdjustedScreenSpaceError*=1.02;const t=e._processingQueue;for(let n=0;n<t.length;++n)t[n].updatePriority();t.sort(TX)}(e)}(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,D(t)&&t.enabled&&t.update(e);const n=this._clippingPolygons;D(n)&&n.enabled&&n.update(e),D(this._loadTimestamp)||(this._loadTimestamp=Hn.clone(e.time)),this._timeSinceLoad=Math.max(1e3*Hn.secondsDifference(e.time,this._loadTimestamp),0),this.dynamicScreenSpaceError&&function(e,t){let n,i,o,r,s;const a=t.camera,c=e._root,l=c.contentBoundingVolume;if(l instanceof xW)n=H.normalize(a.positionWC,fX),i=a.directionWC,o=a.positionCartographic.height,r=l.minimumHeight,s=l.maximumHeight;else{const e=ve.inverseTransformation(c.computedTransform,_X),u=t.mapProjection.ellipsoid,d=l.boundingVolume,h=ve.multiplyByPoint(e,d.center,gX);if(H.magnitude(h)>u.minimumRadius){const e=Qt.fromCartesian(h,u,mX);n=H.normalize(a.positionWC,fX),i=a.directionWC,o=a.positionCartographic.height,r=0,s=2*e.height}else{const t=ve.multiplyByPoint(e,a.positionWC,yX);if(n=H.UNIT_Z,i=ve.multiplyByPointAsVector(e,a.directionWC,bX),i=H.normalize(i,i),o=t.z,l instanceof $q){const e=re.getColumn(d.halfAxes,2,vX),t=H.magnitude(e);r=h.z-t,s=h.z+t}else if(l instanceof Hq){const e=d.radius;r=h.z-e,s=h.z+e}}}const u=r+(s-r)*e.dynamicScreenSpaceErrorHeightFalloff,d=s,h=V.clamp((o-u)/(d-u),0,1);let p=1-Math.abs(H.dot(i,n));p*=1-h,e._dynamicScreenSpaceErrorComputedDensity=e.dynamicScreenSpaceErrorDensity*p}(this,e),e.newFrame&&this._cache.reset()};const EX=new Qt,xX=new Qt,SX=new H;function CX(e,t,n){if(!e.enableCollision||!e.show)return;const i=e._addHeightCallbacks,o=t.boundingSphere;for(const r of i){if(r.invoked||t._wasSelectedLastFrame)continue;const e=r.ellipsoid,i=Qt.clone(r.positionCartographic,EX),s=Qt.fromCartesian(o.center,e,xX);D(s)&&(i.height=s.height);const a=Qt.toCartesian(i,e,SX);H.distance(a,o.center)<=o.radius&&n.afterRender.push((()=>{D(r.callback)&&r.callback(i),r.invoked=!1}))}}const IX=new H,OX={maximumFractionDigits:3};function DX(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,OX):Math.round(t).toLocaleString()}function PX(e){const{halfAxes:t,radius:n,center:i}=e.boundingVolume.boundingVolume;let o=H.clone(i,IX);if(D(t))o.x+=.75*(t[0]+t[3]+t[6]),o.y+=.75*(t[1]+t[4]+t[7]),o.z+=.75*(t[2]+t[5]+t[8]);else if(D(n)){let e=H.normalize(i,IX);e=H.multiplyByScalar(e,.75*n,IX),o=H.add(e,i,IX)}return o}function NX(e,t,n){let i="",o=0;if(t.debugShowGeometricError&&(i+=`\nGeometric error: ${e.geometricError}`,o++),t.debugShowRenderingStatistics){i+=`\nCommands: ${e.commandsLength}`,o++;e.content.pointsLength>0&&(i+=`\nPoints: ${e.content.pointsLength}`,o++);e.content.trianglesLength>0&&(i+=`\nTriangles: ${e.content.trianglesLength}`,o++),i+=`\nFeatures: ${e.content.featuresLength}`,o++}if(t.debugShowMemoryUsage&&(i+=`\nTexture Memory: ${DX(e.content.texturesByteLength)}`,i+=`\nGeometry Memory: ${DX(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+="\nUrls:";const t=e.content.innerContentUrls;for(let e=0;e<t.length;e++)i+=`\n- ${t[e]}`;o+=t.length}else i+=`\nUrl: ${e._contentHeader.uri}`,o++;const r={text:i.substring(1),position:n,font:19-o+"px sans-serif",showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(r)}function RX(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;const{commandList:i,context:o}=t,r=i.length,s=e._selectedTiles,a=e.isSkippingLevelOfDetail&&e._hasMixedContent&&o.stencilBuffer&&s.length>0;e._backfaceCommands.length=0,a&&(D(e._stencilClearCommand)||(e._stencilClearCommand=new Bt({stencil:0,pass:zt.CESIUM_3D_TILE,renderState:_s.fromCache({stencilMask:sy.SKIP_LOD_MASK})})),i.push(e._stencilClearCommand));const{statistics:c,tileVisible:l}=e,u=n.isRender,d=i.length;for(let f=0;f<s.length;++f){const i=s[f];u&&l.raiseEvent(i),CX(e,i,t),i.update(e,t,n),c.incrementSelectionCounts(i.content),++c.selected}const h=e._emptyTiles;for(let f=0;f<h.length;++f){h[f].update(e,t,n)}let p=i.length-d;if(e._backfaceCommands.trim(),a){const t=e._backfaceCommands.values,n=t.length;i.length+=n;for(let e=p-1;e>=0;--e)i[d+n+e]=i[d+e];for(let e=0;e<n;++e)i[d+e]=t[e]}p=i.length-r,c.numberOfCommands=p,u&&(e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&p>0&&e._pointCloudEyeDomeLighting.update(t,r,e.pointCloudShading,e.boundingSphere),e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(D(e._tileDebugLabels)||(e._tileDebugLabels=new SH),function(e,t){const n=e._selectedTiles,i=n.length,o=e._emptyTiles,r=o.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(D(e.debugPickedTile)){const t=D(e.debugPickPosition)?e.debugPickPosition:PX(e.debugPickedTile);NX(e.debugPickedTile,e,t).pixelOffset=new kt(15,-15)}}else{for(let t=0;t<i;++t){const i=n[t];NX(i,e,PX(i))}for(let t=0;t<r;++t){const n=o[t];(n.hasTilesetContent||n.hasImplicitContent)&&NX(n,e,PX(n))}}e._tileDebugLabels.update(t)}(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const LX=[];function MX(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function FX(e,t){e._cache.unloadTile(e,t,MX),t.destroy()}function BX(e,t,n,i){if(t.mode===gl.MORPHING)return!1;if(!D(e._root))return!1;const o=e._statistics;o.clear(),++e._updatedVisibilityFrame,function(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}(e),function(e,t){t.frameNumber===e._updatedModelMatrixFrame&&D(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!ve.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=ve.clone(e.modelMatrix,e._previousModelMatrix)))}(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const r=e.getTraversal(i).selectTiles(e,t);if(i.requestTiles&&function(e){const t=e._requestedTiles;t.sort(TX);for(let n=0;n<t.length;++n)AX(e,t[n])}(e),RX(e,t,i),DY.clone(o,n),i.isRender){const n=e._credits;if(D(n)&&0!==o.selected)for(let e=0;e<n.length;++e){const i=n[e];t.creditDisplay.addCreditToNextFrame(i)}}return r}function zX(e){let t=e._credits;D(t)||(t=[]),t.length=0,D(e.resource.credits)&&e.resource.credits.forEach((e=>{t.push(YT.clone(e))}));const n=e.asset.extras;if(D(n)&&D(n.cesium)&&D(n.cesium.credits)){const e=n.cesium.credits;for(let n=0;n<e.length;++n){const i=e[n];t.push(new YT(i.html))}}t.forEach((t=>t.showOnScreen=t.showOnScreen||e._showCreditsOnScreen)),e._credits=t}hX.prototype.trimLoadedTiles=function(){this._cache.trim()},hX.prototype.getTraversal=function(e){const{pass:t}=e;return t===Wj.MOST_DETAILED_PRELOAD||t===Wj.MOST_DETAILED_PICK?WY:this.isSkippingLevelOfDetail?iX:KY},hX.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)},hX.prototype.updateForPass=function(e,t){L.typeOf.object("frameState",e),L.typeOf.object("tilesetPassState",t);const n=t.pass;if(n===Wj.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===Wj.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===Wj.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const i=e.commandList,o=e.camera,r=e.cullingVolume;t.ready=!1;const s=Wj.getPassOptions(n),a=s.ignoreCommands,c=M(t.commandList,i),l=c.length;e.commandList=c,e.camera=M(t.camera,o),e.cullingVolume=M(t.cullingVolume,r);const u=this._clippingPolygons;D(u)&&u.enabled&&u.queueCommands(e);const d=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=BX(this,e,d,s)),a&&(c.length=l),e.commandList=i,e.camera=o,e.cullingVolume=r},hX.prototype.hasExtension=function(e){return!!D(this._extensionsUsed)&&this._extensionsUsed.indexOf(e)>-1},hX.prototype.isDestroyed=function(){return!1},hX.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),D(this._root)){const e=LX;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const n=t.children;for(let i=0;i<n.length;++i)e.push(n[i])}}return this._root=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,He(this)},hX.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0,MAXAR_content_geojson:!0},hX.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!hX.supportedExtensions[e[t]])throw new be(`Unsupported 3D Tiles Extension: ${e[t]}`)};const UX=new tp,kX=new H,VX=new Qt;hX.prototype.getHeight=function(e,t){var n,i;L.typeOf.object("cartographic",e),L.typeOf.object("scene",t);let o=null==(n=t.globe)?void 0:n.ellipsoid;D(o)||(o=on.WGS84);const r=UX,s=o.cartographicToCartesian(e,r.direction);H.normalize(r.direction,r.direction),r.direction=H.normalize(s,r.direction),r.direction=H.negate(s,r.direction),r.origin=H.multiplyByScalar(r.direction,-2*o.maximumRadius,r.origin);const a=this.pick(r,t.frameState,kX);if(D(a))return null==(i=o.cartesianToCartographic(a,VX))?void 0:i.height},hX.prototype.updateHeight=function(e,t,n){const i={positionCartographic:e,ellipsoid:n=M(n,on.WGS84),callback:t,invoked:!1};return this._addHeightCallbacks.push(i),()=>{const e=this._addHeightCallbacks,t=e.length;for(let n=0;n<t;++n)if(e[n]===i){e.splice(n,1);break}i.callback&&(i.callback=void 0)}};const HX=new Qu,GX=new H;hX.prototype.pick=function(e,t,n){if(!t.context.webgl2&&!this._enablePick)return;const i=this._selectedTiles,o=i.length,r=[];for(let c=0;c<o;++c){const t=i[c];D(Pp.raySphere(e,t.contentBoundingVolume.boundingSphere,HX))&&D(t.content)&&r.push(t)}const s=r.length;let a;r.sort(((t,n)=>$u.distanceSquaredTo(t.contentBoundingVolume.boundingSphere,e.origin)-$u.distanceSquaredTo(n.contentBoundingVolume.boundingSphere,e.origin)));for(let c=0;c<s;++c){const i=r[c].content.pick(e,t,GX);if(D(i))return a=H.clone(i,n),a}};const jX=new ve;function WX(e,t){if(!D(e))throw new P("scene is required.");if(!D(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(WX.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new bu,this._onCollectionChanged(t,t.values,[],[])}function qX(e,t,n,i){const o=n[t.id];D(o)&&(D(o.tilesetPrimitive)&&i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}async function YX(e,t,n,i){t[n.id]={url:e.url,loadFail:!1};try{const o=await hX.fromUrl(e);if(o.id=n,i.add(o),!D(t[n.id]))return;t[n.id].tilesetPrimitive=o}catch(o){t[n.id].loadFail=!0}}WX.prototype.update=function(e){if(!D(e))throw new P("time is required.");const t=this._entitiesToVisualize.values,n=this._tilesetHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const r=t[o],s=r._tileset;let a;const c=n[r.id],l=r.isShowing&&r.isAvailable(e)&&Ou.getValueOrDefault(s._show,e,!0);let u;l&&(u=r.computeModelMatrix(e,jX),a=Bi.createIfNeeded(Ou.getValueOrUndefined(s._uri,e)));const d=D(c)?c.tilesetPrimitive:void 0;l?(D(c)&&a.url===c.url||(D(d)&&i.removeAndDestroy(d),delete n[r.id],YX(a,n,r,i)),D(d)&&(d.show=!0,D(u)&&(d.modelMatrix=u),d.maximumScreenSpaceError=Ou.getValueOrDefault(s.maximumScreenSpaceError,e,d.maximumScreenSpaceError))):D(d)&&(d.show=!1)}return!0},WX.prototype.isDestroyed=function(){return!1},WX.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(WX.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)qX(this,e[i],t,n);return He(this)},WX.prototype.getBoundingSphere=function(e,t){if(!D(e))throw new P("entity is required.");if(!D(t))throw new P("result is required.");const n=this._tilesetHash[e.id];if(!D(n)||n.loadFail)return Iu.FAILED;const i=n.tilesetPrimitive;return D(i)?i.show?($u.clone(i.boundingSphere,t),Iu.DONE):Iu.FAILED:Iu.PENDING},WX.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._tilesetHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],D(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],D(r._tileset)?s.set(r.id,r):(qX(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],qX(this,r,a,c),s.remove(r.id)};const XX={id:void 0};function QX(e){if(e._firing)e._refire=!0;else if(0===e._suspendCount){const t=e._addedEntities,n=e._removedEntities,i=e._changedEntities;if(0!==i.length||0!==t.length||0!==n.length){e._firing=!0;do{e._refire=!1;const o=t.values.slice(0),r=n.values.slice(0),s=i.values.slice(0);t.removeAll(),n.removeAll(),i.removeAll(),e._collectionChanged.raiseEvent(e,o,r,s)}while(e._refire);e._firing=!1}}}function $X(e){this._owner=e,this._entities=new bu,this._addedEntities=new bu,this._removedEntities=new bu,this._changedEntities=new bu,this._suspendCount=0,this._collectionChanged=new gi,this._id=ke(),this._show=!0,this._firing=!1,this._refire=!1}function KX(){this._removalFunctions=[]}function ZX(e,t){return Hn.compare(e.start,t.start)}function JX(e){if(this._intervals=[],this._changedEvent=new gi,D(e)){const t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}$X.prototype.suspendEvents=function(){this._suspendCount++},$X.prototype.resumeEvents=function(){if(0===this._suspendCount)throw new P("resumeEvents can not be called before suspendEvents.");this._suspendCount--,QX(this)},Object.defineProperties($X.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(!D(e))throw new P("value is required.");if(e===this._show)return;let t;this.suspendEvents();const n=[],i=this._entities.values,o=i.length;for(t=0;t<o;t++)n.push(i[t].isShowing);for(this._show=e,t=0;t<o;t++){const e=n[t],o=i[t];e!==o.isShowing&&o.definitionChanged.raiseEvent(o,"isShowing",o.isShowing,e)}this.resumeEvents()}},owner:{get:function(){return this._owner}}}),$X.prototype.computeAvailability=function(){let e=ih.MAXIMUM_VALUE,t=ih.MINIMUM_VALUE;const n=this._entities.values;for(let i=0,o=n.length;i<o;i++){const o=n[i].availability;if(D(o)){const n=o.start,i=o.stop;Hn.lessThan(n,e)&&!n.equals(ih.MINIMUM_VALUE)&&(e=n),Hn.greaterThan(i,t)&&!i.equals(ih.MAXIMUM_VALUE)&&(t=i)}}return ih.MAXIMUM_VALUE.equals(e)&&(e=ih.MINIMUM_VALUE),ih.MINIMUM_VALUE.equals(t)&&(t=ih.MAXIMUM_VALUE),new Jd({start:e,stop:t})},$X.prototype.add=function(e){if(!D(e))throw new P("entity is required.");e instanceof _A||(e=new _A(e));const t=e.id,n=this._entities;if(n.contains(t))throw new P(`An entity with id ${t} already exists in this collection.`);return e.entityCollection=this,n.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener($X.prototype._onEntityDefinitionChanged,this),QX(this),e},$X.prototype.remove=function(e){return!!D(e)&&this.removeById(e.id)},$X.prototype.contains=function(e){if(!D(e))throw new P("entity is required");return this._entities.get(e.id)===e},$X.prototype.removeById=function(e){if(!D(e))return!1;const 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($X.prototype._onEntityDefinitionChanged,this),QX(this),!0)},$X.prototype.removeAll=function(){const e=this._entities,t=e.length,n=e.values,i=this._addedEntities,o=this._removedEntities;for(let r=0;r<t;r++){const e=n[r],t=e.id;D(i.get(t))||(e.definitionChanged.removeEventListener($X.prototype._onEntityDefinitionChanged,this),o.set(t,e))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),QX(this)},$X.prototype.getById=function(e){if(!D(e))throw new P("id is required.");return this._entities.get(e)},$X.prototype.getOrCreateEntity=function(e){if(!D(e))throw new P("id is required.");let t=this._entities.get(e);return D(t)||(XX.id=e,t=new _A(XX),this.add(t)),t},$X.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),QX(this)},KX.prototype.add=function(e,t,n){if(!D(e))throw new P("event is required");const i=e.addEventListener(t,n);this._removalFunctions.push(i);const o=this;return function(){i();const e=o._removalFunctions;e.splice(e.indexOf(i),1)}},KX.prototype.removeAll=function(){const e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0},Object.defineProperties(JX.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){const e=this._intervals;return 0===e.length?void 0:e[0].start}},isStartIncluded:{get:function(){const e=this._intervals;return 0!==e.length&&e[0].isStartIncluded}},stop:{get:function(){const e=this._intervals,t=e.length;return 0===t?void 0:e[t-1].stop}},isStopIncluded:{get:function(){const 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}}}),JX.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof JX))return!1;const n=this._intervals,i=e._intervals,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;r++)if(!Jd.equals(n[r],i[r],t))return!1;return!0},JX.prototype.get=function(e){if(!D(e))throw new P("index is required.");return this._intervals[e]},JX.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))},JX.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0},JX.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0},JX.prototype.contains=function(e){return this.indexOf(e)>=0};const eQ=new Jd;JX.prototype.indexOf=function(e){if(!D(e))throw new P("date is required");const t=this._intervals;eQ.start=e,eQ.stop=e;let n=_n(t,eQ,ZX);return n>=0?t[n].isStartIncluded?n:n>0&&t[n-1].stop.equals(e)&&t[n-1].isStopIncluded?n-1:~n:(n=~n,n>0&&n-1<t.length&&Jd.contains(t[n-1],e)?n-1:~n)},JX.prototype.findInterval=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).start,n=e.stop,i=e.isStartIncluded,o=e.isStopIncluded,r=this._intervals;for(let s=0,a=r.length;s<a;s++){const e=r[s];if((!D(t)||e.start.equals(t))&&(!D(n)||e.stop.equals(n))&&(!D(i)||e.isStartIncluded===i)&&(!D(o)||e.isStopIncluded===o))return r[s]}},JX.prototype.addInterval=function(e,t){if(!D(e))throw new P("interval is required");if(e.isEmpty)return;const n=this._intervals;if(0===n.length||Hn.greaterThan(e.start,n[n.length-1].stop))return n.push(e),void this._changedEvent.raiseEvent(this);let i,o=_n(n,e,ZX);for(o<0?o=~o:o>0&&e.isStartIncluded&&n[o-1].isStartIncluded&&n[o-1].start.equals(e.start)?--o:o<n.length&&!e.isStartIncluded&&n[o].isStartIncluded&&n[o].start.equals(e.start)&&++o,o>0&&(i=Hn.compare(n[o-1].stop,e.start),(i>0||0===i&&(n[o-1].isStopIncluded||e.isStartIncluded))&&((D(t)?t(n[o-1].data,e.data):n[o-1].data===e.data)?(e=Hn.greaterThan(e.stop,n[o-1].stop)?new Jd({start:n[o-1].start,stop:e.stop,isStartIncluded:n[o-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):new Jd({start:n[o-1].start,stop:n[o-1].stop,isStartIncluded:n[o-1].isStartIncluded,isStopIncluded:n[o-1].isStopIncluded||e.stop.equals(n[o-1].stop)&&e.isStopIncluded,data:e.data}),n.splice(o-1,1),--o):(i=Hn.compare(n[o-1].stop,e.stop),(i>0||0===i&&n[o-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(o,0,new Jd({start:e.stop,stop:n[o-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[o-1].isStopIncluded,data:n[o-1].data})),n[o-1]=new Jd({start:n[o-1].start,stop:e.start,isStartIncluded:n[o-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:n[o-1].data}))));o<n.length&&(i=Hn.compare(e.stop,n[o].start),i>0||0===i&&(e.isStopIncluded||n[o].isStartIncluded));)if(D(t)?t(n[o].data,e.data):n[o].data===e.data)e=new Jd({start:e.start,stop:Hn.greaterThan(n[o].stop,e.stop)?n[o].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:Hn.greaterThan(n[o].stop,e.stop)?n[o].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(o,1);else{if(n[o]=new Jd({start:e.stop,stop:n[o].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[o].isStopIncluded,data:n[o].data}),!n[o].isEmpty)break;n.splice(o,1)}n.splice(o,0,e),this._changedEvent.raiseEvent(this)},JX.prototype.removeInterval=function(e){if(!D(e))throw new P("interval is required");if(e.isEmpty)return!1;const t=this._intervals;let n=_n(t,e,ZX);n<0&&(n=~n);let i=!1;for(n>0&&(Hn.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(Hn.greaterThan(t[n-1].stop,e.stop)||t[n-1].isStopIncluded&&!e.isStopIncluded&&t[n-1].stop.equals(e.stop))&&t.splice(n,0,new Jd({start:e.stop,stop:t[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n-1].isStopIncluded,data:t[n-1].data})),t[n-1]=new Jd({start:t[n-1].start,stop:e.start,isStartIncluded:t[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[n-1].data})),n<t.length&&!e.isStartIncluded&&t[n].isStartIncluded&&e.start.equals(t[n].start)&&(i=!0,t.splice(n,0,new Jd({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&Hn.greaterThan(e.stop,t[n].stop);)i=!0,t.splice(n,1);return n<t.length&&e.stop.equals(t[n].stop)&&(i=!0,!e.isStopIncluded&&t[n].isStopIncluded?n+1<t.length&&t[n+1].start.equals(e.stop)&&t[n].data===t[n+1].data?(t.splice(n,1),t[n]=new Jd({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new Jd({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(Hn.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new Jd({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i},JX.prototype.intersect=function(e,t,n){if(!D(e))throw new P("other is required.");const i=new JX;let o=0,r=0;const s=this._intervals,a=e._intervals;for(;o<s.length&&r<a.length;){const e=s[o],c=a[r];if(Hn.lessThan(e.stop,c.start))++o;else if(Hn.lessThan(c.stop,e.start))++r;else{if(D(n)||D(t)&&t(e.data,c.data)||!D(t)&&c.data===e.data){const o=Jd.intersect(e,c,new Jd,n);o.isEmpty||i.addInterval(o,t)}Hn.lessThan(e.stop,c.stop)||e.stop.equals(c.stop)&&!e.isStopIncluded&&c.isStopIncluded?++o:++r}}return i},JX.fromJulianDateArray=function(e,t){if(!D(e))throw new P("options is required.");if(!D(e.julianDates))throw new P("options.iso8601Array is required.");D(t)||(t=new JX);const n=e.julianDates,i=n.length,o=e.dataCallback,r=M(e.isStartIncluded,!0),s=M(e.isStopIncluded,!0),a=M(e.leadingInterval,!1),c=M(e.trailingInterval,!1);let l,u=0;a&&(++u,l=new Jd({start:ih.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!r}),l.data=D(o)?o(l,t.length):t.length,t.addInterval(l));for(let d=0;d<i-1;++d){let e=n[d];const a=n[d+1];l=new Jd({start:e,stop:a,isStartIncluded:t.length!==u||r,isStopIncluded:d===i-2&&s}),l.data=D(o)?o(l,t.length):t.length,t.addInterval(l),e=a}return c&&(l=new Jd({start:n[i-1],stop:ih.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),l.data=D(o)?o(l,t.length):t.length,t.addInterval(l)),t};const tQ=new vn,nQ=[0,31,28,31,30,31,30,31,31,30,31,30,31];function iQ(e,t,n){D(n)||(n=new Hn),Hn.toGregorianDate(e,tQ);let i=tQ.millisecond+t.millisecond,o=tQ.second+t.second,r=tQ.minute+t.minute,s=tQ.hour+t.hour,a=tQ.day+t.day,c=tQ.month+t.month,l=tQ.year+t.year;for(i>=1e3&&(o+=Math.floor(i/1e3),i%=1e3),o>=60&&(r+=Math.floor(o/60),o%=60),r>=60&&(s+=Math.floor(r/60),r%=60),s>=24&&(a+=Math.floor(s/24),s%=24),nQ[2]=yn(l)?29:28;a>nQ[c]||c>=13;)a>nQ[c]&&(a-=nQ[c],++c),c>=13&&(--c,l+=Math.floor(c/12),c%=12,++c),nQ[2]=yn(l)?29:28;return tQ.millisecond=i,tQ.second=o,tQ.minute=r,tQ.hour=s,tQ.day=a,tQ.month=c,tQ.year=l,Hn.fromGregorianDate(tQ,n)}const oQ=new Hn,rQ=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function sQ(e,t){if(!D(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,t.millisecond=0,"P"===e[0]){const n=e.match(rQ);if(!D(n))return!1;if(D(n[1])&&(t.year=Number(n[1].replace(",","."))),D(n[2])&&(t.month=Number(n[2].replace(",","."))),D(n[3])&&(t.day=7*Number(n[3].replace(",","."))),D(n[4])&&(t.day+=Number(n[4].replace(",","."))),D(n[5])&&(t.hour=Number(n[5].replace(",","."))),D(n[6])&&(t.minute=Number(n[6].replace(",","."))),D(n[7])){const e=Number(n[7].replace(",","."));t.second=Math.floor(e),t.millisecond=e%1*1e3}}else"Z"!==e[e.length-1]&&(e+="Z"),Hn.toGregorianDate(Hn.fromIso8601(e,oQ),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const aQ=new vn;function cQ(){this._eventHelper=new KX,this._definitionChanged=new gi,this._intervals=new JX,this._intervals.changedEvent.addEventListener(cQ.prototype._intervalsChanged,this)}function lQ(e){this._referenceFrame=M(e,Mv.FIXED),this._definitionChanged=new gi,this._composite=new cQ,this._composite.definitionChanged.addEventListener(lQ.prototype._raiseDefinitionChanged,this)}JX.fromIso8601=function(e,t){if(!D(e))throw new P("options is required.");if(!D(e.iso8601))throw new P("options.iso8601 is required.");const n=e.iso8601.split("/"),i=Hn.fromIso8601(n[0]),o=Hn.fromIso8601(n[1]),r=[];if(sQ(n[2],aQ)){let e=Hn.clone(i);for(r.push(e);Hn.compare(e,o)<0;){e=iQ(e,aQ);Hn.compare(o,e)<=0&&Hn.clone(o,e),r.push(e)}}else r.push(i,o);return JX.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},JX.fromIso8601DateArray=function(e,t){if(!D(e))throw new P("options is required.");if(!D(e.iso8601Dates))throw new P("options.iso8601Dates is required.");return JX.fromJulianDateArray({julianDates:e.iso8601Dates.map((function(e){return Hn.fromIso8601(e)})),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},JX.fromIso8601DurationArray=function(e,t){if(!D(e))throw new P("options is required.");if(!D(e.epoch))throw new P("options.epoch is required.");if(!D(e.iso8601Durations))throw new P("options.iso8601Durations is required.");const n=e.epoch,i=e.iso8601Durations,o=M(e.relativeToPrevious,!1),r=[];let s,a;const c=i.length;for(let l=0;l<c;++l)(sQ(i[l],aQ)||0===l)&&(s=o&&D(a)?iQ(a,aQ):iQ(n,aQ),r.push(s),a=s);return JX.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)},Object.defineProperties(cQ.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),cQ.prototype.getValue=function(e,t){if(!D(e))throw new P("time is required");const n=this._intervals.findDataForIntervalContainingDate(e);if(D(n))return n.getValue(e,t)},cQ.prototype.equals=function(e){return this===e||e instanceof cQ&&this._intervals.equals(e._intervals,Ou.equals)},cQ.prototype._intervalsChanged=function(){!function(e,t,n,i){function o(){n.raiseEvent(e)}const r=[];t.removeAll();const s=i.length;for(let a=0;a<s;a++){const e=i.get(a);D(e.data)&&-1===r.indexOf(e.data)&&t.add(e.data.definitionChanged,o)}}(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)},Object.defineProperties(lQ.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}}}),lQ.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Mv.FIXED,t)},lQ.prototype.getValueInReferenceFrame=function(e,t,n){if(!D(e))throw new P("time is required.");if(!D(t))throw new P("referenceFrame is required.");const i=this._composite._intervals.findDataForIntervalContainingDate(e);if(D(i))return i.getValueInReferenceFrame(e,t,n)},lQ.prototype.equals=function(e){return this===e||e instanceof lQ&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Ou.equals)},lQ.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const uQ=Object.freeze({ROUNDED:0,MITERED:1,BEVELED:2}),dQ=[new H,new H],hQ=new H,pQ=new H,fQ=new H,mQ=new H,_Q=new H,gQ=new H,yQ=new H,bQ=new H,vQ=new H,AQ=new H,TQ=new H,wQ={};let EQ=new Qt;function xQ(e,t,n,i){const o=e[0],r=e[1],s=H.angleBetween(o,r),a=Math.ceil(s/i),c=new Array(a);let l;if(t===n){for(l=0;l<a;l++)c[l]=t;return c.push(n),c}const u=(n-t)/a;for(l=1;l<a;l++){const e=t+l*u;c[l]=e}return c[0]=t,c.push(n),c}const SQ=new H,CQ=new H;const IQ=new H(-1,0,0);let OQ=new ve;const DQ=new ve;let PQ=new re;const NQ=re.IDENTITY.clone(),RQ=new H,LQ=new K,MQ=new H;function FQ(e,t,n,i,o,r,s,a){let c=RQ,l=LQ;OQ=Cr.eastNorthUpToFixedFrame(e,o,OQ),c=ve.multiplyByPointAsVector(OQ,IQ,c),c=H.normalize(c,c);const u=function(e,t,n,i){const o=new Rp(n,i),r=o.projectPointOntoPlane(H.add(n,e,SQ),SQ),s=o.projectPointOntoPlane(H.add(n,t,CQ),CQ),a=kt.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}(c,t,e,o);PQ=re.fromRotationZ(u,PQ),MQ.z=r,OQ=ve.multiplyTransformation(OQ,ve.fromRotationTranslation(PQ,MQ,DQ),OQ);const d=NQ;d[0]=s;for(let h=0;h<a;h++)for(let e=0;e<n.length;e+=3)l=H.fromArray(n,e,l),l=re.multiplyByVector(d,l,l),l=ve.multiplyByPoint(OQ,l,l),i.push(l.x,l.y,l.z);return i}const BQ=new H;function zQ(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){i=FQ(H.fromArray(e,a,BQ),t,n,i,o,r[a/3],s,1)}return i}function UQ(e,t){const n=e.length,i=new Array(3*n);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;for(let a=0;a<n;a++)i[o++]=e[a].x-r,i[o++]=0,i[o++]=e[a].y-s;return i}const kQ=new _o,VQ=new H,HQ=new re;function GQ(e,t,n,i,o,r,s,a,c,l){const u=H.angleBetween(H.subtract(t,e,AQ),H.subtract(n,e,TQ)),d=i===uQ.BEVELED?0:Math.ceil(u/V.toRadians(5));let h,p,f;if(h=o?re.fromQuaternion(_o.fromAxisAngle(H.negate(e,AQ),u/(d+1),kQ),HQ):re.fromQuaternion(_o.fromAxisAngle(e,u/(d+1),kQ),HQ),t=H.clone(t,VQ),d>0){const n=l?2:1;for(let i=0;i<d;i++)t=re.multiplyByVector(h,t,t),p=H.subtract(t,e,AQ),p=H.normalize(p,p),o||(p=H.negate(p,p)),f=r.scaleToGeodeticSurface(t,TQ),s=FQ(f,p,a,s,r,c,1,n)}else p=H.subtract(t,e,AQ),p=H.normalize(p,p),o||(p=H.negate(p,p)),f=r.scaleToGeodeticSurface(t,TQ),s=FQ(f,p,a,s,r,c,1,1),n=H.clone(n,VQ),p=H.subtract(n,e,AQ),p=H.normalize(p,p),o||(p=H.negate(p,p)),f=r.scaleToGeodeticSurface(n,TQ),s=FQ(f,p,a,s,r,c,1,1);return s}wQ.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let i=t-1,o=0;o<t;i=o++){const t=e[i],r=e[o];kt.equals(t,r)||n.push(r)}return n},wQ.angleIsGreaterThanPi=function(e,t,n,i){const o=new Rp(n,i),r=o.projectPointOntoPlane(H.add(n,e,SQ),SQ),s=o.projectPointOntoPlane(H.add(n,t,CQ),CQ);return s.x*r.y-s.y*r.x>=0};const jQ=new H,WQ=new H;wQ.computePositions=function(e,t,n,i,o){const r=i._ellipsoid,s=function(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++){const o=e[i];EQ=t.cartesianToCartographic(o,EQ),n[i]=EQ.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}(e,r),a=i._granularity,c=i._cornerType,l=o?function(e,t){const n=e.length,i=new Array(6*n);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;let a=e[0];i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s;for(let c=1;c<n;c++){a=e[c];const t=a.x-r,n=a.y-s;i[o++]=t,i[o++]=0,i[o++]=n,i[o++]=t,i[o++]=0,i[o++]=n}return a=e[0],i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s,i}(t,n):UQ(t,n),u=o?UQ(t,n):void 0,d=n.height/2,h=n.width/2;let p=e.length,f=[],m=o?[]:void 0,_=hQ,g=pQ,y=fQ,b=mQ,v=_Q,A=gQ,T=yQ,w=bQ,E=vQ,x=e[0],S=e[1];b=r.geodeticSurfaceNormal(x,b),_=H.subtract(S,x,_),_=H.normalize(_,_),w=H.cross(b,_,w),w=H.normalize(w,w);let C,I,O=s[0],D=s[1];o&&(m=FQ(x,w,u,m,r,O+d,1,1)),E=H.clone(x,E),x=S,g=H.negate(_,g);for(let R=1;R<p-1;R++){const t=o?2:1;if(S=e[R+1],x.equals(S)){Oa("Positions are too close and are considered equivalent with rounding error.");continue}_=H.subtract(S,x,_),_=H.normalize(_,_),y=H.add(_,g,y),y=H.normalize(y,y),b=r.geodeticSurfaceNormal(x,b);const n=H.multiplyByScalar(b,H.dot(_,b),jQ);H.subtract(_,n,n),H.normalize(n,n);const i=H.multiplyByScalar(b,H.dot(g,b),WQ);H.subtract(g,i,i),H.normalize(i,i);if(!V.equalsEpsilon(Math.abs(H.dot(n,i)),1,V.EPSILON7)){y=H.cross(y,b,y),y=H.cross(b,y,y),y=H.normalize(y,y);const e=1/Math.max(.25,H.magnitude(H.cross(y,g,AQ))),n=wQ.angleIsGreaterThanPi(_,g,x,r);n?(v=H.add(x,H.multiplyByScalar(y,e*h,y),v),A=H.add(v,H.multiplyByScalar(w,h,A),A),dQ[0]=H.clone(E,dQ[0]),dQ[1]=H.clone(A,dQ[1]),C=xQ(dQ,O+d,D+d,a),I=$H.generateArc({positions:dQ,granularity:a,ellipsoid:r}),f=zQ(I,w,l,f,r,C,1),w=H.cross(b,_,w),w=H.normalize(w,w),T=H.add(v,H.multiplyByScalar(w,h,T),T),c===uQ.ROUNDED||c===uQ.BEVELED?GQ(v,A,T,c,n,r,f,l,D+d,o):(y=H.negate(y,y),f=FQ(x,y,l,f,r,D+d,e,t)),E=H.clone(T,E)):(v=H.add(x,H.multiplyByScalar(y,e*h,y),v),A=H.add(v,H.multiplyByScalar(w,-h,A),A),dQ[0]=H.clone(E,dQ[0]),dQ[1]=H.clone(A,dQ[1]),C=xQ(dQ,O+d,D+d,a),I=$H.generateArc({positions:dQ,granularity:a,ellipsoid:r}),f=zQ(I,w,l,f,r,C,1),w=H.cross(b,_,w),w=H.normalize(w,w),T=H.add(v,H.multiplyByScalar(w,-h,T),T),c===uQ.ROUNDED||c===uQ.BEVELED?GQ(v,A,T,c,n,r,f,l,D+d,o):f=FQ(x,y,l,f,r,D+d,e,t),E=H.clone(T,E)),g=H.negate(_,g)}else f=FQ(E,w,l,f,r,O+d,1,1),E=x;O=D,D=s[R+1],x=S}dQ[0]=H.clone(E,dQ[0]),dQ[1]=H.clone(x,dQ[1]),C=xQ(dQ,O+d,D+d,a),I=$H.generateArc({positions:dQ,granularity:a,ellipsoid:r}),f=zQ(I,w,l,f,r,C,1),o&&(m=FQ(x,w,u,m,r,D+d,1,1)),p=f.length;const P=o?p+m.length:p,N=new Float64Array(P);return N.set(f),o&&N.set(m,p),N};const qQ=wQ,YQ={},XQ=new H,QQ=new H,$Q=new H,KQ=new H,ZQ=[new H,new H],JQ=new H,e$=new H,t$=new H,n$=new H,i$=new H,o$=new H,r$=new H,s$=new H,a$=new H,c$=new H,l$=new _o,u$=new re;function d$(e,t,n,i,o){const r=H.angleBetween(H.subtract(t,e,XQ),H.subtract(n,e,QQ)),s=i===uQ.BEVELED?1:Math.ceil(r/V.toRadians(5))+1,a=3*s,c=new Array(a);let l;c[a-3]=n.x,c[a-2]=n.y,c[a-1]=n.z,l=o?re.fromQuaternion(_o.fromAxisAngle(H.negate(e,XQ),r/s,l$),u$):re.fromQuaternion(_o.fromAxisAngle(e,r/s,l$),u$);let u=0;t=H.clone(t,XQ);for(let d=0;d<s;d++)t=re.multiplyByVector(l,t,t),c[u++]=t.x,c[u++]=t.y,c[u++]=t.z;return c}function h$(e,t,n,i){let o=XQ;return i||(t=H.negate(t,t)),o=H.add(e,t,o),[o.x,o.y,o.z,n.x,n.y,n.z]}function p$(e,t,n,i){const o=new Array(e.length),r=new Array(e.length),s=H.multiplyByScalar(t,n,XQ),a=H.negate(s,QQ);let c=0,l=e.length-1;for(let u=0;u<e.length;u+=3){const t=H.fromArray(e,u,$Q),n=H.add(t,a,KQ);o[c++]=n.x,o[c++]=n.y,o[c++]=n.z;const i=H.add(t,s,KQ);r[l--]=i.z,r[l--]=i.y,r[l--]=i.x}return i.push(o,r),i}YQ.addAttribute=function(e,t,n,i){const o=t.x,r=t.y,s=t.z;D(n)&&(e[n]=o,e[n+1]=r,e[n+2]=s),D(i)&&(e[i]=s,e[i-1]=r,e[i-2]=o)};const f$=new H,m$=new H;YQ.computePositions=function(e){const t=e.granularity,n=e.positions,i=e.ellipsoid,o=e.width/2,r=e.cornerType,s=e.saveAttributes;let a=JQ,c=e$,l=t$,u=n$,d=i$,h=o$,p=r$,f=s$,m=a$,_=c$,g=[];const y=s?[]:void 0,b=s?[]:void 0;let v,A=n[0],T=n[1];c=H.normalize(H.subtract(T,A,c),c),a=i.geodeticSurfaceNormal(A,a),u=H.normalize(H.cross(a,c,u),u),s&&(y.push(u.x,u.y,u.z),b.push(a.x,a.y,a.z)),p=H.clone(A,p),A=T,l=H.negate(c,l);const w=[];let E;const x=n.length;for(E=1;E<x-1;E++){a=i.geodeticSurfaceNormal(A,a),T=n[E+1],c=H.normalize(H.subtract(T,A,c),c),d=H.normalize(H.add(c,l,d),d);const e=H.multiplyByScalar(a,H.dot(c,a),f$);H.subtract(c,e,e),H.normalize(e,e);const x=H.multiplyByScalar(a,H.dot(l,a),m$);H.subtract(l,x,x),H.normalize(x,x);if(!V.equalsEpsilon(Math.abs(H.dot(e,x)),1,V.EPSILON7)){d=H.cross(d,a,d),d=H.cross(a,d,d),d=H.normalize(d,d);const e=o/Math.max(.25,H.magnitude(H.cross(d,l,XQ))),n=qQ.angleIsGreaterThanPi(c,l,A,i);d=H.multiplyByScalar(d,e,d),n?(f=H.add(A,d,f),_=H.add(f,H.multiplyByScalar(u,o,_),_),m=H.add(f,H.multiplyByScalar(u,2*o,m),m),ZQ[0]=H.clone(p,ZQ[0]),ZQ[1]=H.clone(_,ZQ[1]),v=$H.generateArc({positions:ZQ,granularity:t,ellipsoid:i}),g=p$(v,u,o,g),s&&(y.push(u.x,u.y,u.z),b.push(a.x,a.y,a.z)),h=H.clone(m,h),u=H.normalize(H.cross(a,c,u),u),m=H.add(f,H.multiplyByScalar(u,2*o,m),m),p=H.add(f,H.multiplyByScalar(u,o,p),p),r===uQ.ROUNDED||r===uQ.BEVELED?w.push({leftPositions:d$(f,h,m,r,n)}):w.push({leftPositions:h$(A,H.negate(d,d),m,n)})):(m=H.add(A,d,m),_=H.add(m,H.negate(H.multiplyByScalar(u,o,_),_),_),f=H.add(m,H.negate(H.multiplyByScalar(u,2*o,f),f),f),ZQ[0]=H.clone(p,ZQ[0]),ZQ[1]=H.clone(_,ZQ[1]),v=$H.generateArc({positions:ZQ,granularity:t,ellipsoid:i}),g=p$(v,u,o,g),s&&(y.push(u.x,u.y,u.z),b.push(a.x,a.y,a.z)),h=H.clone(f,h),u=H.normalize(H.cross(a,c,u),u),f=H.add(m,H.negate(H.multiplyByScalar(u,2*o,f),f),f),p=H.add(m,H.negate(H.multiplyByScalar(u,o,p),p),p),r===uQ.ROUNDED||r===uQ.BEVELED?w.push({rightPositions:d$(m,h,f,r,n)}):w.push({rightPositions:h$(A,d,f,n)})),l=H.negate(c,l)}A=T}let S;return a=i.geodeticSurfaceNormal(A,a),ZQ[0]=H.clone(p,ZQ[0]),ZQ[1]=H.clone(A,ZQ[1]),v=$H.generateArc({positions:ZQ,granularity:t,ellipsoid:i}),g=p$(v,u,o,g),s&&(y.push(u.x,u.y,u.z),b.push(a.x,a.y,a.z)),r===uQ.ROUNDED&&(S=function(e){let t=JQ,n=e$,i=t$,o=e[1];n=H.fromArray(e[1],o.length-3,n),i=H.fromArray(e[0],0,i),t=H.midpoint(n,i,t);const r=d$(t,n,i,uQ.ROUNDED,!1),s=e.length-1,a=e[s-1];return o=e[s],n=H.fromArray(a,a.length-3,n),i=H.fromArray(o,0,i),t=H.midpoint(n,i,t),[r,d$(t,n,i,uQ.ROUNDED,!1)]}(g)),{positions:g,corners:w,lefts:y,normals:b,endPositions:S}};const _$=YQ,g$=new H,y$=new H,b$=new H,v$=new H,A$=new H,T$=new H,w$=new H,E$=new H;function x$(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function S$(e,t,n,i,o,r){const s=e.normals,a=e.tangents,c=e.bitangents,l=H.normalize(H.cross(n,t,w$),w$);r.normal&&_$.addAttribute(s,t,i,o),r.tangent&&_$.addAttribute(a,l,i,o),r.bitangent&&_$.addAttribute(c,n,i,o)}function C$(e,t,n){const i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,c=new Md;let l,u,d,h=0,p=0,f=0;for(u=0;u<i.length;u+=2)d=i[u].length-3,h+=d,f+=2*d,p+=i[u+1].length-3;for(h+=3,p+=3,u=0;u<o.length;u++){l=o[u];const e=o[u].leftPositions;D(e)?(d=e.length,h+=d,f+=d):(d=o[u].rightPositions.length,p+=d,f+=d)}const m=D(r);let _;m&&(_=r[0].length-3,h+=_,p+=_,_/=3,f+=6*_);const g=h+p,y=new Float64Array(g),b={normals:t.normal?new Float32Array(g):void 0,tangents:t.tangent?new Float32Array(g):void 0,bitangents:t.bitangent?new Float32Array(g):void 0};let v,A,T,w,E,x,S=0,C=g-1,I=g$,O=y$;const P=_/2,N=je.createTypedArray(g/3,f);let R=0;if(m){x=b$,E=v$;const e=r[0];for(I=H.fromArray(a,0,I),O=H.fromArray(s,0,O),u=0;u<P;u++)x=H.fromArray(e,3*(P-1-u),x),E=H.fromArray(e,3*(P+u),E),_$.addAttribute(y,E,S),_$.addAttribute(y,x,void 0,C),S$(b,I,O,S,C,t),A=S/3,w=A+1,v=(C-2)/3,T=v-1,N[R++]=v,N[R++]=A,N[R++]=T,N[R++]=T,N[R++]=A,N[R++]=w,S+=3,C-=3}let L,M,F=0,B=0,z=i[F++],U=i[F++];for(y.set(z,S),y.set(U,C-U.length+1),O=H.fromArray(s,B,O),d=U.length-3,u=0;u<d;u+=3)L=n.geodeticSurfaceNormal(H.fromArray(z,u,w$),w$),M=n.geodeticSurfaceNormal(H.fromArray(U,d-u,E$),E$),I=H.normalize(H.add(L,M,I),I),S$(b,I,O,S,C,t),A=S/3,w=A+1,v=(C-2)/3,T=v-1,N[R++]=v,N[R++]=A,N[R++]=T,N[R++]=T,N[R++]=A,N[R++]=w,S+=3,C-=3;for(L=n.geodeticSurfaceNormal(H.fromArray(z,d,w$),w$),M=n.geodeticSurfaceNormal(H.fromArray(U,d,E$),E$),I=H.normalize(H.add(L,M,I),I),B+=3,u=0;u<o.length;u++){let e;l=o[u];const r=l.leftPositions,c=l.rightPositions;let h,p,f=T$,m=b$,_=v$;if(I=H.fromArray(a,B,I),D(r)){for(S$(b,I,O,void 0,C,t),C-=3,h=w,p=T,e=0;e<r.length/3;e++)f=H.fromArray(r,3*e,f),N[R++]=h,N[R++]=p-e-1,N[R++]=p-e,_$.addAttribute(y,f,void 0,C),m=H.fromArray(y,3*(p-e-1),m),_=H.fromArray(y,3*h,_),O=H.normalize(H.subtract(m,_,O),O),S$(b,I,O,void 0,C,t),C-=3;f=H.fromArray(y,3*h,f),m=H.subtract(H.fromArray(y,3*p,m),f,m),_=H.subtract(H.fromArray(y,3*(p-e),_),f,_),O=H.normalize(H.add(m,_,O),O),S$(b,I,O,S,void 0,t),S+=3}else{for(S$(b,I,O,S,void 0,t),S+=3,h=T,p=w,e=0;e<c.length/3;e++)f=H.fromArray(c,3*e,f),N[R++]=h,N[R++]=p+e,N[R++]=p+e+1,_$.addAttribute(y,f,S),m=H.fromArray(y,3*h,m),_=H.fromArray(y,3*(p+e),_),O=H.normalize(H.subtract(m,_,O),O),S$(b,I,O,S,void 0,t),S+=3;f=H.fromArray(y,3*h,f),m=H.subtract(H.fromArray(y,3*(p+e),m),f,m),_=H.subtract(H.fromArray(y,3*p,_),f,_),O=H.normalize(H.negate(H.add(_,m,O),O),O),S$(b,I,O,void 0,C,t),C-=3}for(z=i[F++],U=i[F++],z.splice(0,3),U.splice(U.length-3,3),y.set(z,S),y.set(U,C-U.length+1),d=U.length-3,B+=3,O=H.fromArray(s,B,O),e=0;e<U.length;e+=3)L=n.geodeticSurfaceNormal(H.fromArray(z,e,w$),w$),M=n.geodeticSurfaceNormal(H.fromArray(U,d-e,E$),E$),I=H.normalize(H.add(L,M,I),I),S$(b,I,O,S,C,t),w=S/3,A=w-1,T=(C-2)/3,v=T+1,N[R++]=v,N[R++]=A,N[R++]=T,N[R++]=T,N[R++]=A,N[R++]=w,S+=3,C-=3;S-=3,C+=3}if(I=H.fromArray(a,a.length-3,I),S$(b,I,O,S,C,t),m){S+=3,C-=3,x=b$,E=v$;const e=r[1];for(u=0;u<P;u++)x=H.fromArray(e,3*(_-u-1),x),E=H.fromArray(e,3*u,E),_$.addAttribute(y,x,void 0,C),_$.addAttribute(y,E,S),S$(b,I,O,S,C,t),w=S/3,A=w-1,T=(C-2)/3,v=T+1,N[R++]=v,N[R++]=A,N[R++]=T,N[R++]=T,N[R++]=A,N[R++]=w,S+=3,C-=3}if(c.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:y}),t.st){const e=new Float32Array(g/3*2);let t,n,i=0;if(m){h/=3,p/=3;const o=Math.PI/(_+1);let r;n=1/(h-_+1),t=1/(p-_+1);const s=_/2;for(u=s+1;u<_+1;u++)r=V.PI_OVER_TWO+o*u,e[i++]=t*(1+Math.cos(r)),e[i++]=.5*(1+Math.sin(r));for(u=1;u<p-_+1;u++)e[i++]=u*t,e[i++]=0;for(u=_;u>s;u--)r=V.PI_OVER_TWO-u*o,e[i++]=1-t*(1+Math.cos(r)),e[i++]=.5*(1+Math.sin(r));for(u=s;u>0;u--)r=V.PI_OVER_TWO-o*u,e[i++]=1-n*(1+Math.cos(r)),e[i++]=.5*(1+Math.sin(r));for(u=h-_;u>0;u--)e[i++]=u*n,e[i++]=1;for(u=1;u<s+1;u++)r=V.PI_OVER_TWO+o*u,e[i++]=n*(1+Math.cos(r)),e[i++]=.5*(1+Math.sin(r))}else{for(h/=3,p/=3,n=1/(h-1),t=1/(p-1),u=0;u<p;u++)e[i++]=u*t,e[i++]=0;for(u=h;u>0;u--)e[i++]=(u-1)*n,e[i++]=1}c.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:e})}return t.normal&&(c.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:b.normals})),t.tangent&&(c.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:b.tangents})),t.bitangent&&(c.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:b.bitangents})),{attributes:c,indices:N}}function I$(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(let i=3;i<e.length;i+=3){const o=e[i],r=e[i+1],s=e[i+2];n[t++]=o,n[t++]=r,n[t++]=s,n[t++]=o,n[t++]=r,n[t++]=s}return n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n}function O$(e,t){const n=new Bd({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),i=e.ellipsoid,o=C$(_$.computePositions(e),n,i),r=e.height,s=e.extrudedHeight;let a=o.attributes;const c=o.indices;let l=a.position.values,u=l.length;const d=new Float64Array(6*u);let h=new Float64Array(u);h.set(l);let p,f=new Float64Array(4*u);l=$O.scaleToGeodeticHeight(l,r,i),f=I$(l,0,f),h=$O.scaleToGeodeticHeight(h,s,i),f=I$(h,2*u,f),d.set(l),d.set(h,u),d.set(f,2*u),a.position.values=d,a=function(e,t){if(!(t.normal||t.tangent||t.bitangent||t.st))return e;const n=e.position.values;let i,o;(t.normal||t.bitangent)&&(i=e.normal.values,o=e.bitangent.values);const r=e.position.values.length/18,s=3*r,a=2*r,c=2*s;let l;if(t.normal||t.bitangent||t.tangent){const r=t.normal?new Float32Array(6*s):void 0,a=t.tangent?new Float32Array(6*s):void 0,u=t.bitangent?new Float32Array(6*s):void 0;let d=g$,h=y$,p=b$,f=v$,m=A$,_=T$,g=c;for(l=0;l<s;l+=3){const e=g+c;d=H.fromArray(n,l,d),h=H.fromArray(n,l+s,h),p=H.fromArray(n,(l+3)%s,p),h=H.subtract(h,d,h),p=H.subtract(p,d,p),f=H.normalize(H.cross(h,p,f),f),t.normal&&(_$.addAttribute(r,f,e),_$.addAttribute(r,f,e+3),_$.addAttribute(r,f,g),_$.addAttribute(r,f,g+3)),(t.tangent||t.bitangent)&&(_=H.fromArray(i,l,_),t.bitangent&&(_$.addAttribute(u,_,e),_$.addAttribute(u,_,e+3),_$.addAttribute(u,_,g),_$.addAttribute(u,_,g+3)),t.tangent&&(m=H.normalize(H.cross(_,f,m),m),_$.addAttribute(a,m,e),_$.addAttribute(a,m,e+3),_$.addAttribute(a,m,g),_$.addAttribute(a,m,g+3))),g+=6}if(t.normal){for(r.set(i),l=0;l<s;l+=3)r[l+s]=-i[l],r[l+s+1]=-i[l+1],r[l+s+2]=-i[l+2];e.normal.values=r}else e.normal=void 0;if(t.bitangent?(u.set(o),u.set(o,s),e.bitangent.values=u):e.bitangent=void 0,t.tangent){const t=e.tangent.values;a.set(t),a.set(t,s),e.tangent.values=a}}if(t.st){const t=e.st.values,n=new Float32Array(6*a);n.set(t),n.set(t,a);let i=2*a;for(let e=0;e<2;e++){for(n[i++]=t[0],n[i++]=t[1],l=2;l<a;l+=2){const e=t[l],o=t[l+1];n[i++]=e,n[i++]=o,n[i++]=e,n[i++]=o}n[i++]=t[0],n[i++]=t[1]}e.st.values=n}return e}(a,t);const m=u/3;if(e.shadowVolume){const e=a.normal.values;u=e.length;let n=new Float32Array(6*u);for(p=0;p<u;p++)e[p]=-e[p];n.set(e,u),n=I$(e,4*u,n),a.extrudeDirection=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:n}),t.normal||(a.normal=void 0)}if(D(e.offsetAttribute)){let t=new Uint8Array(6*m);if(e.offsetAttribute===Fd.TOP)t=t.fill(1,0,m).fill(1,2*m,4*m);else{const n=e.offsetAttribute===Fd.NONE?0:1;t=t.fill(n)}a.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}const _=c.length,g=m+m,y=je.createTypedArray(d.length/3,2*_+3*g);y.set(c);let b,v,A,T,w=_;for(p=0;p<_;p+=3){const e=c[p],t=c[p+1],n=c[p+2];y[w++]=n+m,y[w++]=t+m,y[w++]=e+m}for(p=0;p<g;p+=2)b=p+g,v=b+g,A=b+1,T=v+1,y[w++]=b,y[w++]=v,y[w++]=A,y[w++]=A,y[w++]=v,y[w++]=T;return{attributes:a,indices:y}}const D$=new H,P$=new H,N$=new Qt;function R$(e,t,n,i,o,r){const s=H.subtract(t,e,D$);H.normalize(s,s);const a=n.geodeticSurfaceNormal(e,P$),c=H.cross(s,a,D$);H.multiplyByScalar(c,i,c);let l=o.latitude,u=o.longitude,d=r.latitude,h=r.longitude;H.add(e,c,P$),n.cartesianToCartographic(P$,N$);let p=N$.latitude,f=N$.longitude;l=Math.min(l,p),u=Math.min(u,f),d=Math.max(d,p),h=Math.max(h,f),H.subtract(e,c,P$),n.cartesianToCartographic(P$,N$),p=N$.latitude,f=N$.longitude,l=Math.min(l,p),u=Math.min(u,f),d=Math.max(d,p),h=Math.max(h,f),o.latitude=l,o.longitude=u,r.latitude=d,r.longitude=h}const L$=new H,M$=new H,F$=new Qt,B$=new Qt;function z$(e,t,n,i,o){const r=Ry(e=x$(e,t),H.equalsEpsilon),s=r.length;if(s<2||n<=0)return new Ir;const a=.5*n;let c,l;if(F$.latitude=Number.POSITIVE_INFINITY,F$.longitude=Number.POSITIVE_INFINITY,B$.latitude=Number.NEGATIVE_INFINITY,B$.longitude=Number.NEGATIVE_INFINITY,i===uQ.ROUNDED){const e=r[0];H.subtract(e,r[1],L$),H.normalize(L$,L$),H.multiplyByScalar(L$,a,L$),H.add(e,L$,M$),t.cartesianToCartographic(M$,N$),c=N$.latitude,l=N$.longitude,F$.latitude=Math.min(F$.latitude,c),F$.longitude=Math.min(F$.longitude,l),B$.latitude=Math.max(B$.latitude,c),B$.longitude=Math.max(B$.longitude,l)}for(let h=0;h<s-1;++h)R$(r[h],r[h+1],t,a,F$,B$);const u=r[s-1];H.subtract(u,r[s-2],L$),H.normalize(L$,L$),H.multiplyByScalar(L$,a,L$),H.add(u,L$,M$),R$(u,M$,t,a,F$,B$),i===uQ.ROUNDED&&(t.cartesianToCartographic(M$,N$),c=N$.latitude,l=N$.longitude,F$.latitude=Math.min(F$.latitude,c),F$.longitude=Math.min(F$.longitude,l),B$.latitude=Math.max(B$.latitude,c),B$.longitude=Math.max(B$.longitude,l));const d=D(o)?o:new Ir;return d.north=B$.latitude,d.south=F$.latitude,d.east=B$.longitude,d.west=F$.longitude,d}function U$(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions,n=e.width;L.defined("options.positions",t),L.defined("options.width",n);const i=M(e.height,0),o=M(e.extrudedHeight,i);this._positions=t,this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._vertexFormat=Bd.clone(M(e.vertexFormat,Bd.DEFAULT)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=M(e.cornerType,uQ.ROUNDED),this._granularity=M(e.granularity,V.RADIANS_PER_DEGREE),this._shadowVolume=M(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*H.packedLength+on.packedLength+Bd.packedLength+7}U$.pack=function(e,t,n){L.defined("value",e),L.defined("array",t),n=M(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=H.packedLength)H.pack(i[r],t,n);return on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n++]=e._shadowVolume?1:0,t[n]=M(e._offsetAttribute,-1),t};const k$=on.clone(on.UNIT_SPHERE),V$=new Bd,H$={positions:void 0,ellipsoid:k$,vertexFormat:V$,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};U$.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=e[t++],o=new Array(i);for(let f=0;f<i;++f,t+=H.packedLength)o[f]=H.unpack(e,t);const r=on.unpack(e,t,k$);t+=on.packedLength;const s=Bd.unpack(e,t,V$);t+=Bd.packedLength;const a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=1===e[t++],p=e[t];return D(n)?(n._positions=o,n._ellipsoid=on.clone(r,n._ellipsoid),n._vertexFormat=Bd.clone(s,n._vertexFormat),n._width=a,n._height=c,n._extrudedHeight=l,n._cornerType=u,n._granularity=d,n._shadowVolume=h,n._offsetAttribute=-1===p?void 0:p,n):(H$.positions=o,H$.width=a,H$.height=c,H$.extrudedHeight=l,H$.cornerType=u,H$.granularity=d,H$.shadowVolume=h,H$.offsetAttribute=-1===p?void 0:p,new U$(H$))},U$.computeRectangle=function(e,t){const n=(e=M(e,M.EMPTY_OBJECT)).positions,i=e.width;L.defined("options.positions",n),L.defined("options.width",i);return z$(n,M(e.ellipsoid,on.WGS84),i,M(e.cornerType,uQ.ROUNDED),t)},U$.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=x$(t,i);const o=Ry(t,H.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!V.equalsEpsilon(r,s,0,V.EPSILON2),c=e._vertexFormat,l={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};let u;if(a)l.height=r,l.extrudedHeight=s,l.shadowVolume=e._shadowVolume,l.offsetAttribute=e._offsetAttribute,u=O$(l,c);else{if(u=C$(_$.computePositions(l),c,i),u.attributes.position.values=$O.scaleToGeodeticHeight(u.attributes.position.values,r,i),D(e._offsetAttribute)){const t=e._offsetAttribute===Fd.NONE?0:1,n=u.attributes.position.values.length,i=new Uint8Array(n/3).fill(t);u.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}}const d=u.attributes,h=$u.fromVertices(d.position.values,void 0,3);return c.position||(u.attributes.position.values=void 0),new Na({attributes:d,indices:u.indices,primitiveType:Vr.TRIANGLES,boundingSphere:h,offsetAttribute:e._offsetAttribute})},U$.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new U$({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:o,granularity:i,extrudedHeight:r,height:s,vertexFormat:Bd.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(U$.prototype,{rectangle:{get:function(){return D(this._rectangle)||(this._rectangle=z$(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});const G$=new H,j$=new H,W$=new H;function q$(e,t){const n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new Md;let a,c,l,u=0,d=0,h=0;for(c=0;c<i.length;c+=2)l=i[c].length-3,u+=l,h+=l/3*4,d+=i[c+1].length-3;for(u+=3,d+=3,c=0;c<o.length;c++){a=o[c];const e=o[c].leftPositions;D(e)?(l=e.length,u+=l,h+=l/3*2):(l=o[c].rightPositions.length,d+=l,h+=l/3*2)}const p=D(r);let f;p&&(f=r[0].length-3,u+=f,d+=f,f/=3,h+=4*f);const m=u+d,_=new Float64Array(m);let g,y,b,v,A,T,w=0,E=m-1;const x=f/2,S=je.createTypedArray(m/3,h+4);let C=0;if(S[C++]=w/3,S[C++]=(E-2)/3,p){n.push(w/3),T=G$,A=j$;const e=r[0];for(c=0;c<x;c++)T=H.fromArray(e,3*(x-1-c),T),A=H.fromArray(e,3*(x+c),A),_$.addAttribute(_,A,w),_$.addAttribute(_,T,void 0,E),y=w/3,v=y+1,g=(E-2)/3,b=g-1,S[C++]=g,S[C++]=b,S[C++]=y,S[C++]=v,w+=3,E-=3}let I=0,O=i[I++],P=i[I++];for(_.set(O,w),_.set(P,E-P.length+1),l=P.length-3,n.push(w/3,(E-2)/3),c=0;c<l;c+=3)y=w/3,v=y+1,g=(E-2)/3,b=g-1,S[C++]=g,S[C++]=b,S[C++]=y,S[C++]=v,w+=3,E-=3;for(c=0;c<o.length;c++){let e;a=o[c];const r=a.leftPositions,s=a.rightPositions;let u,d=W$;if(D(r)){for(E-=3,u=b,n.push(v),e=0;e<r.length/3;e++)d=H.fromArray(r,3*e,d),S[C++]=u-e-1,S[C++]=u-e,_$.addAttribute(_,d,void 0,E),E-=3;n.push(u-Math.floor(r.length/6)),t===uQ.BEVELED&&n.push((E-2)/3+1),w+=3}else{for(w+=3,u=v,n.push(b),e=0;e<s.length/3;e++)d=H.fromArray(s,3*e,d),S[C++]=u+e,S[C++]=u+e+1,_$.addAttribute(_,d,w),w+=3;n.push(u+Math.floor(s.length/6)),t===uQ.BEVELED&&n.push(w/3-1),E-=3}for(O=i[I++],P=i[I++],O.splice(0,3),P.splice(P.length-3,3),_.set(O,w),_.set(P,E-P.length+1),l=P.length-3,e=0;e<P.length;e+=3)v=w/3,y=v-1,b=(E-2)/3,g=b+1,S[C++]=g,S[C++]=b,S[C++]=y,S[C++]=v,w+=3,E-=3;w-=3,E+=3,n.push(w/3,(E-2)/3)}if(p){w+=3,E-=3,T=G$,A=j$;const e=r[1];for(c=0;c<x;c++)T=H.fromArray(e,3*(f-c-1),T),A=H.fromArray(e,3*c,A),_$.addAttribute(_,T,void 0,E),_$.addAttribute(_,A,w),v=w/3,y=v-1,b=(E-2)/3,g=b+1,S[C++]=g,S[C++]=b,S[C++]=y,S[C++]=v,w+=3,E-=3;n.push(w/3)}else n.push(w/3,(E-2)/3);return S[C++]=w/3,S[C++]=(E-2)/3,s.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:_}),{attributes:s,indices:S,wallIndices:n}}function Y$(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions,n=e.width;L.typeOf.object("options.positions",t),L.typeOf.number("options.width",n);const i=M(e.height,0),o=M(e.extrudedHeight,i);this._positions=t,this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=M(e.cornerType,uQ.ROUNDED),this._granularity=M(e.granularity,V.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*H.packedLength+on.packedLength+6}Y$.pack=function(e,t,n){L.typeOf.object("value",e),L.typeOf.object("array",t),n=M(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=H.packedLength)H.pack(i[r],t,n);return on.pack(e._ellipsoid,t,n),n+=on.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n]=M(e._offsetAttribute,-1),t};const X$=on.clone(on.UNIT_SPHERE),Q$={positions:void 0,ellipsoid:X$,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};Y$.unpack=function(e,t,n){L.typeOf.object("array",e),t=M(t,0);const i=e[t++],o=new Array(i);for(let h=0;h<i;++h,t+=H.packedLength)o[h]=H.unpack(e,t);const r=on.unpack(e,t,X$);t+=on.packedLength;const s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t];return D(n)?(n._positions=o,n._ellipsoid=on.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=c,n._cornerType=l,n._granularity=u,n._offsetAttribute=-1===d?void 0:d,n):(Q$.positions=o,Q$.width=s,Q$.height=a,Q$.extrudedHeight=c,Q$.cornerType=l,Q$.granularity=u,Q$.offsetAttribute=-1===d?void 0:d,new Y$(Q$))},Y$.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=function(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}(t,i);const o=Ry(t,H.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!V.equalsEpsilon(r,s,0,V.EPSILON2),c={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};let l;if(a)c.height=r,c.extrudedHeight=s,c.offsetAttribute=e._offsetAttribute,l=function(e){const t=e.ellipsoid,n=q$(_$.computePositions(e),e.cornerType),i=n.wallIndices,o=e.height,r=e.extrudedHeight,s=n.attributes,a=n.indices;let c=s.position.values,l=c.length,u=new Float64Array(l);u.set(c);const d=new Float64Array(2*l);if(c=$O.scaleToGeodeticHeight(c,o,t),u=$O.scaleToGeodeticHeight(u,r,t),d.set(c),d.set(u,l),s.position.values=d,l/=3,D(e.offsetAttribute)){let t=new Uint8Array(2*l);if(e.offsetAttribute===Fd.TOP)t=t.fill(1,0,l);else{const n=e.offsetAttribute===Fd.NONE?0:1;t=t.fill(n)}s.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}let h;const p=a.length,f=je.createTypedArray(d.length/3,2*(p+i.length));f.set(a);let m,_,g=p;for(h=0;h<p;h+=2){const e=a[h],t=a[h+1];f[g++]=e+l,f[g++]=t+l}for(h=0;h<i.length;h++)m=i[h],_=m+l,f[g++]=m,f[g++]=_;return{attributes:s,indices:f}}(c);else{if(l=q$(_$.computePositions(c),c.cornerType),l.attributes.position.values=$O.scaleToGeodeticHeight(l.attributes.position.values,r,i),D(e._offsetAttribute)){const t=l.attributes.position.values.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);l.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}}const u=l.attributes,d=$u.fromVertices(u.position.values,void 0,3);return new Na({attributes:u,indices:l.indices,primitiveType:Vr.LINES,boundingSphere:d,offsetAttribute:e._offsetAttribute})};const $$=new mu(0);function K$(e){DA.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}D(Object.create)&&(K$.prototype=Object.create(DA.prototype),K$.prototype.constructor=K$),Object.defineProperties(K$.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),K$.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!D(t.height)&&!D(t.extrudedHeight)&&gy.isSupported(this._scene)},K$.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight;return 0===t||D(n)&&n!==t},K$.prototype._computeCenter=P.throwInstantiationError,K$.prototype._onEntityPropertyChanged=function(e,t,n,i){if(DA.prototype._onEntityPropertyChanged.call(this,e,t,n,i),-1===this._observedPropertyNames.indexOf(t))return;const o=this._entity[this._geometryPropertyName];if(!D(o))return;D(o.zIndex)&&(D(o.height)||D(o.extrudedHeight))&&Oa(Oa.geometryZIndex),this._zIndex=M(o.zIndex,$$),D(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference,s=o.extrudedHeightReference;if(D(r)||D(s)){const e=new PA(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new RA(this._scene,e,r,s)}},K$.prototype.destroy=function(){D(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),DA.prototype.destroy.call(this)},K$.getGeometryHeight=function(e,t){if(L.defined("heightReference",t),D(e))return Eu(t)?0:e;t!==wu.NONE&&Oa(Oa.geometryHeightReference)},K$.getGeometryExtrudedHeight=function(e,t){if(L.defined("extrudedHeightReference",t),D(e))return Eu(t)?K$.CLAMP_TO_GROUND:e;t!==wu.NONE&&Oa(Oa.geometryExtrudedHeightReference)},K$.CLAMP_TO_GROUND="clamp",K$.computeGeometryOffsetAttribute=function(e,t,n,i){D(e)&&D(t)||(t=wu.NONE),D(n)&&D(i)||(i=wu.NONE);let o=0;return t!==wu.NONE&&o++,i===wu.RELATIVE_TO_GROUND&&o++,2===o?Fd.ALL:1===o?Fd.TOP:void 0};const Z$=new Ot,J$=H.ZERO,eK=new H,tK=new Ir;function nK(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 iK(e,t){K$.call(this,{entity:e,scene:t,geometryOptions:new nK(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}function oK(e,t,n){Dy.call(this,e,t,n)}function rK(){P.throwInstantiationError()}function sK(e,t){L.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new H,this._cameraPositionInScaledSpace=new H,this._distanceToLimbInScaledSpaceSquared=0,D(t)&&(this.cameraPosition=t)}D(Object.create)&&(iK.prototype=Object.create(K$.prototype),iK.prototype.constructor=iK),iK.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,Z$)),D(t)||(t=Ot.WHITE),i.color=$d.fromColor(t)}return D(this._options.offsetAttribute)&&(i.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,J$,eK))),new Zd({id:t,geometry:new U$(this._options),attributes:i})},iK.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,Z$),o={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return D(this._options.offsetAttribute)&&(o.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,J$,eK))),new Zd({id:t,geometry:new Y$(this._options),attributes:o})},iK.prototype._computeCenter=function(e,t){const n=Ou.getValueOrUndefined(this._entity.corridor.positions,e);if(D(n)&&0!==n.length)return H.clone(n[Math.floor(n.length/2)],t)},iK.prototype._isHidden=function(e,t){return!D(t.positions)||!D(t.width)||DA.prototype._isHidden.call(this,e,t)},iK.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Ou.isConstant(t.height)||!Ou.isConstant(t.extrudedHeight)||!Ou.isConstant(t.granularity)||!Ou.isConstant(t.width)||!Ou.isConstant(t.outlineWidth)||!Ou.isConstant(t.cornerType)||!Ou.isConstant(t.zIndex)||this._onTerrain&&!Ou.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Oh)},iK.prototype._setStaticOptions=function(e,t){let n=Ou.getValueOrUndefined(t.height,ih.MINIMUM_VALUE);const i=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE);let o=Ou.getValueOrUndefined(t.extrudedHeight,ih.MINIMUM_VALUE);const r=Ou.getValueOrDefault(t.extrudedHeightReference,ih.MINIMUM_VALUE,wu.NONE);D(o)&&!D(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof Oh?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(ih.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(ih.MINIMUM_VALUE),s.granularity=Ou.getValueOrUndefined(t.granularity,ih.MINIMUM_VALUE),s.cornerType=Ou.getValueOrUndefined(t.cornerType,ih.MINIMUM_VALUE),s.offsetAttribute=K$.computeGeometryOffsetAttribute(n,i,o,r),s.height=K$.getGeometryHeight(n,i),o=K$.getGeometryExtrudedHeight(o,r),o===K$.CLAMP_TO_GROUND&&(o=Hh.getMinimumMaximumHeights(U$.computeRectangle(s,tK)).minimumTerrainHeight),s.extrudedHeight=o},iK.DynamicGeometryUpdater=oK,D(Object.create)&&(oK.prototype=Object.create(Dy.prototype),oK.prototype.constructor=oK),oK.prototype._isHidden=function(e,t,n){const i=this._options;return!D(i.positions)||!D(i.width)||Dy.prototype._isHidden.call(this,e,t,n)},oK.prototype._setOptions=function(e,t,n){const i=this._options;let o=Ou.getValueOrUndefined(t.height,n);const r=Ou.getValueOrDefault(t.heightReference,n,wu.NONE);let s=Ou.getValueOrUndefined(t.extrudedHeight,n);const a=Ou.getValueOrDefault(t.extrudedHeightReference,n,wu.NONE);D(s)&&!D(o)&&(o=0),i.positions=Ou.getValueOrUndefined(t.positions,n),i.width=Ou.getValueOrUndefined(t.width,n),i.granularity=Ou.getValueOrUndefined(t.granularity,n),i.cornerType=Ou.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=K$.computeGeometryOffsetAttribute(o,r,s,a),i.height=K$.getGeometryHeight(o,r),s=K$.getGeometryExtrudedHeight(s,a),s===K$.CLAMP_TO_GROUND&&(s=Hh.getMinimumMaximumHeights(U$.computeRectangle(i,tK)).minimumTerrainHeight),i.extrudedHeight=s},Object.defineProperties(rK.prototype,{name:{get:P.throwInstantiationError},clock:{get:P.throwInstantiationError},entities:{get:P.throwInstantiationError},isLoading:{get:P.throwInstantiationError},changedEvent:{get:P.throwInstantiationError},errorEvent:{get:P.throwInstantiationError},loadingEvent:{get:P.throwInstantiationError},show:{get:P.throwInstantiationError},clustering:{get:P.throwInstantiationError}}),rK.prototype.update=function(e){P.throwInstantiationError()},rK.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))},Object.defineProperties(sK.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){const t=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),n=H.magnitudeSquared(t)-1;H.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=t,this._distanceToLimbInScaledSpaceSquared=n}}});const aK=new H;sK.prototype.isPointVisible=function(e){return _K(this._ellipsoid.transformPositionToScaledSpace(e,aK),this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)},sK.prototype.isScaledSpacePointVisible=function(e){return _K(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const cK=new H;sK.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){const n=this._ellipsoid;let i,o;return D(t)&&t<0&&n.minimumRadius>-t?(o=cK,o.x=this._cameraPosition.x/(n.radii.x+t),o.y=this._cameraPosition.y/(n.radii.y+t),o.z=this._cameraPosition.z/(n.radii.z+t),i=o.x*o.x+o.y*o.y+o.z*o.z-1):(o=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),_K(e,o,i)},sK.prototype.computeHorizonCullingPoint=function(e,t,n){return pK(this._ellipsoid,e,t,n)};const lK=on.clone(on.UNIT_SPHERE);sK.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){return pK(hK(this._ellipsoid,n,lK),e,t,i)},sK.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return mK(this._ellipsoid,e,t,n,i,o)},sK.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){return mK(hK(this._ellipsoid,o,lK),e,t,n,i,r)};const uK=[];sK.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){L.typeOf.object("rectangle",e);const i=Ir.subsample(e,t,0,uK),o=$u.fromPoints(i);if(!(H.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};const dK=new H;function hK(e,t,n){if(D(t)&&t<0&&e.minimumRadius>-t){const i=H.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,dK);e=on.fromCartesian3(i,n)}return e}function pK(e,t,n,i){L.typeOf.object("directionToPoint",t),L.defined("positions",n),D(i)||(i=new H);const o=TK(e,t);let r=0;for(let s=0,a=n.length;s<a;++s){const t=bK(e,n[s],o);if(t<0)return;r=Math.max(r,t)}return vK(o,r,i)}const fK=new H;function mK(e,t,n,i,o,r){L.typeOf.object("directionToPoint",t),L.defined("vertices",n),L.typeOf.number("stride",i),D(r)||(r=new H),i=M(i,3),o=M(o,H.ZERO);const s=TK(e,t);let a=0;for(let c=0,l=n.length;c<l;c+=i){fK.x=n[c]+o.x,fK.y=n[c+1]+o.y,fK.z=n[c+2]+o.z;const t=bK(e,fK,s);if(t<0)return;a=Math.max(a,t)}return vK(s,a,r)}function _K(e,t,n){const i=t,o=n,r=H.subtract(e,i,aK),s=-H.dot(r,i);return!(o<0?s>0:s>o&&s*s/H.magnitudeSquared(r)>o)}const gK=new H,yK=new H;function bK(e,t,n){const i=e.transformPositionToScaledSpace(t,gK);let o=H.magnitudeSquared(i),r=Math.sqrt(o);const s=H.divideByScalar(i,r,yK);o=Math.max(1,o),r=Math.max(1,r);const a=1/r;return 1/(H.dot(s,n)*a-H.magnitude(H.cross(s,n,s))*(Math.sqrt(o-1)*a))}function vK(e,t,n){if(!(t<=0||t===1/0||t!=t))return H.multiplyByScalar(e,t,n)}const AK=new H;function TK(e,t){return H.equals(t,H.ZERO)?t:(e.transformPositionToScaledSpace(t,AK),H.normalize(AK,AK))}function wK(e,t){if(D((e=M(e,M.EMPTY_OBJECT)).disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new P("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;if(D(n)){if(n.far<=n.near)throw new P("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Au.clone(n)}if(D(i)){if(i.far<=i.near)throw new P("scaleByDistance.far must be greater than scaleByDistance.near.");i=Au.clone(i)}if(D(o)){if(o.far<=o.near)throw new P("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=vu.clone(o)}this._show=M(e.show,!0),this._position=H.clone(M(e.position,H.ZERO)),this._actualPosition=H.clone(this._position),this._color=Ot.clone(M(e.color,Ot.WHITE)),this._outlineColor=Ot.clone(M(e.outlineColor,Ot.TRANSPARENT)),this._outlineWidth=M(e.outlineWidth,0),this._pixelSize=M(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=M(e.disableDepthTestDistance,0),this._id=e.id,this._collection=M(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}const EK=wK.SHOW_INDEX=0,xK=wK.POSITION_INDEX=1,SK=wK.COLOR_INDEX=2,CK=wK.OUTLINE_COLOR_INDEX=3,IK=wK.OUTLINE_WIDTH_INDEX=4,OK=wK.PIXEL_SIZE_INDEX=5,DK=wK.SCALE_BY_DISTANCE_INDEX=6,PK=wK.TRANSLUCENCY_BY_DISTANCE_INDEX=7,NK=wK.DISTANCE_DISPLAY_CONDITION_INDEX=8,RK=wK.DISABLE_DEPTH_DISTANCE_INDEX=9;function LK(e,t){const n=e._pointPrimitiveCollection;D(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}wK.NUMBER_OF_PROPERTIES=10,Object.defineProperties(wK.prototype,{show:{get:function(){return this._show},set:function(e){if(!D(e))throw new P("value is required.");this._show!==e&&(this._show=e,LK(this,EK))}},position:{get:function(){return this._position},set:function(e){if(!D(e))throw new P("value is required.");const t=this._position;H.equals(t,e)||(H.clone(e,t),H.clone(e,this._actualPosition),LK(this,xK))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far distance must be greater than near distance.");const t=this._scaleByDistance;Au.equals(t,e)||(this._scaleByDistance=Au.clone(e,t),LK(this,DK))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far distance must be greater than near distance.");const t=this._translucencyByDistance;Au.equals(t,e)||(this._translucencyByDistance=Au.clone(e,t),LK(this,PK))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!D(e))throw new P("value is required.");this._pixelSize!==e&&(this._pixelSize=e,LK(this,OK))}},color:{get:function(){return this._color},set:function(e){if(!D(e))throw new P("value is required.");const t=this._color;Ot.equals(t,e)||(Ot.clone(e,t),LK(this,SK))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!D(e))throw new P("value is required.");const t=this._outlineColor;Ot.equals(t,e)||(Ot.clone(e,t),LK(this,CK))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!D(e))throw new P("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,LK(this,IK))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(D(e)&&e.far<=e.near)throw new P("far must be greater than near");vu.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=vu.clone(e,this._distanceDisplayCondition),LK(this,NK))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(!D(e)||e<0)throw new P("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance=e,LK(this,RK)}}},id:{get:function(){return this._id},set:function(e){this._id=e,D(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,LK(this,EK))}}}),wK.prototype.getPickId=function(e){return D(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},wK.prototype._getActualPosition=function(){return this._actualPosition},wK.prototype._setActualPosition=function(e){H.clone(e,this._actualPosition),LK(this,xK)};const MK=new K;wK._computeActualPosition=function(e,t,n){return t.mode===gl.SCENE3D?e:(ve.multiplyByPoint(n,e,MK),QR.computeActualWgs84Position(t,MK))};const FK=new K;wK._computeScreenSpacePosition=function(e,t,n,i){const o=ve.multiplyByVector(e,K.fromElements(t.x,t.y,t.z,1,FK),FK);return QR.wgs84ToWindowCoordinates(n,o,i)},wK.prototype.computeScreenSpacePosition=function(e,t){const n=this._pointPrimitiveCollection;if(D(t)||(t=new kt),!D(n))throw new P("PointPrimitive must be in a collection.");if(!D(e))throw new P("scene is required.");const i=n.modelMatrix,o=wK._computeScreenSpacePosition(i,this._actualPosition,e,t);if(D(o))return o.y=e.canvas.clientHeight-o.y,o},wK.getScreenSpaceBoundingBox=function(e,t,n){const i=e.pixelSize,o=.5*i,r=t.x-o,s=t.y-o,a=i,c=i;return D(n)||(n=new Fr),n.x=r,n.y=s,n.width=a,n.height=c,n},wK.prototype.equals=function(e){return this===e||D(e)&&this._id===e._id&&H.equals(this._position,e._position)&&Ot.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&Ot.equals(this._outlineColor,e._outlineColor)&&Au.equals(this._scaleByDistance,e._scaleByDistance)&&Au.equals(this._translucencyByDistance,e._translucencyByDistance)&&vu.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance},wK.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};const BK="in vec4 v_color;\nin vec4 v_outlineColor;\nin float v_innerPercent;\nin float v_pixelDistance;\nin vec4 v_pickColor;\n\nvoid main()\n{\n // The distance in UV space from this fragment to the center of the point, at most 0.5.\n float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.\n float maxDistance = max(0.0, 0.5 - v_pixelDistance);\n float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\n float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\n\n vec4 color = mix(v_outlineColor, v_color, innerAlpha);\n color.a *= wholeAlpha;\n\n// Fully transparent parts of the billboard are not pickable.\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\n if (color.a < 0.005) // matches 0/255 and 1/255\n {\n discard;\n }\n#else\n// The billboard is rendered twice. The opaque pass discards translucent fragments\n// and the translucent pass discards opaque fragments.\n#ifdef OPAQUE\n if (color.a < 0.995) // matches < 254/255\n {\n discard;\n }\n#else\n if (color.a >= 0.995) // matches 254/255 and 255/255\n {\n discard;\n }\n#endif\n#endif\n\n out_FragColor = czm_gammaCorrect(color);\n czm_writeLogDepth();\n}\n",zK=wK.SHOW_INDEX,UK=wK.POSITION_INDEX,kK=wK.COLOR_INDEX,VK=wK.OUTLINE_COLOR_INDEX,HK=wK.OUTLINE_WIDTH_INDEX,GK=wK.PIXEL_SIZE_INDEX,jK=wK.SCALE_BY_DISTANCE_INDEX,WK=wK.TRANSLUCENCY_BY_DISTANCE_INDEX,qK=wK.DISTANCE_DISPLAY_CONDITION_INDEX,YK=wK.DISABLE_DEPTH_DISTANCE_INDEX,XK=wK.NUMBER_OF_PROPERTIES,QK={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function $K(e){e=M(e,M.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(XK),this._maxPixelSize=1,this._baseVolume=new $u,this._baseVolumeWC=new $u,this._baseVolume2D=new $u,this._boundingVolume=new $u,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=M(e.show,!0),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._modelMatrix=ve.clone(ve.IDENTITY),this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.blendOption=M(e.blendOption,Rk.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=gl.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW,qe.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}function KK(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}function ZK(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;const t=[],n=e._pointPrimitives,i=n.length;for(let e=0,o=0;e<i;++e){const i=n[e];i&&(i._index=o++,t.push(i))}e._pointPrimitives=t}}Object.defineProperties($K.prototype,{length:{get:function(){return ZK(this),this._pointPrimitives.length}}}),$K.prototype.add=function(e){const t=new wK(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},$K.prototype.remove=function(e){return!!this.contains(e)&&(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0)},$K.prototype.removeAll=function(){KK(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},$K.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},$K.prototype.contains=function(e){return D(e)&&e._pointPrimitiveCollection===this},$K.prototype.get=function(e){if(!D(e))throw new P("index is required.");return ZK(this),this._pointPrimitives[e]},$K.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<XK;++i){const o=0===n[i]?qe.STATIC_DRAW:qe.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};const JK=new Ic;function eZ(e,t,n,i){const o=i._index,r=i._getActualPosition();e._mode===gl.SCENE3D&&($u.expand(e._baseVolume,r,e._baseVolume),e._boundingVolumeDirty=!0),Ic.fromCartesian(r,JK);const s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);const c=n[QK.positionHighAndSize],l=JK.high;c(o,l.x,l.y,l.z,s);const u=n[QK.positionLowAndOutline],d=JK.low;u(o,d.x,d.y,d.z,a)}const tZ=65536,nZ=256;function iZ(e,t,n,i){const o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor;let c=Ot.floatToByte(r.red),l=Ot.floatToByte(r.green),u=Ot.floatToByte(r.blue);const d=c*tZ+l*nZ+u;c=Ot.floatToByte(a.red),l=Ot.floatToByte(a.green),u=Ot.floatToByte(a.blue);const h=c*tZ+l*nZ+u;c=Ot.floatToByte(s.red),l=Ot.floatToByte(s.green),u=Ot.floatToByte(s.blue);const p=c*tZ+l*nZ+u,f=Ot.floatToByte(r.alpha)*tZ+Ot.floatToByte(a.alpha)*nZ+Ot.floatToByte(s.alpha);(0,n[QK.compressedAttribute0])(o,d,h,p,f)}function oZ(e,t,n,i){const o=i._index;let r=0,s=1,a=1,c=1;const l=i.translucencyByDistance;D(l)&&(r=l.near,s=l.nearValue,a=l.far,c=l.farValue,1===s&&1===c||(e._shaderTranslucencyByDistance=!0));let u=i.show&&i.clusterShow;0===i.color.alpha&&0===i.outlineColor.alpha&&(u=!1),s=V.clamp(s,0,1),s=1===s?255:255*s|0;const d=(u?1:0)*nZ+s;c=V.clamp(c,0,1),c=1===c?255:255*c|0;const h=c;(0,n[QK.compressedAttribute1])(o,d,h,r,a)}function rZ(e,t,n,i){const o=i._index,r=n[QK.scaleByDistance];let s=0,a=1,c=1,l=1;const u=i.scaleByDistance;D(u)&&(s=u.near,a=u.nearValue,c=u.far,l=u.farValue,1===a&&1===l||(e._shaderScaleByDistance=!0)),r(o,s,a,c,l)}function sZ(e,t,n,i){const o=i._index,r=n[QK.distanceDisplayConditionAndDisableDepth];let s=0,a=Number.MAX_VALUE;const c=i.distanceDisplayCondition;D(c)&&(s=c.near,a=c.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let l=i.disableDepthTestDistance;l*=l,l>0&&(e._shaderDisableDepthDistance=!0,l===Number.POSITIVE_INFINITY&&(l=-1)),r(o,s,a,l)}function aZ(e,t,n,i){eZ(e,0,n,i),iZ(0,t,n,i),oZ(e,0,n,i),rZ(e,0,n,i),sZ(e,0,n,i)}function cZ(e,t,n,i,o,r){let s;i.mode===gl.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let c=0;c<n;++c){const e=t[c],n=e.position,l=wK._computeActualPosition(n,i,o);D(l)&&(e._setActualPosition(l),r?a.push(l):$u.expand(s,l,s))}r&&$u.fromPoints(a,s)}const lZ=[];$K.prototype.update=function(e){if(ZK(this),!this.show)return;this._maxTotalPointSize=rs.maximumAliasedPointSize,function(e,t){const n=t.mode,i=e._pointPrimitives,o=e._pointPrimitivesToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==gl.SCENE3D&&!ve.equals(r,e.modelMatrix)?(e._mode=n,ve.clone(e.modelMatrix,r),e._createVertexArray=!0,n!==gl.SCENE3D&&n!==gl.SCENE2D&&n!==gl.COLUMBUS_VIEW||cZ(e,i,i.length,t,r,!0)):n===gl.MORPHING?cZ(e,i,i.length,t,r,!0):n!==gl.SCENE2D&&n!==gl.COLUMBUS_VIEW||cZ(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}(this,e);const t=this._pointPrimitives.length,n=this._pointPrimitivesToUpdate,i=this._pointPrimitivesToUpdateIndex,o=this._propertiesChanged,r=this._createVertexArray;let s;const a=e.context,c=e.passes,l=c.pick;if(r||!l&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let e=0;e<XK;++e)o[e]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),t>0){this._vaf=function(e,t,n){return new uu(e,[{index:QK.positionHighAndSize,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[UK]},{index:QK.positionLowAndShow,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[UK]},{index:QK.compressedAttribute0,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[kK]},{index:QK.compressedAttribute1,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[WK]},{index:QK.scaleByDistance,componentsPerAttribute:4,componentDatatype:Ca.FLOAT,usage:n[jK]},{index:QK.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:Ca.FLOAT,usage:n[qK]}],t)}(a,t,this._buffersUsage),s=this._vaf.writers;for(let e=0;e<t;++e){const t=this._pointPrimitives[e];t._dirty=!1,aZ(this,a,s,t)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(i>0){const e=lZ;e.length=0,(o[UK]||o[HK]||o[GK])&&e.push(eZ),(o[kK]||o[VK])&&e.push(iZ),(o[zK]||o[WK])&&e.push(oZ),o[jK]&&e.push(rZ),(o[qK]||o[YK])&&e.push(sZ);const r=e.length;if(s=this._vaf.writers,i/t>.1){for(let t=0;t<i;++t){const i=n[t];i._dirty=!1;for(let t=0;t<r;++t)e[t](this,a,s,i)}this._vaf.commit()}else{for(let t=0;t<i;++t){const i=n[t];i._dirty=!1;for(let t=0;t<r;++t)e[t](this,a,s,i);this._vaf.subCommit(i._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(i>1.5*t&&(n.length=t),!D(this._vaf)||!D(this._vaf.va))return;let u;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,$u.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let d=ve.IDENTITY;e.mode===gl.SCENE3D?(d=this.modelMatrix,u=$u.clone(this._baseVolumeWC,this._boundingVolume)):u=$u.clone(this._baseVolume2D,this._boundingVolume),function(e,t,n){const i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=i}(this,e,u);const h=this._blendOption!==this.blendOption;let p,f,m,_,g,y;this._blendOption=this.blendOption,h&&(this._blendOption===Rk.OPAQUE||this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=_s.fromCache({depthTest:{enabled:!0,func:Me.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===Rk.TRANSLUCENT||this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=_s.fromCache({depthTest:{enabled:!0,func:Me.LEQUAL},depthMask:!1,blending:dh.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||0!==e.minimumDisableDepthTestDistance,(h||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(p=new bc({sources:['uniform float u_maxTotalPointSize;\n\nin vec4 positionHighAndSize;\nin vec4 positionLowAndOutline;\nin vec4 compressedAttribute0; // color, outlineColor, pick color\nin vec4 compressedAttribute1; // show, translucency by distance, some free space\nin vec4 scaleByDistance; // near, nearScale, far, farScale\nin vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance\n\nout vec4 v_color;\nout vec4 v_outlineColor;\nout float v_innerPercent;\nout float v_pixelDistance;\nout vec4 v_pickColor;\n\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\n\nvoid main()\n{\n // Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition\n\n // unpack attributes\n vec3 positionHigh = positionHighAndSize.xyz;\n vec3 positionLow = positionLowAndOutline.xyz;\n float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\n float totalSize = positionHighAndSize.w + outlineWidthBothSides;\n float outlinePercent = outlineWidthBothSides / totalSize;\n // Scale in response to browser-zoom.\n totalSize *= czm_pixelRatio;\n\n float temp = compressedAttribute1.x * SHIFT_RIGHT8;\n float show = floor(temp);\n\n#ifdef EYE_DISTANCE_TRANSLUCENCY\n vec4 translucencyByDistance;\n translucencyByDistance.x = compressedAttribute1.z;\n translucencyByDistance.z = compressedAttribute1.w;\n\n translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n\n temp = compressedAttribute1.y * SHIFT_RIGHT8;\n translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\n\n ///////////////////////////////////////////////////////////////////////////\n\n vec4 color;\n vec4 outlineColor;\n vec4 pickColor;\n\n // compressedAttribute0.z => pickColor.rgb\n\n temp = compressedAttribute0.z * SHIFT_RIGHT8;\n pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n pickColor.r = floor(temp);\n\n // compressedAttribute0.x => color.rgb\n\n temp = compressedAttribute0.x * SHIFT_RIGHT8;\n color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n color.r = floor(temp);\n\n // compressedAttribute0.y => outlineColor.rgb\n\n temp = compressedAttribute0.y * SHIFT_RIGHT8;\n outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n temp = floor(temp) * SHIFT_RIGHT8;\n outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n outlineColor.r = floor(temp);\n\n // compressedAttribute0.w => color.a, outlineColor.a, pickColor.a\n\n temp = compressedAttribute0.w * SHIFT_RIGHT8;\n pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n pickColor = pickColor / 255.0;\n\n temp = floor(temp) * SHIFT_RIGHT8;\n outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n outlineColor /= 255.0;\n color.a = floor(temp);\n color /= 255.0;\n\n ///////////////////////////////////////////////////////////////////////////\n\n vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n vec4 positionEC = czm_modelViewRelativeToEye * p;\n\n ///////////////////////////////////////////////////////////////////////////\n\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\n float lengthSq;\n if (czm_sceneMode == czm_sceneMode2D)\n {\n // 2D camera distance is a special case\n // treat all billboards as flattened to the z=0.0 plane\n lengthSq = czm_eyeHeight2D.y;\n }\n else\n {\n lengthSq = dot(positionEC.xyz, positionEC.xyz);\n }\n#endif\n\n#ifdef EYE_DISTANCE_SCALING\n totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\n if (totalSize > 0.0) {\n // Add padding for anti-aliasing on both sides.\n totalSize += 3.0;\n }\n\n // Clamp to max point size.\n totalSize = min(totalSize, u_maxTotalPointSize);\n // If size is too small, push vertex behind near plane for clipping.\n // Note that context.minimumAliasedPointSize "will be at most 1.0".\n if (totalSize < 1.0)\n {\n positionEC.xyz = vec3(0.0);\n totalSize = 1.0;\n }\n\n float translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\n translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\n // push vertex behind near plane for clipping\n if (translucency < 0.004)\n {\n positionEC.xyz = vec3(0.0);\n }\n#endif\n\n#ifdef DISTANCE_DISPLAY_CONDITION\n float nearSq = distanceDisplayConditionAndDisableDepth.x;\n float farSq = distanceDisplayConditionAndDisableDepth.y;\n if (lengthSq < nearSq || lengthSq > farSq) {\n // push vertex behind camera to force it to be clipped\n positionEC.xyz = vec3(0.0, 0.0, 1.0);\n }\n#endif\n\n gl_Position = czm_projection * positionEC;\n czm_vertexLogDepth();\n\n#ifdef DISABLE_DEPTH_DISTANCE\n float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\n if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n {\n disableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n }\n\n if (disableDepthTestDistance != 0.0)\n {\n // Don\'t try to "multiply both sides" by w. Greater/less-than comparisons won\'t work for negative values of w.\n float zclip = gl_Position.z / gl_Position.w;\n bool clipped = (zclip < -1.0 || zclip > 1.0);\n if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n {\n // Position z on the near plane.\n gl_Position.z = -gl_Position.w;\n#ifdef LOG_DEPTH\n czm_vertexLogDepth(vec4(czm_currentFrustum.x));\n#endif\n }\n }\n#endif\n\n v_color = color;\n v_color.a *= translucency * show;\n v_outlineColor = outlineColor;\n v_outlineColor.a *= translucency * show;\n\n v_innerPercent = 1.0 - outlinePercent;\n v_pixelDistance = 2.0 / totalSize;\n gl_PointSize = totalSize * show;\n gl_Position *= show;\n\n v_pickColor = pickColor;\n}\n']}),this._shaderScaleByDistance&&p.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&p.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&p.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&p.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT&&(f=new bc({defines:["OPAQUE"],sources:[BK]}),this._sp=ya.replaceCache({context:a,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:QK}),f=new bc({defines:["TRANSLUCENT"],sources:[BK]}),this._spTranslucent=ya.replaceCache({context:a,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:QK})),this._blendOption===Rk.OPAQUE&&(f=new bc({sources:[BK]}),this._sp=ya.replaceCache({context:a,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:QK})),this._blendOption===Rk.TRANSLUCENT&&(f=new bc({sources:[BK]}),this._spTranslucent=ya.replaceCache({context:a,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:f,attributeLocations:QK})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);const b=e.commandList;if(c.render||l){const e=this._colorCommands,t=this._blendOption===Rk.OPAQUE,n=this._blendOption===Rk.OPAQUE_AND_TRANSLUCENT;m=this._vaf.va,_=m.length,e.length=_;const i=n?2*_:_;for(y=0;y<i;++y){const i=t||n&&y%2==0;g=e[y],D(g)||(g=e[y]=new Kr),g.primitiveType=Vr.POINTS,g.pass=i||!n?zt.OPAQUE:zt.TRANSLUCENT,g.owner=this;const o=n?Math.floor(y/2):y;g.boundingVolume=u,g.modelMatrix=d,g.shaderProgram=i?this._sp:this._spTranslucent,g.uniformMap=this._uniforms,g.vertexArray=m[o].va,g.renderState=i?this._rsOpaque:this._rsTranslucent,g.debugShowBoundingVolume=this.debugShowBoundingVolume,g.pickId="v_pickColor",b.push(g)}}},$K.prototype.isDestroyed=function(){return!1},$K.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(),KK(this._pointPrimitives),He(this)};const uZ=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class dZ{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const i=n>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const o=uZ[15&n];if(!o)throw new Error("Unrecognized array type.");const[r]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new dZ(s,r,o,e)}constructor(e,t=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const o=uZ.indexOf(this.ArrayType),r=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+r+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return hZ(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:r,nodeSize:s}=this,a=[0,o.length-1,0],c=[];for(;a.length;){const l=a.pop()||0,u=a.pop()||0,d=a.pop()||0;if(u-d<=s){for(let s=d;s<=u;s++){const a=r[2*s],l=r[2*s+1];a>=e&&a<=n&&l>=t&&l<=i&&c.push(o[s])}continue}const h=d+u>>1,p=r[2*h],f=r[2*h+1];p>=e&&p<=n&&f>=t&&f<=i&&c.push(o[h]),(0===l?e<=p:t<=f)&&(a.push(d),a.push(h-1),a.push(1-l)),(0===l?n>=p:i>=f)&&(a.push(h+1),a.push(u),a.push(1-l))}return c}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:r}=this,s=[0,i.length-1,0],a=[],c=n*n;for(;s.length;){const l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=r){for(let n=d;n<=u;n++)_Z(o[2*n],o[2*n+1],e,t)<=c&&a.push(i[n]);continue}const h=d+u>>1,p=o[2*h],f=o[2*h+1];_Z(p,f,e,t)<=c&&a.push(i[h]),(0===l?e-n<=p:t-n<=f)&&(s.push(d),s.push(h-1),s.push(1-l)),(0===l?e+n>=p:t+n>=f)&&(s.push(h+1),s.push(u),s.push(1-l))}return a}}function hZ(e,t,n,i,o,r){if(o-i<=n)return;const s=i+o>>1;pZ(e,t,s,i,o,r),hZ(e,t,n,i,s-1,1-r),hZ(e,t,n,s+1,o,1-r)}function pZ(e,t,n,i,o,r){for(;o>i;){if(o-i>600){const s=o-i+1,a=n-i+1,c=Math.log(s),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(s-l)/s)*(a-s/2<0?-1:1);pZ(e,t,n,Math.max(i,Math.floor(n-a*l/s+u)),Math.min(o,Math.floor(n+(s-a)*l/s+u)),r)}const s=t[2*n+r];let a=i,c=o;for(fZ(e,t,i,n),t[2*o+r]>s&&fZ(e,t,i,o);a<c;){for(fZ(e,t,a,c),a++,c--;t[2*a+r]<s;)a++;for(;t[2*c+r]>s;)c--}t[2*i+r]===s?fZ(e,t,i,c):(c++,fZ(e,t,c,o)),c<=n&&(i=c+1),n<=c&&(o=c-1)}}function fZ(e,t,n,i){mZ(e,n,i),mZ(t,2*n,2*i),mZ(t,2*n+1,2*i+1)}function mZ(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function _Z(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function gZ(e){e=M(e,M.EMPTY_OBJECT),this._enabled=M(e.enabled,!1),this._pixelRange=M(e.pixelRange,80),this._minimumClusterSize=M(e.minimumClusterSize,2),this._clusterBillboards=M(e.clusterBillboards,!0),this._clusterLabels=M(e.clusterLabels,!0),this._clusterPoints=M(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 gi,this.show=M(e.show,!0)}function yZ(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const bZ=new Fr;function vZ(e,t,n,i,o){if(D(e._labelCollection)&&i._clusterLabels?o=nH.getScreenSpaceBoundingBox(e,t,o):D(e._billboardCollection)&&i._clusterBillboards?o=uk.getScreenSpaceBoundingBox(e,t,o):D(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=wK.getScreenSpaceBoundingBox(e,t,o)),yZ(o,n),i._clusterLabels&&!D(e._labelCollection)&&D(e.id)&&wZ(i,e.id.id)&&D(e.id._label)){const r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=nH.getScreenSpaceBoundingBox(s,t,bZ);yZ(a,n),o=Fr.union(o,a,o)}return o}function AZ(e,t){if(e.clusterShow=!0,!D(e._labelCollection)&&D(e.id)&&wZ(t,e.id.id)&&D(e.id._label)){const n=t._collectionIndicesByEntity[e.id.id].labelIndex;t._labelCollection.get(n).clusterShow=!0}}function TZ(e,t,n,i){const o={billboard:i._clusterBillboardCollection.add(),label:i._clusterLabelCollection.add(),point:i._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=n,o.billboard.position=o.label.position=o.point.position=e,i._clusterEvent.raiseEvent(n,o)}function wZ(e,t){return D(e)&&D(e._collectionIndicesByEntity[t])&&D(e._collectionIndicesByEntity[t].labelIndex)}function EZ(e,t,n,i,o){if(!D(e))return;const r=e.length;for(let s=0;s<r;++s){const r=e.get(s);if(r.clusterShow=!1,!r.show||o._scene.mode===gl.SCENE3D&&!i.isPointVisible(r.position))continue;const a=o._clusterLabels&&D(r._labelCollection),c=o._clusterBillboards&&D(r.id._billboard),l=o._clusterPoints&&D(r.id._point);if(a&&(l||c))continue;const u=r.computeScreenSpacePosition(n);D(u)&&t.push({index:s,collection:e,clustered:!1,coord:u})}}const xZ=new Fr,SZ=new Fr,CZ=new Fr;function IZ(e,t,n,i){return function(o){let r=this[e];D(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s,a,c=this._collectionIndicesByEntity[o.id];if(D(c)||(c=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),D(r)&&D(c[i]))return r.get(c[i]);D(r)||(r=this[e]=new t({scene:this._scene}));const l=this[n];l.length>0?(s=l.shift(),a=r.get(s)):(a=r.add(),s=r.length-1),c[i]=s;const u=this;return Promise.resolve().then((function(){u._clusterDirty=!0})),a}}function OZ(e,t){const n=e._collectionIndicesByEntity[t];D(n.billboardIndex)||D(n.labelIndex)||D(n.pointIndex)||delete e._collectionIndicesByEntity[t]}function DZ(e){if(!D(e))return;const t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function PZ(e){this._name=e,this._clock=void 0,this._changed=new gi,this._error=new gi,this._isLoading=!1,this._loading=new gi,this._entityCollection=new $X(this),this._entityCluster=new gZ}gZ.prototype._initialize=function(e){this._scene=e;const t=(n=this,function(e){if(D(e)&&e<.05||!n.enabled)return;const t=n._scene,i=n._labelCollection,o=n._billboardCollection,r=n._pointCollection;if(!D(i)&&!D(o)&&!D(r)||!n._clusterBillboards&&!n._clusterLabels&&!n._clusterPoints)return;let s=n._clusterLabelCollection,a=n._clusterBillboardCollection,c=n._clusterPointCollection;D(s)?s.removeAll():s=n._clusterLabelCollection=new SH({scene:t}),D(a)?a.removeAll():a=n._clusterBillboardCollection=new lV({scene:t}),D(c)?c.removeAll():c=n._clusterPointCollection=new $K;const l=n._pixelRange,u=n._minimumClusterSize,d=n._previousClusters,h=[],p=n._previousHeight,f=t.camera.positionCartographic.height,m=new sK(t.mapProjection.ellipsoid,t.camera.positionWC),_=[];let g,y,b,v,A,T,w,E,x,S,C,I;if(n._clusterLabels&&EZ(i,_,t,m,n),n._clusterBillboards&&EZ(o,_,t,m,n),n._clusterPoints&&EZ(r,_,t,m,n),_.length>0){const e=new dZ(_.length,64,Uint32Array);for(let t=0;t<_.length;++t)e.add(_[t].coord.x,_[t].coord.y);if(e.finish(),f<p)for(b=d.length,g=0;g<b;++g){const i=d[g];if(!m.isPointVisible(i.position))continue;const o=uk._computeScreenSpacePosition(ve.IDENTITY,i.position,H.ZERO,kt.ZERO,t);if(!D(o))continue;const r=1-f/p;let s=i.width=i.width*r,a=i.height=i.height*r;s=Math.max(s,i.minimumWidth),a=Math.max(a,i.minimumHeight);const c=o.x-.5*s,l=o.y-.5*a,b=o.x+s,v=o.y+a;for(A=e.range(c,l,b,v),T=A.length,S=0,x=[],y=0;y<T;++y)w=A[y],E=_[w],E.clustered||(++S,C=E.collection,I=E.index,x.push(C.get(I).id));if(S>=u)for(TZ(i.position,S,x,n),h.push(i),y=0;y<T;++y)_[A[y]].clustered=!0}for(b=_.length,g=0;g<b;++g){const t=_[g];if(t.clustered)continue;t.clustered=!0,C=t.collection,I=t.index;const i=C.get(I);v=vZ(i,t.coord,l,n,xZ);const o=Fr.clone(v,SZ);A=e.range(v.x,v.y,v.x+v.width,v.y+v.height),T=A.length;const r=H.clone(i.position);for(S=1,x=[i.id],y=0;y<T;++y)if(w=A[y],E=_[w],!E.clustered){const e=E.collection.get(E.index),t=vZ(e,E.coord,l,n,CZ);H.add(e.position,r,r),Fr.union(o,t,o),++S,x.push(e.id)}if(S>=u){const e=H.multiplyByScalar(r,1/S,r);for(TZ(e,S,x,n),h.push({position:e,width:o.width,height:o.height,minimumWidth:v.width,minimumHeight:v.height}),y=0;y<T;++y)_[A[y]].clustered=!0}else AZ(i,n)}}0===s.length&&(s.destroy(),n._clusterLabelCollection=void 0),0===a.length&&(a.destroy(),n._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),n._clusterPointCollection=void 0),n._previousClusters=h,n._previousHeight=f});var n;this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)},Object.defineProperties(gZ.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}}}),gZ.prototype.getLabel=IZ("_labelCollection",SH,"_unusedLabelIndices","labelIndex"),gZ.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!D(this._labelCollection)||!D(t)||!D(t.labelIndex))return;const n=t.labelIndex;t.labelIndex=void 0,OZ(this,e.id);const i=this._labelCollection.get(n);i.show=!1,i.text="",i.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0},gZ.prototype.getBillboard=IZ("_billboardCollection",lV,"_unusedBillboardIndices","billboardIndex"),gZ.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!D(this._billboardCollection)||!D(t)||!D(t.billboardIndex))return;const n=t.billboardIndex;t.billboardIndex=void 0,OZ(this,e.id);const i=this._billboardCollection.get(n);i.id=void 0,i.show=!1,i.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0},gZ.prototype.getPoint=IZ("_pointCollection",$K,"_unusedPointIndices","pointIndex"),gZ.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!D(this._pointCollection)||!D(t)||!D(t.pointIndex))return;const n=t.pointIndex;t.pointIndex=void 0,OZ(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0},gZ.prototype.update=function(e){if(!this.show)return;let t;var n;D(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),D(this._billboardCollection)&&this._billboardCollection.length>0&&!D(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,(n=this).enabled||(D(n._clusterLabelCollection)&&n._clusterLabelCollection.destroy(),D(n._clusterBillboardCollection)&&n._clusterBillboardCollection.destroy(),D(n._clusterPointCollection)&&n._clusterPointCollection.destroy(),n._clusterLabelCollection=void 0,n._clusterBillboardCollection=void 0,n._clusterPointCollection=void 0,DZ(n._labelCollection),DZ(n._billboardCollection),DZ(n._pointCollection)),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),D(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),D(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),D(this._clusterPointCollection)&&this._clusterPointCollection.update(e),D(this._labelCollection)&&this._labelCollection.update(e),D(this._billboardCollection)&&this._billboardCollection.update(e),D(this._pointCollection)&&this._pointCollection.update(e)},gZ.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(),D(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},Object.defineProperties(PZ.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){rK.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!D(e))throw new P("value must be defined.");this._entityCluster=e}}}),PZ.prototype.update=function(e){return!0};const NZ={computePositions:function(e,t,n,i,o){const r=.5*e,s=-r,a=i+i,c=new Float64Array(3*(o?2*a:a));let l,u=0,d=0;const h=o?3*a:0,p=o?3*(a+i):3*i;for(l=0;l<i;l++){const e=l/i*V.TWO_PI,a=Math.cos(e),f=Math.sin(e),m=a*n,_=f*n,g=a*t,y=f*t;c[d+h]=m,c[d+h+1]=_,c[d+h+2]=s,c[d+p]=g,c[d+p+1]=y,c[d+p+2]=r,d+=3,o&&(c[u++]=m,c[u++]=_,c[u++]=s,c[u++]=g,c[u++]=y,c[u++]=r)}return c}},RZ=NZ,LZ=new kt,MZ=new H,FZ=new H,BZ=new H,zZ=new H;function UZ(e){const t=(e=M(e,M.EMPTY_OBJECT)).length,n=e.topRadius,i=e.bottomRadius,o=M(e.vertexFormat,Bd.DEFAULT),r=M(e.slices,128);if(!D(t))throw new P("options.length must be defined.");if(!D(n))throw new P("options.topRadius must be defined.");if(!D(i))throw new P("options.bottomRadius must be defined.");if(r<3)throw new P("options.slices must be greater than or equal to 3.");if(D(e.offsetAttribute)&&e.offsetAttribute===Fd.TOP)throw new P("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=Bd.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}UZ.packedLength=Bd.packedLength+5,UZ.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n]=M(e._offsetAttribute,-1),t};const kZ=new Bd,VZ={vertexFormat:kZ,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};let HZ;UZ.unpack=function(e,t,n){if(!D(e))throw new P("array is required");t=M(t,0);const i=Bd.unpack(e,t,kZ);t+=Bd.packedLength;const o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return D(n)?(n._vertexFormat=Bd.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=-1===c?void 0:c,n):(VZ.length=o,VZ.topRadius=r,VZ.bottomRadius=s,VZ.slices=a,VZ.offsetAttribute=-1===c?void 0:c,new UZ(VZ))},UZ.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._vertexFormat,r=e._slices;if(t<=0||n<0||i<0||0===n&&0===i)return;const s=r+r,a=r+s,c=s+s,l=RZ.computePositions(t,n,i,r,!0),u=o.st?new Float32Array(2*c):void 0,d=o.normal?new Float32Array(3*c):void 0,h=o.tangent?new Float32Array(3*c):void 0,p=o.bitangent?new Float32Array(3*c):void 0;let f;const m=o.normal||o.tangent||o.bitangent;if(m){const e=o.tangent||o.bitangent;let s=0,a=0,c=0;const l=Math.atan2(i-n,t),u=MZ;u.z=Math.sin(l);const _=Math.cos(l);let g=BZ,y=FZ;for(f=0;f<r;f++){const t=f/r*V.TWO_PI,n=_*Math.cos(t),i=_*Math.sin(t);m&&(u.x=n,u.y=i,e&&(g=H.normalize(H.cross(H.UNIT_Z,u,g),g)),o.normal&&(d[s++]=u.x,d[s++]=u.y,d[s++]=u.z,d[s++]=u.x,d[s++]=u.y,d[s++]=u.z),o.tangent&&(h[a++]=g.x,h[a++]=g.y,h[a++]=g.z,h[a++]=g.x,h[a++]=g.y,h[a++]=g.z),o.bitangent&&(y=H.normalize(H.cross(u,g,y),y),p[c++]=y.x,p[c++]=y.y,p[c++]=y.z,p[c++]=y.x,p[c++]=y.y,p[c++]=y.z))}for(f=0;f<r;f++)o.normal&&(d[s++]=0,d[s++]=0,d[s++]=-1),o.tangent&&(h[a++]=1,h[a++]=0,h[a++]=0),o.bitangent&&(p[c++]=0,p[c++]=-1,p[c++]=0);for(f=0;f<r;f++)o.normal&&(d[s++]=0,d[s++]=0,d[s++]=1),o.tangent&&(h[a++]=1,h[a++]=0,h[a++]=0),o.bitangent&&(p[c++]=0,p[c++]=1,p[c++]=0)}const _=12*r-12,g=je.createTypedArray(c,_);let y=0,b=0;for(f=0;f<r-1;f++)g[y++]=b,g[y++]=b+2,g[y++]=b+3,g[y++]=b,g[y++]=b+3,g[y++]=b+1,b+=2;for(g[y++]=s-2,g[y++]=0,g[y++]=1,g[y++]=s-2,g[y++]=1,g[y++]=s-1,f=1;f<r-1;f++)g[y++]=s+f+1,g[y++]=s+f,g[y++]=s;for(f=1;f<r-1;f++)g[y++]=a,g[y++]=a+f,g[y++]=a+f+1;let v=0;if(o.st){const e=Math.max(n,i);for(f=0;f<c;f++){const t=H.fromArray(l,3*f,zZ);u[v++]=(t.x+e)/(2*e),u[v++]=(t.y+e)/(2*e)}}const A=new Md;o.position&&(A.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:l})),o.normal&&(A.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:d})),o.tangent&&(A.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:h})),o.bitangent&&(A.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:p})),o.st&&(A.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:u})),LZ.x=.5*t,LZ.y=Math.max(i,n);const T=new $u(H.ZERO,kt.magnitude(LZ));if(D(e._offsetAttribute)){t=l.length;const n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);A.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:A,indices:g,primitiveType:Vr.TRIANGLES,boundingSphere:T,offsetAttribute:e._offsetAttribute})},UZ.getUnitCylinder=function(){return D(HZ)||(HZ=UZ.createGeometry(new UZ({topRadius:1,bottomRadius:1,length:1,vertexFormat:Bd.POSITION_ONLY}))),HZ};const GZ=new kt;function jZ(e){const t=(e=M(e,M.EMPTY_OBJECT)).length,n=e.topRadius,i=e.bottomRadius,o=M(e.slices,128),r=Math.max(M(e.numberOfVerticalLines,16),0);if(L.typeOf.number("options.positions",t),L.typeOf.number("options.topRadius",n),L.typeOf.number("options.bottomRadius",i),L.typeOf.number.greaterThanOrEquals("options.slices",o,3),D(e.offsetAttribute)&&e.offsetAttribute===Fd.TOP)throw new P("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}jZ.packedLength=6,jZ.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=M(e._offsetAttribute,-1),t};const WZ={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};jZ.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=e[t++],o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return D(n)?(n._length=i,n._topRadius=o,n._bottomRadius=r,n._slices=s,n._numberOfVerticalLines=a,n._offsetAttribute=-1===c?void 0:c,n):(WZ.length=i,WZ.topRadius=o,WZ.bottomRadius=r,WZ.slices=s,WZ.numberOfVerticalLines=a,WZ.offsetAttribute=-1===c?void 0:c,new jZ(WZ))},jZ.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._slices,r=e._numberOfVerticalLines;if(t<=0||n<0||i<0||0===n&&0===i)return;const s=2*o,a=RZ.computePositions(t,n,i,o,!1);let c,l=2*o;if(r>0){const e=Math.min(r,o);c=Math.round(o/e),l+=e}const u=je.createTypedArray(s,2*l);let d,h=0;for(d=0;d<o-1;d++)u[h++]=d,u[h++]=d+1,u[h++]=d+o,u[h++]=d+1+o;if(u[h++]=o-1,u[h++]=0,u[h++]=o+o-1,u[h++]=o,r>0)for(d=0;d<o;d+=c)u[h++]=d,u[h++]=d+o;const p=new Md;p.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:a}),GZ.x=.5*t,GZ.y=Math.max(i,n);const f=new $u(H.ZERO,kt.magnitude(GZ));if(D(e._offsetAttribute)){t=a.length;const n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);p.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:p,indices:u,primitiveType:Vr.LINES,boundingSphere:f,offsetAttribute:e._offsetAttribute})};const qZ=H.ZERO,YZ=new H,XZ=new H,QZ=new Ot;function $Z(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 KZ(e,t){DA.call(this,{entity:e,scene:t,geometryOptions:new $Z(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}function ZZ(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(KZ.prototype=Object.create(DA.prototype),KZ.prototype.constructor=KZ),Object.defineProperties(KZ.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),KZ.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r={show:i,distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o),color:void 0,offset:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,QZ)),D(t)||(t=Ot.WHITE),r.color=$d.fromColor(t)}return D(this._options.offsetAttribute)&&(r.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,qZ,YZ))),new Zd({id:t,geometry:new UZ(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:r})},KZ.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,QZ),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o),offset:void 0};return D(this._options.offsetAttribute)&&(r.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,qZ,YZ))),new Zd({id:t,geometry:new jZ(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,.5*this._options.length,this._scene.mapProjection.ellipsoid),attributes:r})},KZ.prototype._computeCenter=function(e,t){return Ou.getValueOrUndefined(this._entity.position,e,t)},KZ.prototype._isHidden=function(e,t){return!D(e.position)||!D(t.length)||!D(t.topRadius)||!D(t.bottomRadius)||DA.prototype._isHidden.call(this,e,t)},KZ.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Ou.isConstant(e.orientation)&&t.length.isConstant&&t.topRadius.isConstant&&t.bottomRadius.isConstant&&Ou.isConstant(t.slices)&&Ou.isConstant(t.outlineWidth)&&Ou.isConstant(t.numberOfVerticalLines))},KZ.prototype._setStaticOptions=function(e,t){const n=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Oh?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(ih.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(ih.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(ih.MINIMUM_VALUE),i.slices=Ou.getValueOrUndefined(t.slices,ih.MINIMUM_VALUE),i.numberOfVerticalLines=Ou.getValueOrUndefined(t.numberOfVerticalLines,ih.MINIMUM_VALUE),i.offsetAttribute=n!==wu.NONE?Fd.ALL:void 0},KZ.prototype._onEntityPropertyChanged=LA,KZ.DynamicGeometryUpdater=ZZ,D(Object.create)&&(ZZ.prototype=Object.create(Dy.prototype),ZZ.prototype.constructor=ZZ),ZZ.prototype._isHidden=function(e,t,n){const i=this._options;return!D(Ou.getValueOrUndefined(e.position,n,XZ))||!D(i.length)||!D(i.topRadius)||!D(i.bottomRadius)||Dy.prototype._isHidden.call(this,e,t,n)},ZZ.prototype._setOptions=function(e,t,n){const i=Ou.getValueOrDefault(t.heightReference,n,wu.NONE),o=this._options;o.length=Ou.getValueOrUndefined(t.length,n),o.topRadius=Ou.getValueOrUndefined(t.topRadius,n),o.bottomRadius=Ou.getValueOrUndefined(t.bottomRadius,n),o.slices=Ou.getValueOrUndefined(t.slices,n),o.numberOfVerticalLines=Ou.getValueOrUndefined(t.numberOfVerticalLines,n),o.offsetAttribute=i!==wu.NONE?Fd.ALL:void 0};const JZ=Object.freeze({UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2}),eJ=Object.freeze({TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2}),tJ=Object.freeze({NONE:0,HOLD:1,EXTRAPOLATE:2}),nJ={type:"Linear",getRequiredDataPoints:function(e){return 2},interpolateOrderZero:function(e,t,n,i,o){if(2!==t.length)throw new P("The xTable provided to the linear interpolator must have exactly two elements.");if(i<=0)throw new P("There must be at least 1 dependent variable for each independent variable.");let r,s,a;D(o)||(o=new Array(i));const c=t[0],l=t[1];if(c===l)throw new P("Divide by zero error: xTable[0] and xTable[1] are equal");for(r=0;r<i;r++)s=n[r],a=n[r+i],o[r]=((a-s)*e+l*s-c*a)/(l-c);return o}},iJ=nJ;let oJ;oJ="undefined"!=typeof performance&&"function"==typeof performance.now&&isFinite(performance.now())?function(){return performance.now()}:function(){return Date.now()};const rJ=oJ;function sJ(e){let t=(e=M(e,M.EMPTY_OBJECT)).currentTime,n=e.startTime,i=e.stopTime;if(t=D(t)?Hn.clone(t):D(n)?Hn.clone(n):D(i)?Hn.addDays(i,-1,new Hn):Hn.now(),n=D(n)?Hn.clone(n):Hn.clone(t),i=D(i)?Hn.clone(i):Hn.addDays(n,1,new Hn),Hn.greaterThan(n,i))throw new P("startTime must come before stopTime.");this.startTime=n,this.stopTime=i,this.clockRange=M(e.clockRange,JZ.UNBOUNDED),this.canAnimate=M(e.canAnimate,!0),this.onTick=new gi,this.onStop=new gi,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=rJ(),this.currentTime=t,this.multiplier=M(e.multiplier,1),this.shouldAnimate=M(e.shouldAnimate,!1),this.clockStep=M(e.clockStep,eJ.SYSTEM_CLOCK_MULTIPLIER)}function aJ(e){let t=e._targetProperty;if(!D(t)){let n=e._targetEntity;if(!D(n)){if(n=e._targetCollection.getById(e._targetId),!D(n))return void(e._targetEntity=e._targetProperty=void 0);n.definitionChanged.addEventListener(cJ.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}const i=e._targetPropertyNames;t=e._targetEntity;for(let e=0,o=i.length;e<o&&D(t);++e)t=t[i[e]];e._targetProperty=t}return t}function cJ(e,t,n){if(!D(e))throw new P("targetCollection is required.");if(!D(t)||""===t)throw new P("targetId is required.");if(!D(n)||0===n.length)throw new P("targetPropertyNames is required.");for(let i=0;i<n.length;i++){const e=n[i];if(!D(e)||""===e)throw new P("reference contains invalid properties.")}this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new gi,e.collectionChanged.addEventListener(cJ.prototype._onCollectionChanged,this)}Object.defineProperties(sJ.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){Hn.equals(this._currentTime,e)||(this._clockStep===eJ.SYSTEM_CLOCK&&(this._clockStep=eJ.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===eJ.SYSTEM_CLOCK&&(this._clockStep=eJ.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===eJ.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=Hn.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===eJ.SYSTEM_CLOCK&&(this._clockStep=eJ.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}}),sJ.prototype.tick=function(){const e=rJ();let t=Hn.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){const n=this._clockStep;if(n===eJ.SYSTEM_CLOCK)t=Hn.now(t);else{const i=this._multiplier;if(n===eJ.TICK_DEPENDENT)t=Hn.addSeconds(t,i,t);else{const n=e-this._lastSystemTime;t=Hn.addSeconds(t,i*(n/1e3),t)}const o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===JZ.CLAMPED)Hn.lessThan(t,r)?t=Hn.clone(r,t):Hn.greaterThan(t,s)&&(t=Hn.clone(s,t),this.onStop.raiseEvent(this));else if(o===JZ.LOOP_STOP)for(Hn.lessThan(t,r)&&(t=Hn.clone(r,t));Hn.greaterThan(t,s);)t=Hn.addSeconds(r,Hn.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t},Object.defineProperties(cJ.prototype,{isConstant:{get:function(){return Ou.isConstant(aJ(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=aJ(this);return D(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return aJ(this)}}}),cJ.fromString=function(e,t){if(!D(e))throw new P("targetCollection is required.");if(!D(t))throw new P("referenceString is required.");let n;const i=[];let o=!0,r=!1,s="";for(let a=0;a<t.length;++a){const e=t.charAt(a);r?(s+=e,r=!1):"\\"===e?r=!0:o&&"#"===e?(n=s,o=!1,s=""):o||"."!==e?s+=e:(i.push(s),s="")}return i.push(s),new cJ(e,n,i)},cJ.prototype.getValue=function(e,t){const n=aJ(this);return D(n)?n.getValue(e,t):void 0},cJ.prototype.getValueInReferenceFrame=function(e,t,n){const i=aJ(this);return D(i)?i.getValueInReferenceFrame(e,t,n):void 0},cJ.prototype.getType=function(e){const t=aJ(this);return D(t)?t.getType(e):void 0},cJ.prototype.equals=function(e){if(this===e)return!0;const t=this._targetPropertyNames,n=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==n.length)return!1;const i=this._targetPropertyNames.length;for(let o=0;o<i;o++)if(t[o]!==n[o])return!1;return!0},cJ.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){D(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))},cJ.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;D(i)&&-1!==n.indexOf(i)?(i.definitionChanged.removeEventListener(cJ.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):D(i)||(i=aJ(this),D(i)&&this._definitionChanged.raiseEvent(this))};const lJ={packedLength:1,pack:function(e,t,n){t[n=M(n,0)]=e},unpack:function(e,t,n){return e[t=M(t,0)]}};function uJ(e,t,n){let i;const o=e.length,r=n.length,s=o+r;if(e.length=s,o!==t){let n=o-1;for(i=s-1;i>=t;i--)e[i]=e[n--]}for(i=0;i<r;i++)e[t++]=n[i]}function dJ(e,t){return e instanceof Hn?e:"string"==typeof e?Hn.fromIso8601(e):Hn.addSeconds(t,e,new Hn)}const hJ=[],pJ=[];function fJ(e,t,n,i,o){let r,s,a,c,l,u,d=0;for(;d<i.length;){l=dJ(i[d],e),a=_n(t,l,Hn.compare);let h=0,p=0;if(a<0){for(a=~a,c=a*o,s=void 0,u=t[a];d<i.length&&(l=dJ(i[d],e),!(D(s)&&Hn.compare(s,l)>=0||D(u)&&Hn.compare(l,u)>=0));){for(hJ[h++]=l,d+=1,r=0;r<o;r++)pJ[p++]=i[d],d+=1;s=l}h>0&&(pJ.length=p,uJ(n,c,pJ),hJ.length=h,uJ(t,a,hJ))}else{for(r=0;r<o;r++)d++,n[a*o+r]=i[d];d++}}}function mJ(e,t){L.defined("type",e);let n=e;n===Number&&(n=lJ);let i,o=n.packedLength,r=M(n.packedInterpolationLength,o),s=0;if(D(t)){const e=t.length;i=new Array(e);for(let n=0;n<e;n++){let e=t[n];e===Number&&(e=lJ);const s=e.packedLength;o+=s,r+=M(e.packedInterpolationLength,s),i[n]=e}s=e}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=iJ,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=o,this._packedInterpolationLength=r,this._updateTableLength=!0,this._interpolationResult=new Array(r),this._definitionChanged=new gi,this._derivativeTypes=t,this._innerDerivativeTypes=i,this._inputOrder=s,this._forwardExtrapolationType=tJ.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=tJ.NONE,this._backwardExtrapolationDuration=0}function _J(e,t,n){const i=e._packedLength;e._times.splice(t,n),e._values.splice(t*i,n*i),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}function gJ(e,t){let n;if((t=M(t,0))>0){n=new Array(t);for(let e=0;e<t;e++)n[e]=H}this._numberOfDerivatives=t,this._property=new mJ(H,n),this._definitionChanged=new gi,this._referenceFrame=M(e,Mv.FIXED),this._property._definitionChanged.addEventListener((function(){this._definitionChanged.raiseEvent(this)}),this)}function yJ(e){this._definitionChanged=new gi,this._intervals=new JX,this._intervals.changedEvent.addEventListener(yJ.prototype._intervalsChanged,this),this._referenceFrame=M(e,Mv.FIXED)}function bJ(){this._dataSources=[],this._dataSourceAdded=new gi,this._dataSourceRemoved=new gi,this._dataSourceMoved=new gi}function vJ(e,t){if(!D(t))throw new P("dataSource is required.");const n=e.indexOf(t);if(-1===n)throw new P("dataSource is not in this collection.");return n}function AJ(e,t,n){const i=e._dataSources,o=i.length-1;if((t=V.clamp(t,0,o))===(n=V.clamp(n,0,o)))return;const r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}function TJ(e){e=M(e,M.EMPTY_OBJECT),this._primitives=[],this._guid=ke(),this._primitiveAdded=new gi,this._primitiveRemoved=new gi,this._zIndex=void 0,this.show=M(e.show,!0),this.destroyPrimitives=M(e.destroyPrimitives,!0)}function wJ(e,t){if(!e.contains(t))throw new P("primitive is not in this collection.");return e._primitives.indexOf(t)}function EJ(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}function xJ(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new bu}Object.defineProperties(mJ.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))}}}),mJ.prototype.getValue=function(e,t){L.defined("time",e);const n=this._times,i=n.length;if(0===i)return;let o;const r=this._innerType,s=this._values;let a=_n(n,e,Hn.compare);if(a<0){if(a=~a,0===a){const i=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===tJ.NONE||0!==o&&Hn.secondsDifference(i,e)>o)return;if(this._backwardExtrapolationType===tJ.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;const c=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===tJ.NONE||0!==o&&Hn.secondsDifference(e,c)>o)return;if(this._forwardExtrapolationType===tJ.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}const c=this._xTable,l=this._yTable,u=this._interpolationAlgorithm,d=this._packedInterpolationLength,h=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const e=Math.min(u.getRequiredDataPoints(this._interpolationDegree,h),i);e!==this._numberOfPoints&&(this._numberOfPoints=e,c.length=e,l.length=e*d)}const p=this._numberOfPoints-1;if(p<1)return;let f=0,m=i-1;if(m-f+1>=p+1){let e=a-(p/2|0)-1;e<f&&(e=f);let t=e+p;t>m&&(t=m,e=t-p,e<f&&(e=f)),f=e,m=t}const _=m-f+1;for(let e=0;e<_;++e)c[e]=Hn.secondsDifference(n[f+e],n[m]);if(D(r.convertPackedArrayForInterpolation))r.convertPackedArrayForInterpolation(s,f,m,l);else{let e=0;const t=this._packedLength;let n=f*t;const i=(m+1)*t;for(;n<i;)l[e]=s[n],n++,e++}const g=Hn.secondsDifference(e,n[m]);let y;if(0!==h&&D(u.interpolate)){const e=Math.floor(d/(h+1));y=u.interpolate(g,c,l,e,h,h,this._interpolationResult)}else y=u.interpolateOrderZero(g,c,l,d,this._interpolationResult);return D(r.unpackInterpolationResult)?r.unpackInterpolationResult(y,s,f,m,t):r.unpack(y,0,t)}return r.unpack(s,a*this._packedLength,t)},mJ.prototype.setInterpolationOptions=function(e){if(!D(e))return;let t=!1;const n=e.interpolationAlgorithm,i=e.interpolationDegree;D(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),D(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))},mJ.prototype.addSample=function(e,t,n){const i=this._innerDerivativeTypes,o=D(i);L.defined("time",e),L.defined("value",t),o&&L.defined("derivatives",n);const r=this._innerType,s=[];if(s.push(e),r.pack(t,s,s.length),o){const e=i.length;for(let t=0;t<e;t++)i[t].pack(n[t],s,s.length)}fJ(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},mJ.prototype.addSamples=function(e,t,n){const i=this._innerDerivativeTypes,o=D(i);if(L.defined("times",e),L.defined("values",t),e.length!==t.length)throw new P("times and values must be the same length.");if(o&&(!D(n)||n.length!==e.length))throw new P("times and derivativeValues must be the same length.");const r=this._innerType,s=e.length,a=[];for(let c=0;c<s;c++)if(a.push(e[c]),r.pack(t[c],a,a.length),o){const e=n[c],t=i.length;for(let n=0;n<t;n++)i[n].pack(e[n],a,a.length)}fJ(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},mJ.prototype.addSamplesPackedArray=function(e,t){L.defined("packedSamples",e),fJ(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},mJ.prototype.removeSample=function(e){L.defined("time",e);const t=_n(this._times,e,Hn.compare);return!(t<0)&&(_J(this,t,1),!0)},mJ.prototype.removeSamples=function(e){L.defined("timeInterval",e);const t=this._times;let n=_n(t,e.start,Hn.compare);n<0?n=~n:e.isStartIncluded||++n;let i=_n(t,e.stop,Hn.compare);i<0?i=~i:e.isStopIncluded&&++i,_J(this,n,i-n)},mJ.prototype.equals=function(e){if(this===e)return!0;if(!D(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;const t=this._derivativeTypes,n=D(t),i=e._derivativeTypes;if(n!==D(i))return!1;let o,r;if(n){if(r=t.length,r!==i.length)return!1;for(o=0;o<r;o++)if(t[o]!==i[o])return!1}const s=this._times,a=e._times;if(r=s.length,r!==a.length)return!1;for(o=0;o<r;o++)if(!Hn.equals(s[o],a[o]))return!1;const c=this._values,l=e._values;for(r=c.length,o=0;o<r;o++)if(c[o]!==l[o])return!1;return!0},mJ._mergeNewSamples=fJ,Object.defineProperties(gJ.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}}}),gJ.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Mv.FIXED,t)},gJ.prototype.getValueInReferenceFrame=function(e,t,n){if(L.defined("time",e),L.defined("referenceFrame",t),D(n=this._property.getValue(e,n)))return Fv.convertToReferenceFrame(e,n,this._referenceFrame,t,n)},gJ.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},gJ.prototype.addSample=function(e,t,n){const i=this._numberOfDerivatives;if(i>0&&(!D(n)||n.length!==i))throw new P("derivatives length must be equal to the number of derivatives.");this._property.addSample(e,t,n)},gJ.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)},gJ.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},gJ.prototype.removeSample=function(e){return this._property.removeSample(e)},gJ.prototype.removeSamples=function(e){this._property.removeSamples(e)},gJ.prototype.equals=function(e){return this===e||e instanceof gJ&&Ou.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame},Object.defineProperties(yJ.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}}}),yJ.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Mv.FIXED,t)},yJ.prototype.getValueInReferenceFrame=function(e,t,n){if(!D(e))throw new P("time is required.");if(!D(t))throw new P("referenceFrame is required.");const i=this._intervals.findDataForIntervalContainingDate(e);if(D(i))return Fv.convertToReferenceFrame(e,i,this._referenceFrame,t,n)},yJ.prototype.equals=function(e){return this===e||e instanceof yJ&&this._intervals.equals(e._intervals,Ou.equals)&&this._referenceFrame===e._referenceFrame},yJ.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},Object.defineProperties(bJ.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}}}),bJ.prototype.add=function(e){if(!D(e))throw new P("dataSource is required.");const t=this,n=this._dataSources;return Promise.resolve(e).then((function(e){return n===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e}))},bJ.prototype.remove=function(e,t){t=M(t,!1);const n=this._dataSources.indexOf(e);return-1!==n&&(this._dataSources.splice(n,1),this._dataSourceRemoved.raiseEvent(this,e),t&&"function"==typeof e.destroy&&e.destroy(),!0)},bJ.prototype.removeAll=function(e){e=M(e,!1);const t=this._dataSources;for(let n=0,i=t.length;n<i;++n){const i=t[n];this._dataSourceRemoved.raiseEvent(this,i),e&&"function"==typeof i.destroy&&i.destroy()}this._dataSources=[]},bJ.prototype.contains=function(e){return-1!==this.indexOf(e)},bJ.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},bJ.prototype.get=function(e){if(!D(e))throw new P("index is required.");return this._dataSources[e]},bJ.prototype.getByName=function(e){if(!D(e))throw new P("name is required.");return this._dataSources.filter((function(t){return t.name===e}))},bJ.prototype.raise=function(e){const t=vJ(this._dataSources,e);AJ(this,t,t+1)},bJ.prototype.lower=function(e){const t=vJ(this._dataSources,e);AJ(this,t,t-1)},bJ.prototype.raiseToTop=function(e){const t=vJ(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))},bJ.prototype.lowerToBottom=function(e){const t=vJ(this._dataSources,e);0!==t&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))},bJ.prototype.isDestroyed=function(){return!1},bJ.prototype.destroy=function(){return this.removeAll(!0),He(this)},Object.defineProperties(TJ.prototype,{length:{get:function(){return this._primitives.length}},primitiveAdded:{get:function(){return this._primitiveAdded}},primitiveRemoved:{get:function(){return this._primitiveRemoved}}}),TJ.prototype.add=function(e,t){const n=D(t);if(!D(e))throw new P("primitive is required.");if(n){if(t<0)throw new P("index must be greater than or equal to zero.");if(t>this._primitives.length)throw new P("index must be less than or equal to the number of primitives.")}const i=e._external=e._external||{};return(i._composites=i._composites||{})[this._guid]={collection:this},n?this._primitives.splice(t,0,e):this._primitives.push(e),this._primitiveAdded.raiseEvent(e),e},TJ.prototype.remove=function(e){if(this.contains(e)){const t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),this._primitiveRemoved.raiseEvent(e),!0}return!1},TJ.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},TJ.prototype.removeAll=function(){const e=this._primitives,t=e.length;for(let n=0;n<t;++n)delete e[n]._external._composites[this._guid],this.destroyPrimitives&&e[n].destroy(),this._primitiveRemoved.raiseEvent(e[n]);this._primitives=[]},TJ.prototype.contains=function(e){return!!(D(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},TJ.prototype.raise=function(e){if(D(e)){const t=wJ(this,e),n=this._primitives;if(t!==n.length-1){const e=n[t];n[t]=n[t+1],n[t+1]=e}}},TJ.prototype.raiseToTop=function(e){if(D(e)){const t=wJ(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}},TJ.prototype.lower=function(e){if(D(e)){const t=wJ(this,e),n=this._primitives;if(0!==t){const e=n[t];n[t]=n[t-1],n[t-1]=e}}},TJ.prototype.lowerToBottom=function(e){if(D(e)){const t=wJ(this,e),n=this._primitives;0!==t&&(n.splice(t,1),n.unshift(e))}},TJ.prototype.get=function(e){if(!D(e))throw new P("index is required.");return this._primitives[e]},TJ.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)},TJ.prototype.prePassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];D(i.prePassesUpdate)&&i.prePassesUpdate(e)}},TJ.prototype.updateForPass=function(e,t){const n=this._primitives;for(let i=0;i<n.length;++i){const o=n[i];D(o.updateForPass)&&o.updateForPass(e,t)}},TJ.prototype.postPassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];D(i.postPassesUpdate)&&i.postPassesUpdate(e)}},TJ.prototype.isDestroyed=function(){return!1},TJ.prototype.destroy=function(){return this.removeAll(),He(this)},Object.defineProperties(EJ.prototype,{length:{get:function(){return this._length}}}),EJ.prototype.add=function(e,t){L.defined("primitive",e),D(t)&&L.typeOf.number("zIndex",t),t=M(t,0);let n=this._collections[t];if(!D(n)){n=new TJ({destroyPrimitives:!1}),n._zIndex=t,this._collections[t]=n;const e=this._collectionsArray;let i=0;for(;i<e.length&&e[i]._zIndex<t;)i++;e.splice(i,0,n)}return n.add(e),this._length++,e._zIndex=t,e},EJ.prototype.set=function(e,t){return L.defined("primitive",e),L.typeOf.number("zIndex",t),t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e},EJ.prototype.remove=function(e,t){if(this.contains(e)){const n=e._zIndex,i=this._collections[n];let o;return o=t?i.remove(e):i.removeAndDestroy(e),o&&this._length--,0===i.length&&(this._collectionsArray.splice(this._collectionsArray.indexOf(i),1),this._collections[n]=void 0,i.destroy()),o}return!1},EJ.prototype.removeAll=function(){const e=this._collectionsArray;for(let t=0;t<e.length;t++){const n=e[t];n.destroyPrimitives=!0,n.destroy()}this._collections={},this._collectionsArray=[],this._length=0},EJ.prototype.contains=function(e){if(!D(e))return!1;const t=this._collections[e._zIndex];return D(t)&&t.contains(e)},EJ.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)},EJ.prototype.isDestroyed=function(){return!1},EJ.prototype.destroy=function(){return this.removeAll(),He(this)},xJ.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))},xJ.prototype.remove=function(e){const t=e.id,n=this._dynamicUpdaters.get(t);D(n)&&(this._dynamicUpdaters.remove(t),n.destroy())},xJ.prototype.update=function(e){const t=this._dynamicUpdaters.values;for(let n=0,i=t.length;n<i;n++)t[n].update(e);return!0},xJ.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},xJ.prototype.getBoundingSphere=function(e,t){return D(e=this._dynamicUpdaters.get(e.id))&&D(e.getBoundingSphere)?e.getBoundingSphere(t):Iu.FAILED};const SJ={},CJ=new H,IJ=new H,OJ=new _o,DJ=new re;function PJ(e,t,n,i,o,r,s,a,c,l){const u=e+t;H.multiplyByScalar(i,Math.cos(u),CJ),H.multiplyByScalar(n,Math.sin(u),IJ),H.add(CJ,IJ,CJ);let d=Math.cos(e);d*=d;let h=Math.sin(e);h*=h;const p=r/Math.sqrt(s*d+o*h)/a;return _o.fromAxisAngle(CJ,p,OJ),re.fromQuaternion(OJ,DJ),re.multiplyByVector(DJ,c,l),H.normalize(l,l),H.multiplyByScalar(l,a,l),l}const NJ=new H,RJ=new H,LJ=new H,MJ=new H;SJ.raisePositionsToHeight=function(e,t,n){const i=t.ellipsoid,o=t.height,r=t.extrudedHeight,s=n?e.length/3*2:e.length/3,a=new Float64Array(3*s),c=e.length,l=n?c:0;for(let u=0;u<c;u+=3){const t=u+1,s=u+2,c=H.fromArray(e,u,NJ);i.scaleToGeodeticSurface(c,c);const d=H.clone(c,RJ),h=i.geodeticSurfaceNormal(c,MJ),p=H.multiplyByScalar(h,o,LJ);H.add(c,p,c),n&&(H.multiplyByScalar(h,r,p),H.add(d,p,d),a[u+l]=d.x,a[t+l]=d.y,a[s+l]=d.z),a[u]=c.x,a[t]=c.y,a[s]=c.z}return a};const FJ=new H,BJ=new H,zJ=new H;SJ.computeEllipsePositions=function(e,t,n){const i=e.semiMinorAxis,o=e.semiMajorAxis,r=e.rotation,s=e.center,a=8*e.granularity,c=i*i,l=o*o,u=o*i,d=H.magnitude(s),h=H.normalize(s,FJ);let p=H.cross(H.UNIT_Z,s,BJ);p=H.normalize(p,p);const f=H.cross(h,p,zJ);let m=1+Math.ceil(V.PI_OVER_TWO/a);const _=V.PI_OVER_TWO/(m-1);let g=V.PI_OVER_TWO-m*_;g<0&&(m-=Math.ceil(Math.abs(g)/_));const y=t?new Array(3*(m*(m+2)*2)):void 0;let b=0,v=NJ,A=RJ;const T=4*m*3;let w=T-1,E=0;const x=n?new Array(T):void 0;let S,C,I,O,D;for(g=V.PI_OVER_TWO,v=PJ(g,r,f,p,c,u,l,d,h,v),t&&(y[b++]=v.x,y[b++]=v.y,y[b++]=v.z),n&&(x[w--]=v.z,x[w--]=v.y,x[w--]=v.x),g=V.PI_OVER_TWO-_,S=1;S<m+1;++S){if(v=PJ(g,r,f,p,c,u,l,d,h,v),A=PJ(Math.PI-g,r,f,p,c,u,l,d,h,A),t){for(y[b++]=v.x,y[b++]=v.y,y[b++]=v.z,I=2*S+2,C=1;C<I-1;++C)O=C/(I-1),D=H.lerp(v,A,O,LJ),y[b++]=D.x,y[b++]=D.y,y[b++]=D.z;y[b++]=A.x,y[b++]=A.y,y[b++]=A.z}n&&(x[w--]=v.z,x[w--]=v.y,x[w--]=v.x,x[E++]=A.x,x[E++]=A.y,x[E++]=A.z),g=V.PI_OVER_TWO-(S+1)*_}for(S=m;S>1;--S){if(g=V.PI_OVER_TWO-(S-1)*_,v=PJ(-g,r,f,p,c,u,l,d,h,v),A=PJ(g+Math.PI,r,f,p,c,u,l,d,h,A),t){for(y[b++]=v.x,y[b++]=v.y,y[b++]=v.z,I=2*(S-1)+2,C=1;C<I-1;++C)O=C/(I-1),D=H.lerp(v,A,O,LJ),y[b++]=D.x,y[b++]=D.y,y[b++]=D.z;y[b++]=A.x,y[b++]=A.y,y[b++]=A.z}n&&(x[w--]=v.z,x[w--]=v.y,x[w--]=v.x,x[E++]=A.x,x[E++]=A.y,x[E++]=A.z)}g=V.PI_OVER_TWO,v=PJ(-g,r,f,p,c,u,l,d,h,v);const P={};return t&&(y[b++]=v.x,y[b++]=v.y,y[b++]=v.z,P.positions=y,P.numPts=m),n&&(x[w--]=v.z,x[w--]=v.y,x[w--]=v.x,P.outerPositions=x),P};const UJ=SJ,kJ=new H,VJ=new H,HJ=new H,GJ=new H,jJ=new kt,WJ=new re,qJ=new re,YJ=new _o,XJ=new H,QJ=new H,$J=new H,KJ=new Qt,ZJ=new H,JJ=new kt,e0=new kt;function t0(e,t,n){const i=t.vertexFormat,o=t.center,r=t.semiMajorAxis,s=t.semiMinorAxis,a=t.ellipsoid,c=t.stRotation,l=n?e.length/3*2:e.length/3,u=t.shadowVolume,d=i.st?new Float32Array(2*l):void 0,h=i.normal?new Float32Array(3*l):void 0,p=i.tangent?new Float32Array(3*l):void 0,f=i.bitangent?new Float32Array(3*l):void 0,m=u?new Float32Array(3*l):void 0;let _=0,g=XJ,y=QJ,b=$J;const v=new fn(a),A=v.project(a.cartesianToCartographic(o,KJ),ZJ),T=a.scaleToGeodeticSurface(o,kJ);a.geodeticSurfaceNormal(T,T);let w=WJ,E=qJ;if(0!==c){let e=_o.fromAxisAngle(T,c,YJ);w=re.fromQuaternion(e,w),e=_o.fromAxisAngle(T,-c,YJ),E=re.fromQuaternion(e,E)}else w=re.clone(re.IDENTITY,w),E=re.clone(re.IDENTITY,E);const x=kt.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,JJ),S=kt.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,e0);let C=e.length;const I=n?C:0,O=I/3*2;for(let D=0;D<C;D+=3){const t=D+1,o=D+2,c=H.fromArray(e,D,kJ);if(i.st){const e=re.multiplyByVector(w,c,VJ),t=v.project(a.cartesianToCartographic(e,KJ),HJ);H.subtract(t,A,t),jJ.x=(t.x+r)/(2*r),jJ.y=(t.y+s)/(2*s),x.x=Math.min(jJ.x,x.x),x.y=Math.min(jJ.y,x.y),S.x=Math.max(jJ.x,S.x),S.y=Math.max(jJ.y,S.y),n&&(d[_+O]=jJ.x,d[_+1+O]=jJ.y),d[_++]=jJ.x,d[_++]=jJ.y}(i.normal||i.tangent||i.bitangent||u)&&(g=a.geodeticSurfaceNormal(c,g),u&&(m[D+I]=-g.x,m[t+I]=-g.y,m[o+I]=-g.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(y=H.normalize(H.cross(H.UNIT_Z,g,y),y),re.multiplyByVector(E,y,y)),i.normal&&(h[D]=g.x,h[t]=g.y,h[o]=g.z,n&&(h[D+I]=-g.x,h[t+I]=-g.y,h[o+I]=-g.z)),i.tangent&&(p[D]=y.x,p[t]=y.y,p[o]=y.z,n&&(p[D+I]=-y.x,p[t+I]=-y.y,p[o+I]=-y.z)),i.bitangent&&(b=H.normalize(H.cross(g,y,b),b),f[D]=b.x,f[t]=b.y,f[o]=b.z,n&&(f[D+I]=b.x,f[t+I]=b.y,f[o+I]=b.z))))}if(i.st){C=d.length;for(let e=0;e<C;e+=2)d[e]=(d[e]-x.x)/(S.x-x.x),d[e+1]=(d[e+1]-x.y)/(S.y-x.y)}const P=new Md;if(i.position){const i=UJ.raisePositionsToHeight(e,t,n);P.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:i})}if(i.st&&(P.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:d})),i.normal&&(P.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:h})),i.tangent&&(P.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:p})),i.bitangent&&(P.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:f})),u&&(P.extrudeDirection=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:m})),n&&D(t.offsetAttribute)){let e=new Uint8Array(l);if(t.offsetAttribute===Fd.TOP)e=e.fill(1,0,l/2);else{const n=t.offsetAttribute===Fd.NONE?0:1;e=e.fill(n)}P.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return P}function n0(e){const t=new Array(e*(e+1)*12-6);let n,i,o,r,s,a=0;for(n=0,o=1,r=0;r<3;r++)t[a++]=o++,t[a++]=n,t[a++]=o;for(r=2;r<e+1;++r){for(o=r*(r+1)-1,n=(r-1)*r-1,t[a++]=o++,t[a++]=n,t[a++]=o,i=2*r,s=0;s<i-1;++s)t[a++]=o,t[a++]=n++,t[a++]=n,t[a++]=o++,t[a++]=n,t[a++]=o;t[a++]=o++,t[a++]=n,t[a++]=o}for(i=2*e,++o,++n,r=0;r<i-1;++r)t[a++]=o,t[a++]=n++,t[a++]=n,t[a++]=o++,t[a++]=n,t[a++]=o;for(t[a++]=o,t[a++]=n++,t[a++]=n,t[a++]=o++,t[a++]=n++,t[a++]=n,++n,r=e-1;r>1;--r){for(t[a++]=n++,t[a++]=n,t[a++]=o,i=2*r,s=0;s<i-1;++s)t[a++]=o,t[a++]=n++,t[a++]=n,t[a++]=o++,t[a++]=n,t[a++]=o;t[a++]=n++,t[a++]=n++,t[a++]=o++}for(r=0;r<3;r++)t[a++]=n++,t[a++]=n,t[a++]=o;return t}let i0=new H;const o0=new $u,r0=new $u;function s0(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=H.multiplyByScalar(n.geodeticSurfaceNormal(t,kJ),e.height,kJ);o0.center=H.add(t,o,o0.center),o0.radius=i,o=H.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),r0.center=H.add(t,o,r0.center),r0.radius=i;const r=UJ.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,c=r.outerPositions,l=$u.union(o0,r0),u=t0(s,e,!0);let d=n0(a);const h=d.length;d.length=2*h;const p=s.length/3;for(let y=0;y<h;y+=3)d[y+h]=d[y+2]+p,d[y+1+h]=d[y+1]+p,d[y+2+h]=d[y]+p;const f=new Na({attributes:u,indices:je.createTypedArray(2*p/3,d),primitiveType:Vr.TRIANGLES}),m=function(e,t){const n=t.vertexFormat,i=t.center,o=t.semiMajorAxis,r=t.semiMinorAxis,s=t.ellipsoid,a=t.height,c=t.extrudedHeight,l=t.stRotation,u=e.length/3*2,d=new Float64Array(3*u),h=n.st?new Float32Array(2*u):void 0,p=n.normal?new Float32Array(3*u):void 0,f=n.tangent?new Float32Array(3*u):void 0,m=n.bitangent?new Float32Array(3*u):void 0,_=t.shadowVolume,g=_?new Float32Array(3*u):void 0;let y=0,b=XJ,v=QJ,A=$J;const T=new fn(s),w=T.project(s.cartesianToCartographic(i,KJ),ZJ),E=s.scaleToGeodeticSurface(i,kJ);s.geodeticSurfaceNormal(E,E);const x=_o.fromAxisAngle(E,l,YJ),S=re.fromQuaternion(x,WJ),C=kt.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,JJ),I=kt.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,e0);let O=e.length;const P=O/3*2;for(let D=0;D<O;D+=3){const t=D+1,i=D+2;let l,u=H.fromArray(e,D,kJ);if(n.st){const e=re.multiplyByVector(S,u,VJ),t=T.project(s.cartesianToCartographic(e,KJ),HJ);H.subtract(t,w,t),jJ.x=(t.x+o)/(2*o),jJ.y=(t.y+r)/(2*r),C.x=Math.min(jJ.x,C.x),C.y=Math.min(jJ.y,C.y),I.x=Math.max(jJ.x,I.x),I.y=Math.max(jJ.y,I.y),h[y+P]=jJ.x,h[y+1+P]=jJ.y,h[y++]=jJ.x,h[y++]=jJ.y}u=s.scaleToGeodeticSurface(u,u),l=H.clone(u,VJ),b=s.geodeticSurfaceNormal(u,b),_&&(g[D+O]=-b.x,g[t+O]=-b.y,g[i+O]=-b.z);let E=H.multiplyByScalar(b,a,GJ);if(u=H.add(u,E,u),E=H.multiplyByScalar(b,c,E),l=H.add(l,E,l),n.position&&(d[D+O]=l.x,d[t+O]=l.y,d[i+O]=l.z,d[D]=u.x,d[t]=u.y,d[i]=u.z),n.normal||n.tangent||n.bitangent){A=H.clone(b,A);const o=H.fromArray(e,(D+3)%O,GJ);H.subtract(o,u,o);const r=H.subtract(l,u,HJ);b=H.normalize(H.cross(r,o,b),b),n.normal&&(p[D]=b.x,p[t]=b.y,p[i]=b.z,p[D+O]=b.x,p[t+O]=b.y,p[i+O]=b.z),n.tangent&&(v=H.normalize(H.cross(A,b,v),v),f[D]=v.x,f[t]=v.y,f[i]=v.z,f[D+O]=v.x,f[D+1+O]=v.y,f[D+2+O]=v.z),n.bitangent&&(m[D]=A.x,m[t]=A.y,m[i]=A.z,m[D+O]=A.x,m[t+O]=A.y,m[i+O]=A.z)}}if(n.st){O=h.length;for(let e=0;e<O;e+=2)h[e]=(h[e]-C.x)/(I.x-C.x),h[e+1]=(h[e+1]-C.y)/(I.y-C.y)}const N=new Md;if(n.position&&(N.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:d})),n.st&&(N.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:h})),n.normal&&(N.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:p})),n.tangent&&(N.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:f})),n.bitangent&&(N.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:m})),_&&(N.extrudeDirection=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:g})),D(t.offsetAttribute)){let e=new Uint8Array(u);if(t.offsetAttribute===Fd.TOP)e=e.fill(1,0,u/2);else{const n=t.offsetAttribute===Fd.NONE?0:1;e=e.fill(n)}N.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return N}(c,e);d=function(e){const t=e.length/3,n=je.createTypedArray(t,6*t);let i=0;for(let o=0;o<t;o++){const e=o,r=o+t,s=(e+1)%t,a=s+t;n[i++]=e,n[i++]=r,n[i++]=s,n[i++]=s,n[i++]=r,n[i++]=a}return n}(c);const _=new Na({attributes:m,indices:je.createTypedArray(2*c.length/3,d),primitiveType:Vr.TRIANGLES}),g=C_.combineInstances([new Zd({geometry:f}),new Zd({geometry:_})]);return{boundingSphere:l,attributes:g[0].attributes,indices:g[0].indices}}function a0(e,t,n,i,o,r,s){const a=UJ.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,c=a.length/3,l=new Array(c);for(let d=0;d<c;++d)l[d]=H.fromArray(a,3*d);const u=Ir.fromCartesianArray(l,r,s);return u.width>V.PI&&(u.north=u.north>0?V.PI_OVER_TWO-V.EPSILON7:u.north,u.south=u.south<0?V.EPSILON7-V.PI_OVER_TWO:u.south,u.east=V.PI,u.west=-V.PI),u}function c0(e){const t=(e=M(e,M.EMPTY_OBJECT)).center,n=M(e.ellipsoid,on.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=M(e.granularity,V.RADIANS_PER_DEGREE),s=M(e.vertexFormat,Bd.DEFAULT);if(L.defined("options.center",t),L.typeOf.number("options.semiMajorAxis",i),L.typeOf.number("options.semiMinorAxis",o),i<o)throw new P("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new P("granularity must be greater than zero.");const a=M(e.height,0),c=M(e.extrudedHeight,a);this._center=H.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=on.clone(n),this._rotation=M(e.rotation,0),this._stRotation=M(e.stRotation,0),this._height=Math.max(c,a),this._granularity=r,this._vertexFormat=Bd.clone(s),this._extrudedHeight=Math.min(c,a),this._shadowVolume=M(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}c0.packedLength=H.packedLength+on.packedLength+Bd.packedLength+9,c0.pack=function(e,t,n){return L.defined("value",e),L.defined("array",t),n=M(n,0),H.pack(e._center,t,n),n+=H.packedLength,on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=M(e._offsetAttribute,-1),t};const l0=new H,u0=new on,d0=new Bd,h0={center:l0,ellipsoid:u0,vertexFormat:d0,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};c0.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=H.unpack(e,t,l0);t+=H.packedLength;const o=on.unpack(e,t,u0);t+=on.packedLength;const r=Bd.unpack(e,t,d0);t+=Bd.packedLength;const s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t++],p=1===e[t++],f=e[t];return D(n)?(n._center=H.clone(i,n._center),n._ellipsoid=on.clone(o,n._ellipsoid),n._vertexFormat=Bd.clone(r,n._vertexFormat),n._semiMajorAxis=s,n._semiMinorAxis=a,n._rotation=c,n._stRotation=l,n._height=u,n._granularity=d,n._extrudedHeight=h,n._shadowVolume=p,n._offsetAttribute=-1===f?void 0:f,n):(h0.height=u,h0.extrudedHeight=h,h0.granularity=d,h0.stRotation=l,h0.rotation=c,h0.semiMajorAxis=s,h0.semiMinorAxis=a,h0.shadowVolume=p,h0.offsetAttribute=-1===f?void 0:f,new c0(h0))},c0.computeRectangle=function(e,t){const n=(e=M(e,M.EMPTY_OBJECT)).center,i=M(e.ellipsoid,on.WGS84),o=e.semiMajorAxis,r=e.semiMinorAxis,s=M(e.granularity,V.RADIANS_PER_DEGREE),a=M(e.rotation,0);if(L.defined("options.center",n),L.typeOf.number("options.semiMajorAxis",o),L.typeOf.number("options.semiMinorAxis",r),o<r)throw new P("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(s<=0)throw new P("granularity must be greater than zero.");return a0(n,o,r,a,s,i,t)},c0.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!V.equalsEpsilon(t,n,0,V.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};let r;if(i)o.extrudedHeight=n,o.shadowVolume=e._shadowVolume,o.offsetAttribute=e._offsetAttribute,r=s0(o);else if(r=function(e){const t=e.center;i0=H.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,i0),e.height,i0),i0=H.add(t,i0,i0);const n=new $u(i0,e.semiMajorAxis),i=UJ.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=t0(o,e,!1);let a=n0(r);return a=je.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}(o),D(e._offsetAttribute)){const t=r.attributes.position.values.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);r.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:r.attributes,indices:r.indices,primitiveType:Vr.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})},c0.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new c0({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:o,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Bd.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(c0.prototype,{rectangle:{get:function(){return D(this._rectangle)||(this._rectangle=a0(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return D(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(e){const t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];const n=UJ.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,i=n.length/3,o=new Array(i);for(let a=0;a<i;++a)o[a]=H.fromArray(n,3*a);const r=e._ellipsoid,s=e.rectangle;return Na._textureCoordinateRotationPoints(o,t,r,s)}(this)),this._textureCoordinateRotationPoints}}});const p0=new H;let f0=new H;const m0=new $u,_0=new $u;function g0(e){const t=(e=M(e,M.EMPTY_OBJECT)).center,n=M(e.ellipsoid,on.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=M(e.granularity,V.RADIANS_PER_DEGREE);if(!D(t))throw new P("center is required.");if(!D(i))throw new P("semiMajorAxis is required.");if(!D(o))throw new P("semiMinorAxis is required.");if(i<o)throw new P("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new P("granularity must be greater than zero.");const s=M(e.height,0),a=M(e.extrudedHeight,s);this._center=H.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=on.clone(n),this._rotation=M(e.rotation,0),this._height=Math.max(a,s),this._granularity=r,this._extrudedHeight=Math.min(a,s),this._numberOfVerticalLines=Math.max(M(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}g0.packedLength=H.packedLength+on.packedLength+8,g0.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),H.pack(e._center,t,n),n+=H.packedLength,on.pack(e._ellipsoid,t,n),n+=on.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._numberOfVerticalLines,t[n]=M(e._offsetAttribute,-1),t};const y0=new H,b0=new on,v0={center:y0,ellipsoid:b0,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};g0.unpack=function(e,t,n){if(!D(e))throw new P("array is required");t=M(t,0);const i=H.unpack(e,t,y0);t+=H.packedLength;const o=on.unpack(e,t,b0);t+=on.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t];return D(n)?(n._center=H.clone(i,n._center),n._ellipsoid=on.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=c,n._granularity=l,n._extrudedHeight=u,n._numberOfVerticalLines=d,n._offsetAttribute=-1===h?void 0:h,n):(v0.height=c,v0.extrudedHeight=u,v0.granularity=l,v0.rotation=a,v0.semiMajorAxis=r,v0.semiMinorAxis=s,v0.numberOfVerticalLines=d,v0.offsetAttribute=-1===h?void 0:h,new g0(v0))},g0.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!V.equalsEpsilon(t,n,0,V.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};let r;if(i)o.extrudedHeight=n,o.offsetAttribute=e._offsetAttribute,r=function(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=H.multiplyByScalar(n.geodeticSurfaceNormal(t,p0),e.height,p0);m0.center=H.add(t,o,m0.center),m0.radius=i,o=H.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),_0.center=H.add(t,o,_0.center),_0.radius=i;let r=UJ.computeEllipsePositions(e,!1,!0).outerPositions;const s=new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:UJ.raisePositionsToHeight(r,e,!0)})});r=s.position.values;const a=$u.union(m0,_0);let c=r.length/3;if(D(e.offsetAttribute)){let t=new Uint8Array(c);if(e.offsetAttribute===Fd.TOP)t=t.fill(1,0,c/2);else{const n=e.offsetAttribute===Fd.NONE?0:1;t=t.fill(n)}s.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}let l=M(e.numberOfVerticalLines,16);l=V.clamp(l,0,c/2);const u=je.createTypedArray(c,2*c+2*l);c/=2;let d,h,p=0;for(d=0;d<c;++d)u[p++]=d,u[p++]=(d+1)%c,u[p++]=d+c,u[p++]=(d+1)%c+c;if(l>0){const e=Math.min(l,c);h=Math.round(c/e);const t=Math.min(h*l,c);for(d=0;d<t;d+=h)u[p++]=d,u[p++]=d+c}return{boundingSphere:a,attributes:s,indices:u}}(o);else if(r=function(e){const t=e.center;f0=H.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,f0),e.height,f0),f0=H.add(t,f0,f0);const n=new $u(f0,e.semiMajorAxis),i=UJ.computeEllipsePositions(e,!1,!0).outerPositions,o=new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:UJ.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=je.createTypedArray(r,2*r);let a=0;for(let c=0;c<r;++c)s[a++]=c,s[a++]=(c+1)%r;return{boundingSphere:n,attributes:o,indices:s}}(o),D(e._offsetAttribute)){const t=r.attributes.position.values.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);r.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:r.attributes,indices:r.indices,primitiveType:Vr.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};const A0=new Ot,T0=H.ZERO,w0=new H,E0=new Ir;function x0(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 S0(e,t){K$.call(this,{entity:e,scene:t,geometryOptions:new x0(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function C0(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(S0.prototype=Object.create(K$.prototype),S0.prototype.constructor=S0),S0.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,A0)),D(t)||(t=Ot.WHITE),i.color=$d.fromColor(t)}return D(this._options.offsetAttribute)&&(i.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,T0,w0))),new Zd({id:t,geometry:new c0(this._options),attributes:i})},S0.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,A0),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o),offset:void 0};return D(this._options.offsetAttribute)&&(r.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,T0,w0))),new Zd({id:t,geometry:new g0(this._options),attributes:r})},S0.prototype._computeCenter=function(e,t){return Ou.getValueOrUndefined(this._entity.position,e,t)},S0.prototype._isHidden=function(e,t){return!D(e.position)||!D(t.semiMajorAxis)||!D(t.semiMinorAxis)||DA.prototype._isHidden.call(this,e,t)},S0.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Ou.isConstant(t.rotation)||!Ou.isConstant(t.height)||!Ou.isConstant(t.extrudedHeight)||!Ou.isConstant(t.granularity)||!Ou.isConstant(t.stRotation)||!Ou.isConstant(t.outlineWidth)||!Ou.isConstant(t.numberOfVerticalLines)||!Ou.isConstant(t.zIndex)||this._onTerrain&&!Ou.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Oh)},S0.prototype._setStaticOptions=function(e,t){let n=Ou.getValueOrUndefined(t.height,ih.MINIMUM_VALUE);const i=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE);let o=Ou.getValueOrUndefined(t.extrudedHeight,ih.MINIMUM_VALUE);const r=Ou.getValueOrDefault(t.extrudedHeightReference,ih.MINIMUM_VALUE,wu.NONE);D(o)&&!D(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof Oh?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(ih.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(ih.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(ih.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=Ou.getValueOrUndefined(t.rotation,ih.MINIMUM_VALUE),s.granularity=Ou.getValueOrUndefined(t.granularity,ih.MINIMUM_VALUE),s.stRotation=Ou.getValueOrUndefined(t.stRotation,ih.MINIMUM_VALUE),s.numberOfVerticalLines=Ou.getValueOrUndefined(t.numberOfVerticalLines,ih.MINIMUM_VALUE),s.offsetAttribute=K$.computeGeometryOffsetAttribute(n,i,o,r),s.height=K$.getGeometryHeight(n,i),o=K$.getGeometryExtrudedHeight(o,r),o===K$.CLAMP_TO_GROUND&&(o=Hh.getMinimumMaximumHeights(c0.computeRectangle(s,E0)).minimumTerrainHeight),s.extrudedHeight=o},S0.DynamicGeometryUpdater=C0,D(Object.create)&&(C0.prototype=Object.create(Dy.prototype),C0.prototype.constructor=C0),C0.prototype._isHidden=function(e,t,n){const i=this._options;return!D(i.center)||!D(i.semiMajorAxis)||!D(i.semiMinorAxis)||Dy.prototype._isHidden.call(this,e,t,n)},C0.prototype._setOptions=function(e,t,n){const i=this._options;let o=Ou.getValueOrUndefined(t.height,n);const r=Ou.getValueOrDefault(t.heightReference,n,wu.NONE);let s=Ou.getValueOrUndefined(t.extrudedHeight,n);const a=Ou.getValueOrDefault(t.extrudedHeightReference,n,wu.NONE);D(s)&&!D(o)&&(o=0),i.center=Ou.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=Ou.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=Ou.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=Ou.getValueOrUndefined(t.rotation,n),i.granularity=Ou.getValueOrUndefined(t.granularity,n),i.stRotation=Ou.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=Ou.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=K$.computeGeometryOffsetAttribute(o,r,s,a),i.height=K$.getGeometryHeight(o,r),s=K$.getGeometryExtrudedHeight(s,a),s===K$.CLAMP_TO_GROUND&&(s=Hh.getMinimumMaximumHeights(c0.computeRectangle(i,E0)).minimumTerrainHeight),i.extrudedHeight=s};const I0=new H,O0=new H,D0=new H,P0=new H,N0=new H,R0=new H(1,1,1),L0=Math.cos,M0=Math.sin;function F0(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.radii,R0),n=M(e.innerRadii,t),i=M(e.minimumClock,0),o=M(e.maximumClock,V.TWO_PI),r=M(e.minimumCone,0),s=M(e.maximumCone,V.PI),a=Math.round(M(e.stackPartitions,64)),c=Math.round(M(e.slicePartitions,64)),l=M(e.vertexFormat,Bd.DEFAULT);if(c<3)throw new P("options.slicePartitions cannot be less than three.");if(a<3)throw new P("options.stackPartitions cannot be less than three.");this._radii=H.clone(t),this._innerRadii=H.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._vertexFormat=Bd.clone(l),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}F0.packedLength=2*H.packedLength+Bd.packedLength+7,F0.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");return n=M(n,0),H.pack(e._radii,t,n),n+=H.packedLength,H.pack(e._innerRadii,t,n),n+=H.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n]=M(e._offsetAttribute,-1),t};const B0=new H,z0=new H,U0=new Bd,k0={radii:B0,innerRadii:z0,vertexFormat:U0,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};let V0;F0.unpack=function(e,t,n){if(!D(e))throw new P("array is required");t=M(t,0);const i=H.unpack(e,t,B0);t+=H.packedLength;const o=H.unpack(e,t,z0);t+=H.packedLength;const r=Bd.unpack(e,t,U0);t+=Bd.packedLength;const s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=e[t++],h=e[t];return D(n)?(n._radii=H.clone(i,n._radii),n._innerRadii=H.clone(o,n._innerRadii),n._vertexFormat=Bd.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=c,n._maximumCone=l,n._stackPartitions=u,n._slicePartitions=d,n._offsetAttribute=-1===h?void 0:h,n):(k0.minimumClock=s,k0.maximumClock=a,k0.minimumCone=c,k0.maximumCone=l,k0.stackPartitions=u,k0.slicePartitions=d,k0.offsetAttribute=-1===h?void 0:h,new F0(k0))},F0.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._vertexFormat;let c,l,u=e._slicePartitions+1,d=e._stackPartitions+1;u=Math.round(u*Math.abs(o-i)/V.TWO_PI),d=Math.round(d*Math.abs(s-r)/V.PI),u<2&&(u=2),d<2&&(d=2);let h=0;const p=[r],f=[i];for(c=0;c<d;c++)p.push(r+c*(s-r)/(d-1));for(p.push(s),l=0;l<u;l++)f.push(i+l*(o-i)/(u-1));f.push(o);const m=p.length,_=f.length;let g=0,y=1;const b=n.x!==t.x||n.y!==t.y||n.z!==t.z;let v=!1,A=!1,T=!1;b&&(y=2,r>0&&(v=!0,g+=u-1),s<Math.PI&&(A=!0,g+=u-1),(o-i)%V.TWO_PI?(T=!0,g+=2*(d-1)+1):g+=1);const w=_*m*y,E=new Float64Array(3*w),x=new Array(w).fill(!1),S=new Array(w).fill(!1),C=u*d*y,I=6*(C+g+1-(u+d)*y),O=je.createTypedArray(C,I),P=a.normal?new Float32Array(3*w):void 0,N=a.tangent?new Float32Array(3*w):void 0,R=a.bitangent?new Float32Array(3*w):void 0,L=a.st?new Float32Array(2*w):void 0,M=new Array(m),F=new Array(m);for(c=0;c<m;c++)M[c]=M0(p[c]),F[c]=L0(p[c]);const B=new Array(_),z=new Array(_);for(l=0;l<_;l++)z[l]=L0(f[l]),B[l]=M0(f[l]);for(c=0;c<m;c++)for(l=0;l<_;l++)E[h++]=t.x*M[c]*z[l],E[h++]=t.y*M[c]*B[l],E[h++]=t.z*F[c];let U,k,G,j,W=w/2;if(b)for(c=0;c<m;c++)for(l=0;l<_;l++)E[h++]=n.x*M[c]*z[l],E[h++]=n.y*M[c]*B[l],E[h++]=n.z*F[c],x[W]=!0,c>0&&c!==m-1&&0!==l&&l!==_-1&&(S[W]=!0),W++;for(h=0,c=1;c<m-2;c++)for(U=c*_,k=(c+1)*_,l=1;l<_-2;l++)O[h++]=k+l,O[h++]=k+l+1,O[h++]=U+l+1,O[h++]=k+l,O[h++]=U+l+1,O[h++]=U+l;if(b){const e=m*_;for(c=1;c<m-2;c++)for(U=e+c*_,k=e+(c+1)*_,l=1;l<_-2;l++)O[h++]=k+l,O[h++]=U+l,O[h++]=U+l+1,O[h++]=k+l,O[h++]=U+l+1,O[h++]=k+l+1}if(b){if(v)for(j=m*_,c=1;c<_-2;c++)O[h++]=c,O[h++]=c+1,O[h++]=j+c+1,O[h++]=c,O[h++]=j+c+1,O[h++]=j+c;if(A)for(G=m*_-_,j=m*_*y-_,c=1;c<_-2;c++)O[h++]=G+c+1,O[h++]=G+c,O[h++]=j+c,O[h++]=G+c+1,O[h++]=j+c,O[h++]=j+c+1}if(T){for(c=1;c<m-2;c++)j=_*m+_*c,G=_*c,O[h++]=j,O[h++]=G+_,O[h++]=G,O[h++]=j,O[h++]=j+_,O[h++]=G+_;for(c=1;c<m-2;c++)j=_*m+_*(c+1)-1,G=_*(c+1)-1,O[h++]=G+_,O[h++]=j,O[h++]=G,O[h++]=G+_,O[h++]=j+_,O[h++]=j}const q=new Md;a.position&&(q.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:E}));let Y=0,X=0,Q=0,$=0;const K=w/2;let Z;const J=on.fromCartesian3(t),ee=on.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(c=0;c<w;c++){Z=x[c]?ee:J;const e=H.fromArray(E,3*c,I0),t=Z.geodeticSurfaceNormal(e,O0);if(S[c]&&H.negate(t,t),a.st){const e=kt.negate(t,N0);L[Y++]=Math.atan2(e.y,e.x)/V.TWO_PI+.5,L[Y++]=Math.asin(t.z)/Math.PI+.5}if(a.normal&&(P[X++]=t.x,P[X++]=t.y,P[X++]=t.z),a.tangent||a.bitangent){const e=D0;let n,i=0;if(x[c]&&(i=K),n=!v&&c>=i&&c<i+2*_?H.UNIT_X:H.UNIT_Z,H.cross(n,t,e),H.normalize(e,e),a.tangent&&(N[Q++]=e.x,N[Q++]=e.y,N[Q++]=e.z),a.bitangent){const n=H.cross(t,e,P0);H.normalize(n,n),R[$++]=n.x,R[$++]=n.y,R[$++]=n.z}}}a.st&&(q.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:L})),a.normal&&(q.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:P})),a.tangent&&(q.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:N})),a.bitangent&&(q.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:R}))}if(D(e._offsetAttribute)){const t=E.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);q.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return new Na({attributes:q,indices:O,primitiveType:Vr.TRIANGLES,boundingSphere:$u.fromEllipsoid(J),offsetAttribute:e._offsetAttribute})},F0.getUnitEllipsoid=function(){return D(V0)||(V0=F0.createGeometry(new F0({radii:new H(1,1,1),vertexFormat:Bd.POSITION_ONLY}))),V0};const H0=new Oh(Ot.WHITE),G0=H.ZERO,j0=new H,W0=new H,q0=new H,Y0=new Ot,X0=new H(1,1,1);function Q0(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 $0(e,t){DA.call(this,{entity:e,scene:t,geometryOptions:new Q0(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function K0(e,t,n){Dy.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new ve,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 H,this._material={}}function Z0(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.vertexFormat,Bd.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}D(Object.create)&&($0.prototype=Object.create(DA.prototype),$0.prototype.constructor=$0),Object.defineProperties($0.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}}),$0.prototype.createFillGeometryInstance=function(e,t,n){L.defined("time",e);const i=this._entity,o=i.isAvailable(e);let r;const s=new rh(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),c={show:s,distanceDisplayCondition:Kd.fromDistanceDisplayCondition(a),color:void 0,offset:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(t=this._materialProperty.color.getValue(e,Y0)),D(t)||(t=Ot.WHITE),r=$d.fromColor(t),c.color=r}return D(this._options.offsetAttribute)&&(c.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,G0,j0))),new Zd({id:i,geometry:new F0(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,n),attributes:c})},$0.prototype.createOutlineGeometryInstance=function(e,t,n){L.defined("time",e);const i=this._entity,o=i.isAvailable(e),r=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,Y0),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new rh(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(r),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(s),offset:void 0};return D(this._options.offsetAttribute)&&(a.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,G0,j0))),new Zd({id:i,geometry:new Mq(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,.5*this._options.radii.z,this._scene.mapProjection.ellipsoid,n),attributes:a})},$0.prototype._computeCenter=function(e,t){return Ou.getValueOrUndefined(this._entity.position,e,t)},$0.prototype._isHidden=function(e,t){return!D(e.position)||!D(t.radii)||DA.prototype._isHidden.call(this,e,t)},$0.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Ou.isConstant(e.orientation)&&t.radii.isConstant&&Ou.isConstant(t.innerRadii)&&Ou.isConstant(t.stackPartitions)&&Ou.isConstant(t.slicePartitions)&&Ou.isConstant(t.outlineWidth)&&Ou.isConstant(t.minimumClock)&&Ou.isConstant(t.maximumClock)&&Ou.isConstant(t.minimumCone)&&Ou.isConstant(t.maximumCone)&&Ou.isConstant(t.subdivisions))},$0.prototype._setStaticOptions=function(e,t){const n=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Oh?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(ih.MINIMUM_VALUE,i.radii),i.innerRadii=Ou.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=Ou.getValueOrUndefined(t.minimumClock,ih.MINIMUM_VALUE),i.maximumClock=Ou.getValueOrUndefined(t.maximumClock,ih.MINIMUM_VALUE),i.minimumCone=Ou.getValueOrUndefined(t.minimumCone,ih.MINIMUM_VALUE),i.maximumCone=Ou.getValueOrUndefined(t.maximumCone,ih.MINIMUM_VALUE),i.stackPartitions=Ou.getValueOrUndefined(t.stackPartitions,ih.MINIMUM_VALUE),i.slicePartitions=Ou.getValueOrUndefined(t.slicePartitions,ih.MINIMUM_VALUE),i.subdivisions=Ou.getValueOrUndefined(t.subdivisions,ih.MINIMUM_VALUE),i.offsetAttribute=n!==wu.NONE?Fd.ALL:void 0},$0.prototype._onEntityPropertyChanged=LA,$0.DynamicGeometryUpdater=K0,D(Object.create)&&(K0.prototype=Object.create(Dy.prototype),K0.prototype.constructor=K0),K0.prototype.update=function(e){L.defined("time",e);const t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Ou.getValueOrDefault(n.show,e,!0))return D(this._primitive)&&(this._primitive.show=!1),void(D(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));const i=Ou.getValueOrUndefined(n.radii,e,W0);let o=D(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,.5*i.z,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!D(o)||!D(i))return D(this._primitive)&&(this._primitive.show=!1),void(D(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));const r=Ou.getValueOrDefault(n.fill,e,!0),s=Ou.getValueOrDefault(n.outline,e,!1),a=Ou.getValueOrClonedDefault(n.outlineColor,e,Ot.BLACK,Y0),c=Oy.getValue(e,M(n.material,H0),this._material),l=Ou.getValueOrUndefined(n.innerRadii,e,q0),u=Ou.getValueOrUndefined(n.minimumClock,e),d=Ou.getValueOrUndefined(n.maximumClock,e),h=Ou.getValueOrUndefined(n.minimumCone,e),p=Ou.getValueOrUndefined(n.maximumCone,e),f=Ou.getValueOrUndefined(n.stackPartitions,e),m=Ou.getValueOrUndefined(n.slicePartitions,e),_=Ou.getValueOrUndefined(n.subdivisions,e),g=Ou.getValueOrDefault(n.outlineWidth,e,1),y=Ou.getValueOrDefault(n.heightReference,e,wu.NONE),b=y!==wu.NONE?Fd.ALL:void 0,v=this._scene.mode,A=v===gl.SCENE3D&&y===wu.NONE,T=this._options,w=this._geometryUpdater.shadowsProperty.getValue(e),E=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),x=Ou.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,G0,j0);if(!A||this._lastSceneMode!==v||!D(this._primitive)||T.stackPartitions!==f||T.slicePartitions!==m||D(l)&&!H.equals(T.innerRadii!==l)||T.minimumClock!==u||T.maximumClock!==d||T.minimumCone!==h||T.maximumCone!==p||T.subdivisions!==_||this._lastOutlineWidth!==g||T.offsetAttribute!==b){const t=this._primitives;t.removeAndDestroy(this._primitive),t.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=v,this._lastOutlineWidth=g,T.stackPartitions=f,T.slicePartitions=m,T.subdivisions=_,T.offsetAttribute=b,T.radii=H.clone(A?X0:i,T.radii),D(l)?T.innerRadii=A?H.fromElements(l.x/i.x,l.y/i.y,l.z/i.z,T.innerRadii):H.clone(l,T.innerRadii):T.innerRadii=void 0,T.minimumClock=u,T.maximumClock=d,T.minimumCone=h,T.maximumCone=p;const n=new Sh({material:c,translucent:c.isTranslucent(),closed:!0});T.vertexFormat=n.vertexFormat;const o=this._geometryUpdater.createFillGeometryInstance(e,A,this._modelMatrix);this._primitive=t.add(new V_({geometryInstances:o,appearance:n,asynchronous:!1,shadows:w}));const y=this._geometryUpdater.createOutlineGeometryInstance(e,A,this._modelMatrix);this._outlinePrimitive=t.add(new V_({geometryInstances:y,appearance:new Ih({flat:!0,translucent:255!==y.attributes.color.value[3],renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(g)}}),asynchronous:!1,shadows:w})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=Ot.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=E,this._lastOffset=H.clone(x,this._lastOffset)}else if(this._primitive.ready){const e=this._primitive,n=this._outlinePrimitive;e.show=!0,n.show=!0,e.appearance.material=c;let i=this._attributes;D(i)||(i=e.getGeometryInstanceAttributes(t),this._attributes=i),r!==this._lastShow&&(i.show=rh.toValue(r,i.show),this._lastShow=r);let o=this._outlineAttributes;D(o)||(o=n.getGeometryInstanceAttributes(t),this._outlineAttributes=o),s!==this._lastOutlineShow&&(o.show=rh.toValue(s,o.show),this._lastOutlineShow=s),Ot.equals(a,this._lastOutlineColor)||(o.color=$d.toValue(a,o.color),Ot.clone(a,this._lastOutlineColor)),vu.equals(E,this._lastDistanceDisplayCondition)||(i.distanceDisplayCondition=Kd.toValue(E,i.distanceDisplayCondition),o.distanceDisplayCondition=Kd.toValue(E,o.distanceDisplayCondition),vu.clone(E,this._lastDistanceDisplayCondition)),H.equals(x,this._lastOffset)||(i.offset=oh.toValue(x,i.offset),o.offset=oh.toValue(x,i.offset),H.clone(x,this._lastOffset))}A&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),o=ve.multiplyByScale(o,i,o),this._primitive.modelMatrix=o,this._outlinePrimitive.modelMatrix=o)},Z0.packedLength=Bd.packedLength,Z0.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),Bd.pack(e._vertexFormat,t,n),t};const J0=new Bd,e1={vertexFormat:J0};Z0.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=Bd.unpack(e,t,J0);return D(n)?(n._vertexFormat=Bd.clone(i,n._vertexFormat),n):new Z0(e1)};const t1=new H(-.5,-.5,0),n1=new H(.5,.5,0);function i1(){this._workerName="createPlaneOutlineGeometry"}Z0.createGeometry=function(e){const t=e._vertexFormat,n=new Md;let i,o;if(t.position){if(o=new Float64Array(12),o[0]=t1.x,o[1]=t1.y,o[2]=0,o[3]=n1.x,o[4]=t1.y,o[5]=0,o[6]=n1.x,o[7]=n1.y,o[8]=0,o[9]=t1.x,o[10]=n1.y,o[11]=0,n.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:o}),t.normal){const e=new Float32Array(12);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=1,e[9]=0,e[10]=0,e[11]=1,n.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}if(t.st){const e=new Float32Array(8);e[0]=0,e[1]=0,e[2]=1,e[3]=0,e[4]=1,e[5]=1,e[6]=0,e[7]=1,n.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:e})}if(t.tangent){const e=new Float32Array(12);e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=1,e[7]=0,e[8]=0,e[9]=1,e[10]=0,e[11]=0,n.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}if(t.bitangent){const e=new Float32Array(12);e[0]=0,e[1]=1,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=1,e[8]=0,e[9]=0,e[10]=1,e[11]=0,n.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}i=new Uint16Array(6),i[0]=0,i[1]=1,i[2]=2,i[3]=0,i[4]=2,i[5]=3}return new Na({attributes:n,indices:i,primitiveType:Vr.TRIANGLES,boundingSphere:new $u(H.ZERO,Math.sqrt(2))})},i1.packedLength=0,i1.pack=function(e,t){return L.defined("value",e),L.defined("array",t),t},i1.unpack=function(e,t,n){return L.defined("array",e),D(n)?n:new i1};const o1=new H(-.5,-.5,0),r1=new H(.5,.5,0);i1.createGeometry=function(){const e=new Md,t=new Uint16Array(8),n=new Float64Array(12);return n[0]=o1.x,n[1]=o1.y,n[2]=o1.z,n[3]=r1.x,n[4]=o1.y,n[5]=o1.z,n[6]=r1.x,n[7]=r1.y,n[8]=o1.z,n[9]=o1.x,n[10]=r1.y,n[11]=o1.z,e.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:n}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new Na({attributes:e,indices:t,primitiveType:Vr.LINES,boundingSphere:new $u(H.ZERO,Math.sqrt(2))})};const s1=new H,a1=new Ot;function c1(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function l1(e,t){DA.call(this,{entity:e,scene:t,geometryOptions:new c1(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}function u1(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(l1.prototype=Object.create(DA.prototype),l1.prototype.constructor=l1),l1.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Kd.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,a1)),D(t)||(t=Ot.WHITE),o=$d.fromColor(t),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};const c=t.plane,l=this._options;let u=t.computeModelMatrix(e);const d=Ou.getValueOrDefault(c.plane,e,l.plane),h=Ou.getValueOrUndefined(c.dimensions,e,l.dimensions);return l.plane=d,l.dimensions=h,u=y1(d,h,u,u),new Zd({id:t,geometry:new Z0(this._options),modelMatrix:u,attributes:i})},l1.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,a1),o=this._distanceDisplayConditionProperty.getValue(e),r=t.plane,s=this._options;let a=t.computeModelMatrix(e);const c=Ou.getValueOrDefault(r.plane,e,s.plane),l=Ou.getValueOrUndefined(r.dimensions,e,s.dimensions);return s.plane=c,s.dimensions=l,a=y1(c,l,a,a),new Zd({id:t,geometry:new i1,modelMatrix:a,attributes:{show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o)}})},l1.prototype._isHidden=function(e,t){return!D(t.plane)||!D(t.dimensions)||!D(e.position)||DA.prototype._isHidden.call(this,e,t)},l1.prototype._getIsClosed=function(e){return!1},l1.prototype._isDynamic=function(e,t){return!(e.position.isConstant&&Ou.isConstant(e.orientation)&&t.plane.isConstant&&t.dimensions.isConstant&&Ou.isConstant(t.outlineWidth))},l1.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof Oh,i=this._options;i.vertexFormat=n?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(ih.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(ih.MINIMUM_VALUE,i.dimensions)},l1.DynamicGeometryUpdater=u1,D(Object.create)&&(u1.prototype=Object.create(Dy.prototype),u1.prototype.constructor=u1),u1.prototype._isHidden=function(e,t,n){const i=this._options;return!D(Ou.getValueOrUndefined(e.position,n,s1))||!D(i.plane)||!D(i.dimensions)||Dy.prototype._isHidden.call(this,e,t,n)},u1.prototype._setOptions=function(e,t,n){const i=this._options;i.plane=Ou.getValueOrDefault(t.plane,n,i.plane),i.dimensions=Ou.getValueOrUndefined(t.dimensions,n,i.dimensions)};const d1=new H,h1=new H,p1=new H,f1=new H,m1=new re,_1=new re,g1=new ve;function y1(e,t,n,i){const o=e.normal,r=e.distance,s=H.multiplyByScalar(o,-r,p1);let a=H.clone(H.UNIT_Z,h1);V.equalsEpsilon(Math.abs(H.dot(a,o)),1,V.EPSILON8)&&(a=H.clone(H.UNIT_Y,a));const c=H.cross(a,o,d1);a=H.cross(o,c,a),H.normalize(c,c),H.normalize(a,a);const l=m1;re.setColumn(l,0,c,l),re.setColumn(l,1,a,l),re.setColumn(l,2,o,l);const u=H.fromElements(t.x,t.y,1,f1),d=re.multiplyByScale(l,u,_1),h=ve.fromRotationTranslation(d,s,g1);return ve.multiplyTransformation(n,h,i)}l1.createPrimitiveMatrix=y1;const b1=new H,v1=new Fr,A1=new kt,T1=new kt,w1=new H,E1=new H,x1=new H,S1=new H,C1=new H,I1=new H,O1=new _o,D1=new re,P1=new re,N1=new H;function R1(e,t,n,i,o,r,s,a,c){const l=e.positions;let u=$O.triangulate(e.positions2D,e.holes);u.length<3&&(u=[0,1,2]);const d=je.createTypedArray(l.length,u.length);d.set(u);let h=D1;if(0!==i){let e=_o.fromAxisAngle(s,i,O1);if(h=re.fromQuaternion(e,h),t.tangent||t.bitangent){e=_o.fromAxisAngle(s,-i,O1);const n=re.fromQuaternion(e,P1);a=H.normalize(re.multiplyByVector(n,a,a),a),t.bitangent&&(c=H.normalize(H.cross(s,a,c),c))}}else h=re.clone(re.IDENTITY,h);const p=T1;t.st&&(p.x=n.x,p.y=n.y);const f=l.length,m=3*f,_=new Float64Array(m),g=t.normal?new Float32Array(m):void 0,y=t.tangent?new Float32Array(m):void 0,b=t.bitangent?new Float32Array(m):void 0,v=t.st?new Float32Array(2*f):void 0;let A=0,T=0,w=0,E=0,x=0;for(let C=0;C<f;C++){const e=l[C];if(_[A++]=e.x,_[A++]=e.y,_[A++]=e.z,t.st)if(D(o)&&o.positions.length===f)v[x++]=o.positions[C].x,v[x++]=o.positions[C].y;else{const t=r(re.multiplyByVector(h,e,b1),A1);kt.subtract(t,p,t);const i=V.clamp(t.x/n.width,0,1),o=V.clamp(t.y/n.height,0,1);v[x++]=i,v[x++]=o}t.normal&&(g[T++]=s.x,g[T++]=s.y,g[T++]=s.z),t.tangent&&(y[E++]=a.x,y[E++]=a.y,y[E++]=a.z),t.bitangent&&(b[w++]=c.x,b[w++]=c.y,b[w++]=c.z)}const S=new Md;return t.position&&(S.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:_})),t.normal&&(S.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:g})),t.tangent&&(S.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:y})),t.bitangent&&(S.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:b})),t.st&&(S.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:v})),new Na({attributes:S,indices:d,primitiveType:Vr.TRIANGLES})}function L1(e){const t=(e=M(e,M.EMPTY_OBJECT)).polygonHierarchy,n=e.textureCoordinates;L.defined("options.polygonHierarchy",t);const i=M(e.vertexFormat,Bd.DEFAULT);this._vertexFormat=Bd.clone(i),this._polygonHierarchy=t,this._stRotation=M(e.stRotation,0),this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=xD.computeHierarchyPackedLength(t,H)+Bd.packedLength+on.packedLength+(D(n)?xD.computeHierarchyPackedLength(n,kt):1)+2}L1.fromPositions=function(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.positions",e.positions);return new L1({polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates})},L1.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),n=xD.packPolygonHierarchy(e._polygonHierarchy,t,n,H),on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._stRotation,D(e._textureCoordinates)?n=xD.packPolygonHierarchy(e._textureCoordinates,t,n,kt):t[n++]=-1,t[n++]=e.packedLength,t};const M1=on.clone(on.UNIT_SPHERE),F1=new Bd,B1={polygonHierarchy:{}};L1.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=xD.unpackPolygonHierarchy(e,t,H);t=i.startingIndex,delete i.startingIndex;const o=on.unpack(e,t,M1);t+=on.packedLength;const r=Bd.unpack(e,t,F1);t+=Bd.packedLength;const s=e[t++],a=-1===e[t]?void 0:xD.unpackPolygonHierarchy(e,t,kt);D(a)?(t=a.startingIndex,delete a.startingIndex):t++;const c=e[t++];return D(n)||(n=new L1(B1)),n._polygonHierarchy=i,n._ellipsoid=on.clone(o,n._ellipsoid),n._vertexFormat=Bd.clone(r,n._vertexFormat),n._stRotation=s,n._textureCoordinates=a,n.packedLength=c,n},L1.createGeometry=function(e){const t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation,o=e._textureCoordinates,r=D(o);let s=n.positions;if(s=Ry(s,H.equalsEpsilon,!0),s.length<3)return;let a=w1,c=E1,l=x1,u=C1;const d=I1;if(!XW.computeProjectTo2DArguments(s,S1,u,d))return;if(a=H.cross(u,d,a),a=H.normalize(a,a),!H.equalsEpsilon(S1,H.ZERO,V.EPSILON6)){const t=e._ellipsoid.geodeticSurfaceNormal(S1,N1);H.dot(a,t)<0&&(a=H.negate(a,a),u=H.negate(u,u))}const h=XW.createProjectPointsTo2DFunction(S1,u,d),p=XW.createProjectPointTo2DFunction(S1,u,d);t.tangent&&(c=H.clone(u,c)),t.bitangent&&(l=H.clone(d,l));const f=xD.polygonsFromHierarchy(n,r,h,!1),m=f.hierarchy,_=f.polygons,g=r?xD.polygonsFromHierarchy(o,!0,(function(e){return e}),!1).polygons:void 0;if(0===m.length)return;s=m[0].outerRing;const y=$u.fromPoints(s),b=xD.computeBoundingRectangle(a,p,s,i,v1),v=[];for(let w=0;w<_.length;w++){const e=new Zd({geometry:R1(_[w],t,b,i,r?g[w]:void 0,p,a,c,l)});v.push(e)}const A=C_.combineInstances(v)[0];A.attributes.position.values=new Float64Array(A.attributes.position.values),A.indices=je.createTypedArray(A.attributes.position.values.length/3,A.indices);const T=A.attributes;return t.position||delete T.position,new Na({attributes:T,indices:A.indices,primitiveType:A.primitiveType,boundingSphere:y})};const z1=[],U1=[];function k1(e,t,n,i,o){const r=Rp.fromPoints(t,e).projectPointsOntoPlane(t,z1);let s,a;$O.computeWindingOrder2D(r)===us.CLOCKWISE&&(r.reverse(),t=t.slice().reverse());let c=t.length,l=0;if(i)for(s=new Float64Array(2*c*3),a=0;a<c;a++){const e=t[a],n=t[(a+1)%c];s[l++]=e.x,s[l++]=e.y,s[l++]=e.z,s[l++]=n.x,s[l++]=n.y,s[l++]=n.z}else{let i=0;if(o===Py.GEODESIC)for(a=0;a<c;a++)i+=xD.subdivideLineCount(t[a],t[(a+1)%c],n);else if(o===Py.RHUMB)for(a=0;a<c;a++)i+=xD.subdivideRhumbLineCount(e,t[a],t[(a+1)%c],n);for(s=new Float64Array(3*i),a=0;a<c;a++){let i;o===Py.GEODESIC?i=xD.subdivideLine(t[a],t[(a+1)%c],n,U1):o===Py.RHUMB&&(i=xD.subdivideRhumbLine(e,t[a],t[(a+1)%c],n,U1));const r=i.length;for(let e=0;e<r;++e)s[l++]=i[e]}}c=s.length/3;const u=2*c,d=je.createTypedArray(c,u);for(l=0,a=0;a<c-1;a++)d[l++]=a,d[l++]=a+1;return d[l++]=c-1,d[l++]=0,new Zd({geometry:new Na({attributes:new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s})}),indices:d,primitiveType:Vr.LINES})})}function V1(e,t,n,i,o){const r=Rp.fromPoints(t,e).projectPointsOntoPlane(t,z1);let s,a;$O.computeWindingOrder2D(r)===us.CLOCKWISE&&(r.reverse(),t=t.slice().reverse());let c=t.length;const l=new Array(c);let u=0;if(i)for(s=new Float64Array(2*c*3*2),a=0;a<c;++a){l[a]=u/3;const e=t[a],n=t[(a+1)%c];s[u++]=e.x,s[u++]=e.y,s[u++]=e.z,s[u++]=n.x,s[u++]=n.y,s[u++]=n.z}else{let i=0;if(o===Py.GEODESIC)for(a=0;a<c;a++)i+=xD.subdivideLineCount(t[a],t[(a+1)%c],n);else if(o===Py.RHUMB)for(a=0;a<c;a++)i+=xD.subdivideRhumbLineCount(e,t[a],t[(a+1)%c],n);for(s=new Float64Array(3*i*2),a=0;a<c;++a){let i;l[a]=u/3,o===Py.GEODESIC?i=xD.subdivideLine(t[a],t[(a+1)%c],n,U1):o===Py.RHUMB&&(i=xD.subdivideRhumbLine(e,t[a],t[(a+1)%c],n,U1));const r=i.length;for(let e=0;e<r;++e)s[u++]=i[e]}}c=s.length/6;const d=l.length,h=2*(2*c+d),p=je.createTypedArray(c+d,h);for(u=0,a=0;a<c;++a)p[u++]=a,p[u++]=(a+1)%c,p[u++]=a+c,p[u++]=(a+1)%c+c;for(a=0;a<d;a++){const e=l[a];p[u++]=e,p[u++]=e+c}return new Zd({geometry:new Na({attributes:new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s})}),indices:p,primitiveType:Vr.LINES})})}function H1(e){if(L.typeOf.object("options",e),L.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),e.perPositionHeight&&D(e.height))throw new P("Cannot use both options.perPositionHeight and options.height");if(D(e.arcType)&&e.arcType!==Py.GEODESIC&&e.arcType!==Py.RHUMB)throw new P("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=M(e.ellipsoid,on.WGS84),i=M(e.granularity,V.RADIANS_PER_DEGREE),o=M(e.perPositionHeight,!1),r=o&&D(e.extrudedHeight),s=M(e.arcType,Py.GEODESIC);let a=M(e.height,0),c=M(e.extrudedHeight,a);if(!r){const e=Math.max(a,c);c=Math.min(a,c),a=e}this._ellipsoid=on.clone(n),this._granularity=i,this._height=a,this._extrudedHeight=c,this._arcType=s,this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=xD.computeHierarchyPackedLength(t,H)+on.packedLength+8}H1.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),n=xD.packPolygonHierarchy(e._polygonHierarchy,t,n,H),on.pack(e._ellipsoid,t,n),n+=on.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._arcType,t[n++]=M(e._offsetAttribute,-1),t[n]=e.packedLength,t};const G1=on.clone(on.UNIT_SPHERE),j1={polygonHierarchy:{}};H1.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=xD.unpackPolygonHierarchy(e,t,H);t=i.startingIndex,delete i.startingIndex;const o=on.unpack(e,t,G1);t+=on.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=1===e[t++],l=1===e[t++],u=e[t++],d=e[t++],h=e[t];return D(n)||(n=new H1(j1)),n._polygonHierarchy=i,n._ellipsoid=on.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=l,n._perPositionHeightExtrude=c,n._arcType=u,n._offsetAttribute=-1===d?void 0:d,n.packedLength=h,n},H1.fromPositions=function(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.positions",e.positions);return new H1({polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},H1.createGeometry=function(e){const t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=xD.polygonOutlinesFromHierarchy(i,!o,t);if(0===s.length)return;let a;const c=[],l=V.chordLength(n,t.maximumRadius),u=e._height,d=e._extrudedHeight;let h,p;if(e._perPositionHeightExtrude||!V.equalsEpsilon(u,d,0,V.EPSILON2))for(p=0;p<s.length;p++){if(a=V1(t,s[p],l,o,r),a.geometry=xD.scaleToGeodeticHeightExtruded(a.geometry,u,d,t,o),D(e._offsetAttribute)){const t=a.geometry.attributes.position.values.length/3;let n=new Uint8Array(t);e._offsetAttribute===Fd.TOP?n=n.fill(1,0,t/2):(h=e._offsetAttribute===Fd.NONE?0:1,n=n.fill(h)),a.geometry.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}c.push(a)}else for(p=0;p<s.length;p++){if(a=k1(t,s[p],l,o,r),a.geometry.attributes.position.values=$O.scaleToGeodeticHeight(a.geometry.attributes.position.values,u,t,!o),D(e._offsetAttribute)){const t=a.geometry.attributes.position.values.length;h=e._offsetAttribute===Fd.NONE?0:1;const n=new Uint8Array(t/3).fill(h);a.geometry.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}c.push(a)}const f=C_.combineInstances(c)[0],m=$u.fromVertices(f.attributes.position.values);return new Na({attributes:f.attributes,indices:f.indices,primitiveType:f.primitiveType,boundingSphere:m,offsetAttribute:e._offsetAttribute})};const W1="Entity polygons cannot have both height and perPositionHeight. height will be ignored",q1="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",Y1=new Ot,X1=H.ZERO,Q1=new H,$1=new Ir,K1=[],Z1=new kt;function J1(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0,this.textureCoordinates=void 0}function e2(e,t){K$.call(this,{entity:e,scene:t,geometryOptions:new J1(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function t2(e,t,n){Dy.call(this,e,t,n)}function n2(e){const t=(e=M(e,M.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;if(!D(t))throw new P("options.polylinePositions is required.");if(!D(n))throw new P("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._cornerType=M(e.cornerType,uQ.ROUNDED),this._vertexFormat=Bd.clone(M(e.vertexFormat,Bd.DEFAULT)),this._granularity=M(e.granularity,V.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*H.packedLength;i+=1+n.length*kt.packedLength,this.packedLength=i+on.packedLength+Bd.packedLength+2}D(Object.create)&&(e2.prototype=Object.create(K$.prototype),e2.prototype.constructor=e2),e2.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,Y1)),D(t)||(t=Ot.WHITE),o.color=$d.fromColor(t)}let r;return D(i.offsetAttribute)&&(o.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,X1,Q1))),r=i.perPositionHeight&&!D(i.extrudedHeight)?new L1(i):new eP(i),new Zd({id:t,geometry:r,attributes:o})},e2.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,Y1),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(o),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(r),offset:void 0};let a;return D(i.offsetAttribute)&&(s.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,X1,Q1))),a=i.perPositionHeight&&!D(i.extrudedHeight)?new $W(i):new H1(i),new Zd({id:t,geometry:a,attributes:s})},e2.prototype._computeCenter=function(e,t){const n=Ou.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!D(n))return;const i=n.positions;if(0===i.length)return;const o=this._scene.mapProjection.ellipsoid,r=Rp.fromPoints(i,o),s=r.projectPointsOntoPlane(i,K1),a=s.length;let c=0,l=a-1,u=new kt;for(let h=0;h<a;l=h++){const e=s[h],t=s[l],n=e.x*t.y-t.x*e.y;let i=kt.add(e,t,Z1);i=kt.multiplyByScalar(i,n,i),u=kt.add(u,i,u),c+=n}const d=1/(3*c);return u=kt.multiplyByScalar(u,d,u),r.projectPointOntoEllipsoid(u,t)},e2.prototype._isHidden=function(e,t){return!D(t.hierarchy)||DA.prototype._isHidden.call(this,e,t)},e2.prototype._isOnTerrain=function(e,t){const n=K$.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=D(i)&&(!i.isConstant||i.getValue(ih.MINIMUM_VALUE));return n&&!o},e2.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Ou.isConstant(t.height)||!Ou.isConstant(t.extrudedHeight)||!Ou.isConstant(t.granularity)||!Ou.isConstant(t.stRotation)||!Ou.isConstant(t.textureCoordinates)||!Ou.isConstant(t.outlineWidth)||!Ou.isConstant(t.perPositionHeight)||!Ou.isConstant(t.closeTop)||!Ou.isConstant(t.closeBottom)||!Ou.isConstant(t.zIndex)||!Ou.isConstant(t.arcType)||this._onTerrain&&!Ou.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Oh)},e2.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof Oh,i=this._options;i.vertexFormat=n?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat;const o=t.hierarchy.getValue(ih.MINIMUM_VALUE);let r=Ou.getValueOrUndefined(t.height,ih.MINIMUM_VALUE);const s=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE);let a=Ou.getValueOrUndefined(t.extrudedHeight,ih.MINIMUM_VALUE);const c=Ou.getValueOrDefault(t.extrudedHeightReference,ih.MINIMUM_VALUE,wu.NONE),l=Ou.getValueOrDefault(t.perPositionHeight,ih.MINIMUM_VALUE,!1);let u;if(r=K$.getGeometryHeight(r,s),l?(D(r)&&(r=void 0,Oa(W1)),s!==wu.NONE&&l&&(r=void 0,Oa(q1))):(D(a)&&!D(r)&&(r=0),u=K$.computeGeometryOffsetAttribute(r,s,a,c)),i.polygonHierarchy=o,i.granularity=Ou.getValueOrUndefined(t.granularity,ih.MINIMUM_VALUE),i.stRotation=Ou.getValueOrUndefined(t.stRotation,ih.MINIMUM_VALUE),i.perPositionHeight=l,i.closeTop=Ou.getValueOrDefault(t.closeTop,ih.MINIMUM_VALUE,!0),i.closeBottom=Ou.getValueOrDefault(t.closeBottom,ih.MINIMUM_VALUE,!0),i.offsetAttribute=u,i.height=r,i.arcType=Ou.getValueOrDefault(t.arcType,ih.MINIMUM_VALUE,Py.GEODESIC),i.textureCoordinates=Ou.getValueOrUndefined(t.textureCoordinates,ih.MINIMUM_VALUE),a=K$.getGeometryExtrudedHeight(a,c),a===K$.CLAMP_TO_GROUND){const e=eP.computeRectangleFromPositions(i.polygonHierarchy.positions,i.ellipsoid,i.arcType,$1);a=Hh.getMinimumMaximumHeights(e).minimumTerrainHeight}i.extrudedHeight=a},e2.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight,i=D(n)&&n!==t;return!e.perPositionHeight&&(!i&&0===t||i&&e.closeTop&&e.closeBottom)},e2.DynamicGeometryUpdater=t2,D(Object.create)&&(t2.prototype=Object.create(Dy.prototype),t2.prototype.constructor=t2),t2.prototype._isHidden=function(e,t,n){return!D(this._options.polygonHierarchy)||Dy.prototype._isHidden.call(this,e,t,n)},t2.prototype._setOptions=function(e,t,n){const i=this._options;i.polygonHierarchy=Ou.getValueOrUndefined(t.hierarchy,n);let o=Ou.getValueOrUndefined(t.height,n);const r=Ou.getValueOrDefault(t.heightReference,n,wu.NONE),s=Ou.getValueOrDefault(t.extrudedHeightReference,n,wu.NONE);let a=Ou.getValueOrUndefined(t.extrudedHeight,n);const c=Ou.getValueOrUndefined(t.perPositionHeight,n);let l;if(o=K$.getGeometryHeight(o,s),c?(D(o)&&(o=void 0,Oa(W1)),r!==wu.NONE&&c&&(o=void 0,Oa(q1))):(D(a)&&!D(o)&&(o=0),l=K$.computeGeometryOffsetAttribute(o,r,a,s)),i.granularity=Ou.getValueOrUndefined(t.granularity,n),i.stRotation=Ou.getValueOrUndefined(t.stRotation,n),i.textureCoordinates=Ou.getValueOrUndefined(t.textureCoordinates,n),i.perPositionHeight=Ou.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=Ou.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=Ou.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=l,i.height=o,i.arcType=Ou.getValueOrDefault(t.arcType,n,Py.GEODESIC),a=K$.getGeometryExtrudedHeight(a,s),a===K$.CLAMP_TO_GROUND){const e=eP.computeRectangleFromPositions(i.polygonHierarchy.positions,i.ellipsoid,i.arcType,$1);a=Hh.getMinimumMaximumHeights(e).minimumTerrainHeight}i.extrudedHeight=a},n2.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");let i;n=M(n,0);const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=kt.packedLength)kt.pack(s[i],t,n);return on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const i2=on.clone(on.UNIT_SPHERE),o2=new Bd,r2={polylinePositions:void 0,shapePositions:void 0,ellipsoid:i2,vertexFormat:o2,cornerType:void 0,granularity:void 0};n2.unpack=function(e,t,n){if(!D(e))throw new P("array is required");let i;t=M(t,0);let o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)r[i]=H.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=kt.packedLength)s[i]=kt.unpack(e,t);const a=on.unpack(e,t,i2);t+=on.packedLength;const c=Bd.unpack(e,t,o2);t+=Bd.packedLength;const l=e[t++],u=e[t];return D(n)?(n._positions=r,n._shape=s,n._ellipsoid=on.clone(a,n._ellipsoid),n._vertexFormat=Bd.clone(c,n._vertexFormat),n._cornerType=l,n._granularity=u,n):(r2.polylinePositions=r,r2.shapePositions=s,r2.cornerType=l,r2.granularity=u,new n2(r2))};const s2=new Fr;function a2(e){const t=(e=M(e,M.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;if(!D(t))throw new P("options.polylinePositions is required.");if(!D(n))throw new P("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._cornerType=M(e.cornerType,uQ.ROUNDED),this._granularity=M(e.granularity,V.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*H.packedLength;i+=1+n.length*kt.packedLength,this.packedLength=i+on.packedLength+2}n2.createGeometry=function(e){const t=Ry(e._positions,H.equalsEpsilon);let n=e._shape;if(n=qQ.removeDuplicatesFromShape(n),t.length<2||n.length<3)return;$O.computeWindingOrder2D(n)===us.CLOCKWISE&&n.reverse();const i=Fr.fromPoints(n,s2);return function(e,t,n,i){const o=new Md;i.position&&(o.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:e}));const r=t.length,s=e.length/3,a=(s-2*r)/(2*r),c=$O.triangulate(t),l=(a-1)*r*6+2*c.length,u=je.createTypedArray(s,l);let d,h,p,f,m,_;const g=2*r;let y=0;for(d=0;d<a-1;d++){for(h=0;h<r-1;h++)p=2*h+d*r*2,_=p+g,f=p+1,m=f+g,u[y++]=f,u[y++]=p,u[y++]=m,u[y++]=m,u[y++]=p,u[y++]=_;p=2*r-2+d*r*2,f=p+1,m=f+g,_=p+g,u[y++]=f,u[y++]=p,u[y++]=m,u[y++]=m,u[y++]=p,u[y++]=_}if(i.st||i.tangent||i.bitangent){const e=new Float32Array(2*s),i=1/(a-1),c=1/n.height,l=n.height/2;let u,p,f=0;for(d=0;d<a;d++){for(u=d*i,p=c*(t[0].y+l),e[f++]=u,e[f++]=p,h=1;h<r;h++)p=c*(t[h].y+l),e[f++]=u,e[f++]=p,e[f++]=u,e[f++]=p;p=c*(t[0].y+l),e[f++]=u,e[f++]=p}for(h=0;h<r;h++)u=0,p=c*(t[h].y+l),e[f++]=u,e[f++]=p;for(h=0;h<r;h++)u=(a-1)*i,p=c*(t[h].y+l),e[f++]=u,e[f++]=p;o.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:new Float32Array(e)})}const b=s-2*r;for(d=0;d<c.length;d+=3){const e=c[d]+b,t=c[d+1]+b,n=c[d+2]+b;u[y++]=e,u[y++]=t,u[y++]=n,u[y++]=n+r,u[y++]=t+r,u[y++]=e+r}let v=new Na({attributes:o,indices:u,boundingSphere:$u.fromVertices(e),primitiveType:Vr.TRIANGLES});if(i.normal&&(v=C_.computeNormal(v)),i.tangent||i.bitangent){try{v=C_.computeTangentAndBitangent(v)}catch(A){Oa("polyline-volume-tangent-bitangent")}i.tangent||(v.attributes.tangent=void 0),i.bitangent||(v.attributes.bitangent=void 0),i.st||(v.attributes.st=void 0)}return v}(qQ.computePositions(t,n,i,e,!0),n,i,e._vertexFormat)},a2.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");let i;n=M(n,0);const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=kt.packedLength)kt.pack(s[i],t,n);return on.pack(e._ellipsoid,t,n),n+=on.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const c2=on.clone(on.UNIT_SPHERE),l2={polylinePositions:void 0,shapePositions:void 0,ellipsoid:c2,height:void 0,cornerType:void 0,granularity:void 0};a2.unpack=function(e,t,n){if(!D(e))throw new P("array is required");let i;t=M(t,0);let o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)r[i]=H.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=kt.packedLength)s[i]=kt.unpack(e,t);const a=on.unpack(e,t,c2);t+=on.packedLength;const c=e[t++],l=e[t];return D(n)?(n._positions=r,n._shape=s,n._ellipsoid=on.clone(a,n._ellipsoid),n._cornerType=c,n._granularity=l,n):(l2.polylinePositions=r,l2.shapePositions=s,l2.cornerType=c,l2.granularity=l,new a2(l2))};const u2=new Fr;a2.createGeometry=function(e){const t=Ry(e._positions,H.equalsEpsilon);let n=e._shape;if(n=qQ.removeDuplicatesFromShape(n),t.length<2||n.length<3)return;$O.computeWindingOrder2D(n)===us.CLOCKWISE&&n.reverse();const i=Fr.fromPoints(n,u2);return function(e,t){const n=new Md;n.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,o=n.position.values.length/3,r=e.length/3/i,s=je.createTypedArray(o,2*i*(r+1));let a,c,l=0;a=0;let u=a*i;for(c=0;c<i-1;c++)s[l++]=c+u,s[l++]=c+u+1;for(s[l++]=i-1+u,s[l++]=u,a=r-1,u=a*i,c=0;c<i-1;c++)s[l++]=c+u,s[l++]=c+u+1;for(s[l++]=i-1+u,s[l++]=u,a=0;a<r-1;a++){const e=i*a,t=e+i;for(c=0;c<i;c++)s[l++]=c+e,s[l++]=c+t}return new Na({attributes:n,indices:je.createTypedArray(o,s),boundingSphere:$u.fromVertices(e),primitiveType:Vr.LINES})}(qQ.computePositions(t,n,i,e,!1),n)};const d2=new Ot;function h2(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 p2(e,t){DA.call(this,{entity:e,scene:t,geometryOptions:new h2(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function f2(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(p2.prototype=Object.create(DA.prototype),p2.prototype.constructor=p2),p2.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Kd.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,d2)),D(t)||(t=Ot.WHITE),o=$d.fromColor(t),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new Zd({id:t,geometry:new n2(this._options),attributes:i})},p2.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,d2),o=this._distanceDisplayConditionProperty.getValue(e);return new Zd({id:t,geometry:new a2(this._options),attributes:{show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o)}})},p2.prototype._isHidden=function(e,t){return!D(t.positions)||!D(t.shape)||DA.prototype._isHidden.call(this,e,t)},p2.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&t.shape.isConstant&&Ou.isConstant(t.granularity)&&Ou.isConstant(t.outlineWidth)&&Ou.isConstant(t.cornerType))},p2.prototype._setStaticOptions=function(e,t){const n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof Oh;o.vertexFormat=r?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(ih.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(ih.MINIMUM_VALUE,o.shape),o.granularity=D(n)?n.getValue(ih.MINIMUM_VALUE):void 0,o.cornerType=D(i)?i.getValue(ih.MINIMUM_VALUE):void 0},p2.DynamicGeometryUpdater=f2,D(Object.create)&&(f2.prototype=Object.create(Dy.prototype),f2.prototype.constructor=f2),f2.prototype._isHidden=function(e,t,n){const i=this._options;return!D(i.polylinePositions)||!D(i.shapePositions)||Dy.prototype._isHidden.call(this,e,t,n)},f2.prototype._setOptions=function(e,t,n){const i=this._options;i.polylinePositions=Ou.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=Ou.getValueOrUndefined(t.shape,n),i.granularity=Ou.getValueOrUndefined(t.granularity,n),i.cornerType=Ou.getValueOrUndefined(t.cornerType,n)};const m2=new H,_2=new H,g2=new H,y2=new H,b2=new Ir,v2=new kt,A2=new $u,T2=new $u;function w2(e,t){const n=new Na({attributes:new Md,primitiveType:Vr.TRIANGLES});return n.attributes.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}const E2=new H,x2=new H;function S2(e,t){const n=e._vertexFormat,i=e._ellipsoid,o=t.height,r=t.width,s=t.northCap,a=t.southCap;let c=0,l=o,u=o,d=0;s&&(c=1,u-=1,d+=1),a&&(l-=1,u-=1,d+=1),d+=r*u;const h=n.position?new Float64Array(3*d):void 0,p=n.st?new Float32Array(2*d):void 0;let f=0,m=0;const _=m2,g=v2;let y=Number.MAX_VALUE,b=Number.MAX_VALUE,v=-Number.MAX_VALUE,A=-Number.MAX_VALUE;for(let I=c;I<l;++I)for(let e=0;e<r;++e)fW.computePosition(t,i,n.st,I,e,_,g),h[f++]=_.x,h[f++]=_.y,h[f++]=_.z,n.st&&(p[m++]=g.x,p[m++]=g.y,y=Math.min(y,g.x),b=Math.min(b,g.y),v=Math.max(v,g.x),A=Math.max(A,g.y));if(s&&(fW.computePosition(t,i,n.st,0,0,_,g),h[f++]=_.x,h[f++]=_.y,h[f++]=_.z,n.st&&(p[m++]=g.x,p[m++]=g.y,y=g.x,b=g.y,v=g.x,A=g.y)),a&&(fW.computePosition(t,i,n.st,o-1,0,_,g),h[f++]=_.x,h[f++]=_.y,h[f]=_.z,n.st&&(p[m++]=g.x,p[m]=g.y,y=Math.min(y,g.x),b=Math.min(b,g.y),v=Math.max(v,g.x),A=Math.max(A,g.y))),n.st&&(y<0||b<0||v>1||A>1))for(let I=0;I<p.length;I+=2)p[I]=(p[I]-y)/(v-y),p[I+1]=(p[I+1]-b)/(A-b);const T=function(e,t,n,i){const o=e.length,r=t.normal?new Float32Array(o):void 0,s=t.tangent?new Float32Array(o):void 0,a=t.bitangent?new Float32Array(o):void 0;let c=0;const l=y2,u=g2;let d=_2;if(t.normal||t.tangent||t.bitangent)for(let h=0;h<o;h+=3){const o=H.fromArray(e,h,m2),p=c+1,f=c+2;d=n.geodeticSurfaceNormal(o,d),(t.tangent||t.bitangent)&&(H.cross(H.UNIT_Z,d,u),re.multiplyByVector(i,u,u),H.normalize(u,u),t.bitangent&&H.normalize(H.cross(d,u,l),l)),t.normal&&(r[c]=d.x,r[p]=d.y,r[f]=d.z),t.tangent&&(s[c]=u.x,s[p]=u.y,s[f]=u.z),t.bitangent&&(a[c]=l.x,a[p]=l.y,a[f]=l.z),c+=3}return w2(t,{positions:e,normals:r,tangents:s,bitangents:a})}(h,n,i,t.tangentRotationMatrix);let w=6*(r-1)*(u-1);s&&(w+=3*(r-1)),a&&(w+=3*(r-1));const E=je.createTypedArray(d,w);let x,S=0,C=0;for(x=0;x<u-1;++x){for(let e=0;e<r-1;++e){const e=S,t=e+r,n=t+1,i=e+1;E[C++]=e,E[C++]=t,E[C++]=i,E[C++]=i,E[C++]=t,E[C++]=n,++S}++S}if(s||a){let e=d-1;const t=d-1;let n,i;if(s&&a&&(e=d-2),S=0,s)for(x=0;x<r-1;x++)n=S,i=n+1,E[C++]=e,E[C++]=n,E[C++]=i,++S;if(a)for(S=(u-1)*r,x=0;x<r-1;x++)n=S,i=n+1,E[C++]=n,E[C++]=t,E[C++]=i,++S}return T.indices=E,n.st&&(T.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:p})),T}function C2(e,t,n,i,o){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n+2],e[t++]=o[n],e[t++]=o[n+1],e[t]=o[n+2],e}function I2(e,t,n,i){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n],e[t]=i[n+1],e}const O2=new Bd;function D2(e,t){const n=e._shadowVolume,i=e._offsetAttribute,o=e._vertexFormat,r=e._extrudedHeight,s=e._surfaceHeight,a=e._ellipsoid,c=t.height,l=t.width;let u;if(n){const t=Bd.clone(o,O2);t.normal=!0,e._vertexFormat=t}const d=S2(e,t);n&&(e._vertexFormat=o);let h=$O.scaleToGeodeticHeight(d.attributes.position.values,s,a,!1);h=new Float64Array(h);let p=h.length;const f=2*p,m=new Float64Array(f);m.set(h);const _=$O.scaleToGeodeticHeight(d.attributes.position.values,r,a);m.set(_,p),d.attributes.position.values=m;const g=o.normal?new Float32Array(f):void 0,y=o.tangent?new Float32Array(f):void 0,b=o.bitangent?new Float32Array(f):void 0,v=o.st?new Float32Array(f/3*2):void 0;let A,T,w;if(o.normal){for(T=d.attributes.normal.values,g.set(T),u=0;u<p;u++)T[u]=-T[u];g.set(T,p),d.attributes.normal.values=g}if(n){T=d.attributes.normal.values,o.normal||(d.attributes.normal=void 0);const e=new Float32Array(f);for(u=0;u<p;u++)T[u]=-T[u];e.set(T,p),d.attributes.extrudeDirection=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})}const E=D(i);if(E){const e=p/3*2;let t=new Uint8Array(e);i===Fd.TOP?t=t.fill(1,0,e/2):(w=i===Fd.NONE?0:1,t=t.fill(w)),d.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}if(o.tangent){const e=d.attributes.tangent.values;for(y.set(e),u=0;u<p;u++)e[u]=-e[u];y.set(e,p),d.attributes.tangent.values=y}if(o.bitangent){const e=d.attributes.bitangent.values;b.set(e),b.set(e,p),d.attributes.bitangent.values=b}o.st&&(A=d.attributes.st.values,v.set(A),v.set(A,p/3*2),d.attributes.st.values=v);const x=d.indices,S=x.length,C=p/3,I=je.createTypedArray(f/3,2*S);for(I.set(x),u=0;u<S;u+=3)I[u+S]=x[u+2]+C,I[u+1+S]=x[u+1]+C,I[u+2+S]=x[u]+C;d.indices=I;const O=t.northCap,P=t.southCap;let N=c,R=2,L=0,M=4,F=4;O&&(R-=1,N-=1,L+=1,M-=2,F-=1),P&&(R-=1,N-=1,L+=1,M-=2,F-=1),L+=R*l+2*N-M;const B=2*(L+F);let z=new Float64Array(3*B);const U=n?new Float32Array(3*B):void 0;let k=E?new Uint8Array(B):void 0,G=o.st?new Float32Array(2*B):void 0;const j=i===Fd.TOP;E&&!j&&(w=i===Fd.ALL?1:0,k=k.fill(w));let W=0,q=0,Y=0,X=0;const Q=l*N;let $;for(u=0;u<Q;u+=l)$=3*u,z=C2(z,W,$,h,_),W+=6,o.st&&(G=I2(G,q,2*u,A),q+=4),n&&(Y+=3,U[Y++]=T[$],U[Y++]=T[$+1],U[Y++]=T[$+2]),j&&(k[X++]=1,X+=1);if(P){const e=O?Q+1:Q;for($=3*e,u=0;u<2;u++)z=C2(z,W,$,h,_),W+=6,o.st&&(G=I2(G,q,2*e,A),q+=4),n&&(Y+=3,U[Y++]=T[$],U[Y++]=T[$+1],U[Y++]=T[$+2]),j&&(k[X++]=1,X+=1)}else for(u=Q-l;u<Q;u++)$=3*u,z=C2(z,W,$,h,_),W+=6,o.st&&(G=I2(G,q,2*u,A),q+=4),n&&(Y+=3,U[Y++]=T[$],U[Y++]=T[$+1],U[Y++]=T[$+2]),j&&(k[X++]=1,X+=1);for(u=Q-1;u>0;u-=l)$=3*u,z=C2(z,W,$,h,_),W+=6,o.st&&(G=I2(G,q,2*u,A),q+=4),n&&(Y+=3,U[Y++]=T[$],U[Y++]=T[$+1],U[Y++]=T[$+2]),j&&(k[X++]=1,X+=1);if(O){const e=Q;for($=3*e,u=0;u<2;u++)z=C2(z,W,$,h,_),W+=6,o.st&&(G=I2(G,q,2*e,A),q+=4),n&&(Y+=3,U[Y++]=T[$],U[Y++]=T[$+1],U[Y++]=T[$+2]),j&&(k[X++]=1,X+=1)}else for(u=l-1;u>=0;u--)$=3*u,z=C2(z,W,$,h,_),W+=6,o.st&&(G=I2(G,q,2*u,A),q+=4),n&&(Y+=3,U[Y++]=T[$],U[Y++]=T[$+1],U[Y++]=T[$+2]),j&&(k[X++]=1,X+=1);let K=function(e,t,n){const i=e.length,o=t.normal?new Float32Array(i):void 0,r=t.tangent?new Float32Array(i):void 0,s=t.bitangent?new Float32Array(i):void 0;let a=0,c=0,l=0,u=!0,d=y2,h=g2,p=_2;if(t.normal||t.tangent||t.bitangent)for(let f=0;f<i;f+=6){const m=H.fromArray(e,f,m2),_=H.fromArray(e,(f+6)%i,E2);if(u){const t=H.fromArray(e,(f+3)%i,x2);H.subtract(_,m,_),H.subtract(t,m,t),p=H.normalize(H.cross(t,_,p),p),u=!1}H.equalsEpsilon(_,m,V.EPSILON10)&&(u=!0),(t.tangent||t.bitangent)&&(d=n.geodeticSurfaceNormal(m,d),t.tangent&&(h=H.normalize(H.cross(d,p,h),h))),t.normal&&(o[a++]=p.x,o[a++]=p.y,o[a++]=p.z,o[a++]=p.x,o[a++]=p.y,o[a++]=p.z),t.tangent&&(r[c++]=h.x,r[c++]=h.y,r[c++]=h.z,r[c++]=h.x,r[c++]=h.y,r[c++]=h.z),t.bitangent&&(s[l++]=d.x,s[l++]=d.y,s[l++]=d.z,s[l++]=d.x,s[l++]=d.y,s[l++]=d.z)}return w2(t,{positions:e,normals:o,tangents:r,bitangents:s})}(z,o,a);o.st&&(K.attributes.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:G})),n&&(K.attributes.extrudeDirection=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:U})),E&&(K.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:k}));const Z=je.createTypedArray(B,6*L);let J,ee,te,ne;p=z.length/3;let ie=0;for(u=0;u<p-1;u+=2){J=u,ne=(J+2)%p;const e=H.fromArray(z,3*J,E2),t=H.fromArray(z,3*ne,x2);H.equalsEpsilon(e,t,V.EPSILON10)||(ee=(J+1)%p,te=(ee+2)%p,Z[ie++]=J,Z[ie++]=ee,Z[ie++]=ne,Z[ie++]=ne,Z[ie++]=ee,Z[ie++]=te)}return K.indices=Z,K=C_.combineInstances([new Zd({geometry:d}),new Zd({geometry:K})]),K[0]}const P2=[new H,new H,new H,new H],N2=new Qt,R2=new Qt;function L2(e,t,n,i,o){if(0===n)return Ir.clone(e,o);const r=fW.computeOptions(e,t,n,0,b2,N2),s=r.height,a=r.width,c=P2;return fW.computePosition(r,i,!1,0,0,c[0]),fW.computePosition(r,i,!1,0,a-1,c[1]),fW.computePosition(r,i,!1,s-1,0,c[2]),fW.computePosition(r,i,!1,s-1,a-1,c[3]),Ir.fromCartesianArray(c,i,o)}function M2(e){const t=(e=M(e,M.EMPTY_OBJECT)).rectangle;if(L.typeOf.object("rectangle",t),Ir.validate(t),t.north<t.south)throw new P("options.rectangle.north must be greater than or equal to options.rectangle.south");const n=M(e.height,0),i=M(e.extrudedHeight,n);this._rectangle=Ir.clone(t),this._granularity=M(e.granularity,V.RADIANS_PER_DEGREE),this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=M(e.rotation,0),this._stRotation=M(e.stRotation,0),this._vertexFormat=Bd.clone(M(e.vertexFormat,Bd.DEFAULT)),this._extrudedHeight=Math.min(n,i),this._shadowVolume=M(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}M2.packedLength=Ir.packedLength+on.packedLength+Bd.packedLength+7,M2.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),Ir.pack(e._rectangle,t,n),n+=Ir.packedLength,on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=M(e._offsetAttribute,-1),t};const F2=new Ir,B2=on.clone(on.UNIT_SPHERE),z2={rectangle:F2,ellipsoid:B2,vertexFormat:O2,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};M2.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=Ir.unpack(e,t,F2);t+=Ir.packedLength;const o=on.unpack(e,t,B2);t+=on.packedLength;const r=Bd.unpack(e,t,O2);t+=Bd.packedLength;const s=e[t++],a=e[t++],c=e[t++],l=e[t++],u=e[t++],d=1===e[t++],h=e[t];return D(n)?(n._rectangle=Ir.clone(i,n._rectangle),n._ellipsoid=on.clone(o,n._ellipsoid),n._vertexFormat=Bd.clone(r,n._vertexFormat),n._granularity=s,n._surfaceHeight=a,n._rotation=c,n._stRotation=l,n._extrudedHeight=u,n._shadowVolume=d,n._offsetAttribute=-1===h?void 0:h,n):(z2.granularity=s,z2.height=a,z2.rotation=c,z2.stRotation=l,z2.extrudedHeight=u,z2.shadowVolume=d,z2.offsetAttribute=-1===h?void 0:h,new M2(z2))},M2.computeRectangle=function(e,t){const n=(e=M(e,M.EMPTY_OBJECT)).rectangle;if(L.typeOf.object("rectangle",n),Ir.validate(n),n.north<n.south)throw new P("options.rectangle.north must be greater than or equal to options.rectangle.south");const i=M(e.granularity,V.RADIANS_PER_DEGREE),o=M(e.ellipsoid,on.WGS84);return L2(n,i,M(e.rotation,0),o,t)};const U2=new re,k2=new _o,V2=new Qt;M2.createGeometry=function(e){if(V.equalsEpsilon(e._rectangle.north,e._rectangle.south,V.EPSILON10)||V.equalsEpsilon(e._rectangle.east,e._rectangle.west,V.EPSILON10))return;let t=e._rectangle;const n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=fW.computeOptions(t,e._granularity,i,o,b2,N2,R2),a=U2;if(0!==o||0!==i){const e=Ir.center(t,V2),i=n.geodeticSurfaceNormalCartographic(e,E2);_o.fromAxisAngle(i,-o,k2),re.fromQuaternion(k2,a)}else re.clone(re.IDENTITY,a);const c=e._surfaceHeight,l=e._extrudedHeight,u=!V.equalsEpsilon(c,l,0,V.EPSILON2);let d,h;if(s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a,t=e._rectangle,u){d=D2(e,s);const i=$u.fromRectangle3D(t,n,c,T2),o=$u.fromRectangle3D(t,n,l,A2);h=$u.union(i,o)}else{if(d=S2(e,s),d.attributes.position.values=$O.scaleToGeodeticHeight(d.attributes.position.values,c,n,!1),D(e._offsetAttribute)){const t=d.attributes.position.values.length,n=e._offsetAttribute===Fd.NONE?0:1,i=new Uint8Array(t/3).fill(n);d.attributes.applyOffset=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}h=$u.fromRectangle3D(t,n,c)}return r.position||delete d.attributes.position,new Na({attributes:d.attributes,indices:d.indices,primitiveType:d.primitiveType,boundingSphere:h,offsetAttribute:e._offsetAttribute})},M2.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new M2({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Bd.POSITION_ONLY,shadowVolume:!0})};const H2=new Ir,G2=[new kt,new kt,new kt],j2=new Ms,W2=new Qt;Object.defineProperties(M2.prototype,{rectangle:{get:function(){return D(this._rotatedRectangle)||(this._rotatedRectangle=L2(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return D(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(e){if(0===e._stRotation)return[0,0,0,1,1,0];const t=Ir.clone(e._rectangle,H2),n=e._granularity,i=e._ellipsoid,o=L2(t,n,e._rotation-e._stRotation,i,H2),r=G2;r[0].x=o.west,r[0].y=o.south,r[1].x=o.west,r[1].y=o.north,r[2].x=o.east,r[2].y=o.south;const s=e.rectangle,a=Ms.fromRotation(e._stRotation,j2),c=Ir.center(s,W2);for(let p=0;p<3;++p){const e=r[p];e.x-=c.longitude,e.y-=c.latitude,Ms.multiplyByVector(a,e,e),e.x+=c.longitude,e.y+=c.latitude,e.x=(e.x-s.west)/s.width,e.y=(e.y-s.south)/s.height}const l=r[0],u=r[1],d=r[2],h=new Array(6);return kt.pack(l,h),kt.pack(u,h,2),kt.pack(d,h,4),h}(this)),this._textureCoordinateRotationPoints}}});const q2=new Ot,Y2=H.ZERO,X2=new H,Q2=new Ir,$2=new Ir,K2=new Qt;function Z2(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 J2(e,t){K$.call(this,{entity:e,scene:t,geometryOptions:new Z2(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function e3(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(J2.prototype=Object.create(K$.prototype),J2.prototype.constructor=J2),J2.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,q2)),D(t)||(t=Ot.WHITE),i.color=$d.fromColor(t)}return D(this._options.offsetAttribute)&&(i.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,Y2,X2))),new Zd({id:t,geometry:new M2(this._options),attributes:i})},J2.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,q2),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o),offset:void 0};return D(this._options.offsetAttribute)&&(r.offset=oh.fromCartesian3(Ou.getValueOrDefault(this._terrainOffsetProperty,e,Y2,X2))),new Zd({id:t,geometry:new vW(this._options),attributes:r})},J2.prototype._computeCenter=function(e,t){const n=Ou.getValueOrUndefined(this._entity.rectangle.coordinates,e,$2);if(!D(n))return;const i=Ir.center(n,K2);return Qt.toCartesian(i,on.WGS84,t)},J2.prototype._isHidden=function(e,t){return!D(t.coordinates)||DA.prototype._isHidden.call(this,e,t)},J2.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Ou.isConstant(t.height)||!Ou.isConstant(t.extrudedHeight)||!Ou.isConstant(t.granularity)||!Ou.isConstant(t.stRotation)||!Ou.isConstant(t.rotation)||!Ou.isConstant(t.outlineWidth)||!Ou.isConstant(t.zIndex)||this._onTerrain&&!Ou.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Oh)},J2.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof Oh;let i=Ou.getValueOrUndefined(t.height,ih.MINIMUM_VALUE);const o=Ou.getValueOrDefault(t.heightReference,ih.MINIMUM_VALUE,wu.NONE);let r=Ou.getValueOrUndefined(t.extrudedHeight,ih.MINIMUM_VALUE);const s=Ou.getValueOrDefault(t.extrudedHeightReference,ih.MINIMUM_VALUE,wu.NONE);D(r)&&!D(i)&&(i=0);const a=this._options;a.vertexFormat=n?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(ih.MINIMUM_VALUE,a.rectangle),a.granularity=Ou.getValueOrUndefined(t.granularity,ih.MINIMUM_VALUE),a.stRotation=Ou.getValueOrUndefined(t.stRotation,ih.MINIMUM_VALUE),a.rotation=Ou.getValueOrUndefined(t.rotation,ih.MINIMUM_VALUE),a.offsetAttribute=K$.computeGeometryOffsetAttribute(i,o,r,s),a.height=K$.getGeometryHeight(i,o),r=K$.getGeometryExtrudedHeight(r,s),r===K$.CLAMP_TO_GROUND&&(r=Hh.getMinimumMaximumHeights(M2.computeRectangle(a,Q2)).minimumTerrainHeight),a.extrudedHeight=r},J2.DynamicGeometryUpdater=e3,D(Object.create)&&(e3.prototype=Object.create(Dy.prototype),e3.prototype.constructor=e3),e3.prototype._isHidden=function(e,t,n){return!D(this._options.rectangle)||Dy.prototype._isHidden.call(this,e,t,n)},e3.prototype._setOptions=function(e,t,n){const i=this._options;let o=Ou.getValueOrUndefined(t.height,n);const r=Ou.getValueOrDefault(t.heightReference,n,wu.NONE);let s=Ou.getValueOrUndefined(t.extrudedHeight,n);const a=Ou.getValueOrDefault(t.extrudedHeightReference,n,wu.NONE);D(s)&&!D(o)&&(o=0),i.rectangle=Ou.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=Ou.getValueOrUndefined(t.granularity,n),i.stRotation=Ou.getValueOrUndefined(t.stRotation,n),i.rotation=Ou.getValueOrUndefined(t.rotation,n),i.offsetAttribute=K$.computeGeometryOffsetAttribute(o,r,s,a),i.height=K$.getGeometryHeight(o,r),s=K$.getGeometryExtrudedHeight(s,a),s===K$.CLAMP_TO_GROUND&&(s=Hh.getMinimumMaximumHeights(M2.computeRectangle(i,Q2)).minimumTerrainHeight),i.extrudedHeight=s};const t3={};function n3(e,t){return V.equalsEpsilon(e.latitude,t.latitude,V.EPSILON10)&&V.equalsEpsilon(e.longitude,t.longitude,V.EPSILON10)}const i3=new Qt,o3=new Qt;const r3=new Array(2),s3=new Array(2),a3={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};t3.computePositions=function(e,t,n,i,o,r){const s=function(e,t,n,i){const o=(t=Ry(t,H.equalsEpsilon)).length;if(o<2)return;const r=D(i),s=D(n),a=new Array(o),c=new Array(o),l=new Array(o),u=t[0];a[0]=u;const d=e.cartesianToCartographic(u,i3);s&&(d.height=n[0]),c[0]=d.height,l[0]=r?i[0]:0;let h=c[0]===l[0],p=1;for(let f=1;f<o;++f){const o=t[f],u=e.cartesianToCartographic(o,o3);s&&(u.height=n[f]),h=h&&0===u.height,n3(d,u)?d.height<u.height&&(c[p-1]=u.height):(a[p]=o,c[p]=u.height,l[p]=r?i[f]:0,h=h&&c[p]===l[p],Qt.clone(u,d),++p)}return h||p<2?void 0:(a.length=p,c.length=p,l.length=p,{positions:a,topHeights:c,bottomHeights:l})}(e,t,n,i);if(!D(s))return;t=s.positions,n=s.topHeights,i=s.bottomHeights;const a=t.length,c=a-2;let l,u;const d=V.chordLength(o,e.maximumRadius),h=a3;if(h.minDistance=d,h.ellipsoid=e,r){let e,o=0;for(e=0;e<a-1;e++)o+=$H.numberOfPoints(t[e],t[e+1],d)+1;l=new Float64Array(3*o),u=new Float64Array(3*o);const r=r3,s=s3;h.positions=r,h.height=s;let c=0;for(e=0;e<a-1;e++){r[0]=t[e],r[1]=t[e+1],s[0]=n[e],s[1]=n[e+1];const o=$H.generateArc(h);l.set(o,c),s[0]=i[e],s[1]=i[e+1],u.set($H.generateArc(h),c),c+=o.length}}else h.positions=t,h.height=n,l=new Float64Array($H.generateArc(h)),h.height=i,u=new Float64Array($H.generateArc(h));return{bottomPositions:u,topPositions:l,numCorners:c}};const c3=t3,l3=new H,u3=new H,d3=new H,h3=new H,p3=new H,f3=new H,m3=new H;function _3(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions,n=e.maximumHeights,i=e.minimumHeights;if(!D(t))throw new P("options.positions is required.");if(D(n)&&n.length!==t.length)throw new P("options.positions and options.maximumHeights must have the same length.");if(D(i)&&i.length!==t.length)throw new P("options.positions and options.minimumHeights must have the same length.");const o=M(e.vertexFormat,Bd.DEFAULT),r=M(e.granularity,V.RADIANS_PER_DEGREE),s=M(e.ellipsoid,on.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=Bd.clone(o),this._granularity=r,this._ellipsoid=on.clone(s),this._workerName="createWallGeometry";let a=1+t.length*H.packedLength+2;D(i)&&(a+=i.length),D(n)&&(a+=n.length),this.packedLength=a+on.packedLength+Bd.packedLength+1}_3.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");let i;n=M(n,0);const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(o[i],t,n);const s=e._minimumHeights;if(r=D(s)?s.length:0,t[n++]=r,D(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=D(a)?a.length:0,t[n++]=r,D(a))for(i=0;i<r;++i)t[n++]=a[i];return on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),t[n+=Bd.packedLength]=e._granularity,t};const g3=on.clone(on.UNIT_SPHERE),y3=new Bd,b3={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:g3,vertexFormat:y3,granularity:void 0};_3.unpack=function(e,t,n){if(!D(e))throw new P("array is required");let i;t=M(t,0);let o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)r[i]=H.unpack(e,t);let s,a;if(o=e[t++],o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];if(o=e[t++],o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const c=on.unpack(e,t,g3);t+=on.packedLength;const l=Bd.unpack(e,t,y3),u=e[t+=Bd.packedLength];return D(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=on.clone(c,n._ellipsoid),n._vertexFormat=Bd.clone(l,n._vertexFormat),n._granularity=u,n):(b3.positions=r,b3.minimumHeights=s,b3.maximumHeights=a,b3.granularity=u,new _3(b3))},_3.fromConstantHeights=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions;if(!D(t))throw new P("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=D(o),a=D(r);if(s||a){const e=t.length;n=s?new Array(e):void 0,i=a?new Array(e):void 0;for(let t=0;t<e;++t)s&&(n[t]=o),a&&(i[t]=r)}return new _3({positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},_3.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=c3.computePositions(s,t,i,n,r,!0);if(!D(a))return;const c=a.bottomPositions,l=a.topPositions,u=a.numCorners;let d=l.length,h=2*d;const p=o.position?new Float64Array(h):void 0,f=o.normal?new Float32Array(h):void 0,m=o.tangent?new Float32Array(h):void 0,_=o.bitangent?new Float32Array(h):void 0,g=o.st?new Float32Array(h/3*2):void 0;let y,b=0,v=0,A=0,T=0,w=0,E=m3,x=f3,S=p3,C=!0;d/=3;let I=0;const O=1/(d-u-1);for(y=0;y<d;++y){const e=3*y,t=H.fromArray(l,e,l3),n=H.fromArray(c,e,u3);if(o.position&&(p[b++]=n.x,p[b++]=n.y,p[b++]=n.z,p[b++]=t.x,p[b++]=t.y,p[b++]=t.z),o.st&&(g[w++]=I,g[w++]=0,g[w++]=I,g[w++]=1),o.normal||o.tangent||o.bitangent){let n=H.clone(H.ZERO,h3);const i=H.subtract(t,s.geodeticSurfaceNormal(t,u3),u3);if(y+1<d&&(n=H.fromArray(l,e+3,h3)),C){const e=H.subtract(n,t,d3),o=H.subtract(i,t,l3);E=H.normalize(H.cross(o,e,E),E),C=!1}H.equalsEpsilon(t,n,V.EPSILON10)?C=!0:(I+=O,o.tangent&&(x=H.normalize(H.subtract(n,t,x),x)),o.bitangent&&(S=H.normalize(H.cross(E,x,S),S))),o.normal&&(f[v++]=E.x,f[v++]=E.y,f[v++]=E.z,f[v++]=E.x,f[v++]=E.y,f[v++]=E.z),o.tangent&&(m[T++]=x.x,m[T++]=x.y,m[T++]=x.z,m[T++]=x.x,m[T++]=x.y,m[T++]=x.z),o.bitangent&&(_[A++]=S.x,_[A++]=S.y,_[A++]=S.z,_[A++]=S.x,_[A++]=S.y,_[A++]=S.z)}}const P=new Md;o.position&&(P.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:p})),o.normal&&(P.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:f})),o.tangent&&(P.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:m})),o.bitangent&&(P.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:_})),o.st&&(P.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:g}));const N=h/3;h-=6*(u+1);const R=je.createTypedArray(N,h);let L=0;for(y=0;y<N-2;y+=2){const e=y,t=y+2,n=H.fromArray(p,3*e,l3),i=H.fromArray(p,3*t,u3);if(H.equalsEpsilon(n,i,V.EPSILON10))continue;const o=y+1,r=y+3;R[L++]=o,R[L++]=e,R[L++]=r,R[L++]=r,R[L++]=e,R[L++]=t}return new Na({attributes:P,indices:R,primitiveType:Vr.TRIANGLES,boundingSphere:new $u.fromVertices(p)})};const v3=new H,A3=new H;function T3(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions,n=e.maximumHeights,i=e.minimumHeights;if(!D(t))throw new P("options.positions is required.");if(D(n)&&n.length!==t.length)throw new P("options.positions and options.maximumHeights must have the same length.");if(D(i)&&i.length!==t.length)throw new P("options.positions and options.minimumHeights must have the same length.");const o=M(e.granularity,V.RADIANS_PER_DEGREE),r=M(e.ellipsoid,on.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=o,this._ellipsoid=on.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*H.packedLength+2;D(i)&&(s+=i.length),D(n)&&(s+=n.length),this.packedLength=s+on.packedLength+1}T3.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");let i;n=M(n,0);const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(o[i],t,n);const s=e._minimumHeights;if(r=D(s)?s.length:0,t[n++]=r,D(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=D(a)?a.length:0,t[n++]=r,D(a))for(i=0;i<r;++i)t[n++]=a[i];return on.pack(e._ellipsoid,t,n),t[n+=on.packedLength]=e._granularity,t};const w3=on.clone(on.UNIT_SPHERE),E3={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:w3,granularity:void 0};T3.unpack=function(e,t,n){if(!D(e))throw new P("array is required");let i;t=M(t,0);let o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)r[i]=H.unpack(e,t);let s,a;if(o=e[t++],o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];if(o=e[t++],o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const c=on.unpack(e,t,w3),l=e[t+=on.packedLength];return D(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=on.clone(c,n._ellipsoid),n._granularity=l,n):(E3.positions=r,E3.minimumHeights=s,E3.maximumHeights=a,E3.granularity=l,new T3(E3))},T3.fromConstantHeights=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions;if(!D(t))throw new P("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=D(o),a=D(r);if(s||a){const e=t.length;n=s?new Array(e):void 0,i=a?new Array(e):void 0;for(let t=0;t<e;++t)s&&(n[t]=o),a&&(i[t]=r)}return new T3({positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid})},T3.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._granularity,r=e._ellipsoid,s=c3.computePositions(r,t,i,n,o,!1);if(!D(s))return;const a=s.bottomPositions,c=s.topPositions;let l=c.length,u=2*l;const d=new Float64Array(u);let h,p=0;for(l/=3,h=0;h<l;++h){const e=3*h,t=H.fromArray(c,e,v3),n=H.fromArray(a,e,A3);d[p++]=n.x,d[p++]=n.y,d[p++]=n.z,d[p++]=t.x,d[p++]=t.y,d[p++]=t.z}const f=new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:d})}),m=u/3;u=2*m-4+m;const _=je.createTypedArray(m,u);let g=0;for(h=0;h<m-2;h+=2){const e=h,t=h+2,n=H.fromArray(d,3*e,v3),i=H.fromArray(d,3*t,A3);if(H.equalsEpsilon(n,i,V.EPSILON10))continue;const o=h+1,r=h+3;_[g++]=o,_[g++]=e,_[g++]=o,_[g++]=r,_[g++]=e,_[g++]=t}return _[g++]=m-2,_[g++]=m-1,new Na({attributes:f,indices:_,primitiveType:Vr.LINES,boundingSphere:new $u.fromVertices(d)})};const x3=new Ot;function S3(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 C3(e,t){DA.call(this,{entity:e,scene:t,geometryOptions:new S3(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function I3(e,t,n){Dy.call(this,e,t,n)}D(Object.create)&&(C3.prototype=Object.create(DA.prototype),C3.prototype.constructor=C3),C3.prototype.createFillGeometryInstance=function(e){if(L.defined("time",e),!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Kd.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Oh){let t;D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(t=this._materialProperty.color.getValue(e,x3)),D(t)||(t=Ot.WHITE),o=$d.fromColor(t),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new Zd({id:t,geometry:new _3(this._options),attributes:i})},C3.prototype.createOutlineGeometryInstance=function(e){if(L.defined("time",e),!this._outlineEnabled)throw new P("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Ou.getValueOrDefault(this._outlineColorProperty,e,Ot.BLACK,x3),o=this._distanceDisplayConditionProperty.getValue(e);return new Zd({id:t,geometry:new T3(this._options),attributes:{show:new rh(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$d.fromColor(i),distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o)}})},C3.prototype._isHidden=function(e,t){return!D(t.positions)||DA.prototype._isHidden.call(this,e,t)},C3.prototype._getIsClosed=function(e){return!1},C3.prototype._isDynamic=function(e,t){return!(t.positions.isConstant&&Ou.isConstant(t.minimumHeights)&&Ou.isConstant(t.maximumHeights)&&Ou.isConstant(t.outlineWidth)&&Ou.isConstant(t.granularity))},C3.prototype._setStaticOptions=function(e,t){const n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof Oh,s=this._options;s.vertexFormat=r?Ih.VERTEX_FORMAT:Sh.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(ih.MINIMUM_VALUE,s.positions),s.minimumHeights=D(n)?n.getValue(ih.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=D(i)?i.getValue(ih.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=D(o)?o.getValue(ih.MINIMUM_VALUE):void 0},C3.DynamicGeometryUpdater=I3,D(Object.create)&&(I3.prototype=Object.create(Dy.prototype),I3.prototype.constructor=I3),I3.prototype._isHidden=function(e,t,n){return!D(this._options.positions)||Dy.prototype._isHidden.call(this,e,t,n)},I3.prototype._setOptions=function(e,t,n){const i=this._options;i.positions=Ou.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=Ou.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=Ou.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=Ou.getValueOrUndefined(t.granularity,n)};const O3=[kA,KZ,iK,S0,$0,l1,e2,p2,J2,C3];function D3(e,t){this.entity=e,this.scene=t;const n=new Array(O3.length),i=new gi,o=new KX;for(let r=0;r<n.length;r++){const s=new O3[r](e,t);o.add(s.geometryChanged,(e=>{i.raiseEvent(e)})),n[r]=s}this.updaters=n,this.geometryChanged=i,this.eventHelper=o,this._removeEntitySubscription=e.definitionChanged.addEventListener(D3.prototype._onEntityPropertyChanged,this)}D3.prototype._onEntityPropertyChanged=function(e,t,n,i){const o=this.updaters;for(let r=0;r<o.length;r++)o[r]._onEntityPropertyChanged(e,t,n,i)},D3.prototype.forEach=function(e){const t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])},D3.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),He(this)},D3.registerUpdater=function(e){O3.includes(e)||O3.push(e)},D3.unregisterUpdater=function(e){if(O3.includes(e)){const t=O3.indexOf(e);O3.splice(t,1)}};const P3=new Ot,N3=new vu,R3=new vu,L3=H.ZERO,M3=new H;function F3(e,t,n,i,o,r,s){let a;this.translucent=t,this.appearanceType=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.depthFailMaterial=void 0,this.closed=r,this.shadows=s,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new bu,this.updaters=new bu,this.updatersWithAttributes=new bu,this.attributes=new bu,this.subscriptions=new bu,this.showsUpdated=new bu,this.itemsToRemove=[],this.invalidated=!1,D(o)&&(a=o.definitionChanged.addEventListener(F3.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}function B3(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}function z3(e,t){for(let n=e.length-1;n>=0;n--){const i=e[n];if(i.remove(t))return 0===i.updaters.length&&(e.splice(n,1),i.destroy()),!0}return!1}function U3(e,t,n){let i=!1;const o=t.length;for(let r=0;r<o;++r){const o=t[r],s=o.itemsToRemove,a=s.length;if(a>0)for(r=0;r<a;r++){const t=s[r];o.remove(t),e.add(n,t),i=!0}}return i}function k3(e,t,n,i){let o,r=t.length;for(o=r-1;o>=0;o--){const i=t[o];if(i.invalidated){t.splice(o,1);const r=i.updaters.values,s=r.length;for(let t=0;t<s;t++)e.add(n,r[t]);i.destroy()}}for(r=t.length,o=0;o<r;++o)i=t[o].update(n)&&i;return i}function V3(e,t,n){const i=e.length;for(let o=0;o<i;o++){const i=e[o];if(i.contains(t))return i.getBoundingSphere(t,n)}return Iu.FAILED}function H3(e){const t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}F3.prototype.onMaterialChanged=function(){this.invalidated=!0},F3.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t||!!D(t)&&t.equals(n)},F3.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Ou.isConstant(e.distanceDisplayConditionProperty)&&Ou.isConstant(e.terrainOffsetProperty)){const t=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener((function(n,i,o,r){"isShowing"===i&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(n,e)},F3.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return D(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},F3.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const n=this.geometry.values;if(n.length>0){let r;D(i)&&(D(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),D(this.depthFailAppearanceType)&&(D(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Oy.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),r=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new V_({show:!1,asynchronous:!0,geometryInstances:n.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:r,shadows:this.shadows}),o.add(i),t=!1}else{D(i)&&(o.remove(i),i=void 0);const e=this.oldPrimitive;D(e)&&(o.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(D(i)&&i.ready){i.show=!0,D(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),!D(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof Oh||(this.depthFailMaterial=Oy.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const t=this.updatersWithAttributes.values,s=t.length,a=this.waitingOnCreate;for(r=0;r<s;r++){const o=t[r],s=this.geometry.get(o.id);let c=this.attributes.get(s.id.id);if(D(c)||(c=i.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,c)),!o.fillMaterialProperty.isConstant||a){const t=o.fillMaterialProperty.color,i=Ou.getValueOrDefault(t,e,Ot.WHITE,P3);Ot.equals(c._lastColor,i)||(c._lastColor=Ot.clone(i,c._lastColor),c.color=$d.toValue(i,c.color),(this.translucent&&255===c.color[3]||!this.translucent&&255!==c.color[3])&&(this.itemsToRemove[n++]=o))}if(D(this.depthFailAppearanceType)&&o.depthFailMaterialProperty instanceof Oh&&(!o.depthFailMaterialProperty.isConstant||a)){const t=o.depthFailMaterialProperty.color,n=Ou.getValueOrDefault(t,e,Ot.WHITE,P3);Ot.equals(c._lastDepthFailColor,n)||(c._lastDepthFailColor=Ot.clone(n,c._lastDepthFailColor),c.depthFailColor=$d.toValue(n,c.depthFailColor))}const l=o.entity.isShowing&&(o.hasConstantFill||o.isFilled(e));l!==(1===c.show[0])&&(c.show=rh.toValue(l,c.show));const u=o.distanceDisplayConditionProperty;if(!Ou.isConstant(u)){const t=Ou.getValueOrDefault(u,e,R3,N3);vu.equals(t,c._lastDistanceDisplayCondition)||(c._lastDistanceDisplayCondition=vu.clone(t,c._lastDistanceDisplayCondition),c.distanceDisplayCondition=Kd.toValue(t,c.distanceDisplayCondition))}const d=o.terrainOffsetProperty;if(!Ou.isConstant(d)){const t=Ou.getValueOrDefault(d,e,L3,M3);H.equals(t,c._lastOffset)||(c._lastOffset=H.clone(t,c._lastOffset),c.offset=oh.toValue(t,c.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else D(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t},F3.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],o=this.geometry.get(n.id);let r=this.attributes.get(o.id.id);D(r)||(r=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,r));const s=n.entity.isShowing;s!==(1===r.show[0])&&(r.show=rh.toValue(s,r.show),o.attributes.show.value[0]=r.show[0])}this.showsUpdated.removeAll()},F3.prototype.contains=function(e){return this.updaters.contains(e.id)},F3.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Iu.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!D(i)||!D(i.boundingSphere)||D(i.show)&&0===i.show[0]?Iu.FAILED:(i.boundingSphere.clone(t),Iu.DONE)},F3.prototype.destroy=function(){const e=this.primitive,t=this.primitives;D(e)&&t.remove(e);const n=this.oldPrimitive;D(n)&&t.remove(n),D(this.removeMaterialSubscription)&&this.removeMaterialSubscription()},B3.prototype.add=function(e,t){let n,i;const o=t.createFillGeometryInstance(e);255===o.attributes.color.value[3]?(n=this._solidItems,i=!1):(n=this._translucentItems,i=!0);const r=n.length;for(let a=0;a<r;a++){const e=n[a];if(e.isMaterial(t))return void e.add(t,o)}const s=new F3(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)},B3.prototype.remove=function(e){z3(this._solidItems,e)||z3(this._translucentItems,e)},B3.prototype.update=function(e){let t=k3(this,this._solidItems,e,!0);t=k3(this,this._translucentItems,e,t)&&t;const n=U3(this,this._solidItems,e),i=U3(this,this._translucentItems,e);return(n||i)&&(t=k3(this,this._solidItems,e,t)&&t,t=k3(this,this._translucentItems,e,t)&&t),t},B3.prototype.getBoundingSphere=function(e,t){const n=V3(this._solidItems,e,t);return n===Iu.FAILED?V3(this._translucentItems,e,t):n},B3.prototype.removeAllPrimitives=function(){H3(this._solidItems),H3(this._translucentItems)};const G3=new vu,j3=new vu,W3=H.ZERO,q3=new H;function Y3(e,t,n,i,o,r,s){this.primitives=e,this.appearanceType=t,this.materialProperty=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.closed=r,this.shadows=s,this.updaters=new bu,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new bu,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new bu,this.attributes=new bu,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Y3.prototype.onMaterialChanged,this),this.subscriptions=new bu,this.showsUpdated=new bu}Y3.prototype.onMaterialChanged=function(){this.invalidated=!0},Y3.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty,i=this.depthFailMaterialProperty,o=e.depthFailMaterialProperty;if(n===t&&o===i)return!0;let r=D(t)&&t.equals(n);return r=(!D(i)&&!D(o)||D(i)&&i.equals(o))&&r,r},Y3.prototype.add=function(e,t){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Ou.isConstant(t.distanceDisplayConditionProperty)&&Ou.isConstant(t.terrainOffsetProperty)){const e=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener((function(n,i,o,r){"isShowing"===i&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(n,t);this.createPrimitive=!0},Y3.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return D(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};const X3=new Ot;function Q3(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}function $3(){this._tree=new C}function K3(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}function Z3(e,t){return e.id===t.id}Y3.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0){let r;D(n)&&(D(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Oy.getValue(e,this.materialProperty,this.material),D(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Oy.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),r=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new V_({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:r,shadows:this.shadows}),i.add(n),t=!1}else{D(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;D(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(D(n)&&n.ready){n.show=!0,D(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Oy.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,!D(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof Oh||(this.depthFailMaterial=Oy.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const t=this.updatersWithAttributes.values,o=t.length;for(r=0;r<o;r++){const i=t[r],o=i.entity,s=this.geometry.get(i.id);let a=this.attributes.get(s.id.id);if(D(a)||(a=n.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a)),D(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof Oh&&!i.depthFailMaterialProperty.isConstant){const t=i.depthFailMaterialProperty.color,n=Ou.getValueOrDefault(t,e,Ot.WHITE,X3);Ot.equals(a._lastDepthFailColor,n)||(a._lastDepthFailColor=Ot.clone(n,a._lastDepthFailColor),a.depthFailColor=$d.toValue(n,a.depthFailColor))}const c=o.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===a.show[0])&&(a.show=rh.toValue(c,a.show));const l=i.distanceDisplayConditionProperty;if(!Ou.isConstant(l)){const t=Ou.getValueOrDefault(l,e,j3,G3);vu.equals(t,a._lastDistanceDisplayCondition)||(a._lastDistanceDisplayCondition=vu.clone(t,a._lastDistanceDisplayCondition),a.distanceDisplayCondition=Kd.toValue(t,a.distanceDisplayCondition))}const u=i.terrainOffsetProperty;if(!Ou.isConstant(u)){const t=Ou.getValueOrDefault(u,e,W3,q3);H.equals(t,a._lastOffset)||(a._lastOffset=H.clone(t,a._lastOffset),a.offset=oh.toValue(t,a.offset))}}this.updateShows(n)}else D(n)&&!n.ready&&(t=!1);return t},Y3.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],o=n.entity,r=this.geometry.get(n.id);let s=this.attributes.get(r.id.id);D(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.isShowing;a!==(1===s.show[0])&&(s.show=rh.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},Y3.prototype.contains=function(e){return this.updaters.contains(e.id)},Y3.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Iu.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!D(i)||!D(i.boundingSphere)||D(i.show)&&0===i.show[0]?Iu.FAILED:(i.boundingSphere.clone(t),Iu.DONE)},Y3.prototype.destroy=function(){const e=this.primitive,t=this.primitives;D(e)&&t.remove(e);const n=this.oldPrimitive;D(n)&&t.remove(n),this.removeMaterialSubscription()},Q3.prototype.add=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const i=n[r];if(i.isMaterial(t))return void i.add(e,t)}const o=new Y3(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)},Q3.prototype.remove=function(e){const t=this._items;for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.remove(e)){0===i.updaters.length&&(t.splice(n,1),i.destroy());break}}},Q3.prototype.update=function(e){let t;const n=this._items;for(t=n.length-1;t>=0;t--){const i=n[t];if(i.invalidated){n.splice(t,1);const o=i.updaters.values,r=o.length;for(let t=0;t<r;t++)this.add(e,o[t]);i.destroy()}}let i=!0;for(t=0;t<n.length;t++)i=n[t].update(e)&&i;return i},Q3.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const i=n[o];if(i.contains(e))return i.getBoundingSphere(e,t)}return Iu.FAILED},Q3.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0},K3.fromRectangleAndId=function(e,t,n){return n.minX=t.west,n.minY=t.south,n.maxX=t.east,n.maxY=t.north,n.id=e,n},$3.prototype.insert=function(e,t){L.typeOf.string("id",e),L.typeOf.object("rectangle",t);const n=K3.fromRectangleAndId(e,t,new K3);this._tree.insert(n)};const J3=new K3;$3.prototype.remove=function(e,t){L.typeOf.string("id",e),L.typeOf.object("rectangle",t);const n=K3.fromRectangleAndId(e,t,J3);this._tree.remove(n,Z3)};const e4=new K3;$3.prototype.collides=function(e){L.typeOf.object("rectangle",e);const t=K3.fromRectangleAndId("",e,e4);return this._tree.collides(t)};const t4=new Ot,n4=new vu,i4=new vu;function o4(e,t,n,i){this.primitives=e,this.zIndex=i,this.classificationType=t,this.color=n,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new bu,this.updaters=new bu,this.updatersWithAttributes=new bu,this.attributes=new bu,this.subscriptions=new bu,this.showsUpdated=new bu,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new $3}function r4(e,t){this._batches=[],this._primitives=e,this._classificationType=t}o4.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},o4.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),this.rectangleCollisionCheck.insert(n,t.geometry.rectangle),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Ou.isConstant(e.distanceDisplayConditionProperty)){const t=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener((function(n,i,o,r){"isShowing"===i&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(n,e)},o4.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return D(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},o4.prototype.update=function(e){let t=!0;let n=this.primitive;const i=this.primitives;let o;if(this.createPrimitive){const e=this.geometry.values;if(e.length>0)D(n)&&(D(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new gy({show:!1,asynchronous:!0,geometryInstances:e.slice(),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{D(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;D(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(D(n)&&n.ready){n.show=!0,D(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0);const t=this.updatersWithAttributes.values,r=t.length,s=this.waitingOnCreate;for(o=0;o<r;o++){const i=t[o],r=this.geometry.get(i.id);let a=this.attributes.get(r.id.id);if(D(a)||(a=n.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,a)),!i.fillMaterialProperty.isConstant||s){const t=i.fillMaterialProperty.color,n=Ou.getValueOrDefault(t,e,Ot.WHITE,t4);Ot.equals(a._lastColor,n)||(a._lastColor=Ot.clone(n,a._lastColor),a.color=$d.toValue(n,a.color))}const c=i.entity.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===a.show[0])&&(a.show=rh.toValue(c,a.show));const l=i.distanceDisplayConditionProperty;if(!Ou.isConstant(l)){const t=Ou.getValueOrDefault(l,e,i4,n4);vu.equals(t,a._lastDistanceDisplayCondition)||(a._lastDistanceDisplayCondition=vu.clone(t,a._lastDistanceDisplayCondition),a.distanceDisplayCondition=Kd.toValue(t,a.distanceDisplayCondition))}}this.updateShows(n),this.waitingOnCreate=!1}else D(n)&&!n.ready&&(t=!1);return this.itemsToRemove.length=0,t},o4.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],o=this.geometry.get(n.id);let r=this.attributes.get(o.id.id);D(r)||(r=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,r));const s=n.entity.isShowing;s!==(1===r.show[0])&&(r.show=rh.toValue(s,r.show),o.attributes.show.value[0]=r.show[0])}this.showsUpdated.removeAll()},o4.prototype.contains=function(e){return this.updaters.contains(e.id)},o4.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Iu.PENDING;const i=n.getBoundingSphere(e.entity);return D(i)?(i.clone(t),Iu.DONE):Iu.FAILED},o4.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;D(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;D(n)&&(e.remove(n),this.oldPrimitive=void 0)},r4.prototype.add=function(e,t){const n=t.createFillGeometryInstance(e),i=this._batches,o=Ou.getValueOrDefault(t.zIndex,0);let r;const s=i.length;for(let a=0;a<s;++a){const e=i[a];if(e.zIndex===o&&!e.overlapping(n.geometry.rectangle)){r=e;break}}return D(r)||(r=new o4(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r},r4.prototype.remove=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return},r4.prototype.update=function(e){let t,n,i=!0;const o=this._batches,r=o.length;for(t=0;t<r;++t)i=o[t].update(e)&&i;for(t=0;t<r;++t){const i=o[t],r=i.itemsToRemove,s=r.length;for(let t=0;t<s;t++){n=r[t],i.remove(n);const o=this.add(e,n);i.isDirty=!0,o.isDirty=!0}}for(t=r-1;t>=0;--t){const n=o[t];n.isDirty&&(i=o[t].update(e)&&i,n.isDirty=!1),0===n.geometry.length&&o.splice(t,1)}return i},r4.prototype.getBoundingSphere=function(e,t){const n=this._batches,i=n.length;for(let o=0;o<i;++o){const i=n[o];if(i.contains(e))return i.getBoundingSphere(e,t)}return Iu.FAILED},r4.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};const s4=new vu,a4=new vu;function c4(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new bu,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new bu,this.material=void 0,this.updatersWithAttributes=new bu,this.attributes=new bu,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(c4.prototype.onMaterialChanged,this),this.subscriptions=new bu,this.showsUpdated=new bu,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new $3}function l4(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}c4.prototype.onMaterialChanged=function(){this.invalidated=!0},c4.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)},c4.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Oh&&t instanceof Oh||D(t)&&t.equals(n)},c4.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),this.rectangleCollisionCheck.insert(i,n.geometry.rectangle),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Ou.isConstant(t.distanceDisplayConditionProperty)){const e=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener((function(n,i,o,r){"isShowing"===i&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},c4.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return D(e)&&(e(),this.subscriptions.remove(t)),!0}return!1},c4.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)D(n)&&(D(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Oy.getValue(e,this.materialProperty,this.material),n=new gy({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{D(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;D(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(D(n)&&n.ready){n.show=!0,D(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Oy.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const t=this.updatersWithAttributes.values,o=t.length;for(r=0;r<o;r++){const i=t[r],o=i.entity,s=this.geometry.get(i.id);let a=this.attributes.get(s.id.id);D(a)||(a=n.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=o.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===a.show[0])&&(a.show=rh.toValue(c,a.show));const l=i.distanceDisplayConditionProperty;if(!Ou.isConstant(l)){const t=Ou.getValueOrDefault(l,e,a4,s4);vu.equals(t,a._lastDistanceDisplayCondition)||(a._lastDistanceDisplayCondition=vu.clone(t,a._lastDistanceDisplayCondition),a.distanceDisplayCondition=Kd.toValue(t,a.distanceDisplayCondition))}}this.updateShows(n)}else D(n)&&!n.ready&&(t=!1);return t},c4.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],o=n.entity,r=this.geometry.get(n.id);let s=this.attributes.get(r.id.id);D(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.isShowing;a!==(1===s.show[0])&&(s.show=rh.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},c4.prototype.contains=function(e){return this.updaters.contains(e.id)},c4.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Iu.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!D(i)||!D(i.boundingSphere)||D(i.show)&&0===i.show[0]?Iu.FAILED:(i.boundingSphere.clone(t),Iu.DONE)},c4.prototype.destroy=function(){const e=this.primitive,t=this.primitives;D(e)&&t.remove(e);const n=this.oldPrimitive;D(n)&&t.remove(n),this.removeMaterialSubscription()},l4.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Og.shouldUseSphericalCoordinates(o.geometry.rectangle),s=Ou.getValueOrDefault(t.zIndex,0);for(let c=0;c<i;++c){const i=n[c];if(i.isMaterial(t)&&i.usingSphericalTextureCoordinates===r&&i.zIndex===s&&!i.overlapping(o.geometry.rectangle))return void i.add(e,t,o)}const a=new c4(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)},l4.prototype.remove=function(e){const t=this._items;for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.remove(e)){0===i.updaters.length&&(t.splice(n,1),i.destroy());break}}},l4.prototype.update=function(e){let t;const n=this._items;for(t=n.length-1;t>=0;t--){const i=n[t];if(i.invalidated){n.splice(t,1);const o=i.updaters.values,r=o.length;for(let t=0;t<r;t++)this.add(e,o[t]);i.destroy()}}let i=!0;for(t=0;t<n.length;t++)i=n[t].update(e)&&i;return i},l4.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const i=n[o];if(i.contains(e))return i.getBoundingSphere(e,t)}return Iu.FAILED},l4.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const u4=new Ot,d4=new vu,h4=new vu,p4=H.ZERO,f4=new H;function m4(e,t,n,i){this.translucent=t,this.width=n,this.shadows=i,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new bu,this.updaters=new bu,this.updatersWithAttributes=new bu,this.attributes=new bu,this.itemsToRemove=[],this.subscriptions=new bu,this.showsUpdated=new bu}function _4(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new bu,this._translucentBatches=new bu}m4.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant&&Ou.isConstant(e.distanceDisplayConditionProperty)&&Ou.isConstant(e.terrainOffsetProperty)){const t=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener((function(n,i,o,r){"isShowing"===i&&t.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(n,e)},m4.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return D(e)&&(e(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1},m4.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const e=this.geometry.values;if(e.length>0)D(i)&&(D(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new V_({show:!1,asynchronous:!0,geometryInstances:e.slice(),appearance:new Ih({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{D(i)&&(o.remove(i),i=void 0);const e=this.oldPrimitive;D(e)&&(o.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(D(i)&&i.ready){i.show=!0,D(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const t=this.updatersWithAttributes.values,s=t.length,a=this.waitingOnCreate;for(r=0;r<s;r++){const o=t[r],s=this.geometry.get(o.id);let c=this.attributes.get(s.id.id);if(D(c)||(c=i.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,c)),!o.outlineColorProperty.isConstant||a){const t=o.outlineColorProperty,i=Ou.getValueOrDefault(t,e,Ot.WHITE,u4);Ot.equals(c._lastColor,i)||(c._lastColor=Ot.clone(i,c._lastColor),c.color=$d.toValue(i,c.color),(this.translucent&&255===c.color[3]||!this.translucent&&255!==c.color[3])&&(this.itemsToRemove[n++]=o))}const l=o.entity.isShowing&&(o.hasConstantOutline||o.isOutlineVisible(e));l!==(1===c.show[0])&&(c.show=rh.toValue(l,c.show));const u=o.distanceDisplayConditionProperty;if(!Ou.isConstant(u)){const t=Ou.getValueOrDefault(u,e,h4,d4);vu.equals(t,c._lastDistanceDisplayCondition)||(c._lastDistanceDisplayCondition=vu.clone(t,c._lastDistanceDisplayCondition),c.distanceDisplayCondition=Kd.toValue(t,c.distanceDisplayCondition))}const d=o.terrainOffsetProperty;if(!Ou.isConstant(d)){const t=Ou.getValueOrDefault(d,e,p4,f4);H.equals(t,c._lastOffset)||(c._lastOffset=H.clone(t,c._lastOffset),c.offset=oh.toValue(t,c.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else D(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t},m4.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],o=this.geometry.get(n.id);let r=this.attributes.get(o.id.id);D(r)||(r=e.getGeometryInstanceAttributes(o.id),this.attributes.set(o.id.id,r));const s=n.entity.isShowing;s!==(1===r.show[0])&&(r.show=rh.toValue(s,r.show),o.attributes.show.value[0]=r.show[0])}this.showsUpdated.removeAll()},m4.prototype.contains=function(e){return this.updaters.contains(e.id)},m4.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Iu.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!D(i)||!D(i.boundingSphere)||D(i.show)&&0===i.show[0]?Iu.FAILED:(i.boundingSphere.clone(t),Iu.DONE)},m4.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;D(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;D(n)&&(e.remove(n),this.oldPrimitive=void 0)},_4.prototype.add=function(e,t){const n=t.createOutlineGeometryInstance(e),i=this._scene.clampLineWidth(t.outlineWidth);let o,r;255===n.attributes.color.value[3]?(o=this._solidBatches,r=o.get(i),D(r)||(r=new m4(this._primitives,!1,i,this._shadows),o.set(i,r)),r.add(t,n)):(o=this._translucentBatches,r=o.get(i),D(r)||(r=new m4(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))},_4.prototype.remove=function(e){let t;const n=this._solidBatches.values,i=n.length;for(t=0;t<i;t++)if(n[t].remove(e))return;const o=this._translucentBatches.values,r=o.length;for(t=0;t<r;t++)if(o[t].remove(e))return},_4.prototype.update=function(e){let t,n,i,o;const r=this._solidBatches.values,s=r.length,a=this._translucentBatches.values,c=a.length;let l,u=!0,d=!1;do{for(d=!1,n=0;n<s;n++){o=r[n],u=o.update(e),l=o.itemsToRemove;const s=l.length;if(s>0)for(d=!0,t=0;t<s;t++)i=l[t],o.remove(i),this.add(e,i)}for(n=0;n<c;n++){o=a[n],u=o.update(e),l=o.itemsToRemove;const r=l.length;if(r>0)for(d=!0,t=0;t<r;t++)i=l[t],o.remove(i),this.add(e,i)}}while(d);return u},_4.prototype.getBoundingSphere=function(e,t){let n;const i=this._solidBatches.values,o=i.length;for(n=0;n<o;n++){const o=i[n];if(o.contains(e))return o.getBoundingSphere(e,t)}const r=this._translucentBatches.values,s=r.length;for(n=0;n<s;n++){const i=r[n];if(i.contains(e))return i.getBoundingSphere(e,t)}return Iu.FAILED},_4.prototype.removeAllPrimitives=function(){let e;const t=this._solidBatches.values,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._translucentBatches.values,o=i.length;for(e=0;e<o;e++)i[e].removeAllPrimitives()};const g4=[];function y4(e,t,n,i){L.defined("scene",e),L.defined("entityCollection",t),n=M(n,e.primitives),i=M(i,e.groundPrimitives),this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new bu,this._removedObjects=new bu,this._changedObjects=new bu;const o=k_.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(2*o),this._closedColorBatches=new Array(2*o),this._closedMaterialBatches=new Array(2*o),this._openColorBatches=new Array(2*o),this._openMaterialBatches=new Array(2*o);const r=_A.supportsMaterialsforEntitiesOnTerrain(e);let s;for(this._supportsMaterialsforEntitiesOnTerrain=r,s=0;s<o;++s)this._outlineBatches[s]=new _4(n,e,s),this._outlineBatches[o+s]=new _4(n,e,s),this._closedColorBatches[s]=new B3(n,Ih,void 0,!0,s),this._closedColorBatches[o+s]=new B3(n,Ih,void 0,!0,s),this._closedMaterialBatches[s]=new Q3(n,Sh,void 0,!0,s),this._closedMaterialBatches[o+s]=new Q3(n,Sh,void 0,!0,s),this._openColorBatches[s]=new B3(n,Ih,void 0,!1,s),this._openColorBatches[o+s]=new B3(n,Ih,void 0,!1,s),this._openMaterialBatches[s]=new Q3(n,Sh,void 0,!1,s),this._openMaterialBatches[o+s]=new Q3(n,Sh,void 0,!1,s);const a=Vf.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(a),l=[];if(r)for(s=0;s<a;++s)l.push(new l4(i,s,Sh)),c[s]=new r4(i,s);else for(s=0;s<a;++s)c[s]=new r4(i,s);this._groundColorBatches=c,this._groundMaterialBatches=l,this._dynamicBatch=new xJ(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new bu,this._updaterSets=new bu,this._entityCollection=t,t.collectionChanged.addEventListener(y4.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,g4)}y4.registerUpdater=function(e){D3.registerUpdater(e)},y4.unregisterUpdater=function(e){D3.unregisterUpdater(e)},y4.prototype.update=function(e){L.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,c,l,u;const d=this;for(a=s.length-1;a>-1;a--)c=s[a],l=c.id,u=this._updaterSets.get(l),u.entity===c?u.forEach((function(t){d._removeUpdater(t),d._insertUpdaterIntoBatch(e,t)})):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],l=c.id,u=this._updaterSets.get(l),u.forEach(this._removeUpdater.bind(this)),u.destroy(),this._updaterSets.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(a=n.length-1;a>-1;a--)c=n[a],l=c.id,u=new D3(c,this._scene),this._updaterSets.set(l,u),u.forEach((function(t){d._insertUpdaterIntoBatch(e,t)})),this._subscriptions.set(l,u.geometryChanged.addEventListener(y4._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let h=!0;const p=this._batches,f=p.length;for(a=0;a<f;a++)h=p[a].update(e)&&h;return h};const b4=[],v4=new $u;y4.prototype.getBoundingSphere=function(e,t){L.defined("entity",e),L.defined("result",t);const n=b4,i=v4;let o=0,r=Iu.DONE;const s=this._batches,a=s.length,c=e.id,l=this._updaterSets.get(c).updaters;for(let u=0;u<l.length;u++){const e=l[u];for(let t=0;t<a;t++){if(r=s[t].getBoundingSphere(e,i),r===Iu.PENDING)return Iu.PENDING;r===Iu.DONE&&(n[o]=$u.clone(i,n[o]),o++)}}return 0===o?Iu.FAILED:(n.length=o,$u.fromBoundingSpheres(n,t),Iu.DONE)},y4.prototype.isDestroyed=function(){return!1},y4.prototype.destroy=function(){let e;this._entityCollection.collectionChanged.removeEventListener(y4.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();this._subscriptions.removeAll();const o=this._updaterSets.values;for(n=o.length,e=0;e<n;e++)o[e].destroy();return this._updaterSets.removeAll(),He(this)},y4.prototype._removeUpdater=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)},y4.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic)return void this._dynamicBatch.add(e,t);let n;(t.outlineEnabled||t.fillEnabled)&&(n=t.shadowsProperty.getValue(e));const i=k_.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(D(t.terrainOffsetProperty)?this._outlineBatches[i+n].add(e,t):this._outlineBatches[n].add(e,t)),t.fillEnabled)if(t.onTerrain){const n=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof Oh?this._groundColorBatches[n].add(e,t):this._groundMaterialBatches[n].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof Oh?D(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):D(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof Oh?D(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):D(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)},y4._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;D(t.get(o))||D(n.get(o))||n.set(o,i)},y4.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let s,a,c;for(s=n.length-1;s>-1;s--)c=n[s],a=c.id,i.remove(a)||(o.set(a,c),r.remove(a));for(s=t.length-1;s>-1;s--)c=t[s],a=c.id,o.remove(a)?r.set(a,c):i.set(a,c)};const A4=qV.FILL,T4=Ot.WHITE,w4=Ot.BLACK,E4=new Ot(.165,.165,.165,.8),x4=new kt(7,5),S4=kt.ZERO,C4=H.ZERO,I4=wu.NONE,O4=Su.CENTER,D4=Cu.CENTER,P4=new H,N4=new Ot,R4=new Ot,L4=new Ot,M4=new kt,F4=new H,B4=new kt,z4=new Au,U4=new Au,k4=new Au,V4=new vu;function H4(e){this.entity=e,this.label=void 0,this.index=void 0}function G4(e,t){if(!D(e))throw new P("entityCluster is required.");if(!D(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(G4.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new bu,this._onCollectionChanged(t,t.values,[],[])}function j4(e,t,n){D(e)&&(e.label=void 0,n.removeLabel(t))}G4.prototype.update=function(e){if(!D(e))throw new P("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const o=t[i],r=o.entity,s=r._label;let a,c,l=o.label,u=r.isShowing&&r.isAvailable(e)&&Ou.getValueOrDefault(s._show,e,!0);if(u&&(c=Ou.getValueOrUndefined(r._position,e,P4),a=Ou.getValueOrUndefined(s._text,e),u=D(c)&&D(a)),!u){j4(o,r,n);continue}Ou.isConstant(r._position)||(n._clusterDirty=!0);let d=!1;const h=Ou.getValueOrDefault(s._heightReference,e,I4);D(l)||(l=n.getLabel(r),l.id=r,o.label=l,d=H.equals(l.position,c)&&l.heightReference===h),l.show=!0,l.position=c,l.text=a,l.scale=Ou.getValueOrDefault(s._scale,e,1),l.font=Ou.getValueOrDefault(s._font,e,"30px sans-serif"),l.style=Ou.getValueOrDefault(s._style,e,A4),l.fillColor=Ou.getValueOrDefault(s._fillColor,e,T4,N4),l.outlineColor=Ou.getValueOrDefault(s._outlineColor,e,w4,R4),l.outlineWidth=Ou.getValueOrDefault(s._outlineWidth,e,1),l.showBackground=Ou.getValueOrDefault(s._showBackground,e,false),l.backgroundColor=Ou.getValueOrDefault(s._backgroundColor,e,E4,L4),l.backgroundPadding=Ou.getValueOrDefault(s._backgroundPadding,e,x4,M4),l.pixelOffset=Ou.getValueOrDefault(s._pixelOffset,e,S4,B4),l.eyeOffset=Ou.getValueOrDefault(s._eyeOffset,e,C4,F4),l.heightReference=h,l.horizontalOrigin=Ou.getValueOrDefault(s._horizontalOrigin,e,O4),l.verticalOrigin=Ou.getValueOrDefault(s._verticalOrigin,e,D4),l.translucencyByDistance=Ou.getValueOrUndefined(s._translucencyByDistance,e,z4),l.pixelOffsetScaleByDistance=Ou.getValueOrUndefined(s._pixelOffsetScaleByDistance,e,U4),l.scaleByDistance=Ou.getValueOrUndefined(s._scaleByDistance,e,k4),l.distanceDisplayCondition=Ou.getValueOrUndefined(s._distanceDisplayCondition,e,V4),l.disableDepthTestDistance=Ou.getValueOrUndefined(s._disableDepthTestDistance,e),d&&l._updateClamping()}return!0},G4.prototype.getBoundingSphere=function(e,t){if(!D(e))throw new P("entity is required.");if(!D(t))throw new P("result is required.");const n=this._items.get(e.id);if(!D(n)||!D(n.label))return Iu.FAILED;const i=n.label;return t.center=H.clone(M(i._clampedPosition,i.position),t.center),t.radius=0,Iu.DONE},G4.prototype.isDestroyed=function(){return!1},G4.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(G4.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return He(this)},G4.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],D(r._label)&&D(r._position)&&s.set(r.id,new H4(r));for(o=i.length-1;o>-1;o--)r=i[o],D(r._label)&&D(r._position)?s.contains(r.id)||s.set(r.id,new H4(r)):(j4(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],j4(s.get(r.id),r,a),s.remove(r.id)};const W4=k_.ENABLED,q4=wu.NONE,Y4=Ot.RED,X4=Ot.WHITE,Q4=SP.HIGHLIGHT,$4=new kt(1,1),K4=new ve,Z4=new ve,J4=new Ot,e5=new Array(4),t5=new H;function n5(e,t){L.typeOf.object("scene",e),L.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(n5.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new bu,this._onCollectionChanged(t,t.values,[],[])}async function i5(e,t,n,i){const o=e._primitives,r=e._modelHash;try{const s=await jU.fromGltfAsync({url:n,incrementallyLoadTextures:i,scene:e._scene});if(e.isDestroyed()||!D(r[t.id]))return;s.id=t,o.add(s),r[t.id].modelPrimitive=s,s.errorEvent.addEventListener((e=>{D(r[t.id])&&"TextureError"!==e.name&&s.incrementallyLoadTextures&&(r[t.id].loadFailed=!0)}))}catch(s){if(e.isDestroyed()||!D(r[t.id]))return;r[t.id].loadFailed=!0}}n5.prototype.update=function(e){if(!D(e))throw new P("time is required.");const t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const r=t[o],s=r._model;let a,c,l=n[r.id],u=r.isShowing&&r.isAvailable(e)&&Ou.getValueOrDefault(s._show,e,!0);if(u&&(c=r.computeModelMatrix(e,K4),a=Bi.createIfNeeded(Ou.getValueOrUndefined(s._uri,e)),u=D(c)&&D(a)),!u){D(l)&&l.modelPrimitive&&(l.modelPrimitive.show=!1);continue}if(!D(l)||a.url!==l.url){D(null==l?void 0:l.modelPrimitive)&&(i.removeAndDestroy(l.modelPrimitive),delete n[r.id]),l={modelPrimitive:void 0,url:a.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFailed:!1,modelUpdated:!1},n[r.id]=l;i5(this,r,a,Ou.getValueOrDefault(s._incrementallyLoadTextures,e,true))}const d=l.modelPrimitive;if(!D(d))continue;d.show=!0,d.scale=Ou.getValueOrDefault(s._scale,e,1),d.minimumPixelSize=Ou.getValueOrDefault(s._minimumPixelSize,e,0),d.maximumScale=Ou.getValueOrUndefined(s._maximumScale,e),d.modelMatrix=ve.clone(c,d.modelMatrix),d.shadows=Ou.getValueOrDefault(s._shadows,e,W4),d.heightReference=Ou.getValueOrDefault(s._heightReference,e,q4),d.distanceDisplayCondition=Ou.getValueOrUndefined(s._distanceDisplayCondition,e),d.silhouetteColor=Ou.getValueOrDefault(s._silhouetteColor,e,Y4,J4),d.silhouetteSize=Ou.getValueOrDefault(s._silhouetteSize,e,0),d.color=Ou.getValueOrDefault(s._color,e,X4,J4),d.colorBlendMode=Ou.getValueOrDefault(s._colorBlendMode,e,Q4),d.colorBlendAmount=Ou.getValueOrDefault(s._colorBlendAmount,e,.5),d.clippingPlanes=Ou.getValueOrUndefined(s._clippingPlanes,e),d.clampAnimations=Ou.getValueOrDefault(s._clampAnimations,e,true),d.imageBasedLighting.imageBasedLightingFactor=Ou.getValueOrDefault(s._imageBasedLightingFactor,e,$4);let h=Ou.getValueOrUndefined(s._lightColor,e);if(D(h)&&(Ot.pack(h,e5,0),h=H.unpack(e5,0,t5)),d.lightColor=h,d.customShader=Ou.getValueOrUndefined(s._customShader,e),n[r.id].modelUpdated=!0,d.ready){const t=Ou.getValueOrDefault(s._runAnimations,e,!0);l.animationsRunning!==t&&(t?d.activeAnimations.addAll({loop:GI.REPEAT}):d.activeAnimations.removeAll(),l.animationsRunning=t);const n=Ou.getValueOrUndefined(s._nodeTransformations,e,l.nodeTransformationsScratch);if(D(n)){const e=Object.keys(n);for(let t=0,i=e.length;t<i;++t){const i=e[t],o=n[i];if(!D(o))continue;const r=d.getNode(i);if(!D(r))continue;const s=ve.fromTranslationRotationScale(o,Z4);r.matrix=ve.multiply(r.originalMatrix,s,s)}}let i=!1;const o=Ou.getValueOrUndefined(s._articulations,e,l.articulationsScratch);if(D(o)){const e=Object.keys(o);for(let t=0,n=e.length;t<n;++t){const n=e[t],r=o[n];D(r)&&(i=!0,d.setArticulationStage(n,r))}}i&&d.applyArticulations()}}return!0},n5.prototype.isDestroyed=function(){return!1},n5.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(n5.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)s5(this,e[i],t,n);return He(this)};const o5=new H,r5=new Qt;function s5(e,t,n,i){const o=n[t.id];D(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function a5(e,t){const n=t[e.id];D(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function c5(e){this._definitionChanged=new gi,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}n5.prototype.getBoundingSphere=function(e,t){if(!D(e))throw new P("entity is required.");if(!D(t))throw new P("result is required.");const n=this._modelHash[e.id];if(!D(n))return Iu.FAILED;if(n.loadFailed)return Iu.FAILED;const i=n.modelPrimitive;if(!D(i)||!i.show)return Iu.PENDING;if(!i.ready||!n.modelUpdated)return Iu.PENDING;const o=this._scene,r=o.globe,s=M(null==r?void 0:r.ellipsoid,on.WGS84);if(i.heightReference!==wu.NONE){const e=i.modelMatrix;o5.x=e[12],o5.y=e[13],o5.z=e[14];const n=s.cartesianToCartographic(o5,r5),r=o.getHeight(n,i.heightReference);return D(r)&&(Eu(i.heightReference)?n.height=r:n.height+=r),$u.clone(i.boundingSphere,t),t.center=s.cartographicToCartesian(n),Iu.DONE}return $u.clone(i.boundingSphere,t),Iu.DONE},n5.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._modelHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],D(r._model)&&D(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],D(r._model)&&D(r._position)?(a5(r,a),s.set(r.id,r)):(s5(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],s5(this,r,a,c),s.remove(r.id)},Object.defineProperties(c5.prototype,{isConstant:{get:function(){return Ou.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return D(this._value)?this._value.referenceFrame:Mv.FIXED}}}),c5.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Mv.FIXED,t)},c5.prototype.setValue=function(e){this._value!==e&&(this._value=e,D(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),D(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},c5.prototype.getValueInReferenceFrame=function(e,t,n){if(!D(e))throw new P("time is required.");if(!D(t))throw new P("referenceFrame is required.");if(D(this._value))return D(n=this._value.getValueInReferenceFrame(e,t,n))?on.WGS84.scaleToGeodeticSurface(n,n):void 0},c5.prototype.equals=function(e){return this===e||e instanceof c5&&this._value===e._value},c5.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const l5=new Jd,u5=new Jd,d5=new Jd;function h5(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function p5(e,t,n,i,o,r,s,a){for(;e instanceof cJ;)e=e.resolvedProperty;if(e instanceof gJ){s=function(e,t,n,i,o,r,s,a,c){let l,u=a;l=e.getValueInReferenceFrame(t,r,c[u]),D(l)&&(c[u++]=l);let d=!D(o)||Hn.lessThanOrEquals(o,t)||Hn.greaterThanOrEquals(o,n),h=0;const p=i.length;let f=i[h];const m=n;let _,g,y,b=!1;for(;h<p;){if(!d&&Hn.greaterThanOrEquals(f,o)&&(l=e.getValueInReferenceFrame(o,r,c[u]),D(l)&&(c[u++]=l),d=!0),Hn.greaterThan(f,t)&&Hn.lessThan(f,m)&&!f.equals(o)&&(l=e.getValueInReferenceFrame(f,r,c[u]),D(l)&&(c[u++]=l)),h<p-1){if(s>0&&!b){const e=i[h+1],t=Hn.secondsDifference(e,f);b=t>s,b&&(_=Math.ceil(t/s),g=0,y=t/Math.max(_,2),_=Math.max(_-1,1))}if(b&&g<_){f=Hn.addSeconds(f,y,new Hn),g++;continue}}b=!1,h++,f=i[h]}return l=e.getValueInReferenceFrame(n,r,c[u]),D(l)&&(c[u++]=l),u}(e,t,n,e._property._times,i,o,r,s,a)}else s=e instanceof lQ?function(e,t,n,i,o,r,s,a){u5.start=t,u5.stop=n;let c=s;const l=e.intervals;for(let u=0;u<l.length;u++){const e=l.get(u);if(!Jd.intersect(e,u5,l5).isEmpty){const s=e.start,l=e.stop;let u=t;Hn.greaterThan(s,u)&&(u=s);let d=n;Hn.lessThan(l,d)&&(d=l),c=p5(e.data,u,d,i,o,r,c,a)}}return c}(e,t,n,i,o,r,s,a):e instanceof yJ?function(e,t,n,i,o,r,s,a){d5.start=t,d5.stop=n;let c=s;const l=e.intervals;for(let u=0;u<l.length;u++){const t=l.get(u);if(!Jd.intersect(t,d5,l5).isEmpty){let n=t.start;t.isStartIncluded||(n=t.isStopIncluded?t.stop:Hn.addSeconds(t.start,Hn.secondsDifference(t.stop,t.start)/2,new Hn));const i=e.getValueInReferenceFrame(n,o,a[c]);D(i)&&(a[c]=i,c++)}}return c}(e,t,n,0,o,0,s,a):e instanceof zv||e instanceof c5&&Ou.isConstant(e)?function(e,t,n,i,o,r,s,a){const c=e.getValueInReferenceFrame(t,o,a[s]);return D(c)&&(a[s++]=c),s}(e,t,0,0,o,0,s,a):function(e,t,n,i,o,r,s,a){let c,l=0,u=s,d=t;const h=Math.max(r,60);let p=!D(i)||Hn.lessThanOrEquals(i,t)||Hn.greaterThanOrEquals(i,n);for(;Hn.lessThan(d,n);)!p&&Hn.greaterThanOrEquals(d,i)&&(p=!0,c=e.getValueInReferenceFrame(i,o,a[u]),D(c)&&(a[u]=c,u++)),c=e.getValueInReferenceFrame(d,o,a[u]),D(c)&&(a[u]=c,u++),l++,d=Hn.addSeconds(t,h*l,new Hn);return c=e.getValueInReferenceFrame(n,o,a[u]),D(c)&&(a[u]=c,u++),u}(e,t,n,i,o,r,s,a);return s}function f5(e,t,n,i,o,r,s){D(s)||(s=[]);const a=p5(e,t,n,i,o,r,0,s);return s.length=a,s}const m5=new re;function _5(e,t){this._unusedIndexes=[],this._polylineCollection=new fG,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}function g5(e,t){if(!D(e))throw new P("scene is required.");if(!D(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(g5.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new bu,this._onCollectionChanged(t,t.values,[],[])}_5.prototype.update=function(e){if(this._referenceFrame===Mv.INERTIAL){let t=Cr.computeIcrfToFixedMatrix(e,m5);D(t)||(t=Cr.computeTemeToPseudoFixedMatrix(e,m5)),ve.fromRotationTranslation(t,H.ZERO,this._polylineCollection.modelMatrix)}},_5.prototype.updateObject=function(e,t){const n=t.entity,i=n._path,o=n._position;let r,s;const a=i._show;let c=t.polyline,l=n.isShowing&&n.isAvailable(e)&&(!D(a)||a.getValue(e));if(l){const t=Ou.getValueOrUndefined(i._leadTime,e),o=Ou.getValueOrUndefined(i._trailTime,e),a=n._availability,c=D(a),u=D(t),d=D(o);if(l=c||u&&d,l){if(d&&(r=Hn.addSeconds(e,-o,new Hn)),u&&(s=Hn.addSeconds(e,t,new Hn)),c){const e=a.start,t=a.stop;d&&!Hn.greaterThan(e,r)||(r=e),u&&!Hn.lessThan(t,s)||(s=t)}l=Hn.lessThan(r,s)}}if(!l)return void(D(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0));if(!D(c)){const e=this._unusedIndexes;if(e.length>0){const n=e.pop();c=this._polylineCollection.get(n),t.index=n}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=n,t.polyline=c}const u=Ou.getValueOrDefault(i._resolution,e,60);c.show=!0,c.positions=f5(o,r,s,e,this._referenceFrame,u,c.positions.slice()),c.material=Oy.getValue(e,i._material,c.material),c.width=Ou.getValueOrDefault(i._width,e,1),c.distanceDisplayCondition=Ou.getValueOrUndefined(i._distanceDisplayCondition,e,c.distanceDisplayCondition)},_5.prototype.removeObject=function(e){const t=e.polyline;D(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)},_5.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),He(this)},g5.prototype.update=function(e){if(!D(e))throw new P("time is required.");const t=this._updaters;for(const i in t)t.hasOwnProperty(i)&&t[i].update(e);const n=this._items.values;if(0===n.length&&D(this._updaters)&&Object.keys(this._updaters).length>0){for(const e in t)t.hasOwnProperty(e)&&t[e].destroy();this._updaters={}}for(let i=0,o=n.length;i<o;i++){const t=n[i],o=t.entity._position,r=t.updater;let s=Mv.FIXED;this._scene.mode===gl.SCENE3D&&(s=o.referenceFrame);let a=this._updaters[s];r===a&&D(a)?a.updateObject(e,t):(D(r)&&r.removeObject(t),D(a)||(a=new _5(this._scene,s),a.update(e),this._updaters[s]=a),t.updater=a,D(a)&&a.updateObject(e,t))}return!0},g5.prototype.isDestroyed=function(){return!1},g5.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(g5.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return He(this)},g5.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s;const a=this._items;for(o=t.length-1;o>-1;o--)r=t[o],D(r._path)&&D(r._position)&&a.set(r.id,new h5(r));for(o=i.length-1;o>-1;o--)r=i[o],D(r._path)&&D(r._position)?a.contains(r.id)||a.set(r.id,new h5(r)):(s=a.get(r.id),D(s)&&(D(s.updater)&&s.updater.removeObject(s),a.remove(r.id)));for(o=n.length-1;o>-1;o--)r=n[o],s=a.get(r.id),D(s)&&(D(s.updater)&&s.updater.removeObject(s),a.remove(r.id))},g5._subSample=f5;const y5=Ot.WHITE,b5=Ot.BLACK,v5=new Ot,A5=new H,T5=new Ot,w5=new Au,E5=new Au,x5=new vu;function S5(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 C5(e,t){if(!D(e))throw new P("entityCluster is required.");if(!D(t))throw new P("entityCollection is required.");t.collectionChanged.addEventListener(C5.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new bu,this._onCollectionChanged(t,t.values,[],[])}function I5(e,t,n){if(D(e)){if(D(e.pointPrimitive))return e.pointPrimitive=void 0,void n.removePoint(t);D(e.billboard)&&(e.billboard=void 0,n.removeBillboard(t))}}C5.prototype.update=function(e){if(!D(e))throw new P("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const o=t[i],r=o.entity,s=r._point;let a=o.pointPrimitive,c=o.billboard;const l=Ou.getValueOrDefault(s._heightReference,e,wu.NONE);let u,d=r.isShowing&&r.isAvailable(e)&&Ou.getValueOrDefault(s._show,e,!0);if(d&&(u=Ou.getValueOrUndefined(r._position,e,A5),d=D(u)),!d){I5(o,r,n);continue}Ou.isConstant(r._position)||(n._clusterDirty=!0);let h=!1,p=!1;if(l===wu.NONE||D(c)?l!==wu.NONE||D(a)||(D(c)&&(I5(o,r,n),c=void 0),a=n.getPoint(r),a.id=r,o.pointPrimitive=a):(D(a)&&(I5(o,r,n),a=void 0),c=n.getBillboard(r),c.id=r,c.image=void 0,o.billboard=c,h=!0,p=H.equals(c.position,u)&&c.heightReference===l),D(a))a.show=!0,a.position=u,a.scaleByDistance=Ou.getValueOrUndefined(s._scaleByDistance,e,w5),a.translucencyByDistance=Ou.getValueOrUndefined(s._translucencyByDistance,e,E5),a.color=Ou.getValueOrDefault(s._color,e,y5,v5),a.outlineColor=Ou.getValueOrDefault(s._outlineColor,e,b5,T5),a.outlineWidth=Ou.getValueOrDefault(s._outlineWidth,e,0),a.pixelSize=Ou.getValueOrDefault(s._pixelSize,e,1),a.distanceDisplayCondition=Ou.getValueOrUndefined(s._distanceDisplayCondition,e,x5),a.disableDepthTestDistance=Ou.getValueOrDefault(s._disableDepthTestDistance,e,0);else if(D(c)){c.show=!0,c.position=u,c.scaleByDistance=Ou.getValueOrUndefined(s._scaleByDistance,e,w5),c.translucencyByDistance=Ou.getValueOrUndefined(s._translucencyByDistance,e,E5),c.distanceDisplayCondition=Ou.getValueOrUndefined(s._distanceDisplayCondition,e,x5),c.disableDepthTestDistance=Ou.getValueOrDefault(s._disableDepthTestDistance,e,0),c.heightReference=l;const t=Ou.getValueOrDefault(s._color,e,y5,v5),n=Ou.getValueOrDefault(s._outlineColor,e,b5,T5),i=Math.round(Ou.getValueOrDefault(s._outlineWidth,e,0));let r=Math.max(1,Math.round(Ou.getValueOrDefault(s._pixelSize,e,1)));if(i>0?(c.scale=1,h=h||i!==o.outlineWidth||r!==o.pixelSize||!Ot.equals(t,o.color)||!Ot.equals(n,o.outlineColor)):(c.scale=r/50,r=50,h=h||i!==o.outlineWidth||!Ot.equals(t,o.color)||!Ot.equals(n,o.outlineColor)),h){o.color=Ot.clone(t,o.color),o.outlineColor=Ot.clone(n,o.outlineColor),o.pixelSize=r,o.outlineWidth=i;const e=t.alpha,s=t.toCssColorString(),a=n.toCssColorString(),l=JSON.stringify([s,r,a,i]);c.setImage(l,FV(e,s,a,i,r))}p&&c._updateClamping()}}return!0},C5.prototype.getBoundingSphere=function(e,t){if(!D(e))throw new P("entity is required.");if(!D(t))throw new P("result is required.");const n=this._items.get(e.id);if(!D(n)||!D(n.pointPrimitive)&&!D(n.billboard))return Iu.FAILED;if(D(n.pointPrimitive))t.center=H.clone(n.pointPrimitive.position,t.center);else{const e=n.billboard;if(!D(e._clampedPosition))return Iu.PENDING;t.center=H.clone(e._clampedPosition,t.center)}return t.radius=0,Iu.DONE},C5.prototype.isDestroyed=function(){return!1},C5.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(C5.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return He(this)},C5.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],D(r._point)&&D(r._position)&&s.set(r.id,new S5(r));for(o=i.length-1;o>-1;o--)r=i[o],D(r._point)&&D(r._position)?s.contains(r.id)||s.set(r.id,new S5(r)):(I5(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],I5(s.get(r.id),r,a),s.remove(r.id)};const O5=[];function D5(e,t,n,i,o){const r=O5;let s;r.length=o;const a=n.red,c=n.green,l=n.blue,u=n.alpha,d=i.red,h=i.green,p=i.blue,f=i.alpha;if(Ot.equals(n,i)){for(s=0;s<o;s++)r[s]=Ot.clone(n);return r}const m=(d-a)/o,_=(h-c)/o,g=(p-l)/o,y=(f-u)/o;for(s=0;s<o;s++)r[s]=new Ot(a+s*m,c+s*_,l+s*g,u+s*y);return r}function P5(e){const t=(e=M(e,M.EMPTY_OBJECT)).positions,n=e.colors,i=M(e.width,1),o=M(e.colorsPerVertex,!1);if(!D(t)||t.length<2)throw new P("At least two positions are required.");if("number"!=typeof i)throw new P("width must be a number");if(D(n)&&(o&&n.length<t.length||!o&&n.length<t.length-1))throw new P("colors has an invalid length.");this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=o,this._vertexFormat=Bd.clone(M(e.vertexFormat,Bd.DEFAULT)),this._arcType=M(e.arcType,Py.GEODESIC),this._granularity=M(e.granularity,V.RADIANS_PER_DEGREE),this._ellipsoid=on.clone(M(e.ellipsoid,on.WGS84)),this._workerName="createPolylineGeometry";let r=1+t.length*H.packedLength;r+=D(n)?1+n.length*Ot.packedLength:1,this.packedLength=r+on.packedLength+Bd.packedLength+4}P5.pack=function(e,t,n){if(!D(e))throw new P("value is required");if(!D(t))throw new P("array is required");let i;n=M(n,0);const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(o[i],t,n);const s=e._colors;for(r=D(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=Ot.packedLength)Ot.pack(s[i],t,n);return on.pack(e._ellipsoid,t,n),n+=on.packedLength,Bd.pack(e._vertexFormat,t,n),n+=Bd.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};const N5=on.clone(on.UNIT_SPHERE),R5=new Bd,L5={positions:void 0,colors:void 0,ellipsoid:N5,vertexFormat:R5,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};P5.unpack=function(e,t,n){if(!D(e))throw new P("array is required");let i;t=M(t,0);let o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)r[i]=H.unpack(e,t);o=e[t++];const s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=Ot.packedLength)s[i]=Ot.unpack(e,t);const a=on.unpack(e,t,N5);t+=on.packedLength;const c=Bd.unpack(e,t,R5);t+=Bd.packedLength;const l=e[t++],u=1===e[t++],d=e[t++],h=e[t];return D(n)?(n._positions=r,n._colors=s,n._ellipsoid=on.clone(a,n._ellipsoid),n._vertexFormat=Bd.clone(c,n._vertexFormat),n._width=l,n._colorsPerVertex=u,n._arcType=d,n._granularity=h,n):(L5.positions=r,L5.colors=s,L5.width=l,L5.colorsPerVertex=u,L5.arcType=d,L5.granularity=h,new P5(L5))};const M5=new H,F5=new H,B5=new H,z5=new H;P5.createGeometry=function(e){const t=e._width,n=e._vertexFormat;let i=e._colors;const o=e._colorsPerVertex,r=e._arcType,s=e._granularity,a=e._ellipsoid;let c,l,u;const d=[];let h=Ry(e._positions,H.equalsEpsilon,!1,d);if(D(i)&&d.length>0){let e=0,t=d[0];i=i.filter((function(n,i){let r=!1;return r=o?i===t||0===i&&1===t:i+1===t,!r||(e++,t=d[e],!1)}))}let p=h.length;if(p<2||t<=0)return;if(r===Py.GEODESIC||r===Py.RHUMB){let e,t;r===Py.GEODESIC?(e=V.chordLength(s,a.maximumRadius),t=$H.numberOfPoints):(e=s,t=$H.numberOfPointsRhumbLine);const n=$H.extractHeights(h,a);if(D(i)){let n=1;for(c=0;c<p-1;++c)n+=t(h[c],h[c+1],e);const r=new Array(n);let s=0;for(c=0;c<p-1;++c){const a=h[c],u=h[c+1],d=i[c],p=t(a,u,e);if(o&&c<n){const e=D5(0,0,d,i[c+1],p),t=e.length;for(l=0;l<t;++l)r[s++]=e[l]}else for(l=0;l<p;++l)r[s++]=Ot.clone(d)}r[s]=Ot.clone(i[i.length-1]),i=r,O5.length=0}h=r===Py.GEODESIC?$H.generateCartesianArc({positions:h,minDistance:e,ellipsoid:a,height:n}):$H.generateCartesianRhumbArc({positions:h,granularity:e,ellipsoid:a,height:n})}p=h.length;const f=4*p-4,m=new Float64Array(3*f),_=new Float64Array(3*f),g=new Float64Array(3*f),y=new Float32Array(2*f),b=n.st?new Float32Array(2*f):void 0,v=D(i)?new Uint8Array(4*f):void 0;let A,T=0,w=0,E=0,x=0;for(l=0;l<p;++l){let e,r;0===l?(A=M5,H.subtract(h[0],h[1],A),H.add(h[0],A,A)):A=h[l-1],H.clone(A,B5),H.clone(h[l],F5),l===p-1?(A=M5,H.subtract(h[p-1],h[p-2],A),H.add(h[p-1],A,A)):A=h[l+1],H.clone(A,z5),D(v)&&(e=0===l||o?i[l]:i[l-1],l!==p-1&&(r=i[l]));const s=l===p-1?2:4;for(u=0===l?2:0;u<s;++u){H.pack(F5,m,T),H.pack(B5,_,T),H.pack(z5,g,T),T+=3;const i=u-2<0?-1:1;if(y[w++]=u%2*2-1,y[w++]=i*t,n.st&&(b[E++]=l/(p-1),b[E++]=Math.max(y[w-2],0)),D(v)){const t=u<2?e:r;v[x++]=Ot.floatToByte(t.red),v[x++]=Ot.floatToByte(t.green),v[x++]=Ot.floatToByte(t.blue),v[x++]=Ot.floatToByte(t.alpha)}}}const S=new Md;S.position=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:m}),S.prevPosition=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:_}),S.nextPosition=new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:g}),S.expandAndWidth=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:y}),n.st&&(S.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:b})),D(v)&&(S.color=new Ga({componentDatatype:Ca.UNSIGNED_BYTE,componentsPerAttribute:4,values:v,normalize:!0}));const C=je.createTypedArray(f,6*p-6);let I=0,O=0;const P=p-1;for(l=0;l<P;++l)C[O++]=I,C[O++]=I+2,C[O++]=I+1,C[O++]=I+1,C[O++]=I+2,C[O++]=I+3,I+=4;return new Na({attributes:S,indices:C,primitiveType:Vr.TRIANGLES,boundingSphere:$u.fromPoints(h),geometryType:Pa.POLYLINES})};const U5=new mu(0),k5={},V5=new Ot,H5=new Oh(Ot.WHITE),G5=new mu(!0),j5=new mu(k_.DISABLED),W5=new mu(new vu),q5=new mu(Vf.BOTH);function Y5(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function X5(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Q5(e,t){if(!D(e))throw new P("entity is required");if(!D(t))throw new P("scene is required");this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(Q5.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new gi,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 Y5,this._groundGeometryOptions=new X5,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=_A.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(Q5.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||!D(this._entity.availability)&&Ou.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}}}),Q5.prototype.isOutlineVisible=function(e){return!1},Q5.prototype.isFilled=function(e){const t=this._entity;return M(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e),!1)},Q5.prototype.createFillGeometryInstance=function(e){if(!D(e))throw new P("time is required.");if(!this._fillEnabled)throw new P("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new rh(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r={show:i,distanceDisplayCondition:Kd.fromDistanceDisplayCondition(o)};let s;return this._materialProperty instanceof Oh&&(D(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,V5)),D(s)||(s=Ot.WHITE),r.color=$d.fromColor(s)),this.clampToGround?new Zd({id:t,geometry:new $y(this._groundGeometryOptions),attributes:r}):(D(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof Oh&&(D(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(s=this._depthFailMaterialProperty.color.getValue(e,V5)),D(s)||(s=Ot.WHITE),r.depthFailColor=$d.fromColor(s)),new Zd({id:t,geometry:new P5(this._geometryOptions),attributes:r}))},Q5.prototype.createOutlineGeometryInstance=function(e){throw new P("This instance does not represent an outlined geometry.")},Q5.prototype.isDestroyed=function(){return!1},Q5.prototype.destroy=function(){this._entitySubscription(),He(this)},Q5.prototype._onEntityPropertyChanged=function(e,t,n,i){if("availability"!==t&&"polyline"!==t)return;const o=this._entity.polyline;if(!D(o))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));const r=o.positions,s=o.show;if(D(s)&&s.isConstant&&!s.getValue(ih.MINIMUM_VALUE)||!D(r))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));const a=o.zIndex,c=M(o.material,H5),l=c instanceof Oh;this._materialProperty=c,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=M(s,G5),this._shadowsProperty=M(o.shadows,j5),this._distanceDisplayConditionProperty=M(o.distanceDisplayCondition,W5),this._classificationTypeProperty=M(o.classificationType,q5),this._fillEnabled=!0,this._zIndex=M(a,U5);const u=o.width,d=o.arcType,h=o.clampToGround,p=o.granularity;if(r.isConstant&&Ou.isConstant(u)&&Ou.isConstant(d)&&Ou.isConstant(p)&&Ou.isConstant(h)&&Ou.isConstant(a)){const e=this._geometryOptions,t=r.getValue(ih.MINIMUM_VALUE,e.positions);if(!D(t)||t.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));let n;n=l&&(!D(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof Oh)?Av.VERTEX_FORMAT:xv.VERTEX_FORMAT,e.vertexFormat=n,e.positions=t,e.width=D(u)?u.getValue(ih.MINIMUM_VALUE):void 0,e.arcType=D(d)?d.getValue(ih.MINIMUM_VALUE):void 0,e.granularity=D(p)?p.getValue(ih.MINIMUM_VALUE):void 0;const i=this._groundGeometryOptions;i.positions=t,i.width=e.width,i.arcType=e.arcType,i.granularity=e.granularity,this._clampToGround=!!D(h)&&h.getValue(ih.MINIMUM_VALUE),!this._clampToGround&&D(a)&&Oa("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))},Q5.prototype.createDynamicUpdater=function(e,t){if(L.defined("primitives",e),L.defined("groundPrimitives",t),!this._dynamic)throw new P("This instance does not represent dynamic geometry.");return new K5(e,t,this)};const $5={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function K5(e,t,n){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=n,this._positions=[]}function Z5(e){if(D(e._line))return e._line;const t=e._primitives,n=e._geometryUpdater._scene.id+t._guid;let i=k5[n];!D(i)||i.isDestroyed()?(i=new fG,k5[n]=i,t.add(i)):t.contains(i)||t.add(i);const o=i.add();return o.id=e._geometryUpdater._entity,e._line=o,o}K5.prototype.update=function(e){const t=this._geometryUpdater,n=t._entity,i=n.polyline,o=i.positions;let r=Ou.getValueOrUndefined(o,e,this._positions);t._clampToGround=Ou.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=r,t._groundGeometryOptions.width=Ou.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=Ou.getValueOrDefault(i._arcType,e,Py.GEODESIC),t._groundGeometryOptions.granularity=Ou.getValueOrDefault(i._granularity,e,9999);const s=this._groundPrimitives;if(D(this._groundPolylinePrimitive)&&(s.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!Ou.getValueOrDefault(i._show,e,!0))return;if(!D(r)||r.length<2)return;const o=t.fillMaterialProperty;let a;if(o instanceof Oh)a=new Av;else{const t=Oy.getValue(e,o,this._material);a=new xv({material:t,translucent:t.isTranslucent()}),this._material=t}return this._groundPolylinePrimitive=s.add(new Sv({geometryInstances:t.createFillGeometryInstance(e),appearance:a,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Ou.getValueOrUndefined(t.zIndex,e)),void(D(this._line)&&(this._line.show=!1))}const a=Z5(this);if(!n.isShowing||!n.isAvailable(e)||!Ou.getValueOrDefault(i._show,e,!0))return void(a.show=!1);if(!D(r)||r.length<2)return void(a.show=!1);let c=Py.GEODESIC;c=Ou.getValueOrDefault(i._arcType,e,c);const l=t._scene.globe;c!==Py.NONE&&D(l)&&($5.ellipsoid=l.ellipsoid,$5.positions=r,$5.granularity=Ou.getValueOrUndefined(i._granularity,e),$5.height=$H.extractHeights(r,l.ellipsoid),r=c===Py.GEODESIC?$H.generateCartesianArc($5):$H.generateCartesianRhumbArc($5)),a.show=!0,a.positions=r.slice(),a.material=Oy.getValue(e,t.fillMaterialProperty,a.material),a.width=Ou.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=Ou.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)},K5.prototype.getBoundingSphere=function(e){if(L.defined("result",e),this._geometryUpdater.clampToGround){const t=this._groundPolylinePrimitive;if(D(t)&&t.show&&t.ready){const n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(D(n)&&D(n.boundingSphere))return $u.clone(n.boundingSphere,e),Iu.DONE}return D(t)&&!t.ready?Iu.PENDING:Iu.DONE}{const t=Z5(this);if(t.show&&t.positions.length>0)return $u.fromPoints(t.positions,e),Iu.DONE}return Iu.FAILED},K5.prototype.isDestroyed=function(){return!1},K5.prototype.destroy=function(){const e=this._geometryUpdater._scene.id+this._primitives._guid,t=k5[e];D(t)&&(t.remove(this._line),0===t.length&&(this._primitives.removeAndDestroy(t),delete k5[e])),D(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),He(this)};const J5=new Ot,e8=new vu,t8=new vu;function n8(e,t,n,i,o){let r;r=n instanceof Oh?Av:xv,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new bu,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new bu,this.material=void 0,this.updatersWithAttributes=new bu,this.attributes=new bu,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(n8.prototype.onMaterialChanged,this),this.subscriptions=new bu,this.showsUpdated=new bu,this.zIndex=i,this._asynchronous=o}function i8(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=M(n,!0)}n8.prototype.onMaterialChanged=function(){this.invalidated=!0},n8.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Oh&&t instanceof Oh||D(t)&&t.equals(n)},n8.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),t.hasConstantFill&&t.fillMaterialProperty.isConstant&&Ou.isConstant(t.distanceDisplayConditionProperty)){const e=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener((function(n,i,o,r){"isShowing"===i&&e.showsUpdated.set(t.id,t)})))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},n8.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const e=this.subscriptions.get(t);return D(e)&&(e(),this.subscriptions.remove(t)),!0}return!1},n8.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.orderedGroundPrimitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)D(n)&&(D(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new Sv({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===xv&&(this.material=Oy.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{D(n)&&(i.remove(n),n=void 0);const e=this.oldPrimitive;D(e)&&(i.remove(e),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(D(n)&&n.ready){n.show=!0,D(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===xv&&(this.material=Oy.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const t=this.updatersWithAttributes.values,o=t.length;for(r=0;r<o;r++){const i=t[r],o=i.entity,s=this.geometry.get(i.id);let a=this.attributes.get(s.id.id);if(D(a)||(a=n.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a)),!i.fillMaterialProperty.isConstant){const t=i.fillMaterialProperty.color,n=Ou.getValueOrDefault(t,e,Ot.WHITE,J5);Ot.equals(a._lastColor,n)||(a._lastColor=Ot.clone(n,a._lastColor),a.color=$d.toValue(n,a.color))}const c=o.isShowing&&(i.hasConstantFill||i.isFilled(e));c!==(1===a.show[0])&&(a.show=rh.toValue(c,a.show));const l=i.distanceDisplayConditionProperty;if(!Ou.isConstant(l)){const t=Ou.getValueOrDefault(l,e,t8,e8);vu.equals(t,a._lastDistanceDisplayCondition)||(a._lastDistanceDisplayCondition=vu.clone(t,a._lastDistanceDisplayCondition),a.distanceDisplayCondition=Kd.toValue(t,a.distanceDisplayCondition))}}this.updateShows(n)}else D(n)&&!n.ready&&(t=!1);return t},n8.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const n=t[i],o=n.entity,r=this.geometry.get(n.id);let s=this.attributes.get(r.id.id);D(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.isShowing;a!==(1===s.show[0])&&(s.show=rh.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()},n8.prototype.contains=function(e){return this.updaters.contains(e.id)},n8.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Iu.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!D(i)||!D(i.boundingSphere)||D(i.show)&&0===i.show[0]?Iu.FAILED:(i.boundingSphere.clone(t),Iu.DONE)},n8.prototype.destroy=function(){const e=this.primitive,t=this.orderedGroundPrimitives;D(e)&&t.remove(e);const n=this.oldPrimitive;D(n)&&t.remove(n),this.removeMaterialSubscription()},i8.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Ou.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){const i=n[a];if(i.isMaterial(t)&&i.zIndex===r)return void i.add(e,t,o)}const s=new n8(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)},i8.prototype.remove=function(e){const t=this._items;for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.remove(e)){0===i.updaters.length&&(t.splice(n,1),i.destroy());break}}},i8.prototype.update=function(e){let t;const n=this._items;for(t=n.length-1;t>=0;t--){const i=n[t];if(i.invalidated){n.splice(t,1);const o=i.updaters.values,r=o.length;for(let t=0;t<r;t++)this.add(e,o[t]);i.destroy()}}let i=!0;for(t=0;t<n.length;t++)i=n[t].update(e)&&i;return i},i8.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const i=n[o];if(i.contains(e))return i.getBoundingSphere(e,t)}return Iu.FAILED},i8.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const o8=[];function r8(e,t){const n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function s8(e,t,n){if(n.isDynamic)return void e._dynamicBatch.add(t,n);if(n.clampToGround&&n.fillEnabled){const i=n.classificationTypeProperty.getValue(t);return void e._groundBatches[i].add(t,n)}let i;n.fillEnabled&&(i=n.shadowsProperty.getValue(t));let o,r=0;D(n.depthFailMaterialProperty)&&(r=n.depthFailMaterialProperty instanceof Oh?1:2),D(i)&&(o=i+r*k_.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof Oh?e._colorBatches[o].add(t,n):e._materialBatches[o].add(t,n))}function a8(e,t,n,i){let o;L.defined("scene",e),L.defined("entityCollection",t),i=M(i,e.groundPrimitives),n=M(n,e.primitives),this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new bu,this._removedObjects=new bu,this._changedObjects=new bu;const r=k_.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(3*r),this._materialBatches=new Array(3*r),o=0;o<r;++o)this._colorBatches[o]=new B3(n,Av,void 0,!1,o),this._materialBatches[o]=new Q3(n,xv,void 0,!1,o),this._colorBatches[o+r]=new B3(n,Av,Av,!1,o),this._materialBatches[o+r]=new Q3(n,xv,Av,!1,o),this._colorBatches[o+2*r]=new B3(n,Av,xv,!1,o),this._materialBatches[o+2*r]=new Q3(n,xv,xv,!1,o);this._dynamicBatch=new xJ(n,i);const s=Vf.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new i8(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new bu,this._updaters=new bu,this._entityCollection=t,t.collectionChanged.addEventListener(a8.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,o8)}a8.prototype.update=function(e){L.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,c,l,u;for(a=s.length-1;a>-1;a--)c=s[a],l=c.id,u=this._updaters.get(l),u.entity===c?(r8(this,u),s8(this,e,u)):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],l=c.id,u=this._updaters.get(l),r8(this,u),u.destroy(),this._updaters.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(a=n.length-1;a>-1;a--)c=n[a],l=c.id,u=new Q5(c,this._scene),this._updaters.set(l,u),s8(this,e,u),this._subscriptions.set(l,u.geometryChanged.addEventListener(a8._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let d=!0;const h=this._batches,p=h.length;for(a=0;a<p;a++)d=h[a].update(e)&&d;return d};const c8=[],l8=new $u;function u8(e){L.typeOf.object("options",e),L.typeOf.object("options.scene",e.scene),L.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),gy.initializeTerrainHeights(),Sv.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new KX,this._eventHelper.add(n.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(n.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(n.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=n,this._scene=t,this._visualizersCallback=M(e.visualizersCallback,u8.defaultVisualizersCallback);let i=!1;const o=new TJ,r=new TJ;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let l=0,u=n.length;l<u;l++)this._onDataSourceAdded(n,n.get(l));const s=new PZ;let a,c;if(this._onDataSourceAdded(void 0,s),this._defaultDataSource=s,!i){const e=this,i=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),c(),e._removeDefaultDataSourceListener=void 0,e._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(i),c=n.dataSourceAdded.addEventListener(i)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=c,this._ready=!1}a8.prototype.getBoundingSphere=function(e,t){L.defined("entity",e),L.defined("result",t);const n=c8,i=l8;let o=0,r=Iu.DONE;const s=this._batches,a=s.length,c=this._updaters.get(e.id);for(let l=0;l<a;l++){if(r=s[l].getBoundingSphere(c,i),r===Iu.PENDING)return Iu.PENDING;r===Iu.DONE&&(n[o]=$u.clone(i,n[o]),o++)}return 0===o?Iu.FAILED:(n.length=o,$u.fromBoundingSpheres(n,t),Iu.DONE)},a8.prototype.isDestroyed=function(){return!1},a8.prototype.destroy=function(){let e;this._entityCollection.collectionChanged.removeEventListener(a8.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();return this._subscriptions.removeAll(),He(this)},a8._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;D(t.get(o))||D(n.get(o))||n.set(o,i)},a8.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let s,a,c;for(s=n.length-1;s>-1;s--)c=n[s],a=c.id,i.remove(a)||(o.set(a,c),r.remove(a));for(s=t.length-1;s>-1;s--)c=t[s],a=c.id,o.remove(a)?r.set(a,c):i.set(a,c)};const d8=[];u8.registerVisualizer=function(e){d8.includes(e)||d8.push(e)},u8.unregisterVisualizer=function(e){if(d8.includes(e)){const t=d8.indexOf(e);d8.splice(t,1)}},u8.defaultVisualizersCallback=function(e,t,n){const i=n.entities;return[new Yu(t,i),new y4(e,i,n._primitives,n._groundPrimitives),new G4(t,i),new n5(e,i),new WX(e,i),new C5(t,i),new g5(e,i),new a8(e,i,n._primitives,n._groundPrimitives),...d8.map((t=>new t(e,i)))]},Object.defineProperties(u8.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}}}),u8.prototype.isDestroyed=function(){return!1},u8.prototype.destroy=function(){this._eventHelper.removeAll();const e=this._dataSourceCollection;for(let t=0,n=e.length;t<n;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),D(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),He(this)},u8.prototype.update=function(e){if(L.defined("time",e),!Hh.initialized)return this._ready=!1,!1;let t,n,i,o,r=!0;const s=this._dataSourceCollection,a=s.length;for(t=0;t<a;t++){const a=s.get(t);for(D(a.update)&&(r=a.update(e)&&r),i=a._visualizers,o=i.length,n=0;n<o;n++)r=i[n].update(e)&&r}for(i=this._defaultDataSource._visualizers,o=i.length,n=0;n<o;n++)r=i[n].update(e)&&r;return!this._ready&&r&&this._scene.requestRender(),this._ready=r,r},u8.prototype._postRender=function(){const e=this._scene.frameState,t=this._dataSourceCollection,n=t.length;for(let i=0;i<n;i++){const n=t.get(i),o=n.credit;D(o)&&e.creditDisplay.addCreditToNextFrame(o);const r=n._resourceCredits;if(D(r)){const t=r.length;for(let n=0;n<t;n++)e.creditDisplay.addCreditToNextFrame(r[n])}}};const h8=[],p8=new $u;function f8(e,t,n){this.heading=M(e,0),this.pitch=M(t,0),this.range=M(n,0)}u8.prototype.getBoundingSphere=function(e,t,n){if(L.defined("entity",e),L.typeOf.bool("allowPartial",t),L.defined("result",n),!this._ready)return Iu.PENDING;let i,o,r=this._defaultDataSource;if(!r.entities.contains(e)){r=void 0;const t=this._dataSourceCollection;for(o=t.length,i=0;i<o;i++){const n=t.get(i);if(n.entities.contains(e)){r=n;break}}}if(!D(r))return Iu.FAILED;const s=h8,a=p8;let c=0,l=Iu.DONE;const u=r._visualizers,d=u.length;for(i=0;i<d;i++){if(D(u[i].getBoundingSphere)){if(l=u[i].getBoundingSphere(e,a),!t&&l===Iu.PENDING)return Iu.PENDING;l===Iu.DONE&&(s[c]=$u.clone(a,s[c]),c++)}}return 0===c?Iu.FAILED:(s.length=c,$u.fromBoundingSpheres(s,n),Iu.DONE)},u8.prototype._onDataSourceAdded=function(e,t){const n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new TJ),s=o.add(new EJ);t._primitives=r,t._groundPrimitives=s;const a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)},u8.prototype._onDataSourceRemoved=function(e,t){const n=this._primitives,i=this._groundPrimitives,o=t._primitives,r=t._groundPrimitives,s=t.clustering;o.remove(s);const a=t._visualizers,c=a.length;for(let l=0;l<c;l++)a[l].destroy();n.remove(o),i.remove(r),t._visualizers=void 0},u8.prototype._onDataSourceMoved=function(e,t,n){const i=this._primitives,o=this._groundPrimitives,r=e._primitives,s=e._groundPrimitives;t===n+1?(i.raise(r),o.raise(s)):t===n-1?(i.lower(r),o.lower(s)):0===t?(i.lowerToBottom(r),o.lowerToBottom(s),i.raise(r),o.raise(s)):(i.raiseToTop(r),o.raiseToTop(s))},f8.clone=function(e,t){if(D(e))return D(t)||(t=new f8),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const m8=new re,_8=new re,g8=new re,y8=new ve,b8=new H,v8=new H,A8=new H,T8=new H,w8=new H,E8=new H,x8=new Hn;function S8(e,t,n){L.defined("entity",e),L.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=M(n,on.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new H,this._defaultOffset3D=void 0,this._offset3D=new H}Object.defineProperties(S8,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=H.clone(e,new H)}}}),S8.defaultOffset3D=new H(-14e3,3500,3500);const C8=new f8,I8=new H;function O8(e){if("string"==typeof e){const t=document.getElementById(e);if(null===t)throw new P(`Element with id "${e}" does not exist in the document.`);e=t}return e}S8.prototype.update=function(e,t){L.defined("time",e);const n=this.scene,i=this.ellipsoid,o=n.mode;if(o===gl.MORPHING)return;const r=this.entity,s=r.position;if(!D(s))return;const a=r!==this._lastEntity,c=o!==this._mode,l=n.camera;let u=a||c,d=!0;if(a){const n=r.viewFrom,o=D(n);if(!o&&D(t)){C8.pitch=-V.PI_OVER_FOUR,C8.range=0;const n=s.getValue(e,I8);if(D(n)){const e=2-1/Math.max(1,H.magnitude(n)/i.maximumRadius);C8.pitch*=e}l.viewBoundingSphere(t,C8),this.boundingSphere=t,u=!1,d=!1}else o&&D(n.getValue(e,this._offset3D))||H.clone(S8._defaultOffset3D,this._offset3D)}else c||this._mode===gl.SCENE2D||H.clone(l.position,this._offset3D);this._lastEntity=r,this._mode=o,function(e,t,n,i,o,r,s){const a=e.scene.mode;let c=o.getValue(r,e._lastCartesian);if(D(c)){let n,l,u,d,h,p,f=!1,m=!1;if(a===gl.SCENE3D){Hn.addSeconds(r,.001,x8);let e=o.getValue(x8,b8);if(D(e)||(Hn.addSeconds(r,-.001,x8),e=o.getValue(x8,b8),m=!0),D(e)){let t,i=Cr.computeFixedToIcrfMatrix(r,m8),o=Cr.computeFixedToIcrfMatrix(x8,_8);D(i)&&D(o)?t=re.transpose(i,g8):(t=Cr.computeTemeToPseudoFixedMatrix(r,g8),i=re.transpose(t,m8),o=Cr.computeTemeToPseudoFixedMatrix(x8,_8),re.transpose(o,o));const a=re.multiplyByVector(i,c,w8),d=re.multiplyByVector(o,e,E8);H.subtract(a,d,T8);const h=1e3*H.magnitude(T8),p=V.GRAVITATIONALPARAMETER,_=-p/(h*h-2*p/H.magnitude(a));_<0||_>1.25*s.maximumRadius?(n=v8,H.normalize(c,n),H.negate(n,n),u=H.clone(H.UNIT_Z,A8),l=H.cross(u,n,b8),H.magnitude(l)>V.EPSILON7&&(H.normalize(n,n),H.normalize(l,l),u=H.cross(n,l,A8),H.normalize(u,u),f=!0)):H.equalsEpsilon(c,e,V.EPSILON7)||(u=v8,H.normalize(a,u),H.normalize(d,d),l=H.cross(u,d,A8),m&&(l=H.multiplyByScalar(l,-1,l)),H.equalsEpsilon(l,H.ZERO,V.EPSILON7)||(n=H.cross(l,u,b8),re.multiplyByVector(t,n,n),re.multiplyByVector(t,l,l),re.multiplyByVector(t,u,u),H.normalize(n,n),H.normalize(l,l),H.normalize(u,u),f=!0))}}D(e.boundingSphere)&&(c=e.boundingSphere.center),i&&(d=H.clone(t.position,T8),h=H.clone(t.direction,w8),p=H.clone(t.up,E8));const _=y8;f?(_[0]=n.x,_[1]=n.y,_[2]=n.z,_[3]=0,_[4]=l.x,_[5]=l.y,_[6]=l.z,_[7]=0,_[8]=u.x,_[9]=u.y,_[10]=u.z,_[11]=0,_[12]=c.x,_[13]=c.y,_[14]=c.z,_[15]=0):Cr.eastNorthUpToFixedFrame(c,s,_),t._setTransform(_),i&&(H.clone(d,t.position),H.clone(h,t.direction),H.clone(p,t.up),H.cross(h,p,t.right))}if(n){const n=a===gl.SCENE2D||H.equals(e._offset3D,H.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,n)}}(this,l,u,d,s,e,i)};var D8,P8=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 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:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-P8.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*P8.Bounce.In(2*e):.5*P8.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e<Number.EPSILON?Number.EPSILON:e)>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),N8=function(){return performance.now()},R8=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=N8()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var o=this._tweens[n[i]],r=!t;o&&!1===o.update(e,r)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),L8={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=L8.Utils.Linear;return t<0?r(e[0],e[1],i):t>1?r(e[n],e[n-1],n-i):r(e[o],e[o+1>n?n:o+1],i-o)},Bezier:function(e,t){for(var n=0,i=e.length-1,o=Math.pow,r=L8.Utils.Bernstein,s=0;s<=i;s++)n+=o(1-t,i-s)*o(t,s)*e[s]*r(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=L8.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(i=n*(1+t))),r(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],i-o)):t<0?e[0]-(r(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(r(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):r(e[o?o-1:0],e[o],e[n<o+1?n:o+1],e[n<o+2?n:o+2],i-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=L8.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(D8=[1],function(e){var t=1;if(D8[e])return D8[e];for(var n=e;n>1;n--)t*=n;return D8[e]=t,t}),CatmullRom:function(e,t,n,i,o){var r=.5*(n-e),s=.5*(i-t),a=o*o;return(2*t-2*n+r+s)*(o*a)+(-3*t+3*n-2*r-s)*a+r*o+t}}},M8=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),F8=new R8,B8=function(){function e(e,t){void 0===t&&(t=F8),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=P8.Linear.None,this._interpolationFunction=L8.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=M8.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e<0?0:e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=N8()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,n,i,o){for(var r in n){var s=e[r],a=Array.isArray(s),c=a?"array":typeof s,l=!a&&Array.isArray(n[r]);if("undefined"!==c&&"function"!==c){if(l){if(0===(_=n[r]).length)continue;for(var u=[s],d=0,h=_.length;d<h;d+=1){var p=this._handleRelativeValue(s,_[d]);if(isNaN(p)){l=!1;break}u.push(p)}l&&(n[r]=u)}if("object"!==c&&!a||!s||l)(void 0===t[r]||o)&&(t[r]=s),a||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{t[r]=a?[]:{};var f=s;for(var m in f)t[r][m]=f[m];i[r]=a?[]:{};var _=n[r];if(!this._isDynamic){var g={};for(var m in _)g[m]=_[m];n[r]=_=g}this._setupProperties(f,t[r],_,i[r],o)}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=N8()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=N8()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return void 0===e&&(e=F8),this._group=e,this},e.prototype.delay=function(e){return void 0===e&&(e=0),this._delayTime=e,this},e.prototype.repeat=function(e){return void 0===e&&(e=0),this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return void 0===e&&(e=!1),this._yoyo=e,this},e.prototype.easing=function(e){return void 0===e&&(e=P8.Linear.None),this._easingFunction=e,this},e.prototype.interpolation=function(e){return void 0===e&&(e=L8.Linear),this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){var n;if(void 0===e&&(e=N8()),void 0===t&&(t=!0),this._isPaused)return!0;var i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,r=this._duration+(null!==(n=this._repeatDelayTime)&&void 0!==n?n:this._delayTime),s=this._duration+this._repeat*r,a=this._calculateElapsedPortion(o,r,s),c=this._easingFunction(a),l=this._calculateCompletionStatus(o,r);if("repeat"===l&&this._processRepetition(o,r),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),"about-to-repeat"===l&&this._processRepetition(o,r),this._onUpdateCallback&&this._onUpdateCallback(this._object,a),"repeat"===l||"about-to-repeat"===l)this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if("completed"===l){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var u=0,d=this._chainedTweens.length;u<d;u++)this._chainedTweens[u].start(this._startTime+this._duration,!1)}return"completed"!==l},e.prototype._calculateElapsedPortion=function(e,t,n){if(0===this._duration||e>n)return 1;var i=e%t,o=Math.min(i/this._duration,1);return 0===o&&0!==e&&e%this._duration==0?1:o},e.prototype._calculateCompletionStatus=function(e,t){return 0!==this._duration&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},e.prototype._processRepetition=function(e,t){var n=Math.min(Math.trunc((e-this._duration)/t)+1,this._repeat);for(var i in isFinite(this._repeat)&&(this._repeat-=n),this._valuesStartRepeat){var o=this._valuesEnd[i];this._yoyo||"string"!=typeof o||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(o)),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=t*n},e.prototype._updateProperties=function(e,t,n,i){for(var o in n)if(void 0!==t[o]){var r=t[o]||0,s=n[o],a=Array.isArray(e[o]),c=Array.isArray(s);!a&&c?e[o]=this._interpolationFunction(s,i):"object"==typeof s&&s?this._updateProperties(e[o],r,s,i):"number"==typeof(s=this._handleRelativeValue(r,s))&&(e[o]=r+(s-r)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}();M8.nextId;var z8=F8;z8.getAll.bind(z8),z8.removeAll.bind(z8),z8.add.bind(z8),z8.remove.bind(z8),z8.update.bind(z8);const U8={LINEAR_NONE:P8.Linear.None,QUADRATIC_IN:P8.Quadratic.In,QUADRATIC_OUT:P8.Quadratic.Out,QUADRATIC_IN_OUT:P8.Quadratic.InOut,CUBIC_IN:P8.Cubic.In,CUBIC_OUT:P8.Cubic.Out,CUBIC_IN_OUT:P8.Cubic.InOut,QUARTIC_IN:P8.Quartic.In,QUARTIC_OUT:P8.Quartic.Out,QUARTIC_IN_OUT:P8.Quartic.InOut,QUINTIC_IN:P8.Quintic.In,QUINTIC_OUT:P8.Quintic.Out,QUINTIC_IN_OUT:P8.Quintic.InOut,SINUSOIDAL_IN:P8.Sinusoidal.In,SINUSOIDAL_OUT:P8.Sinusoidal.Out,SINUSOIDAL_IN_OUT:P8.Sinusoidal.InOut,EXPONENTIAL_IN:P8.Exponential.In,EXPONENTIAL_OUT:P8.Exponential.Out,EXPONENTIAL_IN_OUT:P8.Exponential.InOut,CIRCULAR_IN:P8.Circular.In,CIRCULAR_OUT:P8.Circular.Out,CIRCULAR_IN_OUT:P8.Circular.InOut,ELASTIC_IN:P8.Elastic.In,ELASTIC_OUT:P8.Elastic.Out,ELASTIC_IN_OUT:P8.Elastic.InOut,BACK_IN:P8.Back.In,BACK_OUT:P8.Back.Out,BACK_IN_OUT:P8.Back.InOut,BOUNCE_IN:P8.Bounce.In,BOUNCE_OUT:P8.Bounce.Out,BOUNCE_IN_OUT:P8.Bounce.InOut},k8=Object.freeze(U8),V8="#ifdef MRT\nlayout (location = 0) out vec4 out_FragData_0;\nlayout (location = 1) out vec4 out_FragData_1;\n#else\nlayout (location = 0) out vec4 out_FragColor;\n#endif\n\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n if (texture(u_depthTexture, v_textureCoordinates).r < 1.0)\n {\n#ifdef MRT\n out_FragData_0 = u_bgColor;\n out_FragData_1 = vec4(u_bgColor.a);\n#else\n out_FragColor = u_bgColor;\n#endif\n return;\n }\n \n discard;\n}\n",H8="uniform vec3 u_radiiAndDynamicAtmosphereColor;\n\nuniform float u_atmosphereLightIntensity;\nuniform float u_atmosphereRayleighScaleHeight;\nuniform float u_atmosphereMieScaleHeight;\nuniform float u_atmosphereMieAnisotropy;\nuniform vec3 u_atmosphereRayleighCoefficient;\nuniform vec3 u_atmosphereMieCoefficient;\n\nconst float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.\nconst int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.\nconst int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\n/**\n * This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as\n * the transmittance value for the ray.\n *\n * @param {czm_ray} primaryRay The ray from the camera to the position.\n * @param {float} primaryRayLength The length of the primary ray.\n * @param {vec3} lightDirection The direction of the light to calculate the scattering from.\n * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.\n * @param {vec3} mieColor The variable the Mie scattering will be written to.\n * @param {float} opacity The variable the transmittance will be written to.\n * @glslFunction\n */\nvoid computeScattering(\n czm_ray primaryRay,\n float primaryRayLength,\n vec3 lightDirection,\n float atmosphereInnerRadius,\n out vec3 rayleighColor,\n out vec3 mieColor,\n out float opacity\n) {\n\n // Initialize the default scattering amounts to 0.\n rayleighColor = vec3(0.0);\n mieColor = vec3(0.0);\n opacity = 0.0;\n\n float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;\n\n vec3 origin = vec3(0.0);\n\n // Calculate intersection from the camera to the outer ring of the atmosphere.\n czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);\n\n // Return empty colors if no intersection with the atmosphere geometry.\n if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {\n return;\n }\n\n // To deal with smaller values of PRIMARY_STEPS (e.g. 4)\n // we implement a split strategy: sky or horizon.\n // For performance reasons, instead of a if/else branch\n // a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0\n float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);\n // Value close to 0.0: close to the horizon\n // Value close to 1.0: above in the sky\n float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));\n\n // The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.\n float start_0 = primaryRayAtmosphereIntersect.start;\n primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);\n // The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.\n primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));\n\n // For the number of ray steps, distinguish inside or outside atmosphere (outer space)\n // (1) from outer space we have to use more ray steps to get a realistic rendering\n // (2) within atmosphere we need fewer steps for faster rendering\n float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters\n float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));\n int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.\n int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\n // Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.\n float rayPositionLength = primaryRayAtmosphereIntersect.start;\n // (1) Outside the atmosphere: constant rayStepLength\n // (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps\n float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;\n float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));\n float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));\n\n vec3 rayleighAccumulation = vec3(0.0);\n vec3 mieAccumulation = vec3(0.0);\n vec2 opticalDepth = vec2(0.0);\n vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);\n\n // Sample positions on the primary ray.\n for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {\n\n // The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot\n // loop with non-constant condition, so it has to break early instead\n if (i >= PRIMARY_STEPS) {\n break;\n }\n\n // Calculate sample position along viewpoint ray.\n vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);\n\n // Calculate height of sample position above ellipsoid.\n float sampleHeight = length(samplePosition) - atmosphereInnerRadius;\n\n // Calculate and accumulate density of particles at the sample position.\n vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;\n opticalDepth += sampleDensity;\n\n // Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.\n czm_ray lightRay = czm_ray(samplePosition, lightDirection);\n czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);\n\n float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);\n float lightPositionLength = 0.0;\n\n vec2 lightOpticalDepth = vec2(0.0);\n\n // Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.\n for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {\n\n // The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot\n // loop with non-constant condition, so it has to break early instead\n if (j >= LIGHT_STEPS) {\n break;\n }\n\n // Calculate sample position along light ray.\n vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);\n\n // Calculate height of the light sample position above ellipsoid.\n float lightHeight = length(lightPosition) - atmosphereInnerRadius;\n\n // Calculate density of photons at the light sample position.\n lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;\n\n // Increment distance on light ray.\n lightPositionLength += lightStepLength;\n }\n\n // Compute attenuation via the primary ray and the light ray.\n vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));\n\n // Accumulate the scattering.\n rayleighAccumulation += sampleDensity.x * attenuation;\n mieAccumulation += sampleDensity.y * attenuation;\n\n // Increment distance on primary ray.\n rayPositionLength += (rayStepLength += rayStepLengthIncrease);\n }\n\n // Compute the scattering amount.\n rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;\n mieColor = u_atmosphereMieCoefficient * mieAccumulation;\n\n // Compute the transmittance i.e. how much light is passing through the atmosphere.\n opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));\n}\n\nvec4 computeAtmosphereColor(\n vec3 positionWC,\n vec3 lightDirection,\n vec3 rayleighColor,\n vec3 mieColor,\n float opacity\n) {\n // Setup the primary ray: from the camera position to the vertex position.\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n\n float cosAngle = dot(cameraToPositionWCDirection, lightDirection);\n float cosAngleSq = cosAngle * cosAngle;\n\n float G = u_atmosphereMieAnisotropy;\n float GSq = G * G;\n\n // The Rayleigh phase function.\n float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);\n // The Mie phase function.\n float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));\n\n // The final color is generated by combining the effects of the Rayleigh and Mie scattering.\n vec3 rayleigh = rayleighPhase * rayleighColor;\n vec3 mie = miePhase * mieColor;\n\n vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;\n\n return vec4(color, opacity);\n}\n",G8="uniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\n\nin vec3 v_positionEC;\n\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\n vec3 positionEC = czm_pointAlongRay(ray, intersection);\n vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\n vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\n vec3 sphericalNormal = normalize(positionMC / u_radii);\n vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates\n vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordinates\n\n vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\n vec3 positionToEyeEC = -positionEC;\n\n czm_materialInput materialInput;\n materialInput.s = st.s;\n materialInput.st = st;\n materialInput.str = (positionMC + u_radii) / u_radii;\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef ONLY_SUN_LIGHTING\n return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);\n#else\n return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n\nvoid main()\n{\n // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii\n // in the vertex shader. Only when it is larger than some constant, march along the ray.\n // Otherwise perform one intersection test which will be the common case.\n\n // Test if the ray intersects a sphere with the ellipsoid's maximum radius.\n // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test\n // may cause false negatives. This will discard fragments before marching the ray forward.\n float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\n vec3 direction = normalize(v_positionEC);\n vec3 ellipsoidCenter = czm_modelView[3].xyz;\n\n float t1 = -1.0;\n float t2 = -1.0;\n\n float b = -2.0 * dot(direction, ellipsoidCenter);\n float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\n\n float discriminant = b * b - 4.0 * c;\n if (discriminant >= 0.0) {\n t1 = (-b - sqrt(discriminant)) * 0.5;\n t2 = (-b + sqrt(discriminant)) * 0.5;\n }\n\n if (t1 < 0.0 && t2 < 0.0) {\n discard;\n }\n\n float t = min(t1, t2);\n if (t < 0.0) {\n t = 0.0;\n }\n\n // March ray forward to intersection with larger sphere and find\n czm_ray ray = czm_ray(t * direction, direction);\n\n vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);\n\n czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\n\n if (czm_isEmpty(intersection))\n {\n discard;\n }\n\n // If the viewer is outside, compute outsideFaceColor, with normals facing outward.\n vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\n\n // If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.\n vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\n\n out_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\n out_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n\n#if (defined(WRITE_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))\n t = (intersection.start != 0.0) ? intersection.start : intersection.stop;\n vec3 positionEC = czm_pointAlongRay(ray, t);\n vec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n#ifdef LOG_DEPTH\n czm_writeLogDepth(1.0 + positionCC.w);\n#else\n float z = positionCC.z / positionCC.w;\n\n float n = czm_depthRange.near;\n float f = czm_depthRange.far;\n\n gl_FragDepth = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n}\n",j8="in vec3 position;\n\nuniform vec3 u_radii;\n\nout vec3 v_positionEC;\n\nvoid main()\n{\n // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.\n // Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry,\n // but doing it here allows us to change the radii without rewriting the vertex data, and\n // allows all ellipsoids to reuse the same vertex data.\n vec4 p = vec4(u_radii * position, 1.0);\n\n v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates\n gl_Position = czm_modelViewProjection * p; // position in clip coordinates\n\n // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums\n // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the\n // ellipsoid (does not write depth) that was rendered in the farther frustum.\n //\n // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates\n // artifacts since some fragments can be alpha blended twice. This is solved by only rendering\n // the ellipsoid in the closest frustum to the viewer.\n gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n\n czm_vertexLogDepth();\n}\n",W8="void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {\n\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);\n \n float atmosphereInnerRadius = length(positionWC);\n\n computeScattering(\n primaryRay,\n length(cameraToPositionWC),\n lightDirection,\n atmosphereInnerRadius,\n rayleighColor,\n mieColor,\n opacity\n );\n}\n",q8="uniform sampler2D u_texture;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n out_FragColor = texture(u_texture, v_textureCoordinates);\n}\n",Y8="in vec4 position;\nin float webMercatorT;\n\nuniform vec2 u_textureDimensions;\n\nout vec2 v_textureCoordinates;\n\nvoid main()\n{\n v_textureCoordinates = vec2(position.x, webMercatorT);\n gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n",X8="float interpolateByDistance(vec4 nearFarScalar, float distance)\n{\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\n\nvoid computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe)\n{\n float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;\n\n // Adjustment to the atmosphere radius applied based on the camera height.\n float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0;\n float distanceAdjustMax = czm_ellipsoidRadii.x;\n float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0;\n float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0);\n\n // Since atmosphere scattering assumes the atmosphere is a spherical shell, we compute an inner radius of the atmosphere best fit\n // for the position on the ellipsoid.\n float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;\n float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;\n\n // Setup the primary ray: from the camera position to the vertex position.\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);\n\n underTranslucentGlobe = 0.0;\n\n // Brighten the sky atmosphere under the Earth's atmosphere when translucency is enabled.\n #if defined(GLOBE_TRANSLUCENT)\n\n // Check for intersection with the inner radius of the atmopshere.\n czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);\n if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {\n\n // Compute position on globe.\n vec3 direction = normalize(positionWC);\n czm_ray ellipsoidRay = czm_ray(positionWC, -direction);\n czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii);\n vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start);\n\n // Control the color using the camera angle.\n float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));\n\n // Control the opacity using the distance from Earth.\n opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth));\n vec3 horizonColor = vec3(0.1, 0.2, 0.3);\n vec3 nearColor = vec3(0.0);\n\n rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity);\n\n // Set the traslucent flag to avoid alpha adjustment in computeFinalColor funciton.\n underTranslucentGlobe = 1.0;\n return;\n }\n #endif\n\n computeScattering(\n primaryRay,\n length(cameraToPositionWC),\n lightDirection,\n atmosphereInnerRadius,\n rayleighColor,\n mieColor,\n opacity\n );\n\n // Alter the opacity based on how close the viewer is to the ground.\n // (0.0 = At edge of atmosphere, 1.0 = On ground)\n float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;\n float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;\n opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);\n\n // Alter alpha based on time of day (0.0 = night , 1.0 = day)\n float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;\n opacity *= pow(nightAlpha, 0.5);\n}\n";function Q8(e){let t;const n=e.name,i=e.message;t=D(n)&&D(i)?`${n}: ${i}`:e.toString();const o=e.stack;return D(o)&&(t+=`\n${o}`),t}const $8=Object.freeze({NONE:0,LERC:1}),K8=Object.freeze({NONE:0,BITS12:1}),Z8=new H,J8=new H,e9=new kt,t9=new ve,n9=new ve,i9=Math.pow(2,12);function o9(e,t,n,i,o,r,s,a,c,l){let u,d,h=K8.NONE;if(D(t)&&D(n)&&D(i)&&D(o)){const e=t.minimum,r=t.maximum,s=H.subtract(r,e,J8),a=i-n;h=Math.max(H.maximumComponent(s),a)<i9-1?K8.BITS12:K8.NONE,u=ve.inverseTransformation(o,new ve);const c=H.negate(e,Z8);ve.multiply(ve.fromTranslation(c,t9),u,u);const l=Z8;l.x=1/s.x,l.y=1/s.y,l.z=1/s.z,ve.multiply(ve.fromScale(l,t9),u,u),d=ve.clone(o),ve.setTranslation(d,H.ZERO,d),o=ve.clone(o,new ve);const p=ve.fromTranslation(e,t9),f=ve.fromScale(s,n9),m=ve.multiply(p,f,t9);ve.multiply(o,m,o),ve.multiply(d,m,d)}this.quantization=h,this.minimumHeight=n,this.maximumHeight=i,this.center=H.clone(e),this.toScaledENU=u,this.fromScaledENU=o,this.matrix=d,this.hasVertexNormals=r,this.hasWebMercatorT=M(s,!1),this.hasGeodeticSurfaceNormals=M(a,!1),this.exaggeration=M(c,1),this.exaggerationRelativeHeight=M(l,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}o9.prototype.encode=function(e,t,n,i,o,r,s,a){const c=i.x,l=i.y;if(this.quantization===K8.BITS12){(n=ve.multiplyByPoint(this.toScaledENU,n,Z8)).x=V.clamp(n.x,0,1),n.y=V.clamp(n.y,0,1),n.z=V.clamp(n.z,0,1);const i=this.maximumHeight-this.minimumHeight,r=V.clamp((o-this.minimumHeight)/i,0,1);kt.fromElements(n.x,n.y,e9);const a=sm.compressTextureCoordinates(e9);kt.fromElements(n.z,r,e9);const u=sm.compressTextureCoordinates(e9);kt.fromElements(c,l,e9);const d=sm.compressTextureCoordinates(e9);if(e[t++]=a,e[t++]=u,e[t++]=d,this.hasWebMercatorT){kt.fromElements(s,0,e9);const n=sm.compressTextureCoordinates(e9);e[t++]=n}}else H.subtract(n,this.center,Z8),e[t++]=Z8.x,e[t++]=Z8.y,e[t++]=Z8.z,e[t++]=o,e[t++]=c,e[t++]=l,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=sm.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};const r9=new H,s9=new H;o9.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;const i=this.stride,o=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();const r=this.stride;for(let s=0;s<o;s++){for(let n=0;n<i;n++){const o=s*i+n;t[s*r+n]=e[o]}const o=this.decodePosition(t,s,r9),a=n.geodeticSurfaceNormal(o,s9),c=s*r+this._offsetGeodeticSurfaceNormal;t[c]=a.x,t[c+1]=a.y,t[c+2]=a.z}},o9.prototype.removeGeodeticSurfaceNormals=function(e,t){if(!this.hasGeodeticSurfaceNormals)return;const n=this.stride,i=e.length/n;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();const o=this.stride;for(let r=0;r<i;r++)for(let i=0;i<o;i++){const s=r*n+i;t[r*o+i]=e[s]}},o9.prototype.decodePosition=function(e,t,n){if(D(n)||(n=new H),t*=this.stride,this.quantization===K8.BITS12){const i=sm.decompressTextureCoordinates(e[t],e9);n.x=i.x,n.y=i.y;const o=sm.decompressTextureCoordinates(e[t+1],e9);return n.z=o.x,ve.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],H.add(n,this.center,n)},o9.prototype.getExaggeratedPosition=function(e,t,n){n=this.decodePosition(e,t,n);const i=this.exaggeration,o=this.exaggerationRelativeHeight;if(1!==i&&this.hasGeodeticSurfaceNormals){const r=this.decodeGeodeticSurfaceNormal(e,t,s9),s=this.decodeHeight(e,t),a=zf.getHeight(s,i,o)-s;n.x+=r.x*a,n.y+=r.y*a,n.z+=r.z*a}return n},o9.prototype.decodeTextureCoordinates=function(e,t,n){return D(n)||(n=new kt),t*=this.stride,this.quantization===K8.BITS12?sm.decompressTextureCoordinates(e[t+2],n):kt.fromElements(e[t+4],e[t+5],n)},o9.prototype.decodeHeight=function(e,t){if(t*=this.stride,this.quantization===K8.BITS12){return sm.decompressTextureCoordinates(e[t+1],e9).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight}return e[t+3]},o9.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===K8.BITS12?sm.decompressTextureCoordinates(e[t+3],e9).x:e[t+6]},o9.prototype.getOctEncodedNormal=function(e,t,n){const i=e[t=t*this.stride+this._offsetVertexNormal]/256,o=Math.floor(i),r=256*(i-o);return kt.fromElements(o,r,n)},o9.prototype.decodeGeodeticSurfaceNormal=function(e,t,n){return t=t*this.stride+this._offsetGeodeticSurfaceNormal,n.x=e[t],n.y=e[t+1],n.z=e[t+2],n},o9.prototype._calculateStrideAndOffsets=function(){let e=0;if(this.quantization===K8.BITS12)e+=3;else e+=6;this.hasWebMercatorT&&(e+=1),this.hasVertexNormals&&(this._offsetVertexNormal=e,e+=1),this.hasGeodeticSurfaceNormals&&(this._offsetGeodeticSurfaceNormal=e,e+=3),this.stride=e};const a9={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},c9={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};o9.prototype.getAttributes=function(e){const t=Ca.FLOAT,n=Ca.getSizeInBytes(t),i=this.stride*n;let o=0;const r=[];function s(s,a){r.push({index:s,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:a,offsetInBytes:o,strideInBytes:i}),o+=a*n}if(this.quantization===K8.NONE){s(a9.position3DAndHeight,4);let e=2;e+=this.hasWebMercatorT?1:0,e+=this.hasVertexNormals?1:0,s(a9.textureCoordAndEncodedNormals,e),this.hasGeodeticSurfaceNormals&&s(a9.geodeticSurfaceNormal,3)}else{const e=this.hasWebMercatorT||this.hasVertexNormals,t=this.hasWebMercatorT&&this.hasVertexNormals;s(c9.compressed0,e?4:3),t&&s(c9.compressed1,1),this.hasGeodeticSurfaceNormals&&s(c9.geodeticSurfaceNormal,3)}return r},o9.prototype.getAttributeLocations=function(){return this.quantization===K8.NONE?a9:c9},o9.clone=function(e,t){if(D(e))return D(t)||(t=new o9),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=H.clone(e.center),t.toScaledENU=ve.clone(e.toScaledENU),t.fromScaledENU=ve.clone(e.fromScaledENU),t.matrix=ve.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t};const l9={};l9.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const u9=new H,d9=new ve,h9=new H,p9=new H;l9.computeVertices=function(e){if(!D(e)||!D(e.heightmap))throw new P("options.heightmap is required.");if(!D(e.width)||!D(e.height))throw new P("options.width and options.height are required.");if(!D(e.nativeRectangle))throw new P("options.nativeRectangle is required.");if(!D(e.skirtHeight))throw new P("options.skirtHeight is required.");const t=Math.cos,n=Math.sin,i=Math.sqrt,o=Math.atan,r=Math.exp,s=V.PI_OVER_TWO,a=V.toRadians,c=e.heightmap,l=e.width,u=e.height,d=e.skirtHeight,h=d>0,p=M(e.isGeographic,!0),f=M(e.ellipsoid,on.WGS84),m=1/f.maximumRadius,_=Ir.clone(e.nativeRectangle),g=Ir.clone(e.rectangle);let y,b,v,A;D(g)?(y=g.west,b=g.south,v=g.east,A=g.north):p?(y=a(_.west),b=a(_.south),v=a(_.east),A=a(_.north)):(y=_.west*m,b=s-2*o(r(-_.south*m)),v=_.east*m,A=s-2*o(r(-_.north*m)));let T=e.relativeToCenter;const w=D(T);T=w?T:H.ZERO;const E=M(e.includeWebMercatorT,!1),x=M(e.exaggeration,1),S=M(e.exaggerationRelativeHeight,0),C=1!==x,I=M(e.structure,l9.DEFAULT_STRUCTURE),O=M(I.heightScale,l9.DEFAULT_STRUCTURE.heightScale),N=M(I.heightOffset,l9.DEFAULT_STRUCTURE.heightOffset),R=M(I.elementsPerHeight,l9.DEFAULT_STRUCTURE.elementsPerHeight),L=M(I.stride,l9.DEFAULT_STRUCTURE.stride),F=M(I.elementMultiplier,l9.DEFAULT_STRUCTURE.elementMultiplier),B=M(I.isBigEndian,l9.DEFAULT_STRUCTURE.isBigEndian);let z=Ir.computeWidth(_),U=Ir.computeHeight(_);const k=z/(l-1),G=U/(u-1);p||(z*=m,U*=m);const j=f.radiiSquared,W=j.x,q=j.y,Y=j.z;let X=65536,Q=-65536;const $=Cr.eastNorthUpToFixedFrame(T,f),K=ve.inverseTransformation($,d9);let Z,J;E&&(Z=I_.geodeticLatitudeToMercatorAngle(b),J=1/(I_.geodeticLatitudeToMercatorAngle(A)-Z));const ee=h9;ee.x=Number.POSITIVE_INFINITY,ee.y=Number.POSITIVE_INFINITY,ee.z=Number.POSITIVE_INFINITY;const te=p9;te.x=Number.NEGATIVE_INFINITY,te.y=Number.NEGATIVE_INFINITY,te.z=Number.NEGATIVE_INFINITY;let ne=Number.POSITIVE_INFINITY;const ie=l*u,oe=ie+(d>0?2*l+2*u:0),re=new Array(oe),se=new Array(oe),ae=new Array(oe),ce=E?new Array(oe):[],le=C?new Array(oe):[];let ue=0,de=u,he=0,pe=l;h&&(--ue,++de,--he,++pe);const fe=1e-5;for(let D=ue;D<de;++D){let e=D;e<0&&(e=0),e>=u&&(e=u-1);let h=_.north-G*e;h=p?a(h):s-2*o(r(-h*m));let g=(h-b)/(A-b);g=V.clamp(g,0,1);const T=D===ue,w=D===de-1;d>0&&(T?h+=fe*U:w&&(h-=fe*U));const x=t(h),S=n(h),I=Y*S;let P;E&&(P=(I_.geodeticLatitudeToMercatorAngle(h)-Z)*J);for(let o=he;o<pe;++o){let r=o;r<0&&(r=0),r>=l&&(r=l-1);const s=e*(l*L)+r*L;let h;if(1===R)h=c[s];else{let e;if(h=0,B)for(e=0;e<R;++e)h=h*F+c[s+e];else for(e=R-1;e>=0;--e)h=h*F+c[s+e]}h=h*O+N,Q=Math.max(Q,h),X=Math.min(X,h);let b=_.west+k*r;p?b=a(b):b*=m;let A=(b-y)/(v-y);A=V.clamp(A,0,1);let D=e*l+r;if(d>0){const t=o===he,n=o===pe-1,i=T||w||t||n;if((T||w)&&(t||n))continue;i&&(h-=d,t?(D=ie+(u-e-1),b-=fe*z):w?D=ie+u+(l-r-1):n?(D=ie+u+l+e,b+=fe*z):T&&(D=ie+u+l+u+r))}const M=x*t(b),U=x*n(b),G=W*M,j=q*U,Y=1/i(G*M+j*U+I*S),$=G*Y,Z=j*Y,J=I*Y,oe=new H;oe.x=$+M*h,oe.y=Z+U*h,oe.z=J+S*h,ve.multiplyByPoint(K,oe,u9),H.minimumByComponent(u9,ee,ee),H.maximumByComponent(u9,te,te),ne=Math.min(ne,h),re[D]=oe,ae[D]=new kt(A,g),se[D]=h,E&&(ce[D]=P),C&&(le[D]=f.geodeticSurfaceNormal(oe))}}const me=$u.fromPoints(re);let _e,ge;if(D(g)&&(_e=zp.fromRectangle(g,X,Q,f)),w){ge=new sK(f).computeHorizonCullingPointPossiblyUnderEllipsoid(T,re,X)}const ye=new o9(T,new Gh(ee,te,T),ne,Q,$,!1,E,C,x,S),be=new Float32Array(oe*ye.stride);let Ae=0;for(let D=0;D<oe;++D)Ae=ye.encode(be,Ae,re[D],ae[D],se[D],void 0,ce[D],le[D]);return{vertices:be,maximumHeight:Q,minimumHeight:X,encoding:ye,boundingSphere3D:me,orientedBoundingBox:_e,occludeePointInScaledSpace:ge}};const f9=l9;function m9(){P.throwInstantiationError()}function _9(e,t,n,i,o,r,s,a,c,l,u,d,h,p,f,m){this.center=e,this.vertices=t,this.stride=M(l,6),this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=o,this.minimumHeight=r,this.maximumHeight=s,this.boundingSphere3D=a,this.occludeePointInScaledSpace=c,this.orientedBoundingBox=u,this.encoding=d,this.westIndicesSouthToNorth=h,this.southIndicesEastToWest=p,this.eastIndicesNorthToSouth=f,this.northIndicesWestToEast=m}function g9(){P.throwInstantiationError()}Object.defineProperties(m9.prototype,{credits:{get:P.throwInstantiationError},waterMask:{get:P.throwInstantiationError}}),m9.prototype.interpolateHeight=P.throwInstantiationError,m9.prototype.isChildAvailable=P.throwInstantiationError,m9.prototype.createMesh=P.throwInstantiationError,m9.prototype.upsample=P.throwInstantiationError,m9.prototype.wasCreatedByUpsampling=P.throwInstantiationError,m9.maximumAsynchronousTasks=5,Object.defineProperties(g9.prototype,{errorEvent:{get:P.throwInstantiationError},credit:{get:P.throwInstantiationError},tilingScheme:{get:P.throwInstantiationError},hasWaterMask:{get:P.throwInstantiationError},hasVertexNormals:{get:P.throwInstantiationError},availability:{get:P.throwInstantiationError}});const y9=[];g9.getRegularGridIndices=function(e,t){if(e*t>=V.FOUR_GIGABYTES)throw new P("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=y9[e];D(n)||(y9[e]=n=[]);let i=n[t];return D(i)||(i=e*t<V.SIXTY_FOUR_KILOBYTES?n[t]=new Uint16Array((e-1)*(t-1)*6):n[t]=new Uint32Array((e-1)*(t-1)*6),T9(e,t,i,0)),i};const b9=[];g9.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=V.FOUR_GIGABYTES)throw new P("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=b9[e];D(n)||(b9[e]=n=[]);let i=n[t];if(!D(i)){const o=g9.getRegularGridIndices(e,t),r=A9(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,c=r.eastIndicesNorthToSouth,l=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:c,northIndicesWestToEast:l}}return i};const v9=[];function A9(e,t){const n=new Array(t),i=new Array(e),o=new Array(t),r=new Array(e);let s;for(s=0;s<e;++s)r[s]=s,i[s]=e*t-1-s;for(s=0;s<t;++s)o[s]=(s+1)*e-1,n[s]=(t-s-1)*e;return{westIndicesSouthToNorth:n,southIndicesEastToWest:i,eastIndicesNorthToSouth:o,northIndicesWestToEast:r}}function T9(e,t,n,i){let o=0;for(let r=0;r<t-1;++r){for(let t=0;t<e-1;++t){const t=o,r=t+e,s=r+1,a=t+1;n[i++]=t,n[i++]=r,n[i++]=a,n[i++]=a,n[i++]=r,n[i++]=s,++o}++o}}function w9(e,t,n,i){let o=e[0];const r=e.length;for(let s=1;s<r;++s){const r=e[s];n[i++]=o,n[i++]=r,n[i++]=t,n[i++]=t,n[i++]=r,n[i++]=t+1,o=r,++t}return i}function E9(e){if(!D(e)||!D(e.buffer))throw new P("options.buffer is required.");if(!D(e.width))throw new P("options.width is required.");if(!D(e.height))throw new P("options.height is required.");this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=M(e.childTileMask,15),this._encoding=M(e.encoding,$8.NONE);const t=f9.DEFAULT_STRUCTURE;let n=e.structure;D(n)?n!==t&&(n.heightScale=M(n.heightScale,t.heightScale),n.heightOffset=M(n.heightOffset,t.heightOffset),n.elementsPerHeight=M(n.elementsPerHeight,t.elementsPerHeight),n.stride=M(n.stride,t.stride),n.elementMultiplier=M(n.elementMultiplier,t.elementMultiplier),n.isBigEndian=M(n.isBigEndian,t.isBigEndian)):n=t,this._structure=n,this._createdByUpsampling=M(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===$8.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}g9.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=V.FOUR_GIGABYTES)throw new P("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=v9[e];D(n)||(v9[e]=n=[]);let i=n[t];if(!D(i)){const o=e*t,r=(e-1)*(t-1)*6,s=2*e+2*t,a=o+s,c=r+6*Math.max(0,s-4),l=A9(e,t),u=l.westIndicesSouthToNorth,d=l.southIndicesEastToWest,h=l.eastIndicesNorthToSouth,p=l.northIndicesWestToEast,f=je.createTypedArray(a,c);T9(e,t,f,0),g9.addSkirtIndices(u,d,h,p,o,f,r),i=n[t]={indices:f,westIndicesSouthToNorth:u,southIndicesEastToWest:d,eastIndicesNorthToSouth:h,northIndicesWestToEast:p,indexCountWithoutSkirts:r}}return i},g9.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=w9(e,a,r,s),a+=e.length,s=w9(t,a,r,s),a+=t.length,s=w9(n,a,r,s),a+=n.length,w9(i,a,r,s)},g9.heightmapTerrainQuality=.25,g9.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return 2*e.maximumRadius*Math.PI*g9.heightmapTerrainQuality/(t*n)},g9.prototype.requestTileGeometry=P.throwInstantiationError,g9.prototype.getLevelMaximumGeometricError=P.throwInstantiationError,g9.prototype.getTileDataAvailable=P.throwInstantiationError,g9.prototype.loadTileDataAvailability=P.throwInstantiationError,Object.defineProperties(E9.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});const x9="createVerticesFromHeightmap",S9=new Qa(x9),C9=new Qa(x9,m9.maximumAsynchronousTasks);function I9(e,t,n,i,o,r,s,a,c){const l=(a-o.west)*(r-1)/(o.east-o.west),u=(c-o.south)*(s-1)/(o.north-o.south);let d=0|l,h=d+1;h>=r&&(h=r-1,d=r-2);let p=0|u,f=p+1;f>=s&&(f=s-1,p=s-2);const m=u-p;p=s-1-p,f=s-1-f;return O9(l-d,m,(t.decodeHeight(e,p*r+d)-n)/i,(t.decodeHeight(e,p*r+h)-n)/i,(t.decodeHeight(e,f*r+d)-n)/i,(t.decodeHeight(e,f*r+h)-n)/i)}function O9(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function D9(e,t,n,i,o,r){r*=i;let s,a=0;if(o)for(s=0;s<t;++s)a=a*n+e[r+s];else for(s=t-1;s>=0;--s)a=a*n+e[r+s];return a}function P9(e,t,n,i,o,r,s,a){let c;if(s*=o,r)for(c=0;c<t-1;++c)e[s+c]=a/i|0,a-=e[s+c]*i,i/=n;else for(c=t-1;c>0;--c)e[s+c]=a/i|0,a-=e[s+c]*i,i/=n;e[s+c]=a}function N9(e){e=M(e,M.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,D(this._tilingScheme)||(this._tilingScheme=new Dh({ellipsoid:M(e.ellipsoid,on.WGS84)})),this._levelZeroMaximumGeometricError=g9.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new gi}E9.prototype.createMesh=function(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.tilingScheme",e.tilingScheme),L.typeOf.number("options.x",e.x),L.typeOf.number("options.y",e.y),L.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=M(e.exaggeration,1),s=M(e.exaggerationRelativeHeight,0),a=M(e.throttle,!0),c=t.ellipsoid,l=t.tileXYToNativeRectangle(n,i,o),u=t.tileXYToRectangle(n,i,o),d=c.cartographicToCartesian(Ir.center(u)),h=this._structure,p=g9.getEstimatedLevelZeroGeometricErrorForAHeightmap(c,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(4*p,1e3);const f=(a?C9:S9).scheduleTask({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:l,rectangle:u,relativeToCenter:d,ellipsoid:c,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof fn,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!D(f))return;const m=this;return Promise.resolve(f).then((function(e){let t;t=m._skirtHeight>0?g9.getRegularGridAndSkirtIndicesAndEdgeIndices(e.gridWidth,e.gridHeight):g9.getRegularGridIndicesAndEdgeIndices(e.gridWidth,e.gridHeight);const n=e.gridWidth*e.gridHeight;return m._mesh=new _9(d,new Float32Array(e.vertices),t.indices,t.indexCountWithoutSkirts,n,e.minimumHeight,e.maximumHeight,$u.clone(e.boundingSphere3D),H.clone(e.occludeePointInScaledSpace),e.numberOfAttributes,zp.clone(e.orientedBoundingBox),o9.clone(e.encoding),t.westIndicesSouthToNorth,t.southIndicesEastToWest,t.eastIndicesNorthToSouth,t.northIndicesWestToEast),m._buffer=void 0,m._mesh}))},E9.prototype._createMeshSync=function(e){L.typeOf.object("options.tilingScheme",e.tilingScheme),L.typeOf.number("options.x",e.x),L.typeOf.number("options.y",e.y),L.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=M(e.exaggeration,1),s=M(e.exaggerationRelativeHeight,0),a=t.ellipsoid,c=t.tileXYToNativeRectangle(n,i,o),l=t.tileXYToRectangle(n,i,o),u=a.cartographicToCartesian(Ir.center(l)),d=this._structure,h=g9.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(4*h,1e3);const p=f9.computeVertices({heightmap:this._buffer,structure:d,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:l,relativeToCenter:u,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof fn,exaggeration:r,exaggerationRelativeHeight:s});let f;this._buffer=void 0,f=this._skirtHeight>0?g9.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):g9.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const m=p.gridWidth*p.gridHeight;return this._mesh=new _9(u,p.vertices,f.indices,f.indexCountWithoutSkirts,m,p.minimumHeight,p.maximumHeight,p.boundingSphere3D,p.occludeePointInScaledSpace,p.encoding.stride,p.orientedBoundingBox,p.encoding,f.westIndicesSouthToNorth,f.southIndicesEastToWest,f.eastIndicesNorthToSouth,f.northIndicesWestToEast),this._mesh},E9.prototype.interpolateHeight=function(e,t,n){const i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,c=r.elementMultiplier,l=r.isBigEndian,u=r.heightOffset,d=r.heightScale,h=D(this._mesh),p=this._encoding===$8.LERC;if(!h&&p)return;let f;if(h){f=I9(this._mesh.vertices,this._mesh.encoding,u,d,e,i,o,t,n)}else f=function(e,t,n,i,o,r,s,a,c,l){const u=(c-r.west)*(s-1)/(r.east-r.west),d=(l-r.south)*(a-1)/(r.north-r.south);let h=0|u,p=h+1;p>=s&&(p=s-1,h=s-2);let f=0|d,m=f+1;m>=a&&(m=a-1,f=a-2);const _=u-h,g=d-f;f=a-1-f,m=a-1-m;const y=D9(e,t,n,i,o,f*s+h),b=D9(e,t,n,i,o,f*s+p),v=D9(e,t,n,i,o,m*s+h),A=D9(e,t,n,i,o,m*s+p);return O9(_,g,y,b,v,A)}(this._buffer,a,c,s,l,e,i,o,t,n),f=f*d+u;return f},E9.prototype.upsample=function(e,t,n,i,o,r,s){if(!D(e))throw new P("tilingScheme is required.");if(!D(t))throw new P("thisX is required.");if(!D(n))throw new P("thisY is required.");if(!D(i))throw new P("thisLevel is required.");if(!D(o))throw new P("descendantX is required.");if(!D(r))throw new P("descendantY is required.");if(!D(s))throw new P("descendantLevel is required.");if(s-i>1)throw new P("Upsampling through more than one level at a time is not currently supported.");const a=this._mesh;if(!D(a))return;const c=this._width,l=this._height,u=this._structure,d=u.stride,h=new this._bufferType(c*l*d),p=a.vertices,f=a.encoding,m=e.tileXYToRectangle(t,n,i),_=e.tileXYToRectangle(o,r,s),g=u.heightOffset,y=u.heightScale,b=u.elementsPerHeight,v=u.elementMultiplier,A=u.isBigEndian,T=Math.pow(v,b-1);for(let w=0;w<l;++w){const e=V.lerp(_.north,_.south,w/(l-1));for(let t=0;t<c;++t){let n=I9(p,f,g,y,m,c,l,V.lerp(_.west,_.east,t/(c-1)),e);n=n<u.lowestEncodedHeight?u.lowestEncodedHeight:n,n=n>u.highestEncodedHeight?u.highestEncodedHeight:n,P9(h,b,v,T,d,A,w*c+t,n)}}return Promise.resolve(new E9({buffer:h,width:c,height:l,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))},E9.prototype.isChildAvailable=function(e,t,n,i){if(!D(e))throw new P("thisX is required.");if(!D(t))throw new P("thisY is required.");if(!D(n))throw new P("childX is required.");if(!D(i))throw new P("childY is required.");let o=2;return n!==2*e&&++o,i!==2*t&&(o-=2),!!(this._childTileMask&1<<o)},E9.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling},Object.defineProperties(N9.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}}),N9.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new E9({buffer:new Uint8Array(256),width:16,height:16}))},N9.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},N9.prototype.getTileDataAvailable=function(e,t,n){},N9.prototype.loadTileDataAvailability=function(e,t,n){};const R9=new kt;function L9(e,t){L.typeOf.object("clippingPlaneCollection",e),L.typeOf.object("context",t);const n=e.unionClippingRegions,i=e.length,o=qI.useFloatTexture(t),r=qI.getTextureResolution(e,t,R9),s=r.x,a=r.y;let c=o?function(e,t){const n=1/e,i=1/t;let o=`${n}`;-1===o.indexOf(".")&&(o+=".0");let r=`${i}`;-1===r.indexOf(".")&&(r+=".0");const s=`vec4 getClippingPlane(highp 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) * ${o};\n float v = (float(pixY) + 0.5) * ${r};\n vec4 plane = texture(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n`;return s}(s,a):function(e,t){const n=1/e,i=1/t;let o=`${n}`;-1===o.indexOf(".")&&(o+=".0");let r=`${i}`;-1===r.indexOf(".")&&(r+=".0");const s=`vec4 getClippingPlane(highp 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) * ${o};\n float v = (float(pixY) + 0.5) * ${r};\n vec4 oct32 = texture(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(texture(packedClippingPlanes, vec2(u + ${o}, v)));\n return czm_transformPlane(plane, transform);\n}\n`;return s}(s,a);return c+="\n",c+=n?function(e){const t=`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`;return t}(i):function(e){const t=`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`;return t}(i),c}function M9(e,t,n,i,o,r){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o,this.clippingPolygonShaderState=r}function F9(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}F9.prototype.getShaderProgram=function(e){const t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,o=e.applyBrightness,r=e.applyContrast,s=e.applyHue,a=e.applySaturation,c=e.applyGamma,l=e.applyAlpha,u=e.applyDayNightAlpha,d=e.applySplit,h=e.showReflectiveOcean,p=e.showOceanWaves,f=e.enableLighting,m=e.dynamicAtmosphereLighting,_=e.dynamicAtmosphereLightingFromSun,g=e.showGroundAtmosphere,y=e.perFragmentGroundAtmosphere,b=e.hasVertexNormals,v=e.useWebMercatorProjection,A=e.enableFog,T=e.enableClippingPlanes,w=e.clippingPlanes,E=e.enableClippingPolygons,x=e.clippingPolygons,S=e.clippedByBoundaries,C=e.hasImageryLayerCutout,I=e.colorCorrect,O=e.highlightFillTile,P=e.colorToAlpha,N=e.hasGeodeticSurfaceNormals,R=e.hasExaggeration,L=e.showUndergroundColor,M=e.translucent;let F=0,B="";const z=n.renderedMesh.encoding;z.quantization===K8.BITS12&&(F=1,B="QUANTIZATION_BITS12");let U=0,k="";S&&(U=1,k="TILE_LIMIT_RECTANGLE");let V=0,H="";C&&(V=1,H="APPLY_IMAGERY_CUTOUT");const G=t.mode,j=G|o<<2|r<<3|s<<4|a<<5|c<<6|l<<7|h<<8|p<<9|f<<10|m<<11|_<<12|g<<13|y<<14|b<<15|v<<16|A<<17|F<<18|d<<19|T<<20|E<<21|U<<22|V<<23|I<<24|O<<25|P<<26|N<<27|R<<28|L<<29|M<<30|u<<31;let W=0;D(w)&&w.length>0&&(W=T?w.clippingPlanesState:0);let q=0;D(x)&&x.length>0&&(q=E?x.clippingPolygonsState:0);let Y=n.surfaceShader;if(D(Y)&&Y.numberOfDayTextures===i&&Y.flags===j&&Y.material===this.material&&Y.clippingShaderState===W&&Y.clippingPolygonShaderState===q)return Y.shaderProgram;let X=this._shadersByTexturesFlags[i];if(D(X)||(X=this._shadersByTexturesFlags[i]=[]),Y=X[j],!D(Y)||Y.material!==this.material||Y.clippingShaderState!==W||Y.clippingPolygonShaderState!==q){const e=this.baseVertexShaderSource.clone(),n=this.baseFragmentShaderSource.clone();0!==W&&n.sources.unshift(L9(w,t.context)),0!==q&&(n.sources.unshift(t.context.webgl2?"void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {\n czm_clipPolygons(clippingDistance, regionsLength, clippingPosition, regionIndex);\n }":"void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {\n }"),e.sources.unshift(function(e){return e.webgl2?"vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {\n return czm_unpackClippingExtents(extentsTexture, index);\n }":"vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {\n return vec4();\n }"}(t.context))),e.defines.push(B),n.defines.push(`TEXTURE_UNITS ${i}`,k,H),o&&n.defines.push("APPLY_BRIGHTNESS"),r&&n.defines.push("APPLY_CONTRAST"),s&&n.defines.push("APPLY_HUE"),a&&n.defines.push("APPLY_SATURATION"),c&&n.defines.push("APPLY_GAMMA"),l&&n.defines.push("APPLY_ALPHA"),u&&n.defines.push("APPLY_DAY_NIGHT_ALPHA"),h&&(n.defines.push("SHOW_REFLECTIVE_OCEAN"),e.defines.push("SHOW_REFLECTIVE_OCEAN")),p&&n.defines.push("SHOW_OCEAN_WAVES"),P&&n.defines.push("APPLY_COLOR_TO_ALPHA"),L&&(e.defines.push("UNDERGROUND_COLOR"),n.defines.push("UNDERGROUND_COLOR")),M&&(e.defines.push("TRANSLUCENT"),n.defines.push("TRANSLUCENT")),f&&(b?(e.defines.push("ENABLE_VERTEX_LIGHTING"),n.defines.push("ENABLE_VERTEX_LIGHTING")):(e.defines.push("ENABLE_DAYNIGHT_SHADING"),n.defines.push("ENABLE_DAYNIGHT_SHADING"))),m&&(e.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),n.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),_&&(e.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),n.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),g&&(e.defines.push("GROUND_ATMOSPHERE"),n.defines.push("GROUND_ATMOSPHERE"),y&&(e.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),n.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),e.defines.push("INCLUDE_WEB_MERCATOR_Y"),n.defines.push("INCLUDE_WEB_MERCATOR_Y"),A&&(e.defines.push("FOG"),n.defines.push("FOG")),d&&n.defines.push("APPLY_SPLIT"),T&&n.defines.push("ENABLE_CLIPPING_PLANES"),E&&(n.defines.push("ENABLE_CLIPPING_POLYGONS"),e.defines.push("ENABLE_CLIPPING_POLYGONS"),x.inverse&&n.defines.push("CLIPPING_INVERSE"),n.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${x.extentsCount}`),e.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${x.extentsCount}`)),I&&n.defines.push("COLOR_CORRECT"),O&&n.defines.push("HIGHLIGHT_FILL_TILE"),N&&e.defines.push("GEODETIC_SURFACE_NORMALS"),R&&e.defines.push("EXAGGERATION");let S=" vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)\n {\n vec4 color = initialColor;\n";C&&(S+=" vec4 cutoutAndColorResult;\n bool texelUnclipped;\n");for(let t=0;t<i;++t)S+=C?` cutoutAndColorResult = u_dayTextureCutoutRectangles[${t}];\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",S+=` color,\n u_dayTextures[${t}],\n u_dayTextureUseWebMercatorT[${t}] ? textureCoordinates.xz : textureCoordinates.xy,\n u_dayTextureTexCoordsRectangle[${t}],\n u_dayTextureTranslationAndScale[${t}],\n ${l?`u_dayTextureAlpha[${t}]`:"1.0"},\n ${u?`u_dayTextureNightAlpha[${t}]`:"1.0"},\n${u?`u_dayTextureDayAlpha[${t}]`:"1.0"},\n${o?`u_dayTextureBrightness[${t}]`:"0.0"},\n ${r?`u_dayTextureContrast[${t}]`:"0.0"},\n ${s?`u_dayTextureHue[${t}]`:"0.0"},\n ${a?`u_dayTextureSaturation[${t}]`:"0.0"},\n ${c?`u_dayTextureOneOverGamma[${t}]`:"0.0"},\n ${d?`u_dayTextureSplit[${t}]`:"0.0"},\n ${P?`u_colorsToAlpha[${t}]`:"vec4(0.0)"},\n nightBlend );\n`,C&&(S+=" color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);\n");S+=" return color;\n }",n.sources.push(S),e.sources.push(function(e){let t;switch(e){case gl.SCENE3D:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }";break;case gl.SCENE2D:case gl.COLUMBUS_VIEW:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }";break;case gl.MORPHING:t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }"}return t}(G)),e.sources.push(function(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}(v));const D=ya.fromCache({context:t.context,vertexShaderSource:e,fragmentShaderSource:n,attributeLocations:z.getAttributeLocations()});Y=X[j]=new M9(i,j,this.material,D,W,q)}return n.surfaceShader=Y,Y.shaderProgram},F9.prototype.destroy=function(){let e,t;const n=this._shadersByTexturesFlags;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];if(!D(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],D(t)&&t.shaderProgram.destroy())}return He(this)};const B9=Object.freeze({NONE:-1,PARTIAL:0,FULL:1});function z9(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=M(r,0),this.retry=!1,this.error=s}z9.reportError=function(e,t,n,i,o,r,s,a){let c=e;return D(e)?(c.provider=t,c.message=i,c.x=o,c.y=r,c.level=s,c.retry=!1,c.error=a,++c.timesRetried):c=new z9(t,i,o,r,s,0,a),D(n)&&n.numberOfListeners>0?n.raiseEvent(c):D(t),c},z9.reportSuccess=function(e){D(e)&&(e.timesRetried=-1)};const U9=Object.freeze({UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7}),k9=Object.freeze({START:0,LOADING:1,DONE:2,FAILED:3}),V9=Object.freeze({FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6});function H9(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new K(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new H,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=V9.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new $u,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(H9.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let t=!(e===V9.RECEIVING||e===V9.TRANSFORMING);const n=this.imagery;for(let i=0,o=n.length;t&&i<o;++i){const e=n[i];t=!D(e.loadingImagery)||e.loadingImagery.state!==U9.TRANSITIONING}return t}},renderedMesh:{get:function(){return D(this.vertexArray)?this.mesh:D(this.fill)?this.fill.mesh:void 0}}});const G9=new Qt;function j9(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(D(t)&&t!==gl.SCENE3D){const e=n.ellipsoid.cartesianToCartographic(s,G9);s=n.project(e,r),s=H.fromElements(s.z,s.x,s.y,r)}return s}const W9=new H,q9=new H,Y9=new H;function X9(e,t,n,i){const o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride;let c=o9.clone(s);c.hasGeodeticSurfaceNormals=t,c=o9.clone(c);const l=c.stride,u=new Float32Array(a*l);t?s.addGeodeticSurfaceNormals(r,u,n):s.removeGeodeticSurfaceNormals(r,u),o.vertices=u,o.stride=l;o!==e.mesh?(H9._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=H9._createVertexArrayForMesh(i.context,o)):(H9._freeVertexArray(e.vertexArray),e.vertexArray=H9._createVertexArrayForMesh(i.context,o)),H9._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}H9.prototype.pick=function(e,t,n,i,o){const r=this.renderedMesh;if(!D(r))return;const s=r.vertices,a=r.indices,c=r.encoding,l=a.length;let u=Number.MAX_VALUE;for(let d=0;d<l;d+=3){const o=a[d],r=a[d+1],l=a[d+2],h=j9(c,t,n,s,o,W9),p=j9(c,t,n,s,r,q9),f=j9(c,t,n,s,l,Y9),m=Pp.rayTriangleParametric(e,h,p,f,i);D(m)&&m<u&&m>=0&&(u=m)}return u!==Number.MAX_VALUE?tp.getPoint(e,u,o):void 0},H9.prototype.freeResources=function(){D(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=V9.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();const e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()},H9.prototype.freeVertexArray=function(){H9._freeVertexArray(this.vertexArray),this.vertexArray=void 0,H9._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0},H9.initialize=function(e,t,n){let i=e.data;D(i)||(i=e.data=new H9),e.state===k9.START&&(!function(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!D(i)&&D(e.parent)){const t=e.parent,n=t.data;D(n)&&D(n.terrainData)&&(i=n.terrainData.isChildAvailable(t.x,t.y,e.x,e.y))}!1===i&&(e.data.terrainState=V9.FAILED);for(let o=0,r=n.length;o<r;++o){const i=n.get(o);i.show&&i._createTileImagerySkeletons(e,t)}}(e,t,n),e.state=k9.LOADING)},H9.processStateMachine=function(e,t,n,i,o,r,s){H9.initialize(e,n,i);const a=e.data;if(e.state===k9.LOADING&&function(e,t,n,i,o,r){const s=e.data,a=e.parent;if(s.terrainState===V9.FAILED&&void 0!==a){void 0!==a.data&&void 0!==a.data.terrainData&&!1!==a.data.terrainData.canUpsample||H9.processStateMachine(a,t,n,i,o,r,!0)}s.terrainState===V9.FAILED&&function(e,t,n,i,o,r,s){const a=t.parent;if(!a)return void(t.state=k9.FAILED);const c=a.data.terrainData,l=a.x,u=a.y,d=a.level;if(!D(c))return;const h=c.upsample(i.tilingScheme,l,u,d,o,r,s);if(!D(h))return;e.terrainState=V9.RECEIVING,Promise.resolve(h).then((function(t){D(t)&&(e.terrainData=t,e.terrainState=V9.RECEIVED)})).catch((function(){e.terrainState=V9.FAILED}))}(s,e,0,n,e.x,e.y,e.level);s.terrainState===V9.UNLOADED&&function(e,t,n,i,o){function r(t){if(!D(t))return e.terrainState=V9.UNLOADED,void(e.request=void 0);e.terrainData=t,e.terrainState=V9.RECEIVED,e.request=void 0}function s(r){if(e.request.state===pi.CANCELLED)return e.terrainData=void 0,e.terrainState=V9.UNLOADED,void(e.request=void 0);e.terrainState=V9.FAILED,e.request=void 0;const s=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${r}"`;t._requestError=z9.reportError(t._requestError,t,t.errorEvent,s,n,i,o),t._requestError.retry&&a()}function a(){const a=new mi({throttle:!1,throttleByServer:!0,type:fi.TERRAIN});e.request=a;const c=t.requestTileGeometry(n,i,o,a);D(c)?(e.terrainState=V9.RECEIVING,Promise.resolve(c).then((function(e){r(e)})).catch((function(e){s(e)}))):(e.terrainState=V9.UNLOADED,e.request=void 0)}a()}(s,n,e.x,e.y,e.level);s.terrainState===V9.RECEIVED&&function(e,t,n,i,o,r){const s=n.tilingScheme,a=Q9;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.verticalExaggeration,a.exaggerationRelativeHeight=t.verticalExaggerationRelativeHeight,a.throttle=!0;const c=e.terrainData,l=c.createMesh(a);if(!D(l))return;e.terrainState=V9.TRANSFORMING,Promise.resolve(l).then((function(t){e.mesh=t,e.terrainState=V9.TRANSFORMED})).catch((function(){e.terrainState=V9.FAILED}))}(s,t,n,e.x,e.y,e.level);s.terrainState===V9.TRANSFORMED&&(!function(e,t,n,i,o,r,s){e.vertexArray=H9._createVertexArrayForMesh(t,e.mesh),e.terrainState=V9.READY,e.fill=e.fill&&e.fill.destroy(s)}(s,t.context,0,e.x,e.y,e.level,r),s.updateExaggeration(e,t,o));if(s.terrainState>=V9.RECEIVED&&void 0===s.waterMaskTexture&&n.hasWaterMask){if(void 0!==s.terrainData.waterMask)!function(e,t){const n=t.terrainData.waterMask,i=function(e){let t=e.cache.tile_waterMaskData;if(!D(t)){const n=Sc.create({context:e,pixelFormat:is.LUMINANCE,pixelDatatype:ts.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;t={allWaterTexture:n,sampler:new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:ac.LINEAR,magnificationFilter:rc.LINEAR}),destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}(e);let o;const r=n.length;if(1===r){if(0===n[0])return;o=i.allWaterTexture}else{const t=Math.sqrt(r);o=Sc.create({context:e,pixelFormat:is.LUMINANCE,pixelDatatype:ts.UNSIGNED_BYTE,source:{width:t,height:t,arrayBufferView:n},sampler:i.sampler,flipY:!1}),o.referenceCount=0}++o.referenceCount,t.waterMaskTexture=o,K.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}(t.context,s);else{const t=s._findAncestorTileWithTerrainData(e);D(t)&&D(t.data.waterMaskTexture)&&(s.waterMaskTexture=t.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,t,s.waterMaskTranslationAndScale))}}}(e,t,n,i,o,r),s)return;const c=e.renderable;e.renderable=D(a.vertexArray);const l=a.terrainState===V9.READY;e.upsampledFromParent=D(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();const u=a.processImagery(e,n,t);if(l&&u){const t=e._loadedCallbacks,n={};for(const i in t)t.hasOwnProperty(i)&&(t[i](e)||(n[i]=t[i]));e._loadedCallbacks=n,e.state=k9.DONE}c&&(e.renderable=!0)},H9.prototype.processImagery=function(e,t,n,i){const o=e.data;let r=e.upsampledFromParent,s=!1,a=!0;const c=o.imagery;let l,u;for(l=0,u=c.length;l<u;++l){const o=c[l];if(!D(o.loadingImagery)){r=!1;continue}if(o.loadingImagery.state===U9.PLACEHOLDER){const n=o.loadingImagery.imageryLayer;if(n.ready){o.freeResources(),c.splice(l,1),n._createTileImagerySkeletons(e,t,l),--l,u=c.length;continue}r=!1}const d=o.processStateMachine(e,n,i);a=a&&d,s=s||d||D(o.readyImagery),r=r&&D(o.loadingImagery)&&(o.loadingImagery.state===U9.FAILED||o.loadingImagery.state===U9.INVALID)}return e.upsampledFromParent=r,e.renderable=e.renderable&&(s||a),a},H9.prototype.addGeodeticSurfaceNormals=function(e,t){X9(this,!0,e,t)},H9.prototype.removeGeodeticSurfaceNormals=function(e){X9(this,!1,void 0,e)},H9.prototype.updateExaggeration=function(e,t,n){const i=this,o=i.renderedMesh;if(void 0===o)return;const r=t.verticalExaggeration,s=t.verticalExaggerationRelativeHeight,a=1!==r,c=o.encoding,l=c.exaggeration!==r,u=c.exaggerationRelativeHeight!==s;if(l||u){if(l)if(a&&!c.hasGeodeticSurfaceNormals){const n=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(n,t)}else!a&&c.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(c.exaggeration=r,c.exaggerationRelativeHeight=s,void 0!==n){n._tileToUpdateHeights.push(e);const t=e.customData,i=t.length;for(let e=0;e<i;e++){t[e].level=-1}}}};const Q9={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function $9(e){if(e=M(e,M.EMPTY_OBJECT),this._ellipsoid=M(e.ellipsoid,on.WGS84),this._numberOfLevelZeroTilesX=M(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=M(e.numberOfLevelZeroTilesY,1),this._projection=new I_(this._ellipsoid),D(e.rectangleSouthwestInMeters)&&D(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{const e=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new kt(-e,-e),this._rectangleNortheastInMeters=new kt(e,e)}const t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new Ir(t.longitude,t.latitude,n.longitude,n.latitude)}let K9;H9._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=Ye.createVertexBuffer({context:e,typedArray:n,usage:qe.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{};let s=r[e.id];if(!D(s)||s.isDestroyed()){const n=t.indices;s=Ye.createIndexBuffer({context:e,typedArray:n,usage:qe.STATIC_DRAW,indexDatatype:je.fromSizeInBytes(n.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new kl({context:e,attributes:o,indexBuffer:s})},H9._freeVertexArray=function(e){if(D(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),D(t)&&!t.isDestroyed()&&D(t.referenceCount)&&(--t.referenceCount,0===t.referenceCount&&t.destroy())}},H9.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;D(t)&&(!D(t.data)||!D(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t},H9.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){const i=t.rectangle,o=e.rectangle,r=o.width,s=o.height,a=r/i.width,c=s/i.height;return n.x=a*(o.west-i.west)/r,n.y=c*(o.south-i.south)/s,n.z=a,n.w=c,n},Object.defineProperties($9.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),$9.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},$9.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},$9.prototype.rectangleToNativeRectangle=function(e,t){const n=this._projection,i=n.project(Ir.southwest(e)),o=n.project(Ir.northeast(e));return D(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new Ir(i.x,i.y,o.x,o.y)},$9.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.getNumberOfXTilesAtLevel(n),r=this.getNumberOfYTilesAtLevel(n),s=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,a=this._rectangleSouthwestInMeters.x+e*s,c=this._rectangleSouthwestInMeters.x+(e+1)*s,l=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,u=this._rectangleNortheastInMeters.y-t*l,d=this._rectangleNortheastInMeters.y-(t+1)*l;return D(i)?(i.west=a,i.south=d,i.east=c,i.north=u,i):new Ir(a,d,c,u)},$9.prototype.tileXYToRectangle=function(e,t,n,i){const o=this.tileXYToNativeRectangle(e,t,n,i),r=this._projection,s=r.unproject(new kt(o.west,o.south)),a=r.unproject(new kt(o.east,o.north));return o.west=s.longitude,o.south=s.latitude,o.east=a.longitude,o.north=a.latitude,o},$9.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!Ir.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,a=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,c=this._projection.project(e);let l=(c.x-this._rectangleSouthwestInMeters.x)/s|0;l>=o&&(l=o-1);let u=(this._rectangleNortheastInMeters.y-c.y)/a|0;return u>=r&&(u=r-1),D(n)?(n.x=l,n.y=u,n):new kt(l,u)};const Z9="AAPK809db8a668914f14bf886dcf16d4dc82Hm5SsO4xOJY2n4-V_ypQyxlGKJRQugNnPIslyTLkk5-HHQl9BRpgdNXaKNGe7oxx",J9={};J9.defaultAccessToken=Z9,J9.defaultWorldImageryServer=new Bi({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"}),J9.defaultWorldHillshadeServer=new Bi({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"}),J9.defaultWorldOceanServer=new Bi({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"}),J9.getDefaultTokenCredit=function(e){if(e===Z9){if(!D(K9)){K9=new YT('<b> This application is using a default ArcGIS access token. Please assign <i>Cesium.ArcGisMapService.defaultAccessToken</i> with an API key from your ArcGIS Developer account before using the ArcGIS tile services. You can sign up for a free ArcGIS Developer account at <a href="https://developers.arcgis.com/">https://developers.arcgis.com/</a>.</b>',!0)}return K9}};const e6=J9;function t6(e){if(!D((e=M(e,M.EMPTY_OBJECT)).missingImageUrl))throw new P("options.missingImageUrl is required.");if(!D(e.pixelsToCheck))throw new P("options.pixelsToCheck is required.");this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=Bi.createIfNeeded(e.missingImageUrl),n=this;t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then((function(t){D(t.blob)&&(n._missingImageByteLength=t.blob.size);let i=si(t);if(e.disableCheckIfAllPixelsAreTransparent){let n=!0;const o=t.width,r=e.pixelsToCheck;for(let e=0,t=r.length;n&&e<t;++e){const t=r[e];i[4*t.x+t.y*o+3]>0&&(n=!1)}n&&(i=void 0)}n._missingImagePixels=i,n._isReady=!0})).catch((function(){n._missingImagePixels=void 0,n._isReady=!0}))}function n6(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}function i6(){P.throwInstantiationError()}t6.prototype.isReady=function(){return this._isReady},t6.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new P("shouldDiscardImage must not be called before the discard policy is ready.");const t=this._pixelsToCheck,n=this._missingImagePixels;if(!D(n))return!1;if(D(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const i=si(e),o=e.width;for(let r=0,s=t.length;r<s;++r){const e=t[r],s=4*e.x+e.y*o;for(let t=0;t<4;++t){const e=s+t;if(i[e]!==n[e])return!1}}return!0},n6.prototype.configureNameFromProperties=function(e){let t,n=10;for(const i in e)if(e.hasOwnProperty(i)&&e[i]){const e=i.toLowerCase();n>1&&"name"===e?(n=1,t=i):n>2&&"title"===e?(n=2,t=i):n>3&&/name/i.test(i)?(n=3,t=i):n>4&&/title/i.test(i)&&(n=4,t=i)}D(t)&&(this.name=e[t])},n6.prototype.configureDescriptionFromProperties=function(e){this.description=function e(t){let n='<table class="cesium-infoBox-defaultTable">';for(const i in t)if(t.hasOwnProperty(i)){const o=t[i];D(o)&&(n+="object"==typeof o?`<tr><td>${i}</td><td>${e(o)}</td></tr>`:`<tr><td>${i}</td><td>${o}</td></tr>`)}return n+="</table>",n}(e)},Object.defineProperties(i6.prototype,{rectangle:{get:P.throwInstantiationError},tileWidth:{get:P.throwInstantiationError},tileHeight:{get:P.throwInstantiationError},maximumLevel:{get:P.throwInstantiationError},minimumLevel:{get:P.throwInstantiationError},tilingScheme:{get:P.throwInstantiationError},tileDiscardPolicy:{get:P.throwInstantiationError},errorEvent:{get:P.throwInstantiationError},credit:{get:P.throwInstantiationError},proxy:{get:P.throwInstantiationError},hasAlphaChannel:{get:P.throwInstantiationError}}),i6.prototype.getTileCredits=function(e,t,n){P.throwInstantiationError()},i6.prototype.requestImage=function(e,t,n,i){P.throwInstantiationError()},i6.prototype.pickFeatures=function(e,t,n,i,o){P.throwInstantiationError()};const o6=/\.ktx2$/i;i6.loadImage=function(e,t){L.defined("url",t);const n=Bi.createIfNeeded(t);return o6.test(n.url)?ec(n):D(e)&&D(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};const r6=Object.freeze({SATELLITE:1,OCEANS:2,HILLSHADE:3});function s6(e){this.useTiles=M(e.usePreCachedTilesIfAvailable,!0);const t=e.ellipsoid;this.tilingScheme=M(e.tilingScheme,new Dh({ellipsoid:t})),this.rectangle=M(e.rectangle,this.tilingScheme.rectangle),this.ellipsoid=t;let n=e.credit;"string"==typeof n&&(n=new YT(n)),this.credit=n,this.tileCredits=void 0,this.tileDiscardPolicy=e.tileDiscardPolicy,this.tileWidth=M(e.tileWidth,256),this.tileHeight=M(e.tileHeight,256),this.maximumLevel=e.maximumLevel}async function a6(e,t){const n=e.getDerivedResource({queryParameters:{f:"json"}});try{!function(e,t){const n=e.tileInfo;if(D(n)){if(t.tileWidth=n.rows,t.tileHeight=n.cols,102100===n.spatialReference.wkid||102113===n.spatialReference.wkid)t.tilingScheme=new $9({ellipsoid:t.ellipsoid});else{if(4326!==e.tileInfo.spatialReference.wkid)throw new be(`Tile spatial reference WKID ${e.tileInfo.spatialReference.wkid} is not supported.`);t.tilingScheme=new Dh({ellipsoid:t.ellipsoid})}if(t.maximumLevel=e.tileInfo.lods.length-1,D(e.fullExtent)){if(D(e.fullExtent.spatialReference)&&D(e.fullExtent.spatialReference.wkid))if(102100===e.fullExtent.spatialReference.wkid||102113===e.fullExtent.spatialReference.wkid){const n=new I_,i=e.fullExtent,o=n.unproject(new H(Math.max(i.xmin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(i.ymin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),r=n.unproject(new H(Math.min(i.xmax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(i.ymax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0));t.rectangle=new Ir(o.longitude,o.latitude,r.longitude,r.latitude)}else{if(4326!==e.fullExtent.spatialReference.wkid)throw new be(`fullExtent.spatialReference WKID ${e.fullExtent.spatialReference.wkid} is not supported.`);t.rectangle=Ir.fromDegrees(e.fullExtent.xmin,e.fullExtent.ymin,e.fullExtent.xmax,e.fullExtent.ymax)}}else t.rectangle=t.tilingScheme.rectangle;t.useTiles=!0}else t.useTiles=!1;D(e.copyrightText)&&e.copyrightText.length>0&&(D(t.credit)?t.tileCredits=[new YT(e.copyrightText)]:t.credit=new YT(e.copyrightText))}(await n.fetchJson(),t)}catch(i){!function(e,t){let n=`An error occurred while accessing ${e.url}`;throw D(t)&&D(t.message)&&(n+=`: ${t.message}`),new be(n)}(e,i)}}function c6(e){e=M(e,M.EMPTY_OBJECT),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=M(e.tileWidth,256),this._tileHeight=M(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=M(e.tilingScheme,new Dh({ellipsoid:e.ellipsoid})),this._useTiles=M(e.usePreCachedTilesIfAvailable,!0),this._rectangle=M(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers,this._credit=e.credit,this._tileCredits=void 0;let t=e.credit;"string"==typeof t&&(t=new YT(t)),this.enablePickFeatures=M(e.enablePickFeatures,!0),this._errorEvent=new gi}function l6(e,t,n,i,o){let r;if(e._useTiles)r=e._resource.getDerivedResource({url:`tile/${i}/${n}/${t}`,request:o});else{const s=e._tilingScheme.tileXYToNativeRectangle(t,n,i),a={bbox:`${s.west},${s.south},${s.east},${s.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof fn?(a.bboxSR=4326,a.imageSR=4326):(a.bboxSR=3857,a.imageSR=3857),e.layers&&(a.layers=`show:${e.layers}`),r=e._resource.getDerivedResource({url:"export",request:o,queryParameters:a})}return r}s6.prototype.build=function(e){e._useTiles=this.useTiles,e._tilingScheme=this.tilingScheme,e._rectangle=this.rectangle,e._credit=this.credit,e._tileCredits=this.tileCredits,e._tileDiscardPolicy=this.tileDiscardPolicy,e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,this.useTiles&&!D(this.tileDiscardPolicy)&&(e._tileDiscardPolicy=new t6({missingImageUrl:l6(e,0,0,this.maximumLevel).url,pixelsToCheck:[new kt(0,0),new kt(200,20),new kt(20,200),new kt(80,110),new kt(160,130)],disableCheckIfAllPixelsAreTransparent:!0}))},c6.fromBasemapType=async function(e,t){let n,i,o;switch(L.defined("style",e),t=M(t,M.EMPTY_OBJECT),e){case r6.SATELLITE:{n=M(t.token,e6.defaultAccessToken),i=Bi.createIfNeeded(e6.defaultWorldImageryServer),i.appendForwardSlash();const e=e6.getDefaultTokenCredit(n);D(e)&&(o=YT.clone(e))}break;case r6.OCEANS:{n=M(t.token,e6.defaultAccessToken),i=Bi.createIfNeeded(e6.defaultWorldOceanServer),i.appendForwardSlash();const e=e6.getDefaultTokenCredit(n);D(e)&&(o=YT.clone(e))}break;case r6.HILLSHADE:{n=M(t.token,e6.defaultAccessToken),i=Bi.createIfNeeded(e6.defaultWorldHillshadeServer),i.appendForwardSlash();const e=e6.getDefaultTokenCredit(n);D(e)&&(o=YT.clone(e))}break;default:throw new P(`Unsupported basemap type: ${e}`)}return c6.fromUrl(i,{...t,token:n,credit:o,usePreCachedTilesIfAvailable:!0})},Object.defineProperties(c6.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}}),c6.fromUrl=async function(e,t){L.defined("url",e),t=M(t,M.EMPTY_OBJECT);const n=Bi.createIfNeeded(e);n.appendForwardSlash(),D(t.token)&&n.setQueryParameters({token:t.token});const i=new c6(t);i._resource=n;const o=new s6(t);return M(t.usePreCachedTilesIfAvailable,!0)&&await a6(n,o),o.build(i),i},c6.prototype.getTileCredits=function(e,t,n){return this._tileCredits},c6.prototype.requestImage=function(e,t,n,i){return i6.loadImage(this,l6(this,e,t,n,i))},c6.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures)return;const r=this._tilingScheme.tileXYToNativeRectangle(e,t,n);let s,a,c;if(this._tilingScheme.projection instanceof fn)s=V.toDegrees(i),a=V.toDegrees(o),c="4326";else{const e=this._tilingScheme.projection.project(new Qt(i,o,0));s=e.x,a=e.y,c="3857"}let l="visible";D(this._layers)&&(l+=`:${this._layers}`);const u={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${s},${a}`,mapExtent:`${r.west},${r.south},${r.east},${r.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:c,layers:l};return this._resource.getDerivedResource({url:"identify",queryParameters:u}).fetchJson().then((function(e){const t=[],n=e.results;if(!D(n))return t;for(let i=0;i<n.length;++i){const e=n[i],o=new n6;if(o.data=e,o.name=e.value,o.properties=e.attributes,o.configureDescriptionFromProperties(e.attributes),"esriGeometryPoint"===e.geometryType&&e.geometry){const t=e.geometry.spatialReference&&e.geometry.spatialReference.wkid?e.geometry.spatialReference.wkid:4326;if(4326===t||4283===t)o.position=Qt.fromDegrees(e.geometry.x,e.geometry.y,e.geometry.z);else if(102100===t||900913===t||3857===t){const t=new I_;o.position=t.unproject(new H(e.geometry.x,e.geometry.y,e.geometry.z))}}t.push(o)}return t}))},c6._metadataCache={};const u6=Object.freeze({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"});function d6(e){}let h6;function p6(e){this.tileWidth=void 0,this.tileHeight=void 0,this.maximumLevel=void 0,this.imageUrlSubdomains=void 0,this.imageUrlTemplate=void 0,this.attributionList=void 0}async function f6(e,t,n){const i=e.url;let o=m6._metadataCache[i];D(o)||(o=e.fetchJsonp("jsonp"),m6._metadataCache[i]=o);try{return function(e,t){if(1!==e.resourceSets.length)throw new be("metadata does not specify one resource in resourceSets");const n=e.resourceSets[0].resources[0];t.tileWidth=n.imageWidth,t.tileHeight=n.imageHeight,t.maximumLevel=n.zoomMax-1,t.imageUrlSubdomains=n.imageUrlSubdomains,t.imageUrlTemplate=n.imageUrl,t.attributionList=n.imageryProviders}(await o,t)}catch(r){!function(e,t,n){let i=`An error occurred while accessing ${e.url}`;throw D(t)&&D(t.message)&&(i+=`: ${t.message}`),z9.reportError(void 0,n,D(n)?n._errorEvent:void 0,i,void 0,void 0,void 0,t),new be(i)}(e,r,n)}}function m6(e){e=M(e,M.EMPTY_OBJECT),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=1,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._mapStyle=M(e.mapStyle,u6.AERIAL),this._mapLayer=e.mapLayer,this._culture=M(e.culture,""),this._key=e.key,this._tileDiscardPolicy=e.tileDiscardPolicy,D(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new d6),this._proxy=e.proxy,this._credit=new YT(`<a href="https://www.microsoft.com/en-us/maps/product/enduserterms"><img src="${m6.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new $9({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._attributionList=void 0,this._errorEvent=new gi}d6.prototype.isReady=function(){return!0},d6.prototype.shouldDiscardImage=function(e){return d6.EMPTY_IMAGE===e},Object.defineProperties(d6,{EMPTY_IMAGE:{get:function(){return D(h6)||(h6=new Image,h6.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),h6}}}),p6.prototype.build=function(e){e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,e._imageUrlSubdomains=this.imageUrlSubdomains,e._imageUrlTemplate=this.imageUrlTemplate;let t=e._attributionList=this.attributionList;t||(t=[]),e._attributionList=t;for(let n=0,i=t.length;n<i;++n){const e=t[n];if(e.credit instanceof YT)break;e.credit=new YT(e.attribution);const i=e.coverageAreas;for(let t=0,n=e.coverageAreas.length;t<n;++t){const e=i[t],n=e.bbox;e.bbox=new Ir(V.toRadians(n[1]),V.toRadians(n[0]),V.toRadians(n[3]),V.toRadians(n[2]))}}},Object.defineProperties(m6.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},mapLayer:{get:function(){return this._mapLayer}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return D(this.mapLayer)}}}),m6.fromUrl=async function(e,t){t=M(t,M.EMPTY_OBJECT),L.defined("url",e),L.defined("options.key",t.key);let n=t.tileProtocol;if(D(n))n.length>0&&":"===n[n.length-1]&&(n=n.substr(0,n.length-1));else{n="http:"===document.location.protocol?"http":"https"}const i=M(t.mapStyle,u6.AERIAL),o=Bi.createIfNeeded(e);o.appendForwardSlash();const r={incl:"ImageryProviders",key:t.key,uriScheme:n};D(t.mapLayer)&&(r.mapLayer=t.mapLayer),D(t.culture)&&(r.culture=t.culture);const s=o.getDerivedResource({url:`REST/v1/Imagery/Metadata/${i}`,queryParameters:r}),a=new m6(t);a._resource=o;const c=new p6;return await f6(s,c),c.build(a),a};const _6=new Ir;m6.prototype.getTileCredits=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(e,t,n,_6),o=function(e,t,n){++t;const i=[];for(let o=0,r=e.length;o<r;++o){const r=e[o],s=r.coverageAreas;let a=!1;for(let e=0,i=r.coverageAreas.length;!a&&e<i;++e){const i=s[e];if(t>=i.zoomMin&&t<=i.zoomMax){D(Ir.intersection(n,i.bbox,g6))&&(a=!0)}}a&&i.push(r.credit)}return i}(this._attributionList,n,i);return o},m6.prototype.requestImage=function(e,t,n,i){const o=i6.loadImage(this,function(e,t,n,i,o){const r=e._imageUrlTemplate,s=e._imageUrlSubdomains,a=(t+n+i)%s.length;return e._resource.getDerivedResource({url:r,request:o,templateValues:{quadkey:m6.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}(this,e,t,n,i));if(D(o))return o.catch((function(e){return D(e.blob)&&0===e.blob.size?d6.EMPTY_IMAGE:Promise.reject(e)}))},m6.prototype.pickFeatures=function(e,t,n,i,o){},m6.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){const n=1<<o;let r=0;e&n&&(r|=1),t&n&&(r|=2),i+=r}return i},m6.quadKeyToTileXY=function(e){let t=0,n=0;const i=e.length-1;for(let o=i;o>=0;--o){const r=1<<o,s=+e[i-o];1&s&&(t|=r),2&s&&(n|=r)}return{x:t,y:n,level:i}},m6._logoUrl=void 0,Object.defineProperties(m6,{logoUrl:{get:function(){return D(m6._logoUrl)||(m6._logoUrl=lo("Assets/Images/bing_maps_credit.png")),m6._logoUrl},set:function(e){L.defined("value",e),m6._logoUrl=e}}});const g6=new Ir;m6._metadataCache={};const y6=/{[^}]+}/g,b6={x:function(e,t,n,i){return O6(e,"{x}",t)},y:function(e,t,n,i){return O6(e,"{y}",n)},z:function(e,t,n,i){return O6(e,"{z}",i)},s:function(e,t,n,i){const o=(t+n+i)%e._subdomains.length;return e._subdomains[o]},reverseX:function(e,t,n,i){const o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return O6(e,"{reverseX}",o)},reverseY:function(e,t,n,i){const o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return O6(e,"{reverseY}",o)},reverseZ:function(e,t,n,i){const o=e.maximumLevel,r=D(o)&&i<o?o-i-1:i;return O6(e,"{reverseZ}",r)},westDegrees:function(e,t,n,i){return D6(e,t,n,i),w6.west},southDegrees:function(e,t,n,i){return D6(e,t,n,i),w6.south},eastDegrees:function(e,t,n,i){return D6(e,t,n,i),w6.east},northDegrees:function(e,t,n,i){return D6(e,t,n,i),w6.north},westProjected:function(e,t,n,i){return P6(e,t,n,i),x6.west},southProjected:function(e,t,n,i){return P6(e,t,n,i),x6.south},eastProjected:function(e,t,n,i){return P6(e,t,n,i),x6.east},northProjected:function(e,t,n,i){return P6(e,t,n,i),x6.north},width:function(e,t,n,i){return e.tileWidth},height:function(e,t,n,i){return e.tileHeight}},v6=ni(b6,{i:function(e,t,n,i,o,r,s){return L6(e,t,n,i,o,r),C6.x},j:function(e,t,n,i,o,r,s){return L6(e,t,n,i,o,r),C6.y},reverseI:function(e,t,n,i,o,r,s){return L6(e,t,n,i,o,r),e.tileWidth-C6.x-1},reverseJ:function(e,t,n,i,o,r,s){return L6(e,t,n,i,o,r),e.tileHeight-C6.y-1},longitudeDegrees:function(e,t,n,i,o,r,s){return V.toDegrees(o)},latitudeDegrees:function(e,t,n,i,o,r,s){return V.toDegrees(r)},longitudeProjected:function(e,t,n,i,o,r,s){return F6(e,t,n,i,o,r),R6.x},latitudeProjected:function(e,t,n,i,o,r,s){return F6(e,t,n,i,o,r),R6.y},format:function(e,t,n,i,o,r,s){return s}});function A6(e){e=M(e,M.EMPTY_OBJECT),this._errorEvent=new gi,L.defined("options.url",e.url);const t=Bi.createIfNeeded(e.url),n=Bi.createIfNeeded(e.pickFeaturesUrl);this._resource=t,this._urlSchemeZeroPadding=e.urlSchemeZeroPadding,this._getFeatureInfoFormats=e.getFeatureInfoFormats,this._pickFeaturesResource=n;let i=e.subdomains;i=Array.isArray(i)?i.slice():D(i)&&i.length>0?i.split(""):["a","b","c"],this._subdomains=i,this._tileWidth=M(e.tileWidth,256),this._tileHeight=M(e.tileHeight,256),this._minimumLevel=M(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._tilingScheme=M(e.tilingScheme,new $9({ellipsoid:e.ellipsoid})),this._rectangle=M(e.rectangle,this._tilingScheme.rectangle),this._rectangle=Ir.intersection(this._rectangle,this._tilingScheme.rectangle),this._tileDiscardPolicy=e.tileDiscardPolicy;let o=e.credit;"string"==typeof o&&(o=new YT(o)),this._credit=o,this._hasAlphaChannel=M(e.hasAlphaChannel,!0);const r=e.customTags,s=ni(b6,r),a=ni(v6,r);this._tags=s,this._pickFeaturesTags=a,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this.enablePickFeatures=M(e.enablePickFeatures,!0)}Object.defineProperties(A6.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}}),A6.prototype.getTileCredits=function(e,t,n){},A6.prototype.requestImage=function(e,t,n,i){return i6.loadImage(this,function(e,t,n,i,o){T6=!1,E6=!1;const r=e._resource,s=r.getUrlComponent(!0),a=e._tags,c={},l=s.match(y6);D(l)&&l.forEach((function(o){const r=o.substring(1,o.length-1);D(a[r])&&(c[r]=a[r](e,t,n,i))}));return r.getDerivedResource({request:o,templateValues:c})}(this,e,t,n,i))},A6.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures||!D(this._pickFeaturesResource)||0===this._getFeatureInfoFormats.length)return;let r=0;const s=this;function a(e,t){return e.callback(t)}return function c(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);const l=s._getFeatureInfoFormats[r],u=function(e,t,n,i,o,r,s){T6=!1,E6=!1,S6=!1,I6=!1;const a=e._pickFeaturesResource,c=a.getUrlComponent(!0),l=e._pickFeaturesTags,u={},d=c.match(y6);D(d)&&d.forEach((function(a){const c=a.substring(1,a.length-1);D(l[c])&&(u[c]=l[c](e,t,n,i,o,r,s))}));return a.getDerivedResource({templateValues:u})}(s,e,t,n,i,o,l.format);return++r,"json"===l.type?u.fetchJson().then(l.callback).catch(c):"xml"===l.type?u.fetchXML().then(l.callback).catch(c):"text"===l.type||"html"===l.type?u.fetchText().then(l.callback).catch(c):u.fetch({responseType:l.format}).then(a.bind(void 0,l)).catch(c)}()};let T6=!1;const w6=new Ir;let E6=!1;const x6=new Ir;let S6=!1;const C6=new kt;let I6=!1;function O6(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const i=e.urlSchemeZeroPadding[t];if("string"==typeof i){const e=i.length;e>1&&(n=n.length>=e?n:new Array(e-n.toString().length+1).join("0")+n)}}return n}function D6(e,t,n,i){T6||(e.tilingScheme.tileXYToRectangle(t,n,i,w6),w6.west=V.toDegrees(w6.west),w6.south=V.toDegrees(w6.south),w6.east=V.toDegrees(w6.east),w6.north=V.toDegrees(w6.north),T6=!0)}function P6(e,t,n,i){E6||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,x6),E6=!0)}const N6=new Ir,R6=new H;function L6(e,t,n,i,o,r,s){if(S6)return;F6(e,t,n,i,o,r);const a=R6,c=e.tilingScheme.tileXYToNativeRectangle(t,n,i,N6);C6.x=e.tileWidth*(a.x-c.west)/c.width|0,C6.y=e.tileHeight*(c.north-a.y)/c.height|0,S6=!0}const M6=new Qt;function F6(e,t,n,i,o,r,s){if(!I6){if(e.tilingScheme.projection instanceof fn)R6.x=V.toDegrees(o),R6.y=V.toDegrees(r);else{const t=M6;t.longitude=o,t.latitude=r,e.tilingScheme.projection.project(t,R6)}I6=!0}}function B6(e){A6.call(this,e)}function z6(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function U6(e,t,n){const i=e.positionToTileXY(Ir.southwest(t),n),o=e.positionToTileXY(Ir.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}function k6(e){this.channel=e.channel,this.ellipsoid=e.ellipsoid,this.tilingScheme=void 0,this.version=void 0}async function V6(e,t,n){try{!function(e,t){let n,i;try{n=JSON.parse(e)}catch(o){n=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(let r=0;r<n.layers.length;r++)if(n.layers[r].id===t.channel){i=n.layers[r];break}if(!D(i))throw new be(`Could not find layer with channel (id) of ${t.channel}.`);if(!D(i.version))throw new be(`Could not find a version in channel (id) ${t.channel}.`);if(t.version=i.version,D(n.projection)&&"flat"===n.projection)t.tilingScheme=new Dh({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Ir(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:t.ellipsoid});else{if(D(n.projection)&&"mercator"!==n.projection)throw new be(`Unsupported projection ${n.projection}.`);t.tilingScheme=new $9({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:t.ellipsoid})}}(await e.fetchText(),t)}catch(i){!function(e,t,n){let i=`An error occurred while accessing ${t.url}.`;throw D(e)&&D(e.message)&&(i+=`: ${e.message}`),z9.reportError(void 0,n,D(n)?n._errorEvent:void 0,i),new be(i)}(i,e,n)}}function H6(e){e=M(e,{}),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=1.9,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new YT(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${H6.logoUrl}" title="Google Imagery"/></a>`),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new gi}B6._requestMetadata=async function(e,t,n,i){try{const o=await n.fetchXML();return B6._metadataSuccess(o,e,t,n,i)}catch(o){if(o instanceof _i)return B6._metadataFailure(e,t);throw o}},B6.fromUrl=async function(e,t){L.defined("url",e);const n=Bi.createIfNeeded(e);n.appendForwardSlash();const i=n,o=n.getDerivedResource({url:"tilemapresource.xml"});t=M(t,M.EMPTY_OBJECT);const r=await B6._requestMetadata(t,i,o);return new B6(r)},D(Object.create)&&(B6.prototype=Object.create(A6.prototype),B6.prototype.constructor=B6),B6._metadataSuccess=function(e,t,n,i,o){const r=/tileformat/i,s=/tileset/i,a=/tilesets/i,c=/boundingbox/i;let l,u,d;const h=[],p=e.childNodes[0].childNodes;for(let w=0;w<p.length;w++)if(r.test(p.item(w).nodeName))l=p.item(w);else if(a.test(p.item(w).nodeName)){d=p.item(w);const e=p.item(w).childNodes;for(let t=0;t<e.length;t++)s.test(e.item(t).nodeName)&&h.push(e.item(t))}else c.test(p.item(w).nodeName)&&(u=p.item(w));let f;if(!D(d)||!D(u))throw f=`Unable to find expected tilesets or bbox attributes in ${i.url}.`,D(o)&&z9.reportError(void 0,o,o.errorEvent,f),new be(f);const m=M(t.fileExtension,l.getAttribute("extension")),_=M(t.tileWidth,parseInt(l.getAttribute("width"),10)),g=M(t.tileHeight,parseInt(l.getAttribute("height"),10));let y=M(t.minimumLevel,parseInt(h[0].getAttribute("order"),10));const b=M(t.maximumLevel,parseInt(h[h.length-1].getAttribute("order"),10)),v=d.getAttribute("profile");let A=t.tilingScheme;if(!D(A))if("geodetic"===v||"global-geodetic"===v)A=new Dh({ellipsoid:t.ellipsoid});else{if("mercator"!==v&&"global-mercator"!==v)throw f=`${i.url} specifies an unsupported profile attribute, ${v}.`,D(o)&&z9.reportError(void 0,o,o.errorEvent,f),new be(f);A=new $9({ellipsoid:t.ellipsoid})}let T=Ir.clone(t.rectangle);if(!D(T)){let e,n,i,o;M(t.flipXY,!1)?(i=new kt(parseFloat(u.getAttribute("miny")),parseFloat(u.getAttribute("minx"))),o=new kt(parseFloat(u.getAttribute("maxy")),parseFloat(u.getAttribute("maxx")))):(i=new kt(parseFloat(u.getAttribute("minx")),parseFloat(u.getAttribute("miny"))),o=new kt(parseFloat(u.getAttribute("maxx")),parseFloat(u.getAttribute("maxy"))));const r="geodetic"===v||"mercator"===v;if(A.projection instanceof fn||r)e=Qt.fromDegrees(i.x,i.y),n=Qt.fromDegrees(o.x,o.y);else{const t=A.projection;e=t.unproject(i),n=t.unproject(o)}T=new Ir(e.longitude,e.latitude,n.longitude,n.latitude)}T=z6(T,A),y=U6(A,T,y);return{url:n.getDerivedResource({url:`{z}/{x}/{reverseY}.${m}`}),tilingScheme:A,rectangle:T,tileWidth:_,tileHeight:g,minimumLevel:y,maximumLevel:b,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit}},B6._metadataFailure=function(e,t){const n=M(e.fileExtension,"png"),i=M(e.tileWidth,256),o=M(e.tileHeight,256),r=e.maximumLevel,s=D(e.tilingScheme)?e.tilingScheme:new $9({ellipsoid:e.ellipsoid});let a=M(e.rectangle,s.rectangle);a=z6(a,s);const c=U6(s,a,e.minimumLevel);return{url:t.getDerivedResource({url:`{z}/{x}/{reverseY}.${n}`}),tilingScheme:s,rectangle:a,tileWidth:i,tileHeight:o,minimumLevel:c,maximumLevel:r,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit}},k6.prototype.build=function(e){e._channel=this.channel,e._version=this.version,e._tilingScheme=this.tilingScheme},Object.defineProperties(H6.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),H6.fromUrl=async function(e,t,n){L.defined("url",e),L.defined("channel",t),n=M(n,{});const i=M(n.path,"/default_map"),o=Bi.createIfNeeded(e).getDerivedResource({url:"/"===i[0]?i.substring(1):i});o.appendForwardSlash();const r=o.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),s=new k6(n);s.channel=t,await V6(r,s);const a=new H6(n);return s.build(a),a._resource=o,a._url=e,a._path=i,a},H6.prototype.getTileCredits=function(e,t,n){},H6.prototype.requestImage=function(e,t,n,i){const o=this._resource.getDerivedResource({url:"query",request:i,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:n+1}});return i6.loadImage(this,o)},H6.prototype.pickFeatures=function(e,t,n,i,o){},H6._logoUrl=void 0,Object.defineProperties(H6,{logoUrl:{get:function(){return D(H6._logoUrl)||(H6._logoUrl=lo("Assets/Images/google_earth_credit.png")),H6._logoUrl},set:function(e){L.defined("value",e),H6._logoUrl=e}}});const G6=/\/$/,j6=new YT('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function W6(e){const t=(e=M(e,M.EMPTY_OBJECT)).mapId;if(!D(t))throw new P("options.mapId is required.");const n=e.accessToken;if(!D(n))throw new P("options.accessToken is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;const i=Bi.createIfNeeded(M(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let o=M(e.format,"png");/\./.test(o)||(o=`.${o}`),this._format=o;let r,s=i.getUrlComponent();G6.test(s)||(s+="/"),s+=`${t}/{z}/{x}/{y}${this._format}`,i.url=s,i.setQueryParameters({access_token:n}),D(e.credit)?(r=e.credit,"string"==typeof r&&(r=new YT(r))):r=j6,this._resource=i,this._imageryProvider=new A6({url:i,credit:r,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}function q6(e){e=M(e,M.EMPTY_OBJECT),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;const t=new Dh({rectangle:M(e.rectangle,Ir.MAX_VALUE),numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=t,this._image=void 0,this._texture=void 0,this._hasError=!1,this._errorEvent=new gi;let n=e.credit;"string"==typeof n&&(n=new YT(n)),this._credit=n,L.defined("options.url",e.url);const i=Bi.createIfNeeded(e.url);this._resource=i,L.typeOf.number("options.tileWidth",e.tileWidth),L.typeOf.number("options.tileHeight",e.tileHeight),this._tileWidth=e.tileWidth,this._tileHeight=e.tileHeight}async function Y6(e,t,n){try{return await i6.loadImage(null,e)}catch(i){return function(e,t,n,i){let o=`Failed to load image ${e.url}`;D(t)&&D(t.message)&&(o+=`: ${t.message}`);const r=z9.reportError(i,n,D(n)?n._errorEvent:void 0,o,0,0,0,t);if(r.retry)return Y6(e,n,r);throw D(n)&&(n._hasError=!0),new be(o)}(e,i,t,n)}}function X6(e,t,n){if(!D(e))throw new P("type is required.");if(this.type=e,!D(t))if("json"===e)t="application/json";else if("xml"===e)t="text/xml";else if("html"===e)t="text/html";else{if("text"!==e)throw new P('format is required when type is not "json", "xml", "html", or "text".');t="text/plain"}if(this.format=t,!D(n))if("json"===e)n=Q6;else if("xml"===e)n=e7;else if("html"===e)n=s7;else{if("text"!==e)throw new P('callback is required when type is not "json", "xml", "html", or "text".');n=s7}this.callback=n}function Q6(e){const t=[],n=e.features;for(let i=0;i<n.length;++i){const e=n[i],o=new n6;if(o.data=e,o.properties=e.properties,o.configureNameFromProperties(e.properties),o.configureDescriptionFromProperties(e.properties),D(e.geometry)&&"Point"===e.geometry.type){const t=e.geometry.coordinates[0],n=e.geometry.coordinates[1];o.position=Qt.fromDegrees(t,n)}t.push(o)}return t}Object.defineProperties(W6.prototype,{url:{get:function(){return this._imageryProvider.url}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),W6.prototype.getTileCredits=function(e,t,n){},W6.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)},W6.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)},W6._defaultCredit=j6,Object.defineProperties(q6.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),q6.fromUrl=async function(e,t){L.defined("url",e);const n=Bi.createIfNeeded(e),i=await Y6(n);t=M(t,M.EMPTY_OBJECT);const o=new q6({...t,url:e,tileWidth:i.width,tileHeight:i.height});return o._image=i,o},q6.prototype.getTileCredits=function(e,t,n){},q6.prototype.requestImage=async function(e,t,n,i){if(!this._hasError&&!D(this._image)){const e=await Y6(this._resource,this);return this._image=e,z9.reportSuccess(this._errorEvent),e}return this._image},q6.prototype.pickFeatures=function(e,t,n,i,o){};const $6="http://www.mapinfo.com/mxp",K6="http://www.esri.com/wms",Z6="http://www.opengis.net/wfs",J6="http://www.opengis.net/gml";function e7(e){const t=e.documentElement;if("MultiFeatureCollection"===t.localName&&t.namespaceURI===$6)return function(e){const t=[],n=e.documentElement,i=n.getElementsByTagNameNS($6,"Feature");for(let o=0;o<i.length;++o){const e=i[o],n={},r=e.getElementsByTagNameNS($6,"Val");for(let t=0;t<r.length;++t){const e=r[t];if(e.hasAttribute("ref")){const t=e.getAttribute("ref"),i=e.textContent.trim();n[t]=i}}const s=new n6;s.data=e,s.properties=n,s.configureNameFromProperties(n),s.configureDescriptionFromProperties(n),t.push(s)}return t}(e);if("FeatureInfoResponse"===t.localName&&t.namespaceURI===K6)return function(e){const t=e.documentElement,n=[];let i;const o=t.getElementsByTagNameNS("*","FIELDS");if(o.length>0)for(let r=0;r<o.length;++r){const e=o[r];i={};const t=e.attributes;for(let n=0;n<t.length;++n){const e=t[n];i[e.name]=e.value}n.push(n7(e,i))}else{const e=t.getElementsByTagNameNS("*","FeatureInfo");for(let t=0;t<e.length;++t){const o=e[t];i={};const r=o.childNodes;for(let e=0;e<r.length;++e){const t=r[e];t.nodeType===Node.ELEMENT_NODE&&(i[t.localName]=t.textContent)}n.push(n7(o,i))}}return n}(e);if("FeatureCollection"===t.localName&&t.namespaceURI===Z6)return function(e){const t=[],n=e.documentElement,i=n.getElementsByTagNameNS(J6,"featureMember");for(let o=0;o<i.length;++o){const e=i[o],n={};t7(e,n),t.push(n7(e,n))}return t}(e);if("ServiceExceptionReport"===t.localName)throw new be((new XMLSerializer).serializeToString(t));return"msGMLOutput"===t.localName?function(e){const t=[];let n;const i=e.documentElement.childNodes;for(let r=0;r<i.length;r++)if(i[r].nodeType===Node.ELEMENT_NODE){n=i[r];break}if(!D(n))throw new be("Unable to find first child of the feature info xml document");const o=n.childNodes;for(let r=0;r<o.length;++r){const e=o[r];if(e.nodeType===Node.ELEMENT_NODE){const n={};t7(e,n),t.push(n7(e,n))}}return t}(e):function(e){const t=(new XMLSerializer).serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);const o=new n6;return o.data=e,o.description=n.innerHTML,[o]}(e)}function t7(e,t){let n=!0;for(let i=0;i<e.childNodes.length;++i){const o=e.childNodes[i];o.nodeType===Node.ELEMENT_NODE&&(n=!1),"Point"!==o.localName&&"LineString"!==o.localName&&"Polygon"!==o.localName&&"boundedBy"!==o.localName&&(o.hasChildNodes()&&t7(o,t)&&(t[o.localName]=o.textContent))}return n}function n7(e,t){const n=new n6;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}const i7=/<body>\s*<\/body>/im,o7=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,r7=/<title>([\s\S]*)<\/title>/im;function s7(e){if(i7.test(e))return;if(o7.test(e))return;let t;const n=r7.exec(e);n&&n.length>1&&(t=n[1]);const i=new n6;return i.name=t,i.description=e,i.data=e,[i]}function a7(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.clock",e.clock),L.typeOf.object("options.times",e.times),L.typeOf.func("options.requestImageFunction",e.requestImageFunction),L.typeOf.func("options.reloadFunction",e.reloadFunction),this._tileCache={},this._tilesRequestedForInterval=[];const t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}function c7(e,t,n){return`${e}-${t}-${n}`}function l7(e){const t=e._times;if(!D(t))return;const n=e._clock,i=n.currentTime,o=n.canAnimate&&n.shouldAnimate,r=n.multiplier;if(!o&&0!==r)return;let s,a=t.indexOf(i);if(a<0)return;const c=t.get(a);return r>0?(s=Hn.secondsDifference(c.stop,i),++a):(s=Hn.secondsDifference(c.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function u7(e,t,n){const i=e._times.indexOf(n.start),o=e._tileCache;let r=o[i];D(r)||(r=o[i]={});const s=t.key;if(D(r[s]))return!0;const a=function(e){const t=e.split("-");if(3===t.length)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}(s),c=new mi({throttle:!1,throttleByServer:!0,type:fi.IMAGERY,priorityFunction:t.priorityFunction}),l=e._requestImageFunction(a.x,a.y,a.level,c,n);return!!D(l)&&(r[s]={promise:l,request:c},!0)}Object.defineProperties(a7.prototype,{clock:{get:function(){return this._clock},set:function(e){if(!D(e))throw new P("value is required.");this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){if(!D(e))throw new P("value is required.");this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}}),a7.prototype.getFromCache=function(e,t,n,i){const o=c7(e,t,n);let r;const s=this._tileCache[this._currentIntervalIndex];if(D(s)&&D(s[o])){const e=s[o];r=e.promise.catch((function(t){throw i.state=e.request.state,t})),delete s[o]}return r},a7.prototype.checkApproachingInterval=function(e,t,n,i){const o=c7(e,t,n),r=this._tilesRequestedForInterval,s=l7(this),a={key:o,priorityFunction:i.priorityFunction};D(s)&&u7(this,a,s)||r.push(a),r.length>=512&&r.splice(0,256)},a7.prototype._clockOnTick=function(e){const t=e.currentTime,n=this._times.indexOf(t),i=this._currentIntervalIndex;if(n!==i){const e=this._tileCache[i];for(const t in e)e.hasOwnProperty(t)&&e[t].request.cancel();return delete this._tileCache[i],this._tilesRequestedForInterval=[],this._currentIntervalIndex=n,void this._reloadFunction()}const o=l7(this);if(D(o)){const e=this._tilesRequestedForInterval;let t=!0;for(;t&&0!==e.length;){const n=e.pop();t=u7(this,n,o),t||e.push(n)}}};const d7=[3034,3035,3042,3043,3044],h7=[4471,4559];function p7(e){if(!D((e=M(e,M.EMPTY_OBJECT)).url))throw new P("options.url is required.");if(!D(e.layers))throw new P("options.layers is required.");if(D(e.times)&&!D(e.clock))throw new P("options.times was specified, so options.clock is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._getFeatureInfoUrl=M(e.getFeatureInfoUrl,e.url);const t=Bi.createIfNeeded(e.url),n=Bi.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(p7.DefaultParameters,!0),n.setQueryParameters(p7.GetFeatureInfoDefaultParameters,!0),D(e.parameters)&&t.setQueryParameters(m7(e.parameters)),D(e.getFeatureInfoParameters)&&n.setQueryParameters(m7(e.getFeatureInfoParameters));const i=this;this._reload=void 0,D(e.times)&&(this._timeDynamicImagery=new a7({clock:e.clock,times:e.times,requestImageFunction:function(e,t,n,o,r){return f7(i,e,t,n,o,r)},reloadFunction:function(){D(i._reload)&&i._reload()}}));const o={};if(o.layers=e.layers,o.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",o.width="{width}",o.height="{height}",parseFloat(t.queryParameters.version)>=1.3){o.crs=M(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof I_?"EPSG:3857":"CRS:84");const t=o.crs.split(":");if("EPSG"===t[0]&&2===t.length){const e=Number(t[1]);(e>=4e3&&e<5e3&&!h7.includes(e)||d7.includes(e))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=M(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof I_?"EPSG:3857":"EPSG:4326");t.setQueryParameters(o,!0),n.setQueryParameters(o,!0);const r={query_layers:e.layers,info_format:"{format}"};parseFloat(n.queryParameters.version)>=1.3?(r.i="{i}",r.j="{j}"):(r.x="{i}",r.y="{j}"),n.setQueryParameters(r,!0),this._resource=t,this._pickFeaturesResource=n,this._layers=e.layers,this._tileProvider=new A6({url:t,pickFeaturesUrl:n,tilingScheme:M(e.tilingScheme,new Dh({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:M(e.getFeatureInfoFormats,p7.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function f7(e,t,n,i,o,r){const s=D(r)?r.data:void 0,a=e._tileProvider;return D(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function m7(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}Object.defineProperties(p7.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},getFeatureInfoUrl:{get:function(){return this._getFeatureInfoUrl}}}),p7.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)},p7.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return D(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),D(o)||(o=f7(this,e,t,n,i,s)),D(o)&&D(r)&&r.checkApproachingInterval(e,t,n,i),o},p7.prototype.pickFeatures=function(e,t,n,i,o){const r=this._timeDynamicImagery;return function(e,t,n,i,o,r,s){const a=D(s)?s.data:void 0,c=e._tileProvider;return D(a)&&c._pickFeaturesResource.setQueryParameters(a),c.pickFeatures(t,n,i,o,r)}(this,e,t,n,i,o,D(r)?r.currentInterval:void 0)},p7.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"}),p7.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"}),p7.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new X6("json","application/json")),Object.freeze(new X6("xml","text/xml")),Object.freeze(new X6("text","text/html"))]);const _7=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function g7(e){if(!D((e=M(e,M.EMPTY_OBJECT)).url))throw new P("options.url is required.");if(!D(e.layer))throw new P("options.layer is required.");if(!D(e.style))throw new P("options.style is required.");if(!D(e.tileMatrixSetID))throw new P("options.tileMatrixSetID is required.");if(D(e.times)&&!D(e.clock))throw new P("options.times was specified, so options.clock is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;const t=Bi.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!D(r)||1===r.length&&/{s}/.test(o))t.setQueryParameters(_7),this._useKvp=!0;else{const e={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(e),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=M(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=D(e.tilingScheme)?e.tilingScheme:new $9({ellipsoid:e.ellipsoid}),this._tileWidth=M(e.tileWidth,256),this._tileHeight=M(e.tileHeight,256),this._minimumLevel=M(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=M(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const s=this;this._reload=void 0,D(e.times)&&(this._timeDynamicImagery=new a7({clock:e.clock,times:e.times,requestImageFunction:function(e,t,n,i,o){return y7(s,e,t,n,i,o)},reloadFunction:function(){D(s._reload)&&s._reload()}}));const a=this._tilingScheme.positionToTileXY(Ir.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(Ir.northeast(this._rectangle),this._minimumLevel),l=(Math.abs(c.x-a.x)+1)*(Math.abs(c.y-a.y)+1);if(l>4)throw new P(`The imagery provider's rectangle and minimumLevel indicate that there are ${l} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);this._errorEvent=new gi;const u=e.credit;this._credit="string"==typeof u?new YT(u):u,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():D(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function y7(e,t,n,i,o,r){const s=e._tileMatrixLabels,a=D(s)?s[i]:i.toString(),c=e._subdomains,l=e._dimensions,u=D(r)?r.data:void 0;let d,h;if(e._useKvp){let r={};r.tilematrix=a,r.layer=e._layer,r.style=e._style,r.tilerow=n,r.tilecol=t,r.tilematrixset=e._tileMatrixSetID,r.format=e._format,D(l)&&(r=ni(r,l)),D(u)&&(r=ni(r,u)),h={s:c[(t+n+i)%c.length]},d=e._resource.getDerivedResource({queryParameters:r,request:o}),d.setTemplateValues(h)}else h={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:c[(t+n+i)%c.length]},d=e._resource.getDerivedResource({request:o}),d.setTemplateValues(h),D(l)&&d.setTemplateValues(l),D(u)&&d.setTemplateValues(u);return i6.loadImage(e,d)}Object.defineProperties(g7.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,D(this._reload)&&this._reload())}}}),g7.prototype.getTileCredits=function(e,t,n){},g7.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return D(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),D(o)||(o=y7(this,e,t,n,i,s)),D(o)&&D(r)&&r.checkApproachingInterval(e,t,n,i),o},g7.prototype.pickFeatures=function(e,t,n,i,o){};const b7={ARCGIS_MAPSERVER:c6.fromUrl,BING:async(e,t)=>m6.fromUrl(e,t),GOOGLE_EARTH:async(e,t)=>{const n=t.channel;return delete t.channel,H6.fromUrl(e,n,t)},MAPBOX:(e,t)=>new W6({url:e,...t}),SINGLE_TILE:q6.fromUrl,TMS:B6.fromUrl,URL_TEMPLATE:(e,t)=>new A6({url:e,...t}),WMS:(e,t)=>new p7({url:e,...t}),WMTS:(e,t)=>new g7({url:e,...t})};function v7(e){this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileCredits=void 0,this._errorEvent=new gi}Object.defineProperties(v7.prototype,{rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}},proxy:{get:function(){}}}),v7.fromAssetId=async function(e,t){L.typeOf.number("assetId",e),t=M(t,M.EMPTY_OBJECT);const n=pw._createEndpointResource(e,t),i=e.toString()+t.accessToken+t.server;let o=v7._endpointCache[i];D(o)||(o=n.fetchJson(),v7._endpointCache[i]=o);const r=await o;if("IMAGERY"!==r.type)throw new be(`Cesium ion asset ${e} is not an imagery asset.`);let s;const a=r.externalType;if(D(a)){const e=b7[a];if(!D(e))throw new be(`Unrecognized Cesium ion imagery type: ${a}`);const t={...r.options},n=t.url;delete t.url,s=await e(n,t)}else s=await B6.fromUrl(new pw(r,n));const c=new v7;return s.errorEvent.addEventListener((function(e){e.provider=c,c._errorEvent.raiseEvent(e)})),c._tileCredits=pw.getCreditsFromEndpoint(r,n),c._imageryProvider=s,c},v7.prototype.getTileCredits=function(e,t,n){const i=this._imageryProvider.getTileCredits(e,t,n);return D(i)?this._tileCredits.concat(i):this._tileCredits},v7.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)},v7.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)},v7._endpointCache={};const A7=Object.freeze({AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4});function T7(e){e=M(e,M.EMPTY_OBJECT);const t=M(e.style,A7.AERIAL);return v7.fromAssetId(t)}function w7(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,0!==i){const o=t/2|0,r=n/2|0,s=i-1;this.parent=e.getImageryFromCache(o,r,s)}if(this.state=U9.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!D(o)&&e.ready){o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)}this.rectangle=o}function E7(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}function x7(e,t){this._imageryProvider=e,this._readyEvent=new gi,this._errorEvent=new gi,t=M(t,M.EMPTY_OBJECT),e=M(e,M.EMPTY_OBJECT),this.alpha=M(t.alpha,M(e._defaultAlpha,1)),this.nightAlpha=M(t.nightAlpha,M(e._defaultNightAlpha,1)),this.dayAlpha=M(t.dayAlpha,M(e._defaultDayAlpha,1)),this.brightness=M(t.brightness,M(e._defaultBrightness,x7.DEFAULT_BRIGHTNESS)),this.contrast=M(t.contrast,M(e._defaultContrast,x7.DEFAULT_CONTRAST)),this.hue=M(t.hue,M(e._defaultHue,x7.DEFAULT_HUE)),this.saturation=M(t.saturation,M(e._defaultSaturation,x7.DEFAULT_SATURATION)),this.gamma=M(t.gamma,M(e._defaultGamma,x7.DEFAULT_GAMMA)),this.splitDirection=M(t.splitDirection,x7.DEFAULT_SPLIT),this.minificationFilter=M(t.minificationFilter,M(e._defaultMinificationFilter,x7.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=M(t.magnificationFilter,M(e._defaultMagnificationFilter,x7.DEFAULT_MAGNIFICATION_FILTER)),this.show=M(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=M(t.rectangle,Ir.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new E7(w7.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=M(t.colorToAlphaThreshold,x7.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}w7.createPlaceholder=function(e){const t=new w7(e,0,0,0);return t.addReference(),t.state=U9.PLACEHOLDER,t},w7.prototype.addReference=function(){++this.referenceCount},w7.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),D(this.parent)&&this.parent.releaseReference(),D(this.image)&&D(this.image.destroy)&&this.image.destroy(),D(this.texture)&&this.texture.destroy(),D(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),He(this),0):this.referenceCount},w7.prototype.processStateMachine=function(e,t,n){this.state!==U9.UNLOADED||n||(this.state=U9.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===U9.RECEIVED&&(this.state=U9.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const i=this.state===U9.READY&&t&&!this.texture;(this.state===U9.TEXTURE_LOADED||i)&&(this.state=U9.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))},E7.prototype.freeResources=function(){D(this.readyImagery)&&this.readyImagery.releaseReference(),D(this.loadingImagery)&&this.loadingImagery.releaseReference()},E7.prototype.processStateMachine=function(e,t,n){const i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===U9.READY)return D(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this),!0;let r,s=i.parent;for(;D(s)&&(s.state!==U9.READY||!this.useWebMercatorT&&!D(s.texture));)s.state!==U9.FAILED&&s.state!==U9.INVALID&&(r=r||s),s=s.parent;return this.readyImagery!==s&&(D(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=s,D(s)&&(s.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),(i.state===U9.FAILED||i.state===U9.INVALID)&&(!D(r)||(r.processStateMachine(t,!this.useWebMercatorT,n),!1))},Object.defineProperties(x7.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},ready:{get:function(){return D(this._imageryProvider)}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},rectangle:{get:function(){return this._rectangle}}}),x7.DEFAULT_BRIGHTNESS=1,x7.DEFAULT_CONTRAST=1,x7.DEFAULT_HUE=0,x7.DEFAULT_SATURATION=1,x7.DEFAULT_GAMMA=1,x7.DEFAULT_SPLIT=$R.NONE,x7.DEFAULT_MINIFICATION_FILTER=ac.LINEAR,x7.DEFAULT_MAGNIFICATION_FILTER=rc.LINEAR,x7.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004,x7.fromProviderAsync=function(e,t){L.typeOf.object("imageryProviderPromise",e);const n=new x7(void 0,t);return async function(e,t){let n;try{if(n=await Promise.resolve(t),e.isDestroyed())return;e._imageryProvider=n,e._readyEvent.raiseEvent(n)}catch(i){!function(e,t){e.numberOfListeners>0&&e.raiseEvent(t)}(e._errorEvent,i)}}(n,Promise.resolve(e)),n},x7.fromWorldImagery=function(e){return e=M(e,M.EMPTY_OBJECT),x7.fromProviderAsync(T7({style:e.style}),e)},x7.prototype.isBaseLayer=function(){return this._isBaseLayer},x7.prototype.isDestroyed=function(){return!1},x7.prototype.destroy=function(){return He(this)};const S7=new Ir,C7=new Ir,I7=new Ir,O7=new Ir;function D7(e,t,n){return`${e}:${t}:${n}`}function P7(e,t,n){return JSON.stringify([e,t,n])}x7.prototype.getImageryRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return Ir.intersection(e.rectangle,t)},x7.prototype._createTileImagerySkeletons=function(e,t,n){const i=e.data;if(!D(t)||D(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(D(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;D(n)||(n=i.imagery.length);const o=this._imageryProvider;if(!this.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;const r=o.tilingScheme.projection instanceof I_&&e.rectangle.north<I_.MaximumLatitude&&e.rectangle.south>-I_.MaximumLatitude,s=Ir.intersection(o.rectangle,this._rectangle,S7);let a=Ir.intersection(e.rectangle,s,C7);if(!D(a)){if(!this.isBaseLayer())return!1;const t=s,n=e.rectangle;a=C7,n.south>=t.north?a.north=a.south=t.north:n.north<=t.south?a.north=a.south=t.south:(a.south=Math.max(n.south,t.south),a.north=Math.min(n.north,t.north)),n.west>=t.east?a.west=a.east=t.east:n.east<=t.west?a.west=a.east=t.west:(a.west=Math.max(n.west,t.west),a.east=Math.min(n.east,t.east))}let c=0;a.south>0?c=a.south:a.north<0&&(c=a.north);let l=function(e,t,n){const i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof fn?1:Math.cos(n),a=o.rectangle,c=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0)),l=c/t,u=Math.log(l)/Math.log(2);return 0|Math.round(u)}(this,1*t.getLevelMaximumGeometricError(e.level),c);l=Math.max(0,l);const u=o.maximumLevel;if(l>u&&(l=u),D(o.minimumLevel)){const e=o.minimumLevel;l<e&&(l=e)}const d=o.tilingScheme,h=d.positionToTileXY(Ir.northwest(a),l),p=d.positionToTileXY(Ir.southeast(a),l);let f=e.rectangle.width/512,m=e.rectangle.height/512;const _=d.tileXYToRectangle(h.x,h.y,l);Math.abs(_.south-e.rectangle.north)<m&&h.y<p.y&&++h.y,Math.abs(_.east-e.rectangle.west)<f&&h.x<p.x&&++h.x;const g=d.tileXYToRectangle(p.x,p.y,l);Math.abs(g.north-e.rectangle.south)<m&&p.y>h.y&&--p.y,Math.abs(g.west-e.rectangle.east)<f&&p.x>h.x&&--p.x;const y=Ir.clone(e.rectangle,O7);let b,v,A=d.tileXYToRectangle(h.x,h.y,l),T=Ir.intersection(A,s,I7);r?(d.rectangleToNativeRectangle(y,y),d.rectangleToNativeRectangle(A,A),d.rectangleToNativeRectangle(T,T),d.rectangleToNativeRectangle(s,s),b=d.tileXYToNativeRectangle.bind(d),f=y.width/512,m=y.height/512):b=d.tileXYToRectangle.bind(d);let w,E=0,x=1;!this.isBaseLayer()&&Math.abs(T.west-y.west)>=f&&(E=Math.min(1,(T.west-y.west)/y.width)),!this.isBaseLayer()&&Math.abs(T.north-y.north)>=m&&(x=Math.max(0,(T.north-y.south)/y.height));const S=x;for(let C=h.x;C<=p.x;C++)if(v=E,A=b(C,h.y,l),T=Ir.simpleIntersection(A,s,I7),D(T)){E=Math.min(1,(T.east-y.west)/y.width),C===p.x&&(this.isBaseLayer()||Math.abs(T.east-y.east)<f)&&(E=1),x=S;for(let e=h.y;e<=p.y;e++){if(w=x,A=b(C,e,l),T=Ir.simpleIntersection(A,s,I7),!D(T))continue;x=Math.max(0,(T.south-y.south)/y.height),e===p.y&&(this.isBaseLayer()||Math.abs(T.south-y.south)<m)&&(x=0);const t=new K(v,x,E,w),o=this.getImageryFromCache(C,e,l);i.imagery.splice(n,0,new E7(o,t,r)),++n}}return!0},x7.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){const e=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=e.rectangleToNativeRectangle(n,S7),i=e.rectangleToNativeRectangle(i,O7)}const o=i.width,r=i.height,s=o/n.width,a=r/n.height;return new K(s*(i.west-n.west)/o,a*(i.south-n.south)/r,s,a)},x7.prototype._requestImagery=function(e){const t=this._imageryProvider,n=this;function i(i){if(e.request.state===pi.CANCELLED)return e.state=U9.UNLOADED,void(e.request=void 0);e.state=U9.FAILED,e.request=void 0;const r=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=z9.reportError(n._requestImageError,t,t.errorEvent,r,e.x,e.y,e.level,i),n._requestImageError.retry&&o()}function o(){const o=new mi({throttle:!1,throttleByServer:!0,type:fi.IMAGERY});e.request=o,e.state=U9.TRANSITIONING;const r=t.requestImage(e.x,e.y,e.level,o);if(!D(r))return e.state=U9.UNLOADED,void(e.request=void 0);D(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),r.then((function(t){!function(t){if(!D(t))return i();e.image=t,e.state=U9.RECEIVED,e.request=void 0,z9.reportSuccess(n._requestImageError)}(t)})).catch((function(e){i(e)}))}o()},x7.prototype._createTextureWebGL=function(e,t){const n=new uc({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return D(i.internalFormat)?new Sc({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new Sc({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?is.RGBA:is.RGB,sampler:n})},x7.prototype._createTexture=function(e,t){const n=this._imageryProvider,i=t.image;if(D(n.tileDiscardPolicy)){const e=n.tileDiscardPolicy;if(D(e)){if(!e.isReady())return void(t.state=U9.RECEIVED);if(e.shouldDiscardImage(i))return void(t.state=U9.INVALID)}}if(this.minificationFilter!==ac.NEAREST&&this.minificationFilter!==ac.LINEAR)throw new P("ImageryLayer minification filter must be NEAREST or LINEAR");const o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof I_?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=U9.TEXTURE_LOADED},x7.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===ac.LINEAR&&i===rc.LINEAR&&!is.isCompressedFormat(t.pixelFormat)&&V.isPowerOfTwo(t.width)&&V.isPowerOfTwo(t.height)){n=ac.LINEAR_MIPMAP_LINEAR;const o=rs.maximumTextureFilterAnisotropy,r=Math.min(o,M(this._maximumAnisotropy,o)),s=D7(n,i,r);let a=e.cache.imageryLayerMipmapSamplers;D(a)||(a={},e.cache.imageryLayerMipmapSamplers=a);let c=a[s];D(c)||(c=a[s]=new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:r})),t.generateMipmap(ic.NICEST),t.sampler=c}else{const o=D7(n,i,0);let r=e.cache.imageryLayerNonMipmapSamplers;D(r)||(r={},e.cache.imageryLayerNonMipmapSamplers=r);let s=r[o];D(s)||(s=r[o]=new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=s}},x7.prototype._reprojectTexture=function(e,t,n){const i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if((n=M(n,!0))&&!(this._imageryProvider.tilingScheme.projection instanceof fn)&&o.width/i.width>1e-5){const e=this;t.addReference();const n=new Ut({persists:!0,owner:this,preExecute:function(e){!function(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!D(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){D(this.framebuffer)&&this.framebuffer.destroy(),D(this.vertexArray)&&this.vertexArray.destroy(),D(this.shaderProgram)&&this.shaderProgram.destroy()}};const e=new Float32Array(256);let n=0;for(let t=0;t<64;++t){const i=t/63;e[n++]=0,e[n++]=i,e[n++]=1,e[n++]=i}const i={position:0,webMercatorT:1},r=g9.getRegularGridIndices(2,64),s=Ye.createIndexBuffer({context:t,typedArray:r,usage:qe.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});o.vertexArray=new kl({context:t,attributes:[{index:i.position,vertexBuffer:Ye.createVertexBuffer({context:t,typedArray:e,usage:qe.STATIC_DRAW}),componentsPerAttribute:2},{index:i.webMercatorT,vertexBuffer:Ye.createVertexBuffer({context:t,sizeInBytes:512,usage:qe.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:s});const a=new bc({sources:[Y8]});o.shaderProgram=ya.fromCache({context:t,vertexShaderSource:a,fragmentShaderSource:q8,attributeLocations:i}),o.sampler=new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:ac.LINEAR,magnificationFilter:rc.LINEAR})}n.sampler=o.sampler;const r=n.width,s=n.height;N7.textureDimensions.x=r,N7.textureDimensions.y=s,N7.texture=n;let a=Math.sin(i.south);const c=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);const l=1/(.5*Math.log((1+a)/(1-a))-c),u=new Sc({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});V.isPowerOfTwo(r)&&V.isPowerOfTwo(s)&&u.generateMipmap(ic.NICEST);const d=i.south,h=i.north,p=R7;let f=0;for(let m=0;m<64;++m){const e=m/63,t=V.lerp(d,h,e);a=Math.sin(t);const n=(.5*Math.log((1+a)/(1-a))-c)*l;p[f++]=n,p[f++]=n}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(p),e.shaderProgram=o.shaderProgram,e.outputTexture=u,e.uniformMap=N7,e.vertexArray=o.vertexArray}(e,r,i,t.rectangle)},postExecute:function(n){t.texture=n,e._finalizeReprojectTexture(r,n),t.state=U9.READY,t.releaseReference()},canceled:function(){t.state=U9.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(n)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=U9.READY},x7.prototype.queueReprojectionCommands=function(e){const t=this._reprojectComputeCommands,n=t.length;for(let i=0;i<n;++i)e.commandList.push(t[i]);t.length=0},x7.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach((function(e){D(e.canceled)&&e.canceled()})),this._reprojectComputeCommands.length=0},x7.prototype.getImageryFromCache=function(e,t,n,i){const o=P7(e,t,n);let r=this._imageryCache[o];return D(r)||(r=new w7(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r},x7.prototype.removeImageryFromCache=function(e){const t=P7(e.x,e.y,e.level);delete this._imageryCache[t]};const N7={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new kt,texture:void 0},R7=Ct.supportsTypedArrays()?new Float32Array(128):void 0;const L7={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},M7={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>=M7.RENDERED_AND_KICKED},originalResult:function(e){return 3&e},kick:function(e){return 4|e}},F7=M7;function B7(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 K}B7.prototype.update=function(e,t,n){this.changedThisFrame&&(iee(e,t,this.tile,n),this.changedThisFrame=!1)},B7.prototype.destroy=function(e){this._destroyVertexArray(e),D(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)},B7.prototype._destroyVertexArray=function(e){D(this.vertexArray)&&(D(e)?e.push(this.vertexArray):H9._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const z7=new KO;function U7(e,t,n,i,o,r,s,a,c){if(void 0===i)return;let l=i;for(;l&&(l._lastSelectionResultFrame!==o||F7.wasKicked(l._lastSelectionResult)||F7.originalResult(l._lastSelectionResult)===F7.CULLED);){if(s)return;const e=l.parent;if(r>=L7.NORTHWEST&&void 0!==e)switch(r){case L7.NORTHWEST:l=l===e.northwestChild?e:void 0;break;case L7.NORTHEAST:l=l===e.northeastChild?e:void 0;break;case L7.SOUTHWEST:l=l===e.southwestChild?e:void 0;break;case L7.SOUTHEAST:l=l===e.southeastChild?e:void 0}else l=e}if(void 0!==l)if(l._lastSelectionResult!==F7.RENDERED){if(F7.originalResult(i._lastSelectionResult)!==F7.CULLED)switch(r){case L7.WEST:U7(e,t,n,i.northwestChild,o,r,!0,a,c),U7(e,t,n,i.southwestChild,o,r,!0,a,c);break;case L7.EAST:U7(e,t,n,i.southeastChild,o,r,!0,a,c),U7(e,t,n,i.northeastChild,o,r,!0,a,c);break;case L7.SOUTH:U7(e,t,n,i.southwestChild,o,r,!0,a,c),U7(e,t,n,i.southeastChild,o,r,!0,a,c);break;case L7.NORTH:U7(e,t,n,i.northeastChild,o,r,!0,a,c),U7(e,t,n,i.northwestChild,o,r,!0,a,c);break;case L7.NORTHWEST:U7(e,t,n,i.northwestChild,o,r,!0,a,c);break;case L7.NORTHEAST:U7(e,t,n,i.northeastChild,o,r,!0,a,c);break;case L7.SOUTHWEST:U7(e,t,n,i.southwestChild,o,r,!0,a,c);break;case L7.SOUTHEAST:U7(e,t,n,i.southeastChild,o,r,!0,a,c);break;default:throw new P("Invalid edge")}}else{if(D(l.data.vertexArray))return;!function(e,t,n,i,o,r,s,a){const c=i.data;if(void 0===c.fill)c.fill=new B7(i);else if(c.fill.visitedFrame===r)return;c.fill.enqueuedFrame!==r&&(c.fill.enqueuedFrame=r,c.fill.changedThisFrame=!1,s.enqueue(i));!function(e,t,n,i,o,r){const s=i.data.fill;let a;const c=n.data.fill;D(c)?(c.visitedFrame=t.frameNumber,c.changedThisFrame&&(iee(e,t,n,r),c.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let l,u,d,h,p,f;switch(o){case L7.WEST:l=s.westMeshes,u=s.westTiles;break;case L7.SOUTH:l=s.southMeshes,u=s.southTiles;break;case L7.EAST:l=s.eastMeshes,u=s.eastTiles;break;case L7.NORTH:l=s.northMeshes,u=s.northTiles;break;case L7.NORTHWEST:return s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,void(s.northwestTile=n);case L7.NORTHEAST:return s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,void(s.northeastTile=n);case L7.SOUTHWEST:return s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,void(s.southwestTile=n);case L7.SOUTHEAST:return s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,void(s.southeastTile=n)}if(n.level<=i.level)return s.changedThisFrame=s.changedThisFrame||l[0]!==a||1!==l.length,l[0]=a,u[0]=n,l.length=1,void(u.length=1);const m=n.rectangle;let _;const g=i.rectangle;switch(o){case L7.WEST:for(_=(g.north-g.south)*V.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!V.greaterThan(m.north,f.south,_));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!V.greaterThanOrEquals(m.south,f.north,_));++h);break;case L7.SOUTH:for(_=(g.east-g.west)*V.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!V.lessThan(m.west,f.east,_));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!V.lessThanOrEquals(m.east,f.west,_));++h);break;case L7.EAST:for(_=(g.north-g.south)*V.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!V.lessThan(m.south,f.north,_));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!V.lessThanOrEquals(m.north,f.south,_));++h);break;case L7.NORTH:for(_=(g.east-g.west)*V.EPSILON5,d=0;d<u.length&&(p=u[d],f=p.rectangle,!V.greaterThan(m.east,f.west,_));++d);for(h=d;h<u.length&&(p=u[h],f=p.rectangle,!V.greaterThanOrEquals(m.west,f.east,_));++h);}h-d==1?(s.changedThisFrame=s.changedThisFrame||l[d]!==a,l[d]=a,u[d]=n):(s.changedThisFrame=!0,l.splice(d,h-d,a),u.splice(d,h-d,n))}(e,t,n,i,o,a)}(e,t,n,l,r,o,a,c)}}B7.updateFillTiles=function(e,t,n,i){const o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=z7;a.clear();for(let l=0;l<t.length;++l){D(t[l].data.vertexArray)&&a.enqueue(t[l])}let c=a.dequeue();for(;void 0!==c;){const t=c.findTileToWest(r),o=c.findTileToSouth(r),l=c.findTileToEast(r),u=c.findTileToNorth(r);U7(e,n,c,t,s,L7.EAST,!1,a,i),U7(e,n,c,o,s,L7.NORTH,!1,a,i),U7(e,n,c,l,s,L7.WEST,!1,a,i),U7(e,n,c,u,s,L7.SOUTH,!1,a,i);const d=t.findTileToNorth(r),h=t.findTileToSouth(r),p=l.findTileToNorth(r),f=l.findTileToSouth(r);U7(e,n,c,d,s,L7.SOUTHEAST,!1,a,i),U7(e,n,c,p,s,L7.SOUTHWEST,!1,a,i),U7(e,n,c,h,s,L7.NORTHEAST,!1,a,i),U7(e,n,c,f,s,L7.NORTHWEST,!1,a,i),c=a.dequeue()}};const k7=new Qt,V7=new Qt,H7=new H,G7=new H,j7=new kt,W7=new kt,q7=new kt;function Y7(){this.height=0,this.encodedNormal=new kt}function X7(e,t,n,i,o,r,s,a,c){if(D(o))return o;let l;if(D(r)&&D(s))l=.5*(r.height+s.height);else if(D(r))l=r.height;else if(D(s))l=s.height;else if(D(a))l=a.height;else{const t=e.tile.data.tileBoundingRegion;let n=0,i=0;D(t)&&(n=t.minimumHeight,i=t.maximumHeight),l=.5*(n+i)}return dee(e,t,n,i,l,c),c}const Q7={minimumHeight:0,maximumHeight:0},$7=new H,K7=new Y7,Z7=new Y7,J7=new Y7,eee=new Y7,tee="undefined"!=typeof Uint8Array?new Uint8Array(81):void 0,nee={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function iee(e,t,n,i){H9.initialize(n,e.terrainProvider,e._imageryLayers);const o=n.data,r=o.fill,s=n.rectangle,a=t.verticalExaggeration,c=t.verticalExaggerationRelativeHeight,l=1!==a,u=n.tilingScheme.ellipsoid;let d=hee(r,u,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,J7),h=hee(r,u,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,K7),p=hee(r,u,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,Z7),f=hee(r,u,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,eee);d=X7(r,u,0,1,d,h,f,p,J7),h=X7(r,u,0,0,h,d,p,f,K7),p=X7(r,u,1,1,p,h,f,d,Z7),f=X7(r,u,1,1,f,p,d,h,eee);const m=h.height,_=p.height,g=d.height,y=f.height;let b=Math.min(m,_,g,y),v=Math.max(m,_,g,y);const A=.5*(b+v);let T,w;const E=e.getLevelMaximumGeometricError(n.level),x=u.maximumRadius-E;let S=4*Math.acos(x/u.maximumRadius);if(S*=1.5,s.width>S&&v-b<=E){const e=new E9({width:9,height:9,buffer:tee,structure:{heightOffset:v}}),t=nee;t.tilingScheme=n.tilingScheme,t.x=n.x,t.y=n.y,t.level=n.level,t.exaggeration=a,t.exaggerationRelativeHeight=c,r.mesh=e._createMeshSync(t)}else{const t=l,i=Ir.center(s,V7);i.height=A;const o=new o9(u.cartographicToCartesian(i,$7),void 0,void 0,void 0,void 0,!0,!0,t,a,c);let m,_=5;for(m=r.westMeshes,T=0,w=m.length;T<w;++T)_+=m[T].eastIndicesNorthToSouth.length;for(m=r.southMeshes,T=0,w=m.length;T<w;++T)_+=m[T].northIndicesWestToEast.length;for(m=r.eastMeshes,T=0,w=m.length;T<w;++T)_+=m[T].westIndicesSouthToNorth.length;for(m=r.northMeshes,T=0,w=m.length;T<w;++T)_+=m[T].southIndicesEastToWest.length;const g=Q7;g.minimumHeight=b,g.maximumHeight=v;const y=o.stride;let E=new Float32Array(_*y),x=0;const S=x;x=oee(u,s,o,E,x,0,1,d.height,d.encodedNormal,1,g),x=fee(r,u,o,E,x,r.westTiles,r.westMeshes,L7.EAST,g);const C=x;x=oee(u,s,o,E,x,0,0,h.height,h.encodedNormal,0,g),x=fee(r,u,o,E,x,r.southTiles,r.southMeshes,L7.NORTH,g);const I=x;x=oee(u,s,o,E,x,1,0,p.height,p.encodedNormal,0,g),x=fee(r,u,o,E,x,r.eastTiles,r.eastMeshes,L7.WEST,g);const O=x;x=oee(u,s,o,E,x,1,1,f.height,f.encodedNormal,1,g),x=fee(r,u,o,E,x,r.northTiles,r.northMeshes,L7.SOUTH,g),b=g.minimumHeight,v=g.maximumHeight;const D=zp.fromRectangle(s,b,v,n.tilingScheme.ellipsoid),P=I_.geodeticLatitudeToMercatorAngle(s.south),N=1/(I_.geodeticLatitudeToMercatorAngle(s.north)-P),R=(I_.geodeticLatitudeToMercatorAngle(i.latitude)-P)*N,L=u.geodeticSurfaceNormalCartographic(k7,G7),M=sm.octEncode(L,j7),F=x;o.encode(E,x*y,D.center,kt.fromElements(.5,.5,q7),A,M,R,L),++x;const B=x,z=3*(B-1),U=z*(B<256?1:2);let k;if((E.length-B*y)*Float32Array.BYTES_PER_ELEMENT>=U){const e=B*y*Float32Array.BYTES_PER_ELEMENT;k=B<256?new Uint8Array(E.buffer,e,z):new Uint16Array(E.buffer,e,z)}else k=B<256?new Uint8Array(z):new Uint16Array(z);E=new Float32Array(E.buffer,0,B*y);let V=0;for(T=0;T<B-2;++T)k[V++]=F,k[V++]=T,k[V++]=T+1;k[V++]=F,k[V++]=T,k[V++]=0;const G=[];for(T=C;T>=S;--T)G.push(T);const j=[];for(T=I;T>=C;--T)j.push(T);const W=[];for(T=O;T>=I;--T)W.push(T);const q=[];for(q.push(0),T=F-1;T>=O;--T)q.push(T);r.mesh=new _9(o.center,E,k,z,B,b,v,$u.fromOrientedBoundingBox(D),function(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=bee;return H.fromRadians(n.west,n.south,o,a,c[0]),H.fromRadians(n.east,n.south,o,a,c[1]),H.fromRadians(n.west,n.north,o,a,c[2]),H.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}(e,D.center,s,b,v),o.stride,D,o,G,j,W,q)}const C=t.context;r._destroyVertexArray(i),r.vertexArray=H9._createVertexArrayForMesh(C,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);const I=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const e=o._findAncestorTileWithTerrainData(n);D(e)&&D(e.data.waterMaskTexture)&&(r.waterMaskTexture=e.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,e,r.waterMaskTranslationAndScale))}D(I)&&(--I.referenceCount,0===I.referenceCount&&I.destroy())}function oee(e,t,n,i,o,r,s,a,c,l,u){const d=k7;d.longitude=V.lerp(t.west,t.east,r),d.latitude=V.lerp(t.south,t.north,s),d.height=a;const h=e.cartographicToCartesian(d,H7);let p;n.hasGeodeticSurfaceNormals&&(p=e.geodeticSurfaceNormal(h,G7));const f=W7;return f.x=r,f.y=s,n.encode(i,o*n.stride,h,f,a,c,l,p),u.minimumHeight=Math.min(u.minimumHeight,a),u.maximumHeight=Math.max(u.maximumHeight,a),o+1}const ree=new Ir;function see(e,t,n,i){let o=e.rectangle;const r=t.rectangle;0===t.x&&1===n.x&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(o=Ir.clone(e.rectangle,ree),o.west-=V.TWO_PI,o.east-=V.TWO_PI):0===e.x&&0===n.x&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=Ir.clone(e.rectangle,ree),o.west+=V.TWO_PI,o.east+=V.TWO_PI);const s=o.east-o.west,a=(r.west-o.west)/s,c=(r.east-o.west)/s,l=o.north-o.south,u=(r.south-o.south)/l,d=(r.north-o.south)/l;let h=(n.x-a)/(c-a),p=(n.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),i.x=h,i.y=p,i}const aee=new kt;function cee(e,t,n,i,o){const r=e.encoding,s=e.vertices;if(o.height=r.decodeHeight(s,t),r.hasVertexNormals)r.getOctEncodedNormal(s,t,o.encodedNormal);else{const e=o.encodedNormal;e.x=0,e.y=0}}const lee=new kt,uee=new H;function dee(e,t,n,i,o,r){r.height=o;const s=t.geodeticSurfaceNormalCartographic(k7,H7);sm.octEncode(s,r.encodedNormal)}function hee(e,t,n,i,o,r,s,a,c,l,u){if(yee(e,t,a,s,!1,n,i,u)||yee(e,t,l,c,!0,n,i,u))return u;let d,h;return gee(o,r)?(d=0===n?0===i?r.eastIndicesNorthToSouth[0]:r.southIndicesEastToWest[0]:0===i?r.northIndicesWestToEast[0]:r.westIndicesSouthToNorth[0],cee(r,d,0,0,u),u):(h=0===n?0===i?pee(e.westMeshes,e.westTiles,L7.EAST,e.southMeshes,e.southTiles,L7.NORTH):pee(e.northMeshes,e.northTiles,L7.SOUTH,e.westMeshes,e.westTiles,L7.EAST):0===i?pee(e.southMeshes,e.southTiles,L7.NORTH,e.eastMeshes,e.eastTiles,L7.WEST):pee(e.eastMeshes,e.eastTiles,L7.WEST,e.northMeshes,e.northTiles,L7.SOUTH),D(h)?(dee(0,t,0,0,h,u),u):void 0)}function pee(e,t,n,i,o,r,s,a){const c=_ee(e,t,!1,n),l=_ee(i,o,!0,r);return D(c)&&D(l)?.5*(c+l):D(c)?c:l}function fee(e,t,n,i,o,r,s,a,c){for(let l=0;l<r.length;++l)o=mee(e,t,n,i,o,r[l],s[l],a,c);return o}function mee(e,t,n,i,o,r,s,a,c){let l=r.rectangle;a===L7.EAST&&0===e.tile.x?(l=Ir.clone(r.rectangle,ree),l.west-=V.TWO_PI,l.east-=V.TWO_PI):a===L7.WEST&&0===r.x&&(l=Ir.clone(r.rectangle,ree),l.west+=V.TWO_PI,l.east+=V.TWO_PI);const u=e.tile.rectangle;let d,h,p,f;switch(o>0&&(n.decodeTextureCoordinates(i,o-1,q7),d=q7.x,h=q7.y),a){case L7.WEST:p=s.westIndicesSouthToNorth,f=!1;break;case L7.NORTH:p=s.northIndicesWestToEast,f=!0;break;case L7.EAST:p=s.eastIndicesNorthToSouth,f=!1;break;case L7.SOUTH:p=s.southIndicesEastToWest,f=!0}const m=r,_=e.tile,g=s.encoding,y=s.vertices,b=n.stride;let v,A;g.hasWebMercatorT&&(v=I_.geodeticLatitudeToMercatorAngle(u.south),A=1/(I_.geodeticLatitudeToMercatorAngle(u.north)-v));for(let T=0;T<p.length;++T){const e=p[T],r=g.decodeTextureCoordinates(y,e,q7);see(m,_,r,r);const s=r.x,a=r.y,l=f?s:a;if(l<0||l>1)continue;if(Math.abs(s-d)<V.EPSILON5&&Math.abs(a-h)<V.EPSILON5)continue;const w=Math.abs(s)<V.EPSILON5||Math.abs(s-1)<V.EPSILON5,E=Math.abs(a)<V.EPSILON5||Math.abs(a-1)<V.EPSILON5;if(w&&E)continue;const x=g.decodePosition(y,e,H7),S=g.decodeHeight(y,e);let C;g.hasVertexNormals?C=g.getOctEncodedNormal(y,e,j7):(C=j7,C.x=0,C.y=0);let I,O=a;if(g.hasWebMercatorT){const e=V.lerp(u.south,u.north,a);O=(I_.geodeticLatitudeToMercatorAngle(e)-v)*A}n.hasGeodeticSurfaceNormals&&(I=t.geodeticSurfaceNormal(x,G7)),n.encode(i,o*b,x,r,S,C,O,I),c.minimumHeight=Math.min(c.minimumHeight,S),c.maximumHeight=Math.max(c.maximumHeight,S),++o}return o}function _ee(e,t,n,i,o,r){let s,a,c;n?(s=0,a=e.length,c=1):(s=e.length-1,a=-1,c=-1);for(let l=s;l!==a;l+=c){const o=e[l];if(!gee(t[l],o))continue;let r;switch(i){case L7.WEST:r=o.westIndicesSouthToNorth;break;case L7.SOUTH:r=o.southIndicesEastToWest;break;case L7.EAST:r=o.eastIndicesNorthToSouth;break;case L7.NORTH:r=o.northIndicesWestToEast}const s=r[n?0:r.length-1];if(D(s))return o.encoding.decodeHeight(o.vertices,s)}}function gee(e,t){return D(t)&&(!D(e.data.fill)||!e.data.fill.changedThisFrame)}function yee(e,t,n,i,o,r,s,a){let c,l,u,d,h;const p=i[o?0:n.length-1],f=n[o?0:n.length-1];if(gee(p,f)&&(0===r?0===s?(c=o?f.northIndicesWestToEast:f.eastIndicesNorthToSouth,l=o,u=o):(c=o?f.eastIndicesNorthToSouth:f.southIndicesEastToWest,l=!o,u=!1):0===s?(c=o?f.westIndicesSouthToNorth:f.northIndicesWestToEast,l=!o,u=!0):(c=o?f.southIndicesEastToWest:f.westIndicesSouthToNorth,l=o,u=!o),c.length>0)){d=o?0:c.length-1,h=c[d],f.encoding.decodeTextureCoordinates(f.vertices,h,q7);const n=see(p,e.tile,q7,q7);if(n.x===r&&n.y===s)return cee(f,h,0,0,a),!0;if(d=_n(c,l?r:s,(function(t,n){f.encoding.decodeTextureCoordinates(f.vertices,t,q7);const i=see(p,e.tile,q7,q7);return u?l?i.x-r:i.y-s:l?r-i.x:s-i.y})),!(d<0))return cee(f,c[d],0,0,a),!0;if(d=~d,d>0&&d<c.length)return function(e,t,n,i,o,r,s,a,c,l){const u=i.encoding,d=i.vertices,h=see(t,n,u.decodeTextureCoordinates(d,o,q7),q7),p=see(t,n,u.decodeTextureCoordinates(d,r,W7),W7);let f;f=c?(s-h.x)/(p.x-h.x):(a-h.y)/(p.y-h.y);const m=u.decodeHeight(d,o),_=u.decodeHeight(d,r),g=n.rectangle;let y;if(k7.longitude=V.lerp(g.west,g.east,s),k7.latitude=V.lerp(g.south,g.north,a),l.height=k7.height=V.lerp(m,_,f),u.hasVertexNormals){const e=u.getOctEncodedNormal(d,o,aee),t=u.getOctEncodedNormal(d,r,lee),n=sm.octDecode(e.x,e.y,H7),i=sm.octDecode(t.x,t.y,uee);y=H.lerp(n,i,f,H7),H.normalize(y,y),sm.octEncode(y,l.encodedNormal)}else y=e.geodeticSurfaceNormalCartographic(k7,H7),sm.octEncode(y,l.encodedNormal)}(t,p,e.tile,f,c[d-1],c[d],r,s,l,a),!0}return!1}const bee=[new H,new H,new H,new H];function vee(e){if(!D(e))throw new P("options is required.");if(!D(e.terrainProvider))throw new P("options.terrainProvider is required.");if(!D(e.imageryLayers))throw new P("options.imageryLayers is required.");if(!D(e.surfaceShaderSet))throw new P("options.surfaceShaderSet is required.");this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=k_.RECEIVE_ONLY,this.vertexShadowDarkness=.3,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new gi,this._removeLayerAddedListener=this._imageryLayers.layerAdded.addEventListener(vee.prototype._onLayerAdded,this),this._removeLayerRemovedListener=this._imageryLayers.layerRemoved.addEventListener(vee.prototype._onLayerRemoved,this),this._removeLayerMovedListener=this._imageryLayers.layerMoved.addEventListener(vee.prototype._onLayerMoved,this),this._removeLayerShownListener=this._imageryLayers.layerShownOrHidden.addEventListener(vee.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new gi,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 Ot(0,0,.5,1),this._clippingPlanes=void 0,this._clippingPolygons=void 0,this.cartographicLimitRectangle=Ir.clone(Ir.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldVerticalExaggeration=void 0,this._oldVerticalExaggerationRelativeHeight=void 0}function Aee(e,t){let n=e.loadingImagery;D(n)||(n=e.readyImagery);let i=t.loadingImagery;return D(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}function Tee(e,t){const n=t.globeTranslucencyState;if(n.translucent){const i=e.renderState.blending.enabled;n.pushDerivedCommands(e,i,t)}else t.commandList.push(e)}Object.defineProperties(vee.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){if(!D(e))throw new P("value is required.");this._baseColor=e,this._firstPassInitialColor=K.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){if(!D(e))throw new P("value is required.");this._quadtree=e}},tilingScheme:{get:function(){if(D(this._terrainProvider))return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,D(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){qI.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){bP.setOwner(e,this,"_clippingPolygons")}}}),vee.prototype.update=function(e){this._imageryLayers._update()},vee.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile((function(e){e.data.imagery.sort(Aee)}))),function(e,t){const n=t.creditDisplay,i=e._terrainProvider;D(i)&&D(i.credit)&&n.addCreditToNextFrame(i.credit);const o=e._imageryLayers;for(let r=0,s=o.length;r<s;++r){const e=o.get(r);e.ready&&e.show&&D(e.imageryProvider.credit)&&n.addCreditToNextFrame(e.imageryProvider.credit)}}(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)H9._freeVertexArray(t[i]);t.length=0},vee.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let o=0,r=t.length;o<r;++o){const e=t[o];D(e)&&(e.length=0)}const n=this._clippingPlanes;D(n)&&n.enabled&&n.update(e);const i=this._clippingPolygons;D(i)&&i.enabled&&(i.update(e),i.queueCommands(e)),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1},vee.prototype.endUpdate=function(e){if(!D(this._renderState)){this._renderState=_s.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:Gf.LESS}}),this._blendRenderState=_s.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:Gf.LESS_OR_EQUAL},blending:dh.ALPHA_BLEND});let e=ti(this._renderState,!0);e.cull.enabled=!1,this._disableCullingRenderState=_s.fromCache(e),e=ti(this._blendRenderState,!0),e.cull.enabled=!1,this._disableCullingBlendRenderState=_s.fromCache(e)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&B7.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const t=this.quadtree,n=e.verticalExaggeration,i=e.verticalExaggerationRelativeHeight,o=this._oldVerticalExaggeration!==n||this._oldVerticalExaggerationRelativeHeight!==i;this._oldVerticalExaggeration=n,this._oldVerticalExaggerationRelativeHeight=i,o&&t.forEachLoadedTile((function(n){n.data.updateExaggeration(n,e,t)}));const r=this._tilesToRenderByTextureCount;for(let s=0,a=r.length;s<a;++s){const t=r[s];if(D(t))for(let n=0,i=t.length;n<i;++n){const i=t[n],o=i.data.tileBoundingRegion;ete(this,i,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,o.minimumHeight)}}},vee.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)Tee(t[n],e)},vee.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()},vee.prototype.getLevelMaximumGeometricError=function(e){return D(this._terrainProvider)?this._terrainProvider.getLevelMaximumGeometricError(e):0},vee.prototype.loadTile=function(e,t){let n,i=t.data,o=!0;D(i)&&(o=i.boundingVolumeSourceTile!==t||t._lastSelectionResult===F7.CULLED_BUT_NEEDED,n=i.terrainState),H9.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,o),i=t.data,o&&n!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==B9.NONE&&i.boundingVolumeSourceTile===t&&(o=!1,H9.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,o))};const wee=new $u,Eee=new Ir,xee=new Ir,See=new Qt;function Cee(e,t){if(t.west<t.east)return t;const n=Ir.clone(t,xee);return Ir.center(e,See).longitude>0?n.east=V.PI:n.west=-V.PI,n}function Iee(e,t){if(t.cameraUnderground)return!0;if(t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;if(D(n)&&n.enabled)return!0;const i=e._clippingPolygons;return!(!D(i)||!i.enabled)||!Ir.equals(e.cartographicLimitRectangle,Ir.MAX_VALUE)}vee.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const o=Iee(this,t);if(t.fog.enabled&&!o&&V.fog(i,t.fog.density)>=1)return B9.NONE;const r=e.data,s=r.tileBoundingRegion;if(void 0===r.boundingVolumeSourceTile)return B9.PARTIAL;const a=t.cullingVolume;let c=s.boundingVolume;D(c)||(c=s.boundingSphere),r.clippedByBoundaries=!1;const l=Cee(e.rectangle,this.cartographicLimitRectangle),u=Ir.simpleIntersection(l,e.rectangle,Eee);if(!D(u))return B9.NONE;if(Ir.equals(u,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==gl.SCENE3D&&(c=wee,$u.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,c),H.fromElements(c.center.z,c.center.x,c.center.y,c.center),t.mode===gl.MORPHING&&D(r.renderedMesh)&&(c=$u.union(s.boundingSphere,c,c))),!D(c))return B9.PARTIAL;const d=this._clippingPlanes;if(D(d)&&d.enabled){const t=d.computeIntersectionWithBoundingVolume(c);if(e.isClipped=t!==mn.INSIDE,t===mn.OUTSIDE)return B9.NONE}const h=this._clippingPolygons;if(D(h)&&h.enabled){const t=h.computeIntersectionWithBoundingVolume(s);e.isClipped=t!==mn.OUTSIDE}let p;const f=a.computeVisibility(c);if(f===mn.OUTSIDE?p=B9.NONE:f===mn.INTERSECTING?p=B9.PARTIAL:f===mn.INSIDE&&(p=B9.FULL),p===B9.NONE)return p;const m=t.mode===gl.SCENE3D&&t.camera.frustum instanceof Xc;if(t.mode===gl.SCENE3D&&!m&&D(n)&&!o){const e=r.occludeePointInScaledSpace;return D(e)?n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(e,s.minimumHeight)?p:B9.NONE:p}return p},vee.prototype.canRefine=function(e){if(D(e.data.terrainData))return!0;return void 0!==this.terrainProvider.getTileDataAvailable(2*e.x,2*e.y,e.level+1)};const Oee=[],Dee=[];vee.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=Oee;i.length=this._imageryLayers.length;let o,r,s,a=!1,c=!1;for(D(n)&&(a=n.terrainState===V9.READY,c=!0,o=n.imagery),r=0,s=i.length;r<s;++r)i[r]=c;if(D(o))for(r=0,s=o.length;r<s;++r){const e=o[r],t=e.loadingImagery,n=!D(t)||t.state===U9.FAILED||t.state===U9.INVALID,s=(e.loadingImagery||e.readyImagery).imageryLayer._layerIndex;i[s]=n&&i[s]}const l=this.quadtree._lastSelectionFrameNumber,u=Dee;for(u.length=0,u.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);u.length>0;){const e=u.pop(),t=e._lastSelectionResultFrame===l?e._lastSelectionResult:F7.NONE;if(t===F7.RENDERED){if(!D(e.data))continue;if(!a&&e.data.terrainState===V9.READY)return!1;const t=e.data.imagery;for(r=0,s=t.length;r<s;++r){const e=t[r],n=e.loadingImagery,o=!D(n)||n.state===U9.FAILED||n.state===U9.INVALID,s=(e.loadingImagery||e.readyImagery).imageryLayer._layerIndex;if(o&&!i[s])return!1}}else t===F7.REFINED&&u.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild)}return!0};const Pee=new H;vee.prototype.computeTileLoadPriority=function(e,t){const n=e.data;if(void 0===n)return 0;const i=n.tileBoundingRegion.boundingVolume;if(void 0===i)return 0;const o=t.camera.positionWC,r=t.camera.directionWC,s=H.subtract(i.center,o,Pee),a=H.magnitude(s);return a<V.EPSILON5?0:(H.divideByScalar(s,a,s),(1-H.dot(s,r))*e._distance)};const Nee=new ve,Ree=new ve,Lee=new K,Mee=new K,Fee=new K,Bee=new H,zee=new H,Uee=new H,kee=new H;vee.prototype.showTileThisFrame=function(e,t){let n=0;const i=e.data.imagery;for(let s=0,a=i.length;s<a;++s){const e=i[s];D(e.readyImagery)&&0!==e.readyImagery.imageryLayer.alpha&&++n}let o=this._tilesToRenderByTextureCount[n];D(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);D(e.data.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const r=this._debug;++r.tilesRendered,r.texturesRendered+=n};const Vee=[new H,new H,new H,new H];function Hee(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=Vee;return H.fromRadians(n.west,n.south,o,a,c[0]),H.fromRadians(n.east,n.south,o,a,c[1]),H.fromRadians(n.west,n.north,o,a,c[2]),H.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}vee.prototype.computeDistanceToTile=function(e,t){!function(e,t,n){let i=e.data;void 0===i&&(i=e.data=new H9);const o=e.tilingScheme.ellipsoid;void 0===i.tileBoundingRegion&&(i.tileBoundingRegion=new xW({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));const r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight;let c=!1,l=e;const u=i.mesh,d=i.terrainData;if(void 0!==u&&void 0!==u.minimumHeight&&void 0!==u.maximumHeight)r.minimumHeight=u.minimumHeight,r.maximumHeight=u.maximumHeight,c=!0;else if(void 0!==d&&void 0!==d._minimumHeight&&void 0!==d._maximumHeight)r.minimumHeight=d._minimumHeight,r.maximumHeight=d._maximumHeight;else{r.minimumHeight=Number.NaN,r.maximumHeight=Number.NaN;let t=e.parent;for(;void 0!==t;){const e=t.data;if(void 0!==e){const t=e.mesh,n=e.terrainData;if(void 0!==t&&void 0!==t.minimumHeight&&void 0!==t.maximumHeight){r.minimumHeight=t.minimumHeight,r.maximumHeight=t.maximumHeight;break}if(void 0!==n&&void 0!==n._minimumHeight&&void 0!==n._maximumHeight){r.minimumHeight=n._minimumHeight,r.maximumHeight=n._maximumHeight;break}}t=t.parent}l=t}if(void 0!==l){const d=n.verticalExaggeration,h=n.verticalExaggerationRelativeHeight;if(1!==d&&(c=!1,r.minimumHeight=zf.getHeight(r.minimumHeight,d,h),r.maximumHeight=zf.getHeight(r.maximumHeight,d,h)),c)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=zp.clone(u.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=$u.clone(u.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=H.clone(u.occludeePointInScaledSpace,i.occludeePointInScaledSpace),D(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=Hee(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{const n=void 0===r._orientedBoundingBox||void 0===r._boundingSphere;(r.minimumHeight!==s||r.maximumHeight!==a||n)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=Hee(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=l,i.boundingVolumeIsFromMesh=c}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}(e,this,t);const n=e.data;if(void 0===n.boundingVolumeSourceTile)return 9999999999;const i=n.tileBoundingRegion,o=i.minimumHeight,r=i.maximumHeight;if(n.boundingVolumeSourceTile!==e){const e=t.camera.positionCartographic.height;Math.abs(e-o)>Math.abs(e-r)?(i.minimumHeight=o,i.maximumHeight=o):(i.minimumHeight=r,i.maximumHeight=r)}const s=i.distanceToCamera(t);return i.minimumHeight=o,i.maximumHeight=r,s},vee.prototype.isDestroyed=function(){return!1},vee.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),this._removeLayerAddedListener=this._removeLayerAddedListener&&this._removeLayerAddedListener(),this._removeLayerRemovedListener=this._removeLayerRemovedListener&&this._removeLayerRemovedListener(),this._removeLayerMovedListener=this._removeLayerMovedListener&&this._removeLayerMovedListener(),this._removeLayerShownListener=this._removeLayerShownListener&&this._removeLayerShownListener(),He(this)},vee.prototype._onLayerAdded=function(e,t){if(!this.isDestroyed()&&e.show){const t=this._terrainProvider,n=this,i=this._imageryLayersUpdatedEvent,o=function(){e._imageryCache={},n._quadtree.forEachLoadedTile((function(n){if(D(n._loadedCallbacks[e._layerIndex]))return;let i;const o=n.data.imagery,r=o.length;let s=-1,a=0;for(i=0;i<r;++i){const t=o[i];if(M(t.readyImagery,t.loadingImagery).imageryLayer===e)-1===s&&(s=i),++a;else if(-1!==s)break}if(-1===s)return;const c=s+a;e._createTileImagerySkeletons(n,t,c)&&(n._loadedCallbacks[e._layerIndex]=function(e,t,n){return function(i){let o,r,s=-1;const a=i.data.imagery,c=a.length;let l;for(l=0;l<c;++l)if(o=a[l],r=M(o.readyImagery,o.loadingImagery),r.imageryLayer===t){s=l;break}if(-1!==s){const c=s+e;if(o=a[c],r=D(o)?M(o.readyImagery,o.loadingImagery):void 0,!D(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,c);for(l=s;l<c;++l)a[l].freeResources();a.splice(s,e)}return!0}}(a,e,t),n.state=k9.LOADING)}))};if(e.ready){e.imageryProvider._reload=o}this._quadtree.forEachLoadedTile((function(i){e._createTileImagerySkeletons(i,t)&&(i.state=k9.LOADING,0===i.level||i._lastSelectionResultFrame===n.quadtree._lastSelectionFrameNumber&&i._lastSelectionResult===F7.RENDERED||(i.renderable=!1))})),this._layerOrderChanged=!0,i.raiseEvent()}},vee.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile((function(t){const n=t.data.imagery;let i=-1,o=0;for(let r=0,s=n.length;r<s;++r){const t=n[r];let s=t.loadingImagery;if(D(s)||(s=t.readyImagery),s.imageryLayer===e)-1===i&&(i=r),t.freeResources(),++o;else if(-1!==i)break}-1!==i&&n.splice(i,o)})),D(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()},vee.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()},vee.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const Gee=new ve,jee=new ve;function Wee(e,t){const n={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_atmosphereLightIntensity:function(){return this.properties.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return this.properties.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return this.properties.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return this.properties.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return this.properties.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return this.properties.atmosphereMieAnisotropy},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_verticalExaggerationAndRelativeHeight:function(){return this.properties.verticalExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){const t=e.context.uniformState.view,n=ve.multiplyByPoint(t,this.properties.rtc,zee);return ve.setTranslation(t,n,Nee),Nee},u_modifiedModelViewProjection:function(){const t=e.context.uniformState.view,n=e.context.uniformState.projection,i=ve.multiplyByPoint(t,this.properties.rtc,zee);return ve.setTranslation(t,i,Ree),ve.multiply(n,Ree,Ree),Ree},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_clippingPlanes:function(){const n=t._clippingPlanes;return D(n)&&D(n.texture)?n.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const n=t._clippingPlanes,i=D(n)?ve.multiply(e.context.uniformState.view,n.modelMatrix,Gee):ve.IDENTITY;return ve.inverseTranspose(i,jee)},u_clippingPlanesEdgeStyle:function(){const e=this.properties.clippingPlanesEdgeColor;return e.alpha=this.properties.clippingPlanesEdgeWidth,e},u_clippingDistance:function(){const n=t._clippingPolygons.clippingTexture;return D(n)?n:e.context.defaultTexture},u_clippingExtents:function(){const n=t._clippingPolygons.extentsTexture;return D(n)?n:e.context.defaultTexture},u_minimumBrightness:function(){return e.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},u_frontFaceAlphaByDistance:function(){return this.properties.frontFaceAlphaByDistance},u_backFaceAlphaByDistance:function(){return this.properties.backFaceAlphaByDistance},u_translucencyRectangle:function(){return this.properties.localizedTranslucencyRectangle},u_undergroundColor:function(){return this.properties.undergroundColor},u_undergroundColorAlphaByDistance:function(){return this.properties.undergroundColorAlphaByDistance},u_lambertDiffuseMultiplier:function(){return this.properties.lambertDiffuseMultiplier},u_vertexShadowDarkness:function(){return this.properties.vertexShadowDarkness},properties:{initialColor:new K(0,0,.5,1),fillHighlightColor:new Ot(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new kt(65e5,9e6),nightFadeDistance:new kt(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new H(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new H(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new H,center3D:void 0,rtc:new H,modifiedModelView:new ve,tileRectangle:new K,verticalExaggerationAndRelativeHeight:new kt(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new kt,southMercatorYAndOneOverHeight:new kt,waterMask:void 0,waterMaskTranslationAndScale:new K,minMaxHeight:new kt,scaleAndBias:new ve,clippingPlanesEdgeColor:Ot.clone(Ot.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new K,frontFaceAlphaByDistance:new K,backFaceAlphaByDistance:new K,localizedTranslucencyRectangle:new K,undergroundColor:Ot.clone(Ot.TRANSPARENT),undergroundColorAlphaByDistance:new K,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return D(t.materialUniformMap)?ni(n,t.materialUniformMap):n}function qee(e,t,n){const i=n.data;let o,r;if(D(i.vertexArray)?(o=i.mesh,r=i.vertexArray):D(i.fill)&&D(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),D(o)&&D(r)){if(D(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=function(e,t,n){const i={indices:n.indices,primitiveType:Vr.TRIANGLES};C_.toWireframe(i);const o=i.indices,r=Ye.createIndexBuffer({context:e,typedArray:o,usage:qe.STATIC_DRAW,indexDatatype:je.fromSizeInBytes(o.BYTES_PER_ELEMENT)});return new kl({context:e,attributes:t._attributes,indexBuffer:r})}(e,r,o),i.wireframeVertexArray.mesh=o}}let Yee,Xee,Qee;!function(){const e=new Zd({geometry:qd.fromDimensions({dimensions:new H(2,2,2)})}),t=new Zd({geometry:new Uq({radius:1})});let n,i,o=new ve;function r(e){return new V_({geometryInstances:e,appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1})}Yee=function(t,s){return t===n||(Qee(),n=t,o=ve.fromRotationTranslation(t.halfAxes,t.center,o),e.modelMatrix=o,e.attributes.color=$d.fromColor(s),i=r(e)),i},Xee=function(e,s){return e===n||(Qee(),n=e,o=ve.fromTranslation(e.center,o),o=ve.multiplyByUniformScale(o,e.radius,o),t.modelMatrix=o,t.attributes.color=$d.fromColor(s),i=r(t)),i},Qee=function(){D(i)&&(i.destroy(),i=void 0,n=void 0)}}();const $ee=new K(0,0,0,0),Kee={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,enableClippingPolygons:void 0,clippingPolygons:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},Zee=Ot.TRANSPARENT,Jee=new Au;function ete(e,t,n){const i=t.data;D(i.vertexArray)||(void 0===i.fill&&(i.fill=new B7(t)),i.fill.update(e,n));const o=n.creditDisplay,r=i.terrainData;if(D(r)&&D(r.credits)){const e=r.credits;for(let t=0,n=e.length;t<n;++t)o.addCreditToNextFrame(e[t])}let s=rs.maximumTextureImageUnits,a=i.waterMaskTexture,c=i.waterMaskTranslationAndScale;!D(a)&&D(i.fill)&&(a=i.fill.waterMaskTexture,c=i.fill.waterMaskTranslationAndScale);const l=n.cameraUnderground,u=n.globeTranslucencyState,d=u.translucent,h=u.frontFaceAlphaByDistance,p=u.backFaceAlphaByDistance,f=u.rectangle,m=M(e.undergroundColor,Zee),_=M(e.undergroundColorAlphaByDistance,Jee),g=Iee(e,n)&&n.mode===gl.SCENE3D&&m.alpha>0&&(_.nearValue>0||_.farValue>0),y=e.lambertDiffuseMultiplier,b=e.vertexShadowDarkness,v=e.hasWaterMask&&D(a),A=e.oceanNormalMap,T=v&&D(A),w=D(e.terrainProvider)&&e.terrainProvider.hasVertexNormals,E=n.fog.enabled&&n.fog.renderable&&!l,x=e.showGroundAtmosphere&&n.mode===gl.SCENE3D,S=k_.castShadows(e.shadows)&&!d,C=k_.receiveShadows(e.shadows)&&!d,I=e.hueShift,O=e.saturationShift,N=e.brightnessShift;let R=!(V.equalsEpsilon(I,0,V.EPSILON7)&&V.equalsEpsilon(O,0,V.EPSILON7)&&V.equalsEpsilon(N,0,V.EPSILON7)),L=!1;if(x){L=H.magnitude(n.camera.positionWC)>e.nightFadeOutDistance}v&&--s,T&&--s,D(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,D(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,D(e.clippingPolygons)&&e.clippingPolygons.enabled&&(--s,--s),s-=u.numberOfTextureUniforms;const F=i.renderedMesh;let B=F.center;const z=F.encoding,U=i.tileBoundingRegion,k=n.verticalExaggeration,G=n.verticalExaggerationRelativeHeight,j=1!==k,W=z.hasGeodeticSurfaceNormals,q=Lee;let Y=0,X=0,Q=0,$=0,Z=!1;if(n.mode!==gl.SCENE3D){const e=n.mapProjection,i=e.project(Ir.southwest(t.rectangle),Uee),o=e.project(Ir.northeast(t.rectangle),kee);if(q.x=i.x,q.y=i.y,q.z=o.x,q.w=o.y,n.mode!==gl.MORPHING&&(B=Bee,B.x=0,B.y=.5*(q.z+q.x),B.z=.5*(q.w+q.y),q.x-=B.y,q.y-=B.z,q.z-=B.y,q.w-=B.z),n.mode===gl.SCENE2D&&z.quantization===K8.BITS12){const e=1/(Math.pow(2,12)-1)*.5,t=(q.z-q.x)*e,n=(q.w-q.y)*e;q.x-=t,q.y-=n,q.z+=t,q.w+=n}e instanceof I_&&(Y=t.rectangle.south,X=t.rectangle.north,Q=I_.geodeticLatitudeToMercatorAngle(Y),$=1/(I_.geodeticLatitudeToMercatorAngle(X)-Q),Z=!0)}const J=Kee;J.frameState=n,J.surfaceTile=i,J.showReflectiveOcean=v,J.showOceanWaves=T,J.enableLighting=e.enableLighting,J.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,J.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,J.showGroundAtmosphere=x,J.atmosphereLightIntensity=e.atmosphereLightIntensity,J.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,J.atmosphereMieCoefficient=e.atmosphereMieCoefficient,J.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,J.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,J.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,J.perFragmentGroundAtmosphere=L,J.hasVertexNormals=w,J.useWebMercatorProjection=Z,J.clippedByBoundaries=i.clippedByBoundaries,J.hasGeodeticSurfaceNormals=W,J.hasExaggeration=j;const ee=i.imagery;let te=0;const ne=ee.length,ie=e.showSkirts&&!l&&!d,oe=e.backFaceCulling&&!l&&!d,re=oe?e._renderState:e._disableCullingRenderState,se=oe?e._blendRenderState:e._disableCullingBlendRenderState;let ae=re,ce=e._firstPassInitialColor;const le=n.context;D(e._debug.boundingSphereTile)||Qee();if(e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const t=e._drawCommands.length;for(let i=0;i<t;++i)e._uniformMaps[i]=Wee(n,e)}do{let r,v,T=0;if(e._drawCommands.length<=e._usedDrawCommands?(r=new Kr,r.owner=t,r.cull=!1,r.boundingVolume=new $u,r.orientedBoundingBox=void 0,v=Wee(n,e),e._drawCommands.push(r),e._uniformMaps.push(v)):(r=e._drawCommands[e._usedDrawCommands],v=e._uniformMaps[e._usedDrawCommands]),r.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const e=U.boundingVolume,t=U.boundingSphere;D(e)?Yee(e,Ot.RED).update(n):D(t)&&Xee(t,Ot.RED).update(n)}const w=v.properties;K.clone(ce,w.initialColor),w.oceanNormalMap=A,w.lightingFadeDistance.x=e.lightingFadeOutDistance,w.lightingFadeDistance.y=e.lightingFadeInDistance,w.nightFadeDistance.x=e.nightFadeOutDistance,w.nightFadeDistance.y=e.nightFadeInDistance,w.atmosphereLightIntensity=e.atmosphereLightIntensity,w.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,w.atmosphereMieCoefficient=e.atmosphereMieCoefficient,w.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,w.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,w.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,w.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const L=l?p:h,M=l?h:p;D(L)&&(K.fromElements(L.near,L.nearValue,L.far,L.farValue,w.frontFaceAlphaByDistance),K.fromElements(M.near,M.nearValue,M.far,M.farValue,w.backFaceAlphaByDistance)),K.fromElements(_.near,_.nearValue,_.far,_.farValue,w.undergroundColorAlphaByDistance),Ot.clone(m,w.undergroundColor),w.lambertDiffuseMultiplier=y,w.vertexShadowDarkness=b;const j=!D(i.vertexArray)&&D(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;j&&Ot.clone(e.fillHighlightColor,w.fillHighlightColor),w.verticalExaggerationAndRelativeHeight.x=k,w.verticalExaggerationAndRelativeHeight.y=G,w.center3D=F.center,H.clone(B,w.rtc),K.clone(q,w.tileRectangle),w.southAndNorthLatitude.x=Y,w.southAndNorthLatitude.y=X,w.southMercatorYAndOneOverHeight.x=Q,w.southMercatorYAndOneOverHeight.y=$;const W=Mee,Z=Cee(t.rectangle,e.cartographicLimitRectangle),oe=Fee,re=Cee(t.rectangle,f);H.fromElements(I,O,N,w.hsbShift);const ue=t.rectangle,de=1/ue.width,he=1/ue.height;W.x=(Z.west-ue.west)*de,W.y=(Z.south-ue.south)*he,W.z=(Z.east-ue.west)*de,W.w=(Z.north-ue.south)*he,K.clone(W,w.localizedCartographicLimitRectangle),oe.x=(re.west-ue.west)*de,oe.y=(re.south-ue.south)*he,oe.z=(re.east-ue.west)*de,oe.w=(re.north-ue.south)*he,K.clone(oe,w.localizedTranslucencyRectangle);const pe=E&&V.fog(t._distance,n.fog.density)>V.EPSILON3;R=R&&(pe||x);let fe=!1,me=!1,_e=!1,ge=!1,ye=!1,be=!1,Ae=!1,Te=!1,we=!1,Ee=!1;for(;T<s&&te<ne;){const e=ee[te],n=e.readyImagery;if(++te,!D(n)||0===n.imageryLayer.alpha)continue;const i=e.useWebMercatorT?n.textureWebMercator:n.texture;if(!D(i))throw new P("readyImagery is not actually ready!");const r=n.imageryLayer;D(e.textureTranslationAndScale)||(e.textureTranslationAndScale=r._calculateTextureTranslationAndScale(t,e)),w.dayTextures[T]=i,w.dayTextureTranslationAndScale[T]=e.textureTranslationAndScale,w.dayTextureTexCoordsRectangle[T]=e.textureCoordinateRectangle,w.dayTextureUseWebMercatorT[T]=e.useWebMercatorT,w.dayTextureAlpha[T]=r.alpha,be=be||1!==w.dayTextureAlpha[T],w.dayTextureNightAlpha[T]=r.nightAlpha,Ae=Ae||1!==w.dayTextureNightAlpha[T],w.dayTextureDayAlpha[T]=r.dayAlpha,Ae=Ae||1!==w.dayTextureDayAlpha[T],w.dayTextureBrightness[T]=r.brightness,fe=fe||w.dayTextureBrightness[T]!==x7.DEFAULT_BRIGHTNESS,w.dayTextureContrast[T]=r.contrast,me=me||w.dayTextureContrast[T]!==x7.DEFAULT_CONTRAST,w.dayTextureHue[T]=r.hue,_e=_e||w.dayTextureHue[T]!==x7.DEFAULT_HUE,w.dayTextureSaturation[T]=r.saturation,ge=ge||w.dayTextureSaturation[T]!==x7.DEFAULT_SATURATION,w.dayTextureOneOverGamma[T]=1/r.gamma,ye=ye||w.dayTextureOneOverGamma[T]!==1/x7.DEFAULT_GAMMA,w.dayTextureSplit[T]=r.splitDirection,Te=Te||0!==w.dayTextureSplit[T];let s=w.dayTextureCutoutRectangles[T];if(D(s)||(s=w.dayTextureCutoutRectangles[T]=new K),K.clone(K.ZERO,s),D(r.cutoutRectangle)){const e=Cee(ue,r.cutoutRectangle);we=D(Ir.simpleIntersection(e,ue,Eee))||we,s.x=(e.west-ue.west)*de,s.y=(e.south-ue.south)*he,s.z=(e.east-ue.west)*de,s.w=(e.north-ue.south)*he}let a=w.colorsToAlpha[T];D(a)||(a=w.colorsToAlpha[T]=new K);const c=D(r.colorToAlpha)&&r.colorToAlphaThreshold>0;if(Ee=Ee||c,c){const e=r.colorToAlpha;a.x=e.red,a.y=e.green,a.z=e.blue,a.w=r.colorToAlphaThreshold}else a.w=-1;if(D(n.credits)){const e=n.credits;for(let t=0,n=e.length;t<n;++t)o.addCreditToNextFrame(e[t])}++T}w.dayTextures.length=T,w.waterMask=a,K.clone(c,w.waterMaskTranslationAndScale),w.minMaxHeight.x=z.minimumHeight,w.minMaxHeight.y=z.maximumHeight,ve.clone(z.matrix,w.scaleAndBias);const xe=e._clippingPlanes,Se=D(xe)&&xe.enabled&&t.isClipped;Se&&(w.clippingPlanesEdgeColor=Ot.clone(xe.edgeColor,w.clippingPlanesEdgeColor),w.clippingPlanesEdgeWidth=xe.edgeWidth);const Ce=e._clippingPolygons,Ie=D(Ce)&&Ce.enabled&&t.isClipped;J.numberOfDayTextures=T,J.applyBrightness=fe,J.applyContrast=me,J.applyHue=_e,J.applySaturation=ge,J.applyGamma=ye,J.applyAlpha=be,J.applyDayNightAlpha=Ae,J.applySplit=Te,J.enableFog=pe,J.enableClippingPlanes=Se,J.clippingPlanes=xe,J.enableClippingPolygons=Ie,J.clippingPolygons=Ce,J.hasImageryLayerCutout=we,J.colorCorrect=R,J.highlightFillTile=j,J.colorToAlpha=Ee,J.showUndergroundColor=g,J.translucent=d;let Oe=i.renderedMesh.indices.length;ie||(Oe=i.renderedMesh.indexCountWithoutSkirts),r.shaderProgram=e._surfaceShaderSet.getShaderProgram(J),r.castShadows=S,r.receiveShadows=C,r.renderState=ae,r.primitiveType=Vr.TRIANGLES,r.vertexArray=i.vertexArray||i.fill.vertexArray,r.count=Oe,r.uniformMap=v,r.pass=zt.GLOBE,e._debug.wireframe&&(qee(le,0,t),D(i.wireframeVertexArray)&&(r.vertexArray=i.wireframeVertexArray,r.primitiveType=Vr.LINES,r.count=2*Oe));let De=r.boundingVolume;const Pe=r.orientedBoundingBox;n.mode!==gl.SCENE3D?($u.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,U.minimumHeight,U.maximumHeight,De),H.fromElements(De.center.z,De.center.x,De.center.y,De.center),n.mode===gl.MORPHING&&(De=$u.union(U.boundingSphere,De,De))):(r.boundingVolume=$u.clone(U.boundingSphere,De),r.orientedBoundingBox=zp.clone(U.boundingVolume,Pe)),r.dirty=!0,d&&u.updateDerivedCommands(r,n),Tee(r,n),ae=se,ce=$ee}while(te<ne)}function tte(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=Ir.clone(Ir.MAX_VALUE)}function nte(){this._layers=[],this.layerAdded=new gi,this.layerRemoved=new gi,this.layerMoved=new gi,this.layerShownOrHidden=new gi}function ite(e,t){if(!D(t))throw new P("layer is required.");const n=e.indexOf(t);if(-1===n)throw new P("layer is not in this collection.");return n}function ote(e,t,n){const i=e._layers;if((t=V.clamp(t,0,i.length-1))===(n=V.clamp(n,0,i.length-1)))return;const o=i[t];i[t]=i[n],i[n]=o,e._update(),e.layerMoved.raiseEvent(o,n,t)}Object.defineProperties(tte.prototype,{enabled:{get:function(){return this._enabled},set:function(e){L.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){L.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),L.typeOf.number.lessThanOrEquals("frontFaceAlpha",e,1),this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){if(D(e)&&e.far<e.near)throw new P("far distance must be greater than near distance.");this._frontFaceAlphaByDistance=Au.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){L.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),L.typeOf.number.lessThanOrEquals("backFaceAlpha",e,1),this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){if(D(e)&&e.far<e.near)throw new P("far distance must be greater than near distance.");this._backFaceAlphaByDistance=Au.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){D(e)||(e=Ir.clone(Ir.MAX_VALUE)),Ir.clone(e,this._rectangle)}}}),Object.defineProperties(nte.prototype,{length:{get:function(){return this._layers.length}}}),nte.prototype.add=function(e,t){const n=D(t);if(!D(e))throw new P("layer is required.");if(n){if(t<0)throw new P("index must be greater than or equal to zero.");if(t>this._layers.length)throw new P("index must be less than or equal to the number of layers.")}n?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t);const i=e.readyEvent.addEventListener((()=>{this.layerShownOrHidden.raiseEvent(e,e._layerIndex,e.show),i()}))},nte.prototype.addImageryProvider=function(e,t){if(!D(e))throw new P("imageryProvider is required.");const n=new x7(e);return this.add(n,t),n},nte.prototype.remove=function(e,t){t=M(t,!0);const n=this._layers.indexOf(e);return-1!==n&&(this._layers.splice(n,1),this._update(),this.layerRemoved.raiseEvent(e,n),t&&e.destroy(),!0)},nte.prototype.removeAll=function(e){e=M(e,!0);const t=this._layers;for(let n=0,i=t.length;n<i;n++){const i=t[n];this.layerRemoved.raiseEvent(i,n),e&&i.destroy()}this._layers=[]},nte.prototype.contains=function(e){return-1!==this.indexOf(e)},nte.prototype.indexOf=function(e){return this._layers.indexOf(e)},nte.prototype.get=function(e){if(!D(e))throw new P("index is required.");return this._layers[e]},nte.prototype.raise=function(e){const t=ite(this._layers,e);ote(this,t,t+1)},nte.prototype.lower=function(e){const t=ite(this._layers,e);ote(this,t,t-1)},nte.prototype.raiseToTop=function(e){const t=ite(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))},nte.prototype.lowerToBottom=function(e){const t=ite(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const rte=new Ir;function ste(e,t,n,i){const o=e.globe._surface._tilesToRender;let r;for(let a=0;!D(r)&&a<o.length;++a){const e=o[a];Ir.contains(e.rectangle,t)&&(r=e)}if(!D(r))return;const s=r.data.imagery;for(let a=s.length-1;a>=0;--a){const e=s[a],o=e.readyImagery;if(!D(o))continue;if(!o.imageryLayer.ready)continue;const c=o.imageryLayer.imageryProvider;if(n&&!D(c.pickFeatures))continue;if(!Ir.contains(o.rectangle,t))continue;const l=rte,u=1/1024;l.west=V.lerp(r.rectangle.west,r.rectangle.east,e.textureCoordinateRectangle.x-u),l.east=V.lerp(r.rectangle.west,r.rectangle.east,e.textureCoordinateRectangle.z+u),l.south=V.lerp(r.rectangle.south,r.rectangle.north,e.textureCoordinateRectangle.y-u),l.north=V.lerp(r.rectangle.south,r.rectangle.north,e.textureCoordinateRectangle.w+u),Ir.contains(l,t)&&i(o)}}function ate(e){this._ellipsoid=new sK(e.ellipsoid,H.ZERO)}function cte(e){if(!D(e))throw new P("options is required.");if(!D(e.x))throw new P("options.x is required.");if(!D(e.y))throw new P("options.y is required.");if(e.x<0||e.y<0)throw new P("options.x and options.y must be greater than or equal to zero.");if(!D(e.level))throw new P("options.level is required and must be greater than or equal to zero.");if(!D(e.tilingScheme))throw new P("options.tilingScheme is required.");this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=F7.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=k9.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}function lte(e){D(e)&&e.freeResources()}function ute(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function dte(e,t){const n=t.replacementPrevious,i=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=i),t===e.head?e.head=i:n.replacementNext=i,t===e.tail?e.tail=n:i.replacementPrevious=n,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}function hte(e){if(!D(e)||!D(e.tileProvider))throw new P("options.tileProvider is required.");if(D(e.tileProvider.quadtree))throw new P("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};const t=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new ute,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=M(e.maximumScreenSpaceError,2),this.tileCacheSize=M(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new ate({ellipsoid:t}),this._tileLoadProgressEvent=new gi,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}function pte(e){const t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}let fte;nte.prototype.pickImageryLayers=function(e,t){const n=t.globe.pick(e,t);if(!D(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[];return ste(t,i,!1,(function(e){o.push(e.imageryLayer)})),0!==o.length?o:void 0},nte.prototype.pickImageryLayerFeatures=function(e,t){const n=t.globe.pick(e,t);if(!D(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[],r=[];return ste(t,i,!0,(function(e){if(!e.imageryLayer.ready)return;const t=e.imageryLayer.imageryProvider.pickFeatures(e.x,e.y,e.level,i.longitude,i.latitude);D(t)&&(o.push(t),r.push(e.imageryLayer))})),0!==o.length?Promise.all(o).then((function(e){const t=[];for(let n=0;n<e.length;++n){const o=e[n],s=r[n];if(D(o)&&o.length>0)for(let e=0;e<o.length;++e){const n=o[e];n.imageryLayer=s,D(n.position)||(n.position=i),t.push(n)}}return t})):void 0},nte.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)},nte.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()},nte.prototype.isDestroyed=function(){return!1},nte.prototype.destroy=function(){return this.removeAll(!0),He(this)},nte.prototype._update=function(){let e=!0;const t=this._layers;let n,i,o,r;for(o=0,r=t.length;o<r;++o)i=t[o],i._layerIndex=o,i.show?(i._isBaseLayer=e,e=!1):i._isBaseLayer=!1,i.show!==i._show&&(D(i._show)&&(D(n)||(n=[]),n.push(i)),i._show=i.show);if(D(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},Object.defineProperties(ate.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),cte.createLevelZeroTiles=function(e){if(!D(e))throw new P("tilingScheme is required.");const t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n);let o=0;for(let r=0;r<n;++r)for(let n=0;n<t;++n)i[o++]=new cte({tilingScheme:e,x:n,y:r,level:0});return i},cte.prototype._updateCustomData=function(e,t,n){let i,o,r,s=this.customData;if(D(t)&&D(n)){for(s=s.filter((function(e){return-1===n.indexOf(e)})),this._customData=s,r=this._rectangle,i=0;i<t.length;++i)o=t[i],Ir.contains(r,o.positionCartographic)&&s.push(o);this._frameUpdated=e}else{const e=this._parent;if(D(e)&&this._frameUpdated!==e._frameUpdated){s.length=0,r=this._rectangle;const t=e.customData;for(i=0;i<t.length;++i)o=t[i],Ir.contains(r,o.positionCartographic)&&s.push(o);this._frameUpdated=e._frameUpdated}}},Object.defineProperties(cte.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 D(this._southwestChild)||(this._southwestChild=new cte({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return D(this._southeastChild)||(this._southeastChild=new cte({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 D(this._northwestChild)||(this._northwestChild=new cte({tilingScheme:this.tilingScheme,x:2*this.x,y:2*this.y,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return D(this._northeastChild)||(this._northeastChild=new cte({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<k9.DONE}},eligibleForUnloading:{get:function(){let e=!0;return D(this.data)&&(e=this.data.eligibleForUnloading,D(e)||(e=!0)),e}}}),cte.prototype.findLevelZeroTile=function(e,t,n){const i=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=i:t>=i&&(t-=i),!(n<0||n>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter((function(e){return e.x===t&&e.y===n}))[0]},cte.prototype.findTileToWest=function(e){const 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;const n=t.findTileToWest(e);return void 0!==n?t.southwestChild===this?n.southeastChild:n.northeastChild:void 0},cte.prototype.findTileToEast=function(e){const 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;const n=t.findTileToEast(e);return void 0!==n?t.southeastChild===this?n.southwestChild:n.northwestChild:void 0},cte.prototype.findTileToSouth=function(e){const 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;const n=t.findTileToSouth(e);return void 0!==n?t.southwestChild===this?n.northwestChild:n.northeastChild:void 0},cte.prototype.findTileToNorth=function(e){const 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;const n=t.findTileToNorth(e);return void 0!==n?t.northwestChild===this?n.southwestChild:n.southeastChild:void 0},cte.prototype.freeResources=function(){this.state=k9.START,this.renderable=!1,this.upsampledFromParent=!1,D(this.data)&&D(this.data.freeResources)&&this.data.freeResources(),lte(this._southwestChild),this._southwestChild=void 0,lte(this._southeastChild),this._southeastChild=void 0,lte(this._northwestChild),this._northwestChild=void 0,lte(this._northeastChild),this._northeastChild=void 0},ute.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},ute.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&D(this._lastBeforeStartOfFrame)&&this.count>e&&D(t);){n=t!==this._lastBeforeStartOfFrame;const e=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),dte(this,t)),t=e}},ute.prototype.markTileRendered=function(e){const t=this.head;if(t!==e){if(++this.count,!D(t))return e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,void(this.tail=e);(D(e.replacementPrevious)||D(e.replacementNext))&&dte(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e}else e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext)},Object.defineProperties(hte.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}}),hte.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0},hte.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;D(t);)t.state!==k9.START&&e(t),t=t.replacementNext},hte.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])},hte.prototype.updateHeight=function(e,t){const n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t,removeFunc:function(){const e=n._addHeightCallbacks,t=e.length;for(let n=0;n<t;++n)if(e[n]===i){e.splice(n,1);break}n._removeHeightCallbacks.push(i),i.callback&&(i.callback=void 0)}};return n._addHeightCallbacks.push(i),i.removeFunc},hte.prototype.update=function(e){D(this._tileProvider.update)&&this._tileProvider.update(e)},hte.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(!function(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,pte(e);const n=e._levelZeroTiles;if(D(n))for(let i=0;i<n.length;++i){const t=n[i].customData,o=t.length;for(let n=0;n<o;++n){const i=t[n];i.level=0,e._addHeightCallbacks.push(i)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),pte(this),this._debug.suspendLodUpdate||this._tileReplacementQueue.markStartOfRenderFrame())},hte.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),function(e,t){const n=e._debug;if(n.suspendLodUpdate)return;let i;e._tilesToRender.length=0;const o=e._tileProvider;if(!D(e._levelZeroTiles)){if(!D(o.tilingScheme))return;{const t=o.tilingScheme;e._levelZeroTiles=cte.createLevelZeroTiles(t);const n=e._levelZeroTiles.length;if(yte.length<n)for(yte=new Array(n),i=0;i<n;++i)void 0===yte[i]&&(yte[i]=new vte)}}let r;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;const s=e._levelZeroTiles,a=s.length>1?e._occluders:void 0;fte=t.camera.positionCartographic,s.sort(_te);const c=e._addHeightCallbacks,l=e._removeHeightCallbacks,u=t.frameNumber;let d;if(c.length>0||l.length>0){for(i=0,d=s.length;i<d;++i)r=s[i],r._updateCustomData(u,c,l);c.length=0,l.length=0}const h=t.camera;e._cameraPositionCartographic=h.positionCartographic;const p=ve.getTranslation(h.transform,gte);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(p,e._cameraReferenceFrameOriginCartographic),i=0,d=s.length;i<d;++i)r=s[i],e._tileReplacementQueue.markTileRendered(r),r.renderable?Ete(e,r,o,t,a,!1,yte[i]):(bte(e,e._tileLoadQueueHigh,r,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=u}(this,e),function(e,t){const n=e._tileProvider,i=e._tilesToRender;for(let o=0,r=i.length;o<r;++o){const e=i[o];n.showTileThisFrame(e,t)}}(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)},hte.prototype.endFrame=function(e){e.passes.render&&e.mode!==gl.MORPHING&&(function(e,t){const n=e._tileLoadQueueHigh,i=e._tileLoadQueueMedium,o=e._tileLoadQueueLow;if(0===n.length&&0===i.length&&0===o.length)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);const r=rJ()+e._loadQueueTimeSlice,s=e._tileProvider;let a=Cte(e,t,s,r,n,!1);a=Cte(e,t,s,r,i,a),Cte(e,t,s,r,o,a)}(this,e),function(e,t){if(!D(e.tileProvider.tilingScheme))return;const n=Pte;n.length=0;const i=e._tileToUpdateHeights,o=rJ(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,c=t.mapProjection,l=e.tileProvider.tilingScheme.ellipsoid;let u;for(;i.length>0;){const t=i[0];if(!D(t.data)||!D(t.data.mesh)){const o=t._lastSelectionResultFrame===e._lastSelectionFrameNumber?t._lastSelectionResult:F7.NONE;o!==F7.RENDERED&&o!==F7.CULLED_BUT_NEEDED||n.push(t),i.shift(),e._lastTileIndex=0;continue}const o=t.customData,r=o.length;let d=!1;for(u=e._lastTileIndex;u<r;++u){const e=o[u],n=t.data.terrainData,i=D(n)&&n.wasCreatedByUpsampling();if(t.level>e.level&&!i){if(D(e.positionOnEllipsoidSurface)||(e.positionOnEllipsoidSurface=H.fromRadians(e.positionCartographic.longitude,e.positionCartographic.latitude,0,l)),a===gl.SCENE3D){const n=l.geodeticSurfaceNormal(e.positionOnEllipsoidSurface,Ite.direction);if(!D(l.getSurfaceNormalIntersectionWithZAxis(e.positionOnEllipsoidSurface,11500,Ite.origin))){let i=0;D(t.data.tileBoundingRegion)&&(i=t.data.tileBoundingRegion.minimumHeight);const o=Math.min(i,-11500),r=H.multiplyByScalar(n,Math.abs(o)+1,Dte);H.subtract(e.positionOnEllipsoidSurface,r,Ite.origin)}}else Qt.clone(e.positionCartographic,Ote),Ote.height=-11500,c.project(Ote,Dte),H.fromElements(Dte.z,Dte.x,Dte.y,Dte),H.clone(Dte,Ite.origin),H.clone(H.UNIT_X,Ite.direction);const n=t.data.pick(Ite,a,c,!1,Dte);D(n)&&(D(e.callback)&&e.callback(n),e.level=t.level)}if(rJ()>=s){d=!0;break}}if(d){e._lastTileIndex=u;break}e._lastTileIndex=0,i.shift()}for(u=0;u<n.length;u++)i.push(n[u])}(this,e),function(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){const i=gi.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n);t.afterRender.push((()=>(i(),!0))),e._lastTileLoadQueueLength=n}const i=e._debug;i.enableDebugOutput&&!i.suspendLodUpdate&&(i.maxDepth=e._tilesToRender.reduce((function(e,t){return Math.max(e,t.level)}),-1),i.tilesRendered=e._tilesToRender.length,i.tilesVisited===i.lastTilesVisited&&i.tilesRendered===i.lastTilesRendered&&i.tilesCulled===i.lastTilesCulled&&i.maxDepth===i.lastMaxDepth&&i.tilesWaitingForChildren===i.lastTilesWaitingForChildren&&i.maxDepthVisited===i.lastMaxDepthVisited||(i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren,i.lastMaxDepthVisited=i.maxDepthVisited))}(this,e))},hte.prototype.isDestroyed=function(){return!1},hte.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};const mte=new Qt;function _te(e,t){let n=Ir.center(e.rectangle,mte);const i=n.longitude-fte.longitude,o=n.latitude-fte.latitude;n=Ir.center(t.rectangle,mte);const r=n.longitude-fte.longitude,s=n.latitude-fte.latitude;return i*i+o*o-(r*r+s*s)}const gte=new H;let yte=[];function bte(e,t,n,i){n.needsLoading&&(void 0!==e.tileProvider.computeTileLoadPriority&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function vte(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function Ate(){this.southwest=new vte,this.southeast=new vte,this.northwest=new vte,this.northeast=new vte}Ate.prototype.combine=function(e){const t=this.southwest,n=this.southeast,i=this.northwest,o=this.northeast;e.allAreRenderable=t.allAreRenderable&&n.allAreRenderable&&i.allAreRenderable&&o.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||o.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+n.notYetRenderableCount+i.notYetRenderableCount+o.notYetRenderableCount};const Tte=new Array(31);for(let ko=0;ko<Tte.length;++ko)Tte[ko]=new Ate;function wte(e,t,n,i,o){const r=e._debug;++r.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>r.maxDepthVisited&&(r.maxDepthVisited=n.level);const s=function(e,t,n){if(t.mode===gl.SCENE2D||t.camera.frustum instanceof Xc||t.camera.frustum instanceof Hc)return function(e,t,n){const i=t.camera;let o=i.frustum;const r=o.offCenterFrustum;D(r)&&(o=r);const s=t.context,a=s.drawingBufferWidth,c=s.drawingBufferHeight,l=e._tileProvider.getLevelMaximumGeometricError(n.level),u=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(a,c);let d=l/u;t.fog.enabled&&t.mode!==gl.SCENE2D&&(d-=V.fog(n._distance,t.fog.density)*t.fog.sse);return d/=t.pixelRatio,d}(e,t,n);const i=e._tileProvider.getLevelMaximumGeometricError(n.level),o=n._distance,r=t.context.drawingBufferHeight,s=t.camera.frustum.sseDenominator;let a=i*r/(o*s);t.fog.enabled&&(a-=V.fog(o,t.fog.density)*t.fog.sse);return a/=t.pixelRatio,a}(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,c=n.southeastChild,l=n.northwestChild,u=n.northeastChild,d=e._lastSelectionFrameNumber,h=n._lastSelectionResultFrame===d?n._lastSelectionResult:F7.NONE,p=e.tileProvider;if(s||i){const r=F7.originalResult(h)===F7.RENDERED,a=F7.originalResult(h)===F7.CULLED||h===F7.NONE,c=n.state===k9.DONE;let l=r||a||c;if(l||D(p.canRenderWithoutLosingDetail)&&(l=p.canRenderWithoutLosingDetail(n)),l)return s&&bte(e,e._tileLoadQueueMedium,n,t),xte(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=h===F7.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=F7.RENDERED,void(o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n));i=!0,s&&bte(e,e._tileLoadQueueHigh,n,t)}if(p.canRefine(n)){if(a.upsampledFromParent&&c.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent)return xte(e,n),bte(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=h===F7.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=F7.RENDERED,void(o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n));n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=F7.REFINED;const s=e._tilesToRender.length,d=e._tileLoadQueueLow.length,p=e._tileLoadQueueMedium.length,f=e._tileLoadQueueHigh.length,m=e._tileToUpdateHeights.length;if(function(e,t,n,i,o,r,s,a){const c=r.camera.positionCartographic,l=e._tileProvider,u=e._occluders,d=Tte[t.level],h=d.southwest,p=d.southeast,f=d.northwest,m=d.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(Ete(e,t,l,r,u,s,h),Ete(e,n,l,r,u,s,p),Ete(e,i,l,r,u,s,f),Ete(e,o,l,r,u,s,m)):(Ete(e,i,l,r,u,s,f),Ete(e,t,l,r,u,s,h),Ete(e,o,l,r,u,s,m),Ete(e,n,l,r,u,s,p)):c.latitude<t.rectangle.north?(Ete(e,n,l,r,u,s,p),Ete(e,t,l,r,u,s,h),Ete(e,o,l,r,u,s,m),Ete(e,i,l,r,u,s,f)):(Ete(e,o,l,r,u,s,m),Ete(e,i,l,r,u,s,f),Ete(e,n,l,r,u,s,p),Ete(e,t,l,r,u,s,h));d.combine(a)}(e,a,c,l,u,t,i,o),s!==e._tilesToRender.length){const i=o.allAreRenderable,a=o.anyWereRenderedLastFrame,c=o.notYetRenderableCount;let l=!1;if(!i&&!a){const i=e._tilesToRender;for(let e=s;e<i.length;++e){let t=i[e];for(;void 0!==t&&t._lastSelectionResult!==F7.KICKED&&t!==n;)t._lastSelectionResult=F7.kick(t._lastSelectionResult),t=t.parent}e._tilesToRender.length=s,e._tileToUpdateHeights.length=m,xte(e,n),n._lastSelectionResult=F7.RENDERED;const a=h===F7.RENDERED;!a&&c>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=d,e._tileLoadQueueMedium.length=p,e._tileLoadQueueHigh.length=f,bte(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,l=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=a,a||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!l&&bte(e,e._tileLoadQueueLow,n,t)}}else n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=F7.RENDERED,xte(e,n),bte(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=h===F7.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function Ete(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==B9.NONE)return wte(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,function(e,t){const n=t.rectangle;return D(e._cameraPositionCartographic)&&Ir.contains(n,e._cameraPositionCartographic)||D(e._cameraReferenceFrameOriginCartographic)&&Ir.contains(n,e._cameraReferenceFrameOriginCartographic)}(e,t)){D(t.data)&&D(t.data.vertexArray)||bte(e,e._tileLoadQueueMedium,t,i);const n=e._lastSelectionFrameNumber,o=t._lastSelectionResultFrame===n?t._lastSelectionResult:F7.NONE;o!==F7.CULLED_BUT_NEEDED&&o!==F7.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=F7.CULLED_BUT_NEEDED}else e.preloadSiblings||0===t.level?(bte(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=F7.CULLED):t._lastSelectionResult=F7.CULLED;t._lastSelectionResultFrame=i.frameNumber}function xte(e,t){e._tilesToRender.push(t)}function Ste(e,t){return e._loadPriority-t._loadPriority}function Cte(e,t,n,i,o,r){void 0!==n.computeTileLoadPriority&&o.sort(Ste);for(let s=0,a=o.length;s<a&&(rJ()<i||!r);++s){const i=o[s];e._tileReplacementQueue.markTileRendered(i),n.loadTile(t,i),r=!0}return r}const Ite=new tp,Ote=new Qt,Dte=new H,Pte=[];function Nte(e){const t=new N9({ellipsoid:e=M(e,on.WGS84)}),n=new nte;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new F9,this._material=void 0,this._surface=new hte({tileProvider:new vee({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new gi,this._undergroundColor=Ot.clone(Ot.BLACK),this._undergroundColorAlphaByDistance=new Au(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new tte,Rte(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Bi({url:lo("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!0,this.atmosphereLightIntensity=10,this.atmosphereRayleighCoefficient=new H(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new H(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=k_.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0,this.vertexShadowDarkness=.3}function Rte(e){const t=[],n=D(e._material)&&(D(e._material.shaderSource.match(/slope/))||D(e._material.shaderSource.match("normalEC"))),i=[H8,W8];!D(e._material)||n&&!e._terrainProvider.requestVertexNormals?e._surface._tileProvider.materialUniformMap=void 0:(i.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms),i.push("uniform vec4 u_initialColor;\n\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\nuniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_DAY_NIGHT_ALPHA\nuniform float u_dayTextureNightAlpha[TEXTURE_UNITS];\nuniform float u_dayTextureDayAlpha[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_SPLIT\nuniform float u_dayTextureSplit[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_IMAGERY_CUTOUT\nuniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];\n#endif\n\n#ifdef APPLY_COLOR_TO_ALPHA\nuniform vec4 u_colorsToAlpha[TEXTURE_UNITS];\n#endif\n\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\nuniform vec2 u_lightingFadeDistance;\n#endif\n\n#ifdef TILE_LIMIT_RECTANGLE\nuniform vec4 u_cartographicLimitRectangle;\n#endif\n\n#ifdef GROUND_ATMOSPHERE\nuniform vec2 u_nightFadeDistance;\n#endif\n\n#ifdef ENABLE_CLIPPING_PLANES\nuniform highp sampler2D u_clippingPlanes;\nuniform mat4 u_clippingPlanesMatrix;\nuniform vec4 u_clippingPlanesEdgeStyle;\n#endif\n\n#ifdef ENABLE_CLIPPING_POLYGONS\nuniform highp sampler2D u_clippingDistance;\nin vec2 v_clippingPosition;\nflat in int v_regionIndex;\n#endif\n\n#if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\nuniform float u_minimumBrightness;\n#endif\n\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift; // Hue, saturation, brightness\n#endif\n\n#ifdef HIGHLIGHT_FILL_TILE\nuniform vec4 u_fillHighlightColor;\n#endif\n\n#ifdef TRANSLUCENT\nuniform vec4 u_frontFaceAlphaByDistance;\nuniform vec4 u_backFaceAlphaByDistance;\nuniform vec4 u_translucencyRectangle;\n#endif\n\n#ifdef UNDERGROUND_COLOR\nuniform vec4 u_undergroundColor;\nuniform vec4 u_undergroundColorAlphaByDistance;\n#endif\n\n#ifdef ENABLE_VERTEX_LIGHTING\nuniform float u_lambertDiffuseMultiplier;\nuniform float u_vertexShadowDarkness;\n#endif\n\nin vec3 v_positionMC;\nin vec3 v_positionEC;\nin vec3 v_textureCoordinates;\nin vec3 v_normalMC;\nin vec3 v_normalEC;\n\n#ifdef APPLY_MATERIAL\nin float v_height;\nin float v_slope;\nin float v_aspect;\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nin float v_distance;\n#endif\n\n#if defined(GROUND_ATMOSPHERE) || defined(FOG)\nin vec3 v_atmosphereRayleighColor;\nin vec3 v_atmosphereMieColor;\nin float v_atmosphereOpacity;\n#endif\n\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nfloat interpolateByDistance(vec4 nearFarScalar, float distance)\n{\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\n#endif\n\n#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)\n{\n return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\n#endif\n\n#ifdef TRANSLUCENT\nbool inTranslucencyRectangle()\n{\n return\n v_textureCoordinates.x > u_translucencyRectangle.x &&\n v_textureCoordinates.x < u_translucencyRectangle.z &&\n v_textureCoordinates.y > u_translucencyRectangle.y &&\n v_textureCoordinates.y < u_translucencyRectangle.w;\n}\n#endif\n\nvec4 sampleAndBlend(\n vec4 previousColor,\n sampler2D textureToSample,\n vec2 tileTextureCoordinates,\n vec4 textureCoordinateRectangle,\n vec4 textureCoordinateTranslationAndScale,\n float textureAlpha,\n float textureNightAlpha,\n float textureDayAlpha,\n float textureBrightness,\n float textureContrast,\n float textureHue,\n float textureSaturation,\n float textureOneOverGamma,\n float split,\n vec4 colorToAlpha,\n float nightBlend)\n{\n // This crazy step stuff sets the alpha to 0.0 if this following condition is true:\n // tileTextureCoordinates.s < textureCoordinateRectangle.s ||\n // tileTextureCoordinates.s > textureCoordinateRectangle.p ||\n // tileTextureCoordinates.t < textureCoordinateRectangle.t ||\n // tileTextureCoordinates.t > textureCoordinateRectangle.q\n // In other words, the alpha is zero if the fragment is outside the rectangle\n // covered by this texture. Would an actual 'if' yield better performance?\n vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\n textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\n alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\n textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\n textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);\n#endif\n\n vec2 translation = textureCoordinateTranslationAndScale.xy;\n vec2 scale = textureCoordinateTranslationAndScale.zw;\n vec2 textureCoordinates = tileTextureCoordinates * scale + translation;\n vec4 value = texture(textureToSample, textureCoordinates);\n vec3 color = value.rgb;\n float alpha = value.a;\n\n#ifdef APPLY_COLOR_TO_ALPHA\n vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);\n colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);\n alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);\n#endif\n\n#if !defined(APPLY_GAMMA)\n vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));\n color = tempColor.rgb;\n alpha = tempColor.a;\n#else\n color = pow(color, vec3(textureOneOverGamma));\n#endif\n\n#ifdef APPLY_SPLIT\n float splitPosition = czm_splitPosition;\n // Split to the left\n if (split < 0.0 && gl_FragCoord.x > splitPosition) {\n alpha = 0.0;\n }\n // Split to the right\n else if (split > 0.0 && gl_FragCoord.x < splitPosition) {\n alpha = 0.0;\n }\n#endif\n\n#ifdef APPLY_BRIGHTNESS\n color = mix(vec3(0.0), color, textureBrightness);\n#endif\n\n#ifdef APPLY_CONTRAST\n color = mix(vec3(0.5), color, textureContrast);\n#endif\n\n#ifdef APPLY_HUE\n color = czm_hue(color, textureHue);\n#endif\n\n#ifdef APPLY_SATURATION\n color = czm_saturation(color, textureSaturation);\n#endif\n\n float sourceAlpha = alpha * textureAlpha;\n float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\n outAlpha += sign(outAlpha) - 1.0;\n\n vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\n\n // When rendering imagery for a tile in multiple passes,\n // some GPU/WebGL implementation combinations will not blend fragments in\n // additional passes correctly if their computation includes an unmasked\n // divide-by-zero operation,\n // even if it's not in the output or if the output has alpha zero.\n //\n // For example, without sanitization for outAlpha,\n // this renders without artifacts:\n // if (outAlpha == 0.0) { outColor = vec3(0.0); }\n //\n // but using czm_branchFreeTernary will cause portions of the tile that are\n // alpha-zero in the additional pass to render as black instead of blending\n // with the previous pass:\n // outColor = czm_branchFreeTernary(outAlpha == 0.0, vec3(0.0), outColor);\n //\n // So instead, sanitize against divide-by-zero,\n // store this state on the sign of outAlpha, and correct on return.\n\n return vec4(outColor, max(outAlpha, 0.0));\n}\n\nvec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);\n\nconst float fExposure = 2.0;\n\nvec3 computeEllipsoidPosition()\n{\n float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);\n vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);\n xy *= czm_viewport.zw * mpp * 0.5;\n\n vec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));\n czm_ray ray = czm_ray(vec3(0.0), direction);\n\n vec3 ellipsoid_center = czm_view[3].xyz;\n\n czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\n\n vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);\n return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;\n}\n\nvoid main()\n{\n#ifdef TILE_LIMIT_RECTANGLE\n if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||\n v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)\n {\n discard;\n }\n#endif\n\n#ifdef ENABLE_CLIPPING_PLANES\n float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n#endif\n\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)\n vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates\n vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordinates\n#endif\n\n#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)\n float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);\n#else\n float nightBlend = 0.0;\n#endif\n\n // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0\n // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the\n // fragments on the edges of tiles even though the vertex shader is outputting\n // coordinates strictly in the 0-1 range.\n vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);\n\n#ifdef SHOW_TILE_BOUNDARIES\n if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\n v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n {\n color = vec4(1.0, 0.0, 0.0, 1.0);\n }\n#endif\n\n#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)\n float cameraDist;\n if (czm_sceneMode == czm_sceneMode2D)\n {\n cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;\n }\n else if (czm_sceneMode == czm_sceneModeColumbusView)\n {\n cameraDist = -czm_view[3].z;\n }\n else\n {\n cameraDist = length(czm_view[3]);\n }\n float fadeOutDist = u_lightingFadeDistance.x;\n float fadeInDist = u_lightingFadeDistance.y;\n if (czm_sceneMode != czm_sceneMode3D) {\n vec3 radii = czm_ellipsoidRadii;\n float maxRadii = max(radii.x, max(radii.y, radii.z));\n fadeOutDist -= maxRadii;\n fadeInDist -= maxRadii;\n }\n float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n#else\n float fade = 0.0;\n#endif\n\n#ifdef SHOW_REFLECTIVE_OCEAN\n vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\n vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\n vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\n waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\n\n float mask = texture(u_waterMask, waterMaskTextureCoordinates).r;\n\n if (mask > 0.0)\n {\n mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\n\n vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\n vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\n\n vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\n\n color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);\n }\n#endif\n\n#ifdef APPLY_MATERIAL\n czm_materialInput materialInput;\n materialInput.st = v_textureCoordinates.st;\n materialInput.normalEC = normalize(v_normalEC);\n materialInput.positionToEyeEC = -v_positionEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));\n materialInput.slope = v_slope;\n materialInput.height = v_height;\n materialInput.aspect = v_aspect;\n czm_material material = czm_getMaterial(materialInput);\n vec4 materialColor = vec4(material.diffuse, material.alpha);\n color = alphaBlend(materialColor, color);\n#endif\n\n#ifdef ENABLE_VERTEX_LIGHTING\n float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);\n vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\n float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\n diffuseIntensity = mix(1.0, diffuseIntensity, fade);\n vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n#else\n vec4 finalColor = color;\n#endif\n\n#ifdef ENABLE_CLIPPING_PLANES\n vec4 clippingPlanesEdgeColor = vec4(1.0);\n clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\n float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\n\n if (clipDistance < clippingPlanesEdgeWidth)\n {\n finalColor = clippingPlanesEdgeColor;\n }\n#endif\n\n#ifdef ENABLE_CLIPPING_POLYGONS\n vec2 clippingPosition = v_clippingPosition;\n int regionIndex = v_regionIndex;\n clipPolygons(u_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex); \n#endif\n\n#ifdef HIGHLIGHT_FILL_TILE\n finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);\n#endif\n\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\n vec3 atmosphereLightDirection = czm_sunDirectionWC;\n#else\n vec3 atmosphereLightDirection = czm_lightDirectionWC;\n#endif\n\n#if defined(GROUND_ATMOSPHERE) || defined(FOG)\n if (!czm_backFacing())\n {\n bool dynamicLighting = false;\n #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\n dynamicLighting = true;\n #endif\n\n vec3 rayleighColor;\n vec3 mieColor;\n float opacity;\n\n vec3 positionWC;\n vec3 lightDirection;\n\n // When the camera is far away (camera distance > nightFadeOutDistance), the scattering is computed in the fragment shader.\n // Otherwise, the scattering is computed in the vertex shader.\n #ifdef PER_FRAGMENT_GROUND_ATMOSPHERE\n positionWC = computeEllipsoidPosition();\n lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));\n computeAtmosphereScattering(\n positionWC,\n lightDirection,\n rayleighColor,\n mieColor,\n opacity\n );\n #else\n positionWC = v_positionMC;\n lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));\n rayleighColor = v_atmosphereRayleighColor;\n mieColor = v_atmosphereMieColor;\n opacity = v_atmosphereOpacity;\n #endif\n\n #ifdef COLOR_CORRECT\n const bool ignoreBlackPixels = true;\n rayleighColor = czm_applyHSBShift(rayleighColor, u_hsbShift, ignoreBlackPixels);\n mieColor = czm_applyHSBShift(mieColor, u_hsbShift, ignoreBlackPixels);\n #endif\n\n vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);\n\n // Fog is applied to tiles selected for fog, close to the Earth.\n #ifdef FOG\n vec3 fogColor = groundAtmosphereColor.rgb;\n\n // If there is lighting, apply that to the fog.\n #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\n float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);\n fogColor *= darken;\n #endif\n\n #ifndef HDR\n fogColor.rgb = czm_acesTonemapping(fogColor.rgb);\n fogColor.rgb = czm_inverseGamma(fogColor.rgb);\n #endif\n\n const float modifier = 0.15;\n finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a);\n\n #else\n // Apply ground atmosphere. This happens when the camera is far away from the earth.\n\n // The transmittance is based on optical depth i.e. the length of segment of the ray inside the atmosphere.\n // This value is larger near the \"circumference\", as it is further away from the camera. We use it to\n // brighten up that area of the ground atmosphere.\n const float transmittanceModifier = 0.5;\n float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0);\n\n vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance;\n\n #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\n float fadeInDist = u_nightFadeDistance.x;\n float fadeOutDist = u_nightFadeDistance.y;\n\n float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0);\n float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0);\n vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken);\n\n finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity);\n #endif\n\n #ifndef HDR\n finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb);\n #else\n finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6);\n #endif\n\n finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade);\n #endif\n }\n#endif\n\n#ifdef UNDERGROUND_COLOR\n if (czm_backFacing())\n {\n float distanceFromEllipsoid = max(czm_eyeHeight, 0.0);\n float distance = max(v_distance - distanceFromEllipsoid, 0.0);\n float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);\n vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);\n finalColor = alphaBlend(undergroundColor, finalColor);\n }\n#endif\n\n#ifdef TRANSLUCENT\n if (inTranslucencyRectangle())\n {\n vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;\n finalColor.a *= interpolateByDistance(alphaByDistance, v_distance);\n }\n#endif\n\n out_FragColor = finalColor;\n}\n\n\n#ifdef SHOW_REFLECTIVE_OCEAN\n\nfloat waveFade(float edge0, float edge1, float x)\n{\n float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n return pow(1.0 - y, 5.0);\n}\n\nfloat linearFade(float edge0, float edge1, float x)\n{\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\n// Based on water rendering by Jonas Wagner:\n// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\n// low altitude wave settings\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\n\n// high altitude wave settings\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\n\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)\n{\n vec3 positionToEyeEC = -positionEyeCoordinates;\n float positionToEyeECLength = length(positionToEyeEC);\n\n // The double normalize below works around a bug in Firefox on Android devices.\n vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));\n\n // Fade out the waves as the camera moves far from the surface.\n float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n\n#ifdef SHOW_OCEAN_WAVES\n // high altitude waves\n float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\n vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\n vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\n\n // low altitude waves\n time = czm_frameNumber * oceanAnimationSpeedLowAltitude;\n noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\n vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\n\n // blend the 2 wave layers based on distance to surface\n float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\n float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\n vec3 normalTangentSpace =\n (highAltitudeFade * normalTangentSpaceHighAltitude) +\n (lowAltitudeFade * normalTangentSpaceLowAltitude);\n normalTangentSpace = normalize(normalTangentSpace);\n\n // fade out the normal perturbation as we move farther from the water surface\n normalTangentSpace.xy *= waveIntensity;\n normalTangentSpace = normalize(normalTangentSpace);\n#else\n vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\n\n vec3 normalEC = enuToEye * normalTangentSpace;\n\n const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\n\n // Use diffuse light to highlight the waves\n float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;\n vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);\n\n#ifdef SHOW_OCEAN_WAVES\n // Where diffuse light is low or non-existent, use wave highlights based solely on\n // the wave bumpiness and no particular light direction.\n float tsPerturbationRatio = normalTangentSpace.z;\n vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\n vec3 nonDiffuseHighlight = vec3(0.0);\n#endif\n\n // Add specular highlights in 3D, and in all modes when zoomed in.\n float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);\n float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\n float specular = specularIntensity * surfaceReflectance;\n\n#ifdef HDR\n specular *= 1.4;\n\n float e = 0.2;\n float d = 3.3;\n float c = 1.7;\n\n vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));\n#else\n vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;\n#endif\n\n return vec4(color, imageryColor.a);\n}\n\n#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n"),e._surfaceShaderSet.baseVertexShaderSource=new bc({sources:[H8,W8,"#ifdef QUANTIZATION_BITS12\nin vec4 compressed0;\nin float compressed1;\n#else\nin vec4 position3DAndHeight;\nin vec4 textureCoordAndEncodedNormals;\n#endif\n\n#ifdef GEODETIC_SURFACE_NORMALS\nin vec3 geodeticSurfaceNormal;\n#endif\n\n#ifdef EXAGGERATION\nuniform vec2 u_verticalExaggerationAndRelativeHeight;\n#endif\n\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform mat4 u_modifiedModelViewProjection;\nuniform vec4 u_tileRectangle;\n\n// Uniforms for 2D Mercator projection\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\n\nout vec3 v_positionMC;\nout vec3 v_positionEC;\n\nout vec3 v_textureCoordinates;\nout vec3 v_normalMC;\nout vec3 v_normalEC;\n\n#ifdef APPLY_MATERIAL\nout float v_slope;\nout float v_aspect;\nout float v_height;\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nout float v_distance;\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nout vec3 v_atmosphereRayleighColor;\nout vec3 v_atmosphereMieColor;\nout float v_atmosphereOpacity;\n#endif\n\n#ifdef ENABLE_CLIPPING_POLYGONS\nuniform highp sampler2D u_clippingExtents;\nout vec2 v_clippingPosition;\nflat out int v_regionIndex;\n#endif\n\n// These functions are generated at runtime.\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\n\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\n return u_modifiedModelViewProjection * vec4(position, 1.0);\n}\n\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\n // The width of a tile at level 11, in radians and assuming a single root tile, is\n // 2.0 * czm_pi / pow(2.0, 11.0)\n // We want to just linearly interpolate the 2D position from the texture coordinates\n // when we're at this level or higher. The constant below is the expression\n // above evaluated and then rounded up at the 4th significant digit.\n const float maxTileWidth = 0.003068;\n float positionFraction = textureCoordinates.y;\n float southLatitude = u_southAndNorthLatitude.x;\n float northLatitude = u_southAndNorthLatitude.y;\n if (northLatitude - southLatitude > maxTileWidth)\n {\n float southMercatorY = u_southMercatorYAndOneOverHeight.x;\n float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\n\n float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\n currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\n positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n }\n return positionFraction;\n}\n\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\n return textureCoordinates.y;\n}\n\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\n float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n return u_modifiedModelViewProjection * rtcPosition2D;\n}\n\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\n return getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\n\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\n return getPositionPlanarEarth(position, height, textureCoordinates);\n}\n\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\n // We do not do RTC while morphing, so there is potential for jitter.\n // This is unlikely to be noticeable, though.\n vec3 position3DWC = position + u_center3D;\n float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\n return czm_modelViewProjection * morphPosition;\n}\n\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\n\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\n vec2 xy = czm_decompressTextureCoordinates(compressed0.x);\n vec2 zh = czm_decompressTextureCoordinates(compressed0.y);\n vec3 position = vec3(xy, zh.x);\n float height = zh.y;\n vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\n\n height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\n position = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y) || defined(APPLY_MATERIAL)\n float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n float encodedNormal = compressed1;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n float encodedNormal = 0.0;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = compressed0.w;\n#else\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = 0.0;\n#endif\n\n#else\n // A single float per element\n vec3 position = position3DAndHeight.xyz;\n float height = position3DAndHeight.w;\n vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = textureCoordAndEncodedNormals.z;\n float encodedNormal = textureCoordAndEncodedNormals.w;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = textureCoordAndEncodedNormals.z;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = textureCoordAndEncodedNormals.z;\n float encodedNormal = 0.0;\n#else\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = 0.0;\n#endif\n\n#endif\n\n vec3 position3DWC = position + u_center3D;\n\n#ifdef GEODETIC_SURFACE_NORMALS\n vec3 ellipsoidNormal = geodeticSurfaceNormal;\n#else\n vec3 ellipsoidNormal = normalize(position3DWC);\n#endif\n\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\n float exaggeration = u_verticalExaggerationAndRelativeHeight.x;\n float relativeHeight = u_verticalExaggerationAndRelativeHeight.y;\n float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;\n\n // stop from going through center of earth\n float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);\n newHeight = max(newHeight, -minRadius);\n\n vec3 offset = ellipsoidNormal * (newHeight - height);\n position += offset;\n position3DWC += offset;\n height = newHeight;\n#endif\n\n gl_Position = getPosition(position, height, textureCoordinates);\n\n v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n v_positionMC = position3DWC; // position in model coordinates\n\n v_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n\n#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n vec3 normalMC = czm_octDecode(encodedNormal);\n\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\n vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;\n vec3 rejection = normalMC - projection;\n normalMC = normalize(projection + rejection * exaggeration);\n#endif\n\n v_normalMC = normalMC;\n v_normalEC = czm_normal3D * v_normalMC;\n#endif\n\n#ifdef ENABLE_CLIPPING_POLYGONS\n vec2 sphericalLatLong = czm_approximateSphericalCoordinates(position3DWC);\n sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\n \n vec2 minDistance = vec2(czm_infinity);\n v_clippingPosition = vec2(czm_infinity);\n v_regionIndex = -1;\n\n for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {\n vec4 extents = unpackClippingExtents(u_clippingExtents, regionIndex);\n vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;\n\n vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));\n vec2 distance = abs(rectUv - clamped) * extents.wz;\n\n float threshold = 0.01;\n if (minDistance.x > distance.x || minDistance.y > distance.y) {\n minDistance = distance;\n v_clippingPosition = rectUv;\n if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {\n v_regionIndex = regionIndex;\n }\n }\n }\n#endif\n\n#if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))\n\n bool dynamicLighting = false;\n\n #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\n dynamicLighting = true;\n #endif\n\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\n vec3 atmosphereLightDirection = czm_sunDirectionWC;\n#else\n vec3 atmosphereLightDirection = czm_lightDirectionWC;\n#endif\n\n vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));\n\n computeAtmosphereScattering(\n position3DWC,\n lightDirection,\n v_atmosphereRayleighColor,\n v_atmosphereMieColor,\n v_atmosphereOpacity\n );\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\n v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n\n#ifdef APPLY_MATERIAL\n float northPoleZ = czm_ellipsoidRadii.z;\n vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\n vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\n float dotProd = abs(dot(ellipsoidNormal, v_normalMC));\n v_slope = acos(dotProd);\n vec3 normalRejected = ellipsoidNormal * dotProd;\n vec3 normalProjected = v_normalMC - normalRejected;\n vec3 aspectVector = normalize(normalProjected);\n v_aspect = acos(dot(aspectVector, vectorEastMC));\n float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\n v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\n v_height = height;\n#endif\n}\n"],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new bc({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}Object.defineProperties(Nte.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!D(this._surface)||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}},clippingPolygons:{get:function(){return this._surface.tileProvider.clippingPolygons},set:function(e){this._surface.tileProvider.clippingPolygons=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){D(e)||(e=Ir.clone(Ir.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),D(this._material)&&Rte(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,Rte(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=Ot.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){if(D(e)&&e.far<e.near)throw new P("far distance must be greater than near distance.");this._undergroundColorAlphaByDistance=Au.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});const Lte=[],Mte={start:0,stop:0};Nte.prototype.pickWorldCoordinates=function(e,t,n,i){if(!D(e))throw new P("ray is required");if(!D(t))throw new P("scene is required");n=M(n,!0);const o=t.mode,r=t.mapProjection,s=Lte;s.length=0;const a=this._surface._tilesToRender;let c,l,u=a.length;for(l=0;l<u;++l){c=a[l];const t=c.data;if(!D(t))continue;let n=t.pickBoundingSphere;if(o!==gl.SCENE3D)t.pickBoundingSphere=n=$u.fromRectangleWithHeights2D(c.rectangle,r,t.tileBoundingRegion.minimumHeight,t.tileBoundingRegion.maximumHeight,n),H.fromElements(n.center.z,n.center.x,n.center.y,n.center);else{if(!D(t.renderedMesh))continue;$u.clone(t.tileBoundingRegion.boundingSphere,n)}D(Pp.raySphere(e,n,Mte))&&s.push(t)}var d;let h;for(s.sort((d=e.origin,function(e,t){return $u.distanceSquaredTo(e.pickBoundingSphere,d)-$u.distanceSquaredTo(t.pickBoundingSphere,d)})),u=s.length,l=0;l<u&&(h=s[l].pick(e,t.mode,t.mapProjection,n,i),!D(h));++l);return h};const Fte=new Qt;Nte.prototype.pick=function(e,t,n){if(D(n=this.pickWorldCoordinates(e,t,!0,n))&&t.mode!==gl.SCENE3D){n=H.fromElements(n.y,n.z,n.x,n);const e=t.mapProjection.unproject(n,Fte);n=t.globe.ellipsoid.cartographicToCartesian(e,n)}return n};const Bte=new H,zte=new H,Ute=new Qt,kte=new tp;function Vte(e,t){return D(e)&&Ir.contains(e.rectangle,t)?e:void 0}function Hte(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}Nte.prototype.getHeight=function(e){if(!D(e))throw new P("cartographic is required");const t=this._surface._levelZeroTiles;if(!D(t))return;let n,i;const o=t.length;for(i=0;i<o&&(n=t[i],!Ir.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;D(n);)n=Vte(n._southwestChild,e)||Vte(n._southeastChild,e)||Vte(n._northwestChild,e)||n._northeastChild,D(n)&&D(n.data)&&D(n.data.renderedMesh)&&(r=n);if(n=r,!D(n)||!D(n.data)||!D(n.data.renderedMesh))return;const s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,c=H.fromRadians(e.longitude,e.latitude,0,a,Bte),l=kte,u=a.geodeticSurfaceNormal(c,l.direction);if(!D(a.getSurfaceNormalIntersectionWithZAxis(c,11500,l.origin))){let e;D(n.data.tileBoundingRegion)&&(e=n.data.tileBoundingRegion.minimumHeight);const t=Math.min(M(e,0),-11500),i=H.multiplyByScalar(u,Math.abs(t)+1,zte);H.subtract(c,i,l.origin)}const d=n.data.pick(l,void 0,s,!1,zte);return D(d)?a.cartesianToCartographic(d,Ute).height:void 0},Nte.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)},Nte.prototype.beginFrame=function(e){const t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=this.showWaterEffect&&D(i)&&i.hasWaterMask&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const t=this._oceanNormalMapResource,n=t.url;if(D(n)){const i=this;t.fetchImage().then((function(t){n===i._oceanNormalMapResource.url&&(i._oceanNormalMap=i._oceanNormalMap&&i._oceanNormalMap.destroy(),i._oceanNormalMap=new Sc({context:e.context,source:t}))}))}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const r=e.passes,s=e.mode;r.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,t.maximumScreenSpaceError=this.maximumScreenSpaceError,t.tileCacheSize=this.tileCacheSize,t.loadingDescendantLimit=this.loadingDescendantLimit,t.preloadAncestors=this.preloadAncestors,t.preloadSiblings=this.preloadSiblings,n.terrainProvider=this.terrainProvider,n.lightingFadeOutDistance=this.lightingFadeOutDistance,n.lightingFadeInDistance=this.lightingFadeInDistance,n.nightFadeOutDistance=this.nightFadeOutDistance,n.nightFadeInDistance=this.nightFadeInDistance,n.zoomedOutOceanSpecularIntensity=s===gl.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=o,n.oceanNormalMap=this._oceanNormalMap,n.enableLighting=this.enableLighting,n.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,n.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,n.showGroundAtmosphere=this.showGroundAtmosphere,n.atmosphereLightIntensity=this.atmosphereLightIntensity,n.atmosphereRayleighCoefficient=this.atmosphereRayleighCoefficient,n.atmosphereMieCoefficient=this.atmosphereMieCoefficient,n.atmosphereRayleighScaleHeight=this.atmosphereRayleighScaleHeight,n.atmosphereMieScaleHeight=this.atmosphereMieScaleHeight,n.atmosphereMieAnisotropy=this.atmosphereMieAnisotropy,n.shadows=this.shadows,n.hueShift=this.atmosphereHueShift,n.saturationShift=this.atmosphereSaturationShift,n.brightnessShift=this.atmosphereBrightnessShift,n.fillHighlightColor=this.fillHighlightColor,n.showSkirts=this.showSkirts,n.backFaceCulling=this.backFaceCulling,n.vertexShadowDarkness=this.vertexShadowDarkness,n.undergroundColor=this._undergroundColor,n.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,n.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))},Nte.prototype.render=function(e){this.show&&(D(this._material)&&this._material.update(e.context),this._surface.render(e))},Nte.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)},Nte.prototype.isDestroyed=function(){return!1},Nte.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(),He(this)};const Gte={},jte=-.0529921,Wte=-.1059842,qte=13.0120009,Yte=13.3407154,Xte=.9856003,Qte=26.4057084,$te=13.064993,Kte=.3287146,Zte=1.7484877,Jte=-.1589763,ene=.0036096,tne=.1643573,nne=12.9590088;let ine=new Hn;Gte.ComputeMoon=function(e,t){D(e)||(e=Hn.now()),ine=Hn.addSeconds(e,32.184,ine);const n=Hn.totalDays(ine)-2451545,i=n/Tn.DAYS_PER_JULIAN_CENTURY,o=(125.045+jte*n)*V.RADIANS_PER_DEGREE,r=(250.089+Wte*n)*V.RADIANS_PER_DEGREE,s=(260.008+qte*n)*V.RADIANS_PER_DEGREE,a=(176.625+Yte*n)*V.RADIANS_PER_DEGREE,c=(357.529+Xte*n)*V.RADIANS_PER_DEGREE,l=(311.589+Qte*n)*V.RADIANS_PER_DEGREE,u=(134.963+$te*n)*V.RADIANS_PER_DEGREE,d=(276.617+Kte*n)*V.RADIANS_PER_DEGREE,h=(34.226+Zte*n)*V.RADIANS_PER_DEGREE,p=(15.134+Jte*n)*V.RADIANS_PER_DEGREE,f=(119.743+ene*n)*V.RADIANS_PER_DEGREE,m=(239.961+tne*n)*V.RADIANS_PER_DEGREE,_=(25.053+nne*n)*V.RADIANS_PER_DEGREE,g=Math.sin(o),y=Math.sin(r),b=Math.sin(s),v=Math.sin(a),A=Math.sin(c),T=Math.sin(l),w=Math.sin(u),E=Math.sin(d),x=Math.sin(h),S=Math.sin(p),C=Math.sin(f),I=Math.sin(m),O=Math.sin(_),P=Math.cos(o),N=Math.cos(r),R=Math.cos(s),L=Math.cos(a),M=Math.cos(c),F=Math.cos(l),B=Math.cos(u),z=Math.cos(d),U=Math.cos(h),k=Math.cos(p),H=Math.cos(f),G=Math.cos(m),j=Math.cos(_),W=(269.9949+.0031*i-3.8787*g-.1204*y+.07*b-.0172*v+.0072*T-.0052*S+.0043*O)*V.RADIANS_PER_DEGREE,q=(66.5392+.013*i+1.5419*P+.0239*N-.0278*R+.0068*L-.0029*F+9e-4*B+8e-4*k-9e-4*j)*V.RADIANS_PER_DEGREE,Y=(38.3213+13.17635815*n-14e-13*n*n+3.561*g+.1208*y-.0642*b+.0158*v+.0252*A-.0066*T-.0047*w-.0046*E+.0028*x+.0052*S+.004*C+.0019*I-.0044*O)*V.RADIANS_PER_DEGREE,X=(13.17635815-2*n*14e-13+3.561*P*jte+.1208*N*Wte-.0642*R*qte+.0158*L*Yte+.0252*M*Xte-.0066*F*Qte-.0047*B*$te-.0046*z*Kte+.0028*U*Zte+.0052*k*Jte+.004*H*ene+.0019*G*tne-.0044*j*nne)/86400*V.RADIANS_PER_DEGREE;return D(t)||(t=new Hte),t.rightAscension=W,t.declination=q,t.rotation=Y,t.rotationRate=X,t};const one=Gte;function rne(e){D(e)&&"function"==typeof e||(e=one.ComputeMoon),this._computeFunction=e}const sne=new H,ane=new H,cne=new H;const lne=new re,une=new _o;rne.prototype.evaluate=function(e,t){D(e)||(e=Hn.now());const n=this._computeFunction(e),i=function(e,t,n){const i=sne;i.x=Math.cos(e+V.PI_OVER_TWO),i.y=Math.sin(e+V.PI_OVER_TWO),i.z=0;const o=Math.cos(t),r=cne;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);const s=H.cross(r,i,ane);return D(n)||(n=new re),n[0]=i.x,n[1]=s.x,n[2]=r.x,n[3]=i.y,n[4]=s.y,n[5]=r.y,n[6]=i.z,n[7]=s.z,n[8]=r.z,n}(n.rightAscension,n.declination,t),o=V.zeroToTwoPi(n.rotation),r=_o.fromAxisAngle(H.UNIT_Z,o,une),s=re.fromQuaternion(_o.conjugate(r,r),lne);return re.multiply(s,i,i)};const dne={position:0};function hne(e){e=M(e,M.EMPTY_OBJECT),this.center=H.clone(M(e.center,H.ZERO)),this._center=new H,this.radii=H.clone(e.radii),this._radii=new H,this._oneOverEllipsoidRadiiSquared=new H,this._boundingSphere=new $u,this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._modelMatrix=new ve,this._computedModelMatrix=new ve,this.show=M(e.show,!0),this.material=M(e.material,mh.fromType(mh.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=M(e.debugShowBoundingVolume,!1),this.onlySunLighting=M(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=M(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 Kr({owner:M(e._owner,this)}),this._pickCommand=new Kr({owner:M(e._owner,this),pickOnly:!0});const t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function pne(e){let t=(e=M(e,M.EMPTY_OBJECT)).textureUrl;D(t)||(t=lo("Assets/Textures/moonSmall.jpg")),this.show=M(e.show,!0),this.textureUrl=t,this._ellipsoid=M(e.ellipsoid,on.MOON),this.onlySunLighting=M(e.onlySunLighting,!0),this._ellipsoidPrimitive=new hne({radii:this.ellipsoid.radii,material:mh.fromType(mh.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new rne}hne.prototype.update=function(e){if(!this.show||e.mode!==gl.SCENE3D||!D(this.center)||!D(this.radii))return;if(!D(this.material))throw new P("this.material must be defined.");const t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;D(this._rs)&&!i||(this._translucent=n,this._rs=_s.fromCache({cull:{enabled:!0,face:ph.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?dh.ALPHA_BLEND:void 0})),D(this._va)||(this._va=function(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(D(t))return t;const n=Ud.createGeometry(Ud.fromDimensions({dimensions:new H(2,2,2),vertexFormat:Bd.POSITION_ONLY}));return t=kl.fromGeometry({context:e,geometry:n,attributeLocations:dne,bufferUsage:qe.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}(t));let o=!1;const r=this.radii;if(!H.equals(this._radii,r)){H.clone(r,this._radii);const e=this._oneOverEllipsoidRadiiSquared;e.x=1/(r.x*r.x),e.y=1/(r.y*r.y),e.z=1/(r.z*r.z),o=!0}ve.equals(this.modelMatrix,this._modelMatrix)&&H.equals(this.center,this._center)||(ve.clone(this.modelMatrix,this._modelMatrix),H.clone(this.center,this._center),ve.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(H.clone(H.ZERO,this._boundingSphere.center),this._boundingSphere.radius=H.maximumComponent(r),$u.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const s=this._material!==this.material;this._material=this.material,this._material.update(t);const a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const c=e.useLogDepth,l=this._useLogDepth!==c;this._useLogDepth=c;const u=this._colorCommand;let d,h;(s||a||i||l)&&(d=new bc({sources:[j8]}),h=new bc({sources:[this.material.shaderSource,G8]}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH")),this._sp=ya.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:dne}),u.vertexArray=this._va,u.renderState=this._rs,u.shaderProgram=this._sp,u.uniformMap=ni(this._uniforms,this.material._uniforms),u.executeInClosestFrustum=n);const p=e.commandList,f=e.passes;if(f.render&&(u.boundingVolume=this._boundingSphere,u.debugShowBoundingVolume=this.debugShowBoundingVolume,u.modelMatrix=this._computedModelMatrix,u.pass=n?zt.TRANSLUCENT:zt.OPAQUE,p.push(u)),f.pick){const e=this._pickCommand;D(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(s||a||!D(this._pickSP)||l)&&(d=new bc({sources:[j8]}),h=new bc({sources:[this.material.shaderSource,G8],pickColorQualifier:"uniform"}),this.onlySunLighting&&h.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&h.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),h.defines.push("LOG_DEPTH")),this._pickSP=ya.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:h,attributeLocations:dne}),e.vertexArray=this._va,e.renderState=this._rs,e.shaderProgram=this._pickSP,e.uniformMap=ni(ni(this._uniforms,this._pickUniforms),this.material._uniforms),e.executeInClosestFrustum=n),e.boundingVolume=this._boundingSphere,e.modelMatrix=this._computedModelMatrix,e.pass=n?zt.TRANSLUCENT:zt.OPAQUE,p.push(e)}},hne.prototype.isDestroyed=function(){return!1},hne.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(),He(this)},Object.defineProperties(pne.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const fne=new re,mne=new re,_ne=new H,gne=[];pne.prototype.update=function(e){if(!this.show)return;const t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;const n=e.time;D(Cr.computeIcrfToFixedMatrix(n,fne))||Cr.computeTemeToPseudoFixedMatrix(n,fne);const i=this._axes.evaluate(n,mne);re.transpose(i,i),re.multiply(fne,i,i);const o=ml.computeMoonPositionInEarthInertialFrame(n,_ne);re.multiplyByVector(fne,o,o),ve.fromRotationTranslation(i,o,t.modelMatrix);const r=e.commandList;return e.commandList=gne,gne.length=0,t.update(e),e.commandList=r,1===gne.length?gne[0]:void 0},pne.prototype.isDestroyed=function(){return!1},pne.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),He(this)};const yne=[],bne=[];function vne(e,t,n,i,o){if(i>=o)return;const r=Math.floor(.5*(i+o));vne(e,t,n,i,r),vne(e,t,n,r+1,o),function(e,t,n,i,o,r){const s=o-i+1,a=r-o,c=yne,l=bne;let u,d;for(u=0;u<s;++u)c[u]=e[i+u];for(d=0;d<a;++d)l[d]=e[o+d+1];u=0,d=0;for(let h=i;h<=r;++h){const i=c[u],o=l[d];u<s&&(d>=a||t(i,o,n)<=0)?(e[h]=i,++u):d<a&&(e[h]=o,++d)}}(e,t,n,i,r,o)}function Ane(e,t,n){if(!D(e))throw new P("array is required.");if(!D(t))throw new P("comparator is required.");const i=e.length,o=Math.ceil(.5*i);yne.length=o,bne.length=o,vne(e,t,n,0,i-1),yne.length=0,bne.length=0}function Tne(e,t){if(!D(e))throw new P("occluderBoundingSphere is required.");if(!D(t))throw new P("camera position is required.");this._occluderPosition=H.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}const wne=new H;Object.defineProperties(Tne.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){if(!D(e))throw new P("cameraPosition is required.");e=H.clone(e,this._cameraPosition);const t=H.subtract(this._occluderPosition,e,wne);let n=H.magnitudeSquared(t);const i=this._occluderRadius*this._occluderRadius;let o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=H.multiplyByScalar(t,n,wne);const a=o*o*n;s=H.add(e,H.multiplyByScalar(r,a,wne),wne)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}}),Tne.fromBoundingSphere=function(e,t,n){if(!D(e))throw new P("occluderBoundingSphere is required.");if(!D(t))throw new P("camera position is required.");return D(n)?(H.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new Tne(e,t)};const Ene=new H;Tne.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=H.subtract(e,this._occluderPosition,Ene),n=this._occluderRadius;if(n=H.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=H.subtract(e,this._cameraPosition,t),n*n>H.magnitudeSquared(t)}return!1};const xne=new H;Tne.prototype.isBoundingSphereVisible=function(e){const t=H.clone(e.center,xne),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let e=H.subtract(t,this._occluderPosition,Ene),i=this._occluderRadius-n;if(i=H.magnitudeSquared(e)-i*i,n<this._occluderRadius)return i>0&&(i=Math.sqrt(i)+this._horizonDistance,e=H.subtract(t,this._cameraPosition,e),i*i+n*n>H.magnitudeSquared(e));if(i>0){e=H.subtract(t,this._cameraPosition,e);const o=H.magnitudeSquared(e),r=this._occluderRadius*this._occluderRadius,s=n*n;return(this._horizonDistance*this._horizonDistance+r)*s>o*r||(i=Math.sqrt(i)+this._horizonDistance,i*i+s>o)}return!0}return!1};const Sne=new H;Tne.prototype.computeVisibility=function(e){if(!D(e))throw new P("occludeeBS is required.");const t=H.clone(e.center),n=e.radius;if(n>this._occluderRadius)return B9.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let e=H.subtract(t,this._occluderPosition,Sne),i=this._occluderRadius-n;const o=H.magnitudeSquared(e);if(i=o-i*i,i>0){i=Math.sqrt(i)+this._horizonDistance,e=H.subtract(t,this._cameraPosition,e);const r=H.magnitudeSquared(e);return i*i+n*n<r?B9.NONE:(i=this._occluderRadius+n,i=o-i*i,i>0?(i=Math.sqrt(i)+this._horizonDistance,r<i*i+n*n?B9.FULL:B9.PARTIAL):(e=H.subtract(t,this._horizonPlanePosition,e),H.dot(e,this._horizonPlaneNormal)>-n?B9.PARTIAL:B9.FULL))}}return B9.NONE};const Cne=new H;Tne.computeOccludeePoint=function(e,t,n){if(!D(e))throw new P("occluderBoundingSphere is required.");if(!D(n))throw new P("positions is required.");if(0===n.length)throw new P("positions must contain at least one element");const i=H.clone(t),o=H.clone(e.center),r=e.radius,s=n.length;if(H.equals(o,t))throw new P("occludeePosition must be different than occluderBoundingSphere.center");const a=H.normalize(H.subtract(i,o,Cne),Cne),c=-H.dot(a,o),l=Tne._anyRotationVector(o,a,c);let u,d=Tne._horizonToPlaneNormalDotProduct(e,a,c,l,n[0]);if(!d)return;for(let p=1;p<s;++p){if(u=Tne._horizonToPlaneNormalDotProduct(e,a,c,l,n[p]),!u)return;u<d&&(d=u)}if(d<.0017453283658983088)return;const h=r/d;return H.add(o,H.multiplyByScalar(a,h,Cne),Cne)};const Ine=[];Tne.computeOccludeePointFromRectangle=function(e,t){if(!D(e))throw new P("rectangle is required.");t=M(t,on.WGS84);const n=Ir.subsample(e,t,0,Ine),i=$u.fromPoints(n),o=H.ZERO;if(!H.equals(o,i.center))return Tne.computeOccludeePoint(new $u(o,t.minimumRadius),i.center,n)};const One=new H;Tne._anyRotationVector=function(e,t,n){const i=H.abs(t,One);let o=i.x>i.y?0:1;(0===o&&i.z>i.x||1===o&&i.z>i.y)&&(o=2);const r=new H;let s;0===o?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=H.UNIT_X):1===o?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=H.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=H.UNIT_Z);const a=(H.dot(t,i)+n)/-H.dot(t,s);return H.normalize(H.subtract(H.add(i,H.multiplyByScalar(s,a,r),i),e,i),i)};const Dne=new H;Tne._rotationVector=function(e,t,n,i,o){let r=H.subtract(i,e,Dne);if(r=H.normalize(r,r),H.dot(t,r)<.9999999847691291){const e=H.cross(t,r,r);if(H.magnitude(e)>V.EPSILON13)return H.normalize(e,new H)}return o};const Pne=new H,Nne=new H,Rne=new H,Lne=new H;function Mne(e){e=M(e,M.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=M(e.near,1),this._near=this.near,this.far=M(e.far,5e8),this._far=this.far,this._cullingVolume=new Bc,this._perspectiveMatrix=new ve,this._infinitePerspective=new ve}function Fne(e){if(!(D(e.right)&&D(e.left)&&D(e.top)&&D(e.bottom)&&D(e.near)&&D(e.far)))throw new P("right, left, top, bottom, near, or far parameters are not set.");const t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,s=e.far;if(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far){if(e.near<=0||e.near>e.far)throw new P("near must be greater than zero and less than far.");e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=ve.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=ve.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective)}}Tne._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){const r=H.clone(o,Pne),s=H.clone(e.center,Nne),a=e.radius;let c=H.subtract(s,r,Rne);const l=H.magnitudeSquared(c),u=a*a;if(l<u)return!1;const d=l-u,h=Math.sqrt(d),p=h*(1/Math.sqrt(l))*h;c=H.normalize(c,c);const f=H.add(r,H.multiplyByScalar(c,p,Lne),Lne),m=Math.sqrt(d-p*p);let _=this._rotationVector(s,t,n,r,i),g=H.fromElements(_.x*_.x*c.x+(_.x*_.y-_.z)*c.y+(_.x*_.z+_.y)*c.z,(_.x*_.y+_.z)*c.x+_.y*_.y*c.y+(_.y*_.z-_.x)*c.z,(_.x*_.z-_.y)*c.x+(_.y*_.z+_.x)*c.y+_.z*_.z*c.z,Pne);g=H.normalize(g,g);const y=H.multiplyByScalar(g,m,Pne);_=H.normalize(H.subtract(H.add(f,y,Rne),s,Rne),Rne);const b=H.dot(t,_);_=H.normalize(H.subtract(H.subtract(f,y,_),s,_),_);const v=H.dot(t,_);return b<v?b:v},Object.defineProperties(Mne.prototype,{projectionMatrix:{get:function(){return Fne(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return Fne(this),this._infinitePerspective}}});const Bne=new H,zne=new H,Une=new H,kne=new H;function Vne(e){e=M(e,M.EMPTY_OBJECT),this._offCenterFrustum=new Mne,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=M(e.near,1),this._near=this.near,this.far=M(e.far,5e8),this._far=this.far,this.xOffset=M(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=M(e.yOffset,0),this._yOffset=this.yOffset}function Hne(e){if(!(D(e.fov)&&D(e.aspectRatio)&&D(e.near)&&D(e.far)))throw new P("fov, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset){if(e.fov<0||e.fov>=Math.PI)throw new P("fov must be in the range [0, PI).");if(e.aspectRatio<0)throw new P("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new P("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov: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}}Mne.prototype.computeCullingVolume=function(e,t,n){if(!D(e))throw new P("position is required.");if(!D(t))throw new P("direction is required.");if(!D(n))throw new P("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,l=this.far,u=H.cross(t,n,Bne),d=zne;H.multiplyByScalar(t,c,d),H.add(e,d,d);const h=Une;H.multiplyByScalar(t,l,h),H.add(e,h,h);const p=kne;H.multiplyByScalar(u,a,p),H.add(d,p,p),H.subtract(p,e,p),H.normalize(p,p),H.cross(p,n,p),H.normalize(p,p);let f=i[0];return D(f)||(f=i[0]=new K),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-H.dot(p,e),H.multiplyByScalar(u,s,p),H.add(d,p,p),H.subtract(p,e,p),H.cross(n,p,p),H.normalize(p,p),f=i[1],D(f)||(f=i[1]=new K),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-H.dot(p,e),H.multiplyByScalar(n,r,p),H.add(d,p,p),H.subtract(p,e,p),H.cross(u,p,p),H.normalize(p,p),f=i[2],D(f)||(f=i[2]=new K),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-H.dot(p,e),H.multiplyByScalar(n,o,p),H.add(d,p,p),H.subtract(p,e,p),H.cross(p,u,p),H.normalize(p,p),f=i[3],D(f)||(f=i[3]=new K),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-H.dot(p,e),f=i[4],D(f)||(f=i[4]=new K),f.x=t.x,f.y=t.y,f.z=t.z,f.w=-H.dot(t,d),H.negate(t,p),f=i[5],D(f)||(f=i[5]=new K),f.x=p.x,f.y=p.y,f.z=p.z,f.w=-H.dot(p,h),this._cullingVolume},Mne.prototype.getPixelDimensions=function(e,t,n,i,o){if(Fne(this),!D(e)||!D(t))throw new P("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new P("drawingBufferWidth must be greater than zero.");if(t<=0)throw new P("drawingBufferHeight must be greater than zero.");if(!D(n))throw new P("distance is required.");if(!D(i))throw new P("pixelRatio is required");if(i<=0)throw new P("pixelRatio must be greater than zero.");if(!D(o))throw new P("A result object is required.");const r=1/this.near;let s=this.top*r;const a=2*i*n*s/t;s=this.right*r;const c=2*i*n*s/e;return o.x=c,o.y=a,o},Mne.prototype.clone=function(e){return D(e)||(e=new Mne),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},Mne.prototype.equals=function(e){return D(e)&&e instanceof Mne&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},Mne.prototype.equalsEpsilon=function(e,t,n){return e===this||D(e)&&e instanceof Mne&&V.equalsEpsilon(this.right,e.right,t,n)&&V.equalsEpsilon(this.left,e.left,t,n)&&V.equalsEpsilon(this.top,e.top,t,n)&&V.equalsEpsilon(this.bottom,e.bottom,t,n)&&V.equalsEpsilon(this.near,e.near,t,n)&&V.equalsEpsilon(this.far,e.far,t,n)},Vne.packedLength=6,Vne.pack=function(e,t,n){return L.typeOf.object("value",e),L.defined("array",t),n=M(n,0),t[n++]=e.fov,t[n++]=e.aspectRatio,t[n++]=e.near,t[n++]=e.far,t[n++]=e.xOffset,t[n]=e.yOffset,t},Vne.unpack=function(e,t,n){return L.defined("array",e),t=M(t,0),D(n)||(n=new Vne),n.fov=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t++],n.xOffset=e[t++],n.yOffset=e[t],n},Object.defineProperties(Vne.prototype,{projectionMatrix:{get:function(){return Hne(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return Hne(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return Hne(this),this._fovy}},sseDenominator:{get:function(){return Hne(this),this._sseDenominator}},offCenterFrustum:{get:function(){return Hne(this),this._offCenterFrustum}}}),Vne.prototype.computeCullingVolume=function(e,t,n){return Hne(this),this._offCenterFrustum.computeCullingVolume(e,t,n)},Vne.prototype.getPixelDimensions=function(e,t,n,i,o){return Hne(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)},Vne.prototype.clone=function(e){return D(e)||(e=new Vne),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},Vne.prototype.equals=function(e){return!!(D(e)&&e instanceof Vne)&&(Hne(this),Hne(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))},Vne.prototype.equalsEpsilon=function(e,t,n){return!!(D(e)&&e instanceof Vne)&&(Hne(this),Hne(e),V.equalsEpsilon(this.fov,e.fov,t,n)&&V.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const Gne={NONE:0,SCENE_LIGHT:1,SUNLIGHT:2,fromGlobeFlags:function(e){return e.enableLighting&&e.dynamicAtmosphereLighting?e.dynamicAtmosphereLightingFromSun?Gne.SUNLIGHT:Gne.SCENE_LIGHT:Gne.NONE}},jne=Object.freeze(Gne);function Wne(){this.lightIntensity=10,this.rayleighCoefficient=new H(55e-7,13e-6,284e-7),this.mieCoefficient=new H(21e-6,21e-6,21e-6),this.rayleighScaleHeight=1e4,this.mieScaleHeight=3200,this.mieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.dynamicLighting=jne.NONE}function qne(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(qne.prototype,{colorTexture:{get:function(){return this._colorTexture}}}),qne.prototype.update=function(e){if(!D(this._colorTexture)){const t=e.context,n=new Sc({context:t,width:256,height:256,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,sampler:uc.NEAREST});this._colorTexture=n;const i=new cs({context:t,colorTextures:[n],destroyAttachments:!1});!function(e,t,n){const i=t.createViewportQuadCommand("in vec2 v_textureCoordinates;\nconst float M_PI = 3.141592653589793;\n\nfloat vdcRadicalInverse(int i)\n{\n float r;\n float base = 2.0;\n float value = 0.0;\n float invBase = 1.0 / base;\n float invBi = invBase;\n for (int x = 0; x < 100; x++)\n {\n if (i <= 0)\n {\n break;\n }\n r = mod(float(i), base);\n value += r * invBi;\n invBi *= invBase;\n i = int(float(i) * invBase);\n }\n return value;\n}\n\nvec2 hammersley2D(int i, int N)\n{\n return vec2(float(i) / float(N), vdcRadicalInverse(i));\n}\n\nvec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n{\n float a = roughness * roughness;\n float phi = 2.0 * M_PI * xi.x;\n float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\n vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n vec3 tangentX = normalize(cross(upVector, N));\n vec3 tangentY = cross(N, tangentX);\n return tangentX * H.x + tangentY * H.y + N * H.z;\n}\n\nfloat G1_Smith(float NdotV, float k)\n{\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\nfloat G_Smith(float roughness, float NdotV, float NdotL)\n{\n float k = roughness * roughness / 2.0;\n return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n}\n\nvec2 integrateBrdf(float roughness, float NdotV)\n{\n vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\n float A = 0.0;\n float B = 0.0;\n const int NumSamples = 1024;\n for (int i = 0; i < NumSamples; i++)\n {\n vec2 xi = hammersley2D(i, NumSamples);\n vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\n vec3 L = 2.0 * dot(V, H) * H - V;\n float NdotL = clamp(L.z, 0.0, 1.0);\n float NdotH = clamp(H.z, 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n if (NdotL > 0.0)\n {\n float G = G_Smith(roughness, NdotV, NdotL);\n float G_Vis = G * VdotH / (NdotH * NdotV);\n float Fc = pow(1.0 - VdotH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n return vec2(A, B) / float(NumSamples);\n}\n\nvoid main()\n{\n out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n}\n",{framebuffer:n,renderState:_s.fromCache({viewport:new Fr(0,0,256,256)})});e._drawCommand=i}(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}},qne.prototype.isDestroyed=function(){return!1},qne.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),He(this)};const Yne={};const Xne=new H,Qne=new H;function $ne(e,t,n,i){if(D(i)&&n(.5)>i){const i=n(0),o=n(1),r=n(.5),s=r-i,a=r-o;return function(r){const c=n(r);if(r<=.5){const t=(c-i)/s;return V.lerp(e,-V.PI_OVER_TWO,t)}const l=(c-o)/a;return V.lerp(-V.PI_OVER_TWO,t,1-l)}}return function(n){return V.lerp(e,t,n)}}function Kne(e,t,n,i,o){let r=o;const s=Math.max(n,i);if(!D(r)){const n=e.position,i=t,o=e.up,s=e.right,a=e.frustum,c=H.subtract(n,i,Xne),l=H.magnitude(H.multiplyByScalar(o,H.dot(c,o),Qne)),u=H.magnitude(H.multiplyByScalar(s,H.dot(c,s),Qne));r=Math.min(.2*function(e,t,n){let i,o,r;if(e instanceof Vne){const s=Math.tan(.5*e.fovy);return i=e.near,o=e.near*s,r=e.aspectRatio*o,Math.max(t*i/r,n*i/o)}return e instanceof Mne?(i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o)):Math.max(t,n)}(a,l,u),1e9)}if(s<r){const e=8,t=1e6,o=-Math.pow((r-n)*t,1/e),s=Math.pow((r-i)*t,1/e);return function(n){const i=n*(s-o)+o;return-Math.pow(i,e)/t+r}}return function(e){return V.lerp(n,i,e)}}function Zne(e,t){return V.equalsEpsilon(e,V.TWO_PI,V.EPSILON11)&&(e=0),t>e+Math.PI?e+=V.TWO_PI:t<e-Math.PI&&(e-=V.TWO_PI),e}const Jne=new H;function eie(e,t,n,i,o,r,s,a){const c=e.camera,l=H.clone(c.position,Jne),u=c.pitch,d=Zne(c.heading,i),h=Zne(c.roll,r),p=Kne(c,n,l.z,n.z,s),f=$ne(u,o,p,a);return function(e){const o=e.time/t;c.setView({orientation:{heading:V.lerp(d,i,o),pitch:f(o),roll:V.lerp(h,r,o)}}),kt.lerp(l,n,o,c.position),c.position.z=p(o)}}const tie=new Qt,nie=new Qt;function iie(e,t,n,i,o,r,s,a,c,l){const u=e.camera,d=e.mapProjection.ellipsoid,h=Qt.clone(u.positionCartographic,tie),p=u.pitch,f=Zne(u.heading,i),m=Zne(u.roll,r),_=d.cartesianToCartographic(n,nie);h.longitude=V.zeroToTwoPi(h.longitude),_.longitude=V.zeroToTwoPi(_.longitude);let g=!1;if(D(a)){const e=V.zeroToTwoPi(a),t=Math.min(h.longitude,_.longitude),n=Math.max(h.longitude,_.longitude),i=e>=t&&e<=n;if(D(c)){const e=Math.abs(h.longitude-_.longitude),t=V.TWO_PI-e;(i?e:t)<(i?t:e)*c&&!i&&(g=!0)}else i||(g=!0)}g?function(e,t){e.longitude<t.longitude?e.longitude+=V.TWO_PI:t.longitude+=V.TWO_PI}(h,_):function(e,t){const n=e.longitude-t.longitude;n<-V.PI?e.longitude+=V.TWO_PI:n>V.PI&&(t.longitude+=V.TWO_PI)}(h,_);const y=Kne(u,n,h.height,_.height,s),b=$ne(p,o,y,l);return function(){const e=h.longitude,n=_.longitude,o=h.latitude,s=_.latitude;return function(a){const c=a.time/t,l=H.fromRadians(V.lerp(e,n,c),V.lerp(o,s,c),y(c),d);u.setView({destination:l,orientation:{heading:V.lerp(f,i,c),pitch:b(c),roll:V.lerp(m,r,c)}})}}()}function oie(e,t,n,i,o,r,s){const a=e.camera,c=H.clone(a.position,Jne),l=Zne(a.heading,i),u=a.frustum.right-a.frustum.left,d=Kne(a,n,u,n.z,s);return function(e){const o=e.time/t;a.setView({orientation:{heading:V.lerp(l,i,o)}}),kt.lerp(c,n,o,a.position);const r=d(o),s=a.frustum,u=s.top/s.right,h=.5*(r-(s.right-s.left));s.right+=h,s.left-=h,s.top=u*s.right,s.bottom=-s.top}}const rie=new Qt,sie=new H;function aie(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function cie(e,t){return function(){"function"==typeof t&&t(),e.enableInputs=!0}}Yne.createTween=function(e,t){let n=(t=M(t,M.EMPTY_OBJECT)).destination;if(!D(e))throw new P("scene is required.");if(!D(n))throw new P("destination is required.");const i=e.mode;if(i===gl.MORPHING)return aie();const o=M(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,c=t.flyOverLongitude,l=t.flyOverLongitudeWeight,u=t.pitchAdjustHeight;let d=t.easingFunction;o&&i!==gl.SCENE3D&&(s.cartesianToCartographic(n,rie),n=r.project(rie,sie));const h=e.camera,p=t.endTransform;D(p)&&h._setTransform(p);let f=t.duration;D(f)||(f=Math.ceil(H.distance(h.position,n)/1e6)+2,f=Math.min(f,3));const m=M(t.heading,0),_=M(t.pitch,-V.PI_OVER_TWO),g=M(t.roll,0),y=e.screenSpaceCameraController;y.enableInputs=!1;const b=cie(y,t.complete),v=cie(y,t.cancel),A=h.frustum;let T=e.mode===gl.SCENE2D;if(T=T&&kt.equalsEpsilon(h.position,n,V.EPSILON6),T=T&&V.equalsEpsilon(Math.max(A.right-A.left,A.top-A.bottom),n.z,V.EPSILON6),T=T||e.mode!==gl.SCENE2D&&H.equalsEpsilon(n,h.position,V.EPSILON10),T=T&&V.equalsEpsilon(V.negativePiToPi(m),V.negativePiToPi(h.heading),V.EPSILON10)&&V.equalsEpsilon(V.negativePiToPi(_),V.negativePiToPi(h.pitch),V.EPSILON10)&&V.equalsEpsilon(V.negativePiToPi(g),V.negativePiToPi(h.roll),V.EPSILON10),T)return aie(b,v);const w=new Array(4);if(w[gl.SCENE2D]=oie,w[gl.SCENE3D]=iie,w[gl.COLUMBUS_VIEW]=eie,f<=0){return aie((function(){w[i](e,1,n,m,_,g,a,c,l,u)({time:1}),"function"==typeof b&&b()}),v)}const E=w[i](e,f,n,m,_,g,a,c,l,u);if(!D(d)){const e=h.positionCartographic.height;d=e>(i===gl.SCENE3D?s.cartesianToCartographic(n).height:n.z)&&e>11500?k8.CUBIC_OUT:k8.QUINTIC_IN_OUT}return{duration:f,easingFunction:d,startObject:{time:0},stopObject:{time:f},update:E,complete:b,cancel:v}};const lie=Yne,uie=Object.freeze({ROTATE:0,INFINITE_SCROLL:1});function die(e){if(!D(e))throw new P("scene is required.");this._scene=e,this._transform=ve.clone(ve.IDENTITY),this._invTransform=ve.clone(ve.IDENTITY),this._actualTransform=ve.clone(ve.IDENTITY),this._actualInvTransform=ve.clone(ve.IDENTITY),this._transformChanged=!1,this.position=new H,this._position=new H,this._positionWC=new H,this._positionCartographic=new Qt,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new H,this._direction=new H,this._directionWC=new H,this.up=new H,this._up=new H,this._upWC=new H,this.right=new H,this._right=new H,this._rightWC=new H,this.frustum=new Vne,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=V.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 gi,this._moveEnd=new gi,this._changed=new gi,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this._changedRoll=void 0,this.percentageChanged=.5,this._viewMatrix=new ve,this._invViewMatrix=new ve,hie(this),this._mode=gl.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Qt(Math.PI,V.PI_OVER_TWO)),this._max2Dfrustum=void 0,Ioe(this,die.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=H.magnitude(this.position);n+=n*die.DEFAULT_VIEW_FACTOR,H.normalize(this.position,this.position),H.multiplyByScalar(this.position,n,this.position)}function hie(e){ve.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),ve.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),ve.inverseTransformation(e._viewMatrix,e._invViewMatrix)}die.TRANSFORM_2D=new ve(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),die.TRANSFORM_2D_INVERSE=ve.inverseTransformation(die.TRANSFORM_2D,new ve),die.DEFAULT_VIEW_RECTANGLE=Ir.fromDegrees(-95,-20,-70,90),die.DEFAULT_VIEW_FACTOR=.5,die.DEFAULT_OFFSET=new f8(0,-V.PI_OVER_FOUR,0),die.prototype.canPreloadFlight=function(){return D(this._currentFlight)&&this._mode!==gl.SCENE2D},die.prototype._updateCameraChanged=function(){const e=this;if(function(e){if(D(e._oldPositionWC)){e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=H.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=H.magnitude(t),e._oldPositionWC=H.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=rJ()):e.timeSinceMoved=Math.max(rJ()-e._lastMovedTimestamp,0)/1e3}else e._oldPositionWC=H.clone(e.positionWC,e._oldPositionWC)}(e),0===e._changed.numberOfListeners)return;const t=e.percentageChanged,n=e.heading;D(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%V.TWO_PI;i=i>V.PI?V.TWO_PI-i:i;const o=i/Math.PI;o>t&&(e._changedHeading=n);const r=e.roll;D(e._changedRoll)||(e._changedRoll=r);let s=Math.abs(e._changedRoll-r)%V.TWO_PI;s=s>V.PI?V.TWO_PI-s:s;const a=s/Math.PI;if(a>t&&(e._changedRoll=r),(a>t||o>t)&&e._changed.raiseEvent(Math.max(a,o)),e._mode===gl.SCENE2D){if(!D(e._changedFrustum))return e._changedPosition=H.clone(e.position,e._changedPosition),void(e._changedFrustum=e.frustum.clone());const n=e.position,i=e._changedPosition,o=e.frustum,r=e._changedFrustum,s=n.x+o.left,a=n.x+o.right,c=i.x+r.left,l=i.x+r.right,u=n.y+o.bottom,d=n.y+o.top,h=i.y+r.bottom,p=i.y+r.top,f=Math.max(s,c),m=Math.min(a,l),_=Math.max(u,h),g=Math.min(d,p);let y;if(f>=m||_>=d)y=1;else{let e=r;s<c&&a>l&&u<h&&d>p&&(e=o),y=1-(m-f)*(g-_)/((e.right-e.left)*(e.top-e.bottom))}return void(y>t&&(e._changed.raiseEvent(y),e._changedPosition=H.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum)))}if(!D(e._changedDirection))return e._changedPosition=H.clone(e.positionWC,e._changedPosition),void(e._changedDirection=H.clone(e.directionWC,e._changedDirection));const c=V.acosClamped(H.dot(e.directionWC,e._changedDirection));let l;l=D(e.frustum.fovy)?c/(.5*e.frustum.fovy):c;const u=H.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(l>t||u>t)&&(e._changed.raiseEvent(Math.max(l,u)),e._changedPosition=H.clone(e.positionWC,e._changedPosition),e._changedDirection=H.clone(e.directionWC,e._changedDirection))};const pie=new Qt,fie=new H,mie=new H,_ie=new K,gie=new K,yie=new K,bie=new K,vie=new K;const Aie=new H;function Tie(e){const t=e._mode;let n=!1,i=0;t===gl.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position;const r=!H.equals(o,e.position)||n;r&&(o=H.clone(e.position,e._position));let s=e._direction;const a=!H.equals(s,e.direction);a&&(H.normalize(e.direction,e.direction),s=H.clone(e.direction,e._direction));let c=e._up;const l=!H.equals(c,e.up);l&&(H.normalize(e.up,e.up),c=H.clone(e.up,e._up));let u=e._right;const d=!H.equals(u,e.right);d&&(H.normalize(e.right,e.right),u=H.clone(e.right,e._right));const h=e._transformChanged||e._modeChanged;e._transformChanged=!1,h&&(ve.inverseTransformation(e._transform,e._invTransform),e._mode===gl.COLUMBUS_VIEW||e._mode===gl.SCENE2D?ve.equals(ve.IDENTITY,e._transform)?ve.clone(die.TRANSFORM_2D,e._actualTransform):e._mode===gl.COLUMBUS_VIEW?function(e){Cr.basisTo2D(e._projection,e._transform,e._actualTransform)}(e):function(e){const t=e._projection,n=t.ellipsoid,i=ve.getColumn(e._transform,3,_ie),o=n.cartesianToCartographic(i,pie),r=t.project(o,fie),s=gie;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;const a=K.clone(K.UNIT_X,vie),c=K.add(ve.getColumn(e._transform,0,mie),i,mie);n.cartesianToCartographic(c,o),t.project(o,r);const l=yie;l.x=r.z,l.y=r.x,l.z=r.y,l.w=0,H.subtract(l,s,l),l.x=0;const u=bie;if(H.magnitudeSquared(l)>V.EPSILON10)H.cross(a,l,u);else{const a=K.add(ve.getColumn(e._transform,1,mie),i,mie);n.cartesianToCartographic(a,o),t.project(o,r),u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,H.subtract(u,s,u),u.x=0,H.magnitudeSquared(u)<V.EPSILON10&&(K.clone(K.UNIT_Y,l),K.clone(K.UNIT_Z,u))}H.cross(u,a,l),H.normalize(l,l),H.cross(a,l,u),H.normalize(u,u),ve.setColumn(e._actualTransform,0,l,e._actualTransform),ve.setColumn(e._actualTransform,1,u,e._actualTransform),ve.setColumn(e._actualTransform,2,a,e._actualTransform),ve.setColumn(e._actualTransform,3,s,e._actualTransform)}(e):ve.clone(e._transform,e._actualTransform),ve.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const p=e._actualTransform;if(r||h)if(e._positionWC=ve.multiplyByPoint(p,o,e._positionWC),t===gl.SCENE3D||t===gl.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const n=Aie;n.x=e._positionWC.y,n.y=e._positionWC.z,n.z=e._positionWC.x,t===gl.SCENE2D&&(n.z=i),e._projection.unproject(n,e._positionCartographic)}if(a||l||d){const t=H.dot(s,H.cross(c,u,Aie));if(Math.abs(1-t)>V.EPSILON2){const t=1/H.magnitudeSquared(c),n=H.dot(c,s)*t,i=H.multiplyByScalar(s,n,Aie);c=H.normalize(H.subtract(c,i,e._up),e._up),H.clone(c,e.up),u=H.cross(s,c,e._right),H.clone(u,e.right)}}(a||h)&&(e._directionWC=ve.multiplyByPointAsVector(p,s,e._directionWC),H.normalize(e._directionWC,e._directionWC)),(l||h)&&(e._upWC=ve.multiplyByPointAsVector(p,c,e._upWC),H.normalize(e._upWC,e._upWC)),(d||h)&&(e._rightWC=ve.multiplyByPointAsVector(p,u,e._rightWC),H.normalize(e._rightWC,e._rightWC)),(r||a||l||d||h)&&hie(e)}function wie(e,t){let n;return n=V.equalsEpsilon(Math.abs(e.z),1,V.EPSILON3)?Math.atan2(t.y,t.x)-V.PI_OVER_TWO:Math.atan2(e.y,e.x)-V.PI_OVER_TWO,V.TWO_PI-V.zeroToTwoPi(n)}function Eie(e){return V.PI_OVER_TWO-V.acosClamped(e.z)}function xie(e,t,n){let i=0;return V.equalsEpsilon(Math.abs(e.z),1,V.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=V.zeroToTwoPi(i+V.TWO_PI)),i}const Sie=new ve,Cie=new ve;Object.defineProperties(die.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return Tie(this),this._invTransform}},viewMatrix:{get:function(){return Tie(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return Tie(this),this._invViewMatrix}},positionCartographic:{get:function(){return Tie(this),this._positionCartographic}},positionWC:{get:function(){return Tie(this),this._positionWC}},directionWC:{get:function(){return Tie(this),this._directionWC}},upWC:{get:function(){return Tie(this),this._upWC}},rightWC:{get:function(){return Tie(this),this._rightWC}},heading:{get:function(){if(this._mode!==gl.MORPHING){const e=this._projection.ellipsoid,t=ve.clone(this._transform,Sie),n=Cr.eastNorthUpToFixedFrame(this.positionWC,e,Cie);this._setTransform(n);const i=wie(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==gl.MORPHING){const e=this._projection.ellipsoid,t=ve.clone(this._transform,Sie),n=Cr.eastNorthUpToFixedFrame(this.positionWC,e,Cie);this._setTransform(n);const i=Eie(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==gl.MORPHING){const e=this._projection.ellipsoid,t=ve.clone(this._transform,Sie),n=Cr.eastNorthUpToFixedFrame(this.positionWC,e,Cie);this._setTransform(n);const i=xie(this.direction,this.up,this.right);return this._setTransform(t),i}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}}),die.prototype.update=function(e){if(!D(e))throw new P("mode is required.");if(e===gl.SCENE2D&&!(this.frustum instanceof Hc))throw new P("An OrthographicOffCenterFrustum is required in 2D.");if(!(e!==gl.SCENE3D&&e!==gl.COLUMBUS_VIEW||this.frustum instanceof Vne||this.frustum instanceof Xc))throw new P("A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view");let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==gl.MORPHING,t=this._mode===gl.SCENE2D),t){const e=this._max2Dfrustum=this.frustum.clone();if(!(e instanceof Hc))throw new P("The camera frustum is expected to be orthographic for 2D camera control.");const t=2,n=e.top/e.right;e.right=this._maxCoord.x*t,e.left=-e.right,e.top=n*e.right,e.bottom=-e.top}this._mode===gl.SCENE2D&&Qie(this,this.position)};const Iie=new H,Oie=new H,Die=new H;die.prototype._setTransform=function(e){const t=H.clone(this.positionWC,Iie),n=H.clone(this.upWC,Oie),i=H.clone(this.directionWC,Die);ve.clone(e,this._transform),this._transformChanged=!0,Tie(this);const o=this._actualInvTransform;ve.multiplyByPoint(o,t,this.position),ve.multiplyByPointAsVector(o,i,this.direction),ve.multiplyByPointAsVector(o,n,this.up),H.cross(this.direction,this.up,this.right),Tie(this)};const Pie=new kt,Nie=new tp,Rie=new H,Lie=new H;function Mie(e){if(!ve.equals(ve.IDENTITY,e.transform))return H.magnitude(e.position);const t=e._scene,n=t.globe,i=Pie;let o,r,s;if(i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2,D(n)){const r=e.getPickRay(i,Nie);o=n.pickWorldCoordinates(r,t,!0,Rie)}if(t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,Lie)),D(o)||D(r)){const t=D(r)?H.distance(r,e.positionWC):Number.POSITIVE_INFINITY,n=D(o)?H.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(t,n)}else s=Math.max(e.positionCartographic.height,0);return s}die.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof Xc&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=Mie(this)))};const Fie=new H,Bie=new ve,zie=new ve,Uie=new _o,kie=new re,Vie=new Qt;const Hie=new H,Gie=new H,jie=new H;function Wie(e,t,n,i){const o=H.clone(n.direction,Hie),r=H.clone(n.up,Gie);if(e._scene.mode===gl.SCENE3D){const n=e._projection.ellipsoid,i=Cr.eastNorthUpToFixedFrame(t,n,Sie),s=ve.inverseTransformation(i,Cie);ve.multiplyByPointAsVector(s,o,o),ve.multiplyByPointAsVector(s,r,r)}const s=H.cross(o,r,jie);return i.heading=wie(o,r),i.pitch=Eie(o),i.roll=xie(o,r,s),i}const qie={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},Yie=new eo;die.prototype.setView=function(e){e=M(e,M.EMPTY_OBJECT);let t=M(e.orientation,M.EMPTY_OBJECT);const n=this._mode;if(n===gl.MORPHING)return;D(e.endTransform)&&this._setTransform(e.endTransform);let i=M(e.convert,!0),o=M(e.destination,H.clone(this.positionWC,Fie));if(D(o)&&D(o.west)){if(o=this.getRectangleCameraCoordinates(o,Fie),isNaN(o.x)||isNaN(o.y))throw new P("destination has a NaN component");i=!1}D(t.direction)&&(t=Wie(this,o,t,qie.orientation)),Yie.heading=M(t.heading,0),Yie.pitch=M(t.pitch,-V.PI_OVER_TWO),Yie.roll=M(t.roll,0),n===gl.SCENE3D?function(e,t,n){if(isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new P("position has a NaN component");const i=ve.clone(e.transform,Bie),o=Cr.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,zie);e._setTransform(o),H.clone(H.ZERO,e.position),n.heading=n.heading-V.PI_OVER_TWO;const r=_o.fromHeadingPitchRoll(n,Uie),s=re.fromQuaternion(r,kie);re.getColumn(s,0,e.direction),re.getColumn(s,2,e.up),H.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}(this,o,Yie):n===gl.SCENE2D?function(e,t,n,i){const o=ve.clone(e.transform,Bie);if(e._setTransform(ve.IDENTITY),!H.equals(t,e.positionWC)){if(i){const n=e._projection,i=n.ellipsoid.cartesianToCartographic(t,Vie);t=n.project(i,Fie)}kt.clone(t,e.position);const n=.5*-t.z,o=-n,r=e.frustum;if(o>n){const e=r.top/r.right;r.right=o,r.left=n,r.top=r.right*e,r.bottom=-r.top}}if(e._scene.mapMode2D===uie.ROTATE){n.heading=n.heading-V.PI_OVER_TWO,n.pitch=-V.PI_OVER_TWO,n.roll=0;const t=_o.fromHeadingPitchRoll(n,Uie),i=re.fromQuaternion(t,kie);re.getColumn(i,2,e.up),H.cross(e.direction,e.up,e.right)}e._setTransform(o)}(this,o,Yie,i):function(e,t,n,i){const o=ve.clone(e.transform,Bie);if(e._setTransform(ve.IDENTITY),!H.equals(t,e.positionWC)){if(i){const n=e._projection,i=n.ellipsoid.cartesianToCartographic(t,Vie);t=n.project(i,Fie)}H.clone(t,e.position)}n.heading=n.heading-V.PI_OVER_TWO;const r=_o.fromHeadingPitchRoll(n,Uie),s=re.fromQuaternion(r,kie);re.getColumn(s,0,e.direction),re.getColumn(s,2,e.up),H.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}(this,o,Yie,i)};const Xie=new H;function Qie(e,t){const n=e._scene.mapMode2D===uie.ROTATE,i=e._maxCoord.x,o=e._maxCoord.y;let r,s;n?(s=i,r=-s):(s=t.x-2*i,r=t.x+2*i),t.x>i&&(t.x=s),t.x<-i&&(t.x=r),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}die.prototype.flyHome=function(e){const t=this._mode;if(t===gl.MORPHING&&this._scene.completeMorph(),t===gl.SCENE2D)this.flyTo({destination:die.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:ve.IDENTITY});else if(t===gl.SCENE3D){const t=this.getRectangleCameraCoordinates(die.DEFAULT_VIEW_RECTANGLE);let n=H.magnitude(t);n+=n*die.DEFAULT_VIEW_FACTOR,H.normalize(t,t),H.multiplyByScalar(t,n,t),this.flyTo({destination:t,duration:e,endTransform:ve.IDENTITY})}else if(t===gl.COLUMBUS_VIEW){const t=this._projection.ellipsoid.maximumRadius;let n=new H(0,-1,1);n=H.multiplyByScalar(H.normalize(n,n),5*t,n),this.flyTo({destination:n,duration:e,orientation:{heading:0,pitch:-Math.acos(H.normalize(n,Xie).z),roll:0},endTransform:ve.IDENTITY,convert:!1})}},die.prototype.worldToCameraCoordinates=function(e,t){if(!D(e))throw new P("cartesian is required.");return D(t)||(t=new K),Tie(this),ve.multiplyByVector(this._actualInvTransform,e,t)},die.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!D(e))throw new P("cartesian is required.");return D(t)||(t=new H),Tie(this),ve.multiplyByPoint(this._actualInvTransform,e,t)},die.prototype.worldToCameraCoordinatesVector=function(e,t){if(!D(e))throw new P("cartesian is required.");return D(t)||(t=new H),Tie(this),ve.multiplyByPointAsVector(this._actualInvTransform,e,t)},die.prototype.cameraToWorldCoordinates=function(e,t){if(!D(e))throw new P("cartesian is required.");return D(t)||(t=new K),Tie(this),ve.multiplyByVector(this._actualTransform,e,t)},die.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!D(e))throw new P("cartesian is required.");return D(t)||(t=new H),Tie(this),ve.multiplyByPoint(this._actualTransform,e,t)},die.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!D(e))throw new P("cartesian is required.");return D(t)||(t=new H),Tie(this),ve.multiplyByPointAsVector(this._actualTransform,e,t)};const $ie=new H;die.prototype.move=function(e,t){if(!D(e))throw new P("direction is required.");const n=this.position;H.multiplyByScalar(e,t,$ie),H.add(n,$ie,n),this._mode===gl.SCENE2D&&Qie(this,n),this._adjustOrthographicFrustum(!0)},die.prototype.moveForward=function(e){e=M(e,this.defaultMoveAmount),this._mode===gl.SCENE2D?aoe(this,e):this.move(this.direction,e)},die.prototype.moveBackward=function(e){e=M(e,this.defaultMoveAmount),this._mode===gl.SCENE2D?aoe(this,-e):this.move(this.direction,-e)},die.prototype.moveUp=function(e){e=M(e,this.defaultMoveAmount),this.move(this.up,e)},die.prototype.moveDown=function(e){e=M(e,this.defaultMoveAmount),this.move(this.up,-e)},die.prototype.moveRight=function(e){e=M(e,this.defaultMoveAmount),this.move(this.right,e)},die.prototype.moveLeft=function(e){e=M(e,this.defaultMoveAmount),this.move(this.right,-e)},die.prototype.lookLeft=function(e){e=M(e,this.defaultLookAmount),this._mode!==gl.SCENE2D&&this.look(this.up,-e)},die.prototype.lookRight=function(e){e=M(e,this.defaultLookAmount),this._mode!==gl.SCENE2D&&this.look(this.up,e)},die.prototype.lookUp=function(e){e=M(e,this.defaultLookAmount),this._mode!==gl.SCENE2D&&this.look(this.right,-e)},die.prototype.lookDown=function(e){e=M(e,this.defaultLookAmount),this._mode!==gl.SCENE2D&&this.look(this.right,e)};const Kie=new _o,Zie=new re;die.prototype.look=function(e,t){if(!D(e))throw new P("axis is required.");const n=M(t,this.defaultLookAmount),i=_o.fromAxisAngle(e,-n,Kie),o=re.fromQuaternion(i,Zie),r=this.direction,s=this.up,a=this.right;re.multiplyByVector(o,r,r),re.multiplyByVector(o,s,s),re.multiplyByVector(o,a,a)},die.prototype.twistLeft=function(e){e=M(e,this.defaultLookAmount),this.look(this.direction,e)},die.prototype.twistRight=function(e){e=M(e,this.defaultLookAmount),this.look(this.direction,-e)};const Jie=new _o,eoe=new re;die.prototype.rotate=function(e,t){if(!D(e))throw new P("axis is required.");const n=M(t,this.defaultRotateAmount),i=_o.fromAxisAngle(e,-n,Jie),o=re.fromQuaternion(i,eoe);re.multiplyByVector(o,this.position,this.position),re.multiplyByVector(o,this.direction,this.direction),re.multiplyByVector(o,this.up,this.up),H.cross(this.direction,this.up,this.right),H.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)},die.prototype.rotateDown=function(e){roe(this,e=M(e,this.defaultRotateAmount))},die.prototype.rotateUp=function(e){roe(this,-(e=M(e,this.defaultRotateAmount)))};const toe=new H,noe=new H,ioe=new H,ooe=new H;function roe(e,t){const n=e.position;if(D(e.constrainedAxis)&&!H.equalsEpsilon(e.position,H.ZERO,V.EPSILON2)){const i=H.normalize(n,toe),o=H.equalsEpsilon(i,e.constrainedAxis,V.EPSILON2),r=H.equalsEpsilon(i,H.negate(e.constrainedAxis,ooe),V.EPSILON2);if(o||r)(o&&t<0||r&&t>0)&&e.rotate(e.right,t);else{const n=H.normalize(e.constrainedAxis,noe);let o=H.dot(i,n),r=V.acosClamped(o);t>0&&t>r&&(t=r-V.EPSILON4),o=H.dot(i,H.negate(n,ooe)),r=V.acosClamped(o),t<0&&-t>r&&(t=-r+V.EPSILON4);const s=H.cross(n,i,ioe);e.rotate(s,t)}}else e.rotate(e.right,t)}function soe(e,t){D(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function aoe(e,t){const n=e.frustum;if(!(n instanceof Hc&&D(n.left)&&D(n.right)&&D(n.bottom)&&D(n.top)))throw new P("The camera frustum is expected to be orthographic for 2D camera control.");let i;if(t*=.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let o=n.top-t,r=n.bottom+t,s=e._maxCoord.y;e._scene.mapMode2D===uie.ROTATE&&(s*=e.maximumZoomFactor),r>s&&(r=s,o=-s),o<=r&&(o=1,r=-1),i=n.right/n.top,n.top=o,n.bottom=r,n.right=n.top*i,n.left=-n.right}else{let o=n.right-t,r=n.left+t,s=e._maxCoord.x;e._scene.mapMode2D===uie.ROTATE&&(s*=e.maximumZoomFactor),o>s&&(o=s,r=-s),o<=r&&(o=1,r=-1),i=n.top/n.right,n.right=o,n.left=r,n.top=n.right*i,n.bottom=-n.top}}function coe(e,t){e.move(e.direction,t)}die.prototype.rotateRight=function(e){soe(this,-(e=M(e,this.defaultRotateAmount)))},die.prototype.rotateLeft=function(e){soe(this,e=M(e,this.defaultRotateAmount))},die.prototype.zoomIn=function(e){e=M(e,this.defaultZoomAmount),this._mode===gl.SCENE2D?aoe(this,e):coe(this,e)},die.prototype.zoomOut=function(e){e=M(e,this.defaultZoomAmount),this._mode===gl.SCENE2D?aoe(this,-e):coe(this,-e)},die.prototype.getMagnitude=function(){return this._mode===gl.SCENE3D?H.magnitude(this.position):this._mode===gl.COLUMBUS_VIEW?Math.abs(this.position.z):this._mode===gl.SCENE2D?Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom):void 0};const loe=new ve;die.prototype.lookAt=function(e,t){if(!D(e))throw new P("target is required");if(!D(t))throw new P("offset is required");if(this._mode===gl.MORPHING)throw new P("lookAt is not supported while morphing.");const n=Cr.eastNorthUpToFixedFrame(e,on.WGS84,loe);this.lookAtTransform(n,t)};const uoe=new H,doe=new _o,hoe=new _o,poe=new re;function foe(e,t,n){t=V.clamp(t,-V.PI_OVER_TWO,V.PI_OVER_TWO),e=V.zeroToTwoPi(e)-V.PI_OVER_TWO;const i=_o.fromAxisAngle(H.UNIT_Y,-t,doe),o=_o.fromAxisAngle(H.UNIT_Z,-e,hoe),r=_o.multiply(o,i,o),s=re.fromQuaternion(r,poe),a=H.clone(H.UNIT_X,uoe);return re.multiplyByVector(s,a,a),H.negate(a,a),H.multiplyByScalar(a,n,a),a}die.prototype.lookAtTransform=function(e,t){if(!D(e))throw new P("transform is required");if(this._mode===gl.MORPHING)throw new P("lookAtTransform is not supported while morphing.");if(this._setTransform(e),!D(t))return;let n;if(n=D(t.heading)?foe(t.heading,t.pitch,t.range):t,this._mode===gl.SCENE2D){kt.clone(kt.ZERO,this.position),H.negate(n,this.up),this.up.z=0,H.magnitudeSquared(this.up)<V.EPSILON10&&H.clone(H.UNIT_Y,this.up),H.normalize(this.up,this.up),this._setTransform(ve.IDENTITY),H.negate(H.UNIT_Z,this.direction),H.cross(this.direction,this.up,this.right),H.normalize(this.right,this.right);const t=this.frustum,i=t.top/t.right;return t.right=.5*H.magnitude(n),t.left=-t.right,t.top=i*t.right,t.bottom=-t.top,void this._setTransform(e)}H.clone(n,this.position),H.negate(this.position,this.direction),H.normalize(this.direction,this.direction),H.cross(this.direction,H.UNIT_Z,this.right),H.magnitudeSquared(this.right)<V.EPSILON10&&H.clone(H.UNIT_X,this.right),H.normalize(this.right,this.right),H.cross(this.right,this.direction,this.up),H.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const moe=new Qt,_oe=new Qt,goe=new H,yoe=new H,boe=new H,voe=new H,Aoe=new H,Toe=new H,woe=new H,Eoe=new H,xoe={direction:new H,right:new H,up:new H};let Soe;function Coe(e,t,n,i){return Math.abs(H.dot(t,n))/i-H.dot(e,n)}function Ioe(e,t,n,i){const o=e._projection.ellipsoid,r=i?e:xoe,s=t.north,a=t.south;let c=t.east;const l=t.west;l>c&&(c+=V.TWO_PI);const u=.5*(l+c);let d;if(a<-V.PI_OVER_TWO+V.RADIANS_PER_DEGREE&&s>V.PI_OVER_TWO-V.RADIANS_PER_DEGREE)d=0;else{const e=moe;e.longitude=u,e.latitude=s,e.height=0;const t=_oe;t.longitude=u,t.latitude=a,t.height=0;let n=Soe;D(n)&&n.ellipsoid===o||(Soe=n=new zy(void 0,void 0,o)),n.setEndPoints(e,t),d=n.interpolateUsingFraction(.5,moe).latitude}const h=moe;h.longitude=u,h.latitude=d,h.height=0;const p=o.cartographicToCartesian(h,woe),f=moe;f.longitude=c,f.latitude=s;const m=o.cartographicToCartesian(f,goe);f.longitude=l;const _=o.cartographicToCartesian(f,boe);f.longitude=u;const g=o.cartographicToCartesian(f,Aoe);f.latitude=a;const y=o.cartographicToCartesian(f,Toe);f.longitude=c;const b=o.cartographicToCartesian(f,voe);f.longitude=l;const v=o.cartographicToCartesian(f,yoe);H.subtract(_,p,_),H.subtract(b,p,b),H.subtract(m,p,m),H.subtract(v,p,v),H.subtract(g,p,g),H.subtract(y,p,y);const A=o.geodeticSurfaceNormal(p,r.direction);H.negate(A,A);const T=H.cross(A,H.UNIT_Z,r.right);H.normalize(T,T);const w=H.cross(T,A,r.up);let E;if(e.frustum instanceof Xc){const t=Math.max(H.distance(m,_),H.distance(b,v)),n=Math.max(H.distance(m,b),H.distance(_,v));let i,o;const r=e.frustum._offCenterFrustum,s=r.right/r.top,a=n*s;t>a?(i=t,o=i/s):(o=n,i=a),E=Math.max(i,o)}else{const t=Math.tan(.5*e.frustum.fovy),n=e.frustum.aspectRatio*t;if(E=Math.max(Coe(A,w,_,t),Coe(A,w,b,t),Coe(A,w,m,t),Coe(A,w,v,t),Coe(A,w,g,t),Coe(A,w,y,t),Coe(A,T,_,n),Coe(A,T,b,n),Coe(A,T,m,n),Coe(A,T,v,n),Coe(A,T,g,n),Coe(A,T,y,n)),a<0&&s>0){const e=moe;e.longitude=l,e.latitude=0,e.height=0;let i=o.cartographicToCartesian(e,Eoe);H.subtract(i,p,i),E=Math.max(E,Coe(A,w,i,t),Coe(A,T,i,n)),e.longitude=c,i=o.cartographicToCartesian(e,Eoe),H.subtract(i,p,i),E=Math.max(E,Coe(A,w,i,t),Coe(A,T,i,n))}}return H.add(p,H.multiplyByScalar(A,-E,Eoe),n)}const Ooe=new Qt,Doe=new H,Poe=new H;const Noe=new Qt,Roe=new H,Loe=new H;die.prototype.getRectangleCameraCoordinates=function(e,t){if(!D(e))throw new P("rectangle is required");const n=this._mode;return D(t)||(t=new H),n===gl.SCENE3D?Ioe(this,e,t):n===gl.COLUMBUS_VIEW?function(e,t,n){const i=e._projection;t.west>t.east&&(t=Ir.MAX_VALUE);const o=e._actualTransform,r=e._actualInvTransform,s=Ooe;s.longitude=t.east,s.latitude=t.north;const a=i.project(s,Doe);ve.multiplyByPoint(o,a,a),ve.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;const c=i.project(s,Poe);if(ve.multiplyByPoint(o,c,c),ve.multiplyByPoint(r,c,c),n.x=.5*(a.x-c.x)+c.x,n.y=.5*(a.y-c.y)+c.y,D(e.frustum.fovy)){const t=Math.tan(.5*e.frustum.fovy),i=e.frustum.aspectRatio*t;n.z=.5*Math.max((a.x-c.x)/i,(a.y-c.y)/t)}else{const e=a.x-c.x,t=a.y-c.y;n.z=Math.max(e,t)}return n}(this,e,t):n===gl.SCENE2D?function(e,t,n){const i=e._projection;let o=t.east;t.west>t.east&&(e._scene.mapMode2D===uie.INFINITE_SCROLL?o+=V.TWO_PI:o=(t=Ir.MAX_VALUE).east);let r=Noe;r.longitude=o,r.latitude=t.north;const s=i.project(r,Roe);r.longitude=t.west,r.latitude=t.south;const a=i.project(r,Loe),c=.5*Math.abs(s.x-a.x);let l,u,d=.5*Math.abs(s.y-a.y);const h=e.frustum.right/e.frustum.top,p=d*h;return c>p?(l=c,u=l/h):(u=d,l=p),d=Math.max(2*l,2*u),n.x=.5*(s.x-a.x)+a.x,n.y=.5*(s.y-a.y)+a.y,r=i.unproject(n,r),r.height=d,i.project(r,n)}(this,e,t):void 0};const Moe=new tp;const Foe=new tp;const Boe=new tp;die.prototype.pickEllipsoid=function(e,t,n){if(!D(e))throw new P("windowPosition is required.");const i=this._scene.canvas;if(0!==i.clientWidth&&0!==i.clientHeight){if(D(n)||(n=new H),t=M(t,on.WGS84),this._mode===gl.SCENE3D)n=function(e,t,n,i){n=M(n,on.WGS84);const o=e.getPickRay(t,Moe),r=Pp.rayEllipsoid(o,n);if(!r)return;const s=r.start>0?r.start:r.stop;return tp.getPoint(o,s,i)}(this,e,t,n);else if(this._mode===gl.SCENE2D)n=function(e,t,n,i){let o=e.getPickRay(t,Foe).origin;o=H.fromElements(o.y,o.z,0,o);const r=n.unproject(o);if(!(r.latitude<-V.PI_OVER_TWO||r.latitude>V.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(r,i)}(this,e,this._projection,n);else{if(this._mode!==gl.COLUMBUS_VIEW)return;n=function(e,t,n,i){const o=e.getPickRay(t,Boe),r=-o.origin.x/o.direction.x;tp.getPoint(o,r,i);const s=n.unproject(new H(i.y,i.z,0));if(!(s.latitude<-V.PI_OVER_TWO||s.latitude>V.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}(this,e,this._projection,n)}return n}};const zoe=new H,Uoe=new H,koe=new H;const Voe=new H;die.prototype.getPickRay=function(e,t){if(!D(e))throw new P("windowPosition is required.");D(t)||(t=new tp);const n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;const i=this.frustum;return D(i.aspectRatio)&&D(i.fov)&&D(i.near)?function(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=Math.tan(.5*e.frustum.fovy),a=e.frustum.aspectRatio*s,c=e.frustum.near,l=2/o*t.x-1,u=2/r*(r-t.y)-1,d=e.positionWC;H.clone(d,n.origin);const h=H.multiplyByScalar(e.directionWC,c,zoe);H.add(d,h,h);const p=H.multiplyByScalar(e.rightWC,l*c*a,Uoe),f=H.multiplyByScalar(e.upWC,u*c*s,koe),m=H.add(h,p,n.direction);return H.add(m,f,m),H.subtract(m,d,m),H.normalize(m,m),n}(this,e,t):function(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight;let s=e.frustum;const a=s.offCenterFrustum;D(a)&&(s=a);let c=2/o*t.x-1;c*=.5*(s.right-s.left);let l=2/r*(r-t.y)-1;l*=.5*(s.top-s.bottom);const u=n.origin;return H.clone(e.position,u),H.multiplyByScalar(e.right,c,Voe),H.add(Voe,u,u),H.multiplyByScalar(e.up,l,Voe),H.add(Voe,u,u),H.clone(e.directionWC,n.direction),e._mode!==gl.COLUMBUS_VIEW&&e._mode!==gl.SCENE2D||H.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}(this,e,t)};const Hoe=new H,Goe=new H;die.prototype.distanceToBoundingSphere=function(e){if(!D(e))throw new P("boundingSphere is required.");const t=H.subtract(this.positionWC,e.center,Hoe),n=H.multiplyByScalar(this.directionWC,H.dot(t,this.directionWC),Goe);return Math.max(0,H.magnitude(n)-e.radius)};const joe=new kt;die.prototype.getPixelSize=function(e,t,n){if(!D(e))throw new P("boundingSphere is required.");if(!D(t))throw new P("drawingBufferWidth is required.");if(!D(n))throw new P("drawingBufferHeight is required.");const i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,joe);return Math.max(o.x,o.y)};const Woe=new H,qoe=new H,Yoe=new H,Xoe=new H;function Qoe(e,t){let n=e.position;const i=e.direction,o=e.worldToCameraCoordinatesVector(H.UNIT_X,Woe),r=-H.dot(o,n)/H.dot(o,i),s=H.add(n,H.multiplyByScalar(i,r,qoe),qoe);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,Yoe);const a=Math.tan(.5*e.frustum.fovy),c=e.frustum.aspectRatio*a,l=H.magnitude(H.subtract(n,s,Xoe)),u=c*l,d=a*l,h=e._maxCoord.x,p=e._maxCoord.y,f=Math.max(u-h,h),m=Math.max(d-p,p);if(n.z<-f||n.z>f||n.y<-m||n.y>m){const i=s.y<-f||s.y>f,o=s.z<-m||s.z>m;if(i||o)return function(e,t,n,i,o,r){const s=H.clone(t);return n.y>i?s.y-=n.y-i:n.y<-i&&(s.y+=-i-n.y),n.z>o?s.z-=n.z-o:n.z<-o&&(s.z+=-o-n.z),{easingFunction:k8.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:function(n){const i=H.lerp(t,s,n.time,new H);e.worldToCameraCoordinatesPoint(i,e.position)}}}(e,n,s,f,m,t)}}die.prototype.createCorrectPositionTween=function(e){if(!D(e))throw new P("duration is required.");if(this._mode===gl.COLUMBUS_VIEW)return Qoe(this,e)};const $oe=new H,Koe={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};die.prototype.cancelFlight=function(){D(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)},die.prototype.completeFlight=function(){if(D(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=Koe.destination,e.orientation.heading=Koe.heading,e.orientation.pitch=Koe.pitch,e.orientation.roll=Koe.roll,this.setView(e),D(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}},die.prototype.flyTo=function(e){let t=(e=M(e,M.EMPTY_OBJECT)).destination;if(!D(t))throw new P("destination is required.");if(this._mode===gl.MORPHING)return;this.cancelFlight();const n=t instanceof Ir;n&&(t=this.getRectangleCameraCoordinates(t,$oe));let i=M(e.orientation,M.EMPTY_OBJECT);if(D(i.direction)&&(i=Wie(this,t,i,qie.orientation)),D(e.duration)&&e.duration<=0){const t=qie;return t.destination=e.destination,t.orientation.heading=i.heading,t.orientation.pitch=i.pitch,t.orientation.roll=i.roll,t.convert=e.convert,t.endTransform=e.endTransform,this.setView(t),void("function"==typeof e.complete&&e.complete())}const o=this;let r;Koe.destination=t,Koe.heading=i.heading,Koe.pitch=i.pitch,Koe.roll=i.roll,Koe.duration=e.duration,Koe.complete=function(){r===o._currentFlight&&(o._currentFlight=void 0),D(e.complete)&&e.complete()},Koe.cancel=e.cancel,Koe.endTransform=e.endTransform,Koe.convert=!n&&e.convert,Koe.maximumHeight=e.maximumHeight,Koe.pitchAdjustHeight=e.pitchAdjustHeight,Koe.flyOverLongitude=e.flyOverLongitude,Koe.flyOverLongitudeWeight=e.flyOverLongitudeWeight,Koe.easingFunction=e.easingFunction;const s=this._scene,a=lie.createTween(s,Koe);if(0===a.duration)return void("function"==typeof a.complete&&a.complete());r=s.tweens.add(a),this._currentFlight=r;let c=this._scene.preloadFlightCamera;this._mode!==gl.SCENE2D&&(D(c)||(c=die.clone(this)),c.setView({destination:t,orientation:i}),this._scene.preloadFlightCullingVolume=c.frustum.computeCullingVolume(c.positionWC,c.directionWC,c.upWC))};function Zoe(e,t,n){n=f8.clone(D(n)?n:die.DEFAULT_OFFSET);const i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!D(r)||0===r){const r=t.radius;0===r?n.range=100:e.frustum instanceof Xc||e._mode===gl.SCENE2D?n.range=function(e,t){let n=e.frustum;const i=n.offCenterFrustum;let o,r;D(i)&&(n=i);const s=n.right/n.top,a=t*s;return t>a?(o=t,r=o/s):(r=t,o=a),1.5*Math.max(o,r)}(e,r):n.range=function(e,t){const n=e.frustum,i=Math.tan(.5*n.fovy),o=n.aspectRatio*i;return Math.max(t/o,t/i)}(e,r),n.range=V.clamp(n.range,i,o)}return n}die.prototype.viewBoundingSphere=function(e,t){if(!D(e))throw new P("boundingSphere is required.");if(this._mode===gl.MORPHING)throw new P("viewBoundingSphere is not supported while morphing.");t=Zoe(this,e,t),this.lookAt(e.center,t)};const Joe=new ve,ere=new H,tre=new H,nre=new H,ire=new H,ore=new K,rre=new _o,sre=new re;die.prototype.flyToBoundingSphere=function(e,t){if(!D(e))throw new P("boundingSphere is required.");t=M(t,M.EMPTY_OBJECT);const n=this._mode===gl.SCENE2D||this._mode===gl.COLUMBUS_VIEW;this._setTransform(ve.IDENTITY);const i=Zoe(this,e,t.offset);let o;o=n?H.multiplyByScalar(H.UNIT_Z,i.range,ere):foe(i.heading,i.pitch,i.range);const r=Cr.eastNorthUpToFixedFrame(e.center,on.WGS84,Joe);let s,a;if(ve.multiplyByPoint(r,o,o),!n){if(s=H.subtract(e.center,o,tre),H.normalize(s,s),a=ve.multiplyByPointAsVector(r,H.UNIT_Z,nre),1-Math.abs(H.dot(s,a))<V.EPSILON6){const e=_o.fromAxisAngle(s,i.heading,rre),t=re.fromQuaternion(e,sre);H.fromCartesian4(ve.getColumn(r,1,ore),a),re.multiplyByVector(t,a,a)}const t=H.cross(s,a,ire);H.cross(t,s,a),H.normalize(a,a)}this.flyTo({destination:o,orientation:{direction:s,up:a},duration:t.duration,complete:t.complete,cancel:t.cancel,endTransform:t.endTransform,maximumHeight:t.maximumHeight,easingFunction:t.easingFunction,flyOverLongitude:t.flyOverLongitude,flyOverLongitudeWeight:t.flyOverLongitudeWeight,pitchAdjustHeight:t.pitchAdjustHeight})};const are=new H,cre=new H,lre=new H,ure=new H,dre=[new H,new H,new H,new H];const hre=new kt,pre=new H,fre=[new Qt,new Qt,new Qt,new Qt];function mre(e,t,n,i,o,r){hre.x=e,hre.y=t;const s=i.pickEllipsoid(hre,o,pre);return D(s)?(fre[n]=o.cartesianToCartographic(s,fre[n]),1):(fre[n]=o.cartesianToCartographic(r[n],fre[n]),0)}function _re(e){L.typeOf.object("options",e),L.typeOf.number("options.pass",e.pass),this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}die.prototype.computeViewRectangle=function(e,t){e=M(e,on.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new $u(H.ZERO,e.maximumRadius);if(n.computeVisibility(i)===mn.OUTSIDE)return;const o=this._scene.canvas,r=o.clientWidth,s=o.clientHeight;let a=0;const c=function(e,t){const n=t.radii,i=e.positionWC,o=H.multiplyComponents(t.oneOverRadii,i,are),r=H.magnitude(o),s=H.normalize(o,cre);let a,c;H.equalsEpsilon(s,H.UNIT_Z,V.EPSILON10)?(a=new H(0,1,0),c=new H(0,0,1)):(a=H.normalize(H.cross(H.UNIT_Z,s,lre),lre),c=H.normalize(H.cross(s,a,ure),ure));const l=Math.sqrt(H.magnitudeSquared(o)-1),u=H.multiplyByScalar(s,1/r,are),d=l/r,h=H.multiplyByScalar(a,d,cre),p=H.multiplyByScalar(c,d,lre),f=H.add(u,p,dre[0]);H.subtract(f,h,f),H.multiplyComponents(n,f,f);const m=H.subtract(u,p,dre[1]);H.subtract(m,h,m),H.multiplyComponents(n,m,m);const _=H.subtract(u,p,dre[2]);H.add(_,h,_),H.multiplyComponents(n,_,_);const g=H.add(u,p,dre[3]);return H.add(g,h,g),H.multiplyComponents(n,g,g),dre}(this,e);if(a+=mre(0,0,0,this,e,c),a+=mre(0,s,1,this,e,c),a+=mre(r,s,2,this,e,c),a+=mre(r,0,3,this,e,c),a<2)return Ir.MAX_VALUE;t=Ir.fromCartographicArray(fre,t);let l=0,u=fre[3].longitude;for(let d=0;d<4;++d){const e=fre[d].longitude,t=Math.abs(e-u);t>V.PI?l+=V.TWO_PI-t:l+=t,u=e}return V.equalsEpsilon(Math.abs(l),V.TWO_PI,V.EPSILON9)&&(t.west=-V.PI,t.east=V.PI,fre[0].latitude>=0?t.north=V.PI_OVER_TWO:t.south=-V.PI_OVER_TWO),t},die.prototype.switchToPerspectiveFrustum=function(){if(this._mode===gl.SCENE2D||this.frustum instanceof Vne)return;const e=this._scene;this.frustum=new Vne,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=V.toRadians(60)},die.prototype.switchToOrthographicFrustum=function(){if(this._mode===gl.SCENE2D||this.frustum instanceof Xc)return;const e=Mie(this),t=this._scene;this.frustum=new Xc,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e},die.clone=function(e,t){return D(t)||(t=new die(e._scene)),H.clone(e.position,t.position),H.clone(e.direction,t.direction),H.clone(e.up,t.up),H.clone(e.right,t.right),ve.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};const gre="#ffffff",yre="#48b";function bre(e,t){this.credit=e,this.count=M(t,1)}const vre="cesium-credit-delimiter";function Are(e){const t=document.createElement("span");return t.textContent=e,t.className=vre,t}function Tre(e,t){if(D(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function wre(e,t,n,i){const o=e.childNodes;let r=-1;t.sort((function(e,t){return t.count-e.count}));for(let s=0;s<t.length;++s){const a=t[s].credit;if(D(a)){if(r=s,D(n)&&(r*=2,s>0)){const t=r-1;if(o.length<=t)e.appendChild(Are(n));else{const i=o[t];i.className!==vre&&e.replaceChild(Are(n),i)}}const t=a.element;if(o.length<=r)e.appendChild(Tre(t,i));else{const n=o[r];n._creditId!==a._id&&e.replaceChild(Tre(t,i),n)}}}for(++r;r<o.length;)e.removeChild(o[r])}function Ere(e,t){let n=`${e} {`;for(const i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=" }\n",n}function xre(e,t,n){L.defined("container",e);const i=this;n=M(n,document.body);const o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);const r=document.createElement("div");function s(e){r.contains(e.target)||i.hideLightbox()}r.className="cesium-credit-lightbox",o.appendChild(r),o.addEventListener("click",s,!1);const a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);const c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="×",c.className="cesium-credit-lightbox-close",r.appendChild(c);const l=document.createElement("ul");r.appendChild(l);const u=document.createElement("div");u.className="cesium-credit-logoContainer",u.style.display="inline",e.appendChild(u);const d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);const h=document.createElement("a");h.className="cesium-credit-expand-link",h.onclick=this.showLightbox.bind(this),h.textContent="Data attribution",e.appendChild(h),function(e){let t="";t+=Ere(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),t+=Ere(".cesium-credit-lightbox",{"background-color":"#303336",color:gre,position:"relative","min-height":"100px",margin:"auto"}),t+=Ere(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:gre}),t+=Ere(".cesium-credit-lightbox > ul > li a:hover",{color:yre}),t+=Ere(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),t+=Ere(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),t+=Ere(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),t+=Ere(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:gre}),t+=Ere(".cesium-credit-lightbox-close:hover",{color:yre}),t+=Ere(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),t+=Ere(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),t+=Ere(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),t+=Ere(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:gre}),t+=Ere(".cesium-credit-expand-link:hover",{color:yre}),t+=Ere(".cesium-credit-text",{color:gre}),t+=Ere(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});const n=M(function(e){if(e.shadowRoot)return e.shadowRoot;if(e.getRootNode){const t=e.getRootNode();if(t instanceof ShadowRoot)return t}}(e),document.head),i=document.createElement("style");i.innerHTML=t,n.appendChild(i)}(e);const p=YT.clone(xre.cesiumCredit);this._delimiter=M(t," • "),this._screenContainer=d,this._cesiumCreditContainer=u,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=l,this._lightbox=o,this._hideLightbox=s,this._expandLink=h,this._expanded=!1,this._staticCredits=[],this._cesiumCredit=p,this._previousCesiumCredit=void 0,this._currentCesiumCredit=p,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new bu,lightboxCredits:new bu},this._defaultCredit=void 0,this.viewport=n,this.container=e}function Sre(e,t,n,i){i=M(i,1);let o=t.get(n.id);if(D(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{const r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new bre(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}let Cre;function Ire(){if(!D(Cre)){let e=lo("Assets/Images/ion-credit.png");if(0!==e.indexOf("http://")&&0!==e.indexOf("https://")&&0!==e.indexOf("data:")){e=new ei(e).path()}Cre=new YT(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return xre._cesiumCreditInitialized||(xre._cesiumCredit=Cre,xre._cesiumCreditInitialized=!0),Cre}xre.prototype.addCreditToNextFrame=function(e){if(L.defined("credit",e),e.isIon())return D(this._defaultCredit)||(this._defaultCredit=YT.clone(Ire())),void(this._currentCesiumCredit=this._defaultCredit);let t;t=e.showOnScreen?this._currentFrameCredits.screenCredits:this._currentFrameCredits.lightboxCredits,Sre(this,t,e)},xre.prototype.addStaticCredit=function(e){L.defined("credit",e);const t=this._staticCredits;(function(e,t){const n=e.length;for(let i=0;i<n;i++){const n=e[i];if(YT.equals(n,t))return!0}return!1})(t,e)||t.push(e)},xre.prototype.removeStaticCredit=function(e){L.defined("credit",e);const t=this._staticCredits,n=t.indexOf(e);-1!==n&&t.splice(n,1)},xre.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0},xre.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1},xre.prototype.update=function(){this._expanded&&function(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<576?(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*(i-t.clientHeight))}px`),e._lastViewportWidth=n),n>=576&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor(.5*(i-t.clientHeight))}px`,e._lastViewportHeight=i)}(this)},xre.prototype.beginFrame=function(){const e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;const t=e.screenCredits,n=e.lightboxCredits;t.removeAll(),n.removeAll();const i=this._staticCredits;for(let o=0;o<i.length;++o){const e=i[o],r=e.showOnScreen?t:n;e.isIon()&&YT.equals(xre.cesiumCredit,this._cesiumCredit)||Sre(this,r,e,Number.MAX_VALUE)}YT.equals(xre.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=YT.clone(xre.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit},xre.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;wre(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",wre(this._creditList,t,void 0,"li"),function(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;YT.equals(n,t)||(D(t)&&e._cesiumCreditContainer.removeChild(t.element),D(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}(this)},xre.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),He(this)},xre.prototype.isDestroyed=function(){return!1},xre._cesiumCredit=void 0,xre._cesiumCreditInitialized=!1,Object.defineProperties(xre,{cesiumCredit:{get:function(){return Ire(),xre._cesiumCredit},set:function(e){xre._cesiumCredit=e,xre._cesiumCreditInitialized=!0}}}),xre.CreditDisplayElement=bre;function Ore(e){L.typeOf.object("options",e),L.typeOf.object("options.frustum",e.frustum),L.typeOf.object("options.origin",e.origin),L.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=M(e.vertexFormat,Bd.DEFAULT),r=M(e._drawNearPlane,!0);let s,a;t instanceof Vne?(s=0,a=Vne.packedLength):t instanceof Xc&&(s=1,a=Xc.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=H.clone(i),this._orientation=_o.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+H.packedLength+_o.packedLength+Bd.packedLength}Ore.pack=function(e,t,n){L.typeOf.object("value",e),L.defined("array",t),n=M(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,0===i?(Vne.pack(o,t,n),n+=Vne.packedLength):(Xc.pack(o,t,n),n+=Xc.packedLength),H.pack(e._origin,t,n),n+=H.packedLength,_o.pack(e._orientation,t,n),n+=_o.packedLength,Bd.pack(e._vertexFormat,t,n),t[n+=Bd.packedLength]=e._drawNearPlane?1:0,t};const Dre=new Vne,Pre=new Xc,Nre=new _o,Rre=new H,Lre=new Bd;function Mre(e,t,n,i,o,r,s,a){const c=e/3*2;for(let l=0;l<4;++l)D(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),D(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),D(i)&&(i[e]=a.x,i[e+1]=a.y,i[e+2]=a.z),e+=3;o[c]=0,o[c+1]=0,o[c+2]=1,o[c+3]=0,o[c+4]=1,o[c+5]=1,o[c+6]=0,o[c+7]=1}Ore.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=e[t++];let o;0===i?(o=Vne.unpack(e,t,Dre),t+=Vne.packedLength):(o=Xc.unpack(e,t,Pre),t+=Xc.packedLength);const r=H.unpack(e,t,Rre);t+=H.packedLength;const s=_o.unpack(e,t,Nre);t+=_o.packedLength;const a=Bd.unpack(e,t,Lre),c=1===e[t+=Bd.packedLength];if(!D(n))return new Ore({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:c});const l=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(l),n._frustumType=i,n._origin=H.clone(r,n._origin),n._orientation=_o.clone(s,n._orientation),n._vertexFormat=Bd.clone(a,n._vertexFormat),n._drawNearPlane=c,n};const Fre=new re,Bre=new ve,zre=new ve,Ure=new H,kre=new H,Vre=new H,Hre=new H,Gre=new H,jre=new H,Wre=new Array(3),qre=new Array(4);qre[0]=new K(-1,-1,1,1),qre[1]=new K(1,-1,1,1),qre[2]=new K(1,1,1,1),qre[3]=new K(-1,1,1,1);const Yre=new Array(4);for(let ko=0;ko<4;++ko)Yre[ko]=new K;Ore._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){const c=re.fromQuaternion(t,Fre);let l=M(r,Ure),u=M(s,kre),d=M(a,Vre);l=re.getColumn(c,0,l),u=re.getColumn(c,1,u),d=re.getColumn(c,2,d),H.normalize(l,l),H.normalize(u,u),H.normalize(d,d),H.negate(l,l);const h=ve.computeView(e,d,u,l,Bre);let p,f;const m=i.projectionMatrix;if(0===n){const e=ve.multiply(m,h,zre);f=ve.inverse(e,zre)}else p=ve.inverseTransformation(h,zre);D(f)?(Wre[0]=i.near,Wre[1]=i.far):(Wre[0]=0,Wre[1]=i.near,Wre[2]=i.far);for(let _=0;_<2;++_)for(let t=0;t<4;++t){let n=K.clone(qre[t],Yre[t]);if(D(f)){n=ve.multiplyByVector(f,n,n);const t=1/n.w;H.multiplyByScalar(n,t,n),H.subtract(n,e,n),H.normalize(n,n);const i=H.dot(d,n);H.multiplyByScalar(n,Wre[_]/i,n),H.add(n,e,n)}else{const e=i.offCenterFrustum;D(e)&&(i=e);const t=Wre[_],o=Wre[_+1];n.x=.5*(n.x*(i.right-i.left)+i.left+i.right),n.y=.5*(n.y*(i.top-i.bottom)+i.bottom+i.top),n.z=.5*(n.z*(t-o)-t-o),n.w=1,ve.multiplyByVector(p,n,n)}o[12*_+3*t]=n.x,o[12*_+3*t+1]=n.y,o[12*_+3*t+2]=n.z}},Ore.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=e._vertexFormat,a=r?6:5;let c=new Float64Array(72);Ore._computeNearFarPlanes(i,o,t,n,c);let l=24;c[l]=c[12],c[l+1]=c[13],c[l+2]=c[14],c[l+3]=c[0],c[l+4]=c[1],c[l+5]=c[2],c[l+6]=c[9],c[l+7]=c[10],c[l+8]=c[11],c[l+9]=c[21],c[l+10]=c[22],c[l+11]=c[23],l+=12,c[l]=c[15],c[l+1]=c[16],c[l+2]=c[17],c[l+3]=c[3],c[l+4]=c[4],c[l+5]=c[5],c[l+6]=c[0],c[l+7]=c[1],c[l+8]=c[2],c[l+9]=c[12],c[l+10]=c[13],c[l+11]=c[14],l+=12,c[l]=c[3],c[l+1]=c[4],c[l+2]=c[5],c[l+3]=c[15],c[l+4]=c[16],c[l+5]=c[17],c[l+6]=c[18],c[l+7]=c[19],c[l+8]=c[20],c[l+9]=c[6],c[l+10]=c[7],c[l+11]=c[8],l+=12,c[l]=c[6],c[l+1]=c[7],c[l+2]=c[8],c[l+3]=c[18],c[l+4]=c[19],c[l+5]=c[20],c[l+6]=c[21],c[l+7]=c[22],c[l+8]=c[23],c[l+9]=c[9],c[l+10]=c[10],c[l+11]=c[11],r||(c=c.subarray(12));const u=new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:c})});if(D(s.normal)||D(s.tangent)||D(s.bitangent)||D(s.st)){const e=D(s.normal)?new Float32Array(12*a):void 0,t=D(s.tangent)?new Float32Array(12*a):void 0,n=D(s.bitangent)?new Float32Array(12*a):void 0,i=D(s.st)?new Float32Array(8*a):void 0,o=Ure,c=kre,d=Vre,h=H.negate(o,Hre),p=H.negate(c,Gre),f=H.negate(d,jre);l=0,r&&(Mre(l,e,t,n,i,f,o,c),l+=12),Mre(l,e,t,n,i,d,h,c),l+=12,Mre(l,e,t,n,i,h,f,c),l+=12,Mre(l,e,t,n,i,p,f,h),l+=12,Mre(l,e,t,n,i,o,d,c),l+=12,Mre(l,e,t,n,i,c,d,h),D(e)&&(u.normal=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:e})),D(t)&&(u.tangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:t})),D(n)&&(u.bitangent=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:n})),D(i)&&(u.st=new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:2,values:i}))}const d=new Uint16Array(6*a);for(let h=0;h<a;++h){const e=6*h,t=4*h;d[e]=t,d[e+1]=t+1,d[e+2]=t+2,d[e+3]=t,d[e+4]=t+2,d[e+5]=t+3}return new Na({attributes:u,indices:d,primitiveType:Vr.TRIANGLES,boundingSphere:$u.fromVertices(c)})};function Xre(e){L.typeOf.object("options",e),L.typeOf.object("options.frustum",e.frustum),L.typeOf.object("options.origin",e.origin),L.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=M(e._drawNearPlane,!0);let r,s;t instanceof Vne?(r=0,s=Vne.packedLength):t instanceof Xc&&(r=1,s=Xc.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=H.clone(i),this._orientation=_o.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+H.packedLength+_o.packedLength}Xre.pack=function(e,t,n){L.typeOf.object("value",e),L.defined("array",t),n=M(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,0===i?(Vne.pack(o,t,n),n+=Vne.packedLength):(Xc.pack(o,t,n),n+=Xc.packedLength),H.pack(e._origin,t,n),n+=H.packedLength,_o.pack(e._orientation,t,n),t[n+=_o.packedLength]=e._drawNearPlane?1:0,t};const Qre=new Vne,$re=new Xc,Kre=new _o,Zre=new H;function Jre(e){if(!D((e=M(e,M.EMPTY_OBJECT)).camera))throw new P("options.camera is required.");this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=M(e.color,Ot.CYAN),this._updateOnChange=M(e.updateOnChange,!0),this.show=M(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}Xre.unpack=function(e,t,n){L.defined("array",e),t=M(t,0);const i=e[t++];let o;0===i?(o=Vne.unpack(e,t,Qre),t+=Vne.packedLength):(o=Xc.unpack(e,t,$re),t+=Xc.packedLength);const r=H.unpack(e,t,Zre);t+=H.packedLength;const s=_o.unpack(e,t,Kre),a=1===e[t+=_o.packedLength];if(!D(n))return new Xre({frustum:o,origin:r,orientation:s,_drawNearPlane:a});const c=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(c),n._frustumType=i,n._origin=H.clone(r,n._origin),n._orientation=_o.clone(s,n._orientation),n._drawNearPlane=a,n},Xre.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=new Float64Array(24);Ore._computeNearFarPlanes(i,o,t,n,s);const a=new Md({position:new Ga({componentDatatype:Ca.DOUBLE,componentsPerAttribute:3,values:s})});let c,l;const u=r?2:1,d=new Uint16Array(8*(u+1));let h=r?0:1;for(;h<2;++h)c=r?8*h:0,l=4*h,d[c]=l,d[c+1]=l+1,d[c+2]=l+1,d[c+3]=l+2,d[c+4]=l+2,d[c+5]=l+3,d[c+6]=l+3,d[c+7]=l;for(h=0;h<2;++h)c=8*(u+h),l=4*h,d[c]=l,d[c+1]=l+4,d[c+2]=l+1,d[c+3]=l+5,d[c+4]=l+2,d[c+5]=l+6,d[c+6]=l+3,d[c+7]=l+7;return new Na({attributes:a,indices:d,primitiveType:Vr.LINES,boundingSphere:$u.fromVertices(s)})};const ese=new H,tse=new re,nse=new _o,ise=new Vne,ose=new Mne,rse=new Xc,sse=new Hc,ase=new Ot,cse=[1,1e5];function lse(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=M(e,0)}Jre.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,n=this._outlinePrimitives;let i,o;if(this._updateOnChange){for(o=t.length,i=0;i<o;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(0===t.length){const e=this._camera,o=e.frustum;let r,s;r=o instanceof Vne?ise:o instanceof Mne?ose:o instanceof Xc?rse:sse,r=o.clone(r);let a=this._frustumSplits;!D(a)||a.length<=1?(a=cse,a[0]=this._camera.frustum.near,a[1]=this._camera.frustum.far,s=1):s=a.length-1;const c=e.positionWC,l=e.directionWC,u=e.upWC;let d=e.rightWC;d=H.negate(d,ese);const h=tse;re.setColumn(h,0,d,h),re.setColumn(h,1,u,h),re.setColumn(h,2,l,h);const p=_o.fromRotationMatrix(h,nse);for(t.length=n.length=s,i=0;i<s;++i)r.near=a[i],r.far=a[i+1],t[i]=new V_({geometryInstances:new Zd({geometry:new Ore({origin:c,orientation:p,frustum:r,_drawNearPlane:0===i}),attributes:{color:$d.fromColor(Ot.fromAlpha(this._color,.1,ase))},id:this.id,pickPrimitive:this}),appearance:new Ih({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new V_({geometryInstances:new Zd({geometry:new Xre({origin:c,orientation:p,frustum:r,_drawNearPlane:0===i}),attributes:{color:$d.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)},Jre.prototype.isDestroyed=function(){return!1},Jre.prototype.destroy=function(){const e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return He(this)};const use=Ct.supportsTypedArrays()?new Float32Array(12):[],dse=new H,hse=new H,pse=new H,fse=new H,mse=new H;function _se(){}lse.prototype.update=function(e){if(this._mode=e.mode,e.mode!==gl.SCENE3D)return;const t=e.context,n=e.mapProjection.ellipsoid.radii,i=new on(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(D(this._command)||(this._rs=_s.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new Kr({renderState:this._rs,boundingVolume:new $u(H.ZERO,i.maximumRadius),pass:zt.OPAQUE,owner:this})),!D(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;const e=new bc({sources:["in vec4 position;\n\nout vec4 positionEC;\n\nvoid main()\n{\n positionEC = czm_modelView * position;\n gl_Position = czm_projection * positionEC;\n\n czm_vertexLogDepth();\n}\n"]}),n=new bc({sources:["in vec4 positionEC;\n\nvoid main()\n{\n vec3 position;\n vec3 direction;\n if (czm_orthographicIn3D == 1.0)\n {\n vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;\n vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom\n vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top\n position = vec3(mix(minPlane, maxPlane, uv), 0.0);\n direction = vec3(0.0, 0.0, -1.0);\n } \n else \n {\n position = vec3(0.0);\n direction = normalize(positionEC.xyz);\n }\n\n czm_ray ray = czm_ray(position, direction);\n\n vec3 ellipsoid_center = czm_view[3].xyz;\n\n czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\n if (!czm_isEmpty(intersection))\n {\n out_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n }\n else\n {\n discard;\n }\n\n czm_writeLogDepth();\n}\n"]});o&&(n.defines.push("LOG_DEPTH"),e.defines.push("LOG_DEPTH")),this._sp=ya.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:e,fragmentShaderSource:n,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=function(e,t){const n=e.radii,i=t.camera;let o,r,s;if(i.frustum instanceof Xc)o=H.ZERO,r=i.rightWC,s=i.upWC;else{const t=i.positionWC,n=H.multiplyComponents(e.oneOverRadii,t,dse),a=H.normalize(n,hse),c=H.normalize(H.cross(H.UNIT_Z,n,pse),pse),l=H.normalize(H.cross(a,c,fse),fse),u=H.magnitude(n),d=Math.sqrt(u*u-1);o=H.multiplyByScalar(a,1/u,dse);const h=d/u;r=H.multiplyByScalar(c,h,hse),s=H.multiplyByScalar(l,h,pse)}const a=H.add(o,s,mse);H.subtract(a,r,a),H.multiplyComponents(n,a,a),H.pack(a,use,0);const c=H.subtract(o,s,mse);H.subtract(c,r,c),H.multiplyComponents(n,c,c),H.pack(c,use,3);const l=H.add(o,s,mse);H.add(l,r,l),H.multiplyComponents(n,l,l),H.pack(l,use,6);const u=H.subtract(o,s,mse);return H.add(u,r,u),H.multiplyComponents(n,u,u),H.pack(u,use,9),use}(i,e);if(D(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const e=new Na({attributes:{position:new Ga({componentDatatype:Ca.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:Vr.TRIANGLES});this._va=kl.fromGeometry({context:t,geometry:e,attributeLocations:{position:0},bufferUsage:qe.DYNAMIC_DRAW}),this._command.vertexArray=this._va}},lse.prototype.execute=function(e,t){this._mode===gl.SCENE3D&&this._command.execute(e,t)},lse.prototype.isDestroyed=function(){return!1},lse.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};const gse=/\bgl_FragDepth\b/,yse=/\bdiscard\b/;_se.createDepthOnlyDerivedCommand=function(e,t,n,i){let o,r;return D(i)||(i={}),D(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=Kr.shallowClone(t,i.depthOnlyCommand),D(o)&&i.shaderProgramId===t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r):(i.depthOnlyCommand.shaderProgram=function(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!D(n)){const i=t._attributeLocations;let o,r=t.fragmentShaderSource,s=!1;const a=r.sources;let c=a.length;for(o=0;o<c;++o)if(gse.test(a[o])||yse.test(a[o])){s=!0;break}let l=!1;const u=r.defines;for(c=u.length,o=0;o<c;++o)if("LOG_DEPTH"===u[o]){l=!0;break}let d;s||l?!s&&l&&(d="void main() \n{ \n out_FragColor = vec4(1.0); \n czm_writeLogDepth(); \n} \n",r=new bc({defines:["LOG_DEPTH"],sources:[d]})):(d="void main() \n{ \n out_FragColor = vec4(1.0); \n} \n",r=new bc({sources:[d]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:i})}return n}(n,t.shaderProgram),i.depthOnlyCommand.renderState=function(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!D(i)){const e=_s.getState(t);e.depthMask=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=_s.fromCache(e),n[t.id]=i}return i}(e,t.renderState),i.shaderProgramId=t.shaderProgram.id),i};const bse=/\s+czm_writeLogDepth\(/,vse=/\s+czm_vertexLogDepth\(/;function Ase(e){if(!D(e))throw new P("scene is required.");this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;const t=this;function n(e){const n=e.alpha;if(!D(n))return t._alpha=void 0,t._beta=void 0,void(t._gamma=void 0);t._alpha=V.toRadians(n),t._beta=V.toRadians(e.beta),t._gamma=V.toRadians(e.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}_se.createLogDepthCommand=function(e,t,n){let i;return D(n)||(n={}),D(n.command)&&(i=n.command.shaderProgram),n.command=Kr.shallowClone(e,n.command),D(i)&&n.shaderProgramId===e.shaderProgram.id?n.command.shaderProgram=i:(n.command.shaderProgram=function(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let n=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!D(n)){const i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();let s,a;o.defines=D(o.defines)?o.defines.slice(0):[],o.defines.push("LOG_DEPTH"),r.defines=D(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH");let c=!1,l=o.sources,u=l.length;for(s=0;s<u;++s)if(vse.test(l[s])){c=!0;break}if(!c){for(s=0;s<u;++s)l[s]=bc.replaceMain(l[s],"czm_log_depth_main");a="\n\nvoid main() \n{ \n czm_log_depth_main(); \n czm_vertexLogDepth(); \n} \n",l.push(a)}for(l=r.sources,u=l.length,c=!1,s=0;s<u;++s)bse.test(l[s])&&(c=!0);-1!==r.defines.indexOf("LOG_DEPTH_WRITE")&&(c=!0);let d="";if(!c){for(s=0;s<u;s++)l[s]=bc.replaceMain(l[s],"czm_log_depth_main");d+="\nvoid main() \n{ \n czm_log_depth_main(); \n czm_writeLogDepth(); \n} \n"}l.push(d),n=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id),n},_se.createPickDerivedCommand=function(e,t,n,i){let o,r;return D(i)||(i={}),D(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=Kr.shallowClone(t,i.pickCommand),D(o)&&i.shaderProgramId===t.shaderProgram.id?(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r):(i.pickCommand.shaderProgram=function(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!D(i)){const o=t._attributeLocations;let r=t.fragmentShaderSource;const s=r.sources,a=s.length,c=s.some((e=>e.includes("out_FragData")))?"out_FragData_0":"out_FragColor",l=`void main () \n{ \n czm_non_pick_main(); \n if (${c}.a == 0.0) { \n discard; \n } \n ${c} = ${n}; \n} `,u=new Array(a+1);for(let e=0;e<a;++e)u[e]=bc.replaceMain(s[e],"czm_non_pick_main");u[a]=l,r=new bc({sources:u,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=function(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!D(i)){const e=_s.getState(t);e.blending.enabled=!1,e.depthMask=!0,i=_s.fromCache(e),n[t.id]=i}return i}(e,t.renderState),i.shaderProgramId=t.shaderProgram.id),i},_se.createHdrCommand=function(e,t,n){let i;return D(n)||(n={}),D(n.command)&&(i=n.command.shaderProgram),n.command=Kr.shallowClone(e,n.command),D(i)&&n.shaderProgramId===e.shaderProgram.id?n.command.shaderProgram=i:(n.command.shaderProgram=function(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!D(n)){const i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=D(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=D(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id),n};const Tse=new _o,wse=new _o,Ese=new re;function xse(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}Ase.prototype.update=function(){if(!D(this._alpha))return;D(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);const e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;!function(e,t,n,i){const o=e.direction,r=e.right,s=e.up,a=_o.fromAxisAngle(o,n,wse),c=_o.fromAxisAngle(r,i,Tse),l=_o.multiply(c,a,c),u=_o.fromAxisAngle(s,t,wse);_o.multiply(u,l,l);const d=re.fromQuaternion(l,Ese);re.multiplyByVector(d,r,r),re.multiplyByVector(d,s,s),re.multiplyByVector(d,o,o)}(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma},Ase.prototype.isDestroyed=function(){return!1},Ase.prototype.destroy=function(){return this._removeListener(),He(this)};const Sse=[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],Cse=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7];for(let ko=0;ko<Cse.length;++ko)Cse[ko]*=1e6;const Ise=Cse[1],Ose=Cse[Cse.length-1];for(let ko=0;ko<Cse.length;++ko)Cse[ko]=(Cse[ko]-Ose)/(Ise-Ose);let Dse=0;const Pse=new H;function Nse(e,t,n){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=gl.SCENE3D,this.morphTime=gl.getMorphTime(gl.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=n,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,pickVoxel:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,renderable:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.atmosphere=void 0,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.splitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0}xse.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;const t=e.camera,n=t.positionCartographic;if(!D(n)||n.height>8e5||e.mode!==gl.SCENE3D)return e.fog.enabled=!1,void(e.fog.density=0);const i=n.height,o=function(e){const t=Sse,n=t.length;if(e<t[0])return Dse=0,Dse;if(e>t[n-1])return Dse=n-2,Dse;if(e>=t[Dse]){if(Dse+1<n&&e<t[Dse+1])return Dse;if(Dse+2<n&&e<t[Dse+2])return++Dse,Dse}else if(Dse-1>=0&&e>=t[Dse-1])return--Dse,Dse;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return Dse=i,Dse}(i),r=V.clamp((i-Sse[o])/(Sse[o+1]-Sse[o]),0,1);let s=V.lerp(Cse[o],Cse[o+1],r);const a=1e6*this.density;s=s*(a-a/Ise*Ose)*1e-6;const c=H.normalize(t.positionWC,Pse);s*=1-Math.abs(H.dot(t.directionWC,c)),e.fog.density=s,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};const Rse=0,Lse=1,Mse=2,Fse=3,Bse=4,zse=5,Use=6,kse=7,Vse=8,Hse=9,Gse=10,jse=11,Wse=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function qse(){this._frontFaceAlphaByDistance=new Au(0,1,0,1),this._backFaceAlphaByDistance=new Au(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=Ir.clone(Ir.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(jse),this._derivedBlendCommandTypes=new Array(jse),this._derivedPickCommandTypes=new Array(jse),this._derivedCommandTypesToUpdate=new Array(jse),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}function Yse(e,t,n,i){return e?D(n)?(Au.clone(n,i),i.nearValue*=t,i.farValue*=t,i):(i.nearValue=t,i.farValue=t,i):(i.nearValue=1,i.farValue=1,i)}function Xse(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function Qse(e,t,n,i,o){let r=0;const s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;const c=t.cameraUnderground,l=e._requiresManualDepthTest,u=i?Hse:l?kse:zse,d=i?Gse:l?Vse:Use;return t.mode===gl.SCENE2D?(o[r++]=Mse,o[r++]=u,r):(a?(n||(o[r++]=Bse),c?(o[r++]=u,o[r++]=d):(o[r++]=d,o[r++]=u)):c?(n||(o[r++]=Fse),o[r++]=Rse,o[r++]=d):(n||(o[r++]=Mse),o[r++]=Lse,o[r++]=u),r)}function $se(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function Kse(e,t){return e.indexOf(t)>-1}function Zse(e,t){$se(e.defines,"TRANSLUCENT"),$se(t.defines,"TRANSLUCENT")}function Jse(e,t){$se(e.defines,"GROUND_ATMOSPHERE"),$se(t.defines,"GROUND_ATMOSPHERE"),$se(e.defines,"FOG"),$se(t.defines,"FOG"),$se(e.defines,"TRANSLUCENT"),$se(t.defines,"TRANSLUCENT")}function eae(e,t){if(Kse(t.defines,"TILE_LIMIT_RECTANGLE")||Kse(t.defines,"ENABLE_CLIPPING_PLANES"))return;t.sources=["void main() \n{ \n out_FragColor = vec4(1.0); \n} \n"]}function tae(e,t){const n=t.sources,i=n.length;for(let o=0;o<i;++o)n[o]=bc.replaceMain(n[o],"czm_globe_translucency_main");n.push("\n\nuniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n#ifdef MANUAL_DEPTH_TEST \n float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st)); \n if (logDepthOrDepth != 0.0) \n { \n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); \n float depthEC = eyeCoordinate.z / eyeCoordinate.w; \n if (v_positionEC.z < depthEC) \n { \n discard; \n } \n } \n#endif \n czm_globe_translucency_main(); \n vec4 classificationColor = texture(u_classificationTexture, st); \n if (classificationColor.a > 0.0) \n { \n // Reverse premultiplication process to get the correct composited result of the classification primitives \n classificationColor.rgb /= classificationColor.a; \n } \n out_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + out_FragColor * (1.0 - classificationColor.a); \n} \n")}function nae(e,t){tae(0,t),$se(e.defines,"GROUND_ATMOSPHERE"),$se(t.defines,"GROUND_ATMOSPHERE"),$se(e.defines,"FOG"),$se(t.defines,"FOG")}function iae(e,t){tae(0,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function oae(e,t){nae(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function rae(e,t){t.sources=["uniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n vec4 pickColor = texture(u_classificationTexture, st); \n if (pickColor == vec4(0.0)) \n { \n discard; \n } \n out_FragColor = pickColor; \n} \n"]}function sae(e,t,n,i,o,r){if(!D(o))return t;if(!i&&D(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!D(s)){const n=t._attributeLocations,i=t.vertexShaderSource.clone(),a=t.fragmentShaderSource.clone();i.defines=D(i.defines)?i.defines.slice(0):[],a.defines=D(a.defines)?a.defines.slice(0):[],o(i,a),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:i,fragmentShaderSource:a,attributeLocations:n})}return s}function aae(e){e.cull.face=ph.BACK,e.cull.enabled=!0}function cae(e){e.cull.face=ph.FRONT,e.cull.enabled=!0}function lae(e){e.cull.face=ph.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function uae(e){e.cull.face=ph.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function dae(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function hae(e){e.cull.face=ph.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=dh.ALPHA_BLEND}function pae(e){e.cull.face=ph.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=dh.ALPHA_BLEND}function fae(e){e.cull.face=ph.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function mae(e){e.cull.face=ph.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function _ae(e,t,n,i,o){if(!D(i))return e;if(!n&&D(t))return t;let r=o[e.id];if(!D(r)){const t=_s.getState(e);i(t),r=_s.fromCache(t),o[e.id]=r}return r}function gae(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function yae(e,t,n,i,o){return D(o)?!i&&D(n)?n:ni(t,o(e),!1):t}function bae(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}Object.defineProperties(qse.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}}),qse.prototype.update=function(e){const t=e.globe;if(!D(t)||!t.show)return this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,void(this._useDepthPlane=!1);this._frontFaceAlphaByDistance=Yse(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=Yse(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=Xse(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=Xse(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=function(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==gl.SCENE2D&&t.context.depthTexture}(this,e,t),this._sunVisibleThroughGlobe=function(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}(this,e),this._environmentVisible=function(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}(this,e),this._useDepthPlane=function(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}(this,e),this._numberOfTextureUniforms=function(e){let t=0;e._frontFaceTranslucent&&++t;e._requiresManualDepthTest&&++t;return t}(this),this._rectangle=Ir.clone(t.translucency.rectangle,this._rectangle),function(e,t){let n;e._derivedCommandsLength=Qse(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=Qse(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=Qse(e,t,!1,!0,e._derivedPickCommandTypes);let i=0;for(n=0;n<e._derivedCommandsLength;++n)i|=1<<e._derivedCommandTypes[n];for(n=0;n<e._derivedBlendCommandsLength;++n)i|=1<<e._derivedBlendCommandTypes[n];for(n=0;n<e._derivedPickCommandsLength;++n)i|=1<<e._derivedPickCommandTypes[n];let o=0;for(n=0;n<jse;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;const r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!D(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=[new bae({pass:zt.GLOBE,pickOnly:!1,getShaderProgramFunction:Zse,getRenderStateFunction:aae,getUniformMapFunction:void 0}),new bae({pass:zt.GLOBE,pickOnly:!1,getShaderProgramFunction:Jse,getRenderStateFunction:cae,getUniformMapFunction:void 0}),new bae({pass:zt.GLOBE,pickOnly:!1,getShaderProgramFunction:eae,getRenderStateFunction:lae,getUniformMapFunction:void 0}),new bae({pass:zt.GLOBE,pickOnly:!1,getShaderProgramFunction:eae,getRenderStateFunction:uae,getUniformMapFunction:void 0}),new bae({pass:zt.GLOBE,pickOnly:!1,getShaderProgramFunction:eae,getRenderStateFunction:dae,getUniformMapFunction:void 0}),new bae({pass:zt.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:tae,getRenderStateFunction:hae,getUniformMapFunction:gae}),new bae({pass:zt.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:nae,getRenderStateFunction:pae,getUniformMapFunction:gae}),new bae({pass:zt.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:iae,getRenderStateFunction:hae,getUniformMapFunction:gae}),new bae({pass:zt.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:oae,getRenderStateFunction:pae,getUniformMapFunction:gae}),new bae({pass:zt.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:rae,getRenderStateFunction:fae,getUniformMapFunction:gae}),new bae({pass:zt.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:rae,getRenderStateFunction:mae,getUniformMapFunction:gae})])}(this,e)};const vae=new Array(jse),Aae=new Array(jse);function Tae(e,t,n,i,o,r,s){for(let a=0;a<t;++a){const t=e[a],c=t.derivedCommands.type;(!D(s)||s.indexOf(c)>-1)&&n(t,i,o,r)}}function wae(e,t,n,i,o,r){for(let s=0;s<t;++s)n(e[s],i,o,r)}qse.prototype.updateDerivedCommands=function(e,t){const n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(0!==i){for(let e=0;e<i;++e)Aae[e]=this._derivedCommandPacks[n[e]],vae[e]=Wse[n[e]];!function(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency;const c=e._derivedCommandsDirty;if(t.dirty||!D(a)||c){t.dirty=!1,D(a)||(a={},t.derivedCommands.globeTranslucency=a);const c=s.frameNumber,l=M(a.uniformMapDirtyFrame,0),u=M(a.shaderProgramDirtyFrame,0),d=M(a.renderStateDirtyFrame,0),h=a.uniformMap!==t.uniformMap,p=a.shaderProgramId!==t.shaderProgram.id,f=a.renderStateId!==t.renderState.id;h&&(a.uniformMapDirtyFrame=c),p&&(a.shaderProgramDirtyFrame=c),f&&(a.renderStateDirtyFrame=c),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let m=0;m<n;++m){const n=r[m],_=i[m],g=o[m];let y,b,v,A=a[g];D(A)?(y=A.uniformMap,b=A.shaderProgram,v=A.renderState):(y=void 0,b=void 0,v=void 0),A=Kr.shallowClone(t,A),a[g]=A;const T=M(A.derivedCommands.uniformMapDirtyFrame,0),w=M(A.derivedCommands.shaderProgramDirtyFrame,0),E=M(A.derivedCommands.renderStateDirtyFrame,0),x=h||T<l,S=p||w<u,C=f||E<d;x&&(A.derivedCommands.uniformMapDirtyFrame=c),S&&(A.derivedCommands.shaderProgramDirtyFrame=c),C&&(A.derivedCommands.renderStateDirtyFrame=c),A.derivedCommands.type=_,A.pass=n.pass,A.pickOnly=n.pickOnly,A.uniformMap=yae(e,t.uniformMap,y,x,n.getUniformMapFunction),A.shaderProgram=sae(s.context,t.shaderProgram,b,S,n.getShaderProgramFunction,g),A.renderState=_ae(t.renderState,v,C,n.getRenderStateFunction,n.renderStateCache)}}}(this,e,i,n,vae,Aae,t)}},qse.prototype.pushDerivedCommands=function(e,t,n){const i=n.passes.pick||n.passes.pickVoxel;if(i&&t)return;let o=this._derivedCommandTypes,r=this._derivedCommandsLength;if(i?(o=this._derivedPickCommandTypes,r=this._derivedPickCommandsLength):t&&(o=this._derivedBlendCommandTypes,r=this._derivedBlendCommandsLength),0===r)return void n.commandList.push(e);const s=e.derivedCommands.globeTranslucency;for(let a=0;a<r;++a){const e=Wse[o[a]];n.commandList.push(s[e])}};const Eae=[Rse,Lse],xae=[Mse,Fse,Bse];qse.prototype.executeGlobeCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[zt.GLOBE],a=e.indices[zt.GLOBE];0!==a&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),Tae(s,a,t,i,r,o,Eae))},qse.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[zt.GLOBE],a=e.indices[zt.GLOBE],c=e.commands[zt.TERRAIN_CLASSIFICATION],l=e.indices[zt.TERRAIN_CLASSIFICATION];if(0===a||0===l)return;const u=this._frontFaceTranslucent,d=this._backFaceTranslucent;if(u&&d||wae(c,l,t,i,r,o),!u&&!d)return;this._globeTranslucencyFramebuffer=n;const h=r.uniformState.globeDepthTexture,p=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,Tae(s,a,t,i,r,o,xae),r.depthTexture){const e=n.packDepth(r,o);r.uniformState.globeDepthTexture=e}wae(c,l,t,i,r,o),r.uniformState.globeDepthTexture=h,o.framebuffer=p};const Sae="uniform sampler2D colorTexture;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n out_FragColor = texture(colorTexture, v_textureCoordinates);\n}\n";function Cae(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new ou({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new ou({depthStencil:!0,createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new Bt({color:new Ot(0,0,0,0),owner:this}),this._clearCommand=new Bt({color:new Ot(0,0,0,0),depth:1,stencil:0});const e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(Cae.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}}),Cae.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const Iae={depthMask:!1,stencilTest:{enabled:!0,frontFunction:ny.EQUAL,frontOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},backFunction:ny.NEVER,reference:0,mask:sy.CLASSIFICATION_MASK},blending:dh.ALPHA_BLEND},Oae={depthMask:!1,stencilTest:{enabled:!0,frontFunction:ny.NOT_EQUAL,frontOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},backFunction:ny.NEVER,reference:0,mask:sy.CLASSIFICATION_MASK},blending:dh.ALPHA_BLEND},Dae={depthMask:!0,depthTest:{enabled:!0},stencilTest:sy.setCesium3DTileBit(),stencilMask:sy.CESIUM_3D_TILE_MASK,blending:dh.ALPHA_BLEND};function Pae(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}function Nae(e){if(D(e)&&e.length!==gS.NUMBER_OF_JOB_TYPES)throw new P("A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES.");const t=new Array(gS.NUMBER_OF_JOB_TYPES);t[gS.TEXTURE]=new Pae(D(e)?e[gS.TEXTURE]:10),t[gS.PROGRAM]=new Pae(D(e)?e[gS.PROGRAM]:10),t[gS.BUFFER]=new Pae(D(e)?e[gS.BUFFER]:30);const n=t.length;let i,o=0;for(i=0;i<n;++i)o+=t[i].total;const r=new Array(n);for(i=0;i<n;++i)r[i]=!1;this._totalBudget=o,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=r}function Rae(e){const t=O8((e=M(e,M.EMPTY_OBJECT)).container);if(!D(t))throw new P("container is required");this._container=t;const n=document.createElement("div");n.className="cesium-performanceDisplay";const i=document.createElement("div");i.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),i.appendChild(this._fpsText);const o=document.createElement("div");o.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),o.appendChild(this._msText),n.appendChild(o),n.appendChild(i),this._container.appendChild(n),this._lastFpsSampleTime=rJ(),this._lastMsSampleTime=rJ(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const r=document.createElement("div");r.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),r.appendChild(this._throttledText),n.appendChild(r)}function Lae(){this._framebuffer=new ou,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Cae.prototype.update=function(e,t,n){const i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,c=!D(i)||i.width!==s||i.height!==a;if((c||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),D(this._previousFramebuffer)||(this._depthStencilTexture=new Sc({context:e,width:s,height:a,pixelFormat:is.DEPTH_STENCIL,pixelDatatype:ts.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new iu({context:e,width:s,height:a,format:nu.DEPTH24_STENCIL8,numSamples:t})))),!D(this._fbo.framebuffer)||c||o||r){let i,o;this._fbo.destroy(),this._fboClassified.destroy(),D(this._previousFramebuffer)?(i=n.getDepthStencilTexture(),o=n.getDepthStencilRenderbuffer()):(i=this._depthStencilTexture,o=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(i),D(o)&&this._fbo.setDepthStencilRenderbuffer(o),this._fbo.update(e,s,a,t),D(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(i),this._fboClassified.update(e,s,a))}if(D(this._rsUnclassified)||(this._rsUnclassified=_s.fromCache(Iae),this._rsClassified=_s.fromCache(Oae),this._rsDefault=_s.fromCache(Dae)),!D(this._unclassifiedCommand)||o||r){D(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const t=D(this._previousFramebuffer)?"uniform sampler2D colorTexture;\nin vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n#ifdef UNCLASSIFIED\n out_FragColor = color * czm_invertClassificationColor;\n#else\n out_FragColor = color;\n#endif\n}\n":"uniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform sampler2D classifiedTexture;\nin vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n bool isClassified = all(equal(texture(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 out_FragColor = color * highlightColor;\n gl_FragDepth = texture(depthTexture, v_textureCoordinates).r;\n}\n",n=new bc({defines:["UNCLASSIFIED"],sources:[t]}),i=new bc({sources:[t]});this._unclassifiedCommand=e.createViewportQuadCommand(n,{renderState:D(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(i,{renderState:D(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),D(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),D(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(Sae,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}},Cae.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)},Cae.prototype.clear=function(e,t){D(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))},Cae.prototype.executeClassified=function(e,t){if(!D(this._previousFramebuffer)){const n=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)},Cae.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)},Cae.prototype.isDestroyed=function(){return!1},Cae.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),D(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),He(this)},Object.defineProperties(Pae.prototype,{total:{get:function(){return this._total}}}),Nae.getTimestamp=rJ,Object.defineProperties(Nae.prototype,{totalBudget:{get:function(){return this._totalBudget}}}),Nae.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget},Nae.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let n=0;n<t;++n){const t=e[n];t.starvedLastFrame=t.starvedThisFrame,t.starvedThisFrame=!1,t.usedThisFrame=0,t.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0},Nae.prototype.execute=function(e,t){const n=this._budgets,i=n[t],o=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&o)return i.starvedThisFrame=!0,!1;let r;if(i.usedThisFrame+i.stolenFromMeThisFrame>=i.total){const e=n.length;let t;for(t=0;t<e&&(r=n[t],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total)||r.starvedLastFrame);++t);if(t===e&&o)return!1;o&&(i.starvedThisFrame=!0)}const s=Nae.getTimestamp();e.execute();const a=Nae.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0},Object.defineProperties(Rae.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(this._throttledText.nodeValue=e?"(throttled)":"",this._throttled=e)}}}),Rae.prototype.update=function(e){const t=rJ(),n=M(e,!0);this._fpsFrameCount++;const i=t-this._lastFpsSampleTime;if(i>1e3){let e="N/A";n&&(e=1e3*this._fpsFrameCount/i|0),this._fpsText.nodeValue=`${e} FPS`,this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;const o=t-this._lastMsSampleTime;if(o>200){let e="N/A";n&&(e=(o/this._msFrameCount).toFixed(2)),this._msText.nodeValue=`${e} MS`,this._lastMsSampleTime=t,this._msFrameCount=0}},Rae.prototype.destroy=function(){return He(this)},Object.defineProperties(Lae.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}}),Lae.prototype.update=function(e,t){!function(e,t,n){const i=n.width,o=n.height;e._framebuffer.update(t,i,o)}(this,e,t),function(e,t,n){if(!D(e._copyDepthCommand)){const n="uniform highp sampler2D u_texture;\nin vec2 v_textureCoordinates;\nvoid main()\n{\n out_FragColor = czm_packDepth(texture(u_texture, v_textureCoordinates).r);\n}\n";e._copyDepthCommand=t.createViewportQuadCommand(n,{renderState:_s.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}(this,e,t)};const Mae=new K,Fae=new K(1,1/255,1/65025,1/16581375);function Bae(e,t){this.near=M(e,0),this.far=M(t,0);const n=zt.NUMBER_OF_PASSES,i=new Array(n),o=new Array(n);for(let r=0;r<n;++r)i[r]=[],o[r]=0;this.commands=i,this.indices=o}Lae.prototype.getDepth=function(e,t,n){if(!D(this.framebuffer))return;const i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=K.unpack(i,0,Mae);return K.divideByScalar(o,255,o),K.dot(o,Fae)},Lae.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},Lae.prototype.isDestroyed=function(){return!1},Lae.prototype.destroy=function(){return this._framebuffer.destroy(),D(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=D(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),He(this)};const zae="uniform highp sampler2D u_depthTexture;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n out_FragColor = czm_packDepth(texture(u_depthTexture, v_textureCoordinates).r);\n}\n";function Uae(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new ou({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new ou({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new ou,this._tempCopyDepthFramebuffer=new ou,this._updateDepthFramebuffer=new ou({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new Fr,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}function kae(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Fr.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Fr.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Fr.clone(o.viewport,e._scissorRectangle),s=!0),D(e._rs)&&Fr.equals(e._viewport,e._rs.viewport)&&!s||(e._rs=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:dh.ALPHA_BLEND}),e._rsUpdate=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:ny.EQUAL,frontOperation:{fail:oy.KEEP,zFail:oy.KEEP,zPass:oy.KEEP},backFunction:ny.NEVER,reference:sy.CESIUM_3D_TILE_MASK,mask:sy.CESIUM_3D_TILE_MASK}})),D(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(zae,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,D(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(Sae,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,D(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(zae,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,D(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(Sae,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,D(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new Bt({color:new Ot(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}function Vae(){this._framebuffer=new ou({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new ou,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new Fr,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}function Hae(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const t=e.colorBufferFloat&&e.depthTexture&&e.floatBlend;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new ou({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new ou({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new ou({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new ou({createColorAttachments:!1}),this._opaqueClearCommand=new Bt({color:new Ot(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new Bt({color:new Ot(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new Bt({color:new Ot(0,0,0,0),owner:this}),this._alphaClearCommand=new Bt({color:new Ot(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 Fr,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function Gae(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function jae(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function Wae(e){Gae(e),jae(e)}Object.defineProperties(Uae.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}}),Uae.prototype.update=function(e,t,n,i,o,r){const s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?ts.HALF_FLOAT:ts.FLOAT:ts.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,c),this._copyDepthFramebuffer.update(e,s,a),kae(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r},Uae.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)},Uae.prototype.executeCopyDepth=function(e,t){D(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())},Uae.prototype.executeUpdateDepth=function(e,t,n,i){const o=D(i)?i:t.framebuffer.depthStencilTexture;if(n||o!==this.colorFramebufferManager.getDepthStencilTexture()){if(D(this._updateDepthCommand)){if(!D(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==o||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const n=this._copyDepthFramebuffer.getColorTexture().width,i=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,n,i);const r=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(r,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,n,i),kae(this,e,n,i,t)}this._tempCopyDepthTexture=o,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}}else D(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)},Uae.prototype.executeCopyColor=function(e,t){D(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},Uae.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;D(i)&&(Ot.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))},Uae.prototype.isDestroyed=function(){return!1},Uae.prototype.destroy=function(){var e;return(e=this)._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy(),D(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),D(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),D(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),D(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),He(this)},Object.defineProperties(Vae.prototype,{classificationTexture:{get:function(){return this._framebuffer.getColorTexture()}},classificationFramebuffer:{get:function(){return this._framebuffer.framebuffer}},packedDepthFramebuffer:{get:function(){return this._packedDepthFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._framebuffer.getDepthStencilTexture()}},depthStencilRenderbuffer:{get:function(){return this._framebuffer.getDepthStencilRenderbuffer()}},packedDepthTexture:{get:function(){return this._packedDepthFramebuffer.getColorTexture()}}}),Vae.prototype.updateAndClear=function(e,t,n,i){const o=t.width,r=t.height;!function(e,t,n,i,o){const r=o?t.halfFloatingPointTexture?ts.HALF_FLOAT:ts.FLOAT:ts.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}(this,n,o,r,e),function(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Fr.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Fr.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Fr.clone(o.viewport,e._scissorRectangle),s=!0),D(e._renderState)&&Fr.equals(e._viewport,e._renderState.viewport)&&!s||(e._renderState=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),D(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(zae,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),D(e._clearCommand)||(e._clearCommand=new Bt({color:new Ot(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer.framebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e.classificationFramebuffer,e._clearCommand.renderState=e._renderState}(this,n,o,r,i),this._useHdr=e},Vae.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)},Vae.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture},Vae.prototype.isDestroyed=function(){return!1},Vae.prototype.destroy=function(){var e;return(e=this)._framebuffer.destroy(),e._packedDepthFramebuffer.destroy(),He(this)},Hae.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();const{width:r,height:s}=this._opaqueTexture,a=this._accumulationTexture,c=!D(a)||a.width!==r||a.height!==s||i!==this._useHDR,l=this._numSamples!==o;if((c||l)&&(this._numSamples=o,function(e,t,n,i){Gae(e),e._accumulationTexture=new Sc({context:t,width:n,height:i,pixelFormat:is.RGBA,pixelDatatype:ts.FLOAT});const o=new Float32Array(n*i*4);e._revealageTexture=new Sc({context:t,pixelFormat:is.RGBA,pixelDatatype:ts.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}(this,e,r,s)),(!D(this._translucentFBO.framebuffer)||c||l)&&!function(e,t){jae(e);const n=Me.FRAMEBUFFER_COMPLETE;let i=!0;const{width:o,height:r}=e._accumulationTexture;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,o,r),e._translucentFBO.status===n&&e._adjustTranslucentFBO.status===n||(jae(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,o,r),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,o,r);const s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,c=e._adjustTranslucentFBO.status===n,l=e._adjustAlphaFBO.status===n;s&&a&&c&&l||(Wae(e),e._translucentMultipassSupport=!1,i=!1)}return i}(this,e))return;this._useHDR=i;const u=this;let d,h;D(this._compositeCommand)||(d=new bc({sources:["/**\n * Compositing for Weighted Blended Order-Independent Transparency. See:\n * - http://jcgt.org/published/0002/02/09/\n * - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html\n */\n\nuniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n vec4 opaque = texture(u_opaque, v_textureCoordinates);\n vec4 accum = texture(u_accumulation, v_textureCoordinates);\n float r = texture(u_revealage, v_textureCoordinates).r;\n\n#ifdef MRT\n vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\n vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\n\n out_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n\n if (opaque != czm_backgroundColor)\n {\n out_FragColor.a = 1.0;\n }\n}\n"]}),this._translucentMRTSupport&&d.defines.push("MRT"),h={u_opaque:function(){return u._opaqueTexture},u_accumulation:function(){return u._accumulationTexture},u_revealage:function(){return u._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this})),D(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(d=new bc({defines:["MRT"],sources:[V8]}),h={u_bgColor:function(){return u._translucentMRTClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this})):this._translucentMultipassSupport&&(d=new bc({sources:[V8]}),h={u_bgColor:function(){return u._translucentMultipassClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this}),h={u_bgColor:function(){return u._alphaClearCommand.color},u_depthTexture:function(){return u._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(d,{uniformMap:h,owner:this}))),this._viewport.width=r,this._viewport.height=s;const p=!Fr.equals(this._viewport,t.viewport);let f=p!==this._useScissorTest;this._useScissorTest=p,Fr.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=Fr.clone(t.viewport,this._scissorRectangle),f=!0),D(this._rs)&&Fr.equals(this._viewport,this._rs.viewport)&&!f||(this._rs=_s.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),D(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),D(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const qae={enabled:!0,color:new Ot(0,0,0,0),equationRgb:ah.ADD,equationAlpha:ah.ADD,functionSourceRgb:lh.ONE,functionDestinationRgb:lh.ONE,functionSourceAlpha:lh.ZERO,functionDestinationAlpha:lh.ONE_MINUS_SOURCE_ALPHA},Yae={enabled:!0,color:new Ot(0,0,0,0),equationRgb:ah.ADD,equationAlpha:ah.ADD,functionSourceRgb:lh.ONE,functionDestinationRgb:lh.ONE,functionSourceAlpha:lh.ONE,functionDestinationAlpha:lh.ONE},Xae={enabled:!0,color:new Ot(0,0,0,0),equationRgb:ah.ADD,equationAlpha:ah.ADD,functionSourceRgb:lh.ZERO,functionDestinationRgb:lh.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:lh.ZERO,functionDestinationAlpha:lh.ONE_MINUS_SOURCE_ALPHA};function Qae(e,t,n,i){let o=n[i.id];if(!D(o)){const e=_s.getState(i);e.depthMask=!1,e.blending=t,o=_s.fromCache(e),n[i.id]=o}return o}function $ae(e,t,n,i){const{shaderCache:o}=e,r=o.getDerivedShaderProgram(t,n);if(D(r))return r;const s=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map((function(e){return bc.replaceMain(e,"czm_translucent_main").replace(/out_FragColor/g,"czm_out_FragColor").replace(/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,"").replace(/\bdiscard\b/g,"czm_discard = true").replace(/czm_phong/g,"czm_translucentPhong")})),a.sources.splice(0,0,"vec4 czm_out_FragColor;\nbool czm_discard = false;\n");const c=[...i.matchAll(/out_FragData_(\d+)/g)];let l="";for(let u=0;u<c.length;u++){const e=c[u];l=`layout (location = ${e[1]}) out vec4 ${e[0]};\n${l}`}return a.sources.push(l),a.sources.push(`void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n${i}}\n`),o.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:s})}function Kae(){this._framebuffer=new ou({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}function Zae(e){const t=new hc(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new Fr},t.viewport=new Fr,this._context=e,this._fb=new ou({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}Hae.prototype.createDerivedCommands=function(e,t,n){if(D(n)||(n={}),this._translucentMRTSupport){let r,s;return D(n.translucentCommand)&&(r=n.translucentCommand.shaderProgram,s=n.translucentCommand.renderState),n.translucentCommand=Kr.shallowClone(e,n.translucentCommand),D(r)&&n.shaderProgramId===e.shaderProgram.id?(n.translucentCommand.shaderProgram=r,n.translucentCommand.renderState=s):(n.translucentCommand.shaderProgram=function(e,t){return $ae(e,t,"translucentMRT"," vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;\n float ai = czm_out_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n out_FragData_0 = vec4(Ci * wzi, ai);\n out_FragData_1 = vec4(ai * wzi);\n")}(t,e.shaderProgram),n.translucentCommand.renderState=(i=this,o=e.renderState,Qae(0,qae,i._translucentRenderStateCache,o)),n.shaderProgramId=e.shaderProgram.id),n}var i,o;let r,s,a,c;return D(n.translucentCommand)&&(r=n.translucentCommand.shaderProgram,s=n.translucentCommand.renderState,a=n.alphaCommand.shaderProgram,c=n.alphaCommand.renderState),n.translucentCommand=Kr.shallowClone(e,n.translucentCommand),n.alphaCommand=Kr.shallowClone(e,n.alphaCommand),D(r)&&n.shaderProgramId===e.shaderProgram.id?(n.translucentCommand.shaderProgram=r,n.translucentCommand.renderState=s,n.alphaCommand.shaderProgram=a,n.alphaCommand.renderState=c):(n.translucentCommand.shaderProgram=function(e,t){return $ae(e,t,"translucentMultipass"," vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;\n float ai = czm_out_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n out_FragColor = vec4(Ci, ai) * wzi;\n")}(t,e.shaderProgram),n.translucentCommand.renderState=function(e,t,n){return Qae(0,Yae,e._translucentRenderStateCache,n)}(this,0,e.renderState),n.alphaCommand.shaderProgram=function(e,t){return $ae(e,t,"alphaMultipass"," float ai = czm_out_FragColor.a;\n out_FragColor = vec4(ai);\n")}(t,e.shaderProgram),n.alphaCommand.renderState=function(e,t,n){return Qae(0,Xae,e._alphaRenderStateCache,n)}(this,0,e.renderState),n.shaderProgramId=e.shaderProgram.id),n},Hae.prototype.executeCommands=function(e,t,n,i,o){this._translucentMRTSupport?function(e,t,n,i,o,r){const{context:s,frameState:a}=t,{useLogDepth:c,shadowState:l}=a,u=t._hdr,d=i.framebuffer,h=l.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);const p=e._opaqueFBO.framebuffer;let f,m;i.framebuffer=e._translucentFBO.framebuffer;for(let _=0;_<o.length;++_)f=o[_],f=c?f.derivedCommands.logDepth.command:f,f=u?f.derivedCommands.hdr.command:f,m=h&&f.receiveShadows?f.derivedCommands.oit.shadows.translucentCommand:f.derivedCommands.oit.translucentCommand,n(m,t,s,i,p);D(r)&&(f=r.unclassifiedCommand,m=h&&f.receiveShadows?f.derivedCommands.oit.shadows.translucentCommand:f.derivedCommands.oit.translucentCommand,n(m,t,s,i,p)),i.framebuffer=d}(this,e,t,n,i,o):function(e,t,n,i,o,r){let s,a,c;const{context:l,frameState:u}=t,{useLogDepth:d,shadowState:h}=u,p=t._hdr,f=i.framebuffer,m=h.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(l,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(l,i);const _=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,c=0;c<o.length;++c)s=o[c],s=d?s.derivedCommands.logDepth.command:s,s=p?s.derivedCommands.hdr.command:s,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,l,i,_);for(D(r)&&(s=r.unclassifiedCommand,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,l,i,_)),i.framebuffer=e._alphaFBO.framebuffer,c=0;c<o.length;++c)s=o[c],s=d?s.derivedCommands.logDepth.command:s,s=p?s.derivedCommands.hdr.command:s,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,l,i,_);D(r)&&(s=r.unclassifiedCommand,a=m&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,l,i,_)),i.framebuffer=f}(this,e,t,n,i,o)},Hae.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},Hae.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,Ot.clone(n,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer;(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO.framebuffer,this._alphaClearCommand.execute(e,t)),t.framebuffer=i},Hae.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},Hae.prototype.isDestroyed=function(){return!1},Hae.prototype.destroy=function(){return Wae(this),D(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),D(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),D(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),He(this)},Object.defineProperties(Kae.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}}),Kae.prototype.update=function(e,t,n){const i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&function(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const o=new hc(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new Fr},o.viewport=new Fr,e._passState=o}(this,e);const r=this.framebuffer,s=this._passState;return s.framebuffer=r,s.viewport.width=i,s.viewport.height=o,s.scissorTest.rectangle.x=t.x,s.scissorTest.rectangle.y=o-t.y,s.scissorTest.rectangle.width=1,s.scissorTest.rectangle.height=1,s},Kae.prototype.isDestroyed=function(){return!1},Kae.prototype.destroy=function(){return this._framebuffer.destroy(),He(this)},Zae.prototype.begin=function(e,t){const n=this._context,{width:i,height:o}=t;return Fr.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=o,this._fb.update(n,i,o),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=o,this._passState};const Jae=new Ot;function ece(){this._numSamples=1,this._colorFramebuffer=new ou({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new ou({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new Ot(0,0,0,0),this._clearCommand=new Bt({color:new Ot(0,0,0,0),depth:1,owner:this})}function tce(){}function nce(e){const t=(e=M(e,M.EMPTY_OBJECT)).context;if(!D(t))throw new P("context is required.");if(!D(e.lightCamera))throw new P("lightCamera is required.");if(D(e.numberOfCascades)&&1!==e.numberOfCascades&&4!==e.numberOfCascades)throw new P("Only one or four cascades are supported.");this._enabled=M(e.enabled,!0),this._softShadows=M(e.softShadows,!1),this._normalOffset=M(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=M(e.fromLightSource,!0),this.darkness=M(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=M(e.fadingEnabled,!0),this.maximumDistance=M(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n,i=!0;(Ct.isInternetExplorer()||Ct.isEdge()||(Ct.isChrome()||Ct.isFirefox())&&Ct.isWindows()&&!t.depthTexture)&&(i=!1),this._polygonOffsetSupported=i,this._terrainBias={polygonOffset:i,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:i,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 ve,this._shadowMapTexture=void 0,this._lightDirectionEC=new H,this._lightPositionEC=new K,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new yce,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new $u,this._isPointLight=M(e.isPointLight,!1),this._pointLightRadius=M(e.pointLightRadius,100),this._cascadesEnabled=!this._isPointLight&&M(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?M(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new kt,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new Hc:D(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new K,new K],this._cascadeMatrices=[new ve,new ve,new ve,new ve],this._cascadeDistances=new K,n=this._isPointLight?6:this._cascadesEnabled?this._numberOfCascades:1,this._passes=new Array(n);for(let o=0;o<n;++o)this._passes[o]=new ice(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,rce(this),this._clearCommand=new Bt({depth:1,color:new Ot}),this._clearPassState=new hc(t),this._size=M(e.size,2048),this.size=this._size}function ice(e){this.camera=new yce,this.passState=new hc(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function oce(e,t){return _s.fromCache({cull:{enabled:!0,face:ph.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 rce(e){const t=!e._usesDepthTexture;e._primitiveRenderState=oce(t,e._primitiveBias),e._terrainRenderState=oce(t,e._terrainBias),e._pointRenderState=oce(t,e._pointBias)}function sce(e){const t=e._passes.length;for(let n=0;n<t;++n){const t=e._passes[n],i=t.framebuffer;D(i)&&!i.isDestroyed()&&i.destroy(),t.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function ace(e,t){e._isPointLight?function(e,t){const n=new iu({context:t,width:e._textureSize.x,height:e._textureSize.y,format:nu.DEPTH_COMPONENT16}),i=new dc({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,sampler:uc.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){const i=new cs({context:t,depthRenderbuffer:n,colorTextures:[o[r]],destroyAttachments:!1}),s=e._passes[r];s.framebuffer=i,s.passState.framebuffer=i}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}(e,t):e._usesDepthTexture?function(e,t){const n=new Sc({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:is.DEPTH_STENCIL,pixelDatatype:ts.UNSIGNED_INT_24_8,sampler:uc.NEAREST}),i=new cs({context:t,depthStencilTexture:n,destroyAttachments:!1}),o=e._passes.length;for(let r=0;r<o;++r){const t=e._passes[r];t.framebuffer=i,t.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}(e,t):function(e,t){const n=new iu({context:t,width:e._textureSize.x,height:e._textureSize.y,format:nu.DEPTH_COMPONENT16}),i=new Sc({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,sampler:uc.NEAREST}),o=new cs({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),r=e._passes.length;for(let s=0;s<r;++s){const t=e._passes[s];t.framebuffer=o,t.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}(e,t)}function cce(e,t){D(e._passes[0].framebuffer)&&e._shadowMapTexture.width===e._textureSize.x||(sce(e),ace(e,t),function(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==Me.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,rce(e),sce(e),ace(e,t))}(e,t),lce(e,t))}function lce(e,t,n){n=M(n,0),(e._isPointLight||0===n)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}Zae.prototype.end=function(e){const t=M(e.width,1),n=M(e.height,1),i=this._context,o=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.max(t,n),s=r*r,a=Math.floor(.5*t),c=Math.floor(.5*n);let l=0,u=0,d=0,h=-1;for(let p=0;p<s;++p){if(-a<=l&&l<=a&&-c<=u&&u<=c){const e=4*((c-u)*t+l+a);Jae.red=Ot.byteToFloat(o[e]),Jae.green=Ot.byteToFloat(o[e+1]),Jae.blue=Ot.byteToFloat(o[e+2]),Jae.alpha=Ot.byteToFloat(o[e+3]);const n=i.getObjectByPickColor(Jae);if(D(n))return n}if(l===u||l<0&&-l===u||l>0&&l===1-u){const e=d;d=-h,h=e}l+=d,u+=h}},Zae.prototype.readVoxelInfo=function(e){const t=M(e.width,1),n=M(e.height,1),i=this._context.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),o=Math.floor(.5*t),r=4*(Math.floor(.5*n)*t+o);return i.slice(r,r+4)},Zae.prototype.isDestroyed=function(){return!1},Zae.prototype.destroy=function(){return this._fb.destroy(),He(this)},Object.defineProperties(ece.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}}),ece.prototype.update=function(e,t,n,i){const o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?ts.HALF_FLOAT:ts.FLOAT:ts.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)},ece.prototype.clear=function(e,t,n){Ot.clone(n,this._clearCommand.color),Ot.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)},ece.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer},ece.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer},ece.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)},ece.prototype.isDestroyed=function(){return!1},ece.prototype.destroy=function(){var e;return(e=this)._colorFramebuffer.destroy(),e._idFramebuffer.destroy(),He(this)},tce.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`},tce.createShadowCastVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");const r=D(bc.findPositionVarying(e));if(t&&!r){const e=o.length;for(let n=0;n<e;++n)o[n]=bc.replaceMain(o[n],"czm_shadow_cast_main");const t="out vec3 v_positionEC; \nvoid main() \n{ \n czm_shadow_cast_main(); \n v_positionEC = (czm_inverseProjection * gl_Position).xyz; \n}";o.push(t)}return new bc({defines:i,sources:o})},tce.createShadowCastFragmentShader=function(e,t,n,i){const o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=bc.findPositionVarying(e);const a=D(s);a||(s="v_positionEC");const c=r.length;for(let u=0;u<c;++u)r[u]=bc.replaceMain(r[u],"czm_shadow_cast_main");let l="";return t&&(a||(l+="in vec3 v_positionEC; \n"),l+="uniform vec4 shadowMap_lightPositionEC; \n"),l+=i?"void main() \n{ \n":"void main() \n{ \n czm_shadow_cast_main(); \n if (out_FragColor.a == 0.0) \n { \n discard; \n } \n",l+=t?` float distance = length(${s}); \n if (distance >= shadowMap_lightPositionEC.w) \n { \n discard; \n } \n distance /= shadowMap_lightPositionEC.w; // radius \n out_FragColor = czm_packDepth(distance); \n`:n?" out_FragColor = vec4(1.0); \n":" out_FragColor = czm_packDepth(gl_FragCoord.z); \n",l+="} \n",r.push(l),new bc({defines:o,sources:r})},tce.getShadowReceiveShaderKeyword=function(e,t,n,i){return`receiveShadow ${e._usesDepthTexture}${e._polygonOffsetSupported}${e._isPointLight}${e._isSpotLight}${e._numberOfCascades>1}${e.debugCascadeColors}${e.softShadows}${t}${n}${i}`},tce.createShadowReceiveVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new bc({defines:i,sources:o})},tce.createShadowReceiveFragmentShader=function(e,t,n,i,o){const r=bc.findNormalVarying(e),s=!i&&D(r)||i&&o,a=bc.findPositionVarying(e),c=D(a),l=t._usesDepthTexture,u=t._polygonOffsetSupported,d=t._isPointLight,h=t._isSpotLight,p=t._numberOfCascades>1,f=t.debugCascadeColors,m=t.softShadows,_=d?t._pointBias:i?t._terrainBias:t._primitiveBias,g=e.defines.slice(0),y=e.sources.slice(0),b=y.length;for(let T=0;T<b;++T)y[T]=bc.replaceMain(y[T],"czm_shadow_receive_main");d?g.push("USE_CUBE_MAP_SHADOW"):l&&g.push("USE_SHADOW_DEPTH_TEXTURE"),m&&!d&&g.push("USE_SOFT_SHADOWS"),p&&n&&i&&(s?g.push("ENABLE_VERTEX_LIGHTING"):g.push("ENABLE_DAYNIGHT_SHADING")),n&&_.normalShading&&s&&(g.push("USE_NORMAL_SHADING"),_.normalShadingSmooth>0&&g.push("USE_NORMAL_SHADING_SMOOTH"));let v,A="";return A+=d?"uniform samplerCube shadowMap_textureCube; \n":"uniform sampler2D shadowMap_texture; \n",v=c?` return vec4(${a}, 1.0); \n`:"#ifndef LOG_DEPTH \n return czm_windowToEyeCoordinates(gl_FragCoord); \n#else \n return vec4(v_logPositionEC, 1.0); \n#endif \n",A+=`uniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \n#ifdef LOG_DEPTH \nin vec3 v_logPositionEC; \n#endif \nvec4 getPositionEC() \n{ \n${v}} \nvec3 getNormalEC() \n{ \n${s?` return normalize(${r}); \n`:" return vec3(1.0); \n"}} \nvoid applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) \n{ \n${_.normalOffset&&s?" float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; \n float normalOffsetScale = 1.0 - nDotL; \n vec3 offset = normalOffset * normalOffsetScale * normalEC; \n positionEC.xyz += offset; \n":""}} \n`,A+="void main() \n{ \n czm_shadow_receive_main(); \n vec4 positionEC = getPositionEC(); \n vec3 normalEC = getNormalEC(); \n float depth = -positionEC.z; \n",A+=" 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",i?A+=" shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n":u||(A+=" shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n"),A+=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"+(f?" // Draw cascade colors for debugging \n out_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",A+=" out_FragColor.rgb *= visibility; \n} \n",y.push(A),new bc({defines:g,sources:y})},nce.MAXIMUM_DISTANCE=2e4,nce.prototype.debugCreateRenderStates=function(){rce(this)},Object.defineProperties(nce.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){!function(e,t){e._size=t;const n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=rs.maximumCubeMapSize>=t?t:rs.maximumCubeMapSize,o.x=t,o.y=t;const e=new Fr(0,0,t,t);n[0].passState.viewport=e,n[1].passState.viewport=e,n[2].passState.viewport=e,n[3].passState.viewport=e,n[4].passState.viewport=e,n[5].passState.viewport=e}else 1===i?(t=rs.maximumTextureSize>=t?t:rs.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new Fr(0,0,t,t)):4===i&&(t=rs.maximumTextureSize>=2*t?t:rs.maximumTextureSize/2,o.x=2*t,o.y=2*t,n[0].passState.viewport=new Fr(0,0,t,t),n[1].passState.viewport=new Fr(t,0,t,t),n[2].passState.viewport=new Fr(0,t,t,t),n[3].passState.viewport=new Fr(t,t,t,t));e._clearPassState.viewport=new Fr(0,0,o.x,o.y);for(let r=0;r<i;++r){const e=n[r],t=e.passState.viewport,i=t.x/o.x,s=t.y/o.y,a=t.width/o.x,c=t.height/o.y;e.textureOffsets=new ve(a,0,0,i,0,c,0,s,0,0,1,0,0,0,0,1)}}(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}}});const uce=new Fr;function dce(e,t){const n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=.3*Math.min(i,o),s=uce;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;D(a)||(a=function(e,t){let n;n=e._isPointLight?"uniform samplerCube shadowMap_textureCube; \nin 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(czm_textureCube(shadowMap_textureCube, dir)); \n out_FragColor = vec4(vec3(shadow), 1.0); \n} \n":`uniform sampler2D shadowMap_texture; \nin vec2 v_textureCoordinates; \nvoid main() \n{ \n${e._usesDepthTexture?" float shadow = texture(shadowMap_texture, v_textureCoordinates).r; \n":" float shadow = czm_unpackDepth(texture(shadowMap_texture, v_textureCoordinates)); \n"} out_FragColor = vec4(vec3(shadow), 1.0); \n} \n`;const i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=zt.OVERLAY,i}(e,n),e._debugShadowViewCommand=a),D(a.renderState)&&Fr.equals(a.renderState.viewport,s)||(a.renderState=_s.fromCache({viewport:Fr.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}const hce=new Array(8);hce[0]=new K(-1,-1,-1,1),hce[1]=new K(1,-1,-1,1),hce[2]=new K(1,1,-1,1),hce[3]=new K(-1,1,-1,1),hce[4]=new K(-1,-1,1,1),hce[5]=new K(1,-1,1,1),hce[6]=new K(1,1,1,1),hce[7]=new K(-1,1,1,1);const pce=new ve,fce=new Array(8);for(let ko=0;ko<8;++ko)fce[ko]=new K;const mce=[Ot.RED,Ot.GREEN,Ot.BLUE,Ot.MAGENTA],_ce=new H;function gce(e,t){dce(e,t);const n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new Jre({camera:e._sceneCamera,color:Ot.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new Jre({camera:e._shadowMapCamera,color:Ot.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let i=0;i<e._numberOfCascades;++i)n&&(e._debugCascadeFrustums[i]=e._debugCascadeFrustums[i]&&e._debugCascadeFrustums[i].destroy(),e._debugCascadeFrustums[i]=new Jre({camera:e._passes[i].camera,color:mce[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!D(e._debugLightFrustum)||e._needsUpdate){const t=e._shadowMapCamera.positionWC,n=_o.IDENTITY,i=2*e._pointLightRadius,o=H.fromElements(i,i,i,_ce),r=ve.fromTranslationQuaternionRotationScale(t,n,o,pce);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=function(e,t){return new V_({geometryInstances:[new Zd({geometry:new qd({minimum:new H(-.5,-.5,-.5),maximum:new H(.5,.5,.5)}),attributes:{color:$d.fromColor(t)}}),new Zd({geometry:new Uq({radius:.5}),attributes:{color:$d.fromColor(t)}})],appearance:new Ih({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}(r,Ot.YELLOW)}e._debugLightFrustum.update(t)}else D(e._debugLightFrustum)&&!e._needsUpdate||(e._debugLightFrustum=new Jre({camera:e._shadowMapCamera,color:Ot.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function yce(){this.viewMatrix=new ve,this.inverseViewMatrix=new ve,this.frustum=void 0,this.positionCartographic=new Qt,this.positionWC=new H,this.directionWC=H.clone(H.UNIT_Z),this.upWC=H.clone(H.UNIT_Y),this.rightWC=H.clone(H.UNIT_X),this.viewProjectionMatrix=new ve}yce.prototype.clone=function(e){ve.clone(e.viewMatrix,this.viewMatrix),ve.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Qt.clone(e.positionCartographic,this.positionCartographic),H.clone(e.positionWC,this.positionWC),H.clone(e.directionWC,this.directionWC),H.clone(e.upWC,this.upWC),H.clone(e.rightWC,this.rightWC)};const bce=new ve(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);yce.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return ve.multiply(t,e,this.viewProjectionMatrix),ve.multiply(bce,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const vce=new Array(5),Ace=new Vne,Tce=new Array(4),wce=new H,Ece=new H;const xce=new ve,Sce=new H,Cce=new H,Ice=new H;const Oce=[new H(-1,0,0),new H(0,-1,0),new H(0,0,-1),new H(1,0,0),new H(0,1,0),new H(0,0,1)],Dce=[new H(0,-1,0),new H(0,0,-1),new H(0,-1,0),new H(0,-1,0),new H(0,0,1),new H(0,-1,0)],Pce=[new H(0,0,1),new H(1,0,0),new H(-1,0,0),new H(0,0,-1),new H(1,0,0),new H(1,0,0)];const Nce=new H,Rce=new H,Lce=new $u,Mce=Lce.center;function Fce(e,t){const n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?H.clone(i.directionWC,r.directionWC):e._isPointLight?H.clone(i.positionWC,r.positionWC):r.clone(i);const s=e._lightDirectionEC;let a,c;ve.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),H.normalize(s,s),H.negate(s,s),ve.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius,e._fitNearFar?(a=Math.min(t.shadowState.nearPlane,e.maximumDistance),c=Math.min(t.shadowState.farPlane,e.maximumDistance),c=Math.max(c,a+1)):(a=n.frustum.near,c=e.maximumDistance),e._sceneCamera=die.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=c,e._distance=c-a,function(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,o=Lce;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance)return e._outOfView=!0,void(e._needsUpdate=!1);const o=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,Nce),r=H.negate(i.directionWC,Rce),s=H.dot(o,r);if(e.fadingEnabled){const t=V.clamp(s/.1,0,1);e._darkness=V.lerp(1,e.darkness,t)}else e._darkness=e.darkness;if(s<0)return e._outOfView=!0,void(e._needsUpdate=!1);e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)o.center=i.positionWC,o.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(o)===mn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),$u.clone(o,e._boundingSphere);else{const n=i.frustum.far/2,r=H.add(i.positionWC,H.multiplyByScalar(i.directionWC,n,Mce),Mce);o.center=r,o.radius=n,e._outOfView=t.cullingVolume.computeVisibility(o)===mn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),$u.clone(o,e._boundingSphere)}}(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}nce.prototype.update=function(e){if(Fce(this,e),this._needsUpdate)if(cce(this,e.context),this._isPointLight&&function(e,t){const n=new Vne;n.fov=V.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){const o=e._passes[i].camera;o.positionWC=e._shadowMapCamera.positionWC,o.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(o.positionWC,o.positionCartographic),o.directionWC=Oce[i],o.upWC=Dce[i],o.rightWC=Pce[i],ve.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),ve.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}(this,e),this._cascadesEnabled&&(function(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=ve.multiply(i.frustum.projectionMatrix,i.viewMatrix,pce),r=ve.inverse(o,pce),s=n.directionWC;let a=i.directionWC;H.equalsEpsilon(s,a,V.EPSILON10)&&(a=i.upWC);const c=H.cross(s,a,Sce);a=H.cross(c,s,Cce),H.normalize(a,a),H.normalize(c,c);const l=H.fromElements(0,0,0,Ice);let u=ve.computeView(l,s,a,c,xce);const d=ve.multiply(u,r,pce),h=H.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,wce),p=H.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Ece);for(let v=0;v<8;++v){const e=K.clone(hce[v],fce[v]);ve.multiplyByVector(d,e,e),H.divideByScalar(e,e.w,e),H.minimumByComponent(e,h,h),H.maximumByComponent(e,p,p)}p.z+=1e3,h.z-=10;const f=Ice;f.x=-.5*(h.x+p.x),f.y=-.5*(h.y+p.y),f.z=-p.z;const m=ve.fromTranslation(f,pce);u=ve.multiply(m,u,u);const _=.5*(p.x-h.x),g=.5*(p.y-h.y),y=p.z-h.z,b=n.frustum;b.left=-_,b.right=_,b.bottom=-g,b.top=g,b.near=.01,b.far=y,ve.clone(u,n.viewMatrix),ve.inverse(u,n.inverseViewMatrix),ve.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),H.clone(s,n.directionWC),H.clone(a,n.upWC),H.clone(c,n.rightWC)}(this,e),this._numberOfCascades>1&&function(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades;let a;const c=r-o,l=r/o;let u=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,u=.9);const h=Tce,p=vce;for(p[0]=o,p[s]=r,a=0;a<s;++a){const e=(a+1)/s,t=o*Math.pow(l,e),n=o+c*e,i=V.lerp(n,t,u);p[a+1]=i,h[a]=i-p[a]}if(d){for(a=0;a<s;++a)h[a]=Math.min(h[a],e._maximumCascadeDistances[a]);let t=p[0];for(a=0;a<s-1;++a)t+=h[a],p[a+1]=t}K.unpack(p,0,e._cascadeSplits[0]),K.unpack(p,1,e._cascadeSplits[1]),K.unpack(h,0,e._cascadeDistances);const f=n.frustum,m=f.left,_=f.right,g=f.bottom,y=f.top,b=f.near,v=f.far,A=n.positionWC,T=n.directionWC,w=n.upWC,E=i.frustum.clone(Ace),x=n.getViewProjection();for(a=0;a<s;++a){E.near=p[a],E.far=p[a+1];const t=ve.multiply(E.projectionMatrix,i.viewMatrix,pce),o=ve.inverse(t,pce),r=ve.multiply(x,o,pce),s=H.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,wce),c=H.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Ece);for(let e=0;e<8;++e){const t=K.clone(hce[e],fce[e]);ve.multiplyByVector(r,t,t),H.divideByScalar(t,t.w,t),H.minimumByComponent(t,s,s),H.maximumByComponent(t,c,c)}s.x=Math.max(s.x,0),s.y=Math.max(s.y,0),s.z=0,c.x=Math.min(c.x,1),c.y=Math.min(c.y,1),c.z=Math.min(c.z,1);const l=e._passes[a],u=l.camera;u.clone(n);const d=u.frustum;d.left=m+s.x*(_-m),d.right=m+c.x*(_-m),d.bottom=g+s.y*(y-g),d.top=g+c.y*(y-g),d.near=b+s.z*(v-b),d.far=b+c.z*(v-b),l.cullingVolume=u.frustum.computeCullingVolume(A,T,w);const h=e._cascadeMatrices[a];ve.multiply(u.getViewProjection(),i.inverseViewMatrix,h),ve.multiply(l.textureOffsets,h,h)}}(this,e)),this._isPointLight)this._shadowMapCullingVolume=Bc.fromBoundingSphere(this._boundingSphere);else{const e=this._shadowMapCamera,t=e.positionWC,n=e.directionWC,i=e.upWC;this._shadowMapCullingVolume=e.frustum.computeCullingVolume(t,n,i),1===this._passes.length&&this._passes[0].camera.clone(e)}if(1===this._passes.length){const e=this._sceneCamera.inverseViewMatrix;ve.multiply(this._shadowMapCamera.getViewProjection(),e,this._shadowMapMatrix)}this.debugShow&&gce(this,e)},nce.prototype.updatePass=function(e,t){lce(this,e,t)};const Bce=new kt;function zce(e,t,n){const i=e._isPointLight?e._pointBias:n?e._terrainBias:e._primitiveBias;return ni(t,{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){const t=Bce;return t.x=1/e._textureSize.x,t.y=1/e._textureSize.y,K.fromElements(t.x,t.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return K.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new K,combinedUniforms2:new K},!1)}function Uce(e,t,n,i,o,r){let s,a,c;if(D(r)&&(s=r.shaderProgram,a=r.renderState,c=r.uniformMap),(r=Kr.shallowClone(n,r)).castShadows=!0,r.receiveShadows=!1,!D(s)||o!==n.shaderProgram.id||t){const t=n.shaderProgram,o=n.pass===zt.GLOBE,r=n.pass!==zt.TRANSLUCENT,l=e._isPointLight,u=e._usesDepthTexture,d=tce.getShadowCastShaderKeyword(l,o,u,r);if(s=i.shaderCache.getDerivedShaderProgram(t,d),!D(s)){const e=t.vertexShaderSource,n=t.fragmentShaderSource,a=tce.createShadowCastVertexShader(e,l,o),c=tce.createShadowCastFragmentShader(n,l,u,r);s=i.shaderCache.createDerivedShaderProgram(t,d,{vertexShaderSource:a,fragmentShaderSource:c,attributeLocations:t._attributeLocations})}a=e._primitiveRenderState,l?a=e._pointRenderState:o&&(a=e._terrainRenderState);n.renderState.cull.enabled||(a=ti(a,!1),a.cull=ti(a.cull,!1),a.cull.enabled=!1,a=_s.fromCache(a)),c=zce(e,n.uniformMap,o)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=c,r}nce.createReceiveDerivedCommand=function(e,t,n,i,o){D(o)||(o={});const r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,c=s.fragmentShaderSource,l=t.pass===zt.GLOBE;let u=!1;if(l&&(u=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let r,d;D(o.receiveCommand)&&(r=o.receiveCommand.shaderProgram,d=o.receiveCommand.uniformMap),o.receiveCommand=Kr.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;const h=o.receiveShaderCastShadows!==t.castShadows,p=o.receiveShaderProgramId!==t.shaderProgram.id;if(!D(r)||p||n||h){const n=tce.getShadowReceiveShaderKeyword(e[0],t.castShadows,l,u);if(r=i.shaderCache.getDerivedShaderProgram(s,n),!D(r)){const o=tce.createShadowReceiveVertexShader(a,l,u),d=tce.createShadowReceiveFragmentShader(c,e[0],t.castShadows,l,u);r=i.shaderCache.createDerivedShaderProgram(s,n,{vertexShaderSource:o,fragmentShaderSource:d,attributeLocations:s._attributeLocations})}d=zce(e[0],t.uniformMap,l)}o.receiveCommand.shaderProgram=r,o.receiveCommand.uniformMap=d,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o},nce.createCastDerivedCommand=function(e,t,n,i,o){if(D(o)||(o={}),t.castShadows){let r=o.castCommands;D(r)||(r=o.castCommands=[]);const s=o.castShaderProgramId,a=e.length;r.length=a;for(let o=0;o<a;++o)r[o]=Uce(e[o],n,t,i,s,r[o]);o.castShaderProgramId=t.shaderProgram.id}return o},nce.prototype.isDestroyed=function(){return!1},nce.prototype.destroy=function(){sce(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(let e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return He(this)};const kce="uniform sampler2D colorTexture;\n\n#ifdef DEBUG_SHOW_DEPTH\nuniform sampler2D u_packedTranslucentDepth;\n#endif\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n#ifdef DEBUG_SHOW_DEPTH\n if (v_textureCoordinates.x < 0.5)\n {\n out_FragColor.rgb = vec3(czm_unpackDepth(texture(u_packedTranslucentDepth, v_textureCoordinates)));\n out_FragColor.a = 1.0;\n }\n#else\n vec4 color = texture(colorTexture, v_textureCoordinates);\n\n#ifdef PICK\n if (color == vec4(0.0))\n {\n discard;\n }\n#else\n // Reverse premultiplication process to get the correct composited result of the classification primitives\n color.rgb /= color.a;\n#endif\n out_FragColor = color;\n#endif\n}\n";function Vce(e){this._drawClassificationFBO=new ou({createDepthAttachments:!1}),this._accumulationFBO=new ou({createDepthAttachments:!1}),this._packFBO=new ou,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new Bt({color:new Ot(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new Bt({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new Fr,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}function Hce(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function Gce(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function jce(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;const o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;let s,a;if(e._drawClassificationFBO.isDirty(o,r)&&(function(e,t,n,i){Hce(e),e._translucentDepthStencilTexture=new Sc({context:t,width:n,height:i,pixelFormat:is.DEPTH_STENCIL,pixelDatatype:ts.UNSIGNED_INT_24_8,sampler:uc.NEAREST})}(e,t,o,r),function(e,t,n,i){Gce(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,n,i),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,n,i),e._packFBO.update(t,n,i)}(e,t,o,r)),D(e._packDepthCommand)||(s=new bc({sources:["uniform sampler2D u_opaqueDepthTexture;\nuniform sampler2D u_translucentDepthTexture;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n float opaqueDepth = texture(u_opaqueDepthTexture, v_textureCoordinates).r;\n float translucentDepth = texture(u_translucentDepthTexture, v_textureCoordinates).r;\n translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);\n out_FragColor = czm_packDepth(translucentDepth);\n}\n"]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!D(e._compositeCommand)){s=new bc({sources:[kce]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});const n=e._compositeCommand,i=n.shaderProgram,o=t.shaderCache.createDerivedShaderProgram(i,"pick",{vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:new bc({sources:s.sources,defines:["PICK"]}),attributeLocations:i._attributeLocations}),r=Kr.shallowClone(n);r.shaderProgram=o,n.derivedCommands.pick=r}D(e._copyCommand)||(s=new bc({sources:[kce]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),D(e._accumulateCommand)||(s=new bc({sources:[kce]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;const c=!Fr.equals(e._viewport,n.viewport);let l=c!==e._useScissorTest;e._useScissorTest=c,Fr.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=Fr.clone(n.viewport,e._scissorRectangle),l=!0),D(e._rsDepth)&&Fr.equals(e._viewport,e._rsDepth.viewport)&&!l||(e._rsDepth=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),D(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),D(e._rsAccumulate)&&Fr.equals(e._viewport,e._rsAccumulate.viewport)&&!l||(e._rsAccumulate=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:ny.EQUAL,reference:sy.CESIUM_3D_TILE_MASK}})),D(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),D(e._rsComp)&&Fr.equals(e._viewport,e._rsComp.viewport)&&!l||(e._rsComp=_s.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:dh.ALPHA_BLEND})),D(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}function Wce(){this.command=void 0,this.near=void 0,this.far=void 0}function qce(e,t,n){const i=e.context;let o,r;i.depthTexture&&(o=new Uae),e._useOIT&&i.depthTexture&&(r=new Hae(i));const s=new hc(i);s.viewport=Fr.clone(n),this.camera=t,this._cameraClone=die.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new Zae(i),this.pickDepthFramebuffer=new Kae,this.sceneFramebuffer=new ece,this.globeDepth=o,this.globeTranslucencyFramebuffer=new Vae,this.oit=r,this.translucentTileClassification=new Vce(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}Object.defineProperties(Vce.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}}),Vce.prototype.executeTranslucentCommands=function(e,t,n,i,o){const r=i.length;let s,a;const c=e.frameState.useLogDepth,l=e.context,u=n.framebuffer;for(a=0;a<r;++a)if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,s.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(jce(this,l,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(l,n),a=0;a<r;++a){if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,!s.depthForTranslucentClassification)continue;t(s.derivedCommands.depth.depthOnlyCommand,e,l,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(l,n)),n.framebuffer=u}},Vce.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;const o=e.context,r=o.uniformState,s=n.framebuffer;2===this._frustumsDrawn&&(n.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(o,n)),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(o,n),r.updatePass(zt.CESIUM_3D_TILE_CLASSIFICATION);const a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();const c=i.commands[zt.CESIUM_3D_TILE_CLASSIFICATION],l=i.indices[zt.CESIUM_3D_TILE_CLASSIFICATION];for(let u=0;u<l;++u)t(c[u],e,o,n);r.globeDepthTexture=a,n.framebuffer=s,1!==this._frustumsDrawn&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)},Vce.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;1===this._frustumsDrawn?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture();(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),function(e,t,n){if(!e._hasTranslucentDepth)return;const i=n.framebuffer;n.framebuffer=e._drawClassificationFBO.framebuffer,e._clearColorCommand.execute(t._context,n),n.framebuffer=i,e._frustumsDrawn>1&&(n.framebuffer=e._accumulationFBO.framebuffer,e._clearColorCommand.execute(t._context,n));e._hasTranslucentDepth=!1,e._frustumsDrawn=0}(this,e,t)},Vce.prototype.isSupported=function(){return this._supported},Vce.prototype.isDestroyed=function(){return!1},Vce.prototype.destroy=function(){return Hce(this),Gce(this),D(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),D(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),He(this)};const Yce=new H,Xce=new H;function Qce(e,t,n){const i=1/Math.max(1,function(e,t){const n=Math.max(Math.abs(e.x),Math.abs(t.x)),i=Math.max(Math.abs(e.y),Math.abs(t.y)),o=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(n,i),o)}(e.position,t.position));return H.multiplyByScalar(e.position,i,Yce),H.multiplyByScalar(t.position,i,Xce),H.equalsEpsilon(Yce,Xce,n)&&H.equalsEpsilon(e.direction,t.direction,n)&&H.equalsEpsilon(e.up,t.up,n)&&H.equalsEpsilon(e.right,t.right,n)&&ve.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}function $ce(e,t,n,i,o){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);const r=e.frustumCommandsList,s=r.length;for(let a=0;a<s;++a){const e=r[a],s=e.near;if(i>e.far)continue;if(o<s)break;const c=n.pass,l=e.indices[c]++;if(e.commands[c][l]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(t.debugShowFrustums){const t=e.debugFrustumStatistics.commandsInFrustums;t[n.debugOverlappingFrustums]=D(t[n.debugOverlappingFrustums])?t[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}qce.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return Qce(t,n,V.EPSILON15)?(this._cameraStartFired&&rJ()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=rJ(),die.clone(t,n),!0)};const Kce=new Bc,Zce=new Qu;qce.prototype.createPotentiallyVisibleSet=function(e){const t=e.frameState,n=t.camera,i=n.directionWC,o=n.positionWC,r=e._computeCommandList,s=e._overlayCommandList,a=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const c=this.frustumCommandsList,l=c.length,u=zt.NUMBER_OF_PASSES;for(let I=0;I<l;++I)for(let e=0;e<u;++e)c[I].indices[e]=0;r.length=0,s.length=0;const d=this._commandExtents,h=d.length;let p=0,f=+Number.MAX_VALUE,m=-Number.MAX_VALUE;const _=t.shadowState.shadowsEnabled;let g=+Number.MAX_VALUE,y=-Number.MAX_VALUE,b=Number.MAX_VALUE;const v=t.mode===gl.SCENE3D?t.occluder:void 0;let A=t.cullingVolume;const T=Kce.planes;for(let I=0;I<5;++I)T[I]=A.planes[I];A=Kce;const w=a.length;for(let I=0;I<w;++I){const t=a[I],c=t.pass;if(c===zt.COMPUTE)r.push(t);else if(c===zt.OVERLAY)s.push(t);else{let r,s;const a=t.boundingVolume;if(D(a)){if(!e.isVisible(t,A,v))continue;const n=a.computePlaneDistances(o,i,Zce);if(r=n.start,s=n.stop,f=Math.min(f,r),m=Math.max(m,s),_&&t.receiveShadows&&r<nce.MAXIMUM_DISTANCE&&!(c===zt.GLOBE&&r<-100&&s>100)){const e=s-r;c!==zt.GLOBE&&r<100&&(b=Math.min(b,e)),g=Math.min(g,r),y=Math.max(y,s)}}else t instanceof Bt?(r=n.frustum.near,s=n.frustum.far):(r=n.frustum.near,s=n.frustum.far,f=Math.min(f,r),m=Math.max(m,s));let l=d[p];D(l)||(l=d[p]=new Wce),l.command=t,l.near=r,l.far=s,p++}}let E,x;for(_&&(g=Math.min(Math.max(g,n.frustum.near),n.frustum.far),y=Math.max(Math.min(y,n.frustum.far),g)),_&&(t.shadowState.nearPlane=g,t.shadowState.farPlane=y,t.shadowState.closestObjectSize=b),function(e,t,n,i){const o=t.frameState,r=o.camera,s=o.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,a=t.mode===gl.SCENE2D,c=t.nearToFarDistance2D;let l;i*=1+V.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n),a?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),l=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):l=Math.ceil(Math.log(i/n)/Math.log(s));const u=e.frustumCommandsList;u.length=l;for(let d=0;d<l;++d){let e,t;a?(e=Math.min(i-c,n+d*c),t=Math.min(i,e+c)):(e=Math.max(n,Math.pow(s,d)*n),t=Math.min(i,s*e));let o=u[d];D(o)?(o.near=e,o.far=t):o=u[d]=new Bae(e,t)}}(this,e,f,m),E=0;E<p;E++)x=d[E],$ce(this,e,x.command,x.near,x.far);if(p<h)for(E=p;E<h&&(x=d[E],D(x.command));E++)x.command=void 0;const S=c.length,C=t.frustumSplits;C.length=S+1;for(let I=0;I<S;++I)C[I]=c[I].near,I===S-1&&(C[I+1]=c[I].far)},qce.prototype.destroy=function(){let e;this.pickFramebuffer=this.pickFramebuffer&&this.pickFramebuffer.destroy(),this.pickDepthFramebuffer=this.pickDepthFramebuffer&&this.pickDepthFramebuffer.destroy(),this.sceneFramebuffer=this.sceneFramebuffer&&this.sceneFramebuffer.destroy(),this.globeDepth=this.globeDepth&&this.globeDepth.destroy(),this.oit=this.oit&&this.oit.destroy(),this.translucentTileClassification=this.translucentTileClassification&&this.translucentTileClassification.destroy(),this.globeTranslucencyFramebuffer=this.globeTranslucencyFramebuffer&&this.globeTranslucencyFramebuffer.destroy();const t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};const Jce=new _re({pass:Wj.MOST_DETAILED_PRELOAD}),ele=new _re({pass:Wj.MOST_DETAILED_PICK}),tle=new _re({pass:Wj.PICK});function nle(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new Fr(0,0,1,1),n=new die(e);n.frustum=new Xc({width:.1,aspectRatio:1,near:.1}),this._pickOffscreenView=new qce(e,n,t)}nle.prototype.update=function(){this._pickPositionCacheDirty=!0},nle.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return D(i)||(i=new Lae,n[t]=i),i};const ile=new Hc,ole=new H,rle=new H,sle=new kt,ale=new ve;const cle=new Mne,lle=new kt;function ule(e,t,n,i,o){const r=e.camera.frustum;return r instanceof Xc||r instanceof Hc?function(e,t,n,i,o){const r=e.camera;let s=r.frustum;const a=s.offCenterFrustum;D(a)&&(s=a);let c=2*(t.x-o.x)/o.width-1;c*=.5*(s.right-s.left);let l=2*(o.height-t.y-o.y)/o.height-1;l*=.5*(s.top-s.bottom);const u=ve.clone(r.transform,ale);r._setTransform(ve.IDENTITY);const d=H.clone(r.position,ole);H.multiplyByScalar(r.right,c,rle),H.add(rle,d,d),H.multiplyByScalar(r.up,l,rle),H.add(rle,d,d),r._setTransform(u),e.mode===gl.SCENE2D&&H.fromElements(d.z,d.x,d.y,d);const h=s.getPixelDimensions(o.width,o.height,1,1,sle),p=ile;return p.right=.5*h.x,p.left=-p.right,p.top=.5*h.y,p.bottom=-p.top,p.near=s.near,p.far=s.far,p.computeCullingVolume(d,r.directionWC,r.upWC)}(e,t,0,0,o):function(e,t,n,i,o){const r=e.camera,s=r.frustum,a=s.near,c=Math.tan(.5*s.fovy),l=s.aspectRatio*c,u=(2*(t.x-o.x)/o.width-1)*a*l,d=(2*(o.height-t.y-o.y)/o.height-1)*a*c,h=s.getPixelDimensions(o.width,o.height,1,1,lle),p=h.x*n*.5,f=h.y*i*.5,m=cle;return m.top=d+f,m.bottom=d-f,m.right=u+p,m.left=u-p,m.near=a,m.far=s.far,m.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}(e,t,n,i,o)}let dle=3,hle=3,ple=new Fr(0,0,dle,hle);const fle=new kt,mle=new Ot(0,0,0,0);nle.prototype.pick=function(e,t,n,i){L.defined("windowPosition",t),dle=M(n,3),hle=M(i,dle);const{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:c}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let l=s.passState;l.viewport=Fr.clone(a,l.viewport);const u=QR.transformWindowToDrawingBuffer(e,t,fle);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=ule(e,u,dle,hle,a),r.invertClassification=!1,r.passes.pick=!0,r.tilesetPassState=tle,o.uniformState.update(r),e.updateEnvironment(),ple.x=u.x-.5*(dle-1),ple.y=e.drawingBufferHeight-u.y-.5*(hle-1),ple.width=dle,ple.height=hle,l=c.begin(ple,a),e.updateAndExecuteCommands(l,mle),e.resolveFramebuffers(l);const d=c.end(ple);return o.endFrame(),d},nle.prototype.pickVoxelCoordinate=function(e,t,n,i){L.defined("windowPosition",t),dle=M(n,3),hle=M(i,dle);const{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:c}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let l=s.passState;l.viewport=Fr.clone(a,l.viewport);const u=QR.transformWindowToDrawingBuffer(e,t,fle);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=ule(e,u,dle,hle,a),r.invertClassification=!1,r.passes.pickVoxel=!0,r.tilesetPassState=tle,o.uniformState.update(r),e.updateEnvironment(),ple.x=u.x-.5*(dle-1),ple.y=e.drawingBufferHeight-u.y-.5*(hle-1),ple.width=dle,ple.height=hle,l=c.begin(ple,a),e.updateAndExecuteCommands(l,mle),e.resolveFramebuffers(l);const d=c.readVoxelInfo(ple);return o.endFrame(),d};const _le=new Vne,gle=new Mne,yle=new Xc,ble=new Hc;nle.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;if(L.defined("windowPosition",t),!e.context.depthTexture)throw new P("Picking from the depth buffer is not supported. Check pickPositionSupported.");const i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return H.clone(this._pickPositionCache[i],n);const{context:o,frameState:r,camera:s,defaultView:a}=e,{uniformState:c}=o;e.view=a;const l=QR.transformWindowToDrawingBuffer(e,t,fle);let u;e.pickTranslucentDepth?function(e,t){const{defaultView:n,context:i,frameState:o,environmentState:r}=e,{viewport:s,pickDepthFramebuffer:a}=n;e.view=n,s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;let c=n.passState;c.viewport=Fr.clone(s,c.viewport),e.clearPasses(o.passes),o.passes.pick=!0,o.passes.depth=!0,o.cullingVolume=ule(e,t,1,1,s),o.tilesetPassState=tle,e.updateEnvironment(),r.renderTranslucentDepthForPick=!0,c=a.update(i,t,s),e.updateAndExecuteCommands(c,mle),e.resolveFramebuffers(c),i.endFrame()}(e,l):(e.updateFrameState(),c.update(r),e.updateEnvironment()),l.y=e.drawingBufferHeight-l.y,u=D(s.frustum.fov)?s.frustum.clone(_le):D(s.frustum.infiniteProjectionMatrix)?s.frustum.clone(gle):D(s.frustum.width)?s.frustum.clone(yle):s.frustum.clone(ble);const d=a.frustumCommandsList,h=d.length;for(let p=0;p<h;++p){const t=this.getPickDepth(e,p).getDepth(o,l.x,l.y);if(D(t)&&(t>0&&t<1)){const o=d[p];let a;return e.mode===gl.SCENE2D?(a=s.position.z,s.position.z=a-o.near+1,u.far=Math.max(1,o.far-o.near),u.near=1,c.update(r),c.updateFrustum(u)):(u.near=o.near*(0!==p?e.opaqueFrustumNearOffset:1),u.far=o.far,c.updateFrustum(u)),n=QR.drawingBufferToWgs84Coordinates(e,l,t,n),e.mode===gl.SCENE2D&&(s.position.z=a,c.update(r)),this._pickPositionCache[i]=H.clone(n),n}}this._pickPositionCache[i]=void 0};const vle=new Qt;function Ale(e,t){let n,i;const o=[],r=[],s=[],a=[];D(e)||(e=Number.MAX_VALUE);let c=t();for(;D(c);){const n=c.object,l=c.position,u=c.exclude;if(D(l)&&!D(n)){o.push(c);break}if(!D(n)||!D(n.primitive))break;if(!u&&(o.push(c),0>=--e))break;const d=n.primitive;let h=!1;"function"==typeof d.getGeometryInstanceAttributes&&D(n.id)&&(i=d.getGeometryInstanceAttributes(n.id),D(i)&&D(i.show)&&(h=!0,i.show=rh.toValue(!1,i.show),s.push(i))),n instanceof uE&&(h=!0,n.show=!1,a.push(n)),h||(d.show=!1,r.push(d)),c=t()}for(n=0;n<r.length;++n)r[n].show=!0;for(n=0;n<s.length;++n)i=s[n],i.show=rh.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}nle.prototype.pickPosition=function(e,t,n){if(D(n=this.pickPositionWorldCoordinates(e,t,n))&&e.mode!==gl.SCENE3D){H.fromElements(n.y,n.z,n.x,n);const t=e.mapProjection,i=t.ellipsoid,o=t.unproject(n,vle);i.cartographicToCartesian(o,n)}return n},nle.prototype.drillPick=function(e,t,n,i,o){const r=this;return Ale(n,(function(){const n=r.pick(e,t,i,o);if(D(n))return{object:n,position:void 0,exclude:!1}})).map((function(e){return e.object}))};const Tle=new H,wle=new H;function Ele(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1;const i=this;this.promise=new Promise((e=>{i._completePick=()=>{e()}}))}function xle(e,t,n,i){const o=t.direction,r=H.mostOrthogonalAxis(o,Tle),s=H.cross(o,r,Tle),a=H.cross(o,s,wle);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=M(n,.1),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function Sle(e,t,n){const i=t.frameState,{ray:o,width:r,tilesets:s}=n,a=e._pickOffscreenView.camera,c=xle(0,o,r,a),l=Jce;l.camera=a,l.cullingVolume=c;let u=!0;const d=s.length;for(let h=0;h<d;++h){const e=s[h];e.show&&t.primitives.contains(e)&&(e.updateForPass(i,l),u=u&&l.ready)}return u&&n._completePick(),u}function Cle(e,t,n){for(let i=0;i<e.length;++i){const o=e.get(i);o.show&&(D(o.isCesium3DTileset)?D(t)&&-1!==t.indexOf(o)||n.push(o):o instanceof TJ&&Cle(o,t,n))}}function Ile(e,t,n,i,o,r){const s=[];if(Cle(t.primitives,i,s),0===s.length)return Promise.resolve(r());const a=new Ele(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then((function(){return r()}))}function Ole(e,t){return!(!D(e)||!D(t)||0===t.length)&&(t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1)}function Dle(e,t,n,i,o,r,s,a){return Ale(i,(function(){return function(e,t,n,i,o,r,s){const{context:a,frameState:c}=t,l=a.uniformState,u=e._pickOffscreenView;t.view=u,xle(0,n,o,u.camera),ple=Fr.clone(u.viewport,ple);const d=u.pickFramebuffer.begin(ple,u.viewport);let h;t.jobScheduler.disableThisFrame(),t.updateFrameState(),c.invertClassification=!1,c.passes.pick=!0,c.passes.offscreen=!0,c.tilesetPassState=s?ele:tle,l.update(c),t.updateEnvironment(),t.updateAndExecuteCommands(d,mle),t.resolveFramebuffers(d);const p=u.pickFramebuffer.end(ple);if(t.context.depthTexture){const i=u.frustumCommandsList.length;for(let o=0;o<i;++o){const i=e.getPickDepth(t,o).getDepth(a,0,0);if(D(i)&&i>0&&i<1){const e=u.frustumCommandsList[o],r=e.near*(0!==o?t.opaqueFrustumNearOffset:1),s=r+i*(e.far-r);h=tp.getPoint(n,s);break}}}if(t.view=t.defaultView,a.endFrame(),D(p)||D(h))return{object:p,position:h,exclude:!D(h)&&r||Ole(p,i)}}(e,t,n,o,r,s,a)}))}function Ple(e,t,n,i,o,r,s){const a=Dle(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function Nle(e,t,n,i,o,r,s,a){return Dle(e,t,n,i,o,r,s,a)}function Rle(e,t){return new Promise(((n,i)=>{t.then((function(t){const i=e.postRender.addEventListener((function(){i(),n(t)}));e.requestRender()})).catch((function(e){i(e)}))}))}nle.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)Sle(this,e,t[n])&&t.splice(n--,1)},nle.prototype.pickFromRay=function(e,t,n,i){if(L.defined("ray",t),e.mode!==gl.SCENE3D)throw new P("Ray intersections are only supported in 3D mode.");return Ple(this,e,t,n,i,!1,!1)},nle.prototype.drillPickFromRay=function(e,t,n,i,o){if(L.defined("ray",t),e.mode!==gl.SCENE3D)throw new P("Ray intersections are only supported in 3D mode.");return Nle(this,e,t,n,i,o,!1,!1)},nle.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(L.defined("ray",t),e.mode!==gl.SCENE3D)throw new P("Ray intersections are only supported in 3D mode.");const o=this;return t=tp.clone(t),n=D(n)?n.slice():n,Rle(e,Ile(o,e,t,n,i,(function(){return Ple(o,e,t,n,i,!1,!0)})))},nle.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(L.defined("ray",t),e.mode!==gl.SCENE3D)throw new P("Ray intersections are only supported in 3D mode.");const r=this;return t=tp.clone(t),i=D(i)?i.slice():i,Rle(e,Ile(r,e,t,i,o,(function(){return Nle(r,e,t,n,i,o,!1,!0)})))};const Lle=new H,Mle=new H,Fle=new tp,Ble=new Qt;function zle(e,t){const n=e.globe,i=D(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Hh._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,Mle),s=Qt.toCartesian(t,i,Lle),a=Fle;a.origin=s,a.direction=r;const c=new tp;return tp.getPoint(a,o,c.origin),H.negate(r,c.direction),c}function Ule(e,t){const n=e.globe,i=D(n)?n.ellipsoid:e.mapProjection.ellipsoid;return zle(e,Qt.fromCartesian(t,i,Ble))}function kle(e,t){const n=e.globe,i=D(n)?n.ellipsoid:e.mapProjection.ellipsoid;return Qt.fromCartesian(t,i,Ble).height}function Vle(e,t,n,i,o){const r=zle(t,n);return Ile(e,t,r,i,o,(function(){const n=Ple(e,t,r,i,o,!0,!0);if(D(n))return kle(t,n.position)}))}function Hle(e,t,n,i,o,r){const s=Ule(t,n);return Ile(e,t,s,i,o,(function(){const n=Ple(e,t,s,i,o,!0,!0);if(D(n))return H.clone(n.position,r)}))}nle.prototype.sampleHeight=function(e,t,n,i){if(L.defined("position",t),e.mode!==gl.SCENE3D)throw new P("sampleHeight is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new P("sampleHeight requires depth texture support. Check sampleHeightSupported.");const o=Ple(this,e,zle(e,t),n,i,!0,!1);if(D(o))return kle(e,o.position)},nle.prototype.clampToHeight=function(e,t,n,i,o){if(L.defined("cartesian",t),e.mode!==gl.SCENE3D)throw new P("clampToHeight is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new P("clampToHeight requires depth texture support. Check clampToHeightSupported.");const r=Ple(this,e,Ule(e,t),n,i,!0,!1);if(D(r))return H.clone(r.position,o)},nle.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(L.defined("positions",t),e.mode!==gl.SCENE3D)throw new P("sampleHeightMostDetailed is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new P("sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.");n=D(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Vle(this,e,t[s],n,i);return Rle(e,Promise.all(r).then((function(e){const n=e.length;for(let i=0;i<n;++i)t[i].height=e[i];return t})))},nle.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(L.defined("cartesians",t),e.mode!==gl.SCENE3D)throw new P("clampToHeightMostDetailed is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new P("clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.");n=D(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Hle(this,e,t[s],n,i,t[s]);return Rle(e,Promise.all(r).then((function(e){const n=e.length;for(let i=0;i<n;++i)t[i]=e[i];return t})))},nle.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const Gle="#define SAMPLES 8\n\nuniform float delta;\nuniform float sigma;\nuniform float direction; // 0.0 for x direction, 1.0 for y direction\n\nuniform sampler2D colorTexture;\n\n#ifdef USE_STEP_SIZE\nuniform float stepSize;\n#else\nuniform vec2 step;\n#endif\n\nin vec2 v_textureCoordinates;\n\n// Incremental Computation of the Gaussian:\n// https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html\n\nvoid main()\n{\n vec2 st = v_textureCoordinates;\n vec2 dir = vec2(1.0 - direction, direction);\n\n#ifdef USE_STEP_SIZE\n vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));\n#else\n vec2 step = step;\n#endif\n\n vec3 g;\n g.x = 1.0 / (sqrt(czm_twoPi) * sigma);\n g.y = exp((-0.5 * delta * delta) / (sigma * sigma));\n g.z = g.y * g.y;\n\n vec4 result = texture(colorTexture, st) * g.x;\n for (int i = 1; i < SAMPLES; ++i)\n {\n g.xy *= g.yz;\n\n vec2 offset = float(i) * dir * step;\n result += texture(colorTexture, st - offset) * g.x;\n result += texture(colorTexture, st + offset) * g.x;\n }\n\n out_FragColor = result;\n}\n";function jle(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new ou,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new kt,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}function Wle(e){const t=e._framebuffers;if(!D(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function qle(e){const t=e._commands;if(!D(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function Yle(e,t){let n;if(0===t)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{const i=e._framebuffers[t-1].getColorTexture(0);n={colorTexture:function(){return i},colorTextureDimensions:function(){return i.dimensions}}}return n.minMaxLuminance=function(){return e._minMaxLuminance},n.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},n}function Xle(e,t){let n="uniform sampler2D colorTexture; \nin vec2 v_textureCoordinates; \nfloat sampleTexture(vec2 offset) { \n";return n+=0===e?" vec4 color = texture(colorTexture, v_textureCoordinates + offset); \n return czm_luminance(color.rgb); \n":" return texture(colorTexture, v_textureCoordinates + offset).r; \n",n+="}\n\n",n+="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&&(n+=" float previous = texture(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"),n+=" out_FragColor = vec4(color); \n} \n",n}Object.defineProperties(jle.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(D(e))return e[e.length-1].getColorTexture(0)}}}),jle.prototype.clear=function(e){const t=this._framebuffers;if(!D(t))return;let n=this._clearCommand;D(n)||(n=this._clearCommand=new Bt({color:new Ot(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)},jle.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;t===this._width&&n===this._height||(this._width=t,this._height=n,function(e,t){Wle(e);let n=e._width,i=e._height;const o=t.halfFloatingPointTexture?ts.HALF_FLOAT:ts.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let c=0;c<r;++c)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[c]=new ou,s[c].update(t,n,i,1,o);const a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}(this,e),function(e,t){qle(e);const n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(Xle(r,i),{framebuffer:n[r].framebuffer,uniformMap:Yle(e,r)});e._commands=o}(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const i=this._framebuffers,o=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=o},jle.prototype.execute=function(e,t){this._colorTexture=t;const n=this._commands;if(!D(n))return;const i=n.length;for(let o=0;o<i;++o)n[o].execute(e)},jle.prototype.isDestroyed=function(){return!1},jle.prototype.destroy=function(){return Wle(this),qle(this),He(this)};const Qle={NEAREST:0,LINEAR:1};function $le(e){const t=(e=M(e,M.EMPTY_OBJECT)).fragmentShader,n=M(e.textureScale,1),i=M(e.pixelFormat,is.RGBA);if(L.typeOf.string("options.fragmentShader",t),L.typeOf.number.greaterThan("options.textureScale",n,0),L.typeOf.number.lessThanOrEquals("options.textureScale",n,1),!is.isColorFormat(i))throw new P("options.pixelFormat must be a color format.");this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=M(e.forcePowerOfTwo,!1),this._sampleMode=M(e.sampleMode,Qle.NEAREST),this._pixelFormat=i,this._pixelDatatype=M(e.pixelDatatype,ts.UNSIGNED_BYTE),this._clearColor=M(e.clearColor,Ot.BLACK),this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;const o=new hc;o.scissorTest={enabled:!0,rectangle:D(e.scissorRectangle)?Fr.clone(e.scissorRectangle):new Fr},this._passState=o,this._ready=!1;let r=e.name;D(r)||(r=ke()),this._name=r,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties($le.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(D(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(D(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});const Kle=/uniform\s+sampler2D\s+depthTexture/g;function Zle(e,t,n){const i=t[n];return("string"==typeof i||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(i){const o=t[n];t[n]=i;const r=e._actualUniforms,s=r[n];D(s)&&s!==o&&s instanceof Sc&&!D(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(s),delete r[n],delete r[`${n}Dimensions`]),o instanceof Sc&&e._texturesToRelease.push(o),"string"==typeof i||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData?e._dirtyUniforms.push(n):r[n]=i}}}function Jle(e,t){return function(){const n=e._actualUniforms[t];return"function"==typeof n?n():n}}function eue(e,t){return function(){const n=e[t]();if(D(n))return n.dimensions}}function tue(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function nue(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function iue(e){D(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();const t=e._textureCache;if(!D(t))return;const n=e._uniforms,i=e._actualUniforms;for(const o in i)i.hasOwnProperty(o)&&i[o]instanceof Sc&&(D(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function oue(e){e=M(e,M.EMPTY_OBJECT),L.defined("options.stages",e.stages),L.typeOf.number.greaterThan("options.stages.length",e.stages.length,0),this._stages=e.stages,this._inputPreviousStageTexture=M(e.inputPreviousStageTexture,!0);let t=e.name;D(t)||(t=ke()),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}$le.prototype._isSupported=function(e){return!Kle.test(this._fragmentShader)||e.depthTexture},$le.prototype.update=function(e,t){if(this.enabled===this._enabled||this.enabled||iue(this),this._enabled=this.enabled,!this._enabled)return;if(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=function(e){let t=D(e._selected)?e._selected.length:0;const n=D(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,D(e._selected)&&D(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):D(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&D(e._combinedSelected)){if(!D(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return i}(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=D(this._selected)?this._selected.length:0,this._parentSelectedLength=D(this._parentSelected)?this._parentSelected.length:0,function(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const n=e._combinedSelected;if(!D(n))return;let i,o,r=0;const s=n.length;for(i=0;i<s;++i)o=n[i],D(o.pickIds)?r+=o.pickIds.length:D(o.pickId)&&++r;if(0===s||0===r){const n=new Uint8Array(4);return n[0]=255,n[1]=255,n[2]=255,n[3]=255,void(e._selectedIdTexture=new Sc({context:t,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,source:{arrayBufferView:n,width:1,height:1},sampler:uc.NEAREST}))}let a,c=0;const l=new Uint8Array(4*r);for(i=0;i<s;++i)if(o=n[i],D(o.pickIds)){const e=o.pickIds,t=e.length;for(let n=0;n<t;++n)a=e[n].color,l[c]=Ot.floatToByte(a.red),l[c+1]=Ot.floatToByte(a.green),l[c+2]=Ot.floatToByte(a.blue),l[c+3]=Ot.floatToByte(a.alpha),c+=4}else D(o.pickId)&&(a=o.pickId.color,l[c]=Ot.floatToByte(a.red),l[c+1]=Ot.floatToByte(a.green),l[c+2]=Ot.floatToByte(a.blue),l[c+3]=Ot.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new Sc({context:t,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,source:{arrayBufferView:l,width:r,height:1},sampler:uc.NEAREST})}(this,e),function(e){if(D(e._uniformMap))return;const t={},n={},i=e._uniforms,o=e._actualUniforms;for(const r in i)if(i.hasOwnProperty(r)){"function"!=typeof i[r]?(t[r]=Jle(e,r),n[r]=Zle(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];const s=t[r]();("string"==typeof s||s instanceof Sc||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=eue(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=ni(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}})}(this),function(e,t){let n,i,o;const r=e._texturesToRelease;let s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;const a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){const i=a[n];o=i.name;const r=i.source;e._actualUniforms[o]=new Sc({context:t,source:r})}a.length=0;const c=e._dirtyUniforms;if(0===c.length&&!D(e._texturePromise))return void(e._ready=!0);if(0===c.length||D(e._texturePromise))return;s=c.length;const l=e._uniforms,u=[];for(n=0;n<s;++n){o=c[n];const t=l[o];if(D(e._textureCache.getStageByName(t)))e._actualUniforms[o]=nue(e,t);else if("string"==typeof t){const n=new Bi({url:t});u.push(n.fetchImage().then(tue(e,o)))}else e._texturesToCreate.push({name:o,source:t})}c.length=0,u.length>0?(e._ready=!1,e._texturePromise=Promise.all(u).then((function(){e._ready=!0,e._texturePromise=void 0}))):e._ready=!0}(this,e),function(e,t){if(D(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(D(e._selectedIdTexture)){const t=e._selectedIdTexture.width;n=n.replace(/in\s+vec2\s+v_textureCoordinates;/g,""),n=`#define CZM_SELECTED_FEATURE \nuniform sampler2D czm_idTexture; \nuniform sampler2D czm_selectedIdTexture; \nuniform float czm_selectedIdTextureStep; \nin vec2 v_textureCoordinates; \nbool czm_selected(vec2 offset) \n{ \n bool selected = false;\n vec4 id = texture(czm_idTexture, v_textureCoordinates + offset); \n for (int i = 0; i < ${t}; ++i) \n { \n vec4 selectedId = texture(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${n}`}const i=new bc({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}(this,e),function(e){let t,n;e._sampleMode===Qle.LINEAR?(t=ac.LINEAR,n=rc.LINEAR):(t=ac.NEAREST,n=rc.NEAREST);const i=e._sampler;D(i)&&i.minificationFilter===t&&i.magnificationFilter===n||(e._sampler=new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:t,magnificationFilter:n}))}(this),this._selectedDirty=!1,!this._ready)return;const n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!D(n))return;const i=n.getColorTexture(0);let o;i.width===e.drawingBufferWidth&&i.height===e.drawingBufferHeight||(o=this._renderState,D(o)&&i.width===o.viewport.width&&i.height===o.viewport.height||(this._renderState=_s.fromCache({viewport:new Fr(0,0,i.width,i.height)}))),this._command.renderState=o},$le.prototype.execute=function(e,t,n,i){if(!(D(this._command)&&D(this._command.framebuffer)&&this._ready&&this._enabled))return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,uc.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const o=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;D(o)&&(o.context=e),this._command.execute(e,o)},$le.prototype.isDestroyed=function(){return!1},$le.prototype.destroy=function(){return iue(this),He(this)},Object.defineProperties(oue.prototype,{ready:{get:function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)if(!e[n].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)t[i].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}}),oue.prototype._isSupported=function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0},oue.prototype.get=function(e){return L.typeOf.number.greaterThanOrEquals("index",e,0),L.typeOf.number.lessThan("index",e,this.length),this._stages[e]},oue.prototype.update=function(e,t){this._selectedDirty=function(e){let t=D(e._selected)?e._selected.length:0;const n=D(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,D(e._selected)&&D(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):D(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&D(e._combinedSelected)){if(!D(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let n=0;n<t;++n)if(e._combinedSelected[n]!==e._combinedSelectedShadow[n])return!0}return i}(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=D(this._selected)?this._selected.length:0,this._parentSelectedLength=D(this._parentSelected)?this._parentSelected.length:0;const n=this._stages,i=n.length;for(let o=0;o<i;++o){const i=n[o];this._selectedDirty&&(i.parentSelected=this._combinedSelected),i.update(e,t)}},oue.prototype.isDestroyed=function(){return!1},oue.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};const rue={};function sue(e){const t=`#define USE_STEP_SIZE\n${Gle}`,n=new $le({name:`${e}_x_direction`,fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:Qle.LINEAR}),i=new $le({name:`${e}_y_direction`,fragmentShader:t,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:Qle.LINEAR}),o={};return Object.defineProperties(o,{delta:{get:function(){return n.uniforms.delta},set:function(e){const t=n.uniforms,o=i.uniforms;t.delta=o.delta=e}},sigma:{get:function(){return n.uniforms.sigma},set:function(e){const t=n.uniforms,o=i.uniforms;t.sigma=o.sigma=e}},stepSize:{get:function(){return n.uniforms.stepSize},set:function(e){const t=n.uniforms,o=i.uniforms;t.stepSize=o.stepSize=e}}}),new oue({name:e,stages:[n,i],uniforms:o})}rue.createBlurStage=function(){return sue("czm_blur")},rue.createDepthOfFieldStage=function(){const e=sue("czm_depth_of_field_blur"),t=new $le({name:"czm_depth_of_field_composite",fragmentShader:"uniform sampler2D colorTexture;\nuniform sampler2D blurTexture;\nuniform sampler2D depthTexture;\nuniform float focalDistance;\n\nin vec2 v_textureCoordinates;\n\nvec4 toEye(vec2 uv, float depth)\n{\n vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\n vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera = posInCamera / posInCamera.w;\n return posInCamera;\n}\n\nfloat computeDepthBlur(float depth)\n{\n float f;\n if (depth < focalDistance)\n {\n f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);\n }\n else\n {\n f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);\n f = pow(f, 0.1);\n }\n f *= f;\n f = clamp(f, 0.0, 1.0);\n return pow(f, 0.5);\n}\n\nvoid main(void)\n{\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 posInCamera = toEye(v_textureCoordinates, depth);\n float d = computeDepthBlur(-posInCamera.z);\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), texture(blurTexture, v_textureCoordinates), d);\n}\n",uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(e){t.uniforms.focalDistance=e}},delta:{get:function(){return e.uniforms.delta},set:function(t){e.uniforms.delta=t}},sigma:{get:function(){return e.uniforms.sigma},set:function(t){e.uniforms.sigma=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}}}),new oue({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})},rue.isDepthOfFieldSupported=function(e){return e.context.depthTexture},rue.createEdgeDetectionStage=function(){return new $le({name:`czm_edge_detection_${ke()}`,fragmentShader:"uniform sampler2D depthTexture;\nuniform float length;\nuniform vec4 color;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n float directions[3];\n directions[0] = -1.0;\n directions[1] = 0.0;\n directions[2] = 1.0;\n\n float scalars[3];\n scalars[0] = 3.0;\n scalars[1] = 10.0;\n scalars[2] = 3.0;\n\n float padx = czm_pixelRatio / czm_viewport.z;\n float pady = czm_pixelRatio / czm_viewport.w;\n\n#ifdef CZM_SELECTED_FEATURE\n bool selected = false;\n for (int i = 0; i < 3; ++i)\n {\n float dir = directions[i];\n selected = selected || czm_selected(vec2(-padx, dir * pady));\n selected = selected || czm_selected(vec2(padx, dir * pady));\n selected = selected || czm_selected(vec2(dir * padx, -pady));\n selected = selected || czm_selected(vec2(dir * padx, pady));\n if (selected)\n {\n break;\n }\n }\n if (!selected)\n {\n out_FragColor = vec4(color.rgb, 0.0);\n return;\n }\n#endif\n\n float horizEdge = 0.0;\n float vertEdge = 0.0;\n\n for (int i = 0; i < 3; ++i)\n {\n float dir = directions[i];\n float scale = scalars[i];\n\n horizEdge -= texture(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;\n horizEdge += texture(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;\n\n vertEdge -= texture(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;\n vertEdge += texture(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;\n }\n\n float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\n out_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);\n}\n",uniforms:{length:.25,color:Ot.clone(Ot.BLACK)}})},rue.isEdgeDetectionSupported=function(e){return e.context.depthTexture},rue.createSilhouetteStage=function(e){const t=function(e){if(!D(e))return rue.createEdgeDetectionStage();const t=new oue({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={};let i="",o="";for(let r=0;r<e.length;++r)i+=`uniform sampler2D edgeTexture${r}; \n`,o+=` vec4 edge${r} = texture(edgeTexture${r}, v_textureCoordinates); \n if (edge${r}.a > 0.0) \n { \n color = edge${r}; \n break; \n } \n`,n[`edgeTexture${r}`]=e[r].name;return new oue({name:"czm_edge_detection_composite",stages:[t,new $le({name:"czm_edge_detection_combine",fragmentShader:`${i}in vec2 v_textureCoordinates; \nvoid main() { \n vec4 color = vec4(0.0); \n for (int i = 0; i < ${e.length}; i++) \n { \n${o} } \n out_FragColor = color; \n} \n`,uniforms:n})]})}(e);return new oue({name:"czm_silhouette",stages:[t,new $le({name:"czm_silhouette_color_edges",fragmentShader:"uniform sampler2D colorTexture;\nuniform sampler2D silhouetteTexture;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n out_FragColor = mix(color, silhouetteColor, silhouetteColor.a);\n}\n",uniforms:{silhouetteTexture:t.name}})],inputPreviousStageTexture:!1,uniforms:t.uniforms})},rue.isSilhouetteSupported=function(e){return e.context.depthTexture},rue.createBloomStage=function(){const e=new $le({name:"czm_bloom_contrast_bias",fragmentShader:"uniform sampler2D colorTexture;\nuniform float contrast;\nuniform float brightness;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 sceneColor = texture(colorTexture, v_textureCoordinates).xyz;\n sceneColor = czm_RGBToHSB(sceneColor);\n sceneColor.z += brightness;\n sceneColor = czm_HSBToRGB(sceneColor);\n\n float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\n sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\n out_FragColor = vec4(sceneColor, 1.0);\n}\n",uniforms:{contrast:128,brightness:-.3}}),t=sue("czm_bloom_blur"),n=new oue({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new $le({name:"czm_bloom_generate_composite",fragmentShader:"uniform sampler2D colorTexture;\nuniform sampler2D bloomTexture;\nuniform bool glowOnly;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec4 color = texture(colorTexture, v_textureCoordinates);\n\n#ifdef CZM_SELECTED_FEATURE\n if (czm_selected()) {\n out_FragColor = color;\n return;\n }\n#endif\n\n vec4 bloom = texture(bloomTexture, v_textureCoordinates);\n out_FragColor = glowOnly ? bloom : bloom + color;\n}\n",uniforms:{glowOnly:!1,bloomTexture:n.name}}),o={};return Object.defineProperties(o,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(e){i.uniforms.glowOnly=e}},contrast:{get:function(){return e.uniforms.contrast},set:function(t){e.uniforms.contrast=t}},brightness:{get:function(){return e.uniforms.brightness},set:function(t){e.uniforms.brightness=t}},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 oue({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})},rue.createAmbientOcclusionStage=function(){const e=new $le({name:"czm_ambient_occlusion_generate",fragmentShader:"uniform sampler2D randomTexture;\nuniform sampler2D depthTexture;\nuniform float intensity;\nuniform float bias;\nuniform float lengthCap;\nuniform float stepSize;\nuniform float frustumLength;\n\nin vec2 v_textureCoordinates;\n\nvec4 clipToEye(vec2 uv, float depth)\n{\n vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\n vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);\n posEC = posEC / posEC.w;\n return posEC;\n}\n\n//Reconstruct Normal Without Edge Removation\nvec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)\n{\n vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);\n vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);\n vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);\n vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);\n\n vec3 up = posInCamera.xyz - posInCameraUp.xyz;\n vec3 down = posInCameraDown.xyz - posInCamera.xyz;\n vec3 left = posInCamera.xyz - posInCameraLeft.xyz;\n vec3 right = posInCameraRight.xyz - posInCamera.xyz;\n\n vec3 DX = length(left) < length(right) ? left : right;\n vec3 DY = length(up) < length(down) ? up : down;\n\n return normalize(cross(DY, DX));\n}\n\nvoid main(void)\n{\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 posInCamera = clipToEye(v_textureCoordinates, depth);\n\n if (posInCamera.z > frustumLength)\n {\n out_FragColor = vec4(1.0);\n return;\n }\n\n vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\n float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));\n float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));\n float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));\n float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));\n vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);\n\n float ao = 0.0;\n vec2 sampleDirection = vec2(1.0, 0.0);\n float gapAngle = 90.0 * czm_radiansPerDegree;\n\n // RandomNoise\n float randomVal = texture(randomTexture, v_textureCoordinates / pixelSize / 255.0).x;\n\n //Loop for each direction\n for (int i = 0; i < 4; i++)\n {\n float newGapAngle = gapAngle * (float(i) + randomVal);\n float cosVal = cos(newGapAngle);\n float sinVal = sin(newGapAngle);\n\n //Rotate Sampling Direction\n vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);\n float localAO = 0.0;\n float localStepSize = stepSize;\n\n //Loop for each step\n for (int j = 0; j < 6; j++)\n {\n vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;\n\n //Exception Handling\n if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)\n {\n break;\n }\n\n float stepDepthInfo = czm_readDepth(depthTexture, newCoords);\n vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);\n vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;\n float len = length(diffVec);\n\n if (len > lengthCap)\n {\n break;\n }\n\n float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );\n float weight = len / lengthCap;\n weight = 1.0 - weight * weight;\n\n if (dotVal < bias)\n {\n dotVal = 0.0;\n }\n\n localAO = max(localAO, dotVal * weight);\n localStepSize += stepSize;\n }\n ao += localAO;\n }\n\n ao /= 4.0;\n ao = 1.0 - clamp(ao, 0.0, 1.0);\n ao = pow(ao, intensity);\n out_FragColor = vec4(vec3(ao), 1.0);\n}\n",uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=sue("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new oue({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new $le({name:"czm_ambient_occlusion_composite",fragmentShader:"uniform sampler2D colorTexture;\nuniform sampler2D ambientOcclusionTexture;\nuniform bool ambientOcclusionOnly;\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates);\n out_FragColor = ambientOcclusionOnly ? ao : ao * color;\n}\n",uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),o={};return Object.defineProperties(o,{intensity:{get:function(){return e.uniforms.intensity},set:function(t){e.uniforms.intensity=t}},bias:{get:function(){return e.uniforms.bias},set:function(t){e.uniforms.bias=t}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(t){e.uniforms.lengthCap=t}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(t){e.uniforms.stepSize=t}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(t){e.uniforms.frustumLength=t}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(t){e.uniforms.randomTexture=t}},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}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(e){t.uniforms.stepSize=e}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(e){i.uniforms.ambientOcclusionOnly=e}}}),new oue({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})},rue.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};rue.createFXAAStage=function(){return new $le({name:"czm_FXAA",fragmentShader:"#define FXAA_QUALITY_PRESET 39 \n/**\n * @license\n * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of NVIDIA CORPORATION nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n\n// Steps used to integrate into Cesium:\n// * The following defines are set:\n// #define FXAA_PC 1\n// #define FXAA_WEBGL_1 1\n// #define FXAA_GREEN_AS_LUMA 1\n// #define FXAA_EARLY_EXIT 1\n// #define FXAA_GLSL_120 1\n// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.\n// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace\n// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.\n// * There are no implicit conversions from ivec* to vec* so replace:\n// #define FxaaInt2 ivec2\n// with\n// #define FxaaInt2 vec2\n// * The texture2DLod function is only available in vertex shaders so replace:\n// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n// with\n// #define FxaaTexTop(t, p) texture(t, p)\n// #define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))\n// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.\n// * The following parameters to FxaaPixelShader are unused and can be removed:\n// fxaaConsolePosPos\n// fxaaConsoleRcpFrameOpt\n// fxaaConsoleRcpFrameOpt2\n// fxaaConsole360RcpFrameOpt2\n// fxaaConsoleEdgeSharpness\n// fxaaConsoleEdgeThreshold\n// fxaaConsoleEdgeThresholdMi\n// fxaaConsole360ConstDir\n\n//\n// Choose the quality preset.\n// This needs to be compiled into the shader as it effects code.\n// Best option to include multiple presets is to\n// in each shader define the preset, then include this file.\n//\n// OPTIONS\n// -----------------------------------------------------------------------\n// 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n// 39 - no dither, very expensive\n//\n// NOTES\n// -----------------------------------------------------------------------\n// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n// 13 = about same speed as FXAA 3.9 and better than 12\n// 23 = closest to FXAA 3.9 visually and performance wise\n// _ = the lowest digit is directly related to performance\n// _ = the highest digit is directly related to style\n//\n//#define FXAA_QUALITY_PRESET 12\n\n\n#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\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\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture(t, p)\n#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))\n\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n\nFxaaFloat4 FxaaPixelShader(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n}\n\nin vec2 v_textureCoordinates;\n\nuniform sampler2D colorTexture;\n\nconst float fxaaQualitySubpix = 0.5;\nconst float fxaaQualityEdgeThreshold = 0.125;\nconst float fxaaQualityEdgeThresholdMin = 0.0833;\n\nvoid main()\n{\n vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;\n vec4 color = FxaaPixelShader(\n v_textureCoordinates,\n colorTexture,\n fxaaQualityRcpFrame,\n fxaaQualitySubpix,\n fxaaQualityEdgeThreshold,\n fxaaQualityEdgeThresholdMin);\n float alpha = texture(colorTexture, v_textureCoordinates).a;\n out_FragColor = vec4(color.rgb, alpha);\n}\n",sampleMode:Qle.LINEAR})},rue.createAcesTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+="uniform sampler2D colorTexture;\n\nin vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\nvoid main()\n{\n vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n\n#ifdef AUTO_EXPOSURE\n color /= texture(autoExposure, vec2(0.5)).r;\n#endif\n color = czm_acesTonemapping(color);\n color = czm_inverseGamma(color);\n\n out_FragColor = vec4(color, fragmentColor.a);\n}\n",new $le({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})},rue.createFilmicTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+="uniform sampler2D colorTexture;\n\nin vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\n// See slides 142 and 143:\n// http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting\n\nvoid main()\n{\n vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n\n#ifdef AUTO_EXPOSURE\n float exposure = texture(autoExposure, vec2(0.5)).r;\n color /= exposure;\n#endif\n\n\tconst float A = 0.22; // shoulder strength\n\tconst float B = 0.30; // linear strength\n\tconst float C = 0.10; // linear angle\n\tconst float D = 0.20; // toe strength\n\tconst float E = 0.01; // toe numerator\n\tconst float F = 0.30; // toe denominator\n\n\tconst float white = 11.2; // linear white point value\n\n\tvec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\n\tfloat w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\n\n\tc = czm_inverseGamma(c / w);\n\tout_FragColor = vec4(c, fragmentColor.a);\n}\n",new $le({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})},rue.createReinhardTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+="uniform sampler2D colorTexture;\n\nin vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\n// See equation 3:\n// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf\n\nvoid main()\n{\n vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\n float exposure = texture(autoExposure, vec2(0.5)).r;\n color /= exposure;\n#endif\n color = color / (1.0 + color);\n color = czm_inverseGamma(color);\n out_FragColor = vec4(color, fragmentColor.a);\n}\n",new $le({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})},rue.createModifiedReinhardTonemappingStage=function(e){let t=e?"#define AUTO_EXPOSURE\n":"";return t+="uniform sampler2D colorTexture;\nuniform vec3 white;\n\nin vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\n// See equation 4:\n// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf\n\nvoid main()\n{\n vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\n float exposure = texture(autoExposure, vec2(0.5)).r;\n color /= exposure;\n#endif\n color = (color * (1.0 + color / white)) / (1.0 + color);\n color = czm_inverseGamma(color);\n out_FragColor = vec4(color, fragmentColor.a);\n}\n",new $le({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:Ot.WHITE,autoExposure:void 0}})},rue.createAutoExposureStage=function(){return new jle},rue.createBlackAndWhiteStage=function(){return new $le({name:"czm_black_and_white",fragmentShader:"uniform sampler2D colorTexture;\nuniform float gradations;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;\n#ifdef CZM_SELECTED_FEATURE\n if (czm_selected()) {\n out_FragColor = vec4(rgb, 1.0);\n return;\n }\n#endif\n float luminance = czm_luminance(rgb);\n float darkness = luminance * gradations;\n darkness = (darkness - fract(darkness)) / gradations;\n out_FragColor = vec4(vec3(darkness), 1.0);\n}\n",uniforms:{gradations:5}})},rue.createBrightnessStage=function(){return new $le({name:"czm_brightness",fragmentShader:"uniform sampler2D colorTexture;\nuniform float brightness;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;\n vec3 target = vec3(0.0);\n out_FragColor = vec4(mix(target, rgb, brightness), 1.0);\n}\n",uniforms:{brightness:.5}})},rue.createNightVisionStage=function(){return new $le({name:"czm_night_vision",fragmentShader:"uniform sampler2D colorTexture;\n\nin vec2 v_textureCoordinates;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;\n vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;\n vec3 green = vec3(0.0, 1.0, 0.0);\n out_FragColor = vec4((noiseValue + rgb) * green, 1.0);\n}\n"})},rue.createDepthViewStage=function(){return new $le({name:"czm_depth_view",fragmentShader:"uniform sampler2D depthTexture;\n\nin vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n out_FragColor = vec4(vec3(depth), 1.0);\n}\n"})},rue.createLensFlareStage=function(){return new $le({name:"czm_lens_flare",fragmentShader:"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;\n\nin vec2 v_textureCoordinates;\n\n// whether it is in space or not\n// 6500000.0 is empirical value\n#define DISTANCE_TO_SPACE 6500000.0\n\n// return ndc from world coordinate biased earthRadius\nvec4 getNDCFromWC(vec3 WC, float earthRadius)\n{\n vec4 positionEC = czm_view * vec4(WC, 1.0);\n positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);\n vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n}\n\n// Check if current pixel is included Earth\n// if then mask it gradually\nfloat isInEarth(vec2 texcoord, vec2 sceneSize)\n{\n vec2 NDC = texcoord * 2.0 - 1.0;\n vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);\n vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);\n NDC.xy -= earthPosSC.xy;\n\n float X = abs(NDC.x) * sceneSize.x;\n float Y = abs(NDC.y) * sceneSize.y;\n\n return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));\n}\n\n// For Chromatic effect\nvec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)\n{\n vec2 sceneSize = czm_viewport.zw;\n vec3 color;\n if(isSpace)\n {\n color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture(tex, texcoord + direction * distortion.r).r;\n color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture(tex, texcoord + direction * distortion.g).g;\n color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture(tex, texcoord + direction * distortion.b).b;\n }\n else\n {\n color.r = texture(tex, texcoord + direction * distortion.r).r;\n color.g = texture(tex, texcoord + direction * distortion.g).g;\n color.b = texture(tex, texcoord + direction * distortion.b).b;\n }\n return vec4(clamp(color, 0.0, 1.0), 0.0);\n}\n\nvoid main(void)\n{\n vec4 originalColor = texture(colorTexture, v_textureCoordinates);\n vec3 rgb = originalColor.rgb;\n bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;\n\n // Sun position\n vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);\n vec4 sunPositionEC = czm_view * sunPos;\n vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);\n sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);\n\n // If sun is not in the screen space, use original color.\n if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))\n {\n // Lens flare is disabled when not in space until #5932 is fixed.\n // https://github.com/CesiumGS/cesium/issues/5932\n out_FragColor = originalColor;\n return;\n }\n\n vec2 texcoord = vec2(1.0) - v_textureCoordinates;\n vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\n vec2 invPixelSize = 1.0 / pixelSize;\n vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);\n\n // ghost vector to image centre:\n vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;\n vec3 direction = normalize(vec3(ghostVec, 0.0));\n\n // sample ghosts:\n vec4 result = vec4(0.0);\n vec4 ghost = vec4(0.0);\n for (int i = 0; i < 4; ++i)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n // Only bright spots from the centre of the source image\n ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);\n }\n result += ghost;\n\n // sample halo\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weightForHalo = pow(1.0 - weightForHalo, 5.0);\n\n result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;\n\n // dirt on lens\n vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;\n if (dirtTexCoords.x > 1.0)\n {\n dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);\n }\n if (dirtTexCoords.y > 1.0)\n {\n dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);\n }\n result += dirtAmount * texture(dirtTexture, dirtTexCoords);\n\n // Rotating starburst texture's coordinate\n // dot(czm_view[0].xyz, vec3(0.0, 0.0, 1.0)) + dot(czm_view[1].xyz, vec3(0.0, 1.0, 0.0))\n float camrot = czm_view[0].z + czm_view[1].y;\n float cosValue = cos(camrot);\n float sinValue = sin(camrot);\n mat3 rotation = mat3(\n cosValue, -sinValue, 0.0,\n sinValue, cosValue, 0.0,\n 0.0, 0.0, 1.0\n );\n\n vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);\n vec3 st2 = vec3((rotation * st1).xy, 1.0);\n vec3 st3 = st2 * 0.5 + vec3(0.5);\n vec2 lensStarTexcoord = st3.xy;\n float weightForLensFlare = length(vec3(sunPos.xy, 0.0));\n float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);\n\n if (!isSpace)\n {\n result *= oneMinusWeightForLensFlare * intensity * 0.2;\n }\n else\n {\n result *= oneMinusWeightForLensFlare * intensity;\n result *= texture(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;\n }\n\n result += texture(colorTexture, v_textureCoordinates);\n\n out_FragColor = result;\n}\n",uniforms:{dirtTexture:lo("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:lo("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:on.WGS84.maximumRadius}})};const aue=rue;function cue(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function lue(e){for(;D(e.length);)e=e.get(e.length-1);return e.name}function uue(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;const r=n[i.name]={};if(D(o)){r[lue(e.getStageByName(o))]=!0}const s=i.uniforms;if(D(s)){const t=Object.getOwnPropertyNames(s),n=t.length;for(let i=0;i<n;++i){const n=s[t[i]];if("string"==typeof n){const t=e.getStageByName(n);D(t)&&(r[lue(t)]=!0)}}}return i.name}function due(e,t,n,i,o){if(D(i.enabled)&&!i.enabled||D(i._isSupported)&&!i._isSupported(t))return o;const r=o,s=!D(i.inputPreviousStageTexture)||i.inputPreviousStageTexture;let a=o;const c=i.length;for(let d=0;d<c;++d){const r=i.get(d);a=D(r.length)?due(e,t,n,r,o):uue(e,t,n,r,o),s&&(o=a)}let l,u;if(s)for(l=1;l<c;++l)u=lue(i.get(l)),D(n[u])||(n[u]={}),n[u][r]=!0;else for(l=1;l<c;++l){u=lue(i.get(l));const e=n[u];for(let t=0;t<l;++t)e[lue(i.get(t))]=!0}return a}function hue(e,t,n){const i=e._collection.getStageByName(t),o=i._textureScale,r=i._forcePowerOfTwo,s=i._pixelFormat,a=i._pixelDatatype,c=i._clearColor;let l,u;const d=e._framebuffers,h=d.length;for(l=0;l<h;++l){if(u=d[l],o!==u.textureScale||r!==u.forcePowerOfTwo||s!==u.pixelFormat||a!==u.pixelDatatype||!Ot.equals(c,u.clearColor))continue;const e=u.stages,t=e.length;let i=!1;for(let o=0;o<t;++o)if(n[e[o]]){i=!0;break}if(!i)break}return D(u)&&l<h?(u.stages.push(t),u):(u={textureScale:o,forcePowerOfTwo:r,pixelFormat:s,pixelDatatype:a,clearColor:c,stages:[t],buffer:new ou({pixelFormat:s,pixelDatatype:a}),clear:void 0},d.push(u),u)}function pue(e,t){const n=function(e,t){const n={};if(D(e.ambientOcclusion)){const i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa;let a=due(e,t,n,i,void 0);a=due(e,t,n,o,a),a=uue(e,t,n,r,a),a=due(e,t,n,e,a),uue(e,t,n,s,a)}else due(e,t,n,e,void 0);return n}(e._collection,t);for(const i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=hue(e,i,n[i]))}function fue(e){const t=e._framebuffers,n=t.length;for(let i=0;i<n;++i){t[i].buffer.destroy()}}cue.prototype.updateDependencies=function(){this._updateDependencies=!0},cue.prototype.update=function(e){const t=this._collection,n=this._updateDependencies,i=D(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=D(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=D(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=D(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!D(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(fue(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;0===this._framebuffers.length&&pue(this,e);const c=e.drawingBufferWidth,l=e.drawingBufferHeight,u=this._width!==c||this._height!==l;(n||u)&&(this._width=c,this._height=l,this._updateDependencies=!1,fue(this),function(e,t){const n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){const e=o[s],r=e.textureScale;let a=Math.ceil(n*r),c=Math.ceil(i*r),l=Math.min(a,c);e.forcePowerOfTwo&&(V.isPowerOfTwo(l)||(l=V.nextPowerOfTwo(l)),a=l,c=l),e.buffer.update(t,a,c),e.clear=new Bt({color:e.clearColor,framebuffer:e.buffer.framebuffer})}}(this,e))},cue.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)},cue.prototype.getStageByName=function(e){return this._collection.getStageByName(e)},cue.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)},cue.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(D(t))return t.buffer.framebuffer},cue.prototype.isDestroyed=function(){return!1},cue.prototype.destroy=function(){return fue(this),He(this)};const mue={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===mue.REINHARD||e===mue.MODIFIED_REINHARD||e===mue.FILMIC||e===mue.ACES}},_ue=Object.freeze(mue),gue=[];function yue(){const e=aue.createFXAAStage(),t=aue.createAmbientOcclusionStage(),n=aue.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=aue.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=_ue.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const o=new cue(this),r={},s=gue;for(s.push(e,t,n,i);s.length>0;){const e=s.pop();r[e.name]=e,e._textureCache=o;const t=e.length;if(D(t))for(let n=0;n<t;++n)s.push(e.get(n))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const a=this;t.uniforms.randomTexture=function(){return a._randomTexture},this._ao=t,this._bloom=n,this._fxaa=e,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._activeStagesChanged=!1,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=r,this._textureCache=o}function bue(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],n=e._stages,i=n.length;for(let o=0,r=0;o<i;++o){const e=n[o];e&&(e._index=r++,t.push(e))}e._stages=t}function vue(e){for(;D(e.length);)e=e.get(e.length-1);return e.outputTexture}function Aue(e,t,n,i,o){if(D(e.execute))return void e.execute(t,n,i,o);const r=e.length;let s;if(e.inputPreviousStageTexture)for(Aue(e.get(0),t,n,i,o),s=1;s<r;++s)Aue(e.get(s),t,vue(e.get(s-1)),i,o);else for(s=0;s<r;++s)Aue(e.get(s),t,n,i,o)}Object.defineProperties(yue.prototype,{ready:{get:function(){let e=!1;const t=this._stages;for(let s=t.length-1;s>=0;--s){const n=t[s];e=e||n.ready&&n.enabled}const n=this._fxaa,i=this._ao,o=this._bloom,r=this._tonemapping;return e=e||n.ready&&n.enabled,e=e||i.ready&&i.enabled,e=e||o.ready&&o.enabled,e=e||r.ready&&r.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return bue(this),this._stages.length}},outputTexture:{get:function(){const e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);const t=this._stages;for(let r=t.length-1;r>=0;--r){const e=t[r];if(D(e)&&e.ready&&e.enabled)return this.getOutputTexture(e.name)}const n=this._tonemapping;if(n.enabled&&n.ready)return this.getOutputTexture(n.name);const i=this._bloom;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const o=this._ao;return o.enabled&&o.ready?this.getOutputTexture(o.name):void 0}},hasSelected:{get:function(){const e=this._stages.slice();for(;e.length>0;){const t=e.pop();if(!D(t))continue;if(D(t.selected))return!0;const n=t.length;if(D(n))for(let i=0;i<n;++i)e.push(t.get(i))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;if(!_ue.validate(e))throw new P("tonemapper was set to an invalid value.");D(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let n;switch(e){case _ue.REINHARD:n=aue.createReinhardTonemappingStage(t);break;case _ue.MODIFIED_REINHARD:n=aue.createModifiedReinhardTonemappingStage(t);break;case _ue.FILMIC:n=aue.createFilmicTonemappingStage(t);break;default:n=aue.createAcesTonemappingStage(t)}if(t){const e=this._autoExposure;n.uniforms.autoExposure=function(){return e.outputTexture}}this._tonemapper=e,this._tonemapping=n,D(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}}),yue.prototype.add=function(e){L.typeOf.object("stage",e);const t=this._stageNames,n=gue;for(n.push(e);n.length>0;){const e=n.pop();if(D(t[e.name]))throw new P(`${e.name} has already been added to the collection or does not have a unique name.`);t[e.name]=e,e._textureCache=this._textureCache;const i=e.length;if(D(i))for(let t=0;t<i;++t)n.push(e.get(t))}const i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e},yue.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=gue;for(n.push(e);n.length>0;){const e=n.pop();delete t[e.name];const i=e.length;if(D(i))for(let t=0;t<i;++t)n.push(e.get(t))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0},yue.prototype.contains=function(e){return D(e)&&D(e._index)&&e._textureCache===this._textureCache},yue.prototype.get=function(e){bue(this);const t=this._stages,n=t.length;return L.typeOf.number.greaterThanOrEquals("stages length",n,0),L.typeOf.number.greaterThanOrEquals("index",e,0),L.typeOf.number.lessThan("index",e,n),t[e]},yue.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0},yue.prototype.getStageByName=function(e){return this._stageNames[e]},yue.prototype.update=function(e,t,n){bue(this);const i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;const r=this._stages;let s,a,c=o.length=r.length,l=0;for(s=0;s<c;++s)a=r[s],a.ready&&a.enabled&&a._isSupported(e)&&(o[l++]=a);o.length=l;let u=l!==i.length;if(!u)for(s=0;s<l;++s)if(o[s]!==i[s]){u=!0;break}const d=this._ao,h=this._bloom,p=this._autoExposure,f=this._tonemapping,m=this._fxaa;f.enabled=n;const _=d.enabled&&d._isSupported(e),g=h.enabled&&h._isSupported(e),y=f.enabled&&f._isSupported(e),b=m.enabled&&m._isSupported(e);if((u||this._textureCacheDirty||_!==this._aoEnabled||g!==this._bloomEnabled||y!==this._tonemappingEnabled||b!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=_,this._bloomEnabled=g,this._tonemappingEnabled=y,this._fxaaEnabled=b,this._textureCacheDirty=!1),D(this._randomTexture)&&!_&&(this._randomTexture.destroy(),this._randomTexture=void 0),!D(this._randomTexture)&&_){c=196608;const t=new Uint8Array(c);for(s=0;s<c;s+=3)t[s]=Math.floor(255*Math.random());this._randomTexture=new Sc({context:e,pixelFormat:is.RGB,pixelDatatype:ts.UNSIGNED_BYTE,source:{arrayBufferView:t,width:256,height:256},sampler:new uc({wrapS:lc.REPEAT,wrapT:lc.REPEAT,minificationFilter:ac.NEAREST,magnificationFilter:rc.NEAREST})})}for(this._textureCache.update(e),m.update(e,t),d.update(e,t),h.update(e,t),f.update(e,t),this._autoExposureEnabled&&p.update(e,t),c=r.length,s=0;s<c;++s)r[s].update(e,t);for(l=0,s=0;s<c;++s)a=r[s],a.ready&&a.enabled&&a._isSupported(e)&&l++;u=l!==o.length,u&&this.update(e,t,n)},yue.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)},yue.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(D(t))return vue(t)},yue.prototype.execute=function(e,t,n,i){const o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,c=this._bloom,l=this._autoExposure,u=this._tonemapping,d=a.enabled&&a._isSupported(e),h=c.enabled&&c._isSupported(e),p=this._autoExposureEnabled,f=u.enabled&&u._isSupported(e),m=s.enabled&&s._isSupported(e);if(!(m||d||h||f||0!==r))return;let _=t;d&&a.ready&&(Aue(a,e,_,n,i),_=vue(a)),h&&c.ready&&(Aue(c,e,_,n,i),_=vue(c)),p&&l.ready&&Aue(l,e,_,n,i),f&&u.ready&&(Aue(u,e,_,n,i),_=vue(u));let g=_;if(r>0){Aue(o[0],e,_,n,i);for(let t=1;t<r;++t)Aue(o[t],e,vue(o[t-1]),n,i);g=vue(o[r-1])}m&&s.ready&&Aue(s,e,g,n,i)},yue.prototype.copy=function(e,t){if(!D(this._copyColorCommand)){const t=this;this._copyColorCommand=e.createViewportQuadCommand(Sae,{uniformMap:{colorTexture:function(){return t.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},yue.prototype.isDestroyed=function(){return!1},yue.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(),He(this)};const Tue=Object.freeze({SHIFT:0,CTRL:1,ALT:2}),wue=Object.freeze({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});function Eue(e,t,n){const i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;const o=i.getBoundingClientRect();return n.x=t.clientX-o.left,n.y=t.clientY-o.top,n}function xue(e,t){let n=e;return D(t)&&(n+=`+${t}`),n}function Sue(e){return e.shiftKey?Tue.SHIFT:e.ctrlKey?Tue.CTRL:e.altKey?Tue.ALT:void 0}const Cue=0,Iue=1,Oue=2;function Due(e,t,n,i){function o(t){i(e,t)}Ct.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push((function(){n.removeEventListener(t,o,!1)}))}const Pue={position:new kt};function Nue(e){e._lastSeenTouchEvent=rJ()}function Rue(e){return rJ()-e._lastSeenTouchEvent>sde.mouseEmulationIgnoreMilliseconds}function Lue(e,t,n){const i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function Mue(e,t){if(!Rue(e))return;const n=t.button;let i;if(e._buttonDown[n]=!0,n===Cue)i=wue.LEFT_DOWN;else if(n===Iue)i=wue.MIDDLE_DOWN;else{if(n!==Oue)return;i=wue.RIGHT_DOWN}const o=Eue(e,t,e._primaryPosition);kt.clone(o,e._primaryStartPosition),kt.clone(o,e._primaryPreviousPosition);const r=Sue(t),s=e.getInputAction(i,r);D(s)&&(kt.clone(o,Pue.position),s(Pue),t.preventDefault())}const Fue={position:new kt},Bue={position:new kt};function zue(e,t,n,i){const o=Sue(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(D(r)||D(s)){const t=Eue(e,i,e._primaryPosition);if(D(r)&&(kt.clone(t,Fue.position),r(Fue)),D(s)){Lue(e._primaryStartPosition,t,e._clickPixelTolerance)&&(kt.clone(t,Bue.position),s(Bue))}}}function Uue(e,t){if(!Rue(e))return;const n=t.button;n!==Cue&&n!==Iue&&n!==Oue||(e._buttonDown[Cue]&&(zue(e,wue.LEFT_UP,wue.LEFT_CLICK,t),e._buttonDown[Cue]=!1),e._buttonDown[Iue]&&(zue(e,wue.MIDDLE_UP,wue.MIDDLE_CLICK,t),e._buttonDown[Iue]=!1),e._buttonDown[Oue]&&(zue(e,wue.RIGHT_UP,wue.RIGHT_CLICK,t),e._buttonDown[Oue]=!1))}const kue={startPosition:new kt,endPosition:new kt};function Vue(e,t){if(!Rue(e))return;const n=Sue(t),i=Eue(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(wue.MOUSE_MOVE,n);D(r)&&(kt.clone(o,kue.startPosition),kt.clone(i,kue.endPosition),r(kue)),kt.clone(i,o),(e._buttonDown[Cue]||e._buttonDown[Iue]||e._buttonDown[Oue])&&t.preventDefault()}const Hue={position:new kt};function Gue(e,t){let n;if(t.button!==Cue)return;n=wue.LEFT_DOUBLE_CLICK;const i=Sue(t),o=e.getInputAction(n,i);D(o)&&(Eue(e,t,Hue.position),o(Hue))}function jue(e,t){let n;if(D(t.deltaY)){const e=t.deltaMode;n=e===t.DOM_DELTA_PIXEL?-t.deltaY:e===t.DOM_DELTA_LINE?40*-t.deltaY:120*-t.deltaY}else n=t.detail>0?-120*t.detail:t.wheelDelta;if(!D(n))return;const i=Sue(t),o=e.getInputAction(wue.WHEEL,i);D(o)&&(o(n),t.preventDefault())}function Wue(e,t){Nue(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.set(s,Eue(e,r,new kt));Zue(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.set(s,kt.clone(a.get(s)))}function que(e,t){Nue(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.remove(s);Zue(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.remove(s)}const Yue={position:new kt},Xue={position1:new kt,position2:new kt},Que={position:new kt},$ue={position:new kt},Kue={position:new kt};function Zue(e,t){const n=Sue(t),i=e._positions,o=i.length;let r,s;const a=e._isPinching;if(1!==o&&e._buttonDown[Cue]){if(e._buttonDown[Cue]=!1,D(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(wue.LEFT_UP,n),D(r)&&(kt.clone(e._primaryPosition,Que.position),r(Que)),0===o&&!e._isTouchHolding&&(s=e.getInputAction(wue.LEFT_CLICK,n),D(s))){Lue(e._primaryStartPosition,e._previousPositions.values[0],e._clickPixelTolerance)&&(kt.clone(e._primaryPosition,$ue.position),s($ue))}e._isTouchHolding=!1}if(0===o&&a&&(e._isPinching=!1,r=e.getInputAction(wue.PINCH_END,n),D(r)&&r()),1===o&&!a){const o=i.values[0];kt.clone(o,e._primaryPosition),kt.clone(o,e._primaryStartPosition),kt.clone(o,e._primaryPreviousPosition),e._buttonDown[Cue]=!0,r=e.getInputAction(wue.LEFT_DOWN,n),D(r)&&(kt.clone(o,Yue.position),r(Yue)),e._touchHoldTimer=setTimeout((function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(wue.RIGHT_CLICK,n),D(s))){Lue(e._primaryStartPosition,e._previousPositions.values[0],e._holdPixelTolerance)&&(kt.clone(e._primaryPosition,Kue.position),s(Kue))}}),sde.touchHoldDelayMilliseconds),t.preventDefault()}2!==o||a||(e._isPinching=!0,r=e.getInputAction(wue.PINCH_START,n),D(r)&&(kt.clone(i.values[0],Xue.position1),kt.clone(i.values[1],Xue.position2),r(Xue),t.preventDefault()))}function Jue(e,t){Nue(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i){r=n[i],s=r.identifier;const t=a.get(s);D(t)&&Eue(e,r,t)}nde(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,kt.clone(a.get(s),c.get(s))}const ede={startPosition:new kt,endPosition:new kt},tde={distance:{startPosition:new kt,endPosition:new kt},angleAndHeight:{startPosition:new kt,endPosition:new kt}};function nde(e,t){const n=Sue(t),i=e._positions,o=e._previousPositions,r=i.length;let s;if(1===r&&e._buttonDown[Cue]){const o=i.values[0];kt.clone(o,e._primaryPosition);const r=e._primaryPreviousPosition;s=e.getInputAction(wue.MOUSE_MOVE,n),D(s)&&(kt.clone(r,ede.startPosition),kt.clone(o,ede.endPosition),s(ede)),kt.clone(o,r),t.preventDefault()}else if(2===r&&e._isPinching&&(s=e.getInputAction(wue.PINCH_MOVE,n),D(s))){const e=i.values[0],t=i.values[1],n=o.values[0],r=o.values[1],a=t.x-e.x,c=t.y-e.y,l=.25*Math.sqrt(a*a+c*c),u=r.x-n.x,d=r.y-n.y,h=.25*Math.sqrt(u*u+d*d),p=.125*(t.y+e.y),f=.125*(r.y+n.y),m=Math.atan2(c,a),_=Math.atan2(d,u);kt.fromElements(0,h,tde.distance.startPosition),kt.fromElements(0,l,tde.distance.endPosition),kt.fromElements(_,f,tde.angleAndHeight.startPosition),kt.fromElements(m,p,tde.angleAndHeight.endPosition),s(tde)}}function ide(e,t){if(t.target.setPointerCapture(t.pointerId),"touch"===t.pointerType){const n=e._positions,i=t.pointerId;n.set(i,Eue(e,t,new kt)),Zue(e,t);e._previousPositions.set(i,kt.clone(n.get(i)))}else Mue(e,t)}function ode(e,t){if("touch"===t.pointerType){const n=e._positions,i=t.pointerId;n.remove(i),Zue(e,t);e._previousPositions.remove(i)}else Uue(e,t)}function rde(e,t){if("touch"===t.pointerType){const n=e._positions,i=t.pointerId,o=n.get(i);if(!D(o))return;Eue(e,t,o),nde(e,t);const r=e._previousPositions;kt.clone(n.get(i),r.get(i))}else Vue(e,t)}function sde(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-sde.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new kt,this._primaryPosition=new kt,this._primaryPreviousPosition=new kt,this._positions=new bu,this._previousPositions=new bu,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=M(e,document),function(e){const t=e._element,n=D(t.disableRootEvents)?t:document;let i;Ct.supportsPointerEvents()?(Due(e,"pointerdown",t,ide),Due(e,"pointerup",t,ode),Due(e,"pointermove",t,rde),Due(e,"pointercancel",t,ode)):(Due(e,"mousedown",t,Mue),Due(e,"mouseup",n,Uue),Due(e,"mousemove",n,Vue),Due(e,"touchstart",t,Wue),Due(e,"touchend",n,que),Due(e,"touchmove",n,Jue),Due(e,"touchcancel",n,que)),Due(e,"dblclick",t,Gue),i="onwheel"in t?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",Due(e,i,t,jue)}(this)}function ade(e){L.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}sde.prototype.setInputAction=function(e,t,n){if(!D(e))throw new P("action is required.");if(!D(t))throw new P("type is required.");const i=xue(t,n);this._inputEvents[i]=e},sde.prototype.getInputAction=function(e,t){if(!D(e))throw new P("type is required.");const n=xue(e,t);return this._inputEvents[n]},sde.prototype.removeInputAction=function(e,t){if(!D(e))throw new P("type is required.");const n=xue(e,t);delete this._inputEvents[n]},sde.prototype.isDestroyed=function(){return!1},sde.prototype.destroy=function(){return function(e){const t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}(this),He(this)},sde.mouseEmulationIgnoreMilliseconds=800,sde.touchHoldDelayMilliseconds=1500,ade.prototype.completeMorph=function(){D(this._completeMorph)&&this._completeMorph()},ade.prototype.morphTo2D=function(e,t){D(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof Xc,this._previousMode!==gl.SCENE2D&&this._previousMode!==gl.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,gl.SCENE2D,!0),n._mode=gl.MORPHING,n.camera._setTransform(ve.IDENTITY),this._previousMode===gl.COLUMBUS_VIEW?function(e,t){t*=.5;const n=e._scene,i=n.camera,o=H.clone(i.position,jde),r=H.clone(i.direction,Wde),s=H.clone(i.up,qde),a=H.negate(H.UNIT_Z,Xde),c=H.clone(H.UNIT_Y,Qde),l=Yde;if(t>0)H.clone(H.ZERO,Yde),l.z=5*n.mapProjection.ellipsoid.maximumRadius;else{H.clone(o,Yde);const e=Kde;ve.multiplyByPoint(die.TRANSFORM_2D,o,e.origin),ve.multiplyByPointAsVector(die.TRANSFORM_2D,r,e.direction);const t=n.globe;if(D(t)){const i=t.pickWorldCoordinates(e,n,!0,Zde);D(i)&&(ve.multiplyByPoint(die.TRANSFORM_2D_INVERSE,i,l),l.z+=H.distance(o,l))}}const u=$de;u.right=.5*l.z,u.left=-u.right,u.top=u.right*(n.drawingBufferHeight/n.drawingBufferWidth),u.bottom=-u.top;const d=Jde;d.position=l,d.direction=a,d.up=c,d.frustum=u;const h=dhe(d);function p(e){Hde(o,l,e.time,i.position),Hde(r,a,e.time,i.direction),Hde(s,c,e.time,i.up),H.cross(i.direction,i.up,i.right),H.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function f(e,t){e.position.z=t}Tde(e,h);const m=n.tweens.add({duration:t,easingFunction:k8.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:p,complete:function(){Gde(e,t,d,f,h)}});e._currentTweens.push(m)}(this,e):function(e,t,n){t*=.5;const i=e._scene,o=i.camera,r=the;if(t>0)H.clone(H.ZERO,r.position),r.position.z=5*n.maximumRadius,H.negate(H.UNIT_Z,r.direction),H.clone(H.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,ehe),i.mapProjection.project(ehe,r.position),H.negate(H.UNIT_Z,r.direction),H.clone(H.UNIT_Y,r.up);const e=ohe;H.clone(r.position2D,e.origin);const t=H.clone(o.directionWC,e.direction),s=n.scaleToGeodeticSurface(o.positionWC,she),a=Cr.eastNorthUpToFixedFrame(s,n,rhe);ve.inverseTransformation(a,a),ve.multiplyByPointAsVector(a,t,t),ve.multiplyByPointAsVector(die.TRANSFORM_2D,t,t);const c=i.globe;if(D(c)){const t=c.pickWorldCoordinates(e,i,!0,ihe);if(D(t)){const e=H.distance(r.position2D,t);t.x+=e,H.clone(t,r.position2D)}}}function s(e,t){e.position.x=t}ve.multiplyByPoint(die.TRANSFORM_2D,r.position,r.position2D),ve.multiplyByPointAsVector(die.TRANSFORM_2D,r.direction,r.direction2D),ve.multiplyByPointAsVector(die.TRANSFORM_2D,r.up,r.up2D);const a=r.frustum;a.right=.5*r.position.z,a.left=-a.right,a.top=a.right*(i.drawingBufferHeight/i.drawingBufferWidth),a.bottom=-a.top;const c=nhe;ve.multiplyByPoint(die.TRANSFORM_2D_INVERSE,r.position2D,c.position),H.clone(r.direction,c.direction),H.clone(r.up,c.up),c.frustum=a;const l=dhe(c);function u(){Gde(e,t,r,s,l)}Tde(e,l),che(e,t,r,u)}(this,e,t),0===e&&D(this._completeMorph)&&this._completeMorph())};const cde=new H,lde=new H,ude=new H,dde=new H,hde=new H,pde=new H,fde=new H,mde=new Qt,_de=new ve,gde=new Vne,yde=new Xc,bde={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};ade.prototype.morphToColumbusView=function(e,t){D(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode===gl.COLUMBUS_VIEW||this._previousMode===gl.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,gl.COLUMBUS_VIEW,!0),n.camera._setTransform(ve.IDENTITY);let i=cde;const o=lde,r=ude;if(e>0)i.x=0,i.y=-1,i.z=1,i=H.multiplyByScalar(H.normalize(i,i),5*t.maximumRadius,i),H.negate(H.normalize(i,o),o),H.cross(H.UNIT_X,o,r);else{const e=n.camera;if(this._previousMode===gl.SCENE2D)H.clone(e.position,i),i.z=e.frustum.right-e.frustum.left,H.negate(H.UNIT_Z,o),H.clone(H.UNIT_Y,r);else{H.clone(e.positionWC,i),H.clone(e.directionWC,o),H.clone(e.upWC,r);const s=t.scaleToGeodeticSurface(i,fde),a=Cr.eastNorthUpToFixedFrame(s,t,_de);ve.inverseTransformation(a,a),n.mapProjection.project(t.cartesianToCartographic(i,mde),i),ve.multiplyByPointAsVector(a,o,o),ve.multiplyByPointAsVector(a,r,r)}}let s;this._morphToOrthographic?(s=yde,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=gde,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=V.toRadians(60));const a=bde;a.position=i,a.direction=o,a.up=r,a.frustum=s;const c=function(e){return function(t){const n=t._scene;n._mode=gl.COLUMBUS_VIEW,n.morphTime=gl.getMorphTime(gl.COLUMBUS_VIEW),wde(t);const i=n.camera;(t._previousModeMode!==gl.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,H.clone(e.position,i.position),H.clone(e.direction,i.direction),H.clone(e.up,i.up),H.cross(i.direction,i.up,i.right),H.normalize(i.right,i.right));const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=D(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,gl.COLUMBUS_VIEW,r)}}(a);Tde(this,c),this._previousMode===gl.SCENE2D?function(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=H.clone(n.position,Ude),a=H.clone(n.direction,kde),c=H.clone(n.up,Vde);function l(){r.frustum=n.frustum.clone();const l=H.clone(r.position,Fde),u=H.clone(r.direction,Bde),d=H.clone(r.up,zde);function h(e){Hde(l,s,e.time,r.position),Hde(u,a,e.time,r.direction),Hde(d,c,e.time,r.up),H.cross(r.direction,r.up,r.right),H.normalize(r.right,r.right)}l.z=s.z;const p=o.tweens.add({duration:t,easingFunction:k8.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:h,complete:function(){i(e)}});e._currentTweens.push(p)}o._mode=gl.MORPHING,e._morphToOrthographic?l():ahe(e,0,n,l)}(this,e,a,c):(a.position2D=ve.multiplyByPoint(die.TRANSFORM_2D,i,dde),a.direction2D=ve.multiplyByPointAsVector(die.TRANSFORM_2D,o,hde),a.up2D=ve.multiplyByPointAsVector(die.TRANSFORM_2D,r,pde),n._mode=gl.MORPHING,che(this,e,a,c)),0===e&&D(this._completeMorph)&&this._completeMorph()};const vde={position:new H,direction:new H,up:new H,frustum:void 0},Ade=new Vne;function Tde(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new sde(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,wue.LEFT_DOWN),e._morphHandler.setInputAction(n,wue.MIDDLE_DOWN),e._morphHandler.setInputAction(n,wue.RIGHT_DOWN),e._morphHandler.setInputAction(n,wue.WHEEL)}}function wde(e){const t=e._currentTweens;for(let n=0;n<t.length;++n)t[n].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}ade.prototype.morphTo3D=function(e,t){D(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode!==gl.SCENE3D&&this._previousMode!==gl.MORPHING){if(this._scene.morphStart.raiseEvent(this,this._previousMode,gl.SCENE3D,!0),n._mode=gl.MORPHING,n.camera._setTransform(ve.IDENTITY),this._previousMode===gl.SCENE2D)!function(e,t,n){t/=3;const i=e._scene,o=i.camera;let r,s;t>0?(r=vde,H.fromDegrees(0,0,5*n.maximumRadius,n,r.position),H.negate(r.position,r.direction),H.normalize(r.direction,r.direction),H.clone(H.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=Cde(e,n));e._morphToOrthographic?(s=Mde,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=Ade,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=V.toRadians(60));r.frustum=s;const a=uhe(r);let c;Tde(e,a),c=e._morphToOrthographic?function(){Lde(e,t,r,a)}:function(){ahe(e,t,r,(function(){Lde(e,t,r,a)}))};t>0?(i._mode=gl.SCENE2D,o.flyTo({duration:t,destination:H.fromDegrees(0,0,5*n.maximumRadius,n,Ude),complete:function(){i._mode=gl.MORPHING,c()}})):c()}(this,e,t);else{let i,o;e>0?(i=vde,H.fromDegrees(0,0,5*t.maximumRadius,t,i.position),H.negate(i.position,i.direction),H.normalize(i.direction,i.direction),H.clone(H.UNIT_Z,i.up)):i=Cde(this,t);const r=n.camera;r.frustum instanceof Xc?o=r.frustum.clone():(o=Ade,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=V.toRadians(60)),i.frustum=o;const s=uhe(i);Tde(this,s),Lde(this,e,i,s)}0===e&&D(this._completeMorph)&&this._completeMorph()}},ade.prototype.isDestroyed=function(){return!1},ade.prototype.destroy=function(){return wde(this),He(this)};const Ede=new Qt,xde=new H,Sde=new ve;function Cde(e,t){const n=e._scene,i=n.camera,o=vde,r=o.position,s=o.direction,a=o.up,c=n.mapProjection.unproject(i.position,Ede);t.cartographicToCartesian(c,r);const l=t.scaleToGeodeticSurface(r,xde),u=Cr.eastNorthUpToFixedFrame(l,t,Sde);return ve.multiplyByPointAsVector(u,i.direction,s),ve.multiplyByPointAsVector(u,i.up,a),o}const Ide=new H,Ode=new H,Dde=new H,Pde=new H,Nde=new H,Rde=new H;function Lde(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=H.clone(r.position,Ide),a=H.clone(r.direction,Ode),c=H.clone(r.up,Dde),l=ve.multiplyByPoint(die.TRANSFORM_2D_INVERSE,n.position,Pde),u=ve.multiplyByPointAsVector(die.TRANSFORM_2D_INVERSE,n.direction,Nde),d=ve.multiplyByPointAsVector(die.TRANSFORM_2D_INVERSE,n.up,Rde);const h=o.tweens.add({duration:t,easingFunction:k8.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){Hde(s,l,e.time,r.position),Hde(a,u,e.time,r.direction),Hde(c,d,e.time,r.up),H.cross(r.direction,r.up,r.right),H.normalize(r.right,r.right)},complete:function(){lhe(e,o,0,1,t,i)}});e._currentTweens.push(h)}const Mde=new Xc,Fde=new H,Bde=new H,zde=new H,Ude=new H,kde=new H,Vde=new H;function Hde(e,t,n,i){return H.lerp(e,t,n,i)}function Gde(e,t,n,i,o){const r=e._scene,s=r.camera;if(s.frustum instanceof Xc)return;const a=s.frustum.fov,c=.5*V.RADIANS_PER_DEGREE,l=n.position.z*Math.tan(.5*a);s.frustum.far=l/Math.tan(.5*c)+1e7;const u=r.tweens.add({duration:t,easingFunction:k8.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){s.frustum.fov=V.lerp(a,c,e.time);const t=l/Math.tan(.5*s.frustum.fov);i(s,t)},complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(u)}const jde=new H,Wde=new H,qde=new H,Yde=new H,Xde=new H,Qde=new H,$de=new Hc,Kde=new tp,Zde=new H,Jde={position:void 0,direction:void 0,up:void 0,frustum:void 0};const ehe=new Qt,the={position:new H,direction:new H,up:new H,position2D:new H,direction2D:new H,up2D:new H,frustum:new Hc},nhe={position:new H,direction:new H,up:new H,frustum:void 0},ihe=new H,ohe=new tp,rhe=new ve,she=new H;function ahe(e,t,n,i){const o=e._scene,r=o.camera,s=r.frustum.right-r.frustum.left;r.frustum=n.frustum.clone();const a=r.frustum.fov,c=.5*V.RADIANS_PER_DEGREE,l=s*Math.tan(.5*a);r.frustum.far=l/Math.tan(.5*c)+1e7,r.frustum.fov=c;const u=o.tweens.add({duration:t,easingFunction:k8.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){r.frustum.fov=V.lerp(c,a,e.time),r.position.z=l/Math.tan(.5*r.frustum.fov)},complete:function(){i(e)}});e._currentTweens.push(u)}function che(e,t,n,i){const o=e._scene,r=o.camera,s=H.clone(r.position,Fde),a=H.clone(r.direction,Bde),c=H.clone(r.up,zde),l=H.clone(n.position2D,Ude),u=H.clone(n.direction2D,kde),d=H.clone(n.up2D,Vde);const h=o.tweens.add({duration:t,easingFunction:k8.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:function(e){Hde(s,l,e.time,r.position),Hde(a,u,e.time,r.direction),Hde(c,d,e.time,r.up),H.cross(r.direction,r.up,r.right),H.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)},complete:function(){lhe(e,o,1,0,t,i)}});e._currentTweens.push(h)}function lhe(e,t,n,i,o,r){const s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:k8.QUARTIC_OUT};D(r)&&(s.complete=function(){r(e)});const a=t.tweens.addProperty(s);e._currentTweens.push(a)}function uhe(e){return function(t){const n=t._scene;n._mode=gl.SCENE3D,n.morphTime=gl.getMorphTime(gl.SCENE3D),wde(t);const i=n.camera;(t._previousMode!==gl.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,H.clone(e.position,i.position),H.clone(e.direction,i.direction),H.clone(e.up,i.up),H.cross(i.direction,i.up,i.right),H.normalize(i.right,i.right),i.frustum=e.frustum.clone());const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=D(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,gl.SCENE3D,r)}}function dhe(e){return function(t){const n=t._scene;n._mode=gl.SCENE2D,n.morphTime=gl.getMorphTime(gl.SCENE2D),wde(t);const i=n.camera;H.clone(e.position,i.position),i.position.z=2*n.mapProjection.ellipsoid.maximumRadius,H.clone(e.direction,i.direction),H.clone(e.up,i.up),H.cross(i.direction,i.up,i.right),H.normalize(i.right,i.right),i.frustum=e.frustum.clone();const o=D(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,gl.SCENE2D,o)}}const hhe=Object.freeze({LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4});function phe(e,t){let n=e;return D(t)&&(n+=`+${t}`),n}function fhe(e,t,n){const i=phe(hhe.PINCH,t),o=e._update,r=e._isDown,s=e._eventStartPosition,a=e._pressTime,c=e._releaseTime;o[i]=!0,r[i]=!1,s[i]=new kt;let l=e._movement[i];D(l)||(l=e._movement[i]={}),l.distance={startPosition:new kt,endPosition:new kt},l.angleAndHeight={startPosition:new kt,endPosition:new kt},l.prevAngle=0,e._eventHandler.setInputAction((function(t){e._buttonsDown++,r[i]=!0,a[i]=new Date,kt.lerp(t.position1,t.position2,.5,s[i])}),wue.PINCH_START,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,c[i]=new Date}),wue.PINCH_END,t),e._eventHandler.setInputAction((function(e){if(r[i]){o[i]?(t=e,s=l,kt.clone(t.distance.startPosition,s.distance.startPosition),kt.clone(t.distance.endPosition,s.distance.endPosition),kt.clone(t.angleAndHeight.startPosition,s.angleAndHeight.startPosition),kt.clone(t.angleAndHeight.endPosition,s.angleAndHeight.endPosition),o[i]=!1,l.prevAngle=l.angleAndHeight.startPosition.x):(kt.clone(e.distance.endPosition,l.distance.endPosition),kt.clone(e.angleAndHeight.endPosition,l.angleAndHeight.endPosition));let r=l.angleAndHeight.endPosition.x;const a=l.prevAngle,c=2*Math.PI;for(;r>=a+Math.PI;)r-=c;for(;r<a-Math.PI;)r+=c;l.angleAndHeight.endPosition.x=-r*n.clientWidth/12,l.angleAndHeight.startPosition.x=-a*n.clientWidth/12}var t,s}),wue.PINCH_MOVE,t)}function mhe(e,t){const n=phe(hhe.WHEEL,t),i=e._pressTime,o=e._releaseTime,r=e._update;r[n]=!0;let s=e._movement[n];D(s)||(s=e._movement[n]={});let a=e._lastMovement[n];D(a)||(a=e._lastMovement[n]={startPosition:new kt,endPosition:new kt,valid:!1}),s.startPosition=new kt,kt.clone(kt.ZERO,s.startPosition),s.endPosition=new kt,e._eventHandler.setInputAction((function(e){const t=7.5*V.toRadians(e);i[n]=o[n]=new Date,s.endPosition.x=0,s.endPosition.y=t,kt.clone(s.endPosition,a.endPosition),a.valid=!0,r[n]=!1}),wue.WHEEL,t)}function _he(e,t,n){const i=phe(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime,a=e._releaseTime;o[i]=!1,r[i]=new kt;let c,l,u=e._lastMovement[i];D(u)||(u=e._lastMovement[i]={startPosition:new kt,endPosition:new kt,valid:!1}),n===hhe.LEFT_DRAG?(c=wue.LEFT_DOWN,l=wue.LEFT_UP):n===hhe.RIGHT_DRAG?(c=wue.RIGHT_DOWN,l=wue.RIGHT_UP):n===hhe.MIDDLE_DRAG&&(c=wue.MIDDLE_DOWN,l=wue.MIDDLE_UP),e._eventHandler.setInputAction((function(t){e._buttonsDown++,u.valid=!1,o[i]=!0,s[i]=new Date,kt.clone(t.position,r[i])}),c,t),e._eventHandler.setInputAction((function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,a[i]=new Date}),l,t)}function ghe(e,t){kt.clone(e.startPosition,t.startPosition),kt.clone(e.endPosition,t.endPosition)}function yhe(e,t){const n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(const s in hhe)if(hhe.hasOwnProperty(s)){const i=hhe[s];if(D(i)){const o=phe(i,t);n[o]=!0,D(e._lastMovement[o])||(e._lastMovement[o]={startPosition:new kt,endPosition:new kt,valid:!1}),D(e._movement[o])||(e._movement[o]={startPosition:new kt,endPosition:new kt})}}e._eventHandler.setInputAction((function(s){for(const e in hhe)if(hhe.hasOwnProperty(e)){const a=hhe[e];if(D(a)){const e=phe(a,t);r[e]&&(n[e]?(ghe(i[e],o[e]),o[e].valid=!0,ghe(s,i[e]),n[e]=!1):kt.clone(s.endPosition,i[e].endPosition))}}kt.clone(s.endPosition,e._currentMousePosition)}),wue.MOUSE_MOVE,t)}function bhe(e){if(!D(e))throw new P("canvas is required.");this._eventHandler=new sde(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new kt,mhe(this,void 0),fhe(this,void 0,e),_he(this,void 0,hhe.LEFT_DRAG),_he(this,void 0,hhe.RIGHT_DRAG),_he(this,void 0,hhe.MIDDLE_DRAG),yhe(this,void 0);for(const t in Tue)if(Tue.hasOwnProperty(t)){const n=Tue[t];D(n)&&(mhe(this,n),fhe(this,n,e),_he(this,n,hhe.LEFT_DRAG),_he(this,n,hhe.RIGHT_DRAG),_he(this,n,hhe.MIDDLE_DRAG),yhe(this,n))}}function vhe(e,t,n,i,o,r,s,a,c,l){this._tweens=e,this._tweenjs=t,this._startObject=ti(n),this._stopObject=ti(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=c,this.cancel=l,this.needsStart=!0}function Ahe(){this._tweens=[]}function The(e){if(!D(e))throw new P("scene is required.");this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=hhe.LEFT_DRAG,this.zoomEventTypes=[hhe.RIGHT_DRAG,hhe.WHEEL,hhe.PINCH],this.rotateEventTypes=hhe.LEFT_DRAG,this.tiltEventTypes=[hhe.MIDDLE_DRAG,hhe.PINCH,{eventType:hhe.LEFT_DRAG,modifier:Tue.CTRL},{eventType:hhe.RIGHT_DRAG,modifier:Tue.CTRL}],this.lookEventTypes={eventType:hhe.LEFT_DRAG,modifier:Tue.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumPickingTerrainDistanceWithInertia=4e3,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=e,this._globe=void 0,this._ellipsoid=void 0,this._lastGlobeHeight=0,this._aggregator=new bhe(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new Ahe,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new kt(-1,-1),this._tiltCenter=new H,this._rotateMousePosition=new kt(-1,-1),this._rotateStartPosition=new H,this._strafeStartPosition=new H,this._strafeMousePosition=new kt,this._strafeEndMousePosition=new kt,this._zoomMouseStart=new kt(-1,-1),this._zoomWorldPosition=new H,this._useZoomWorldPosition=!1,this._panLastMousePosition=new kt,this._panLastWorldPosition=new H,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;const t=e.mapProjection;this._maxCoord=t.project(new Qt(Math.PI,V.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,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}Object.defineProperties(bhe.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!(this._update[phe(hhe.WHEEL)]&&this._update[phe(hhe.WHEEL,Tue.SHIFT)]&&this._update[phe(hhe.WHEEL,Tue.CTRL)]&&this._update[phe(hhe.WHEEL,Tue.ALT)]);return this._buttonsDown>0||e}}}),bhe.prototype.isMoving=function(e,t){if(!D(e))throw new P("type is required.");const n=phe(e,t);return!this._update[n]},bhe.prototype.getMovement=function(e,t){if(!D(e))throw new P("type is required.");const n=phe(e,t);return this._movement[n]},bhe.prototype.getLastMovement=function(e,t){if(!D(e))throw new P("type is required.");const n=phe(e,t),i=this._lastMovement[n];if(i.valid)return i},bhe.prototype.isButtonDown=function(e,t){if(!D(e))throw new P("type is required.");const n=phe(e,t);return this._isDown[n]},bhe.prototype.getStartMousePosition=function(e,t){if(!D(e))throw new P("type is required.");if(e===hhe.WHEEL)return this._currentMousePosition;const n=phe(e,t);return this._eventStartPosition[n]},bhe.prototype.getButtonPressTime=function(e,t){if(!D(e))throw new P("type is required.");const n=phe(e,t);return this._pressTime[n]},bhe.prototype.getButtonReleaseTime=function(e,t){if(!D(e))throw new P("type is required.");const n=phe(e,t);return this._releaseTime[n]},bhe.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)},bhe.prototype.isDestroyed=function(){return!1},bhe.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),He(this)},Object.defineProperties(vhe.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}}}),vhe.prototype.cancelTween=function(){this._tweens.remove(this)},Object.defineProperties(Ahe.prototype,{length:{get:function(){return this._tweens.length}}}),Ahe.prototype.add=function(e){if(!D((e=M(e,M.EMPTY_OBJECT)).startObject)||!D(e.stopObject))throw new P("options.startObject and options.stopObject are required.");if(!D(e.duration)||e.duration<0)throw new P("options.duration is required and must be positive.");if(0===e.duration)return D(e.complete)&&e.complete(),new vhe(this);const t=e.duration/Tn.SECONDS_PER_MILLISECOND,n=M(e.delay,0),i=n/Tn.SECONDS_PER_MILLISECOND,o=M(e.easingFunction,k8.LINEAR_NONE),r=e.startObject,s=new B8(r);s.to(ti(e.stopObject),t),s.delay(i),s.easing(o),D(e.update)&&s.onUpdate((function(){e.update(r)})),s.onComplete(M(e.complete,null)),s.repeat(M(e._repeat,0));const a=new vhe(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a},Ahe.prototype.addProperty=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).object,n=e.property,i=e.startValue,o=e.stopValue;if(!D(t)||!D(e.property))throw new P("options.object and options.property are required.");if(!D(t[n]))throw new P("options.object must have the specified property.");if(!D(i)||!D(o))throw new P("options.startValue and options.stopValue are required.");return this.add({startObject:{value:i},stopObject:{value:o},duration:M(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){t[n]=e.value},complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},Ahe.prototype.addAlpha=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).material;if(!D(t))throw new P("options.material is required.");const n=[];for(const i in t.uniforms)t.uniforms.hasOwnProperty(i)&&D(t.uniforms[i])&&D(t.uniforms[i].alpha)&&n.push(i);if(0===n.length)throw new P("material has no properties with alpha components.");return this.add({startObject:{alpha:M(e.startValue,0)},stopObject:{alpha:M(e.stopValue,1)},duration:M(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:function(e){const i=n.length;for(let o=0;o<i;++o)t.uniforms[n[o]].alpha=e.alpha},complete:e.complete,cancel:e.cancel})},Ahe.prototype.addOffsetIncrement=function(e){const t=(e=M(e,M.EMPTY_OBJECT)).material;if(!D(t))throw new P("material is required.");if(!D(t.uniforms.offset))throw new P("material.uniforms must have an offset property.");const n=t.uniforms;return this.addProperty({object:n,property:"offset",startValue:n.offset,stopValue:n.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},Ahe.prototype.remove=function(e){if(!D(e))return!1;const t=this._tweens.indexOf(e);return-1!==t&&(e.tweenjs.stop(),D(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0)},Ahe.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const n=e[t];n.tweenjs.stop(),D(n.cancel)&&n.cancel()}e.length=0},Ahe.prototype.contains=function(e){return D(e)&&-1!==this._tweens.indexOf(e)},Ahe.prototype.get=function(e){if(!D(e))throw new P("index is required.");return this._tweens[e]},Ahe.prototype.update=function(e){const t=this._tweens;let n=0;for(e=D(e)?e/Tn.SECONDS_PER_MILLISECOND:rJ();n<t.length;){const i=t[n],o=i.tweenjs;i.needsStart?(i.needsStart=!1,o.start(e)):o.update(e)?n++:(o.stop(),t.splice(n,1))}};function whe(e,t,n,i,o,r,s){let a=r[s];D(a)||(a=r[s]={startPosition:new kt,endPosition:new kt,motion:new kt,inertiaEnabled:!0});const c=e.getButtonPressTime(t,n),l=e.getButtonReleaseTime(t,n),u=c&&l&&(l.getTime()-c.getTime())/1e3,d=new Date,h=l&&(d.getTime()-l.getTime())/1e3;if(c&&l&&u<.4){const s=function(e,t){if(e<0)return 0;const n=25*(1-t);return Math.exp(-n*e)}(h,i),c=e.getLastMovement(t,n);if(!D(c)||(p=c,kt.equalsEpsilon(p.startPosition,p.endPosition,V.EPSILON14))||!a.inertiaEnabled)return;if(a.motion.x=.5*(c.endPosition.x-c.startPosition.x),a.motion.y=.5*(c.endPosition.y-c.startPosition.y),a.startPosition=kt.clone(c.startPosition,a.startPosition),a.endPosition=kt.multiplyByScalar(a.motion,s,a.endPosition),a.endPosition=kt.add(a.startPosition,a.endPosition,a.endPosition),isNaN(a.endPosition.x)||isNaN(a.endPosition.y)||kt.distance(a.startPosition,a.endPosition)<.5)return;if(!e.isButtonDown(t,n)){o(r,e.getStartMousePosition(t,n),a)}}var p}function Ehe(e,t){if(D(t)){let n=e[t];D(n)&&(n.inertiaEnabled=!0);const i=e._inertiaDisablers[t];if(D(i)){const t=i.length;for(let o=0;o<t;++o)n=e[i[o]],D(n)&&(n.inertiaEnabled=!1)}}}const xhe=[];function She(e,t,n,i,o,r){if(!D(n))return;const s=e._aggregator;Array.isArray(n)||(xhe[0]=n,n=xhe);const a=n.length;for(let c=0;c<a;++c){const a=n[c],l=D(a.eventType)?a.eventType:a,u=a.modifier,d=s.isMoving(l,u)&&s.getMovement(l,u),h=s.getStartMousePosition(l,u);e.enableInputs&&t&&(d?(i(e,h,d),Ehe(e,r)):o<1&&whe(s,l,u,o,i,e,r))}}const Che=new tp,Ihe=new H,Ohe=new kt,Dhe=new H,Phe=new kt,Nhe=new H,Rhe=new H,Lhe=new H,Mhe=new H,Fhe=new H,Bhe=new H,zhe=new H,Uhe=new H,khe=new H,Vhe=new H,Hhe=new H,Ghe=new H,jhe=new H,Whe=new H,qhe=new H,Yhe=new H,Xhe=new H,Qhe=new H,$he={orientation:new eo};function Khe(e,t,n,i,o,r){let s=1;D(r)&&(s=V.clamp(Math.abs(r),.25,1));const a=n.endPosition.y-n.startPosition.y,c=a>0?e.minimumZoomDistance*s:0,l=e.maximumZoomDistance;let u=i*(o-c);u=V.clamp(u,e._minimumZoomRate,e._maximumZoomRate);let d=a/e._scene.canvas.clientHeight;d=Math.min(d,e.maximumMovementRatio);let h=u*d;if(e.enableCollisionDetection||0===e.minimumZoomDistance||!D(e._globe)){if(h>0&&Math.abs(o-c)<1)return;if(h<0&&Math.abs(o-l)<1)return;o-h<c?h=o-c-1:o-h>l&&(h=o-l)}const p=e._scene,f=p.camera,m=p.mode,_=$he.orientation;if(_.heading=f.heading,_.pitch=f.pitch,_.roll=f.roll,f.frustum instanceof Xc)return void(Math.abs(h)>0&&(f.zoomIn(h),f._adjustOrthographicFrustum(!0)));const g=M(n.inertiaEnabled,kt.equals(t,e._zoomMouseStart));let y,b=e._zoomingOnVector,v=e._rotatingZoom;if(g||(e._zoomMouseStart=kt.clone(t,e._zoomMouseStart),D(e._globe)&&m===gl.SCENE2D?(y=f.getPickRay(t,Che).origin,y=H.fromElements(y.y,y.z,y.x)):D(e._globe)&&(y=lpe(e,t,Ihe)),D(y)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=H.clone(y,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,b=e._zoomingOnVector=!1,v=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition)return void f.zoomIn(h);let A=m===gl.COLUMBUS_VIEW;if(f.positionCartographic.height<2e6&&(v=!0),!g||v){if(m===gl.SCENE2D){const n=e._zoomWorldPosition,i=f.position;if(!H.equals(n,i)&&f.positionCartographic.height<2*e._maxCoord.x){const o=f.position.x,r=H.subtract(n,i,Dhe);H.normalize(r,r);const s=H.distance(n,i)*h/(.5*f.getMagnitude());f.move(r,.5*s),(f.position.x<0&&o>0||f.position.x>0&&o<0)&&(y=f.getPickRay(t,Che).origin,y=H.fromElements(y.y,y.z,y.x),e._zoomWorldPosition=H.clone(y,e._zoomWorldPosition))}}else if(m===gl.SCENE3D){const t=H.normalize(f.position,Fhe);if(e._cameraUnderground||e._zoomingUnderground||f.positionCartographic.height<3e3&&Math.abs(H.dot(f.direction,t))<.6)A=!0;else{const n=p.canvas,i=Phe;i.x=n.clientWidth/2,i.y=n.clientHeight/2;const o=lpe(e,i,Nhe);if(D(o))if(f.positionCartographic.height<1e6){if(!(H.dot(f.direction,t)>=-.5)){const n=zhe;H.clone(f.position,n);const i=e._zoomWorldPosition;let o=Bhe;if(o=H.normalize(i,o),H.dot(o,t)<0)return;const r=qhe,s=Vhe;H.clone(f.direction,s),H.add(n,H.multiplyByScalar(s,1e3,Yhe),r);const a=Hhe,c=Ghe;H.subtract(i,n,a),H.normalize(a,c);const l=H.dot(t,c);if(l>=0)return void(e._zoomMouseStart.x=-1);const u=Math.acos(-l),d=H.magnitude(n),p=H.magnitude(i),m=d-h,_=H.magnitude(a),g=Math.asin(V.clamp(_/p*Math.sin(u),-1,1))-Math.asin(V.clamp(m/p*Math.sin(u),-1,1))+u,y=Uhe;H.normalize(n,y);let b=khe;b=H.cross(c,y,b),b=H.normalize(b,b),H.normalize(H.cross(y,b,Yhe),s),H.multiplyByScalar(H.normalize(r,Yhe),H.magnitude(r)-h,r),H.normalize(n,n),H.multiplyByScalar(n,m,n);const v=jhe;H.multiplyByScalar(H.add(H.multiplyByScalar(y,Math.cos(g)-1,Xhe),H.multiplyByScalar(s,Math.sin(g),Qhe),Yhe),m,v),H.add(n,v,n),H.normalize(r,y),H.normalize(H.cross(y,b,Yhe),s);const A=Whe;return H.multiplyByScalar(H.add(H.multiplyByScalar(y,Math.cos(g)-1,Xhe),H.multiplyByScalar(s,Math.sin(g),Qhe),Yhe),H.magnitude(r),A),H.add(r,A,r),H.clone(n,f.position),H.normalize(H.subtract(r,n,Yhe),f.direction),H.clone(f.direction,f.direction),H.cross(f.direction,f.up,f.right),H.cross(f.right,f.direction,f.up),void f.setView($he)}A=!0}else{const t=H.normalize(o,Rhe),n=H.normalize(e._zoomWorldPosition,Lhe),i=H.dot(n,t);if(i>0&&i<1){const e=V.acosClamped(i),o=H.cross(n,t,Mhe),r=h/(Math.abs(e)>V.toRadians(20)?.75*f.positionCartographic.height:f.positionCartographic.height-h);f.rotate(o,e*r)}}else A=!0}}e._rotatingZoom=!A}if(!g&&A||b){let n;const i=QR.wgs84ToWindowCoordinates(p,e._zoomWorldPosition,Ohe);n=m!==gl.COLUMBUS_VIEW&&kt.equals(t,e._zoomMouseStart)&&D(i)?f.getPickRay(i,Che):f.getPickRay(t,Che);const o=n.direction;m!==gl.COLUMBUS_VIEW&&m!==gl.SCENE2D||H.fromElements(o.y,o.z,o.x,o),f.move(o,h),e._zoomingOnVector=!0}else f.zoomIn(h);e._cameraUnderground||f.setView($he)}const Zhe=new tp,Jhe=new tp,epe=new H;function tpe(e,t,n){const i=e._scene.camera;let o=i.getPickRay(n.startPosition,Zhe).origin,r=i.getPickRay(n.endPosition,Jhe).origin;o=H.fromElements(o.y,o.z,o.x,o),r=H.fromElements(r.y,r.z,r.x,r);const s=H.subtract(o,r,epe),a=H.magnitude(s);a>0&&(H.normalize(s,s),i.move(s,a))}function npe(e,t,n){D(n.distance)&&(n=n.distance);const i=e._scene.camera;Khe(e,t,n,e._zoomFactor,i.getMagnitude())}const ipe=new kt,ope=new kt;function rpe(e,t,n){if(D(n.angleAndHeight))return void function(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate);i<e._minimumRotateRate&&(i=e._minimumRotateRate);const o=e._scene,r=o.camera,s=o.canvas;let a=(n.endPosition.x-n.startPosition.x)/s.clientWidth;a=Math.min(a,e.maximumMovementRatio);const c=i*a*Math.PI*4;r.twistRight(c)}(e,0,n.angleAndHeight);const i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight;let c=ipe;c.x=2/s*n.startPosition.x-1,c.y=2/a*(a-n.startPosition.y)-1,c=kt.normalize(c,c);let l=ope;l.x=2/s*n.endPosition.x-1,l.y=2/a*(a-n.endPosition.y)-1,l=kt.normalize(l,l);let u=V.acosClamped(c.x);c.y<0&&(u=V.TWO_PI-u);let d=V.acosClamped(l.x);l.y<0&&(d=V.TWO_PI-d);const h=d-u;o.twistRight(h)}const spe=new tp,ape=new H,cpe=new H;function lpe(e,t,n){const i=e._scene,o=e._globe,r=i.camera;let s;if(i.pickPositionSupported&&(s=i.pickPositionWorldCoordinates(t,ape)),!D(o))return H.clone(s,n);const a=!e._cameraUnderground,c=r.getPickRay(t,spe),l=o.pickWorldCoordinates(c,i,a,cpe);return(D(s)?H.distance(s,r.positionWC):Number.POSITIVE_INFINITY)<(D(l)?H.distance(l,r.positionWC):Number.POSITIVE_INFINITY)?H.clone(s,n):H.clone(l,n)}const upe=new Qt;function dpe(e){const t=e._ellipsoid,n=e._scene,i=n.camera;let o=0;if(n.mode===gl.SCENE3D){const e=t.cartesianToCartographic(i.position,upe);D(e)&&(o=e.height)}else o=i.position.z;const r=M(e._scene.globeHeight,0);return Math.abs(r-o)}const hpe=new H;function ppe(e,t){const n=t.origin,i=t.direction,o=dpe(e),r=H.normalize(n,hpe);let s=Math.abs(H.dot(r,i));return s=2*Math.max(s,.5),o*s}function fpe(e,t,n,i){let o=H.distance(t.origin,n);const r=dpe(e);return o>V.clamp(5*r,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance)&&(o=Math.min(o,r/5),o=Math.max(o,100)),tp.getPoint(t,o,i)}function mpe(e,t,n,i){let o;return D(n)?(o=H.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=dpe(e))):o=dpe(e),tp.getPoint(t,o,i)}const _pe=new kt;function gpe(e,t){const n=t.endPosition,i=kt.subtract(t.endPosition,t.startPosition,_pe),o=e._strafeEndMousePosition;kt.add(o,i,o),t.endPosition=o,Kpe(e,t,e._strafeStartPosition),t.endPosition=n}const ype=new tp,bpe=new tp,vpe=new H,Ape=new H,Tpe=new H,wpe=new H,Epe=new Pc(H.UNIT_X,0),xpe=new kt,Spe=new kt;function Cpe(e,t,n){if(H.equals(t,e._translateMousePosition)||(e._looking=!1),H.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking)return void Hfe(e,t,n);if(e._strafing)return void gpe(e,n);const i=e._scene.camera,o=e._cameraUnderground,r=kt.clone(n.startPosition,xpe),s=kt.clone(n.endPosition,Spe);let a=i.getPickRay(r,ype);const c=H.clone(H.ZERO,wpe),l=H.UNIT_X;let u;if(i.position.z<e._minimumPickingTerrainHeight&&(u=lpe(e,r,vpe),D(u)&&(c.x=u.x)),o||c.x>i.position.z&&D(u)){let i=u;return o&&(i=mpe(e,a,u,vpe)),kt.clone(t,e._strafeMousePosition),kt.clone(t,e._strafeEndMousePosition),H.clone(i,e._strafeStartPosition),e._strafing=!0,void Kpe(e,n,e._strafeStartPosition)}const d=Pc.fromPointNormal(c,l,Epe);a=i.getPickRay(r,ype);const h=Pp.rayPlane(a,d,vpe),p=i.getPickRay(s,bpe),f=Pp.rayPlane(p,d,Ape);if(!D(h)||!D(f))return e._looking=!0,Hfe(e,t,n),void kt.clone(t,e._translateMousePosition);const m=H.subtract(h,f,Tpe),_=m.x;m.x=m.y,m.y=m.z,m.z=_;const g=H.magnitude(m);g>V.EPSILON6&&(H.normalize(m,m),i.move(m,g))}const Ipe=new kt,Ope=new tp,Dpe=new H,Ppe=new H,Npe=new ve,Rpe=new ve,Lpe=new H,Mpe=new Pc(H.UNIT_X,0),Fpe=new H,Bpe=new Qt,zpe=new ve,Upe=new _o,kpe=new re,Vpe=new H;function Hpe(e,t,n){if(D(n.angleAndHeight)&&(n=n.angleAndHeight),kt.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking)return void Hfe(e,t,n);const i=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(i.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,function(e,t,n){const i=e._scene,o=i.camera,r=i.canvas,s=Ipe;s.x=r.clientWidth/2,s.y=r.clientHeight/2;const a=o.getPickRay(s,Ope),c=H.UNIT_X,l=a.origin,u=a.direction;let d;const h=H.dot(c,u);Math.abs(h)>V.EPSILON6&&(d=-H.dot(c,l)/h);if(!D(d)||d<=0)return e._looking=!0,Hfe(e,t,n),void kt.clone(t,e._tiltCenterMousePosition);const p=H.multiplyByScalar(u,d,Dpe);H.add(l,p,p);const f=i.mapProjection,m=f.ellipsoid;H.fromElements(p.y,p.z,p.x,p);const _=f.unproject(p,Bpe);m.cartographicToCartesian(_,p);const g=Cr.eastNorthUpToFixedFrame(p,m,Npe),y=e._globe,b=e._ellipsoid;e._globe=void 0,e._ellipsoid=on.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const v=ve.clone(o.transform,zpe);o._setTransform(g),sfe(e,t,n,H.UNIT_Z),o._setTransform(v),e._globe=y,e._ellipsoid=b;const A=b.maximumRadius;e._rotateFactor=1/A,e._rotateRateRangeAdjustment=A}(e,t,n)):function(e,t,n){const i=e._scene,o=i.camera,r=e._cameraUnderground;let s,a;const c=H.UNIT_X;if(kt.equals(t,e._tiltCenterMousePosition))s=H.clone(e._tiltCenter,Dpe);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=lpe(e,t,Dpe)),!D(s)){a=o.getPickRay(t,Ope);const i=a.origin,r=a.direction;let l;const u=H.dot(c,r);if(Math.abs(u)>V.EPSILON6&&(l=-H.dot(c,i)/u),!D(l)||l<=0)return e._looking=!0,Hfe(e,t,n),void kt.clone(t,e._tiltCenterMousePosition);s=H.multiplyByScalar(r,l,Dpe),H.add(i,s,s)}r&&(D(a)||(a=o.getPickRay(t,Ope)),fpe(e,a,s,s)),kt.clone(t,e._tiltCenterMousePosition),H.clone(s,e._tiltCenter)}const l=i.canvas,u=Ipe;u.x=l.clientWidth/2,u.y=e._tiltCenterMousePosition.y,a=o.getPickRay(u,Ope);const d=H.clone(H.ZERO,Lpe);d.x=s.x;const h=Pc.fromPointNormal(d,c,Mpe),p=Pp.rayPlane(a,h,Ppe),f=o._projection,m=f.ellipsoid;H.fromElements(s.y,s.z,s.x,s);let _=f.unproject(s,Bpe);m.cartographicToCartesian(_,s);const g=Cr.eastNorthUpToFixedFrame(s,m,Npe);let y;D(p)?(H.fromElements(p.y,p.z,p.x,p),_=f.unproject(p,Bpe),m.cartographicToCartesian(_,p),y=Cr.eastNorthUpToFixedFrame(p,m,Rpe)):y=g;const b=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=on.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let A=H.UNIT_Z;const T=ve.clone(o.transform,zpe);o._setTransform(g);const w=H.cross(H.UNIT_Z,H.normalize(o.position,Fpe),Fpe),E=H.dot(o.right,w);if(sfe(e,t,n,A,!1,!0),o._setTransform(y),E<0){const i=n.startPosition.y-n.endPosition.y;(r&&i<0||!r&&i>0)&&(A=void 0);const s=o.constrainedAxis;o.constrainedAxis=void 0,sfe(e,t,n,A,!0,!1),o.constrainedAxis=s}else sfe(e,t,n,A,!0,!1);if(D(o.constrainedAxis)){const e=H.cross(o.direction,o.constrainedAxis,Vpe);H.equalsEpsilon(e,H.ZERO,V.EPSILON6)||(H.dot(e,o.right)<0&&H.negate(e,e),H.cross(e,o.direction,o.up),H.cross(o.direction,o.up,o.right),H.normalize(o.up,o.up),H.normalize(o.right,o.right))}o._setTransform(T),e._globe=b,e._ellipsoid=v;const x=v.maximumRadius;e._rotateFactor=1/x,e._rotateRateRangeAdjustment=x;const S=H.clone(o.positionWC,Fpe);e.enableCollisionDetection&&Wfe(e,!0);if(!H.equals(o.positionWC,S)){o._setTransform(y),o.worldToCameraCoordinatesPoint(S,S);const e=H.magnitudeSquared(S);H.magnitudeSquared(o.position)>e&&(H.normalize(o.position,o.position),H.multiplyByScalar(o.position,Math.sqrt(e),o.position));const t=H.angleBetween(S,o.position),n=H.cross(S,o.position,S);H.normalize(n,n);const i=_o.fromAxisAngle(n,t,Upe),r=re.fromQuaternion(i,kpe);re.multiplyByVector(r,o.direction,o.direction),re.multiplyByVector(r,o.up,o.up),H.cross(o.direction,o.up,o.right),H.cross(o.right,o.direction,o.up),o._setTransform(T)}}(e,t,n)}const Gpe=new kt,jpe=new tp,Wpe=new H;function qpe(e,t,n){D(n.distance)&&(n=n.distance);const i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground;let a;s?a=t:(a=Gpe,a.x=r.clientWidth/2,a.y=r.clientHeight/2);const c=o.getPickRay(a,jpe),l=c.origin,u=c.direction;let d,h;if(o.position.z<e._minimumPickingTerrainHeight&&(d=lpe(e,a,Wpe)),D(d)&&(h=H.distance(l,d)),s){const t=ppe(e,c);h=D(h)?Math.min(h,t):t}if(!D(h)){const e=H.UNIT_X;h=-H.dot(e,l)/H.dot(e,u)}Khe(e,t,n,e._zoomFactor,h)}const Ype=new tp,Xpe=new Pc(H.UNIT_X,0),Qpe=new H,$pe=new H;function Kpe(e,t,n){const i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,Ype);let s=H.clone(o.direction,$pe);i.mode===gl.COLUMBUS_VIEW&&H.fromElements(s.z,s.x,s.y,s);const a=Pc.fromPointNormal(n,s,Xpe),c=Pp.rayPlane(r,a,Qpe);D(c)&&(s=H.subtract(n,c,s),i.mode===gl.COLUMBUS_VIEW&&H.fromElements(s.y,s.z,s.x,s),H.add(o.position,s,o.position))}const Zpe=new H,Jpe=new Qt,efe=new H,tfe=new on,nfe=new H,ife=new H,ofe=new H;function rfe(e,t,n){const i=e._scene.camera,o=e._cameraUnderground;let r,s,a=e._ellipsoid;if(!ve.equals(i.transform,ve.IDENTITY))return void sfe(e,t,n);const c=a.geodeticSurfaceNormal(i.position,nfe);if(kt.equals(t,e._rotateMousePosition)){if(e._looking)Hfe(e,t,n,c);else if(e._rotating)sfe(e,t,n);else if(e._strafing)gpe(e,n);else{if(H.magnitude(i.position)<H.magnitude(e._rotateStartPosition))return;r=H.magnitude(e._rotateStartPosition),s=efe,s.x=s.y=s.z=r,a=on.fromCartesian3(s,tfe),yfe(e,t,n,a)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const l=a.cartesianToCartographic(i.positionWC,Jpe).height;if(D(e._globe)&&l<e._minimumPickingTerrainHeight){const l=lpe(e,n.startPosition,ofe);if(D(l)){let c=!1;const u=i.getPickRay(n.startPosition,spe);if(o)c=!0,mpe(e,u,l,l);else{const e=a.geodeticSurfaceNormal(l,ife);c=!!(Math.abs(H.dot(u.direction,e))<.05)||H.magnitude(i.position)<H.magnitude(l)}c?(kt.clone(t,e._strafeEndMousePosition),H.clone(l,e._strafeStartPosition),e._strafing=!0,Kpe(e,n,e._strafeStartPosition)):(r=H.magnitude(l),s=efe,s.x=s.y=s.z=r,a=on.fromCartesian3(s,tfe),yfe(e,t,n,a),H.clone(l,e._rotateStartPosition))}else e._looking=!0,Hfe(e,t,n,c)}else D(i.pickEllipsoid(n.startPosition,e._ellipsoid,Zpe))?(yfe(e,t,n,e._ellipsoid),H.clone(Zpe,e._rotateStartPosition)):l>e._minimumTrackBallHeight?(e._rotating=!0,sfe(e,t,n)):(e._looking=!0,Hfe(e,t,n,c));kt.clone(t,e._rotateMousePosition)}function sfe(e,t,n,i,o,r){o=M(o,!1),r=M(r,!1);const s=e._scene,a=s.camera,c=s.canvas,l=a.constrainedAxis;D(i)&&(a.constrainedAxis=i);const u=H.magnitude(a.position);let d=e._rotateFactor*(u-e._rotateRateRangeAdjustment);d>e._maximumRotateRate&&(d=e._maximumRotateRate),d<e._minimumRotateRate&&(d=e._minimumRotateRate);let h=(n.startPosition.x-n.endPosition.x)/c.clientWidth,p=(n.startPosition.y-n.endPosition.y)/c.clientHeight;h=Math.min(h,e.maximumMovementRatio),p=Math.min(p,e.maximumMovementRatio);const f=d*h*Math.PI*2,m=d*p*Math.PI;o||a.rotateRight(f),r||a.rotateUp(m),a.constrainedAxis=l}const afe=K.clone(K.UNIT_W),cfe=K.clone(K.UNIT_W),lfe=new H,ufe=new H,dfe=new H,hfe=new H,pfe=new kt,ffe=new kt,mfe=new kt,_fe=new kt,gfe=new tp;function yfe(e,t,n,i){const o=e._scene,r=o.camera,s=kt.clone(n.startPosition,pfe),a=kt.clone(n.endPosition,ffe),c=i.cartesianToCartographic(r.positionWC,Jpe).height;let l,u;if(!n.inertiaEnabled&&c<e._minimumPickingTerrainHeight&&(l=H.clone(e._panLastWorldPosition,afe),D(e._globe)||kt.equalsEpsilon(s,e._panLastMousePosition)||(l=lpe(e,s,afe)),!D(e._globe)&&D(l))){const t=H.subtract(l,r.positionWC,ufe),n=H.multiplyByScalar(r.directionWC,H.dot(r.directionWC,t),ufe),i=H.magnitude(n),c=r.frustum.getPixelDimensions(o.drawingBufferWidth,o.drawingBufferHeight,i,o.pixelRatio,_fe),d=kt.subtract(a,s,mfe),h=H.multiplyByScalar(r.rightWC,d.x*c.x,ufe),p=H.normalize(r.positionWC,Fhe),f=r.getPickRay(a,gfe).direction,m=H.subtract(f,H.projectVector(f,r.rightWC,dfe),dfe),_=H.angleBetween(m,r.directionWC);let g=1;D(r.frustum.fov)&&(g=Math.max(Math.tan(_),.1));let y=Math.abs(H.dot(r.directionWC,p));const b=-d.y*c.y*2/Math.sqrt(g)*(1-y),v=H.multiplyByScalar(f,b,dfe);y=Math.abs(H.dot(r.upWC,p));const A=H.multiplyByScalar(r.upWC,-d.y*(1-y)*c.y,hfe);u=H.add(l,h,cfe),u=H.add(u,v,u),u=H.add(u,A,u),H.clone(u,e._panLastWorldPosition),kt.clone(a,e._panLastMousePosition)}if(D(l)&&D(u)||(l=r.pickEllipsoid(s,i,afe),u=r.pickEllipsoid(a,i,cfe)),!D(l)||!D(u))return e._rotating=!0,void sfe(e,0,n);if(l=r.worldToCameraCoordinates(l,l),u=r.worldToCameraCoordinates(u,u),D(r.constrainedAxis)){const e=r.constrainedAxis,t=H.mostOrthogonalAxis(e,lfe);H.cross(t,e,t),H.normalize(t,t);const n=H.cross(e,t,ufe),i=H.magnitude(l),o=H.dot(e,l),s=Math.acos(o/i),a=H.multiplyByScalar(e,o,dfe);H.subtract(l,a,a),H.normalize(a,a);const c=H.magnitude(u),d=H.dot(e,u),h=Math.acos(d/c),p=H.multiplyByScalar(e,d,hfe);H.subtract(u,p,p),H.normalize(p,p);let f=Math.acos(H.dot(a,t));H.dot(a,n)<0&&(f=V.TWO_PI-f);let m=Math.acos(H.dot(p,t));H.dot(p,n)<0&&(m=V.TWO_PI-m);const _=f-m;let g;g=H.equalsEpsilon(e,r.position,V.EPSILON2)?r.right:H.cross(e,r.position,lfe);const y=H.cross(e,g,lfe),b=H.dot(y,H.subtract(l,e,ufe)),v=H.dot(y,H.subtract(u,e,ufe));let A;A=b>0&&v>0?h-s:b>0&&v<=0?H.dot(r.position,e)>0?-s-h:s+h:s-h,r.rotateRight(_),r.rotateUp(A)}else{H.normalize(l,l),H.normalize(u,u);const e=H.dot(l,u),t=H.cross(l,u,lfe);if(e<1&&!H.equalsEpsilon(t,H.ZERO,V.EPSILON14)){const n=Math.acos(e);r.rotate(t,n)}}}const bfe=new H,vfe=new Qt;let Afe=0;function Tfe(e,t,n){D(n.distance)&&(n=n.distance);const i=n.inertiaEnabled,o=e._ellipsoid,r=e._scene,s=r.camera,a=r.canvas,c=e._cameraUnderground;let l;c?l=t:(l=Gpe,l.x=a.clientWidth/2,l.y=a.clientHeight/2);const u=s.getPickRay(l,jpe);let d;const h=o.cartesianToCartographic(s.position,vfe).height,p=Math.abs(Afe)<e.minimumPickingTerrainDistanceWithInertia;let f;if((i?p:h<e._minimumPickingTerrainHeight)&&(d=lpe(e,l,Wpe)),D(d)&&(f=H.distance(u.origin,d),Afe=f),c){const t=ppe(e,u);f=D(f)?Math.min(f,t):t}D(f)||(f=h);const m=H.normalize(s.position,bfe);Khe(e,t,n,e._zoomFactor,f,H.dot(m,s.direction))}const wfe=new kt,Efe=new tp,xfe=new H,Sfe=new H,Cfe=new ve,Ife=new ve,Ofe=new ve,Dfe=new _o,Pfe=new re,Nfe=new Qt,Rfe=new H;function Lfe(e,t,n){const i=e._scene.camera;if(!ve.equals(i.transform,ve.IDENTITY))return;if(D(n.angleAndHeight)&&(n=n.angleAndHeight),kt.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const o=e._ellipsoid.geodeticSurfaceNormal(i.position,Rfe);return void Hfe(e,t,n,o)}const o=e._ellipsoid.cartesianToCartographic(i.position,Nfe);e._tiltOnEllipsoid||o.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,function(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=.25*e.minimumZoomDistance,a=i.cartesianToCartographic(r.positionWC,Mfe).height;if(a-s-1<V.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const c=o.canvas,l=wfe;l.x=c.clientWidth/2,l.y=c.clientHeight/2;const u=r.getPickRay(l,Efe);let d;const h=Pp.rayEllipsoid(u,i);if(D(h))d=tp.getPoint(u,h.start,xfe);else{if(!(a>e._minimumTrackBallHeight)){e._looking=!0;const i=e._ellipsoid.geodeticSurfaceNormal(r.position,Rfe);return Hfe(e,t,n,i),void kt.clone(t,e._tiltCenterMousePosition)}{const e=Pp.grazingAltitudeLocation(u,i);if(!D(e))return;const t=i.cartesianToCartographic(e,Nfe);t.height=0,d=i.cartographicToCartesian(t,xfe)}}const p=Cr.eastNorthUpToFixedFrame(d,i,Cfe),f=e._globe,m=e._ellipsoid;e._globe=void 0,e._ellipsoid=on.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const _=ve.clone(r.transform,Ofe);r._setTransform(p),sfe(e,0,n,H.UNIT_Z),r._setTransform(_),e._globe=f,e._ellipsoid=m;const g=m.maximumRadius;e._rotateFactor=1/g,e._rotateRateRangeAdjustment=g}(e,t,n)):function(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground;let a,c,l;if(kt.equals(t,e._tiltCenterMousePosition))a=H.clone(e._tiltCenter,xfe);else{if(a=lpe(e,t,xfe),!D(a)){if(c=r.getPickRay(t,Efe),l=Pp.rayEllipsoid(c,i),!D(l)){if(i.cartesianToCartographic(r.position,Nfe).height<=e._minimumTrackBallHeight){e._looking=!0;const i=e._ellipsoid.geodeticSurfaceNormal(r.position,Rfe);Hfe(e,t,n,i),kt.clone(t,e._tiltCenterMousePosition)}return}a=tp.getPoint(c,l.start,xfe)}s&&(D(c)||(c=r.getPickRay(t,Efe)),fpe(e,c,a,a)),kt.clone(t,e._tiltCenterMousePosition),H.clone(a,e._tiltCenter)}const u=o.canvas,d=wfe;d.x=u.clientWidth/2,d.y=e._tiltCenterMousePosition.y,c=r.getPickRay(d,Efe);const h=H.magnitude(a),p=H.fromElements(h,h,h,efe),f=on.fromCartesian3(p,tfe);if(l=Pp.rayEllipsoid(c,f),!D(l))return;const m=H.magnitude(c.origin)>h?l.start:l.stop,_=tp.getPoint(c,m,Sfe),g=Cr.eastNorthUpToFixedFrame(a,i,Cfe),y=Cr.eastNorthUpToFixedFrame(_,f,Ife),b=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=on.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let A=H.UNIT_Z;const T=ve.clone(r.transform,Ofe);r._setTransform(y);const w=H.cross(_,r.positionWC,Vpe),E=H.dot(r.rightWC,w);if(E<0){const t=n.startPosition.y-n.endPosition.y;(s&&t<0||!s&&t>0)&&(A=void 0);const i=r.constrainedAxis;r.constrainedAxis=void 0,sfe(e,0,n,A,!0,!1),r.constrainedAxis=i}else sfe(e,0,n,A,!0,!1);if(r._setTransform(g),sfe(e,0,n,A,!1,!0),D(r.constrainedAxis)){const e=H.cross(r.direction,r.constrainedAxis,Vpe);H.equalsEpsilon(e,H.ZERO,V.EPSILON6)||(H.dot(e,r.right)<0&&H.negate(e,e),H.cross(e,r.direction,r.up),H.cross(r.direction,r.up,r.right),H.normalize(r.up,r.up),H.normalize(r.right,r.right))}r._setTransform(T),e._globe=b,e._ellipsoid=v;const x=v.maximumRadius;e._rotateFactor=1/x,e._rotateRateRangeAdjustment=x;const S=H.clone(r.positionWC,Vpe);e.enableCollisionDetection&&Wfe(e,!0);if(!H.equals(r.positionWC,S)){r._setTransform(y),r.worldToCameraCoordinatesPoint(S,S);const e=H.magnitudeSquared(S);H.magnitudeSquared(r.position)>e&&(H.normalize(r.position,r.position),H.multiplyByScalar(r.position,Math.sqrt(e),r.position));const t=H.angleBetween(S,r.position),n=H.cross(S,r.position,S);H.normalize(n,n);const i=_o.fromAxisAngle(n,t,Dfe),o=re.fromQuaternion(i,Pfe);re.multiplyByVector(o,r.direction,r.direction),re.multiplyByVector(o,r.up,r.up),H.cross(r.direction,r.up,r.right),H.cross(r.right,r.direction,r.up),r._setTransform(T)}}(e,t,n)}const Mfe=new Qt;const Ffe=new kt,Bfe=new kt,zfe=new tp,Ufe=new tp,kfe=new H,Vfe=new H;function Hfe(e,t,n,i){const o=e._scene.camera,r=Ffe;r.x=n.startPosition.x,r.y=0;const s=Bfe;s.x=n.endPosition.x,s.y=0;let a,c,l=o.getPickRay(r,zfe),u=o.getPickRay(s,Ufe),d=0;o.frustum instanceof Xc?(a=l.origin,c=u.origin,H.add(o.direction,a,a),H.add(o.direction,c,c),H.subtract(a,o.position,a),H.subtract(c,o.position,c),H.normalize(a,a),H.normalize(c,c)):(a=l.direction,c=u.direction);let h=H.dot(a,c);h<1&&(d=Math.acos(h)),d=n.startPosition.x>n.endPosition.x?-d:d;const p=e._horizontalRotationAxis;if(D(i)?o.look(i,-d):D(p)?o.look(p,-d):o.lookLeft(d),r.x=0,r.y=n.startPosition.y,s.x=0,s.y=n.endPosition.y,l=o.getPickRay(r,zfe),u=o.getPickRay(s,Ufe),d=0,o.frustum instanceof Xc?(a=l.origin,c=u.origin,H.add(o.direction,a,a),H.add(o.direction,c,c),H.subtract(a,o.position,a),H.subtract(c,o.position,c),H.normalize(a,a),H.normalize(c,c)):(a=l.direction,c=u.direction),h=H.dot(a,c),h<1&&(d=Math.acos(h)),d=n.startPosition.y>n.endPosition.y?-d:d,D(i=M(i,p))){const e=o.direction,t=H.negate(i,kfe),n=H.equalsEpsilon(e,i,V.EPSILON2),r=H.equalsEpsilon(e,t,V.EPSILON2);if(n||r)(n&&d<0||r&&d>0)&&o.look(o.right,-d);else{h=H.dot(e,i);let n=V.acosClamped(h);d>0&&d>n&&(d=n-V.EPSILON4),h=H.dot(e,t),n=V.acosClamped(h),d<0&&-d>n&&(d=-n+V.EPSILON4);const r=H.cross(i,e,Vfe);o.look(r,d)}}else o.lookUp(d)}const Gfe=new ve,jfe=new Qt;function Wfe(e,t){e._adjustedHeightForTerrain=!0;const n=e._scene,i=n.mode,o=n.globe;if(i===gl.SCENE2D||i===gl.MORPHING)return;const r=n.camera,s=M(null==o?void 0:o.ellipsoid,on.WGS84),a=n.mapProjection;let c,l;ve.equals(r.transform,ve.IDENTITY)||(c=ve.clone(r.transform,Gfe),l=H.magnitude(r.position),r._setTransform(ve.IDENTITY));const u=jfe;i===gl.SCENE3D?s.cartesianToCartographic(r.position,u):a.unproject(r.position,u);let d=!1;if(u.height<e._minimumCollisionTerrainHeight){const n=e._scene.globeHeight;if(D(n)){const o=n+e.minimumZoomDistance,c=n-e._lastGlobeHeight,l=c/e._lastGlobeHeight;u.height<o&&(t||Math.abs(l)<=.1)&&(u.height=o,i===gl.SCENE3D?s.cartographicToCartesian(u,r.position):a.project(u,r.position),d=!0),t||Math.abs(l)<=.1?e._lastGlobeHeight=n:e._lastGlobeHeight+=.1*c}}D(c)&&(r._setTransform(c),d&&(H.normalize(r.position,r.position),H.negate(r.position,r.direction),H.multiplyByScalar(r.position,Math.max(l,e.minimumZoomDistance),r.position),H.normalize(r.direction,r.direction),H.cross(r.direction,r.up,r.right),H.cross(r.right,r.direction,r.up)))}The.prototype.onMap=function(){const e=this._scene,t=e.mode,n=e.camera;return t!==gl.COLUMBUS_VIEW||Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0};const qfe=new H,Yfe=new H;The.prototype.update=function(){const e=this._scene,{camera:t,globe:n,mode:i}=e;ve.equals(t.transform,ve.IDENTITY)?(this._globe=n,this._ellipsoid=D(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=on.UNIT_SPHERE);const{verticalExaggeration:o,verticalExaggerationRelativeHeight:r}=e;this._minimumCollisionTerrainHeight=zf.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=zf.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=zf.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&D(this._globe);const s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;const a=H.clone(t.positionWC,qfe),c=H.clone(t.directionWC,Yfe);var l;if(i===gl.SCENE2D?function(e){const t=e._scene.mapMode2D===uie.ROTATE;ve.equals(ve.IDENTITY,e._scene.camera.transform)?(She(e,e.enableTranslate,e.translateEventTypes,tpe,e.inertiaTranslate,"_lastInertiaTranslateMovement"),She(e,e.enableZoom,e.zoomEventTypes,npe,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&She(e,e.enableRotate,e.tiltEventTypes,rpe,e.inertiaSpin,"_lastInertiaTiltMovement")):(She(e,e.enableZoom,e.zoomEventTypes,npe,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&She(e,e.enableRotate,e.translateEventTypes,rpe,e.inertiaSpin,"_lastInertiaSpinMovement"))}(this):i===gl.COLUMBUS_VIEW?(this._horizontalRotationAxis=H.UNIT_Z,function(e){const t=e._scene.camera;if(ve.equals(ve.IDENTITY,t.transform)){const n=e._tweens;if(e._aggregator.anyButtonDown&&n.removeAll(),She(e,e.enableTilt,e.tiltEventTypes,Hpe,e.inertiaSpin,"_lastInertiaTiltMovement"),She(e,e.enableTranslate,e.translateEventTypes,Cpe,e.inertiaTranslate,"_lastInertiaTranslateMovement"),She(e,e.enableZoom,e.zoomEventTypes,qpe,e.inertiaZoom,"_lastInertiaZoomMovement"),She(e,e.enableLook,e.lookEventTypes,Hfe),!e._aggregator.anyButtonDown&&!n.contains(e._tween)){const i=t.createCorrectPositionTween(e.bounceAnimationTime);D(i)&&(e._tween=n.add(i))}n.update()}else She(e,e.enableRotate,e.rotateEventTypes,sfe,e.inertiaSpin,"_lastInertiaSpinMovement"),She(e,e.enableZoom,e.zoomEventTypes,Tfe,e.inertiaZoom,"_lastInertiaZoomMovement")}(this)):i===gl.SCENE3D&&(this._horizontalRotationAxis=void 0,She(l=this,l.enableRotate,l.rotateEventTypes,rfe,l.inertiaSpin,"_lastInertiaSpinMovement"),She(l,l.enableZoom,l.zoomEventTypes,Tfe,l.inertiaZoom,"_lastInertiaZoomMovement"),She(l,l.enableTilt,l.tiltEventTypes,Lfe,l.inertiaSpin,"_lastInertiaTiltMovement"),She(l,l.enableLook,l.lookEventTypes,Hfe)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain){Wfe(this,!H.equals(a,t.positionWC)||!H.equals(c,t.directionWC))}this._aggregator.reset()},The.prototype.isDestroyed=function(){return!1},The.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),He(this)};function Xfe(){this._sceneFramebuffer=new ece;const e=.125,t=new Array(6);t[0]=new $le({fragmentShader:Sae,textureScale:e,forcePowerOfTwo:!0,sampleMode:Qle.LINEAR});const n=t[1]=new $le({fragmentShader:'uniform sampler2D colorTexture;\n\nuniform float avgLuminance;\nuniform float threshold;\nuniform float offset;\n\nin vec2 v_textureCoordinates;\n\nfloat key(float avg)\n{\n float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\n return max(0.0, guess) + 0.1;\n}\n\n// See section 9. "The bright-pass filter" of Realtime HDR Rendering\n// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf\n\nvoid main()\n{\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec3 xyz = czm_RGBToXYZ(color.rgb);\n float luminance = xyz.r;\n\n float scaledLum = key(avgLuminance) * luminance / avgLuminance;\n float brightLum = max(scaledLum - threshold, 0.0);\n float brightness = brightLum / (offset + brightLum);\n\n xyz.r = brightness;\n out_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n',uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new kt,t[2]=new $le({fragmentShader:Gle,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new $le({fragmentShader:Gle,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new $le({fragmentShader:Sae,sampleMode:Qle.LINEAR}),this._uCenter=new kt,this._uRadius=void 0,t[5]=new $le({fragmentShader:"uniform sampler2D colorTexture;\nuniform sampler2D colorTexture2;\n\nuniform vec2 center;\nuniform float radius;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n vec4 color0 = texture(colorTexture, v_textureCoordinates);\n vec4 color1 = texture(colorTexture2, v_textureCoordinates);\n\n float x = length(gl_FragCoord.xy - center) / radius;\n float t = smoothstep(0.5, 0.8, x);\n out_FragColor = mix(color0 + color1, color1, t);\n}\n",uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new oue({stages:t});const o=new cue(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}Xfe.prototype.get=function(e){return this._stages.get(e)},Xfe.prototype.getStageByName=function(e){const t=this._stages.length;for(let n=0;n<t;++n){const t=this._stages.get(n);if(t.name===e)return t}};const Qfe=new K,$fe=new kt,Kfe=new kt,Zfe=new ve;function Jfe(){this._cachedShowFrustumsShaders={}}Xfe.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)},Xfe.prototype.update=function(e){const t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);const o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),function(e,t,n){const i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection;let c=ve.computeViewportTransformation(n,0,1,Zfe);const l=ve.multiplyByPoint(r,o,Qfe);let u=Cr.pointToGLWindowCoordinates(s,c,o,$fe);l.x+=V.SOLAR_RADIUS;const d=Cr.pointToGLWindowCoordinates(a,c,l,l),h=30*kt.magnitude(kt.subtract(d,u,d))*2,p=Kfe;p.x=h,p.y=h,e._uCenter=kt.clone(u,e._uCenter),e._uRadius=.15*Math.max(p.x,p.y);const f=t.drawingBufferWidth,m=t.drawingBufferHeight,_=e._stages,g=_.get(0),y=g.outputTexture.width,b=g.outputTexture.height,v=new Fr;v.width=y,v.height=b,c=ve.computeViewportTransformation(v,0,1,Zfe),u=Cr.pointToGLWindowCoordinates(s,c,o,$fe),p.x*=y/f,p.y*=b/m;const A=g.scissorRectangle;A.x=Math.max(u.x-.5*p.x,0),A.y=Math.max(u.y-.5*p.y,0),A.width=Math.min(p.x,f),A.height=Math.min(p.y,m);for(let T=1;T<4;++T)Fr.clone(A,_.get(T).scissorRectangle)}(this,t,n),o},Xfe.prototype.execute=function(e){const t=this._sceneFramebuffer.framebuffer.getColorTexture(0),n=this._stages,i=n.length;n.get(0).execute(e,t);for(let o=1;o<i;++o)n.get(o).execute(e,n.get(o-1).outputTexture)},Xfe.prototype.copy=function(e,t){if(!D(this._copyColorCommand)){const t=this;this._copyColorCommand=e.createViewportQuadCommand(Sae,{uniformMap:{colorTexture:function(){return t._stages.get(t._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)},Xfe.prototype.isDestroyed=function(){return!1},Xfe.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),He(this)};const eme=new Ot;const tme=new Kr;function nme(e,t,n){this._primitive=e,this._tileIndex=t,this._sampleIndex=n,this._metadata={},this._orientedBoundingBox=new zp}Jfe.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let o=this._cachedShowFrustumsShaders[i];D(o)||(o=function(e,t){const n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map((function(e){e=bc.replaceMain(e,"czm_Debug_main");const t=/out_FragData_(\d+)/g;let n;for(;null!==(n=t.exec(e));)-1===r.indexOf(n[1])&&r.push(n[1]);return e}));const s=r.length;let a,c="";if(c+="uniform vec3 debugShowCommandsColor;\n",c+="uniform vec3 debugShowFrustumsColor;\n",c+="void main() \n{ \n czm_Debug_main(); \n",s>0)for(a=0;a<s;++a)c+=` out_FragData_${r[a]}.rgb *= debugShowCommandsColor;\n`,c+=` out_FragData_${r[a]}.rgb *= debugShowFrustumsColor;\n`;else c+=" out_FragColor.rgb *= debugShowCommandsColor;\n",c+=" out_FragColor.rgb *= debugShowFrustumsColor;\n";c+="}",o.sources.push(c);const l=function(e){const t={},n=e.vertexAttributes;for(const i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}(i);return ya.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:l})}(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);const r=Kr.shallowClone(t,tme);r.shaderProgram=o,r.uniformMap=function(e,t){let n;return n=D(t.uniformMap)?t.uniformMap:{},D(n.debugShowCommandsColor)||D(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(D(t._debugColor)||(t._debugColor=Ot.fromRandom()),t._debugColor):Ot.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(eme.red=1&t.debugOverlappingFrustums?1:0,eme.green=2&t.debugOverlappingFrustums?1:0,eme.blue=4&t.debugOverlappingFrustums?1:0,eme.alpha=1,eme):Ot.WHITE}),n}(e,t),r.execute(e.context,n)},nme.fromKeyframeNode=function(e,t,n,i){L.typeOf.object("primitive",e),L.typeOf.number("tileIndex",t),L.typeOf.number("sampleIndex",n),L.typeOf.object("keyframeNode",i);const o=new nme(e,t,n),{spatialNode:r,metadata:s}=i;return o._metadata=function(e,t,n){if(!D(t))return;const{names:i,types:o}=e.provider,r={};for(let s=0;s<i.length;s++){const e=i[s],a=Vx.getComponentCount(o[s]),c=t[s].slice(n*a,(n+1)*a);r[e]=c}return r}(e,s,n),o._orientedBoundingBox=function(e,t,n,i){const o=t.dimensions,r=o.x*o.y,s=Math.floor(n/r),a=n-s*r,c=Math.floor(a/o.x),l=a-c*o.x,u=H.fromElements(l,c,s,ime),d=H.divideComponents(H.subtract(u,e._paddingBefore,ime),e.dimensions,ome),h=e._shape;return h.computeOrientedBoundingBoxForSample(t,e.dimensions,d,i)}(e,r,n,o._orientedBoundingBox),o};const ime=new H,ome=new H;Object.defineProperties(nme.prototype,{metadata:{get:function(){return this._metadata}},primitive:{get:function(){return this._primitive}},sampleIndex:{get:function(){return this._sampleIndex}},tileIndex:{get:function(){return this._tileIndex}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox.clone()}}}),nme.prototype.hasProperty=function(e){return D(this._metadata[e])},nme.prototype.getNames=function(){return Object.keys(this._metadata)},nme.prototype.getProperty=function(e){return this._metadata[e]};const rme='// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT,\n// RayShapeIntersection\n\nvec4 intersectLongitude(in Ray ray, in float angle, in bool positiveNormal) {\n float normalSign = positiveNormal ? 1.0 : -1.0;\n vec2 planeNormal = vec2(-sin(angle), cos(angle)) * normalSign;\n\n vec2 position = ray.pos.xy;\n vec2 direction = ray.dir.xy;\n float approachRate = dot(direction, planeNormal);\n float distance = -dot(position, planeNormal);\n\n float t = (approachRate == 0.0)\n ? NO_HIT\n : distance / approachRate;\n\n return vec4(planeNormal, 0.0, t);\n}\n\nRayShapeIntersection intersectHalfSpace(in Ray ray, in float angle, in bool positiveNormal)\n{\n vec4 intersection = intersectLongitude(ray, angle, positiveNormal);\n vec4 farSide = vec4(normalize(ray.dir), INF_HIT);\n\n bool hitFront = (intersection.w > 0.0) == (dot(ray.pos.xy, intersection.xy) > 0.0);\n if (!hitFront) {\n return RayShapeIntersection(intersection, farSide);\n } else {\n return RayShapeIntersection(-1.0 * farSide, intersection);\n }\n}\n\nvoid intersectFlippedWedge(in Ray ray, in vec2 minMaxAngle, out RayShapeIntersection intersections[2])\n{\n intersections[0] = intersectHalfSpace(ray, minMaxAngle.x, false);\n intersections[1] = intersectHalfSpace(ray, minMaxAngle.y, true);\n}\n\nbool hitPositiveHalfPlane(in Ray ray, in vec4 intersection, in bool positiveNormal) {\n float normalSign = positiveNormal ? 1.0 : -1.0;\n vec2 planeDirection = vec2(intersection.y, -intersection.x) * normalSign;\n vec2 hit = ray.pos.xy + intersection.w * ray.dir.xy;\n return dot(hit, planeDirection) > 0.0;\n}\n\nvoid intersectHalfPlane(in Ray ray, in float angle, out RayShapeIntersection intersections[2]) {\n vec4 intersection = intersectLongitude(ray, angle, true);\n vec4 farSide = vec4(normalize(ray.dir), INF_HIT);\n\n if (hitPositiveHalfPlane(ray, intersection, true)) {\n intersections[0].entry = -1.0 * farSide;\n intersections[0].exit = vec4(-1.0 * intersection.xy, 0.0, intersection.w);\n intersections[1].entry = intersection;\n intersections[1].exit = farSide;\n } else {\n vec4 miss = vec4(normalize(ray.dir), NO_HIT);\n intersections[0].entry = -1.0 * farSide;\n intersections[0].exit = farSide;\n intersections[1].entry = miss;\n intersections[1].exit = miss;\n }\n}\n\nRayShapeIntersection intersectRegularWedge(in Ray ray, in vec2 minMaxAngle)\n{\n // Note: works for maxAngle > minAngle + pi, where the "regular wedge"\n // is actually a negative volume.\n // Compute intersections with the two planes.\n // Normals will point toward the "outside" (negative space)\n vec4 intersect1 = intersectLongitude(ray, minMaxAngle.x, false);\n vec4 intersect2 = intersectLongitude(ray, minMaxAngle.y, true);\n\n // Choose intersection with smallest T as the "first", the other as "last"\n // Note: first or last could be in the "shadow" wedge, beyond the tip\n bool inOrder = intersect1.w <= intersect2.w;\n vec4 first = inOrder ? intersect1 : intersect2;\n vec4 last = inOrder ? intersect2 : intersect1;\n\n bool firstIsAhead = first.w >= 0.0;\n bool startedInsideFirst = dot(ray.pos.xy, first.xy) < 0.0;\n bool exitFromInside = firstIsAhead == startedInsideFirst;\n bool lastIsAhead = last.w > 0.0;\n bool startedOutsideLast = dot(ray.pos.xy, last.xy) >= 0.0;\n bool enterFromOutside = lastIsAhead == startedOutsideLast;\n\n vec4 farSide = vec4(normalize(ray.dir), INF_HIT);\n vec4 miss = vec4(normalize(ray.dir), NO_HIT);\n\n if (exitFromInside && enterFromOutside) {\n // Ray crosses both faces of negative wedge, exiting then entering the positive shape\n return RayShapeIntersection(first, last);\n } else if (!exitFromInside && enterFromOutside) {\n // Ray starts inside wedge. last is in shadow wedge, and first is actually the entry\n return RayShapeIntersection(-1.0 * farSide, first);\n } else if (exitFromInside && !enterFromOutside) {\n // First intersection was in the shadow wedge, so last is actually the exit\n return RayShapeIntersection(last, farSide);\n } else { // !exitFromInside && !enterFromOutside\n // Both intersections were in the shadow wedge\n return RayShapeIntersection(miss, miss);\n }\n}\n',sme="// Main intersection function for Voxel scenes.\n// See IntersectBox.glsl, IntersectCylinder.glsl, or IntersectEllipsoid.glsl\n// for the definition of intersectShape. The appropriate function is selected\n// based on the VoxelPrimitive shape type, and added to the shader in\n// Scene/VoxelRenderResources.js.\n// See also IntersectClippingPlane.glsl and IntersectDepth.glsl.\n// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT,\n// getFirstIntersection, initializeIntersections, nextIntersection.\n\n/* Intersection defines (set in Scene/VoxelRenderResources.js)\n#define INTERSECTION_COUNT ###\n*/\n\nRayShapeIntersection intersectScene(in vec2 screenCoord, in Ray ray, out Intersections ix) {\n // Do a ray-shape intersection to find the exact starting and ending points.\n intersectShape(ray, ix);\n\n // Exit early if the positive shape was completely missed or behind the ray.\n RayShapeIntersection intersection = getFirstIntersection(ix);\n if (intersection.entry.w == NO_HIT) {\n // Positive shape was completely missed - so exit early.\n return intersection;\n }\n\n // Clipping planes\n #if defined(CLIPPING_PLANES)\n intersectClippingPlanes(ray, ix);\n #endif\n\n // Depth\n #if defined(DEPTH_TEST)\n intersectDepth(screenCoord, ray, ix);\n #endif\n\n // Find the first intersection that's in front of the ray\n #if (INTERSECTION_COUNT > 1)\n initializeIntersections(ix);\n for (int i = 0; i < INTERSECTION_COUNT; ++i) {\n intersection = nextIntersection(ix);\n if (intersection.exit.w > 0.0) {\n // Set start to 0.0 when ray is inside the shape.\n intersection.entry.w = max(intersection.entry.w, 0.0);\n break;\n }\n }\n #else\n // Set start to 0.0 when ray is inside the shape.\n intersection.entry.w = max(intersection.entry.w, 0.0);\n #endif\n\n return intersection;\n}\n";function ame(e){const t=new lu;this.shaderBuilder=t;const n=e._customShader,i=ni(e._uniformMap,n.uniformMap);e._uniformMap=i;const o=n.uniforms;for(const h in o)if(o.hasOwnProperty(h)){const e=o[h];t.addUniform(e.type,h,su.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",su.FRAGMENT),this.uniformMap=i;const r=e._clippingPlanes,s=D(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines(["in vec2 position;\n\nuniform vec4 u_ndcSpaceAxisAlignedBoundingBox;\n\nvoid main() {\n vec2 aabbMin = u_ndcSpaceAxisAlignedBoundingBox.xy;\n vec2 aabbMax = u_ndcSpaceAxisAlignedBoundingBox.zw;\n vec2 translation = 0.5 * (aabbMax + aabbMin);\n vec2 scale = 0.5 * (aabbMax - aabbMin);\n gl_Position = vec4(position * scale + translation, 0.0, 1.0);\n}\n"]),t.addFragmentLines([n.fragmentShaderText,"#line 0","// These octree flags must be in sync with GpuOctreeFlag in VoxelTraversal.js\n#define OCTREE_FLAG_INTERNAL 0\n#define OCTREE_FLAG_LEAF 1\n#define OCTREE_FLAG_PACKED_LEAF_FROM_PARENT 2\n\n#define OCTREE_MAX_LEVELS 32 // Harcoded value because GLSL doesn't like variable length loops\n\nuniform sampler2D u_octreeInternalNodeTexture;\nuniform vec2 u_octreeInternalNodeTexelSizeUv;\nuniform int u_octreeInternalNodeTilesPerRow;\n#if (SAMPLE_COUNT > 1)\nuniform sampler2D u_octreeLeafNodeTexture;\nuniform vec2 u_octreeLeafNodeTexelSizeUv;\nuniform int u_octreeLeafNodeTilesPerRow;\n#endif\n\nstruct OctreeNodeData {\n int data;\n int flag;\n};\n\nstruct TraversalData {\n ivec4 octreeCoords;\n int parentOctreeIndex;\n};\n\nstruct SampleData {\n int megatextureIndex;\n ivec4 tileCoords;\n vec3 tileUv;\n #if (SAMPLE_COUNT > 1)\n float weight;\n #endif\n};\n\n// Integer mod: For WebGL1 only\nint intMod(in int a, in int b) {\n return a - (b * (a / b));\n}\nint normU8_toInt(in float value) {\n return int(value * 255.0);\n}\nint normU8x2_toInt(in vec2 value) {\n return int(value.x * 255.0) + 256 * int(value.y * 255.0);\n}\nfloat normU8x2_toFloat(in vec2 value) {\n return float(normU8x2_toInt(value)) / 65535.0;\n}\n\nOctreeNodeData getOctreeNodeData(in vec2 octreeUv) {\n vec4 texData = texture(u_octreeInternalNodeTexture, octreeUv);\n\n OctreeNodeData data;\n data.data = normU8x2_toInt(texData.xy);\n data.flag = normU8x2_toInt(texData.zw);\n return data;\n}\n\nOctreeNodeData getOctreeChildData(in int parentOctreeIndex, in ivec3 childCoord) {\n int childIndex = childCoord.z * 4 + childCoord.y * 2 + childCoord.x;\n int octreeCoordX = intMod(parentOctreeIndex, u_octreeInternalNodeTilesPerRow) * 9 + 1 + childIndex;\n int octreeCoordY = parentOctreeIndex / u_octreeInternalNodeTilesPerRow;\n vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);\n return getOctreeNodeData(octreeUv);\n}\n\nint getOctreeParentIndex(in int octreeIndex) {\n int octreeCoordX = intMod(octreeIndex, u_octreeInternalNodeTilesPerRow) * 9;\n int octreeCoordY = octreeIndex / u_octreeInternalNodeTilesPerRow;\n vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);\n vec4 parentData = texture(u_octreeInternalNodeTexture, octreeUv);\n int parentOctreeIndex = normU8x2_toInt(parentData.xy);\n return parentOctreeIndex;\n}\n\n/**\n* Convert a position in the uv-space of the tileset bounding shape\n* into the uv-space of a tile within the tileset\n*/\nvec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {\n\t// PERFORMANCE_IDEA: use bit-shifting (only in WebGL2)\n float dimAtLevel = exp2(float(octreeCoords.w));\n return shapePosition * dimAtLevel - vec3(octreeCoords.xyz);\n}\n\nvec3 getClampedTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {\n vec3 tileUv = getTileUv(shapePosition, octreeCoords);\n return clamp(tileUv, vec3(0.0), vec3(1.0));\n}\n\nvoid getOctreeLeafSampleData(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleData) {\n sampleData.megatextureIndex = data.data;\n sampleData.tileCoords = (data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT)\n ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)\n : octreeCoords;\n}\n\n#if (SAMPLE_COUNT > 1)\nvoid getOctreeLeafSampleDatas(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleDatas[SAMPLE_COUNT]) {\n int leafIndex = data.data;\n int leafNodeTexelCount = 2;\n // Adding 0.5 moves to the center of the texel\n float leafCoordXStart = float(intMod(leafIndex, u_octreeLeafNodeTilesPerRow) * leafNodeTexelCount) + 0.5;\n float leafCoordY = float(leafIndex / u_octreeLeafNodeTilesPerRow) + 0.5;\n\n // Get an interpolation weight and a flag to determine whether to read the parent texture\n vec2 leafUv0 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 0.0, leafCoordY);\n vec4 leafData0 = texture(u_octreeLeafNodeTexture, leafUv0);\n float lerp = normU8x2_toFloat(leafData0.xy);\n sampleDatas[0].weight = 1.0 - lerp;\n sampleDatas[1].weight = lerp;\n // TODO: this looks wrong? Should be comparing to OCTREE_FLAG_PACKED_LEAF_FROM_PARENT\n sampleDatas[0].tileCoords = (normU8_toInt(leafData0.z) == 1)\n ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)\n : octreeCoords;\n sampleDatas[1].tileCoords = (normU8_toInt(leafData0.w) == 1)\n ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)\n : octreeCoords;\n\n // Get megatexture indices for both samples\n vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY);\n vec4 leafData1 = texture(u_octreeLeafNodeTexture, leafUv1);\n sampleDatas[0].megatextureIndex = normU8x2_toInt(leafData1.xy);\n sampleDatas[1].megatextureIndex = normU8x2_toInt(leafData1.zw);\n}\n#endif\n\nOctreeNodeData traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData) {\n float sizeAtLevel = exp2(-1.0 * float(traversalData.octreeCoords.w));\n vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel;\n vec3 end = start + vec3(sizeAtLevel);\n OctreeNodeData childData;\n\n for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {\n // Find out which octree child contains the position\n // 0 if before center, 1 if after\n vec3 center = 0.5 * (start + end);\n vec3 childCoord = step(center, shapePosition);\n\n // Get octree coords for the next level down\n ivec4 octreeCoords = traversalData.octreeCoords;\n traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1);\n\n childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord));\n\n if (childData.flag != OCTREE_FLAG_INTERNAL) {\n // leaf tile - stop traversing\n break;\n }\n\n // interior tile - keep going deeper\n start = mix(start, center, childCoord);\n end = mix(center, end, childCoord);\n traversalData.parentOctreeIndex = childData.data;\n }\n\n return childData;\n}\n\n/**\n* Transform a given position to an octree tile coordinate and a position within that tile,\n* and find the corresponding megatexture index and texture coordinates\n*/\nvoid traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {\n traversalData.octreeCoords = ivec4(0);\n traversalData.parentOctreeIndex = 0;\n\n OctreeNodeData nodeData = getOctreeNodeData(vec2(0.0));\n if (nodeData.flag != OCTREE_FLAG_LEAF) {\n nodeData = traverseOctreeDownwards(shapePosition, traversalData);\n }\n\n #if (SAMPLE_COUNT == 1)\n getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);\n sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);\n #else\n getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);\n sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);\n sampleDatas[1].tileUv = getClampedTileUv(shapePosition, sampleDatas[1].tileCoords);\n #endif\n}\n\nbool inRange(in vec3 v, in vec3 minVal, in vec3 maxVal) {\n return clamp(v, minVal, maxVal) == v;\n}\n\nbool insideTile(in vec3 shapePosition, in ivec4 octreeCoords) {\n vec3 tileUv = getTileUv(shapePosition, octreeCoords);\n\tbool inside = inRange(tileUv, vec3(0.0), vec3(1.0));\n\t// Assume (!) the position is always inside the root tile.\n\treturn inside || octreeCoords.w == 0;\n}\n\nvoid traverseOctreeFromExisting(in vec3 shapePosition, inout TraversalData traversalData, inout SampleData sampleDatas[SAMPLE_COUNT]) {\n if (insideTile(shapePosition, traversalData.octreeCoords)) {\n for (int i = 0; i < SAMPLE_COUNT; i++) {\n sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);\n }\n return;\n }\n\n // Go up tree until we find a parent tile containing shapePosition\n for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {\n traversalData.octreeCoords.xyz /= 2;\n traversalData.octreeCoords.w -= 1;\n\n if (insideTile(shapePosition, traversalData.octreeCoords)) {\n break;\n }\n\n traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex);\n }\n\n // Go down tree\n OctreeNodeData nodeData = traverseOctreeDownwards(shapePosition, traversalData);\n\n #if (SAMPLE_COUNT == 1)\n getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);\n sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);\n #else\n getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);\n sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);\n sampleDatas[1].tileUv = getClampedTileUv(shapePosition, sampleDatas[1].tileCoords);\n #endif\n}\n","struct Ray {\n vec3 pos;\n vec3 dir;\n vec3 rawDir;\n};\n\n#if defined(JITTER)\n/**\n * Generate a pseudo-random value for a given 2D screen coordinate.\n * Similar to https://www.shadertoy.com/view/4djSRW with a modified hashscale.\n */\nfloat hash(vec2 p)\n{\n vec3 p3 = fract(vec3(p.xyx) * 50.0);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n}\n#endif\n\nfloat minComponent(in vec3 v) {\n return min(min(v.x, v.y), v.z);\n}\n\nfloat maxComponent(in vec3 v) {\n return max(max(v.x, v.y), v.z);\n}\n\nstruct PointJacobianT {\n vec3 point;\n mat3 jacobianT;\n};\n","/* Intersection defines\n#define INTERSECTION_COUNT ###\n*/\n\n#define NO_HIT (-czm_infinity)\n#define INF_HIT (czm_infinity * 0.5)\n\nstruct RayShapeIntersection {\n vec4 entry;\n vec4 exit;\n};\n\nvec4 intersectionMin(in vec4 intersect0, in vec4 intersect1)\n{\n if (intersect0.w == NO_HIT) {\n return intersect1;\n } else if (intersect1.w == NO_HIT) {\n return intersect0;\n }\n return (intersect0.w <= intersect1.w) ? intersect0 : intersect1;\n}\n\nvec4 intersectionMax(in vec4 intersect0, in vec4 intersect1)\n{\n return (intersect0.w >= intersect1.w) ? intersect0 : intersect1;\n}\n\nRayShapeIntersection intersectIntersections(in Ray ray, in RayShapeIntersection intersect0, in RayShapeIntersection intersect1)\n{\n bool missed = (intersect0.entry.w == NO_HIT) ||\n (intersect1.entry.w == NO_HIT) ||\n (intersect0.exit.w < intersect1.entry.w) ||\n (intersect0.entry.w > intersect1.exit.w);\n if (missed) {\n vec4 miss = vec4(normalize(ray.dir), NO_HIT);\n return RayShapeIntersection(miss, miss);\n }\n\n vec4 entry = intersectionMax(intersect0.entry, intersect1.entry);\n vec4 exit = intersectionMin(intersect0.exit, intersect1.exit);\n\n return RayShapeIntersection(entry, exit);\n}\n\nstruct Intersections {\n // Don't access these member variables directly - call the functions instead.\n\n // Store an array of ray-surface intersections. Each intersection is composed of:\n // .xyz for the surface normal at the intersection point\n // .w for the T value\n // The scale of the normal encodes the shape intersection type:\n // length(intersection.xyz) = 1: positive shape entry\n // length(intersection.xyz) = 2: positive shape exit\n // length(intersection.xyz) = 3: negative shape entry\n // length(intersection.xyz) = 4: negative shape exit\n // INTERSECTION_COUNT is the number of ray-*shape* (volume) intersections,\n // so we need twice as many to track ray-*surface* intersections\n vec4 intersections[INTERSECTION_COUNT * 2];\n\n #if (INTERSECTION_COUNT > 1)\n // Maintain state for future nextIntersection calls\n int index;\n int surroundCount;\n bool surroundIsPositive;\n #endif\n};\n\nRayShapeIntersection getFirstIntersection(in Intersections ix) \n{\n return RayShapeIntersection(ix.intersections[0], ix.intersections[1]);\n}\n\nvec4 encodeIntersectionType(vec4 intersection, int index, bool entry)\n{\n float scale = float(index > 0) * 2.0 + float(!entry) + 1.0;\n return vec4(intersection.xyz * scale, intersection.w);\n}\n\n// Use defines instead of real functions because WebGL1 cannot access array with non-constant index.\n#define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = vec4(0.0, float(!positive) * 2.0 + float(!enter) + 1.0, 0.0, (t))\n#define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec4(0.0, float((index) > 0) * 2.0 + 1.0, 0.0, (entryExit).x); (ix).intersections[(index) * 2 + 1] = vec4(0.0, float((index) > 0) * 2.0 + 2.0, 0.0, (entryExit).y)\n#define setSurfaceIntersection(/*inout Intersections*/ ix, /*int*/ index, /*vec4*/ intersection, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = encodeIntersectionType((intersection), int(!positive), (enter))\n#define setShapeIntersection(/*inout Intersections*/ ix, /*int*/ index, /*RayShapeIntersection*/ intersection) (ix).intersections[(index) * 2 + 0] = encodeIntersectionType((intersection).entry, (index), true); (ix).intersections[(index) * 2 + 1] = encodeIntersectionType((intersection).exit, (index), false)\n\n#if (INTERSECTION_COUNT > 1)\nvoid initializeIntersections(inout Intersections ix) {\n // Sort the intersections from min T to max T with bubble sort.\n // Note: If this sorting function changes, some of the intersection test may\n // need to be updated. Search for \"bubble sort\" to find those areas.\n const int sortPasses = INTERSECTION_COUNT * 2 - 1;\n for (int n = sortPasses; n > 0; --n) {\n for (int i = 0; i < sortPasses; ++i) {\n // The loop should be: for (i = 0; i < n; ++i) {...} but WebGL1 cannot\n // loop with non-constant condition, so it has to break early instead\n if (i >= n) { break; }\n\n vec4 intersect0 = ix.intersections[i + 0];\n vec4 intersect1 = ix.intersections[i + 1];\n\n bool inOrder = intersect0.w <= intersect1.w;\n\n ix.intersections[i + 0] = inOrder ? intersect0 : intersect1;\n ix.intersections[i + 1] = inOrder ? intersect1 : intersect0;\n }\n }\n\n // Prepare initial state for nextIntersection\n ix.index = 0;\n ix.surroundCount = 0;\n ix.surroundIsPositive = false;\n}\n#endif\n\n#if (INTERSECTION_COUNT > 1)\nRayShapeIntersection nextIntersection(inout Intersections ix) {\n vec4 surfaceIntersection = vec4(0.0, 0.0, 0.0, NO_HIT);\n RayShapeIntersection shapeIntersection = RayShapeIntersection(surfaceIntersection, surfaceIntersection);\n\n const int passCount = INTERSECTION_COUNT * 2;\n\n if (ix.index == passCount) {\n return shapeIntersection;\n }\n\n for (int i = 0; i < passCount; ++i) {\n // The loop should be: for (i = ix.index; i < passCount; ++i) {...} but WebGL1 cannot\n // loop with non-constant condition, so it has to continue instead.\n if (i < ix.index) {\n continue;\n }\n\n ix.index = i + 1;\n\n surfaceIntersection = ix.intersections[i];\n int intersectionType = int(length(surfaceIntersection.xyz) - 0.5);\n bool currShapeIsPositive = intersectionType < 2;\n bool enter = intMod(intersectionType, 2) == 0;\n\n ix.surroundCount += enter ? +1 : -1;\n ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive;\n\n // entering positive or exiting negative\n if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) {\n shapeIntersection.entry = surfaceIntersection;\n }\n\n // exiting positive or entering negative after being inside positive\n bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0;\n bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive;\n if (exitPositive || enterNegativeFromPositive) {\n shapeIntersection.exit = surfaceIntersection;\n\n // entry and exit have been found, so the loop can stop\n if (exitPositive) {\n // After exiting positive shape there is nothing left to intersect, so jump to the end index.\n ix.index = passCount;\n }\n break;\n }\n }\n\n return shapeIntersection;\n}\n#endif\n\n// NOTE: initializeIntersections, nextIntersection aren't even declared unless INTERSECTION_COUNT > 1\n","// See Octree.glsl for the definitions of SampleData and intMod\n\n/* Megatexture defines (set in Scene/VoxelRenderResources.js)\n#define SAMPLE_COUNT ###\n#define NEAREST_SAMPLING\n#define PADDING\n*/\n\nuniform ivec2 u_megatextureSliceDimensions; // number of slices per tile, in two dimensions\nuniform ivec2 u_megatextureTileDimensions; // number of tiles per megatexture, in two dimensions\nuniform vec2 u_megatextureVoxelSizeUv;\nuniform vec2 u_megatextureSliceSizeUv;\nuniform vec2 u_megatextureTileSizeUv;\n\nuniform ivec3 u_dimensions; // does not include padding\n#if defined(PADDING)\n uniform ivec3 u_paddingBefore;\n uniform ivec3 u_paddingAfter;\n#endif\n\n// Integer min, max, clamp: For WebGL1 only\nint intMin(int a, int b) {\n return a <= b ? a : b;\n}\nint intMax(int a, int b) {\n return a >= b ? a : b;\n}\nint intClamp(int v, int minVal, int maxVal) {\n return intMin(intMax(v, minVal), maxVal);\n}\n\nvec2 index1DTo2DTexcoord(int index, ivec2 dimensions, vec2 uvScale)\n{\n int indexX = intMod(index, dimensions.x);\n int indexY = index / dimensions.x;\n return vec2(indexX, indexY) * uvScale;\n}\n\n/*\n How is 3D data stored in a 2D megatexture?\n\n In this example there is only one loaded tile and it has 2x2x2 voxels (8 voxels total).\n The data is sliced by Z. The data at Z = 0 is placed in texels (0,0), (0,1), (1,0), (1,1) and\n the data at Z = 1 is placed in texels (2,0), (2,1), (3,0), (3,1).\n Note that there could be empty space in the megatexture because it's a power of two.\n\n 0 1 2 3\n +---+---+---+---+\n | | | | | 3\n +---+---+---+---+\n | | | | | 2\n +-------+-------+\n |010|110|011|111| 1\n |--- ---|--- ---|\n |000|100|001|101| 0\n +-------+-------+\n\n When doing linear interpolation the megatexture needs to be sampled twice: once for\n the Z slice above the voxel coordinate and once for the slice below. The two slices\n are interpolated with fract(coord.z - 0.5). For example, a Z coordinate of 1.0 is\n halfway between two Z slices so the interpolation factor is 0.5. Below is a side view\n of the 3D voxel grid with voxel coordinates on the left side.\n\n 2 +---+\n |001|\n 1 +-z-+\n |000|\n 0 +---+\n\n When doing nearest neighbor the megatexture only needs to be sampled once at the closest Z slice.\n*/\n\nProperties getPropertiesFromMegatexture(in SampleData sampleData) {\n int tileIndex = sampleData.megatextureIndex;\n vec3 voxelCoord = sampleData.tileUv * vec3(u_dimensions);\n ivec3 voxelDimensions = u_dimensions;\n\n #if defined(PADDING)\n voxelDimensions += u_paddingBefore + u_paddingAfter;\n voxelCoord += vec3(u_paddingBefore);\n #endif\n\n #if defined(NEAREST_SAMPLING)\n // Round to the center of the nearest voxel\n voxelCoord = floor(voxelCoord) + vec3(0.5);\n #endif\n\n // Tile location\n vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv);\n\n // Slice location\n float slice = voxelCoord.z - 0.5;\n int sliceIndex = int(floor(slice));\n int sliceIndex0 = intClamp(sliceIndex, 0, voxelDimensions.z - 1);\n vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);\n\n // Voxel location\n vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(voxelDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv;\n\n // Final location in the megatexture\n vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset;\n\n #if defined(NEAREST_SAMPLING)\n return getPropertiesFromMegatextureAtUv(uv0);\n #else\n float sliceLerp = fract(slice);\n int sliceIndex1 = intMin(sliceIndex + 1, voxelDimensions.z - 1);\n vec2 sliceUvOffset1 = index1DTo2DTexcoord(sliceIndex1, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);\n vec2 uv1 = tileUvOffset + sliceUvOffset1 + voxelUvOffset;\n Properties properties0 = getPropertiesFromMegatextureAtUv(uv0);\n Properties properties1 = getPropertiesFromMegatextureAtUv(uv1);\n return mixProperties(properties0, properties1, sliceLerp);\n #endif\n}\n\n// Convert an array of sample datas to a final weighted properties.\nProperties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) {\n #if (SAMPLE_COUNT == 1)\n return getPropertiesFromMegatexture(sampleDatas[0]);\n #else\n // When more than one sample is taken the accumulator needs to start at 0\n Properties properties = clearProperties();\n for (int i = 0; i < SAMPLE_COUNT; ++i) {\n float weight = sampleDatas[i].weight;\n\n // Avoid reading the megatexture when the weight is 0 as it can be costly.\n if (weight > 0.0) {\n Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]);\n tempProperties = scaleProperties(tempProperties, weight);\n properties = sumProperties(properties, tempProperties);\n }\n }\n return properties;\n #endif\n}\n"]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,su.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,su.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,su.FRAGMENT),t.addFragmentLines(["// See IntersectionUtils.glsl for the definitions of Ray, Intersections, INF_HIT,\n// NO_HIT, setShapeIntersection\n\n/* Clipping plane defines (set in Scene/VoxelRenderResources.js)\n#define CLIPPING_PLANES_UNION\n#define CLIPPING_PLANES_COUNT\n#define CLIPPING_PLANES_INTERSECTION_INDEX\n*/\n\nuniform sampler2D u_clippingPlanesTexture;\nuniform mat4 u_clippingPlanesMatrix;\n\n// Plane is in Hessian Normal Form\nvec4 intersectPlane(in Ray ray, in vec4 plane) {\n vec3 n = plane.xyz; // normal\n float w = plane.w; // -dot(pointOnPlane, normal)\n\n float a = dot(ray.pos, n);\n float b = dot(ray.dir, n);\n float t = -(w + a) / b;\n\n return vec4(n, t);\n}\n\nvoid intersectClippingPlanes(in Ray ray, inout Intersections ix) {\n vec4 backSide = vec4(-ray.dir, -INF_HIT);\n vec4 farSide = vec4(ray.dir, +INF_HIT);\n RayShapeIntersection clippingVolume;\n\n #if (CLIPPING_PLANES_COUNT == 1)\n // Union and intersection are the same when there's one clipping plane, and the code\n // is more simplified.\n vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix);\n vec4 intersection = intersectPlane(ray, planeUv);\n bool reflects = dot(ray.dir, intersection.xyz) < 0.0;\n clippingVolume.entry = reflects ? backSide : intersection;\n clippingVolume.exit = reflects ? intersection : farSide;\n setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);\n #elif defined(CLIPPING_PLANES_UNION)\n vec4 firstTransmission = vec4(ray.dir, +INF_HIT);\n vec4 lastReflection = vec4(-ray.dir, -INF_HIT);\n for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {\n vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);\n vec4 intersection = intersectPlane(ray, planeUv);\n if (dot(ray.dir, planeUv.xyz) > 0.0) {\n firstTransmission = intersection.w <= firstTransmission.w ? intersection : firstTransmission;\n } else {\n lastReflection = intersection.w >= lastReflection.w ? intersection : lastReflection;\n }\n }\n clippingVolume.entry = backSide;\n clippingVolume.exit = lastReflection;\n setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, clippingVolume);\n clippingVolume.entry = firstTransmission;\n clippingVolume.exit = farSide;\n setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, clippingVolume);\n #else // intersection\n vec4 lastTransmission = vec4(ray.dir, -INF_HIT);\n vec4 firstReflection = vec4(-ray.dir, +INF_HIT);\n for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {\n vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);\n vec4 intersection = intersectPlane(ray, planeUv);\n if (dot(ray.dir, planeUv.xyz) > 0.0) {\n lastTransmission = intersection.w > lastTransmission.w ? intersection : lastTransmission;\n } else {\n firstReflection = intersection.w < firstReflection.w ? intersection: firstReflection;\n }\n }\n if (lastTransmission.w < firstReflection.w) {\n clippingVolume.entry = lastTransmission;\n clippingVolume.exit = firstReflection;\n } else {\n clippingVolume.entry = vec4(-ray.dir, NO_HIT);\n clippingVolume.exit = vec4(ray.dir, NO_HIT);\n }\n setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);\n #endif\n}\n"])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,su.FRAGMENT),t.addFragmentLines(["// See IntersectionUtils.glsl for the definitions of Ray, Intersections,\n// setIntersectionPair, INF_HIT, NO_HIT\n\n/* intersectDepth defines (set in Scene/VoxelRenderResources.js)\n#define DEPTH_INTERSECTION_INDEX ###\n*/\n\nuniform mat4 u_transformPositionViewToUv;\n\nvoid intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {\n float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));\n if (logDepthOrDepth != 0.0) {\n // Calculate how far the ray must travel before it hits the depth buffer.\n vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);\n eyeCoordinateDepth /= eyeCoordinateDepth.w;\n vec3 depthPositionUv = vec3(u_transformPositionViewToUv * eyeCoordinateDepth);\n float t = dot(depthPositionUv - ray.pos, ray.dir);\n setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(t, +INF_HIT));\n } else {\n // There's no depth at this location.\n setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT));\n }\n}\n"]));const a=e._provider.shape;"BOX"===a?t.addFragmentLines(["/* Box defines (set in Scene/VoxelBoxShape.js)\n#define BOX_HAS_SHAPE_BOUNDS\n*/\n\n#if defined(BOX_HAS_SHAPE_BOUNDS)\n uniform vec3 u_boxUvToShapeUvScale;\n uniform vec3 u_boxUvToShapeUvTranslate;\n#endif\n\nPointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {\n // For BOX, UV space = shape space, so we can use positionUv as-is,\n // and the Jacobian is the identity matrix, except that a step of 1\n // only spans half the shape space [-1, 1], so the identity is scaled.\n return PointJacobianT(positionUv, mat3(0.5));\n}\n\nvec3 convertShapeToShapeUvSpace(in vec3 positionShape) {\n#if defined(BOX_HAS_SHAPE_BOUNDS)\n return positionShape * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate;\n#else\n return positionShape;\n#endif\n}\n\nPointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {\n PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);\n pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);\n return pointJacobian;\n}\n\nvec3 convertShapeUvToUvSpace(in vec3 shapeUv) {\n#if defined(BOX_HAS_SHAPE_BOUNDS)\n return (shapeUv - u_boxUvToShapeUvTranslate) / u_boxUvToShapeUvScale;\n#else\n return shapeUv;\n#endif\n}\n\nvec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {\n#if defined(BOX_HAS_SHAPE_BOUNDS)\n return shapeUv / u_boxUvToShapeUvScale;\n#else\n return shapeUv;\n#endif\n}","// See IntersectionUtils.glsl for the definitions of Ray, RayShapeIntersection,\n// NO_HIT, Intersections\n\n/* Box defines (set in Scene/VoxelBoxShape.js)\n#define BOX_INTERSECTION_INDEX ### // always 0\n*/\n\nuniform vec3 u_renderMinBounds;\nuniform vec3 u_renderMaxBounds;\n\nRayShapeIntersection intersectBox(in Ray ray, in vec3 minBound, in vec3 maxBound)\n{\n // Consider the box as the intersection of the space between 3 pairs of parallel planes\n // Compute the distance along the ray to each plane\n vec3 t0 = (minBound - ray.pos) / ray.dir;\n vec3 t1 = (maxBound - ray.pos) / ray.dir;\n\n // Identify candidate entries/exits based on distance from ray.pos\n vec3 entries = min(t0, t1);\n vec3 exits = max(t0, t1);\n\n vec3 directions = sign(ray.dir);\n\n // The actual intersection points are the furthest entry and the closest exit\n float lastEntry = maxComponent(entries);\n bvec3 isLastEntry = equal(entries, vec3(lastEntry));\n vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;\n vec4 entry = vec4(entryNormal, lastEntry);\n\n float firstExit = minComponent(exits);\n bvec3 isFirstExit = equal(exits, vec3(firstExit));\n vec3 exitNormal = vec3(isLastEntry) * directions;\n vec4 exit = vec4(exitNormal, firstExit);\n\n if (entry.w > exit.w) {\n entry.w = NO_HIT;\n exit.w = NO_HIT;\n }\n\n return RayShapeIntersection(entry, exit);\n}\n\nvoid intersectShape(in Ray ray, inout Intersections ix)\n{\n RayShapeIntersection intersection = intersectBox(ray, u_renderMinBounds, u_renderMaxBounds);\n setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection);\n}\n",sme]):"CYLINDER"===a?t.addFragmentLines(["/* Cylinder defines (set in Scene/VoxelCylinderShape.js)\n#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS\n#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT\n#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE\n#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY\n#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY\n#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED\n*/\n\n#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)\n uniform vec2 u_cylinderUvToShapeUvRadius; // x = scale, y = offset\n#endif\n#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)\n uniform vec2 u_cylinderUvToShapeUvHeight; // x = scale, y = offset\n#endif\n#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)\n uniform vec2 u_cylinderUvToShapeUvAngle; // x = scale, y = offset\n#endif\n#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)\n uniform vec2 u_cylinderShapeUvAngleMinMax;\n#endif\n#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)\n uniform float u_cylinderShapeUvAngleRangeZeroMid;\n#endif\n\nPointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {\n // Convert from Cartesian UV space [0, 1] to Cartesian local space [-1, 1]\n vec3 position = positionUv * 2.0 - 1.0;\n\n float radius = length(position.xy); // [0, 1]\n vec3 radial = normalize(vec3(position.xy, 0.0));\n\n // Shape space height is defined within [0, 1]\n float height = positionUv.z; // [0, 1]\n vec3 z = vec3(0.0, 0.0, 1.0);\n\n float angle = atan(position.y, position.x);\n vec3 east = normalize(vec3(-position.y, position.x, 0.0));\n\n vec3 point = vec3(radius, height, angle);\n mat3 jacobianT = mat3(radial, z, east / length(position.xy));\n return PointJacobianT(point, jacobianT);\n}\n\nvec3 convertShapeToShapeUvSpace(in vec3 positionShape) {\n float radius = positionShape.x;\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)\n radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y;\n #endif\n\n float height = positionShape.y;\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)\n height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y;\n #endif\n\n float angle = (positionShape.z + czm_pi) / czm_twoPi;\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)\n // Comparing against u_cylinderShapeUvAngleMinMax has precision problems. u_cylinderShapeUvAngleRangeZeroMid is more conservative.\n angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid);\n #endif\n\n // Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY)\n angle = angle > u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.x : angle;\n #elif defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)\n angle = angle < u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.y : angle;\n #endif\n\n angle = angle * u_cylinderUvToShapeUvAngle.x + u_cylinderUvToShapeUvAngle.y;\n #endif\n\n return vec3(radius, height, angle);\n}\n\nPointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {\n PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);\n pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);\n return pointJacobian;\n}\n\nvec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {\n float radius = shapeUv.x;\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)\n radius /= u_cylinderUvToShapeUvRadius.x;\n #endif\n\n float height = shapeUv.y;\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)\n height /= u_cylinderUvToShapeUvHeight.x;\n #endif\n\n float angle = shapeUv.z * czm_twoPi;\n #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)\n angle /= u_cylinderUvToShapeUvAngle.x;\n #endif\n\n return vec3(radius, height, angle);\n}\n",rme,"// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, Intersections,\n// RayShapeIntersection, setSurfaceIntersection, setShapeIntersection,\n// intersectIntersections\n// See IntersectLongitude.glsl for the definitions of intersectHalfPlane,\n// intersectFlippedWedge, intersectRegularWedge\n\n/* Cylinder defines (set in Scene/VoxelCylinderShape.js)\n#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN\n#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT\n#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE\n#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF\n#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF\n#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO\n\n#define CYLINDER_INTERSECTION_INDEX_RADIUS_MAX\n#define CYLINDER_INTERSECTION_INDEX_RADIUS_MIN\n#define CYLINDER_INTERSECTION_INDEX_ANGLE\n*/\n\n// Cylinder uniforms\nuniform vec2 u_cylinderRenderRadiusMinMax;\nuniform vec2 u_cylinderRenderHeightMinMax;\n#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)\n uniform vec2 u_cylinderRenderAngleMinMax;\n#endif\n\n/**\n * Find the intersection of a ray with the volume defined by two planes of constant z\n */\nRayShapeIntersection intersectHeightBounds(in Ray ray, in vec2 minMaxHeight, in bool convex)\n{\n float zPosition = ray.pos.z;\n float zDirection = ray.dir.z;\n\n float tmin = (minMaxHeight.x - zPosition) / zDirection;\n float tmax = (minMaxHeight.y - zPosition) / zDirection;\n\n // Normals point outside the volume\n float signFlip = convex ? 1.0 : -1.0;\n vec4 intersectMin = vec4(0.0, 0.0, -1.0 * signFlip, tmin);\n vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax);\n\n bool topEntry = zDirection < 0.0;\n vec4 entry = topEntry ? intersectMax : intersectMin;\n vec4 exit = topEntry ? intersectMin : intersectMax;\n\n return RayShapeIntersection(entry, exit);\n}\n\n/**\n * Find the intersection of a ray with a right cylindrical surface of a given radius\n * about the z-axis.\n */\nRayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool convex)\n{\n vec2 position = ray.pos.xy;\n vec2 direction = ray.dir.xy;\n\n float a = dot(direction, direction);\n float b = dot(position, direction);\n float c = dot(position, position) - radius * radius;\n float determinant = b * b - a * c;\n\n if (determinant < 0.0) {\n vec4 miss = vec4(normalize(ray.dir), NO_HIT);\n return RayShapeIntersection(miss, miss);\n }\n\n determinant = sqrt(determinant);\n float t1 = (-b - determinant) / a;\n float t2 = (-b + determinant) / a;\n float signFlip = convex ? 1.0 : -1.0;\n vec4 intersect1 = vec4(normalize(position + t1 * direction) * signFlip, 0.0, t1);\n vec4 intersect2 = vec4(normalize(position + t2 * direction) * signFlip, 0.0, t2);\n\n return RayShapeIntersection(intersect1, intersect2);\n}\n\n/**\n * Find the intersection of a ray with a right cylindrical solid of given\n * radius and height bounds. NOTE: The shape is assumed to be convex.\n */\nRayShapeIntersection intersectBoundedCylinder(in Ray ray, in float radius, in vec2 minMaxHeight)\n{\n RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true);\n RayShapeIntersection heightBoundsIntersection = intersectHeightBounds(ray, minMaxHeight, true);\n return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection);\n}\n\nvoid intersectShape(Ray ray, inout Intersections ix)\n{\n // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].\n // Direction is scaled as well to be in sync with position.\n ray.pos = ray.pos * 2.0 - 1.0;\n ray.dir *= 2.0;\n\n RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax);\n\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);\n\n if (outerIntersect.entry.w == NO_HIT) {\n return;\n }\n\n #if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)\n // When the cylinder is perfectly thin it's necessary to sandwich the\n // inner cylinder intersection inside the outer cylinder intersection.\n\n // Without this special case,\n // [outerMin, outerMax, innerMin, innerMax] will bubble sort to\n // [outerMin, innerMin, outerMax, innerMax] which will cause the back\n // side of the cylinder to be invisible because it will think the ray\n // is still inside the inner (negative) cylinder after exiting the\n // outer (positive) cylinder.\n\n // With this special case,\n // [outerMin, innerMin, innerMax, outerMax] will bubble sort to\n // [outerMin, innerMin, innerMax, outerMax] which will work correctly.\n\n // Note: If initializeIntersections() changes its sorting function\n // from bubble sort to something else, this code may need to change.\n RayShapeIntersection innerIntersect = intersectCylinder(ray, 1.0, false);\n setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter\n setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter\n setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit\n setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit\n #elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN)\n RayShapeIntersection innerIntersect = intersectCylinder(ray, u_cylinderRenderRadiusMinMax.x, false);\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect);\n #endif\n\n #if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF)\n RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax);\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);\n #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF)\n RayShapeIntersection wedgeIntersects[2];\n intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax, wedgeIntersects);\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);\n #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)\n RayShapeIntersection wedgeIntersects[2];\n intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x, wedgeIntersects);\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);\n setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);\n #endif\n}\n",sme]):"ELLIPSOID"===a&&(t.addDefine("SHAPE_ELLIPSOID",void 0,su.FRAGMENT),t.addFragmentLines(["/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY\n#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE\n#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED\n#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE\n*/\n\nuniform vec3 u_ellipsoidRadiiUv; // [0,1]\nuniform vec2 u_evoluteScale; // (radiiUv.x ^ 2 - radiiUv.z ^ 2) * vec2(1.0, -1.0) / radiiUv;\nuniform vec3 u_ellipsoidInverseRadiiSquaredUv;\n#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) || defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)\n uniform vec3 u_ellipsoidShapeUvLongitudeMinMaxMid;\n#endif\n#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)\n uniform vec2 u_ellipsoidUvToShapeUvLongitude; // x = scale, y = offset\n#endif\n#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)\n uniform vec2 u_ellipsoidUvToShapeUvLatitude; // x = scale, y = offset\n#endif\nuniform float u_ellipsoidInverseHeightDifferenceUv;\n\n// robust iterative solution without trig functions\n// https://github.com/0xfaded/ellipse_demo/issues/1\n// https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse\n// Extended to return radius of curvature along with the point\nvec3 nearestPointAndRadiusOnEllipse(vec2 pos, vec2 radii) {\n vec2 p = abs(pos);\n vec2 inverseRadii = 1.0 / radii;\n\n // We describe the ellipse parametrically: v = radii * vec2(cos(t), sin(t))\n // but store the cos and sin of t in a vec2 for efficiency.\n // Initial guess: t = pi/4\n vec2 tTrigs = vec2(0.7071067811865476);\n // Initial guess of point on ellipsoid\n vec2 v = radii * tTrigs;\n // Center of curvature of the ellipse at v\n vec2 evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;\n\n const int iterations = 3;\n for (int i = 0; i < iterations; ++i) {\n // Find the (approximate) intersection of p - evolute with the ellipsoid.\n vec2 q = normalize(p - evolute) * length(v - evolute);\n // Update the estimate of t.\n tTrigs = (q + evolute) * inverseRadii;\n tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));\n v = radii * tTrigs;\n evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;\n }\n\n return vec3(v * sign(pos), length(v - evolute));\n}\n\nPointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {\n // Convert from UV space [0, 1] to local space [-1, 1]\n vec3 position = positionUv * 2.0 - 1.0;\n // Undo the scaling from ellipsoid to sphere\n position = position * u_ellipsoidRadiiUv;\n\n float longitude = atan(position.y, position.x);\n vec3 east = normalize(vec3(-position.y, position.x, 0.0));\n\n // Convert the 3D position to a 2D position relative to the ellipse (radii.x, radii.z)\n // (assume radii.y == radii.x) and find the nearest point on the ellipse and its normal\n float distanceFromZAxis = length(position.xy);\n vec2 posEllipse = vec2(distanceFromZAxis, position.z);\n vec3 surfacePointAndRadius = nearestPointAndRadiusOnEllipse(posEllipse, u_ellipsoidRadiiUv.xz);\n vec2 surfacePoint = surfacePointAndRadius.xy;\n\n vec2 normal2d = normalize(surfacePoint * u_ellipsoidInverseRadiiSquaredUv.xz);\n float latitude = atan(normal2d.y, normal2d.x);\n vec3 north = vec3(-normal2d.y * normalize(position.xy), abs(normal2d.x));\n\n float heightSign = length(posEllipse) < length(surfacePoint) ? -1.0 : 1.0;\n float height = heightSign * length(posEllipse - surfacePoint);\n vec3 up = normalize(cross(east, north));\n\n vec3 point = vec3(longitude, latitude, height);\n mat3 jacobianT = mat3(east / distanceFromZAxis, north / (surfacePointAndRadius.z + height), up);\n return PointJacobianT(point, jacobianT);\n}\n\nvec3 convertShapeToShapeUvSpace(in vec3 positionShape) {\n // Longitude: shift & scale to [0, 1]\n float longitude = (positionShape.x + czm_pi) / czm_twoPi;\n\n // Correct the angle when max < min\n // Technically this should compare against min longitude - but it has precision problems so compare against the middle of empty space.\n #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)\n longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z);\n #endif\n\n // Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.\n #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY)\n longitude = longitude > u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.x : longitude;\n #endif\n #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY)\n longitude = longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.y : longitude;\n #endif\n\n #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)\n longitude = longitude * u_ellipsoidUvToShapeUvLongitude.x + u_ellipsoidUvToShapeUvLongitude.y;\n #endif\n\n // Latitude: shift and scale to [0, 1]\n float latitude = (positionShape.y + czm_piOverTwo) / czm_pi;\n #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)\n latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y;\n #endif\n\n // Height: scale to the range [0, 1]\n float height = 1.0 + positionShape.z * u_ellipsoidInverseHeightDifferenceUv;\n\n return vec3(longitude, latitude, height);\n}\n\nPointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {\n PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);\n pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);\n return pointJacobian;\n}\n\nvec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {\n // Convert from [0, 1] to radians [-pi, pi]\n float longitude = shapeUv.x * czm_twoPi;\n #if defined (ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)\n longitude /= u_ellipsoidUvToShapeUvLongitude.x;\n #endif\n\n // Convert from [0, 1] to radians [-pi/2, pi/2]\n float latitude = shapeUv.y * czm_pi;\n #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)\n latitude /= u_ellipsoidUvToShapeUvLatitude.x;\n #endif\n \n float height = shapeUv.z / u_ellipsoidInverseHeightDifferenceUv;\n\n return vec3(longitude, latitude, height);\n}\n",rme,"// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT, Intersections,\n// RayShapeIntersection, setSurfaceIntersection, setShapeIntersection\n// See IntersectLongitude.glsl for the definitions of intersectHalfPlane,\n// intersectFlippedWedge, intersectRegularWedge\n\n/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF\n#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF\n#define ELLIPSOID_INTERSECTION_INDEX_LONGITUDE\n#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX\n#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN\n#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX\n#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN\n*/\n\n#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)\n uniform vec2 u_ellipsoidRenderLongitudeMinMax;\n#endif\nuniform float u_eccentricitySquared;\nuniform vec2 u_ellipsoidRenderLatitudeSinMinMax;\nuniform vec2 u_clipMinMaxHeight;\n\nRayShapeIntersection intersectZPlane(in Ray ray, in float z) {\n float t = -ray.pos.z / ray.dir.z;\n\n bool startsOutside = sign(ray.pos.z) == sign(z);\n bool entry = (t >= 0.0) != startsOutside;\n\n vec4 intersect = vec4(0.0, 0.0, z, t);\n vec4 farSide = vec4(normalize(ray.dir), INF_HIT);\n\n if (entry) {\n return RayShapeIntersection(intersect, farSide);\n } else {\n return RayShapeIntersection(-1.0 * farSide, intersect);\n }\n}\n\nRayShapeIntersection intersectHeight(in Ray ray, in float relativeHeight, in bool convex)\n{\n // Scale the ray by the ellipsoid axes to make it a unit sphere\n // Note: approximating ellipsoid + height as an ellipsoid\n vec3 radiiCorrection = u_ellipsoidRadiiUv / (u_ellipsoidRadiiUv + relativeHeight);\n vec3 position = ray.pos * radiiCorrection;\n vec3 direction = ray.dir * radiiCorrection;\n\n float a = dot(direction, direction); // ~ 1.0 (or maybe 4.0 if ray is scaled)\n float b = dot(direction, position); // roughly inside [-1.0, 1.0] when zoomed in\n float c = dot(position, position) - 1.0; // ~ 0.0 when zoomed in.\n float determinant = b * b - a * c; // ~ b * b when zoomed in\n\n if (determinant < 0.0) {\n vec4 miss = vec4(normalize(direction), NO_HIT);\n return RayShapeIntersection(miss, miss);\n }\n\n determinant = sqrt(determinant);\n\n // Compute larger root using standard formula\n float signB = b < 0.0 ? -1.0 : 1.0;\n // The other root may suffer from subtractive cancellation in the standard formula.\n // Compute it from the first root instead.\n float t1 = (-b - signB * determinant) / a;\n float t2 = c / (a * t1);\n float tmin = min(t1, t2);\n float tmax = max(t1, t2);\n\n float directionScale = convex ? 1.0 : -1.0;\n vec3 d1 = directionScale * normalize(position + tmin * direction);\n vec3 d2 = directionScale * normalize(position + tmax * direction);\n\n return RayShapeIntersection(vec4(d1, tmin), vec4(d2, tmax));\n}\n\n/**\n * Given a circular cone around the z-axis, with apex at the origin,\n * find the parametric distance(s) along a ray where that ray intersects\n * the cone.\n * The cone opening angle is described by the squared cosine of\n * its half-angle (the angle between the Z-axis and the surface)\n */\nvec2 intersectDoubleEndedCone(in Ray ray, in float cosSqrHalfAngle)\n{\n vec3 o = ray.pos;\n vec3 d = ray.dir;\n float sinSqrHalfAngle = 1.0 - cosSqrHalfAngle;\n\n float aSin = d.z * d.z * sinSqrHalfAngle;\n float aCos = -dot(d.xy, d.xy) * cosSqrHalfAngle;\n float a = aSin + aCos;\n\n float bSin = d.z * o.z * sinSqrHalfAngle;\n float bCos = -dot(o.xy, d.xy) * cosSqrHalfAngle;\n float b = bSin + bCos;\n\n float cSin = o.z * o.z * sinSqrHalfAngle;\n float cCos = -dot(o.xy, o.xy) * cosSqrHalfAngle;\n float c = cSin + cCos;\n // determinant = b * b - a * c. But bSin * bSin = aSin * cSin.\n // Avoid subtractive cancellation by expanding to eliminate these terms\n float determinant = 2.0 * bSin * bCos + bCos * bCos - aSin * cCos - aCos * cSin - aCos * cCos;\n\n if (determinant < 0.0) {\n return vec2(NO_HIT);\n } else if (a == 0.0) {\n // Ray is parallel to cone surface\n return (b == 0.0)\n ? vec2(NO_HIT) // Ray is on cone surface\n : vec2(-0.5 * c / b, NO_HIT);\n }\n\n determinant = sqrt(determinant);\n\n // Compute larger root using standard formula\n float signB = b < 0.0 ? -1.0 : 1.0;\n float t1 = (-b - signB * determinant) / a;\n // The other root may suffer from subtractive cancellation in the standard formula.\n // Compute it from the first root instead.\n float t2 = c / (a * t1);\n float tmin = min(t1, t2);\n float tmax = max(t1, t2);\n return vec2(tmin, tmax);\n}\n\n/**\n * Given a point on a conical surface, find the surface normal at that point.\n */\nvec3 getConeNormal(in vec3 p, in bool convex) {\n // Start with radial component pointing toward z-axis\n vec2 radial = -abs(p.z) * normalize(p.xy);\n // Z component points toward opening of cone\n float zSign = (p.z < 0.0) ? -1.0 : 1.0;\n float z = length(p.xy) * zSign;\n // Flip normal if shape is convex\n float flip = (convex) ? -1.0 : 1.0;\n return normalize(vec3(radial, z) * flip);\n}\n\n/**\n * Compute the shift between the ellipsoid origin and the apex of a cone of latitude\n */\nfloat getLatitudeConeShift(in float sinLatitude) {\n // Find prime vertical radius of curvature: \n // the distance along the ellipsoid normal to the intersection with the z-axis\n float x2 = u_eccentricitySquared * sinLatitude * sinLatitude;\n float primeVerticalRadius = inversesqrt(1.0 - x2);\n\n // Compute a shift from the origin to the intersection of the cone with the z-axis\n return primeVerticalRadius * u_eccentricitySquared * sinLatitude;\n}\n\nvoid intersectFlippedCone(in Ray ray, in float cosHalfAngle, out RayShapeIntersection intersections[2]) {\n // Undo the scaling from ellipsoid to sphere\n ray.pos = ray.pos * u_ellipsoidRadiiUv;\n ray.dir = ray.dir * u_ellipsoidRadiiUv;\n // Shift the ray to account for the latitude cone not being centered at the Earth center\n ray.pos.z += getLatitudeConeShift(cosHalfAngle);\n\n float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;\n vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);\n\n vec4 miss = vec4(normalize(ray.dir), NO_HIT);\n vec4 farSide = vec4(normalize(ray.dir), INF_HIT);\n\n // Initialize output with no intersections\n intersections[0].entry = -1.0 * farSide;\n intersections[0].exit = farSide;\n intersections[1].entry = miss;\n intersections[1].exit = miss;\n\n if (intersect.x == NO_HIT) {\n return;\n }\n\n // Find the points of intersection\n float tmin = intersect.x;\n float tmax = intersect.y;\n vec3 p0 = ray.pos + tmin * ray.dir;\n vec3 p1 = ray.pos + tmax * ray.dir;\n\n vec4 intersect0 = vec4(getConeNormal(p0, true), tmin);\n vec4 intersect1 = vec4(getConeNormal(p1, true), tmax);\n\n bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);\n bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);\n\n if (p0InShadowCone && p1InShadowCone) {\n // no valid intersections\n } else if (p0InShadowCone) {\n intersections[0].exit = intersect1;\n } else if (p1InShadowCone) {\n intersections[0].entry = intersect0;\n } else {\n intersections[0].exit = intersect0;\n intersections[1].entry = intersect1;\n intersections[1].exit = farSide;\n }\n}\n\nRayShapeIntersection intersectRegularCone(in Ray ray, in float cosHalfAngle, in bool convex) {\n // Undo the scaling from ellipsoid to sphere\n ray.pos = ray.pos * u_ellipsoidRadiiUv;\n ray.dir = ray.dir * u_ellipsoidRadiiUv;\n // Shift the ray to account for the latitude cone not being centered at the Earth center\n ray.pos.z += getLatitudeConeShift(cosHalfAngle);\n\n float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;\n vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);\n\n vec4 miss = vec4(normalize(ray.dir), NO_HIT);\n vec4 farSide = vec4(normalize(ray.dir), INF_HIT);\n\n if (intersect.x == NO_HIT) {\n return RayShapeIntersection(miss, miss);\n }\n\n // Find the points of intersection\n float tmin = intersect.x;\n float tmax = intersect.y;\n vec3 p0 = ray.pos + tmin * ray.dir;\n vec3 p1 = ray.pos + tmax * ray.dir;\n\n vec4 intersect0 = vec4(getConeNormal(p0, convex), tmin);\n vec4 intersect1 = vec4(getConeNormal(p1, convex), tmax);\n\n bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);\n bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);\n\n if (p0InShadowCone && p1InShadowCone) {\n return RayShapeIntersection(miss, miss);\n } else if (p0InShadowCone) {\n return RayShapeIntersection(intersect1, farSide);\n } else if (p1InShadowCone) {\n return RayShapeIntersection(-1.0 * farSide, intersect0);\n } else {\n return RayShapeIntersection(intersect0, intersect1);\n }\n}\n\nvoid intersectShape(in Ray ray, inout Intersections ix) {\n // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].\n // Direction is scaled as well to be in sync with position.\n ray.pos = ray.pos * 2.0 - 1.0;\n ray.dir *= 2.0;\n\n // Outer ellipsoid\n RayShapeIntersection outerIntersect = intersectHeight(ray, u_clipMinMaxHeight.y, true);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);\n\n // Exit early if the outer ellipsoid was missed.\n if (outerIntersect.entry.w == NO_HIT) {\n return;\n }\n\n // Inner ellipsoid\n RayShapeIntersection innerIntersect = intersectHeight(ray, u_clipMinMaxHeight.x, false);\n\n if (innerIntersect.entry.w == NO_HIT) {\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);\n } else {\n // When the ellipsoid is large and thin it's possible for floating point math\n // to cause the ray to intersect the inner ellipsoid before the outer ellipsoid. \n // To prevent this from happening, clamp innerIntersect to outerIntersect and\n // sandwich the inner ellipsoid intersection inside the outer ellipsoid intersection.\n\n // Without this special case,\n // [outerMin, outerMax, innerMin, innerMax] will bubble sort to\n // [outerMin, innerMin, outerMax, innerMax] which will cause the back\n // side of the ellipsoid to be invisible because it will think the ray\n // is still inside the inner (negative) ellipsoid after exiting the\n // outer (positive) ellipsoid.\n\n // With this special case,\n // [outerMin, innerMin, innerMax, outerMax] will bubble sort to\n // [outerMin, innerMin, innerMax, outerMax] which will work correctly.\n\n // Note: If initializeIntersections() changes its sorting function\n // from bubble sort to something else, this code may need to change.\n innerIntersect.entry.w = max(innerIntersect.entry.w, outerIntersect.entry.w);\n innerIntersect.exit.w = min(innerIntersect.exit.w, outerIntersect.exit.w);\n setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter\n setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter\n setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit\n setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit\n }\n\n // Bottom cone\n #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)\n RayShapeIntersection bottomConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, false);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);\n #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)\n RayShapeIntersection bottomConeIntersection = intersectZPlane(ray, -1.0);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);\n #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)\n RayShapeIntersection bottomConeIntersections[2];\n intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, bottomConeIntersections);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersections[0]);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersections[1]);\n #endif\n\n // Top cone\n #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)\n RayShapeIntersection topConeIntersections[2];\n intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, topConeIntersections);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersections[0]);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersections[1]);\n #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)\n RayShapeIntersection topConeIntersection = intersectZPlane(ray, 1.0);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);\n #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)\n RayShapeIntersection topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, false);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);\n #endif\n\n // Wedge\n #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)\n RayShapeIntersection wedgeIntersects[2];\n intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x, wedgeIntersects);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);\n #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)\n RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);\n #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)\n RayShapeIntersection wedgeIntersects[2];\n intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax, wedgeIntersects);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);\n setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);\n #endif\n}\n",sme])),t.addFragmentLines(["// See Intersection.glsl for the definition of intersectScene\n// See IntersectionUtils.glsl for the definition of nextIntersection\n// See convertUvToBox.glsl, convertUvToCylinder.glsl, or convertUvToEllipsoid.glsl\n// for the definition of convertUvToShapeUvSpace. The appropriate function is \n// selected based on the VoxelPrimitive shape type, and added to the shader in\n// Scene/VoxelRenderResources.js.\n// See Octree.glsl for the definitions of TraversalData, SampleData,\n// traverseOctreeFromBeginning, and traverseOctreeFromExisting\n// See Megatexture.glsl for the definition of accumulatePropertiesFromMegatexture\n\n#define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops\n#if defined(PICKING_VOXEL)\n #define ALPHA_ACCUM_MAX 0.1\n#else\n #define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0\n#endif\n\nuniform mat3 u_transformDirectionViewToLocal;\nuniform vec3 u_cameraPositionUv;\nuniform float u_stepSize;\n\n#if defined(PICKING)\n uniform vec4 u_pickColor;\n#endif\n\nvec3 getSampleSize(in int level) {\n vec3 sampleCount = exp2(float(level)) * vec3(u_dimensions);\n vec3 sampleSizeUv = 1.0 / sampleCount;\n return scaleShapeUvToShapeSpace(sampleSizeUv);\n}\n\n#define MINIMUM_STEP_SCALAR (0.02)\n#define SHIFT_FRACTION (0.001)\n\n/**\n * Given a coordinate within a tile, and sample spacings along a ray through\n * the coordinate, find the distance to the points where the ray entered and\n * exited the voxel cell, along with the surface normals at those points.\n * The surface normals are returned in shape space coordinates.\n */\nRayShapeIntersection getVoxelIntersection(in vec3 tileUv, in vec3 sampleSizeAlongRay) {\n vec3 voxelCoord = tileUv * vec3(u_dimensions);\n vec3 directions = sign(sampleSizeAlongRay);\n vec3 positiveDirections = max(directions, 0.0);\n vec3 entryCoord = mix(ceil(voxelCoord), floor(voxelCoord), positiveDirections);\n vec3 exitCoord = entryCoord + directions;\n\n vec3 distanceFromEntry = -abs((entryCoord - voxelCoord) * sampleSizeAlongRay);\n float lastEntry = maxComponent(distanceFromEntry);\n bvec3 isLastEntry = equal(distanceFromEntry, vec3(lastEntry));\n vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;\n vec4 entry = vec4(entryNormal, lastEntry);\n\n vec3 distanceToExit = abs((exitCoord - voxelCoord) * sampleSizeAlongRay);\n float firstExit = minComponent(distanceToExit);\n bvec3 isFirstExit = equal(distanceToExit, vec3(firstExit));\n vec3 exitNormal = vec3(isFirstExit) * directions;\n vec4 exit = vec4(exitNormal, firstExit);\n\n return RayShapeIntersection(entry, exit);\n}\n\nvec4 getStepSize(in SampleData sampleData, in Ray viewRay, in RayShapeIntersection shapeIntersection, in mat3 jacobianT, in float currentT) {\n // The Jacobian is computed in a space where the shape spans [-1, 1].\n // But the ray is marched in a space where the shape fills [0, 1].\n // So we need to scale the Jacobian by 2.\n vec3 gradient = 2.0 * viewRay.rawDir * jacobianT;\n vec3 sampleSizeAlongRay = getSampleSize(sampleData.tileCoords.w) / gradient;\n\n RayShapeIntersection voxelIntersection = getVoxelIntersection(sampleData.tileUv, sampleSizeAlongRay);\n\n // Transform normal from shape space to Cartesian space\n vec3 voxelNormal = normalize(jacobianT * voxelIntersection.entry.xyz);\n // Compare with the shape intersection, to choose the appropriate normal\n vec4 voxelEntry = vec4(voxelNormal, currentT + voxelIntersection.entry.w);\n vec4 entry = intersectionMax(shapeIntersection.entry, voxelEntry);\n\n float fixedStep = minComponent(abs(sampleSizeAlongRay)) * u_stepSize;\n float shift = fixedStep * SHIFT_FRACTION;\n float dt = voxelIntersection.exit.w + shift;\n if ((currentT + dt) > shapeIntersection.exit.w) {\n // Stop at end of shape\n dt = shapeIntersection.exit.w - currentT + shift;\n }\n float stepSize = clamp(dt, fixedStep * MINIMUM_STEP_SCALAR, fixedStep + shift);\n\n return vec4(entry.xyz, stepSize);\n}\n\nvec2 packIntToVec2(int value) {\n float shifted = float(value) / 255.0;\n float lowBits = fract(shifted);\n float highBits = floor(shifted) / 255.0;\n return vec2(highBits, lowBits);\n}\n\nvec2 packFloatToVec2(float value) {\n float lowBits = fract(value);\n float highBits = floor(value) / 255.0;\n return vec2(highBits, lowBits);\n}\n\nint getSampleIndex(in vec3 tileUv) {\n ivec3 voxelDimensions = u_dimensions;\n vec3 sampleCoordinate = tileUv * vec3(voxelDimensions);\n // tileUv = 1.0 is a valid coordinate but sampleIndex = voxelDimensions is not.\n // (tileUv = 1.0 corresponds to the last sample, at index = voxelDimensions - 1).\n // Clamp to [0, voxelDimensions - 0.5) to avoid numerical error before flooring\n vec3 maxCoordinate = vec3(voxelDimensions) - vec3(0.5);\n sampleCoordinate = clamp(sampleCoordinate, vec3(0.0), maxCoordinate);\n ivec3 sampleIndex = ivec3(floor(sampleCoordinate));\n #if defined(PADDING)\n voxelDimensions += u_paddingBefore + u_paddingAfter;\n sampleIndex += u_paddingBefore;\n #endif\n // Convert to a 1D index for lookup in a 1D data array\n return sampleIndex.x + voxelDimensions.x * (sampleIndex.y + voxelDimensions.y * sampleIndex.z);\n}\n\nvoid main()\n{\n vec4 fragCoord = gl_FragCoord;\n vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw; // [0,1]\n vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz);\n vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection); // normalize again just in case\n vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection); // normalize again just in case\n vec3 viewPosUv = u_cameraPositionUv;\n #if defined(SHAPE_ELLIPSOID)\n // viewDirUv has been scaled to a space where the ellipsoid is a sphere.\n // Undo this scaling to get the raw direction.\n vec3 rawDir = viewDirUv * u_ellipsoidRadiiUv;\n Ray viewRayUv = Ray(viewPosUv, viewDirUv, rawDir);\n #else\n Ray viewRayUv = Ray(viewPosUv, viewDirUv, viewDirUv);\n #endif\n\n Intersections ix;\n RayShapeIntersection shapeIntersection = intersectScene(screenCoord, viewRayUv, ix);\n\n // Exit early if the scene was completely missed.\n if (shapeIntersection.entry.w == NO_HIT) {\n discard;\n }\n\n float currentT = shapeIntersection.entry.w;\n float endT = shapeIntersection.exit.w;\n vec3 positionUv = viewPosUv + currentT * viewDirUv;\n PointJacobianT pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);\n\n // Traverse the tree from the start position\n TraversalData traversalData;\n SampleData sampleDatas[SAMPLE_COUNT];\n traverseOctreeFromBeginning(pointJacobian.point, traversalData, sampleDatas);\n vec4 step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);\n\n #if defined(JITTER)\n float noise = hash(screenCoord); // [0,1]\n currentT += noise * step.w;\n positionUv += noise * step.w * viewDirUv;\n #endif\n\n FragmentInput fragmentInput;\n #if defined(STATISTICS)\n setStatistics(fragmentInput.metadata.statistics);\n #endif\n\n vec4 colorAccum = vec4(0.0);\n\n for (int stepCount = 0; stepCount < STEP_COUNT_MAX; ++stepCount) {\n // Read properties from the megatexture based on the traversal state\n Properties properties = accumulatePropertiesFromMegatexture(sampleDatas);\n\n // Prepare the custom shader inputs\n copyPropertiesToMetadata(properties, fragmentInput.metadata);\n fragmentInput.voxel.positionUv = positionUv;\n fragmentInput.voxel.positionShapeUv = pointJacobian.point;\n fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv;\n fragmentInput.voxel.viewDirUv = viewDirUv;\n fragmentInput.voxel.viewDirWorld = viewDirWorld;\n fragmentInput.voxel.surfaceNormal = step.xyz;\n fragmentInput.voxel.travelDistance = step.w;\n fragmentInput.voxel.stepCount = stepCount;\n fragmentInput.voxel.tileIndex = sampleDatas[0].megatextureIndex;\n fragmentInput.voxel.sampleIndex = getSampleIndex(sampleDatas[0].tileUv);\n\n // Run the custom shader\n czm_modelMaterial materialOutput;\n fragmentMain(fragmentInput, materialOutput);\n\n // Sanitize the custom shader output\n vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha);\n color.rgb = max(color.rgb, vec3(0.0));\n color.a = clamp(color.a, 0.0, 1.0);\n\n // Pre-multiplied alpha blend\n colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a);\n\n // Stop traversing if the alpha has been fully saturated\n if (colorAccum.a > ALPHA_ACCUM_MAX) {\n colorAccum.a = ALPHA_ACCUM_MAX;\n break;\n }\n\n if (step.w == 0.0) {\n // Shape is infinitely thin. The ray may have hit the edge of a\n // foreground voxel. Step ahead slightly to check for more voxels\n step.w == 0.00001;\n }\n\n // Keep raymarching\n currentT += step.w;\n positionUv = viewPosUv + currentT * viewDirUv;\n\n // Check if there's more intersections.\n if (currentT > endT) {\n #if (INTERSECTION_COUNT == 1)\n break;\n #else\n shapeIntersection = nextIntersection(ix);\n if (shapeIntersection.entry.w == NO_HIT) {\n break;\n } else {\n // Found another intersection. Resume raymarching there\n currentT = shapeIntersection.entry.w;\n endT = shapeIntersection.exit.w;\n positionUv = viewPosUv + currentT * viewDirUv;\n }\n #endif\n }\n\n // Traverse the tree from the current ray position.\n // This is similar to traverseOctreeFromBeginning but is faster when the ray is in the same tile as the previous step.\n pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);\n traverseOctreeFromExisting(pointJacobian.point, traversalData, sampleDatas);\n step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);\n }\n\n // Convert the alpha from [0,ALPHA_ACCUM_MAX] to [0,1]\n colorAccum.a /= ALPHA_ACCUM_MAX;\n\n #if defined(PICKING)\n // If alpha is 0.0 there is nothing to pick\n if (colorAccum.a == 0.0) {\n discard;\n }\n out_FragColor = u_pickColor;\n #elif defined(PICKING_VOXEL)\n // If alpha is 0.0 there is nothing to pick\n if (colorAccum.a == 0.0) {\n discard;\n }\n vec2 megatextureId = packIntToVec2(sampleDatas[0].megatextureIndex);\n vec2 sampleIndex = packIntToVec2(getSampleIndex(sampleDatas[0].tileUv));\n out_FragColor = vec4(megatextureId, sampleIndex);\n #else\n out_FragColor = colorAccum;\n #endif\n}\n"]);const c=e._shape,l=c.shaderDefines;for(const h in l)if(l.hasOwnProperty(h)){let e=l[h];D(e)&&(e=!0===e?void 0:e,t.addDefine(h,e,su.FRAGMENT))}let u=c.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",u,su.FRAGMENT),1===s?u+=1:r.unionClippingRegions?u+=2:u+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",u,su.FRAGMENT),u+=1),t.addDefine("INTERSECTION_COUNT",u,su.FRAGMENT),H.equals(e.paddingBefore,H.ZERO)&&H.equals(e.paddingAfter,H.ZERO)||t.addDefine("PADDING",void 0,su.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,su.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,su.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,su.FRAGMENT);const d=e._traversal;t.addDefine("SAMPLE_COUNT",`${d._sampleCount}`,su.FRAGMENT)}function cme(e){return e===Vx.SCALAR?"float":e===Vx.VEC2?"vec2":e===Vx.VEC3?"vec3":e===Vx.VEC4?"vec4":void 0}function lme(e){return e===Vx.SCALAR?".r":e===Vx.VEC2?".ra":e===Vx.VEC3?".rgb":e===Vx.VEC4?"":void 0}function ume(e){return e===Vx.SCALAR?"vec3":e===Vx.VEC2?"mat2":e===Vx.VEC3?"mat3":e===Vx.VEC4?"mat4":void 0}function dme(e){let t=e.toString();return-1===t.indexOf(".")&&(t=`${e}.0`),t}function hme(e,t){return e===Vx.SCALAR?"":`[${t}]`}function pme(e,t){const n=new ame(e);!function(e,t){const{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,c=o.length,l=D(s)&&D(a);n.addDefine("METADATA_COUNT",c,su.FRAGMENT),l&&n.addDefine("STATISTICS",void 0,su.FRAGMENT);for(let T=0;T<c;T++){const e=i[T],t=o[T],r=`PropertyStatistics_${e}`,s=`PropertyStatistics_${e}`;n.addStruct(r,s,su.FRAGMENT);const a=cme(t);n.addStructField(r,a,"min"),n.addStructField(r,a,"max")}const u="Statistics",d="Statistics",h="statistics";n.addStruct(u,d,su.FRAGMENT);for(let T=0;T<c;T++){const e=i[T],t=`PropertyStatistics_${e}`,o=e;n.addStructField(u,t,o)}const p="Metadata",f="Metadata",m="metadata";n.addStruct(p,f,su.FRAGMENT),n.addStructField(p,d,h);for(let T=0;T<c;T++){const e=i[T],t=cme(o[T]);n.addStructField(p,t,e)}for(let T=0;T<c;T++){const e=i[T],t=ume(o[T]),r=`VoxelProperty_${e}`,s=`VoxelProperty_${e}`;n.addStruct(r,s,su.FRAGMENT),n.addStructField(r,t,"partialDerivativeLocal"),n.addStructField(r,t,"partialDerivativeWorld"),n.addStructField(r,t,"partialDerivativeView"),n.addStructField(r,t,"partialDerivativeValid")}const _="Voxel",g="Voxel";n.addStruct(_,g,su.FRAGMENT);for(let T=0;T<c;T++){const e=i[T],t=`VoxelProperty_${e}`;n.addStructField(_,t,e)}n.addStructField(_,"vec3","positionEC"),n.addStructField(_,"vec3","positionUv"),n.addStructField(_,"vec3","positionShapeUv"),n.addStructField(_,"vec3","positionUvLocal"),n.addStructField(_,"vec3","viewDirUv"),n.addStructField(_,"vec3","viewDirWorld"),n.addStructField(_,"vec3","surfaceNormal"),n.addStructField(_,"float","travelDistance"),n.addStructField(_,"int","stepCount"),n.addStructField(_,"int","tileIndex"),n.addStructField(_,"int","sampleIndex");const y="FragmentInput";n.addStruct(y,"FragmentInput",su.FRAGMENT),n.addStructField(y,f,m),n.addStructField(y,g,"voxel");const b="Properties",v="Properties",A="properties";n.addStruct(b,v,su.FRAGMENT);for(let T=0;T<c;T++){const e=i[T],t=cme(o[T]);n.addStructField(b,t,e)}{const e="clearProperties";n.addFunction(e,`${v} clearProperties()`,su.FRAGMENT),n.addFunctionLines(e,[`${v} ${A};`]);for(let t=0;t<c;t++){const s=i[t],a=o[t];r[t];const c=cme(a);n.addFunctionLines(e,[`${A}.${s} = ${c}(0.0);`])}n.addFunctionLines(e,[`return ${A};`])}{const e="sumProperties";n.addFunction(e,`${v} sumProperties(${v} propertiesA, ${v} propertiesB)`,su.FRAGMENT),n.addFunctionLines(e,[`${v} ${A};`]);for(let t=0;t<c;t++){const o=i[t];n.addFunctionLines(e,[`${A}.${o} = propertiesA.${o} + propertiesB.${o};`])}n.addFunctionLines(e,[`return ${A};`])}{const e="scaleProperties";n.addFunction(e,`${v} scaleProperties(${v} ${A}, float scale)`,su.FRAGMENT),n.addFunctionLines(e,[`${v} scaledProperties = ${A};`]);for(let t=0;t<c;t++){const o=i[t];n.addFunctionLines(e,[`scaledProperties.${o} *= scale;`])}n.addFunctionLines(e,["return scaledProperties;"])}{const e="mixProperties";n.addFunction(e,`${v} mixProperties(${v} propertiesA, ${v} propertiesB, float mixFactor)`,su.FRAGMENT),n.addFunctionLines(e,[`${v} ${A};`]);for(let t=0;t<c;t++){const o=i[t];n.addFunctionLines(e,[`${A}.${o} = mix(propertiesA.${o}, propertiesB.${o}, mixFactor);`])}n.addFunctionLines(e,[`return ${A};`])}{const e="copyPropertiesToMetadata";n.addFunction(e,`void copyPropertiesToMetadata(in ${v} ${A}, inout ${f} ${m})`,su.FRAGMENT);for(let t=0;t<c;t++){const o=i[t];n.addFunctionLines(e,[`${m}.${o} = ${A}.${o};`])}}if(l){const e="setStatistics";n.addFunction(e,`void setStatistics(inout ${d} ${h})`,su.FRAGMENT);for(let t=0;t<c;t++){const r=i[t],c=o[t],l=Vx.getComponentCount(c);for(let i=0;i<l;i++){const o=hme(c,i),l=s[t][i],u=a[t][i];n.addFunctionLines(e,[`${h}.${r}.min${o} = ${dme(l)};`,`${h}.${r}.max${o} = ${dme(u)};`])}}}{const e="getPropertiesFromMegatextureAtUv";n.addFunction(e,`${v} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,su.FRAGMENT),n.addFunctionLines(e,[`${v} ${A};`]);for(let t=0;t<c;t++){const s=i[t],a=o[t];r[t];const c=lme(a);n.addFunctionLines(e,[`properties.${s} = texture(u_megatextureTextures[${t}], texcoord)${c};`])}n.addFunctionLines(e,[`return ${A};`])}}(n,e);const{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){const e="getClippingPlane",n=L9(o,t),r=0,s=n.indexOf(")")+1,a=n.indexOf("{",s)+1,c=n.indexOf("}",a),l=n.slice(r,s),u=n.slice(a,c);i.addFunction(e,l,su.FRAGMENT),i.addFunctionLines(e,[u])}const s=i.clone();s.addDefine("PICKING",void 0,su.FRAGMENT);const a=i.clone();a.addDefine("PICKING_VOXEL",void 0,su.FRAGMENT);const c=i.buildShaderProgram(t),l=s.buildShaderProgram(t),u=a.buildShaderProgram(t),d=_s.fromCache({cull:{enabled:!0,face:ph.BACK},depthTest:{enabled:!1},depthMask:!1,blending:dh.PRE_MULTIPLIED_ALPHA_BLEND}),h=t.getViewportQuadVertexArray(),p=e._depthTest,f=new Kr({vertexArray:h,primitiveType:Vr.TRIANGLES,renderState:d,shaderProgram:c,uniformMap:n.uniformMap,modelMatrix:e._compoundModelMatrix,pass:zt.VOXELS,executeInClosestFrustum:!0,owner:this,cull:p,occlude:p}),m=Kr.shallowClone(f,new Kr);m.shaderProgram=l,m.pickOnly=!0;const _=Kr.shallowClone(f,new Kr);if(_.shaderProgram=u,_.pickOnly=!0,D(e._drawCommand)){const t=e._drawCommand;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}if(D(e._drawCommandPick)){const t=e._drawCommandPick;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}if(D(e._drawCommandPickVoxel)){const t=e._drawCommandPickVoxel;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}e._drawCommand=f,e._drawCommandPick=m,e._drawCommandPickVoxel=_}function fme(){this.orientedBoundingBox=new zp,this.boundingSphere=new $u,this.boundTransform=new ve,this.shapeTransform=new ve,this._minBounds=H.clone(fme.DefaultMinBounds,new H),this._maxBounds=H.clone(fme.DefaultMaxBounds,new H),this.shaderUniforms={renderMinBounds:new H,renderMaxBounds:new H,boxUvToShapeUvScale:new H,boxUvToShapeUvTranslate:new H},this.shaderDefines={BOX_INTERSECTION_INDEX:void 0,BOX_HAS_SHAPE_BOUNDS:void 0},this.shaderMaximumIntersectionsLength=0}const mme=new H,_me=new H,gme=new re,yme=new H,bme=new H,vme=new H,Ame=new H,Tme=ve.fromRotationTranslation(re.fromUniformScale(.5,new re),new H(.5,.5,.5),new ve);fme.prototype.update=function(e,t,n,i,o){i=M(i,fme.DefaultMinBounds),o=M(o,fme.DefaultMaxBounds),L.typeOf.object("modelMatrix",e),L.typeOf.object("minBounds",t),L.typeOf.object("maxBounds",n);const r=fme.DefaultMinBounds,s=fme.DefaultMaxBounds;t=this._minBounds=H.clamp(t,r,s,this._minBounds),n=this._maxBounds=H.clamp(n,r,s,this._maxBounds),i=H.clamp(i,r,s,yme),o=H.clamp(o,r,s,bme);const a=H.clamp(t,i,o,vme),c=H.clamp(n,i,o,Ame),l=ve.getScale(e,_me);if(a.x>c.x||a.y>c.y||a.z>c.z||(a.x===c.x)+(a.y===c.y)+(a.z===c.z)>=2||i.x>o.x||i.y>o.y||i.z>o.z||0===l.x||0===l.y||0===l.z)return!1;this.shapeTransform=ve.clone(e,this.shapeTransform),this.orientedBoundingBox=Sme(a,c,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=ve.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=$u.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const{shaderUniforms:u,shaderDefines:d}=this;for(const f in d)d.hasOwnProperty(f)&&(d[f]=void 0);const h=!H.equals(t,r)||!H.equals(n,s);let p=0;if(d.BOX_INTERSECTION_INDEX=p,p+=1,u.renderMinBounds=ve.multiplyByPoint(Tme,a,u.renderMinBounds),u.renderMaxBounds=ve.multiplyByPoint(Tme,c,u.renderMaxBounds),h){d.BOX_HAS_SHAPE_BOUNDS=!0;const e=t,i=n;u.boxUvToShapeUvScale=H.fromElements(2/(e.x===i.x?1:i.x-e.x),2/(e.y===i.y?1:i.y-e.y),2/(e.z===i.z?1:i.z-e.z),u.boxUvToShapeUvScale),u.boxUvToShapeUvTranslate=H.fromElements(-u.boxUvToShapeUvScale.x*(.5*e.x+.5),-u.boxUvToShapeUvScale.y*(.5*e.y+.5),-u.boxUvToShapeUvScale.z*(.5*e.z+.5),u.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=p,!0};const wme=new H,Eme=new H;fme.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){L.typeOf.number("tileLevel",e),L.typeOf.number("tileX",t),L.typeOf.number("tileY",n),L.typeOf.number("tileZ",i),L.typeOf.object("result",o);const r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e);return Sme(H.fromElements(V.lerp(r.x,s.x,a*t),V.lerp(r.y,s.y,a*n),V.lerp(r.z,s.z,a*i),wme),H.fromElements(V.lerp(r.x,s.x,a*(t+1)),V.lerp(r.y,s.y,a*(n+1)),V.lerp(r.z,s.z,a*(i+1)),Eme),this.shapeTransform,o)};const xme=new H;function Sme(e,t,n,i){const o=fme.DefaultMinBounds,r=fme.DefaultMaxBounds;if(H.equals(e,o)&&H.equals(t,r))i.center=ve.getTranslation(n,i.center),i.halfAxes=ve.getMatrix3(n,i.halfAxes);else{let o=ve.getScale(n,_me);const r=H.midpoint(e,t,mme);i.center=ve.multiplyByPoint(n,r,i.center),o=H.fromElements(.5*o.x*(t.x-e.x),.5*o.y*(t.y-e.y),.5*o.z*(t.z-e.z),_me);const s=ve.getRotation(n,gme);i.halfAxes=re.setScale(s,o,i.halfAxes)}return i}function Cme(){this.orientedBoundingBox=new zp,this.boundingSphere=new $u,this.boundTransform=new ve,this.shapeTransform=new ve,this._minimumRadius=Cme.DefaultMinBounds.x,this._maximumRadius=Cme.DefaultMaxBounds.x,this._minimumHeight=Cme.DefaultMinBounds.y,this._maximumHeight=Cme.DefaultMaxBounds.y,this._minimumAngle=Cme.DefaultMinBounds.z,this._maximumAngle=Cme.DefaultMaxBounds.z,this.shaderUniforms={cylinderRenderHeightMinMax:new kt,cylinderRenderRadiusMinMax:new kt,cylinderRenderAngleMinMax:new kt,cylinderUvToShapeUvRadius:new kt,cylinderUvToShapeUvHeight:new kt,cylinderUvToShapeUvAngle:new kt,cylinderShapeUvAngleMinMax:new kt,cylinderShapeUvAngleRangeZeroMid:0},this.shaderDefines={CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MAX:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MIN:void 0,CYLINDER_INTERSECTION_INDEX_ANGLE:void 0},this.shaderMaximumIntersectionsLength=0}fme.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){L.typeOf.object("spatialNode",e),L.typeOf.object("tileDimensions",t),L.typeOf.object("tileUv",n),L.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=H.divideComponents(H.ONE,t,xme),s=H.multiplyByScalar(r,o,xme),a=H.multiplyByScalar(H.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,wme),o,wme),c=H.add(a,s,Eme),l=this._minBounds,u=this._maxBounds;return Sme(H.fromElements(V.lerp(l.x,u.x,a.x),V.lerp(l.y,u.y,a.y),V.lerp(l.z,u.z,a.z),wme),H.fromElements(V.lerp(l.x,u.x,c.x),V.lerp(l.y,u.y,c.y),V.lerp(l.z,u.z,c.z),Eme),this.shapeTransform,i)},fme.DefaultMinBounds=Object.freeze(new H(-1,-1,-1)),fme.DefaultMaxBounds=Object.freeze(new H(1,1,1));const Ime=new H;Cme.prototype.update=function(e,t,n,i,o){i=M(i,Cme.DefaultMinBounds),o=M(o,Cme.DefaultMaxBounds),L.typeOf.object("modelMatrix",e),L.typeOf.object("minBounds",t),L.typeOf.object("maxBounds",n);const r=Cme.DefaultMinBounds.x,s=Cme.DefaultMaxBounds.x,a=Cme.DefaultMinBounds.y,c=Cme.DefaultMaxBounds.y,l=Cme.DefaultMinBounds.z,u=Cme.DefaultMaxBounds.z,d=u-l,h=.5*d,p=V.EPSILON10,f=V.EPSILON3,m=V.EPSILON10,_=V.clamp(t.x,r,s),g=V.clamp(n.x,r,s),y=V.clamp(i.x,r,s),b=V.clamp(o.x,r,s),v=Math.max(_,y),A=Math.min(g,b),T=V.clamp(t.y,a,c),w=V.clamp(n.y,a,c),E=V.clamp(i.y,a,c),x=V.clamp(o.y,a,c),S=Math.max(T,E),C=Math.min(w,x),I=V.negativePiToPi(t.z),O=V.negativePiToPi(n.z),D=V.negativePiToPi(i.z),P=V.negativePiToPi(o.z),N=Math.max(I,D),R=Math.min(O,P),F=ve.getScale(e,Ime);if(0===A||v>A||S>C||V.equalsEpsilon(F.x,0,void 0,p)||V.equalsEpsilon(F.y,0,void 0,p)||V.equalsEpsilon(F.z,0,void 0,p))return!1;this._minimumRadius=_,this._maximumRadius=g,this._minimumHeight=T,this._maximumHeight=w,this._minimumAngle=I,this._maximumAngle=O,this.shapeTransform=ve.clone(e,this.shapeTransform),this.orientedBoundingBox=jme(v,A,S,C,N,R,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=ve.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=$u.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const B=_===r&&g===s,z=T===a&&w===c,U=O<I,k=O-I+U*d,H=k>h+m&&k<d-m||k<h-m||k>=h-m&&k<=h+m,G=V.equalsEpsilon(I,l,void 0,f),j=V.equalsEpsilon(O,u,void 0,f),W=v===r,q=R-N+(R<N)*d,Y=q>=h-m&&q<d-m,X=q>m&&q<h-m,Q=q<=m,$=Y||X||Q,{shaderUniforms:K,shaderDefines:Z}=this;for(const L in Z)Z.hasOwnProperty(L)&&(Z[L]=void 0);let J=0;if(Z.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=J,J+=1,W||(Z.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,Z.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=J,J+=1),K.cylinderRenderRadiusMinMax=kt.fromElements(v,A,K.cylinderRenderRadiusMinMax),v===A&&(Z.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),!B){Z.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;const e=g-_;let t=0,n=1;0!==e&&(t=1/e,n=-_/e),K.cylinderUvToShapeUvRadius=kt.fromElements(t,n,K.cylinderUvToShapeUvRadius)}if(!z){Z.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;const e=w-T;let t=0,n=1;0!==e&&(t=2/e,n=-(T+1)/e),K.cylinderUvToShapeUvHeight=kt.fromElements(t,n,K.cylinderUvToShapeUvHeight)}if(K.cylinderRenderHeightMinMax=kt.fromElements(S,C,K.cylinderRenderHeightMinMax),U&&(Z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),$&&(Z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,Z.CYLINDER_INTERSECTION_INDEX_ANGLE=J,Y?(Z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,J+=1):X?(Z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,J+=2):Q&&(Z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,J+=2),K.cylinderRenderAngleMinMax=kt.fromElements(N,R,K.cylinderRenderAngleMinMax)),H){Z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,G&&(Z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),j&&(Z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);const e=(I-l)/d,t=(O-l)/d,n=1-k/d;if(K.cylinderShapeUvAngleMinMax=kt.fromElements(e,t,K.cylinderShapeUvAngleMinMax),K.cylinderShapeUvAngleRangeZeroMid=(t+.5*n)%1,k<=m)K.cylinderUvToShapeUvAngle=kt.fromElements(0,1,K.cylinderUvToShapeUvAngle);else{const e=d/k,t=-(I-l)/k;K.cylinderUvToShapeUvAngle=kt.fromElements(e,t,K.cylinderUvToShapeUvAngle)}}return this.shaderMaximumIntersectionsLength=J,!0},Cme.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){L.typeOf.number("tileLevel",e),L.typeOf.number("tileX",t),L.typeOf.number("tileY",n),L.typeOf.number("tileZ",i),L.typeOf.object("result",o);const r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,c=this._maximumHeight,l=this._minimumAngle,u=this._maximumAngle,d=1/Math.pow(2,e);return jme(V.lerp(r,s,t*d),V.lerp(r,s,(t+1)*d),V.lerp(a,c,n*d),V.lerp(a,c,(n+1)*d),V.lerp(l,u,i*d),V.lerp(l,u,(i+1)*d),this.shapeTransform,o)};const Ome=new H,Dme=new H,Pme=new H;Cme.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){L.typeOf.object("spatialNode",e),L.typeOf.object("tileDimensions",t),L.typeOf.object("tileUv",n),L.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=H.divideComponents(H.ONE,t,Ome),s=H.multiplyByScalar(r,o,Ome),a=H.multiplyByScalar(H.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,Dme),o,Dme),c=H.add(a,s,Pme),l=this._minimumRadius,u=this._maximumRadius,d=this._minimumHeight,h=this._maximumHeight,p=this._minimumAngle,f=this._maximumAngle;return jme(V.lerp(l,u,a.x),V.lerp(l,u,c.x),V.lerp(d,h,a.y),V.lerp(d,h,c.y),V.lerp(p,f,a.z),V.lerp(p,f,c.z),this.shapeTransform,i)},Cme.DefaultMinBounds=Object.freeze(new H(0,-1,-V.PI)),Cme.DefaultMaxBounds=Object.freeze(new H(1,1,+V.PI));const Nme=new Array(5),Rme=new H,Lme=new re,Mme=new ve,Fme=new ve,Bme=new ve,zme=new ve,Ume=new H,kme=new H,Vme=new H,Hme=new Array(8);for(let ko=0;ko<8;ko++)Hme[ko]=new H;function Gme(e,t,n){return Math.abs(K.dot(e,t))<n}function jme(e,t,n,i,o,r,s,a){const c=Cme.DefaultMinBounds,l=Cme.DefaultMaxBounds,u=c.x,d=l.x,h=c.y,p=l.y,f=c.z,m=l.z;if(e===u&&t===d&&n===h&&i===p&&o===f&&r===m)return a.center=ve.getTranslation(s,a.center),a.halfAxes=ve.getMatrix3(s,a.halfAxes),a;r<o&&(r+=V.TWO_PI);const _=r-o,g=o+.5*_,y=Nme;let b=0;y[b++]=o,y[b++]=r,y[b++]=g,_>V.PI&&(y[b++]=g-V.PI_OVER_TWO,y[b++]=g+V.PI_OVER_TWO);let v=1,A=1,T=-1,w=-1;for(let z=0;z<b;++z){const n=y[z]-g,i=Math.cos(n),o=Math.sin(n),r=i*e,s=o*e,a=i*t,c=o*t;v=Math.min(v,r),A=Math.min(A,s),v=Math.min(v,a),A=Math.min(A,c),T=Math.max(T,r),w=Math.max(w,s),T=Math.max(T,a),w=Math.max(w,c)}const E=T-v,x=w-A,S=i-n,C=.5*(v+T),I=.5*(A+w),O=.5*(n+i),D=H.fromElements(C,I,O,Rme),P=re.fromRotationZ(g,Lme),N=H.fromElements(E,x,S,Ime),R=ve.fromScale(N,Bme),L=ve.fromRotation(P,Fme),M=ve.fromTranslation(D,Mme),F=ve.multiplyTransformation(L,ve.multiplyTransformation(M,R,zme),zme),B=ve.multiplyTransformation(s,F,zme);return function(e){const t=ve.getColumn(e,0,Ume),n=ve.getColumn(e,1,kme),i=ve.getColumn(e,2,Vme),o=V.EPSILON4;return Gme(t,n,o)&&Gme(n,i,o)}(B)?zp.fromTransformation(B,a):function(e,t){const n=Hme;H.fromElements(-.5,-.5,-.5,n[0]),H.fromElements(-.5,-.5,.5,n[1]),H.fromElements(-.5,.5,-.5,n[2]),H.fromElements(-.5,.5,.5,n[3]),H.fromElements(.5,-.5,-.5,n[4]),H.fromElements(.5,-.5,.5,n[5]),H.fromElements(.5,.5,-.5,n[6]),H.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)ve.multiplyByPoint(e,n[i],n[i]);return zp.fromPoints(n,t)}(B,a)}function Wme(){this.orientedBoundingBox=new zp,this.boundingSphere=new $u,this.boundTransform=new ve,this.shapeTransform=new ve,this._rectangle=new Ir,this._minimumHeight=Wme.DefaultMinBounds.z,this._maximumHeight=Wme.DefaultMaxBounds.z,this._ellipsoid=new on,this._translation=new H,this._rotation=new re,this.shaderUniforms={ellipsoidRadiiUv:new H,eccentricitySquared:0,evoluteScale:new kt,ellipsoidInverseRadiiSquaredUv:new H,ellipsoidRenderLongitudeMinMax:new kt,ellipsoidShapeUvLongitudeMinMaxMid:new H,ellipsoidUvToShapeUvLongitude:new kt,ellipsoidUvToShapeUvLatitude:new kt,ellipsoidRenderLatitudeSinMinMax:new kt,ellipsoidInverseHeightDifferenceUv:0,clipMinMaxHeight:new kt},this.shaderDefines={ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LONGITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN:void 0},this.shaderMaximumIntersectionsLength=0}const qme=new H,Yme=new H,Xme=new H,Qme=new H,$me=new H,Kme=new H,Zme=new H,Jme=new H,e_e=new re,t_e=new H,n_e=new H,i_e=new Ir;Wme.prototype.update=function(e,t,n,i,o){const{DefaultMinBounds:r,DefaultMaxBounds:s}=Wme;i=M(i,r),o=M(o,s),L.typeOf.object("modelMatrix",e),L.typeOf.object("minBounds",t),L.typeOf.object("maxBounds",n);const a=V.EPSILON10,c=V.EPSILON3,l=V.EPSILON10,u=V.EPSILON10,d=V.EPSILON3,h=ve.getScale(e,Jme),p=H.clone(r,qme);p.z=-H.minimumComponent(h);const f=H.clamp(t,p,s,Yme),m=H.clamp(n,p,s,Xme),_=H.clamp(i,p,s,Qme),g=H.clamp(o,p,s,$me),y=H.maximumByComponent(f,_,Kme),b=H.minimumByComponent(m,g,Zme),v=H.add(h,H.fromElements(m.z,m.z,m.z,t_e),t_e),A=H.maximumComponent(v),T=H.add(h,H.fromElements(b.z,b.z,b.z,n_e),n_e);if(y.y>b.y||y.y===s.y||b.y===r.y||y.z>b.z||V.equalsEpsilon(T,H.ZERO,void 0,a))return!1;this._rectangle=Ir.fromRadians(f.x,f.y,m.x,m.y),this._translation=ve.getTranslation(e,this._translation),this._rotation=ve.getRotation(e,this._rotation),this._ellipsoid=on.fromCartesian3(h,this._ellipsoid),this._minimumHeight=f.z,this._maximumHeight=m.z;const w=Ir.fromRadians(y.x,y.y,b.x,b.y,i_e);this.orientedBoundingBox=c_e(w,y.z,b.z,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=ve.fromRotationTranslation(re.setScale(this._rotation,v,e_e),this._translation,this.shapeTransform),this.boundTransform=ve.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=$u.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const E=s.x-r.x,x=.5*E,S=b.x<y.x,C=b.x-y.x+S*E,I=C<=l,O=C>=x-l&&C<E-l,D=C>l&&C<x-l,P=I||O||D,N=m.x<f.x,R=m.x-f.x+N*E,F=R>x+l&&R<E-l||R>=x-l&&R<=x+l||R<x-l,B=b.y<-d,z=b.y>=-d&&b.y<=+d,U=b.y>+d&&b.y<s.y-u,k=B||z||U,G=y.y>r.y+u&&y.y<-d,j=y.y>=-d&&y.y<=+d,W=y.y>+d,q=G||j||W,Y=k||q,X=m.y-f.y,Q=m.y<-d,$=m.y>=-d&&m.y<=+d,K=m.y>+d&&m.y<s.y-u,Z=Q||$||K,J=f.y>r.y+u&&f.y<-d,ee=f.y>=-d&&f.y<=+d,te=f.y>+d,ne=Z||(J||ee||te),{shaderUniforms:ie,shaderDefines:oe}=this;for(const L in oe)oe.hasOwnProperty(L)&&(oe[L]=void 0);ie.ellipsoidRadiiUv=H.divideByScalar(v,A,ie.ellipsoidRadiiUv);const{x:se,z:ae}=ie.ellipsoidRadiiUv,ce=ae/se;ie.eccentricitySquared=1-ce*ce,ie.evoluteScale=kt.fromElements((se*se-ae*ae)/se,(ae*ae-se*se)/ae,ie.evoluteScale),ie.ellipsoidInverseRadiiSquaredUv=H.divideComponents(H.ONE,H.multiplyComponents(ie.ellipsoidRadiiUv,ie.ellipsoidRadiiUv,ie.ellipsoidInverseRadiiSquaredUv),ie.ellipsoidInverseRadiiSquaredUv);let le=0;oe.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=le,le+=1,oe.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=le,le+=1,ie.clipMinMaxHeight=kt.fromElements((y.z-m.z)/A,(b.z-m.z)/A,ie.clipMinMaxHeight);const ue=(m.z-f.z)/A;if(ie.ellipsoidInverseHeightDifferenceUv=1/ue,f.z===m.z&&(ie.ellipsoidInverseHeightDifferenceUv=0),P&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,oe.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=le,O?(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,le+=1):D?(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,le+=2):I&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,le+=2),ie.ellipsoidRenderLongitudeMinMax=kt.fromElements(y.x,b.x,ie.ellipsoidRenderLongitudeMinMax)),F){oe.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0;if(m.x<f.x&&(oe.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0),R<=l)ie.ellipsoidUvToShapeUvLongitude=kt.fromElements(0,1,ie.ellipsoidUvToShapeUvLongitude);else{const e=E/R,t=-(f.x-r.x)/R;ie.ellipsoidUvToShapeUvLongitude=kt.fromElements(e,t,ie.ellipsoidUvToShapeUvLongitude)}}if(P){const e=V.equalsEpsilon(y.x,r.x,void 0,c),t=V.equalsEpsilon(b.x,s.x,void 0,c);e&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),t&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);const n=(f.x-r.x)/E,i=(m.x-r.x)/E,o=((b.x-r.x)/E+.5*(1-C/E))%1;ie.ellipsoidShapeUvLongitudeMinMaxMid=H.fromElements(n,i,o,ie.ellipsoidShapeUvLongitudeMinMaxMid)}if(Y&&(q&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,oe.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=le,G?(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,le+=1):j?(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,le+=1):W&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,le+=2)),k&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,oe.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=le,B?(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,le+=2):z?(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,le+=1):U&&(oe.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,le+=1)),ie.ellipsoidRenderLatitudeSinMinMax=kt.fromElements(Math.sin(y.y),Math.sin(b.y),ie.ellipsoidRenderLatitudeSinMinMax)),ne)if(oe.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,X<u)ie.ellipsoidUvToShapeUvLatitude=kt.fromElements(0,1,ie.ellipsoidUvToShapeUvLatitude);else{const e=(s.y-r.y)/X,t=(r.y-f.y)/X;ie.ellipsoidUvToShapeUvLatitude=kt.fromElements(e,t,ie.ellipsoidUvToShapeUvLatitude)}return this.shaderMaximumIntersectionsLength=le,!0};const o_e=new Ir;Wme.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){L.typeOf.number("tileLevel",e),L.typeOf.number("tileX",t),L.typeOf.number("tileY",n),L.typeOf.number("tileZ",i),L.typeOf.object("result",o);const r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,c=n*r,l=(n+1)*r,u=i*r,d=(i+1)*r;return c_e(Ir.subsection(this._rectangle,s,c,a,l,o_e),V.lerp(this._minimumHeight,this._maximumHeight,u),V.lerp(this._minimumHeight,this._maximumHeight,d),this._ellipsoid,this._translation,this._rotation,o)};const r_e=new H,s_e=new H,a_e=new H;function c_e(e,t,n,i,o,r,s){return(s=zp.fromRectangle(e,t,n,i,s)).center=H.add(s.center,o,s.center),s.halfAxes=re.multiply(s.halfAxes,r,s.halfAxes),s}Wme.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){L.typeOf.object("spatialNode",e),L.typeOf.object("tileDimensions",t),L.typeOf.object("tileUv",n),L.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=H.divideComponents(H.ONE,t,r_e),s=H.multiplyByScalar(r,o,r_e),a=H.multiplyByScalar(H.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,s_e),o,s_e),c=H.add(a,s,a_e);return c_e(Ir.subsection(this._rectangle,a.x,a.y,c.x,c.y,o_e),V.lerp(this._minimumHeight,this._maximumHeight,a.z),V.lerp(this._minimumHeight,this._maximumHeight,c.z),this._ellipsoid,this._translation,this._rotation,i)},Wme.DefaultMinBounds=Object.freeze(new H(-V.PI,-V.PI_OVER_TWO,-on.WGS84.minimumRadius)),Wme.DefaultMaxBounds=Object.freeze(new H(V.PI,V.PI_OVER_TWO,10*on.WGS84.maximumRadius));const l_e={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER",getMinBounds:function(e){switch(e){case l_e.BOX:return fme.DefaultMinBounds;case l_e.ELLIPSOID:return Wme.DefaultMinBounds;case l_e.CYLINDER:return Cme.DefaultMinBounds;default:throw new P(`Invalid shape type ${e}`)}},getMaxBounds:function(e){switch(e){case l_e.BOX:return fme.DefaultMaxBounds;case l_e.ELLIPSOID:return Wme.DefaultMaxBounds;case l_e.CYLINDER:return Cme.DefaultMaxBounds;default:throw new P(`Invalid shape type ${e}`)}},getShapeConstructor:function(e){switch(e){case l_e.BOX:return fme;case l_e.ELLIPSOID:return Wme;case l_e.CYLINDER:return Cme;default:throw new P(`Invalid shape type ${e}`)}}},u_e=Object.freeze(l_e);function d_e(e){L.typeOf.object("options",e),L.defined("options.comparator",e.comparator),D(e.maximumLength)&&L.typeOf.number.greaterThanOrEquals("options.maximumLength",e.maximumLength,0),this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=D(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}function h_e(e,t,n){const i=e._array,o=i[t];i[t]=i[n],i[n]=o}function p_e(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function f_e(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function m_e(e,t){if(0===t)return;const n=Math.floor(V.log2(t+1))%2==0,i=Math.floor((t-1)/2),o=p_e(e,t,i);for(o!==n&&(h_e(e,t,i),t=i);t>=3;){const n=Math.floor((t-3)/4);if(p_e(e,t,n)!==o)break;h_e(e,t,n),t=n}}function __e(e,t){const n=e._length,i=Math.floor(V.log2(t+1))%2==0;let o;for(;(o=2*t+1)<n;){let r=o;const s=o+1;if(s<n){p_e(e,s,r)===i&&(r=s);const t=2*o+1,a=Math.max(Math.min(n-t,4),0);for(let n=0;n<a;n++){const o=t+n;p_e(e,o,r)===i&&(r=o)}}if(p_e(e,r,t)===i&&(h_e(e,r,t),r!==o&&r!==s)){const t=Math.floor((r-1)/2);f_e(e,r,t)===i&&h_e(e,r,t)}t=r}}Object.defineProperties(d_e.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(D(e)){for(L.typeOf.number.greaterThanOrEquals("maximumLength",e,0);this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}}),d_e.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new d_e({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o},d_e.prototype.reset=function(){this._length=0;const e=this._maximumLength;if(D(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0},d_e.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)m_e(this,t)},d_e.prototype.insert=function(e){let t;const n=this._maximumLength;if(D(n)){if(0===n)return;if(this._length===n){const n=this._array[0];if(this._comparator(e,n)<=0)return e;t=this.removeMinimum()}}const i=this._length;return this._array[i]=e,this._length++,m_e(this,i),t},d_e.prototype.removeMinimum=function(){const e=this._length;if(0===e)return;this._length--;const t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],__e(this,0)),this._array[e-1]=void 0,t},d_e.prototype.removeMaximum=function(){const e=this._length;if(0===e)return;let t;if(this._length--,e<=2)t=this._array[e-1];else{const n=f_e(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&__e(this,n)}return this._array[e-1]=void 0,t},d_e.prototype.getMinimum=function(){if(0!==this._length)return this._array[0]},d_e.prototype.getMaximum=function(){const e=this._length;if(0!==e)return e<=2?this._array[e-1]:this._array[f_e(this,1,2)?1:2]};const g_e=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function y_e(e,t){this.spatialNode=e,this.keyframe=t,this.state=g_e.UNLOADED,this.metadata=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}function b_e(e,t,n,i,o){i===Ux.UNSIGNED_SHORT&&(i=Ux.FLOAT32);const r=e.floatingPointTexture;if(i===Ux.FLOAT32&&!r)throw new be("Floating point texture not supported");let s,a;i===Ux.FLOAT32||i===Ux.FLOAT64?s=ts.FLOAT:i===Ux.UINT8&&(s=ts.UNSIGNED_BYTE),1===n?a=e.webgl2?is.RED:is.LUMINANCE:2===n?a=e.webgl2?is.RG:is.LUMINANCE_ALPHA:3===n?a=is.RGB:4===n&&(a=is.RGBA);o=Math.min(M(o,134217728),536870912);const c=rs.maximumTextureSize,l=Ux.getSizeInBytes(i),u=Math.floor(o/(n*l)),d=Math.min(c,V.previousPowerOfTwo(Math.floor(Math.sqrt(u)))),h=Math.ceil(Math.sqrt(t.x)),p=Math.ceil(t.z/h),f=h*t.x,m=p*t.y,_=Math.floor(d/f),g=Math.floor(d/m);if(0===_||0===g)throw new be("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=H.clone(t,new H),this.maximumTileCount=_*g,this.regionCountPerMegatexture=new kt(_,g),this.voxelCountPerRegion=new kt(f,m),this.sliceCountPerRegion=new kt(h,p),this.voxelSizeUv=new kt(1/d,1/d),this.sliceSizeUv=new kt(t.x/d,t.y/d),this.regionSizeUv=new kt(f/d,m/d),this.texture=new Sc({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:d,height:d,sampler:new uc({wrapS:lc.CLAMP_TO_EDGE,wrapT:lc.CLAMP_TO_EDGE,minificationFilter:ac.LINEAR,magnificationFilter:rc.LINEAR})});const y=Ux.toComponentDatatype(i);this.tileVoxelDataTemp=Ca.createTypedArray(y,f*m*n),this.nodes=new Array(this.maximumTileCount);for(let b=0;b<this.maximumTileCount;b++)this.nodes[b]=new v_e(b);for(let b=0;b<this.maximumTileCount;b++){const e=this.nodes[b];e.previousNode=b>0?this.nodes[b-1]:void 0,e.nextNode=b<this.maximumTileCount-1?this.nodes[b+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function v_e(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}function A_e(e,t,n,i,o,r,s){this.children=void 0,this.parent=o,this.level=e,this.x=t,this.y=n,this.z=i,this.dimensions=H.clone(s),this.keyframeNodes=[],this.renderableKeyframeNodes=[],this.renderableKeyframeNodeLerp=0,this.renderableKeyframeNodePrevious=void 0,this.renderableKeyframeNodeNext=void 0,this.orientedBoundingBox=new zp,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r)}y_e.priorityComparator=function(e,t){return e.priority-t.priority},y_e.searchComparator=function(e,t){return e.keyframe-t.keyframe},y_e.LoadState=g_e,b_e.prototype.add=function(e){if(this.isFull())throw new P("Trying to add when there are no empty spots");const t=this.emptyList;this.emptyList=this.emptyList.nextNode,D(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,D(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;const n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n},b_e.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new P("Megatexture index out of bounds");const t=this.nodes[e];D(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),D(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,D(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--},b_e.prototype.isFull=function(){return void 0===this.emptyList},b_e.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===Ux.UNSIGNED_SHORT&&(i=Ux.FLOAT32);const o=Ux.getSizeInBytes(i),r=e*t.x*t.y*t.z,s=Math.ceil(Math.sqrt(t.x)),a=Math.ceil(t.z/s),c=s*t.x,l=a*t.y;let u=V.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){if(Math.floor(u/c)*Math.floor(u/l)>=e)break;u*=2}return u*u*n*o},b_e.prototype.writeDataToTexture=function(e,t){const n=t.constructor===Uint16Array?new Float32Array(t):t,i=this.voxelCountPerTile,o=this.sliceCountPerRegion,r=this.voxelCountPerRegion,s=this.channelCount,a=this.tileVoxelDataTemp;for(let u=0;u<i.z;u++){const e=u%o.x*i.x,t=Math.floor(u/o.x)*i.y;for(let o=0;o<i.y;o++)for(let c=0;c<i.x;c++){const l=u*i.y*i.x+o*i.x+c,d=(t+o)*r.x+(e+c);for(let e=0;e<s;e++)a[d*s+e]=n[l*s+e]}}const c=this.regionCountPerMegatexture,l={source:{arrayBufferView:a,width:r.x,height:r.y},xOffset:e%c.x*r.x,yOffset:Math.floor(e/c.x)*r.y};this.texture.copyFrom(l)},b_e.prototype.isDestroyed=function(){return!1},b_e.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),He(this)};const T_e=new H;A_e.prototype.computeBoundingVolumes=function(e){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);const t=re.getScale(this.orientedBoundingBox.halfAxes,T_e),n=2*H.maximumComponent(t);this.approximateVoxelSize=n/H.minimumComponent(this.dimensions)},A_e.prototype.constructChildNodes=function(e){const{level:t,x:n,y:i,z:o}=this,r=2*n,s=2*i,a=2*o,c=s+1,l=r+1,u=a+1,d=t+1,h=[[d,r,s,a],[d,l,s,a],[d,r,c,a],[d,l,c,a],[d,r,s,u],[d,l,s,u],[d,r,c,u],[d,l,c,u]];this.children=h.map((([t,n,i,o])=>new A_e(t,n,i,o,this,e,this.dimensions)))},A_e.prototype.visibility=function(e,t){const n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)},A_e.prototype.computeScreenSpaceError=function(e,t){const n=this.orientedBoundingBox;let i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,V.EPSILON7);const o=t*(this.approximateVoxelSize/i);this.screenSpaceError=o};const w_e={keyframe:0};function E_e(e,t){return w_e.keyframe=e,_n(t,w_e,y_e.searchComparator)}function x_e(e,t){const n=E_e(e,t);return n<0?V.clamp(~n-1,0,t.length-1):n}function S_e(e,t){return e*Math.exp(4*e)+t*(t>=0?1:-200)}function C_e(e,t,n,i,o,r,s){this._primitive=e,this.megatextures=new Array(i.length);for(let p=0;p<i.length;p++){const e=i[p],r=Vx.getComponentCount(e),a=o[p];this.megatextures[p]=new b_e(t,n,r,a,s)}const a=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;const c=e._shape;this.rootNode=new A_e(0,0,0,0,void 0,c,n),this._priorityQueue=new d_e({maximumLength:a,comparator:y_e.priorityComparator}),this._highPriorityKeyframeNodes=new Array(a),this._keyframeNodesInMegatexture=new Array(a),this._keyframeCount=r,this._sampleCount=void 0,this._keyframeLocation=0,this._binaryTreeKeyframeWeighting=new Array(r);const l=this._binaryTreeKeyframeWeighting;l[0]=0,l[r-1]=0,I_e(l,1,r-2,0);const u=2048,d=Math.floor(227.55555555555554),h=Math.ceil(a/d);this.internalNodeTexture=new Sc({context:t,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,flipY:!1,width:u,height:h,sampler:new uc({minificationFilter:ac.NEAREST,magnificationFilter:rc.NEAREST})}),this.internalNodeTilesPerRow=d,this.internalNodeTexelSizeUv=new kt(.00048828125,1/h),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new kt}function I_e(e,t,n,i){if(t>n)return;const o=Math.floor((t+n)/2);e[o]=i,I_e(e,t,o-1,i+1),I_e(e,o+1,n,i+1)}function O_e(e,t){if(t.computeBoundingVolumes(e._primitive._shape),D(t.children))for(let n=0;n<8;n++){O_e(e,t.children[n])}}function D_e(e,t){if(e._simultaneousRequestCount>=C_e.simultaneousRequestCountMaximum)return;const n=e._primitive._provider;const{keyframe:i,spatialNode:o}=t,r=n.requestData({tileLevel:o.level,tileX:o.x,tileY:o.y,tileZ:o.z,keyframe:i});D(r)?(e._simultaneousRequestCount++,t.state=y_e.LoadState.RECEIVING,r.then((function(i){e._simultaneousRequestCount--;const o=n.types.length;if(D(i))if(i===y_e.LoadState.FAILED)t.state=y_e.LoadState.FAILED;else if(Array.isArray(i)&&i.length===o){const n=e.megatextures;for(let e=0;e<o;e++){const{voxelCountPerTile:o,channelCount:r}=n[e],{x:s,y:a,z:c}=o,l=s*a*c,u=i[e],d=l*r;if(u.length!==d){t.state=y_e.LoadState.FAILED;break}t.metadata[e]=u,t.state=y_e.LoadState.RECEIVED}}else t.state=y_e.LoadState.FAILED;else t.state=y_e.LoadState.UNAVAILABLE})).catch((function(){e._simultaneousRequestCount--,t.state=y_e.LoadState.FAILED}))):t.state=y_e.LoadState.FAILED}function P_e(e,t,n,i){const o=Math.min(Math.abs(t-e),Math.abs(t-n)),r=Math.max(e,i._keyframeCount-n-1,1),s=Math.pow(1-o/r,4),a=Math.exp(-i._binaryTreeKeyframeWeighting[t]);return V.lerp(a,s,.15+.85*s)}A_e.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this;const n=t.level,i=Math.floor(e),o=Math.ceil(e);let r,s,a=+Number.MAX_VALUE,c=+Number.MAX_VALUE;for(;D(t);){const{renderableKeyframeNodes:e}=t;if(e.length>=1){const l=x_e(i,e),u=e[l],d=e[o===i||i<u.keyframe?l:Math.min(l+1,e.length-1)],h=i-u.keyframe,p=S_e(n-t.level,h);p<a&&(a=p,r=u);const f=d.keyframe-o,m=S_e(n-t.level,f);if(m<c&&(c=m,s=d),0===h&&0===f)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,!D(r)||!D(s))return;const l=r.keyframe,u=s.keyframe;this.renderableKeyframeNodeLerp=l===u?0:V.clamp((e-l)/(u-l),0,1)},A_e.prototype.isVisited=function(e){return this.visitedFrameNumber===e},A_e.prototype.createKeyframeNode=function(e){let t=E_e(e,this.keyframeNodes);if(t<0){t=~t;const n=new y_e(this,e);this.keyframeNodes.splice(t,0,n)}},A_e.prototype.destroyKeyframeNode=function(e,t){const n=e.keyframe,i=E_e(n,this.keyframeNodes);if(i<0)throw new P("Keyframe node does not exist.");if(this.keyframeNodes.splice(i,1),-1!==e.megatextureIndex){for(let n=0;n<t.length;n++)t[n].remove(e.megatextureIndex);const i=E_e(n,this.renderableKeyframeNodes);if(i<0)throw new P("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(i,1)}e.spatialNode=void 0,e.state=y_e.LoadState.UNLOADED,e.metadata={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1},A_e.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==y_e.LoadState.RECEIVED||-1!==e.megatextureIndex||e.metadata.length!==t.length)throw new P("Keyframe node cannot be added to megatexture");for(let o=0;o<t.length;o++){const n=t[o];e.megatextureIndex=n.add(e.metadata[o])}e.state=y_e.LoadState.LOADED;const n=this.renderableKeyframeNodes;let i=E_e(e.keyframe,n);if(i>=0)throw new P("Keyframe already renderable");i=~i,n.splice(i,0,e)},A_e.prototype.isRenderable=function(e){const t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return D(t)&&D(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e},C_e.prototype.findKeyframeNode=function(e){return this._keyframeNodesInMegatexture.find((function(t){return t.megatextureIndex===e}))},C_e.simultaneousRequestCountMaximum=50,C_e.prototype.update=function(e,t,n,i){const o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,c=o._levelBlendFactor,l=(c>0?2:1)*(a>1?2:1);this._sampleCount=l;const u=l>=2;if(u&&!D(this.leafNodeTexture)){const e=2,t=1024,n=Math.floor(t/e),i=Math.ceil(s/n);this.leafNodeTexture=new Sc({context:r,pixelFormat:is.RGBA,pixelDatatype:ts.UNSIGNED_BYTE,flipY:!1,width:t,height:i,sampler:new uc({minificationFilter:ac.NEAREST,magnificationFilter:rc.NEAREST})}),this.leafNodeTexelSizeUv=kt.fromElements(1/t,1/i,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=n}else!u&&D(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=V.clamp(t,0,a-1),n&&O_e(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;const d=rJ();!function(e,t){const n=e._frameNumber,i=e._primitive,o=i._shape,r=i.screenSpaceError,s=e._priorityQueue,a=e._keyframeCount,c=V.clamp(Math.floor(e._keyframeLocation),0,a-2),l=c+1,{camera:u,context:d,pixelRatio:h}=t,{positionWC:p,frustum:f}=u,m=d.drawingBufferHeight/h,_=m/f.sseDenominator;function g(i,u){if(i.computeScreenSpaceError(p,_),(u=i.visibility(t,u))===Bc.MASK_OUTSIDE)return;if(i.visitedFrameNumber=n,1===a)i.createKeyframeNode(0);else if(i.keyframeNodes.length!==a)for(let e=0;e<a;e++)i.createKeyframeNode(e);const{screenSpaceError:d,keyframeNodes:h}=i,f=(m=d)/(1+m);var m;let y=!1;for(let t=0;t<h.length;t++){const n=h[t];n.priority=10*f+P_e(c,n.keyframe,l,e),n.state!==y_e.LoadState.UNAVAILABLE&&n.state!==y_e.LoadState.FAILED&&n.priority!==-Number.MAX_VALUE&&s.insert(n),n.state===y_e.LoadState.LOADED&&(y=!0)}if(d<r||!y)i.children=void 0;else{D(i.children)||i.constructChildNodes(o);for(let e=0;e<8;e++){g(i.children[e],u)}}}s.reset(),g(e.rootNode,Bc.MASK_INDETERMINATE);const y=e._highPriorityKeyframeNodes;let b,v=0;for(;s.length>0;)b=s.removeMaximum(),b.highPriorityFrameNumber=n,y[v]=b,v++;const A=e._keyframeNodesInMegatexture,T=e.megatextures[0],w=T.occupiedCount;A.length=w,A.sort((function(e,t){return e.highPriorityFrameNumber===t.highPriorityFrameNumber?t.priority-e.priority:t.highPriorityFrameNumber-e.highPriorityFrameNumber}));let E=0,x=0;for(let S=0;S<v;S++)if(b=y[S],b.state!==y_e.LoadState.LOADED&&void 0!==b.spatialNode&&(b.state===y_e.LoadState.UNLOADED&&D_e(e,b),b.state===y_e.LoadState.RECEIVED)){let t=0;if(T.isFull()){t=w-1-E,E++;const n=A[t];n.spatialNode.destroyKeyframeNode(n,e.megatextures)}else t=w+x,x++;b.spatialNode.addKeyframeNodeToMegatextures(b,e.megatextures),A[t]=b}}(this,e);const h=rJ();!function(e,t,n){const i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2;let a=0,c=0;const l=[],u=[];function d(e,t,h,p,f){let m=!1;if(D(e.children))for(let n=0;n<8;n++){const t=e.children[n];t.computeSurroundingRenderableKeyframeNodes(o),t.isRenderable(r)&&(m=!0)}if(m){l[f]=N_e.INTERNAL<<16|t,l[h]=p,a++,f=9*(p=t)+1;for(let n=0;n<8;n++){d(e.children[n],t=a,h=9*t+0,p,f+n)}}else{if(s){const t=5*c,o=e.renderableKeyframeNodePrevious,r=e.level-o.spatialNode.level,s=o.spatialNode.parent,a=D(s)?s.renderableKeyframeNodePrevious:o,d=function(e,t,n){if(void 0===e.parent)return 0;const i=e.screenSpaceError,o=e.parent.screenSpaceError,r=(t-i)/(o-i),s=(r+n-1)/n;return V.clamp(s,0,1)}(e,i,n),h=r,p=1,m=o.megatextureIndex,_=a.megatextureIndex;u[t+0]=d,u[t+1]=h,u[t+2]=p,u[t+3]=m,u[t+4]=_,l[f]=N_e.LEAF<<16|c}else{const t=e.renderableKeyframeNodePrevious,n=0===e.level-t.spatialNode.level?N_e.LEAF:N_e.PACKED_LEAF_FROM_PARENT;l[f]=n<<16|t.megatextureIndex}c++}}const h=e.rootNode;h.computeSurroundingRenderableKeyframeNodes(o),h.isRenderable(r)&&d(h,0,0,0,0);(function(e,t,n,i){const o=is.componentsLength(i.pixelFormat),r=Math.ceil(e.length/t),s=Math.max(1,t*Math.min(r,n)),a=Math.max(1,Math.ceil(r/n)),c=new Uint8Array(s*a*o);for(let u=0;u<e.length;u++){const t=e[u],n=u*o;for(let e=0;e<o;e++)c[n+e]=t>>>8*e&255}const l={source:{arrayBufferView:c,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(l)})(l,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&function(e,t,n,i){const o=is.componentsLength(i.pixelFormat),r=5,s=Math.ceil(e.length/r),a=Math.max(1,t*Math.min(s,n)),c=Math.max(1,Math.ceil(s/n)),l=new Uint8Array(a*c*o);for(let d=0;d<s;d++){const t=e[d*r+0],n=e[d*r+1],i=e[d*r+2],o=e[d*r+3],s=e[d*r+4],a=V.clamp(Math.floor(65536*t),0,65535);l[8*d+0]=a>>>0&255,l[8*d+1]=a>>>8&255,l[8*d+2]=255&n,l[8*d+3]=255&i,l[8*d+4]=o>>>0&255,l[8*d+5]=o>>>8&255,l[8*d+6]=s>>>0&255,l[8*d+7]=s>>>8&255}const u={source:{arrayBufferView:l,width:a,height:c},xOffset:0,yOffset:0};i.copyFrom(u)}(u,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}(this,l,c);const p=rJ();if(this._debugPrint){!function(e,t,n,i){const o=e._keyframeCount,r=e.rootNode,s=Object.keys(y_e.LoadState).length,a=new Array(s),c=new Array(s);let l=0;for(let d=0;d<s;d++){const e=new Array(o);a[d]=e;for(let t=0;t<o;t++)e[t]=0;c[d]=0}function u(e){const t=e.keyframeNodes;for(let n=0;n<t.length;n++){const e=t[n],i=e.keyframe,o=e.state;a[o][i]+=1,c[o]+=1,l++}if(D(e.children))for(let n=0;n<8;n++){u(e.children[n])}}u(r);a[y_e.LoadState.LOADED],c[y_e.LoadState.UNLOADED],c[y_e.LoadState.RECEIVING],c[y_e.LoadState.RECEIVED],c[y_e.LoadState.LOADED],c[y_e.LoadState.FAILED],c[y_e.LoadState.UNAVAILABLE],Math.round(100*t),Math.round(100*n),Math.round(100*i)}(this,h-d,p-h,p-d)}},C_e.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)},C_e.prototype.isDestroyed=function(){return!1},C_e.prototype.destroy=function(){const e=this.megatextures,t=e.length;for(let n=0;n<t;n++)e[n]=e[n]&&e[n].destroy();return this.internalNodeTexture=this.internalNodeTexture&&this.internalNodeTexture.destroy(),this.leafNodeTexture=this.leafNodeTexture&&this.leafNodeTexture.destroy(),He(this)};const N_e={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};C_e.getApproximateTextureMemoryByteLength=function(e,t,n,i){let o=0;const r=n.length;for(let s=0;s<r;s++){const r=n[s],a=i[s],c=Vx.getComponentCount(r);o+=b_e.getApproximateTextureMemoryByteLength(e,t,c,a)}return o};const R_e=Object.freeze({FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",MAT2:"mat2",MAT3:"mat3",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"});function L_e(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}function M_e(e,t,n){const{id:i,textureUniform:o,image:r}=t,s=n.webgl2?F_e(o,r,n):function(e,t,n){const{typedArray:i,sampler:o}=e,r=B_e(o),s=o.wrapS===lc.REPEAT||o.wrapS===lc.MIRRORED_REPEAT||o.wrapT===lc.REPEAT||o.wrapT===lc.MIRRORED_REPEAT,{width:a,height:c}=D(i)?e:t,l=[a,c].every(V.isPowerOfTwo);if(!r&&!s||l)return F_e(e,t,n);if(!D(i)){return F_e(e,GC(t),n)}if(e.pixelDatatype===ts.UNSIGNED_BYTE){const e=function(e,t,n){const i=new Uint8ClampedArray(e.buffer),o=new ImageData(i,t,n),r=document.createElement("canvas");return r.width=t,r.height=n,r.getContext("2d").putImageData(o,0,0),r}(i,a,c);return F_e({sampler:o},GC(e),n)}return z_e(e,n)}(o,r,n),a=e._textures[i];D(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function F_e(e,t,n){const{typedArray:i,sampler:o}=e,r=D(i)?z_e(e,n):new Sc({context:n,source:t,sampler:o});return B_e(o)&&r.generateMipmap(),r}function B_e(e){return[ac.NEAREST_MIPMAP_NEAREST,ac.NEAREST_MIPMAP_LINEAR,ac.LINEAR_MIPMAP_NEAREST,ac.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function z_e(e,t){const{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new Sc({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}function U_e(e){e=M(e,M.EMPTY_OBJECT),this.mode=M(e.mode,XF.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=M(e.uniforms,M.EMPTY_OBJECT),this.varyings=M(e.varyings,M.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=M(e.translucencyMode,fB.INHERIT),this._textureManager=new L_e,this._defaultTexture=void 0,this.uniformMap=function(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const o=t[i],r=o.type;if(r===R_e.SAMPLER_CUBE)throw new P("CustomShader does not support samplerCube uniforms");r===R_e.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=k_e(e,i)):n[i]=V_e(e,i)}return n}(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},function(e){const t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g;let o;const r=e.vertexShaderText;D(r)&&(o=e.usedVariablesVertex.attributeSet,H_e(r,t,o),o=e.usedVariablesVertex.featureIdSet,H_e(r,n,o),o=e.usedVariablesVertex.metadataSet,H_e(r,i,o));const s=e.fragmentShaderText;if(D(s)){o=e.usedVariablesFragment.attributeSet,H_e(s,t,o),o=e.usedVariablesFragment.featureIdSet,H_e(s,n,o),o=e.usedVariablesFragment.metadataSet,H_e(s,i,o);H_e(s,/material\.(\w+)/g,e.usedVariablesFragment.materialSet)}}(this),function(e){const t=e.usedVariablesVertex.attributeSet;j_e(t,"position","positionMC","vertex"),j_e(t,"normal","normalMC","vertex"),j_e(t,"tangent","tangentMC","vertex"),j_e(t,"bitangent","bitangentMC","vertex"),j_e(t,"positionWC","positionMC","vertex"),j_e(t,"positionEC","positionMC","vertex"),j_e(t,"normalEC","normalMC","vertex"),j_e(t,"tangentEC","tangentMC","vertex"),j_e(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;j_e(n,"position","positionEC","fragment"),j_e(n,"normal","normalEC","fragment"),j_e(n,"tangent","tangentEC","fragment"),j_e(n,"bitangent","bitangentEC","fragment"),j_e(n,"normalMC","normalEC","fragment"),j_e(n,"tangentMC","tangentEC","fragment"),j_e(n,"bitangentMC","bitangentEC","fragment")}(this)}function k_e(e,t){return function(){return M(e._textureManager.getTexture(t),e._defaultTexture)}}function V_e(e,t){return function(){return e.uniforms[t].value}}function H_e(e,t,n){let i;for(;null!==(i=t.exec(e));){n[i[1]]=!0}}function G_e(e){return/^.*MC$/.test(e)?`${e} (model coordinates)`:/^.*WC$/.test(e)?`${e} (Cartesian world coordinates)`:/^.*EC$/.test(e)?`${e} (eye coordinates)`:e}function j_e(e,t,n,i){if(e.hasOwnProperty(t)){throw new P(`${G_e(t)} is not available in the ${i} shader. Did you mean ${G_e(n)} instead?`)}}function W_e(e){e=M(e,M.EMPTY_OBJECT),this._ready=!1,this._provider=M(e.provider,W_e.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new H,this._paddingAfter=new H,this._minBounds=new H,this._minBoundsOld=new H,this._maxBounds=new H,this._maxBoundsOld=new H,this._exaggeratedMinBounds=new H,this._exaggeratedMinBoundsOld=new H,this._exaggeratedMaxBounds=new H,this._exaggeratedMaxBoundsOld=new H,this._minClippingBounds=new H,this._minClippingBoundsOld=new H,this._maxClippingBounds=new H,this._maxClippingBoundsOld=new H,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this._exaggeratedModelMatrix=ve.clone(this._modelMatrix),this._compoundModelMatrix=new ve,this._compoundModelMatrixOld=new ve,this._customShader=M(e.customShader,W_e.DefaultCustomShader),this._customShaderCompilationEvent=new gi,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new ve,this._transformPositionUvToWorld=new ve,this._transformDirectionWorldToLocal=new re,this._transformNormalLocalToWorld=new re,this._jitter=!1,this._nearestSampling=!1,this._levelBlendFactor=0,this._stepSizeMultiplier=1,this._depthTest=!0,this._useLogDepth=void 0,this._screenSpaceError=4,this._debugPolylines=new fG,this._debugDraw=!1,this._disableRender=!1,this._disableUpdate=!1,this._uniforms={octreeInternalNodeTexture:void 0,octreeInternalNodeTilesPerRow:0,octreeInternalNodeTexelSizeUv:new kt,octreeLeafNodeTexture:void 0,octreeLeafNodeTilesPerRow:0,octreeLeafNodeTexelSizeUv:new kt,megatextureTextures:[],megatextureSliceDimensions:new kt,megatextureTileDimensions:new kt,megatextureVoxelSizeUv:new kt,megatextureSliceSizeUv:new kt,megatextureTileSizeUv:new kt,dimensions:new H,paddingBefore:new H,paddingAfter:new H,transformPositionViewToUv:new ve,transformPositionUvToView:new ve,transformDirectionViewToLocal:new re,transformNormalLocalToWorld:new re,cameraPositionUv:new H,ndcSpaceAxisAlignedBoundingBox:new K,clippingPlanesTexture:void 0,clippingPlanesMatrix:new ve,stepSize:0,pickColor:new Ot},this._shapeDefinesOld={},this._uniformMap={};const t=this._uniforms,n=this._uniformMap;for(const i in t)if(t.hasOwnProperty(i)){n[`u_${i}`]=function(){return t[i]}}!function(e,t){const{shape:n,minBounds:i=u_e.getMinBounds(n),maxBounds:o=u_e.getMaxBounds(n)}=t;e.minBounds=i,e.maxBounds=o,e.minClippingBounds=u_e.getMinBounds(n),e.maxClippingBounds=u_e.getMaxBounds(n),e._exaggeratedMinBounds=H.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=H.clone(e._maxBounds,e._exaggeratedMaxBounds),e._exaggeratedModelMatrix=ve.clone(e._modelMatrix,e._exaggeratedModelMatrix),cge(e,t);const r=u_e.getShapeConstructor(n);e._shape=new r,e._shapeVisible=uge(e,e._shape)}(this,this._provider)}L_e.prototype.getTexture=function(e){return this._textures[e]},L_e.prototype.loadTexture2D=function(e,t){D(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):function(e,t,n){n.resource.fetchImage().then((function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})})).catch((function(){const n=e._textures[t];D(n)&&n!==e._defaultTexture&&n.destroy(),e._textures[t]=e._defaultTexture}))}(this,e,t)},L_e.prototype.update=function(e){if(e.frameNumber===this._lastUpdatedFrame)return;this._lastUpdatedFrame=e.frameNumber;const t=e.context;this._defaultTexture=t.defaultTexture;const n=this._loadedImages;for(let i=0;i<n.length;i++){M_e(this,n[i],t)}n.length=0},L_e.prototype.isDestroyed=function(){return!1},L_e.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];n!==this._defaultTexture&&n.destroy()}return He(this)},U_e.prototype.setUniform=function(e,t){if(L.typeOf.string("uniformName",e),L.defined("value",t),!D(this.uniforms[e]))throw new P(`Uniform ${e} must be declared in the CustomShader constructor.`);const n=this.uniforms[e];n.type===R_e.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):D(t.clone)?n.value=t.clone(n.value):n.value=t},U_e.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)},U_e.prototype.isDestroyed=function(){return!1},U_e.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),He(this)},Object.defineProperties(W_e.prototype,{ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}},boundingSphere:{get:function(){return this._shape.boundingSphere}},orientedBoundingBox:{get:function(){return this._shape.orientedBoundingBox}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){L.typeOf.object("modelMatrix",e),this._modelMatrix=ve.clone(e,this._modelMatrix)}},shape:{get:function(){return this._provider.shape}},dimensions:{get:function(){return this._provider.dimensions}},minimumValues:{get:function(){return this._provider.minimumValues}},maximumValues:{get:function(){return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){L.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){L.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){L.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){L.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){L.typeOf.bool("jitter",e),this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){L.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){L.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=V.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){L.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){L.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){L.defined("minBounds",e),this._minBounds=H.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){L.defined("maxBounds",e),this._maxBounds=H.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){L.defined("minClippingBounds",e),this._minClippingBounds=H.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){L.defined("maxClippingBounds",e),this._maxClippingBounds=H.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){qI.setOwner(e,this,"_clippingPlanes")}},customShader:{get:function(){return this._customShader},set:function(e){if(this._customShader!==e){const t=this._uniformMap,n=this._customShader.uniformMap;for(const e in n)n.hasOwnProperty(e)&&delete t[e];D(e)?this._customShader=e:this._customShader=W_e.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});const q_e=new H,Y_e=new K,X_e=new K,Q_e=new H,$_e=new H,K_e=new re,Z_e=new re,J_e=new ve,ege=new ve,tge=new ve,nge=ve.fromRotationTranslation(re.fromUniformScale(.5,new re),new H(.5,.5,.5),new ve),ige=ve.fromRotationTranslation(re.fromUniformScale(2,new re),new H(-1,-1,-1),new ve);W_e.prototype.update=function(e){const t=this._provider;this._customShader.update(e);const n=e.context;if(!this._ready)return function(e,t,n){const i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=Ot.clone(e._pickId.color,i.pickColor);const{shaderDefines:o,shaderUniforms:r}=e._shape;e._shapeDefinesOld=ti(o,!0);const s=e._uniformMap;for(const a in r)if(r.hasOwnProperty(a)){const e=`u_${a}`;D(s[e])&&Oa(`VoxelPrimitive: Uniform name "${e}" is already defined`),s[e]=function(){return r[a]}}i.dimensions=H.clone(t.dimensions,i.dimensions),e._paddingBefore=H.clone(M(t.paddingBefore,H.ZERO),e._paddingBefore),i.paddingBefore=H.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=H.clone(M(t.paddingAfter,H.ZERO),e._paddingBefore),i.paddingAfter=H.clone(e._paddingAfter,i.paddingAfter),e._traversal=function(e,t,n){const i=H.clone(t.dimensions,q_e);H.add(i,e._paddingBefore,i),H.add(i,e._paddingAfter,i);const o=t.maximumTileCount,r=D(o)?C_e.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=M(t.keyframeCount,1);return new C_e(e,n,i,t.types,t.componentTypes,s,r)}(e,t,n),function(e,t){t.octreeInternalNodeTexture=e.internalNodeTexture,t.octreeInternalNodeTexelSizeUv=kt.clone(e.internalNodeTexelSizeUv,t.octreeInternalNodeTexelSizeUv),t.octreeInternalNodeTilesPerRow=e.internalNodeTilesPerRow;const n=e.megatextures,i=n[0],o=n.length;t.megatextureTextures=new Array(o);for(let r=0;r<o;r++)t.megatextureTextures[r]=n[r].texture;t.megatextureSliceDimensions=kt.clone(i.sliceCountPerRegion,t.megatextureSliceDimensions),t.megatextureTileDimensions=kt.clone(i.regionCountPerMegatexture,t.megatextureTileDimensions),t.megatextureVoxelSizeUv=kt.clone(i.voxelSizeUv,t.megatextureVoxelSizeUv),t.megatextureSliceSizeUv=kt.clone(i.sliceSizeUv,t.megatextureSliceSizeUv),t.megatextureTileSizeUv=kt.clone(i.regionSizeUv,t.megatextureTileSizeUv)}(e._traversal,i)}(this,t,n),void e.afterRender.push((()=>(this._ready=!0,!0)));!function(e,t){if(e._exaggeratedMinBounds=H.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=H.clone(e._maxBounds,e._exaggeratedMaxBounds),e.shape===u_e.ELLIPSOID){const n=t.verticalExaggerationRelativeHeight,i=t.verticalExaggeration;e._exaggeratedMinBounds.z=(e._minBounds.z-n)*i+n,e._exaggeratedMaxBounds.z=(e._maxBounds.z-n)*i+n}else if(e.shape===u_e.BOX){const n=H.fromElements(1,1,t.verticalExaggeration,oge);e._exaggeratedModelMatrix=ve.multiplyByScale(e._modelMatrix,n,e._exaggeratedModelMatrix),e._exaggeratedModelMatrix=ve.multiplyByTranslation(e._exaggeratedModelMatrix,function(e,t){const{shapeTransform:n=ve.IDENTITY,globalTransform:i=ve.IDENTITY}=e._provider,o=ve.getTranslation(n,rge),r=ve.multiplyByPoint(e._modelMatrix,o,rge),s=ve.multiplyByPoint(i,r,rge),a=on.WGS84.cartesianToCartographic(s,sge);let c=0;D(a)&&(c=a.height);const l=zf.getHeight(c,t.verticalExaggeration,t.verticalExaggerationRelativeHeight);return H.fromElements(0,0,(l-c)/t.verticalExaggeration,age)}(e,t),e._exaggeratedModelMatrix)}}(this,e);const i=cge(this,t),o=this._shape;if(i&&(this._shapeVisible=uge(this,o),function(e,t){const n=t.shaderDefines,i=Object.keys(n).some((t=>n[t]!==e._shapeDefinesOld[t]));i&&(e._shapeDefinesOld=ti(n,!0));return i}(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;const r=function(e,t){if(!D(e)||!D(t))return 0;let n,i=t.currentTime,o=e.indexOf(i);o>=0?n=e.get(o):(o=~o,o===e.length?(o=e.length-1,n=e.get(o),i=n.stop):(n=e.get(o),i=n.start));const r=Hn.secondsDifference(n.stop,n.start),s=Hn.secondsDifference(i,n.start);return o+s/r}(t.timeIntervalCollection,this._clock),s=this._traversal,a=s._sampleCount;if(s.update(e,r,i,this._disableUpdate),a!==s._sampleCount&&(this._shaderDirty=!0),!s.isRenderable(s.rootNode))return;if(this._debugDraw&&function(e,t){const n=e._traversal,i=e._debugPolylines;function o(e,t,n,o){i.add({positions:[e,t],width:o,material:mh.fromType("Color",{color:n})})}function r(e,t,n){const i=e.computeCorners();o(i[0],i[1],t,n),o(i[2],i[3],t,n),o(i[4],i[5],t,n),o(i[6],i[7],t,n),o(i[0],i[2],t,n),o(i[4],i[6],t,n),o(i[1],i[3],t,n),o(i[5],i[7],t,n),o(i[0],i[4],t,n),o(i[2],i[6],t,n),o(i[1],i[5],t,n),o(i[3],i[7],t,n)}function s(e){if(!n.isRenderable(e))return;const t=e.level,i=5,o=Math.max(1,i/Math.pow(2,t)),a=[Ot.RED,Ot.LIME,Ot.BLUE][t%3];if(r(e.orientedBoundingBox,a,o),D(e.children))for(let n=0;n<8;n++)s(e.children[n])}i.removeAll(),r(e._shape.orientedBoundingBox,Ot.WHITE,5),s(n.rootNode);const a=10;o(H.ZERO,mge,Ot.RED,a),o(H.ZERO,_ge,Ot.LIME,a),o(H.ZERO,gge,Ot.BLUE,a),i.update(t)}(this,e),this._disableRender)return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0);const c=function(e,t){const n=e.clippingPlanes;if(!D(n))return!1;n.update(t);const{clippingPlanesState:i,enabled:o}=n;if(o){const t=e._uniforms;t.clippingPlanesTexture=n.texture,t.clippingPlanesMatrix=ve.transpose(ve.multiplyTransformation(ve.inverse(n.modelMatrix,t.clippingPlanesMatrix),e._transformPositionUvToWorld,t.clippingPlanesMatrix),t.clippingPlanesMatrix)}if(e._clippingPlanesState===i&&e._clippingPlanesEnabled===o)return!1;return e._clippingPlanesState=i,e._clippingPlanesEnabled=o,!0}(this,e);c&&(this._shaderDirty=!0);const l=s.leafNodeTexture,u=this._uniforms;D(l)&&(u.octreeLeafNodeTexture=s.leafNodeTexture,u.octreeLeafNodeTexelSizeUv=kt.clone(s.leafNodeTexelSizeUv,u.octreeLeafNodeTexelSizeUv),u.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(pme(this,n),this._shaderDirty=!1);const d=n.uniformState.viewProjection,h=function(e,t,n){const i=ve.fromRotationTranslation(e.halfAxes,e.center,ege),o=ve.multiply(t,i,tge);let r,s=+Number.MAX_VALUE,a=-Number.MAX_VALUE,c=+Number.MAX_VALUE,l=-Number.MAX_VALUE;const u=pge,d=dge.length;for(r=0;r<d;r++)ve.multiplyByVector(o,dge[r],u[r]);for(r=0;r<d;r++){const e=u[r];if(e.z>=-e.w){const t=e.x/e.w,n=e.y/e.w;s=Math.min(s,t),a=Math.max(a,t),c=Math.min(c,n),l=Math.max(l,n)}else for(let t=0;t<3;t++){const n=u[hge[3*r+t]];if(n.z>=-n.w){const t=e.z+e.w,i=t/(t-(n.z+n.w)),o=K.lerp(e,n,i,Y_e),r=o.x/o.w,u=o.y/o.w;s=Math.min(s,r),a=Math.max(a,r),c=Math.min(c,u),l=Math.max(l,u)}}}return s=V.clamp(s,-1,1),c=V.clamp(c,-1,1),a=V.clamp(a,-1,1),l=V.clamp(l,-1,1),n=K.fromElements(s,c,a,l,n)}(o.orientedBoundingBox,d,X_e);if(1===h.x||1===h.y||-1===h.z||-1===h.w)return;u.ndcSpaceAxisAlignedBoundingBox=K.clone(h,u.ndcSpaceAxisAlignedBoundingBox);const p=n.uniformState.inverseView;u.transformPositionViewToUv=ve.multiplyTransformation(this._transformPositionWorldToUv,p,u.transformPositionViewToUv);const f=n.uniformState.view;u.transformPositionUvToView=ve.multiplyTransformation(f,this._transformPositionUvToWorld,u.transformPositionUvToView);const m=n.uniformState.inverseViewRotation;u.transformDirectionViewToLocal=re.multiply(this._transformDirectionWorldToLocal,m,u.transformDirectionViewToLocal),u.transformNormalLocalToWorld=re.clone(this._transformNormalLocalToWorld,u.transformNormalLocalToWorld);const _=e.camera.positionWC;u.cameraPositionUv=ve.multiplyByPoint(this._transformPositionWorldToUv,_,u.cameraPositionUv),u.stepSize=this._stepSizeMultiplier;const g=e.passes.pick?this._drawCommandPick:e.passes.pickVoxel?this._drawCommandPickVoxel:this._drawCommand;g.boundingVolume=o.boundingSphere,e.commandList.push(g)};const oge=new H,rge=new H,sge=new Qt,age=new H;function cge(e,t){const n=M(t.shapeTransform,ve.IDENTITY),i=M(t.globalTransform,ve.IDENTITY);ve.multiplyTransformation(i,e._exaggeratedModelMatrix,e._compoundModelMatrix),ve.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix);return lge(e,"_compoundModelMatrix","_compoundModelMatrixOld")+lge(e,"_minBounds","_minBoundsOld")+lge(e,"_maxBounds","_maxBoundsOld")+lge(e,"_exaggeratedMinBounds","_exaggeratedMinBoundsOld")+lge(e,"_exaggeratedMaxBounds","_exaggeratedMaxBoundsOld")+lge(e,"_minClippingBounds","_minClippingBoundsOld")+lge(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function lge(e,t,n){const i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function uge(e,t,n){if(!t.update(e._compoundModelMatrix,e._exaggeratedMinBounds,e._exaggeratedMaxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;const i=t.shapeTransform,o=ve.inverse(i,J_e),r=ve.getRotation(i,K_e),s=ve.getScale(i,Q_e),a=H.maximumComponent(s),c=H.divideByScalar(s,a,$_e),l=re.multiplyByScale(r,c,Z_e);return e._transformPositionWorldToUv=ve.multiplyTransformation(nge,o,e._transformPositionWorldToUv),e._transformPositionUvToWorld=ve.multiplyTransformation(i,ige,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=ve.getMatrix3(o,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=re.inverseTranspose(l,e._transformNormalLocalToWorld),!0}W_e.prototype.isDestroyed=function(){return!1},W_e.prototype.destroy=function(){const e=this._drawCommand;D(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());const t=this._drawCommandPick;return D(t)&&(t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()),this._pickId=this._pickId&&this._pickId.destroy(),this._traversal=this._traversal&&this._traversal.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),He(this)};const dge=new Array(new K(-1,-1,-1,1),new K(1,-1,-1,1),new K(-1,1,-1,1),new K(1,1,-1,1),new K(-1,-1,1,1),new K(1,-1,1,1),new K(-1,1,1,1),new K(1,1,1,1)),hge=new Array(1,2,4,0,3,5,0,3,6,1,2,7,0,5,6,1,4,7,2,4,7,3,5,6),pge=new Array(new K,new K,new K,new K,new K,new K,new K,new K);const fge=3e7,mge=new H(fge,0,0),_ge=new H(0,fge,0),gge=new H(0,0,fge);function yge(){this.ready=!0,this.shape=u_e.BOX,this.dimensions=new H(1,1,1),this.names=["data"],this.types=[Vx.SCALAR],this.componentTypes=[Ux.FLOAT32],this.maximumTileCount=1}W_e.DefaultCustomShader=new U_e({fragmentShaderText:"void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)\n{\n material.diffuse = vec3(1.0);\n material.alpha = 1.0;\n}"}),yge.prototype.requestData=function(e){if(!((D(e)?M(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])},W_e.DefaultProvider=new yge;const bge=function(e){return function(){e.frameState.afterRender.push((function(){e.requestRender()}))}};function vge(e){const t=(e=M(e,M.EMPTY_OBJECT)).canvas;let n=e.creditContainer,i=e.creditViewport;const o=ti(e.contextOptions);if(!D(t))throw new P("options and options.canvas are required.");const r=D(n),s=new Gl(t,o);r||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0 0 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",t.parentNode.appendChild(n)),D(i)||(i=t.parentNode),this._id=ke(),this._jobScheduler=new Nae,this._frameState=new Nse(s,new xre(n," • ",i),this._jobScheduler),this._frameState.scene3DOnly=M(e.scene3DOnly,!1),this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new Ta(s),this._globe=void 0,this._globeTranslucencyState=new qse,this._primitives=new TJ,this._groundPrimitives=new TJ,this._globeHeight=void 0,this._globeHeightDirty=!0,this._cameraUnderground=!1,this._removeUpdateHeightCallback=void 0,this._logDepthBuffer=vge.defaultLogDepthBuffer&&s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new Ahe,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=M(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new lse(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new Bt({color:new Ot,stencil:0,owner:this}),this._depthClearCommand=new Bt({depth:1,owner:this}),this._stencilClearCommand=new Bt({stencil:0}),this._classificationStencilClearCommand=new Bt({stencil:0,renderState:_s.fromCache({stencilMask:sy.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new ade(this),this._preUpdate=new gi,this._postUpdate=new gi,this._renderError=new gi,this._preRender=new gi,this._postRender=new gi,this._minimumDisableDepthTestDistance=0,this._debugInspector=new Jfe,this._msaaSamples=M(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new gi,this.morphComplete=new gi,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=Ot.clone(Ot.BLACK),this._mode=gl.SCENE3D,this._mapProjection=D(e.mapProjection)?e.mapProjection:new fn,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.atmosphere=new Wne,this.fog=new xse,this._shadowMapCamera=new die(this),this.shadowMap=new nce({context:s,lightCamera:this._shadowMapCamera,enabled:M(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=Ot.clone(Ot.WHITE),this._actualInvertClassificationColor=Ot.clone(this._invertClassificationColor),this._invertClassification=new Cae,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new yue,this._brdfLutGenerator=new qne,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new The(this),this._cameraUnderground=!1,this._mapMode2D=M(e.mapMode2D,uie.INFINITE_SCROLL),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=M(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=M(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=Ii.requestCompletedEvent.addEventListener(bge(this)),this._removeTaskProcessorListenerCallback=Qa.taskCompletedEvent.addEventListener(bge(this)),this._removeGlobeCallbacks=[],this._removeTerrainProviderReadyListener=void 0;const a=new Fr(0,0,s.drawingBufferWidth,s.drawingBufferHeight),c=new die(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new die(this),this.preloadFlightCullingVolume=void 0,this._picking=new nle(this),this._defaultView=new qce(this,c,a),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,this.light=new yl,Ige(this,0,Hn.now()),this.updateFrameState(),this.initializeFrame()}function Age(e,t,n){const i=e._frameState,o=e._context,r=e._view.oit,s=i.shadowState.lightShadowMaps,a=i.shadowState.lightShadowsEnabled;let c=t.derivedCommands;D(t.pickId)&&(c.picking=_se.createPickDerivedCommand(e,t,o,c.picking)),t.pickOnly||(c.depth=_se.createDepthOnlyDerivedCommand(e,t,o,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=_se.createHdrCommand(t,o,c.hdr),c=(t=c.hdr.command).derivedCommands),a&&t.receiveShadows&&(c.shadows=nce.createReceiveDerivedCommand(s,t,n,o,c.shadows)),t.pass===zt.TRANSLUCENT&&D(r)&&r.isSupported()&&(a&&t.receiveShadows?(c.oit=D(c.oit)?c.oit:{},c.oit.shadows=r.createDerivedCommands(c.shadows.receiveCommand,o,c.oit.shadows)):c.oit=r.createDerivedCommands(t,o,c.oit))}vge.defaultLogDepthBuffer=!0,Object.defineProperties(vge.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 rs.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return rs.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 XT.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,function(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;const n=[];D(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(bge(e))),n.push(t.terrainProviderChanged.addEventListener(bge(e)))),e._removeGlobeCallbacks=n}(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(D(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(D(this.globe))return this.globe.terrainProvider},set:function(e){this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),D(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(D(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){if(this.scene3DOnly&&e!==gl.SCENE3D)throw new P("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");if(e===gl.SCENE2D)this.morphTo2D(0);else if(e===gl.SCENE3D)this.morphTo3D(0);else{if(e!==gl.COLUMBUS_VIEW)throw new P("value must be a valid SceneMode enumeration.");this.morphToColumbusView(0)}this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){if(this.camera.frustum instanceof Xc)throw new P("VR is unsupported with an orthographic projection.");this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new die(this),D(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new Ase(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){if(!D(e)||e<0)throw new P("minimumDisableDepthTestDistance must be greater than or equal to 0.0.");this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){const t=this._context,n=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=n!==this._hdr,this._hdr=n}},highDynamicRangeSupported:{get:function(){const e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},msaaSamples:{get:function(){return this._msaaSamples},set:function(e){e=Math.min(e,rs.maximumSamples),this._msaaSamples=e}},msaaSupported:{get:function(){return this._context.msaa}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return.9999}},globeHeight:{get:function(){return this._globeHeight}}}),vge.prototype.getCompressedTextureFormatSupported=function(e){const 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_etc"===e||"etc"===e)&&t.etc||("WEBGL_compressed_texture_etc1"===e||"etc1"===e)&&t.etc1||("WEBGL_compressed_texture_astc"===e||"astc"===e)&&t.astc||("EXT_texture_compression_bptc"===e||"bc7"===e)&&t.bc7},vge.prototype.updateDerivedCommands=function(e){if(!D(e.derivedCommands))return;const t=this._frameState,n=this._context;let i=!1;const o=t.shadowState.lastDirtyTime;e.lastDirtyTime!==o&&(e.lastDirtyTime=o,e.dirty=!0,i=!0);const r=t.useLogDepth,s=this._hdr,a=e.derivedCommands,c=D(a.logDepth),l=D(a.hdr),u=D(a.originalCommand),d=r&&!c,h=s&&!l,p=!(r&&s||u);if(e.dirty=e.dirty||d||h||p,e.dirty){e.dirty=!1;const o=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=nce.createCastDerivedCommand(o,e,i,n,a.shadows)),(c||d)&&(a.logDepth=_se.createLogDepthCommand(e,n,a.logDepth),Age(this,a.logDepth.command,i)),(u||p)&&Age(this,e,i)}};const Tge=new _re({pass:Wj.RENDER}),wge=new _re({pass:Wj.PRELOAD}),Ege=new _re({pass:Wj.PRELOAD_FLIGHT}),xge=new _re({pass:Wj.REQUEST_RENDER_MODE_DEFER_CHECK}),Sge=new $u;let Cge;function Ige(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=Hn.clone(n,i.time)}vge.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.pickVoxel=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1},vge.prototype.updateFrameState=function(){const e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=function(e){const t=e.globe;if(e._mode===gl.SCENE3D&&D(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return Sge.radius=n.minimumRadius+i,Cge=Tne.fromBoundingSphere(Sge,e.camera.positionWC,Cge),Cge}}(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof Xc||this.camera.frustum instanceof Hc),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState;const{globe:n}=this;D(n)&&n._terrainExaggerationChanged&&(this.verticalExaggeration=n._terrainExaggeration,this.verticalExaggerationRelativeHeight=n._terrainExaggerationRelativeHeight,n._terrainExaggerationChanged=!1),t.verticalExaggeration=this.verticalExaggeration,t.verticalExaggerationRelativeHeight=this.verticalExaggerationRelativeHeight,D(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=Ot.clone(this.invertClassificationColor,this._actualInvertClassificationColor),Cae.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,D(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0},vge.prototype.isVisible=function(e,t,n){return D(e)&&(!D(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==mn.OUTSIDE&&(!D(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let Oge=new ve(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function Dge(e,t,n,i,o){const r=t._frameState;if(D(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof Bt)return void e.execute(n,i);e.debugShowBoundingVolume&&D(e.boundingVolume)&&function(e,t,n,i){const o=t._frameState,r=o.context,s=e.boundingVolume;let a;D(t._debugVolume)&&t._debugVolume.destroy();let c=H.clone(s.center);if(o.mode!==gl.SCENE3D){c=ve.multiplyByPoint(Oge,c,c);const e=o.mapProjection,t=e.unproject(c);c=e.ellipsoid.cartographicToCartesian(t)}if(D(s.radius)){const e=s.radius;a=C_.toWireframe(F0.createGeometry(new F0({radii:new H(e,e,e),vertexFormat:Ih.FLAT_VERTEX_FORMAT}))),t._debugVolume=new V_({geometryInstances:new Zd({geometry:a,modelMatrix:ve.fromTranslation(c),attributes:{color:new $d(1,0,0,1)}}),appearance:new Ih({flat:!0,translucent:!1}),asynchronous:!1})}else{const e=s.halfAxes;a=C_.toWireframe(Ud.createGeometry(Ud.fromDimensions({dimensions:new H(2,2,2),vertexFormat:Ih.FLAT_VERTEX_FORMAT}))),t._debugVolume=new V_({geometryInstances:new Zd({geometry:a,modelMatrix:ve.fromRotationTranslation(e,c,new ve),attributes:{color:new $d(1,0,0,1)}}),appearance:new Ih({flat:!0,translucent:!1}),asynchronous:!1})}const l=o.commandList,u=o.commandList=[];t._debugVolume.update(o),e=u[0],o.useLogDepth&&(e=_se.createLogDepthCommand(e,r).command);let d;D(i)&&(d=n.framebuffer,n.framebuffer=i),e.execute(r,n),D(d)&&(n.framebuffer=d),o.commandList=l}(e,t,i,o),r.useLogDepth&&D(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const s=r.passes;if(!s.pick&&!s.pickVoxel&&!s.depth&&t._hdr&&D(e.derivedCommands)&&D(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth&&D(e.derivedCommands.picking))return void(e=e.derivedCommands.picking.pickCommand).execute(n,i);if(D(e.derivedCommands.depth))return void(e=e.derivedCommands.depth.depthOnlyCommand).execute(n,i)}t.debugShowCommands||t.debugShowFrustums?t._debugInspector.executeDebugShowFrustumsCommand(t,e,i):r.shadowState.lightShadowsEnabled&&e.receiveShadows&&D(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function Pge(e,t,n,i){const o=t._frameState;let r=e.derivedCommands;D(r)&&(o.useLogDepth&&D(r.logDepth)&&(e=r.logDepth.command),r=e.derivedCommands,D(r.picking)?(e=r.picking.pickCommand).execute(n,i):D(r.depth)&&(e=r.depth.depthOnlyCommand).execute(n,i))}function Nge(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function Rge(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+V.EPSILON12}function Lge(e,t,n,i,o){const r=e.context;Ane(i,Nge,e.camera.positionWC),D(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function Mge(e,t,n,i,o){const r=e.context;Ane(i,Rge,e.camera.positionWC),D(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function Fge(e,t,n,i){const o=e.context;Ane(i,Nge,e.camera.positionWC);const r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}Oge=ve.inverseTransformation(Oge,Oge);const Bge=new Vne,zge=new Mne,Uge=new Xc,kge=new Hc;function Vge(e,t){const{camera:n,context:i,frameState:o}=e,{uniformState:r}=i;let s;r.updateCamera(n),s=D(n.frustum.fov)?n.frustum.clone(Bge):D(n.frustum.infiniteProjectionMatrix)?n.frustum.clone(zge):D(n.frustum.width)?n.frustum.clone(Uge):n.frustum.clone(kge),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(zt.ENVIRONMENT);const a=o.passes,c=a.pick||a.pickVoxel,l=e._environmentState,u=e._view,d=l.renderTranslucentDepthForPick,h=l.useWebVR;if(!c){const n=l.skyBoxCommand;if(D(n)&&Dge(n,e,i,t),l.isSkyAtmosphereVisible&&Dge(l.skyAtmosphereCommand,e,i,t),l.isSunVisible&&(l.sunDrawCommand.execute(i,t),e.sunBloom&&!h)){let n;n=l.useGlobeDepthFramebuffer?u.globeDepth.framebuffer:l.usePostProcess?u.sceneFramebuffer.framebuffer:l.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,n),t.framebuffer=n}l.isMoonVisible&&l.moonCommand.execute(i,t)}let p;l.useOIT?(D(e._executeOITFunction)||(e._executeOITFunction=function(e,t,n,o,r){u.globeDepth.prepareColorTextures(i),u.oit.executeCommands(e,t,n,o,r)}),p=e._executeOITFunction):p=a.render?Lge:Mge;const f=u.frustumCommandsList,m=f.length,_=l.clearGlobeDepth,g=l.useDepthPlane,y=e._globeTranslucencyState,b=y.translucent,v=e._view.globeTranslucencyFramebuffer,A=e._depthClearCommand,T=e._stencilClearCommand,w=e._classificationStencilClearCommand,E=e._depthPlane,x=l.usePostProcessSelected,S=n.position.z;let C;for(let I=0;I<m;++I){const a=m-I-1,h=f[a];e.mode===gl.SCENE2D?(n.position.z=S-h.near+1,s.far=Math.max(1,h.far-h.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=0!==a?h.near*e.opaqueFrustumNearOffset:h.near,s.far=h.far,r.updateFrustum(s)),A.execute(i,t),i.stencilBuffer&&T.execute(i,t),r.updatePass(zt.GLOBE);let O=h.commands[zt.GLOBE],P=h.indices[zt.GLOBE];if(b)y.executeGlobeCommands(h,Dge,v,e,t);else for(C=0;C<P;++C)Dge(O[C],e,i,t);const N=u.globeDepth;if(D(N)&&l.useGlobeDepthFramebuffer&&N.executeCopyDepth(i,t),!l.renderTranslucentDepthForPick)if(r.updatePass(zt.TERRAIN_CLASSIFICATION),O=h.commands[zt.TERRAIN_CLASSIFICATION],P=h.indices[zt.TERRAIN_CLASSIFICATION],b)y.executeGlobeClassificationCommands(h,Dge,v,e,t);else for(C=0;C<P;++C)Dge(O[C],e,i,t);if(_&&(A.execute(i,t),g&&E.execute(i,t)),!l.useInvertClassification||c||l.renderTranslucentDepthForPick){for(r.updatePass(zt.CESIUM_3D_TILE),O=h.commands[zt.CESIUM_3D_TILE],P=h.indices[zt.CESIUM_3D_TILE],C=0;C<P;++C)Dge(O[C],e,i,t);if(P>0&&(D(N)&&l.useGlobeDepthFramebuffer&&(N.prepareColorTextures(i,_),N.executeUpdateDepth(i,t,_,N.depthStencilTexture)),!l.renderTranslucentDepthForPick))for(r.updatePass(zt.CESIUM_3D_TILE_CLASSIFICATION),O=h.commands[zt.CESIUM_3D_TILE_CLASSIFICATION],P=h.indices[zt.CESIUM_3D_TILE_CLASSIFICATION],C=0;C<P;++C)Dge(O[C],e,i,t)}else{e._invertClassification.clear(i,t);const n=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(zt.CESIUM_3D_TILE),O=h.commands[zt.CESIUM_3D_TILE],P=h.indices[zt.CESIUM_3D_TILE],C=0;C<P;++C)Dge(O[C],e,i,t);for(D(N)&&l.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),N.executeUpdateDepth(i,t,_,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(zt.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),O=h.commands[zt.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],P=h.indices[zt.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],C=0;C<P;++C)Dge(O[C],e,i,t);for(t.framebuffer=n,e._invertClassification.executeClassified(i,t),1===o.invertClassificationColor.alpha&&e._invertClassification.executeUnclassified(i,t),P>0&&i.stencilBuffer&&w.execute(i,t),r.updatePass(zt.CESIUM_3D_TILE_CLASSIFICATION),O=h.commands[zt.CESIUM_3D_TILE_CLASSIFICATION],P=h.indices[zt.CESIUM_3D_TILE_CLASSIFICATION],C=0;C<P;++C)Dge(O[C],e,i,t)}for(P>0&&i.stencilBuffer&&T.execute(i,t),r.updatePass(zt.VOXELS),O=h.commands[zt.VOXELS],P=h.indices[zt.VOXELS],O.length=P,Fge(e,Dge,t,O),r.updatePass(zt.OPAQUE),O=h.commands[zt.OPAQUE],P=h.indices[zt.OPAQUE],C=0;C<P;++C)Dge(O[C],e,i,t);let R;0!==a&&e.mode!==gl.SCENE2D&&(s.near=h.near,r.updateFrustum(s)),!c&&l.useInvertClassification&&o.invertClassificationColor.alpha<1&&(R=e._invertClassification),r.updatePass(zt.TRANSLUCENT),O=h.commands[zt.TRANSLUCENT],O.length=h.indices[zt.TRANSLUCENT],p(e,Dge,t,O,R);if(h.indices[zt.CESIUM_3D_TILE_CLASSIFICATION]>0&&u.translucentTileClassification.isSupported()&&(u.translucentTileClassification.executeTranslucentCommands(e,Dge,t,O,N.depthStencilTexture),u.translucentTileClassification.executeClassificationCommands(e,Dge,t,h)),i.depthTexture&&e.useDepthPicking&&(l.useGlobeDepthFramebuffer||d)){const n=N.depthStencilTexture,o=e._picking.getPickDepth(e,a);o.update(i,n),o.executeCopyDepth(i,t)}if(c||!x)continue;const L=t.framebuffer;if(t.framebuffer=u.sceneFramebuffer.getIdFramebuffer(),s.near=0!==a?h.near*e.opaqueFrustumNearOffset:h.near,s.far=h.far,r.updateFrustum(s),r.updatePass(zt.GLOBE),O=h.commands[zt.GLOBE],P=h.indices[zt.GLOBE],b)y.executeGlobeCommands(h,Pge,v,e,t);else for(C=0;C<P;++C)Pge(O[C],e,i,t);for(_&&(A.framebuffer=t.framebuffer,A.execute(i,t),A.framebuffer=void 0),_&&g&&E.execute(i,t),r.updatePass(zt.CESIUM_3D_TILE),O=h.commands[zt.CESIUM_3D_TILE],P=h.indices[zt.CESIUM_3D_TILE],C=0;C<P;++C)Pge(O[C],e,i,t);for(r.updatePass(zt.OPAQUE),O=h.commands[zt.OPAQUE],P=h.indices[zt.OPAQUE],C=0;C<P;++C)Pge(O[C],e,i,t);for(r.updatePass(zt.TRANSLUCENT),O=h.commands[zt.TRANSLUCENT],P=h.indices[zt.TRANSLUCENT],C=0;C<P;++C)Pge(O[C],e,i,t);t.framebuffer=L}}function Hge(e){e.context.uniformState.updatePass(zt.COMPUTE);const t=e._environmentState.sunComputeCommand;D(t)&&t.execute(e._computeEngine);const n=e._computeCommandList,i=n.length;for(let o=0;o<i;++o)n[o].execute(e._computeEngine)}function Gge(e,t,n){const i=n.shadowMapCullingVolume,o=n.isPointLight,r=n.passes,s=r.length,a=t.length;for(let c=0;c<a;++c){const n=t[c];if(e.updateDerivedCommands(n),n.castShadows&&(n.pass===zt.GLOBE||n.pass===zt.CESIUM_3D_TILE||n.pass===zt.OPAQUE||n.pass===zt.TRANSLUCENT)&&e.isVisible(n,i))if(o)for(let e=0;e<s;++e)r[e].commandList.push(n);else if(1===s)r[0].commandList.push(n);else{let t=!1;for(let i=s-1;i>=0;--i){const o=r[i].cullingVolume;if(e.isVisible(n,o))r[i].commandList.push(n),t=!0;else if(t)break}}}}function jge(e){const t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;const o=e.context,r=o.uniformState;for(let s=0;s<i;++s){const t=n[s];if(t.outOfView)continue;const i=t.passes,a=i.length;for(let e=0;e<a;++e)i[e].commandList.length=0;Gge(e,e.frameState.commandList,t);for(let n=0;n<a;++n){const i=t.passes[n];r.updateCamera(i.camera),t.updatePass(o,n);const a=i.commandList.length;for(let t=0;t<a;++t){const n=i.commandList[t];r.updatePass(n.pass),Dge(n.derivedCommands.shadows.castCommands[s],e,o,i.passState)}}}}const Wge=new H;vge.prototype.updateAndExecuteCommands=function(e,t){const n=this._frameState.mode;this._environmentState.useWebVR?function(e,t,n){const i=e._view,o=i.camera,r=e._environmentState.renderTranslucentDepthForPick;iye(e,t,n),nye(e),i.createPotentiallyVisibleSet(e),Hge(e),r||jge(e);const s=t.viewport;s.x=0,s.y=0,s.width=.5*s.width;const a=die.clone(o,e._cameraVR);a.frustum=o.frustum;const c=o.frustum.near,l=c*M(e.focalLength,5),u=M(e.eyeSeparation,l/30),d=H.multiplyByScalar(a.right,.5*u,Wge);o.frustum.aspectRatio=s.width/s.height;const h=.5*u*c/l;H.add(a.position,d,o.position),o.frustum.xOffset=h,Vge(e,t),s.x=s.width,H.subtract(a.position,d,o.position),o.frustum.xOffset=-h,Vge(e,t),die.clone(a,o)}(this,e,t):n!==gl.SCENE2D||this._mapMode2D===uie.ROTATE?eye(!0,this,e,t):(iye(this,e,t),function(e,t){const n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=Fr.clone(r,Jge);t.viewport=s;const a=qge,c=Yge;e.mapProjection.project(a,c);const l=H.clone(o.position,Xge),u=ve.clone(o.transform,$ge),d=o.frustum.clone();o._setTransform(ve.IDENTITY);const h=ve.computeViewportTransformation(s,0,1,Qge),p=o.frustum.projectionMatrix,f=o.positionWC.y,m=H.fromElements(V.sign(f)*c.x-f,0,-o.positionWC.x,Kge),_=Cr.pointToGLWindowCoordinates(p,h,m,Zge);_.x=Math.floor(_.x);const g=s.x,y=s.width;if(0===f||_.x<=g||_.x>=g+y)eye(!0,e,t);else if(Math.abs(g+.5*y-_.x)<1)s.width=_.x-s.x,o.position.x*=V.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),eye(!0,e,t),s.x=_.x,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),eye(!1,e,t);else if(_.x>g+.5*y){s.width=_.x-g;const r=o.frustum.right;o.frustum.right=c.x-f,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),eye(!0,e,t),s.x=_.x,s.width=g+y-_.x,o.position.x=-o.position.x,o.frustum.left=-o.frustum.right,o.frustum.right=r-2*o.frustum.right,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),eye(!1,e,t)}else{s.x=_.x,s.width=g+y-_.x;const r=o.frustum.left;o.frustum.left=-c.x-f,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),eye(!0,e,t),s.x=g,s.width=_.x-g,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=r-2*o.frustum.left,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),eye(!1,e,t)}o._setTransform(u),H.clone(l,o.position),o.frustum=d.clone(),t.viewport=r}(this,e))};const qge=new Qt(Math.PI,V.PI_OVER_TWO),Yge=new H,Xge=new H,Qge=new ve,$ge=new ve,Kge=new H,Zge=new H,Jge=new Fr;function eye(e,t,n,i){const o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),nye(t),r.createPotentiallyVisibleSet(t),e&&(D(i)&&iye(t,n,i),Hge(t),s||jge(t)),Vge(t,n)}const tye=new Bc;function nye(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),function(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new Jre({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),D(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}(e),function(e){const t=e._frameState,n=t.shadowMaps,i=n.length,o=i>0&&!t.passes.pick&&!t.passes.pickVoxel&&e.mode===gl.SCENE3D;if(o!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=o),t.shadowState.lightShadowsEnabled=!1,o){for(let e=0;e<i;++e)if(n[e]!==t.shadowState.shadowMaps[e]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let e=0;e<i;++e){const i=n[e];i.update(t),t.shadowState.shadowMaps.push(i),i.fromLightSource&&(t.shadowState.lightShadowMaps.push(i),t.shadowState.lightShadowsEnabled=!0),i.dirty&&(++t.shadowState.lastDirtyTime,i.dirty=!1)}}}(e),e._globe&&e._globe.render(t)}function iye(e,t,n){const i=e._context,o=e._frameState,r=e._environmentState,s=e._view,a=e._frameState.passes,c=a.pick||a.pickVoxel;D(s.globeDepth)&&(s.globeDepth.picking=c);const l=r.useWebVR;r.originalFramebuffer=t.framebuffer,D(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!l?e._sunPostProcess=new Xfe:D(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!D(e.sun)&&D(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const u=e._clearColorCommand;Ot.clone(n,u.color),u.execute(i,t);const d=r.useGlobeDepthFramebuffer=D(s.globeDepth);d&&(s.globeDepth.update(i,t,s.viewport,e.msaaSamples,e._hdr,r.clearGlobeDepth),s.globeDepth.clear(i,t,n));const h=s.oit,p=r.useOIT=!c&&D(h)&&h.isSupported();p&&(h.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),h.clear(i,t,n),r.useOIT=h.isSupported());const f=e.postProcessStages;let m=r.usePostProcess=!c&&(e._hdr||f.length>0||f.ambientOcclusion.enabled||f.fxaa.enabled||f.bloom.enabled);r.usePostProcessSelected=!1,m&&(s.sceneFramebuffer.update(i,s.viewport,e._hdr,e.msaaSamples),s.sceneFramebuffer.clear(i,t,n),f.update(i,o.useLogDepth,e._hdr),f.clear(i),m=r.usePostProcess=f.ready,r.usePostProcessSelected=m&&f.hasSelected),r.isSunVisible&&e.sunBloom&&!l?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):d?t.framebuffer=s.globeDepth.framebuffer:m&&(t.framebuffer=s.sceneFramebuffer.framebuffer),D(t.framebuffer)&&u.execute(i,t);if(r.useInvertClassification=!c&&D(t.framebuffer)&&e.invertClassification){let n;if(1===e.frameState.invertClassificationColor.alpha&&r.useGlobeDepthFramebuffer&&(n=s.globeDepth.framebuffer),D(n)||i.depthTexture){if(e._invertClassification.previousFramebuffer=n,e._invertClassification.update(i,e.msaaSamples,s.globeDepth.colorFramebufferManager),e._invertClassification.clear(i,t),e.frameState.invertClassificationColor.alpha<1&&p){const t=e._invertClassification.unclassifiedCommand,n=t.derivedCommands;n.oit=h.createDerivedCommands(t,i,n.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}vge.prototype.updateEnvironment=function(){const e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,o=e.passes.offscreen,r=this.atmosphere,s=this.skyAtmosphere,a=this.globe,c=this._globeTranslucencyState;if(!i||this._mode!==gl.SCENE2D&&t.camera.frustum instanceof Xc||!c.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{if(D(s)){if(D(a))s.setDynamicLighting(jne.fromGlobeFlags(a)),n.isReadyForAtmosphere=n.isReadyForAtmosphere||!a.show||a._surface._tilesToRender.length>0;else{const e=r.dynamicLighting;s.setDynamicLighting(e),n.isReadyForAtmosphere=!0}n.skyAtmosphereCommand=s.update(e,a),D(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)}else n.skyAtmosphereCommand=void 0;n.skyBoxCommand=D(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const i=D(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=D(i)?i.drawCommand:void 0,n.sunComputeCommand=D(i)?i.computeCommand:void 0,n.moonCommand=D(this.moon)?this.moon.update(e):void 0}const l=n.clearGlobeDepth=D(a)&&a.show&&(!a.depthTestAgainstTerrain||this.mode===gl.SCENE2D);(n.useDepthPlane=l&&this.mode===gl.SCENE3D&&c.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==gl.SCENE2D&&!o;const u=e.mode!==gl.SCENE3D||c.sunVisibleThroughGlobe?void 0:e.occluder;let d=e.cullingVolume;const h=tye.planes;for(let m=0;m<5;++m)h[m]=d.planes[m];d=tye,n.isSkyAtmosphereVisible=D(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,d,u),n.isMoonVisible=this.isVisible(n.moonCommand,d,u);const p=this.specularEnvironmentMaps;let f=this._specularEnvironmentMapAtlas;!D(p)||D(f)&&f.url===p?!D(p)&&D(f)&&(f.destroy(),this._specularEnvironmentMapAtlas=void 0):(f=f&&f.destroy(),this._specularEnvironmentMapAtlas=new XT(p)),D(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)},vge.prototype.resolveFramebuffers=function(e){const t=this._context,n=this._environmentState,i=this._view,o=i.globeDepth;D(o)&&o.prepareColorTextures(t);const r=n.useOIT,s=n.useGlobeDepthFramebuffer,a=n.usePostProcess,c=n.originalFramebuffer,l=s?o.colorFramebufferManager:void 0,u=i.sceneFramebuffer._colorFramebuffer,d=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?u.framebuffer:c,i.oit.execute(t,e));const h=i.translucentTileClassification;if(h.hasTranslucentDepth&&h.isSupported()&&h.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let e=u;s&&!r&&(e=l);const n=this.postProcessStages,o=e.getColorTexture(0),a=d.getColorTexture(0),h=M(l,u).getDepthStencilTexture();n.execute(t,o,h,a),n.copy(t,c)}r||a||!s||(e.framebuffer=c,o.executeCopyColor(t,e))},vge.prototype.getHeight=function(e,t){if(!D(e))return;const n=t===wu.CLAMP_TO_TERRAIN||t===wu.RELATIVE_TO_TERRAIN,i=t===wu.CLAMP_TO_3D_TILE||t===wu.RELATIVE_TO_3D_TILE;if(!D(e))return;let o=Number.NEGATIVE_INFINITY;if(!n){const t=this.primitives.length;for(let n=0;n<t;++n){const t=this.primitives.get(n);if(!t.isCesium3DTileset||!t.show||!t.enableCollision)continue;const i=t.getHeight(e,this);D(i)&&i>o&&(o=i)}}const r=this._globe;if(!i&&D(r)&&r.show){const t=r.getHeight(e);t>o&&(o=t)}return o>Number.NEGATIVE_INFINITY?o:void 0};const oye=new Qt;function rye(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),D(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function sye(e){const t=e._frameState;e.primitives.postPassesUpdate(t),Ii.update()}vge.prototype.updateHeight=function(e,t,n){var i;L.typeOf.func("callback",t);const o=()=>{Qt.clone(e,oye);const i=this.getHeight(e,n);D(i)&&(oye.height=i,t(oye))},r=n===wu.CLAMP_TO_TERRAIN||n===wu.RELATIVE_TO_TERRAIN;let s;!(n===wu.CLAMP_TO_3D_TILE||n===wu.RELATIVE_TO_3D_TILE)&&D(this.globe)&&(s=this.globe._surface.updateHeight(e,o));let a={};const c=null==(i=this.globe)?void 0:i.ellipsoid,l=t=>{if(r||t.isDestroyed()||!t.isCesium3DTileset)return;const n=t.updateHeight(e,o,c);a[t.id]=n};if(!r){const e=this.primitives.length;for(let t=0;t<e;++t){l(this.primitives.get(t))}}const u=this.primitives.primitiveAdded.addEventListener(l),d=this.primitives.primitiveRemoved.addEventListener((e=>{!e.isDestroyed()&&e.isCesium3DTileset&&(D(a[e.id])&&a[e.id](),delete a[e.id])}));return()=>{s=s&&s(),Object.values(a).forEach((e=>e())),a={},u(),d()}},vge.prototype.initializeFrame=function(){if(120==this._shaderFrameCount++&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeightDirty){D(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),this._globeHeight=function(e){if(e.mode===gl.MORPHING)return;const t=e.camera.positionCartographic;return e.getHeight(t)}(this),this._globeHeightDirty=!1;const e=this.camera.positionCartographic;this._removeUpdateHeightCallback=this.updateHeight(e,(e=>{this.isDestroyed()||(this._globeHeight=e.height)}))}this._cameraUnderground=function(e){const t=e.camera,n=e._mode,i=e._screenSpaceCameraController,o=t.positionCartographic;if(!D(o))return!1;if(!i.onMap()&&o.height<0)return!0;if(n===gl.SCENE2D||n===gl.MORPHING)return!1;const r=e._globeHeight;return D(r)&&o.height<r}(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),D(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};const aye=new Ot;function cye(e){const t=e._frameState,n=e.context,i=n.uniformState,o=e._defaultView;e._view=o,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=Tge;let r=M(e.backgroundColor,Ot.BLACK);e._hdr&&(r=Ot.clone(r,aye),r.red=Math.pow(r.red,e.gamma),r.green=Math.pow(r.green,e.gamma),r.blue=Math.pow(r.blue,e.gamma)),t.backgroundColor=r,t.atmosphere=e.atmosphere,e.fog.update(t),i.update(t);const s=e.shadowMap;D(s)&&s.enabled&&(!D(e.light)||e.light instanceof yl?H.negate(i.sunDirectionWC,e._shadowMapCamera.direction):H.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;const c=o.passState;c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,c.viewport=Fr.clone(a,c.viewport),D(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,r),e.resolveFramebuffers(c),c.framebuffer=void 0,function(e,t){e.context.uniformState.updatePass(zt.OVERLAY);const n=e.context,i=e._overlayCommandList,o=i.length;for(let r=0;r<o;++r)i[r].execute(n,t)}(e,c),D(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function lye(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function uye(e){return e._picking.updateMostDetailedRayPicks(e)}function dye(e){const t=e._frameState;wge.camera=t.camera,wge.cullingVolume=t.cullingVolume;e.primitives.updateForPass(t,wge)}function hye(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;Ege.camera=e.preloadFlightCamera,Ege.cullingVolume=e.preloadFlightCullingVolume;e.primitives.updateForPass(t,Ege)}function pye(e){e.primitives.updateForPass(e._frameState,xge)}function fye(e){e=M(e,on.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=H.multiplyByScalar(e.radii,1.025,new H);this._scaleMatrix=ve.fromScale(t),this._modelMatrix=new ve,this._command=new Kr({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new H(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new H(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new H;const n=new H;n.x=1.025*e.maximumRadius,n.y=e.maximumRadius,n.z=0,this._radiiAndDynamicAtmosphereColor=n;const i=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return i._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return i._hueSaturationBrightness.x=i.hueShift,i._hueSaturationBrightness.y=i.saturationShift,i._hueSaturationBrightness.z=i.brightnessShift,i._hueSaturationBrightness},u_atmosphereLightIntensity:function(){return i.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return i.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return i.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return i.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return i.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return i.atmosphereMieAnisotropy}}}vge.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,D(e)||(e=Hn.now());const n=this._view.checkForCameraUpdates(this);n&&(this._globeHeightDirty=!0);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===gl.MORPHING;if(!i&&D(this.maximumRenderTimeChange)&&D(this._lastRenderTime)){const t=Math.abs(Hn.secondsDifference(this._lastRenderTime,e));i=i||t>this.maximumRenderTimeChange}if(i){this._lastRenderTime=Hn.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;Ige(this,V.incrementWrap(t.frameNumber,15e6,1),e),t.newFrame=!0}lye(this,rye),this.primitives.show&&(lye(this,uye),lye(this,dye),lye(this,hye),i||lye(this,pye)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),lye(this,cye)),function(e,t){if(e.debugShowFramesPerSecond){if(!D(e._performanceDisplay)){const t=document.createElement("div");t.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(t);const n=new Rae({container:t});e._performanceDisplay=n,e._performanceContainer=t}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else D(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}(this,i),lye(this,sye),function(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())},vge.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)},vge.prototype.requestRender=function(){this._renderRequested=!0},vge.prototype.clampLineWidth=function(e){return Math.max(rs.minimumAliasedLineWidth,Math.min(e,rs.maximumAliasedLineWidth))},vge.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)},vge.prototype.pickVoxel=function(e,t,n){const i=this.pick(e,t,n);if(!D(i))return;const o=i.primitive;if(!(o instanceof W_e))return;const r=this._picking.pickVoxelCoordinate(this,e,t,n),s=255*r[0]+r[1],a=o._traversal.findKeyframeNode(s);if(!D(a))return;const c=255*r[2]+r[3];return nme.fromKeyframeNode(o,s,c,a)},vge.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)},vge.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)},vge.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)},vge.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)},vge.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)},vge.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)},vge.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)},vge.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)},vge.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)},vge.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)},vge.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)},vge.prototype.cartesianToCanvasCoordinates=function(e,t){return QR.wgs84ToWindowCoordinates(this,e,t)},vge.prototype.completeMorph=function(){this._transitioner.completeMorph()},vge.prototype.morphTo2D=function(e){let t;const n=this.globe;t=D(n)?n.ellipsoid:this.mapProjection.ellipsoid,e=M(e,2),this._transitioner.morphTo2D(e,t)},vge.prototype.morphToColumbusView=function(e){let t;const n=this.globe;t=D(n)?n.ellipsoid:this.mapProjection.ellipsoid,e=M(e,2),this._transitioner.morphToColumbusView(e,t)},vge.prototype.morphTo3D=function(e){let t;const n=this.globe;t=D(n)?n.ellipsoid:this.mapProjection.ellipsoid,e=M(e,2),this._transitioner.morphTo3D(e,t)},vge.prototype.setTerrain=function(e){return L.typeOf.object("terrain",e),function(e,t){e._removeTerrainProviderReadyListener=e._removeTerrainProviderReadyListener&&e._removeTerrainProviderReadyListener(),t.ready?D(e.globe)&&(e.globe.terrainProvider=t.provider):(e.globe.terrainProvider=void 0,e._removeTerrainProviderReadyListener=t.readyEvent.addEventListener((t=>{D(e)&&D(e.globe)&&(e.globe.terrainProvider=t),e._removeTerrainProviderReadyListener()})))}(this,e),e},vge.prototype.isDestroyed=function(){return!1},vge.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),D(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(let e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,D(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),He(this)},Object.defineProperties(fye.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),fye.prototype.setDynamicLighting=function(e){this._radiiAndDynamicAtmosphereColor.z=e};const mye=new ve;function _ye(e){this.sources=e.sources,this._sources=void 0,this.show=M(e.show,!0),this._command=new Kr({modelMatrix:ve.clone(ve.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}function gye(){this.show=!0,this._drawCommand=new Kr({primitiveType:Vr.TRIANGLES,boundingVolume:new $u,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new $u,this._boundingVolume2D=new $u,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1,this._useHdr=void 0;const e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}fye.prototype.update=function(e,t){if(!this.show)return;const n=e.mode;if(n!==gl.SCENE3D&&n!==gl.MORPHING)return;if(!e.passes.render)return;const i=ve.fromRotationTranslation(e.context.uniformState.inverseViewRotation,H.ZERO,mye),o=ve.multiplyTransformation(i,gw.Y_UP_TO_Z_UP,mye),r=ve.multiply(this._scaleMatrix,o,mye);ve.clone(r,this._modelMatrix);const s=e.context,a=(c=this,!(V.equalsEpsilon(c.hueShift,0,V.EPSILON7)&&V.equalsEpsilon(c.saturationShift,0,V.EPSILON7)&&V.equalsEpsilon(c.brightnessShift,0,V.EPSILON7)));var c;const l=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||l||!D(t)||!t.show,d=this._command;if(!D(d.vertexArray)){const e=F0.createGeometry(new F0({radii:new H(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Bd.POSITION_ONLY}));d.vertexArray=kl.fromGeometry({context:s,geometry:e,attributeLocations:C_.createAttributeLocations(e),bufferUsage:qe.STATIC_DRAW}),d.renderState=_s.fromCache({cull:{enabled:!0,face:ph.FRONT},blending:dh.ALPHA_BLEND,depthMask:!1})}const h=a|u<<2|l<<3;if(h!==this._flags){this._flags=h;const e=[];a&&e.push("COLOR_CORRECT"),u&&e.push("PER_FRAGMENT_ATMOSPHERE"),l&&e.push("GLOBE_TRANSLUCENT");const t=new bc({defines:e,sources:[H8,X8,"in vec4 position;\n\nout vec3 v_outerPositionWC;\n\n#ifndef PER_FRAGMENT_ATMOSPHERE\nout vec3 v_mieColor;\nout vec3 v_rayleighColor;\nout float v_opacity;\nout float v_translucent;\n#endif\n\nvoid main(void)\n{\n vec4 positionWC = czm_model * position;\n float lightEnum = u_radiiAndDynamicAtmosphereColor.z;\n vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC.xyz, lightEnum);\n\n #ifndef PER_FRAGMENT_ATMOSPHERE\n computeAtmosphereScattering(\n positionWC.xyz,\n lightDirection,\n v_rayleighColor,\n v_mieColor,\n v_opacity,\n v_translucent\n );\n #endif\n\n v_outerPositionWC = positionWC.xyz;\n gl_Position = czm_modelViewProjection * position;\n}\n"]}),n=new bc({defines:e,sources:[H8,X8,"in vec3 v_outerPositionWC;\n\nuniform vec3 u_hsbShift;\n\n#ifndef PER_FRAGMENT_ATMOSPHERE\nin vec3 v_mieColor;\nin vec3 v_rayleighColor;\nin float v_opacity;\nin float v_translucent;\n#endif\n\nvoid main (void)\n{\n float lightEnum = u_radiiAndDynamicAtmosphereColor.z;\n vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_outerPositionWC, lightEnum);\n\n vec3 mieColor;\n vec3 rayleighColor;\n float opacity;\n float translucent;\n\n #ifdef PER_FRAGMENT_ATMOSPHERE\n computeAtmosphereScattering(\n v_outerPositionWC,\n lightDirection,\n rayleighColor,\n mieColor,\n opacity,\n translucent\n );\n #else\n mieColor = v_mieColor;\n rayleighColor = v_rayleighColor;\n opacity = v_opacity;\n translucent = v_translucent;\n #endif\n\n vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity);\n\n #ifndef HDR\n color.rgb = czm_acesTonemapping(color.rgb);\n color.rgb = czm_inverseGamma(color.rgb);\n #endif\n\n #ifdef COLOR_CORRECT\n const bool ignoreBlackPixels = true;\n color.rgb = czm_applyHSBShift(color.rgb, u_hsbShift, ignoreBlackPixels);\n #endif\n\n // For the parts of the sky atmosphere that are not behind a translucent globe,\n // we mix in the default opacity so that the sky atmosphere still appears at distance.\n // This is needed because the opacity in the sky atmosphere is initially adjusted based\n // on the camera height.\n if (translucent == 0.0) {\n color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);\n }\n\n out_FragColor = color;\n}\n"]});this._spSkyAtmosphere=ya.fromCache({context:s,vertexShaderSource:t,fragmentShaderSource:n}),d.shaderProgram=this._spSkyAtmosphere}return d},fye.prototype.isDestroyed=function(){return!1},fye.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),He(this)},_ye.prototype.update=function(e,t){const n=this;if(!this.show)return;if(e.mode!==gl.SCENE3D&&e.mode!==gl.MORPHING)return;if(!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(D(e.positiveX)&&D(e.negativeX)&&D(e.positiveY)&&D(e.negativeY)&&D(e.positiveZ)&&D(e.negativeZ)))throw new P("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new P("this.sources properties must all be the same type.");"string"==typeof e.positiveX?function(e,t,n){if(L.defined("context",e),!(D(t)&&D(t.positiveX)&&D(t.negativeX)&&D(t.positiveY)&&D(t.negativeY)&&D(t.positiveZ)&&D(t.negativeZ)))throw new P("urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");const i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},o=[Bi.createIfNeeded(t.positiveX).fetchImage(i),Bi.createIfNeeded(t.negativeX).fetchImage(i),Bi.createIfNeeded(t.positiveY).fetchImage(i),Bi.createIfNeeded(t.negativeY).fetchImage(i),Bi.createIfNeeded(t.positiveZ).fetchImage(i),Bi.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then((function(t){return new dc({context:e,source:{positiveX:t[0],negativeX:t[1],positiveY:t[2],negativeY:t[3],positiveZ:t[4],negativeZ:t[5]}})}))}(i,this._sources).then((function(e){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=e})):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new dc({context:i,source:e}))}const o=this._command;if(!D(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};const e=Ud.createGeometry(Ud.fromDimensions({dimensions:new H(2,2,2),vertexFormat:Bd.POSITION_ONLY})),t=this._attributeLocations=C_.createAttributeLocations(e);o.vertexArray=kl.fromGeometry({context:i,geometry:e,attributeLocations:t,bufferUsage:qe.STATIC_DRAW}),o.renderState=_s.fromCache({blending:dh.ALPHA_BLEND})}if(!D(o.shaderProgram)||this._useHdr!==t){const e=new bc({defines:[t?"HDR":""],sources:["uniform samplerCube u_cubeMap;\n\nin vec3 v_texCoord;\n\nvoid main()\n{\n vec4 color = czm_textureCube(u_cubeMap, normalize(v_texCoord));\n out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}\n"]});o.shaderProgram=ya.fromCache({context:i,vertexShaderSource:"in vec3 position;\n\nout vec3 v_texCoord;\n\nvoid main()\n{\n vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return D(this._cubeMap)?o:void 0},_ye.prototype.isDestroyed=function(){return!1},_ye.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),He(this)},Object.defineProperties(gye.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const yye=new kt,bye=new kt,vye=new K,Aye=new K;function Tye(e){return lo(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function wye(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,D(e._scene)&&(e._scene.pixelRatio=t),t}function Eye(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const o=wye(e);e._canvasClientWidth=n,e._canvasClientHeight=i,n*=o,i*=o,t.width=n,t.height=i,e._canRender=0!==n&&0!==i,e._lastDevicePixelRatio=window.devicePixelRatio}function xye(e){const t=e._canvas,n=t.width,i=t.height;if(0!==n&&0!==i){const t=e._scene.camera.frustum;D(t.aspectRatio)?t.aspectRatio=n/i:(t.top=t.right*(i/n),t.bottom=-t.top)}}function Sye(e,t){if(!D(e))throw new P("container is required.");e=O8(e),t=M(t,M.EMPTY_OBJECT);const n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);const i=document.createElement("canvas"),o=Ct.supportsImageRenderingPixelated();function r(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=Ct.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1};M(t.blurActiveElementOnCanvasFocus,!0)&&(i.addEventListener("mousedown",r),i.addEventListener("pointerdown",r)),n.appendChild(i);const s=document.createElement("div");s.className="cesium-widget-credits";const a=D(t.creditContainer)?O8(t.creditContainer):n;a.appendChild(s);const c=D(t.creditViewport)?O8(t.creditViewport):n,l=M(t.showRenderLoopErrors,!0),u=M(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=c,this._creditContainer=a,this._innerCreditContainer=s,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=l,this._resolutionScale=1,this._useBrowserRecommendedResolution=u,this._forceResize=!1,this._clock=D(t.clock)?t.clock:new sJ,Eye(this);try{const e=new vge({canvas:i,contextOptions:t.contextOptions,creditContainer:s,creditViewport:c,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:M(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=e,e.camera.constrainedAxis=H.UNIT_Z,wye(this),xye(this);const n=M(e.mapProjection.ellipsoid,on.WGS84);let o=t.globe;D(o)||(o=new Nte(n)),!1!==o&&(e.globe=o,e.globe.shadows=M(t.terrainShadows,k_.RECEIVE_ONLY));let r=t.skyBox;D(r)||(r=new _ye({sources:{positiveX:Tye("px"),negativeX:Tye("mx"),positiveY:Tye("py"),negativeY:Tye("my"),positiveZ:Tye("pz"),negativeZ:Tye("mz")}})),!1!==r&&(e.skyBox=r,e.sun=new gye,e.moon=new pne);let a=t.skyAtmosphere;D(a)||(a=new fye(n),a.show=!1!==t.globe&&o.show),!1!==a&&(e.skyAtmosphere=a);let l=t.baseLayer;if(!1!==t.globe&&!1!==l&&(D(l)||(l=x7.fromWorldImagery()),e.imageryLayers.add(l)),D(t.terrainProvider)&&!1!==t.globe&&(e.terrainProvider=t.terrainProvider),D(t.terrain)&&!1!==t.globe){if(D(t.terrainProvider))throw new P("Specify either options.terrainProvider or options.terrain.");e.setTerrain(t.terrain)}this._screenSpaceEventHandler=new sde(i),D(t.sceneMode)&&(t.sceneMode===gl.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===gl.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=M(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;const u=this;this._onRenderError=function(e,t){if(u._useDefaultRenderLoop=!1,u._renderLoopRunning=!1,u._showRenderLoopErrors){const e="An error occurred while rendering. Rendering has stopped.";u.showErrorPanel(e,void 0,t)}},e.renderError.addEventListener(this._onRenderError)}catch(d){if(l){const e="Error constructing CesiumWidget.",t='Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:';this.showErrorPanel(e,t,d)}throw d}}function Cye(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}gye.prototype.update=function(e,t,n){if(!this.show)return;const i=e.mode;if(i===gl.SCENE2D||i===gl.MORPHING)return;if(!e.passes.render)return;const o=e.context,r=t.viewport.width,s=t.viewport.height;if(!D(this._texture)||r!==this._drawingBufferWidth||s!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=r,this._drawingBufferHeight=s,this._glowFactorDirty=!1,this._useHdr=n;let e=Math.max(r,s);e=Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))-2),e=Math.max(1,e);const t=n?o.halfFloatingPointTexture?ts.HALF_FLOAT:ts.FLOAT:ts.UNSIGNED_BYTE;this._texture=new Sc({context:o,width:e,height:e,pixelFormat:is.RGBA,pixelDatatype:t}),this._glowLengthTS=5*this._glowFactor,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const i=this,a={u_radiusTS:function(){return i._radiusTS}};this._commands.computeCommand=new Ut({fragmentShaderSource:"uniform float u_radiusTS;\n\nin vec2 v_textureCoordinates;\n\nvec2 rotate(vec2 p, vec2 direction)\n{\n return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);\n}\n\nvec4 addBurst(vec2 position, vec2 direction, float lengthScalar)\n{\n vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);\n float radius = length(rotatedPosition) * lengthScalar;\n float burst = 1.0 - smoothstep(0.0, 0.55, radius);\n return vec4(burst);\n}\n\nvoid main()\n{\n float lengthScalar = 2.0 / sqrt(2.0);\n vec2 position = v_textureCoordinates - vec2(0.5);\n float radius = length(position) * lengthScalar;\n float surface = step(radius, u_radiusTS);\n vec4 color = vec4(vec2(1.0), surface + 0.2, surface);\n\n float glow = 1.0 - smoothstep(0.0, 0.55, radius);\n color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;\n\n vec4 burst = vec4(0.0);\n\n // The following loop has been manually unrolled for speed, to\n // avoid sin() and cos().\n //\n //for (float i = 0.4; i < 3.2; i += 1.047) {\n // vec2 direction = vec2(sin(i), cos(i));\n // burst += 0.4 * addBurst(position, direction, lengthScalar);\n //\n // direction = vec2(sin(i - 0.08), cos(i - 0.08));\n // burst += 0.3 * addBurst(position, direction, lengthScalar);\n //}\n\n burst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar); // angle == 0.4\n burst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar); // angle == 0.4 + 1.047\n burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar); // angle == 0.4 + 1.047 * 2.0\n\n burst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar); // angle == 0.4 - 0.08\n burst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar); // angle == 0.4 + 1.047 - 0.08\n burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar); // angle == 0.4 + 1.047 * 2.0 - 0.08\n\n // End of manual loop unrolling.\n\n color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;\n\n out_FragColor = clamp(color, vec4(0.0), vec4(1.0));\n}\n",outputTexture:this._texture,uniformMap:a,persists:!1,owner:this,postExecute:function(){i._commands.computeCommand=void 0}})}const a=this._drawCommand;if(!D(a.vertexArray)){const e={direction:0},t=new Uint8Array(8);t[0]=0,t[1]=0,t[2]=255,t[3]=0,t[4]=255,t[5]=255,t[6]=0,t[7]=255;const n=Ye.createVertexBuffer({context:o,typedArray:t,usage:qe.STATIC_DRAW}),i=[{index:e.direction,vertexBuffer:n,componentsPerAttribute:2,normalize:!0,componentDatatype:Ca.UNSIGNED_BYTE}],r=Ye.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:qe.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});a.vertexArray=new kl({context:o,attributes:i,indexBuffer:r}),a.shaderProgram=ya.fromCache({context:o,vertexShaderSource:"in vec2 direction;\n\nuniform float u_size;\n\nout vec2 v_textureCoordinates;\n\nvoid main() \n{\n vec4 position;\n if (czm_morphTime == 1.0)\n {\n position = vec4(czm_sunPositionWC, 1.0);\n }\n else\n {\n position = vec4(czm_sunPositionColumbusView.zxy, 1.0);\n }\n \n vec4 positionEC = czm_view * position;\n vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n \n vec2 halfSize = vec2(u_size * 0.5);\n halfSize *= ((direction * 2.0) - 1.0);\n \n gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);\n \n v_textureCoordinates = direction;\n}\n",fragmentShaderSource:"uniform sampler2D u_texture;\n\nin vec2 v_textureCoordinates;\n\nvoid main()\n{\n vec4 color = texture(u_texture, v_textureCoordinates);\n out_FragColor = czm_gammaCorrect(color);\n}\n",attributeLocations:e}),a.renderState=_s.fromCache({blending:dh.ALPHA_BLEND}),a.uniformMap=this._uniformMap}const c=o.uniformState.sunPositionWC,l=o.uniformState.sunPositionColumbusView,u=this._boundingVolume,d=this._boundingVolume2D;H.clone(c,u.center),d.center.x=l.z,d.center.y=l.x,d.center.z=l.y,u.radius=V.SOLAR_RADIUS+V.SOLAR_RADIUS*this._glowLengthTS,d.radius=u.radius,i===gl.SCENE3D?$u.clone(u,a.boundingVolume):i===gl.COLUMBUS_VIEW&&$u.clone(d,a.boundingVolume);const h=QR.computeActualWgs84Position(e,c,Aye),p=H.magnitude(H.subtract(h,e.camera.position,Aye)),f=o.uniformState.projection,m=vye;m.x=0,m.y=0,m.z=-p,m.w=1;const _=ve.multiplyByVector(f,m,Aye),g=QR.clipToGLWindowCoordinates(t.viewport,_,yye);m.x=V.SOLAR_RADIUS;const y=ve.multiplyByVector(f,m,Aye),b=QR.clipToGLWindowCoordinates(t.viewport,y,bye);return this._size=kt.magnitude(kt.subtract(b,g,Aye)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands},gye.prototype.isDestroyed=function(){return!1},gye.prototype.destroy=function(){const e=this._drawCommand;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),He(this)},Object.defineProperties(Sye.prototype,{container:{get:function(){return this._container}},canvas:{get:function(){return this._canvas}},creditContainer:{get:function(){return this._creditContainer}},creditViewport:{get:function(){return this._creditViewport}},scene:{get:function(){return this._scene}},imageryLayers:{get:function(){return this._scene.imageryLayers}},terrainProvider:{get:function(){return this._scene.terrainProvider},set:function(e){this._scene.terrainProvider=e}},creditDisplay:{get:function(){return this._scene.frameState.creditDisplay}},camera:{get:function(){return this._scene.camera}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){if(e<=0)throw new P("targetFrameRate must be greater than 0, or undefined.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&function(e){e._renderLoopRunning=!0;let t=0;requestAnimationFrame((function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{const o=e._targetFrameRate;if(D(o)){const r=1e3/o,s=i-t;s>r&&(e.resize(),e.render(),t=i-s%r),requestAnimationFrame(n)}else e.resize(),e.render(),requestAnimationFrame(n)}catch(o){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){const t="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(t,void 0,o)}}else e._renderLoopRunning=!1}))}(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(e<=0)throw new P("resolutionScale must be greater than 0.");this._resolutionScale!==e&&(this._resolutionScale=e,this._forceResize=!0)}},useBrowserRecommendedResolution:{get:function(){return this._useBrowserRecommendedResolution},set:function(e){this._useBrowserRecommendedResolution!==e&&(this._useBrowserRecommendedResolution=e,this._forceResize=!0)}}}),Sye.prototype.showErrorPanel=function(e,t,n){const i=this._element,o=document.createElement("div");o.className="cesium-widget-errorPanel";const r=document.createElement("div");r.className="cesium-widget-errorPanel-content",o.appendChild(r);const s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),r.appendChild(s);const a=document.createElement("div");function c(){a.style.maxHeight=`${Math.max(Math.round(.9*i.clientHeight-100),30)}px`}a.className="cesium-widget-errorPanel-scroll",r.appendChild(a),c(),D(window.addEventListener)&&window.addEventListener("resize",c,!1);const l=D(t),u=D(n);if(l||u){const e=document.createElement("div");if(e.className="cesium-widget-errorPanel-message",a.appendChild(e),u){let e=Q8(n);l||("string"==typeof n&&(n=new Error(n)),t=Q8({name:n.name,message:n.message}),e=n.stack);const i=document.createElement("div");i.className="cesium-widget-errorPanel-message-details collapsed";const o=document.createElement("span");o.className="cesium-widget-errorPanel-more-details",o.appendChild(document.createTextNode("See more...")),i.appendChild(o),i.onclick=function(t){i.removeChild(o),i.appendChild(document.createTextNode(e)),i.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",i.onclick=void 0},a.appendChild(i)}e.innerHTML=`<p>${t}</p>`}const d=document.createElement("div");d.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(d);const h=document.createElement("button");h.setAttribute("type","button"),h.className="cesium-button",h.appendChild(document.createTextNode("OK")),h.onclick=function(){D(c)&&D(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(o)},d.appendChild(h),i.appendChild(o)},Sye.prototype.isDestroyed=function(){return!1},Sye.prototype.destroy=function(){D(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),He(this)},Sye.prototype.resize=function(){const e=this._canvas;(this._forceResize||this._canvasClientWidth!==e.clientWidth||this._canvasClientHeight!==e.clientHeight||this._lastDevicePixelRatio!==window.devicePixelRatio)&&(this._forceResize=!1,Eye(this),xye(this),this._scene.requestRender())},Sye.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};const Iye=new Ir;function Oye(e,t,n,i){const o=i.length;for(let r=0;r<o;++r){const o=i[r];if(o.x===t&&o.y===n&&o.level===e)return!0}return!1}Cye.prototype.addAvailableTileRange=function(e,t,n,i,o){const r=this._tilingScheme,s=this._rootNodes;if(0===e)for(let d=n;d<=o;++d)for(let n=t;n<=i;++n)Oye(e,n,d,s)||s.push(new Mye(r,void 0,0,n,d));r.tileXYToRectangle(t,n,e,Iye);const a=Iye.west,c=Iye.north;r.tileXYToRectangle(i,o,e,Iye);const l=Iye.east,u=new Fye(e,a,Iye.south,l,c);for(let d=0;d<s.length;++d){const e=s[d];Bye(e.extent,u)&&zye(this._maximumLevel,e,u)}},Cye.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(Vye(i.extent,e)){t=i;break}}return D(t)?Hye(void 0,t,e):-1};const Dye=[],Pye=[],Nye=new Ir,Rye=new Ir;Cye.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=Dye;t.length=0,e.east<e.west?(t.push(Ir.fromRadians(-Math.PI,e.south,e.east,e.north,Nye)),t.push(Ir.fromRadians(e.west,e.south,Math.PI,e.north,Rye))):t.push(e);const n=Pye;let i;for(n.length=0,i=0;i<this._rootNodes.length;++i)Gye(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(D(n[i])&&0===n[i].length)return i;return 0};const Lye=new Qt;function Mye(e,t,n,i,o){this.tilingScheme=e,this.parent=t,this.level=n,this.x=i,this.y=o,this.extent=e.tileXYToRectangle(i,o,n),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}function Fye(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function Bye(e,t){const n=Math.max(e.west,t.west),i=Math.max(e.south,t.south),o=Math.min(e.east,t.east);return i<Math.min(e.north,t.north)&&n<o}function zye(e,t,n){for(;t.level<e;)if(kye(t.nw.extent,n))t=t.nw;else if(kye(t.ne.extent,n))t=t.ne;else if(kye(t.sw.extent,n))t=t.sw;else{if(!kye(t.se.extent,n))break;t=t.se}if(0===t.rectangles.length||t.rectangles[t.rectangles.length-1].level<=n.level)t.rectangles.push(n);else{let e=_n(t.rectangles,n.level,Uye);e<0&&(e=~e),t.rectangles.splice(e,0,n)}}function Uye(e,t){return e.level-t}function kye(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function Vye(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function Hye(e,t,n){let i=0,o=!1;for(;!o;){const e=t._nw&&Vye(t._nw.extent,n),r=t._ne&&Vye(t._ne.extent,n),s=t._sw&&Vye(t._sw.extent,n),a=t._se&&Vye(t._se.extent,n);if(e+r+s+a>1){e&&(i=Math.max(i,Hye(t,t._nw,n))),r&&(i=Math.max(i,Hye(t,t._ne,n))),s&&(i=Math.max(i,Hye(t,t._sw,n))),a&&(i=Math.max(i,Hye(t,t._se,n)));break}e?t=t._nw:r?t=t._ne:s?t=t._sw:a?t=t._se:o=!0}for(;t!==e;){const e=t.rectangles;for(let t=e.length-1;t>=0&&e[t].level>i;--t){const o=e[t];Vye(o,n)&&(i=o.level)}t=t.parent}return i}function Gye(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||Bye(t.extent,n[i]);if(!o)return;const r=t.rectangles;for(i=0;i<r.length;++i){const t=r[i];e[t.level]||(e[t.level]=n),e[t.level]=jye(e[t.level],t)}Gye(e,t._nw,n),Gye(e,t._ne,n),Gye(e,t._sw,n),Gye(e,t._se,n)}function jye(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];Bye(o,t)?(o.west<t.west&&n.push(new Ir(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new Ir(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new Ir(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new Ir(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}Cye.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,Iye);return Ir.center(i,Lye),this.computeMaximumLevelAtPosition(Lye)>=e},Cye.prototype.computeChildMaskForTile=function(e,t,n){const i=e+1;if(i>=this._maximumLevel)return 0;let o=0;return o|=this.isTileAvailable(i,2*t,2*n+1)?1:0,o|=this.isTileAvailable(i,2*t+1,2*n+1)?2:0,o|=this.isTileAvailable(i,2*t,2*n)?4:0,o|=this.isTileAvailable(i,2*t+1,2*n)?8:0,o},Object.defineProperties(Mye.prototype,{nw:{get:function(){return this._nw||(this._nw=new Mye(this.tilingScheme,this,this.level+1,2*this.x,2*this.y)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new Mye(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new Mye(this.tilingScheme,this,this.level+1,2*this.x,2*this.y+1)),this._sw}},se:{get:function(){return this._se||(this._se=new Mye(this.tilingScheme,this,this.level+1,2*this.x+1,2*this.y+1)),this._se}}});const Wye={clipTriangleAtAxisAlignedThreshold:function(e,t,n,i,o,r){if(!D(e))throw new P("threshold is required.");if(!D(t))throw new P("keepAbove is required.");if(!D(n))throw new P("u0 is required.");if(!D(i))throw new P("u1 is required.");if(!D(o))throw new P("u2 is required.");let s,a,c;D(r)?r.length=0:r=[],t?(s=n<e,a=i<e,c=o<e):(s=n>e,a=i>e,c=o>e);const l=s+a+c;let u,d,h,p,f,m;return 1===l?s?(u=(e-n)/(i-n),d=(e-n)/(o-n),r.push(1),r.push(2),1!==d&&(r.push(-1),r.push(0),r.push(2),r.push(d)),1!==u&&(r.push(-1),r.push(0),r.push(1),r.push(u))):a?(h=(e-i)/(o-i),p=(e-i)/(n-i),r.push(2),r.push(0),1!==p&&(r.push(-1),r.push(1),r.push(0),r.push(p)),1!==h&&(r.push(-1),r.push(1),r.push(2),r.push(h))):c&&(f=(e-o)/(n-o),m=(e-o)/(i-o),r.push(0),r.push(1),1!==m&&(r.push(-1),r.push(2),r.push(1),r.push(m)),1!==f&&(r.push(-1),r.push(2),r.push(0),r.push(f))):2===l?s||n===e?a||i===e?c||o===e||(d=(e-n)/(o-n),h=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(d),r.push(-1),r.push(1),r.push(2),r.push(h)):(m=(e-o)/(i-o),u=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(m),r.push(-1),r.push(0),r.push(1),r.push(u)):(p=(e-i)/(n-i),f=(e-o)/(n-o),r.push(0),r.push(-1),r.push(1),r.push(0),r.push(p),r.push(-1),r.push(2),r.push(0),r.push(f)):3!==l&&(r.push(0),r.push(1),r.push(2)),r},computeBarycentricCoordinates:function(e,t,n,i,o,r,s,a,c){if(!D(e))throw new P("x is required.");if(!D(t))throw new P("y is required.");if(!D(n))throw new P("x1 is required.");if(!D(i))throw new P("y1 is required.");if(!D(o))throw new P("x2 is required.");if(!D(r))throw new P("y2 is required.");if(!D(s))throw new P("x3 is required.");if(!D(a))throw new P("y3 is required.");const l=n-s,u=s-o,d=r-a,h=i-a,p=1/(d*l+u*h),f=t-a,m=e-s,_=(d*m+u*f)*p,g=(-h*m+l*f)*p,y=1-_-g;return D(c)?(c.x=_,c.y=g,c.z=y,c):new H(_,g,y)},computeLineSegmentLineSegmentIntersection:function(e,t,n,i,o,r,s,a,c){L.typeOf.number("x00",e),L.typeOf.number("y00",t),L.typeOf.number("x01",n),L.typeOf.number("y01",i),L.typeOf.number("x10",o),L.typeOf.number("y10",r),L.typeOf.number("x11",s),L.typeOf.number("y11",a);const l=(a-r)*(n-e)-(s-o)*(i-t);if(0===l)return;const u=((s-o)*(t-r)-(a-r)*(e-o))/l,d=((n-e)*(t-r)-(i-t)*(e-o))/l;return u>=0&&u<=1&&d>=0&&d<=1?(D(c)||(c=new kt),c.x=e+u*(n-e),c.y=t+u*(i-t),c):void 0}},qye=Wye;function Yye(e){if(!D(e)||!D(e.quantizedVertices))throw new P("options.quantizedVertices is required.");if(!D(e.indices))throw new P("options.indices is required.");if(!D(e.minimumHeight))throw new P("options.minimumHeight is required.");if(!D(e.maximumHeight))throw new P("options.maximumHeight is required.");if(!D(e.maximumHeight))throw new P("options.maximumHeight is required.");if(!D(e.boundingSphere))throw new P("options.boundingSphere is required.");if(!D(e.horizonOcclusionPoint))throw new P("options.horizonOcclusionPoint is required.");if(!D(e.westIndices))throw new P("options.westIndices is required.");if(!D(e.southIndices))throw new P("options.southIndices is required.");if(!D(e.eastIndices))throw new P("options.eastIndices is required.");if(!D(e.northIndices))throw new P("options.northIndices is required.");if(!D(e.westSkirtHeight))throw new P("options.westSkirtHeight is required.");if(!D(e.southSkirtHeight))throw new P("options.southSkirtHeight is required.");if(!D(e.eastSkirtHeight))throw new P("options.eastSkirtHeight is required.");if(!D(e.northSkirtHeight))throw new P("options.northSkirtHeight is required.");this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;const t=this._quantizedVertices.length/3,n=this._uValues=this._quantizedVertices.subarray(0,t),i=this._vValues=this._quantizedVertices.subarray(t,2*t);function o(e,t){return i[e]-i[t]}function r(e,t){return n[e]-n[t]}this._heightValues=this._quantizedVertices.subarray(2*t,3*t),this._westIndices=Qye(e.westIndices,o,t),this._southIndices=Qye(e.southIndices,r,t),this._eastIndices=Qye(e.eastIndices,o,t),this._northIndices=Qye(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=M(e.childTileMask,15),this._createdByUpsampling=M(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(Yye.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return D(this._mesh)}}});const Xye=[];function Qye(e,t,n){Xye.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)Xye[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(Xye.sort(t),je.createTypedArray(n,Xye)):e}const $ye="createVerticesFromQuantizedTerrainMesh",Kye=new Qa($ye),Zye=new Qa($ye,m9.maximumAsynchronousTasks);Yye.prototype.createMesh=function(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.tilingScheme",e.tilingScheme),L.typeOf.number("options.x",e.x),L.typeOf.number("options.y",e.y),L.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=M(e.exaggeration,1),s=M(e.exaggerationRelativeHeight,0),a=M(e.throttle,!0),c=t.ellipsoid,l=t.tileXYToRectangle(n,i,o),u=(a?Zye:Kye).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:l,relativeToCenter:this._boundingSphere.center,ellipsoid:c,exaggeration:r,exaggerationRelativeHeight:s});if(!D(u))return;const d=this;return Promise.resolve(u).then((function(e){const t=d._quantizedVertices.length/3,n=t+d._westIndices.length+d._southIndices.length+d._eastIndices.length+d._northIndices.length,i=je.createTypedArray(n,e.indices),o=new Float32Array(e.vertices),r=e.center,s=e.minimumHeight,a=e.maximumHeight,c=d._boundingSphere,l=d._orientedBoundingBox,u=M(H.clone(e.occludeePointInScaledSpace),d._horizonOcclusionPoint),h=e.vertexStride,p=o9.clone(e.encoding);return d._mesh=new _9(r,o,i,e.indexCountWithoutSkirts,t,s,a,c,u,h,l,p,e.westIndicesSouthToNorth,e.southIndicesEastToWest,e.eastIndicesNorthToSouth,e.northIndicesWestToEast),d._quantizedVertices=void 0,d._encodedNormals=void 0,d._indices=void 0,d._uValues=void 0,d._vValues=void 0,d._heightValues=void 0,d._westIndices=void 0,d._southIndices=void 0,d._eastIndices=void 0,d._northIndices=void 0,d._mesh}))};const Jye=new Qa("upsampleQuantizedTerrainMesh",m9.maximumAsynchronousTasks);Yye.prototype.upsample=function(e,t,n,i,o,r,s){if(!D(e))throw new P("tilingScheme is required.");if(!D(t))throw new P("thisX is required.");if(!D(n))throw new P("thisY is required.");if(!D(i))throw new P("thisLevel is required.");if(!D(o))throw new P("descendantX is required.");if(!D(r))throw new P("descendantY is required.");if(!D(s))throw new P("descendantLevel is required.");if(s-i>1)throw new P("Upsampling through more than one level at a time is not currently supported.");const a=this._mesh;if(!D(this._mesh))return;const c=2*t!==o,l=2*n===r,u=e.ellipsoid,d=e.tileXYToRectangle(o,r,s),h=Jye.scheduleTask({vertices:a.vertices,vertexCountWithoutSkirts:a.vertexCountWithoutSkirts,indices:a.indices,indexCountWithoutSkirts:a.indexCountWithoutSkirts,encoding:a.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:c,isNorthChild:l,childRectangle:d,ellipsoid:u});if(!D(h))return;let p=Math.min(this._westSkirtHeight,this._eastSkirtHeight);p=Math.min(p,this._southSkirtHeight),p=Math.min(p,this._northSkirtHeight);const f=c?.5*p:this._westSkirtHeight,m=l?.5*p:this._southSkirtHeight,_=c?this._eastSkirtHeight:.5*p,g=l?this._northSkirtHeight:.5*p,y=this._credits;return Promise.resolve(h).then((function(e){const t=new Uint16Array(e.vertices),n=je.createTypedArray(t.length/3,e.indices);let i;return D(e.encodedNormals)&&(i=new Uint8Array(e.encodedNormals)),new Yye({quantizedVertices:t,indices:n,encodedNormals:i,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,boundingSphere:$u.clone(e.boundingSphere),orientedBoundingBox:zp.clone(e.orientedBoundingBox),horizonOcclusionPoint:H.clone(e.horizonOcclusionPoint),westIndices:e.westIndices,southIndices:e.southIndices,eastIndices:e.eastIndices,northIndices:e.northIndices,westSkirtHeight:f,southSkirtHeight:m,eastSkirtHeight:_,northSkirtHeight:g,childTileMask:0,credits:y,createdByUpsampling:!0})}))};const ebe=32767,tbe=new H;function nbe(e,t,n,i,o,r,s,a){const c=Math.min(n,o,s),l=Math.max(n,o,s),u=Math.min(i,r,a),d=Math.max(i,r,a);return e>=c&&e<=l&&t>=u&&t<=d}Yye.prototype.interpolateHeight=function(e,t,n){let i=V.clamp((t-e.west)/e.width,0,1);i*=ebe;let o=V.clamp((n-e.south)/e.height,0,1);return o*=ebe,D(this._mesh)?function(e,t,n){const i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,c=s.length;a<c;a+=3){const e=s[a],i=s[a+1],c=s[a+2],l=r.decodeTextureCoordinates(o,e,ibe),u=r.decodeTextureCoordinates(o,i,obe),d=r.decodeTextureCoordinates(o,c,rbe);if(nbe(t,n,l.x,l.y,u.x,u.y,d.x,d.y)){const s=qye.computeBarycentricCoordinates(t,n,l.x,l.y,u.x,u.y,d.x,d.y,tbe);if(s.x>=-1e-15&&s.y>=-1e-15&&s.z>=-1e-15){const t=r.decodeHeight(o,e),n=r.decodeHeight(o,i),a=r.decodeHeight(o,c);return s.x*t+s.y*n+s.z*a}}}return}(this,i,o):function(e,t,n){const i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,c=s.length;a<c;a+=3){const c=s[a],l=s[a+1],u=s[a+2],d=i[c],h=i[l],p=i[u],f=o[c],m=o[l],_=o[u];if(nbe(t,n,d,f,h,m,p,_)){const i=qye.computeBarycentricCoordinates(t,n,d,f,h,m,p,_,tbe);if(i.x>=-1e-15&&i.y>=-1e-15&&i.z>=-1e-15){const t=i.x*r[c]+i.y*r[l]+i.z*r[u];return V.lerp(e._minimumHeight,e._maximumHeight,t/ebe)}}}return}(this,i,o)};const ibe=new kt,obe=new kt,rbe=new kt;function sbe(e){this.resource=e.resource,this.version=e.version,this.isHeightmap=e.isHeightmap,this.tileUrlTemplates=e.tileUrlTemplates,this.availability=e.availability,this.hasVertexNormals=e.hasVertexNormals,this.hasWaterMask=e.hasWaterMask,this.hasMetadata=e.hasMetadata,this.availabilityLevels=e.availabilityLevels,this.availabilityTilesLoaded=e.availabilityTilesLoaded,this.littleEndianExtensionSize=e.littleEndianExtensionSize,this.availabilityPromiseCache={}}function abe(e){this.requestVertexNormals=M(e.requestVertexNormals,!1),this.requestWaterMask=M(e.requestWaterMask,!1),this.requestMetadata=M(e.requestMetadata,!0),this.ellipsoid=e.ellipsoid,this.heightmapWidth=65,this.heightmapStructure=void 0,this.hasWaterMask=!1,this.hasMetadata=!1,this.hasVertexNormals=!1,this.scheme=void 0,this.lastResource=void 0,this.layerJsonResource=void 0,this.previousError=void 0,this.availability=void 0,this.tilingScheme=void 0,this.levelZeroMaximumGeometricError=void 0,this.heightmapStructure=void 0,this.layers=[],this.attribution="",this.overallAvailability=[],this.overallMaxZoom=0,this.tileCredits=[]}async function cbe(e,t,n){if(!t.format){const t="The tile format is not specified in the layer.json file.";throw e.previousError=z9.reportError(e.previousError,n,D(n)?n._errorEvent:void 0,t),new be(t)}if(!t.tiles||0===t.tiles.length){const t="The layer.json file does not specify any tile URL templates.";throw e.previousError=z9.reportError(e.previousError,n,D(n)?n._errorEvent:void 0,t),new be(t)}let i=!1,o=!1,r=!1,s=!0,a=!1;if("heightmap-1.0"===t.format)a=!0,D(e.heightmapStructure)||(e.heightmapStructure={heightScale:.2,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:65535}),o=!0,e.requestWaterMask=!0;else if(0!==t.format.indexOf("quantized-mesh-1.")){const i=`The tile format "${t.format}" is invalid or not supported.`;throw e.previousError=z9.reportError(e.previousError,n,D(n)?n._errorEvent:void 0,i),new be(i)}const c=t.tiles,l=t.maxzoom;if(e.overallMaxZoom=Math.max(e.overallMaxZoom,l),t.projection&&"EPSG:4326"!==t.projection){if("EPSG:3857"!==t.projection){const i=`The projection "${t.projection}" is invalid or not supported.`;throw e.previousError=z9.reportError(e.previousError,n,D(n)?n._errorEvent:void 0,i),new be(i)}e.tilingScheme=new $9({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid})}else e.tilingScheme=new Dh({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});if(e.levelZeroMaximumGeometricError=g9.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.tilingScheme.ellipsoid,e.heightmapWidth,e.tilingScheme.getNumberOfXTilesAtLevel(0)),t.scheme&&"tms"!==t.scheme&&"slippyMap"!==t.scheme){const i=`The scheme "${t.scheme}" is invalid or not supported.`;throw e.previousError=z9.reportError(e.previousError,n,D(n)?n._errorEvent:void 0,i),new be(i)}let u;e.scheme=t.scheme,D(t.extensions)&&-1!==t.extensions.indexOf("octvertexnormals")?i=!0:D(t.extensions)&&-1!==t.extensions.indexOf("vertexnormals")&&(i=!0,s=!1),D(t.extensions)&&-1!==t.extensions.indexOf("watermask")&&(o=!0),D(t.extensions)&&-1!==t.extensions.indexOf("metadata")&&(r=!0);const d=t.metadataAvailability,h=t.available;let p;if(D(h)&&!D(d)){p=new Cye(e.tilingScheme,h.length);for(let t=0;t<h.length;++t){const n=h[t],i=e.tilingScheme.getNumberOfYTilesAtLevel(t);D(e.overallAvailability[t])||(e.overallAvailability[t]=[]);for(let o=0;o<n.length;++o){const r=n[o],s=i-r.endY-1,a=i-r.startY-1;e.overallAvailability[t].push([r.startX,s,r.endX,a]),p.addAvailableTileRange(t,r.startX,s,r.endX,a)}}}else D(d)&&(u=new Cye(e.tilingScheme,l),p=new Cye(e.tilingScheme,l),e.overallAvailability[0]=[[0,0,1,0]],p.addAvailableTileRange(0,0,0,1,0));e.hasWaterMask=e.hasWaterMask||o,e.hasVertexNormals=e.hasVertexNormals||i,e.hasMetadata=e.hasMetadata||r,D(t.attribution)&&(e.attribution.length>0&&(e.attribution+=" "),e.attribution+=t.attribution),e.layers.push(new sbe({resource:e.lastResource,version:t.version,isHeightmap:a,tileUrlTemplates:c,availability:p,hasVertexNormals:i,hasWaterMask:o,hasMetadata:r,availabilityLevels:d,availabilityTilesLoaded:u,littleEndianExtensionSize:s}));const f=t.parentUrl;return!D(f)||(!D(p)||(e.lastResource=e.lastResource.getDerivedResource({url:f}),e.lastResource.appendForwardSlash(),e.layerJsonResource=e.lastResource.getDerivedResource({url:"layer.json"}),await lbe(e),!0))}async function lbe(e,t){try{const n=await e.layerJsonResource.fetchJson();return async function(e,t,n){await cbe(e,t,n);const i=e.overallAvailability.length;if(i>0){const t=e.availability=new Cye(e.tilingScheme,e.overallMaxZoom);for(let n=0;n<i;++n){const i=e.overallAvailability[n];for(let e=0;e<i.length;++e){const o=i[e];t.addAvailableTileRange(n,o[0],o[1],o[2],o[3])}}}if(e.attribution.length>0){const t=new YT(e.attribution);e.tileCredits.push(t)}return!0}(e,n,t)}catch(n){return D(n)&&404===n.statusCode?(await cbe(e,{tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]},t),!0):function(e,t,n){let i=`An error occurred while accessing ${e.layerJsonResource.url}.`;if(D(t)&&(i+=`\n${t.message}`),e.previousError=z9.reportError(e.previousError,n,D(n)?n._errorEvent:void 0,i),e.previousError.retry)return lbe(e,n);throw new be(i)}(e,n,t)}}function ube(e){e=M(e,M.EMPTY_OBJECT),this._heightmapWidth=void 0,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._hasMetadata=!1,this._scheme=void 0,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=M(e.requestVertexNormals,!1),this._requestWaterMask=M(e.requestWaterMask,!1),this._requestMetadata=M(e.requestMetadata,!0),this._errorEvent=new gi;let t=e.credit;"string"==typeof t&&(t=new YT(t)),this._credit=t,this._availability=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._layers=void 0,this._tileCredits=void 0}Yye.prototype.isChildAvailable=function(e,t,n,i){if(!D(e))throw new P("thisX is required.");if(!D(t))throw new P("thisY is required.");if(!D(n))throw new P("childX is required.");if(!D(i))throw new P("childY is required.");let o=2;return n!==2*e&&++o,i!==2*t&&(o-=2),!!(this._childTileMask&1<<o)},Yye.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling},abe.prototype.build=function(e){e._heightmapWidth=this.heightmapWidth,e._scheme=this.scheme;const t=D(this.lastResource.credits)?this.lastResource.credits:[];e._tileCredits=t.concat(this.tileCredits),e._availability=this.availability,e._tilingScheme=this.tilingScheme,e._requestWaterMask=this.requestWaterMask,e._levelZeroMaximumGeometricError=this.levelZeroMaximumGeometricError,e._heightmapStructure=this.heightmapStructure,e._layers=this.layers,e._hasWaterMask=this.hasWaterMask,e._hasVertexNormals=this.hasVertexNormals,e._hasMetadata=this.hasMetadata};const dbe=1,hbe=2,pbe=4;function fbe(e){if(!D(e)||0===e.length)return{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"};return{Accept:`application/vnd.quantized-mesh;extensions=${e.join("-")},application/octet-stream;q=0.9,*/*;q=0.01`}}function mbe(e,t,n,i,o,r){if(!D(o))return Promise.reject(new be("Terrain tile doesn't exist"));const s=o.tileUrlTemplates;if(0===s.length)return;let a;if(e._scheme&&"tms"!==e._scheme)a=n;else{a=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1}const c=[];let l,u;e._requestVertexNormals&&o.hasVertexNormals&&c.push(o.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&o.hasWaterMask&&c.push("watermask"),e._requestMetadata&&o.hasMetadata&&c.push("metadata");const d=s[(t+a+i)%s.length],h=o.resource;D(h._ionEndpoint)&&!D(h._ionEndpoint.externalType)?(0!==c.length&&(u={extensions:c.join("-")}),l=fbe(void 0)):l=fbe(c);const p=h.getDerivedResource({url:d,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:u,headers:l,request:r}).fetchArrayBuffer();return D(p)?p.then((function(r){return D(r)?D(e._heightmapStructure)?function(e,t){const n=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new E9({buffer:n,childTileMask:new Uint8Array(t,n.byteLength,1)[0],waterMask:new Uint8Array(t,n.byteLength+1,t.byteLength-n.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}(e,r):function(e,t,n,i,o,r){const s=r.littleEndianExtensionSize;let a=0;const c=3*Float64Array.BYTES_PER_ELEMENT,l=4*Float64Array.BYTES_PER_ELEMENT,u=3*Uint16Array.BYTES_PER_ELEMENT;let d=Uint16Array.BYTES_PER_ELEMENT,h=3*d;const p=new DataView(t),f=new H(p.getFloat64(a,!0),p.getFloat64(a+8,!0),p.getFloat64(a+16,!0));a+=c;const m=p.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const _=p.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const g=new $u(new H(p.getFloat64(a,!0),p.getFloat64(a+8,!0),p.getFloat64(a+16,!0)),p.getFloat64(a+c,!0));a+=l;const y=new H(p.getFloat64(a,!0),p.getFloat64(a+8,!0),p.getFloat64(a+16,!0));a+=c;const b=p.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const v=new Uint16Array(t,a,3*b);a+=b*u,b>65536&&(d=Uint32Array.BYTES_PER_ELEMENT,h=3*d);const A=v.subarray(0,b),T=v.subarray(b,2*b),w=v.subarray(2*b,3*b);sm.zigZagDeltaDecode(A,T,w),a%d!=0&&(a+=d-a%d);const E=p.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const x=je.createTypedArrayFromArrayBuffer(b,t,a,3*E);a+=E*h;let S=0;const C=x.length;for(let D=0;D<C;++D){const e=x[D];x[D]=S-e,0===e&&++S}const I=p.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const O=je.createTypedArrayFromArrayBuffer(b,t,a,I);a+=I*d;const P=p.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const N=je.createTypedArrayFromArrayBuffer(b,t,a,P);a+=P*d;const R=p.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const L=je.createTypedArrayFromArrayBuffer(b,t,a,R);a+=R*d;const M=p.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const F=je.createTypedArrayFromArrayBuffer(b,t,a,M);let B,z;for(a+=M*d;a<p.byteLength;){const c=p.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;const l=p.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,c===dbe&&e._requestVertexNormals)B=new Uint8Array(t,a,2*b);else if(c===hbe&&e._requestWaterMask)z=new Uint8Array(t,a,l);else if(c===pbe&&e._requestMetadata){const s=p.getUint32(a,!0);if(s>0){const i=Ew(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,s).available;if(D(i))for(let t=0;t<i.length;++t){const o=n+t+1,s=i[t],a=e._tilingScheme.getNumberOfYTilesAtLevel(o);for(let t=0;t<s.length;++t){const n=s[t],i=a-n.endY-1,c=a-n.startY-1;e.availability.addAvailableTileRange(o,n.startX,i,n.endX,c),r.availability.addAvailableTileRange(o,n.startX,i,n.endX,c)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=l}const U=5*e.getLevelMaximumGeometricError(n),k=e._tilingScheme.tileXYToRectangle(i,o,n);return new Yye({center:f,minimumHeight:m,maximumHeight:_,boundingSphere:g,orientedBoundingBox:zp.fromRectangle(k,m,_,e._tilingScheme.ellipsoid),horizonOcclusionPoint:y,quantizedVertices:v,encodedNormals:B,indices:x,westIndices:O,southIndices:N,eastIndices:L,northIndices:F,westSkirtHeight:U,southSkirtHeight:U,eastSkirtHeight:U,northSkirtHeight:U,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:z,credits:e._tileCredits})}(e,r,i,t,n,o):Promise.reject(new be("Mesh buffer doesn't exist."))})):void 0}function _be(e,t,n,i){if(0===i)return;const o=e.availabilityLevels,r=i%o==0?i-o:(i/o|0)*o,s=1<<i-r;return{level:r,x:t/s|0,y:n/s|0}}function gbe(e,t,n,i,o,r){if(!D(o.availabilityLevels))return{result:!1};let s;const a=function(){delete o.availabilityPromiseCache[s]},c=o.availabilityTilesLoaded,l=o.availability;let u=_be(o,t,n,i);for(;D(u);){if(l.isTileAvailable(u.level,u.x,u.y)&&!c.isTileAvailable(u.level,u.x,u.y)){let t;if(!r&&(s=`${u.level}-${u.x}-${u.y}`,t=o.availabilityPromiseCache[s],!D(t))){const n=new mi({throttle:!1,throttleByServer:!0,type:fi.TERRAIN});t=mbe(e,u.x,u.y,u.level,o,n),D(t)&&(o.availabilityPromiseCache[s]=t,t.then(a))}return{result:!0,promise:t}}u=_be(o,u.x,u.y,u.level)}return{result:!1}}ube.prototype.requestTileGeometry=function(e,t,n,i){const o=this._layers;let r;const s=o.length;let a=!1,c=Promise.resolve();if(1===s)r=o[0];else for(let l=0;l<s;++l){const i=o[l];if(!D(i.availability)||i.availability.isTileAvailable(n,e,t)){r=i;break}const s=gbe(this,e,t,n,i,0===l);s.result&&(a=!0,c=c.then((()=>s.promise)))}return!D(r)&&a?c.then((()=>new Promise((o=>{setTimeout((()=>{const r=this.requestTileGeometry(e,t,n,i);o(r)}),0)})))):mbe(this,e,t,n,r,i)},Object.defineProperties(ube.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){return this._hasMetadata&&this._requestMetadata}},requestVertexNormals:{get:function(){return this._requestVertexNormals}},requestWaterMask:{get:function(){return this._requestWaterMask}},requestMetadata:{get:function(){return this._requestMetadata}},availability:{get:function(){return this._availability}}}),ube.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)},ube.fromIonAssetId=async function(e,t){L.defined("assetId",e);const n=await pw.fromAssetId(e);return ube.fromUrl(n,t)},ube.fromUrl=async function(e,t){L.defined("url",e),t=M(t,M.EMPTY_OBJECT),e=await Promise.resolve(e);const n=Bi.createIfNeeded(e);n.appendForwardSlash();const i=new abe(t);i.lastResource=n,i.layerJsonResource=i.lastResource.getDerivedResource({url:"layer.json"}),await lbe(i);const o=new ube(t);return i.build(o),o},ube.prototype.getTileDataAvailable=function(e,t,n){if(!D(this._availability))return;if(n>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(n,e,t))return!0;if(!this._hasMetadata)return!1;const i=this._layers,o=i.length;for(let r=0;r<o;++r){if(gbe(this,e,t,n,i[r],0===r).result)return}return!1},ube.prototype.loadTileDataAvailability=function(e,t,n){if(!D(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;const i=this._layers,o=i.length;for(let r=0;r<o;++r){const o=gbe(this,e,t,n,i[r],0===r);if(D(o.promise))return o.promise}},ube._getAvailabilityTile=_be;const ybe=Object.freeze({SEARCH:0,AUTOCOMPLETE:1});function bbe(){P.throwInstantiationError()}function vbe(e){L.defined("url",e),this._url=Bi.createIfNeeded(e),this._url.appendForwardSlash()}function Abe(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.scene",e.scene);const t=M(e.accessToken,hw.defaultAccessToken),n=Bi.createIfNeeded(M(e.server,hw.defaultServer));n.appendForwardSlash();const i=hw.getDefaultTokenCredit(t);D(i)&&e.scene.frameState.creditDisplay.addStaticCredit(YT.clone(i));const o=n.getDerivedResource({url:"v1/geocode"});D(t)&&o.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new vbe(o)}function Tbe(e){return e=M(e,M.EMPTY_OBJECT),ube.fromIonAssetId(1,{requestVertexNormals:M(e.requestVertexNormals,!1),requestWaterMask:M(e.requestWaterMask,!1)})}async function wbe(e,t,n,i){return D(i)||(i=!1),L.typeOf.object("terrainProvider",e),L.typeOf.number("level",t),L.typeOf.bool("rejectOnTileFail",i),L.defined("positions",n),function(e,t,n,i){const o=e.tilingScheme;let r;const s=[],a={};for(r=0;r<n.length;++r){const i=o.positionToTileXY(n[r],t);if(!D(i))continue;const c=i.toString();if(!a.hasOwnProperty(c)){const n={x:i.x,y:i.y,level:t,tilingScheme:o,terrainProvider:e,positions:[]};a[c]=n,s.push(n)}a[c].positions.push(n[r])}const c=[];return Ebe(s,c,i).then((function(){return Promise.all(c).then((function(){return n}))}))}(e,t,n,i)}function Ebe(e,t,n){if(!e.length)return Promise.resolve();const i=function(e,t,n){const i=e[0],o=i.terrainProvider.requestTileGeometry(i.x,i.y,i.level);if(!o)return!1;let r;return r=n?o.then(Sbe(i)):o.then(Sbe(i)).catch(function(e){const t=e.positions;return function(){for(let e=0;e<t.length;++e)t[e].height=void 0}}(i)),e.shift(),t.push(r),!0}(e,t,n);return i?Ebe(e,t):(o=100,new Promise((function(e){setTimeout(e,o)}))).then((()=>Ebe(e,t)));var o}function xbe(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return void 0!==i&&(e.height=i,!0)}function Sbe(e){const t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let o=!1;for(let e=0;e<t.length;++e){if(!xbe(t[e],i,n)){o=!0;break}}return o?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then((function(){for(let e=0;e<t.length;++e){xbe(t[e],i,n)}})):Promise.resolve()}}Object.defineProperties(bbe.prototype,{credit:{get:P.throwInstantiationError}}),bbe.getCreditsFromResult=function(e){if(D(e.attributions))return e.attributions.map(YT.getIonCredit)},bbe.prototype.geocode=P.throwInstantiationError,Object.defineProperties(vbe.prototype,{url:{get:function(){return this._url}},credit:{get:function(){}}}),vbe.prototype.geocode=async function(e,t){L.typeOf.string("query",e);return this._url.getDerivedResource({url:t===ybe.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then((function(e){return e.features.map((function(t){let n;const i=t.bbox;if(D(i))n=Ir.fromDegrees(i[0],i[1],i[2],i[3]);else{const e=t.geometry.coordinates[0],i=t.geometry.coordinates[1];n=H.fromDegrees(e,i)}return{displayName:t.properties.label,destination:n,attributions:e.attributions}}))}))},Object.defineProperties(Abe.prototype,{credit:{get:function(){}}}),Abe.prototype.geocode=async function(e,t){return this._pelias.geocode(e,t)};const Cbe=new kt;async function Ibe(e,t,n){if(D(n)||(n=!1),!D(e))throw new P("terrainProvider is required.");if(!D(t))throw new P("positions is required.");const i=[],o=[],r=e.availability;if(!D(r))throw new P("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");const s=[];for(let c=0;c<t.length;++c){const n=t[c],a=r.computeMaximumLevelAtPosition(n);if(o[c]=a,0===a){e.tilingScheme.positionToTileXY(n,1,Cbe);const t=e.loadTileDataAvailability(Cbe.x,Cbe.y,1);D(t)&&s.push(t)}let l=i[a];D(l)||(i[a]=l=[]),l.push(n)}await Promise.all(s),await Promise.all(i.map((function(t,i){if(D(t))return wbe(e,i,t,n)})));const a=[];for(let c=0;c<t.length;++c){const e=t[c];r.computeMaximumLevelAtPosition(e)!==o[c]&&a.push(e)}return a.length>0&&await Ibe(e,a,n),t}const Obe=new YT("MapQuest, Open Street Map and contributors, CC-BY-SA");function Dbe(e){e=M(e,M.EMPTY_OBJECT);const t=Bi.createIfNeeded(M(e.url,"https://tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}${e.retinaTiles?"@2x":""}.${M(e.fileExtension,"png")}`;const n=new $9({ellipsoid:e.ellipsoid}),i=M(e.minimumLevel,0),o=e.maximumLevel,r=M(e.rectangle,n.rectangle),s=n.positionToTileXY(Ir.southwest(r),i),a=n.positionToTileXY(Ir.northeast(r),i),c=(Math.abs(a.x-s.x)+1)*(Math.abs(a.y-s.y)+1);if(c>4)throw new P(`The rectangle and minimumLevel indicate that there are ${c} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let l=M(e.credit,Obe);"string"==typeof l&&(l=new YT(l)),A6.call(this,{url:t,credit:l,tilingScheme:n,tileWidth:256,tileHeight:256,minimumLevel:i,maximumLevel:o,rectangle:r})}D(Object.create)&&(Dbe.prototype=Object.create(A6.prototype),Dbe.prototype.constructor=Dbe);const Pbe={modifyFragmentShader:function(e){return e=bc.replaceMain(e,"czm_splitter_main"),e+="uniform float czm_splitDirection; \nvoid main() \n{ \n#ifndef SHADOW_MAP\n if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard; \n if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard; \n#endif\n czm_splitter_main(); \n} \n"},addUniforms:function(e,t){t.czm_splitDirection=function(){return e.splitDirection}}},Nbe=0,Rbe=1,Lbe=2,Mbe=3;function Fbe(e){L.typeOf.object("options",e),L.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=Ot.clone(Ot.DARKGRAY),this._highlightColor=Ot.clone(Ot.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=Lbe,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=M(e.opaquePass,zt.OPAQUE),this._cull=M(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=ve.clone(ve.IDENTITY),this._modelMatrix=ve.clone(ve.IDENTITY),this.time=0,this.shadows=k_.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,this.splitDirection=M(e.splitDirection,$R.NONE),this._splittingEnabled=!1,this._error=void 0,function(e,t){const n=mU.parse(t.arrayBuffer,t.byteOffset);e._parsedContent=n,e._rtcCenter=n.rtcCenter,e._hasNormals=n.hasNormals,e._hasColors=n.hasColors,e._hasBatchIds=n.hasBatchIds,e._isTranslucent=n.isTranslucent,!n.hasBatchIds&&D(n.batchTableBinary)&&(n.styleableProperties=Yw.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary));if(D(n.draco)){const t=n.draco;e._decodingState=Nbe,t.dequantizeInShader=e._dequantizeInShader}const i=n.positions;D(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);const o=n.normals;D(o)&&(e._isOctEncoded16P=o.octEncoded);const r=n.colors;D(r)&&(D(r.constantColor)&&(e._constantColor=Ot.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);const s=n.batchIds;D(n.batchIds)&&(s.name="BATCH_ID",s.semantic="BATCH_ID",s.setIndex=void 0);n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary);e._pointsLength=n.pointsLength}(this,e)}Object.defineProperties(Fbe.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},color:{get:function(){return Ot.clone(this._highlightColor)},set:function(e){this._highlightColor=Ot.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(D(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=$u.clone(e,this._boundingSphere)}}});const Bbe=new H,zbe=new H,Ube=new H;let kbe,Vbe;function Hbe(e){const t=e.length/3,n=Math.min(t,20),i=function(e){if(!D(Vbe)){kbe=new B(0),Vbe=new Array(e);for(let t=0;t<e;++t)Vbe[t]=kbe.random()}return Vbe}(20),o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=H.fromElements(o,o,o,Bbe),a=H.fromElements(r,r,r,zbe);for(let l=0;l<n;++l){const n=Math.floor(i[l]*t),o=H.unpack(e,3*n,Ube);H.minimumByComponent(s,o,s),H.maximumByComponent(a,o,a)}const c=$u.fromCornerPoints(s,a);return c.radius+=V.EPSILON2,c}function Gbe(e,t){const n=Ca.fromTypedArray(e);return n===Ca.INT||n===Ca.UNSIGNED_INT||n===Ca.DOUBLE?(Oa("Cast pnts property to floats"),new Float32Array(e)):e}const jbe=new K,Wbe=new K,qbe=new Ot,Ybe=new ve,Xbe=new ve;function Qbe(e,t){const n=/czm_3dtiles_property_(\d+)/g;let i=n.exec(e);for(;null!==i;){const o=parseInt(i[1]);-1===t.indexOf(o)&&t.push(o),i=n.exec(e)}}function $be(e,t){e=e.slice(e.indexOf("\n"));const n=/czm_3dtiles_builtin_property_(\w+)/g;let i=n.exec(e);for(;null!==i;){const o=i[1];-1===t.indexOf(o)&&t.push(o),i=n.exec(e)}}function Kbe(e,t){const n=e.numberOfAttributes;for(let i=0;i<n;++i){const n=e.getAttribute(i);if(n.index===t)return n}}const Zbe={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function Jbe(e,t,n){let i,o,r;const s=t.context,a=D(n),c=e._isQuantized,l=e._isQuantizedDraco,u=e._isOctEncoded16P,d=e._isOctEncodedDraco,h=e._isRGB565,p=e._isTranslucent,f=e._hasColors,m=e._hasNormals,_=e._hasBatchIds,g=e._backFaceCulling,y=e._normalShading,b=e._drawCommand.vertexArray,v=e.clippingPlanes,A=e._attenuation;let T,w,E,x=p;const S=ti(Zbe),C={},I=e._styleableShaderAttributes;for(o in I)I.hasOwnProperty(o)&&(r=I[o],S[o]=`czm_3dtiles_property_${r.location}`,C[r.location]=r);if(a){const e={translucent:!1},t="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";T=n.getColorShaderFunction(`getColorFromStyle${t}`,S,e),w=n.getShowShaderFunction(`getShowFromStyle${t}`,S,e),E=n.getPointSizeShaderFunction(`getPointSizeFromStyle${t}`,S,e),D(T)&&e.translucent&&(x=!0)}e._styleTranslucent=x;const O=D(T),P=D(w),N=D(E),R=e.isClipped,F=[],B=[];O&&(Qbe(T,F),$be(T,B)),P&&(Qbe(w,F),$be(w,B)),N&&(Qbe(E,F),$be(E,B));const z=B.indexOf("COLOR")>=0,U=B.indexOf("NORMAL")>=0;if(U&&!m)throw new be("Style references the NORMAL semantic but the point cloud does not have normals");for(o in I)if(I.hasOwnProperty(o)){r=I[o];const e=F.indexOf(r.location)>=0;Kbe(b,r.location).enabled=e}const k=f&&(!O||z);if(f){Kbe(b,1).enabled=k}const V=m&&(y||g||U);if(m){Kbe(b,2).enabled=V}const G={a_position:0};k&&(G.a_color=1),V&&(G.a_normal=2),_&&(G.a_batchId=3);let j="";const W=F.length;for(i=0;i<W;++i){const e=F[i];r=C[e];const t=r.componentCount,n=`czm_3dtiles_property_${e}`;let o;o=1===t?"float":`vec${t}`,j+=`in ${o} ${n}; \n`,G[n]=r.location}!function(e,t){const n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco;let s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const i=jbe;if(i.x=e._attenuation?e.maximumAttenuation:e._pointSize,i.x*=t.pixelRatio,i.y=e.time,e._attenuation){const o=t.camera.frustum;let r;r=t.mode===gl.SCENE2D||o instanceof Xc?Number.POSITIVE_INFINITY:n.drawingBufferHeight/t.camera.frustum.sseDenominator,i.z=e.geometricError*e.geometricErrorScale,i.w=r}return i},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const t=e.clippingPlanes;return e.isClipped?t.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){const t=e.clippingPlanes;if(!D(t))return Ot.TRANSPARENT;const n=Ot.clone(t.edgeColor,qbe);return n.alpha=t.edgeWidth,n},u_clippingPlanesMatrix:function(){const t=e.clippingPlanes;if(!D(t))return ve.IDENTITY;const i=M(e.clippingPlanesOriginMatrix,e._modelMatrix);ve.multiply(n.uniformState.view3D,i,Ybe);const o=ve.multiply(Ybe,t.modelMatrix,Ybe);return ve.inverseTranspose(o,Xbe)}};Pbe.addUniforms(e,s),(i||o||r)&&(s=ni(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const t=Wbe;if(D(e._quantizedVolumeScale)){const n=H.clone(e._quantizedVolumeScale,t);H.divideByScalar(n,e._quantizedRange,t)}return t.w=e._octEncodedRange,t}})),D(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}(e,t);let q="in vec3 a_position; \nout vec4 v_color; \nuniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \nuniform vec4 u_constantColor; \nuniform vec4 u_highlightColor; \n";q+="float u_pointSize; \nfloat tiles3d_tileset_time; \n",A&&(q+="float u_geometricError; \nfloat u_depthMultiplier; \n"),q+=j,k&&(q+=p?"in vec4 a_color; \n":h?"in 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":"in vec3 a_color; \n"),V&&(q+=u||d?"in vec2 a_normal; \n":"in vec3 a_normal; \n"),_&&(q+="in float a_batchId; \n"),(c||l||d)&&(q+="uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; \n"),O&&(q+=T),P&&(q+=w),N&&(q+=E),q+="void main() \n{ \n u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; \n tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; \n",A&&(q+=" u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; \n u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; \n"),q+=k?p?" vec4 color = a_color; \n":h?" 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",q+=c||l?" vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; \n":" vec3 position = a_position; \n",q+=" vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); \n",V?(q+=u?" vec3 normal = czm_octDecode(a_normal); \n":d?" vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; \n":" vec3 normal = a_normal; \n",q+=" vec3 normalEC = czm_normal * normal; \n"):q+=" vec3 normal = vec3(1.0); \n",O&&(q+=" color = getColorFromStyle(position, position_absolute, color, normal); \n"),P&&(q+=" float show = float(getShowFromStyle(position, position_absolute, color, normal)); \n"),q+=N?" gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; \n":A?" 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",q+=" color = color * u_highlightColor; \n",V&&y&&(q+=" float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); \n diffuseStrength = max(diffuseStrength, 0.4); \n color.xyz *= diffuseStrength * czm_lightColor; \n"),q+=" v_color = color; \n gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n",V&&g&&(q+=" float visible = step(-normalEC.z, 0.0); \n gl_Position *= visible; \n gl_PointSize *= visible; \n"),P&&(q+=" gl_Position.w *= float(show); \n gl_PointSize *= float(show); \n"),q+="} \n";let Y="in vec4 v_color; \n";var X,Q,$;R&&(Y+="uniform highp sampler2D u_clippingPlanes; \nuniform mat4 u_clippingPlanesMatrix; \nuniform vec4 u_clippingPlanesEdgeStyle; \n",Y+="\n",Y+=L9(v,s),Y+="\n"),Y+="void main() \n{ \n out_FragColor = czm_gammaCorrect(v_color); \n",R&&(Y+=(X="u_clippingPlanes",Q="u_clippingPlanesMatrix",$="u_clippingPlanesEdgeStyle",L.typeOf.string("samplerUniformName",X),L.typeOf.string("matrixUniformName",Q),L.typeOf.string("styleUniformName",$),` float clipDistance = clip(gl_FragCoord, ${X}, ${Q}); \n vec4 clippingPlanesEdgeColor = vec4(1.0); \n clippingPlanesEdgeColor.rgb = ${$}.rgb; \n float clippingPlanesEdgeWidth = ${$}.a; \n if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) \n { \n out_FragColor = clippingPlanesEdgeColor;\n } \n`)),Y+="} \n",e.splitDirection!==$R.NONE&&(Y=Pbe.modifyFragmentShader(Y)),D(e._vertexShaderLoaded)&&(q=e._vertexShaderLoaded(q)),D(e._fragmentShaderLoaded)&&(Y=e._fragmentShaderLoaded(Y));const K=e._drawCommand;D(K.shaderProgram)&&K.shaderProgram.destroy(),K.shaderProgram=ya.fromCache({context:s,vertexShaderSource:q,fragmentShaderSource:Y,attributeLocations:G});try{K.shaderProgram._bind()}catch(Z){throw new be("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}const eve=new K,tve=new H;function nve(e){L.typeOf.object("terrainProviderPromise",e),this._ready=!1,this._provider=void 0,this._errorEvent=new gi,this._readyEvent=new gi,async function(e,t){let n;try{n=await Promise.resolve(t),e._provider=n,e._ready=!0,e._readyEvent.raiseEvent(n)}catch(i){!function(e,t){e.numberOfListeners>0&&e.raiseEvent(t)}(e._errorEvent,i)}}(this,e)}function ive(e){e=M(e,M.EMPTY_OBJECT),L.typeOf.object("options.clock",e.clock),L.typeOf.object("options.intervals",e.intervals),this.show=M(e.show,!0),this.modelMatrix=ve.clone(M(e.modelMatrix,ve.IDENTITY)),this.shadows=M(e.shadows,k_.ENABLED),this.maximumMemoryUsage=M(e.maximumMemoryUsage,256),this.shading=new OR(e.shading),this.style=e.style,this.frameFailed=new gi,this.frameChanged=new gi,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new ER,this._loadTimestamp=void 0,this._clippingPlanesState=0,this._styleDirty=!1,this._pickId=void 0,this._totalMemoryUsageInBytes=0,this._frames=[],this._previousInterval=void 0,this._nextInterval=void 0,this._lastRenderedFrame=void 0,this._clockMultiplier=0,this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=new Array(5).fill(0),this._runningAverage=0}function ove(e){return`uniform vec4 czm_pickColor;\n${e}`}function rve(){return"czm_pickColor"}Fbe.prototype.update=function(e){const t=e.context;if(D(this._error)){const e=this._error;throw this._error=void 0,e}const n=function(e,t){if(e._decodingState===Lbe)return!1;if(e._decodingState===Nbe){const n=e._parsedContent,i=n.draco,o=uS.decodePointCloud(i,t);D(o)&&(e._decodingState=Rbe,o.then((function(t){e._decodingState=Lbe;const o=D(t.POSITION)?t.POSITION.array:void 0,r=D(t.RGB)?t.RGB.array:void 0,s=D(t.RGBA)?t.RGBA.array:void 0,a=D(t.NORMAL)?t.NORMAL.array:void 0,c=D(t.BATCH_ID)?t.BATCH_ID.array:void 0,l=D(o)&&D(t.POSITION.data.quantization),u=D(a)&&D(t.NORMAL.data.quantization);if(l){const n=t.POSITION.data.quantization,i=n.range;e._quantizedVolumeScale=H.fromElements(i,i,i),e._quantizedVolumeOffset=H.unpack(n.minValues),e._quantizedRange=(1<<n.quantizationBits)-1,e._isQuantizedDraco=!0}u&&(e._octEncodedRange=(1<<t.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let d=n.styleableProperties;const h=i.batchTableProperties;for(const e in h)if(h.hasOwnProperty(e)){const n=t[e];D(d)||(d={}),d[e]={typedArray:n.array,componentCount:n.data.componentsPerAttribute}}D(o)&&(n.positions={typedArray:o});const p=M(s,r);D(p)&&(n.colors={typedArray:p}),D(a)&&(n.normals={typedArray:a}),D(c)&&(n.batchIds={typedArray:c}),n.styleableProperties=d})).catch((function(t){e._decodingState=Mbe,e._error=t})))}return!0}(this,t);if(n)return;let i=!1,o=!ve.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),D(this._drawCommand)||(!function(e,t){const n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,c=i.batchIds,l=i.styleableProperties,u=D(l),d=e._isQuantized,h=e._isQuantizedDraco,p=e._isOctEncoded16P,f=e._isOctEncodedDraco,m=e._quantizedRange,_=e._octEncodedRange,g=e._isRGB565,y=e._isTranslucent,b=e._hasColors,v=e._hasNormals,A=e._hasBatchIds;let T,w;const E=[],x={};if(e._styleableShaderAttributes=x,u){let t=4;for(const i in l)if(l.hasOwnProperty(i)){const o=l[i],r=Gbe(o.typedArray);T=o.componentCount,w=Ca.fromTypedArray(r);const s=Ye.createVertexBuffer({context:n,typedArray:r,usage:qe.STATIC_DRAW});e._geometryByteLength+=s.sizeInBytes;const a={index:t,vertexBuffer:s,componentsPerAttribute:T,componentDatatype:w,normalize:!1,offsetInBytes:0,strideInBytes:0};E.push(a),x[i]={location:t,componentCount:T},++t}}const S=Ye.createVertexBuffer({context:n,typedArray:r.typedArray,usage:qe.STATIC_DRAW});let C,I,O;e._geometryByteLength+=S.sizeInBytes,b&&(C=Ye.createVertexBuffer({context:n,typedArray:s.typedArray,usage:qe.STATIC_DRAW}),e._geometryByteLength+=C.sizeInBytes),v&&(I=Ye.createVertexBuffer({context:n,typedArray:a.typedArray,usage:qe.STATIC_DRAW}),e._geometryByteLength+=I.sizeInBytes),A&&(c.typedArray=Gbe(c.typedArray),O=Ye.createVertexBuffer({context:n,typedArray:c.typedArray,usage:qe.STATIC_DRAW}),e._geometryByteLength+=O.sizeInBytes);let P=[];if(w=d?Ca.UNSIGNED_SHORT:h?m<=255?Ca.UNSIGNED_BYTE:Ca.UNSIGNED_SHORT:Ca.FLOAT,P.push({index:0,vertexBuffer:S,componentsPerAttribute:3,componentDatatype:w,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(e._boundingSphere=d||h?$u.fromCornerPoints(H.ZERO,e._quantizedVolumeScale):Hbe(r.typedArray)),b)if(g)P.push({index:1,vertexBuffer:C,componentsPerAttribute:1,componentDatatype:Ca.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const e=y?4:3;P.push({index:1,vertexBuffer:C,componentsPerAttribute:e,componentDatatype:Ca.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}v&&(p?(T=2,w=Ca.UNSIGNED_BYTE):f?(T=2,w=_<=255?Ca.UNSIGNED_BYTE:Ca.UNSIGNED_SHORT):(T=3,w=Ca.FLOAT),P.push({index:2,vertexBuffer:I,componentsPerAttribute:T,componentDatatype:w,normalize:!1,offsetInBytes:0,strideInBytes:0})),A&&P.push({index:3,vertexBuffer:O,componentsPerAttribute:1,componentDatatype:Ca.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),u&&(P=P.concat(E));const N=new kl({context:n,attributes:P}),R={depthTest:{enabled:!0}},L={depthTest:{enabled:!0},depthMask:!1,blending:dh.ALPHA_BLEND};e._opaquePass===zt.CESIUM_3D_TILE&&(R.stencilTest=sy.setCesium3DTileBit(),R.stencilMask=sy.CESIUM_3D_TILE_MASK,L.stencilTest=sy.setCesium3DTileBit(),L.stencilMask=sy.CESIUM_3D_TILE_MASK),e._opaqueRenderState=_s.fromCache(R),e._translucentRenderState=_s.fromCache(L),e._drawCommand=new Kr({boundingVolume:new $u,cull:e._cull,modelMatrix:new ve,primitiveType:Vr.POINTS,vertexArray:N,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:y?e._translucentRenderState:e._opaqueRenderState,pass:y?zt.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}(this,e),o=!0,i=!0,this._ready=!0,this._parsedContent=void 0),o){ve.clone(this.modelMatrix,this._modelMatrix);const t=this._drawCommand.modelMatrix;if(ve.clone(this._modelMatrix,t),D(this._rtcCenter)&&ve.multiplyByTranslation(t,this._rtcCenter,t),D(this._quantizedVolumeOffset)&&ve.multiplyByTranslation(t,this._quantizedVolumeOffset,t),e.mode!==gl.SCENE3D){const n=e.mapProjection,i=ve.getColumn(t,3,eve);K.equals(i,K.UNIT_W)||Cr.basisTo2D(n,t,t)}const n=this._drawCommand.boundingVolume;if($u.clone(this._boundingSphere,n),this._cull){const e=n.center;ve.multiplyByPoint(t,e,e);const i=ve.getScale(t,tve);n.radius*=H.maximumComponent(i)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,i=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,i=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,i=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,i=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,i=!0);const r=this.splitDirection!==$R.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&Jbe(this,e,this._style),this._drawCommand.castShadows=k_.castShadows(this.shadows),this._drawCommand.receiveShadows=k_.receiveShadows(this.shadows);const s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?zt.TRANSLUCENT:this._opaquePass;const a=e.commandList,c=e.passes;(c.render||c.pick)&&a.push(this._drawCommand)},Fbe.prototype.isDestroyed=function(){return!1},Fbe.prototype.destroy=function(){const e=this._drawCommand;return D(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),He(this)},Object.defineProperties(nve.prototype,{errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}}}),nve.fromWorldTerrain=function(e){return new nve(Tbe(e))},nve.fromWorldBathymetry=function(e){return new nve(function(e){return e=M(e,M.EMPTY_OBJECT),ube.fromIonAssetId(2426648,{requestVertexNormals:M(e.requestVertexNormals,!1)})}(e))},Object.defineProperties(ive.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){qI.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(D(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}}}),ive.prototype.makeStyleDirty=function(){this._styleDirty=!0},ive.prototype._getAverageLoadTime=function(){return 0===this._runningLength?.05:this._runningAverage};const sve=new Hn;function ave(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function cve(e,t){return e._intervals.indexOf(t.start)}function lve(e,t){return function(n){const i=D(n.message)?n.message:n.toString();e.frameFailed.numberOfListeners>0&&e.frameFailed.raiseEvent({uri:t,message:i})}}function uve(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);const o=t.pointCloud;if(D(o)&&!t.ready){const r=i.commandList,s=r.length;if(pve(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){!function(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}(e,(rJ()-t.timestamp)/1e3)}}t.touchedFrameNumber=i.frameNumber}const dve=new ve;const hve=new OR;function pve(e,t,n,i){const o=M(e.shading,hve),r=t.pointCloud,s=M(t.transform,ve.IDENTITY);r.modelMatrix=ve.multiplyTransformation(e.modelMatrix,s,dve),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=function(e,t){const n=e.shading;return D(n)&&D(n.baseResolution)?n.baseResolution:D(t.boundingSphere)?V.cbrt(t.boundingSphere.volume()/t.pointsLength):0}(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=function(e){const t=e.shading;return D(t)&&D(t.maximumAttenuation)?t.maximumAttenuation:10}(e);try{r.update(i)}catch(a){lve(e,t.uri)(a)}t.touchedFrameNumber=i.frameNumber}function fve(e,t,n,i){const o=function(e,t,n){const i=cve(e,t),o=e._frames;let r=o[i];if(!D(r)){const s=t.data.transform,a=D(s)?ve.fromArray(s):void 0,c=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:rJ(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber,uri:c},o[i]=r,Bi.fetchArrayBuffer({url:c}).then((function(t){var n;r.pointCloud=new Fbe({arrayBuffer:t,cull:!0,fragmentShaderLoaded:ove,uniformMapLoaded:(n=e,function(e){return ni(e,{czm_pickColor:function(){return n._pickId.color}})}),pickIdLoaded:rve})})).catch(lve(e,c))}return r}(e,t,i);uve(e,o,n,i)}function mve(e,t){const n=e._frames,i=n.length;for(let o=0;o<i;++o){const i=n[o];if(D(i)&&(!D(t)||t(i))){const t=i.pointCloud;i.ready&&(e._totalMemoryUsageInBytes-=t.geometryByteLength),D(t)&&t.destroy(),i===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function _ve(e,t,n,i,o){return!!D(n)&&(!!n.ready||(fve(e,t,i,o),n.ready))}const gve={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};async function yve(e,t){const n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid;let r;const s=t.camera.getRectangleCameraCoordinates(e);if(r=t.mode===gl.SCENE3D?o.cartesianToCartographic(s):i.unproject(s),!D(n))return r;if(!D(n.availability)||t.mode===gl.SCENE2D)return r;const a=[Ir.center(e),Ir.southeast(e),Ir.southwest(e),Ir.northeast(e),Ir.northwest(e)],c=await yve._sampleTerrainMostDetailed(n,a);let l=!1;const u=c.reduce((function(e,t){return D(t.height)?(l=!0,Math.max(t.height,e)):e}),-Number.MAX_VALUE),d=r;return l&&(d.height+=u),d}var bve;ive.prototype.update=function(e){if(e.mode===gl.MORPHING)return;if(!this.show)return;D(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),D(this._loadTimestamp)||(this._loadTimestamp=Hn.clone(e.time));const t=Math.max(1e3*Hn.secondsDifference(e.time,this._loadTimestamp),0),n=this._clippingPlanes;let i=0,o=!1;const r=D(n)&&n.enabled;r&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,o=!0);const s=this._styleDirty;this._styleDirty=!1,(o||s)&&function(e,t,n){const i=e._frames,o=i.length;for(let r=0;r<o;++r){const e=i[r];D(e)&&D(e.pointCloud)&&(e.pointCloud.clippingPlanesDirty=t,e.pointCloud.styleDirty=n)}}(this,o,s),gve.timeSinceLoad=t,gve.isClipped=r;const a=this.shading,c=this._pointCloudEyeDomeLighting,l=e.commandList,u=l.length;let d=this._previousInterval,h=this._nextInterval;const p=function(e){const t=e._intervals,n=e._clock.currentTime,i=t.indexOf(n);return t.get(i)}(this);if(!D(p))return;let f=!1;const m=ave(this),_=0===m;m!==this._clockMultiplier&&(f=!0,this._clockMultiplier=m),D(d)&&!_||(d=p),(!D(h)||f||function(e,t,n){const i=ave(e),o=cve(e,t),r=cve(e,n);return i>=0?o>=r:o<=r}(this,p,h))&&(h=function(e,t){const n=e._intervals,i=e._clock,o=ave(e);if(0===o)return;const r=e._getAverageLoadTime(),s=Hn.addSeconds(i.currentTime,r*o,sve);let a=n.indexOf(s);return a===cve(e,t)&&(o>=0?++a:--a),n.get(a)}(this,p)),d=function(e,t,n,i,o){let r,s,a;const c=e._intervals,l=e._frames,u=cve(e,n),d=cve(e,t);if(u>=d){for(r=u;r>=d;--r)if(s=c.get(r),a=l[r],_ve(e,s,a,i,o))return s}else for(r=u;r<=d;++r)if(s=c.get(r),a=l[r],_ve(e,s,a,i,o))return s;return t}(this,d,p,gve,e);let g=function(e,t){const n=cve(e,t),i=e._frames[n];if(D(i)&&i.ready)return i}(this,d);D(g)||(fve(this,d,gve,e),g=this._lastRenderedFrame),D(g)&&pve(this,g,gve,e),D(h)&&fve(this,h,gve,e);const y=this;D(g)&&!D(this._lastRenderedFrame)&&e.afterRender.push((function(){return!0})),D(g)&&g!==this._lastRenderedFrame&&y.frameChanged.numberOfListeners>0&&e.afterRender.push((function(){return y.frameChanged.raiseEvent(y),!0})),this._previousInterval=d,this._nextInterval=h,this._lastRenderedFrame=g;this._totalMemoryUsageInBytes>1024*this.maximumMemoryUsage*1024&&mve(this,function(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}(e));const b=l.length-u;D(a)&&a.attenuation&&a.eyeDomeLighting&&b>0&&c.update(e,u,a,this.boundingSphere)},ive.prototype.isDestroyed=function(){return!1},ive.prototype.destroy=function(){return mve(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),He(this)},yve._sampleTerrainMostDetailed=Ibe,"undefined"!=typeof ko&&(bve=ko),function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,o=t.jQuery,r=t.JSON;o||"undefined"==typeof jQuery||(o=jQuery),function(s,a){function c(e,t){return(null===e||typeof e in A)&&e===t}function l(t,n){var i;return function(){i||(i=v.a.setTimeout((function(){i=e,t()}),n))}}function u(e,t){var n;return function(){clearTimeout(n),n=v.a.setTimeout(e,t)}}function d(e,t){t&&"change"!==t?"beforeChange"===t?this.pc(e):this.gb(e,t):this.qc(e)}function h(e,t){null!==t&&t.s&&t.s()}function p(e,t){var n=this.qd,i=n[S];i.ra||(this.Qb&&this.mb[t]?(n.uc(t,e,this.mb[t]),this.mb[t]=null,--this.Qb):i.I[t]||n.uc(t,e,i.J?{da:e}:n.$c(e)),e.Ja&&e.gd())}var f,m,_,g,y,b,v=void 0!==s?s:{};v.b=function(e,t){for(var n=e.split("."),i=v,o=0;o<n.length-1;o++)i=i[n[o]];i[n[n.length-1]]=t},v.L=function(e,t,n){e[t]=n},v.version="3.5.1",v.b("version",v.version),v.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},v.a=function(){function s(e,t){for(var n in e)u.call(e,n)&&t(n,e[n])}function a(e,t){if(t)for(var n in t)u.call(t,n)&&(e[n]=t[n]);return e}function c(e,t){return e.__proto__=t,e}function l(e,t,n,i){var o=e[t].match(y)||[];v.a.D(n.match(y),(function(e){v.a.Na(o,e,i)})),e[t]=o.join(" ")}var u=Object.prototype.hasOwnProperty,d={__proto__:[]}instanceof Array,h="function"==typeof Symbol,p={},f={};p[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],p.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),s(p,(function(e,t){if(t.length)for(var n=0,i=t.length;n<i;n++)f[t[n]]=e}));var m,_={propertychange:!0},g=n&&function(){for(var t=3,i=n.createElement("div"),o=i.getElementsByTagName("i");i.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",o[0];);return 4<t?t:e}(),y=/\S+/g;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(e,t,n){for(var i=0,o=e.length;i<o;i++)t.call(n,e[i],i,e)},A:"function"==typeof Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t)}:function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1},Lb:function(t,n,i){for(var o=0,r=t.length;o<r;o++)if(n.call(i,t[o],o,t))return t[o];return e},Pa:function(e,t){var n=v.a.A(e,t);0<n?e.splice(n,1):0===n&&e.shift()},wc:function(e){var t=[];return e&&v.a.D(e,(function(e){0>v.a.A(t,e)&&t.push(e)})),t},Mb:function(e,t,n){var i=[];if(e)for(var o=0,r=e.length;o<r;o++)i.push(t.call(n,e[o],o));return i},jb:function(e,t,n){var i=[];if(e)for(var o=0,r=e.length;o<r;o++)t.call(n,e[o],o)&&i.push(e[o]);return i},Nb:function(e,t){if(t instanceof Array)e.push.apply(e,t);else for(var n=0,i=t.length;n<i;n++)e.push(t[n]);return e},Na:function(e,t,n){var i=v.a.A(v.a.bc(e),t);0>i?n&&e.push(t):n||e.splice(i,1)},Ba:d,extend:a,setPrototypeOf:c,Ab:d?c:a,P:s,Ga:function(e,t,n){if(!e)return e;var i,o={};for(i in e)u.call(e,i)&&(o[i]=t.call(n,e[i],i,e));return o},Tb:function(e){for(;e.firstChild;)v.removeNode(e.firstChild)},Yb:function(e){for(var t=((e=v.a.la(e))[0]&&e[0].ownerDocument||n).createElement("div"),i=0,o=e.length;i<o;i++)t.appendChild(v.oa(e[i]));return t},Ca:function(e,t){for(var n=0,i=e.length,o=[];n<i;n++){var r=e[n].cloneNode(!0);o.push(t?v.oa(r):r)}return o},va:function(e,t){if(v.a.Tb(e),t)for(var n=0,i=t.length;n<i;n++)e.appendChild(t[n])},Xc:function(e,t){var n=e.nodeType?[e]:e;if(0<n.length){for(var i=n[0],o=i.parentNode,r=0,s=t.length;r<s;r++)o.insertBefore(t[r],i);for(r=0,s=n.length;r<s;r++)v.removeNode(n[r])}},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 n=e[0],i=e[e.length-1];for(e.length=0;n!==i;)e.push(n),n=n.nextSibling;e.push(i)}}return e},Zc:function(e,t){7>g?e.setAttribute("selected",t):e.selected=t},Db:function(t){return null===t||t===e?"":t.trim?t.trim():t.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(e,t){return e=e||"",!(t.length>e.length)&&e.substring(0,t.length)===t},vd: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));for(;e&&e!=t;)e=e.parentNode;return!!e},Sb:function(e){return v.a.vd(e,e.ownerDocument.documentElement)},kd:function(e){return!!v.a.Lb(e,v.a.Sb)},R:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},Ac:function(e){return v.onError?function(){try{return e.apply(this,arguments)}catch(t){throw v.onError&&v.onError(t),t}}:e},setTimeout:function(e,t){return setTimeout(v.a.Ac(e),t)},Gc:function(e){setTimeout((function(){throw v.onError&&v.onError(e),e}),0)},B:function(e,t,n){var i=v.a.Ac(n);if(n=_[t],v.options.useOnlyNativeEvents||n||!o)if(n||"function"!=typeof e.addEventListener){if(void 0===e.attachEvent)throw Error("Browser doesn't support addEventListener or attachEvent");var r=function(t){i.call(e,t)},s="on"+t;e.attachEvent(s,r),v.a.K.za(e,(function(){e.detachEvent(s,r)}))}else e.addEventListener(t,i,!1);else m||(m="function"==typeof o(e).on?"on":"bind"),o(e)[m](t,i)},Fb:function(e,i){if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var r;if(r=!("input"!==v.a.R(e)||!e.type||"click"!=i.toLowerCase()||"checkbox"!=(r=e.type)&&"radio"!=r),v.options.useOnlyNativeEvents||!o||r)if("function"==typeof n.createEvent){if("function"!=typeof e.dispatchEvent)throw Error("The supplied element doesn't support dispatchEvent");(r=n.createEvent(f[i]||"HTMLEvents")).initEvent(i,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(r)}else if(r&&e.click)e.click();else{if(void 0===e.fireEvent)throw Error("Browser doesn't support triggering events");e.fireEvent("on"+i)}else o(e).trigger(i)},f:function(e){return v.O(e)?e():e},bc:function(e){return v.O(e)?e.v():e},Eb:function(e,t,n){var i;t&&("object"==typeof e.classList?(i=e.classList[n?"add":"remove"],v.a.D(t.match(y),(function(t){i.call(e.classList,t)}))):"string"==typeof e.className.baseVal?l(e.className,"baseVal",t,n):l(e,"className",t,n))},Bb:function(t,n){var i=v.a.f(n);null!==i&&i!==e||(i="");var o=v.h.firstChild(t);!o||3!=o.nodeType||v.h.nextSibling(o)?v.h.va(t,[t.ownerDocument.createTextNode(i)]):o.data=i,v.a.Ad(t)},Yc:function(e,t){if(e.name=t,7>=g)try{var i=e.name.replace(/[&<>'"]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}));e.mergeAttributes(n.createElement("<input name='"+i+"'/>"),!1)}catch(o){}},Ad:function(e){9<=g&&(e=1==e.nodeType?e:e.parentNode).style&&(e.style.zoom=e.style.zoom)},wd:function(e){if(g){var t=e.style.width;e.style.width=0,e.style.width=t}},Pd:function(e,t){e=v.a.f(e),t=v.a.f(t);for(var n=[],i=e;i<=t;i++)n.push(i);return n},la:function(e){for(var t=[],n=0,i=e.length;n<i;n++)t.push(e[n]);return t},Da:function(e){return h?Symbol(e):e},Zd:6===g,$d:7===g,W:g,Lc:function(e,t){for(var n=v.a.la(e.getElementsByTagName("input")).concat(v.a.la(e.getElementsByTagName("textarea"))),i="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},o=[],r=n.length-1;0<=r;r--)i(n[r])&&o.push(n[r]);return o},Nd:function(e){return"string"==typeof e&&(e=v.a.Db(e))?r&&r.parse?r.parse(e):new Function("return "+e)():null},hc:function(e,t,n){if(!r||!r.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return r.stringify(v.a.f(e),t,n)},Od:function(e,t,i){var o=(i=i||{}).params||{},r=i.includeFields||this.Jc,a=e;if("object"==typeof e&&"form"===v.a.R(e)){a=e.action;for(var c=r.length-1;0<=c;c--)for(var l=v.a.Lc(e,r[c]),u=l.length-1;0<=u;u--)o[l[u].name]=l[u].value}t=v.a.f(t);var d=n.createElement("form");for(var h in d.style.display="none",d.action=a,d.method="post",t)(e=n.createElement("input")).type="hidden",e.name=h,e.value=v.a.hc(v.a.f(t[h])),d.appendChild(e);s(o,(function(e,t){var i=n.createElement("input");i.type="hidden",i.name=e,i.value=t,d.appendChild(i)})),n.body.appendChild(d),i.submitter?i.submitter(d):d.submit(),setTimeout((function(){d.parentNode.removeChild(d)}),0)}}}(),v.b("utils",v.a),v.b("utils.arrayForEach",v.a.D),v.b("utils.arrayFirst",v.a.Lb),v.b("utils.arrayFilter",v.a.jb),v.b("utils.arrayGetDistinctValues",v.a.wc),v.b("utils.arrayIndexOf",v.a.A),v.b("utils.arrayMap",v.a.Mb),v.b("utils.arrayPushAll",v.a.Nb),v.b("utils.arrayRemoveItem",v.a.Pa),v.b("utils.cloneNodes",v.a.Ca),v.b("utils.createSymbolOrString",v.a.Da),v.b("utils.extend",v.a.extend),v.b("utils.fieldsIncludedWithJsonPost",v.a.Jc),v.b("utils.getFormFields",v.a.Lc),v.b("utils.objectMap",v.a.Ga),v.b("utils.peekObservable",v.a.bc),v.b("utils.postJson",v.a.Od),v.b("utils.parseJson",v.a.Nd),v.b("utils.registerEventHandler",v.a.B),v.b("utils.stringifyJson",v.a.hc),v.b("utils.range",v.a.Pd),v.b("utils.toggleDomNodeCssClass",v.a.Eb),v.b("utils.triggerEvent",v.a.Fb),v.b("utils.unwrapObservable",v.a.f),v.b("utils.objectForEach",v.a.P),v.b("utils.addOrRemoveItem",v.a.Na),v.b("utils.setTextContent",v.a.Bb),v.b("unwrap",v.a.f),Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(1===arguments.length)return function(){return t.apply(e,arguments)};var n=Array.prototype.slice.call(arguments,1);return function(){var i=n.slice(0);return i.push.apply(i,arguments),t.apply(e,i)}}),v.a.g=new function(){var t,n,i=0,o="__ko__"+(new Date).getTime(),r={};return v.a.W?(t=function(t,n){var s=t[o];if(!s||"null"===s||!r[s]){if(!n)return e;s=t[o]="ko"+i++,r[s]={}}return r[s]},n=function(e){var t=e[o];return!!t&&(delete r[t],e[o]=null,!0)}):(t=function(e,t){var n=e[o];return!n&&t&&(n=e[o]={}),n},n=function(e){return!!e[o]&&(delete e[o],!0)}),{get:function(e,n){var i=t(e,!1);return i&&i[n]},set:function(n,i,o){(n=t(n,o!==e))&&(n[i]=o)},Ub:function(e,n,i){return(e=t(e,!0))[n]||(e[n]=i)},clear:n,Z:function(){return i+++o}}},v.b("utils.domData",v.a.g),v.b("utils.domData.clear",v.a.g.clear),v.a.K=new function(){function t(t,n){var i=v.a.g.get(t,r);return i===e&&n&&(i=[],v.a.g.set(t,r,i)),i}function n(e){if(n=t(e,!1))for(var n=n.slice(0),o=0;o<n.length;o++)n[o](e);v.a.g.clear(e),v.a.K.cleanExternalData(e),a[e.nodeType]&&i(e.childNodes,!0)}function i(e,t){for(var i,o=[],r=0;r<e.length;r++)if((!t||8===e[r].nodeType)&&(n(o[o.length]=i=e[r]),e[r]!==i))for(;r--&&-1==v.a.A(o,e[r]););}var r=v.a.g.Z(),s={1:!0,8:!0,9:!0},a={1:!0,9:!0};return{za:function(e,n){if("function"!=typeof n)throw Error("Callback must be a function");t(e,!0).push(n)},yb:function(n,i){var o=t(n,!1);o&&(v.a.Pa(o,i),0==o.length&&v.a.g.set(n,r,e))},oa:function(e){return v.u.G((function(){s[e.nodeType]&&(n(e),a[e.nodeType]&&i(e.getElementsByTagName("*")))})),e},removeNode:function(e){v.oa(e),e.parentNode&&e.parentNode.removeChild(e)},cleanExternalData:function(e){o&&"function"==typeof o.cleanData&&o.cleanData([e])}}},v.oa=v.a.K.oa,v.removeNode=v.a.K.removeNode,v.b("cleanNode",v.oa),v.b("removeNode",v.removeNode),v.b("utils.domNodeDisposal",v.a.K),v.b("utils.domNodeDisposal.addDisposeCallback",v.a.K.za),v.b("utils.domNodeDisposal.removeDisposeCallback",v.a.K.yb),f=[0,"",""],y={thead:m=[1,"<table>","</table>"],tbody:m,tfoot:m,tr:[2,"<table><tbody>","</tbody></table>"],td:_=[3,"<table><tbody><tr>","</tr></tbody></table>"],th:_,option:g=[1,"<select multiple='multiple'>","</select>"],optgroup:g},b=8>=v.a.W,v.a.ua=function(e,i){var r;if(o){if(o.parseHTML)r=o.parseHTML(e,i)||[];else if((r=o.clean([e],i))&&r[0]){for(var s=r[0];s.parentNode&&11!==s.parentNode.nodeType;)s=s.parentNode;s.parentNode&&s.parentNode.removeChild(s)}}else{(r=i)||(r=n),s=r.parentWindow||r.defaultView||t;var a,c=v.a.Db(e).toLowerCase(),l=r.createElement("div");for(a=(c=c.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&y[c[1]]||f,c=a[0],a="ignored<div>"+a[1]+e+a[2]+"</div>","function"==typeof s.innerShiv?l.appendChild(s.innerShiv(a)):(b&&r.body.appendChild(l),l.innerHTML=a,b&&l.parentNode.removeChild(l));c--;)l=l.lastChild;r=v.a.la(l.lastChild.childNodes)}return r},v.a.Md=function(e,t){var n=v.a.ua(e,t);return n.length&&n[0].parentElement||v.a.Yb(n)},v.a.fc=function(t,n){if(v.a.Tb(t),null!==(n=v.a.f(n))&&n!==e)if("string"!=typeof n&&(n=n.toString()),o)o(t).html(n);else for(var i=v.a.ua(n,t.ownerDocument),r=0;r<i.length;r++)t.appendChild(i[r])},v.b("utils.parseHtmlFragment",v.a.ua),v.b("utils.setHtml",v.a.fc),v.aa=function(){function t(e,n){if(e)if(8==e.nodeType)null!=(i=v.aa.Uc(e.nodeValue))&&n.push({ud:e,Kd:i});else if(1==e.nodeType)for(var i=0,o=e.childNodes,r=o.length;i<r;i++)t(o[i],n)}var n={};return{Xb: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);return n[t]=e,"\x3c!--[ko_memo:"+t+"]--\x3e"},bd:function(t,i){var o=n[t];if(o===e)throw Error("Couldn't find any memo with ID "+t+". Perhaps it's already been unmemoized.");try{return o.apply(null,i||[]),!0}finally{delete n[t]}},cd:function(e,n){var i=[];t(e,i);for(var o=0,r=i.length;o<r;o++){var s=i[o].ud,a=[s];n&&v.a.Nb(a,n),v.aa.bd(i[o].Kd,a),s.nodeValue="",s.parentNode&&s.parentNode.removeChild(s)}},Uc:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:null}}}(),v.b("memoization",v.aa),v.b("memoization.memoize",v.aa.Xb),v.b("memoization.unmemoize",v.aa.bd),v.b("memoization.parseMemoText",v.aa.Uc),v.b("memoization.unmemoizeDomNodeAndDescendants",v.aa.cd),v.na=function(){function e(){if(c)for(var e,t=c,n=0;u<c;)if(e=a[u++]){if(u>t){if(5e3<=++n){u=c,v.a.Gc(Error("'Too much recursion' after processing "+n+" task groups."));break}t=c}try{e()}catch(i){v.a.Gc(i)}}}function i(){e(),u=c=a.length=0}var o,r,s,a=[],c=0,l=1,u=0;return t.MutationObserver?(r=i,s=n.createElement("div"),new MutationObserver(r).observe(s,{attributes:!0}),o=function(){s.classList.toggle("foo")}):o=n&&"onreadystatechange"in n.createElement("script")?function(e){var t=n.createElement("script");t.onreadystatechange=function(){t.onreadystatechange=null,n.documentElement.removeChild(t),t=null,e()},n.documentElement.appendChild(t)}:function(e){setTimeout(e,0)},{scheduler:o,zb:function(e){return c||v.na.scheduler(i),a[c++]=e,l++},cancel:function(e){(e-=l-c)>=u&&e<c&&(a[e]=null)},resetForTesting:function(){var e=c-u;return u=c=a.length=0,e},Sd:e}}(),v.b("tasks",v.na),v.b("tasks.schedule",v.na.zb),v.b("tasks.runEarly",v.na.Sd),v.Ta={throttle:function(e,t){e.throttleEvaluation=t;var n=null;return v.$({read:e,write:function(i){clearTimeout(n),n=v.a.setTimeout((function(){e(i)}),t)}})},rateLimit:function(e,t){var n,i,o;"number"==typeof t?n=t:(n=t.timeout,i=t.method),e.Hb=!1,o="function"==typeof i?i:"notifyWhenChangesStop"==i?u:l,e.ub((function(e){return o(e,n,t)}))},deferred:function(t,n){if(!0!==n)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");t.Hb||(t.Hb=!0,t.ub((function(n){var i,o=!1;return function(){if(!o){v.na.cancel(i),i=v.na.zb(n);try{o=!0,t.notifySubscribers(e,"dirty")}finally{o=!1}}}})))},notify:function(e,t){e.equalityComparer="always"==t?null:c}};var A={undefined:1,boolean:1,number:1,string:1};v.b("extenders",v.Ta),v.ic=function(e,t,n){this.da=e,this.lc=t,this.mc=n,this.Ib=!1,this.fb=this.Jb=null,v.L(this,"dispose",this.s),v.L(this,"disposeWhenNodeIsRemoved",this.l)},v.ic.prototype.s=function(){this.Ib||(this.fb&&v.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},v.ic.prototype.l=function(e){this.Jb=e,v.a.K.za(e,this.fb=this.s.bind(this))},v.T=function(){v.a.Ab(this,T),T.qb(this)};var T={qb:function(e){e.U={change:[]},e.sc=1},subscribe:function(e,t,n){var i=this;n=n||"change";var o=new v.ic(i,t?e.bind(t):e,(function(){v.a.Pa(i.U[n],o),i.hb&&i.hb(n)}));return i.Qa&&i.Qa(n),i.U[n]||(i.U[n]=[]),i.U[n].push(o),o},notifySubscribers:function(e,t){if("change"===(t=t||"change")&&this.Gb(),this.Wa(t)){var n="change"===t&&this.ed||this.U[t].slice(0);try{v.u.xc();for(var i,o=0;i=n[o];++o)i.Ib||i.lc(e)}finally{v.u.end()}}},ob:function(){return this.sc},Dd:function(e){return this.ob()!==e},Gb:function(){++this.sc},ub:function(e){var t,n,i,o,r,s=this,a=v.O(s);s.gb||(s.gb=s.notifySubscribers,s.notifySubscribers=d);var c=e((function(){s.Ja=!1,a&&o===s&&(o=s.nc?s.nc():s());var e=n||r&&s.sb(i,o);r=n=t=!1,e&&s.gb(i=o)}));s.qc=function(e,n){n&&s.Ja||(r=!n),s.ed=s.U.change.slice(0),s.Ja=t=!0,o=e,c()},s.pc=function(e){t||(i=e,s.gb(e,"beforeChange"))},s.rc=function(){r=!0},s.gd=function(){s.sb(i,s.v(!0))&&(n=!0)}},Wa:function(e){return this.U[e]&&this.U[e].length},Bd:function(e){if(e)return this.U[e]&&this.U[e].length||0;var t=0;return v.a.P(this.U,(function(e,n){"dirty"!==e&&(t+=n.length)})),t},sb:function(e,t){return!this.equalityComparer||!this.equalityComparer(e,t)},toString:function(){return"[object Object]"},extend:function(e){var t=this;return e&&v.a.P(e,(function(e,n){var i=v.Ta[e];"function"==typeof i&&(t=i(t,n)||t)})),t}};v.L(T,"init",T.qb),v.L(T,"subscribe",T.subscribe),v.L(T,"extend",T.extend),v.L(T,"getSubscriptionsCount",T.Bd),v.a.Ba&&v.a.setPrototypeOf(T,Function.prototype),v.T.fn=T,v.Qc=function(e){return null!=e&&"function"==typeof e.subscribe&&"function"==typeof e.notifySubscribers},v.b("subscribable",v.T),v.b("isSubscribable",v.Qc),v.S=v.u=function(){function e(e){i.push(n),n=e}function t(){n=i.pop()}var n,i=[],o=0;return{xc:e,end:t,cc:function(e){if(n){if(!v.Qc(e))throw Error("Only subscribable things can act as dependencies");n.od.call(n.pd,e,e.fd||(e.fd=++o))}},G:function(n,i,o){try{return e(),n.apply(i,o||[])}finally{t()}},qa:function(){if(n)return n.o.qa()},Va:function(){if(n)return n.o.Va()},Ya:function(){if(n)return n.Ya},o:function(){if(n)return n.o}}}(),v.b("computedContext",v.S),v.b("computedContext.getDependenciesCount",v.S.qa),v.b("computedContext.getDependencies",v.S.Va),v.b("computedContext.isInitial",v.S.Ya),v.b("computedContext.registerDependency",v.S.cc),v.b("ignoreDependencies",v.Yd=v.u.G);var w=v.a.Da("_latestValue");v.ta=function(e){function t(){return 0<arguments.length?(t.sb(t[w],arguments[0])&&(t.ya(),t[w]=arguments[0],t.xa()),this):(v.u.cc(t),t[w])}return t[w]=e,v.a.Ba||v.a.extend(t,v.T.fn),v.T.fn.qb(t),v.a.Ab(t,E),v.options.deferUpdates&&v.Ta.deferred(t,!0),t};var E={equalityComparer:c,v:function(){return this[w]},xa:function(){this.notifySubscribers(this[w],"spectate"),this.notifySubscribers(this[w])},ya:function(){this.notifySubscribers(this[w],"beforeChange")}};v.a.Ba&&v.a.setPrototypeOf(E,v.T.fn);var x=v.ta.Ma="__ko_proto__";E[x]=v.ta,v.O=function(e){if((e="function"==typeof e&&e[x])&&e!==E[x]&&e!==v.o.fn[x])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!e},v.Za=function(e){return"function"==typeof e&&(e[x]===E[x]||e[x]===v.o.fn[x]&&e.Nc)},v.b("observable",v.ta),v.b("isObservable",v.O),v.b("isWriteableObservable",v.Za),v.b("isWritableObservable",v.Za),v.b("observable.fn",E),v.L(E,"peek",E.v),v.L(E,"valueHasMutated",E.xa),v.L(E,"valueWillMutate",E.ya),v.Ha=function(e){if("object"!=typeof(e=e||[])||!("length"in e))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return e=v.ta(e),v.a.Ab(e,v.Ha.fn),e.extend({trackArrayChanges:!0})},v.Ha.fn={remove:function(e){for(var t=this.v(),n=[],i="function"!=typeof e||v.O(e)?function(t){return t===e}:e,o=0;o<t.length;o++){var r=t[o];if(i(r)){if(0===n.length&&this.ya(),t[o]!==r)throw Error("Array modified during remove; cannot remove item");n.push(r),t.splice(o,1),o--}}return n.length&&this.xa(),n},removeAll:function(t){if(t===e){var n=this.v(),i=n.slice(0);return this.ya(),n.splice(0,n.length),this.xa(),i}return t?this.remove((function(e){return 0<=v.a.A(t,e)})):[]},destroy:function(e){var t=this.v(),n="function"!=typeof e||v.O(e)?function(t){return t===e}:e;this.ya();for(var i=t.length-1;0<=i;i--){var o=t[i];n(o)&&(o._destroy=!0)}this.xa()},destroyAll:function(t){return t===e?this.destroy((function(){return!0})):t?this.destroy((function(e){return 0<=v.a.A(t,e)})):[]},indexOf:function(e){var t=this();return v.a.A(t,e)},replace:function(e,t){var n=this.indexOf(e);0<=n&&(this.ya(),this.v()[n]=t,this.xa())},sorted:function(e){var t=this().slice(0);return e?t.sort(e):t.sort()},reversed:function(){return this().slice(0).reverse()}},v.a.Ba&&v.a.setPrototypeOf(v.Ha.fn,v.ta.fn),v.a.D("pop push reverse shift sort splice unshift".split(" "),(function(e){v.Ha.fn[e]=function(){var t=this.v();this.ya(),this.zc(t,e,arguments);var n=t[e].apply(t,arguments);return this.xa(),n===t?this:n}})),v.a.D(["slice"],(function(e){v.Ha.fn[e]=function(){var t=this();return t[e].apply(t,arguments)}})),v.Pc=function(e){return v.O(e)&&"function"==typeof e.remove&&"function"==typeof e.push},v.b("observableArray",v.Ha),v.b("isObservableArray",v.Pc),v.Ta.trackArrayChanges=function(t,n){function i(){function e(){if(l){var e,n=[].concat(t.v()||[]);t.Wa("arrayChange")&&((!c||1<l)&&(c=v.a.Pb(s,n,t.Ob)),e=c),s=n,c=null,l=0,e&&e.length&&t.notifySubscribers(e,"arrayChange")}}a?e():(a=!0,r=t.subscribe((function(){++l}),null,"spectate"),s=[].concat(t.v()||[]),c=null,o=t.subscribe(e))}if(t.Ob={},n&&"object"==typeof n&&v.a.extend(t.Ob,n),t.Ob.sparse=!0,!t.zc){var o,r,s,a=!1,c=null,l=0,u=t.Qa,d=t.hb;t.Qa=function(e){u&&u.call(t,e),"arrayChange"===e&&i()},t.hb=function(n){d&&d.call(t,n),"arrayChange"!==n||t.Wa("arrayChange")||(o&&o.s(),r&&r.s(),r=o=null,a=!1,s=e)},t.zc=function(e,t,n){function i(e,t,n){return o[o.length]={status:e,value:t,index:n}}if(a&&!l){var o=[],r=e.length,s=n.length,u=0;switch(t){case"push":u=r;case"unshift":for(t=0;t<s;t++)i("added",n[t],u+t);break;case"pop":u=r-1;case"shift":r&&i("deleted",e[u],u);break;case"splice":t=Math.min(Math.max(0,0>n[0]?r+n[0]:n[0]),r),r=1===s?r:Math.min(t+(n[1]||0),r),s=t+s-2,u=Math.max(r,s);for(var d=[],h=[],p=2;t<u;++t,++p)t<r&&h.push(i("deleted",e[t],t)),t<s&&d.push(i("added",n[p],t));v.a.Kc(h,d);break;default:return}c=o}}}};var S=v.a.Da("_state");v.o=v.$=function(t,n,i){function o(){if(0<arguments.length){if("function"!=typeof r)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 r.apply(s.nb,arguments),this}return s.ra||v.u.cc(o),(s.ka||s.J&&o.Xa())&&o.ha(),s.X}if("object"==typeof t?i=t:(i=i||{},t&&(i.read=t)),"function"!=typeof i.read)throw Error("Pass a function that returns the value of the ko.computed");var r=i.write,s={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:i.read,nb:n||i.owner,l:i.disposeWhenNodeIsRemoved||i.l||null,Sa:i.disposeWhen||i.Sa,Rb:null,I:{},V:0,Ic:null};return o[S]=s,o.Nc="function"==typeof r,v.a.Ba||v.a.extend(o,v.T.fn),v.T.fn.qb(o),v.a.Ab(o,C),i.pure?(s.wb=!0,s.J=!0,v.a.extend(o,I)):i.deferEvaluation&&v.a.extend(o,O),v.options.deferUpdates&&v.Ta.deferred(o,!0),s.l&&(s.jc=!0,s.l.nodeType||(s.l=null)),s.J||i.deferEvaluation||o.ha(),s.l&&o.ja()&&v.a.K.za(s.l,s.Rb=function(){o.s()}),o};var C={equalityComparer:c,qa:function(){return this[S].V},Va:function(){var e=[];return v.a.P(this[S].I,(function(t,n){e[n.Ka]=n.da})),e},Vb:function(e){if(!this[S].V)return!1;var t=this.Va();return-1!==v.a.A(t,e)||!!v.a.Lb(t,(function(t){return t.Vb&&t.Vb(e)}))},uc:function(e,t,n){if(this[S].wb&&t===this)throw Error("A 'pure' computed must not be called recursively");this[S].I[e]=n,n.Ka=this[S].V++,n.La=t.ob()},Xa:function(){var e,t,n=this[S].I;for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e],this.Ia&&t.da.Ja||t.da.Dd(t.La)))return!0},Jd:function(){this.Ia&&!this[S].rb&&this.Ia(!1)},ja:function(){var e=this[S];return e.ka||0<e.V},Rd:function(){this.Ja?this[S].ka&&(this[S].sa=!0):this.Hc()},$c:function(e){if(e.Hb){var t=e.subscribe(this.Jd,this,"dirty"),n=e.subscribe(this.Rd,this);return{da:e,s:function(){t.s(),n.s()}}}return e.subscribe(this.Hc,this)},Hc:function(){var e=this,t=e.throttleEvaluation;t&&0<=t?(clearTimeout(this[S].Ic),this[S].Ic=v.a.setTimeout((function(){e.ha(!0)}),t)):e.Ia?e.Ia(!0):e.ha(!0)},ha:function(e){var t=this[S],n=t.Sa,i=!1;if(!t.rb&&!t.ra){if(t.l&&!v.a.Sb(t.l)||n&&n()){if(!t.jc)return void this.s()}else t.jc=!1;t.rb=!0;try{i=this.zd(e)}finally{t.rb=!1}return i}},zd:function(t){var n=this[S],i=!1,o=n.wb?e:!n.V;i={qd:this,mb:n.I,Qb:n.V},v.u.xc({pd:i,od:p,o:this,Ya:o}),n.I={},n.V=0;var r=this.yd(n,i);return n.V?i=this.sb(n.X,r):(this.s(),i=!0),i&&(n.J?this.Gb():this.notifySubscribers(n.X,"beforeChange"),n.X=r,this.notifySubscribers(n.X,"spectate"),!n.J&&t&&this.notifySubscribers(n.X),this.rc&&this.rc()),o&&this.notifySubscribers(n.X,"awake"),i},yd:function(e,t){try{var n=e.Wc;return e.nb?n.call(e.nb):n()}finally{v.u.end(),t.Qb&&!e.J&&v.a.P(t.mb,h),e.sa=e.ka=!1}},v:function(e){var t=this[S];return(t.ka&&(e||!t.V)||t.J&&this.Xa())&&this.ha(),t.X},ub:function(e){v.T.fn.ub.call(this,e),this.nc=function(){return this[S].J||(this[S].sa?this.ha():this[S].ka=!1),this[S].X},this.Ia=function(e){this.pc(this[S].X),this[S].ka=!0,e&&(this[S].sa=!0),this.qc(this,!e)}},s:function(){var t=this[S];!t.J&&t.I&&v.a.P(t.I,(function(e,t){t.s&&t.s()})),t.l&&t.Rb&&v.a.K.yb(t.l,t.Rb),t.I=e,t.V=0,t.ra=!0,t.sa=!1,t.ka=!1,t.J=!1,t.l=e,t.Sa=e,t.Wc=e,this.Nc||(t.nb=e)}},I={Qa:function(e){var t=this,n=t[S];if(!n.ra&&n.J&&"change"==e){if(n.J=!1,n.sa||t.Xa())n.I=null,n.V=0,t.ha()&&t.Gb();else{var i=[];v.a.P(n.I,(function(e,t){i[t.Ka]=e})),v.a.D(i,(function(e,i){var o=n.I[e],r=t.$c(o.da);r.Ka=i,r.La=o.La,n.I[e]=r})),t.Xa()&&t.ha()&&t.Gb()}n.ra||t.notifySubscribers(n.X,"awake")}},hb:function(t){var n=this[S];n.ra||"change"!=t||this.Wa("change")||(v.a.P(n.I,(function(e,t){t.s&&(n.I[e]={da:t.da,Ka:t.Ka,La:t.La},t.s())})),n.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var e=this[S];return e.J&&(e.sa||this.Xa())&&this.ha(),v.T.fn.ob.call(this)}},O={Qa:function(e){"change"!=e&&"beforeChange"!=e||this.v()}};v.a.Ba&&v.a.setPrototypeOf(C,v.T.fn);var D=v.ta.Ma;C[D]=v.o,v.Oc=function(e){return"function"==typeof e&&e[D]===C[D]},v.Fd=function(e){return v.Oc(e)&&e[S]&&e[S].wb},v.b("computed",v.o),v.b("dependentObservable",v.o),v.b("isComputed",v.Oc),v.b("isPureComputed",v.Fd),v.b("computed.fn",C),v.L(C,"peek",C.v),v.L(C,"dispose",C.s),v.L(C,"isActive",C.ja),v.L(C,"getDependenciesCount",C.qa),v.L(C,"getDependencies",C.Va),v.xb=function(e,t){return"function"==typeof e?v.o(e,t,{pure:!0}):((e=v.a.extend({},e)).pure=!0,v.o(e,t))},v.b("pureComputed",v.xb),function(){function t(o,r,s){if(s=s||new i,"object"!=typeof(o=r(o))||null===o||o===e||o instanceof RegExp||o instanceof Date||o instanceof String||o instanceof Number||o instanceof Boolean)return o;var a=o instanceof Array?[]:{};return s.save(o,a),n(o,(function(n){var i=r(o[n]);switch(typeof i){case"boolean":case"number":case"string":case"function":a[n]=i;break;case"object":case"undefined":var c=s.get(i);a[n]=c!==e?c:t(i,r,s)}})),a}function n(e,t){if(e instanceof Array){for(var n=0;n<e.length;n++)t(n);"function"==typeof e.toJSON&&t("toJSON")}else for(n in e)t(n)}function i(){this.keys=[],this.values=[]}v.ad=function(e){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return t(e,(function(e){for(var t=0;v.O(e)&&10>t;t++)e=e();return e}))},v.toJSON=function(e,t,n){return e=v.ad(e),v.a.hc(e,t,n)},i.prototype={constructor:i,save:function(e,t){var n=v.a.A(this.keys,e);0<=n?this.values[n]=t:(this.keys.push(e),this.values.push(t))},get:function(t){return 0<=(t=v.a.A(this.keys,t))?this.values[t]:e}}}(),v.b("toJS",v.ad),v.b("toJSON",v.toJSON),v.Wd=function(e,t,n){function i(t){var i=v.xb(e,n).extend({ma:"always"}),o=i.subscribe((function(e){e&&(o.s(),t(e))}));return i.notifySubscribers(i.v()),o}return"function"!=typeof Promise||t?i(t.bind(n)):new Promise(i)},v.b("when",v.Wd),v.w={M:function(t){switch(v.a.R(t)){case"option":return!0===t.__ko__hasDomDataOptionValue__?v.a.g.get(t,v.c.options.$b):7>=v.a.W?t.getAttributeNode("value")&&t.getAttributeNode("value").specified?t.value:t.text:t.value;case"select":return 0<=t.selectedIndex?v.w.M(t.options[t.selectedIndex]):e;default:return t.value}},cb:function(t,n,i){switch(v.a.R(t)){case"option":"string"==typeof n?(v.a.g.set(t,v.c.options.$b,e),"__ko__hasDomDataOptionValue__"in t&&delete t.__ko__hasDomDataOptionValue__,t.value=n):(v.a.g.set(t,v.c.options.$b,n),t.__ko__hasDomDataOptionValue__=!0,t.value="number"==typeof n?n:"");break;case"select":""!==n&&null!==n||(n=e);for(var o,r=-1,s=0,a=t.options.length;s<a;++s)if((o=v.w.M(t.options[s]))==n||""===o&&n===e){r=s;break}(i||0<=r||n===e&&1<t.size)&&(t.selectedIndex=r,6===v.a.W&&v.a.setTimeout((function(){t.selectedIndex=r}),0));break;default:null!==n&&n!==e||(n=""),t.value=n}}},v.b("selectExtensions",v.w),v.b("selectExtensions.readValue",v.w.M),v.b("selectExtensions.writeValue",v.w.cb),v.m=function(){function e(e){123===(e=v.a.Db(e)).charCodeAt(0)&&(e=e.slice(1,-1));var t,n=[],s=(e+="\n,").match(i),a=[],c=0;if(1<s.length){for(var l,u=0;l=s[u];++u){var d=l.charCodeAt(0);if(44===d){if(0>=c){n.push(t&&a.length?{key:t,value:a.join("")}:{unknown:t||a.join("")}),t=c=0,a=[];continue}}else if(58===d){if(!c&&!t&&1===a.length){t=a.pop();continue}}else{if(47===d&&1<l.length&&(47===l.charCodeAt(1)||42===l.charCodeAt(1)))continue;47===d&&u&&1<l.length?(d=s[u-1].match(o))&&!r[d[0]]&&(s=(e=e.substr(e.indexOf(l)+1)).match(i),u=-1,l="/"):40===d||123===d||91===d?++c:41===d||125===d||93===d?--c:t||a.length||34!==d&&39!==d||(l=l.slice(1,-1))}a.push(l)}if(0<c)throw Error("Unbalanced parentheses, braces, or brackets")}return n}var t=["true","false","null","undefined"],n=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,i=RegExp("\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|`(?:\\\\.|[^`])*`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*\n|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,\"'`{}()/:[\\]]*[^\\s,\"'`{}()/:[\\]]|[^\\s]","g"),o=/[\])"'A-Za-z0-9_$]+$/,r={in:1,return:1,typeof:1},s={};return{Ra:[],wa:s,ac:e,vb:function(i,o){function r(e,i){var o;if(!u){var d=v.getBindingHandler(e);if(d&&d.preprocess&&!(i=d.preprocess(i,e,r)))return;(d=s[e])&&(o=i,0<=v.a.A(t,o)?o=!1:(d=o.match(n),o=null!==d&&(d[1]?"Object("+d[1]+")"+d[2]:o)),d=o),d&&c.push("'"+("string"==typeof s[e]?s[e]:e)+"':function(_z){"+o+"=_z}")}l&&(i="function(){return "+i+" }"),a.push("'"+e+"':"+i)}var a=[],c=[],l=(o=o||{}).valueAccessors,u=o.bindingParams,d="string"==typeof i?e(i):i;return v.a.D(d,(function(e){r(e.key||e.unknown,e.value)})),c.length&&r("_ko_property_writers","{"+c.join(",")+" }"),a.join(",")},Id:function(e,t){for(var n=0;n<e.length;n++)if(e[n].key==t)return!0;return!1},eb:function(e,t,n,i,o){e&&v.O(e)?!v.Za(e)||o&&e.v()===i||e(i):(e=t.get("_ko_property_writers"))&&e[n]&&e[n](i)}}}(),v.b("expressionRewriting",v.m),v.b("expressionRewriting.bindingRewriteValidators",v.m.Ra),v.b("expressionRewriting.parseObjectLiteral",v.m.ac),v.b("expressionRewriting.preProcessBindings",v.m.vb),v.b("expressionRewriting._twoWayBindings",v.m.wa),v.b("jsonExpressionRewriting",v.m),v.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",v.m.vb),function(){function e(e){return 8==e.nodeType&&s.test(r?e.text:e.nodeValue)}function t(e){return 8==e.nodeType&&a.test(r?e.text:e.nodeValue)}function i(n,i){for(var o=n,r=1,s=[];o=o.nextSibling;){if(t(o)&&(v.a.g.set(o,l,!0),0==--r))return s;s.push(o),e(o)&&r++}if(!i)throw Error("Cannot find closing comment tag to match: "+n.nodeValue);return null}function o(e,t){var n=i(e,t);return n?0<n.length?n[n.length-1].nextSibling:e.nextSibling:null}var r=n&&"\x3c!--test--\x3e"===n.createComment("test").text,s=r?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,a=r?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,c={ul:!0,ol:!0},l="__ko_matchedEndComment__";v.h={ea:{},childNodes:function(t){return e(t)?i(t):t.childNodes},Ea:function(t){if(e(t))for(var n=0,i=(t=v.h.childNodes(t)).length;n<i;n++)v.removeNode(t[n]);else v.a.Tb(t)},va:function(t,n){if(e(t)){v.h.Ea(t);for(var i=t.nextSibling,o=0,r=n.length;o<r;o++)i.parentNode.insertBefore(n[o],i)}else v.a.va(t,n)},Vc:function(t,n){var i;e(t)?(i=t.nextSibling,t=t.parentNode):i=t.firstChild,i?n!==i&&t.insertBefore(n,i):t.appendChild(n)},Wb:function(t,n,i){i?(i=i.nextSibling,e(t)&&(t=t.parentNode),i?n!==i&&t.insertBefore(n,i):t.appendChild(n)):v.h.Vc(t,n)},firstChild:function(n){if(e(n))return!n.nextSibling||t(n.nextSibling)?null:n.nextSibling;if(n.firstChild&&t(n.firstChild))throw Error("Found invalid end comment, as the first child of "+n);return n.firstChild},nextSibling:function(n){if(e(n)&&(n=o(n)),n.nextSibling&&t(n.nextSibling)){var i=n.nextSibling;if(t(i)&&!v.a.g.get(i,l))throw Error("Found end comment without a matching opening comment, as child of "+n);return null}return n.nextSibling},Cd:e,Vd:function(e){return(e=(r?e.text:e.nodeValue).match(s))?e[1]:null},Sc:function(n){if(c[v.a.R(n)]){var i=n.firstChild;if(i)do{if(1===i.nodeType){var r,s=null;if(r=i.firstChild)do{if(s)s.push(r);else if(e(r)){var a=o(r,!0);a?r=a:s=[r]}else t(r)&&(s=[r])}while(r=r.nextSibling);if(r=s)for(s=i.nextSibling,a=0;a<r.length;a++)s?n.insertBefore(r[a],s):n.appendChild(r[a])}}while(i=i.nextSibling)}}}}(),v.b("virtualElements",v.h),v.b("virtualElements.allowedBindings",v.h.ea),v.b("virtualElements.emptyNode",v.h.Ea),v.b("virtualElements.insertAfter",v.h.Wb),v.b("virtualElements.prepend",v.h.Vc),v.b("virtualElements.setDomNodeChildren",v.h.va),v.ga=function(){this.nd={}},v.a.extend(v.ga.prototype,{nodeHasBindings:function(e){switch(e.nodeType){case 1:return null!=e.getAttribute("data-bind")||v.j.getComponentNameForNode(e);case 8:return v.h.Cd(e);default:return!1}},getBindings:function(e,t){var n=(n=this.getBindingsString(e,t))?this.parseBindingsString(n,t,e):null;return v.j.tc(n,e,t,!1)},getBindingAccessors:function(e,t){var n=(n=this.getBindingsString(e,t))?this.parseBindingsString(n,t,e,{valueAccessors:!0}):null;return v.j.tc(n,e,t,!0)},getBindingsString:function(e){switch(e.nodeType){case 1:return e.getAttribute("data-bind");case 8:return v.h.Vd(e);default:return null}},parseBindingsString:function(e,t,n,i){try{var o,r=this.nd,s=e+(i&&i.valueAccessors||"");if(!(o=r[s])){var a,c="with($context){with($data||{}){return{"+v.m.vb(e,i)+"}}}";a=new Function("$context","$element",c),o=r[s]=a}return o(t,n)}catch(l){throw l.message="Unable to parse bindings.\nBindings value: "+e+"\nMessage: "+l.message,l}}}),v.ga.instance=new v.ga,v.b("bindingProvider",v.ga),function(){function i(e){var t=(e=v.a.g.get(e,T))&&e.N;t&&(e.N=null,t.Tc())}function r(e,t,n){this.node=e,this.yc=t,this.kb=[],this.H=!1,t.N||v.a.K.za(e,i),n&&n.N&&(n.N.kb.push(e),this.Kb=n)}function s(e){return function(){return e}}function a(e){return e()}function c(e){return v.a.Ga(v.u.G(e),(function(t,n){return function(){return e()[n]}}))}function l(e,t,n){return"function"==typeof e?c(e.bind(null,t,n)):v.a.Ga(e,s)}function u(e,t){return c(this.getBindings.bind(this,e,t))}function d(e,t){var n=v.h.firstChild(t);if(n){var i,o=v.ga.instance,r=o.preprocessNode;if(r){for(;i=n;)n=v.h.nextSibling(i),r.call(o,i);n=v.h.firstChild(t)}for(;i=n;)n=v.h.nextSibling(i),h(e,i)}v.i.ma(t,v.i.H)}function h(e,t){var n=e,i=1===t.nodeType;i&&v.h.Sc(t),(i||v.ga.instance.nodeHasBindings(t))&&(n=f(t,null,e).bindingContextForDescendants),n&&!b[v.a.R(t)]&&d(n,t)}function p(e){var t=[],n={},i=[];return v.a.P(e,(function o(r){if(!n[r]){var s=v.getBindingHandler(r);s&&(s.after&&(i.push(r),v.a.D(s.after,(function(t){if(e[t]){if(-1!==v.a.A(i,t))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+i.join(", "));o(t)}})),i.length--),t.push({key:r,Mc:s})),n[r]=!0}})),t}function f(t,n,i){var o,r=v.a.g.Ub(t,T,{}),s=r.hd;if(!n){if(s)throw Error("You cannot apply bindings multiple times to the same element.");r.hd=!0}if(s||(r.context=i),r.Zb||(r.Zb={}),n&&"function"!=typeof n)o=n;else{var c=v.ga.instance,l=c.getBindingAccessors||u,d=v.$((function(){return(o=n?n(i,t):l.call(c,t,i))&&(i[_]&&i[_](),i[y]&&i[y]()),o}),null,{l:t});o&&d.ja()||(d=null)}var h,f=i;if(o){var m=function(){return v.a.Ga(d?d():o,a)},g=d?function(e){return function(){return a(d()[e])}}:function(e){return o[e]};m.get=function(e){return o[e]&&a(g(e))},m.has=function(e){return e in o},v.i.H in o&&v.i.subscribe(t,v.i.H,(function(){var e=(0,o[v.i.H])();if(e){var n=v.h.childNodes(t);n.length&&e(n,v.Ec(n[0]))}})),v.i.pa in o&&(f=v.i.Cb(t,i),v.i.subscribe(t,v.i.pa,(function(){var e=(0,o[v.i.pa])();e&&v.h.firstChild(t)&&e(t)}))),r=p(o),v.a.D(r,(function(n){var i=n.Mc.init,r=n.Mc.update,s=n.key;if(8===t.nodeType&&!v.h.ea[s])throw Error("The binding '"+s+"' cannot be used with virtual elements");try{"function"==typeof i&&v.u.G((function(){var n=i(t,g(s),m,f.$data,f);if(n&&n.controlsDescendantBindings){if(h!==e)throw Error("Multiple bindings ("+h+" and "+s+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");h=s}})),"function"==typeof r&&v.$((function(){r(t,g(s),m,f.$data,f)}),null,{l:t})}catch(a){throw a.message='Unable to process binding "'+s+": "+o[s]+'"\nMessage: '+a.message,a}}))}return{shouldBindDescendants:r=h===e,bindingContextForDescendants:r&&f}}function m(t,n){return t&&t instanceof v.fa?t:new v.fa(t,e,e,n)}var _=v.a.Da("_subscribable"),g=v.a.Da("_ancestorBindingInfo"),y=v.a.Da("_dataDependency");v.c={};var b={script:!0,textarea:!0,template:!0};v.getBindingHandler=function(e){return v.c[e]};var A={};v.fa=function(t,n,i,o,r){function s(){var e=d?u():u,t=v.a.f(e);return n?(v.a.extend(c,n),g in n&&(c[g]=n[g])):(c.$parents=[],c.$root=t,c.ko=v),c[_]=a,l?t=c.$data:(c.$rawData=e,c.$data=t),i&&(c[i]=t),o&&o(c,n,t),n&&n[_]&&!v.S.o().Vb(n[_])&&n[_](),h&&(c[y]=h),c.$data}var a,c=this,l=t===A,u=l?e:t,d="function"==typeof u&&!v.O(u),h=r&&r.dataDependency;r&&r.exportDependencies?s():((a=v.xb(s)).v(),a.ja()?a.equalityComparer=null:c[_]=e)},v.fa.prototype.createChildContext=function(e,t,n,i){if(!i&&t&&"object"==typeof t&&(t=(i=t).as,n=i.extend),t&&i&&i.noChildContext){var o="function"==typeof e&&!v.O(e);return new v.fa(A,this,null,(function(i){n&&n(i),i[t]=o?e():e}),i)}return new v.fa(e,this,t,(function(e,t){e.$parentContext=t,e.$parent=t.$data,e.$parents=(t.$parents||[]).slice(0),e.$parents.unshift(e.$parent),n&&n(e)}),i)},v.fa.prototype.extend=function(e,t){return new v.fa(A,this,null,(function(t){v.a.extend(t,"function"==typeof e?e(t):e)}),t)};var T=v.a.g.Z();r.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},r.prototype.sd=function(e){v.a.Pa(this.kb,e),!this.kb.length&&this.H&&this.Cc()},r.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,v.a.K.yb(this.node,i),v.i.ma(this.node,v.i.pa),this.Tc())},v.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(e,t,n,i,o){var r=v.a.g.Ub(e,T,{});return r.Fa||(r.Fa=new v.T),o&&o.notifyImmediately&&r.Zb[t]&&v.u.G(n,i,[e]),r.Fa.subscribe(n,i,t)},ma:function(t,n){var i=v.a.g.get(t,T);if(i&&(i.Zb[n]=!0,i.Fa&&i.Fa.notifySubscribers(t,n),n==v.i.H))if(i.N)i.N.Cc();else if(i.N===e&&i.Fa&&i.Fa.Wa(v.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")},Cb:function(e,t){var n=v.a.g.Ub(e,T,{});return n.N||(n.N=new r(e,n,t[g])),t[g]==n?t:t.extend((function(e){e[g]=n}))}},v.Td=function(e){return(e=v.a.g.get(e,T))&&e.context},v.ib=function(e,t,n){return 1===e.nodeType&&v.h.Sc(e),f(e,t,m(n))},v.ld=function(e,t,n){return n=m(n),v.ib(e,l(t,n,e),n)},v.Oa=function(e,t){1!==t.nodeType&&8!==t.nodeType||d(m(e),t)},v.vc=function(e,i,r){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(!(i=n.body))throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!i||1!==i.nodeType&&8!==i.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");h(m(e,r),i)},v.Dc=function(t){return!t||1!==t.nodeType&&8!==t.nodeType?e:v.Td(t)},v.Ec=function(t){return(t=v.Dc(t))?t.$data:e},v.b("bindingHandlers",v.c),v.b("bindingEvent",v.i),v.b("bindingEvent.subscribe",v.i.subscribe),v.b("bindingEvent.startPossiblyAsyncContentBinding",v.i.Cb),v.b("applyBindings",v.vc),v.b("applyBindingsToDescendants",v.Oa),v.b("applyBindingAccessorsToNode",v.ib),v.b("applyBindingsToNode",v.ld),v.b("contextFor",v.Dc),v.b("dataFor",v.Ec)}(),function(e){function t(t,i){var s,a=Object.prototype.hasOwnProperty.call(o,t)?o[t]:e;a?a.subscribe(i):((a=o[t]=new v.T).subscribe(i),n(t,(function(e,n){var i=!(!n||!n.synchronous);r[t]={definition:e,Gd:i},delete o[t],s||i?a.notifySubscribers(e):v.na.zb((function(){a.notifySubscribers(e)}))})),s=!0)}function n(e,t){i("getConfig",[e],(function(n){n?i("loadComponent",[e,n],(function(e){t(e,n)})):t(null,null)}))}function i(t,n,o,r){r||(r=v.j.loaders.slice(0));var s=r.shift();if(s){var a=s[t];if(a){var c=!1;if(a.apply(s,n.concat((function(e){c?o(null):null!==e?o(e):i(t,n,o,r)})))!==e&&(c=!0,!s.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else i(t,n,o,r)}else o(null)}var o={},r={};v.j={get:function(n,i){var o=Object.prototype.hasOwnProperty.call(r,n)?r[n]:e;o?o.Gd?v.u.G((function(){i(o.definition)})):v.na.zb((function(){i(o.definition)})):t(n,i)},Bc:function(e){delete r[e]},oc:i},v.j.loaders=[],v.b("components",v.j),v.b("components.get",v.j.get),v.b("components.clearCachedDefinition",v.j.Bc)}(),function(){function e(e,t,n,i){function o(){0==--a&&i(r)}var r={},a=2,c=n.template;n=n.viewModel,c?s(t,c,(function(t){v.j.oc("loadTemplate",[e,t],(function(e){r.template=e,o()}))})):o(),n?s(t,n,(function(t){v.j.oc("loadViewModel",[e,t],(function(e){r[u]=e,o()}))})):o()}function i(e,t,n){if("function"==typeof t)n((function(e){return new t(e)}));else if("function"==typeof t[u])n(t[u]);else if("instance"in t){var o=t.instance;n((function(){return o}))}else"viewModel"in t?i(e,t.viewModel,n):e("Unknown viewModel value: "+t)}function o(e){switch(v.a.R(e)){case"script":return v.a.ua(e.text);case"textarea":return v.a.ua(e.value);case"template":if(r(e.content))return v.a.Ca(e.content.childNodes)}return v.a.Ca(e.childNodes)}function r(e){return t.DocumentFragment?e instanceof DocumentFragment:e&&11===e.nodeType}function s(e,n,i){"string"==typeof n.require?a||t.require?(a||t.require)([n.require],(function(e){e&&"object"==typeof e&&e.Xd&&e.default&&(e=e.default),i(e)})):e("Uses require, but no AMD loader is present"):i(n)}function c(e){return function(t){throw Error("Component '"+e+"': "+t)}}var l={};v.j.register=function(e,t){if(!t)throw Error("Invalid configuration for "+e);if(v.j.tb(e))throw Error("Component "+e+" is already registered");l[e]=t},v.j.tb=function(e){return Object.prototype.hasOwnProperty.call(l,e)},v.j.unregister=function(e){delete l[e],v.j.Bc(e)},v.j.Fc={getConfig:function(e,t){t(v.j.tb(e)?l[e]:null)},loadComponent:function(t,n,i){var o=c(t);s(o,n,(function(n){e(t,o,n,i)}))},loadTemplate:function(e,i,s){if(e=c(e),"string"==typeof i)s(v.a.ua(i));else if(i instanceof Array)s(i);else if(r(i))s(v.a.la(i.childNodes));else if(i.element)if(i=i.element,t.HTMLElement?i instanceof HTMLElement:i&&i.tagName&&1===i.nodeType)s(o(i));else if("string"==typeof i){var a=n.getElementById(i);a?s(o(a)):e("Cannot find element with ID "+i)}else e("Unknown element type: "+i);else e("Unknown template value: "+i)},loadViewModel:function(e,t,n){i(c(e),t,n)}};var u="createViewModel";v.b("components.register",v.j.register),v.b("components.isRegistered",v.j.tb),v.b("components.unregister",v.j.unregister),v.b("components.defaultLoader",v.j.Fc),v.j.loaders.push(v.j.Fc),v.j.dd=l}(),function(){function e(e,t){if(n=e.getAttribute("params")){var n=o.parseBindingsString(n,t,e,{valueAccessors:!0,bindingParams:!0}),i=(n=v.a.Ga(n,(function(t){return v.o(t,null,{l:e})})),v.a.Ga(n,(function(t){var n=t.v();return t.ja()?v.o({read:function(){return v.a.f(t())},write:v.Za(n)&&function(e){t()(e)},l:e}):n})));return Object.prototype.hasOwnProperty.call(i,"$raw")||(i.$raw=n),i}return{$raw:{}}}v.j.getComponentNameForNode=function(e){var t=v.a.R(e);if(v.j.tb(t)&&(-1!=t.indexOf("-")||"[object HTMLUnknownElement]"==""+e||8>=v.a.W&&e.tagName===t))return t},v.j.tc=function(t,n,i,o){if(1===n.nodeType){var r=v.j.getComponentNameForNode(n);if(r){if((t=t||{}).component)throw Error('Cannot use the "component" binding on a custom element matching a component');var s={name:r,params:e(n,i)};t.component=o?function(){return s}:s}}return t};var t,i,o=new v.ga;9>v.a.W&&(v.j.register=(i=v.j.register,function(e){return i.apply(this,arguments)}),n.createDocumentFragment=(t=n.createDocumentFragment,function(){var e=t();return v.j.dd,e}))}(),function(){function e(e,t,n){if(!(t=t.template))throw Error("Component '"+e+"' has no template");e=v.a.Ca(t),v.h.va(n,e)}function t(e,t,n){var i=e.createViewModel;return i?i.call(e,t,n):t}var n=0;v.c.component={init:function(i,o,r,s,a){function c(){var e=l&&l.dispose;"function"==typeof e&&e.call(l),d&&d.s(),u=l=d=null}var l,u,d,h=v.a.la(v.h.childNodes(i));return v.h.Ea(i),v.a.K.za(i,c),v.o((function(){var r,s,p=v.a.f(o());if("string"==typeof p?r=p:(r=v.a.f(p.name),s=v.a.f(p.params)),!r)throw Error("No component name specified");var f=v.i.Cb(i,a),m=u=++n;v.j.get(r,(function(n){if(u===m){if(c(),!n)throw Error("Unknown component '"+r+"'");e(r,n,i);var o=t(n,s,{element:i,templateNodes:h});n=f.createChildContext(o,{extend:function(e){e.$component=o,e.$componentTemplateNodes=h}}),o&&o.koDescendantsComplete&&(d=v.i.subscribe(i,v.i.pa,o.koDescendantsComplete,o)),l=o,v.Oa(n,i)}}))}),null,{l:i}),{controlsDescendantBindings:!0}}},v.h.ea.component=!0}();var P={class:"className",for:"htmlFor"};v.c.attr={update:function(t,n){var i=v.a.f(n())||{};v.a.P(i,(function(n,i){i=v.a.f(i);var o=n.indexOf(":"),r=(o="lookupNamespaceURI"in t&&0<o&&t.lookupNamespaceURI(n.substr(0,o)),!1===i||null===i||i===e);r?o?t.removeAttributeNS(o,n):t.removeAttribute(n):i=i.toString(),8>=v.a.W&&n in P?(n=P[n],r?t.removeAttribute(n):t[n]=i):r||(o?t.setAttributeNS(o,n,i):t.setAttribute(n,i)),"name"===n&&v.a.Yc(t,r?"":i)}))}},v.c.checked={after:["value","attr"],init:function(t,n,i){function o(){var o=t.checked,r=s();if(!v.S.Ya()&&(o||!c&&!v.S.qa())){var l=v.u.G(n);if(u){var h=d?l.v():l,f=p;p=r,f!==r?o&&(v.a.Na(h,r,!0),v.a.Na(h,f,!1)):v.a.Na(h,r,o),d&&v.Za(l)&&l(h)}else a&&(r===e?r=o:o||(r=e)),v.m.eb(l,i,"checked",r,!0)}}function r(){var i=v.a.f(n()),o=s();u?(t.checked=0<=v.a.A(i,o),p=o):t.checked=a&&o===e?!!i:s()===i}var s=v.xb((function(){return i.has("checkedValue")?v.a.f(i.get("checkedValue")):h?i.has("value")?v.a.f(i.get("value")):t.value:void 0})),a="checkbox"==t.type,c="radio"==t.type;if(a||c){var l=n(),u=a&&v.a.f(l)instanceof Array,d=!(u&&l.push&&l.splice),h=c||u,p=u?s():e;c&&!t.name&&v.c.uniqueName.init(t,(function(){return!0})),v.o(o,null,{l:t}),v.a.B(t,"click",o),v.o(r,null,{l:t}),l=e}}},v.m.wa.checked=!0,v.c.checkedValue={update:function(e,t){e.value=v.a.f(t())}},v.c.class={update:function(e,t){var n=v.a.Db(v.a.f(t()));v.a.Eb(e,e.__ko__cssValue,!1),e.__ko__cssValue=n,v.a.Eb(e,n,!0)}},v.c.css={update:function(e,t){var n=v.a.f(t());null!==n&&"object"==typeof n?v.a.P(n,(function(t,n){n=v.a.f(n),v.a.Eb(e,t,n)})):v.c.class.update(e,t)}},v.c.enable={update:function(e,t){var n=v.a.f(t());n&&e.disabled?e.removeAttribute("disabled"):n||e.disabled||(e.disabled=!0)}},v.c.disable={update:function(e,t){v.c.enable.update(e,(function(){return!v.a.f(t())}))}},v.c.event={init:function(e,t,n,i,o){var r=t()||{};v.a.P(r,(function(r){"string"==typeof r&&v.a.B(e,r,(function(e){var s,a=t()[r];if(a){try{var c=v.a.la(arguments);i=o.$data,c.unshift(i),s=a.apply(i,c)}finally{!0!==s&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}!1===n.get(r+"Bubble")&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}}))}))}},v.c.foreach={Rc:function(e){return function(){var t=e(),n=v.a.bc(t);return n&&"number"!=typeof n.length?(v.a.f(t),{foreach:n.data,as:n.as,noChildContext:n.noChildContext,includeDestroyed:n.includeDestroyed,afterAdd:n.afterAdd,beforeRemove:n.beforeRemove,afterRender:n.afterRender,beforeMove:n.beforeMove,afterMove:n.afterMove,templateEngine:v.ba.Ma}):{foreach:t,templateEngine:v.ba.Ma}}},init:function(e,t){return v.c.template.init(e,v.c.foreach.Rc(t))},update:function(e,t,n,i,o){return v.c.template.update(e,v.c.foreach.Rc(t),n,i,o)}},v.m.Ra.foreach=!1,v.h.ea.foreach=!0,v.c.hasfocus={init:function(e,t,n){function i(i){e.__ko_hasfocusUpdating=!0;var o=e.ownerDocument;if("activeElement"in o){var r;try{r=o.activeElement}catch(s){r=o.body}i=r===e}o=t(),v.m.eb(o,n,"hasfocus",i,!0),e.__ko_hasfocusLastValue=i,e.__ko_hasfocusUpdating=!1}var o=i.bind(null,!0),r=i.bind(null,!1);v.a.B(e,"focus",o),v.a.B(e,"focusin",o),v.a.B(e,"blur",r),v.a.B(e,"focusout",r),e.__ko_hasfocusLastValue=!1},update:function(e,t){var n=!!v.a.f(t());e.__ko_hasfocusUpdating||e.__ko_hasfocusLastValue===n||(n?e.focus():e.blur(),!n&&e.__ko_hasfocusLastValue&&e.ownerDocument.body.focus(),v.u.G(v.a.Fb,null,[e,n?"focusin":"focusout"]))}},v.m.wa.hasfocus=!0,v.c.hasFocus=v.c.hasfocus,v.m.wa.hasFocus="hasfocus",v.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){v.a.fc(e,t())}},function(){function e(e,t,n){v.c[e]={init:function(e,i,o,r,s){var a,c,l,u,d,h={};if(t){r=o.get("as");var p=o.get("noChildContext");h={as:r,noChildContext:p,exportDependencies:d=!(r&&p)}}return u=(l="render"==o.get("completeOn"))||o.has(v.i.pa),v.o((function(){var o,r=v.a.f(i()),p=!n!=!r,f=!c;(d||p!==a)&&(u&&(s=v.i.Cb(e,s)),p&&(t&&!d||(h.dataDependency=v.S.o()),o=t?s.createChildContext("function"==typeof r?r:i,h):v.S.qa()?s.extend(null,h):s),f&&v.S.qa()&&(c=v.a.Ca(v.h.childNodes(e),!0)),p?(f||v.h.va(e,v.a.Ca(c)),v.Oa(o,e)):(v.h.Ea(e),l||v.i.ma(e,v.i.H)),a=p)}),null,{l:e}),{controlsDescendantBindings:!0}}},v.m.Ra[e]=!1,v.h.ea[e]=!0}e("if"),e("ifnot",!1,!0),e("with",!0)}(),v.c.let={init:function(e,t,n,i,o){return t=o.extend(t),v.Oa(t,e),{controlsDescendantBindings:!0}}},v.h.ea.let=!0;var N={};v.c.options={init:function(e){if("select"!==v.a.R(e))throw Error("options binding applies only to SELECT elements");for(;0<e.length;)e.remove(0);return{controlsDescendantBindings:!0}},update:function(t,n,i){function o(){return v.a.jb(t.options,(function(e){return e.selected}))}function r(e,t,n){var i=typeof t;return"function"==i?t(e):"string"==i?e[t]:n}function s(e,n){if(f&&u)v.i.ma(t,v.i.H);else if(p.length){var i=0<=v.a.A(p,v.w.M(n[0]));v.a.Zc(n[0],i),f&&!i&&v.u.G(v.a.Fb,null,[t,"change"])}}var a=t.multiple,c=0!=t.length&&a?t.scrollTop:null,l=v.a.f(n()),u=i.get("valueAllowUnset")&&i.has("value"),d=i.get("optionsIncludeDestroyed");n={};var h,p=[];u||(a?p=v.a.Mb(o(),v.w.M):0<=t.selectedIndex&&p.push(v.w.M(t.options[t.selectedIndex]))),l&&(void 0===l.length&&(l=[l]),h=v.a.jb(l,(function(t){return d||t===e||null===t||!v.a.f(t._destroy)})),i.has("optionsCaption")&&null!==(l=v.a.f(i.get("optionsCaption")))&&l!==e&&h.unshift(N));var f=!1;n.beforeRemove=function(e){t.removeChild(e)},l=s,i.has("optionsAfterRender")&&"function"==typeof i.get("optionsAfterRender")&&(l=function(t,n){s(0,n),v.u.G(i.get("optionsAfterRender"),null,[n[0],t!==N?t:e])}),v.a.ec(t,h,(function(n,o,s){return s.length&&(p=!u&&s[0].selected?[v.w.M(s[0])]:[],f=!0),o=t.ownerDocument.createElement("option"),n===N?(v.a.Bb(o,i.get("optionsCaption")),v.w.cb(o,e)):(s=r(n,i.get("optionsValue"),n),v.w.cb(o,v.a.f(s)),n=r(n,i.get("optionsText"),s),v.a.Bb(o,n)),[o]}),n,l),u||(a?p.length&&o().length<p.length:p.length&&0<=t.selectedIndex?v.w.M(t.options[t.selectedIndex])!==p[0]:p.length||0<=t.selectedIndex)&&v.u.G(v.a.Fb,null,[t,"change"]),(u||v.S.Ya())&&v.i.ma(t,v.i.H),v.a.wd(t),c&&20<Math.abs(c-t.scrollTop)&&(t.scrollTop=c)}},v.c.options.$b=v.a.g.Z(),v.c.selectedOptions={init:function(e,t,n){function i(){var i=t(),o=[];v.a.D(e.getElementsByTagName("option"),(function(e){e.selected&&o.push(v.w.M(e))})),v.m.eb(i,n,"selectedOptions",o)}function o(){var n=v.a.f(t()),i=e.scrollTop;n&&"number"==typeof n.length&&v.a.D(e.getElementsByTagName("option"),(function(e){var t=0<=v.a.A(n,v.w.M(e));e.selected!=t&&v.a.Zc(e,t)})),e.scrollTop=i}if("select"!=v.a.R(e))throw Error("selectedOptions binding applies only to SELECT elements");var r;v.i.subscribe(e,v.i.H,(function(){r?i():(v.a.B(e,"change",i),r=v.o(o,null,{l:e}))}),null,{notifyImmediately:!0})},update:function(){}},v.m.wa.selectedOptions=!0,v.c.style={update:function(t,n){var i=v.a.f(n()||{});v.a.P(i,(function(n,i){if(null!==(i=v.a.f(i))&&i!==e&&!1!==i||(i=""),o)o(t).css(n,i);else if(/^--/.test(n))t.style.setProperty(n,i);else{n=n.replace(/-(\w)/g,(function(e,t){return t.toUpperCase()}));var r=t.style[n];t.style[n]=i,i===r||t.style[n]!=r||isNaN(i)||(t.style[n]=i+"px")}}))}},v.c.submit={init:function(e,t,n,i,o){if("function"!=typeof t())throw Error("The value for a submit binding must be a function");v.a.B(e,"submit",(function(n){var i,r=t();try{i=r.call(o.$data,e)}finally{!0!==i&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}}))}},v.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){v.a.Bb(e,t())}},v.h.ea.text=!0,function(){if(t&&t.navigator){var n,i,o,r,s,a=function(e){if(e)return parseFloat(e[1])},c=t.navigator.userAgent;(n=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(s=a(c.match(/Edge\/([^ ]+)$/)))||a(c.match(/Chrome\/([^ ]+)/))||(i=a(c.match(/Version\/([^ ]+) Safari/)))||(o=a(c.match(/Firefox\/([^ ]+)/)))||(r=v.a.W||a(c.match(/MSIE ([^ ]+)/)))||(r=a(c.match(/rv:([^ )]+)/)))}if(8<=r&&10>r)var l=v.a.g.Z(),u=v.a.g.Z(),d=function(e){var t=this.activeElement;(t=t&&v.a.g.get(t,u))&&t(e)},h=function(e,t){var n=e.ownerDocument;v.a.g.get(n,l)||(v.a.g.set(n,l,!0),v.a.B(n,"selectionchange",d)),v.a.g.set(e,u,t)};v.c.textInput={init:function(t,a,c){function l(e,n){v.a.B(t,e,n)}function u(){var n=v.a.f(a());null!==n&&n!==e||(n=""),m!==e&&n===m?v.a.setTimeout(u,4):t.value!==n&&(y=!0,t.value=n,y=!1,_=t.value)}function d(){f||(m=t.value,f=v.a.setTimeout(p,4))}function p(){clearTimeout(f),m=f=e;var n=t.value;_!==n&&(_=n,v.m.eb(a(),c,"textInput",n))}var f,m,_=t.value,g=9==v.a.W?d:p,y=!1;r&&l("keypress",p),11>r&&l("propertychange",(function(e){y||"value"!==e.propertyName||g()})),8==r&&(l("keyup",p),l("keydown",p)),h&&(h(t,g),l("dragend",d)),(!r||9<=r)&&l("input",g),5>i&&"textarea"===v.a.R(t)?(l("keydown",d),l("paste",d),l("cut",d)):11>n?l("keydown",d):4>o?(l("DOMAutoComplete",p),l("dragdrop",p),l("drop",p)):s&&"number"===t.type&&l("keydown",d),l("change",p),l("blur",p),v.o(u,null,{l:t})}},v.m.wa.textInput=!0,v.c.textinput={preprocess:function(e,t,n){n("textInput",e)}}}(),v.c.uniqueName={init:function(e,t){if(t()){var n="ko_unique_"+ ++v.c.uniqueName.rd;v.a.Yc(e,n)}}},v.c.uniqueName.rd=0,v.c.using={init:function(e,t,n,i,o){var r;return n.has("as")&&(r={as:n.get("as"),noChildContext:n.get("noChildContext")}),t=o.createChildContext(t,r),v.Oa(t,e),{controlsDescendantBindings:!0}}},v.h.ea.using=!0,v.c.value={init:function(t,n,i){var o=v.a.R(t),r="input"==o;if(!r||"checkbox"!=t.type&&"radio"!=t.type){var s=[],a=i.get("valueUpdate"),c=!1,l=null;a&&(s="string"==typeof a?[a]:v.a.wc(a),v.a.Pa(s,"change"));var u,d,h=function(){l=null,c=!1;var e=n(),o=v.w.M(t);v.m.eb(e,i,"value",o)};!v.a.W||!r||"text"!=t.type||"off"==t.autocomplete||t.form&&"off"==t.form.autocomplete||-1!=v.a.A(s,"propertychange")||(v.a.B(t,"propertychange",(function(){c=!0})),v.a.B(t,"focus",(function(){c=!1})),v.a.B(t,"blur",(function(){c&&h()}))),v.a.D(s,(function(e){var n=h;v.a.Ud(e,"after")&&(n=function(){l=v.w.M(t),v.a.setTimeout(h,0)},e=e.substring(5)),v.a.B(t,e,n)})),u=r&&"file"==t.type?function(){var i=v.a.f(n());null===i||i===e||""===i?t.value="":v.u.G(h)}:function(){var r=v.a.f(n()),s=v.w.M(t);null!==l&&r===l?v.a.setTimeout(u,0):r===s&&s!==e||("select"===o?(s=i.get("valueAllowUnset"),v.w.cb(t,r,s),s||r===v.w.M(t)||v.u.G(h)):v.w.cb(t,r))},"select"===o?v.i.subscribe(t,v.i.H,(function(){d?i.get("valueAllowUnset")?u():h():(v.a.B(t,"change",h),d=v.o(u,null,{l:t}))}),null,{notifyImmediately:!0}):(v.a.B(t,"change",h),v.o(u,null,{l:t}))}else v.ib(t,{checkedValue:n})},update:function(){}},v.m.wa.value=!0,v.c.visible={update:function(e,t){var n=v.a.f(t()),i="none"!=e.style.display;n&&!i?e.style.display="":!n&&i&&(e.style.display="none")}},v.c.hidden={update:function(e,t){v.c.visible.update(e,(function(){return!v.a.f(t())}))}},function(e){v.c[e]={init:function(t,n,i,o,r){return v.c.event.init.call(this,t,(function(){var t={};return t[e]=n(),t}),i,o,r)}}}("click"),v.ca=function(){},v.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},v.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},v.ca.prototype.makeTemplateSource=function(e,t){if("string"==typeof e){var i=(t=t||n).getElementById(e);if(!i)throw Error("Cannot find template with ID "+e);return new v.C.F(i)}if(1==e.nodeType||8==e.nodeType)return new v.C.ia(e);throw Error("Unknown template type: "+e)},v.ca.prototype.renderTemplate=function(e,t,n,i){return e=this.makeTemplateSource(e,i),this.renderTemplateSource(e,t,n,i)},v.ca.prototype.isTemplateRewritten=function(e,t){return!1===this.allowTemplateRewriting||this.makeTemplateSource(e,t).data("isRewritten")},v.ca.prototype.rewriteTemplate=function(e,t,n){t=t((e=this.makeTemplateSource(e,n)).text()),e.text(t),e.data("isRewritten",!0)},v.b("templateEngine",v.ca),v.kc=function(){function e(e,t,n,i){e=v.m.ac(e);for(var o=v.m.Ra,r=0;r<e.length;r++){var s=e[r].key;if(Object.prototype.hasOwnProperty.call(o,s)){var a=o[s];if("function"==typeof a){if(s=a(e[r].value))throw Error(s)}else if(!a)throw Error("This template engine does not support the '"+s+"' binding within its templates")}}return n="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+v.m.vb(e,{valueAccessors:!0})+" } })()},'"+n.toLowerCase()+"')",i.createJavaScriptEvaluatorBlock(n)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,n=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(e,t,n){t.isTemplateRewritten(e,n)||t.rewriteTemplate(e,(function(e){return v.kc.Ld(e,t)}),n)},Ld:function(i,o){return i.replace(t,(function(t,n,i,r,s){return e(s,n,i,o)})).replace(n,(function(t,n){return e(n,"\x3c!-- ko --\x3e","#comment",o)}))},md:function(e,t){return v.aa.Xb((function(n,i){var o=n.nextSibling;o&&o.nodeName.toLowerCase()===t&&v.ib(o,e,i)}))}}}(),v.b("__tr_ambtns",v.kc.md),function(){v.C={},v.C.F=function(e){if(this.F=e){var t=v.a.R(e);this.ab="script"===t?1:"textarea"===t?2:"template"==t&&e.content&&11===e.content.nodeType?3:4}},v.C.F.prototype.text=function(){var e=1===this.ab?"text":2===this.ab?"value":"innerHTML";if(0==arguments.length)return this.F[e];var t=arguments[0];"innerHTML"===e?v.a.fc(this.F,t):this.F[e]=t};var t=v.a.g.Z()+"_";v.C.F.prototype.data=function(e){if(1===arguments.length)return v.a.g.get(this.F,t+e);v.a.g.set(this.F,t+e,arguments[1])};var n=v.a.g.Z();v.C.F.prototype.nodes=function(){var t=this.F;if(0==arguments.length){var i=v.a.g.get(t,n)||{},o=i.lb||(3===this.ab?t.content:4===this.ab?t:e);if(!o||i.jd){var r=this.text();r&&r!==i.bb&&(o=v.a.Md(r,t.ownerDocument),v.a.g.set(t,n,{lb:o,bb:r,jd:!0}))}return o}i=arguments[0],this.ab!==e&&this.text(""),v.a.g.set(t,n,{lb:i})},v.C.ia=function(e){this.F=e},v.C.ia.prototype=new v.C.F,v.C.ia.prototype.constructor=v.C.ia,v.C.ia.prototype.text=function(){if(0==arguments.length){var t=v.a.g.get(this.F,n)||{};return t.bb===e&&t.lb&&(t.bb=t.lb.innerHTML),t.bb}v.a.g.set(this.F,n,{bb:arguments[0]})},v.b("templateSources",v.C),v.b("templateSources.domElement",v.C.F),v.b("templateSources.anonymousTemplate",v.C.ia)}(),function(){function t(e,t,n){var i;for(t=v.h.nextSibling(t);e&&(i=e)!==t;)n(i,e=v.h.nextSibling(i))}function n(e,n){if(e.length){var i=e[0],o=e[e.length-1],r=i.parentNode,s=v.ga.instance,a=s.preprocessNode;if(a){if(t(i,o,(function(e,t){var n=e.previousSibling,r=a.call(s,e);r&&(e===i&&(i=r[0]||t),e===o&&(o=r[r.length-1]||n))})),e.length=0,!i)return;i===o?e.push(i):(e.push(i,o),v.a.Ua(e,r))}t(i,o,(function(e){1!==e.nodeType&&8!==e.nodeType||v.vc(n,e)})),t(i,o,(function(e){1!==e.nodeType&&8!==e.nodeType||v.aa.cd(e,[n])})),v.a.Ua(e,r)}}function i(e){return e.nodeType?e:0<e.length?e[0]:null}function o(e,t,o,r,a){a=a||{};var c=(e&&i(e)||o||{}).ownerDocument,l=a.templateEngine||s;if(v.kc.xd(o,l,c),"number"!=typeof(o=l.renderTemplate(o,r,a,c)).length||0<o.length&&"number"!=typeof o[0].nodeType)throw Error("Template engine must return an array of DOM nodes");switch(c=!1,t){case"replaceChildren":v.h.va(e,o),c=!0;break;case"replaceNode":v.a.Xc(e,o),c=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+t)}return c&&(n(o,r),a.afterRender&&v.u.G(a.afterRender,null,[o,r[a.as||"$data"]]),"replaceChildren"==t&&v.i.ma(e,v.i.H)),o}function r(e,t,n){return v.O(e)?e():"function"==typeof e?e(t,n):e}var s;v.gc=function(t){if(t!=e&&!(t instanceof v.ca))throw Error("templateEngine must inherit from ko.templateEngine");s=t},v.dc=function(t,n,a,c,l){if(((a=a||{}).templateEngine||s)==e)throw Error("Set a template engine before calling renderTemplate");if(l=l||"replaceChildren",c){var u=i(c);return v.$((function(){var e=n&&n instanceof v.fa?n:new v.fa(n,null,null,null,{exportDependencies:!0}),s=r(t,e.$data,e);e=o(c,l,s,e,a),"replaceNode"==l&&(u=i(c=e))}),null,{Sa:function(){return!u||!v.a.Sb(u)},l:u&&"replaceNode"==l?u.parentNode:u})}return v.aa.Xb((function(e){v.dc(t,n,a,e,"replaceNode")}))},v.Qd=function(t,i,s,a,c){function l(e,t){v.u.G(v.a.ec,null,[a,e,d,s,u,t]),v.i.ma(a,v.i.H)}function u(e,t){n(t,h),s.afterRender&&s.afterRender(t,e),h=null}function d(e,n){h=c.createChildContext(e,{as:p,noChildContext:s.noChildContext,extend:function(e){e.$index=n,p&&(e[p+"Index"]=n)}});var i=r(t,e,h);return o(a,"ignoreTargetNode",i,h,s)}var h,p=s.as,f=!1===s.includeDestroyed||v.options.foreachHidesDestroyed&&!s.includeDestroyed;if(f||s.beforeRemove||!v.Pc(i))return v.$((function(){var t=v.a.f(i)||[];void 0===t.length&&(t=[t]),f&&(t=v.a.jb(t,(function(t){return t===e||null===t||!v.a.f(t._destroy)}))),l(t)}),null,{l:a});l(i.v());var m=i.subscribe((function(e){l(i(),e)}),null,"arrayChange");return m.l(a),m};var a=v.a.g.Z(),c=v.a.g.Z();v.c.template={init:function(e,t){var n=v.a.f(t());if("string"==typeof n||"name"in n)v.h.Ea(e);else if("nodes"in n){if(n=n.nodes||[],v.O(n))throw Error('The "nodes" option must be a plain, non-observable array.');var i=n[0]&&n[0].parentNode;i&&v.a.g.get(i,c)||(i=v.a.Yb(n),v.a.g.set(i,c,!0)),new v.C.ia(e).nodes(i)}else{if(!(0<(n=v.h.childNodes(e)).length))throw Error("Anonymous template defined, but no template content was provided");i=v.a.Yb(n),new v.C.ia(e).nodes(i)}return{controlsDescendantBindings:!0}},update:function(t,n,i,o,r){var s=n();i=!0,o=null,"string"==typeof(n=v.a.f(s))?n={}:(s="name"in n?n.name:t,"if"in n&&(i=v.a.f(n.if)),i&&"ifnot"in n&&(i=!v.a.f(n.ifnot)),i&&!s&&(i=!1)),"foreach"in n?o=v.Qd(s,i&&n.foreach||[],n,t,r):i?(i=r,"data"in n&&(i=r.createChildContext(n.data,{as:n.as,noChildContext:n.noChildContext,exportDependencies:!0})),o=v.dc(s,i,n,t)):v.h.Ea(t),r=o,(n=v.a.g.get(t,a))&&"function"==typeof n.s&&n.s(),v.a.g.set(t,a,!r||r.ja&&!r.ja()?e:r)}},v.m.Ra.template=function(e){return 1==(e=v.m.ac(e)).length&&e[0].unknown||v.m.Id(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"},v.h.ea.template=!0}(),v.b("setTemplateEngine",v.gc),v.b("renderTemplate",v.dc),v.a.Kc=function(e,t,n){var i,o,r,s,a;if(e.length&&t.length)for(i=o=0;(!n||i<n)&&(s=e[o]);++o){for(r=0;a=t[r];++r)if(s.value===a.value){s.moved=a.index,a.moved=s.index,t.splice(r,1),i=r=0;break}i+=r}},v.a.Pb=function(){function e(e,t,n,i,o){var r,s,a,c,l,u=Math.min,d=Math.max,h=[],p=e.length,f=t.length,m=f-p||1,_=p+f+1;for(r=0;r<=p;r++)for(c=a,h.push(a=[]),l=u(f,r+m),s=d(0,r-1);s<=l;s++)a[s]=s?r?e[r-1]===t[s-1]?c[s-1]:u(c[s]||_,a[s-1]||_)+1:s+1:r+1;for(u=[],d=[],m=[],r=p,s=f;r||s;)f=h[r][s]-1,s&&f===h[r][s-1]?d.push(u[u.length]={status:n,value:t[--s],index:s}):r&&f===h[r-1][s]?m.push(u[u.length]={status:i,value:e[--r],index:r}):(--s,--r,o.sparse||u.push({status:"retained",value:t[s]}));return v.a.Kc(m,d,!o.dontLimitMoves&&10*p),u.reverse()}return function(t,n,i){return i="boolean"==typeof i?{dontLimitMoves:i}:i||{},n=n||[],(t=t||[]).length<n.length?e(t,n,"added","deleted",i):e(n,t,"deleted","added",i)}}(),v.b("utils.compareArrays",v.a.Pb),function(){function t(t,n,i,o,r){var s=[],a=v.$((function(){var e=n(i,r,v.a.Ua(s,t))||[];0<s.length&&(v.a.Xc(s,e),o&&v.u.G(o,null,[i,e,r])),s.length=0,v.a.Nb(s,e)}),null,{l:t,Sa:function(){return!v.a.kd(s)}});return{Y:s,$:a.ja()?a:e}}var n=v.a.g.Z(),i=v.a.g.Z();v.a.ec=function(o,r,s,a,c,l){function u(e){p={Aa:e,pb:v.ta(T++)},b.push(p),y||C.push(p)}function d(e){p=g[e],T!==p.pb.v()&&S.push(p),p.pb(T++),v.a.Ua(p.Y,o),b.push(p)}function h(e,t){if(e)for(var n=0,i=t.length;n<i;n++)v.a.D(t[n].Y,(function(i){e(i,n,t[n].Aa)}))}void 0===(r=r||[]).length&&(r=[r]),a=a||{};var p,f,m,_,g=v.a.g.get(o,n),y=!g,b=[],A=0,T=0,w=[],E=[],x=[],S=[],C=[],I=0;if(y)v.a.D(r,u);else{if(!l||g&&g._countWaitingForRemove){var O=v.a.Mb(g,(function(e){return e.Aa}));l=v.a.Pb(O,r,{dontLimitMoves:a.dontLimitMoves,sparse:!0})}var D,P,N;for(O=0;D=l[O];O++)switch(P=D.moved,N=D.index,D.status){case"deleted":for(;A<N;)d(A++);P===e&&((p=g[A]).$&&(p.$.s(),p.$=e),v.a.Ua(p.Y,o).length&&(a.beforeRemove&&(b.push(p),I++,p.Aa===i?p=null:x.push(p)),p&&w.push.apply(w,p.Y))),A++;break;case"added":for(;T<N;)d(A++);P!==e?(E.push(b.length),d(P)):u(D.value)}for(;T<r.length;)d(A++);b._countWaitingForRemove=I}v.a.g.set(o,n,b),h(a.beforeMove,S),v.a.D(w,a.beforeRemove?v.oa:v.removeNode);try{_=o.ownerDocument.activeElement}catch(R){}if(E.length)for(;(O=E.shift())!=e;){for(p=b[O],f=e;O;)if((m=b[--O].Y)&&m.length){f=m[m.length-1];break}for(r=0;A=p.Y[r];f=A,r++)v.h.Wb(o,A,f)}for(O=0;p=b[O];O++){for(p.Y||v.a.extend(p,t(o,s,p.Aa,c,p.pb)),r=0;A=p.Y[r];f=A,r++)v.h.Wb(o,A,f);!p.Ed&&c&&(c(p.Aa,p.Y,p.pb),p.Ed=!0,f=p.Y[p.Y.length-1])}for(_&&o.ownerDocument.activeElement!=_&&_.focus(),h(a.beforeRemove,x),O=0;O<x.length;++O)x[O].Aa=i;h(a.afterMove,S),h(a.afterAdd,C)}}(),v.b("utils.setDomNodeChildrenFromArrayMapping",v.a.ec),v.ba=function(){this.allowTemplateRewriting=!1},v.ba.prototype=new v.ca,v.ba.prototype.constructor=v.ba,v.ba.prototype.renderTemplateSource=function(e,t,n,i){return(t=9>v.a.W||!e.nodes?null:e.nodes())?v.a.la(t.cloneNode(!0).childNodes):(e=e.text(),v.a.ua(e,i))},v.ba.Ma=new v.ba,v.gc(v.ba.Ma),v.b("nativeTemplateEngine",v.ba),function(){v.$a=function(){var e=this.Hd=function(){if(!o||!o.tmpl)return 0;try{if(0<=o.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(e){}return 1}();this.renderTemplateSource=function(t,i,r,s){if(s=s||n,r=r||{},2>e)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var a=t.data("precompiled");return a||(a=t.text()||"",a=o.template(null,"{{ko_with $item.koBindingContext}}"+a+"{{/ko_with}}"),t.data("precompiled",a)),t=[i.$data],i=o.extend({koBindingContext:i},r.templateOptions),(i=o.tmpl(a,t,i)).appendTo(s.createElement("div")),o.fragments={},i},this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"},this.addTemplate=function(e,t){n.write("<script type='text/html' id='"+e+"'>"+t+"<\/script>")},0<e&&(o.tmpl.tag.ko_code={open:"__.push($1 || '');"},o.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},v.$a.prototype=new v.ca,v.$a.prototype.constructor=v.$a;var e=new v.$a;0<e.Hd&&v.gc(e),v.b("jqueryTmplTemplateEngine",v.$a)}()}(t.ko={})}();var vve=ko;"undefined"!=typeof window?(ko=window.ko,void 0!==bve?window.ko=bve:delete window.ko):(ko=global.ko,void 0!==bve?global.ko=bve:delete global.ko);const Ave=vve;
|
||
/**
|
||
* @license
|
||
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
|
||
* Copyright (c) Steve Sanderson
|
||
* MIT license
|
||
*/var Tve="__knockoutObservables",wve="__knockoutSubscribable";function Eve(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=xve(e,!0);return(t=t||Object.getOwnPropertyNames(e)).forEach((function(t){if(t!==Tve&&t!==wve&&!(t in i)){var o=e[t],r=o instanceof Array,s=n.isObservable(o)?o:r?n.observableArray(o):n.observable(o);Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:s,set:n.isWriteableObservable(s)?s:void 0}),i[t]=s,r&&function(e,t){var n=null;e.computed((function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=function(e,t,n){var i=function(e,t){var n=t[wve];if(!n){n=new e.subscribable,Object.defineProperty(t,wve,{value:n});var i={};!function(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach((function(i){var o=e[i];e[i]=function(){var e=o.apply(this,arguments);return!0!==n.pause&&t.notifySubscribers(this),e}}))}(t,n,i),function(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach((function(o){Object.defineProperty(t,o,{enumerable:!1,value:function(){var r;i.pause=!0;try{r=e.observableArray.fn[o].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),r}})}))}(e,t,n,i)}return n}(e,n);return i.subscribe(t)}(e,t,i))}))}(n,s)}})),e}function xve(e,t){var n=e[Tve];return!n&&t&&(n={},Object.defineProperty(e,Tve,{value:n})),n}function Sve(e,t,n){var i={owner:e,deferEvaluation:!0};if("function"==typeof n)i.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if("function"!=typeof n.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".');i.read=n.get,i.write=n.set}return e[t]=this.computed(i),Eve.call(this,e,[t]),e}function Cve(e,t){if(!e)return null;var n=xve(e,!1);return n&&n[t]||null}function Ive(e,t){var n=Cve(e,t);n&&n.valueHasMutated()}const Ove="http://www.w3.org/2000/svg",Dve="cesium-svgPath-svg",Pve={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(Ove,"svg:svg");i.setAttribute("class",Dve);const o=document.createElementNS(Ove,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const t=e.unwrap(n());o.setAttribute("d",e.unwrap(t.path));const r=e.unwrap(t.width),s=e.unwrap(t.height);i.setAttribute("width",r),i.setAttribute("height",s),i.setAttribute("viewBox",`0 0 ${r} ${s}`),t.css&&i.setAttribute("class",`${Dve} ${e.unwrap(t.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}};function Nve(e){D(e)||(e=new sJ),this._clock=e,this._eventHelper=new KX,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=Ave.observable(Hn.now()),this.systemTime.equalityComparer=Hn.equals,this.startTime=Ave.observable(e.startTime),this.startTime.equalityComparer=Hn.equals,this.startTime.subscribe((function(t){e.startTime=t,this.synchronize()}),this),this.stopTime=Ave.observable(e.stopTime),this.stopTime.equalityComparer=Hn.equals,this.stopTime.subscribe((function(t){e.stopTime=t,this.synchronize()}),this),this.currentTime=Ave.observable(e.currentTime),this.currentTime.equalityComparer=Hn.equals,this.currentTime.subscribe((function(t){e.currentTime=t,this.synchronize()}),this),this.multiplier=Ave.observable(e.multiplier),this.multiplier.subscribe((function(t){e.multiplier=t,this.synchronize()}),this),this.clockStep=Ave.observable(e.clockStep),this.clockStep.subscribe((function(t){e.clockStep=t,this.synchronize()}),this),this.clockRange=Ave.observable(e.clockRange),this.clockRange.subscribe((function(t){e.clockRange=t,this.synchronize()}),this),this.canAnimate=Ave.observable(e.canAnimate),this.canAnimate.subscribe((function(t){e.canAnimate=t,this.synchronize()}),this),this.shouldAnimate=Ave.observable(e.shouldAnimate),this.shouldAnimate.subscribe((function(t){e.shouldAnimate=t,this.synchronize()}),this),Ave.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}function Rve(e,t){if(!D(e))throw new P("command is required.");this._command=e,t=M(t,M.EMPTY_OBJECT),this.toggled=M(t.toggled,!1),this.tooltip=M(t.tooltip,""),Ave.track(this,["toggled","tooltip"])}function Lve(e,t){if(!D(e))throw new P("func is required.");t=M(t,!0);const n=new gi,i=new gi;function o(){if(!o.canExecute)throw new P("Cannot execute command, canExecute is false.");const t={args:arguments,cancel:!1};let r;return n.raiseEvent(t),t.cancel||(r=e.apply(null,arguments),i.raiseEvent(r)),r}return o.canExecute=t,Ave.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}function Mve(e,t,n,i,o){return n.call(i,e[t]),Ave.getObservable(e,t).subscribe(n,i,o)}function Fve(e){const t=(e=M(e,M.EMPTY_OBJECT)).globe,n=M(e.imageryProviderViewModels,[]),i=M(e.terrainProviderViewModels,[]);if(!D(t))throw new P("globe is required");this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,Ave.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const o=Ave.getObservable(this,"imageryProviderViewModels"),r=Ave.pureComputed((function(){const e=o(),t={};let n;for(n=0;n<e.length;n++){const i=e[n],o=i.category;D(t[o])?t[o].push(i):t[o]=[i]}const i=Object.keys(t),r=[];for(n=0;n<i.length;n++){const e=i[n];r.push({name:e,providers:t[e]})}return r}));this._imageryProviders=r;const s=Ave.getObservable(this,"terrainProviderViewModels"),a=Ave.pureComputed((function(){const e=s(),t={};let n;for(n=0;n<e.length;n++){const i=e[n],o=i.category;D(t[o])?t[o].push(i):t[o]=[i]}const i=Object.keys(t),o=[];for(n=0;n<i.length;n++){const e=i[n];o.push({name:e,providers:t[e]})}return o}));this._terrainProviders=a,this.buttonTooltip=void 0,Ave.defineProperty(this,"buttonTooltip",(function(){const e=this.selectedImagery,t=this.selectedTerrain,n=D(e)?e.name:void 0,i=D(t)?t.name:void 0;return D(n)&&D(i)?`${n}\n${i}`:D(n)?n:i})),this.buttonImageUrl=void 0,Ave.defineProperty(this,"buttonImageUrl",(function(){const e=this.selectedImagery;if(D(e))return e.iconUrl})),this.selectedImagery=void 0;const c=Ave.observable();this._currentImageryLayers=[],Ave.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(e){if(c()===e)return void(this.dropDownVisible=!1);let t;const n=this._currentImageryLayers,i=n.length,o=this._globe.imageryLayers;let r=!1;for(t=0;t<i;t++){const e=o.length;for(let i=0;i<e;i++){const e=o.get(i);if(e===n[t]){o.remove(e),r=!0;break}}}if(D(e)){const n=e.creationCommand();if(Array.isArray(n)){const e=n.length;for(this._currentImageryLayers=[],t=e-1;t>=0;t--){const e=x7.fromProviderAsync(n[t]);o.add(e,0),this._currentImageryLayers.push(e)}}else{this._currentImageryLayers=[];const t=x7.fromProviderAsync(n);if(t.name=e.name,r)o.add(t,0);else{const e=o.get(0);D(e)&&o.remove(e),o.add(t,0)}this._currentImageryLayers.push(t)}}c(e),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const l=Ave.observable();Ave.defineProperty(this,"selectedTerrain",{get:function(){return l()},set:function(e){if(l()===e)return void(this.dropDownVisible=!1);let t;if(D(e)&&(t=e.creationCommand()),D(t)&&!D(t.then))this._globe.depthTestAgainstTerrain=!(t instanceof N9),this._globe.terrainProvider=t;else if(D(t)){let e=!1;const n=this._globe.terrainProviderChanged.addEventListener((()=>{e=!0,n()})),i=new nve(t).readyEvent.addEventListener((t=>{e||(this._globe.depthTestAgainstTerrain=!(t instanceof N9),this._globe.terrainProvider=t,i())}))}l(e),this.dropDownVisible=!1}});const u=this;this._toggleDropDown=Lve((function(){u.dropDownVisible=!u.dropDownVisible})),this.selectedImagery=M(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=M(e.selectedTerrainProviderViewModel,i[0])}function Bve(e,t){if(!D(e))throw new P("container is required.");e=O8(e);const n=new Fve(t),i=document.createElement("button");i.type="button",i.className="cesium-button cesium-toolbar-button",i.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(i);const o=document.createElement("img");o.setAttribute("draggable","false"),o.className="cesium-baseLayerPicker-selected",o.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(o);const r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);const s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);const a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);const c=document.createElement("div");c.className="cesium-baseLayerPicker-category",a.appendChild(c);const l=document.createElement("div");l.className="cesium-baseLayerPicker-categoryTitle",l.setAttribute("data-bind","text: name"),c.appendChild(l);const u=document.createElement("div");u.className="cesium-baseLayerPicker-choices",u.setAttribute("data-bind","foreach: providers"),c.appendChild(u);const 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);const h=document.createElement("img");h.className="cesium-baseLayerPicker-itemIcon",h.setAttribute("data-bind","attr: { src: iconUrl }"),h.setAttribute("draggable","false"),d.appendChild(h);const p=document.createElement("div");p.className="cesium-baseLayerPicker-itemLabel",p.setAttribute("data-bind","text: name"),d.appendChild(p);const f=document.createElement("div");f.className="cesium-baseLayerPicker-sectionTitle",f.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),f.innerHTML="Terrain",r.appendChild(f);const m=document.createElement("div");m.className="cesium-baseLayerPicker-section",m.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(m);const _=document.createElement("div");_.className="cesium-baseLayerPicker-category",m.appendChild(_);const g=document.createElement("div");g.className="cesium-baseLayerPicker-categoryTitle",g.setAttribute("data-bind","text: name"),_.appendChild(g);const y=document.createElement("div");y.className="cesium-baseLayerPicker-choices",y.setAttribute("data-bind","foreach: providers"),_.appendChild(y);const b=document.createElement("div");b.className="cesium-baseLayerPicker-item",b.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(b);const v=document.createElement("img");v.className="cesium-baseLayerPicker-itemIcon",v.setAttribute("data-bind","attr: { src: iconUrl }"),v.setAttribute("draggable","false"),b.appendChild(v);const A=document.createElement("div");A.className="cesium-baseLayerPicker-itemLabel",A.setAttribute("data-bind","text: name"),b.appendChild(A),Ave.applyBindings(n,i),Ave.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(e){i.contains(e.target)||r.contains(e.target)||(n.dropDownVisible=!1)},Ct.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}function zve(e){if(!D(e.name))throw new P("options.name is required.");if(!D(e.tooltip))throw new P("options.tooltip is required.");if(!D(e.iconUrl))throw new P("options.iconUrl is required.");if("function"!=typeof e.creationFunction)throw new P("options.creationFunction is required.");let t=e.creationFunction;D(t.canExecute)||(t=Lve(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=M(e.category,""),Ave.track(this,["name","tooltip","iconUrl"])}({attachToKo:function(e){e.track=Eve,e.getObservable=Cve,e.valueHasMutated=Ive,e.defineProperty=Sve}}).attachToKo(Ave),Pve.register(Ave),Object.defineProperties(Nve.prototype,{clock:{get:function(){return this._clock}}}),Nve.prototype.synchronize=function(){const e=this._clock;this.systemTime=Hn.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},Nve.prototype.isDestroyed=function(){return!1},Nve.prototype.destroy=function(){this._eventHelper.removeAll(),He(this)},Object.defineProperties(Rve.prototype,{command:{get:function(){return this._command}}}),Object.defineProperties(Fve.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}}),Object.defineProperties(Bve.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),Bve.prototype.isDestroyed=function(){return!1},Bve.prototype.destroy=function(){return Ct.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),Ave.cleanNode(this._element),Ave.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),He(this)},Object.defineProperties(zve.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});const Uve="http://www.w3.org/2000/svg",kve="http://www.w3.org/1999/xlink";let Vve;const Hve=Ot.fromCssColorString("rgba(247,250,255,0.384)"),Gve=Ot.fromCssColorString("rgba(143,191,255,0.216)"),jve=Ot.fromCssColorString("rgba(153,197,255,0.098)"),Wve=Ot.fromCssColorString("rgba(255,255,255,0.086)"),qve=Ot.fromCssColorString("rgba(255,255,255,0.267)"),Yve=Ot.fromCssColorString("rgba(255,255,255,0)"),Xve=Ot.fromCssColorString("rgba(66,67,68,0.3)"),Qve=Ot.fromCssColorString("rgba(0,0,0,0.5)");function $ve(e){return Ot.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const Kve={animation_pathReset:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"},animation_pathPause:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"},animation_pathPlay:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathPlayReverse:{tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathLoop:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"},animation_pathClock:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",d:"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"},animation_pathWingButton:{tagName:"path",d:"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z"},animation_pathPointer:{tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},animation_pathSwooshFX:{tagName:"path",d:"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z"}};function Zve(e){const t=document.createElementNS(Uve,e.tagName);for(const n in e)if(e.hasOwnProperty(n)&&"tagName"!==n)if("children"===n){const n=e.children.length;for(let i=0;i<n;++i)t.appendChild(Zve(e.children[i]))}else 0===n.indexOf("xlink:")?t.setAttributeNS(kve,n.substring(6),e[n]):"textContent"===n?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function Jve(e,t,n){const i=document.createElementNS(Uve,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const o=document.createElementNS(Uve,"tspan");return o.textContent=n,i.appendChild(o),i}const eAe=new Ot;function tAe(e,t){const n=t.alpha,i=1-n;return eAe.red=e.red*i+t.red*n,eAe.green=e.green*i+t.green*n,eAe.blue=e.blue*i+t.blue*n,eAe.toCssColorString()}function nAe(e,t,n){const i=Kve[n];return Zve({tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{tagName:"rect",class:"cesium-animation-buttonGlow",width:32,height:32,rx:2,ry:2},{tagName:"rect",class:"cesium-animation-buttonMain",width:32,height:32,rx:4,ry:4},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]})}function iAe(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;const n=this;this._clickFunction=function(){const e=n._viewModel.command;e.canExecute&&e()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[Mve(t,"toggled",this.setToggled,this),Mve(t,"tooltip",this.setTooltip,this),Mve(t.command,"canExecute",this.setEnabled,this)]}function oAe(e,t){if(!D(e))throw new P("container is required.");if(!D(t))throw new P("viewModel is required.");e=O8(e),this._viewModel=t,this._container=e,this._centerX=0,this._centerY=0,this._defsElement=void 0,this._svgNode=void 0,this._topG=void 0,this._lastHeight=void 0,this._lastWidth=void 0;const n=e.ownerDocument,i=document.createElement("style");i.textContent=".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }",n.head.insertBefore(i,n.head.childNodes[0]);const o=document.createElement("div");o.className="cesium-animation-theme",o.innerHTML='<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>',this._theme=o,this._themeNormal=o.childNodes[0],this._themeHover=o.childNodes[1],this._themeSelect=o.childNodes[2],this._themeDisabled=o.childNodes[3],this._themeKnob=o.childNodes[4],this._themePointer=o.childNodes[5],this._themeSwoosh=o.childNodes[6],this._themeSwooshHover=o.childNodes[7];const r=document.createElementNS(Uve,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",kve);const s=document.createElementNS(Uve,"g");this._topG=s,this._realtimeSVG=new iAe(function(e,t,n){const i=Kve[n],o=Kve.animation_pathWingButton;return Zve({tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{class:"cesium-animation-buttonGlow",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonMain",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]})}(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new iAe(nAe(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new iAe(nAe(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new iAe(nAe(84,99,"animation_pathPause"),t.pauseViewModel);const a=document.createElementNS(Uve,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);const c=Zve({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=c;const l=Kve.animation_pathSwooshFX,u=Kve.animation_pathPointer,d=Zve({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:l.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:l.d},{tagName:l.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:l.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=d,this._shuttleRingPointer=Zve({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:u.tagName,d:u.d});const h=Zve({tagName:"g",transform:"translate(100,100)"});this._knobOuter=Zve({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const p=Zve({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:61});this._knobDate=Jve(0,-24,""),this._knobTime=Jve(0,-7,""),this._knobStatus=Jve(0,-41,"");const f=Zve({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:61}),m=document.createElementNS(Uve,"g");m.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(m),s.appendChild(h),s.appendChild(a),m.appendChild(c),m.appendChild(d),m.appendChild(this._shuttleRingPointer),h.appendChild(this._knobOuter),h.appendChild(p),h.appendChild(this._knobDate),h.appendChild(this._knobTime),h.appendChild(this._knobStatus),h.appendChild(f),r.appendChild(s),e.appendChild(r);const _=this;function g(e){!function(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!i||Vve===e)if("mousedown"===t.type||i&&"mousemove"===t.type||"touchstart"===t.type&&1===t.touches.length||i&&"touchmove"===t.type&&1===t.touches.length){const o=e._centerX,r=e._centerY,s=e._svgNode.getBoundingClientRect();let a,c;if("touchstart"===t.type||"touchmove"===t.type?(a=t.touches[0].clientX,c=t.touches[0].clientY):(a=t.clientX,c=t.clientY),!i&&(a>s.right||a<s.left||c<s.top||c>s.bottom))return;const l=e._shuttleRingPointer.getBoundingClientRect(),u=a-o-s.left,d=c-r-s.top;let h=180*Math.atan2(d,u)/Math.PI+90;h>180&&(h-=360);const p=n.shuttleRingAngle;i||a<l.right&&a>l.left&&c>l.top&&c<l.bottom?(Vve=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=h):h<p?n.slower():h>p&&n.faster(),t.preventDefault()}else e===Vve&&(Vve=void 0),n.shuttleRingDragging=!1}(_,e)}this._mouseCallback=g,c.addEventListener("mousedown",g,!0),c.addEventListener("touchstart",g,!0),d.addEventListener("mousedown",g,!0),d.addEventListener("touchstart",g,!0),n.addEventListener("mousemove",g,!0),n.addEventListener("touchmove",g,!0),n.addEventListener("mouseup",g,!0),n.addEventListener("touchend",g,!0),n.addEventListener("touchcancel",g,!0),this._shuttleRingPointer.addEventListener("mousedown",g,!0),this._shuttleRingPointer.addEventListener("touchstart",g,!0),this._knobOuter.addEventListener("mousedown",g,!0),this._knobOuter.addEventListener("touchstart",g,!0);const y=this._knobTime.childNodes[0],b=this._knobDate.childNodes[0],v=this._knobStatus.childNodes[0];let A;this._subscriptions=[Mve(t.pauseViewModel,"toggled",(function(e){A!==e&&(A=e,A?_._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):_._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))})),Mve(t,"shuttleRingAngle",(function(e){var t,n,i;t=_._shuttleRingPointer,n=_._knobOuter,i=e,t.setAttribute("transform",`translate(100,100) rotate(${i})`),n.setAttribute("transform",`rotate(${i})`)})),Mve(t,"dateLabel",(function(e){b.textContent!==e&&(b.textContent=e)})),Mve(t,"timeLabel",(function(e){y.textContent!==e&&(y.textContent=e)})),Mve(t,"multiplierLabel",(function(e){v.textContent!==e&&(v.textContent=e)}))],this.applyThemeChanges(),this.resize()}iAe.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);const e=this._subscriptions;for(let t=0,n=e.length;t<n;t++)e[t].dispose();He(this)},iAe.prototype.isDestroyed=function(){return!1},iAe.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!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")}},iAe.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")))},iAe.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e},Object.defineProperties(oAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),oAe.prototype.isDestroyed=function(){return!1},oAe.prototype.destroy=function(){D(this._observer)&&(this._observer.disconnect(),this._observer=void 0);const e=this._container.ownerDocument,t=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",t,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",t,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",t,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",t,!0),e.removeEventListener("mousemove",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("mouseup",t,!0),e.removeEventListener("touchend",t,!0),e.removeEventListener("touchcancel",t,!0),this._shuttleRingPointer.removeEventListener("mousedown",t,!0),this._shuttleRingPointer.removeEventListener("touchstart",t,!0),this._knobOuter.removeEventListener("mousedown",t,!0),this._knobOuter.removeEventListener("touchstart",t,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();const n=this._subscriptions;for(let i=0,o=n.length;i<o;i++)n[i].dispose();return He(this)},oAe.prototype.resize=function(){const e=this._container.clientWidth,t=this._container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;const n=this._svgNode,i=200,o=132;let r=e,s=t;0===e&&0===t?(r=i,s=o):0===e?(s=t,r=i*(t/o)):0===t&&(r=e,s=o*(e/i));const a=r/i,c=s/o;n.style.cssText=`width: ${r}px; height: ${s}px; position: absolute; bottom: 0; left: 0; overflow: hidden;`,n.setAttribute("width",r),n.setAttribute("height",s),n.setAttribute("viewBox",`0 0 ${r} ${s}`),this._topG.setAttribute("transform",`scale(${a},${c})`),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*c),this._lastHeight=e,this._lastWidth=t},oAe.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(D(this._observer))return;const t=this;return t._observer=new MutationObserver((function(){e.body.contains(t._container)&&(t._observer.disconnect(),t._observer=void 0,t.applyThemeChanges())})),void t._observer.observe(e,{childList:!0,subtree:!0})}const t=$ve(this._themeNormal),n=$ve(this._themeHover),i=$ve(this._themeSelect),o=$ve(this._themeDisabled),r=$ve(this._themeKnob),s=$ve(this._themePointer),a=$ve(this._themeSwoosh),c=$ve(this._themeSwooshHover),l=Zve({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":tAe(t,Hve)},{tagName:"stop",offset:"12%","stop-color":tAe(t,Gve)},{tagName:"stop",offset:"46%","stop-color":tAe(t,jve)},{tagName:"stop",offset:"81%","stop-color":tAe(t,Wve)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":tAe(n,Hve)},{tagName:"stop",offset:"12%","stop-color":tAe(n,Gve)},{tagName:"stop",offset:"46%","stop-color":tAe(n,jve)},{tagName:"stop",offset:"81%","stop-color":tAe(n,Wve)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":tAe(i,Hve)},{tagName:"stop",offset:"12%","stop-color":tAe(i,Gve)},{tagName:"stop",offset:"46%","stop-color":tAe(i,jve)},{tagName:"stop",offset:"81%","stop-color":tAe(i,Wve)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":tAe(o,qve)},{tagName:"stop",offset:"75%","stop-color":tAe(o,Yve)}]},{id:"animation_blurred",tagName:"filter",width:"200%",height:"200%",x:"-50%",y:"-50%",children:[{tagName:"feGaussianBlur",stdDeviation:4,in:"SourceGraphic"}]},{id:"animation_shuttleRingSwooshGradient",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":a.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":c.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":tAe(s,Qve)},{tagName:"stop",offset:"100%","stop-color":tAe(s,Qve)}]},{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":tAe(r,Hve)},{tagName:"stop",offset:"60%","stop-color":tAe(r,Xve)},{tagName:"stop",offset:"85%","stop-color":tAe(r,Gve)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":tAe(r,Xve)},{tagName:"stop",offset:"60%","stop-color":tAe(r,Hve)},{tagName:"stop",offset:"85%","stop-color":tAe(r,Wve)}]}]});D(this._defsElement)?this._svgNode.replaceChild(l,this._defsElement):this._svgNode.appendChild(l),this._defsElement=l};const rAe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sAe=15,aAe=105;function cAe(e,t){return e-t}function lAe(e,t){const n=_n(t,e,cAe);return n<0?~n:n}function uAe(e){if(!D(e))throw new P("clockViewModel is required.");const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=uAe.defaultDateFormatter,this._timeFormatter=uAe.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,Ave.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(uAe.defaultTicks),this.timeLabel=void 0,Ave.defineProperty(this,"timeLabel",(function(){return t._timeFormatter(t._clockViewModel.currentTime,t)})),this.dateLabel=void 0,Ave.defineProperty(this,"dateLabel",(function(){return t._dateFormatter(t._clockViewModel.currentTime,t)})),this.multiplierLabel=void 0,Ave.defineProperty(this,"multiplierLabel",(function(){const e=t._clockViewModel;if(e.clockStep===eJ.SYSTEM_CLOCK)return"Today";const n=e.multiplier;return n%1==0?`${n.toFixed(0)}x`:`${n.toFixed(3).replace(/0{0,3}$/,"")}x`})),this.shuttleRingAngle=void 0,Ave.defineProperty(this,"shuttleRingAngle",{get:function(){return function(e,t,n){if(n.clockStep===eJ.SYSTEM_CLOCK)return sAe;if(Math.abs(e)<=1)return e*sAe;const i=t[t.length-1];let o,r;return e>i?e=i:e<-i&&(e=-i),e>0?(o=Math.log(i),r=(o-0)/90,(Math.log(e)-0)/r+15):(o=Math.log(-t[0]),r=(o-0)/90,-((Math.log(Math.abs(e))-0)/r+15))}(e.multiplier,t._allShuttleRingTicks,e)},set:function(e){e=Math.max(Math.min(e,aAe),-105);const n=t._allShuttleRingTicks,i=t._clockViewModel;if(i.clockStep=eJ.SYSTEM_CLOCK_MULTIPLIER,Math.abs(e)===aAe)return void(i.multiplier=e>0?n[n.length-1]:n[0]);let o=function(e,t){if(Math.abs(e)<=sAe)return e/sAe;let n,i;return e>0?(n=Math.log(t[t.length-1]),i=(n-0)/90,Math.exp(0+i*(e-15))):(n=Math.log(-t[0]),i=(n-0)/90,-Math.exp(0+i*(Math.abs(e)-15)))}(e,n);if(t.snapToTicks)o=n[lAe(o,n)];else if(0!==o){const e=Math.abs(o);if(e>100){const t=e.toFixed(0).length-2,n=Math.pow(10,t);o=Math.round(o/n)*n|0}else e>sAe?o=Math.round(o):e>1?o=+o.toFixed(1):e>0&&(o=+o.toFixed(2))}i.multiplier=o}}),this._canAnimate=void 0,Ave.defineProperty(this,"_canAnimate",(function(){const e=t._clockViewModel,n=e.clockRange;if(t.shuttleRingDragging||n===JZ.UNBOUNDED)return!0;const i=e.multiplier,o=e.currentTime,r=e.startTime;let s=!1;if(n===JZ.LOOP_STOP)s=Hn.greaterThan(o,r)||o.equals(r)&&i>0;else{const t=e.stopTime;s=Hn.greaterThan(o,r)&&Hn.lessThan(o,t)||o.equals(r)&&i>0||o.equals(t)&&i<0}return s||(e.shouldAnimate=!1),s})),this._isSystemTimeAvailable=void 0,Ave.defineProperty(this,"_isSystemTimeAvailable",(function(){const e=t._clockViewModel;if(e.clockRange===JZ.UNBOUNDED)return!0;const n=e.systemTime;return Hn.greaterThanOrEquals(n,e.startTime)&&Hn.lessThanOrEquals(n,e.stopTime)})),this._isAnimating=void 0,Ave.defineProperty(this,"_isAnimating",(function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)}));const n=Lve((function(){const e=t._clockViewModel;e.shouldAnimate?e.shouldAnimate=!1:t._canAnimate&&(e.shouldAnimate=!0)}));this._pauseViewModel=new Rve(n,{toggled:Ave.computed((function(){return!t._isAnimating})),tooltip:"Pause"});const i=Lve((function(){const e=t._clockViewModel,n=e.multiplier;n>0&&(e.multiplier=-n),e.shouldAnimate=!0}));this._playReverseViewModel=new Rve(i,{toggled:Ave.computed((function(){return t._isAnimating&&e.multiplier<0})),tooltip:"Play Reverse"});const o=Lve((function(){const e=t._clockViewModel,n=e.multiplier;n<0&&(e.multiplier=-n),e.shouldAnimate=!0}));this._playForwardViewModel=new Rve(o,{toggled:Ave.computed((function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==eJ.SYSTEM_CLOCK})),tooltip:"Play Forward"});const r=Lve((function(){t._clockViewModel.clockStep=eJ.SYSTEM_CLOCK}),Ave.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Rve(r,{toggled:Ave.computed((function(){return e.clockStep===eJ.SYSTEM_CLOCK})),tooltip:Ave.computed((function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"}))}),this._slower=Lve((function(){const e=t._clockViewModel,n=t._allShuttleRingTicks,i=lAe(e.multiplier,n)-1;i>=0&&(e.multiplier=n[i])})),this._faster=Lve((function(){const e=t._clockViewModel,n=t._allShuttleRingTicks,i=lAe(e.multiplier,n)+1;i<n.length&&(e.multiplier=n[i])}))}function dAe(e,t){D(t)||(t=document.body),t=O8(t);const n=this,i=Ave.observable(Ke.fullscreen),o=Ave.observable(Ke.enabled),r=t.ownerDocument;this.isFullscreen=void 0,Ave.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,Ave.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(e){o(e&&Ke.enabled)}}),this.tooltip=void 0,Ave.defineProperty(this,"tooltip",(function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"})),this._command=Lve((function(){Ke.fullscreen?Ke.exitFullscreen():Ke.requestFullscreen(n._fullscreenElement)}),Ave.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=M(O8(e),r.body),this._callback=function(){i(Ke.fullscreen)},r.addEventListener(Ke.changeEventName,this._callback)}uAe.defaultDateFormatter=function(e,t){const n=Hn.toGregorianDate(e);return`${rAe[n.month-1]} ${n.day} ${n.year}`},uAe.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],uAe.defaultTimeFormatter=function(e,t){const n=Hn.toGregorianDate(e),i=Math.round(n.millisecond);return Math.abs(t._clockViewModel.multiplier)<1?`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")}.${i.toString().padStart(3,"0")}`:`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")} UTC`},uAe.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)},uAe.prototype.setShuttleRingTicks=function(e){if(!D(e))throw new P("positiveTicks is required.");let t,n,i;const o={},r=this._sortedFilteredPositiveTicks;for(r.length=0,t=0,n=e.length;t<n;++t)i=e[t],o.hasOwnProperty(i)||(o[i]=!0,r.push(i));r.sort(cAe);const s=[];for(n=r.length,t=n-1;t>=0;--t)i=r[t],0!==i&&s.push(-i);Array.prototype.push.apply(s,r),this._allShuttleRingTicks=s},Object.defineProperties(uAe.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){if("function"!=typeof e)throw new P("dateFormatter must be a function");this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){if("function"!=typeof e)throw new P("timeFormatter must be a function");this._timeFormatter=e}}}),uAe._maxShuttleRingAngle=aAe,uAe._realtimeShuttleRingAngle=sAe,Object.defineProperties(dAe.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){if(!(e instanceof Element))throw new P("value must be a valid Element.");this._fullscreenElement=e}},command:{get:function(){return this._command}}}),dAe.prototype.isDestroyed=function(){return!1},dAe.prototype.destroy=function(){document.removeEventListener(Ke.changeEventName,this._callback),He(this)};function hAe(e,t){if(!D(e))throw new P("container is required.");const n=new dAe(t,e=O8(e));n._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",n._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";const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-fullscreenButton",i.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(i),Ave.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(hAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),hAe.prototype.isDestroyed=function(){return!1},hAe.prototype.destroy=function(){return this._viewModel.destroy(),Ave.cleanNode(this._element),this._container.removeChild(this._element),He(this)};function pAe(e){if(!D(e)||!D(e.scene))throw new P("options.scene is required.");D(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new Abe({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._wasGeocodeCancelled=!1,this._previousCredits=[],this._complete=new gi,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=mAe,this._handleArrowUp=fAe;const t=this;this._suggestionsVisible=Ave.pureComputed((function(){const e=Ave.getObservable(t,"_suggestions")().length>0,n=Ave.getObservable(t,"_showSuggestions")();return e&&n})),this._searchCommand=Lve((function(e){return e=M(e,ybe.SEARCH),t._focusTextbox=!1,D(t._selectedSuggestion)?(t.activateSuggestion(t._selectedSuggestion),!1):(t.hideSuggestions(),t.isSearchInProgress?void((n=t)._isSearchInProgress&&(n._isSearchInProgress=!1,n._wasGeocodeCancelled=!0)):async function(e,t,n){const i=e._searchText;if(vAe(i))return void e.showSuggestions();let o,r;for(e._isSearchInProgress=!0,e._wasGeocodeCancelled=!1,o=0;o<t.length;o++){if(e._wasGeocodeCancelled)return;if(r=await _Ae(t[o],i,n),D(r)&&"fulfilled"===r.state&&r.value.length>0)break}if(e._wasGeocodeCancelled)return;e._isSearchInProgress=!1,bAe(e);const s=r.value;if("fulfilled"===r.state&&D(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);return void(D(yAe(e,bbe.getCreditsFromResult(s[0])))||gAe(e,t[o].credit))}e._searchText=`${i} (not found)`}(t,t._geocoderServices,e));var n})),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(e,t){const n="ArrowDown"===t.key||"Down"===t.key||40===t.keyCode,i="ArrowUp"===t.key||"Up"===t.key||38===t.keyCode;return(n||i)&&t.preventDefault(),!0},this.handleKeyUp=function(e,n){const i="ArrowDown"===n.key||"Down"===n.key||40===n.keyCode,o="ArrowUp"===n.key||"Up"===n.key||38===n.keyCode,r="Enter"===n.key||13===n.keyCode;return o?fAe(t):i?mAe(t):r&&t._searchCommand(),!0},this.activateSuggestion=function(e){t.hideSuggestions(),t._searchText=e.displayName;const n=e.destination;AAe(t),t.destinationFound(t,n)},this.hideSuggestions=function(){t._showSuggestions=!1,t._selectedSuggestion=void 0},this.showSuggestions=function(){t._showSuggestions=!0},this.handleMouseover=function(e,n){e!==t._selectedSuggestion&&(t._selectedSuggestion=e)},this.keepExpanded=!1,this.autoComplete=M(e.autocomplete,!0),this.destinationFound=M(e.destinationFound,pAe.flyToDestination),this._focusTextbox=!1,Ave.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=Ave.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe((function(){pAe._updateSearchSuggestions(t)})),this.isSearchInProgress=void 0,Ave.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,Ave.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(e){if("string"!=typeof e)throw new P("value must be a valid string.");this._searchText=e}}),this.flightDuration=void 0,Ave.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(e){if(D(e)&&e<0)throw new P("value must be positive.");this._flightDuration=e}})}function fAe(e){if(0===e._suggestions.length)return;const t=e._suggestions.indexOf(e._selectedSuggestion);if(-1===t||0===t)return void(e._selectedSuggestion=void 0);const n=t-1;e._selectedSuggestion=e._suggestions[n],pAe._adjustSuggestionsScroll(e,n)}function mAe(e){if(0===e._suggestions.length)return;const t=e._suggestions.length,n=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[n],pAe._adjustSuggestionsScroll(e,n)}async function _Ae(e,t,n){try{return{state:"fulfilled",value:await e.geocode(t,n),credits:e.credit}}catch(i){return{state:"rejected",reason:i}}}function gAe(e,t){!D(t)||e._scene.isDestroyed()||e._scene.frameState.creditDisplay.isDestroyed()||(e._scene.frameState.creditDisplay.addStaticCredit(t),e._previousCredits.push(t))}function yAe(e,t){return D(t)&&t.forEach((t=>gAe(e,t))),t}function bAe(e){e._scene.isDestroyed()||e._scene.frameState.creditDisplay.isDestroyed()||e._previousCredits.forEach((t=>{e._scene.frameState.creditDisplay.removeStaticCredit(t)})),e._previousCredits.length=0}function vAe(e){return/^\s*$/.test(e)}function AAe(e){Ave.getObservable(e,"_suggestions").removeAll()}Object.defineProperties(pAe.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}}}),pAe.prototype.destroy=function(){this._suggestionSubscription.dispose()},pAe.flyToDestination=function(e,t){const n=e._scene,i=n.mapProjection.ellipsoid,o=n.camera,r=n.terrainProvider;let s,a=t;return t instanceof Ir?V.equalsEpsilon(t.south,t.north,V.EPSILON7)&&V.equalsEpsilon(t.east,t.west,V.EPSILON7)?t=Ir.center(t):s=yve(t,n):t=i.cartesianToCartographic(t),D(s)||(s=function(e,t){const n=D(t)?t.availability:void 0;return D(n)?Ibe(t,[e]).then((function(t){return(e=t[0]).height+=1e3,e})):(e.height+=1e3,Promise.resolve(e))}(t,r)),s.then((function(e){a=i.cartographicToCartesian(e)})).finally((function(){o.flyTo({destination:a,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:ve.IDENTITY})}))},pAe._updateSearchSuggestions=async function(e){if(!e.autoComplete)return;const t=e._searchText;if(AAe(e),bAe(e),!vAe(t))for(const n of e._geocoderServices){const i=await n.geocode(t,ybe.AUTOCOMPLETE);if(e._suggestions=e._suggestions.concat(i),i.length>0){let t=!0;i.forEach((n=>{const i=bbe.getCreditsFromResult(n);t=t&&!D(i),yAe(e,i)})),t&&gAe(e,n.credit)}if(e._suggestions.length>=5)return}},pAe._adjustSuggestionsScroll=function(e,t){const n=O8(e._viewContainer),i=n.getElementsByClassName("search-results")[0],o=n.getElementsByTagName("li")[t];if(0===t)return void(i.scrollTop=0);const r=o.offsetTop;r+o.clientHeight>i.clientHeight?i.scrollTop=r+o.clientHeight:r<i.scrollTop&&(i.scrollTop=r)},pAe.prototype.isDestroyed=function(){return!1},pAe.prototype.destroy=function(){return bAe(this),He(this)};function TAe(e){if(!D(e)||!D(e.container))throw new P("options.container is required.");if(!D(e.scene))throw new P("options.scene is required.");const t=O8(e.container),n=new pAe(e);n._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",n._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";const i=document.createElement("form");i.setAttribute("data-bind","submit: search");const o=document.createElement("input");o.type="search",o.className="cesium-geocoder-input",o.setAttribute("placeholder","Enter an address or landmark..."),o.setAttribute("data-bind",'textInput: searchText,disable: isSearchInProgress,event: { keyup: handleKeyUp, keydown: handleKeyDown, mouseover: deselectSuggestion },css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 },hasFocus: _focusTextbox'),this._onTextBoxFocus=function(){setTimeout((function(){o.select()}),0)},o.addEventListener("focus",this._onTextBoxFocus,!1),i.appendChild(o),this._textBox=o;const r=document.createElement("span");r.className="cesium-geocoder-searchButton",r.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),i.appendChild(r),t.appendChild(i);const s=document.createElement("div");s.className="search-results",s.setAttribute("data-bind","visible: _suggestionsVisible");const a=document.createElement("ul");a.setAttribute("data-bind","foreach: _suggestions");const c=document.createElement("li");a.appendChild(c),c.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),s.appendChild(a),t.appendChild(s),Ave.applyBindings(n,i),Ave.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(e){let i=e.target;"function"==typeof e.composedPath&&(i=e.composedPath()[0]),t.contains(i)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(e){n._focusTextbox=!0,n.showSuggestions()},Ct.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),t.addEventListener("pointerup",this._onInputEnd,!0),t.addEventListener("pointercancel",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),t.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),t.addEventListener("touchend",this._onInputEnd,!0),t.addEventListener("touchcancel",this._onInputEnd,!0))}function wAe(e,t){if(!D(e))throw new P("scene is required.");this._scene=e,this._duration=t;const n=this;this._command=Lve((function(){n._scene.camera.flyHome(n._duration)})),this.tooltip="View Home",Ave.track(this,["tooltip"])}function EAe(e,t,n){if(!D(e))throw new P("container is required.");e=O8(e);const i=new wAe(t,n);i._svgPath="M14,4l-10,8.75h20l-4.25-3.7188v-4.6562h-2.812v2.1875l-2.938-2.5625zm-7.0938,9.906v10.094h14.094v-10.094h-14.094zm2.1876,2.313h3.3122v4.25h-3.3122v-4.25zm5.8442,1.281h3.406v6.438h-3.406v-6.438z";const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-home-button",o.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(o),Ave.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(TAe.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}}),TAe.prototype.isDestroyed=function(){return!1},TAe.prototype.destroy=function(){const e=this._container;return Ct.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),e.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),e.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),e.removeEventListener("touchend",this._onInputEnd,!0)),this._viewModel.destroy(),Ave.cleanNode(this._form),Ave.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),He(this)},Object.defineProperties(wAe.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){if(D(e)&&e<0)throw new P("value must be positive.");this._duration=e}}}),Object.defineProperties(EAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),EAe.prototype.isDestroyed=function(){return!1},EAe.prototype.destroy=function(){return Ave.cleanNode(this._element),this._container.removeChild(this._element),He(this)};function xAe(){this._cameraClicked=new gi,this._closeClicked=new gi,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",Ave.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,Ave.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?"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":"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"}}),Ave.defineProperty(this,"_bodyless",{get:function(){return!D(this.description)||0===this.description.length}})}function SAe(e){L.defined("container",e),e=O8(e);const t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);const n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-infoBox-camera",i.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),t.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="×",t.appendChild(o);const r=document.createElement("iframe");r.className="cesium-infoBox-iframe",r.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),r.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),r.setAttribute("allowfullscreen",!0),t.appendChild(r);const s=new xAe;Ave.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;const a=this;r.addEventListener("load",(function(){const e=r.contentDocument,n=e.createElement("link");n.href=lo("Widgets/InfoBox/InfoBoxDescription.css"),n.rel="stylesheet",n.type="text/css";const i=e.createElement("div");i.className="cesium-infoBox-description",e.head.appendChild(n),e.body.appendChild(i),a._descriptionSubscription=Mve(s,"description",(function(e){r.style.height="5px",i.innerHTML=e;let n=null;const o=i.firstElementChild;if(null!==o&&1===i.childNodes.length){const e=window.getComputedStyle(o);if(null!==e){const t=e["background-color"],i=Ot.fromCssColorString(t);D(i)&&0!==i.alpha&&(n=e["background-color"])}}t.style["background-color"]=n;const s=i.getBoundingClientRect().height;r.style.height=`${s}px`}))})),r.setAttribute("src","about:blank")}function CAe(){this.showInstructions=!1;const e=this;this._command=Lve((function(){e.showInstructions=!e.showInstructions})),this._showClick=Lve((function(){e._touch=!1})),this._showTouch=Lve((function(){e._touch=!0})),this._touch=!1,this.tooltip="Navigation Instructions",Ave.track(this,["tooltip","showInstructions","_touch"])}function IAe(e){if(!D(e)||!D(e.container))throw new P("options.container is required.");const t=O8(e.container),n=new CAe,i=M(e.instructionsInitiallyVisible,!1);n.showInstructions=i,n._svgPath="M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";const o=document.createElement("span");o.className="cesium-navigationHelpButton-wrapper",t.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",r.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),o.appendChild(r);const s=document.createElement("div");s.className="cesium-navigation-help",s.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-navigation-button cesium-navigation-button-left",a.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');const c=document.createElement("img");c.src=lo("Widgets/Images/NavigationHelp/Mouse.svg"),c.className="cesium-navigation-button-icon",c.style.width="25px",c.style.height="25px",a.appendChild(c),a.appendChild(document.createTextNode("Mouse"));const l=document.createElement("button");l.type="button",l.className="cesium-navigation-button cesium-navigation-button-right",l.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');const u=document.createElement("img");u.src=lo("Widgets/Images/NavigationHelp/Touch.svg"),u.className="cesium-navigation-button-icon",u.style.width="25px",u.style.height="25px",l.appendChild(u),l.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(l);const 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="${lo("Widgets/Images/NavigationHelp/MouseLeft.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">Left click + drag</div> </td> </tr> <tr> <td><img src="${lo("Widgets/Images/NavigationHelp/MouseRight.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Right click + drag, or</div> <div class="cesium-navigation-help-details">Mouse wheel scroll</div> </td> </tr> <tr> <td><img src="${lo("Widgets/Images/NavigationHelp/MouseMiddle.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Rotate view</div> <div class="cesium-navigation-help-details">Middle click + drag, or</div> <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div> </td> </tr> </table>`,s.appendChild(d);const 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="${lo("Widgets/Images/NavigationHelp/TouchDrag.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">One finger drag</div> </td> </tr> <tr> <td><img src="${lo("Widgets/Images/NavigationHelp/TouchZoom.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Two finger pinch</div> </td> </tr> <tr> <td><img src="${lo("Widgets/Images/NavigationHelp/TouchTilt.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Tilt view</div> <div class="cesium-navigation-help-details">Two finger drag, same direction</div> </td> </tr> <tr> <td><img src="${lo("Widgets/Images/NavigationHelp/TouchRotate.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-tilt">Rotate view</div> <div class="cesium-navigation-help-details">Two finger drag, opposite direction</div> </td> </tr> </table>`,s.appendChild(h),Ave.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(e){o.contains(e.target)||(n.showInstructions=!1)},Ct.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}function OAe(e){if(!D(e))throw new P("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof Xc,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,Ave.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;Ave.defineProperty(this,"selectedTooltip",(function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective})),this._toggleDropDown=Lve((function(){t.sceneMode===gl.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)})),this._eventHelper=new KX,this._eventHelper.add(e.morphComplete,(function(e,n,i,o){t.sceneMode=i,t._orthographic=i===gl.SCENE2D||t._scene.camera.frustum instanceof Xc})),this._eventHelper.add(e.preRender,(function(){t._flightInProgress=D(e.camera._currentFlight)})),this._switchToPerspective=Lve((function(){t.sceneMode!==gl.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)})),this._switchToOrthographic=Lve((function(){t.sceneMode!==gl.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)})),this._sceneMode=gl}xAe.prototype.maxHeightOffset=function(e){return this.maxHeight-e+"px"},Object.defineProperties(xAe.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}}),Object.defineProperties(SAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}}),SAe.prototype.isDestroyed=function(){return!1},SAe.prototype.destroy=function(){const e=this._container;return Ave.cleanNode(this._element),e.removeChild(this._element),D(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),He(this)},Object.defineProperties(CAe.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}}),Object.defineProperties(IAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),IAe.prototype.isDestroyed=function(){return!1},IAe.prototype.destroy=function(){return Ct.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),Ave.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),He(this)},Object.defineProperties(OAe.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}}}),OAe.prototype.isDestroyed=function(){return!1},OAe.prototype.destroy=function(){this._eventHelper.removeAll(),He(this)};function DAe(e,t){if(!D(e))throw new P("container is required.");if(!D(t))throw new P("scene is required.");e=O8(e);const n=new OAe(t);n._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",n._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";const i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button",o.setAttribute("data-bind",'css: { "cesium-projectionPicker-buttonPerspective": !_orthographic, "cesium-projectionPicker-buttonOrthographic": _orthographic, "cesium-button-disabled" : sceneMode === _sceneMode.SCENE2D || _flightInProgress, "cesium-projectionPicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),o.innerHTML='\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',i.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",r.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && _orthographic), "cesium-projectionPicker-none" : !_orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible },attr: { title: tooltipPerspective },click: switchToPerspective,cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64 }'),i.appendChild(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && !_orthographic), "cesium-projectionPicker-none" : _orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible},attr: { title: tooltipOrthographic },click: switchToOrthographic,cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64 }'),i.appendChild(s),Ave.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(e){i.contains(e.target)||(n.dropDownVisible=!1)},Ct.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}function PAe(e,t){if(!D(e))throw new P("scene is required.");this._scene=e;const n=this;this._eventHelper=new KX,this._eventHelper.add(e.morphStart,(function(e,t,i,o){n.sceneMode=i,n.dropDownVisible=!1})),this._duration=M(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",Ave.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,Ave.defineProperty(this,"selectedTooltip",(function(){const e=n.sceneMode;return e===gl.SCENE2D?n.tooltip2D:e===gl.SCENE3D?n.tooltip3D:n.tooltipColumbusView})),this._toggleDropDown=Lve((function(){n.dropDownVisible=!n.dropDownVisible})),this._morphTo2D=Lve((function(){e.morphTo2D(n._duration)})),this._morphTo3D=Lve((function(){e.morphTo3D(n._duration)})),this._morphToColumbusView=Lve((function(){e.morphToColumbusView(n._duration)})),this._sceneMode=gl}Object.defineProperties(DAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),DAe.prototype.isDestroyed=function(){return!1},DAe.prototype.destroy=function(){return this._viewModel.destroy(),Ct.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),Ave.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),He(this)},Object.defineProperties(PAe.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){if(e<0)throw new P("duration value must be positive.");this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}}),PAe.prototype.isDestroyed=function(){return!1},PAe.prototype.destroy=function(){this._eventHelper.removeAll(),He(this)};function NAe(e,t,n){if(!D(e))throw new P("container is required.");if(!D(t))throw new P("scene is required.");e=O8(e);const i=new PAe(t,n);i._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",i._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",i._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";const o=document.createElement("span");o.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind",'css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),r.innerHTML='\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',o.appendChild(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip3D },click: morphTo3D,cesiumSvgPath: { path: _globePath, width: 64, height: 64 }'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",a.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),o.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",c.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-hidden" : !dropDownVisible},attr: { title: tooltipColumbusView },click: morphToColumbusView,cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64 }'),o.appendChild(c),Ave.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(e){o.contains(e.target)||(i.dropDownVisible=!1)},Ct.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(NAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),NAe.prototype.isDestroyed=function(){return!1},NAe.prototype.destroy=function(){return this._viewModel.destroy(),Ct.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),Ave.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),He(this)};const RAe=new kt,LAe="-1000px";function MAe(e,t,n){if(!D(e))throw new P("scene is required.");if(!D(t))throw new P("selectionIndicatorElement is required.");if(!D(n))throw new P("container is required.");this._scene=e,this._screenPositionX=LAe,this._screenPositionY=LAe,this._tweens=e.tweens,this._container=M(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,Ave.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,Ave.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&D(this.position)}}),Ave.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(t,n){return QR.wgs84ToWindowCoordinates(e,t,n)}}function FAe(e,t){if(!D(e))throw new P("container is required.");e=O8(e),this._container=e;const n=document.createElement("div");n.className="cesium-selection-wrapper",n.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(n),this._element=n;const i="http://www.w3.org/2000/svg",o=document.createElementNS(i,"svg:svg");o.setAttribute("width",160),o.setAttribute("height",160),o.setAttribute("viewBox","0 0 160 160");const r=document.createElementNS(i,"g");r.setAttribute("transform","translate(80,80)"),o.appendChild(r);const s=document.createElementNS(i,"path");s.setAttribute("data-bind","attr: { transform: _transform }"),s.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"),r.appendChild(s),n.appendChild(o);const a=new MAe(t,this._element,this._container);this._viewModel=a,Ave.applyBindings(this._viewModel,this._element)}function BAe(e,t,n){this._color=e,this._height=t,this._base=M(n,0)}function zAe(e,t,n,i){this.interval=e,this.height=t,this.color=n||new Ot(.5,.5,.5,1),this.backgroundColor=i||new Ot(0,0,0,0)}MAe.prototype.update=function(){if(this.showSelection&&D(this.position)){const e=this.computeScreenSpacePosition(this.position,RAe);if(D(e)){const t=this._container,n=t.parentNode.clientWidth,i=t.parentNode.clientHeight,o=this._selectionIndicatorElement.clientWidth,r=.5*o;e.x=Math.min(Math.max(e.x,-o),n+o)-r,e.y=Math.min(Math.max(e.y,-o),i+o)-r,this._screenPositionX=`${Math.floor(e.x+.25)}px`,this._screenPositionY=`${Math.floor(e.y+.25)}px`}else this._screenPositionX=LAe,this._screenPositionY=LAe}},MAe.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:k8.EXPONENTIAL_OUT})},MAe.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:k8.EXPONENTIAL_OUT})},Object.defineProperties(MAe.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}}),Object.defineProperties(FAe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),FAe.prototype.isDestroyed=function(){return!1},FAe.prototype.destroy=function(){const e=this._container;return Ave.cleanNode(this._element),e.removeChild(this._element),He(this)},BAe.prototype.getHeight=function(){return this._height},BAe.prototype.getBase=function(){return this._base},BAe.prototype.getStartTime=function(){return this._start},BAe.prototype.getStopTime=function(){return this._stop},BAe.prototype.setRange=function(e,t){this._start=e,this._stop=t},BAe.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=Hn.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const o=Hn.secondsDifference(this._stop,e.epochJulian);let r=Math.round(e.timeBarWidth*e.getAlpha(o))-i;i<0&&(r+=i,i=0),i+r>e.timeBarWidth&&(r=e.timeBarWidth-i),r>0&&(t=`<span class="cesium-timeline-highlight" style="left: ${i.toString()}px; width: ${r.toString()}px; bottom: ${this._base.toString()}px; height: ${this._height}px; background-color: ${this._color};"></span>`)}return t},zAe.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=Hn.addSeconds(t.startJulian,t.duration,new Hn);if(Hn.lessThan(n,o)&&Hn.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(Hn.lessThanOrEquals(n,r)&&Hn.greaterThanOrEquals(i,o)){let o,r,s;for(o=0;o<t.timeBarWidth;++o){const e=Hn.addSeconds(t.startJulian,o/t.timeBarWidth*t.duration,new Hn);!D(r)&&Hn.greaterThanOrEquals(e,n)?r=o:!D(s)&&Hn.greaterThanOrEquals(e,i)&&(s=o)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),D(r)&&(D(s)||(s=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(r,t.y,Math.max(s-r,1),this.height))}};let UAe=1e12;const kAe=0,VAe=1,HAe=2,GAe=3,jAe=4,WAe=0,qAe=1,YAe=2,XAe=3,QAe=4,$Ae=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],KAe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ZAe(e,t){if(!D(e))throw new P("container is required.");if(!D(t))throw new P("clock is required.");const n=(e=O8(e)).ownerDocument;this.container=e;const i=n.createElement("div");var o;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=kAe,this._touchMode=WAe,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=(o=this,function(e){o._mouseMode!==jAe&&(0===e.button?(o._mouseMode=VAe,o._scrubElement&&(o._scrubElement.style.backgroundPosition="-16px 0"),o._onMouseMove(e)):(o._mouseX=e.clientX,2===e.button?o._mouseMode=GAe:o._mouseMode=HAe)),e.preventDefault()}),this._onMouseUp=function(e){return function(t){e._mouseMode=kAe,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}(this),this._onMouseMove=function(e){return function(t){let n;if(e._mouseMode===VAe){t.preventDefault();const n=t.clientX-e._topDiv.getBoundingClientRect().left;n<0?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):n>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(n,n*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===HAe){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,0!==n){const t=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(Hn.addSeconds(e._startJulian,t,new Hn),Hn.addSeconds(e._endJulian,t,new Hn))}}else e._mouseMode===GAe&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,0!==n&&e.zoomFrom(Math.pow(1.01,n)))}}(this),this._onMouseWheel=function(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;UAe=Math.max(Math.min(Math.abs(n),UAe),1),n/=UAe,e.zoomFrom(Math.pow(1.05,-n))}}(this),this._onTouchStart=function(e){return function(t){const n=t.touches.length;let i,o;const r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=jAe,1===n?(i=Hn.secondsDifference(e._scrubJulian,e._startJulian),o=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+r),Math.abs(t.touches[0].clientX-o)<50?(e._touchMode=qAe,e._scrubElement&&(e._scrubElement.style.backgroundPosition=1===n?"-16px 0":"0 0")):(e._touchMode=XAe,e._touchState.centerX=t.touches[0].clientX-r)):2===n?(e._touchMode=YAe,e._touchState.centerX=.5*(t.touches[0].clientX+t.touches[1].clientX)-r,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=QAe}}(this),this._onTouchMove=function(e){return function(t){let n,i,o,r,s,a,c=1;const l=e._topDiv.getBoundingClientRect().left;e._touchMode===XAe&&(e._touchMode=YAe),e._mouseMode=jAe,e._touchMode===qAe?(t.preventDefault(),1===t.changedTouches.length&&(i=t.changedTouches[0].clientX-l,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===YAe&&(o=t.touches.length,2===o?(r=.5*(t.touches[0].clientX+t.touches[1].clientX)-l,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):1===o&&(r=t.touches[0].clientX-l,s=0),D(r)&&(s>0&&e._touchState.spanX>0?(c=e._touchState.spanX/s,a=Hn.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new Hn)):(n=e._touchState.centerX-r,a=Hn.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new Hn)),e.zoomTo(a,Hn.addSeconds(a,e._timeBarSecondsSpan*c,new Hn)),e._touchState.centerX=r,e._touchState.spanX=s))}}(this),this._onTouchEnd=function(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===XAe?(e._touchMode=qAe,e._onTouchMove(t)):e._touchMode===qAe&&e._onTouchMove(t),e._mouseMode=jAe,1!==n?e._touchMode=n>0?QAe:WAe:e._touchMode===YAe&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}(this);const r=this._timeBarEle;n.addEventListener("mouseup",this._onMouseUp,!1),n.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 JAe(e){return e<10?`0${e.toString()}`:e.toString()}ZAe.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)},ZAe.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)},ZAe.prototype.isDestroyed=function(){return!1},ZAe.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this);const e=this.container.ownerDocument;e.removeEventListener("mouseup",this._onMouseUp,!1),e.removeEventListener("mousemove",this._onMouseMove,!1);const t=this._timeBarEle;t.removeEventListener("mousedown",this._onMouseDown,!1),t.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),t.removeEventListener("mousewheel",this._onMouseWheel,!1),t.removeEventListener("touchstart",this._onTouchStart,!1),t.removeEventListener("touchmove",this._onTouchMove,!1),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),He(this)},ZAe.prototype.addHighlightRange=function(e,t,n){const i=new BAe(e,t,n);return this._highlightRanges.push(i),this.resize(),i},ZAe.prototype.addTrack=function(e,t,n,i){const o=new zAe(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o},ZAe.prototype.zoomTo=function(e,t){if(!D(e))throw new P("startTime is required.");if(!D(t))throw new P("stopTime is required");if(Hn.lessThanOrEquals(t,e))throw new P("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=Hn.secondsDifference(t,e),this._clock&&this._clock.clockRange!==JZ.UNBOUNDED){const e=this._clock.startTime,t=this._clock.stopTime,n=Hn.secondsDifference(t,e),i=Hn.secondsDifference(e,this._startJulian),o=Hn.secondsDifference(t,this._endJulian);this._timeBarSecondsSpan>=n?(this._timeBarSecondsSpan=n,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):i>0?(this._endJulian=Hn.addSeconds(this._endJulian,i,new Hn),this._startJulian=e,this._timeBarSecondsSpan=Hn.secondsDifference(this._endJulian,this._startJulian)):o<0&&(this._startJulian=Hn.addSeconds(this._startJulian,o,new Hn),this._endJulian=t,this._timeBarSecondsSpan=Hn.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();const n=document.createEvent("Event");n.initEvent("setzoom",!0,!0),n.startJulian=this._startJulian,n.endJulian=this._endJulian,n.epochJulian=this._epochJulian,n.totalSpan=this._timeBarSecondsSpan,n.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(n)},ZAe.prototype.zoomFrom=function(e){let t=Hn.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=.5*this._timeBarSecondsSpan:t+=t-.5*this._timeBarSecondsSpan;const n=this._timeBarSecondsSpan-t;this.zoomTo(Hn.addSeconds(this._startJulian,t-t*e,new Hn),Hn.addSeconds(this._endJulian,n*e-n,new Hn))},ZAe.prototype.makeLabel=function(e){const t=Hn.toGregorianDate(e),n=t.millisecond;let i=" UTC";if(n>0&&this._timeBarSecondsSpan<3600){for(i=Math.floor(n).toString();i.length<3;)i=`0${i}`;i=`.${i}`}return`${KAe[t.month-1]} ${t.day} ${t.year} ${JAe(t.hour)}:${JAe(t.minute)}:${JAe(t.second)}${i}`},ZAe.prototype.smallestTicInPixels=7,ZAe.prototype._makeTics=function(){const e=this._timeBarEle,t=Hn.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8;let o;const r=this;this._needleEle.style.left=`${n.toString()}px`;let s="";const a=.01,c=31536e6,l=1e-10;let u=0,d=this._timeBarSecondsSpan;d<a?(d=a,this._timeBarSecondsSpan=a,this._endJulian=Hn.addSeconds(this._startJulian,a,new Hn)):d>c&&(d=c,this._timeBarSecondsSpan=c,this._endJulian=Hn.addSeconds(this._startJulian,c,new Hn));let h=this._timeBarEle.clientWidth;h<10&&(h=10);const p=this._startJulian,f=Math.min(d/h*1e-5,.4);let m;const _=Hn.toGregorianDate(p);m=d>31536e4?Hn.fromDate(new Date(Date.UTC(100*Math.floor(_.year/100),0))):d>31536e3?Hn.fromDate(new Date(Date.UTC(10*Math.floor(_.year/10),0))):d>86400?Hn.fromDate(new Date(Date.UTC(_.year,0))):Hn.fromDate(new Date(Date.UTC(_.year,_.month,_.day)));const g=Hn.secondsDifference(this._startJulian,Hn.addSeconds(m,f,new Hn));let y=g+d;function b(e){return Math.floor(g/e)*e}function v(e,t){return Math.ceil(e/t+.5)*t}function A(e){return(e-g)/d}function T(e,t){return e-t*Math.round(e/t)}this._epochJulian=m,this._rulerEle.innerHTML=this.makeLabel(Hn.addSeconds(this._endJulian,-.01,new Hn));let w=this._rulerEle.offsetWidth+20;w<30&&(w=180);const E=u;u-=l;const x={startTime:g,startJulian:p,epochJulian:m,duration:d,timeBarWidth:h,getAlpha:A};this._highlightRanges.forEach((function(e){s+=e.render(x)}));let S=0,C=0,I=0,O=w/h;O>1&&(O=1),O*=this._timeBarSecondsSpan;let D=-1,P=-1;const N=$Ae.length;let R;for(R=0;R<N;++R){const e=$Ae[R];if(++D,S=e,e>O&&e>u)break;P<0&&h*(e/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(P=D)}if(D>0){for(;D>0;)if(--D,Math.abs(T(S,$Ae[D]))<1e-5){$Ae[D]>=u&&(C=$Ae[D]);break}if(P>=0)for(;P<D;){if(Math.abs(T(C,$Ae[P]))<1e-5&&$Ae[P]>=u){I=$Ae[P];break}++P}}u=E,u>l&&I<1e-5&&Math.abs(u-S)>l&&(I=u,u<=S+l&&(C=0));let L,M=-999999;if(h*(I/this._timeBarSecondsSpan)>=3)for(o=b(I);o<=y;o=v(o,I))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(h*A(o)).toString()}px;"></span>`;if(h*(C/this._timeBarSecondsSpan)>=3)for(o=b(C);o<=y;o=v(o,C))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(h*A(o)).toString()}px;"></span>`;if(h*(S/this._timeBarSecondsSpan)>=2){this._mainTicSpan=S,y+=S,o=b(S);const e=Hn.computeTaiMinusUtc(m);for(;o<=y;){let t=Hn.addSeconds(p,o-g,new Hn);if(S>2.1){const n=Hn.computeTaiMinusUtc(t);Math.abs(n-e)>.1&&(o+=n-e,t=Hn.addSeconds(p,o-g,new Hn))}const n=Math.round(h*A(o)),i=this.makeLabel(t);this._rulerEle.innerHTML=i,L=this._rulerEle.offsetWidth,L<10&&(L=w);const r=n-(L/2-1);r>M?(M=r+L+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${n.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${r.toString()}px;">${i}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${n.toString()}px;"></span>`,o=v(o,S)}}else this._mainTicSpan=-1;s+=`<span class="cesium-timeline-icon16" style="left:${i}px;bottom:0;background-position: 0 0;"></span>`,e.innerHTML=s,this._scrubElement=e.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),x.y=0,this._trackList.forEach((function(e){e.render(r._context,x),x.y+=e.height}))},ZAe.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(D(this._scrubElement)){const t=Hn.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==n&&(this._lastXPos=n,e.style.left=n-8+"px",this._needleEle.style.left=`${n}px`)}D(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(Hn.addSeconds(this._startJulian,this._timelineDrag,new Hn),Hn.addSeconds(this._endJulian,this._timelineDrag,new Hn)))},ZAe.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=Hn.addSeconds(this._startJulian,t,new Hn),this._scrubElement){const t=e-8;this._scrubElement.style.left=`${t.toString()}px`,this._needleEle.style.left=`${e.toString()}px`}const n=document.createEvent("Event");n.initEvent("settime",!0,!0),n.clientX=e,n.timeSeconds=t,n.timeJulian=this._scrubJulian,n.clock=this._clock,this._topDiv.dispatchEvent(n)},ZAe.prototype.resize=function(){const e=this.container.clientWidth,t=this.container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;this._trackContainer.style.height=`${t}px`;let n=1;this._trackList.forEach((function(e){n+=e.height})),this._trackListEle.style.height=`${n.toString()}px`,this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=n,this._makeTics(),this._lastXPos=void 0,this._lastWidth=e,this._lastHeight=t};const{webm:eTe,mp4:tTe}={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",mp4:"data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"},nTe=()=>"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,iTe=()=>"wakeLock"in navigator;var oTe=class{constructor(){if(this.enabled=!1,iTe()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else nTe()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",eTe),this._addSourceToVideo(this.noSleepVideo,"mp4",tTe),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,n){var i=document.createElement("source");i.src=n,i.type=`video/${t}`,e.appendChild(i)}get isEnabled(){return this.enabled}enable(){if(iTe())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,this._wakeLock.addEventListener("release",(()=>{}))})).catch((e=>{throw this.enabled=!1,e}));if(nTe())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){iTe()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):nTe()?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}};function rTe(){const e=window.screen;D(e)&&(D(e.unlockOrientation)?e.unlockOrientation():D(e.mozUnlockOrientation)?e.mozUnlockOrientation():D(e.msUnlockOrientation)?e.msUnlockOrientation():D(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function sTe(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(rTe(),e._locked=!1),e._noSleep.disable(),Ke.exitFullscreen(),n(!1)):(Ke.fullscreen||Ke.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=function(e){let t=!1;const n=window.screen;return D(n)&&(D(n.lockOrientation)?t=n.lockOrientation(e):D(n.mozLockOrientation)?t=n.mozLockOrientation(e):D(n.msLockOrientation)?t=n.msLockOrientation(e):D(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}("landscape")),t.useWebVR=!0,n(!0)))}function aTe(e,t){if(!D(e))throw new P("scene is required.");const n=this,i=Ave.observable(Ke.enabled),o=Ave.observable(!1);this.isVRMode=void 0,Ave.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,Ave.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(e){i(e&&Ke.enabled)}}),this.tooltip=void 0,Ave.defineProperty(this,"tooltip",(function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"}));const r=Ave.observable(!1);this._isOrthographic=void 0,Ave.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new KX,this._eventHelper.add(e.preRender,(function(){r(e.camera.frustum instanceof Xc)})),this._locked=!1,this._noSleep=new oTe,this._command=Lve((function(){sTe(n,e,o,r)}),Ave.getObservable(this,"isVREnabled")),this._vrElement=M(O8(t),document.body),this._callback=function(){!Ke.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(rTe(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(Ke.changeEventName,this._callback)}Object.defineProperties(aTe.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){if(!(e instanceof Element))throw new P("value must be a valid Element.");this._vrElement=e}},command:{get:function(){return this._command}}}),aTe.prototype.isDestroyed=function(){return!1},aTe.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(Ke.changeEventName,this._callback),He(this)};function cTe(e,t,n){if(!D(e))throw new P("container is required.");if(!D(t))throw new P("scene is required.");e=O8(e);const i=new aTe(t,n);i._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",i._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";const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-vrButton",o.setAttribute("data-bind",'css: { "cesium-button-disabled" : _isOrthographic }, attr: { title: tooltip },click: command,enable: isVREnabled,cesiumSvgPath: { path: isVRMode ? _exitVRPath : _enterVRPath, width: 32, height: 32 }'),e.appendChild(o),Ave.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(cTe.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}}),cTe.prototype.isDestroyed=function(){return!1},cTe.prototype.destroy=function(){return this._viewModel.destroy(),Ave.cleanNode(this._element),this._container.removeChild(this._element),He(this)};const lTe=new $u;function uTe(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function dTe(e){const t=e.getPropertyIds();let n="";return t.forEach((function(t){const i=e.getProperty(t);D(i)&&(n+=`<tr><th>${t}</th><td>${i}</td></tr>`)})),n.length>0&&(n=`<table class="cesium-infoBox-defaultTable"><tbody>${n}</tbody></table>`),n}function hTe(e){let t;const n=[],i=e.getPropertyIds();for(t=0;t<i.length;t++){const o=i[t];/^name$/i.test(o)?n[0]=e.getProperty(o):/name/i.test(o)?n[1]=e.getProperty(o):/^title$/i.test(o)?n[2]=e.getProperty(o):/^(id|identifier)$/i.test(o)?n[3]=e.getProperty(o):/element/i.test(o)?n[4]=e.getProperty(o):/(id|identifier)$/i.test(o)&&(n[5]=e.getProperty(o))}const o=n.length;for(t=0;t<o;t++){const e=n[t];if(D(e)&&""!==e)return e}return"Unnamed Feature"}function pTe(e,t){const n=e.scene.pick(t.position);if(D(n)){const e=M(n.id,n.primitive.id);if(e instanceof _A)return e;if(n instanceof uE)return new _A({name:hTe(n),description:dTe(n),feature:n})}if(D(e.scene.globe))return function(e,t){const n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!D(o))return;const r=new _A({id:"Loading...",description:"Loading feature information..."});return o.then((function(t){if(e.selectedEntity!==r)return;if(!D(t)||0===t.length)return void(e.selectedEntity=gTe());const n=t[0],i=new _A({id:n.name,description:n.description});if(D(n.position)){const t=e.scene.globe.ellipsoid.cartographicToCartesian(n.position,_Te);i.position=new zv(t)}e.selectedEntity=i}),(function(){e.selectedEntity===r&&(e.selectedEntity=gTe())})),r}(e,t.position)}const fTe=new Hn;function mTe(e,t,n){if(D(n)){const i=n.clock;if(D(i)&&(i.getValue(t),D(e))){const t=i.startTime;let n=i.stopTime;Hn.equals(t,n)&&(n=Hn.addSeconds(t,V.EPSILON2,fTe)),e.updateFromClock(),e.zoomTo(t,n)}}}const _Te=new H;function gTe(){return new _A({id:"None",description:"No features found."})}function yTe(e,t){if(!D(e))throw new P("container is required.");e=O8(e);const n=!(D((t=M(t,M.EMPTY_OBJECT)).globe)&&!1===t.globe||D(t.baseLayerPicker)&&!1===t.baseLayerPicker);if(!n&&D(t.selectedImageryProviderViewModel))throw new P("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.baseLayer instead or set options.baseLayerPicker to true.");if(!n&&D(t.selectedTerrainProviderViewModel))throw new P("options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true.");const i=this,o=document.createElement("div");o.className="cesium-viewer",e.appendChild(o);const r=document.createElement("div");r.className="cesium-viewer-cesiumWidgetContainer",o.appendChild(r);const s=document.createElement("div");s.className="cesium-viewer-bottom",o.appendChild(s);const a=M(t.scene3DOnly,!1);let c,l,u=!1;D(t.clockViewModel)?(l=t.clockViewModel,c=l.clock):(c=new sJ,l=new Nve(c),u=!0),D(t.shouldAnimate)&&(c.shouldAnimate=t.shouldAnimate);const d=new Sye(r,{baseLayer:!(n||D(t.baseLayer)||D(t.imageryProvider))&&void 0,clock:c,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:D(t.creditContainer)?t.creditContainer:s,creditViewport:t.creditViewport,scene3DOnly:a,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,blurActiveElementOnCanvasFocus:t.blurActiveElementOnCanvasFocus,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});let h=t.dataSources,p=!1;D(h)||(h=new bJ,p=!0);const f=d.scene,m=new u8({scene:f,dataSourceCollection:h}),_=new KX;let g,y;if(_.add(c.onTick,yTe.prototype._onTick,this),_.add(f.morphStart,yTe.prototype._clearTrackedObject,this),!D(t.selectionIndicator)||!1!==t.selectionIndicator){const e=document.createElement("div");e.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(e),g=new FAe(e,f)}if(!D(t.infoBox)||!1!==t.infoBox){const e=document.createElement("div");e.className="cesium-viewer-infoBoxContainer",o.appendChild(e),y=new SAe(e);const t=y.viewModel;_.add(t.cameraClicked,yTe.prototype._onInfoBoxCameraClicked,this),_.add(t.closeClicked,yTe.prototype._onInfoBoxClockClicked,this)}const b=document.createElement("div");let v,A,T,w,E,x,S,C,I,O,N,R,L,F,B;if(b.className="cesium-viewer-toolbar",o.appendChild(b),!D(t.geocoder)||!1!==t.geocoder){const e=document.createElement("div");let n;e.className="cesium-viewer-geocoderContainer",b.appendChild(e),D(t.geocoder)&&"boolean"!=typeof t.geocoder&&(n=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),v=new TAe({container:e,geocoderServices:n,scene:f}),_.add(v.viewModel.search.beforeExecute,yTe.prototype._clearObjects,this)}if(D(t.homeButton)&&!1===t.homeButton||(A=new EAe(b,f),D(v)&&_.add(A.viewModel.command.afterExecute,(function(){const e=v.viewModel;e.searchText="",e.isSearchInProgress&&e.search()})),_.add(A.viewModel.command.beforeExecute,yTe.prototype._clearTrackedObject,this)),!0===t.sceneModePicker&&a)throw new P("options.sceneModePicker is not available when options.scene3DOnly is set to true.");if(a||D(t.sceneModePicker)&&!1===t.sceneModePicker||(T=new NAe(b,f)),t.projectionPicker&&(w=new DAe(b,f)),n){const e=M(t.imageryProviderViewModels,function(){const e=[],t=devicePixelRatio>=2;return e.push(new zve({name:"Bing Maps Aerial",iconUrl:lo("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return T7({style:A7.AERIAL})}})),e.push(new zve({name:"Bing Maps Aerial with Labels",iconUrl:lo("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return T7({style:A7.AERIAL_WITH_LABELS})}})),e.push(new zve({name:"Bing Maps Roads",iconUrl:lo("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return T7({style:A7.ROAD})}})),e.push(new zve({name:"ArcGIS World Imagery",iconUrl:lo("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png"),tooltip:"ArcGIS World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes 15m TerraColor imagery at small and mid-scales (~1:591M down to ~1:288k) for the world. The map features Maxar imagery at 0.3m resolution for select metropolitan areas around the world, 0.5m resolution across the United States and parts of Western Europe, and 1m resolution imagery across the rest of the world. In addition to commercial sources, the World Imagery map features high-resolution aerial photography contributed by the GIS User Community. This imagery ranges from 0.3m to 0.03m resolution (down to ~1:280 nin select communities). For more information on this map, including the terms of use, visit us online at \nhttps://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9",category:"Other",creationFunction:function(){return c6.fromBasemapType(r6.SATELLITE,{enablePickFeatures:!1})}})),e.push(new zve({name:"ArcGIS World Hillshade",iconUrl:lo("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png"),tooltip:"ArcGIS World Hillshade map portrays elevation as an artistic hillshade. This map is designed to be used as a backdrop for topographical, soil, hydro, landcover or other outdoor recreational maps. The map was compiled from a variety of sources from several data providers. The basemap has global coverage down to a scale of ~1:72k. In select areas of the United States and Europe, coverage is available down to ~1:9k. For more information on this map, including the terms of use, visit us online at \nhttps://www.arcgis.com/home/item.html?id=1b243539f4514b6ba35e7d995890db1d",category:"Other",creationFunction:function(){return c6.fromBasemapType(r6.HILLSHADE,{enablePickFeatures:!1})}})),e.push(new zve({name:"Esri World Ocean",iconUrl:lo("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png"),tooltip:"ArcGIS World Ocean map is designed to be used as a base map by marine GIS professionals and as a reference map by anyone interested in ocean data. The base map features marine bathymetry. Land features include inland waters and roads overlaid on land cover and shaded relief imagery. The map was compiled from a variety of best available sources from several data providers, including General Bathymetric Chart of the Oceans GEBCO_08 Grid, National Oceanic and Atmospheric Administration (NOAA), and National Geographic, Garmin, HERE, Geonames.org, and Esri, and various other contributors. The base map currently provides coverage for the world down to a scale of ~1:577k, and coverage down to 1:72k in US coastal areas, and various other areas. Coverage down to ~ 1:9k is available limited areas based on regional hydrographic survey data. The base map was designed and developed by Esri. For more information on this map, including our terms of use, visit us online at \nhttps://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500",category:"Other",creationFunction:function(){return c6.fromBasemapType(r6.OCEANS,{enablePickFeatures:!1})}})),e.push(new zve({name:"OpenStreetMap",iconUrl:lo("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:"OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org",category:"Other",creationFunction:function(){return new Dbe({url:"https://tile.openstreetmap.org/"})}})),e.push(new zve({name:"Stadia x Stamen Watercolor",iconUrl:lo("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:"Based on the original basemaps created for the Knight Foundation and reminiscent of hand drawn maps, the watercolor maps from Stamen Design apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.\nhttps://docs.stadiamaps.com/map-styles/stamen-watercolor/",category:"Other",creationFunction:function(){return new Dbe({url:"https://tiles.stadiamaps.com/tiles/stamen_watercolor/",fileExtension:"jpg",credit:'© <a href="https://stamen.com/" target="_blank">Stamen Design</a>\n © <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>\n © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>\n © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>'})}})),e.push(new zve({name:"Stadia x Stamen Toner",iconUrl:lo("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:"Based on the original basemaps created for the Knight Foundation and the most popular of the excellent styles from Stamen Design, these high-contrast B+W (black and white) maps are the perfect backdrop for your colorful and eye-catching overlays.\nhttps://docs.stadiamaps.com/map-styles/stamen-toner/",category:"Other",creationFunction:function(){return new Dbe({url:"https://tiles.stadiamaps.com/tiles/stamen_toner/",retinaTiles:t,credit:'© <a href="https://stamen.com/" target="_blank">Stamen Design</a>\n © <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>\n © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>\n © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>'})}})),e.push(new zve({name:"Stadia Alidade Smooth",iconUrl:lo("Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png"),tooltip:"Stadia's custom Alidade Smooth style is designed for maps that use a lot of markers or overlays. It features a muted color scheme and fewer points of interest to allow your added data to shine.\nhttps://docs.stadiamaps.com/map-styles/alidade-smooth/",category:"Other",creationFunction:function(){return new Dbe({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth/",retinaTiles:t,credit:'© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>\n © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>\n © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>'})}})),e.push(new zve({name:"Stadia Alidade Smooth Dark",iconUrl:lo("Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png"),tooltip:"Stadia Alidade Smooth Dark, like its lighter cousin, is also designed to stay out of the way. It just flips the dark mode switch on the color scheme. With the lights out, your data can now literally shine.\nhttps://docs.stadiamaps.com/map-styles/alidade-smooth-dark/",category:"Other",creationFunction:function(){return new Dbe({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/",retinaTiles:t,credit:'© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>\n © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>\n © <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>'})}})),e.push(new zve({name:"Sentinel-2",iconUrl:lo("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",category:"Cesium ion",creationFunction:function(){return v7.fromAssetId(3954)}})),e.push(new zve({name:"Blue Marble",iconUrl:lo("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return v7.fromAssetId(3845)}})),e.push(new zve({name:"Earth at night",iconUrl:lo("Widgets/Images/ImageryProviders/earthAtNight.png"),tooltip:"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",category:"Cesium ion",creationFunction:function(){return v7.fromAssetId(3812)}})),e.push(new zve({name:"Natural Earth II",iconUrl:lo("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:"Natural Earth II, darkened for contrast.\nhttp://www.naturalearthdata.com/",category:"Cesium ion",creationFunction:function(){return B6.fromUrl(lo("Assets/Textures/NaturalEarthII"))}})),e}()),n=M(t.terrainProviderViewModels,function(){const e=[];return e.push(new zve({name:"WGS84 Ellipsoid",iconUrl:lo("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new N9}})),e.push(new zve({name:"Cesium World Terrain",iconUrl:lo("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",category:"Cesium ion",creationFunction:function(){return Tbe({requestWaterMask:!0,requestVertexNormals:!0})}})),e}());E=new Bve(b,{globe:f.globe,imageryProviderViewModels:e,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:n,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel});x=b.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}if(D(t.baseLayer)&&!1!==t.baseLayer&&(n&&(E.viewModel.selectedImagery=void 0),f.imageryLayers.removeAll(),f.imageryLayers.add(t.baseLayer)),D(t.terrainProvider)&&(n&&(E.viewModel.selectedTerrain=void 0),f.terrainProvider=t.terrainProvider),D(t.terrain)){if(D(t.terrainProvider))throw new P("Specify either options.terrainProvider or options.terrain.");n&&(E.viewModel.selectedTerrain=void 0,f.globe.depthTestAgainstTerrain=!0),f.setTerrain(t.terrain)}if(!D(t.navigationHelpButton)||!1!==t.navigationHelpButton){let e=!0;try{if(D(window.localStorage)){const t=window.localStorage.getItem("cesium-hasSeenNavHelp");D(t)&&Boolean(t)?e=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch(U){}S=new IAe({container:b,instructionsInitiallyVisible:M(t.navigationInstructionsInitiallyVisible,e)})}if(!D(t.animation)||!1!==t.animation){const e=document.createElement("div");e.className="cesium-viewer-animationContainer",o.appendChild(e),C=new oAe(e,new uAe(l))}if(!D(t.timeline)||!1!==t.timeline){const e=document.createElement("div");e.className="cesium-viewer-timelineContainer",o.appendChild(e),I=new ZAe(e,c),I.addEventListener("settime",uTe,!1),I.zoomTo(c.startTime,c.stopTime)}if(D(t.fullscreenButton)&&!1===t.fullscreenButton||(R=document.createElement("div"),R.className="cesium-viewer-fullscreenContainer",o.appendChild(R),O=new hAe(R,t.fullscreenElement),N=Mve(O.viewModel,"isFullscreenEnabled",(function(e){R.style.display=e?"block":"none",D(I)&&(I.container.style.right=`${R.clientWidth}px`,I.resize())}))),t.vrButton){const e=document.createElement("div");e.className="cesium-viewer-vrContainer",o.appendChild(e),L=new cTe(e,f,t.fullScreenElement),F=Mve(L.viewModel,"isVREnabled",(function(t){e.style.display=t?"block":"none",D(O)&&(e.style.right=`${R.clientWidth}px`),D(I)&&(I.container.style.right=`${e.clientWidth}px`,I.resize())})),B=Mve(L.viewModel,"isVRMode",(function(e){!function(e,t){const n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,c=e._timeline,l=e._fullscreenButton,u=e._infoBox,d=e._selectionIndicator,h=t?"hidden":"visible";if(D(n)&&(n.container.style.visibility=h),D(i)&&(i.container.style.visibility=h),D(o)&&(o.container.style.visibility=h),D(r)&&(r.container.style.visibility=h),D(s)&&(s.container.style.visibility=h),D(a)&&(a.container.style.visibility=h),D(c)&&(c.container.style.visibility=h),D(l)&&l.viewModel.isFullscreenEnabled&&(l.container.style.visibility=h),D(u)&&(u.container.style.visibility=h),D(d)&&(d.container.style.visibility=h),e._container){const n=t||!D(l)?0:l.container.clientWidth;e._vrButton.container.style.right=`${n}px`,e.forceResize()}}(i,e)}))}this._baseLayerPickerDropDown=x,this._fullscreenSubscription=N,this._vrSubscription=F,this._vrModeSubscription=B,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=M(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=d,this._selectionIndicator=g,this._infoBox=y,this._dataSourceCollection=h,this._destroyDataSourceCollection=p,this._dataSourceDisplay=m,this._clockViewModel=l,this._destroyClockViewModel=u,this._toolbar=b,this._homeButton=A,this._sceneModePicker=T,this._projectionPicker=w,this._baseLayerPicker=E,this._navigationHelpButton=S,this._animation=C,this._timeline=I,this._fullscreenButton=O,this._vrButton=L,this._geocoder=v,this._eventHelper=_,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=D(y)||D(g),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new gi,this._trackedEntityChanged=new gi,Ave.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),_.add(h.dataSourceAdded,yTe.prototype._onDataSourceAdded,this),_.add(h.dataSourceRemoved,yTe.prototype._onDataSourceRemoved,this),_.add(f.postUpdate,yTe.prototype.resize,this),_.add(f.postRender,yTe.prototype._postRender,this);const z=h.length;for(let D=0;D<z;D++)this._dataSourceAdded(h,h.get(D));this._dataSourceAdded(void 0,m.defaultDataSource),_.add(h.dataSourceAdded,yTe.prototype._dataSourceAdded,this),_.add(h.dataSourceRemoved,yTe.prototype._dataSourceRemoved,this),d.screenSpaceEventHandler.setInputAction((function(e){i.selectedEntity=pTe(i,e)}),wue.LEFT_CLICK),d.screenSpaceEventHandler.setInputAction((function(e){const t=pTe(i,e);D(t)?Ou.getValueOrUndefined(t.position,i.clock.currentTime)?i.trackedEntity=t:i.zoomTo(t):D(i.trackedEntity)&&(i.trackedEntity=void 0)}),wue.LEFT_DOUBLE_CLICK)}function bTe(e,t,n,i){if(!D(t))throw new P("zoomTarget is required.");ATe(e);const o=new Promise((t=>{e._completeZoom=function(e){t(e)}}));return e._zoomPromise=o,e._zoomIsFlight=i,e._zoomOptions=n,Promise.resolve(t).then((function(t){if(e._zoomPromise===o){if(t instanceof x7){let n;return n=D(t.imageryProvider)?Promise.resolve(t.getImageryRectangle()):new Promise((e=>{const n=t.readyEvent.addEventListener((()=>{n(),e(t.getImageryRectangle())}))})),void n.then((function(t){return yve(t,e.scene)})).then((function(t){e._zoomPromise===o&&(e._zoomTarget=t)}))}if(t instanceof hX||t instanceof ive||t instanceof W_e)e._zoomTarget=t;else if(t.isLoading&&D(t.loadingEvent)){const n=t.loadingEvent.addEventListener((function(){n(),e._zoomPromise===o&&(e._zoomTarget=t.entities.values.slice(0))}))}else Array.isArray(t)?e._zoomTarget=t.slice(0):(D((t=M(t.values,t)).entities)&&(t=t.entities.values),Array.isArray(t)?e._zoomTarget=t.slice(0):e._zoomTarget=[t])}})),e.scene.requestRender(),o}function vTe(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function ATe(e){D(e._zoomPromise)&&(vTe(e),e._completeZoom(!1))}Object.defineProperties(yTe.prototype,{container:{get:function(){return this._container}},creditDisplay:{get:function(){return this._cesiumWidget.creditDisplay}},bottomContainer:{get:function(){return this._bottomContainer}},cesiumWidget:{get:function(){return this._cesiumWidget}},selectionIndicator:{get:function(){return this._selectionIndicator}},infoBox:{get:function(){return this._infoBox}},geocoder:{get:function(){return this._geocoder}},homeButton:{get:function(){return this._homeButton}},sceneModePicker:{get:function(){return this._sceneModePicker}},projectionPicker:{get:function(){return this._projectionPicker}},baseLayerPicker:{get:function(){return this._baseLayerPicker}},navigationHelpButton:{get:function(){return this._navigationHelpButton}},animation:{get:function(){return this._animation}},timeline:{get:function(){return this._timeline}},fullscreenButton:{get:function(){return this._fullscreenButton}},vrButton:{get:function(){return this._vrButton}},dataSourceDisplay:{get:function(){return this._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},canvas:{get:function(){return this._cesiumWidget.canvas}},scene:{get:function(){return this._cesiumWidget.scene}},shadows:{get:function(){return this.scene.shadowMap.enabled},set:function(e){this.scene.shadowMap.enabled=e}},terrainShadows:{get:function(){return this.scene.globe.shadows},set:function(e){this.scene.globe.shadows=e}},shadowMap:{get:function(){return this.scene.shadowMap}},imageryLayers:{get:function(){return this.scene.imageryLayers}},terrainProvider:{get:function(){return this.scene.terrainProvider},set:function(e){this.scene.terrainProvider=e}},camera:{get:function(){return this.scene.camera}},postProcessStages:{get:function(){return this.scene.postProcessStages}},clock:{get:function(){return this._clockViewModel.clock}},clockViewModel:{get:function(){return this._clockViewModel}},screenSpaceEventHandler:{get:function(){return this._cesiumWidget.screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._cesiumWidget.targetFrameRate},set:function(e){this._cesiumWidget.targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._cesiumWidget.useDefaultRenderLoop},set:function(e){this._cesiumWidget.useDefaultRenderLoop=e}},resolutionScale:{get:function(){return this._cesiumWidget.resolutionScale},set:function(e){this._cesiumWidget.resolutionScale=e}},useBrowserRecommendedResolution:{get:function(){return this._cesiumWidget.useBrowserRecommendedResolution},set:function(e){this._cesiumWidget.useBrowserRecommendedResolution=e}},allowDataSourcesToSuspendAnimation:{get:function(){return this._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,ATe(this);const t=this.scene,n=t.mode;D(e)&&D(e.position)?this._needTrackedEntityUpdate=!0:(this._needTrackedEntityUpdate=!1,n!==gl.COLUMBUS_VIEW&&n!==gl.SCENE2D||(t.screenSpaceCameraController.enableTranslate=!0),n!==gl.COLUMBUS_VIEW&&n!==gl.SCENE3D||(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(ve.IDENTITY)),this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;const t=D(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;D(e)?D(t)&&t.animateAppear():D(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,mTe(this._timeline,this.clock,e))}}}),yTe.prototype.extend=function(e,t){if(!D(e))throw new P("mixin is required.");e(this,t)},yTe.prototype.resize=function(){const e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=D(this._animation),r=D(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;const s=i-125,a=this._baseLayerPickerDropDown;if(D(a)&&(a.style.maxHeight=`${s}px`),D(this._geocoder)){this._geocoder.searchSuggestionsContainer.style.maxHeight=`${s}px`}D(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);const c=this._timeline;let l,u=0,d=0,h=0;if(o&&"hidden"!==window.getComputedStyle(this._animation.container).visibility){const e=this._lastWidth;l=this._animation.container,n>900?(u=169,e<=900&&(l.style.width="169px",l.style.height="112px",this._animation.resize())):n>=600?(u=136,(e<600||e>900)&&(l.style.width="136px",l.style.height="90px",this._animation.resize())):(u=106,(e>600||0===e)&&(l.style.width="106px",l.style.height="70px",this._animation.resize())),d=u+5}if(r&&"hidden"!==window.getComputedStyle(this._timeline.container).visibility){const e=this._fullscreenButton,t=this._vrButton,n=c.container,i=n.style;h=n.clientHeight+3,i.left=`${u}px`;let o=0;D(e)&&(o+=e.container.clientWidth),D(t)&&(o+=t.container.clientWidth),i.right=`${o}px`,c.resize()}this._bottomContainer.style.left=`${d}px`,this._bottomContainer.style.bottom=`${h}px`,this._lastWidth=n,this._lastHeight=i},yTe.prototype.forceResize=function(){this._lastWidth=0,this.resize()},yTe.prototype.render=function(){this._cesiumWidget.render()},yTe.prototype.isDestroyed=function(){return!1},yTe.prototype.destroy=function(){let e;D(this.screenSpaceEventHandler)&&!this.screenSpaceEventHandler.isDestroyed()&&(this.screenSpaceEventHandler.removeInputAction(wue.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(wue.LEFT_DOUBLE_CLICK));const t=this.dataSources,n=t.length;for(e=0;e<n;e++)this._dataSourceRemoved(t,t.get(e));return this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),D(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),D(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),D(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),D(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),D(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),D(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),D(this._timeline)&&(this._timeline.removeEventListener("settime",uTe,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),D(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),D(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),D(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),D(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()),He(this)},yTe.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(yTe.prototype._onEntityCollectionChanged,this)},yTe.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener(yTe.prototype._onEntityCollectionChanged,this),D(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),D(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)},yTe.prototype._onTick=function(e){const t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);const i=this._entityView;if(D(i)){const e=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(e,!1,lTe)===Iu.DONE&&i.update(t,lTe)}let o,r=!1;const s=this.selectedEntity,a=D(s)&&this._enableInfoOrSelection;if(a&&s.isShowing&&s.isAvailable(t)){this._dataSourceDisplay.getBoundingSphere(s,!0,lTe)!==Iu.FAILED?o=lTe.center:D(s.position)&&(o=s.position.getValue(t,o)),r=D(o)}const c=D(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;D(c)&&(c.position=H.clone(o,c.position),c.showSelection=a&&r,c.update());const l=D(this._infoBox)?this._infoBox.viewModel:void 0;D(l)&&(l.showInfo=a,l.enableCamera=r,l.isCameraTracking=this.trackedEntity===this.selectedEntity,a?(l.titleText=M(s.name,s.id),l.description=Ou.getValueOrDefault(s.description,t,"")):(l.titleText="",l.description=""))},yTe.prototype._onEntityCollectionChanged=function(e,t,n){const i=n.length;for(let o=0;o<i;o++){const e=n[o];this.trackedEntity===e&&(this.trackedEntity=void 0),this.selectedEntity===e&&(this.selectedEntity=void 0)}},yTe.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{D(this.selectedEntity.position)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}},yTe.prototype._clearTrackedObject=function(){this.trackedEntity=void 0},yTe.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0},yTe.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0},yTe.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&mTe(this.timeline,this.clock,e)},yTe.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,yTe.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i},yTe.prototype._onDataSourceRemoved=function(e,t){const n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){const t=e.length;this._automaticallyTrackDataSourceClocks&&t>0?this.clockTrackedDataSource=e.get(t-1):this.clockTrackedDataSource=void 0}},yTe.prototype.zoomTo=function(e,t){return bTe(this,e,{offset:t},!1)},yTe.prototype.flyTo=function(e,t){return bTe(this,e,t,!0)},yTe.prototype._postRender=function(){!function(e){const t=e._zoomTarget;if(!D(t)||e.scene.mode===gl.MORPHING)return;const n=e.scene,i=n.camera,o=M(e._zoomOptions,{});let r;function s(n){D(o.offset)||(o.offset=new f8(0,-.5,n.radius)),r={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(t.boundingSphere,r):(i.viewBoundingSphere(n,o.offset),i.lookAtTransform(ve.IDENTITY),e._completeZoom(!0)),vTe(e)}if(t instanceof ive){if(D(t.boundingSphere))return void s(t.boundingSphere);const e=t.frameChanged.addEventListener((function(t){s(t.boundingSphere),e()}));return}if(t instanceof hX||t instanceof W_e)return void s(t.boundingSphere);if(t instanceof Qt)return r={destination:n.mapProjection.ellipsoid.cartographicToCartesian(t),duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyTo(r):(i.setView(r),e._completeZoom(!0)),void vTe(e);const a=t,c=[];for(let u=0,d=a.length;u<d;u++){const t=e._dataSourceDisplay.getBoundingSphere(a[u],!1,lTe);if(t===Iu.PENDING)return;t!==Iu.FAILED&&c.push($u.clone(lTe))}if(0===c.length)return void ATe(e);e.trackedEntity=void 0;const l=$u.fromBoundingSpheres(c);e._zoomIsFlight?(vTe(e),i.flyToBoundingSphere(l,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)},offset:o.offset})):(i.viewBoundingSphere(l,o.offset),i.lookAtTransform(ve.IDENTITY),vTe(e),e._completeZoom(!0))}(this),function(e){if(!e._needTrackedEntityUpdate)return;const t=e._trackedEntity,n=e.clock.currentTime;if(!D(Ou.getValueOrUndefined(t.position,n)))return;const i=e.scene,o=e._dataSourceDisplay.getBoundingSphere(t,!1,lTe);if(o===Iu.PENDING)return;const r=i.mode;r!==gl.COLUMBUS_VIEW&&r!==gl.SCENE2D||(i.screenSpaceCameraController.enableTranslate=!1);r!==gl.COLUMBUS_VIEW&&r!==gl.SCENE3D||(i.screenSpaceCameraController.enableTilt=!1);const s=o!==Iu.FAILED?lTe:void 0;e._entityView=new S8(t,i,i.mapProjection.ellipsoid),e._entityView.update(n,s),e._needTrackedEntityUpdate=!1}(this)};const TTe={id:"EnvironmentMap"},wTe=n({__name:"Map",props:{nowValue:{type:Object,default:()=>({})}},setup(t){const n=t;window.CESIUM_BASE_URL="/CesiumUnminified";var g=null,y=null,b=null;const v=i({}),A=i(!1),T=i("");let w=i("");return o((()=>n.nowValue),(async(t,n)=>{const i=await(o={msNmae:t},e({url:"/hjjc/gjmchqjwd",method:"get",params:o}));var o;if(200==i.code){if(w.value=i.data[0],function(e){const t=e.entities.values;for(let n=0;n<t.length;n++){const i=t[n];i.billboard&&(e.entities.remove(i),--n)}}(g),b=g.entities.add({id:`${Number(i.data[0].msLongitude).toFixed(0)+Number(i.data[0].msLatitude).toFixed(0)}`,position:H.fromDegrees(Number(i.data[0].msLongitude),Number(i.data[0].msLatitude),10),billboard:{show:!0,image:"/assets/Point3.3340c5c1.png",scale:.2,color:Ot.WHITE}})){const e=b;T.value=b._id;const t=e.position.getValue(Hn.now());if(t){g.scene.cartesianToCanvasCoordinates(t);A.value=!0}}g.camera.flyTo({destination:H.fromDegrees(Number(i.data[0].msLongitude),Number(i.data[0].msLatitude),1100),duration:4})}}),{deep:!0}),r((()=>{!function(){hw.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlZGZlNDYwYy1hYzNkLTQzMGMtYTZhNy1iZjVjNzgxZWE4NzIiLCJpZCI6MjE2NzUyLCJpYXQiOjE3MTYyOTI5MzN9.btze81tzNNWYuzl63jtY46tbes_XynccAz3DDW7Xdf4";const e=new yTe("EnvironmentMap",{baseLayerPicker:!1,animation:!1,timeline:!1,homeButton:!1,navigationHelpButton:!1,geocoder:!1,infoBox:!1,sceneMode:gl.SCENE2D,selectionIndicator:!1,sceneModePicker:!1,fullscreenButton:!1});let t=new sde((g=e).scene.canvas);function n(e){e&&(v.value={position:"absolute",left:e.x-110+"px",top:e.y-150+"px"})}y=t,g.camera.setView({destination:H.fromDegrees(119,36,1e5)}),g.screenSpaceEventHandler.setInputAction((e=>{const t=g.scene.pick(e.position);if(D(t)&&t.id){const e=t.id;T.value=t.id._id;const i=e.position.getValue(Hn.now());if(i){const e=g.scene.cartesianToCanvasCoordinates(i);A.value=!0,n(e)}}}),wue.LEFT_CLICK),g.scene.postRender.addEventListener((()=>{if(A.value){const e=g.entities.values.find((e=>e._id===T.value)).position.getValue(Hn.now());e&&n(g.scene.cartesianToCanvasCoordinates(e))}}))}(),function(e){if(e){var t=new x7(new g7({url:"http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=5956e6519f2bb0ae8e57bc834298c9f1",layer:"tdtImgBasicLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0,maximumLevel:18}));g.imageryLayers.add(t)}}(!0)})),s((()=>{g.destroy(),y.destroy()})),(e,t)=>{const n=a("CircleClose"),i=a("el-icon");return c(),l("div",TTe,[A.value?(c(),l("div",{key:0,style:u(v.value),class:"popup"},[d(i,{class:"Icon",size:"18px",onClick:t[0]||(t[0]=e=>A.value=!1)},{default:h((()=>[d(n)])),_:1}),p("p",null,f(m(w).msName),1),p("p",null,"经度:"+f(m(w).msLongitude),1),p("p",null,"纬度:"+f(m(w).msLatitude),1)],4)):_("",!0)])}}},[["__scopeId","data-v-43b400cc"]]),ETe={class:"EnvironmentBox"},xTe={class:"LeftTree"},STe={class:"LeftTree_P"},CTe={style:{color:"cornflowerblue"}},ITe={class:"LeftTree_P"},OTe={style:{display:"flex","justify-content":"flex-start"}},DTe={key:0,style:{"margin-left":"10px",color:"#ccc"}},PTe={class:"TopForm"},NTe={class:"BottomTable"},RTe={class:"PageBox"},LTe=n({__name:"Environment",setup(t){var n=localStorage.getItem("deptName")||"青岛西海岸新区";let o=i(0),r=i(""),s=i([]);const u={children:"children",label:"label"};let C=i(!1),D=i({time:["",""]});const P=i(),N=g({time:[{validator:(e,t,n)=>{""===t[0]||""===t[1]?n(new Error("请选择时间段")):n()},trigger:"blur"}]});let R=i([]),L=i(""),M=i(1),F=i(10),B=i(0);const z=e=>{e.devId&&(L.value=e.devId,r.value=e.label,M.value=1)};function U(){C.value=!C.value}function k(){D.value.time=["",""],M.value=1,F.value=10}function V(e){F.value=e,M.value=1}function H(e){M.value=e}return y((()=>{""==D.value.time[0]&&L.value?O({devId:L.value,pageNum:M.value,pageSize:F.value}).then((e=>{R.value=e.rows,B.value=e.total})):L.value&&O({devId:L.value,pageNum:M.value,pageSize:F.value,startTime:b(D.value.time[0]).format("YYYY-MM-DD"),endTime:b(D.value.time[1]).format("YYYY-MM-DD")}).then((e=>{R.value=e.rows,B.value=e.total}))})),v((async()=>{const t=await(i={divisions:n},e({url:"/hjjc/sxjg",method:"get",params:i}));var i;200==t.code&&(s.value=t.data,L.value=t.data[0].children[0].devId,r.value=t.data[0].children[0].label,o.value=function(e){let t=[];return e.forEach(((e,n)=>{e.children&&(t=t.concat(e.children))})),t.length}(t.data))})),(e,t)=>{const n=a("el-tree"),i=a("DArrowLeft"),g=a("el-icon"),y=a("DArrowRight"),v=a("el-date-picker"),G=a("el-form-item"),j=a("el-button"),W=a("Download"),q=a("el-form"),Y=a("el-table-column"),X=a("el-table"),Q=a("el-pagination");return c(),l("div",ETe,[p("div",xTe,[p("p",STe,[A(" 总设备数:"),p("span",CTe," "+f(m(o)),1)]),p("p",ITe,[A(" 当前选择:"),p("span",null," "+f(m(r)),1)]),d(n,{"node-key":"devId",style:{width:"100%"},data:m(s),props:u,accordion:"",onNodeClick:z},{default:h((({node:e,data:t})=>[p("div",OTe,[p("span",null,f(e.label),1),t.children?(c(),l("span",DTe,"("+f(t.children.length)+")",1)):_("",!0)])])),_:1},8,["data"])]),p("div",{class:x(m(C)?"CenterBox":"CenterBox_Auto")},[p("div",{class:"Tool",onClick:U},[T(d(g,{color:"#aaa"},{default:h((()=>[d(i)])),_:1},512),[[w,!m(C)]]),T(d(g,{color:"#aaa"},{default:h((()=>[d(y)])),_:1},512),[[w,m(C)]])]),p("div",PTe,[d(q,{ref_key:"ruleFormRef",ref:P,rules:N,model:m(D),"label-width":"auto",style:{"max-width":"100%"},inline:!0,"label-position":"left"},{default:h((()=>[d(G,{label:"日期:",prop:"time"},{default:h((()=>[d(v,{modelValue:m(D).time,"onUpdate:modelValue":t[0]||(t[0]=e=>m(D).time=e),type:"daterange","range-separator":"至","start-placeholder":"开始时间","end-placeholder":"结束时间",size:e.size},null,8,["modelValue","size"])])),_:1}),d(G,null,{default:h((()=>[d(j,{type:"primary",onClick:t[1]||(t[1]=e=>(async e=>{e&&await e.validate(((e,t)=>{if(e){let e={};D.value.time&&(e.startTime=b(D.value.time[0]).format("YYYY-MM-DD"),e.endTime=b(D.value.time[1]).format("YYYY-MM-DD")),e.whetherToDownload="false",e.devId=L.value,O(e).then((t=>{R.value=t.rows,B.value=t.total,200==t.code&&(M.value=1,S({message:`${t.msg}:已为您查询到${e.startTime}至${e.endTime}的所有数据,共${t.total} 条数据`,type:"success",duration:5e3}))}))}}))})(P.value))},{default:h((()=>[A("查询")])),_:1}),d(j,{onClick:k},{default:h((()=>[A("重置")])),_:1}),d(j,{onClick:t[2]||(t[2]=e=>function(){let e={};""!==D.value.time[0]&&(e.startTime=b(D.value.time[0]).format("YYYY-MM-DD"),e.endTime=b(D.value.time[1]).format("YYYY-MM-DD")),e.whetherToDownload="true",e.devId=L.value,e.pageNum=M.value,e.pageSize=F.value,O(e).then((e=>{e.rows.length>0&&e.rows[e.rows.length-1].excelPath&&I(e.rows[e.rows.length-1].excelPath)}))}(P.value))},{default:h((()=>[d(g,null,{default:h((()=>[d(W)])),_:1}),A(" 下载 ")])),_:1})])),_:1})])),_:1},8,["rules","model"])]),p("div",NTe,[d(X,{data:m(R),border:"",style:{width:"100%"},height:"700"},{default:h((()=>[d(Y,{prop:"datetime",label:"时间",width:"180",fixed:"left"}),d(Y,{prop:"soilEc",label:"土壤EC(S/cm)",width:"115"}),d(Y,{prop:"soilTemperature",label:"土壤温度(℃)",width:"115"}),d(Y,{prop:"soilPh",label:"土壤PH值(ph)",width:"115"}),d(Y,{prop:"soilHumidity",label:"土壤湿度(%rh)",width:"120"}),d(Y,{prop:"co2Concentration",label:"二氧化碳浓度(ppm)",width:"150"}),d(Y,{prop:"airHumidity",label:"空气湿度(%rh)",width:"120"}),d(Y,{prop:"airTemperature",label:"空气温度(℃)",width:"120"}),d(Y,{prop:"lightIllum",label:"光照强度(lx)",width:"115"}),d(Y,{prop:"devId",label:"设备ID",width:"150"}),d(Y,{prop:"lat",label:"纬度",fixed:"right"}),d(Y,{prop:"lng",label:"经度",fixed:"right"})])),_:1},8,["data"])]),p("div",RTe,[d(Q,{size:"small","current-page":m(M),"onUpdate:current-page":t[3]||(t[3]=e=>E(M)?M.value=e:M=e),"page-size":m(F),"onUpdate:page-size":t[4]||(t[4]=e=>E(F)?F.value=e:F=e),"page-sizes":[10,25,50],background:"true",layout:"total, sizes, prev, pager, next, jumper",total:m(B),onSizeChange:V,onCurrentChange:H},null,8,["current-page","page-size","total"])])],2),p("div",{class:x(m(C)?"RightBox":"RightBox_None")},[d(wTe,{nowValue:m(r)},null,8,["nowValue"])],2)])}}},[["__scopeId","data-v-d133c9b8"]]);export{LTe as default};
|