/** * Cesium - https://github.com/AnalyticalGraphicsInc/cesium * * Copyright 2011-2017 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details. */ /** @license mersenne-twister.js - https://gist.github.com/banksean/300494 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ !function(){define("Core/defined",[],function(){"use strict";function e(e){return void 0!==e&&null!==e}return e}),define("Core/DeveloperError",["./defined"],function(e){"use strict";function t(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t}return e(Object.create)&&(t.prototype=Object.create(Error.prototype),t.prototype.constructor=t),t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("Core/Check",["./defined","./DeveloperError"],function(e,t){"use strict";function r(e){return e+" is required, actual value was undefined"}function n(e,t,r){return"Expected "+r+" to be typeof "+t+", actual typeof was "+e}var a={};return a.typeOf={},a.defined=function(n,a){if(!e(a))throw new t(r(n))},a.typeOf.func=function(e,r){if("function"!=typeof r)throw new t(n(typeof r,"function",e))},a.typeOf.string=function(e,r){if("string"!=typeof r)throw new t(n(typeof r,"string",e))},a.typeOf.number=function(e,r){if("number"!=typeof r)throw new t(n(typeof r,"number",e))},a.typeOf.number.lessThan=function(e,r,n){if(a.typeOf.number(e,r),r>=n)throw new t("Expected "+e+" to be less than "+n+", actual value was "+r)},a.typeOf.number.lessThanOrEquals=function(e,r,n){if(a.typeOf.number(e,r),r>n)throw new t("Expected "+e+" to be less than or equal to "+n+", actual value was "+r)},a.typeOf.number.greaterThan=function(e,r,n){if(a.typeOf.number(e,r),n>=r)throw new t("Expected "+e+" to be greater than "+n+", actual value was "+r)},a.typeOf.number.greaterThanOrEquals=function(e,r,n){if(a.typeOf.number(e,r),n>r)throw new t("Expected "+e+" to be greater than or equal to"+n+", actual value was "+r)},a.typeOf.object=function(e,r){if("object"!=typeof r)throw new t(n(typeof r,"object",e))},a.typeOf.bool=function(e,r){if("boolean"!=typeof r)throw new t(n(typeof r,"boolean",e))},a.typeOf.number.equals=function(e,r,n,i){if(a.typeOf.number(e,n),a.typeOf.number(r,i),n!==i)throw new t(e+" must be equal to "+r+", the actual values are "+n+" and "+i)},a}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function t(e,t){return void 0!==e&&null!==e?e:t}return t.EMPTY_OBJECT=e({}),t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r>>1^t[1&e];for(;r>>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,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t,r,n){"use strict";var a={};a.Radious=6378137,a.EPSILON1=.1,a.EPSILON2=.01,a.EPSILON3=.001,a.EPSILON4=1e-4,a.EPSILON5=1e-5,a.EPSILON6=1e-6,a.EPSILON7=1e-7,a.EPSILON8=1e-8,a.EPSILON9=1e-9,a.EPSILON10=1e-10,a.EPSILON11=1e-11,a.EPSILON12=1e-12,a.EPSILON13=1e-13,a.EPSILON14=1e-14,a.EPSILON15=1e-15,a.EPSILON16=1e-16,a.EPSILON17=1e-17,a.EPSILON18=1e-18,a.EPSILON19=1e-19,a.EPSILON20=1e-20,a.GRAVITATIONALPARAMETER=3986004418e5,a.SOLAR_RADIUS=6955e5,a.LUNAR_RADIUS=1737400,a.SIXTY_FOUR_KILOBYTES=65536,a.sign=function(e){return e>0?1:0>e?-1:0},a.signNotZero=function(e){return 0>e?-1:1},a.toSNorm=function(e,r){return r=t(r,255),Math.round((.5*a.clamp(e,-1,1)+.5)*r)},a.fromSNorm=function(e,r){return r=t(r,255),a.clamp(e,0,r)/r*2-1},a.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},a.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},a.lerp=function(e,t,r){return(1-r)*e+r*t},a.PI=Math.PI,a.ONE_OVER_PI=1/Math.PI,a.PI_OVER_TWO=.5*Math.PI,a.PI_OVER_THREE=Math.PI/3,a.PI_OVER_FOUR=Math.PI/4,a.PI_OVER_SIX=Math.PI/6,a.THREE_PI_OVER_TWO=3*Math.PI*.5,a.TWO_PI=2*Math.PI,a.ONE_OVER_TWO_PI=1/(2*Math.PI),a.RADIANS_PER_DEGREE=Math.PI/180,a.DEGREES_PER_RADIAN=180/Math.PI,a.RADIANS_PER_ARCSECOND=a.RADIANS_PER_DEGREE/3600,a.toRadians=function(e){if(!r(e))throw new n("degrees is required.");return e*a.RADIANS_PER_DEGREE},a.toDegrees=function(e){if(!r(e))throw new n("radians is required.");return e*a.DEGREES_PER_RADIAN},a.convertLongitudeRange=function(e){if(!r(e))throw new n("angle is required.");var t=a.TWO_PI,i=e-Math.floor(e/t)*t;return i<-Math.PI?i+t:i>=Math.PI?i-t:i},a.clampToLatitudeRange=function(e){if(!r(e))throw new n("angle is required.");return a.clamp(e,-1*a.PI_OVER_TWO,a.PI_OVER_TWO)},a.negativePiToPi=function(e){if(!r(e))throw new n("angle is required.");return a.zeroToTwoPi(e+a.PI)-a.PI},a.zeroToTwoPi=function(e){if(!r(e))throw new n("angle is required.");var t=a.mod(e,a.TWO_PI);return Math.abs(t)a.EPSILON14?a.TWO_PI:t},a.mod=function(e,t){if(!r(e))throw new n("m is required.");if(!r(t))throw new n("n is required.");return(e%t+t)%t},a.equalsEpsilon=function(e,a,i,o){if(!r(e))throw new n("left is required.");if(!r(a))throw new n("right is required.");if(!r(i))throw new n("relativeEpsilon is required.");o=t(o,i);var u=Math.abs(e-a);return o>=u||u<=i*Math.max(Math.abs(e),Math.abs(a))};var i=[1];a.factorial=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");var t=i.length;if(e>=t)for(var r=i[t-1],a=t;e>=a;a++)i.push(r*a);return i[e]},a.incrementWrap=function(e,a,i){if(i=t(i,0),!r(e))throw new n("n is required.");if(i>=a)throw new n("maximumValue must be greater than minimumValue.");return++e,e>a&&(e=i),e},a.isPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");return 0!==e&&0===(e&e-1)},a.nextPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},a.clamp=function(e,t,a){if(!r(e))throw new n("value is required");if(!r(t))throw new n("min is required.");if(!r(a))throw new n("max is required.");return t>e?t:e>a?a:e};var o=new e;return a.setRandomNumberSeed=function(t){if(!r(t))throw new n("seed is required.");o=new e(t)},a.nextRandomNumber=function(){return o.random()},a.randomBetween=function(e,t){return a.nextRandomNumber()*(t-e)+e},a.acosClamped=function(e){if(!r(e))throw new n("value is required.");return Math.acos(a.clamp(e,-1,1))},a.asinClamped=function(e){if(!r(e))throw new n("value is required.");return Math.asin(a.clamp(e,-1,1))},a.chordLength=function(e,t){if(!r(e))throw new n("angle is required.");if(!r(t))throw new n("radius is required.");return 2*t*Math.sin(.5*e)},a.logBase=function(e,t){if(!r(e))throw new n("number is required.");if(!r(t))throw new n("base is required.");return Math.log(e)/Math.log(t)},a.fog=function(e,t){var r=e*t;return 1-Math.exp(-(r*r))},a}),define("Core/Cartesian3",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e,r,n){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0)}o.fromSpherical=function(n,a){e.typeOf.object("spherical",n),r(a)||(a=new o);var i=n.clock,u=n.cone,s=t(n.magnitude,1),c=s*Math.sin(u);return a.x=c*Math.cos(i),a.y=c*Math.sin(i),a.z=s*Math.cos(u),a},o.fromElements=function(e,t,n,a){return r(a)?(a.x=e,a.y=t,a.z=n,a):new o(e,t,n)},o.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new o(e.x,e.y,e.z):void 0},o.fromCartesian4=o.clone,o.packedLength=3,o.pack=function(r,n,a){return e.typeOf.object("value",r),e.defined("array",n),a=t(a,0),n[a++]=r.x,n[a++]=r.y,n[a]=r.z,n},o.unpack=function(n,a,i){return e.defined("array",n),a=t(a,0),r(i)||(i=new o),i.x=n[a++],i.y=n[a++],i.z=n[a],i},o.packArray=function(t,n){e.defined("array",t);var a=t.length;r(n)?n.length=3*a:n=new Array(3*a);for(var i=0;a>i;++i)o.pack(t[i],n,3*i);return n},o.unpackArray=function(t,a){if(e.defined("array",t),e.typeOf.number.greaterThanOrEquals("array.length",t.length,3),t.length%3!==0)throw new n("array length must be a multiple of 3.");var i=t.length;r(a)?a.length=i/3:a=new Array(i/3);for(var u=0;i>u;u+=3){var s=u/3;a[s]=o.unpack(t,u,a[s])}return a},o.fromArray=o.unpack,o.maximumComponent=function(t){return e.typeOf.object("cartesian",t),Math.max(t.x,t.y,t.z)},o.minimumComponent=function(t){return e.typeOf.object("cartesian",t),Math.min(t.x,t.y,t.z)},o.minimumByComponent=function(t,r,n){return e.typeOf.object("first",t),e.typeOf.object("second",r),e.typeOf.object("result",n),n.x=Math.min(t.x,r.x),n.y=Math.min(t.y,r.y),n.z=Math.min(t.z,r.z),n},o.maximumByComponent=function(t,r,n){return e.typeOf.object("first",t),e.typeOf.object("second",r),e.typeOf.object("result",n),n.x=Math.max(t.x,r.x),n.y=Math.max(t.y,r.y),n.z=Math.max(t.z,r.z),n},o.magnitudeSquared=function(t){return e.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y+t.z*t.z},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var u=new o;o.distance=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.subtract(t,r,u),o.magnitude(u)},o.distanceSquared=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.subtract(t,r,u),o.magnitudeSquared(u)},o.normalize=function(t,r){e.typeOf.object("cartesian",t),e.typeOf.object("result",r);var a=o.magnitude(t);if(r.x=t.x/a,r.y=t.y/a,r.z=t.z/a,isNaN(r.x)||isNaN(r.y)||isNaN(r.z))throw new n("normalized result is not a number");return r},o.dot=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),t.x*r.x+t.y*r.y+t.z*r.z},o.multiplyComponents=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x*r.x,n.y=t.y*r.y,n.z=t.z*r.z,n},o.divideComponents=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x/r.x,n.y=t.y/r.y,n.z=t.z/r.z,n},o.add=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x+r.x,n.y=t.y+r.y,n.z=t.z+r.z,n},o.subtract=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x-r.x,n.y=t.y-r.y,n.z=t.z-r.z,n},o.multiplyByScalar=function(t,r,n){return e.typeOf.object("cartesian",t),e.typeOf.number("scalar",r),e.typeOf.object("result",n),n.x=t.x*r,n.y=t.y*r,n.z=t.z*r,n},o.divideByScalar=function(t,r,n){return e.typeOf.object("cartesian",t),e.typeOf.number("scalar",r),e.typeOf.object("result",n),n.x=t.x/r,n.y=t.y/r,n.z=t.z/r,n},o.negate=function(t,r){return e.typeOf.object("cartesian",t),e.typeOf.object("result",r),r.x=-t.x,r.y=-t.y,r.z=-t.z,r},o.abs=function(t,r){return e.typeOf.object("cartesian",t),e.typeOf.object("result",r),r.x=Math.abs(t.x),r.y=Math.abs(t.y),r.z=Math.abs(t.z),r};var s=new o;o.lerp=function(t,r,n,a){return e.typeOf.object("start",t),e.typeOf.object("end",r),e.typeOf.number("t",n),e.typeOf.object("result",a),o.multiplyByScalar(r,n,s),a=o.multiplyByScalar(t,1-n,a),o.add(s,a,a)};var c=new o,l=new o;o.angleBetween=function(t,r){e.typeOf.object("left",t),e.typeOf.object("right",r),o.normalize(t,c),o.normalize(r,l);var n=o.dot(c,l),a=o.magnitude(o.cross(c,l,c));return Math.atan2(a,n)};var f=new o;o.mostOrthogonalAxis=function(t,r){e.typeOf.object("cartesian",t),e.typeOf.object("result",r);var n=o.normalize(t,f);return o.abs(n,n),r=n.x<=n.y?n.x<=n.z?o.clone(o.UNIT_X,r):o.clone(o.UNIT_Z,r):n.y<=n.z?o.clone(o.UNIT_Y,r):o.clone(o.UNIT_Z,r)},o.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z},o.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]},o.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)&&i.equalsEpsilon(e.z,t.z,n,a)},o.cross=function(t,r,n){e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n);var a=t.x,i=t.y,o=t.z,u=r.x,s=r.y,c=r.z,l=i*c-o*s,f=o*u-a*c,p=a*s-i*u;return n.x=l,n.y=f,n.z=p,n},o.fromDegrees=function(t,r,n,a,u){return e.typeOf.number("longitude",t),e.typeOf.number("latitude",r),t=i.toRadians(t),r=i.toRadians(r),o.fromRadians(t,r,n,a,u)};var p=new o,y=new o,h=new o(40680631590769,40680631590769,40408299984661.445),d=new o(40680631590769,40680631590769,40680631590769);return o.fromRadians=function(n,a,u,s,c){e.typeOf.number("longitude",n),e.typeOf.number("latitude",a),u=t(u,0);var l=r(s)?s.radiiSquared:h;i.Radious>6356753&&(l=r(s)?s.radiiSquared:d);var f=Math.cos(a);p.x=f*Math.cos(n),p.y=f*Math.sin(n),p.z=Math.sin(a),p=o.normalize(p,p),o.multiplyComponents(l,p,y);var m=Math.sqrt(o.dot(p,y));return y=o.divideByScalar(y,m,y),p=o.multiplyByScalar(p,u,p),r(c)||(c=new o),o.add(y,p,c)},o.fromDegreesArray=function(t,a,i){if(e.defined("coordinates",t),t.length<2||t.length%2!==0)throw new n("the number of coordinates must be a multiple of 2 and at least 2");var u=t.length;r(i)?i.length=u/2:i=new Array(u/2);for(var s=0;u>s;s+=2){var c=t[s],l=t[s+1],f=s/2;i[f]=o.fromDegrees(c,l,0,a,i[f])}return i},o.fromRadiansArray=function(t,a,i){if(e.defined("coordinates",t),t.length<2||t.length%2!==0)throw new n("the number of coordinates must be a multiple of 2 and at least 2");var u=t.length;r(i)?i.length=u/2:i=new Array(u/2);for(var s=0;u>s;s+=2){var c=t[s],l=t[s+1],f=s/2;i[f]=o.fromRadians(c,l,0,a,i[f])}return i},o.fromDegreesArrayHeights=function(t,a,i){if(e.defined("coordinates",t),t.length<3||t.length%3!==0)throw new n("the number of coordinates must be a multiple of 3 and at least 3");var u=t.length;r(i)?i.length=u/3:i=new Array(u/3);for(var s=0;u>s;s+=3){var c=t[s],l=t[s+1],f=t[s+2],p=s/3;i[p]=o.fromDegrees(c,l,f,a,i[p])}return i},o.fromRadiansArrayHeights=function(t,a,i){if(e.defined("coordinates",t),t.length<3||t.length%3!==0)throw new n("the number of coordinates must be a multiple of 3 and at least 3");var u=t.length;r(i)?i.length=u/3:i=new Array(u/3);for(var s=0;u>s;s+=3){var c=t[s],l=t[s+1],f=t[s+2],p=s/3;i[p]=o.fromRadians(c,l,f,a,i[p])}return i},o.ZERO=a(new o(0,0,0)),o.UNIT_X=a(new o(1,0,0)),o.UNIT_Y=a(new o(0,1,0)),o.UNIT_Z=a(new o(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,r){return o.equalsEpsilon(this,e,t,r)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},o}),define("Core/scaleToGeodeticSurface",["./Cartesian3","./defined","./DeveloperError","./Math"],function(e,t,r,n){"use strict";function a(a,u,s,c,l){if(!t(a))throw new r("cartesian is required.");if(!t(u))throw new r("oneOverRadii is required.");if(!t(s))throw new r("oneOverRadiiSquared is required.");if(!t(c))throw new r("centerToleranceSquared is required.");var f=a.x,p=a.y,y=a.z,h=u.x,d=u.y,m=u.z,E=f*f*h*h,O=p*p*d*d,T=y*y*m*m,_=E+O+T,v=Math.sqrt(1/_),b=e.multiplyByScalar(a,v,i);if(c>_)return isFinite(v)?e.clone(b,l):void 0;var w=s.x,R=s.y,g=s.z,A=o;A.x=b.x*w*2,A.y=b.y*R*2,A.z=b.z*g*2;var N,S,x,I,M,C,P,L,U,F,D,B=(1-v)*e.magnitude(a)/(.5*e.magnitude(A)),z=0;do{B-=z,x=1/(1+B*w),I=1/(1+B*R),M=1/(1+B*g),C=x*x,P=I*I,L=M*M,U=C*x,F=P*I,D=L*M,N=E*C+O*P+T*L-1,S=E*U*w+O*F*R+T*D*g;var j=-2*S;z=N/j}while(Math.abs(N)>n.EPSILON12);return t(l)?(l.x=f*x,l.y=p*I,l.z=y*M,l):new e(f*x,p*I,y*M)}var i=new e,o=new e;return a}),define("Core/Cartographic",["./Cartesian3","./Check","./defaultValue","./defined","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,t,r,n,a,i,o){"use strict";function u(e,t,n){this.longitude=r(e,0),this.latitude=r(t,0),this.height=r(n,0)}u.fromRadians=function(e,a,i,o){return t.typeOf.number("longitude",e),t.typeOf.number("latitude",a),i=r(i,0),n(o)?(o.longitude=e,o.latitude=a,o.height=i,o):new u(e,a,i)},u.fromDegrees=function(e,r,n,a){return t.typeOf.number("longitude",e),t.typeOf.number("latitude",r),e=i.toRadians(e),r=i.toRadians(r),u.fromRadians(e,r,n,a)};var s=new e,c=new e,l=new e,f=new e(1/6378137,1/6378137,1/6356752.314245179),p=new e(1/6378137,1/6378137,1/6378137),y=new e(1/40680631590769,1/40680631590769,1/40408299984661.445),h=new e(1/40680631590769,1/40680631590769,1/40680631590769),d=i.EPSILON1;return u.fromCartesian=function(t,r,a){var m=n(r)?r.oneOverRadii:f,E=n(r)?r.oneOverRadiiSquared:y,O=n(r)?r._centerToleranceSquared:d;i.Radious>6356753&&(m=n(r)?r.oneOverRadii:p,E=n(r)?r.oneOverRadiiSquared:h);var T=o(t,m,E,O,c);if(n(T)){var _=e.multiplyComponents(T,E,s);_=e.normalize(_,_);var v=e.subtract(t,T,l),b=Math.atan2(_.y,_.x),w=Math.asin(_.z),R=i.sign(e.dot(v,t))*e.magnitude(v);return n(a)?(a.longitude=b,a.latitude=w,a.height=R,a):new u(b,w,R)}},u.clone=function(e,t){return n(e)?n(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new u(e.longitude,e.latitude,e.height):void 0},u.equals=function(e,t){return e===t||n(e)&&n(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},u.equalsEpsilon=function(e,r,a){return t.typeOf.number("epsilon",a),e===r||n(e)&&n(r)&&Math.abs(e.longitude-r.longitude)<=a&&Math.abs(e.latitude-r.latitude)<=a&&Math.abs(e.height-r.height)<=a},u.ZERO=a(new u(0,0,0)),u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.prototype.equalsEpsilon=function(e,t){return u.equalsEpsilon(this,e,t)},u.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},u.sphericalDistance=function(e,t,r,a){if(!n(e)||!n(r))throw new DeveloperError("longitude is required.");if(!n(t)||!n(a))throw new DeveloperError("latitude is required.");if(e===r&&t===a)return 0;var o=i.toRadians(t),u=i.toRadians(a),s=i.toRadians(e),c=i.toRadians(r),l=s*s+o*o,f=c*c+u*u,p=(s-c)*(s-c)+(o-u)*(o-u),y=(l+f-p)/(2*Math.sqrt(l)*Math.sqrt(f));return y=i.clamp(y,-1,1),Math.acos(y)*i.Radious},u}),define("Core/defineProperties",["./defined"],function(e){"use strict";var t=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),r=Object.defineProperties;return t&&e(r)||(r=function(e){return e}),r}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./Check","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math","./scaleToGeodeticSurface"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(t,a,i,o){a=n(a,0),i=n(i,0),o=n(o,0),s.equalsEpsilon(o,6378137,s.EPSILON10)&&(s.Radious=o),r.typeOf.number.greaterThanOrEquals("x",a,0),r.typeOf.number.greaterThanOrEquals("y",i,0),r.typeOf.number.greaterThanOrEquals("z",o,0),t._radii=new e(a,i,o),t._radiiSquared=new e(a*a,i*i,o*o),t._radiiToTheFourth=new e(a*a*a*a,i*i*i*i,o*o*o*o),t._oneOverRadii=new e(0===a?0:1/a,0===i?0:1/i,0===o?0:1/o),t._oneOverRadiiSquared=new e(0===a?0:1/(a*a),0===i?0:1/(i*i),0===o?0:1/(o*o)),t._minimumRadius=Math.min(a,i,o),t._maximumRadius=Math.max(a,i,o),t._centerToleranceSquared=s.EPSILON1,0!==t._radiiSquared.z&&(t._squaredXOverSquaredZ=t._radiiSquared.x/t._radiiSquared.z)}function f(e,t,r){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,l(this,e,t,r)}i(f.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}}}),f.clone=function(t,r){if(a(t)){var n=t._radii;return a(r)?(e.clone(n,r._radii),e.clone(t._radiiSquared,r._radiiSquared),e.clone(t._radiiToTheFourth,r._radiiToTheFourth),e.clone(t._oneOverRadii,r._oneOverRadii),e.clone(t._oneOverRadiiSquared,r._oneOverRadiiSquared),r._minimumRadius=t._minimumRadius,r._maximumRadius=t._maximumRadius,r._centerToleranceSquared=t._centerToleranceSquared,r):new f(n.x,n.y,n.z)}},f.fromCartesian3=function(e,t){return a(t)||(t=new f),a(e)?(l(t,e.x,e.y,e.z),t):t},f.WGS84=u(new f(6378137,6378137,s.Radious)),f.UNIT_SPHERE=u(new f(1,1,1)),f.MOON=u(new f(s.LUNAR_RADIUS,s.LUNAR_RADIUS,s.LUNAR_RADIUS)),f.prototype.clone=function(e){return f.clone(this,e)},f.packedLength=e.packedLength,f.pack=function(t,a,i){return r.typeOf.object("value",t),r.defined("array",a),i=n(i,0),e.pack(t._radii,a,i),a},f.unpack=function(t,a,i){r.defined("array",t),a=n(a,0);var o=e.unpack(t,a);return f.fromCartesian3(o,i)},f.prototype.geocentricSurfaceNormal=e.normalize,f.prototype.geodeticSurfaceNormalCartographic=function(t,n){r.typeOf.object("cartographic",t);var i=t.longitude,o=t.latitude,u=Math.cos(o),s=u*Math.cos(i),c=u*Math.sin(i),l=Math.sin(o);return a(n)||(n=new e),n.x=s,n.y=c,n.z=l,e.normalize(n,n)},f.prototype.geodeticSurfaceNormal=function(t,r){return a(r)||(r=new e),r=e.multiplyComponents(t,this._oneOverRadiiSquared,r),e.normalize(r,r)};var p=new e,y=new e;f.prototype.cartographicToCartesian=function(t,r){var n=p,i=y;this.geodeticSurfaceNormalCartographic(t,n),e.multiplyComponents(this._radiiSquared,n,i);var o=Math.sqrt(e.dot(n,i));return e.divideByScalar(i,o,i),e.multiplyByScalar(n,t.height,n),a(r)||(r=new e),e.add(i,n,r)},f.prototype.cartographicArrayToCartesianArray=function(e,t){r.defined("cartographics",e);var n=e.length;a(t)?t.length=n:t=new Array(n);for(var i=0;n>i;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var h=new e,d=new e,m=new e;return f.prototype.cartesianToCartographic=function(r,n){var i=this.scaleToGeodeticSurface(r,d);if(a(i)){var o=this.geodeticSurfaceNormal(i,h),u=e.subtract(r,i,m),c=Math.atan2(o.y,o.x),l=Math.asin(o.z),f=s.sign(e.dot(u,r))*e.magnitude(u);return a(n)?(n.longitude=c,n.latitude=l,n.height=f,n):new t(c,l,f)}},f.prototype.cartesianArrayToCartographicArray=function(e,t){r.defined("cartesians",e);var n=e.length;a(t)?t.length=n:t=new Array(n);for(var i=0;n>i;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t},f.prototype.scaleToGeodeticSurface=function(e,t){return c(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},f.prototype.scaleToGeocentricSurface=function(t,n){r.typeOf.object("cartesian",t),a(n)||(n=new e);var i=t.x,o=t.y,u=t.z,s=this._oneOverRadiiSquared,c=1/Math.sqrt(i*i*s.x+o*o*s.y+u*u*s.z);return e.multiplyByScalar(t,c,n)},f.prototype.transformPositionToScaledSpace=function(t,r){return a(r)||(r=new e),e.multiplyComponents(t,this._oneOverRadii,r)},f.prototype.transformPositionFromScaledSpace=function(t,r){return a(r)||(r=new e),e.multiplyComponents(t,this._radii,r)},f.prototype.equals=function(t){return this===t||a(t)&&e.equals(this._radii,t._radii)},f.prototype.toString=function(){return this._radii.toString()},f.prototype.getSurfaceNormalIntersectionWithZAxis=function(t,i,u){if(r.typeOf.object("position",t),!s.equalsEpsilon(this._radii.x,this._radii.y,s.EPSILON15))throw new o("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");r.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),i=n(i,0);var c=this._squaredXOverSquaredZ;return a(u)||(u=new e),u.x=0,u.y=0,u.z=t.z*(1-c),Math.abs(u.z)>=this._radii.z-i?void 0:u},f}),define("Core/Rectangle",["./Cartographic","./Check","./defaultValue","./defined","./defineProperties","./Ellipsoid","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(e,t,n,a){this.west=r(e,0),this.south=r(t,0),this.east=r(n,0),this.north=r(a,0)}a(s.prototype,{width:{get:function(){return s.computeWidth(this)}},height:{get:function(){return s.computeHeight(this)}}}),s.packedLength=4,s.pack=function(e,n,a){return t.typeOf.object("value",e),t.defined("array",n),a=r(a,0),n[a++]=e.west,n[a++]=e.south,n[a++]=e.east,n[a]=e.north,n},s.unpack=function(e,a,i){return t.defined("array",e),a=r(a,0),n(i)||(i=new s),i.west=e[a++],i.south=e[a++],i.east=e[a++],i.north=e[a],i},s.computeWidth=function(e){t.typeOf.object("rectangle",e);var r=e.east,n=e.west;return n>r&&(r+=u.TWO_PI),r-n},s.computeHeight=function(e){return t.typeOf.object("rectangle",e),e.north-e.south},s.fromDegrees=function(e,t,a,i,o){return e=u.toRadians(r(e,0)),t=u.toRadians(r(t,0)),a=u.toRadians(r(a,0)),i=u.toRadians(r(i,0)),n(o)?(o.west=e,o.south=t,o.east=a,o.north=i,o):new s(e,t,a,i)},s.fromRadians=function(e,t,a,i,o){return n(o)?(o.west=r(e,0),o.south=r(t,0),o.east=r(a,0),o.north=r(i,0),o):new s(e,t,a,i)},s.fromCartographicArray=function(e,r){t.defined("cartographics",e);for(var a=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,c=-Number.MAX_VALUE,l=Number.MAX_VALUE,f=-Number.MAX_VALUE,p=0,y=e.length;y>p;p++){var h=e[p];a=Math.min(a,h.longitude),i=Math.max(i,h.longitude),l=Math.min(l,h.latitude),f=Math.max(f,h.latitude);var d=h.longitude>=0?h.longitude:h.longitude+u.TWO_PI;o=Math.min(o,d),c=Math.max(c,d)}return i-a>c-o&&(a=o,i=c,i>u.PI&&(i-=u.TWO_PI),a>u.PI&&(a-=u.TWO_PI)),n(r)?(r.west=a,r.south=l,r.east=i,r.north=f,r):new s(a,l,i,f)},s.fromCartesianArray=function(e,a,o){t.defined("cartesians",e),a=r(a,i.WGS84);for(var c=Number.MAX_VALUE,l=-Number.MAX_VALUE,f=Number.MAX_VALUE,p=-Number.MAX_VALUE,y=Number.MAX_VALUE,h=-Number.MAX_VALUE,d=0,m=e.length;m>d;d++){var E=a.cartesianToCartographic(e[d]);c=Math.min(c,E.longitude),l=Math.max(l,E.longitude),y=Math.min(y,E.latitude),h=Math.max(h,E.latitude);var O=E.longitude>=0?E.longitude:E.longitude+u.TWO_PI;f=Math.min(f,O),p=Math.max(p,O)}return l-c>p-f&&(c=f,l=p,l>u.PI&&(l-=u.TWO_PI),c>u.PI&&(c-=u.TWO_PI)),n(o)?(o.west=c,o.south=y,o.east=l,o.north=h,o):new s(c,y,l,h)},s.clone=function(e,t){return n(e)?n(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new s(e.west,e.south,e.east,e.north):void 0},s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},s.prototype.equalsEpsilon=function(e,r){return t.typeOf.number("epsilon",r),n(e)&&Math.abs(this.west-e.west)<=r&&Math.abs(this.south-e.south)<=r&&Math.abs(this.east-e.east)<=r&&Math.abs(this.north-e.north)<=r},s.validate=function(e){t.typeOf.object("rectangle",e);var r=e.north;t.typeOf.number.greaterThanOrEquals("north",r,-u.PI_OVER_TWO),t.typeOf.number.lessThanOrEquals("north",r,u.PI_OVER_TWO);var n=e.south;t.typeOf.number.greaterThanOrEquals("south",n,-u.PI_OVER_TWO),t.typeOf.number.lessThanOrEquals("south",n,u.PI_OVER_TWO);var a=e.west;t.typeOf.number.greaterThanOrEquals("west",a,-Math.PI),t.typeOf.number.lessThanOrEquals("west",a,Math.PI);var i=e.east;t.typeOf.number.greaterThanOrEquals("east",i,-Math.PI),t.typeOf.number.lessThanOrEquals("east",i,Math.PI)},s.southwest=function(r,a){return t.typeOf.object("rectangle",r),n(a)?(a.longitude=r.west,a.latitude=r.south,a.height=0,a):new e(r.west,r.south)},s.northwest=function(r,a){return t.typeOf.object("rectangle",r),n(a)?(a.longitude=r.west,a.latitude=r.north,a.height=0,a):new e(r.west,r.north)},s.northeast=function(r,a){return t.typeOf.object("rectangle",r),n(a)?(a.longitude=r.east,a.latitude=r.north,a.height=0,a):new e(r.east,r.north)},s.southeast=function(r,a){return t.typeOf.object("rectangle",r),n(a)?(a.longitude=r.east,a.latitude=r.south,a.height=0,a):new e(r.east,r.south)},s.center=function(r,a){t.typeOf.object("rectangle",r);var i=r.east,o=r.west;o>i&&(i+=u.TWO_PI);var s=u.negativePiToPi(.5*(o+i)),c=.5*(r.south+r.north);return n(a)?(a.longitude=s,a.latitude=c,a.height=0,a):new e(s,c)},s.intersection=function(e,r,a){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r);var i=e.east,o=e.west,c=r.east,l=r.west;o>i&&c>0?i+=u.TWO_PI:l>c&&i>0&&(c+=u.TWO_PI),o>i&&0>l?l+=u.TWO_PI:l>c&&0>o&&(o+=u.TWO_PI);var f=u.negativePiToPi(Math.max(o,l)),p=u.negativePiToPi(Math.min(i,c));if(!((e.west=p)){var y=Math.max(e.south,r.south),h=Math.min(e.north,r.north);if(!(y>=h))return n(a)?(a.west=f,a.south=y,a.east=p,a.north=h,a):new s(f,y,p,h)}},s.simpleIntersection=function(e,r,a){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r);var i=Math.max(e.west,r.west),o=Math.max(e.south,r.south),u=Math.min(e.east,r.east),c=Math.min(e.north,r.north);return o>=c||i>=u?void 0:n(a)?(a.west=i,a.south=o,a.east=u,a.north=c,a):new s(i,o,u,c)},s.union=function(e,r,a){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r),n(a)||(a=new s);var i=e.east,o=e.west,c=r.east,l=r.west;o>i&&c>0?i+=u.TWO_PI:l>c&&i>0&&(c+=u.TWO_PI),o>i&&0>l?l+=u.TWO_PI:l>c&&0>o&&(o+=u.TWO_PI);var f=u.convertLongitudeRange(Math.min(o,l)),p=u.convertLongitudeRange(Math.max(i,c));return a.west=f,a.south=Math.min(e.south,r.south),a.east=p,a.north=Math.max(e.north,r.north),a},s.expand=function(e,r,a){return t.typeOf.object("rectangle",e),t.typeOf.object("cartographic",r),n(a)||(a=new s),a.west=Math.min(e.west,r.longitude),a.south=Math.min(e.south,r.latitude),a.east=Math.max(e.east,r.longitude),a.north=Math.max(e.north,r.latitude),a},s.contains=function(e,r){t.typeOf.object("rectangle",e),t.typeOf.object("cartographic",r);var n=r.longitude,a=r.latitude,i=e.west,o=e.east;return i>o&&(o+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>i||u.equalsEpsilon(n,i,u.EPSILON14))&&(o>n||u.equalsEpsilon(n,o,u.EPSILON14))&&a>=e.south&&a<=e.north};var c=new e;return s.subsample=function(e,a,o,l){t.typeOf.object("rectangle",e),a=r(a,i.WGS84),o=r(o,0),n(l)||(l=[]);var f=0,p=e.north,y=e.south,h=e.east,d=e.west,m=c;m.height=o,m.longitude=d,m.latitude=p,l[f]=a.cartographicToCartesian(m,l[f]),f++,m.longitude=h,l[f]=a.cartographicToCartesian(m,l[f]),f++,m.latitude=y,l[f]=a.cartographicToCartesian(m,l[f]),f++,m.longitude=d,l[f]=a.cartographicToCartesian(m,l[f]),f++,0>p?m.latitude=p:y>0?m.latitude=y:m.latitude=0;for(var E=1;8>E;++E)m.longitude=-Math.PI+E*u.PI_OVER_TWO,s.contains(e,m)&&(l[f]=a.cartographicToCartesian(m,l[f]),f++);return 0===m.latitude&&(m.longitude=d,l[f]=a.cartographicToCartesian(m,l[f]),f++,m.longitude=h,l[f]=a.cartographicToCartesian(m,l[f]),f++),l.length=f,l},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,t,r,n,a,i,o){"use strict";function u(e){this._ellipsoid=r(e,o.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}return a(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.prototype.project=function(t,r){var a=this._semimajorAxis,i=t.longitude*a,o=t.latitude*a,u=t.height;return n(r)?(r.x=i,r.y=o,r.z=u,r):new e(i,o,u)},u.prototype.unproject=function(e,r){if(!n(e))throw new i("cartesian is required");var a=this._oneOverSemimajorAxis,o=e.x*a,u=e.y*a,s=e.z;return n(r)?(r.longitude=o,r.latitude=u,r.height=s,r):new t(o,u,s)},u}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var t={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(t)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";function t(t,r){this.start=e(t,0),this.stop=e(r,0); }return t}),define("Core/Matrix3",["./Cartesian3","./Check","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i,o,u){"use strict";function s(e,t,n,a,i,o,u,s,c){this[0]=r(e,0),this[1]=r(a,0),this[2]=r(u,0),this[3]=r(t,0),this[4]=r(i,0),this[5]=r(s,0),this[6]=r(n,0),this[7]=r(o,0),this[8]=r(c,0)}function c(e){for(var t=0,r=0;9>r;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function l(e){for(var t=0,r=0;3>r;++r){var n=e[s.getElementIndex(d[r],h[r])];t+=2*n*n}return Math.sqrt(t)}function f(e,t){for(var r=u.EPSILON15,n=0,a=1,i=0;3>i;++i){var o=Math.abs(e[s.getElementIndex(d[i],h[i])]);o>n&&(a=i,n=o)}var c=1,l=0,f=h[a],p=d[a];if(Math.abs(e[s.getElementIndex(p,f)])>r){var y,m=e[s.getElementIndex(p,p)],E=e[s.getElementIndex(f,f)],O=e[s.getElementIndex(p,f)],T=(m-E)/2/O;y=0>T?-1/(-T+Math.sqrt(1+T*T)):1/(T+Math.sqrt(1+T*T)),c=1/Math.sqrt(1+y*y),l=y*c}return t=s.clone(s.IDENTITY,t),t[s.getElementIndex(f,f)]=t[s.getElementIndex(p,p)]=c,t[s.getElementIndex(p,f)]=l,t[s.getElementIndex(f,p)]=-l,t}s.packedLength=9,s.pack=function(e,n,a){return t.typeOf.object("value",e),t.defined("array",n),a=r(a,0),n[a++]=e[0],n[a++]=e[1],n[a++]=e[2],n[a++]=e[3],n[a++]=e[4],n[a++]=e[5],n[a++]=e[6],n[a++]=e[7],n[a++]=e[8],n},s.unpack=function(e,a,i){return t.defined("array",e),a=r(a,0),n(i)||(i=new s),i[0]=e[a++],i[1]=e[a++],i[2]=e[a++],i[3]=e[a++],i[4]=e[a++],i[5]=e[a++],i[6]=e[a++],i[7]=e[a++],i[8]=e[a++],i},s.clone=function(e,t){return n(e)?n(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 s(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},s.fromArray=function(e,a,i){return t.defined("array",e),a=r(a,0),n(i)||(i=new s),i[0]=e[a],i[1]=e[a+1],i[2]=e[a+2],i[3]=e[a+3],i[4]=e[a+4],i[5]=e[a+5],i[6]=e[a+6],i[7]=e[a+7],i[8]=e[a+8],i},s.fromColumnMajorArray=function(e,r){return t.defined("values",e),s.clone(e,r)},s.fromRowMajorArray=function(e,r){return t.defined("values",e),n(r)?(r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8],r):new s(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},s.fromQuaternion=function(e,r){t.typeOf.object("quaternion",e);var a=e.x*e.x,i=e.x*e.y,o=e.x*e.z,u=e.x*e.w,c=e.y*e.y,l=e.y*e.z,f=e.y*e.w,p=e.z*e.z,y=e.z*e.w,h=e.w*e.w,d=a-c-p+h,m=2*(i-y),E=2*(o+f),O=2*(i+y),T=-a+c-p+h,_=2*(l-u),v=2*(o-f),b=2*(l+u),w=-a-c+p+h;return n(r)?(r[0]=d,r[1]=O,r[2]=v,r[3]=m,r[4]=T,r[5]=b,r[6]=E,r[7]=_,r[8]=w,r):new s(d,m,E,O,T,_,v,b,w)},s.fromHeadingPitchRoll=function(e,r){t.typeOf.object("headingPitchRoll",e);var a=Math.cos(-e.pitch),i=Math.cos(-e.heading),o=Math.cos(e.roll),u=Math.sin(-e.pitch),c=Math.sin(-e.heading),l=Math.sin(e.roll),f=a*i,p=-o*c+l*u*i,y=l*c+o*u*i,h=a*c,d=o*i+l*u*c,m=-l*i+o*u*c,E=-u,O=l*a,T=o*a;return n(r)?(r[0]=f,r[1]=h,r[2]=E,r[3]=p,r[4]=d,r[5]=O,r[6]=y,r[7]=m,r[8]=T,r):new s(f,p,y,h,d,m,E,O,T)},s.fromScale=function(e,r){return t.typeOf.object("scale",e),n(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=0,r[4]=e.y,r[5]=0,r[6]=0,r[7]=0,r[8]=e.z,r):new s(e.x,0,0,0,e.y,0,0,0,e.z)},s.fromUniformScale=function(e,r){return t.typeOf.number("scale",e),n(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=e,r[5]=0,r[6]=0,r[7]=0,r[8]=e,r):new s(e,0,0,0,e,0,0,0,e)},s.fromCrossProduct=function(e,r){return t.typeOf.object("vector",e),n(r)?(r[0]=0,r[1]=e.z,r[2]=-e.y,r[3]=-e.z,r[4]=0,r[5]=e.x,r[6]=e.y,r[7]=-e.x,r[8]=0,r):new s(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},s.fromRotationX=function(e,r){t.typeOf.number("angle",e);var a=Math.cos(e),i=Math.sin(e);return n(r)?(r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=a,r[5]=i,r[6]=0,r[7]=-i,r[8]=a,r):new s(1,0,0,0,a,-i,0,i,a)},s.fromRotationY=function(e,r){t.typeOf.number("angle",e);var a=Math.cos(e),i=Math.sin(e);return n(r)?(r[0]=a,r[1]=0,r[2]=-i,r[3]=0,r[4]=1,r[5]=0,r[6]=i,r[7]=0,r[8]=a,r):new s(a,0,i,0,1,0,-i,0,a)},s.fromRotationZ=function(e,r){t.typeOf.number("angle",e);var a=Math.cos(e),i=Math.sin(e);return n(r)?(r[0]=a,r[1]=i,r[2]=0,r[3]=-i,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new s(a,-i,0,i,a,0,0,0,1)},s.toArray=function(e,r){return t.typeOf.object("matrix",e),n(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},s.getElementIndex=function(e,r){return t.typeOf.number.greaterThanOrEquals("row",r,0),t.typeOf.number.lessThanOrEquals("row",r,2),t.typeOf.number.greaterThanOrEquals("column",e,0),t.typeOf.number.lessThanOrEquals("column",e,2),3*e+r},s.getColumn=function(e,r,n){t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,2),t.typeOf.object("result",n);var a=3*r,i=e[a],o=e[a+1],u=e[a+2];return n.x=i,n.y=o,n.z=u,n},s.setColumn=function(e,r,n,a){t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,2),t.typeOf.object("cartesian",n),t.typeOf.object("result",a),a=s.clone(e,a);var i=3*r;return a[i]=n.x,a[i+1]=n.y,a[i+2]=n.z,a},s.getRow=function(e,r,n){t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,2),t.typeOf.object("result",n);var a=e[r],i=e[r+3],o=e[r+6];return n.x=a,n.y=i,n.z=o,n},s.setRow=function(e,r,n,a){return t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,2),t.typeOf.object("cartesian",n),t.typeOf.object("result",a),a=s.clone(e,a),a[r]=n.x,a[r+3]=n.y,a[r+6]=n.z,a};var p=new e;s.getScale=function(r,n){return t.typeOf.object("matrix",r),t.typeOf.object("result",n),n.x=e.magnitude(e.fromElements(r[0],r[1],r[2],p)),n.y=e.magnitude(e.fromElements(r[3],r[4],r[5],p)),n.z=e.magnitude(e.fromElements(r[6],r[7],r[8],p)),n};var y=new e;s.getMaximumScale=function(t){return s.getScale(t,y),e.maximumComponent(y)},s.multiply=function(e,r,n){t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n);var a=e[0]*r[0]+e[3]*r[1]+e[6]*r[2],i=e[1]*r[0]+e[4]*r[1]+e[7]*r[2],o=e[2]*r[0]+e[5]*r[1]+e[8]*r[2],u=e[0]*r[3]+e[3]*r[4]+e[6]*r[5],s=e[1]*r[3]+e[4]*r[4]+e[7]*r[5],c=e[2]*r[3]+e[5]*r[4]+e[8]*r[5],l=e[0]*r[6]+e[3]*r[7]+e[6]*r[8],f=e[1]*r[6]+e[4]*r[7]+e[7]*r[8],p=e[2]*r[6]+e[5]*r[7]+e[8]*r[8];return n[0]=a,n[1]=i,n[2]=o,n[3]=u,n[4]=s,n[5]=c,n[6]=l,n[7]=f,n[8]=p,n},s.add=function(e,r,n){return t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n),n[0]=e[0]+r[0],n[1]=e[1]+r[1],n[2]=e[2]+r[2],n[3]=e[3]+r[3],n[4]=e[4]+r[4],n[5]=e[5]+r[5],n[6]=e[6]+r[6],n[7]=e[7]+r[7],n[8]=e[8]+r[8],n},s.subtract=function(e,r,n){return t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n),n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],n[3]=e[3]-r[3],n[4]=e[4]-r[4],n[5]=e[5]-r[5],n[6]=e[6]-r[6],n[7]=e[7]-r[7],n[8]=e[8]-r[8],n},s.multiplyByVector=function(e,r,n){t.typeOf.object("matrix",e),t.typeOf.object("cartesian",r),t.typeOf.object("result",n);var a=r.x,i=r.y,o=r.z,u=e[0]*a+e[3]*i+e[6]*o,s=e[1]*a+e[4]*i+e[7]*o,c=e[2]*a+e[5]*i+e[8]*o;return n.x=u,n.y=s,n.z=c,n},s.multiplyByScalar=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.number("scalar",r),t.typeOf.object("result",n),n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7]*r,n[8]=e[8]*r,n},s.multiplyByScale=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.object("scale",r),t.typeOf.object("result",n),n[0]=e[0]*r.x,n[1]=e[1]*r.x,n[2]=e[2]*r.x,n[3]=e[3]*r.y,n[4]=e[4]*r.y,n[5]=e[5]*r.y,n[6]=e[6]*r.z,n[7]=e[7]*r.z,n[8]=e[8]*r.z,n},s.negate=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r},s.transpose=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],a=e[3],i=e[6],o=e[1],u=e[4],s=e[7],c=e[2],l=e[5],f=e[8];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=l,r[8]=f,r};var h=[1,0,0],d=[2,2,1],m=new s,E=new s;return s.computeEigenDecomposition=function(e,r){t.typeOf.object("matrix",e);var a=u.EPSILON20,i=10,o=0,p=0;n(r)||(r={});for(var y=r.unitary=s.clone(s.IDENTITY,r.unitary),h=r.diagonal=s.clone(e,r.diagonal),d=a*c(h);i>p&&l(h)>d;)f(h,m),s.transpose(m,E),s.multiply(h,m,h),s.multiply(E,h,h),s.multiply(y,m,y),++o>2&&(++p,o=0);return r},s.abs=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r},s.determinant=function(e){t.typeOf.object("matrix",e);var r=e[0],n=e[3],a=e[6],i=e[1],o=e[4],u=e[7],s=e[2],c=e[5],l=e[8];return r*(o*l-c*u)+i*(c*a-n*l)+s*(n*u-o*a)},s.inverse=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],a=e[1],o=e[2],c=e[3],l=e[4],f=e[5],p=e[6],y=e[7],h=e[8],d=s.determinant(e);if(Math.abs(d)<=u.EPSILON15)throw new i("matrix is not invertible");r[0]=l*h-y*f,r[1]=y*o-a*h,r[2]=a*f-l*o,r[3]=p*f-c*h,r[4]=n*h-p*o,r[5]=c*o-n*f,r[6]=c*y-p*l,r[7]=p*a-n*y,r[8]=n*l-c*a;var m=1/d;return s.multiplyByScalar(r,m,r)},s.equals=function(e,t){return e===t||n(e)&&n(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]},s.equalsEpsilon=function(e,r,a){return t.typeOf.number("epsilon",a),e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=a&&Math.abs(e[1]-r[1])<=a&&Math.abs(e[2]-r[2])<=a&&Math.abs(e[3]-r[3])<=a&&Math.abs(e[4]-r[4])<=a&&Math.abs(e[5]-r[5])<=a&&Math.abs(e[6]-r[6])<=a&&Math.abs(e[7]-r[7])<=a&&Math.abs(e[8]-r[8])<=a},s.IDENTITY=o(new s(1,0,0,0,1,0,0,0,1)),s.ZERO=o(new s(0,0,0,0,0,0,0,0,0)),s.COLUMN0ROW0=0,s.COLUMN0ROW1=1,s.COLUMN0ROW2=2,s.COLUMN1ROW0=3,s.COLUMN1ROW1=4,s.COLUMN1ROW2=5,s.COLUMN2ROW0=6,s.COLUMN2ROW1=7,s.COLUMN2ROW2=8,a(s.prototype,{length:{get:function(){return s.packedLength}}}),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},s}),define("Core/Cartesian4",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e,r,n,a){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(a,0)}o.fromElements=function(e,t,n,a,i){return r(i)?(i.x=e,i.y=t,i.z=n,i.w=a,i):new o(e,t,n,a)},o.fromColor=function(t,n){return e.typeOf.object("color",t),r(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new o(t.red,t.green,t.blue,t.alpha)},o.clone=function(e,t){return r(e)?r(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):void 0},o.packedLength=4,o.pack=function(r,n,a){return e.typeOf.object("value",r),e.defined("array",n),a=t(a,0),n[a++]=r.x,n[a++]=r.y,n[a++]=r.z,n[a]=r.w,n},o.unpack=function(n,a,i){return e.defined("array",n),a=t(a,0),r(i)||(i=new o),i.x=n[a++],i.y=n[a++],i.z=n[a++],i.w=n[a],i},o.packArray=function(t,n){e.defined("array",t);var a=t.length;r(n)?n.length=4*a:n=new Array(4*a);for(var i=0;a>i;++i)o.pack(t[i],n,4*i);return n},o.unpackArray=function(t,n){e.defined("array",t);var a=t.length;r(n)?n.length=a/4:n=new Array(a/4);for(var i=0;a>i;i+=4){var u=i/4;n[u]=o.unpack(t,i,n[u])}return n},o.fromArray=o.unpack,o.maximumComponent=function(t){return e.typeOf.object("cartesian",t),Math.max(t.x,t.y,t.z,t.w)},o.minimumComponent=function(t){return e.typeOf.object("cartesian",t),Math.min(t.x,t.y,t.z,t.w)},o.minimumByComponent=function(t,r,n){return e.typeOf.object("first",t),e.typeOf.object("second",r),e.typeOf.object("result",n),n.x=Math.min(t.x,r.x),n.y=Math.min(t.y,r.y),n.z=Math.min(t.z,r.z),n.w=Math.min(t.w,r.w),n},o.maximumByComponent=function(t,r,n){return e.typeOf.object("first",t),e.typeOf.object("second",r),e.typeOf.object("result",n),n.x=Math.max(t.x,r.x),n.y=Math.max(t.y,r.y),n.z=Math.max(t.z,r.z),n.w=Math.max(t.w,r.w),n},o.magnitudeSquared=function(t){return e.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var u=new o;o.distance=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.subtract(t,r,u),o.magnitude(u)},o.distanceSquared=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.subtract(t,r,u),o.magnitudeSquared(u)},o.normalize=function(t,r){e.typeOf.object("cartesian",t),e.typeOf.object("result",r);var a=o.magnitude(t);if(r.x=t.x/a,r.y=t.y/a,r.z=t.z/a,r.w=t.w/a,isNaN(r.x)||isNaN(r.y)||isNaN(r.z)||isNaN(r.w))throw new n("normalized result is not a number");return r},o.dot=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),t.x*r.x+t.y*r.y+t.z*r.z+t.w*r.w},o.multiplyComponents=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x*r.x,n.y=t.y*r.y,n.z=t.z*r.z,n.w=t.w*r.w,n},o.divideComponents=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x/r.x,n.y=t.y/r.y,n.z=t.z/r.z,n.w=t.w/r.w,n},o.add=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x+r.x,n.y=t.y+r.y,n.z=t.z+r.z,n.w=t.w+r.w,n},o.subtract=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x-r.x,n.y=t.y-r.y,n.z=t.z-r.z,n.w=t.w-r.w,n},o.multiplyByScalar=function(t,r,n){return e.typeOf.object("cartesian",t),e.typeOf.number("scalar",r),e.typeOf.object("result",n),n.x=t.x*r,n.y=t.y*r,n.z=t.z*r,n.w=t.w*r,n},o.divideByScalar=function(t,r,n){return e.typeOf.object("cartesian",t),e.typeOf.number("scalar",r),e.typeOf.object("result",n),n.x=t.x/r,n.y=t.y/r,n.z=t.z/r,n.w=t.w/r,n},o.negate=function(t,r){return e.typeOf.object("cartesian",t),e.typeOf.object("result",r),r.x=-t.x,r.y=-t.y,r.z=-t.z,r.w=-t.w,r},o.abs=function(t,r){return e.typeOf.object("cartesian",t),e.typeOf.object("result",r),r.x=Math.abs(t.x),r.y=Math.abs(t.y),r.z=Math.abs(t.z),r.w=Math.abs(t.w),r};var s=new o;o.lerp=function(t,r,n,a){return e.typeOf.object("start",t),e.typeOf.object("end",r),e.typeOf.number("t",n),e.typeOf.object("result",a),o.multiplyByScalar(r,n,s),a=o.multiplyByScalar(t,1-n,a),o.add(s,a,a)};var c=new o;return o.mostOrthogonalAxis=function(t,r){e.typeOf.object("cartesian",t),e.typeOf.object("result",r);var n=o.normalize(t,c);return o.abs(n,n),r=n.x<=n.y?n.x<=n.z?n.x<=n.w?o.clone(o.UNIT_X,r):o.clone(o.UNIT_W,r):n.z<=n.w?o.clone(o.UNIT_Z,r):o.clone(o.UNIT_W,r):n.y<=n.z?n.y<=n.w?o.clone(o.UNIT_Y,r):o.clone(o.UNIT_W,r):n.z<=n.w?o.clone(o.UNIT_Z,r):o.clone(o.UNIT_W,r)},o.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},o.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]&&e.z===t[r+2]&&e.w===t[r+3]},o.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)&&i.equalsEpsilon(e.z,t.z,n,a)&&i.equalsEpsilon(e.w,t.w,n,a)},o.ZERO=a(new o(0,0,0,0)),o.UNIT_X=a(new o(1,0,0,0)),o.UNIT_Y=a(new o(0,1,0,0)),o.UNIT_Z=a(new o(0,0,1,0)),o.UNIT_W=a(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,r){return o.equalsEpsilon(this,e,t,r)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},o}),define("Core/RuntimeError",["./defined"],function(e){"use strict";function t(e){this.name="RuntimeError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t}return e(Object.create)&&(t.prototype=Object.create(Error.prototype),t.prototype.constructor=t),t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./Check","./defaultValue","./defined","./defineProperties","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,t,r,n,a,i,o,u,s,c){"use strict";function l(e,t,r,a,i,o,u,s,c,l,f,p,y,h,d,m){this[0]=n(e,0),this[1]=n(i,0),this[2]=n(c,0),this[3]=n(y,0),this[4]=n(t,0),this[5]=n(o,0),this[6]=n(l,0),this[7]=n(h,0),this[8]=n(r,0),this[9]=n(u,0),this[10]=n(f,0),this[11]=n(d,0),this[12]=n(a,0),this[13]=n(s,0),this[14]=n(p,0),this[15]=n(m,0)}l.packedLength=16,l.pack=function(e,t,a){return r.typeOf.object("value",e),r.defined("array",t),a=n(a,0),t[a++]=e[0],t[a++]=e[1],t[a++]=e[2],t[a++]=e[3],t[a++]=e[4],t[a++]=e[5],t[a++]=e[6],t[a++]=e[7],t[a++]=e[8],t[a++]=e[9],t[a++]=e[10],t[a++]=e[11],t[a++]=e[12],t[a++]=e[13],t[a++]=e[14],t[a]=e[15],t},l.unpack=function(e,t,i){return r.defined("array",e),t=n(t,0),a(i)||(i=new l),i[0]=e[t++],i[1]=e[t++],i[2]=e[t++],i[3]=e[t++],i[4]=e[t++],i[5]=e[t++],i[6]=e[t++],i[7]=e[t++],i[8]=e[t++],i[9]=e[t++],i[10]=e[t++],i[11]=e[t++],i[12]=e[t++],i[13]=e[t++],i[14]=e[t++],i[15]=e[t],i},l.clone=function(e,t){return a(e)?a(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new l(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]):void 0},l.fromArray=l.unpack,l.fromColumnMajorArray=function(e,t){return r.defined("values",e),l.clone(e,t)},l.fromRowMajorArray=function(e,t){return r.defined("values",e),a(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new l(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},l.fromRotationTranslation=function(t,i,o){return r.typeOf.object("rotation",t),i=n(i,e.ZERO),a(o)?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=0,o[4]=t[3],o[5]=t[4],o[6]=t[5],o[7]=0,o[8]=t[6],o[9]=t[7],o[10]=t[8],o[11]=0,o[12]=i.x,o[13]=i.y,o[14]=i.z,o[15]=1,o):new l(t[0],t[3],t[6],i.x,t[1],t[4],t[7],i.y,t[2],t[5],t[8],i.z,0,0,0,1)},l.fromTranslationQuaternionRotationScale=function(e,t,n,i){r.typeOf.object("translation",e),r.typeOf.object("rotation",t),r.typeOf.object("scale",n),a(i)||(i=new l);var o=n.x,u=n.y,s=n.z,c=t.x*t.x,f=t.x*t.y,p=t.x*t.z,y=t.x*t.w,h=t.y*t.y,d=t.y*t.z,m=t.y*t.w,E=t.z*t.z,O=t.z*t.w,T=t.w*t.w,_=c-h-E+T,v=2*(f-O),b=2*(p+m),w=2*(f+O),R=-c+h-E+T,g=2*(d-y),A=2*(p-m),N=2*(d+y),S=-c-h+E+T;return i[0]=_*o,i[1]=w*o,i[2]=A*o,i[3]=0,i[4]=v*u,i[5]=R*u,i[6]=N*u,i[7]=0,i[8]=b*s,i[9]=g*s,i[10]=S*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i},l.fromTranslationRotationScale=function(e,t){return r.typeOf.object("translationRotationScale",e),l.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)},l.fromTranslation=function(e,t){return r.typeOf.object("translation",e),l.fromRotationTranslation(s.IDENTITY,e,t)},l.fromScale=function(e,t){return r.typeOf.object("scale",e),a(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new l(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},l.fromUniformScale=function(e,t){return r.typeOf.number("scale",e),a(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new l(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var f=new e,p=new e,y=new e;l.fromCamera=function(t,n){r.typeOf.object("camera",t);var i=t.position,o=t.direction,u=t.up;r.typeOf.object("camera.position",i),r.typeOf.object("camera.direction",o),r.typeOf.object("camera.up",u),e.normalize(o,f),e.normalize(e.cross(f,u,p),p),e.normalize(e.cross(p,f,y),y);var s=p.x,c=p.y,h=p.z,d=f.x,m=f.y,E=f.z,O=y.x,T=y.y,_=y.z,v=i.x,b=i.y,w=i.z,R=s*-v+c*-b+h*-w,g=O*-v+T*-b+_*-w,A=d*v+m*b+E*w;return a(n)?(n[0]=s,n[1]=O,n[2]=-d,n[3]=0,n[4]=c,n[5]=T,n[6]=-m,n[7]=0,n[8]=h,n[9]=_,n[10]=-E,n[11]=0,n[12]=R,n[13]=g,n[14]=A,n[15]=1,n):new l(s,c,h,R,O,T,_,g,-d,-m,-E,A,0,0,0,1)},l.computePerspectiveFieldOfView=function(e,t,n,a,i){r.typeOf.number.greaterThan("fovY",e,0),r.typeOf.number.lessThan("fovY",e,Math.PI),r.typeOf.number.greaterThan("near",n,0),r.typeOf.number.greaterThan("far",a,0),r.typeOf.object("result",i);var o=Math.tan(.5*e),u=1/o,s=u/t,c=(a+n)/(n-a),l=2*a*n/(n-a);return i[0]=s,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=u,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=c,i[11]=-1,i[12]=0,i[13]=0,i[14]=l,i[15]=0,i},l.computeOrthographicOffCenter=function(e,t,n,a,i,o,u){r.typeOf.number("left",e),r.typeOf.number("right",t),r.typeOf.number("bottom",n),r.typeOf.number("top",a),r.typeOf.number("near",i),r.typeOf.number("far",o),r.typeOf.object("result",u);var s=1/(t-e),c=1/(a-n),l=1/(o-i),f=-(t+e)*s,p=-(a+n)*c,y=-(o+i)*l;return s*=2,c*=2,l*=-2,u[0]=s,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=c,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=l,u[11]=0,u[12]=f,u[13]=p,u[14]=y,u[15]=1,u},l.computePerspectiveOffCenter=function(e,t,n,a,i,o,u){r.typeOf.number("left",e),r.typeOf.number("right",t),r.typeOf.number("bottom",n),r.typeOf.number("top",a),r.typeOf.number("near",i),r.typeOf.number("far",o),r.typeOf.object("result",u);var s=2*i/(t-e),c=2*i/(a-n),l=(t+e)/(t-e),f=(a+n)/(a-n),p=-(o+i)/(o-i),y=-1,h=-2*o*i/(o-i);return u[0]=s,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=c,u[6]=0,u[7]=0,u[8]=l,u[9]=f,u[10]=p,u[11]=y,u[12]=0,u[13]=0,u[14]=h,u[15]=0,u},l.computeInfinitePerspectiveOffCenter=function(e,t,n,a,i,o){r.typeOf.number("left",e),r.typeOf.number("right",t),r.typeOf.number("bottom",n),r.typeOf.number("top",a),r.typeOf.number("near",i),r.typeOf.object("result",o);var u=2*i/(t-e),s=2*i/(a-n),c=(t+e)/(t-e),l=(a+n)/(a-n),f=-1,p=-1,y=-2*i;return o[0]=u,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=c,o[9]=l,o[10]=f,o[11]=p,o[12]=0,o[13]=0,o[14]=y,o[15]=0,o},l.computeViewportTransformation=function(e,t,a,i){r.typeOf.object("result",i),e=n(e,n.EMPTY_OBJECT);var o=n(e.x,0),u=n(e.y,0),s=n(e.width,0),c=n(e.height,0);t=n(t,0),a=n(a,1);var l=.5*s,f=.5*c,p=.5*(a-t),y=l,h=f,d=p,m=o+l,E=u+f,O=t+p,T=1;return i[0]=y,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]=d,i[11]=0,i[12]=m,i[13]=E,i[14]=O,i[15]=T,i},l.computeView=function(t,n,a,i,o){return r.typeOf.object("position",t),r.typeOf.object("direction",n),r.typeOf.object("up",a),r.typeOf.object("right",i),r.typeOf.object("result",o),o[0]=i.x,o[1]=a.x,o[2]=-n.x,o[3]=0,o[4]=i.y,o[5]=a.y,o[6]=-n.y,o[7]=0,o[8]=i.z,o[9]=a.z,o[10]=-n.z,o[11]=0,o[12]=-e.dot(i,t),o[13]=-e.dot(a,t),o[14]=e.dot(n,t),o[15]=1,o},l.toArray=function(e,t){return r.typeOf.object("matrix",e),a(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},l.getElementIndex=function(e,t){return r.typeOf.number.greaterThanOrEquals("row",t,0),r.typeOf.number.lessThanOrEquals("row",t,3),r.typeOf.number.greaterThanOrEquals("column",e,0),r.typeOf.number.lessThanOrEquals("column",e,3),4*e+t},l.getColumn=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.number.greaterThanOrEquals("index",t,0),r.typeOf.number.lessThanOrEquals("index",t,3),r.typeOf.object("result",n);var a=4*t,i=e[a],o=e[a+1],u=e[a+2],s=e[a+3];return n.x=i,n.y=o,n.z=u,n.w=s,n},l.setColumn=function(e,t,n,a){r.typeOf.object("matrix",e),r.typeOf.number.greaterThanOrEquals("index",t,0),r.typeOf.number.lessThanOrEquals("index",t,3),r.typeOf.object("cartesian",n),r.typeOf.object("result",a),a=l.clone(e,a);var i=4*t;return a[i]=n.x,a[i+1]=n.y,a[i+2]=n.z,a[i+3]=n.w,a},l.setTranslation=function(e,t,n){return r.typeOf.object("matrix",e),r.typeOf.object("translation",t),r.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},l.getRow=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.number.greaterThanOrEquals("index",t,0),r.typeOf.number.lessThanOrEquals("index",t,3),r.typeOf.object("result",n);var a=e[t],i=e[t+4],o=e[t+8],u=e[t+12];return n.x=a,n.y=i,n.z=o,n.w=u,n},l.setRow=function(e,t,n,a){return r.typeOf.object("matrix",e),r.typeOf.number.greaterThanOrEquals("index",t,0),r.typeOf.number.lessThanOrEquals("index",t,3),r.typeOf.object("cartesian",n),r.typeOf.object("result",a),a=l.clone(e,a),a[t]=n.x,a[t+4]=n.y,a[t+8]=n.z,a[t+12]=n.w,a};var h=new e;l.getScale=function(t,n){return r.typeOf.object("matrix",t),r.typeOf.object("result",n),n.x=e.magnitude(e.fromElements(t[0],t[1],t[2],h)),n.y=e.magnitude(e.fromElements(t[4],t[5],t[6],h)),n.z=e.magnitude(e.fromElements(t[8],t[9],t[10],h)),n};var d=new e;l.getMaximumScale=function(t){return l.getScale(t,d),e.maximumComponent(d)},l.multiply=function(e,t,n){r.typeOf.object("left",e),r.typeOf.object("right",t),r.typeOf.object("result",n);var a=e[0],i=e[1],o=e[2],u=e[3],s=e[4],c=e[5],l=e[6],f=e[7],p=e[8],y=e[9],h=e[10],d=e[11],m=e[12],E=e[13],O=e[14],T=e[15],_=t[0],v=t[1],b=t[2],w=t[3],R=t[4],g=t[5],A=t[6],N=t[7],S=t[8],x=t[9],I=t[10],M=t[11],C=t[12],P=t[13],L=t[14],U=t[15],F=a*_+s*v+p*b+m*w,D=i*_+c*v+y*b+E*w,B=o*_+l*v+h*b+O*w,z=u*_+f*v+d*b+T*w,j=a*R+s*g+p*A+m*N,q=i*R+c*g+y*A+E*N,G=o*R+l*g+h*A+O*N,V=u*R+f*g+d*A+T*N,X=a*S+s*x+p*I+m*M,W=i*S+c*x+y*I+E*M,H=o*S+l*x+h*I+O*M,Y=u*S+f*x+d*I+T*M,k=a*C+s*P+p*L+m*U,Z=i*C+c*P+y*L+E*U,K=o*C+l*P+h*L+O*U,Q=u*C+f*P+d*L+T*U;return n[0]=F,n[1]=D,n[2]=B,n[3]=z,n[4]=j,n[5]=q,n[6]=G,n[7]=V,n[8]=X,n[9]=W,n[10]=H,n[11]=Y,n[12]=k,n[13]=Z,n[14]=K,n[15]=Q,n},l.add=function(e,t,n){return r.typeOf.object("left",e),r.typeOf.object("right",t),r.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n},l.subtract=function(e,t,n){return r.typeOf.object("left",e),r.typeOf.object("right",t),r.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n},l.multiplyTransformation=function(e,t,n){r.typeOf.object("left",e),r.typeOf.object("right",t),r.typeOf.object("result",n);var a=e[0],i=e[1],o=e[2],u=e[4],s=e[5],c=e[6],l=e[8],f=e[9],p=e[10],y=e[12],h=e[13],d=e[14],m=t[0],E=t[1],O=t[2],T=t[4],_=t[5],v=t[6],b=t[8],w=t[9],R=t[10],g=t[12],A=t[13],N=t[14],S=a*m+u*E+l*O,x=i*m+s*E+f*O,I=o*m+c*E+p*O,M=a*T+u*_+l*v,C=i*T+s*_+f*v,P=o*T+c*_+p*v,L=a*b+u*w+l*R,U=i*b+s*w+f*R,F=o*b+c*w+p*R,D=a*g+u*A+l*N+y,B=i*g+s*A+f*N+h,z=o*g+c*A+p*N+d;return n[0]=S,n[1]=x,n[2]=I,n[3]=0,n[4]=M,n[5]=C,n[6]=P,n[7]=0,n[8]=L,n[9]=U,n[10]=F,n[11]=0,n[12]=D,n[13]=B,n[14]=z,n[15]=1,n},l.multiplyByMatrix3=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.object("rotation",t),r.typeOf.object("result",n);var a=e[0],i=e[1],o=e[2],u=e[4],s=e[5],c=e[6],l=e[8],f=e[9],p=e[10],y=t[0],h=t[1],d=t[2],m=t[3],E=t[4],O=t[5],T=t[6],_=t[7],v=t[8],b=a*y+u*h+l*d,w=i*y+s*h+f*d,R=o*y+c*h+p*d,g=a*m+u*E+l*O,A=i*m+s*E+f*O,N=o*m+c*E+p*O,S=a*T+u*_+l*v,x=i*T+s*_+f*v,I=o*T+c*_+p*v;return n[0]=b,n[1]=w,n[2]=R,n[3]=0,n[4]=g,n[5]=A,n[6]=N,n[7]=0,n[8]=S,n[9]=x,n[10]=I,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},l.multiplyByTranslation=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.object("translation",t),r.typeOf.object("result",n);var a=t.x,i=t.y,o=t.z,u=a*e[0]+i*e[4]+o*e[8]+e[12],s=a*e[1]+i*e[5]+o*e[9]+e[13],c=a*e[2]+i*e[6]+o*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]=u,n[13]=s,n[14]=c,n[15]=e[15],n};var m=new e;l.multiplyByUniformScale=function(e,t,n){return r.typeOf.object("matrix",e),r.typeOf.number("scale",t),r.typeOf.object("result",n),m.x=t,m.y=t,m.z=t,l.multiplyByScale(e,m,n)},l.multiplyByScale=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.object("scale",t),r.typeOf.object("result",n);var a=t.x,i=t.y,o=t.z;return 1===a&&1===i&&1===o?l.clone(e,n):(n[0]=a*e[0],n[1]=a*e[1],n[2]=a*e[2],n[3]=0,n[4]=i*e[4],n[5]=i*e[5],n[6]=i*e[6],n[7]=0,n[8]=o*e[8],n[9]=o*e[9],n[10]=o*e[10],n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=1,n)},l.multiplyByVector=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.object("cartesian",t),r.typeOf.object("result",n);var a=t.x,i=t.y,o=t.z,u=t.w,s=e[0]*a+e[4]*i+e[8]*o+e[12]*u,c=e[1]*a+e[5]*i+e[9]*o+e[13]*u,l=e[2]*a+e[6]*i+e[10]*o+e[14]*u,f=e[3]*a+e[7]*i+e[11]*o+e[15]*u;return n.x=s,n.y=c,n.z=l,n.w=f,n},l.multiplyByPointAsVector=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.object("cartesian",t),r.typeOf.object("result",n);var a=t.x,i=t.y,o=t.z,u=e[0]*a+e[4]*i+e[8]*o,s=e[1]*a+e[5]*i+e[9]*o,c=e[2]*a+e[6]*i+e[10]*o;return n.x=u,n.y=s,n.z=c,n},l.multiplyByPoint=function(e,t,n){r.typeOf.object("matrix",e),r.typeOf.object("cartesian",t),r.typeOf.object("result",n);var a=t.x,i=t.y,o=t.z,u=e[0]*a+e[4]*i+e[8]*o+e[12],s=e[1]*a+e[5]*i+e[9]*o+e[13],c=e[2]*a+e[6]*i+e[10]*o+e[14];return n.x=u,n.y=s,n.z=c,n},l.multiplyByScalar=function(e,t,n){return r.typeOf.object("matrix",e),r.typeOf.number("scalar",t),r.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n},l.negate=function(e,t){return r.typeOf.object("matrix",e),r.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},l.transpose=function(e,t){r.typeOf.object("matrix",e),r.typeOf.object("result",t);var n=e[1],a=e[2],i=e[3],o=e[6],u=e[7],s=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]=a,t[9]=o,t[10]=e[10],t[11]=e[14],t[12]=i,t[13]=u,t[14]=s,t[15]=e[15],t},l.abs=function(e,t){return r.typeOf.object("matrix",e),r.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t},l.equals=function(e,t){return e===t||a(e)&&a(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]},l.equalsEpsilon=function(e,t,n){return r.typeOf.number("epsilon",n),e===t||a(e)&&a(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n},l.getTranslation=function(e,t){return r.typeOf.object("matrix",e),r.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t},l.getRotation=function(e,t){return r.typeOf.object("matrix",e),r.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};var E=new s,O=new s,T=new t,_=new t(0,0,0,1);return l.inverse=function(e,n){if(r.typeOf.object("matrix",e),r.typeOf.object("result",n),s.equalsEpsilon(l.getRotation(e,E),O,u.EPSILON7)&&t.equals(l.getRow(e,3,T),_))return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0, n[11]=0,n[12]=-e[12],n[13]=-e[13],n[14]=-e[14],n[15]=1,n;var a=e[0],i=e[4],o=e[8],f=e[12],p=e[1],y=e[5],h=e[9],d=e[13],m=e[2],v=e[6],b=e[10],w=e[14],R=e[3],g=e[7],A=e[11],N=e[15],S=b*N,x=w*A,I=v*N,M=w*g,C=v*A,P=b*g,L=m*N,U=w*R,F=m*A,D=b*R,B=m*g,z=v*R,j=S*y+M*h+C*d-(x*y+I*h+P*d),q=x*p+L*h+D*d-(S*p+U*h+F*d),G=I*p+U*y+B*d-(M*p+L*y+z*d),V=P*p+F*y+z*h-(C*p+D*y+B*h),X=x*i+I*o+P*f-(S*i+M*o+C*f),W=S*a+U*o+F*f-(x*a+L*o+D*f),H=M*a+L*i+z*f-(I*a+U*i+B*f),Y=C*a+D*i+B*o-(P*a+F*i+z*o);S=o*d,x=f*h,I=i*d,M=f*y,C=i*h,P=o*y,L=a*d,U=f*p,F=a*h,D=o*p,B=a*y,z=i*p;var k=S*g+M*A+C*N-(x*g+I*A+P*N),Z=x*R+L*A+D*N-(S*R+U*A+F*N),K=I*R+U*g+B*N-(M*R+L*g+z*N),Q=P*R+F*g+z*A-(C*R+D*g+B*A),J=I*b+P*w+x*v-(C*w+S*v+M*b),$=F*w+S*m+U*b-(L*b+D*w+x*m),ee=L*v+z*w+M*m-(B*w+I*m+U*v),te=B*b+C*m+D*v-(F*v+z*b+P*m),re=a*j+i*q+o*G+f*V;if(Math.abs(re)n;n++){e.clone(t[n],i);var A=i.x,N=i.y,S=i.z;Ac.x&&e.clone(i,c),Nl.y&&e.clone(i,l),Sf.z&&e.clone(i,f)}var x=e.magnitudeSquared(e.subtract(c,o,_)),I=e.magnitudeSquared(e.subtract(l,u,_)),M=e.magnitudeSquared(e.subtract(f,s,_)),C=o,P=c,L=x;I>L&&(L=I,C=u,P=l),M>L&&(L=M,C=s,P=f);var U=v;U.x=.5*(C.x+P.x),U.y=.5*(C.y+P.y),U.z=.5*(C.z+P.z);var F=e.magnitudeSquared(e.subtract(P,U,_)),D=Math.sqrt(F),B=b;B.x=o.x,B.y=u.y,B.z=s.z;var z=w;z.x=c.x,z.y=l.y,z.z=f.z;var j=e.multiplyByScalar(e.add(B,z,_),.5,R),q=0;for(n=0;g>n;n++){e.clone(t[n],i);var G=e.magnitude(e.subtract(i,j,_));G>q&&(q=G);var V=e.magnitudeSquared(e.subtract(i,U,_));if(V>F){var X=Math.sqrt(V);D=.5*(D+X),F=D*D;var W=X-D;U.x=(D*U.x+W*i.x)/X,U.y=(D*U.y+W*i.y)/X,U.z=(D*U.z+W*i.z)/X}}return q>D?(e.clone(U,r.center),r.radius=D):(e.clone(j,r.center),r.radius=q),r};var g=new o,A=new e,N=new e,S=new t,x=new t;p.fromRectangle2D=function(e,t,r){return p.fromRectangleWithHeights2D(e,t,0,0,r)},p.fromRectangleWithHeights2D=function(t,r,i,o,u){if(a(u)||(u=new p),!a(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;r=n(r,g),f.southwest(t,S),S.height=i,f.northeast(t,x),x.height=o;var s=r.project(S,A),c=r.project(x,N),l=c.x-s.x,y=c.y-s.y,h=c.z-s.z;u.radius=.5*Math.sqrt(l*l+y*y+h*h);var d=u.center;return d.x=s.x+.5*l,d.y=s.y+.5*y,d.z=s.z+.5*h,u};var I=[];p.fromRectangle3D=function(t,r,o,u){if(r=n(r,i.WGS84),o=n(o,0),a(u)||(u=new p),!a(t))return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;var s=f.subsample(t,r,o,I);return p.fromPoints(s,u)},p.fromVertices=function(t,i,o,u){if(a(u)||(u=new p),!a(t)||0===t.length)return u.center=e.clone(e.ZERO,u.center),u.radius=0,u;i=n(i,e.ZERO),o=n(o,3),r.typeOf.number.greaterThanOrEquals("stride",o,3);var s=T;s.x=t[0]+i.x,s.y=t[1]+i.y,s.z=t[2]+i.z;var c,l=e.clone(s,y),f=e.clone(s,h),g=e.clone(s,d),A=e.clone(s,m),N=e.clone(s,E),S=e.clone(s,O),x=t.length;for(c=0;x>c;c+=o){var I=t[c]+i.x,M=t[c+1]+i.y,C=t[c+2]+i.z;s.x=I,s.y=M,s.z=C,IA.x&&e.clone(s,A),MN.y&&e.clone(s,N),CS.z&&e.clone(s,S)}var P=e.magnitudeSquared(e.subtract(A,l,_)),L=e.magnitudeSquared(e.subtract(N,f,_)),U=e.magnitudeSquared(e.subtract(S,g,_)),F=l,D=A,B=P;L>B&&(B=L,F=f,D=N),U>B&&(B=U,F=g,D=S);var z=v;z.x=.5*(F.x+D.x),z.y=.5*(F.y+D.y),z.z=.5*(F.z+D.z);var j=e.magnitudeSquared(e.subtract(D,z,_)),q=Math.sqrt(j),G=b;G.x=l.x,G.y=f.y,G.z=g.z;var V=w;V.x=A.x,V.y=N.y,V.z=S.z;var X=e.multiplyByScalar(e.add(G,V,_),.5,R),W=0;for(c=0;x>c;c+=o){s.x=t[c]+i.x,s.y=t[c+1]+i.y,s.z=t[c+2]+i.z;var H=e.magnitude(e.subtract(s,X,_));H>W&&(W=H);var Y=e.magnitudeSquared(e.subtract(s,z,_));if(Y>j){var k=Math.sqrt(Y);q=.5*(q+k),j=q*q;var Z=k-q;z.x=(q*z.x+Z*s.x)/k,z.y=(q*z.y+Z*s.y)/k,z.z=(q*z.z+Z*s.z)/k}}return W>q?(e.clone(z,u.center),u.radius=q):(e.clone(X,u.center),u.radius=W),u},p.fromEncodedCartesianVertices=function(t,r,n){if(a(n)||(n=new p),!a(t)||!a(r)||t.length!==r.length||0===t.length)return n.center=e.clone(e.ZERO,n.center),n.radius=0,n;var i=T;i.x=t[0]+r[0],i.y=t[1]+r[1],i.z=t[2]+r[2];var o,u=e.clone(i,y),s=e.clone(i,h),c=e.clone(i,d),l=e.clone(i,m),f=e.clone(i,E),g=e.clone(i,O),A=t.length;for(o=0;A>o;o+=3){var N=t[o]+r[o],S=t[o+1]+r[o+1],x=t[o+2]+r[o+2];i.x=N,i.y=S,i.z=x,Nl.x&&e.clone(i,l),Sf.y&&e.clone(i,f),xg.z&&e.clone(i,g)}var I=e.magnitudeSquared(e.subtract(l,u,_)),M=e.magnitudeSquared(e.subtract(f,s,_)),C=e.magnitudeSquared(e.subtract(g,c,_)),P=u,L=l,U=I;M>U&&(U=M,P=s,L=f),C>U&&(U=C,P=c,L=g);var F=v;F.x=.5*(P.x+L.x),F.y=.5*(P.y+L.y),F.z=.5*(P.z+L.z);var D=e.magnitudeSquared(e.subtract(L,F,_)),B=Math.sqrt(D),z=b;z.x=u.x,z.y=s.y,z.z=c.z;var j=w;j.x=l.x,j.y=f.y,j.z=g.z;var q=e.multiplyByScalar(e.add(z,j,_),.5,R),G=0;for(o=0;A>o;o+=3){i.x=t[o]+r[o],i.y=t[o+1]+r[o+1],i.z=t[o+2]+r[o+2];var V=e.magnitude(e.subtract(i,q,_));V>G&&(G=V);var X=e.magnitudeSquared(e.subtract(i,F,_));if(X>D){var W=Math.sqrt(X);B=.5*(B+W),D=B*B;var H=W-B;F.x=(B*F.x+H*i.x)/W,F.y=(B*F.y+H*i.y)/W,F.z=(B*F.z+H*i.z)/W}}return G>B?(e.clone(F,n.center),n.radius=B):(e.clone(q,n.center),n.radius=G),n},p.fromCornerPoints=function(t,n,i){r.typeOf.object("corner",t),r.typeOf.object("oppositeCorner",n),a(i)||(i=new p);var o=i.center;return e.add(t,n,o),e.multiplyByScalar(o,.5,o),i.radius=e.distance(o,n),i},p.fromEllipsoid=function(t,n){return r.typeOf.object("ellipsoid",t),a(n)||(n=new p),e.clone(e.ZERO,n.center),n.radius=t.maximumRadius,n};var M=new e;p.fromBoundingSpheres=function(t,r){if(a(r)||(r=new p),!a(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var n=t.length;if(1===n)return p.clone(t[0],r);if(2===n)return p.union(t[0],t[1],r);var i,o=[];for(i=0;n>i;i++)o.push(t[i].center);r=p.fromPoints(o,r);var u=r.center,s=r.radius;for(i=0;n>i;i++){var c=t[i];s=Math.max(s,e.distance(u,c.center,M)+c.radius)}return r.radius=s,r};var C=new e,P=new e,L=new e;p.fromOrientedBoundingBox=function(t,n){r.defined("orientedBoundingBox",t),a(n)||(n=new p);var i=t.halfAxes,o=c.getColumn(i,0,C),u=c.getColumn(i,1,P),s=c.getColumn(i,2,L);return e.add(o,u,o),e.add(o,s,o),n.center=e.clone(t.center,n.center),n.radius=e.magnitude(o),n},p.clone=function(t,r){return a(t)?a(r)?(r.center=e.clone(t.center,r.center),r.radius=t.radius,r):new p(t.center,t.radius):void 0},p.packedLength=4,p.pack=function(e,t,a){r.typeOf.object("value",e),r.defined("array",t),a=n(a,0);var i=e.center;return t[a++]=i.x,t[a++]=i.y,t[a++]=i.z,t[a]=e.radius,t},p.unpack=function(e,t,i){r.defined("array",e),t=n(t,0),a(i)||(i=new p);var o=i.center;return o.x=e[t++],o.y=e[t++],o.z=e[t++],i.radius=e[t],i};var U=new e,F=new e;p.union=function(t,n,i){r.typeOf.object("left",t),r.typeOf.object("right",n),a(i)||(i=new p);var o=t.center,u=t.radius,s=n.center,c=n.radius,l=e.subtract(s,o,U),f=e.magnitude(l);if(u>=f+c)return t.clone(i),i;if(c>=f+u)return n.clone(i),i;var y=.5*(u+f+c),h=e.multiplyByScalar(l,(-u+y)/f,F);return e.add(h,o,h),e.clone(h,i.center),i.radius=y,i};var D=new e;p.expand=function(t,n,a){r.typeOf.object("sphere",t),r.typeOf.object("point",n),a=p.clone(t,a);var i=e.magnitude(e.subtract(n,a.center,D));return i>a.radius&&(a.radius=i),a},p.intersectPlane=function(t,n){r.typeOf.object("sphere",t),r.typeOf.object("plane",n);var a=t.center,i=t.radius,o=n.normal,s=e.dot(o,a)+n.distance;return-i>s?u.OUTSIDE:i>s?u.INTERSECTING:u.INSIDE},p.transform=function(e,t,n){return r.typeOf.object("sphere",e),r.typeOf.object("transform",t),a(n)||(n=new p),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=l.getMaximumScale(t)*e.radius,n};var B=new e;p.distanceSquaredTo=function(t,n){r.typeOf.object("sphere",t),r.typeOf.object("cartesian",n);var a=e.subtract(t.center,n,B);return e.magnitudeSquared(a)-t.radius*t.radius},p.transformWithoutScale=function(e,t,n){return r.typeOf.object("sphere",e),r.typeOf.object("transform",t),a(n)||(n=new p),n.center=l.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var z=new e;p.computePlaneDistances=function(t,n,i,o){r.typeOf.object("sphere",t),r.typeOf.object("position",n),r.typeOf.object("direction",i),a(o)||(o=new s);var u=e.subtract(t.center,n,z),c=e.dot(i,u);return o.start=c-t.radius,o.stop=c+t.radius,o};for(var j=new e,q=new e,G=new e,V=new e,X=new e,W=new t,H=new Array(8),Y=0;8>Y;++Y)H[Y]=new e;var k=new o;return p.projectTo2D=function(t,a,i){r.typeOf.object("sphere",t),a=n(a,k);var o=a.ellipsoid,u=t.center,s=t.radius,c=o.geodeticSurfaceNormal(u,j),l=e.cross(e.UNIT_Z,c,q);e.normalize(l,l);var f=e.cross(c,l,G);e.normalize(f,f),e.multiplyByScalar(c,s,c),e.multiplyByScalar(f,s,f),e.multiplyByScalar(l,s,l);var y=e.negate(f,X),h=e.negate(l,V),d=H,m=d[0];e.add(c,f,m),e.add(m,l,m),m=d[1],e.add(c,f,m),e.add(m,h,m),m=d[2],e.add(c,y,m),e.add(m,h,m),m=d[3],e.add(c,y,m),e.add(m,l,m),e.negate(c,c),m=d[4],e.add(c,f,m),e.add(m,l,m),m=d[5],e.add(c,f,m),e.add(m,h,m),m=d[6],e.add(c,y,m),e.add(m,h,m),m=d[7],e.add(c,y,m),e.add(m,l,m);for(var E=d.length,O=0;E>O;++O){var T=d[O];e.add(u,T,T);var _=o.cartesianToCartographic(T,W);a.project(_,T)}i=p.fromPoints(d,i),u=i.center;var v=u.x,b=u.y,w=u.z;return u.x=w,u.y=v,u.z=b,i},p.isOccluded=function(e,t){return r.typeOf.object("sphere",e),r.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)},p.equals=function(t,r){return t===r||a(t)&&a(r)&&e.equals(t.center,r.center)&&t.radius===r.radius},p.prototype.intersectPlane=function(e){return p.intersectPlane(this,e)},p.prototype.distanceSquaredTo=function(e){return p.distanceSquaredTo(this,e)},p.prototype.computePlaneDistances=function(e,t,r){return p.computePlaneDistances(this,e,t,r)},p.prototype.isOccluded=function(e){return p.isOccluded(this,e)},p.prototype.equals=function(e){return p.equals(this,e)},p.prototype.clone=function(e){return p.clone(this,e)},p}),define("Core/Cartesian2",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a,i){"use strict";function o(e,r){this.x=t(e,0),this.y=t(r,0)}o.fromElements=function(e,t,n){return r(n)?(n.x=e,n.y=t,n):new o(e,t)},o.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t):new o(e.x,e.y):void 0},o.fromCartesian3=o.clone,o.fromCartesian4=o.clone,o.packedLength=2,o.pack=function(r,n,a){return e.typeOf.object("value",r),e.defined("array",n),a=t(a,0),n[a++]=r.x,n[a]=r.y,n},o.unpack=function(n,a,i){return e.defined("array",n),a=t(a,0),r(i)||(i=new o),i.x=n[a++],i.y=n[a],i},o.packArray=function(t,n){e.defined("array",t);var a=t.length;r(n)?n.length=2*a:n=new Array(2*a);for(var i=0;a>i;++i)o.pack(t[i],n,2*i);return n},o.unpackArray=function(t,n){e.defined("array",t);var a=t.length;r(n)?n.length=a/2:n=new Array(a/2);for(var i=0;a>i;i+=2){var u=i/2;n[u]=o.unpack(t,i,n[u])}return n},o.fromArray=o.unpack,o.maximumComponent=function(t){return e.typeOf.object("cartesian",t),Math.max(t.x,t.y)},o.minimumComponent=function(t){return e.typeOf.object("cartesian",t),Math.min(t.x,t.y)},o.minimumByComponent=function(t,r,n){return e.typeOf.object("first",t),e.typeOf.object("second",r),e.typeOf.object("result",n),n.x=Math.min(t.x,r.x),n.y=Math.min(t.y,r.y),n},o.maximumByComponent=function(t,r,n){return e.typeOf.object("first",t),e.typeOf.object("second",r),e.typeOf.object("result",n),n.x=Math.max(t.x,r.x),n.y=Math.max(t.y,r.y),n},o.magnitudeSquared=function(t){return e.typeOf.object("cartesian",t),t.x*t.x+t.y*t.y},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var u=new o;o.distance=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.subtract(t,r,u),o.magnitude(u)},o.distanceSquared=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.subtract(t,r,u),o.magnitudeSquared(u)},o.normalize=function(t,r){e.typeOf.object("cartesian",t),e.typeOf.object("result",r);var a=o.magnitude(t);if(r.x=t.x/a,r.y=t.y/a,isNaN(r.x)||isNaN(r.y))throw new n("normalized result is not a number");return r},o.dot=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),t.x*r.x+t.y*r.y},o.multiplyComponents=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x*r.x,n.y=t.y*r.y,n},o.divideComponents=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x/r.x,n.y=t.y/r.y,n},o.add=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x+r.x,n.y=t.y+r.y,n},o.subtract=function(t,r,n){return e.typeOf.object("left",t),e.typeOf.object("right",r),e.typeOf.object("result",n),n.x=t.x-r.x,n.y=t.y-r.y,n},o.multiplyByScalar=function(t,r,n){return e.typeOf.object("cartesian",t),e.typeOf.number("scalar",r),e.typeOf.object("result",n),n.x=t.x*r,n.y=t.y*r,n},o.divideByScalar=function(t,r,n){return e.typeOf.object("cartesian",t),e.typeOf.number("scalar",r),e.typeOf.object("result",n),n.x=t.x/r,n.y=t.y/r,n},o.negate=function(t,r){return e.typeOf.object("cartesian",t),e.typeOf.object("result",r),r.x=-t.x,r.y=-t.y,r},o.abs=function(t,r){return e.typeOf.object("cartesian",t),e.typeOf.object("result",r),r.x=Math.abs(t.x),r.y=Math.abs(t.y),r};var s=new o;o.lerp=function(t,r,n,a){return e.typeOf.object("start",t),e.typeOf.object("end",r),e.typeOf.number("t",n),e.typeOf.object("result",a),o.multiplyByScalar(r,n,s),a=o.multiplyByScalar(t,1-n,a),o.add(s,a,a)};var c=new o,l=new o;o.angleBetween=function(t,r){return e.typeOf.object("left",t),e.typeOf.object("right",r),o.normalize(t,c),o.normalize(r,l),i.acosClamped(o.dot(c,l))};var f=new o;return o.mostOrthogonalAxis=function(t,r){e.typeOf.object("cartesian",t),e.typeOf.object("result",r);var n=o.normalize(t,f);return o.abs(n,n),r=n.x<=n.y?o.clone(o.UNIT_X,r):o.clone(o.UNIT_Y,r)},o.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y},o.equalsArray=function(e,t,r){return e.x===t[r]&&e.y===t[r+1]},o.equalsEpsilon=function(e,t,n,a){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,a)&&i.equalsEpsilon(e.y,t.y,n,a)},o.ZERO=a(new o(0,0)),o.UNIT_X=a(new o(1,0)),o.UNIT_Y=a(new o(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,r){return o.equalsEpsilon(this,e,t,r)},o.prototype.toString=function(){return"("+this.x+", "+this.y+")"},o}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,t){"use strict";var r,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},a={};return t(a,{element:{get:function(){return a.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return a.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return a.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return a.supportsFullscreen()?null!==a.element:void 0}}}),a.supportsFullscreen=function(){if(e(r))return r;r=!1;var t=document.body;if("function"==typeof t.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",r=!0;for(var a,i=["webkit","moz","o","ms","khtml"],o=0,u=i.length;u>o;++o){var s=i[o];a=s+"RequestFullscreen","function"==typeof t[a]?(n.requestFullscreen=a,r=!0):(a=s+"RequestFullScreen","function"==typeof t[a]&&(n.requestFullscreen=a,r=!0)),a=s+"ExitFullscreen","function"==typeof document[a]?n.exitFullscreen=a:(a=s+"CancelFullScreen","function"==typeof document[a]&&(n.exitFullscreen=a)),a=s+"FullscreenEnabled",void 0!==document[a]?n.fullscreenEnabled=a:(a=s+"FullScreenEnabled",void 0!==document[a]&&(n.fullscreenEnabled=a)),a=s+"FullscreenElement",void 0!==document[a]?n.fullscreenElement=a:(a=s+"FullScreenElement",void 0!==document[a]&&(n.fullscreenElement=a)),a=s+"fullscreenchange",void 0!==document["on"+a]&&("ms"===s&&(a="MSFullscreenChange"),n.fullscreenchange=a),a=s+"fullscreenerror",void 0!==document["on"+a]&&("ms"===s&&(a="MSFullscreenError"),n.fullscreenerror=a)}return r},a.requestFullscreen=function(e,t){a.supportsFullscreen()&&e[n.requestFullscreen]({vrDisplay:t})},a.exitFullscreen=function(){a.supportsFullscreen()&&document[n.exitFullscreen]()},a}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,t,r){"use strict";function n(e){for(var t=e.split("."),r=0,n=t.length;n>r;++r)t[r]=parseInt(t[r],10);return t}function a(){if(!t(b)&&(b=!1,!p())){var e=/ Chrome\/([\.0-9]+)/.exec(v.userAgent);null!==e&&(b=!0,w=n(e[1]))}return b}function i(){return a()&&w}function o(){if(!t(R)&&(R=!1,!a()&&!p()&&/ Safari\/[\.0-9]+/.test(v.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(v.userAgent);null!==e&&(R=!0,g=n(e[1]))}return R}function u(){return o()&&g}function s(){if(!t(A)){A=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(v.userAgent);null!==e&&(A=!0,N=n(e[1]),N.isNightly=!!e[2])}return A}function c(){return s()&&N}function l(){if(!t(S)){S=!1;var e;"Microsoft Internet Explorer"===v.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(v.userAgent),null!==e&&(S=!0,x=n(e[1]))):"Netscape"===v.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(v.userAgent),null!==e&&(S=!0,x=n(e[1])))}return S}function f(){return l()&&x}function p(){if(!t(I)){I=!1;var e=/ Edge\/([\.0-9]+)/.exec(v.userAgent);null!==e&&(I=!0,M=n(e[1]))}return I}function y(){return p()&&M}function h(){if(!t(C)){C=!1;var e=/Firefox\/([\.0-9]+)/.exec(v.userAgent);null!==e&&(C=!0,P=n(e[1]))}return C}function d(){return t(L)||(L=/Windows/i.test(v.appVersion)),L}function m(){return h()&&P}function E(){return t(U)||(U="undefined"!=typeof PointerEvent&&(!t(v.pointerEnabled)||v.pointerEnabled)),U}function O(){if(!t(D)){var e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");var r=e.style.imageRendering;D=t(r)&&""!==r,D&&(F=r)}return D}function T(){return O()?F:void 0}function _(){var e=window.navigator.userAgent.toLowerCase(),t="ipad"==e.match(/ipad/i),r="iphone os"==e.match(/iphone os/i),n="midp"==e.match(/midp/i),a="rv:1.2.3.4"==e.match(/rv:1.2.3.4/i),i="ucweb"==e.match(/ucweb/i),o="android"==e.match(/android/i),u="windows ce"==e.match(/windows ce/i),s="windows mobile"==e.match(/windows mobile/i);return t||r||n||a||i||o||u||s?!1:!0}var v;v="undefined"!=typeof navigator?navigator:{};var b,w,R,g,A,N,S,x,I,M,C,P,L,U,F,D,B={isChrome:a,chromeVersion:i,isSafari:o,safariVersion:u,isWebkit:s,webkitVersion:c,isInternetExplorer:l,internetExplorerVersion:f,isEdge:p,edgeVersion:y,isFirefox:h,firefoxVersion:m,isWindows:d,hardwareConcurrency:e(v.hardwareConcurrency,3),supportsPointerEvents:E,supportsImageRenderingPixelated:O,imageRenderingValue:T,isPCBroswer:_};return B.supportsFullscreen=function(){return r.supportsFullscreen()},B.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},B.supportsWebWorkers=function(){return"undefined"!=typeof Worker},B}),define("Core/WebGLConstants",["./freezeObject"],function(e){"use strict";var t={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,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};return e(t)}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./WebGLConstants"],function(e,t,r,n,a,i){"use strict";if(!n.supportsTypedArrays())return{};var o={BYTE:i.BYTE,UNSIGNED_BYTE:i.UNSIGNED_BYTE,SHORT:i.SHORT,UNSIGNED_SHORT:i.UNSIGNED_SHORT,INT:i.INT,UNSIGNED_INT:i.UNSIGNED_INT,FLOAT:i.FLOAT,DOUBLE:i.DOUBLE};return o.getSizeInBytes=function(e){if(!t(e))throw new r("value is required.");switch(e){case o.BYTE:return Int8Array.BYTES_PER_ELEMENT;case o.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case o.SHORT:return Int16Array.BYTES_PER_ELEMENT;case o.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case o.INT:return Int32Array.BYTES_PER_ELEMENT;case o.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case o.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case o.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new r("componentDatatype is not a valid value.")}},o.fromTypedArray=function(e){return e instanceof Int8Array?o.BYTE:e instanceof Uint8Array?o.UNSIGNED_BYTE:e instanceof Int16Array?o.SHORT:e instanceof Uint16Array?o.UNSIGNED_SHORT:e instanceof Int32Array?o.INT:e instanceof Uint32Array?o.UNSIGNED_INT:e instanceof Float32Array?o.FLOAT:e instanceof Float64Array?o.DOUBLE:void 0},o.validate=function(e){return t(e)&&(e===o.BYTE||e===o.UNSIGNED_BYTE||e===o.SHORT||e===o.UNSIGNED_SHORT||e===o.INT||e===o.UNSIGNED_INT||e===o.FLOAT||e===o.DOUBLE)},o.createTypedArray=function(e,n){if(!t(e))throw new r("componentDatatype is required.");if(!t(n))throw new r("valuesOrLength is required.");switch(e){case o.BYTE:return new Int8Array(n);case o.UNSIGNED_BYTE:return new Uint8Array(n);case o.SHORT:return new Int16Array(n);case o.UNSIGNED_SHORT:return new Uint16Array(n);case o.INT:return new Int32Array(n);case o.UNSIGNED_INT:return new Uint32Array(n);case o.FLOAT:return new Float32Array(n);case o.DOUBLE:return new Float64Array(n);default:throw new r("componentDatatype is not a valid value.")}},o.createArrayBufferView=function(n,a,i,u){if(!t(n))throw new r("componentDatatype is required.");if(!t(a))throw new r("buffer is required.");switch(i=e(i,0),u=e(u,(a.byteLength-i)/o.getSizeInBytes(n)),n){case o.BYTE:return new Int8Array(a,i,u);case o.UNSIGNED_BYTE:return new Uint8Array(a,i,u);case o.SHORT:return new Int16Array(a,i,u);case o.UNSIGNED_SHORT:return new Uint16Array(a,i,u);case o.INT:return new Int32Array(a,i,u);case o.UNSIGNED_INT:return new Uint32Array(a,i,u);case o.FLOAT:return new Float32Array(a,i,u);case o.DOUBLE:return new Float64Array(a,i,u);default:throw new r("componentDatatype is not a valid value.")}},o.fromName=function(e){switch(e){case"BYTE":return o.BYTE;case"UNSIGNED_BYTE":return o.UNSIGNED_BYTE;case"SHORT":return o.SHORT;case"UNSIGNED_SHORT":return o.UNSIGNED_SHORT;case"INT":return o.INT;case"UNSIGNED_INT":return o.UNSIGNED_INT;case"FLOAT":return o.FLOAT;case"DOUBLE":return o.DOUBLE;default:throw new r("name is not a valid value.")}},a(o)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject","./WebGLConstants"],function(e,t){"use strict";var r={POINTS:t.POINTS,LINES:t.LINES,LINE_LOOP:t.LINE_LOOP,LINE_STRIP:t.LINE_STRIP,TRIANGLES:t.TRIANGLES,TRIANGLE_STRIP:t.TRIANGLE_STRIP,TRIANGLE_FAN:t.TRIANGLE_FAN,validate:function(e){return e===r.POINTS||e===r.LINES||e===r.LINE_LOOP||e===r.LINE_STRIP||e===r.TRIANGLES||e===r.TRIANGLE_STRIP||e===r.TRIANGLE_FAN}};return e(r)}),define("Core/Geometry",["./Check","./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,a,i){"use strict";function o(r){r=t(r,t.EMPTY_OBJECT),e.typeOf.object("options.attributes",r.attributes),this.attributes=r.attributes,this.indices=r.indices,this.primitiveType=t(r.primitiveType,i.TRIANGLES),this.boundingSphere=r.boundingSphere,this.geometryType=t(r.geometryType,a.NONE),this.boundingSphereCV=r.boundingSphereCV}return o.computeNumberOfVertices=function(t){e.typeOf.object("geometry",t);var a=-1;for(var i in t.attributes)if(t.attributes.hasOwnProperty(i)&&r(t.attributes[i])&&r(t.attributes[i].values)){var o=t.attributes[i],u=o.values.length/o.componentsPerAttribute;if(a!==u&&-1!==a)throw new n("All attribute lists must have the same number of attributes.");a=u}return a},o}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";function n(n){if(n=e(n,e.EMPTY_OBJECT),!t(n.componentDatatype))throw new r("options.componentDatatype is required.");if(!t(n.componentsPerAttribute))throw new r("options.componentsPerAttribute is required.");if(n.componentsPerAttribute<1||n.componentsPerAttribute>4)throw new r("options.componentsPerAttribute must be between 1 and 4.");if(!t(n.values))throw new r("options.values is required.");this.componentDatatype=n.componentDatatype,this.componentsPerAttribute=n.componentsPerAttribute,this.normalize=e(n.normalize,!1),this.values=n.values}return n}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";function t(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.bitangent=t.bitangent,this.tangent=t.tangent,this.color=t.color}return t}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,t,r,n){"use strict";function a(a){if(a=e(a,e.EMPTY_OBJECT),!t(a.geometry))throw new r("options.geometry is required.");this.geometry=a.geometry,this.modelMatrix=n.clone(e(a.modelMatrix,n.IDENTITY)),this.id=a.id,this.pickPrimitive=a.pickPrimitive,this.attributes=e(a.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}return a}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./Check","./DeveloperError","./Math"],function(e,t,r,n,a){"use strict";var i={};i.octEncodeInRange=function(e,i,o){r.defined("vector",e),r.defined("result",o);var u=t.magnitudeSquared(e);if(Math.abs(u-1)>a.EPSILON6)throw new n("vector must be normalized.");if(o.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),o.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){var s=o.x,c=o.y;o.x=(1-Math.abs(c))*a.signNotZero(s),o.y=(1-Math.abs(s))*a.signNotZero(c)}return o.x=a.toSNorm(o.x,i),o.y=a.toSNorm(o.y,i),o},i.octEncode=function(e,t){return i.octEncodeInRange(e,255,t)},i.octDecodeInRange=function(e,i,o,u){if(r.defined("result",u),0>e||e>o||0>i||i>o)throw new n("x and y must be a signed normalized integer between 0 and "+o);if(u.x=a.fromSNorm(e,o),u.y=a.fromSNorm(i,o),u.z=1-(Math.abs(u.x)+Math.abs(u.y)),u.z<0){var s=u.x;u.x=(1-Math.abs(u.y))*a.signNotZero(s),u.y=(1-Math.abs(s))*a.signNotZero(u.y)}return t.normalize(u,u)},i.octShortToFloat=function(e){return a.clamp(3051850947599719e-20*e,-1,1)},i.octShortDecode=function(e,n,o){if(r.defined("result",o),o.x=i.octShortToFloat(e),o.y=i.octShortToFloat(n),o.z=1-(Math.abs(o.x)+Math.abs(o.y)),o.z<0){var u=o.x;o.x=(1-Math.abs(o.y))*a.signNotZero(u),o.y=(1-Math.abs(u))*a.signNotZero(o.y)}return t.normalize(o,o)},i.octDecode=function(e,t,r){return i.octDecodeInRange(e,t,255,r)},i.octPackFloat=function(e){return r.defined("encoded",e),256*e.x+e.y};var o=new e;return i.octEncodeFloat=function(e){return i.octEncode(e,o),i.octPackFloat(o)},i.octDecodeFloat=function(e,t){r.defined("value",e);var n=e/256,a=Math.floor(n),o=256*(n-a);return i.octDecode(a,o,t)},i.octPack=function(e,t,n,a){r.defined("v1",e),r.defined("v2",t),r.defined("v3",n),r.defined("result",a);var u=i.octEncodeFloat(e),s=i.octEncodeFloat(t),c=i.octEncode(n,o);return a.x=65536*c.x+u,a.y=65536*c.y+s,a},i.octUnpack=function(e,t,n,a){r.defined("packed",e),r.defined("v1",t),r.defined("v2",n),r.defined("v3",a);var o=e.x/65536,u=Math.floor(o),s=65536*(o-u);o=e.y/65536;var c=Math.floor(o),l=65536*(o-c);i.octDecodeFloat(s,t),i.octDecodeFloat(l,n),i.octDecode(u,c,a)},i.compressTextureCoordinates=function(e){r.defined("textureCoordinates",e);var t=4095*e.x|0,n=4095*e.y|0;return 4096*t+n},i.decompressTextureCoordinates=function(e,t){r.defined("compressed",e),r.defined("result",t);var n=e/4096,a=Math.floor(n);return t.x=a/4095,t.y=(e-4096*a)/4095,t},i}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./Check","./defined"],function(e,t,r,n){"use strict";function a(a,s,c,l,f){r.defined("point",a),r.defined("p0",s),r.defined("p1",c),r.defined("p2",l),n(f)||(f=new t);var p,y,h,d,m,E,O,T;n(s.z)?(p=t.subtract(c,s,i),y=t.subtract(l,s,o),h=t.subtract(a,s,u),d=t.dot(p,p),m=t.dot(p,y),E=t.dot(p,h),O=t.dot(y,y),T=t.dot(y,h)):(p=e.subtract(c,s,i),y=e.subtract(l,s,o),h=e.subtract(a,s,u),d=e.dot(p,p),m=e.dot(p,y),E=e.dot(p,h),O=e.dot(y,y),T=e.dot(y,h));var _=1/(d*O-m*m);return f.y=(O*E-m*T)*_,f.z=(d*T-m*E)*_,f.x=1-f.y-f.z,f}var i=new t,o=new t,u=new t;return a}),define("Core/EncodedCartesian3",["./Cartesian3","./Check","./defined"],function(e,t,r){"use strict";function n(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)}n.encode=function(e,n){t.typeOf.number("value",e),r(n)||(n={high:0,low:0});var a;return e>=0?(a=65536*Math.floor(e/65536),n.high=a,n.low=e-a):(a=65536*Math.floor(-e/65536),n.high=-a,n.low=e+a),n};var a={high:0,low:0};n.fromCartesian=function(e,i){t.typeOf.object("cartesian",e),r(i)||(i=new n);var o=i.high,u=i.low;return n.encode(e.x,a),o.x=a.high,u.x=a.low,n.encode(e.y,a),o.y=a.high,u.y=a.low,n.encode(e.z,a),o.z=a.high,u.z=a.low,i};var i=new n;return n.writeElements=function(e,r,a){t.defined("cartesianArray",r),t.typeOf.number("index",a),t.typeOf.number.greaterThanOrEquals("index",a,0),n.fromCartesian(e,i);var o=i.high,u=i.low;r[a]=o.x,r[a+1]=o.y,r[a+2]=o.z,r[a+3]=u.x,r[a+4]=u.y,r[a+5]=u.z},n}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math","./WebGLConstants"],function(e,t,r,n,a){"use strict";var i={UNSIGNED_BYTE:a.UNSIGNED_BYTE,UNSIGNED_SHORT:a.UNSIGNED_SHORT,UNSIGNED_INT:a.UNSIGNED_INT};return i.getSizeInBytes=function(e){switch(e){case i.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case i.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case i.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new t("indexDatatype is required and must be a valid IndexDatatype constant.")},i.validate=function(t){return e(t)&&(t===i.UNSIGNED_BYTE||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)},i.createTypedArray=function(r,a){if(!e(r))throw new t("numberOfVertices is required.");return r>=n.SIXTY_FOUR_KILOBYTES?new Uint32Array(a):new Uint16Array(a)},i.createTypedArrayFromArrayBuffer=function(r,a,i,o){if(!e(r))throw new t("numberOfVertices is required.");if(!e(a))throw new t("sourceArray is required.");if(!e(i))throw new t("byteOffset is required.");return r>=n.SIXTY_FOUR_KILOBYTES?new Uint32Array(a,i,o):new Uint16Array(a,i,o)},r(i)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,t){"use strict";function r(e,r,n){var a=e+r;return t.sign(e)!==t.sign(r)&&Math.abs(a/Math.max(Math.abs(e),Math.abs(r)))u&&u/ss&&s/uo)return[];var c=Math.sqrt(o);return[-c,c]}if(0===i)return o=-a/n,0>o?[o,0]:[0,o];var l=a*a,f=4*n*i,p=r(l,-f,t.EPSILON14);if(0>p)return[];var y=-.5*r(a,t.sign(a)*Math.sqrt(p),t.EPSILON14);return a>0?[y/n,i/y]:[i/y,y/n]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,t){"use strict";function r(e,t,r,n){var a,i,o=e,u=t/3,s=r/3,c=n,l=o*s,f=u*c,p=u*u,y=s*s,h=o*s-p,d=o*c-u*s,m=u*c-y,E=4*h*m-d*d;if(0>E){var O,T,_;p*f>=l*y?(O=o,T=h,_=-2*u*h+o*d):(O=c,T=m,_=-c*d+2*s*m);var v=0>_?-1:1,b=-v*Math.abs(O)*Math.sqrt(-E);i=-_+b;var w=i/2,R=0>w?-Math.pow(-w,1/3):Math.pow(w,1/3),g=i===b?-R:-T/R;return a=0>=T?R+g:-_/(R*R+g*g+T),p*f>=l*y?[(a-u)/o]:[-c/(a+s)]}var A=h,N=-2*u*h+o*d,S=m,x=-c*d+2*s*m,I=Math.sqrt(E),M=Math.sqrt(3)/2,C=Math.abs(Math.atan2(o*I,-N)/3);a=2*Math.sqrt(-A);var P=Math.cos(C);i=a*P;var L=a*(-P/2-M*Math.sin(C)),U=i+L>2*u?i-u:L-u,F=o,D=U/F;C=Math.abs(Math.atan2(c*I,-x)/3),a=2*Math.sqrt(-S),P=Math.cos(C),i=a*P,L=a*(-P/2-M*Math.sin(C));var B=-c,z=2*s>i+L?i+s:L+s,j=B/z,q=F*z,G=-U*z-F*B,V=U*B,X=(s*G-u*V)/(-u*G+s*q);return X>=D?j>=D?j>=X?[D,X,j]:[D,j,X]:[j,D,X]:j>=D?[X,D,j]:j>=X?[X,j,D]:[j,X,D]}var n={};return n.computeDiscriminant=function(t,r,n,a){if("number"!=typeof t)throw new e("a is a required number.");if("number"!=typeof r)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");if("number"!=typeof a)throw new e("d is a required number.");var i=t*t,o=r*r,u=n*n,s=a*a,c=18*t*r*n*a+o*u-27*i*s-4*(t*u*n+o*r*a);return c},n.computeRealRoots=function(n,a,i,o){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof a)throw new e("b is a required number.");if("number"!=typeof i)throw new e("c is a required number.");if("number"!=typeof o)throw new e("d is a required number.");var u,s;if(0===n)return t.computeRealRoots(a,i,o);if(0===a){if(0===i){if(0===o)return[0,0,0];s=-o/n;var c=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3);return[c,c,c]}return 0===o?(u=t.computeRealRoots(n,0,i),0===u.Length?[0]:[u[0],0,u[1]]):r(n,0,i,o)}return 0===i?0===o?(s=-a/n,0>s?[s,0,0]:[0,0,s]):r(n,a,0,o):0===o?(u=t.computeRealRoots(n,a,i),0===u.length?[0]:u[1]<=0?[u[0],u[1],0]:u[0]>=0?[0,u[0],u[1]]:[u[0],0,u[1]]):r(n,a,i,o)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,t,r,n){"use strict";function a(t,a,i,o){var u=t*t,s=a-3*u/8,c=i-a*t/2+u*t/8,l=o-i*t/4+a*u/16-3*u*u/256,f=e.computeRealRoots(1,2*s,s*s-4*l,-c*c);if(f.length>0){var p=-t/4,y=f[f.length-1];if(Math.abs(y)=0&&E>=0){var O=Math.sqrt(m),T=Math.sqrt(E);return[p-T,p-O,p+O,p+T]}if(m>=0&&0>E)return d=Math.sqrt(m),[p-d,p+d];if(0>m&&E>=0)return d=Math.sqrt(E),[p-d,p+d]}return[]}if(y>0){var _=Math.sqrt(y),v=(s+y-c/_)/2,b=(s+y+c/_)/2,w=n.computeRealRoots(1,_,v),R=n.computeRealRoots(1,-_,b);return 0!==w.length?(w[0]+=p,w[1]+=p,0!==R.length?(R[0]+=p,R[1]+=p,w[1]<=R[0]?[w[0],w[1],R[0],R[1]]:R[1]<=w[0]?[R[0],R[1],w[0],w[1]]:w[0]>=R[0]&&w[1]<=R[1]?[R[0],w[0],w[1],R[1]]:R[0]>=w[0]&&R[1]<=w[1]?[w[0],R[0],R[1],w[1]]:w[0]>R[0]&&w[0]0){var h,d,m=y[0],E=a-m,O=E*E,T=t/2,_=E/2,v=O-4*o,b=O+4*Math.abs(o),w=c-4*m,R=c+4*Math.abs(m);if(0>m||w*b>v*R){var g=Math.sqrt(w);h=g/2,d=0===g?0:(t*_-i)/g}else{var A=Math.sqrt(v);h=0===A?0:(t*_-i)/A,d=A/2}var N,S;0===T&&0===h?(N=0,S=0):r.sign(T)===r.sign(h)?(N=T+h,S=m/N):(S=T-h,N=m/S);var x,I;0===_&&0===d?(x=0,I=0):r.sign(_)===r.sign(d)?(x=_+d,I=o/x):(I=_-d,x=o/I);var M=n.computeRealRoots(1,N,x),C=n.computeRealRoots(1,S,I);if(0!==M.length)return 0!==C.length?M[1]<=C[0]?[M[0],M[1],C[0],C[1]]:C[1]<=M[0]?[C[0],C[1],M[0],M[1]]:M[0]>=C[0]&&M[1]<=C[1]?[C[0],M[0],M[1],C[1]]:C[0]>=M[0]&&C[1]<=M[1]?[M[0],C[0],C[1],M[1]]:M[0]>C[0]&&M[0]l?1:0;switch(h+=0>f?h+1:h,h+=0>p?h+1:h,h+=0>y?h+1:h){case 0:return a(l,f,p,y);case 1:return i(l,f,p,y);case 2:return i(l,f,p,y);case 3:return a(l,f,p,y);case 4:return a(l,f,p,y);case 5:return i(l,f,p,y);case 6:return a(l,f,p,y);case 7:return a(l,f,p,y);case 8:return i(l,f,p,y);case 9:return a(l,f,p,y);case 10:return a(l,f,p,y);case 11:return i(l,f,p,y);case 12:return a(l,f,p,y);case 13:return a(l,f,p,y);case 14:return a(l,f,p,y);case 15:return a(l,f,p,y);default:return}},o}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,t,r,n){"use strict";function a(r,n){n=e.clone(t(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(t(r,e.ZERO)),this.direction=n}return a.getPoint=function(t,a,i){if(!r(t))throw new n("ray is requred");if("number"!=typeof a)throw new n("t is a required number");return r(i)||(i=new e),i=e.multiplyByScalar(t.direction,a,i),e.add(t.origin,i,i)},a}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Interval","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,t,r,n,a,i,o,u,s,c,l){"use strict";function f(e,t,r,n){var a=t*t-4*e*r;if(!(0>a)){if(a>0){var i=1/(2*e),o=Math.sqrt(a),u=(-t+o)*i,s=(-t-o)*i;return s>u?(n.root0=u,n.root1=s):(n.root0=s,n.root1=u),n}var c=-t/(2*e);if(0!==c)return n.root0=n.root1=c,n}}function p(t,r,a){n(a)||(a=new i);var o=t.origin,u=t.direction,s=r.center,c=r.radius*r.radius,l=e.subtract(o,s,O),p=e.dot(u,u),y=2*e.dot(u,l),h=e.magnitudeSquared(l)-c,d=f(p,y,h,b);return n(d)?(a.start=d.root0,a.stop=d.root1,a):void 0}function y(e,t,r){var n=e+t;return o.sign(e)!==o.sign(t)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(t)))L;++L){var U,F=l[L],D=F*F,B=Math.max(1-D,0),z=Math.sqrt(B);U=o.sign(h)===o.sign(m)?y(h*D+m,d*F,o.EPSILON12):o.sign(m)===o.sign(d*F)?y(h*D,d*F+m,o.EPSILON12):y(h*D+d*F,m,o.EPSILON12);var j=y(E*F,O,o.EPSILON15),q=U*j;0>q?T.push(new e(a,i*F,i*z)):q>0?T.push(new e(a,i*F,i*-z)):0!==z?(T.push(new e(a,i*F,i*-z)),T.push(new e(a,i*F,i*z)),++L):T.push(new e(a,i*F,i*z))}return T}var d={};d.rayPlane=function(t,r,i){if(!n(t))throw new a("ray is required.");if(!n(r))throw new a("plane is required.");n(i)||(i=new e);var u=t.origin,s=t.direction,c=r.normal,l=e.dot(c,s);if(!(Math.abs(l)f))return i=e.multiplyByScalar(s,f,i),e.add(u,i,i)}};var m=new e,E=new e,O=new e,T=new e,_=new e;d.rayTriangleParametric=function(t,i,u,s,c){if(!n(t))throw new a("ray is required.");if(!n(i))throw new a("p0 is required.");if(!n(u))throw new a("p1 is required.");if(!n(s))throw new a("p2 is required.");c=r(c,!1);var l,f,p,y,h,d=t.origin,v=t.direction,b=e.subtract(u,i,m),w=e.subtract(s,i,E),R=e.cross(v,w,O),g=e.dot(b,R);if(c){if(gp||p>g)return;if(f=e.cross(l,b,_),y=e.dot(v,f),0>y||p+y>g)return;h=e.dot(w,f)/g}else{if(Math.abs(g)p||p>1)return;if(f=e.cross(l,b,_),y=e.dot(v,f)*A,0>y||p+y>1)return;h=e.dot(w,f)*A}return h},d.rayTriangle=function(t,r,a,i,o,u){var s=d.rayTriangleParametric(t,r,a,i,o);if(n(s)&&!(0>s))return n(u)||(u=new e),e.multiplyByScalar(t.direction,s,u),e.add(t.origin,u,u)};var v=new l;d.lineSegmentTriangle=function(t,r,i,o,u,s,c){if(!n(t))throw new a("v0 is required.");if(!n(r))throw new a("v1 is required.");if(!n(i))throw new a("p0 is required.");if(!n(o))throw new a("p1 is required.");if(!n(u))throw new a("p2 is required.");var l=v;e.clone(t,l.origin),e.subtract(r,t,l.direction),e.normalize(l.direction,l.direction);var f=d.rayTriangleParametric(l,i,o,u,s);return!n(f)||0>f||f>e.distance(t,r)?void 0:(n(c)||(c=new e),e.multiplyByScalar(l.direction,f,c),e.add(l.origin,c,c))};var b={root0:0,root1:0};d.raySphere=function(e,t,r){if(!n(e))throw new a("ray is required.");if(!n(t))throw new a("sphere is required.");return r=p(e,t,r),!n(r)||r.stop<0?void 0:(r.start=Math.max(r.start,0),r)};var w=new l;d.lineSegmentSphere=function(t,r,i,o){if(!n(t))throw new a("p0 is required.");if(!n(r))throw new a("p1 is required.");if(!n(i))throw new a("sphere is required.");var u=w;e.clone(t,u.origin);var s=e.subtract(r,t,u.direction),c=e.magnitude(s);return e.normalize(s,s),o=p(u,i,o),!n(o)||o.stop<0||o.start>c?void 0:(o.start=Math.max(o.start,0),o.stop=Math.min(o.stop,c),o)};var R=new e,g=new e;d.rayEllipsoid=function(t,r){if(!n(t))throw new a("ray is required.");if(!n(r))throw new a("ellipsoid is required.");var o,u,s,c,l,f=r.oneOverRadii,p=e.multiplyComponents(f,t.origin,R),y=e.multiplyComponents(f,t.direction,g),h=e.magnitudeSquared(p),d=e.dot(p,y);if(h>1){if(d>=0)return;var m=d*d;if(o=h-1,u=e.magnitudeSquared(y),s=u*o,s>m)return;if(m>s){c=d*d-s,l=-d+Math.sqrt(c);var E=l/u,O=o/l;return O>E?new i(E,O):{start:O,stop:E}}var T=Math.sqrt(o/u);return new i(T,T)}return 1>h?(o=h-1,u=e.magnitudeSquared(y),s=u*o,c=d*d-s,l=-d+Math.sqrt(c),new i(0,l/u)):0>d?(u=e.magnitudeSquared(y),new i(0,-d/u)):void 0};var A=new e,N=new e,S=new e,x=new e,I=new e,M=new u,C=new u,P=new u,L=new u,U=new u,F=new u,D=new u,B=new e,z=new e,j=new t;d.grazingAltitudeLocation=function(t,r){if(!n(t))throw new a("ray is required.");if(!n(r))throw new a("ellipsoid is required.");var i=t.origin,s=t.direction;if(!e.equals(i,e.ZERO)){var c=r.geodeticSurfaceNormal(i,A);if(e.dot(s,c)>=0)return i}var l=n(this.rayEllipsoid(t,r)),f=r.transformPositionToScaledSpace(s,A),p=e.normalize(f,f),y=e.mostOrthogonalAxis(f,x),d=e.normalize(e.cross(y,p,N),N),m=e.normalize(e.cross(p,d,S),S),E=M;E[0]=p.x,E[1]=p.y,E[2]=p.z,E[3]=d.x,E[4]=d.y,E[5]=d.z,E[6]=m.x,E[7]=m.y,E[8]=m.z;var O=u.transpose(E,C),T=u.fromScale(r.radii,P),_=u.fromScale(r.oneOverRadii,L),v=U;v[0]=0,v[1]=-s.z,v[2]=s.y,v[3]=s.z,v[4]=0,v[5]=-s.x,v[6]=-s.y,v[7]=s.x,v[8]=0;var b,w,R=u.multiply(u.multiply(O,_,F),v,F),g=u.multiply(u.multiply(R,T,D),E,D),q=u.multiplyByVector(R,i,I),G=h(g,e.negate(q,A),0,0,1),V=G.length;if(V>0){for(var X=e.clone(e.ZERO,z),W=Number.NEGATIVE_INFINITY,H=0;V>H;++H){b=u.multiplyByVector(T,u.multiplyByVector(E,G[H],B),B);var Y=e.normalize(e.subtract(b,i,x),x),k=e.dot(Y,s);k>W&&(W=k,X=e.clone(b,X))}var Z=r.cartesianToCartographic(X,j);return W=o.clamp(W,0,1),w=e.magnitude(e.subtract(X,i,x))*Math.sqrt(1-W*W),w=l?-w:w,Z.height=w,r.cartographicToCartesian(Z,new e)}};var q=new e;return d.lineSegmentPlane=function(t,r,i,u){if(!n(t))throw new a("endPoint0 is required.");if(!n(r))throw new a("endPoint1 is required.");if(!n(i))throw new a("plane is required.");n(u)||(u=new e);var s=e.subtract(r,t,q),c=i.normal,l=e.dot(c,s);if(!(Math.abs(l)p||p>1))return e.multiplyByScalar(s,p,u),e.add(t,u,u),u}},d.trianglePlaneIntersection=function(t,r,i,o){if(!(n(t)&&n(r)&&n(i)&&n(o)))throw new a("p0, p1, p2, and plane are required.");var u=o.normal,s=o.distance,c=e.dot(u,t)+s<0,l=e.dot(u,r)+s<0,f=e.dot(u,i)+s<0,p=0;p+=c?1:0,p+=l?1:0,p+=f?1:0;var y,h;if((1===p||2===p)&&(y=new e,h=new e),1===p){if(c)return d.lineSegmentPlane(t,r,o,y),d.lineSegmentPlane(t,i,o,h),{positions:[t,r,i,y,h],indices:[0,3,4,1,2,4,1,4,3]};if(l)return d.lineSegmentPlane(r,i,o,y),d.lineSegmentPlane(r,t,o,h),{positions:[t,r,i,y,h],indices:[1,3,4,2,0,4,2,4,3]};if(f)return d.lineSegmentPlane(i,t,o,y),d.lineSegmentPlane(i,r,o,h),{positions:[t,r,i,y,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===p){if(!c)return d.lineSegmentPlane(r,t,o,y),d.lineSegmentPlane(i,t,o,h),{positions:[t,r,i,y,h],indices:[1,2,4,1,4,3,0,3,4]};if(!l)return d.lineSegmentPlane(i,r,o,y),d.lineSegmentPlane(t,r,o,h),{positions:[t,r,i,y,h],indices:[2,0,4,2,4,3,1,3,4]};if(!f)return d.lineSegmentPlane(t,i,o,y),d.lineSegmentPlane(r,i,o,h),{positions:[t,r,i,y,h],indices:[0,1,4,0,4,3,2,3,4]}}},d}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,a){"use strict";function i(n,i){if(!t(n))throw new r("normal is required.");if(!a.equalsEpsilon(e.magnitude(n),1,a.EPSILON6))throw new r("normal must be normalized.");if(!t(i))throw new r("distance is required.");this.normal=e.clone(n),this.distance=i}i.fromPointNormal=function(n,o,u){if(!t(n))throw new r("point is required.");if(!t(o))throw new r("normal is required.");if(!a.equalsEpsilon(e.magnitude(o),1,a.EPSILON6))throw new r("normal must be normalized.");var s=-e.dot(o,n);return t(u)?(e.clone(o,u.normal),u.distance=s,u):new i(o,s)};var o=new e;return i.fromCartesian4=function(n,u){if(!t(n))throw new r("coefficients is required.");var s=e.fromCartesian4(n,o),c=n.w;if(!a.equalsEpsilon(e.magnitude(s),1,a.EPSILON6))throw new r("normal must be normalized.");return t(u)?(e.clone(s,u.normal),u.distance=c,u):new i(s,c)},i.getPointDistance=function(n,a){if(!t(n))throw new r("plane is required.");if(!t(a))throw new r("point is required.");return e.dot(n.normal,a)+n.distance},i.ORIGIN_XY_PLANE=n(new i(e.UNIT_Z,0)),i.ORIGIN_YZ_PLANE=n(new i(e.UNIT_X,0)),i.ORIGIN_ZX_PLANE=n(new i(e.UNIT_Y,0)),i}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";var n={};return n.calculateACMR=function(n){n=e(n,e.EMPTY_OBJECT);var a=n.indices,i=n.maximumIndex,o=e(n.cacheSize,24);if(!t(a))throw new r("indices is required.");var u=a.length;if(3>u||u%3!==0)throw new r("indices length must be a multiple of three.");if(0>=i)throw new r("maximumIndex must be greater than zero.");if(3>o)throw new r("cacheSize must be greater than two.");if(!t(i)){i=0;for(var s=0,c=a[s];u>s;)c>i&&(i=c),++s,c=a[s]}for(var l=[],f=0;i+1>f;f++)l[f]=0;for(var p=o+1,y=0;u>y;++y)p-l[a[y]]>o&&(l[a[y]]=p,++p);return(p-o+1)/(u/3)},n.tipsify=function(n){function a(e,t,r,n){for(;t.length>=1;){var a=t[t.length-1];if(t.splice(t.length-1,1),e[a].numLiveTriangles>0)return a}for(;n>o;){if(e[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function i(e,t,r,n,i,o,u){for(var s,c=-1,l=-1,f=0;fl||-1===l)&&(l=s,c=p)),++f}return-1===c?a(n,o,e,u):c}n=e(n,e.EMPTY_OBJECT);var o,u=n.indices,s=n.maximumIndex,c=e(n.cacheSize,24);if(!t(u))throw new r("indices is required.");var l=u.length;if(3>l||l%3!==0)throw new r("indices length must be a multiple of three.");if(0>=s)throw new r("maximumIndex must be greater than zero.");if(3>c)throw new r("cacheSize must be greater than two.");var f=0,p=0,y=u[p],h=l;if(t(s))f=s+1;else{for(;h>p;)y>f&&(f=y),++p,y=u[p];if(-1===f)return 0;++f}var d,m=[];for(d=0;f>d;d++)m[d]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};p=0;for(var E=0;h>p;)m[u[p]].vertexTriangles.push(E),++m[u[p]].numLiveTriangles,m[u[p+1]].vertexTriangles.push(E),++m[u[p+1]].numLiveTriangles,m[u[p+2]].vertexTriangles.push(E),++m[u[p+2]].numLiveTriangles,++E,p+=3;var O=0,T=c+1;o=1;var _,v,b=[],w=[],R=0,g=[],A=l/3,N=[];for(d=0;A>d;d++)N[d]=!1;for(var S,x;-1!==O;){b=[],v=m[O],x=v.vertexTriangles.length;for(var I=0;x>I;++I)if(E=v.vertexTriangles[I],!N[E]){N[E]=!0,p=E+E+E;for(var M=0;3>M;++M)S=u[p],b.push(S),w.push(S),g[R]=S,++R,_=m[S],--_.numLiveTriangles,T-_.timeStamp>c&&(_.timeStamp=T,++T),++p}O=i(u,c,b,m,T,w,f)}return g},n}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,t,r,n,a,i,o,u,s,c,l,f,p,y,h,d,m,E,O,T,_,v,b,w,R){"use strict"; function g(e,t,r,n,a){e[t++]=r,e[t++]=n,e[t++]=n,e[t++]=a,e[t++]=a,e[t]=r}function A(e){for(var t=e.length,r=t/3*6,n=m.createTypedArray(t,r),a=0,i=0;t>i;i+=3,a+=6)g(n,a,e[i],e[i+1],e[i+2]);return n}function N(e){var t=e.length;if(t>=3){var r=6*(t-2),n=m.createTypedArray(t,r);g(n,0,e[0],e[1],e[2]);for(var a=6,i=3;t>i;++i,a+=6)g(n,a,e[i-1],e[i],e[i-2]);return n}return new Uint16Array}function S(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),n=m.createTypedArray(t,r),a=e[0],i=0,o=1;t>o;++o,i+=6)g(n,i,a,e[o],e[o+1]);return n}return new Uint16Array}function x(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new h({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function I(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var a=t[n],i=0;ii;i+=3)a.unpack(r,i,ie),v.multiplyByPoint(e,ie,ie),a.pack(ie,r,i)}function C(e,t){if(c(t))for(var r=t.values,n=r.length,i=0;n>i;i+=3)a.unpack(r,i,ie),_.multiplyByVector(e,ie,ie),ie=a.normalize(ie,ie),a.pack(ie,r,i)}function P(e,t){var r,n=e.length,a={},i=e[0][t].attributes;for(r in i)if(i.hasOwnProperty(r)&&c(i[r])&&c(i[r].values)){for(var o=i[r],s=o.values.length,l=!0,f=1;n>f;++f){var p=e[f][t].attributes[r];if(!c(p)||o.componentDatatype!==p.componentDatatype||o.componentsPerAttribute!==p.componentsPerAttribute||o.normalize!==p.normalize){l=!1;break}s+=p.values.length}l&&(a[r]=new h({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return a}function L(e,t){var n,i,o,u,s=e.length,f=e[0].modelMatrix,p=c(e[0][t].indices),h=e[0][t].primitiveType;for(i=1;s>i;++i){if(!v.equals(e[i].modelMatrix,f))throw new l("All instances must have the same modelMatrix.");if(c(e[i][t].indices)!==p)throw new l("All instance geometries must have an indices or not have one.");if(e[i][t].primitiveType!==h)throw new l("All instance geometries must have the same primitiveType.")}var d,E,O,T=P(e,t);for(n in T)if(T.hasOwnProperty(n))for(d=T[n].values,u=0,i=0;s>i;++i)for(E=e[i][t].attributes[n].values,O=E.length,o=0;O>o;++o)d[u++]=E[o];var _;if(p){var b=0;for(i=0;s>i;++i)b+=e[i][t].indices.length;var R=y.computeNumberOfVertices(new y({attributes:T,primitiveType:w.POINTS})),g=m.createTypedArray(R,b),A=0,N=0;for(i=0;s>i;++i){var S=e[i][t].indices,x=S.length;for(u=0;x>u;++u)g[A++]=N+S[u];N+=y.computeNumberOfVertices(e[i][t])}_=g}var I,M=new a,C=0;for(i=0;s>i;++i){if(I=e[i][t].boundingSphere,!c(I)){M=void 0;break}a.add(I.center,M,M)}if(c(M))for(a.divideByScalar(M,s,M),i=0;s>i;++i){I=e[i][t].boundingSphere;var L=a.magnitude(a.subtract(I.center,M,se))+I.radius;L>C&&(C=L)}return new y({attributes:T,indices:_,primitiveType:h,boundingSphere:c(M)?new r(M,C):void 0})}function U(e){if(c(e.indices))return e;var t=y.computeNumberOfVertices(e);if(3>t)throw new l("The number of vertices must be at least three.");if(t%3!==0)throw new l("The number of vertices must be a multiple of three.");for(var r=m.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function F(e){var t=y.computeNumberOfVertices(e);if(3>t)throw new l("The number of vertices must be at least three.");var r=m.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,a=3;t>a;++a)r[n++]=a-1,r[n++]=0,r[n++]=a;return e.indices=r,e.primitiveType=w.TRIANGLES,e}function D(e){var t=y.computeNumberOfVertices(e);if(3>t)throw new l("The number of vertices must be at least 3.");var r=m.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,a=3;t-1>a;a+=2)r[n++]=a,r[n++]=a-1,r[n++]=a+1,t>a+2&&(r[n++]=a,r[n++]=a+1,r[n++]=a+2);return e.indices=r,e.primitiveType=w.TRIANGLES,e}function B(e){if(c(e.indices))return e;var t=y.computeNumberOfVertices(e);if(2>t)throw new l("The number of vertices must be at least two.");if(t%2!==0)throw new l("The number of vertices must be a multiple of 2.");for(var r=m.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function z(e){var t=y.computeNumberOfVertices(e);if(2>t)throw new l("The number of vertices must be at least two.");var r=m.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return e.indices=r,e.primitiveType=w.LINES,e}function j(e){var t=y.computeNumberOfVertices(e);if(2>t)throw new l("The number of vertices must be at least two.");var r=m.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var n=2,a=2;t>a;++a)r[n++]=a-1,r[n++]=a;return r[n++]=t-1,r[n]=0,e.indices=r,e.primitiveType=w.LINES,e}function q(e){switch(e.primitiveType){case w.TRIANGLE_FAN:return F(e);case w.TRIANGLE_STRIP:return D(e);case w.TRIANGLES:return U(e);case w.LINE_STRIP:return z(e);case w.LINE_LOOP:return j(e);case w.LINES:return B(e)}return e}function G(e,t){Math.abs(e.y)i?a>o?T.sign(e.y):T.sign(r.y):i>o?T.sign(t.y):T.sign(r.y);var u=0>n;G(e,u),G(t,u),G(r,u)}function X(e,t,r,n){a.add(e,a.multiplyByScalar(a.subtract(t,e,ve),e.y/(e.y-t.y),ve),r),a.clone(r,n),G(r,!0),G(n,!1)}function W(e,t,r){if(!(e.x>=0||t.x>=0||r.x>=0)){V(e,t,r);var n=e.y<0,a=t.y<0,i=r.y<0,o=0;o+=n?1:0,o+=a?1:0,o+=i?1:0;var u=Ae.indices;1===o?(u[1]=3,u[2]=4,u[5]=6,u[7]=6,u[8]=5,n?(X(e,t,be,Re),X(e,r,we,ge),u[0]=0,u[3]=1,u[4]=2,u[6]=1):a?(X(t,r,be,Re),X(t,e,we,ge),u[0]=1,u[3]=2,u[4]=0,u[6]=2):i&&(X(r,e,be,Re),X(r,t,we,ge),u[0]=2,u[3]=0,u[4]=1,u[6]=0)):2===o&&(u[2]=4,u[4]=4,u[5]=3,u[7]=5,u[8]=6,n?a?i||(X(r,e,be,Re),X(r,t,we,ge),u[0]=0,u[1]=1,u[3]=0,u[6]=2):(X(t,r,be,Re),X(t,e,we,ge),u[0]=2,u[1]=0,u[3]=2,u[6]=1):(X(e,t,be,Re),X(e,r,we,ge),u[0]=1,u[1]=2,u[3]=1,u[6]=0));var s=Ae.positions;return s[0]=e,s[1]=t,s[2]=r,s.length=3,(1===o||2===o)&&(s[3]=be,s[4]=we,s[5]=Re,s[6]=ge,s.length=7),Ae}}function H(e,t){var n=e.attributes;if(0!==n.position.values.length){for(var a in n)if(n.hasOwnProperty(a)&&c(n[a])&&c(n[a].values)){var i=n[a];i.values=u.createTypedArray(i.componentDatatype,i.values)}var o=y.computeNumberOfVertices(e);return e.indices=m.createTypedArray(o,e.indices),t&&(e.boundingSphere=r.fromVertices(n.position.values)),e}}function Y(e){var t=e.attributes,r={};for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values)){var a=t[n];r[n]=new h({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return new y({attributes:r,indices:[],primitiveType:e.primitiveType})}function k(e,t,r){var n=c(e.geometry.boundingSphere);t=H(t,n),r=H(r,n),c(r)&&!c(t)?e.geometry=r:!c(r)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function Z(e,r,i,o,u,s,l,f,p,y,h,d){if(c(s)||c(l)||c(f)||c(p)||c(y)){var m=a.fromArray(u,3*e,Ne),E=a.fromArray(u,3*r,Se),O=a.fromArray(u,3*i,xe),T=t(o,m,E,O,Ie);if(c(s)){var _=a.fromArray(s,3*e,Ne),v=a.fromArray(s,3*r,Se),b=a.fromArray(s,3*i,xe);a.multiplyByScalar(_,T.x,_),a.multiplyByScalar(v,T.y,v),a.multiplyByScalar(b,T.z,b);var w=a.add(_,v,_);a.add(w,b,w),a.normalize(w,w),a.pack(w,h.normal.values,3*d)}if(c(y)){var R=a.fromArray(y,3*e,Ne),g=a.fromArray(y,3*r,Se),A=a.fromArray(y,3*i,xe);a.multiplyByScalar(R,T.x,R),a.multiplyByScalar(g,T.y,g),a.multiplyByScalar(A,T.z,A);var N;a.equals(R,a.ZERO)&&a.equals(g,a.ZERO)&&a.equals(A,a.ZERO)?(N=Ne,N.x=0,N.y=0,N.z=0):(N=a.add(R,g,R),a.add(N,A,N),a.normalize(N,N)),a.pack(N,h.extrudeDirection.values,3*d)}if(c(l)){var S=a.fromArray(l,3*e,Ne),x=a.fromArray(l,3*r,Se),I=a.fromArray(l,3*i,xe);a.multiplyByScalar(S,T.x,S),a.multiplyByScalar(x,T.y,x),a.multiplyByScalar(I,T.z,I);var M=a.add(S,x,S);a.add(M,I,M),a.normalize(M,M),a.pack(M,h.tangent.values,3*d)}if(c(f)){var C=a.fromArray(f,3*e,Ne),P=a.fromArray(f,3*r,Se),L=a.fromArray(f,3*i,xe);a.multiplyByScalar(C,T.x,C),a.multiplyByScalar(P,T.y,P),a.multiplyByScalar(L,T.z,L);var U=a.add(C,P,C);a.add(U,L,U),a.normalize(U,U),a.pack(U,h.bitangent.values,3*d)}if(c(p)){var F=n.fromArray(p,2*e,Me),D=n.fromArray(p,2*r,Ce),B=n.fromArray(p,2*i,Pe);n.multiplyByScalar(F,T.x,F),n.multiplyByScalar(D,T.y,D),n.multiplyByScalar(B,T.z,B);var z=n.add(F,D,F);n.add(z,B,z),n.pack(z,h.st.values,2*d)}}}function K(e,t,r,n,a,i){var o=e.position.values.length/3;if(-1!==a){var u=n[a],s=r[u];return-1===s?(r[u]=o,e.position.values.push(i.x,i.y,i.z),t.push(o),o):(t.push(s),s)}return e.position.values.push(i.x,i.y,i.z),t.push(o),o}function Q(e){var t,r,n,i,o,u=e.geometry,s=u.attributes,l=s.position.values,f=c(s.normal)?s.normal.values:void 0,p=c(s.bitangent)?s.bitangent.values:void 0,y=c(s.tangent)?s.tangent.values:void 0,h=c(s.st)?s.st.values:void 0,d=c(s.extrudeDirection)?s.extrudeDirection.values:void 0,m=u.indices,E=Y(u),O=Y(u),T=[];T.length=l.length/3;var _=[];for(_.length=l.length/3,o=0;oo;o+=3){var b=m[o],w=m[o+1],R=m[o+2],g=a.fromArray(l,3*b),A=a.fromArray(l,3*w),N=a.fromArray(l,3*R),S=W(g,A,N);if(c(S)&&S.positions.length>3)for(var x=S.positions,I=S.indices,M=I.length,C=0;M>C;++C){var P=I[C],L=x[P];L.y<0?(t=O.attributes,r=O.indices,n=T):(t=E.attributes,r=E.indices,n=_),i=K(t,r,n,m,3>P?o+P:-1,L),Z(b,w,R,L,l,f,y,p,h,d,t,i)}else c(S)&&(g=S.positions[0],A=S.positions[1],N=S.positions[2]),g.y<0?(t=O.attributes,r=O.indices,n=T):(t=E.attributes,r=E.indices,n=_),i=K(t,r,n,m,o,g),Z(b,w,R,g,l,f,y,p,h,d,t,i),i=K(t,r,n,m,o+1,A),Z(b,w,R,A,l,f,y,p,h,d,t,i),i=K(t,r,n,m,o+2,N),Z(b,w,R,N,l,f,y,p,h,d,t,i)}k(e,O,E)}function J(e){var t,r=e.geometry,n=r.attributes,i=n.position.values,o=r.indices,u=Y(r),s=Y(r),l=o.length,f=[];f.length=i.length/3;var p=[];for(p.length=i.length/3,t=0;tt;t+=2){var y=o[t],h=o[t+1],d=a.fromArray(i,3*y,Ne),m=a.fromArray(i,3*h,Se);Math.abs(d.y)u;u+=3){var s=a.unpack(r,u,ze);if(!(s.x>0)){var c=a.unpack(n,u,je);(s.y<0&&c.y>0||s.y>0&&c.y<0)&&(u-3>0?(n[u]=r[u-3],n[u+1]=r[u-2],n[u+2]=r[u-1]):a.pack(s,n,u));var l=a.unpack(i,u,qe);(s.y<0&&l.y>0||s.y>0&&l.y<0)&&(o>u+3?(i[u]=r[u+3],i[u+1]=r[u+4],i[u+2]=r[u+5]):a.pack(s,i,u))}}}function ee(e){var t,r,o,u=e.geometry,s=u.attributes,l=s.position.values,f=s.prevPosition.values,p=s.nextPosition.values,y=s.expandAndWidth.values,h=c(s.st)?s.st.values:void 0,d=c(s.color)?s.color.values:void 0,m=Y(u),E=Y(u),_=!1,v=l.length/3;for(t=0;v>t;t+=4){var b=t,w=t+2,R=a.fromArray(l,3*b,ze),g=a.fromArray(l,3*w,je);if(Math.abs(R.y)r;r+=3)f[r]=l[3*t],f[r+1]=l[3*t+1],f[r+2]=l[3*t+2];if(Math.abs(g.y)r;r+=3)p[r]=l[3*(t+2)],p[r+1]=l[3*(t+2)+1],p[r+2]=l[3*(t+2)+2];var A=m.attributes,N=m.indices,S=E.attributes,x=E.indices,I=O.lineSegmentPlane(R,g,Le,Ge);if(c(I)){_=!0;var M=a.multiplyByScalar(a.UNIT_Y,He,Ve);R.y<0&&(a.negate(M,M),A=E.attributes,N=E.indices,S=m.attributes,x=m.indices);var C=a.add(I,M,Xe);A.position.values.push(R.x,R.y,R.z,R.x,R.y,R.z),A.position.values.push(C.x,C.y,C.z),A.position.values.push(C.x,C.y,C.z),A.prevPosition.values.push(f[3*b],f[3*b+1],f[3*b+2]),A.prevPosition.values.push(f[3*b+3],f[3*b+4],f[3*b+5]),A.prevPosition.values.push(R.x,R.y,R.z,R.x,R.y,R.z),A.nextPosition.values.push(C.x,C.y,C.z),A.nextPosition.values.push(C.x,C.y,C.z),A.nextPosition.values.push(C.x,C.y,C.z),A.nextPosition.values.push(C.x,C.y,C.z),a.negate(M,M),a.add(I,M,C),S.position.values.push(C.x,C.y,C.z),S.position.values.push(C.x,C.y,C.z),S.position.values.push(g.x,g.y,g.z,g.x,g.y,g.z),S.prevPosition.values.push(C.x,C.y,C.z),S.prevPosition.values.push(C.x,C.y,C.z),S.prevPosition.values.push(C.x,C.y,C.z),S.prevPosition.values.push(C.x,C.y,C.z),S.nextPosition.values.push(g.x,g.y,g.z,g.x,g.y,g.z),S.nextPosition.values.push(p[3*w],p[3*w+1],p[3*w+2]),S.nextPosition.values.push(p[3*w+3],p[3*w+4],p[3*w+5]);var P=n.fromArray(y,2*b,De),L=Math.abs(P.y);A.expandAndWidth.values.push(-1,L,1,L),A.expandAndWidth.values.push(-1,-L,1,-L),S.expandAndWidth.values.push(-1,L,1,L),S.expandAndWidth.values.push(-1,-L,1,-L);var U=a.magnitudeSquared(a.subtract(I,R,qe));if(U/=a.magnitudeSquared(a.subtract(g,R,qe)),c(d)){var F=i.fromArray(d,4*b,We),D=i.fromArray(d,4*w,We),B=T.lerp(F.x,D.x,U),z=T.lerp(F.y,D.y,U),j=T.lerp(F.z,D.z,U),q=T.lerp(F.w,D.w,U);for(r=4*b;4*b+8>r;++r)A.color.values.push(d[r]);for(A.color.values.push(B,z,j,q),A.color.values.push(B,z,j,q),S.color.values.push(B,z,j,q),S.color.values.push(B,z,j,q),r=4*w;4*w+8>r;++r)S.color.values.push(d[r])}if(c(h)){var G=n.fromArray(h,2*b,De),V=n.fromArray(h,2*(t+3),Be),X=T.lerp(G.x,V.x,U);for(r=2*b;2*b+4>r;++r)A.st.values.push(h[r]);for(A.st.values.push(X,G.y),A.st.values.push(X,V.y),S.st.values.push(X,G.y),S.st.values.push(X,V.y),r=2*w;2*w+4>r;++r)S.st.values.push(h[r])}o=A.position.values.length/3-4,N.push(o,o+2,o+1),N.push(o+1,o+2,o+3),o=S.position.values.length/3-4,x.push(o,o+2,o+1),x.push(o+1,o+2,o+3)}else{var W,H;for(R.y<0?(W=E.attributes,H=E.indices):(W=m.attributes,H=m.indices),W.position.values.push(R.x,R.y,R.z),W.position.values.push(R.x,R.y,R.z),W.position.values.push(g.x,g.y,g.z),W.position.values.push(g.x,g.y,g.z),r=3*t;3*t+12>r;++r)W.prevPosition.values.push(f[r]),W.nextPosition.values.push(p[r]);for(r=2*t;2*t+8>r;++r)W.expandAndWidth.values.push(y[r]),c(h)&&W.st.values.push(h[r]);if(c(d))for(r=4*t;4*t+16>r;++r)W.color.values.push(d[r]);o=W.position.values.length/3-4,H.push(o,o+2,o+1),H.push(o+1,o+2,o+3)}}_&&($(E),$(m)),k(e,E,m)}var te={};te.toWireframe=function(e){if(!c(e))throw new l("geometry is required.");var t=e.indices;if(c(t)){switch(e.primitiveType){case w.TRIANGLES:e.indices=A(t);break;case w.TRIANGLE_STRIP:e.indices=N(t);break;case w.TRIANGLE_FAN:e.indices=S(t);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=w.LINES}return e},te.createLineSegmentsForVectors=function(e,t,n){if(t=s(t,"normal"),!c(e))throw new l("geometry is required.");if(!c(e.attributes.position))throw new l("geometry.attributes.position is required.");if(!c(e.attributes[t]))throw new l("geometry.attributes must have an attribute with the same name as the attributeName parameter, "+t+".");n=s(n,1e4);for(var a=e.attributes.position.values,i=e.attributes[t].values,o=a.length,f=new Float64Array(2*o),p=0,d=0;o>d;d+=3)f[p++]=a[d],f[p++]=a[d+1],f[p++]=a[d+2],f[p++]=a[d]+i[d]*n,f[p++]=a[d+1]+i[d+1]*n,f[p++]=a[d+2]+i[d+2]*n;var m,E=e.boundingSphere;return c(E)&&(m=new r(E.center,E.radius+n)),new y({attributes:{position:new h({componentDatatype:u.DOUBLE,componentsPerAttribute:3,values:f})},primitiveType:w.LINES,boundingSphere:m})},te.createAttributeLocations=function(e){if(!c(e))throw new l("geometry is required.");var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,a={},i=0,o=r.length;for(t=0;o>t;++t){var u=r[t];c(n[u])&&(a[u]=i++)}for(var s in n)n.hasOwnProperty(s)&&!c(a[s])&&(a[s]=i++);return a},te.reorderForPreVertexCache=function(e){if(!c(e))throw new l("geometry is required.");var t=y.computeNumberOfVertices(e),r=e.indices;if(c(r)){for(var n=new Int32Array(t),a=0;t>a;a++)n[a]=-1;for(var i,o=r,s=o.length,f=m.createTypedArray(t,s),p=0,h=0,d=0;s>p;)i=n[o[p]],-1!==i?f[h]=i:(i=o[p],n[i]=d,f[h]=d,++d),++p,++h;e.indices=f;var E=e.attributes;for(var O in E)if(E.hasOwnProperty(O)&&c(E[O])&&c(E[O].values)){for(var T=E[O],_=T.values,v=0,b=T.componentsPerAttribute,w=u.createTypedArray(T.componentDatatype,d*b);t>v;){var R=n[v];if(-1!==R)for(var g=0;b>g;g++)w[b*R+g]=_[b*v+g];++v}T.values=w}}return e},te.reorderForPostVertexCache=function(e,t){if(!c(e))throw new l("geometry is required.");var r=e.indices;if(e.primitiveType===w.TRIANGLES&&c(r)){for(var n=r.length,a=0,i=0;n>i;i++)r[i]>a&&(a=r[i]);e.indices=R.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},te.fitToUnsignedShortIndices=function(e){if(!c(e))throw new l("geometry is required.");if(c(e.indices)&&e.primitiveType!==w.TRIANGLES&&e.primitiveType!==w.LINES&&e.primitiveType!==w.POINTS)throw new l("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");var t=[],r=y.computeNumberOfVertices(e);if(c(e.indices)&&r>=T.SIXTY_FOUR_KILOBYTES){var n,a=[],i=[],o=0,u=x(e.attributes),s=e.indices,f=s.length;e.primitiveType===w.TRIANGLES?n=3:e.primitiveType===w.LINES?n=2:e.primitiveType===w.POINTS&&(n=1);for(var p=0;f>p;p+=n){for(var h=0;n>h;++h){var d=s[p+h],m=a[d];c(m)||(m=o++,a[d]=m,I(u,e.attributes,d)),i.push(m)}o+n>=T.SIXTY_FOUR_KILOBYTES&&(t.push(new y({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],i=[],o=0,u=x(e.attributes))}0!==i.length&&t.push(new y({attributes:u,indices:i,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var re=new a,ne=new o;te.projectTo2D=function(e,t,r,n,i){if(!c(e))throw new l("geometry is required.");if(!c(t))throw new l("attributeName is required.");if(!c(r))throw new l("attributeName3D is required.");if(!c(n))throw new l("attributeName2D is required.");if(!c(e.attributes[t]))throw new l("geometry must have attribute matching the attributeName argument: "+t+".");if(e.attributes[t].componentDatatype!==u.DOUBLE)throw new l("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");var o=e.attributes[t];i=c(i)?i:new p;for(var s=i.ellipsoid,f=o.values,y=new Float64Array(f.length),d=0,m=0;my;++y)f.encode(i[y],ae),s[y]=ae.high,p[y]=ae.low;var d=a.componentsPerAttribute;return e.attributes[r]=new h({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[n]=new h({componentDatatype:u.FLOAT,componentsPerAttribute:d,values:p}),delete e.attributes[t],e};var ie=new a,oe=new v,ue=new _;te.transformToWorldCoordinates=function(e){if(!c(e))throw new l("instance is required.");var t=e.modelMatrix;if(v.equals(t,v.IDENTITY))return e;var n=e.geometry.attributes;M(t,n.position),M(t,n.prevPosition),M(t,n.nextPosition),(c(n.normal)||c(n.tangent)||c(n.bitangent))&&(v.inverse(t,oe),v.transpose(oe,oe),v.getRotation(oe,ue),C(ue,n.normal),C(ue,n.tangent),C(ue,n.bitangent));var a=e.geometry.boundingSphere;return c(a)&&(e.geometry.boundingSphere=r.transform(a,t,a)),e.modelMatrix=v.clone(v.IDENTITY),e};var se=new a;te.combineInstances=function(e){if(!c(e)||e.length<1)throw new l("instances is required and must have length greater than zero.");for(var t=[],r=[],n=e.length,a=0;n>a;++a){var i=e[a];c(i.geometry)?t.push(i):c(i.westHemisphereGeometry)&&c(i.eastHemisphereGeometry)&&r.push(i)}var o=[];return t.length>0&&o.push(L(t,"geometry")),r.length>0&&(o.push(L(r,"westHemisphereGeometry")),o.push(L(r,"eastHemisphereGeometry"))),o};var ce=new a,le=new a,fe=new a,pe=new a;te.computeNormal=function(e){if(!c(e))throw new l("geometry is required.");if(!c(e.attributes.position)||!c(e.attributes.position.values))throw new l("geometry.attributes.position.values is required.");if(!c(e.indices))throw new l("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new l("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==w.TRIANGLES)throw new l("geometry.primitiveType must be PrimitiveType.TRIANGLES.");var t,r=e.indices,n=e.attributes,i=n.position.values,o=n.position.values.length/3,s=r.length,f=new Array(o),p=new Array(s/3),y=new Array(s);for(t=0;o>t;t++)f[t]={indexOffset:0,count:0,currentCount:0};var d=0;for(t=0;s>t;t+=3){var m=r[t],E=r[t+1],O=r[t+2],_=3*m,v=3*E,b=3*O;le.x=i[_],le.y=i[_+1],le.z=i[_+2],fe.x=i[v],fe.y=i[v+1],fe.z=i[v+2],pe.x=i[b],pe.y=i[b+1],pe.z=i[b+2],f[m].count++,f[E].count++,f[O].count++,a.subtract(fe,le,fe),a.subtract(pe,le,pe),p[d]=a.cross(fe,pe,new a),d++}var R=0;for(t=0;o>t;t++)f[t].indexOffset+=R,R+=f[t].count;d=0;var g;for(t=0;s>t;t+=3){g=f[r[t]];var A=g.indexOffset+g.currentCount;y[A]=d,g.currentCount++,g=f[r[t+1]],A=g.indexOffset+g.currentCount,y[A]=d,g.currentCount++,g=f[r[t+2]],A=g.indexOffset+g.currentCount,y[A]=d,g.currentCount++,d++}var N=new Float32Array(3*o);for(t=0;o>t;t++){var S=3*t;if(g=f[t],a.clone(a.ZERO,ce),g.count>0){for(d=0;dn;n+=3){var O=r[n],T=r[n+1],_=r[n+2];d=3*O,m=3*T,E=3*_;var v=2*O,b=2*T,R=2*_,g=i[d],A=i[d+1],N=i[d+2],S=s[v],x=s[v+1],I=s[b+1]-x,M=s[R+1]-x,C=1/((s[b]-S)*M-(s[R]-S)*I),P=(M*(i[m]-g)-I*(i[E]-g))*C,L=(M*(i[m+1]-A)-I*(i[E+1]-A))*C,U=(M*(i[m+2]-N)-I*(i[E+2]-N))*C;y[d]+=P,y[d+1]+=L,y[d+2]+=U,y[m]+=P,y[m+1]+=L,y[m+2]+=U,y[E]+=P,y[E+1]+=L,y[E+2]+=U}var F=new Float32Array(3*f),D=new Float32Array(3*f);for(n=0;f>n;n++){d=3*n,m=d+1,E=d+2;var B=a.fromArray(o,d,ye),z=a.fromArray(y,d,de),j=a.dot(B,z);a.multiplyByScalar(B,j,he),a.normalize(a.subtract(z,he,z),z),F[d]=z.x,F[m]=z.y,F[E]=z.z,a.normalize(a.cross(B,z,z),z),D[d]=z.x,D[m]=z.y,D[E]=z.z}return e.attributes.tangent=new h({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:F}),e.attributes.bitangent=new h({componentDatatype:u.FLOAT,componentsPerAttribute:3,values:D}),e};var me=new n,Ee=new a,Oe=new a,Te=new a,_e=new n;te.compressVertices=function(t){if(!c(t))throw new l("geometry is required.");var r,i,o=t.attributes.extrudeDirection;if(c(o)){var s=o.values;i=s.length/3;var f=new Float32Array(2*i),p=0;for(r=0;i>r;++r)a.fromArray(s,3*r,Ee),a.equals(Ee,a.ZERO)?p+=2:(_e=e.octEncodeInRange(Ee,65535,_e),f[p++]=_e.x,f[p++]=_e.y);return t.attributes.compressedAttributes=new h({componentDatatype:u.FLOAT,componentsPerAttribute:2,values:f}),delete t.attributes.extrudeDirection,t}var y=t.attributes.normal,d=t.attributes.st,m=c(y),E=c(d);if(!m&&!E)return t;var O,T,_,v,b=t.attributes.tangent,w=t.attributes.bitangent,R=c(b),g=c(w);m&&(O=y.values),E&&(T=d.values),R&&(_=b.values),g&&(v=w.values);var A=m?O.length:T.length,N=m?3:2;i=A/N;var S=i,x=E&&m?2:1;x+=R||g?1:0,S*=x;var I=new Float32Array(S),M=0;for(r=0;i>r;++r){E&&(n.fromArray(T,2*r,me),I[M++]=e.compressTextureCoordinates(me));var C=3*r;m&&c(_)&&c(v)?(a.fromArray(O,C,Ee),a.fromArray(_,C,Oe),a.fromArray(v,C,Te),e.octPack(Ee,Oe,Te,me),I[M++]=me.x,I[M++]=me.y):(m&&(a.fromArray(O,C,Ee),I[M++]=e.octEncodeFloat(Ee)),R&&(a.fromArray(_,C,Ee),I[M++]=e.octEncodeFloat(Ee)),g&&(a.fromArray(v,C,Ee),I[M++]=e.octEncodeFloat(Ee)))}return t.attributes.compressedAttributes=new h({componentDatatype:u.FLOAT,componentsPerAttribute:x,values:I}),m&&delete t.attributes.normal,E&&delete t.attributes.st,g&&delete t.attributes.bitangent,R&&delete t.attributes.tangent,t};var ve=new a,be=new a,we=new a,Re=new a,ge=new a,Ae={positions:new Array(7),indices:new Array(9)},Ne=new a,Se=new a,xe=new a,Ie=new a,Me=new n,Ce=new n,Pe=new n,Le=b.fromPointNormal(a.ZERO,a.UNIT_Y),Ue=new a,Fe=new a,De=new n,Be=new n,ze=new a,je=new a,qe=new a,Ge=new a,Ve=new a,Xe=new a,We=new i,He=5*T.EPSILON9,Ye=T.EPSILON6;return te.splitLongitude=function(e){if(!c(e))throw new l("instance is required.");var t=e.geometry,n=t.boundingSphere;if(c(n)){var a=n.center.x-n.radius;if(a>0||r.intersectPlane(n,b.ORIGIN_ZX_PLANE)!==E.INTERSECTING)return e}if(t.geometryType!==d.NONE)switch(t.geometryType){case d.POLYLINES:ee(e);break;case d.TRIANGLES:Q(e);break;case d.LINES:J(e)}else q(t),t.primitiveType===w.TRIANGLES?Q(e):t.primitiveType===w.LINES&&J(e);return e},te}),define("ThirdParty/earcut-2.1.1",[],function(){"use strict";function e(e,r,a){a=a||2;var i=r&&r.length,o=i?r[0]*a:e.length,u=t(e,0,o,a,!0),c=[];if(!u)return c;var l,f,p,y,h,d,m;if(i&&(u=s(e,r,u,a)),e.length>80*a){l=p=e[0],f=y=e[1];for(var E=a;o>E;E+=a)h=e[E],d=e[E+1],l>h&&(l=h),f>d&&(f=d),h>p&&(p=h),d>y&&(y=d);m=Math.max(p-l,y-f)}return n(u,c,a,l,f,m),c}function t(e,t,r,n,a){var i,o;if(a===S(e,t,r,n)>0)for(i=t;r>i;i+=n)o=g(i,e[i],e[i+1],o);else for(i=r-n;i>=t;i-=n)o=g(i,e[i],e[i+1],o);return o&&T(o,o.next)&&(A(o),o=o.next),o}function r(e,t){if(!e)return e;t||(t=e);var r,n=e;do if(r=!1,n.steiner||!T(n,n.next)&&0!==O(n.prev,n,n.next))n=n.next;else{if(A(n),n=t=n.prev,n===n.next)return null;r=!0}while(r||n!==t);return t}function n(e,t,s,c,l,f,y){if(e){!y&&f&&p(e,c,l,f);for(var h,d,m=e;e.prev!==e.next;)if(h=e.prev,d=e.next,f?i(e,c,l,f):a(e))t.push(h.i/s),t.push(e.i/s),t.push(d.i/s),A(e),e=d.next,m=d.next;else if(e=d,e===m){y?1===y?(e=o(e,t,s),n(e,t,s,c,l,f,2)):2===y&&u(e,t,s,c,l,f):n(r(e),t,s,c,l,f,1);break}}}function a(e){var t=e.prev,r=e,n=e.next;if(O(t,r,n)>=0)return!1;for(var a=e.next.next;a!==e.prev;){if(m(t.x,t.y,r.x,r.y,n.x,n.y,a.x,a.y)&&O(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function i(e,t,r,n){var a=e.prev,i=e,o=e.next;if(O(a,i,o)>=0)return!1;for(var u=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,l=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,f=h(u,s,t,r,n),p=h(c,l,t,r,n),y=e.nextZ;y&&y.z<=p;){if(y!==e.prev&&y!==e.next&&m(a.x,a.y,i.x,i.y,o.x,o.y,y.x,y.y)&&O(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(y=e.prevZ;y&&y.z>=f;){if(y!==e.prev&&y!==e.next&&m(a.x,a.y,i.x,i.y,o.x,o.y,y.x,y.y)&&O(y.prev,y,y.next)>=0)return!1;y=y.prevZ}return!0}function o(e,t,r){var n=e;do{var a=n.prev,i=n.next.next;!T(a,i)&&_(a,n,n.next,i)&&b(a,i)&&b(i,a)&&(t.push(a.i/r),t.push(n.i/r),t.push(i.i/r),A(n),A(n.next),n=e=i),n=n.next}while(n!==e);return n}function u(e,t,a,i,o,u){var s=e;do{for(var c=s.next.next;c!==s.prev;){if(s.i!==c.i&&E(s,c)){var l=R(s,c);return s=r(s,s.next),l=r(l,l.next),n(s,t,a,i,o,u),void n(l,t,a,i,o,u)}c=c.next}s=s.next}while(s!==e)}function s(e,n,a,i){var o,u,s,f,p,y=[];for(o=0,u=n.length;u>o;o++)s=n[o]*i,f=u-1>o?n[o+1]*i:e.length,p=t(e,s,f,i,!1),p===p.next&&(p.steiner=!0),y.push(d(p));for(y.sort(c),o=0;o=n.next.y){var u=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a>=u&&u>o){if(o=u,u===a){if(i===n.y)return n;if(i===n.next.y)return n.next}r=n.x=n.x&&n.x>=l&&m(f>i?a:o,i,l,f,f>i?o:a,i,n.x,n.y)&&(s=Math.abs(i-n.y)/(a-n.x),(p>s||s===p&&n.x>r.x)&&b(n,e)&&(r=n,p=s)),n=n.next;return r}function p(e,t,r,n){var a=e;do null===a.z&&(a.z=h(a.x,a.y,t,r,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,y(a)}function y(e){var t,r,n,a,i,o,u,s,c=1;do{for(r=e,e=null,i=null,o=0;r;){for(o++,n=r,u=0,t=0;c>t&&(u++,n=n.nextZ,n);t++);for(s=c;u>0||s>0&&n;)0===u?(a=n,n=n.nextZ,s--):0!==s&&n?r.z<=n.z?(a=r,r=r.nextZ,u--):(a=n,n=n.nextZ,s--):(a=r,r=r.nextZ,u--),i?i.nextZ=a:e=a,a.prevZ=i,i=a;r=n}i.nextZ=null,c*=2}while(o>1);return e}function h(e,t,r,n,a){return e=32767*(e-r)/a,t=32767*(t-n)/a,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function d(e){var t=e,r=e;do t.x=0&&(e-o)*(n-u)-(r-o)*(t-u)>=0&&(r-o)*(i-u)-(a-o)*(n-u)>=0}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!v(e,t)&&b(e,t)&&b(t,e)&&w(e,t)}function O(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function T(e,t){return e.x===t.x&&e.y===t.y}function _(e,t,r,n){return T(e,t)&&T(r,n)||T(e,n)&&T(r,t)?!0:O(e,t,r)>0!=O(e,t,n)>0&&O(r,n,e)>0!=O(r,n,t)>0}function v(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&_(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function b(e,t){return O(e.prev,e,e.next)<0?O(e,t,e.next)>=0&&O(e,e.prev,t)>=0:O(e,t,e.prev)<0||O(e,e.next,t)<0}function w(e,t){var r=e,n=!1,a=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function R(e,t){var r=new N(e.i,e.x,e.y),n=new N(t.i,t.x,t.y),a=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=a,a.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function g(e,t,r,n){var a=new N(e,t,r);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function A(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 N(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(e,t,r,n){for(var a=0,i=t,o=r-n;r>i;i+=n)a+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return a}return e.deviation=function(e,t,r,n){var a=t&&t.length,i=a?t[0]*r:e.length,o=Math.abs(S(e,0,i,r));if(a)for(var u=0,s=t.length;s>u;u++){var c=t[u]*r,l=s-1>u?t[u+1]*r:e.length;o-=Math.abs(S(e,c,l,r))}var f=0;for(u=0;uo;o++)r.vertices.push(e[a][i][o]);a>0&&(n+=e[a-1].length,r.holes.push(n))}return r},e}),define("Core/WindingOrder",["./freezeObject","./WebGLConstants"],function(e,t){"use strict";var r={CLOCKWISE:t.CW,COUNTER_CLOCKWISE:t.CCW,validate:function(e){return e===r.CLOCKWISE||e===r.COUNTER_CLOCKWISE}};return e(r)}),define("Core/PolygonPipeline",["../ThirdParty/earcut-2.1.1","./Cartesian2","./Cartesian3","./Check","./ComponentDatatype","./defaultValue","./defined","./Ellipsoid","./Geometry","./GeometryAttribute","./Math","./PrimitiveType","./WindingOrder"],function(e,t,r,n,a,i,o,u,s,c,l,f,p){"use strict";var y=new r,h=new r,d={};d.computeArea2D=function(e){n.defined("positions",e),n.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);for(var t=e.length,r=0,a=t-1,i=0;t>i;a=i++){var o=e[a],u=e[i];r+=o.x*u.y-u.x*o.y}return.5*r},d.computeWindingOrder2D=function(e){var t=d.computeArea2D(e);return t>0?p.COUNTER_CLOCKWISE:p.CLOCKWISE},d.triangulate=function(r,a){n.defined("positions",r);var i=t.packArray(r);return e(i,a,2)};var m=new r,E=new r,O=new r,T=new r,_=new r,v=new r,b=new r;return d.computeSubdivision=function(e,t,u,p){p=i(p,l.RADIANS_PER_DEGREE),n.typeOf.object("ellipsoid",e),n.defined("positions",t),n.defined("indices",u),n.typeOf.number.greaterThanOrEquals("indices.length",u.length,3),n.typeOf.number.equals("indices.length % 3","0",u.length%3,0),n.typeOf.number.greaterThan("granularity",p,0);var y,h=u.slice(0),d=t.length,w=new Array(3*d),R=0;for(y=0;d>y;y++){var g=t[y];w[R++]=g.x,w[R++]=g.y,w[R++]=g.z}for(var A=[],N={},S=e.maximumRadius,x=l.chordLength(p,S),I=x*x;h.length>0;){var M,C,P=h.pop(),L=h.pop(),U=h.pop(),F=r.fromArray(w,3*U,m),D=r.fromArray(w,3*L,E),B=r.fromArray(w,3*P,O),z=r.multiplyByScalar(r.normalize(F,T),S,T),j=r.multiplyByScalar(r.normalize(D,_),S,_),q=r.multiplyByScalar(r.normalize(B,v),S,v),G=r.magnitudeSquared(r.subtract(z,j,b)),V=r.magnitudeSquared(r.subtract(j,q,b)),X=r.magnitudeSquared(r.subtract(q,z,b)),W=Math.max(G,V,X);W>I?G===W?(M=Math.min(U,L)+" "+Math.max(U,L),y=N[M],o(y)||(C=r.add(F,D,b),r.multiplyByScalar(C,.5,C),w.push(C.x,C.y,C.z),y=w.length/3-1,N[M]=y),h.push(U,y,P),h.push(y,L,P)):V===W?(M=Math.min(L,P)+" "+Math.max(L,P),y=N[M],o(y)||(C=r.add(D,B,b),r.multiplyByScalar(C,.5,C),w.push(C.x,C.y,C.z),y=w.length/3-1,N[M]=y),h.push(L,y,U),h.push(y,P,U)):X===W&&(M=Math.min(P,U)+" "+Math.max(P,U),y=N[M],o(y)||(C=r.add(B,F,b),r.multiplyByScalar(C,.5,C),w.push(C.x,C.y,C.z),y=w.length/3-1,N[M]=y),h.push(P,y,L),h.push(y,U,L)):(A.push(U),A.push(L),A.push(P))}return new s({attributes:{position:new c({componentDatatype:a.DOUBLE,componentsPerAttribute:3,values:w})},indices:A,primitiveType:f.TRIANGLES})},d.scaleToGeodeticHeight=function(e,t,n,a){n=i(n,u.WGS84);var s=y,c=h;if(t=i(t,0),a=i(a,!0),o(e))for(var l=e.length,f=0;l>f;f+=3)r.fromArray(e,f,c),a&&(c=n.scaleToGeodeticSurface(c,c)),0!==t&&(s=n.geodeticSurfaceNormal(c,s),r.multiplyByScalar(s,t,s),r.add(c,s,c)),e[f]=c.x,e[f+1]=c.y,e[f+2]=c.z;return e},d}),define("Core/Quaternion",["./Cartesian3","./Check","./defaultValue","./defined","./FeatureDetection","./freezeObject","./Math","./Matrix3"],function(e,t,r,n,a,i,o,u){"use strict";function s(e,t,n,a){this.x=r(e,0),this.y=r(t,0),this.z=r(n,0),this.w=r(a,0)}var c=new e;s.fromAxisAngle=function(r,a,i){t.typeOf.object("axis",r),t.typeOf.number("angle",a);var o=a/2,u=Math.sin(o);c=e.normalize(r,c);var l=c.x*u,f=c.y*u,p=c.z*u,y=Math.cos(o);return n(i)?(i.x=l,i.y=f,i.z=p,i.w=y,i):new s(l,f,p,y)};var l=[1,2,0],f=new Array(3);s.fromRotationMatrix=function(e,r){t.typeOf.object("matrix",e);var a,i,o,c,p,y=e[u.COLUMN0ROW0],h=e[u.COLUMN1ROW1],d=e[u.COLUMN2ROW2],m=y+h+d;if(m>0)a=Math.sqrt(m+1),p=.5*a,a=.5/a,i=(e[u.COLUMN1ROW2]-e[u.COLUMN2ROW1])*a,o=(e[u.COLUMN2ROW0]-e[u.COLUMN0ROW2])*a,c=(e[u.COLUMN0ROW1]-e[u.COLUMN1ROW0])*a;else{var E=l,O=0;h>y&&(O=1),d>y&&d>h&&(O=2);var T=E[O],_=E[T];a=Math.sqrt(e[u.getElementIndex(O,O)]-e[u.getElementIndex(T,T)]-e[u.getElementIndex(_,_)]+1);var v=f;v[O]=.5*a,a=.5/a,p=(e[u.getElementIndex(_,T)]-e[u.getElementIndex(T,_)])*a,v[T]=(e[u.getElementIndex(T,O)]+e[u.getElementIndex(O,T)])*a,v[_]=(e[u.getElementIndex(_,O)]+e[u.getElementIndex(O,_)])*a,i=-v[0],o=-v[1],c=-v[2]}return n(r)?(r.x=i,r.y=o,r.z=c,r.w=p,r):new s(i,o,c,p)};var p=new s,y=new s,h=new s,d=new s;s.fromHeadingPitchRoll=function(r,n){return t.typeOf.object("headingPitchRoll",r),d=s.fromAxisAngle(e.UNIT_X,r.roll,p),h=s.fromAxisAngle(e.UNIT_Y,-r.pitch,n),n=s.multiply(h,d,h),y=s.fromAxisAngle(e.UNIT_Z,-r.heading,p),s.multiply(y,n,n)};var m=new e,E=new e,O=new s,T=new s,_=new s;s.packedLength=4,s.pack=function(e,n,a){return t.typeOf.object("value",e),t.defined("array",n),a=r(a,0),n[a++]=e.x,n[a++]=e.y,n[a++]=e.z,n[a]=e.w,n},s.unpack=function(e,a,i){return t.defined("array",e),a=r(a,0),n(i)||(i=new s),i.x=e[a],i.y=e[a+1],i.z=e[a+2],i.w=e[a+3],i},s.packedInterpolationLength=3,s.convertPackedArrayForInterpolation=function(e,t,r,n){s.unpack(e,4*r,_),s.conjugate(_,_);for(var a=0,i=r-t+1;i>a;a++){var o=3*a;s.unpack(e,4*(t+a),O),s.multiply(O,_,O),O.w<0&&s.negate(O,O),s.computeAxis(O,m);var u=s.computeAngle(O);n[o]=m.x*u,n[o+1]=m.y*u,n[o+2]=m.z*u}},s.unpackInterpolationResult=function(t,r,a,i,o){n(o)||(o=new s),e.fromArray(t,0,E);var u=e.magnitude(E);return s.unpack(r,4*i,T),0===u?s.clone(s.IDENTITY,O):s.fromAxisAngle(E,u,O),s.multiply(O,T,o)},s.clone=function(e,t){return n(e)?n(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new s(e.x,e.y,e.z,e.w):void 0},s.conjugate=function(e,r){return t.typeOf.object("quaternion",e),t.typeOf.object("result",r),r.x=-e.x,r.y=-e.y,r.z=-e.z,r.w=e.w,r},s.magnitudeSquared=function(e){return t.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},s.magnitude=function(e){return Math.sqrt(s.magnitudeSquared(e))},s.normalize=function(e,r){t.typeOf.object("result",r);var n=1/s.magnitude(e),a=e.x*n,i=e.y*n,o=e.z*n,u=e.w*n;return r.x=a,r.y=i,r.z=o,r.w=u,r},s.inverse=function(e,r){t.typeOf.object("result",r);var n=s.magnitudeSquared(e);return r=s.conjugate(e,r),s.multiplyByScalar(r,1/n,r)},s.add=function(e,r,n){return t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n),n.x=e.x+r.x,n.y=e.y+r.y,n.z=e.z+r.z,n.w=e.w+r.w,n},s.subtract=function(e,r,n){return t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n),n.x=e.x-r.x,n.y=e.y-r.y,n.z=e.z-r.z,n.w=e.w-r.w,n},s.negate=function(e,r){return t.typeOf.object("quaternion",e),t.typeOf.object("result",r),r.x=-e.x,r.y=-e.y,r.z=-e.z,r.w=-e.w,r},s.dot=function(e,r){return t.typeOf.object("left",e),t.typeOf.object("right",r),e.x*r.x+e.y*r.y+e.z*r.z+e.w*r.w},s.multiply=function(e,r,n){t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n);var a=e.x,i=e.y,o=e.z,u=e.w,s=r.x,c=r.y,l=r.z,f=r.w,p=u*s+a*f+i*l-o*c,y=u*c-a*l+i*f+o*s,h=u*l+a*c-i*s+o*f,d=u*f-a*s-i*c-o*l;return n.x=p,n.y=y,n.z=h,n.w=d,n},s.multiplyByVec=function(t,r,n){var a=new e,i=new e,o=new e(t.x,t.y,t.z);a=e.cross(o,r,a),i=e.cross(o,a,i);var u=new e;u=e.multiplyByScalar(a,2*t.w,u);var s=new e;return s=e.multiplyByScalar(a,2,s),n=e.add(r,u,n),n=e.add(n,s,n)},s.multiplyByScalar=function(e,r,n){return t.typeOf.object("quaternion",e),t.typeOf.number("scalar",r),t.typeOf.object("result",n),n.x=e.x*r,n.y=e.y*r,n.z=e.z*r,n.w=e.w*r,n},s.divideByScalar=function(e,r,n){return t.typeOf.object("quaternion",e),t.typeOf.number("scalar",r),t.typeOf.object("result",n),n.x=e.x/r,n.y=e.y/r,n.z=e.z/r,n.w=e.w/r,n},s.computeAxis=function(e,r){t.typeOf.object("quaternion",e),t.typeOf.object("result",r);var n=e.w;if(Math.abs(n-1)i&&(i=-i,u=b=s.negate(r,b)),1-iU;++U){var F=U+1,D=2*F+1;M[U]=1/(F*D),C[U]=F/D}return M[7]=I/136,C[7]=8*I/17,s.fastSlerp=function(e,r,n,a){t.typeOf.object("start",e),t.typeOf.object("end",r),t.typeOf.number("t",n),t.typeOf.object("result",a);var i,o=s.dot(e,r);o>=0?i=1:(i=-1,o=-o);for(var u=o-1,c=1-n,l=n*n,f=c*c,p=7;p>=0;--p)P[p]=(M[p]*l-C[p])*u,L[p]=(M[p]*f-C[p])*u;var y=i*n*(1+P[0]*(1+P[1]*(1+P[2]*(1+P[3]*(1+P[4]*(1+P[5]*(1+P[6]*(1+P[7])))))))),h=c*(1+L[0]*(1+L[1]*(1+L[2]*(1+L[3]*(1+L[4]*(1+L[5]*(1+L[6]*(1+L[7])))))))),d=s.multiplyByScalar(e,h,x);return s.multiplyByScalar(r,y,a),s.add(d,a,a)},s.fastSquad=function(e,r,n,a,i,o){t.typeOf.object("q0",e),t.typeOf.object("q1",r),t.typeOf.object("s0",n),t.typeOf.object("s1",a),t.typeOf.number("t",i),t.typeOf.object("result",o);var u=s.fastSlerp(e,r,i,N),c=s.fastSlerp(n,a,i,S);return s.fastSlerp(u,c,2*i*(1-i),o)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},s.equalsEpsilon=function(e,r,a){return t.typeOf.number("epsilon",a),e===r||n(e)&&n(r)&&Math.abs(e.x-r.x)<=a&&Math.abs(e.y-r.y)<=a&&Math.abs(e.z-r.z)<=a&&Math.abs(e.w-r.w)<=a},s.ZERO=i(new s(0,0,0,0)),s.IDENTITY=i(new s(0,0,0,1)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},s}),define("Core/Matrix2",["./Cartesian2","./Check","./defaultValue","./defined","./defineProperties","./freezeObject"],function(e,t,r,n,a,i){"use strict";function o(e,t,n,a){this[0]=r(e,0),this[1]=r(n,0),this[2]=r(t,0),this[3]=r(a,0)}o.packedLength=4,o.pack=function(e,n,a){return t.typeOf.object("value",e),t.defined("array",n),a=r(a,0),n[a++]=e[0],n[a++]=e[1],n[a++]=e[2],n[a++]=e[3],n},o.unpack=function(e,a,i){return t.defined("array",e),a=r(a,0),n(i)||(i=new o),i[0]=e[a++],i[1]=e[a++],i[2]=e[a++],i[3]=e[a++],i},o.clone=function(e,t){return n(e)?n(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new o(e[0],e[2],e[1],e[3]):void 0},o.fromArray=function(e,a,i){return t.defined("array",e),a=r(a,0),n(i)||(i=new o),i[0]=e[a],i[1]=e[a+1],i[2]=e[a+2],i[3]=e[a+3],i},o.fromColumnMajorArray=function(e,r){return t.defined("values",e),o.clone(e,r)},o.fromRowMajorArray=function(e,r){return t.defined("values",e),n(r)?(r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3],r):new o(e[0],e[1],e[2],e[3])},o.fromScale=function(e,r){return t.typeOf.object("scale",e),n(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=e.y,r):new o(e.x,0,0,e.y)},o.fromUniformScale=function(e,r){return t.typeOf.number("scale",e),n(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=e,r):new o(e,0,0,e)},o.fromRotation=function(e,r){t.typeOf.number("angle",e);var a=Math.cos(e),i=Math.sin(e);return n(r)?(r[0]=a,r[1]=i,r[2]=-i,r[3]=a,r):new o(a,-i,i,a)},o.toArray=function(e,r){return t.typeOf.object("matrix",e),n(r)?(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r):[e[0],e[1],e[2],e[3]]},o.getElementIndex=function(e,r){return t.typeOf.number.greaterThanOrEquals("row",r,0),t.typeOf.number.lessThanOrEquals("row",r,1),t.typeOf.number.greaterThanOrEquals("column",e,0),t.typeOf.number.lessThanOrEquals("column",e,1),2*e+r},o.getColumn=function(e,r,n){t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,1),t.typeOf.object("result",n);var a=2*r,i=e[a],o=e[a+1];return n.x=i,n.y=o,n},o.setColumn=function(e,r,n,a){t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,1),t.typeOf.object("cartesian",n),t.typeOf.object("result",a),a=o.clone(e,a);var i=2*r;return a[i]=n.x,a[i+1]=n.y,a},o.getRow=function(e,r,n){t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,1),t.typeOf.object("result",n);var a=e[r],i=e[r+2];return n.x=a,n.y=i,n},o.setRow=function(e,r,n,a){return t.typeOf.object("matrix",e),t.typeOf.number.greaterThanOrEquals("index",r,0),t.typeOf.number.lessThanOrEquals("index",r,1),t.typeOf.object("cartesian",n),t.typeOf.object("result",a),a=o.clone(e,a),a[r]=n.x,a[r+2]=n.y,a};var u=new e;o.getScale=function(r,n){return t.typeOf.object("matrix",r),t.typeOf.object("result",n),n.x=e.magnitude(e.fromElements(r[0],r[1],u)),n.y=e.magnitude(e.fromElements(r[2],r[3],u)),n};var s=new e;return o.getMaximumScale=function(t){return o.getScale(t,s),e.maximumComponent(s)},o.multiply=function(e,r,n){t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n);var a=e[0]*r[0]+e[2]*r[1],i=e[0]*r[2]+e[2]*r[3],o=e[1]*r[0]+e[3]*r[1],u=e[1]*r[2]+e[3]*r[3];return n[0]=a,n[1]=o,n[2]=i,n[3]=u,n},o.add=function(e,r,n){return t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n),n[0]=e[0]+r[0],n[1]=e[1]+r[1],n[2]=e[2]+r[2],n[3]=e[3]+r[3],n},o.subtract=function(e,r,n){return t.typeOf.object("left",e),t.typeOf.object("right",r),t.typeOf.object("result",n),n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],n[3]=e[3]-r[3],n},o.multiplyByVector=function(e,r,n){t.typeOf.object("matrix",e),t.typeOf.object("cartesian",r),t.typeOf.object("result",n);var a=e[0]*r.x+e[2]*r.y,i=e[1]*r.x+e[3]*r.y;return n.x=a,n.y=i,n},o.multiplyByScalar=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.number("scalar",r),t.typeOf.object("result",n),n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n},o.multiplyByScale=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.object("scale",r),t.typeOf.object("result",n),n[0]=e[0]*r.x,n[1]=e[1]*r.x,n[2]=e[2]*r.y,n[3]=e[3]*r.y,n},o.negate=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r},o.transpose=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],a=e[2],i=e[1],o=e[3];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r},o.abs=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r},o.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},o.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]},o.equalsEpsilon=function(e,r,a){return t.typeOf.number("epsilon",a),e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=a&&Math.abs(e[1]-r[1])<=a&&Math.abs(e[2]-r[2])<=a&&Math.abs(e[3]-r[3])<=a},o.IDENTITY=i(new o(1,0,0,1)),o.ZERO=i(new o(0,0,0,0)),o.COLUMN0ROW0=0,o.COLUMN0ROW1=1,o.COLUMN1ROW0=2,o.COLUMN1ROW1=3,a(o.prototype,{length:{get:function(){return o.packedLength}}}),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[0]+", "+this[2]+")\n("+this[1]+", "+this[3]+")"},o}),define("Core/RectangleGeometryLibrary",["./Cartesian3","./Cartographic","./defined","./DeveloperError","./GeographicProjection","./Math","./Matrix2","./Rectangle"],function(e,t,r,n,a,i,o,u){"use strict";function s(t,r,n,a,i,u,s){var c=Math.cos(r),l=a*c,f=n*c,p=Math.sin(r),d=a*p,O=n*p;h=E.project(t,h),h=e.subtract(h,m,h);var T=o.fromRotation(r,y);h=o.multiplyByVector(T,h,h),h=e.add(h,m,h),t=E.unproject(h,t),u-=1,s-=1;var _=t.latitude,v=_+u*O,b=_-l*s,w=_-l*s+u*O,R=Math.max(_,v,b,w),g=Math.min(_,v,b,w),A=t.longitude,N=A+u*f,S=A+s*d,x=A+s*d+u*f,I=Math.max(A,N,S,x),M=Math.min(A,N,S,x);return{north:R,south:g,east:I,west:M,granYCos:l,granYSin:d,granXCos:f,granXSin:O,nwCorner:t}}var c=Math.cos,l=Math.sin,f=Math.sqrt,p={};p.computePosition=function(e,t,n,a,i){var o=e.ellipsoid.radiiSquared,u=e.nwCorner,s=e.rectangle,p=u.latitude-e.granYCos*t+n*e.granXSin,y=c(p),h=l(p),d=o.z*h,m=u.longitude+t*e.granYSin+n*e.granXCos,E=y*c(m),O=y*l(m),T=o.x*E,_=o.y*O,v=f(T*E+_*O+d*h);if(a.x=T/v,a.y=_/v,a.z=d/v,r(e.vertexFormat)&&e.vertexFormat.st){var b=e.stNwCorner;r(b)?(p=b.latitude-e.stGranYCos*t+n*e.stGranXSin,m=b.longitude+t*e.stGranYSin+n*e.stGranXCos,i.x=(m-e.stWest)*e.lonScalar,i.y=(p-e.stSouth)*e.latScalar):(i.x=(m-s.west)*e.lonScalar,i.y=(p-s.south)*e.latScalar)}};var y=new o,h=new e,d=new t,m=new e,E=new a;return p.computeOptions=function(e,t,r,a){var o,c,l,f,p,y=e._granularity,h=e._ellipsoid,O=e._surfaceHeight,T=e._rotation,_=e._stRotation,v=e._extrudedHeight,b=t.east,w=t.west,R=t.north,g=t.south,A=R-g;w>b?(p=i.TWO_PI-w+b,o=Math.ceil(p/y)+1,c=Math.ceil(A/y)+1,l=p/(o-1),f=A/(c-1)):(p=b-w,o=Math.ceil(p/y)+1,c=Math.ceil(A/y)+1,l=p/(o-1),f=A/(c-1)),r=u.northwest(t,r);var N=u.center(t,d);(0!==T||0!==_)&&(N.longitudei.PI_OVER_TWO||g<-i.PI_OVER_TWO||g>i.PI_OVER_TWO)throw new n("Rotated rectangle is invalid. It crosses over either the north or south pole.");C.granYCos=P.granYCos,C.granYSin=P.granYSin,C.granXCos=P.granXCos,C.granXSin=P.granXSin,t.north=R,t.south=g,t.east=b,t.west=w}if(0!==_){T-=_,a=u.northwest(t,a);var L=s(a,T,l,f,N,o,c);C.stGranYCos=L.granYCos,C.stGranXCos=L.granXCos,C.stGranYSin=L.granYSin,C.stGranXSin=L.granXSin,C.stNwCorner=a,C.stWest=L.west,C.stSouth=L.south}return C},p}),define("Core/VertexFormat",["./defaultValue","./defined","./DeveloperError","./freezeObject"],function(e,t,r,n){"use strict";function a(t){t=e(t,e.EMPTY_OBJECT),this.position=e(t.position,!1),this.normal=e(t.normal,!1),this.st=e(t.st,!1),this.bitangent=e(t.bitangent,!1),this.tangent=e(t.tangent,!1),this.color=e(t.color,!1)}return a.POSITION_ONLY=n(new a({position:!0})),a.POSITION_AND_NORMAL=n(new a({position:!0,normal:!0})),a.POSITION_NORMAL_AND_ST=n(new a({position:!0,normal:!0,st:!0})),a.POSITION_AND_ST=n(new a({position:!0,st:!0})),a.POSITION_AND_COLOR=n(new a({position:!0,color:!0})),a.ALL=n(new a({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0})),a.DEFAULT=a.POSITION_NORMAL_AND_ST,a.packedLength=6,a.pack=function(n,a,i){if(!t(n))throw new r("value is required");if(!t(a))throw new r("array is required");return i=e(i,0),a[i++]=n.position?1:0,a[i++]=n.normal?1:0,a[i++]=n.st?1:0,a[i++]=n.tangent?1:0,a[i++]=n.bitangent?1:0,a[i]=n.color?1:0,a},a.unpack=function(n,i,o){if(!t(n))throw new r("array is required");return i=e(i,0),t(o)||(o=new a),o.position=1===n[i++],o.normal=1===n[i++],o.st=1===n[i++],o.tangent=1===n[i++],o.bitangent=1===n[i++],o.color=1===n[i],o},a.clone=function(e,r){return t(e)?(t(r)||(r=new a),r.position=e.position,r.normal=e.normal,r.st=e.st,r.tangent=e.tangent,r.bitangent=e.bitangent,r.color=e.color,r):void 0},a}),define("Core/RectangleGeometry",["./BoundingSphere","./Cartesian2","./Cartesian3","./Cartographic","./Check","./ComponentDatatype","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Geometry","./GeometryAttribute","./GeometryAttributes","./GeometryInstance","./GeometryPipeline","./IndexDatatype","./Math","./Matrix3","./PolygonPipeline","./PrimitiveType","./Quaternion","./Rectangle","./RectangleGeometryLibrary","./VertexFormat"],function(e,t,r,n,a,i,o,u,s,c,l,f,p,y,h,d,m,E,O,T,_,v,b,w,R){"use strict";function g(e,t){var r=new f({attributes:new y,primitiveType:_.TRIANGLES});return r.attributes.position=new p({componentDatatype:i.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(r.attributes.normal=new p({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(r.attributes.tangent=new p({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(r.attributes.bitangent=new p({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:t.bitangents})),r}function A(e,t,n,a){var i=e.length,o=t.normal?new Float32Array(i):void 0,u=t.tangent?new Float32Array(i):void 0,s=t.bitangent?new Float32Array(i):void 0,c=0,l=D,f=F,p=U;if(t.normal||t.tangent||t.bitangent)for(var y=0;i>y;y+=3){var h=r.fromArray(e,y,L),d=c+1,m=c+2;p=n.geodeticSurfaceNormal(h,p),(t.tangent||t.bitangent)&&(r.cross(r.UNIT_Z,p,f),O.multiplyByVector(a,f,f),r.normalize(f,f),t.bitangent&&r.normalize(r.cross(p,f,l),l)),t.normal&&(o[c]=p.x,o[d]=p.y,o[m]=p.z),t.tangent&&(u[c]=f.x,u[d]=f.y,u[m]=f.z),t.bitangent&&(s[c]=l.x,s[d]=l.y,s[m]=l.z),c+=3}return g(t,{positions:e,normals:o,tangents:u,bitangents:s})}function N(e,t,n){var a=e.length,i=t.normal?new Float32Array(a):void 0,o=t.tangent?new Float32Array(a):void 0,u=t.bitangent?new Float32Array(a):void 0,s=0,c=0,l=0,f=!0,p=D,y=F,h=U;if(t.normal||t.tangent||t.bitangent)for(var d=0;a>d;d+=6){var m=r.fromArray(e,d,L),O=r.fromArray(e,(d+6)%a,G);if(f){var T=r.fromArray(e,(d+3)%a,V);r.subtract(O,m,O),r.subtract(T,m,T),h=r.normalize(r.cross(T,O,h),h),f=!1}r.equalsEpsilon(O,m,E.EPSILON10)&&(f=!0),(t.tangent||t.bitangent)&&(p=n.geodeticSurfaceNormal(m,p),t.tangent&&(y=r.normalize(r.cross(p,h,y),y))),t.normal&&(i[s++]=h.x,i[s++]=h.y,i[s++]=h.z,i[s++]=h.x,i[s++]=h.y,i[s++]=h.z),t.tangent&&(o[c++]=y.x,o[c++]=y.y,o[c++]=y.z,o[c++]=y.x,o[c++]=y.y,o[c++]=y.z),t.bitangent&&(u[l++]=p.x,u[l++]=p.y,u[l++]=p.z,u[l++]=p.x,u[l++]=p.y,u[l++]=p.z)}return g(t,{positions:e,normals:i,tangents:o,bitangents:u})}function S(e){for(var t=e.vertexFormat,r=e.ellipsoid,n=e.size,a=e.height,o=e.width,u=t.position?new Float64Array(3*n):void 0,s=t.st?new Float32Array(2*n):void 0,c=0,l=0,f=L,y=z,h=Number.MAX_VALUE,d=Number.MAX_VALUE,E=-Number.MAX_VALUE,O=-Number.MAX_VALUE,T=0;a>T;++T)for(var _=0;o>_;++_)w.computePosition(e,T,_,f,y),u[c++]=f.x,u[c++]=f.y,u[c++]=f.z,t.st&&(s[l++]=y.x,s[l++]=y.y,h=Math.min(h,y.x),d=Math.min(d,y.y),E=Math.max(E,y.x),O=Math.max(O,y.y));if(t.st&&(0>h||0>d||E>1||O>1))for(var v=0;vx;++x){for(var I=0;o-1>I;++I){var M=N,C=M+o,P=C+1,U=M+1;g[S++]=M,g[S++]=C,g[S++]=U,g[S++]=U,g[S++]=C,g[S++]=P,++N}++N}return b.indices=g,t.st&&(b.attributes.st=new p({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:s})),b}function x(e,t,r,n,a){return e[t++]=n[r],e[t++]=n[r+1],e[t++]=n[r+2],e[t++]=a[r],e[t++]=a[r+1],e[t++]=a[r+2],e}function I(e,t,r,n){return e[t++]=n[r],e[t++]=n[r+1],e[t++]=n[r],e[t++]=n[r+1],e}function M(e){var t,n=e.shadowVolume,a=e.vertexFormat,o=e.surfaceHeight,u=e.extrudedHeight,s=Math.min(u,o),c=Math.max(u,o),l=e.height,f=e.width,y=e.ellipsoid;n&&(e.vertexFormat=R.clone(a,X),e.vertexFormat.normal=!0);var O=S(e);if(E.equalsEpsilon(s,c,E.EPSILON10))return O;var _=T.scaleToGeodeticHeight(O.attributes.position.values,c,y,!1);_=new Float64Array(_);var v=_.length,b=2*v,w=new Float64Array(b);w.set(_);var g=T.scaleToGeodeticHeight(O.attributes.position.values,s,y);w.set(g,v),O.attributes.position.values=w;var A,M,C=a.normal?new Float32Array(b):void 0,P=a.tangent?new Float32Array(b):void 0,L=a.bitangent?new Float32Array(b):void 0,U=a.st?new Float32Array(b/3*2):void 0;if(a.normal){for(M=O.attributes.normal.values,C.set(M),t=0;v>t;t++)M[t]=-M[t];C.set(M,v),O.attributes.normal.values=C}if(n){M=O.attributes.normal.values,a.normal||(O.attributes.normal=void 0);var F=new Float32Array(b);for(t=0;v>t;t++)M[t]=-M[t];F.set(M,v),O.attributes.extrudeDirection=new p({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:F})}if(a.tangent){var D=O.attributes.tangent.values;for(P.set(D),t=0;v>t;t++)D[t]=-D[t];P.set(D,v),O.attributes.tangent.values=P}if(a.bitangent){var B=O.attributes.bitangent.values;L.set(B),L.set(B,v),O.attributes.bitangent.values=L}a.st&&(A=O.attributes.st.values,U.set(A),U.set(A,v/3*2),O.attributes.st.values=U);var z=O.indices,j=z.length,q=v/3,W=m.createTypedArray(b/3,2*j);for(W.set(z),t=0;j>t;t+=3)W[t+j]=z[t+2]+q,W[t+1+j]=z[t+1]+q,W[t+2+j]=z[t]+q;O.indices=W;var H,Y=2*f+2*l-4,k=2*(Y+4),Z=new Float64Array(3*k),K=n?new Float32Array(3*k):void 0,Q=a.st?new Float32Array(2*k):void 0,J=0,$=0,ee=0,te=f*l;for(t=0;te>t;t+=f)H=3*t,Z=x(Z,J,H,_,g),J+=6,a.st&&(Q=I(Q,$,2*t,A),$+=4),n&&(ee+=3,K[ee++]=M[H],K[ee++]=M[H+1],K[ee++]=M[H+2]);for(t=te-f;te>t;t++)H=3*t,Z=x(Z,J,H,_,g),J+=6,a.st&&(Q=I(Q,$,2*t,A),$+=4),n&&(ee+=3,K[ee++]=M[H],K[ee++]=M[H+1],K[ee++]=M[H+2]);for(t=te-1;t>0;t-=f)H=3*t,Z=x(Z,J,H,_,g),J+=6,a.st&&(Q=I(Q,$,2*t,A),$+=4),n&&(ee+=3,K[ee++]=M[H],K[ee++]=M[H+1],K[ee++]=M[H+2]);for(t=f-1;t>=0;t--)H=3*t,Z=x(Z,J,H,_,g),J+=6,a.st&&(Q=I(Q,$,2*t,A),$+=4),n&&(ee+=3,K[ee++]=M[H],K[ee++]=M[H+1],K[ee++]=M[H+2]);var re=N(Z,a,y);a.st&&(re.attributes.st=new p({componentDatatype:i.FLOAT,componentsPerAttribute:2,values:Q})),n&&(re.attributes.extrudeDirection=new p({componentDatatype:i.FLOAT,componentsPerAttribute:3,values:K}));var ne,ae,ie,oe,ue=m.createTypedArray(k,6*Y);v=Z.length/3;var se=0;for(t=0;v-1>t;t+=2){ne=t,oe=(ne+2)%v;var ce=r.fromArray(Z,3*ne,G),le=r.fromArray(Z,3*oe,V);r.equalsEpsilon(ce,le,E.EPSILON10)||(ae=(ne+1)%v,ie=(ae+2)%v,ue[se++]=ne,ue[se++]=ae,ue[se++]=oe,ue[se++]=oe,ue[se++]=ae,ue[se++]=ie)}return re.indices=ue,re=d.combineInstances([new h({geometry:O}),new h({geometry:re})]),re[0]}function C(e,t,r){if(0===r)return b.clone(e);b.northeast(e,Z[0]),b.northwest(e,Z[1]),b.southeast(e,Z[2]),b.southwest(e,Z[3]),t.cartographicArrayToCartesianArray(Z,k);var n=t.geodeticSurfaceNormalCartographic(b.center(e,H));v.fromAxisAngle(n,r,Y),O.fromQuaternion(Y,W);for(var a=0;4>a;++a)O.multiplyByVector(W,k[a],k[a]);return t.cartesianArrayToCartographicArray(k,Z),b.fromCartographicArray(Z)}function P(e){e=o(e,o.EMPTY_OBJECT);var t=e.rectangle;if(a.typeOf.object("rectangle",t),b.validate(t),t.north