/**
 * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
 *
 * Copyright 2011-2015 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";var e=function(e){return void 0!==e};return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var r=Object.freeze;return e(r)||(r=function(e){return e}),r}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";var r=function(e,r){return void 0!==e?e:r};return r.EMPTY_OBJECT=e({}),r}),define("Core/DeveloperError",["./defined"],function(e){"use strict";var r=function(e){this.name="DeveloperError",this.message=e;var r;try{throw new Error}catch(t){r=t.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r.throwInstantiationError=function(){throw new r("This function defines an interface and should not be called directly.")},r}),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<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,r=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var t;for(this.mti==this.N+1&&this.init_genrand(5489),t=0;t<this.N-this.M;t++)e=this.mt[t]&this.UPPER_MASK|this.mt[t+1]&this.LOWER_MASK,this.mt[t]=this.mt[t+this.M]^e>>>1^r[1&e];for(;t<this.N-1;t++)e=this.mt[t]&this.UPPER_MASK|this.mt[t+1]&this.LOWER_MASK,this.mt[t]=this.mt[t+(this.M-this.N)]^e>>>1^r[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^r[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=2636928640&e<<7,e^=4022730752&e<<15,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,r,t,n){"use strict";var i={};i.EPSILON1=.1,i.EPSILON2=.01,i.EPSILON3=.001,i.EPSILON4=1e-4,i.EPSILON5=1e-5,i.EPSILON6=1e-6,i.EPSILON7=1e-7,i.EPSILON8=1e-8,i.EPSILON9=1e-9,i.EPSILON10=1e-10,i.EPSILON11=1e-11,i.EPSILON12=1e-12,i.EPSILON13=1e-13,i.EPSILON14=1e-14,i.EPSILON15=1e-15,i.EPSILON16=1e-16,i.EPSILON17=1e-17,i.EPSILON18=1e-18,i.EPSILON19=1e-19,i.EPSILON20=1e-20,i.GRAVITATIONALPARAMETER=3986004418e5,i.SOLAR_RADIUS=6955e5,i.LUNAR_RADIUS=1737400,i.SIXTY_FOUR_KILOBYTES=65536,i.sign=function(e){return e>0?1:0>e?-1:0},i.signNotZero=function(e){return 0>e?-1:1},i.toSNorm=function(e){return Math.round(255*(.5*i.clamp(e,-1,1)+.5))},i.fromSNorm=function(e){return 2*(i.clamp(e,0,255)/255)-1},i.sinh=function(e){var r=Math.pow(Math.E,e),t=Math.pow(Math.E,-1*e);return.5*(r-t)},i.cosh=function(e){var r=Math.pow(Math.E,e),t=Math.pow(Math.E,-1*e);return.5*(r+t)},i.lerp=function(e,r,t){return(1-t)*e+t*r},i.PI=Math.PI,i.ONE_OVER_PI=1/Math.PI,i.PI_OVER_TWO=.5*Math.PI,i.PI_OVER_THREE=Math.PI/3,i.PI_OVER_FOUR=Math.PI/4,i.PI_OVER_SIX=Math.PI/6,i.THREE_PI_OVER_TWO=.5*3*Math.PI,i.TWO_PI=2*Math.PI,i.ONE_OVER_TWO_PI=1/(2*Math.PI),i.RADIANS_PER_DEGREE=Math.PI/180,i.DEGREES_PER_RADIAN=180/Math.PI,i.RADIANS_PER_ARCSECOND=i.RADIANS_PER_DEGREE/3600,i.toRadians=function(e){if(!t(e))throw new n("degrees is required.");return e*i.RADIANS_PER_DEGREE},i.toDegrees=function(e){if(!t(e))throw new n("radians is required.");return e*i.DEGREES_PER_RADIAN},i.convertLongitudeRange=function(e){if(!t(e))throw new n("angle is required.");var r=i.TWO_PI,o=e-Math.floor(e/r)*r;return o<-Math.PI?o+r:o>=Math.PI?o-r:o},i.negativePiToPi=function(e){if(!t(e))throw new n("x is required.");return i.zeroToTwoPi(e+i.PI)-i.PI},i.zeroToTwoPi=function(e){if(!t(e))throw new n("x is required.");var r=i.mod(e,i.TWO_PI);return Math.abs(r)<i.EPSILON14&&Math.abs(e)>i.EPSILON14?i.TWO_PI:r},i.mod=function(e,r){if(!t(e))throw new n("m is required.");if(!t(r))throw new n("n is required.");return(e%r+r)%r},i.equalsEpsilon=function(e,i,o,a){if(!t(e))throw new n("left is required.");if(!t(i))throw new n("right is required.");if(!t(o))throw new n("relativeEpsilon is required.");a=r(a,o);var s=Math.abs(e-i);return a>=s||s<=o*Math.max(Math.abs(e),Math.abs(i))};var o=[1];i.factorial=function(e){if("number"!=typeof e||0>e)throw new n("A number greater than or equal to 0 is required.");var r=o.length;if(e>=r)for(var t=o[r-1],i=r;e>=i;i++)o.push(t*i);return o[e]},i.incrementWrap=function(e,i,o){if(o=r(o,0),!t(e))throw new n("n is required.");if(o>=i)throw new n("maximumValue must be greater than minimumValue.");return++e,e>i&&(e=o),e},i.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)},i.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},i.clamp=function(e,r,i){if(!t(e))throw new n("value is required");if(!t(r))throw new n("min is required.");if(!t(i))throw new n("max is required.");return r>e?r:e>i?i:e};var a=new e;return i.setRandomNumberSeed=function(r){if(!t(r))throw new n("seed is required.");a=new e(r)},i.nextRandomNumber=function(){return a.random()},i.acosClamped=function(e){if(!t(e))throw new n("value is required.");return Math.acos(i.clamp(e,-1,1))},i.asinClamped=function(e){if(!t(e))throw new n("value is required.");return Math.asin(i.clamp(e,-1,1))},i.chordLength=function(e,r){if(!t(e))throw new n("angle is required.");if(!t(r))throw new n("radius is required.");return 2*r*Math.sin(.5*e)},i}),define("Core/Cartesian3",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var o=function(r,t,n){this.x=e(r,0),this.y=e(t,0),this.z=e(n,0)};o.fromSpherical=function(n,i){if(!r(n))throw new t("spherical is required");r(i)||(i=new o);var a=n.clock,s=n.cone,u=e(n.magnitude,1),f=u*Math.sin(s);return i.x=f*Math.cos(a),i.y=f*Math.sin(a),i.z=u*Math.cos(s),i},o.fromElements=function(e,t,n,i){return r(i)?(i.x=e,i.y=t,i.z=n,i):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(n,i,o){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");o=e(o,0),i[o++]=n.x,i[o++]=n.y,i[o]=n.z},o.unpack=function(n,i,a){if(!r(n))throw new t("array is required");return i=e(i,0),r(a)||(a=new o),a.x=n[i++],a.y=n[i++],a.z=n[i],a},o.fromArray=o.unpack,o.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y,e.z)},o.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y,e.z)},o.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i.z=Math.min(e.z,n.z),i},o.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i.z=Math.max(e.z,n.z),i},o.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y+e.z*e.z},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return o.subtract(e,n,a),o.magnitude(a)},o.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return o.subtract(e,n,a),o.magnitudeSquared(a)},o.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=o.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n.z=e.z/i,n},o.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y+e.z*n.z},o.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i.z=e.z*n.z,i},o.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i.z=e.z+n.z,i},o.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i.z=e.z-n.z,i},o.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i},o.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i.z=e.z/n,i},o.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n.z=-e.z,n},o.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n};var s=new o;o.lerp=function(e,n,i,a){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(a))throw new t("result is required.");return o.multiplyByScalar(n,i,s),a=o.multiplyByScalar(e,1-i,a),o.add(s,a,a)};var u=new o,f=new o;o.angleBetween=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");o.normalize(e,u),o.normalize(n,f);var i=o.dot(u,f),a=o.magnitude(o.cross(u,f,u));return Math.atan2(a,i)};var l=new o;o.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=o.normalize(e,l);return o.abs(i,i),n=i.x<=i.y?i.x<=i.z?o.clone(o.UNIT_X,n):o.clone(o.UNIT_Z,n):i.y<=i.z?o.clone(o.UNIT_Y,n):o.clone(o.UNIT_Z,n)},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,r,t){return e.x===r[t]&&e.y===r[t+1]&&e.z===r[t+2]},o.equalsEpsilon=function(e,t,n,o){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,o)&&i.equalsEpsilon(e.y,t.y,n,o)&&i.equalsEpsilon(e.z,t.z,n,o)},o.cross=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");var o=e.x,a=e.y,s=e.z,u=n.x,f=n.y,l=n.z,c=a*l-s*f,h=s*u-o*l,d=o*f-a*u;return i.x=c,i.y=h,i.z=d,i},o.fromDegrees=function(e,n,a,s,u){if(!r(e))throw new t("longitude is required");if(!r(n))throw new t("latitude is required");var f=i.toRadians(e),l=i.toRadians(n);return o.fromRadians(f,l,a,s,u)};var c=new o,h=new o,d=new o(40680631590769,40680631590769,40408299984661.445);return o.fromRadians=function(n,i,a,s,u){if(!r(n))throw new t("longitude is required");if(!r(i))throw new t("latitude is required");a=e(a,0);var f=r(s)?s.radiiSquared:d,l=Math.cos(i);c.x=l*Math.cos(n),c.y=l*Math.sin(n),c.z=Math.sin(i),c=o.normalize(c,c),o.multiplyComponents(f,c,h);var w=Math.sqrt(o.dot(c,h));return h=o.divideByScalar(h,w,h),c=o.multiplyByScalar(c,a,c),r(u)||(u=new o),o.add(h,c,u)},o.fromDegreesArray=function(e,n,a){if(!r(e))throw new t("positions is required.");for(var s=new Array(e.length),u=0;u<e.length;u++)s[u]=i.toRadians(e[u]);return o.fromRadiansArray(s,n,a)},o.fromRadiansArray=function(e,n,i){if(!r(e))throw new t("positions is required.");if(e.length<2)throw new t("positions length cannot be less than 2.");if(0!==e.length%2)throw new t("positions length must be a multiple of 2.");var a=e.length;r(i)?i.length=a/2:i=new Array(a/2);for(var s=0;a>s;s+=2){var u=e[s],f=e[s+1];i[s/2]=o.fromRadians(u,f,0,n,i[s/2])}return i},o.fromDegreesArrayHeights=function(e,n,a){if(!r(e))throw new t("positions is required.");if(e.length<3)throw new t("positions length cannot be less than 3.");if(0!==e.length%3)throw new t("positions length must be a multiple of 3.");for(var s=new Array(e.length),u=0;u<e.length;u+=3)s[u]=i.toRadians(e[u]),s[u+1]=i.toRadians(e[u+1]),s[u+2]=e[u+2];return o.fromRadiansArrayHeights(s,n,a)},o.fromRadiansArrayHeights=function(e,n,i){if(!r(e))throw new t("positions is required.");if(e.length<3)throw new t("positions length cannot be less than 3.");if(0!==e.length%3)throw new t("positions length must be a multiple of 3.");var a=e.length;r(i)?i.length=a/3:i=new Array(a/3);for(var s=0;a>s;s+=3){var u=e[s],f=e[s+1],l=e[s+2];i[s/3]=o.fromRadians(u,f,l,n,i[s/3])}return i},o.ZERO=n(new o(0,0,0)),o.UNIT_X=n(new o(1,0,0)),o.UNIT_Y=n(new o(0,1,0)),o.UNIT_Z=n(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,r,t){return o.equalsEpsilon(this,e,r,t)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},o}),define("Core/Cartographic",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var o=function(r,t,n){this.longitude=e(r,0),this.latitude=e(t,0),this.height=e(n,0)};return o.fromRadians=function(n,i,a,s){if(!r(n))throw new t("longitude is required.");if(!r(i))throw new t("latitude is required.");return a=e(a,0),r(s)?(s.longitude=n,s.latitude=i,s.height=a,s):new o(n,i,a)},o.fromDegrees=function(e,n,a,s){if(!r(e))throw new t("longitude is required.");if(!r(n))throw new t("latitude is required.");return e=i.toRadians(e),n=i.toRadians(n),o.fromRadians(e,n,a,s)},o.clone=function(e,t){return r(e)?r(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new o(e.longitude,e.latitude,e.height):void 0},o.equals=function(e,t){return e===t||r(e)&&r(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},o.equalsEpsilon=function(e,n,i){if("number"!=typeof i)throw new t("epsilon is required and must be a number.");return e===n||r(e)&&r(n)&&Math.abs(e.longitude-n.longitude)<=i&&Math.abs(e.latitude-n.latitude)<=i&&Math.abs(e.height-n.height)<=i},o.ZERO=n(new o(0,0,0)),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,r){return o.equalsEpsilon(this,e,r)},o.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},o}),define("Core/defineProperties",["./defined"],function(e){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),t=Object.defineProperties;return r&&e(t)||(t=function(e){return e}),t}),define("Core/Ellipsoid",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i,o,a,s){"use strict";function u(r,n,i,a){if(n=t(n,0),i=t(i,0),a=t(a,0),0>n||0>i||0>a)throw new o("All radii components must be greater than or equal to zero.");r._radii=new e(n,i,a),r._radiiSquared=new e(n*n,i*i,a*a),r._radiiToTheFourth=new e(n*n*n*n,i*i*i*i,a*a*a*a),r._oneOverRadii=new e(0===n?0:1/n,0===i?0:1/i,0===a?0:1/a),r._oneOverRadiiSquared=new e(0===n?0:1/(n*n),0===i?0:1/(i*i),0===a?0:1/(a*a)),r._minimumRadius=Math.min(n,i,a),r._maximumRadius=Math.max(n,i,a),r._centerToleranceSquared=s.EPSILON1}var f=function(e,r,t){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,u(this,e,r,t)};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(r,t){if(!n(r))return void 0;var i=r._radii;return n(t)?(e.clone(i,t._radii),e.clone(r._radiiSquared,t._radiiSquared),e.clone(r._radiiToTheFourth,t._radiiToTheFourth),e.clone(r._oneOverRadii,t._oneOverRadii),e.clone(r._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=r._minimumRadius,t._maximumRadius=r._maximumRadius,t._centerToleranceSquared=r._centerToleranceSquared,t):new f(i.x,i.y,i.z)},f.fromCartesian3=function(e,r){return n(r)||(r=new f),n(e)?(u(r,e.x,e.y,e.z),r):r},f.WGS84=a(new f(6378137,6378137,6356752.314245179)),f.UNIT_SPHERE=a(new f(1,1,1)),f.MOON=a(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(r,i,a){if(!n(r))throw new o("value is required");if(!n(i))throw new o("array is required");a=t(a,0),e.pack(r._radii,i,a)},f.unpack=function(r,i,a){if(!n(r))throw new o("array is required");i=t(i,0);var s=e.unpack(r,i);return f.fromCartesian3(s,a)},f.prototype.geocentricSurfaceNormal=e.normalize,f.prototype.geodeticSurfaceNormalCartographic=function(r,t){if(!n(r))throw new o("cartographic is required.");var i=r.longitude,a=r.latitude,s=Math.cos(a),u=s*Math.cos(i),f=s*Math.sin(i),l=Math.sin(a);return n(t)||(t=new e),t.x=u,t.y=f,t.z=l,e.normalize(t,t)},f.prototype.geodeticSurfaceNormal=function(r,t){return n(t)||(t=new e),t=e.multiplyComponents(r,this._oneOverRadiiSquared,t),e.normalize(t,t)};var l=new e,c=new e;f.prototype.cartographicToCartesian=function(r,t){var i=l,o=c;this.geodeticSurfaceNormalCartographic(r,i),e.multiplyComponents(this._radiiSquared,i,o);var a=Math.sqrt(e.dot(i,o));return e.divideByScalar(o,a,o),e.multiplyByScalar(i,r.height,i),n(t)||(t=new e),e.add(o,i,t)},f.prototype.cartographicArrayToCartesianArray=function(e,r){if(!n(e))throw new o("cartographics is required.");var t=e.length;n(r)?r.length=t:r=new Array(t);for(var i=0;t>i;i++)r[i]=this.cartographicToCartesian(e[i],r[i]);return r};var h=new e,d=new e,w=new e;f.prototype.cartesianToCartographic=function(t,i){var o=this.scaleToGeodeticSurface(t,d);if(!n(o))return void 0;var a=this.geodeticSurfaceNormal(o,h),u=e.subtract(t,o,w),f=Math.atan2(a.y,a.x),l=Math.asin(a.z),c=s.sign(e.dot(u,t))*e.magnitude(u);return n(i)?(i.longitude=f,i.latitude=l,i.height=c,i):new r(f,l,c)},f.prototype.cartesianArrayToCartographicArray=function(e,r){if(!n(e))throw new o("cartesians is required.");var t=e.length;n(r)?r.length=t:r=new Array(t);for(var i=0;t>i;++i)r[i]=this.cartesianToCartographic(e[i],r[i]);return r};var m=new e,p=new e;return f.prototype.scaleToGeodeticSurface=function(r,t){if(!n(r))throw new o("cartesian is required.");var i=r.x,a=r.y,u=r.z,f=this._oneOverRadii,l=f.x,c=f.y,h=f.z,d=i*i*l*l,w=a*a*c*c,y=u*u*h*h,v=d+w+y,g=Math.sqrt(1/v),b=e.multiplyByScalar(r,g,m);if(v<this._centerToleranceSquared)return isFinite(g)?e.clone(b,t):void 0;var E=this._oneOverRadiiSquared,q=E.x,S=E.y,C=E.z,x=p;x.x=2*b.x*q,x.y=2*b.y*S,x.z=2*b.z*C;var A,T,I,M,O,R,N,P,L,z,D,F=(1-g)*e.magnitude(r)/(.5*e.magnitude(x)),_=0;do{F-=_,I=1/(1+F*q),M=1/(1+F*S),O=1/(1+F*C),R=I*I,N=M*M,P=O*O,L=R*I,z=N*M,D=P*O,A=d*R+w*N+y*P-1,T=d*L*q+w*z*S+y*D*C;var B=-2*T;_=A/B}while(Math.abs(A)>s.EPSILON12);return n(t)?(t.x=i*I,t.y=a*M,t.z=u*O,t):new e(i*I,a*M,u*O)},f.prototype.scaleToGeocentricSurface=function(r,t){if(!n(r))throw new o("cartesian is required.");n(t)||(t=new e);var i=r.x,a=r.y,s=r.z,u=this._oneOverRadiiSquared,f=1/Math.sqrt(i*i*u.x+a*a*u.y+s*s*u.z);return e.multiplyByScalar(r,f,t)},f.prototype.transformPositionToScaledSpace=function(r,t){return n(t)||(t=new e),e.multiplyComponents(r,this._oneOverRadii,t)},f.prototype.transformPositionFromScaledSpace=function(r,t){return n(t)||(t=new e),e.multiplyComponents(r,this._radii,t)},f.prototype.equals=function(r){return this===r||n(r)&&e.equals(this._radii,r._radii)},f.prototype.toString=function(){return this._radii.toString()},f}),define("Core/GeographicProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid"],function(e,r,t,n,i,o,a){"use strict";var s=function(e){this._ellipsoid=t(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(s.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),s.prototype.project=function(r,t){var i=this._semimajorAxis,o=r.longitude*i,a=r.latitude*i,s=r.height;return n(t)?(t.x=o,t.y=a,t.z=s,t):new e(o,a,s)},s.prototype.unproject=function(e,t){if(!n(e))throw new o("cartesian is required");var i=this._oneOverSemimajorAxis,a=e.x*i,s=e.y*i,u=e.z;return n(t)?(t.longitude=a,t.latitude=s,t.height=u,t):new r(a,s,u)},s}),define("Core/Intersect",["./freezeObject"],function(e){"use strict";var r={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};return e(r)}),define("Core/Interval",["./defaultValue"],function(e){"use strict";var r=function(r,t){this.start=e(r,0),this.stop=e(t,0)};return r}),define("Core/Cartesian4",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var o=function(r,t,n,i){this.x=e(r,0),this.y=e(t,0),this.z=e(n,0),this.w=e(i,0)};o.fromElements=function(e,t,n,i,a){return r(a)?(a.x=e,a.y=t,a.z=n,a.w=i,a):new o(e,t,n,i)},o.fromColor=function(e,n){if(!r(e))throw new t("color is required");return r(n)?(n.x=e.red,n.y=e.green,n.z=e.blue,n.w=e.alpha,n):new o(e.red,e.green,e.blue,e.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(n,i,o){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");o=e(o,0),i[o++]=n.x,i[o++]=n.y,i[o++]=n.z,i[o]=n.w},o.unpack=function(n,i,a){if(!r(n))throw new t("array is required");return i=e(i,0),r(a)||(a=new o),a.x=n[i++],a.y=n[i++],a.z=n[i++],a.w=n[i],a},o.fromArray=o.unpack,o.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y,e.z,e.w)},o.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y,e.z,e.w)},o.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i.z=Math.min(e.z,n.z),i.w=Math.min(e.w,n.w),i},o.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i.z=Math.max(e.z,n.z),i.w=Math.max(e.w,n.w),i},o.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return o.subtract(e,n,a),o.magnitude(a)},o.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return o.subtract(e,n,a),o.magnitudeSquared(a)},o.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=o.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n.z=e.z/i,n.w=e.w/i,n},o.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y+e.z*n.z+e.w*n.w},o.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i.z=e.z*n.z,i.w=e.w*n.w,i},o.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i.z=e.z+n.z,i.w=e.w+n.w,i},o.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i.z=e.z-n.z,i.w=e.w-n.w,i},o.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i.z=e.z*n,i.w=e.w*n,i},o.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i.z=e.z/n,i.w=e.w/n,i},o.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n.z=-e.z,n.w=-e.w,n},o.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n.w=Math.abs(e.w),n};var s=new o;o.lerp=function(e,n,i,a){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(a))throw new t("result is required.");return o.multiplyByScalar(n,i,s),a=o.multiplyByScalar(e,1-i,a),o.add(s,a,a)};var u=new o;return o.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=o.normalize(e,u);return o.abs(i,i),n=i.x<=i.y?i.x<=i.z?i.x<=i.w?o.clone(o.UNIT_X,n):o.clone(o.UNIT_W,n):i.z<=i.w?o.clone(o.UNIT_Z,n):o.clone(o.UNIT_W,n):i.y<=i.z?i.y<=i.w?o.clone(o.UNIT_Y,n):o.clone(o.UNIT_W,n):i.z<=i.w?o.clone(o.UNIT_Z,n):o.clone(o.UNIT_W,n)},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,r,t){return e.x===r[t]&&e.y===r[t+1]&&e.z===r[t+2]&&e.w===r[t+3]},o.equalsEpsilon=function(e,t,n,o){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,o)&&i.equalsEpsilon(e.y,t.y,n,o)&&i.equalsEpsilon(e.z,t.z,n,o)&&i.equalsEpsilon(e.w,t.w,n,o)},o.ZERO=n(new o(0,0,0,0)),o.UNIT_X=n(new o(1,0,0,0)),o.UNIT_Y=n(new o(0,1,0,0)),o.UNIT_Z=n(new o(0,0,1,0)),o.UNIT_W=n(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,r,t){return o.equalsEpsilon(this,e,r,t)},o.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},o}),define("Core/Matrix3",["./Cartesian3","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i,o){"use strict";function a(e){for(var r=0,t=0;9>t;++t){var n=e[t];r+=n*n}return Math.sqrt(r)}function s(e){for(var r=0,t=0;3>t;++t){var n=e[f.getElementIndex(d[t],h[t])];r+=2*n*n}return Math.sqrt(r)}function u(e,r){for(var t=o.EPSILON15,n=0,i=1,a=0;3>a;++a){var s=Math.abs(e[f.getElementIndex(d[a],h[a])]);s>n&&(i=a,n=s)}var u=1,l=0,c=h[i],w=d[i];if(Math.abs(e[f.getElementIndex(w,c)])>t){var m,p=e[f.getElementIndex(w,w)],y=e[f.getElementIndex(c,c)],v=e[f.getElementIndex(w,c)],g=(p-y)/2/v;m=0>g?-1/(-g+Math.sqrt(1+g*g)):1/(g+Math.sqrt(1+g*g)),u=1/Math.sqrt(1+m*m),l=m*u}return r=f.clone(f.IDENTITY,r),r[f.getElementIndex(c,c)]=r[f.getElementIndex(w,w)]=u,r[f.getElementIndex(w,c)]=l,r[f.getElementIndex(c,w)]=-l,r}var f=function(e,t,n,i,o,a,s,u,f){this[0]=r(e,0),this[1]=r(i,0),this[2]=r(s,0),this[3]=r(t,0),this[4]=r(o,0),this[5]=r(u,0),this[6]=r(n,0),this[7]=r(a,0),this[8]=r(f,0)};f.packedLength=9,f.pack=function(e,i,o){if(!t(e))throw new n("value is required");if(!t(i))throw new n("array is required");o=r(o,0),i[o++]=e[0],i[o++]=e[1],i[o++]=e[2],i[o++]=e[3],i[o++]=e[4],i[o++]=e[5],i[o++]=e[6],i[o++]=e[7],i[o++]=e[8]},f.unpack=function(e,i,o){if(!t(e))throw new n("array is required");return i=r(i,0),t(o)||(o=new f),o[0]=e[i++],o[1]=e[i++],o[2]=e[i++],o[3]=e[i++],o[4]=e[i++],o[5]=e[i++],o[6]=e[i++],o[7]=e[i++],o[8]=e[i++],o},f.clone=function(e,r){return t(e)?t(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):new f(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]):void 0},f.fromArray=function(e,i,o){if(!t(e))throw new n("array is required");return i=r(i,0),t(o)||(o=new f),o[0]=e[i],o[1]=e[i+1],o[2]=e[i+2],o[3]=e[i+3],o[4]=e[i+4],o[5]=e[i+5],o[6]=e[i+6],o[7]=e[i+7],o[8]=e[i+8],o},f.fromColumnMajorArray=function(e,r){if(!t(e))throw new n("values parameter is required");return f.clone(e,r)},f.fromRowMajorArray=function(e,r){if(!t(e))throw new n("values is required.");return t(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 f(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},f.fromQuaternion=function(e,r){if(!t(e))throw new n("quaternion is required");var i=e.x*e.x,o=e.x*e.y,a=e.x*e.z,s=e.x*e.w,u=e.y*e.y,l=e.y*e.z,c=e.y*e.w,h=e.z*e.z,d=e.z*e.w,w=e.w*e.w,m=i-u-h+w,p=2*(o-d),y=2*(a+c),v=2*(o+d),g=-i+u-h+w,b=2*(l-s),E=2*(a-c),q=2*(l+s),S=-i-u+h+w;return t(r)?(r[0]=m,r[1]=v,r[2]=E,r[3]=p,r[4]=g,r[5]=q,r[6]=y,r[7]=b,r[8]=S,r):new f(m,p,y,v,g,b,E,q,S)},f.fromScale=function(e,r){if(!t(e))throw new n("scale is required.");return t(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 f(e.x,0,0,0,e.y,0,0,0,e.z)},f.fromUniformScale=function(e,r){if("number"!=typeof e)throw new n("scale is required.");return t(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 f(e,0,0,0,e,0,0,0,e)},f.fromCrossProduct=function(e,r){if(!t(e))throw new n("vector is required.");return t(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 f(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},f.fromRotationX=function(e,r){if(!t(e))throw new n("angle is required.");var i=Math.cos(e),o=Math.sin(e);return t(r)?(r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=i,r[5]=o,r[6]=0,r[7]=-o,r[8]=i,r):new f(1,0,0,0,i,-o,0,o,i)},f.fromRotationY=function(e,r){if(!t(e))throw new n("angle is required.");var i=Math.cos(e),o=Math.sin(e);return t(r)?(r[0]=i,r[1]=0,r[2]=-o,r[3]=0,r[4]=1,r[5]=0,r[6]=o,r[7]=0,r[8]=i,r):new f(i,0,o,0,1,0,-o,0,i)},f.fromRotationZ=function(e,r){if(!t(e))throw new n("angle is required.");var i=Math.cos(e),o=Math.sin(e);return t(r)?(r[0]=i,r[1]=o,r[2]=0,r[3]=-o,r[4]=i,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r):new f(i,-o,0,o,i,0,0,0,1)},f.toArray=function(e,r){if(!t(e))throw new n("matrix is required");return t(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]]},f.getElementIndex=function(e,r){if("number"!=typeof r||0>r||r>2)throw new n("row must be 0, 1, or 2.");if("number"!=typeof e||0>e||e>2)throw new n("column must be 0, 1, or 2.");return 3*e+r},f.getColumn=function(e,r,i){if(!t(e))throw new n("matrix is required.");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");if(!t(i))throw new n("result is required");var o=3*r,a=e[o],s=e[o+1],u=e[o+2];return i.x=a,i.y=s,i.z=u,i},f.setColumn=function(e,r,i,o){if(!t(e))throw new n("matrix is required");if(!t(i))throw new n("cartesian is required");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");if(!t(o))throw new n("result is required");o=f.clone(e,o);var a=3*r;return o[a]=i.x,o[a+1]=i.y,o[a+2]=i.z,o},f.getRow=function(e,r,i){if(!t(e))throw new n("matrix is required.");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");if(!t(i))throw new n("result is required");var o=e[r],a=e[r+3],s=e[r+6];return i.x=o,i.y=a,i.z=s,i},f.setRow=function(e,r,i,o){if(!t(e))throw new n("matrix is required");if(!t(i))throw new n("cartesian is required");if("number"!=typeof r||0>r||r>2)throw new n("index must be 0, 1, or 2.");
if(!t(o))throw new n("result is required");return o=f.clone(e,o),o[r]=i.x,o[r+3]=i.y,o[r+6]=i.z,o};var l=new e;f.getScale=function(r,i){if(!t(r))throw new n("matrix is required.");if(!t(i))throw new n("result is required");return i.x=e.magnitude(e.fromElements(r[0],r[1],r[2],l)),i.y=e.magnitude(e.fromElements(r[3],r[4],r[5],l)),i.z=e.magnitude(e.fromElements(r[6],r[7],r[8],l)),i};var c=new e;f.getMaximumScale=function(r){return f.getScale(r,c),e.maximumComponent(c)},f.multiply=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");var o=e[0]*r[0]+e[3]*r[1]+e[6]*r[2],a=e[1]*r[0]+e[4]*r[1]+e[7]*r[2],s=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],f=e[1]*r[3]+e[4]*r[4]+e[7]*r[5],l=e[2]*r[3]+e[5]*r[4]+e[8]*r[5],c=e[0]*r[6]+e[3]*r[7]+e[6]*r[8],h=e[1]*r[6]+e[4]*r[7]+e[7]*r[8],d=e[2]*r[6]+e[5]*r[7]+e[8]*r[8];return i[0]=o,i[1]=a,i[2]=s,i[3]=u,i[4]=f,i[5]=l,i[6]=c,i[7]=h,i[8]=d,i},f.add=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i[3]=e[3]+r[3],i[4]=e[4]+r[4],i[5]=e[5]+r[5],i[6]=e[6]+r[6],i[7]=e[7]+r[7],i[8]=e[8]+r[8],i},f.subtract=function(e,r,i){if(!t(e))throw new n("left is required");if(!t(r))throw new n("right is required");if(!t(i))throw new n("result is required");return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i[3]=e[3]-r[3],i[4]=e[4]-r[4],i[5]=e[5]-r[5],i[6]=e[6]-r[6],i[7]=e[7]-r[7],i[8]=e[8]-r[8],i},f.multiplyByVector=function(e,r,i){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("cartesian is required");if(!t(i))throw new n("result is required");var o=r.x,a=r.y,s=r.z,u=e[0]*o+e[3]*a+e[6]*s,f=e[1]*o+e[4]*a+e[7]*s,l=e[2]*o+e[5]*a+e[8]*s;return i.x=u,i.y=f,i.z=l,i},f.multiplyByScalar=function(e,r,i){if(!t(e))throw new n("matrix is required");if("number"!=typeof r)throw new n("scalar must be a number");if(!t(i))throw new n("result is required");return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i[3]=e[3]*r,i[4]=e[4]*r,i[5]=e[5]*r,i[6]=e[6]*r,i[7]=e[7]*r,i[8]=e[8]*r,i},f.negate=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");return 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},f.transpose=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");var i=e[0],o=e[3],a=e[6],s=e[1],u=e[4],f=e[7],l=e[2],c=e[5],h=e[8];return r[0]=i,r[1]=o,r[2]=a,r[3]=s,r[4]=u,r[5]=f,r[6]=l,r[7]=c,r[8]=h,r};var h=[1,0,0],d=[2,2,1],w=new f,m=new f;return f.computeEigenDecomposition=function(e,r){if(!t(e))throw new n("matrix is required.");var i=o.EPSILON20,l=10,c=0,h=0;t(r)||(r={});for(var d=r.unitary=f.clone(f.IDENTITY,r.unitary),p=r.diagonal=f.clone(e,r.diagonal),y=i*a(p);l>h&&s(p)>y;)u(p,w),f.transpose(w,m),f.multiply(p,w,p),f.multiply(m,p,p),f.multiply(d,w,d),++c>2&&(++h,c=0);return r},f.abs=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");return 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},f.determinant=function(e){if(!t(e))throw new n("matrix is required");var r=e[0],i=e[3],o=e[6],a=e[1],s=e[4],u=e[7],f=e[2],l=e[5],c=e[8];return r*(s*c-l*u)+a*(l*o-i*c)+f*(i*u-s*o)},f.inverse=function(e,r){if(!t(e))throw new n("matrix is required");if(!t(r))throw new n("result is required");var i=e[0],a=e[1],s=e[2],u=e[3],l=e[4],c=e[5],h=e[6],d=e[7],w=e[8],m=f.determinant(e);if(Math.abs(m)<=o.EPSILON15)throw new n("matrix is not invertible");r[0]=l*w-d*c,r[1]=d*s-a*w,r[2]=a*c-l*s,r[3]=h*c-u*w,r[4]=i*w-h*s,r[5]=u*s-i*c,r[6]=u*d-h*l,r[7]=h*a-i*d,r[8]=i*l-u*a;var p=1/m;return f.multiplyByScalar(r,p,r)},f.equals=function(e,r){return e===r||t(e)&&t(r)&&e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]&&e[4]===r[4]&&e[5]===r[5]&&e[6]===r[6]&&e[7]===r[7]&&e[8]===r[8]},f.equalsEpsilon=function(e,r,i){if("number"!=typeof i)throw new n("epsilon must be a number");return e===r||t(e)&&t(r)&&Math.abs(e[0]-r[0])<=i&&Math.abs(e[1]-r[1])<=i&&Math.abs(e[2]-r[2])<=i&&Math.abs(e[3]-r[3])<=i&&Math.abs(e[4]-r[4])<=i&&Math.abs(e[5]-r[5])<=i&&Math.abs(e[6]-r[6])<=i&&Math.abs(e[7]-r[7])<=i&&Math.abs(e[8]-r[8])<=i},f.IDENTITY=i(new f(1,0,0,0,1,0,0,0,1)),f.COLUMN0ROW0=0,f.COLUMN0ROW1=1,f.COLUMN0ROW2=2,f.COLUMN1ROW0=3,f.COLUMN1ROW1=4,f.COLUMN1ROW2=5,f.COLUMN2ROW0=6,f.COLUMN2ROW1=7,f.COLUMN2ROW2=8,f.prototype.clone=function(e){return f.clone(this,e)},f.prototype.equals=function(e){return f.equals(this,e)},f.equalsArray=function(e,r,t){return e[0]===r[t]&&e[1]===r[t+1]&&e[2]===r[t+2]&&e[3]===r[t+3]&&e[4]===r[t+4]&&e[5]===r[t+5]&&e[6]===r[t+6]&&e[7]===r[t+7]&&e[8]===r[t+8]},f.prototype.equalsEpsilon=function(e,r){return f.equalsEpsilon(this,e,r)},f.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n"+"("+this[1]+", "+this[4]+", "+this[7]+")\n"+"("+this[2]+", "+this[5]+", "+this[8]+")"},f}),define("Core/RuntimeError",["./defined"],function(e){"use strict";var r=function(e){this.name="RuntimeError",this.message=e;var r;try{throw new Error}catch(t){r=t.stack}this.stack=r};return r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r}),define("Core/Matrix4",["./Cartesian3","./Cartesian4","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math","./Matrix3","./RuntimeError"],function(e,r,t,n,i,o,a,s,u){"use strict";var f=function(e,r,n,i,o,a,s,u,f,l,c,h,d,w,m,p){this[0]=t(e,0),this[1]=t(o,0),this[2]=t(f,0),this[3]=t(d,0),this[4]=t(r,0),this[5]=t(a,0),this[6]=t(l,0),this[7]=t(w,0),this[8]=t(n,0),this[9]=t(s,0),this[10]=t(c,0),this[11]=t(m,0),this[12]=t(i,0),this[13]=t(u,0),this[14]=t(h,0),this[15]=t(p,0)};f.packedLength=16,f.pack=function(e,r,o){if(!n(e))throw new i("value is required");if(!n(r))throw new i("array is required");o=t(o,0),r[o++]=e[0],r[o++]=e[1],r[o++]=e[2],r[o++]=e[3],r[o++]=e[4],r[o++]=e[5],r[o++]=e[6],r[o++]=e[7],r[o++]=e[8],r[o++]=e[9],r[o++]=e[10],r[o++]=e[11],r[o++]=e[12],r[o++]=e[13],r[o++]=e[14],r[o]=e[15]},f.unpack=function(e,r,o){if(!n(e))throw new i("array is required");return r=t(r,0),n(o)||(o=new f),o[0]=e[r++],o[1]=e[r++],o[2]=e[r++],o[3]=e[r++],o[4]=e[r++],o[5]=e[r++],o[6]=e[r++],o[7]=e[r++],o[8]=e[r++],o[9]=e[r++],o[10]=e[r++],o[11]=e[r++],o[12]=e[r++],o[13]=e[r++],o[14]=e[r++],o[15]=e[r],o},f.clone=function(e,r){return n(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[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):new f(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},f.fromArray=f.unpack,f.fromColumnMajorArray=function(e,r){if(!n(e))throw new i("values is required");return f.clone(e,r)},f.fromRowMajorArray=function(e,r){if(!n(e))throw new i("values is required.");return n(r)?(r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15],r):new f(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])},f.fromRotationTranslation=function(r,o,a){if(!n(r))throw new i("rotation is required.");return o=t(o,e.ZERO),n(a)?(a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=0,a[4]=r[3],a[5]=r[4],a[6]=r[5],a[7]=0,a[8]=r[6],a[9]=r[7],a[10]=r[8],a[11]=0,a[12]=o.x,a[13]=o.y,a[14]=o.z,a[15]=1,a):new f(r[0],r[3],r[6],o.x,r[1],r[4],r[7],o.y,r[2],r[5],r[8],o.z,0,0,0,1)},f.fromTranslationQuaternionRotationScale=function(e,r,t,o){if(!n(e))throw new i("translation is required.");if(!n(r))throw new i("rotation is required.");if(!n(t))throw new i("scale is required.");n(o)||(o=new f);var a=t.x,s=t.y,u=t.z,l=r.x*r.x,c=r.x*r.y,h=r.x*r.z,d=r.x*r.w,w=r.y*r.y,m=r.y*r.z,p=r.y*r.w,y=r.z*r.z,v=r.z*r.w,g=r.w*r.w,b=l-w-y+g,E=2*(c-v),q=2*(h+p),S=2*(c+v),C=-l+w-y+g,x=2*(m-d),A=2*(h-p),T=2*(m+d),I=-l-w+y+g;return o[0]=b*a,o[1]=S*a,o[2]=A*a,o[3]=0,o[4]=E*s,o[5]=C*s,o[6]=T*s,o[7]=0,o[8]=q*u,o[9]=x*u,o[10]=I*u,o[11]=0,o[12]=e.x,o[13]=e.y,o[14]=e.z,o[15]=1,o},f.fromTranslation=function(e,r){if(!n(e))throw new i("translation is required.");return f.fromRotationTranslation(s.IDENTITY,e,r)},f.fromScale=function(e,r){if(!n(e))throw new i("scale is required.");return n(r)?(r[0]=e.x,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e.y,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e.z,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new f(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},f.fromUniformScale=function(e,r){if("number"!=typeof e)throw new i("scale is required.");return n(r)?(r[0]=e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r):new f(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};var l=new e,c=new e,h=new e;f.fromCamera=function(r,t){if(!n(r))throw new i("camera is required.");var o=r.eye,a=r.target,s=r.up;if(!n(o))throw new i("camera.eye is required.");if(!n(a))throw new i("camera.target is required.");if(!n(s))throw new i("camera.up is required.");e.normalize(e.subtract(a,o,l),l),e.normalize(e.cross(l,s,c),c),e.normalize(e.cross(c,l,h),h);var u=c.x,d=c.y,w=c.z,m=l.x,p=l.y,y=l.z,v=h.x,g=h.y,b=h.z,E=o.x,q=o.y,S=o.z,C=u*-E+d*-q+w*-S,x=v*-E+g*-q+b*-S,A=m*E+p*q+y*S;return n(t)?(t[0]=u,t[1]=v,t[2]=-m,t[3]=0,t[4]=d,t[5]=g,t[6]=-p,t[7]=0,t[8]=w,t[9]=b,t[10]=-y,t[11]=0,t[12]=C,t[13]=x,t[14]=A,t[15]=1,t):new f(u,d,w,C,v,g,b,x,-m,-p,-y,A,0,0,0,1)},f.computePerspectiveFieldOfView=function(e,r,t,o,a){if(0>=e||e>Math.PI)throw new i("fovY must be in [0, PI).");if(0>=r)throw new i("aspectRatio must be greater than zero.");if(0>=t)throw new i("near must be greater than zero.");if(0>=o)throw new i("far must be greater than zero.");if(!n(a))throw new i("result is required");var s=Math.tan(.5*e),u=1/s,f=u/r,l=(o+t)/(t-o),c=2*o*t/(t-o);return a[0]=f,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=l,a[11]=-1,a[12]=0,a[13]=0,a[14]=c,a[15]=0,a},f.computeOrthographicOffCenter=function(e,r,t,o,a,s,u){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");if(!n(t))throw new i("bottom is required.");if(!n(o))throw new i("top is required.");if(!n(a))throw new i("near is required.");if(!n(s))throw new i("far is required.");if(!n(u))throw new i("result is required");var f=1/(r-e),l=1/(o-t),c=1/(s-a),h=-(r+e)*f,d=-(o+t)*l,w=-(s+a)*c;return f*=2,l*=2,c*=-2,u[0]=f,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=l,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=c,u[11]=0,u[12]=h,u[13]=d,u[14]=w,u[15]=1,u},f.computePerspectiveOffCenter=function(e,r,t,o,a,s,u){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");if(!n(t))throw new i("bottom is required.");if(!n(o))throw new i("top is required.");if(!n(a))throw new i("near is required.");if(!n(s))throw new i("far is required.");if(!n(u))throw new i("result is required");var f=2*a/(r-e),l=2*a/(o-t),c=(r+e)/(r-e),h=(o+t)/(o-t),d=-(s+a)/(s-a),w=-1,m=-2*s*a/(s-a);return u[0]=f,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=l,u[6]=0,u[7]=0,u[8]=c,u[9]=h,u[10]=d,u[11]=w,u[12]=0,u[13]=0,u[14]=m,u[15]=0,u},f.computeInfinitePerspectiveOffCenter=function(e,r,t,o,a,s){if(!n(e))throw new i("left is required.");if(!n(r))throw new i("right is required.");if(!n(t))throw new i("bottom is required.");if(!n(o))throw new i("top is required.");if(!n(a))throw new i("near is required.");if(!n(s))throw new i("result is required");var u=2*a/(r-e),f=2*a/(o-t),l=(r+e)/(r-e),c=(o+t)/(o-t),h=-1,d=-1,w=-2*a;return s[0]=u,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=f,s[6]=0,s[7]=0,s[8]=l,s[9]=c,s[10]=h,s[11]=d,s[12]=0,s[13]=0,s[14]=w,s[15]=0,s},f.computeViewportTransformation=function(e,r,o,a){if(!n(a))throw new i("result is required");e=t(e,t.EMPTY_OBJECT);var s=t(e.x,0),u=t(e.y,0),f=t(e.width,0),l=t(e.height,0);r=t(r,0),o=t(o,1);var c=.5*f,h=.5*l,d=.5*(o-r),w=c,m=h,p=d,y=s+c,v=u+h,g=r+d,b=1;return a[0]=w,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=m,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=p,a[11]=0,a[12]=y,a[13]=v,a[14]=g,a[15]=b,a},f.toArray=function(e,r){if(!n(e))throw new i("matrix is required");return 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[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):[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]]},f.getElementIndex=function(e,r){if("number"!=typeof r||0>r||r>3)throw new i("row must be 0, 1, 2, or 3.");if("number"!=typeof e||0>e||e>3)throw new i("column must be 0, 1, 2, or 3.");return 4*e+r},f.getColumn=function(e,r,t){if(!n(e))throw new i("matrix is required.");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(t))throw new i("result is required");var o=4*r,a=e[o],s=e[o+1],u=e[o+2],f=e[o+3];return t.x=a,t.y=s,t.z=u,t.w=f,t},f.setColumn=function(e,r,t,o){if(!n(e))throw new i("matrix is required");if(!n(t))throw new i("cartesian is required");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(o))throw new i("result is required");o=f.clone(e,o);var a=4*r;return o[a]=t.x,o[a+1]=t.y,o[a+2]=t.z,o[a+3]=t.w,o},f.setTranslation=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("translation is required");if(!n(t))throw new i("result is required");return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=r.x,t[13]=r.y,t[14]=r.z,t[15]=e[15],t},f.getRow=function(e,r,t){if(!n(e))throw new i("matrix is required.");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(t))throw new i("result is required");var o=e[r],a=e[r+4],s=e[r+8],u=e[r+12];return t.x=o,t.y=a,t.z=s,t.w=u,t},f.setRow=function(e,r,t,o){if(!n(e))throw new i("matrix is required");if(!n(t))throw new i("cartesian is required");if("number"!=typeof r||0>r||r>3)throw new i("index must be 0, 1, 2, or 3.");if(!n(o))throw new i("result is required");return o=f.clone(e,o),o[r]=t.x,o[r+4]=t.y,o[r+8]=t.z,o[r+12]=t.w,o};var d=new e;f.getScale=function(r,t){if(!n(r))throw new i("matrix is required.");if(!n(t))throw new i("result is required");return t.x=e.magnitude(e.fromElements(r[0],r[1],r[2],d)),t.y=e.magnitude(e.fromElements(r[4],r[5],r[6],d)),t.z=e.magnitude(e.fromElements(r[8],r[9],r[10],d)),t};var w=new e;f.getMaximumScale=function(r){return f.getScale(r,w),e.maximumComponent(w)},f.multiply=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");var o=e[0],a=e[1],s=e[2],u=e[3],f=e[4],l=e[5],c=e[6],h=e[7],d=e[8],w=e[9],m=e[10],p=e[11],y=e[12],v=e[13],g=e[14],b=e[15],E=r[0],q=r[1],S=r[2],C=r[3],x=r[4],A=r[5],T=r[6],I=r[7],M=r[8],O=r[9],R=r[10],N=r[11],P=r[12],L=r[13],z=r[14],D=r[15],F=o*E+f*q+d*S+y*C,_=a*E+l*q+w*S+v*C,B=s*E+c*q+m*S+g*C,U=u*E+h*q+p*S+b*C,G=o*x+f*A+d*T+y*I,k=a*x+l*A+w*T+v*I,V=s*x+c*A+m*T+g*I,W=u*x+h*A+p*T+b*I,Y=o*M+f*O+d*R+y*N,H=a*M+l*O+w*R+v*N,j=s*M+c*O+m*R+g*N,K=u*M+h*O+p*R+b*N,Z=o*P+f*L+d*z+y*D,X=a*P+l*L+w*z+v*D,Q=s*P+c*L+m*z+g*D,J=u*P+h*L+p*z+b*D;return t[0]=F,t[1]=_,t[2]=B,t[3]=U,t[4]=G,t[5]=k,t[6]=V,t[7]=W,t[8]=Y,t[9]=H,t[10]=j,t[11]=K,t[12]=Z,t[13]=X,t[14]=Q,t[15]=J,t},f.add=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},f.subtract=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t},f.multiplyTransformation=function(e,r,t){if(!n(e))throw new i("left is required");if(!n(r))throw new i("right is required");if(!n(t))throw new i("result is required");var o=e[0],a=e[1],s=e[2],u=e[4],f=e[5],l=e[6],c=e[8],h=e[9],d=e[10],w=e[12],m=e[13],p=e[14],y=r[0],v=r[1],g=r[2],b=r[4],E=r[5],q=r[6],S=r[8],C=r[9],x=r[10],A=r[12],T=r[13],I=r[14],M=o*y+u*v+c*g,O=a*y+f*v+h*g,R=s*y+l*v+d*g,N=o*b+u*E+c*q,P=a*b+f*E+h*q,L=s*b+l*E+d*q,z=o*S+u*C+c*x,D=a*S+f*C+h*x,F=s*S+l*C+d*x,_=o*A+u*T+c*I+w,B=a*A+f*T+h*I+m,U=s*A+l*T+d*I+p;return t[0]=M,t[1]=O,t[2]=R,t[3]=0,t[4]=N,t[5]=P,t[6]=L,t[7]=0,t[8]=z,t[9]=D,t[10]=F,t[11]=0,t[12]=_,t[13]=B,t[14]=U,t[15]=1,t},f.multiplyByMatrix3=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("rotation is required");if(!n(t))throw new i("result is required");var o=e[0],a=e[1],s=e[2],u=e[4],f=e[5],l=e[6],c=e[8],h=e[9],d=e[10],w=r[0],m=r[1],p=r[2],y=r[3],v=r[4],g=r[5],b=r[6],E=r[7],q=r[8],S=o*w+u*m+c*p,C=a*w+f*m+h*p,x=s*w+l*m+d*p,A=o*y+u*v+c*g,T=a*y+f*v+h*g,I=s*y+l*v+d*g,M=o*b+u*E+c*q,O=a*b+f*E+h*q,R=s*b+l*E+d*q;return t[0]=S,t[1]=C,t[2]=x,t[3]=0,t[4]=A,t[5]=T,t[6]=I,t[7]=0,t[8]=M,t[9]=O,t[10]=R,t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},f.multiplyByTranslation=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("translation is required");if(!n(t))throw new i("result is required");var o=r.x,a=r.y,s=r.z,u=o*e[0]+a*e[4]+s*e[8]+e[12],f=o*e[1]+a*e[5]+s*e[9]+e[13],l=o*e[2]+a*e[6]+s*e[10]+e[14];return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=u,t[13]=f,t[14]=l,t[15]=e[15],t};var m=new e;f.multiplyByUniformScale=function(e,r,t){if(!n(e))throw new i("matrix is required");if("number"!=typeof r)throw new i("scale is required");if(!n(t))throw new i("result is required");return m.x=r,m.y=r,m.z=r,f.multiplyByScale(e,m,t)},f.multiplyByScale=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("scale is required");if(!n(t))throw new i("result is required");var o=r.x,a=r.y,s=r.z;return 1===o&&1===a&&1===s?f.clone(e,t):(t[0]=o*e[0],t[1]=o*e[1],t[2]=o*e[2],t[3]=0,t[4]=a*e[4],t[5]=a*e[5],t[6]=a*e[6],t[7]=0,t[8]=s*e[8],t[9]=s*e[9],t[10]=s*e[10],t[11]=0,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=1,t)},f.multiplyByVector=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("cartesian is required");if(!n(t))throw new i("result is required");var o=r.x,a=r.y,s=r.z,u=r.w,f=e[0]*o+e[4]*a+e[8]*s+e[12]*u,l=e[1]*o+e[5]*a+e[9]*s+e[13]*u,c=e[2]*o+e[6]*a+e[10]*s+e[14]*u,h=e[3]*o+e[7]*a+e[11]*s+e[15]*u;return t.x=f,t.y=l,t.z=c,t.w=h,t},f.multiplyByPointAsVector=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("cartesian is required");if(!n(t))throw new i("result is required");var o=r.x,a=r.y,s=r.z,u=e[0]*o+e[4]*a+e[8]*s,f=e[1]*o+e[5]*a+e[9]*s,l=e[2]*o+e[6]*a+e[10]*s;return t.x=u,t.y=f,t.z=l,t},f.multiplyByPoint=function(e,r,t){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("cartesian is required");if(!n(t))throw new i("result is required");var o=r.x,a=r.y,s=r.z,u=e[0]*o+e[4]*a+e[8]*s+e[12],f=e[1]*o+e[5]*a+e[9]*s+e[13],l=e[2]*o+e[6]*a+e[10]*s+e[14];return t.x=u,t.y=f,t.z=l,t},f.multiplyByScalar=function(e,r,t){if(!n(e))throw new i("matrix is required");if("number"!=typeof r)throw new i("scalar must be a number");if(!n(t))throw new i("result is required");return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},f.negate=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return 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[9]=-e[9],r[10]=-e[10],r[11]=-e[11],r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=-e[15],r},f.transpose=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");var t=e[1],o=e[2],a=e[3],s=e[6],u=e[7],f=e[11];return r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=o,r[9]=s,r[10]=e[10],r[11]=e[14],r[12]=a,r[13]=u,r[14]=f,r[15]=e[15],r},f.abs=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return 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[9]=Math.abs(e[9]),r[10]=Math.abs(e[10]),r[11]=Math.abs(e[11]),r[12]=Math.abs(e[12]),r[13]=Math.abs(e[13]),r[14]=Math.abs(e[14]),r[15]=Math.abs(e[15]),r},f.equals=function(e,r){return e===r||n(e)&&n(r)&&e[12]===r[12]&&e[13]===r[13]&&e[14]===r[14]&&e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[4]===r[4]&&e[5]===r[5]&&e[6]===r[6]&&e[8]===r[8]&&e[9]===r[9]&&e[10]===r[10]&&e[3]===r[3]&&e[7]===r[7]&&e[11]===r[11]&&e[15]===r[15]},f.equalsEpsilon=function(e,r,t){if("number"!=typeof t)throw new i("epsilon must be a number");return e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=t&&Math.abs(e[1]-r[1])<=t&&Math.abs(e[2]-r[2])<=t&&Math.abs(e[3]-r[3])<=t&&Math.abs(e[4]-r[4])<=t&&Math.abs(e[5]-r[5])<=t&&Math.abs(e[6]-r[6])<=t&&Math.abs(e[7]-r[7])<=t&&Math.abs(e[8]-r[8])<=t&&Math.abs(e[9]-r[9])<=t&&Math.abs(e[10]-r[10])<=t&&Math.abs(e[11]-r[11])<=t&&Math.abs(e[12]-r[12])<=t&&Math.abs(e[13]-r[13])<=t&&Math.abs(e[14]-r[14])<=t&&Math.abs(e[15]-r[15])<=t},f.getTranslation=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return r.x=e[12],r.y=e[13],r.z=e[14],r},f.getRotation=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r};var p=new s,y=new s,v=new r,g=new r(0,0,0,1);return f.inverse=function(e,t){if(!n(e))throw new i("matrix is required");if(!n(t))throw new i("result is required");if(s.equalsEpsilon(f.getRotation(e,p),y,a.EPSILON7)&&r.equals(f.getRow(e,3,v),g))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;var o=e[0],l=e[4],c=e[8],h=e[12],d=e[1],w=e[5],m=e[9],b=e[13],E=e[2],q=e[6],S=e[10],C=e[14],x=e[3],A=e[7],T=e[11],I=e[15],M=S*I,O=C*T,R=q*I,N=C*A,P=q*T,L=S*A,z=E*I,D=C*x,F=E*T,_=S*x,B=E*A,U=q*x,G=M*w+N*m+P*b-(O*w+R*m+L*b),k=O*d+z*m+_*b-(M*d+D*m+F*b),V=R*d+D*w+B*b-(N*d+z*w+U*b),W=L*d+F*w+U*m-(P*d+_*w+B*m),Y=O*l+R*c+L*h-(M*l+N*c+P*h),H=M*o+D*c+F*h-(O*o+z*c+_*h),j=N*o+z*l+U*h-(R*o+D*l+B*h),K=P*o+_*l+B*c-(L*o+F*l+U*c);M=c*b,O=h*m,R=l*b,N=h*w,P=l*m,L=c*w,z=o*b,D=h*d,F=o*m,_=c*d,B=o*w,U=l*d;var Z=M*A+N*T+P*I-(O*A+R*T+L*I),X=O*x+z*T+_*I-(M*x+D*T+F*I),Q=R*x+D*A+B*I-(N*x+z*A+U*I),J=L*x+F*A+U*T-(P*x+_*A+B*T),$=R*S+L*C+O*q-(P*C+M*q+N*S),er=F*C+M*E+D*S-(z*S+_*C+O*E),rr=z*q+U*C+N*E-(B*C+R*E+D*q),tr=B*S+P*E+_*q-(F*q+U*S+L*E),nr=o*G+l*k+c*V+h*W;if(Math.abs(nr)<a.EPSILON20)throw new u("matrix is not invertible because its determinate is zero.");return nr=1/nr,t[0]=G*nr,t[1]=k*nr,t[2]=V*nr,t[3]=W*nr,t[4]=Y*nr,t[5]=H*nr,t[6]=j*nr,t[7]=K*nr,t[8]=Z*nr,t[9]=X*nr,t[10]=Q*nr,t[11]=J*nr,t[12]=$*nr,t[13]=er*nr,t[14]=rr*nr,t[15]=tr*nr,t},f.inverseTransformation=function(e,r){if(!n(e))throw new i("matrix is required");if(!n(r))throw new i("result is required");var t=e[0],o=e[1],a=e[2],s=e[4],u=e[5],f=e[6],l=e[8],c=e[9],h=e[10],d=e[12],w=e[13],m=e[14],p=-t*d-o*w-a*m,y=-s*d-u*w-f*m,v=-l*d-c*w-h*m;return r[0]=t,r[1]=s,r[2]=l,r[3]=0,r[4]=o,r[5]=u,r[6]=c,r[7]=0,r[8]=a,r[9]=f,r[10]=h,r[11]=0,r[12]=p,r[13]=y,r[14]=v,r[15]=1,r},f.IDENTITY=o(new f(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),f.COLUMN0ROW0=0,f.COLUMN0ROW1=1,f.COLUMN0ROW2=2,f.COLUMN0ROW3=3,f.COLUMN1ROW0=4,f.COLUMN1ROW1=5,f.COLUMN1ROW2=6,f.COLUMN1ROW3=7,f.COLUMN2ROW0=8,f.COLUMN2ROW1=9,f.COLUMN2ROW2=10,f.COLUMN2ROW3=11,f.COLUMN3ROW0=12,f.COLUMN3ROW1=13,f.COLUMN3ROW2=14,f.COLUMN3ROW3=15,f.prototype.clone=function(e){return f.clone(this,e)},f.prototype.equals=function(e){return f.equals(this,e)},f.equalsArray=function(e,r,t){return e[0]===r[t]&&e[1]===r[t+1]&&e[2]===r[t+2]&&e[3]===r[t+3]&&e[4]===r[t+4]&&e[5]===r[t+5]&&e[6]===r[t+6]&&e[7]===r[t+7]&&e[8]===r[t+8]&&e[9]===r[t+9]&&e[10]===r[t+10]&&e[11]===r[t+11]&&e[12]===r[t+12]&&e[13]===r[t+13]&&e[14]===r[t+14]&&e[15]===r[t+15]},f.prototype.equalsEpsilon=function(e,r){return f.equalsEpsilon(this,e,r)},f.prototype.toString=function(){return"("+this[0]+", "+this[4]+", "+this[8]+", "+this[12]+")\n"+"("+this[1]+", "+this[5]+", "+this[9]+", "+this[13]+")\n"+"("+this[2]+", "+this[6]+", "+this[10]+", "+this[14]+")\n"+"("+this[3]+", "+this[7]+", "+this[11]+", "+this[15]+")"},f}),define("Core/Rectangle",["./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./freezeObject","./Math"],function(e,r,t,n,i,o,a,s){"use strict";var u=function(e,t,n,i){this.west=r(e,0),this.south=r(t,0),this.east=r(n,0),this.north=r(i,0)};n(u.prototype,{width:{get:function(){return u.computeWidth(this)}},height:{get:function(){return u.computeHeight(this)}}}),u.packedLength=4,u.pack=function(e,n,o){if(!t(e))throw new i("value is required");if(!t(n))throw new i("array is required");o=r(o,0),n[o++]=e.west,n[o++]=e.south,n[o++]=e.east,n[o]=e.north},u.unpack=function(e,n,o){if(!t(e))throw new i("array is required");return n=r(n,0),t(o)||(o=new u),o.west=e[n++],o.south=e[n++],o.east=e[n++],o.north=e[n],o},u.computeWidth=function(e){if(!t(e))throw new i("rectangle is required.");var r=e.east,n=e.west;return n>r&&(r+=s.TWO_PI),r-n},u.computeHeight=function(e){if(!t(e))throw new i("rectangle is required.");return e.north-e.south},u.fromDegrees=function(e,n,i,o,a){return e=s.toRadians(r(e,0)),n=s.toRadians(r(n,0)),i=s.toRadians(r(i,0)),o=s.toRadians(r(o,0)),t(a)?(a.west=e,a.south=n,a.east=i,a.north=o,a):new u(e,n,i,o)},u.fromCartographicArray=function(e,r){if(!t(e))throw new i("cartographics is required.");for(var n=Number.MAX_VALUE,o=-Number.MAX_VALUE,a=Number.MAX_VALUE,s=-Number.MAX_VALUE,f=0,l=e.length;l>f;f++){var c=e[f];n=Math.min(n,c.longitude),o=Math.max(o,c.longitude),a=Math.min(a,c.latitude),s=Math.max(s,c.latitude)}return t(r)?(r.west=n,r.south=a,r.east=o,r.north=s,r):new u(n,a,o,s)},u.clone=function(e,r){return t(e)?t(r)?(r.west=e.west,r.south=e.south,r.east=e.east,r.north=e.north,r):new u(e.west,e.south,e.east,e.north):void 0},u.prototype.clone=function(e){return u.clone(this,e)},u.prototype.equals=function(e){return u.equals(this,e)},u.equals=function(e,r){return e===r||t(e)&&t(r)&&e.west===r.west&&e.south===r.south&&e.east===r.east&&e.north===r.north},u.prototype.equalsEpsilon=function(e,r){if("number"!=typeof r)throw new i("epsilon is required and must be a number.");return t(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},u.validate=function(e){if(!t(e))throw new i("rectangle is required");var r=e.north;if("number"!=typeof r)throw new i("north is required to be a number.");if(r<-s.PI_OVER_TWO||r>s.PI_OVER_TWO)throw new i("north must be in the interval [-Pi/2, Pi/2].");var n=e.south;if("number"!=typeof n)throw new i("south is required to be a number.");if(n<-s.PI_OVER_TWO||n>s.PI_OVER_TWO)throw new i("south must be in the interval [-Pi/2, Pi/2].");var o=e.west;if("number"!=typeof o)throw new i("west is required to be a number.");if(o<-Math.PI||o>Math.PI)throw new i("west must be in the interval [-Pi, Pi].");var a=e.east;if("number"!=typeof a)throw new i("east is required to be a number.");if(a<-Math.PI||a>Math.PI)throw new i("east must be in the interval [-Pi, Pi].")},u.southwest=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.west,n.latitude=r.south,n.height=0,n):new e(r.west,r.south)},u.northwest=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.west,n.latitude=r.north,n.height=0,n):new e(r.west,r.north)},u.northeast=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.east,n.latitude=r.north,n.height=0,n):new e(r.east,r.north)},u.southeast=function(r,n){if(!t(r))throw new i("rectangle is required");return t(n)?(n.longitude=r.east,n.latitude=r.south,n.height=0,n):new e(r.east,r.south)},u.center=function(r,n){if(!t(r))throw new i("rectangle is required");var o=r.east,a=r.west;a>o&&(o+=s.TWO_PI);var u=s.negativePiToPi(.5*(a+o)),f=.5*(r.south+r.north);return t(n)?(n.longitude=u,n.latitude=f,n.height=0,n):new e(u,f)},u.intersection=function(e,r,n){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("otherRectangle is required.");var o=e.east,a=e.west,f=r.east,l=r.west;a>o&&f>0?o+=s.TWO_PI:l>f&&o>0&&(f+=s.TWO_PI),a>o&&0>l?l+=s.TWO_PI:l>f&&0>a&&(a+=s.TWO_PI);var c=s.negativePiToPi(Math.max(a,l)),h=s.negativePiToPi(Math.min(o,f));if((e.west<e.east||r.west<r.east)&&c>=h)return void 0;var d=Math.max(e.south,r.south),w=Math.min(e.north,r.north);return d>=w?void 0:t(n)?(n.west=c,n.south=d,n.east=h,n.north=w,n):new u(c,d,h,w)},u.contains=function(e,r){if(!t(e))throw new i("rectangle is required");if(!t(r))throw new i("cartographic is required.");var n=r.longitude,o=r.latitude,a=e.west,u=e.east;return a>u&&(u+=s.TWO_PI,0>n&&(n+=s.TWO_PI)),(n>a||s.equalsEpsilon(n,a,s.EPSILON14))&&(u>n||s.equalsEpsilon(n,u,s.EPSILON14))&&o>=e.south&&o<=e.north};var f=new e;return u.subsample=function(e,n,a,l){if(!t(e))throw new i("rectangle is required");n=r(n,o.WGS84),a=r(a,0),t(l)||(l=[]);var c=0,h=e.north,d=e.south,w=e.east,m=e.west,p=f;p.height=a,p.longitude=m,p.latitude=h,l[c]=n.cartographicToCartesian(p,l[c]),c++,p.longitude=w,l[c]=n.cartographicToCartesian(p,l[c]),c++,p.latitude=d,l[c]=n.cartographicToCartesian(p,l[c]),c++,p.longitude=m,l[c]=n.cartographicToCartesian(p,l[c]),c++,p.latitude=0>h?h:d>0?d:0;for(var y=1;8>y;++y)p.longitude=-Math.PI+y*s.PI_OVER_TWO,u.contains(e,p)&&(l[c]=n.cartographicToCartesian(p,l[c]),c++);return 0===p.latitude&&(p.longitude=m,l[c]=n.cartographicToCartesian(p,l[c]),c++,p.longitude=w,l[c]=n.cartographicToCartesian(p,l[c]),c++),l.length=c,l},u.MAX_VALUE=a(new u(-Math.PI,-s.PI_OVER_TWO,Math.PI,s.PI_OVER_TWO)),u}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix4","./Rectangle"],function(e,r,t,n,i,o,a,s,u,f,l){"use strict";var c=function(r,n){this.center=e.clone(t(r,e.ZERO)),this.radius=t(n,0)},h=new e,d=new e,w=new e,m=new e,p=new e,y=new e,v=new e,g=new e,b=new e,E=new e,q=new e,S=new e;c.fromPoints=function(r,t){if(n(t)||(t=new c),!n(r)||0===r.length)return t.center=e.clone(e.ZERO,t.center),t.radius=0,t;for(var i=e.clone(r[0],v),o=e.clone(i,h),a=e.clone(i,d),s=e.clone(i,w),u=e.clone(i,m),f=e.clone(i,p),l=e.clone(i,y),C=r.length,x=1;C>x;x++){e.clone(r[x],i);var A=i.x,T=i.y,I=i.z;A<o.x&&e.clone(i,o),A>u.x&&e.clone(i,u),T<a.y&&e.clone(i,a),T>f.y&&e.clone(i,f),I<s.z&&e.clone(i,s),I>l.z&&e.clone(i,l)}var M=e.magnitudeSquared(e.subtract(u,o,g)),O=e.magnitudeSquared(e.subtract(f,a,g)),R=e.magnitudeSquared(e.subtract(l,s,g)),N=o,P=u,L=M;O>L&&(L=O,N=a,P=f),R>L&&(L=R,N=s,P=l);var z=b;z.x=.5*(N.x+P.x),z.y=.5*(N.y+P.y),z.z=.5*(N.z+P.z);var D=e.magnitudeSquared(e.subtract(P,z,g)),F=Math.sqrt(D),_=E;_.x=o.x,_.y=a.y,_.z=s.z;var B=q;B.x=u.x,B.y=f.y,B.z=l.z;var U=e.multiplyByScalar(e.add(_,B,g),.5,S),G=0;for(x=0;C>x;x++){e.clone(r[x],i);var k=e.magnitude(e.subtract(i,U,g));k>G&&(G=k);var V=e.magnitudeSquared(e.subtract(i,z,g));if(V>D){var W=Math.sqrt(V);F=.5*(F+W),D=F*F;var Y=W-F;z.x=(F*z.x+Y*i.x)/W,z.y=(F*z.y+Y*i.y)/W,z.z=(F*z.z+Y*i.z)/W}}return G>F?(e.clone(z,t.center),t.radius=F):(e.clone(U,t.center),t.radius=G),t
};var C=new a,x=new e,A=new e,T=new r,I=new r;c.fromRectangle2D=function(e,r,t){return c.fromRectangleWithHeights2D(e,r,0,0,t)},c.fromRectangleWithHeights2D=function(r,i,o,a,s){if(n(s)||(s=new c),!n(r))return s.center=e.clone(e.ZERO,s.center),s.radius=0,s;i=t(i,C),l.southwest(r,T),T.height=o,l.northeast(r,I),I.height=a;var u=i.project(T,x),f=i.project(I,A),h=f.x-u.x,d=f.y-u.y,w=f.z-u.z;s.radius=.5*Math.sqrt(h*h+d*d+w*w);var m=s.center;return m.x=u.x+.5*h,m.y=u.y+.5*d,m.z=u.z+.5*w,s};var M=[];c.fromRectangle3D=function(e,r,i,a){r=t(r,o.WGS84),i=t(i,0);var s;return n(e)&&(s=l.subsample(e,r,i,M)),c.fromPoints(s,a)},c.fromVertices=function(r,o,a,s){if(n(s)||(s=new c),!n(r)||0===r.length)return s.center=e.clone(e.ZERO,s.center),s.radius=0,s;if(o=t(o,e.ZERO),a=t(a,3),3>a)throw new i("stride must be 3 or greater.");var u=v;u.x=r[0]+o.x,u.y=r[1]+o.y,u.z=r[2]+o.z;for(var f=e.clone(u,h),l=e.clone(u,d),C=e.clone(u,w),x=e.clone(u,m),A=e.clone(u,p),T=e.clone(u,y),I=r.length,M=0;I>M;M+=a){var O=r[M]+o.x,R=r[M+1]+o.y,N=r[M+2]+o.z;u.x=O,u.y=R,u.z=N,O<f.x&&e.clone(u,f),O>x.x&&e.clone(u,x),R<l.y&&e.clone(u,l),R>A.y&&e.clone(u,A),N<C.z&&e.clone(u,C),N>T.z&&e.clone(u,T)}var P=e.magnitudeSquared(e.subtract(x,f,g)),L=e.magnitudeSquared(e.subtract(A,l,g)),z=e.magnitudeSquared(e.subtract(T,C,g)),D=f,F=x,_=P;L>_&&(_=L,D=l,F=A),z>_&&(_=z,D=C,F=T);var B=b;B.x=.5*(D.x+F.x),B.y=.5*(D.y+F.y),B.z=.5*(D.z+F.z);var U=e.magnitudeSquared(e.subtract(F,B,g)),G=Math.sqrt(U),k=E;k.x=f.x,k.y=l.y,k.z=C.z;var V=q;V.x=x.x,V.y=A.y,V.z=T.z;var W=e.multiplyByScalar(e.add(k,V,g),.5,S),Y=0;for(M=0;I>M;M+=a){u.x=r[M]+o.x,u.y=r[M+1]+o.y,u.z=r[M+2]+o.z;var H=e.magnitude(e.subtract(u,W,g));H>Y&&(Y=H);var j=e.magnitudeSquared(e.subtract(u,B,g));if(j>U){var K=Math.sqrt(j);G=.5*(G+K),U=G*G;var Z=K-G;B.x=(G*B.x+Z*u.x)/K,B.y=(G*B.y+Z*u.y)/K,B.z=(G*B.z+Z*u.z)/K}}return Y>G?(e.clone(B,s.center),s.radius=G):(e.clone(W,s.center),s.radius=Y),s},c.fromCornerPoints=function(r,t,o){if(!n(r)||!n(t))throw new i("corner and oppositeCorner are required.");n(o)||(o=new c);var a=o.center;return e.add(r,t,a),e.multiplyByScalar(a,.5,a),o.radius=e.distance(a,t),o},c.fromEllipsoid=function(r,t){if(!n(r))throw new i("ellipsoid is required.");return n(t)||(t=new c),e.clone(e.ZERO,t.center),t.radius=r.maximumRadius,t};var O=new e;c.fromBoundingSpheres=function(r,t){if(n(t)||(t=new c),!n(r)||0===r.length)return t.center=e.clone(e.ZERO,t.center),t.radius=0,t;var i=r.length;if(1===i)return c.clone(r[0],t);if(2===i)return c.union(r[0],r[1],t);for(var o=[],a=0;i>a;a++)o.push(r[a].center);t=c.fromPoints(o,t);var s=t.center,u=t.radius;for(a=0;i>a;a++){var f=r[a];u=Math.max(u,e.distance(s,f.center,O)+f.radius)}return t.radius=u,t},c.clone=function(r,t){return n(r)?n(t)?(t.center=e.clone(r.center,t.center),t.radius=r.radius,t):new c(r.center,r.radius):void 0},c.packedLength=4,c.pack=function(e,r,o){if(!n(e))throw new i("value is required");if(!n(r))throw new i("array is required");o=t(o,0);var a=e.center;r[o++]=a.x,r[o++]=a.y,r[o++]=a.z,r[o]=e.radius},c.unpack=function(e,r,o){if(!n(e))throw new i("array is required");r=t(r,0),n(o)||(o=new c);var a=o.center;return a.x=e[r++],a.y=e[r++],a.z=e[r++],o.radius=e[r],o};var R=new e,N=new e;c.union=function(r,t,o){if(!n(r))throw new i("left is required.");if(!n(t))throw new i("right is required.");n(o)||(o=new c);var a=r.center,s=t.center;e.add(a,s,N);var u=e.multiplyByScalar(N,.5,N),f=e.magnitude(e.subtract(a,u,R))+r.radius,l=e.magnitude(e.subtract(s,u,R))+t.radius;return o.radius=Math.max(f,l),e.clone(u,o.center),o};var P=new e;c.expand=function(r,t,o){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("point is required.");o=c.clone(r,o);var a=e.magnitude(e.subtract(t,o.center,P));return a>o.radius&&(o.radius=a),o},c.intersect=function(r,t){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("plane is required.");var o=r.center,a=r.radius,u=e.dot(t,o)+t.w;return-a>u?s.OUTSIDE:a>u?s.INTERSECTING:s.INSIDE},c.transform=function(e,r,t){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("transform is required.");return n(t)||(t=new c),t.center=f.multiplyByPoint(r,e.center,t.center),t.radius=f.getMaximumScale(r)*e.radius,t};var L=new e;c.distanceSquaredTo=function(r,t){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("cartesian is required.");var o=e.subtract(r.center,t,L);return e.magnitudeSquared(o)-r.radius*r.radius},c.transformWithoutScale=function(e,r,t){if(!n(e))throw new i("sphere is required.");if(!n(r))throw new i("transform is required.");return n(t)||(t=new c),t.center=f.multiplyByPoint(r,e.center,t.center),t.radius=e.radius,t};var z=new e;c.computePlaneDistances=function(r,t,o,a){if(!n(r))throw new i("sphere is required.");if(!n(t))throw new i("position is required.");if(!n(o))throw new i("direction is required.");n(a)||(a=new u);var s=e.subtract(r.center,t,z),f=e.multiplyByScalar(o,e.dot(o,s),z),l=e.magnitude(f);return a.start=l-r.radius,a.stop=l+r.radius,a};for(var D=new e,F=new e,_=new e,B=new e,U=new e,G=new r,k=new Array(8),V=0;8>V;++V)k[V]=new e;var W=new a;return c.projectTo2D=function(r,o,a){if(!n(r))throw new i("sphere is required.");o=t(o,W);var s=o.ellipsoid,u=r.center,f=r.radius,l=s.geodeticSurfaceNormal(u,D),h=e.cross(e.UNIT_Z,l,F);e.normalize(h,h);var d=e.cross(l,h,_);e.normalize(d,d),e.multiplyByScalar(l,f,l),e.multiplyByScalar(d,f,d),e.multiplyByScalar(h,f,h);var w=e.negate(d,U),m=e.negate(h,B),p=k,y=p[0];e.add(l,d,y),e.add(y,h,y),y=p[1],e.add(l,d,y),e.add(y,m,y),y=p[2],e.add(l,w,y),e.add(y,m,y),y=p[3],e.add(l,w,y),e.add(y,h,y),e.negate(l,l),y=p[4],e.add(l,d,y),e.add(y,h,y),y=p[5],e.add(l,d,y),e.add(y,m,y),y=p[6],e.add(l,w,y),e.add(y,m,y),y=p[7],e.add(l,w,y),e.add(y,h,y);for(var v=p.length,g=0;v>g;++g){var b=p[g];e.add(u,b,b);var E=s.cartesianToCartographic(b,G);o.project(E,b)}a=c.fromPoints(p,a),u=a.center;var q=u.x,S=u.y,C=u.z;return u.x=C,u.y=q,u.z=S,a},c.equals=function(r,t){return r===t||n(r)&&n(t)&&e.equals(r.center,t.center)&&r.radius===t.radius},c.prototype.intersect=function(e){return c.intersect(this,e)},c.prototype.equals=function(e){return c.equals(this,e)},c.prototype.clone=function(e){return c.clone(this,e)},c}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,r){"use strict";var t,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},i={};return r(i,{element:{get:function(){return i.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return i.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return i.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return i.supportsFullscreen()?null!==i.element:void 0}}}),i.supportsFullscreen=function(){if(e(t))return t;t=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",t=!0;for(var i,o=["webkit","moz","o","ms","khtml"],a=0,s=o.length;s>a;++a){var u=o[a];i=u+"RequestFullscreen","function"==typeof r[i]?(n.requestFullscreen=i,t=!0):(i=u+"RequestFullScreen","function"==typeof r[i]&&(n.requestFullscreen=i,t=!0)),i=u+"ExitFullscreen","function"==typeof document[i]?n.exitFullscreen=i:(i=u+"CancelFullScreen","function"==typeof document[i]&&(n.exitFullscreen=i)),i=u+"FullscreenEnabled",e(document[i])?n.fullscreenEnabled=i:(i=u+"FullScreenEnabled",e(document[i])&&(n.fullscreenEnabled=i)),i=u+"FullscreenElement",e(document[i])?n.fullscreenElement=i:(i=u+"FullScreenElement",e(document[i])&&(n.fullscreenElement=i)),i=u+"fullscreenchange",e(document["on"+i])&&("ms"===u&&(i="MSFullscreenChange"),n.fullscreenchange=i),i=u+"fullscreenerror",e(document["on"+i])&&("ms"===u&&(i="MSFullscreenError"),n.fullscreenerror=i)}return t},i.requestFullscreen=function(e){i.supportsFullscreen()&&e[n.requestFullscreen]()},i.exitFullscreen=function(){i.supportsFullscreen()&&document[n.exitFullscreen]()},i}),define("Core/FeatureDetection",["./defaultValue","./defined","./Fullscreen"],function(e,r,t){"use strict";function n(e){for(var r=e.split("."),t=0,n=r.length;n>t;++t)r[t]=parseInt(r[t],10);return r}function i(){if(!r(p)){p=!1;var e=/ Chrome\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(p=!0,y=n(e[1]))}return p}function o(){return i()&&y}function a(){if(!r(v)&&(v=!1,!i()&&/ Safari\/[\.0-9]+/.test(navigator.userAgent))){var e=/ Version\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(v=!0,g=n(e[1]))}return v}function s(){return a()&&g}function u(){if(!r(b)){b=!1;var e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(navigator.userAgent);null!==e&&(b=!0,E=n(e[1]),E.isNightly=!!e[2])}return b}function f(){return u()&&E}function l(){if(!r(q)){q=!1;var e;"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(q=!0,S=n(e[1]))):"Netscape"===navigator.appName&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(navigator.userAgent),null!==e&&(q=!0,S=n(e[1])))}return q}function c(){return l()&&S}function h(){if(!r(C)){C=!1;var e=/Firefox\/([\.0-9]+)/.exec(navigator.userAgent);null!==e&&(C=!0,x=n(e[1]))}return C}function d(){return r(A)||(A=/Windows/i.test(navigator.appVersion)),A}function w(){return h()&&x}function m(){return r(T)||(T=r(window.PointerEvent)&&(!r(window.navigator.pointerEnabled)||window.navigator.pointerEnabled)),T}var p,y,v,g,b,E,q,S,C,x,A,T,I={isChrome:i,chromeVersion:o,isSafari:a,safariVersion:s,isWebkit:u,webkitVersion:f,isInternetExplorer:l,internetExplorerVersion:c,isFirefox:h,firefoxVersion:w,isWindows:d,hardwareConcurrency:e(navigator.hardwareConcurrency,3),supportsPointerEvents:m};return I.supportsFullscreen=function(){return t.supportsFullscreen()},I.supportsTypedArrays=function(){return"undefined"!=typeof ArrayBuffer},I.supportsWebWorkers=function(){return"undefined"!=typeof Worker},I}),define("Core/Color",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject","./Math"],function(e,r,t,n,i,o){"use strict";function a(e,r,t){return 0>t&&(t+=1),t>1&&(t-=1),1>6*t?e+6*(r-e)*t:1>2*t?r:2>3*t?e+6*(r-e)*(2/3-t):e}var s=function(r,t,n,i){this.red=e(r,1),this.green=e(t,1),this.blue=e(n,1),this.alpha=e(i,1)};s.fromCartesian4=function(e,n){if(!r(e))throw new t("cartesian is required");return r(n)?(n.red=e.x,n.green=e.y,n.blue=e.z,n.alpha=e.w,n):new s(e.x,e.y,e.z,e.w)},s.fromBytes=function(t,n,i,o,a){return t=s.byteToFloat(e(t,255)),n=s.byteToFloat(e(n,255)),i=s.byteToFloat(e(i,255)),o=s.byteToFloat(e(o,255)),r(a)?(a.red=t,a.green=n,a.blue=i,a.alpha=o,a):new s(t,n,i,o)},s.fromAlpha=function(e,n,i){if(!r(e))throw new t("color is required");if(!r(n))throw new t("alpha is required");return r(i)?(i.red=e.red,i.green=e.green,i.blue=e.blue,i.alpha=n,i):new s(e.red,e.green,e.blue,n)};var u,f,l;n.supportsTypedArrays()&&(u=new ArrayBuffer(4),f=new Uint32Array(u),l=new Uint8Array(u)),s.fromRgba=function(e){return f[0]=e,s.fromBytes(l[0],l[1],l[2],l[3])},s.fromHsl=function(r,t,n,i){r=e(r,0)%1,t=e(t,0),n=e(n,0),i=e(i,1);var o=n,u=n,f=n;if(0!==t){var l;l=.5>n?n*(1+t):n+t-n*t;var c=2*n-l;o=a(c,l,r+1/3),u=a(c,l,r),f=a(c,l,r-1/3)}return new s(o,u,f,i)},s.fromRandom=function(n,i){n=e(n,e.EMPTY_OBJECT);var a=n.red;if(!r(a)){var u=e(n.minimumRed,0),f=e(n.maximumRed,1);if(u>f)throw new t("minimumRed must be less than or equal to maximumRed");a=u+o.nextRandomNumber()*(f-u)}var l=n.green;if(!r(l)){var c=e(n.minimumGreen,0),h=e(n.maximumGreen,1);if(c>h)throw new t("minimumGreen must be less than or equal to maximumGreen");l=c+o.nextRandomNumber()*(h-c)}var d=n.blue;if(!r(d)){var w=e(n.minimumBlue,0),m=e(n.maximumBlue,1);if(w>m)throw new t("minimumBlue must be less than or equal to maximumBlue");d=w+o.nextRandomNumber()*(m-w)}var p=n.alpha;if(!r(p)){var y=e(n.minimumAlpha,0),v=e(n.maximumAlpha,1);if(y>v)throw new t("minimumAlpha must be less than or equal to maximumAlpha");p=y+o.nextRandomNumber()*(v-y)}return r(i)?(i.red=a,i.green=l,i.blue=d,i.alpha=p,i):new s(a,l,d,p)};var c=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,h=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,d=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,w=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;return s.fromCssColorString=function(n){if(!r(n))throw new t("color is required");var i=s[n.toUpperCase()];if(r(i))return s.clone(i);var o=c.exec(n);return null!==o?new s(parseInt(o[1],16)/15,parseInt(o[2],16)/15,parseInt(o[3],16)/15):(o=h.exec(n),null!==o?new s(parseInt(o[1],16)/255,parseInt(o[2],16)/255,parseInt(o[3],16)/255):(o=d.exec(n),null!==o?new s(parseFloat(o[1])/("%"===o[1].substr(-1)?100:255),parseFloat(o[2])/("%"===o[2].substr(-1)?100:255),parseFloat(o[3])/("%"===o[3].substr(-1)?100:255),parseFloat(e(o[4],"1.0"))):(o=w.exec(n),null!==o?s.fromHsl(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(e(o[4],"1.0"))):void 0)))},s.packedLength=4,s.pack=function(n,i,o){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");o=e(o,0),i[o++]=n.red,i[o++]=n.green,i[o++]=n.blue,i[o]=n.alpha},s.unpack=function(n,i,o){if(!r(n))throw new t("array is required");return i=e(i,0),r(o)||(o=new s),o.red=n[i++],o.green=n[i++],o.blue=n[i++],o.alpha=n[i],o},s.byteToFloat=function(e){return e/255},s.floatToByte=function(e){return 1===e?255:0|256*e},s.clone=function(e,t){return r(e)?r(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new s(e.red,e.green,e.blue,e.alpha):void 0},s.equals=function(e,t){return e===t||r(e)&&r(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha},s.equalsArray=function(e,r,t){return e.red===r[t]&&e.green===r[t+1]&&e.blue===r[t+2]&&e.alpha===r[t+3]},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 this===e||r(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t},s.prototype.toString=function(){return"("+this.red+", "+this.green+", "+this.blue+", "+this.alpha+")"},s.prototype.toCssColorString=function(){var e=s.floatToByte(this.red),r=s.floatToByte(this.green),t=s.floatToByte(this.blue);return 1===this.alpha?"rgb("+e+","+r+","+t+")":"rgba("+e+","+r+","+t+","+this.alpha+")"},s.prototype.toBytes=function(e){var t=s.floatToByte(this.red),n=s.floatToByte(this.green),i=s.floatToByte(this.blue),o=s.floatToByte(this.alpha);return r(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]},s.prototype.toRgba=function(){return l[0]=s.floatToByte(this.red),l[1]=s.floatToByte(this.green),l[2]=s.floatToByte(this.blue),l[3]=s.floatToByte(this.alpha),f[0]},s.prototype.brighten=function(e,n){if(!r(e))throw new t("magnitude is required.");if(0>e)throw new t("magnitude must be positive.");if(!r(n))throw new t("result is required.");return e=1-e,n.red=1-(1-this.red)*e,n.green=1-(1-this.green)*e,n.blue=1-(1-this.blue)*e,n.alpha=this.alpha,n},s.prototype.darken=function(e,n){if(!r(e))throw new t("magnitude is required.");if(0>e)throw new t("magnitude must be positive.");if(!r(n))throw new t("result is required.");return e=1-e,n.red=this.red*e,n.green=this.green*e,n.blue=this.blue*e,n.alpha=this.alpha,n},s.prototype.withAlpha=function(e,r){return s.fromAlpha(this,e,r)},s.ALICEBLUE=i(s.fromCssColorString("#F0F8FF")),s.ANTIQUEWHITE=i(s.fromCssColorString("#FAEBD7")),s.AQUA=i(s.fromCssColorString("#00FFFF")),s.AQUAMARINE=i(s.fromCssColorString("#7FFFD4")),s.AZURE=i(s.fromCssColorString("#F0FFFF")),s.BEIGE=i(s.fromCssColorString("#F5F5DC")),s.BISQUE=i(s.fromCssColorString("#FFE4C4")),s.BLACK=i(s.fromCssColorString("#000000")),s.BLANCHEDALMOND=i(s.fromCssColorString("#FFEBCD")),s.BLUE=i(s.fromCssColorString("#0000FF")),s.BLUEVIOLET=i(s.fromCssColorString("#8A2BE2")),s.BROWN=i(s.fromCssColorString("#A52A2A")),s.BURLYWOOD=i(s.fromCssColorString("#DEB887")),s.CADETBLUE=i(s.fromCssColorString("#5F9EA0")),s.CHARTREUSE=i(s.fromCssColorString("#7FFF00")),s.CHOCOLATE=i(s.fromCssColorString("#D2691E")),s.CORAL=i(s.fromCssColorString("#FF7F50")),s.CORNFLOWERBLUE=i(s.fromCssColorString("#6495ED")),s.CORNSILK=i(s.fromCssColorString("#FFF8DC")),s.CRIMSON=i(s.fromCssColorString("#DC143C")),s.CYAN=i(s.fromCssColorString("#00FFFF")),s.DARKBLUE=i(s.fromCssColorString("#00008B")),s.DARKCYAN=i(s.fromCssColorString("#008B8B")),s.DARKGOLDENROD=i(s.fromCssColorString("#B8860B")),s.DARKGRAY=i(s.fromCssColorString("#A9A9A9")),s.DARKGREEN=i(s.fromCssColorString("#006400")),s.DARKGREY=s.DARKGRAY,s.DARKKHAKI=i(s.fromCssColorString("#BDB76B")),s.DARKMAGENTA=i(s.fromCssColorString("#8B008B")),s.DARKOLIVEGREEN=i(s.fromCssColorString("#556B2F")),s.DARKORANGE=i(s.fromCssColorString("#FF8C00")),s.DARKORCHID=i(s.fromCssColorString("#9932CC")),s.DARKRED=i(s.fromCssColorString("#8B0000")),s.DARKSALMON=i(s.fromCssColorString("#E9967A")),s.DARKSEAGREEN=i(s.fromCssColorString("#8FBC8F")),s.DARKSLATEBLUE=i(s.fromCssColorString("#483D8B")),s.DARKSLATEGRAY=i(s.fromCssColorString("#2F4F4F")),s.DARKSLATEGREY=s.DARKSLATEGRAY,s.DARKTURQUOISE=i(s.fromCssColorString("#00CED1")),s.DARKVIOLET=i(s.fromCssColorString("#9400D3")),s.DEEPPINK=i(s.fromCssColorString("#FF1493")),s.DEEPSKYBLUE=i(s.fromCssColorString("#00BFFF")),s.DIMGRAY=i(s.fromCssColorString("#696969")),s.DIMGREY=s.DIMGRAY,s.DODGERBLUE=i(s.fromCssColorString("#1E90FF")),s.FIREBRICK=i(s.fromCssColorString("#B22222")),s.FLORALWHITE=i(s.fromCssColorString("#FFFAF0")),s.FORESTGREEN=i(s.fromCssColorString("#228B22")),s.FUSCHIA=i(s.fromCssColorString("#FF00FF")),s.GAINSBORO=i(s.fromCssColorString("#DCDCDC")),s.GHOSTWHITE=i(s.fromCssColorString("#F8F8FF")),s.GOLD=i(s.fromCssColorString("#FFD700")),s.GOLDENROD=i(s.fromCssColorString("#DAA520")),s.GRAY=i(s.fromCssColorString("#808080")),s.GREEN=i(s.fromCssColorString("#008000")),s.GREENYELLOW=i(s.fromCssColorString("#ADFF2F")),s.GREY=s.GRAY,s.HONEYDEW=i(s.fromCssColorString("#F0FFF0")),s.HOTPINK=i(s.fromCssColorString("#FF69B4")),s.INDIANRED=i(s.fromCssColorString("#CD5C5C")),s.INDIGO=i(s.fromCssColorString("#4B0082")),s.IVORY=i(s.fromCssColorString("#FFFFF0")),s.KHAKI=i(s.fromCssColorString("#F0E68C")),s.LAVENDER=i(s.fromCssColorString("#E6E6FA")),s.LAVENDAR_BLUSH=i(s.fromCssColorString("#FFF0F5")),s.LAWNGREEN=i(s.fromCssColorString("#7CFC00")),s.LEMONCHIFFON=i(s.fromCssColorString("#FFFACD")),s.LIGHTBLUE=i(s.fromCssColorString("#ADD8E6")),s.LIGHTCORAL=i(s.fromCssColorString("#F08080")),s.LIGHTCYAN=i(s.fromCssColorString("#E0FFFF")),s.LIGHTGOLDENRODYELLOW=i(s.fromCssColorString("#FAFAD2")),s.LIGHTGRAY=i(s.fromCssColorString("#D3D3D3")),s.LIGHTGREEN=i(s.fromCssColorString("#90EE90")),s.LIGHTGREY=s.LIGHTGRAY,s.LIGHTPINK=i(s.fromCssColorString("#FFB6C1")),s.LIGHTSEAGREEN=i(s.fromCssColorString("#20B2AA")),s.LIGHTSKYBLUE=i(s.fromCssColorString("#87CEFA")),s.LIGHTSLATEGRAY=i(s.fromCssColorString("#778899")),s.LIGHTSLATEGREY=s.LIGHTSLATEGRAY,s.LIGHTSTEELBLUE=i(s.fromCssColorString("#B0C4DE")),s.LIGHTYELLOW=i(s.fromCssColorString("#FFFFE0")),s.LIME=i(s.fromCssColorString("#00FF00")),s.LIMEGREEN=i(s.fromCssColorString("#32CD32")),s.LINEN=i(s.fromCssColorString("#FAF0E6")),s.MAGENTA=i(s.fromCssColorString("#FF00FF")),s.MAROON=i(s.fromCssColorString("#800000")),s.MEDIUMAQUAMARINE=i(s.fromCssColorString("#66CDAA")),s.MEDIUMBLUE=i(s.fromCssColorString("#0000CD")),s.MEDIUMORCHID=i(s.fromCssColorString("#BA55D3")),s.MEDIUMPURPLE=i(s.fromCssColorString("#9370DB")),s.MEDIUMSEAGREEN=i(s.fromCssColorString("#3CB371")),s.MEDIUMSLATEBLUE=i(s.fromCssColorString("#7B68EE")),s.MEDIUMSPRINGGREEN=i(s.fromCssColorString("#00FA9A")),s.MEDIUMTURQUOISE=i(s.fromCssColorString("#48D1CC")),s.MEDIUMVIOLETRED=i(s.fromCssColorString("#C71585")),s.MIDNIGHTBLUE=i(s.fromCssColorString("#191970")),s.MINTCREAM=i(s.fromCssColorString("#F5FFFA")),s.MISTYROSE=i(s.fromCssColorString("#FFE4E1")),s.MOCCASIN=i(s.fromCssColorString("#FFE4B5")),s.NAVAJOWHITE=i(s.fromCssColorString("#FFDEAD")),s.NAVY=i(s.fromCssColorString("#000080")),s.OLDLACE=i(s.fromCssColorString("#FDF5E6")),s.OLIVE=i(s.fromCssColorString("#808000")),s.OLIVEDRAB=i(s.fromCssColorString("#6B8E23")),s.ORANGE=i(s.fromCssColorString("#FFA500")),s.ORANGERED=i(s.fromCssColorString("#FF4500")),s.ORCHID=i(s.fromCssColorString("#DA70D6")),s.PALEGOLDENROD=i(s.fromCssColorString("#EEE8AA")),s.PALEGREEN=i(s.fromCssColorString("#98FB98")),s.PALETURQUOISE=i(s.fromCssColorString("#AFEEEE")),s.PALEVIOLETRED=i(s.fromCssColorString("#DB7093")),s.PAPAYAWHIP=i(s.fromCssColorString("#FFEFD5")),s.PEACHPUFF=i(s.fromCssColorString("#FFDAB9")),s.PERU=i(s.fromCssColorString("#CD853F")),s.PINK=i(s.fromCssColorString("#FFC0CB")),s.PLUM=i(s.fromCssColorString("#DDA0DD")),s.POWDERBLUE=i(s.fromCssColorString("#B0E0E6")),s.PURPLE=i(s.fromCssColorString("#800080")),s.RED=i(s.fromCssColorString("#FF0000")),s.ROSYBROWN=i(s.fromCssColorString("#BC8F8F")),s.ROYALBLUE=i(s.fromCssColorString("#4169E1")),s.SADDLEBROWN=i(s.fromCssColorString("#8B4513")),s.SALMON=i(s.fromCssColorString("#FA8072")),s.SANDYBROWN=i(s.fromCssColorString("#F4A460")),s.SEAGREEN=i(s.fromCssColorString("#2E8B57")),s.SEASHELL=i(s.fromCssColorString("#FFF5EE")),s.SIENNA=i(s.fromCssColorString("#A0522D")),s.SILVER=i(s.fromCssColorString("#C0C0C0")),s.SKYBLUE=i(s.fromCssColorString("#87CEEB")),s.SLATEBLUE=i(s.fromCssColorString("#6A5ACD")),s.SLATEGRAY=i(s.fromCssColorString("#708090")),s.SLATEGREY=s.SLATEGRAY,s.SNOW=i(s.fromCssColorString("#FFFAFA")),s.SPRINGGREEN=i(s.fromCssColorString("#00FF7F")),s.STEELBLUE=i(s.fromCssColorString("#4682B4")),s.TAN=i(s.fromCssColorString("#D2B48C")),s.TEAL=i(s.fromCssColorString("#008080")),s.THISTLE=i(s.fromCssColorString("#D8BFD8")),s.TOMATO=i(s.fromCssColorString("#FF6347")),s.TURQUOISE=i(s.fromCssColorString("#40E0D0")),s.VIOLET=i(s.fromCssColorString("#EE82EE")),s.WHEAT=i(s.fromCssColorString("#F5DEB3")),s.WHITE=i(s.fromCssColorString("#FFFFFF")),s.WHITESMOKE=i(s.fromCssColorString("#F5F5F5")),s.YELLOW=i(s.fromCssColorString("#FFFF00")),s.YELLOWGREEN=i(s.fromCssColorString("#9ACD32")),s.TRANSPARENT=i(new s(0,0,0,0)),s}),define("Core/ComponentDatatype",["./defaultValue","./defined","./DeveloperError","./FeatureDetection","./freezeObject"],function(e,r,t,n,i){"use strict";if(!n.supportsTypedArrays())return{};var o={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,FLOAT:5126,DOUBLE:5130};return o.getSizeInBytes=function(e){if(!r(e))throw new t("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.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case o.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new t("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 Float32Array?o.FLOAT:e instanceof Float64Array?o.DOUBLE:void 0},o.validate=function(e){return r(e)&&(e===o.BYTE||e===o.UNSIGNED_BYTE||e===o.SHORT||e===o.UNSIGNED_SHORT||e===o.FLOAT||e===o.DOUBLE)},o.createTypedArray=function(e,n){if(!r(e))throw new t("componentDatatype is required.");if(!r(n))throw new t("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.FLOAT:return new Float32Array(n);case o.DOUBLE:return new Float64Array(n);default:throw new t("componentDatatype is not a valid value.")}},o.createArrayBufferView=function(n,i,a,s){if(!r(n))throw new t("componentDatatype is required.");if(!r(i))throw new t("buffer is required.");switch(a=e(a,0),s=e(s,(i.byteLength-a)/o.getSizeInBytes(n)),n){case o.BYTE:return new Int8Array(i,a,s);case o.UNSIGNED_BYTE:return new Uint8Array(i,a,s);case o.SHORT:return new Int16Array(i,a,s);case o.UNSIGNED_SHORT:return new Uint16Array(i,a,s);case o.FLOAT:return new Float32Array(i,a,s);case o.DOUBLE:return new Float64Array(i,a,s);default:throw new t("componentDatatype is not a valid value.")}},i(o)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var r={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(r)}),define("Core/PrimitiveType",["./freezeObject"],function(e){"use strict";var r={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,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",["./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,r,t,n,i){"use strict";var o=function(o){if(o=e(o,e.EMPTY_OBJECT),!r(o.attributes))throw new t("options.attributes is required.");this.attributes=o.attributes,this.indices=o.indices,this.primitiveType=e(o.primitiveType,i.TRIANGLES),this.boundingSphere=o.boundingSphere,this.geometryType=e(o.geometryType,n.NONE),this.boundingSphereCV=void 0};return o.computeNumberOfVertices=function(e){if(!r(e))throw new t("geometry is required.");var n=-1;for(var i in e.attributes)if(e.attributes.hasOwnProperty(i)&&r(e.attributes[i])&&r(e.attributes[i].values)){var o=e.attributes[i],a=o.values.length/o.componentsPerAttribute;if(n!==a&&-1!==n)throw new t("All attribute lists must have the same number of attributes.");n=a}return n},o}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e,r,t){"use strict";var n=function(n){if(n=e(n,e.EMPTY_OBJECT),!r(n.componentDatatype))throw new t("options.componentDatatype is required.");if(!r(n.componentsPerAttribute))throw new t("options.componentsPerAttribute is required.");if(n.componentsPerAttribute<1||n.componentsPerAttribute>4)throw new t("options.componentsPerAttribute must be between 1 and 4.");if(!r(n.values))throw new t("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";var r=function(r){r=e(r,e.EMPTY_OBJECT),this.position=r.position,this.normal=r.normal,this.st=r.st,this.binormal=r.binormal,this.tangent=r.tangent,this.color=r.color};return r}),define("Core/Cartesian2",["./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n,i){"use strict";var o=function(r,t){this.x=e(r,0),this.y=e(t,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(n,i,o){if(!r(n))throw new t("value is required");if(!r(i))throw new t("array is required");o=e(o,0),i[o++]=n.x,i[o]=n.y},o.unpack=function(n,i,a){if(!r(n))throw new t("array is required");return i=e(i,0),r(a)||(a=new o),a.x=n[i++],a.y=n[i],a},o.fromArray=o.unpack,o.maximumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.max(e.x,e.y)},o.minimumComponent=function(e){if(!r(e))throw new t("cartesian is required");return Math.min(e.x,e.y)},o.minimumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.min(e.x,n.x),i.y=Math.min(e.y,n.y),i},o.maximumByComponent=function(e,n,i){if(!r(e))throw new t("first is required.");if(!r(n))throw new t("second is required.");if(!r(i))throw new t("result is required.");return i.x=Math.max(e.x,n.x),i.y=Math.max(e.y,n.y),i},o.magnitudeSquared=function(e){if(!r(e))throw new t("cartesian is required");return e.x*e.x+e.y*e.y},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return o.subtract(e,n,a),o.magnitude(a)},o.distanceSquared=function(e,n){if(!r(e)||!r(n))throw new t("left and right are required.");return o.subtract(e,n,a),o.magnitudeSquared(a)},o.normalize=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");var i=o.magnitude(e);return n.x=e.x/i,n.y=e.y/i,n},o.dot=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return e.x*n.x+e.y*n.y},o.multiplyComponents=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x*n.x,i.y=e.y*n.y,i},o.add=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x+n.x,i.y=e.y+n.y,i},o.subtract=function(e,n,i){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");if(!r(i))throw new t("result is required");return i.x=e.x-n.x,i.y=e.y-n.y,i},o.multiplyByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x*n,i.y=e.y*n,i},o.divideByScalar=function(e,n,i){if(!r(e))throw new t("cartesian is required");if("number"!=typeof n)throw new t("scalar is required and must be a number.");if(!r(i))throw new t("result is required");return i.x=e.x/n,i.y=e.y/n,i},o.negate=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=-e.x,n.y=-e.y,n},o.abs=function(e,n){if(!r(e))throw new t("cartesian is required");if(!r(n))throw new t("result is required");return n.x=Math.abs(e.x),n.y=Math.abs(e.y),n};var s=new o;o.lerp=function(e,n,i,a){if(!r(e))throw new t("start is required.");if(!r(n))throw new t("end is required.");if("number"!=typeof i)throw new t("t is required and must be a number.");if(!r(a))throw new t("result is required.");return o.multiplyByScalar(n,i,s),a=o.multiplyByScalar(e,1-i,a),o.add(s,a,a)};var u=new o,f=new o;o.angleBetween=function(e,n){if(!r(e))throw new t("left is required");if(!r(n))throw new t("right is required");return o.normalize(e,u),o.normalize(n,f),i.acosClamped(o.dot(u,f))};var l=new o;return o.mostOrthogonalAxis=function(e,n){if(!r(e))throw new t("cartesian is required.");if(!r(n))throw new t("result is required.");var i=o.normalize(e,l);return o.abs(i,i),n=i.x<=i.y?o.clone(o.UNIT_X,n):o.clone(o.UNIT_Y,n)},o.equals=function(e,t){return e===t||r(e)&&r(t)&&e.x===t.x&&e.y===t.y},o.equalsArray=function(e,r,t){return e.x===r[t]&&e.y===r[t+1]},o.equalsEpsilon=function(e,t,n,o){return e===t||r(e)&&r(t)&&i.equalsEpsilon(e.x,t.x,n,o)&&i.equalsEpsilon(e.y,t.y,n,o)},o.ZERO=n(new o(0,0)),o.UNIT_X=n(new o(1,0)),o.UNIT_Y=n(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,r,t){return o.equalsEpsilon(this,e,r,t)},o.prototype.toString=function(){return"("+this.x+", "+this.y+")"},o}),define("Core/AttributeCompression",["./Cartesian2","./Cartesian3","./defined","./DeveloperError","./Math"],function(e,r,t,n,i){"use strict";var o={};o.octEncode=function(e,o){if(!t(e))throw new n("vector is required.");if(!t(o))throw new n("result is required.");var a=r.magnitudeSquared(e);if(Math.abs(a-1)>i.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,u=o.y;o.x=(1-Math.abs(u))*i.signNotZero(s),o.y=(1-Math.abs(s))*i.signNotZero(u)
}return o.x=i.toSNorm(o.x),o.y=i.toSNorm(o.y),o},o.octDecode=function(e,o,a){if(!t(a))throw new n("result is required.");if(0>e||e>255||0>o||o>255)throw new n("x and y must be a signed normalized integer between 0 and 255");if(a.x=i.fromSNorm(e),a.y=i.fromSNorm(o),a.z=1-(Math.abs(a.x)+Math.abs(a.y)),a.z<0){var s=a.x;a.x=(1-Math.abs(a.y))*i.signNotZero(s),a.y=(1-Math.abs(s))*i.signNotZero(a.y)}return r.normalize(a,a)},o.octPackFloat=function(e){if(!t(e))throw new n("encoded is required.");return 256*e.x+e.y};var a=new e;return o.octEncodeFloat=function(e){return o.octEncode(e,a),o.octPackFloat(a)},o.octDecodeFloat=function(e,r){if(!t(e))throw new n("value is required.");var i=e/256,a=Math.floor(i),s=256*(i-a);return o.octDecode(a,s,r)},o.octPack=function(e,r,i,s){if(!t(e))throw new n("v1 is required.");if(!t(r))throw new n("v2 is required.");if(!t(i))throw new n("v3 is required.");if(!t(s))throw new n("result is required.");var u=o.octEncodeFloat(e),f=o.octEncodeFloat(r),l=o.octEncode(i,a);return s.x=65536*l.x+u,s.y=65536*l.y+f,s},o.octUnpack=function(e,r,i,a){if(!t(e))throw new n("packed is required.");if(!t(r))throw new n("v1 is required.");if(!t(i))throw new n("v2 is required.");if(!t(a))throw new n("v3 is required.");var s=e.x/65536,u=Math.floor(s),f=65536*(s-u);s=e.y/65536;var l=Math.floor(s),c=65536*(s-l);o.octDecodeFloat(f,r),o.octDecodeFloat(c,i),o.octDecode(u,l,a)},o.compressTextureCoordinates=function(e){if(!t(e))throw new n("textureCoordinates is required.");var r=1===e.x?4095:0|4096*e.x,i=1===e.y?4095:0|4096*e.y;return 4096*r+i},o.decompressTextureCoordinates=function(e,r){if(!t(e))throw new n("compressed is required.");if(!t(r))throw new n("result is required.");var i=e/4096;return r.x=Math.floor(i)/4096,r.y=i-Math.floor(i),r},o}),define("Core/barycentricCoordinates",["./Cartesian2","./Cartesian3","./defined","./DeveloperError"],function(e,r,t,n){"use strict";var i=new r,o=new r,a=new r,s=function(s,u,f,l,c){if(!(t(s)&&t(u)&&t(f)&&t(l)))throw new n("point, p0, p1, and p2 are required.");t(c)||(c=new r);var h,d,w,m,p,y,v,g;t(u.z)?(h=r.subtract(f,u,i),d=r.subtract(l,u,o),w=r.subtract(s,u,a),m=r.dot(h,h),p=r.dot(h,d),y=r.dot(h,w),v=r.dot(d,d),g=r.dot(d,w)):(h=e.subtract(f,u,i),d=e.subtract(l,u,o),w=e.subtract(s,u,a),m=e.dot(h,h),p=e.dot(h,d),y=e.dot(h,w),v=e.dot(d,d),g=e.dot(d,w));var b=1/(m*v-p*p);return c.y=(v*y-p*g)*b,c.z=(m*g-p*y)*b,c.x=1-c.y-c.z,c};return s}),define("Core/EncodedCartesian3",["./Cartesian3","./defined","./DeveloperError"],function(e,r,t){"use strict";var n=function(){this.high=e.clone(e.ZERO),this.low=e.clone(e.ZERO)};n.encode=function(e,n){if(!r(e))throw new t("value is required");r(n)||(n={high:0,low:0});var i;return e>=0?(i=65536*Math.floor(e/65536),n.high=i,n.low=e-i):(i=65536*Math.floor(-e/65536),n.high=-i,n.low=e+i),n};var i={high:0,low:0};n.fromCartesian=function(e,o){if(!r(e))throw new t("cartesian is required");r(o)||(o=new n);var a=o.high,s=o.low;return n.encode(e.x,i),a.x=i.high,s.x=i.low,n.encode(e.y,i),a.y=i.high,s.y=i.low,n.encode(e.z,i),a.z=i.high,s.z=i.low,o};var o=new n;return n.writeElements=function(e,i,a){if(!r(e))throw new t("cartesian is required");if(!r(i))throw new t("cartesianArray is required");if("number"!=typeof a||0>a)throw new t("index must be a number greater than or equal to 0.");n.fromCartesian(e,o);var s=o.high,u=o.low;i[a]=s.x,i[a+1]=s.y,i[a+2]=s.z,i[a+3]=u.x,i[a+4]=u.y,i[a+5]=u.z},n}),define("Core/GeometryInstance",["./defaultValue","./defined","./DeveloperError","./Matrix4"],function(e,r,t,n){"use strict";var i=function(i){if(i=e(i,e.EMPTY_OBJECT),!r(i.geometry))throw new t("options.geometry is required.");this.geometry=i.geometry,this.modelMatrix=n.clone(e(i.modelMatrix,n.IDENTITY)),this.id=i.id,this.pickPrimitive=i.pickPrimitive,this.attributes=e(i.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0};return i}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math"],function(e,r,t,n){"use strict";var i={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125};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 r("indexDatatype is required and must be a valid IndexDatatype constant.")},i.validate=function(r){return e(r)&&(r===i.UNSIGNED_BYTE||r===i.UNSIGNED_SHORT||r===i.UNSIGNED_INT)},i.createTypedArray=function(t,i){if(!e(t))throw new r("numberOfVertices is required.");return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(i):new Uint16Array(i)},i.createTypedArrayFromArrayBuffer=function(t,i,o,a){if(!e(t))throw new r("numberOfVertices is required.");if(!e(i))throw new r("sourceArray is required.");if(!e(o))throw new r("byteOffset is required.");return t>n.SIXTY_FOUR_KILOBYTES?new Uint32Array(i,o,a):new Uint16Array(i,o,a)},t(i)}),define("Core/QuadraticRealPolynomial",["./DeveloperError","./Math"],function(e,r){"use strict";function t(e,t,n){var i=e+t;return r.sign(e)!==r.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}var n={};return n.computeDiscriminant=function(r,t,n){if("number"!=typeof r)throw new e("a is a required number.");if("number"!=typeof t)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");var i=t*t-4*r*n;return i},n.computeRealRoots=function(n,i,o){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof i)throw new e("b is a required number.");if("number"!=typeof o)throw new e("c is a required number.");var a;if(0===n)return 0===i?[]:[-o/i];if(0===i){if(0===o)return[0,0];var s=Math.abs(o),u=Math.abs(n);if(u>s&&s/u<r.EPSILON14)return[0,0];if(s>u&&u/s<r.EPSILON14)return[];if(a=-o/n,0>a)return[];var f=Math.sqrt(a);return[-f,f]}if(0===o)return a=-i/n,0>a?[a,0]:[0,a];var l=i*i,c=4*n*o,h=t(l,-c,r.EPSILON14);if(0>h)return[];var d=-.5*t(i,r.sign(i)*Math.sqrt(h),r.EPSILON14);return i>0?[d/n,o/d]:[o/d,d/n]},n}),define("Core/CubicRealPolynomial",["./DeveloperError","./QuadraticRealPolynomial"],function(e,r){"use strict";function t(e,r,t,n){var i,o,a=e,s=r/3,u=t/3,f=n,l=a*u,c=s*f,h=s*s,d=u*u,w=a*u-h,m=a*f-s*u,p=s*f-d,y=4*w*p-m*m;if(0>y){var v,g,b;h*c>=l*d?(v=a,g=w,b=-2*s*w+a*m):(v=f,g=p,b=-f*m+2*u*p);var E=0>b?-1:1,q=-E*Math.abs(v)*Math.sqrt(-y);o=-b+q;var S=o/2,C=0>S?-Math.pow(-S,1/3):Math.pow(S,1/3),x=o===q?-C:-g/C;return i=0>=g?C+x:-b/(C*C+x*x+g),h*c>=l*d?[(i-s)/a]:[-f/(i+u)]}var A=w,T=-2*s*w+a*m,I=p,M=-f*m+2*u*p,O=Math.sqrt(y),R=Math.sqrt(3)/2,N=Math.abs(Math.atan2(a*O,-T)/3);i=2*Math.sqrt(-A);var P=Math.cos(N);o=i*P;var L=i*(-P/2-R*Math.sin(N)),z=o+L>2*s?o-s:L-s,D=a,F=z/D;N=Math.abs(Math.atan2(f*O,-M)/3),i=2*Math.sqrt(-I),P=Math.cos(N),o=i*P,L=i*(-P/2-R*Math.sin(N));var _=-f,B=2*u>o+L?o+u:L+u,U=_/B,G=D*B,k=-z*B-D*_,V=z*_,W=(u*k-s*V)/(-s*k+u*G);return W>=F?U>=F?U>=W?[F,W,U]:[F,U,W]:[U,F,W]:U>=F?[W,F,U]:U>=W?[W,U,F]:[U,W,F]}var n={};return n.computeDiscriminant=function(r,t,n,i){if("number"!=typeof r)throw new e("a is a required number.");if("number"!=typeof t)throw new e("b is a required number.");if("number"!=typeof n)throw new e("c is a required number.");if("number"!=typeof i)throw new e("d is a required number.");var o=r*r,a=t*t,s=n*n,u=i*i,f=18*r*t*n*i+a*s-27*o*u-4*(r*s*n+a*t*i);return f},n.computeRealRoots=function(n,i,o,a){if("number"!=typeof n)throw new e("a is a required number.");if("number"!=typeof i)throw new e("b is a required number.");if("number"!=typeof o)throw new e("c is a required number.");if("number"!=typeof a)throw new e("d is a required number.");var s,u;if(0===n)return r.computeRealRoots(i,o,a);if(0===i){if(0===o){if(0===a)return[0,0,0];u=-a/n;var f=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3);return[f,f,f]}return 0===a?(s=r.computeRealRoots(n,0,o),0===s.Length?[0]:[s[0],0,s[1]]):t(n,0,o,a)}return 0===o?0===a?(u=-i/n,0>u?[u,0,0]:[0,0,u]):t(n,i,0,a):0===a?(s=r.computeRealRoots(n,i,o),0===s.length?[0]:s[1]<=0?[s[0],s[1],0]:s[0]>=0?[0,s[0],s[1]]:[s[0],0,s[1]]):t(n,i,o,a)},n}),define("Core/QuarticRealPolynomial",["./CubicRealPolynomial","./DeveloperError","./Math","./QuadraticRealPolynomial"],function(e,r,t,n){"use strict";function i(r,i,o,a){var s=r*r,u=i-3*s/8,f=o-i*r/2+s*r/8,l=a-o*r/4+i*s/16-3*s*s/256,c=e.computeRealRoots(1,2*u,u*u-4*l,-f*f);if(c.length>0){var h=-r/4,d=c[c.length-1];if(Math.abs(d)<t.EPSILON14){var w=n.computeRealRoots(1,u,l);if(2===w.length){var m,p=w[0],y=w[1];if(p>=0&&y>=0){var v=Math.sqrt(p),g=Math.sqrt(y);return[h-g,h-v,h+v,h+g]}if(p>=0&&0>y)return m=Math.sqrt(p),[h-m,h+m];if(0>p&&y>=0)return m=Math.sqrt(y),[h-m,h+m]}return[]}if(d>0){var b=Math.sqrt(d),E=(u+d-f/b)/2,q=(u+d+f/b)/2,S=n.computeRealRoots(1,b,E),C=n.computeRealRoots(1,-b,q);return 0!==S.length?(S[0]+=h,S[1]+=h,0!==C.length?(C[0]+=h,C[1]+=h,S[1]<=C[0]?[S[0],S[1],C[0],C[1]]:C[1]<=S[0]?[C[0],C[1],S[0],S[1]]:S[0]>=C[0]&&S[1]<=C[1]?[C[0],S[0],S[1],C[1]]:C[0]>=S[0]&&C[1]<=S[1]?[S[0],C[0],C[1],S[1]]:S[0]>C[0]&&S[0]<C[1]?[C[0],S[0],C[1],S[1]]:[S[0],C[0],S[1],C[1]]):S):0!==C.length?(C[0]+=h,C[1]+=h,C):[]}}return[]}function o(r,i,o,a){var s=o*o,u=i*i,f=r*r,l=-2*i,c=o*r+u-4*a,h=f*a-o*i*r+s,d=e.computeRealRoots(1,l,c,h);if(d.length>0){var w,m,p=d[0],y=i-p,v=y*y,g=r/2,b=y/2,E=v-4*a,q=v+4*Math.abs(a),S=f-4*p,C=f+4*Math.abs(p);if(0>p||S*q>E*C){var x=Math.sqrt(S);w=x/2,m=0===x?0:(r*b-o)/x}else{var A=Math.sqrt(E);w=0===A?0:(r*b-o)/A,m=A/2}var T,I;0===g&&0===w?(T=0,I=0):t.sign(g)===t.sign(w)?(T=g+w,I=p/T):(I=g-w,T=p/I);var M,O;0===b&&0===m?(M=0,O=0):t.sign(b)===t.sign(m)?(M=b+m,O=a/M):(O=b-m,M=a/O);var R=n.computeRealRoots(1,T,M),N=n.computeRealRoots(1,I,O);if(0!==R.length)return 0!==N.length?R[1]<=N[0]?[R[0],R[1],N[0],N[1]]:N[1]<=R[0]?[N[0],N[1],R[0],R[1]]:R[0]>=N[0]&&R[1]<=N[1]?[N[0],R[0],R[1],N[1]]:N[0]>=R[0]&&N[1]<=R[1]?[R[0],N[0],N[1],R[1]]:R[0]>N[0]&&R[0]<N[1]?[N[0],R[0],N[1],R[1]]:[R[0],N[0],R[1],N[1]]:R;if(0!==N.length)return N}return[]}var a={};return a.computeDiscriminant=function(e,t,n,i,o){if("number"!=typeof e)throw new r("a is a required number.");if("number"!=typeof t)throw new r("b is a required number.");if("number"!=typeof n)throw new r("c is a required number.");if("number"!=typeof i)throw new r("d is a required number.");if("number"!=typeof o)throw new r("e is a required number.");var a=e*e,s=a*e,u=t*t,f=u*t,l=n*n,c=l*n,h=i*i,d=h*i,w=o*o,m=w*o,p=u*l*h-4*f*d-4*e*c*h+18*e*t*n*d-27*a*h*h+256*s*m+o*(18*f*n*i-4*u*c+16*e*l*l-80*e*t*l*i-6*e*u*h+144*a*n*h)+w*(144*e*u*n-27*u*u-128*a*l-192*a*t*i);return p},a.computeRealRoots=function(n,a,s,u,f){if("number"!=typeof n)throw new r("a is a required number.");if("number"!=typeof a)throw new r("b is a required number.");if("number"!=typeof s)throw new r("c is a required number.");if("number"!=typeof u)throw new r("d is a required number.");if("number"!=typeof f)throw new r("e is a required number.");if(Math.abs(n)<t.EPSILON15)return e.computeRealRoots(a,s,u,f);var l=a/n,c=s/n,h=u/n,d=f/n,w=0>l?1:0;switch(w+=0>c?w+1:w,w+=0>h?w+1:w,w+=0>d?w+1:w){case 0:return i(l,c,h,d);case 1:return o(l,c,h,d);case 2:return o(l,c,h,d);case 3:return i(l,c,h,d);case 4:return i(l,c,h,d);case 5:return o(l,c,h,d);case 6:return i(l,c,h,d);case 7:return i(l,c,h,d);case 8:return o(l,c,h,d);case 9:return i(l,c,h,d);case 10:return i(l,c,h,d);case 11:return o(l,c,h,d);case 12:return i(l,c,h,d);case 13:return i(l,c,h,d);case 14:return i(l,c,h,d);case 15:return i(l,c,h,d);default:return void 0}},a}),define("Core/Ray",["./Cartesian3","./defaultValue","./defined","./DeveloperError"],function(e,r,t,n){"use strict";var i=function(t,n){n=e.clone(r(n,e.ZERO)),e.equals(n,e.ZERO)||e.normalize(n,n),this.origin=e.clone(r(t,e.ZERO)),this.direction=n};return i.getPoint=function(r,i,o){if(!t(r))throw new n("ray is requred");if("number"!=typeof i)throw new n("t is a required number");return t(o)||(o=new e),o=e.multiplyByScalar(r.direction,i,o),e.add(r.origin,o,o)},i}),define("Core/IntersectionTests",["./Cartesian3","./Cartographic","./defaultValue","./defined","./DeveloperError","./Math","./Matrix3","./QuadraticRealPolynomial","./QuarticRealPolynomial","./Ray"],function(e,r,t,n,i,o,a,s,u,f){"use strict";function l(r,a,s,u,f){if(!n(r))throw new i("ray is required.");if(!n(a))throw new i("p0 is required.");if(!n(s))throw new i("p1 is required.");if(!n(u))throw new i("p2 is required.");f=t(f,!1);var l,c,h,d,w,m=r.origin,E=r.direction,q=e.subtract(s,a,p),S=e.subtract(u,a,y),C=e.cross(E,S,v),x=e.dot(q,C);if(f){if(x<o.EPSILON6)return void 0;if(l=e.subtract(m,a,g),h=e.dot(l,C),0>h||h>x)return void 0;if(c=e.cross(l,q,b),d=e.dot(E,c),0>d||h+d>x)return void 0;w=e.dot(S,c)/x}else{if(Math.abs(x)<o.EPSILON6)return void 0;var A=1/x;if(l=e.subtract(m,a,g),h=e.dot(l,C)*A,0>h||h>1)return void 0;if(c=e.cross(l,q,b),d=e.dot(E,c)*A,0>d||h+d>1)return void 0;w=e.dot(S,c)*A}return w}function c(e,r,t,n){var i=r*r-4*e*t;if(0>i)return void 0;if(i>0){var o=1/(2*e),a=Math.sqrt(i),s=(-r+a)*o,u=(-r-a)*o;return u>s?(n.root0=s,n.root1=u):(n.root0=u,n.root1=s),n}var f=-r/(2*e);return 0===f?void 0:(n.root0=n.root1=f,n)}function h(r,t,i){n(i)||(i={});var o=r.origin,a=r.direction,s=t.center,u=t.radius*t.radius,f=e.subtract(o,s,v),l=e.dot(a,a),h=2*e.dot(a,f),d=e.magnitudeSquared(f)-u,w=c(l,h,d,q);return n(w)?(i.start=w.root0,i.stop=w.root1,i):void 0}function d(e,r,t){var n=e+r;return o.sign(e)!==o.sign(r)&&Math.abs(n/Math.max(Math.abs(e),Math.abs(r)))<t?0:n}function w(r,t,n,i,f){var l,c=i*i,h=f*f,w=(r[a.COLUMN1ROW1]-r[a.COLUMN2ROW2])*h,m=f*(i*d(r[a.COLUMN1ROW0],r[a.COLUMN0ROW1],o.EPSILON15)+t.y),p=r[a.COLUMN0ROW0]*c+r[a.COLUMN2ROW2]*h+i*t.x+n,y=h*d(r[a.COLUMN2ROW1],r[a.COLUMN1ROW2],o.EPSILON15),v=f*(i*d(r[a.COLUMN2ROW0],r[a.COLUMN0ROW2])+t.z),g=[];if(0===v&&0===y){if(l=s.computeRealRoots(w,m,p),0===l.length)return g;var b=l[0],E=Math.sqrt(Math.max(1-b*b,0));if(g.push(new e(i,f*b,f*-E)),g.push(new e(i,f*b,f*E)),2===l.length){var q=l[1],S=Math.sqrt(Math.max(1-q*q,0));g.push(new e(i,f*q,f*-S)),g.push(new e(i,f*q,f*S))}return g}var C=v*v,x=y*y,A=w*w,T=v*y,I=A+x,M=2*(m*w+T),O=2*p*w+m*m-x+C,R=2*(p*m-T),N=p*p-C;if(0===I&&0===M&&0===O&&0===R)return g;l=u.computeRealRoots(I,M,O,R,N);var P=l.length;if(0===P)return g;for(var L=0;P>L;++L){var z,D=l[L],F=D*D,_=Math.max(1-F,0),B=Math.sqrt(_);z=o.sign(w)===o.sign(p)?d(w*F+p,m*D,o.EPSILON12):o.sign(p)===o.sign(m*D)?d(w*F,m*D+p,o.EPSILON12):d(w*F+m*D,p,o.EPSILON12);var U=d(y*D,v,o.EPSILON15),G=z*U;0>G?g.push(new e(i,f*D,f*B)):G>0?g.push(new e(i,f*D,f*-B)):0!==B?(g.push(new e(i,f*D,f*-B)),g.push(new e(i,f*D,f*B)),++L):g.push(new e(i,f*D,f*B))}return g}var m={};m.rayPlane=function(r,t,a){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("plane is required.");n(a)||(a=new e);var s=r.origin,u=r.direction,f=t.normal,l=e.dot(f,u);if(Math.abs(l)<o.EPSILON15)return void 0;var c=(-t.distance-e.dot(f,s))/l;return 0>c?void 0:(a=e.multiplyByScalar(u,c,a),e.add(s,a,a))};var p=new e,y=new e,v=new e,g=new e,b=new e;m.rayTriangle=function(r,t,i,o,a,s){var u=l(r,t,i,o,a);return!n(u)||0>u?void 0:(n(s)||(s=new e),e.multiplyByScalar(r.direction,u,s),e.add(r.origin,s,s))};var E=new f;m.lineSegmentTriangle=function(r,t,o,a,s,u,f){if(!n(r))throw new i("v0 is required.");if(!n(t))throw new i("v1 is required.");var c=E;e.clone(r,c.origin),e.subtract(t,r,c.direction),e.normalize(c.direction,c.direction);var h=l(c,o,a,s,u);return!n(h)||0>h||h>e.distance(r,t)?void 0:(n(f)||(f=new e),e.multiplyByScalar(c.direction,h,f),e.add(c.origin,f,f))};var q={root0:0,root1:0};m.raySphere=function(e,r,t){if(!n(e))throw new i("ray is required.");if(!n(r))throw new i("sphere is required.");return t=h(e,r,t),!n(t)||t.stop<0?void 0:(t.start=Math.max(t.start,0),t)};var S=new f;m.lineSegmentSphere=function(r,t,o,a){if(!n(r))throw new i("p0 is required.");if(!n(t))throw new i("p1 is required.");if(!n(o))throw new i("sphere is required.");var s=S;e.clone(r,s.origin);var u=e.subtract(t,r,s.direction),f=e.magnitude(u);return e.normalize(u,u),a=h(s,o,a),!n(a)||a.stop<0||a.start>f?void 0:(a.start=Math.max(a.start,0),a.stop=Math.min(a.stop,f),a)};var C=new e,x=new e;m.rayEllipsoid=function(r,t){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("ellipsoid is required.");var o,a,s,u,f,l=t.oneOverRadii,c=e.multiplyComponents(l,r.origin,C),h=e.multiplyComponents(l,r.direction,x),d=e.magnitudeSquared(c),w=e.dot(c,h);if(d>1){if(w>=0)return void 0;var m=w*w;if(o=d-1,a=e.magnitudeSquared(h),s=a*o,s>m)return void 0;if(m>s){u=w*w-s,f=-w+Math.sqrt(u);var p=f/a,y=o/f;return y>p?{start:p,stop:y}:{start:y,stop:p}}var v=Math.sqrt(o/a);return{start:v,stop:v}}return 1>d?(o=d-1,a=e.magnitudeSquared(h),s=a*o,u=w*w-s,f=-w+Math.sqrt(u),{start:0,stop:f/a}):0>w?(a=e.magnitudeSquared(h),{start:0,stop:-w/a}):void 0};var A=new e,T=new e,I=new e,M=new e,O=new e,R=new a,N=new a,P=new a,L=new a,z=new a,D=new a,F=new a,_=new e,B=new e,U=new r;m.grazingAltitudeLocation=function(r,t){if(!n(r))throw new i("ray is required.");if(!n(t))throw new i("ellipsoid is required.");var s=r.origin,u=r.direction,f=t.geodeticSurfaceNormal(s,A);if(e.dot(u,f)>=0)return s;var l=n(this.rayEllipsoid(r,t)),c=t.transformPositionToScaledSpace(u,A),h=e.normalize(c,c),d=e.mostOrthogonalAxis(c,M),m=e.normalize(e.cross(d,h,T),T),p=e.normalize(e.cross(h,m,I),I),y=R;y[0]=h.x,y[1]=h.y,y[2]=h.z,y[3]=m.x,y[4]=m.y,y[5]=m.z,y[6]=p.x,y[7]=p.y,y[8]=p.z;var v=a.transpose(y,N),g=a.fromScale(t.radii,P),b=a.fromScale(t.oneOverRadii,L),E=z;E[0]=0,E[1]=-u.z,E[2]=u.y,E[3]=u.z,E[4]=0,E[5]=-u.x,E[6]=-u.y,E[7]=u.x,E[8]=0;var q,S,C=a.multiply(a.multiply(v,b,D),E,D),x=a.multiply(a.multiply(C,g,F),y,F),G=a.multiplyByVector(C,s,O),k=w(x,e.negate(G,A),0,0,1),V=k.length;if(V>0){for(var W=e.clone(e.ZERO,B),Y=Number.NEGATIVE_INFINITY,H=0;V>H;++H){q=a.multiplyByVector(g,a.multiplyByVector(y,k[H],_),_);var j=e.normalize(e.subtract(q,s,M),M),K=e.dot(j,u);K>Y&&(Y=K,W=e.clone(q,W))}var Z=t.cartesianToCartographic(W,U);return Y=o.clamp(Y,0,1),S=e.magnitude(e.subtract(W,s,M))*Math.sqrt(1-Y*Y),S=l?-S:S,Z.height=S,t.cartographicToCartesian(Z,new e)}return void 0};var G=new e;return m.lineSegmentPlane=function(r,t,a,s){if(!n(r))throw new i("endPoint0 is required.");if(!n(t))throw new i("endPoint1 is required.");if(!n(a))throw new i("plane is required.");n(s)||(s=new e);var u=e.subtract(t,r,G),f=a.normal,l=e.dot(f,u);if(Math.abs(l)<o.EPSILON6)return void 0;var c=e.dot(f,r),h=-(a.distance+c)/l;return 0>h||h>1?void 0:(e.multiplyByScalar(u,h,s),e.add(r,s,s),s)},m.trianglePlaneIntersection=function(r,t,o,a){if(!(n(r)&&n(t)&&n(o)&&n(a)))throw new i("p0, p1, p2, and plane are required.");var s=a.normal,u=a.distance,f=e.dot(s,r)+u<0,l=e.dot(s,t)+u<0,c=e.dot(s,o)+u<0,h=0;h+=f?1:0,h+=l?1:0,h+=c?1:0;var d,w;if((1===h||2===h)&&(d=new e,w=new e),1===h){if(f)return m.lineSegmentPlane(r,t,a,d),m.lineSegmentPlane(r,o,a,w),{positions:[r,t,o,d,w],indices:[0,3,4,1,2,4,1,4,3]};if(l)return m.lineSegmentPlane(t,o,a,d),m.lineSegmentPlane(t,r,a,w),{positions:[r,t,o,d,w],indices:[1,3,4,2,0,4,2,4,3]};if(c)return m.lineSegmentPlane(o,r,a,d),m.lineSegmentPlane(o,t,a,w),{positions:[r,t,o,d,w],indices:[2,3,4,0,1,4,0,4,3]}}else if(2===h){if(!f)return m.lineSegmentPlane(t,r,a,d),m.lineSegmentPlane(o,r,a,w),{positions:[r,t,o,d,w],indices:[1,2,4,1,4,3,0,3,4]};if(!l)return m.lineSegmentPlane(o,t,a,d),m.lineSegmentPlane(r,t,a,w),{positions:[r,t,o,d,w],indices:[2,0,4,2,4,3,1,3,4]};if(!c)return m.lineSegmentPlane(r,o,a,d),m.lineSegmentPlane(t,o,a,w),{positions:[r,t,o,d,w],indices:[0,1,4,0,4,3,2,3,4]}}return void 0},m}),define("Core/Plane",["./Cartesian3","./defined","./DeveloperError"],function(e,r,t){"use strict";var n=function(n,i){if(!r(n))throw new t("normal is required.");if(!r(i))throw new t("distance is required.");this.normal=e.clone(n),this.distance=i};return n.fromPointNormal=function(i,o,a){if(!r(i))throw new t("point is required.");if(!r(o))throw new t("normal is required.");var s=-e.dot(o,i);return r(a)?(e.clone(o,a.normal),a.distance=s,a):new n(o,s)},n.getPointDistance=function(n,i){if(!r(n))throw new t("plane is required.");if(!r(i))throw new t("point is required.");return e.dot(n.normal,i)+n.distance},n}),define("Core/Tipsify",["./defaultValue","./defined","./DeveloperError"],function(e,r,t){"use strict";var n={};return n.calculateACMR=function(n){n=e(n,e.EMPTY_OBJECT);var i=n.indices,o=n.maximumIndex,a=e(n.cacheSize,24);if(!r(i))throw new t("indices is required.");var s=i.length;if(3>s||0!==s%3)throw new t("indices length must be a multiple of three.");if(0>=o)throw new t("maximumIndex must be greater than zero.");if(3>a)throw new t("cacheSize must be greater than two.");if(!r(o)){o=0;for(var u=0,f=i[u];s>u;)f>o&&(o=f),++u,f=i[u]}for(var l=[],c=0;o+1>c;c++)l[c]=0;for(var h=a+1,d=0;s>d;++d)h-l[i[d]]>a&&(l[i[d]]=h,++h);return(h-a+1)/(s/3)},n.tipsify=function(n){function i(e,r,t,n){for(;r.length>=1;){var i=r[r.length-1];if(r.splice(r.length-1,1),e[i].numLiveTriangles>0)return i}for(;n>a;){if(e[a].numLiveTriangles>0)return++a,a-1;++a}return-1}function o(e,r,t,n,o,a,s){for(var u,f=-1,l=-1,c=0;c<t.length;){var h=t[c];n[h].numLiveTriangles&&(u=0,o-n[h].timeStamp+2*n[h].numLiveTriangles<=r&&(u=o-n[h].timeStamp),(u>l||-1===l)&&(l=u,f=h)),++c}return-1===f?i(n,a,e,s):f}n=e(n,e.EMPTY_OBJECT);var a,s=n.indices,u=n.maximumIndex,f=e(n.cacheSize,24);if(!r(s))throw new t("indices is required.");var l=s.length;if(3>l||0!==l%3)throw new t("indices length must be a multiple of three.");if(0>=u)throw new t("maximumIndex must be greater than zero.");if(3>f)throw new t("cacheSize must be greater than two.");var c=0,h=0,d=s[h],w=l;if(r(u))c=u+1;else{for(;w>h;)d>c&&(c=d),++h,d=s[h];if(-1===c)return 0;++c}for(var m=[],p=0;c>p;p++)m[p]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};h=0;for(var y=0;w>h;)m[s[h]].vertexTriangles.push(y),++m[s[h]].numLiveTriangles,m[s[h+1]].vertexTriangles.push(y),++m[s[h+1]].numLiveTriangles,m[s[h+2]].vertexTriangles.push(y),++m[s[h+2]].numLiveTriangles,++y,h+=3;var v=0,g=f+1;a=1;var b,E,q=[],S=[],C=0,x=[],A=l/3,T=[];for(p=0;A>p;p++)T[p]=!1;for(var I,M;-1!==v;){q=[],E=m[v],M=E.vertexTriangles.length;for(var O=0;M>O;++O)if(y=E.vertexTriangles[O],!T[y]){T[y]=!0,h=y+y+y;for(var R=0;3>R;++R)I=s[h],q.push(I),S.push(I),x[C]=I,++C,b=m[I],--b.numLiveTriangles,g-b.timeStamp>f&&(b.timeStamp=g,++g),++h}v=o(s,f,q,m,g,S,c)}return x},n}),define("Core/GeometryPipeline",["./AttributeCompression","./barycentricCoordinates","./BoundingSphere","./Cartesian2","./Cartesian3","./Cartesian4","./Cartographic","./ComponentDatatype","./defaultValue","./defined","./DeveloperError","./EncodedCartesian3","./GeographicProjection","./Geometry","./GeometryAttribute","./GeometryInstance","./GeometryType","./IndexDatatype","./Intersect","./IntersectionTests","./Math","./Matrix3","./Matrix4","./Plane","./PrimitiveType","./Tipsify"],function(e,r,t,n,i,o,a,s,u,f,l,c,h,d,w,m,p,y,v,g,b,E,q,S,C,x){"use strict";function A(e,r,t,n,i){e[r++]=t,e[r++]=n,e[r++]=n,e[r++]=i,e[r++]=i,e[r]=t}function T(e){for(var r=e.length,t=6*(r/3),n=y.createTypedArray(r,t),i=0,o=0;r>o;o+=3,i+=6)A(n,i,e[o],e[o+1],e[o+2]);return n}function I(e){var r=e.length;if(r>=3){var t=6*(r-2),n=y.createTypedArray(r,t);A(n,0,e[0],e[1],e[2]);for(var i=6,o=3;r>o;++o,i+=6)A(n,i,e[o-1],e[o],e[o-2]);return n}return new Uint16Array}function M(e){if(e.length>0){for(var r=e.length-1,t=6*(r-1),n=y.createTypedArray(r,t),i=e[0],o=0,a=1;r>a;++a,o+=6)A(n,o,i,e[a],e[a+1]);return n}return new Uint16Array}function O(e){var r={};for(var t in e)if(e.hasOwnProperty(t)&&f(e[t])&&f(e[t].values)){var n=e[t];r[t]=new w({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return r}function R(e,r,t){for(var n in r)if(r.hasOwnProperty(n)&&f(r[n])&&f(r[n].values))for(var i=r[n],o=0;o<i.componentsPerAttribute;++o)e[n].values.push(i.values[t*i.componentsPerAttribute+o])}function N(e,r){if(f(r))for(var t=r.values,n=t.length,o=0;n>o;o+=3)i.unpack(t,o,or),q.multiplyByPoint(e,or,or),i.pack(or,t,o)}function P(e,r){if(f(r))for(var t=r.values,n=t.length,o=0;n>o;o+=3)i.unpack(t,o,or),E.multiplyByVector(e,or,or),or=i.normalize(or,or),i.pack(or,t,o)}function L(e,r){var t,n=e.length,i={},o=e[0][r].attributes;for(t in o)if(o.hasOwnProperty(t)&&f(o[t])&&f(o[t].values)){for(var a=o[t],u=a.values.length,l=!0,c=1;n>c;++c){var h=e[c][r].attributes[t];if(!f(h)||a.componentDatatype!==h.componentDatatype||a.componentsPerAttribute!==h.componentsPerAttribute||a.normalize!==h.normalize){l=!1;break}u+=h.values.length}l&&(i[t]=new w({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:s.createTypedArray(a.componentDatatype,u)}))}return i}function z(e,r){var n,o,a,s,u=e.length,c=e[0].modelMatrix,h=f(e[0][r].indices),w=e[0][r].primitiveType;for(o=1;u>o;++o){if(!q.equals(e[o].modelMatrix,c))throw new l("All instances must have the same modelMatrix.");if(f(e[o][r].indices)!==h)throw new l("All instance geometries must have an indices or not have one.");if(e[o][r].primitiveType!==w)throw new l("All instance geometries must have the same primitiveType.")}var m,p,v,g=L(e,r);for(n in g)if(g.hasOwnProperty(n))for(m=g[n].values,s=0,o=0;u>o;++o)for(p=e[o][r].attributes[n].values,v=p.length,a=0;v>a;++a)m[s++]=p[a];var b;if(h){var E=0;for(o=0;u>o;++o)E+=e[o][r].indices.length;var S=d.computeNumberOfVertices(new d({attributes:g,primitiveType:C.POINTS})),x=y.createTypedArray(S,E),A=0,T=0;for(o=0;u>o;++o){var I=e[o][r].indices,M=I.length;for(s=0;M>s;++s)x[A++]=T+I[s];T+=d.computeNumberOfVertices(e[o][r])}b=x}var O,R=new i,N=0;for(o=0;u>o;++o){if(O=e[o][r].boundingSphere,!f(O)){R=void 0;break}i.add(O.center,R,R)}if(f(R))for(i.divideByScalar(R,u,R),o=0;u>o;++o){O=e[o][r].boundingSphere;var P=i.magnitude(i.subtract(O.center,R,ur))+O.radius;P>N&&(N=P)}return new d({attributes:g,indices:b,primitiveType:w,boundingSphere:f(R)?new t(R,N):void 0})}function D(e){if(f(e.indices))return e;var r=d.computeNumberOfVertices(e);if(3>r)throw new l("The number of vertices must be at least three.");if(0!==r%3)throw new l("The number of vertices must be a multiple of three.");for(var t=y.createTypedArray(r,r),n=0;r>n;++n)t[n]=n;return e.indices=t,e}function F(e){var r=d.computeNumberOfVertices(e);if(3>r)throw new l("The number of vertices must be at least three.");var t=y.createTypedArray(r,3*(r-2));t[0]=1,t[1]=0,t[2]=2;for(var n=3,i=3;r>i;++i)t[n++]=i-1,t[n++]=0,t[n++]=i;return e.indices=t,e.primitiveType=C.TRIANGLES,e}function _(e){var r=d.computeNumberOfVertices(e);if(3>r)throw new l("The number of vertices must be at least 3.");var t=y.createTypedArray(r,3*(r-2));t[0]=0,t[1]=1,t[2]=2,r>3&&(t[3]=0,t[4]=2,t[5]=3);for(var n=6,i=3;r-1>i;i+=2)t[n++]=i,t[n++]=i-1,t[n++]=i+1,r>i+2&&(t[n++]=i,t[n++]=i+1,t[n++]=i+2);return e.indices=t,e.primitiveType=C.TRIANGLES,e}function B(e){if(f(e.indices))return e;var r=d.computeNumberOfVertices(e);if(2>r)throw new l("The number of vertices must be at least two.");if(0!==r%2)throw new l("The number of vertices must be a multiple of 2.");for(var t=y.createTypedArray(r,r),n=0;r>n;++n)t[n]=n;return e.indices=t,e}function U(e){var r=d.computeNumberOfVertices(e);if(2>r)throw new l("The number of vertices must be at least two.");var t=y.createTypedArray(r,2*(r-1));t[0]=0,t[1]=1;for(var n=2,i=2;r>i;++i)t[n++]=i-1,t[n++]=i;return e.indices=t,e.primitiveType=C.LINES,e}function G(e){var r=d.computeNumberOfVertices(e);if(2>r)throw new l("The number of vertices must be at least two.");var t=y.createTypedArray(r,2*r);t[0]=0,t[1]=1;for(var n=2,i=2;r>i;++i)t[n++]=i-1,t[n++]=i;return t[n++]=r-1,t[n]=0,e.indices=t,e.primitiveType=C.LINES,e}function k(e){switch(e.primitiveType){case C.TRIANGLE_FAN:return F(e);case C.TRIANGLE_STRIP:return _(e);case C.TRIANGLES:return D(e);case C.LINE_STRIP:return U(e);case C.LINE_LOOP:return G(e);case C.LINES:return B(e)}return e}function V(e,r){Math.abs(e.y)<b.EPSILON6&&(e.y=r?-b.EPSILON6:b.EPSILON6)}function W(e,r,t){if(0!==e.y&&0!==r.y&&0!==t.y)return V(e,e.y<0),V(r,r.y<0),V(t,t.y<0),void 0;var n,i=Math.abs(e.y),o=Math.abs(r.y),a=Math.abs(t.y);n=i>o?i>a?b.sign(e.y):b.sign(t.y):o>a?b.sign(r.y):b.sign(t.y);var s=0>n;V(e,s),V(r,s),V(t,s)}function Y(e,r,t,n){i.add(e,i.multiplyByScalar(i.subtract(r,e,br),e.y/(e.y-r.y),br),t),i.clone(t,n),V(t,!0),V(n,!1)}function H(e,r,t){if(e.x>=0||r.x>=0||t.x>=0)return void 0;W(e,r,t);var n=e.y<0,i=r.y<0,o=t.y<0,a=0;a+=n?1:0,a+=i?1:0,a+=o?1:0;var s=xr.indices;1===a?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,n?(Y(e,r,Er,Sr),Y(e,t,qr,Cr),s[0]=0,s[3]=1,s[4]=2,s[6]=1):i?(Y(r,t,Er,Sr),Y(r,e,qr,Cr),s[0]=1,s[3]=2,s[4]=0,s[6]=2):o&&(Y(t,e,Er,Sr),Y(t,r,qr,Cr),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2===a&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,n?i?o||(Y(t,e,Er,Sr),Y(t,r,qr,Cr),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(Y(r,t,Er,Sr),Y(r,e,qr,Cr),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(Y(e,r,Er,Sr),Y(e,t,qr,Cr),s[0]=1,s[1]=2,s[3]=1,s[6]=0));var u=xr.positions;return u[0]=e,u[1]=r,u[2]=t,u.length=3,(1===a||2===a)&&(u[3]=Er,u[4]=qr,u[5]=Sr,u[6]=Cr,u.length=7),xr}function j(e,r){var n=e.attributes;if(0===n.position.values.length)return void 0;for(var i in n)if(n.hasOwnProperty(i)&&f(n[i])&&f(n[i].values)){var o=n[i];o.values=s.createTypedArray(o.componentDatatype,o.values)}var a=d.computeNumberOfVertices(e);return e.indices=y.createTypedArray(a,e.indices),r&&(e.boundingSphere=t.fromVertices(n.position.values)),e}function K(e){var r=e.attributes,t={};for(var n in r)if(r.hasOwnProperty(n)&&f(r[n])&&f(r[n].values)){var i=r[n];t[n]=new w({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return new d({attributes:t,indices:[],primitiveType:e.primitiveType})}function Z(e,r,t){var n=f(e.geometry.boundingSphere);r=j(r,n),t=j(t,n),f(t)&&!f(r)?e.geometry=t:!f(t)&&f(r)?e.geometry=r:(e.westHemisphereGeometry=r,e.eastHemisphereGeometry=t,e.geometry=void 0)}function X(e,t,o,a,s,u,l,c,h,d,w){if(f(u)||f(l)||f(c)||f(h)){var m=i.fromArray(s,3*e,Ar),p=i.fromArray(s,3*t,Tr),y=i.fromArray(s,3*o,Ir),v=r(a,m,p,y,Mr);if(f(u)){var g=i.fromArray(u,3*e,Ar),b=i.fromArray(u,3*t,Tr),E=i.fromArray(u,3*o,Ir);i.multiplyByScalar(g,v.x,g),i.multiplyByScalar(b,v.y,b),i.multiplyByScalar(E,v.z,E);var q=i.add(g,b,g);i.add(q,E,q),i.normalize(q,q),i.pack(q,d.normal.values,3*w)}if(f(l)){var S=i.fromArray(l,3*e,Ar),C=i.fromArray(l,3*t,Tr),x=i.fromArray(l,3*o,Ir);i.multiplyByScalar(S,v.x,S),i.multiplyByScalar(C,v.y,C),i.multiplyByScalar(x,v.z,x);var A=i.add(S,C,S);i.add(A,x,A),i.normalize(A,A),i.pack(A,d.binormal.values,3*w)}if(f(c)){var T=i.fromArray(c,3*e,Ar),I=i.fromArray(c,3*t,Tr),M=i.fromArray(c,3*o,Ir);i.multiplyByScalar(T,v.x,T),i.multiplyByScalar(I,v.y,I),i.multiplyByScalar(M,v.z,M);var O=i.add(T,I,T);i.add(O,M,O),i.normalize(O,O),i.pack(O,d.tangent.values,3*w)}if(f(h)){var R=n.fromArray(h,2*e,Or),N=n.fromArray(h,2*t,Rr),P=n.fromArray(h,2*o,Nr);n.multiplyByScalar(R,v.x,R),n.multiplyByScalar(N,v.y,N),n.multiplyByScalar(P,v.z,P);var L=n.add(R,N,R);n.add(L,P,L),n.pack(L,d.st.values,2*w)}}}function Q(e,r,t,n,i,o){var a=e.position.values.length/3;if(-1!==i){var s=n[i],u=t[s];return-1===u?(t[s]=a,e.position.values.push(o.x,o.y,o.z),r.push(a),a):(r.push(u),u)}return e.position.values.push(o.x,o.y,o.z),r.push(a),a}function J(e){var r,t,n,o,a,s=e.geometry,u=s.attributes,l=u.position.values,c=f(u.normal)?u.normal.values:void 0,h=f(u.binormal)?u.binormal.values:void 0,d=f(u.tangent)?u.tangent.values:void 0,w=f(u.st)?u.st.values:void 0,m=s.indices,p=K(s),y=K(s),v=[];v.length=l.length/3;var g=[];for(g.length=l.length/3,a=0;a<v.length;++a)v[a]=-1,g[a]=-1;var b=m.length;for(a=0;b>a;a+=3){var E=m[a],q=m[a+1],S=m[a+2],C=i.fromArray(l,3*E),x=i.fromArray(l,3*q),A=i.fromArray(l,3*S),T=H(C,x,A);if(f(T)&&T.positions.length>3)for(var I=T.positions,M=T.indices,O=M.length,R=0;O>R;++R){var N=M[R],P=I[N];P.y<0?(r=y.attributes,t=y.indices,n=v):(r=p.attributes,t=p.indices,n=g),o=Q(r,t,n,m,3>N?a+N:-1,P),X(E,q,S,P,l,c,h,d,w,r,o)}else f(T)&&(C=T.positions[0],x=T.positions[1],A=T.positions[2]),C.y<0?(r=y.attributes,t=y.indices,n=v):(r=p.attributes,t=p.indices,n=g),o=Q(r,t,n,m,a,C),X(E,q,S,C,l,c,h,d,w,r,o),o=Q(r,t,n,m,a+1,x),X(E,q,S,x,l,c,h,d,w,r,o),o=Q(r,t,n,m,a+2,A),X(E,q,S,A,l,c,h,d,w,r,o)
}Z(e,y,p)}function $(e){var r,t=e.geometry,n=t.attributes,o=n.position.values,a=t.indices,s=K(t),u=K(t),l=a.length,c=[];c.length=o.length/3;var h=[];for(h.length=o.length/3,r=0;r<c.length;++r)c[r]=-1,h[r]=-1;for(r=0;l>r;r+=2){var d=a[r],w=a[r+1],m=i.fromArray(o,3*d,Ar),p=i.fromArray(o,3*w,Tr);Math.abs(m.y)<b.EPSILON6&&(m.y=m.y<0?-b.EPSILON6:b.EPSILON6),Math.abs(p.y)<b.EPSILON6&&(p.y=p.y<0?-b.EPSILON6:b.EPSILON6);var y=s.attributes,v=s.indices,E=h,q=u.attributes,S=u.indices,C=c,x=g.lineSegmentPlane(m,p,Pr,Ir);if(f(x)){var A=i.multiplyByScalar(i.UNIT_Y,5*b.EPSILON9,Lr);m.y<0&&(i.negate(A,A),y=u.attributes,v=u.indices,E=c,q=s.attributes,S=s.indices,C=h);var T=i.add(x,A,zr);Q(y,v,E,a,r,m),Q(y,v,E,a,-1,T),i.negate(A,A),i.add(x,A,T),Q(q,S,C,a,-1,T),Q(q,S,C,a,r+1,p)}else{var I,M,O;m.y<0?(I=u.attributes,M=u.indices,O=c):(I=s.attributes,M=s.indices,O=h),Q(I,M,O,a,r,m),Q(I,M,O,a,r+1,p)}}Z(e,u,s)}function er(e){var r=e.geometry,t=r.attributes,a=t.position.values,s=t.prevPosition.values,u=t.nextPosition.values,l=t.expandAndWidth.values;r.indices;var c,h,d,w=f(t.st)?t.st.values:void 0,m=f(t.color)?t.color.values:void 0,p=K(r),y=K(r),v=a.length/3;for(c=0;v>c;c+=4){var E=c,q=c+1,S=c+2,C=c+3,x=i.fromArray(a,3*E,_r),A=i.fromArray(a,3*q,Br),T=i.fromArray(a,3*S,Ur),I=i.fromArray(a,3*C,Gr);Math.abs(x.y)<b.EPSILON6&&(x.y=b.EPSILON6*(T.y<0?-1:1),A.y=x.y),Math.abs(T.y)<b.EPSILON6&&(T.y=b.EPSILON6*(x.y<0?-1:1),I.y=T.y);var M=p.attributes,O=p.indices,R=y.attributes,N=y.indices,P=g.lineSegmentPlane(x,T,Pr,kr);if(f(P)){var L=i.multiplyByScalar(i.UNIT_Y,5*b.EPSILON9,Vr);x.y<0&&(i.negate(L,L),M=y.attributes,O=y.indices,R=p.attributes,N=p.indices);var z=i.add(P,L,Wr);for(M.position.values.push(x.x,x.y,x.z,A.x,A.y,A.z),M.position.values.push(z.x,z.y,z.z),M.position.values.push(z.x,z.y,z.z),i.negate(L,L),i.add(P,L,z),R.position.values.push(z.x,z.y,z.z),R.position.values.push(z.x,z.y,z.z),R.position.values.push(T.x,T.y,T.z,I.x,I.y,I.z),h=3*E;3*E+6>h;++h)M.prevPosition.values.push(s[h]);for(M.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),R.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),h=3*S;3*S+6>h;++h)R.prevPosition.values.push(s[h]);for(h=3*E;3*E+6>h;++h)M.nextPosition.values.push(u[h]);for(M.nextPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),R.nextPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),h=3*S;3*S+6>h;++h)R.nextPosition.values.push(u[h]);var D=n.fromArray(l,2*E,Dr),F=Math.abs(D.y);M.expandAndWidth.values.push(-1,F,1,F),M.expandAndWidth.values.push(-1,-F,1,-F),R.expandAndWidth.values.push(-1,F,1,F),R.expandAndWidth.values.push(-1,-F,1,-F);var _=i.magnitudeSquared(i.subtract(P,x,Gr));if(_/=i.magnitudeSquared(i.subtract(T,x,Gr)),f(m)){var B=o.fromArray(m,4*E,Yr),U=o.fromArray(m,4*S,Yr),G=b.lerp(B.x,U.x,_),k=b.lerp(B.y,U.y,_),V=b.lerp(B.z,U.z,_),W=b.lerp(B.w,U.w,_);for(h=4*E;4*E+8>h;++h)M.color.values.push(m[h]);for(M.color.values.push(G,k,V,W),M.color.values.push(G,k,V,W),R.color.values.push(G,k,V,W),R.color.values.push(G,k,V,W),h=4*S;4*S+8>h;++h)R.color.values.push(m[h])}if(f(w)){var Y=n.fromArray(w,2*E,Dr),H=n.fromArray(w,2*(c+3),Fr),j=b.lerp(Y.x,H.x,_);for(h=2*E;2*E+4>h;++h)M.st.values.push(w[h]);for(M.st.values.push(j,Y.y),M.st.values.push(j,H.y),R.st.values.push(j,Y.y),R.st.values.push(j,H.y),h=2*S;2*S+4>h;++h)R.st.values.push(w[h])}d=M.position.values.length/3-4,O.push(d,d+2,d+1),O.push(d+1,d+2,d+3),d=R.position.values.length/3-4,N.push(d,d+2,d+1),N.push(d+1,d+2,d+3)}else{var X,Q;for(x.y<0?(X=y.attributes,Q=y.indices):(X=p.attributes,Q=p.indices),X.position.values.push(x.x,x.y,x.z),X.position.values.push(A.x,A.y,A.z),X.position.values.push(T.x,T.y,T.z),X.position.values.push(I.x,I.y,I.z),h=3*c;3*c+12>h;++h)X.prevPosition.values.push(s[h]),X.nextPosition.values.push(u[h]);for(h=2*c;2*c+8>h;++h)X.expandAndWidth.values.push(l[h]),f(w)&&X.st.values.push(w[h]);if(f(m))for(h=4*c;4*c+16>h;++h)X.color.values.push(m[h]);d=X.position.values.length/3-4,Q.push(d,d+2,d+1),Q.push(d+1,d+2,d+3)}}Z(e,y,p)}var rr={};rr.toWireframe=function(e){if(!f(e))throw new l("geometry is required.");var r=e.indices;if(f(r)){switch(e.primitiveType){case C.TRIANGLES:e.indices=T(r);break;case C.TRIANGLE_STRIP:e.indices=I(r);break;case C.TRIANGLE_FAN:e.indices=M(r);break;default:throw new l("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=C.LINES}return e},rr.createLineSegmentsForVectors=function(e,r,n){if(r=u(r,"normal"),!f(e))throw new l("geometry is required.");if(!f(e.attributes.position))throw new l("geometry.attributes.position is required.");if(!f(e.attributes[r]))throw new l("geometry.attributes must have an attribute with the same name as the attributeName parameter, "+r+".");n=u(n,1e4);for(var i=e.attributes.position.values,o=e.attributes[r].values,a=i.length,c=new Float64Array(2*a),h=0,m=0;a>m;m+=3)c[h++]=i[m],c[h++]=i[m+1],c[h++]=i[m+2],c[h++]=i[m]+o[m]*n,c[h++]=i[m+1]+o[m+1]*n,c[h++]=i[m+2]+o[m+2]*n;var p,y=e.boundingSphere;return f(y)&&(p=new t(y.center,y.radius+n)),new d({attributes:{position:new w({componentDatatype:s.DOUBLE,componentsPerAttribute:3,values:c})},primitiveType:C.LINES,boundingSphere:p})},rr.createAttributeLocations=function(e){if(!f(e))throw new l("geometry is required.");var r,t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","binormal","tangent","compressedAttributes"],n=e.attributes,i={},o=0,a=t.length;for(r=0;a>r;++r){var s=t[r];f(n[s])&&(i[s]=o++)}for(var u in n)n.hasOwnProperty(u)&&!f(i[u])&&(i[u]=o++);return i},rr.reorderForPreVertexCache=function(e){if(!f(e))throw new l("geometry is required.");var r=d.computeNumberOfVertices(e),t=e.indices;if(f(t)){for(var n=new Int32Array(r),i=0;r>i;i++)n[i]=-1;for(var o,a=t,u=a.length,c=y.createTypedArray(r,u),h=0,w=0,m=0;u>h;)o=n[a[h]],-1!==o?c[w]=o:(o=a[h],n[o]=m,c[w]=m,++m),++h,++w;e.indices=c;var p=e.attributes;for(var v in p)if(p.hasOwnProperty(v)&&f(p[v])&&f(p[v].values)){for(var g=p[v],b=g.values,E=0,q=g.componentsPerAttribute,S=s.createTypedArray(g.componentDatatype,m*q);r>E;){var C=n[E];if(-1!==C)for(i=0;q>i;i++)S[q*C+i]=b[q*E+i];++E}g.values=S}}return e},rr.reorderForPostVertexCache=function(e,r){if(!f(e))throw new l("geometry is required.");var t=e.indices;if(e.primitiveType===C.TRIANGLES&&f(t)){for(var n=t.length,i=0,o=0;n>o;o++)t[o]>i&&(i=t[o]);e.indices=x.tipsify({indices:t,maximumIndex:i,cacheSize:r})}return e},rr.fitToUnsignedShortIndices=function(e){if(!f(e))throw new l("geometry is required.");if(f(e.indices)&&e.primitiveType!==C.TRIANGLES&&e.primitiveType!==C.LINES&&e.primitiveType!==C.POINTS)throw new l("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");var r=[],t=d.computeNumberOfVertices(e);if(f(e.indices)&&t>b.SIXTY_FOUR_KILOBYTES){var n,i=[],o=[],a=0,s=O(e.attributes),u=e.indices,c=u.length;e.primitiveType===C.TRIANGLES?n=3:e.primitiveType===C.LINES?n=2:e.primitiveType===C.POINTS&&(n=1);for(var h=0;c>h;h+=n){for(var w=0;n>w;++w){var m=u[h+w],p=i[m];f(p)||(p=a++,i[m]=p,R(s,e.attributes,m)),o.push(p)}a+n>b.SIXTY_FOUR_KILOBYTES&&(r.push(new d({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],a=0,s=O(e.attributes))}0!==o.length&&r.push(new d({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else r.push(e);return r};var tr=new i,nr=new a;rr.projectTo2D=function(e,r,t,n,o){if(!f(e))throw new l("geometry is required.");if(!f(r))throw new l("attributeName is required.");if(!f(t))throw new l("attributeName3D is required.");if(!f(n))throw new l("attributeName2D is required.");if(!f(e.attributes[r]))throw new l("geometry must have attribute matching the attributeName argument: "+r+".");if(e.attributes[r].componentDatatype!==s.DOUBLE)throw new l("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");var a=e.attributes[r];o=f(o)?o:new h;for(var u=o.ellipsoid,c=a.values,d=new Float64Array(c.length),m=0,p=0;p<c.length;p+=3){var y=i.fromArray(c,p,tr),v=u.cartesianToCartographic(y,nr);if(!f(v))throw new l("Could not project point ("+y.x+", "+y.y+", "+y.z+") to 2D.");var g=o.project(v,tr);d[m++]=g.x,d[m++]=g.y,d[m++]=g.z}return e.attributes[t]=a,e.attributes[n]=new w({componentDatatype:s.DOUBLE,componentsPerAttribute:3,values:d}),delete e.attributes[r],e};var ir={high:0,low:0};rr.encodeAttribute=function(e,r,t,n){if(!f(e))throw new l("geometry is required.");if(!f(r))throw new l("attributeName is required.");if(!f(t))throw new l("attributeHighName is required.");if(!f(n))throw new l("attributeLowName is required.");if(!f(e.attributes[r]))throw new l("geometry must have attribute matching the attributeName argument: "+r+".");if(e.attributes[r].componentDatatype!==s.DOUBLE)throw new l("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");for(var i=e.attributes[r],o=i.values,a=o.length,u=new Float32Array(a),h=new Float32Array(a),d=0;a>d;++d)c.encode(o[d],ir),u[d]=ir.high,h[d]=ir.low;var m=i.componentsPerAttribute;return e.attributes[t]=new w({componentDatatype:s.FLOAT,componentsPerAttribute:m,values:u}),e.attributes[n]=new w({componentDatatype:s.FLOAT,componentsPerAttribute:m,values:h}),delete e.attributes[r],e};var or=new i,ar=new q,sr=new E;rr.transformToWorldCoordinates=function(e){if(!f(e))throw new l("instance is required.");var r=e.modelMatrix;if(q.equals(r,q.IDENTITY))return e;var n=e.geometry.attributes;N(r,n.position),N(r,n.prevPosition),N(r,n.nextPosition),(f(n.normal)||f(n.binormal)||f(n.tangent))&&(q.inverse(r,ar),q.transpose(ar,ar),q.getRotation(ar,sr),P(sr,n.normal),P(sr,n.binormal),P(sr,n.tangent));var i=e.geometry.boundingSphere;return f(i)&&(e.geometry.boundingSphere=t.transform(i,r,i)),e.modelMatrix=q.clone(q.IDENTITY),e};var ur=new i;rr.combineInstances=function(e){if(!f(e)||e.length<1)throw new l("instances is required and must have length greater than zero.");for(var r=[],t=[],n=e.length,i=0;n>i;++i){var o=e[i];f(o.geometry)?r.push(o):t.push(o)}var a=[];return r.length>0&&a.push(z(r,"geometry")),t.length>0&&(a.push(z(t,"westHemisphereGeometry")),a.push(z(t,"eastHemisphereGeometry"))),a};var fr=new i,lr=new i,cr=new i,hr=new i;rr.computeNormal=function(e){if(!f(e))throw new l("geometry is required.");if(!f(e.attributes.position)||!f(e.attributes.position.values))throw new l("geometry.attributes.position.values is required.");if(!f(e.indices))throw new l("geometry.indices is required.");if(e.indices.length<2||0!==e.indices.length%3)throw new l("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==C.TRIANGLES)throw new l("geometry.primitiveType must be PrimitiveType.TRIANGLES.");for(var r=e.indices,t=e.attributes,n=t.position.values,o=t.position.values.length/3,a=r.length,u=new Array(o),c=new Array(a/3),h=new Array(a),d=0;o>d;d++)u[d]={indexOffset:0,count:0,currentCount:0};var m=0;for(d=0;a>d;d+=3){var p=r[d],y=r[d+1],v=r[d+2],g=3*p,b=3*y,E=3*v;lr.x=n[g],lr.y=n[g+1],lr.z=n[g+2],cr.x=n[b],cr.y=n[b+1],cr.z=n[b+2],hr.x=n[E],hr.y=n[E+1],hr.z=n[E+2],u[p].count++,u[y].count++,u[v].count++,i.subtract(cr,lr,cr),i.subtract(hr,lr,hr),c[m]=i.cross(cr,hr,new i),m++}var q=0;for(d=0;o>d;d++)u[d].indexOffset+=q,q+=u[d].count;m=0;var S;for(d=0;a>d;d+=3){S=u[r[d]];var x=S.indexOffset+S.currentCount;h[x]=m,S.currentCount++,S=u[r[d+1]],x=S.indexOffset+S.currentCount,h[x]=m,S.currentCount++,S=u[r[d+2]],x=S.indexOffset+S.currentCount,h[x]=m,S.currentCount++,m++}var A=new Float32Array(3*o);for(d=0;o>d;d++){var T=3*d;if(S=u[d],S.count>0){for(i.clone(i.ZERO,fr),m=0;m<S.count;m++)i.add(fr,c[h[S.indexOffset+m]],fr);i.normalize(fr,fr),A[T]=fr.x,A[T+1]=fr.y,A[T+2]=fr.z}else A[T]=0,A[T+1]=0,A[T+2]=1}return e.attributes.normal=new w({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:A}),e};var dr=new i,wr=new i,mr=new i;rr.computeBinormalAndTangent=function(e){if(!f(e))throw new l("geometry is required.");var r=e.attributes,t=e.indices;if(!f(r.position)||!f(r.position.values))throw new l("geometry.attributes.position.values is required.");if(!f(r.normal)||!f(r.normal.values))throw new l("geometry.attributes.normal.values is required.");if(!f(r.st)||!f(r.st.values))throw new l("geometry.attributes.st.values is required.");if(!f(t))throw new l("geometry.indices is required.");if(t.length<2||0!==t.length%3)throw new l("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==C.TRIANGLES)throw new l("geometry.primitiveType must be PrimitiveType.TRIANGLES.");for(var n=e.attributes.position.values,o=e.attributes.normal.values,a=e.attributes.st.values,u=e.attributes.position.values.length/3,c=t.length,h=new Array(3*u),d=0;d<h.length;d++)h[d]=0;var m,p,y;for(d=0;c>d;d+=3){var v=t[d],g=t[d+1],b=t[d+2];m=3*v,p=3*g,y=3*b;var E=2*v,q=2*g,S=2*b,x=n[m],A=n[m+1],T=n[m+2],I=a[E],M=a[E+1],O=a[q+1]-M,R=a[S+1]-M,N=1/((a[q]-I)*R-(a[S]-I)*O),P=(R*(n[p]-x)-O*(n[y]-x))*N,L=(R*(n[p+1]-A)-O*(n[y+1]-A))*N,z=(R*(n[p+2]-T)-O*(n[y+2]-T))*N;h[m]+=P,h[m+1]+=L,h[m+2]+=z,h[p]+=P,h[p+1]+=L,h[p+2]+=z,h[y]+=P,h[y+1]+=L,h[y+2]+=z}var D=new Float32Array(3*u),F=new Float32Array(3*u);for(d=0;u>d;d++){m=3*d,p=m+1,y=m+2;var _=i.fromArray(o,m,dr),B=i.fromArray(h,m,mr),U=i.dot(_,B);i.multiplyByScalar(_,U,wr),i.normalize(i.subtract(B,wr,B),B),F[m]=B.x,F[p]=B.y,F[y]=B.z,i.normalize(i.cross(_,B,B),B),D[m]=B.x,D[p]=B.y,D[y]=B.z}return e.attributes.tangent=new w({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:F}),e.attributes.binormal=new w({componentDatatype:s.FLOAT,componentsPerAttribute:3,values:D}),e};var pr=new n,yr=new i,vr=new i,gr=new i;rr.compressVertices=function(r){if(!f(r))throw new l("geometry is required.");var t=r.attributes.normal,o=r.attributes.st;if(!f(t)&&!f(o))return r;var a,u,c,h,d=r.attributes.tangent,m=r.attributes.binormal;f(t)&&(a=t.values),f(o)&&(u=o.values),f(d)&&(c=d.values),m&&(h=m.values);var p=f(a)?a.length:u.length,y=f(a)?3:2,v=p/y,g=v,b=f(u)&&f(a)?2:1;b+=f(c)||f(h)?1:0,g*=b;for(var E=new Float32Array(g),q=0,S=0;v>S;++S){f(u)&&(n.fromArray(u,2*S,pr),E[q++]=e.compressTextureCoordinates(pr));var C=3*S;f(a)&&f(c)&&f(h)?(i.fromArray(a,C,yr),i.fromArray(c,C,vr),i.fromArray(h,C,gr),e.octPack(yr,vr,gr,pr),E[q++]=pr.x,E[q++]=pr.y):(f(a)&&(i.fromArray(a,C,yr),E[q++]=e.octEncodeFloat(yr)),f(c)&&(i.fromArray(c,C,yr),E[q++]=e.octEncodeFloat(yr)),f(h)&&(i.fromArray(h,C,yr),E[q++]=e.octEncodeFloat(yr)))}return r.attributes.compressedAttributes=new w({componentDatatype:s.FLOAT,componentsPerAttribute:b,values:E}),f(a)&&delete r.attributes.normal,f(u)&&delete r.attributes.st,f(c)&&delete r.attributes.tangent,f(h)&&delete r.attributes.binormal,r};var br=new i,Er=new i,qr=new i,Sr=new i,Cr=new i,xr={positions:new Array(7),indices:new Array(9)},Ar=new i,Tr=new i,Ir=new i,Mr=new i,Or=new n,Rr=new n,Nr=new n,Pr=S.fromPointNormal(i.ZERO,i.UNIT_Y),Lr=new i,zr=new i,Dr=new n,Fr=new n,_r=new i,Br=new i,Ur=new i,Gr=new i,kr=new i,Vr=new i,Wr=new i,Yr=new o;return new o,rr.splitLongitude=function(e){if(!f(e))throw new l("instance is required.");var r=e.geometry,n=r.boundingSphere;if(f(n)){var i=n.center.x-n.radius;if(i>0||t.intersect(n,o.UNIT_Y)!==v.INTERSECTING)return e}if(r.geometryType!==p.NONE)switch(r.geometryType){case p.POLYLINES:er(e);break;case p.TRIANGLES:J(e);break;case p.LINES:$(e)}else k(r),r.primitiveType===C.TRIANGLES?J(e):r.primitiveType===C.LINES&&$(e);return e},rr}),define("Core/WebMercatorProjection",["./Cartesian3","./Cartographic","./defaultValue","./defined","./defineProperties","./DeveloperError","./Ellipsoid","./Math"],function(e,r,t,n,i,o,a,s){"use strict";var u=function(e){this._ellipsoid=t(e,a.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis};return i(u.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),u.mercatorAngleToGeodeticLatitude=function(e){return s.PI_OVER_TWO-2*Math.atan(Math.exp(-e))},u.geodeticLatitudeToMercatorAngle=function(e){e>u.MaximumLatitude?e=u.MaximumLatitude:e<-u.MaximumLatitude&&(e=-u.MaximumLatitude);var r=Math.sin(e);return.5*Math.log((1+r)/(1-r))},u.MaximumLatitude=u.mercatorAngleToGeodeticLatitude(Math.PI),u.prototype.project=function(r,t){var i=this._semimajorAxis,o=r.longitude*i,a=u.geodeticLatitudeToMercatorAngle(r.latitude)*i,s=r.height;return n(t)?(t.x=o,t.y=a,t.z=s,t):new e(o,a,s)},u.prototype.unproject=function(e,t){if(!n(e))throw new o("cartesian is required");var i=this._oneOverSemimajorAxis,a=e.x*i,s=u.mercatorAngleToGeodeticLatitude(e.y*i),f=e.z;return n(t)?(t.longitude=a,t.latitude=s,t.height=f,t):new r(a,s,f)},u}),define("Scene/PrimitivePipeline",["../Core/BoundingSphere","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/FeatureDetection","../Core/GeographicProjection","../Core/Geometry","../Core/GeometryAttribute","../Core/GeometryAttributes","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Matrix4","../Core/WebMercatorProjection"],function(e,r,t,n,i,o,a,s,u,f,l,c,h,d,w,m){"use strict";function p(e,r,t){var n,i=!t,o=e.length;if(!i&&o>1){var a=e[0].modelMatrix;for(n=1;o>n;++n)if(!w.equals(a,e[n].modelMatrix)){i=!0;break}}if(i)for(n=0;o>n;++n)h.transformToWorldCoordinates(e[n]);else w.multiplyTransformation(r,e[0].modelMatrix,r)}function y(e,n){var i=e.attributes,o=i.position,a=4*(o.values.length/o.componentsPerAttribute);i.pickColor=new l({componentDatatype:t.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,values:new Uint8Array(a)});for(var s=r.floatToByte(n.red),u=r.floatToByte(n.green),f=r.floatToByte(n.blue),c=r.floatToByte(n.alpha),h=i.pickColor.values,d=0;a>d;d+=4)h[d]=s,h[d+1]=u,h[d+2]=f,h[d+3]=c}function v(e,r){for(var t=e.length,n=0;t>n;++n){var o=e[n],a=r[n];i(o.geometry)?y(o.geometry,a):(y(o.westHemisphereGeometry,a),y(o.eastHemisphereGeometry,a))}}function g(e){var r,t=e.length,n=[],o=e[0].attributes;for(r in o)if(o.hasOwnProperty(r)){for(var a=o[r],s=!0,u=1;t>u;++u){var f=e[u].attributes[r];if(!i(f)||a.componentDatatype!==f.componentDatatype||a.componentsPerAttribute!==f.componentsPerAttribute||a.normalize!==f.normalize){s=!1;break}}s&&n.push(r)}return n}function b(e,r,n){for(var i=f.computeNumberOfVertices(r),o=n.length,a=0;o>a;++a){for(var s=n[a],u=e[s],c=u.componentDatatype,h=u.value,d=h.length,w=t.createTypedArray(c,i*d),m=0;i>m;++m)w.set(h,m*d);r.attributes[s]=new l({componentDatatype:c,componentsPerAttribute:d,normalize:u.normalize,values:w})}}function E(e,r){for(var t=e.length,n=0;t>n;++n){var o=e[n],a=o.attributes;i(o.geometry)?b(a,o.geometry,r):(b(a,o.westHemisphereGeometry,r),b(a,o.eastHemisphereGeometry,r))}}function q(r){var n,a,s=r.instances,u=r.pickIds,f=r.projection,l=r.elementIndexUintSupported,c=r.scene3DOnly,d=r.allowPicking,w=r.vertexCacheOptimize,m=r.compressVertices,y=r.modelMatrix,b=s.length,q=s[0].geometry.primitiveType;for(n=1;b>n;++n)if(s[n].geometry.primitiveType!==q)throw new o("All instance geometries must have the same primitiveType.");if(p(s,y,c),!c)for(n=0;b>n;++n)h.splitLongitude(s[n]);d&&v(s,u);var S=g(s);if(E(s,S),w)for(n=0;b>n;++n){var C=s[n];i(C.geometry)?(h.reorderForPostVertexCache(C.geometry),h.reorderForPreVertexCache(C.geometry)):(h.reorderForPostVertexCache(C.westHemisphereGeometry),h.reorderForPreVertexCache(C.westHemisphereGeometry),h.reorderForPostVertexCache(C.eastHemisphereGeometry),h.reorderForPreVertexCache(C.eastHemisphereGeometry))}var x=h.combineInstances(s);for(b=x.length,n=0;b>n;++n){a=x[n];var A,T=a.attributes;if(c)for(A in T)T.hasOwnProperty(A)&&T[A].componentDatatype===t.DOUBLE&&h.encodeAttribute(a,A,A+"3DHigh",A+"3DLow");else for(A in T)if(T.hasOwnProperty(A)&&T[A].componentDatatype===t.DOUBLE){var I=A+"3D",M=A+"2D";h.projectTo2D(a,A,I,M,f),i(a.boundingSphere)&&"position"===A&&(a.boundingSphereCV=e.fromVertices(a.attributes.position2D.values)),h.encodeAttribute(a,I,I+"High",I+"Low"),h.encodeAttribute(a,M,M+"High",M+"Low")}m&&h.compressVertices(a)}if(!l){var O=[];for(b=x.length,n=0;b>n;++n)a=x[n],O=O.concat(h.fitToUnsignedShortIndices(a));x=O}return x}function S(e,r,n){for(var i=[],o=e.attributes,a=n.length,s=0;a>s;++s){var u=n[s],f=o[u],l=f.componentDatatype;l===t.DOUBLE&&(l=t.FLOAT);var c=t.createTypedArray(l,f.values);i.push({index:r[u],componentDatatype:l,componentsPerAttribute:f.componentsPerAttribute,normalize:f.normalize,values:c}),delete o[u]}return i}function C(e,r,t,o,a,s,u,l,c){var h=f.computeNumberOfVertices(r);i(u[e])||(u[e]={boundingSphere:r.boundingSphere,boundingSphereCV:r.boundingSphereCV});for(var d=o.length,w=0;d>w;++w)for(var m=o[w],p=a[m],y=h;y>0;){for(var v,g=n(c[m],0),b=s[g],E=b.length,q=0;E>q&&(v=b[q],v.index!==p);++q);i(u[e][m])||(u[e][m]={dirty:!1,valid:!0,value:t[m].value,indices:[]});var S,C=v.values.length/v.componentsPerAttribute,x=n(l[m],0);C>x+y?(S=y,u[e][m].indices.push({attribute:v,offset:x,count:S}),l[m]=x+y):(S=C-x,u[e][m].indices.push({attribute:v,offset:x,count:S}),l[m]=0,c[m]=g+1),y-=S}}function x(e,r,t,n,o){var a,s,u,f=[],l=e.length,c={},h={};for(a=0;l>a;++a)s=e[a],u=s.attributes,i(s.geometry)&&C(a,s.geometry,u,o,n,t,f,c,h);for(a=0;l>a;++a)s=e[a],u=s.attributes,i(s.westHemisphereGeometry)&&C(a,s.westHemisphereGeometry,u,o,n,t,f,c,h);for(a=0;l>a;++a)s=e[a],u=s.attributes,i(s.eastHemisphereGeometry)&&C(a,s.eastHemisphereGeometry,u,o,n,t,f,c,h);for(l=r.length,a=0;l>a;++a){s=r[a],u=s.attributes;var d={};f.push(d);for(var w=o.length,m=0;w>m;++m){var p=o[m];d[p]={dirty:!1,valid:!1,value:u[p].value,indices:[]}}}return f}function A(e,r){var t=e.attributes;for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];i(o)&&i(o.values)&&r.push(o.values.buffer)}i(e.indices)&&r.push(e.indices.buffer)}function T(e,r){for(var t=e.length,n=0;t>n;++n)A(e[n],r)}function I(e,r){for(var t=e.length,n=0;t>n;++n)for(var i=e[n],o=i.length,a=0;o>a;++a)r.push(i[a].values.buffer)}function M(r){for(var t=1,n=r.length,o=0;n>o;o++){var a=r[o];if(++t,i(a)){var s=a.attributes;t+=6+2*e.packedLength+(i(a.indices)?a.indices.length:0);for(var u in s)if(s.hasOwnProperty(u)&&i(s[u])){var f=s[u];t+=5+f.values.length}}}return t}function O(e,r){for(var t=e.length,n=new Uint32Array(e.length),i=0;t>i;++i)n[i]=e[i].toRgba();return r.push(n.buffer),n}function R(e){for(var t=e.length,n=new Array(t),i=0;t>i;i++)n[i]=r.fromRgba(e[i]);return n}function N(e){for(var r=e.length,t=1+17*r,n=0;r>n;n++){var o=e[n].attributes;for(var a in o)if(o.hasOwnProperty(a)&&i(o[a])){var s=o[a];t+=5+s.value.length}}return t}function P(e,r){var t=new Float64Array(N(e)),n={},o=[],a=e.length,s=0;t[s++]=a;for(var u=0;a>u;u++){var f=e[u];w.pack(f.modelMatrix,t,s),s+=w.packedLength;var l=f.attributes,c=[];for(var h in l)l.hasOwnProperty(h)&&i(l[h])&&(c.push(h),i(n[h])||(n[h]=o.length,o.push(h)));t[s++]=c.length;for(var d=0;d<c.length;d++){var m=c[d],p=l[m];t[s++]=n[m],t[s++]=p.componentDatatype,t[s++]=p.componentsPerAttribute,t[s++]=p.normalize,t[s++]=p.value.length,t.set(p.value,s),s+=p.value.length}}return r.push(t.buffer),{stringTable:o,packedData:t}}function L(e){for(var r=e.packedData,n=e.stringTable,i=new Array(r[0]),o=0,a=1;a<r.length;){var s=w.unpack(r,a);a+=w.packedLength;for(var u={},f=r[a++],l=0;f>l;l++){for(var c=n[r[a++]],h=r[a++],d=r[a++],m=0!==r[a++],p=r[a++],y=t.createTypedArray(h,p),v=0;p>v;v++)y[v]=r[a++];u[c]={componentDatatype:h,componentsPerAttribute:d,normalize:m,value:y}}i[o++]={attributes:u,modelMatrix:s}}return i}function z(r){for(var t=r.length,n=1+t,o=0;t>o;o++){var a=r[o];n+=2,n+=i(a.boundingSphere)?e.packedLength:0,n+=i(a.boundingSphereCV)?e.packedLength:0;for(var s in a)if(a.hasOwnProperty(s)&&i(a[s])&&"boundingSphere"!==s&&"boundingSphereCV"!==s){var u=a[s];n+=4+3*u.indices.length+u.value.length}}return n}function D(r,t){var n=new Float64Array(z(r)),o=[],a=[],s={},u=r.length,f=0;n[f++]=u;for(var l=0;u>l;l++){var c=r[l],h=c.boundingSphere,d=i(h);n[f++]=d?1:0,d&&(e.pack(h,n,f),f+=e.packedLength),h=c.boundingSphereCV,d=i(h),n[f++]=d?1:0,d&&(e.pack(h,n,f),f+=e.packedLength);var w=[];for(var m in c)c.hasOwnProperty(m)&&i(c[m])&&"boundingSphere"!==m&&"boundingSphereCV"!==m&&(w.push(m),i(s[m])||(s[m]=o.length,o.push(m)));n[f++]=w.length;for(var p=0;p<w.length;p++){var y=w[p],v=c[y];n[f++]=s[y],n[f++]=v.valid?1:0;var g=v.indices,b=g.length;n[f++]=b;for(var E=0;b>E;E++){var q=g[E];n[f++]=q.count,n[f++]=q.offset;var S=a.indexOf(q.attribute);-1===S&&(S=a.length,a.push(q.attribute)),n[f++]=S}n[f++]=v.value.length,n.set(v.value,f),f+=v.value.length}}return t.push(n.buffer),{stringTable:o,packedData:n,attributeTable:a}}function F(r){for(var n=r.stringTable,i=r.attributeTable,o=r.packedData,a=new Array(o[0]),s=0,u=1,f=o.length;f>u;){var l={},c=1===o[u++];c&&(l.boundingSphere=e.unpack(o,u),u+=e.packedLength),c=1===o[u++],c&&(l.boundingSphereCV=e.unpack(o,u),u+=e.packedLength);for(var h=o[u++],d=0;h>d;d++){for(var w=n[o[u++]],m=1===o[u++],p=o[u++],y=p>0?new Array(p):void 0,v=0;p>v;v++){var g={};g.count=o[u++],g.offset=o[u++],g.attribute=i[o[u++]],y[v]=g}for(var b=o[u++],E=m?t.createTypedArray(y[0].attribute.componentDatatype,b):new Array(b),q=0;b>q;q++)E[q]=o[u++];l[w]={dirty:!1,valid:m,indices:y,value:E}}a[s++]=l}return a}if(!s.supportsTypedArrays())return{};var _={};return _.combineGeometry=function(e){var r,t,n,o,a,s=e.instances,u=e.invalidInstances;if(s.length>0){r=q(e),t=h.createAttributeLocations(r[0]),o=g(s),n=[],a=r.length;for(var f=0;a>f;++f){var l=r[f];n.push(S(l,t,o))}}o=i(o)?o:g(u);var c=x(s,u,n,t,o);return{geometries:r,modelMatrix:e.modelMatrix,attributeLocations:t,vaAttributes:n,vaAttributeLocations:c,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},_.packCreateGeometryResults=function(r,t){var n=new Float64Array(M(r)),o=[],a={},s=r.length,u=0;n[u++]=s;for(var f=0;s>f;f++){var l=r[f],c=i(l);if(n[u++]=c?1:0,c){n[u++]=l.primitiveType,n[u++]=l.geometryType;var h=i(l.boundingSphere)?1:0;n[u++]=h,h&&e.pack(l.boundingSphere,n,u),u+=e.packedLength;var d=i(l.boundingSphereCV)?1:0;n[u++]=d,d&&e.pack(l.boundingSphereCV,n,u),u+=e.packedLength;var w=l.attributes,m=[];for(var p in w)w.hasOwnProperty(p)&&i(w[p])&&(m.push(p),i(a[p])||(a[p]=o.length,o.push(p)));n[u++]=m.length;for(var y=0;y<m.length;y++){var v=m[y],g=w[v];n[u++]=a[v],n[u++]=g.componentDatatype,n[u++]=g.componentsPerAttribute,n[u++]=g.normalize?1:0,n[u++]=g.values.length,n.set(g.values,u),u+=g.values.length}var b=i(l.indices)?l.indices.length:0;n[u++]=b,b>0&&(n.set(l.indices,u),u+=b)}}return t.push(n.buffer),{stringTable:o,packedData:n}},_.unpackCreateGeometryResults=function(r){for(var n,i=r.stringTable,o=r.packedData,a=new Array(o[0]),s=0,u=1;u<o.length;){var h=1===o[u++];if(h){var w,m,p=o[u++],y=o[u++],v=1===o[u++];v&&(w=e.unpack(o,u)),u+=e.packedLength;var g=1===o[u++];g&&(m=e.unpack(o,u)),u+=e.packedLength;var b,E,q,S=new c,C=o[u++];for(n=0;C>n;n++){var x=i[o[u++]],A=o[u++];q=o[u++];var T=0!==o[u++];b=o[u++],E=t.createTypedArray(A,b);for(var I=0;b>I;I++)E[I]=o[u++];S[x]=new l({componentDatatype:A,componentsPerAttribute:q,normalize:T,values:E})}var M;if(b=o[u++],b>0){var O=E.length/q;for(M=d.createTypedArray(O,b),n=0;b>n;n++)M[n]=o[u++]}a[s++]=new f({primitiveType:p,geometryType:y,boundingSphere:w,indices:M,attributes:S})}else a[s++]=void 0}return a},_.packCombineGeometryParameters=function(e,r){for(var t=e.createGeometryResults,n=t.length,i=0;n>i;i++)r.push(t[i].packedData.buffer);var o;return e.allowPicking&&(o=O(e.pickIds,r)),{createGeometryResults:e.createGeometryResults,packedInstances:P(e.instances,r),packedPickIds:o,ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof u,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix}},_.unpackCombineGeometryParameters=function(e){for(var r=L(e.packedInstances),t=e.allowPicking,n=t?R(e.packedPickIds):void 0,o=e.createGeometryResults,s=o.length,f=0,l=[],c=[],h=[],d=[],p=[],y=0;s>y;y++)for(var v=_.unpackCreateGeometryResults(o[y]),g=v.length,b=0;g>b;b++){var E=v[b],q=r[f];i(E)?(q.geometry=E,l.push(q),h.push(f),t&&p.push(n[f])):(c.push(q),d.push(f)),++f}var S=a.clone(e.ellipsoid),C=e.isGeographic?new u(S):new m(S);return{instances:l,invalidInstances:c,validInstancesIndices:h,invalidInstancesIndices:d,pickIds:p,ellipsoid:S,projection:C,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,allowPicking:e.allowPicking,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:w.clone(e.modelMatrix)}},_.packCombineGeometryResults=function(e,r){return i(e.geometries)&&(T(e.geometries,r),I(e.vaAttributes,r)),{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,packedVaAttributeLocations:D(e.vaAttributeLocations,r),modelMatrix:e.modelMatrix,validInstancesIndices:e.validInstancesIndices,invalidInstancesIndices:e.invalidInstancesIndices}},_.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,vaAttributes:e.vaAttributes,perInstanceAttributeLocations:F(e.packedVaAttributeLocations,e.vaAttributes),modelMatrix:e.modelMatrix}},_}),define("Core/formatError",["./defined"],function(e){"use strict";var r=function(r){var t,n=r.name,i=r.message;t=e(n)&&e(i)?n+": "+i:r.toString();var o=r.stack;return e(o)&&(t+="\n"+o),t};return r}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,r,t){"use strict";var n=function(n){var i,o=[],a={id:void 0,result:void 0,error:void 0};return function(s){var u=s.data;o.length=0,a.id=u.id,a.error=void 0,a.result=void 0;try{a.result=n(u.parameters,o)}catch(f){a.error=f instanceof Error?{name:f.name,message:f.message,stack:f.stack}:f}r(i)||(i=e(self.webkitPostMessage,self.postMessage)),u.canTransferArrayBuffer||(o.length=0);try{i(a,o)}catch(f){a.result=void 0,a.error="postMessage failed with error: "+t(f)+"\n  with responseMessage: "+JSON.stringify(a),i(a)}}};return n}),define("Workers/combineGeometry",["../Scene/PrimitivePipeline","./createTaskProcessorWorker"],function(e,r){"use strict";function t(r,t){var n=e.unpackCombineGeometryParameters(r),i=e.combineGeometry(n);return e.packCombineGeometryResults(i,t)}return r(t)})}();