diff --git a/Cesium.js b/Cesium.js index 7d9f015..965db55 100644 --- a/Cesium.js +++ b/Cesium.js @@ -448,9 +448,9 @@ this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,thi this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)},d.prototype.equals=function(e){if(this===e)return!0;if(!i(e))return!1;if(this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;var t=this._derivativeTypes,r=i(t),n=e._derivativeTypes,o=i(n);if(r!==o)return!1;var a,l;if(r){if(l=t.length,l!==n.length)return!1;for(a=0;l>a;a++)if(t[a]!==n[a])return!1}var u=this._times,c=e._times;if(l=u.length,l!==c.length)return!1;for(a=0;l>a;a++)if(!s.equals(u[a],c[a]))return!1;var h=this._values,d=e._values;for(a=0;l>a;a++)if(h[a]!==d[a])return!1;return!0},d._mergeNewSamples=h,d}),i("DataSources/SampledPositionProperty",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","./PositionProperty","./Property","./SampledProperty"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(i,r){r=t(r,0);var n;if(r>0){n=new Array(r);for(var s=0;r>s;s++)n[s]=e}this._numberOfDerivatives=r,this._property=new u(e,n),this._definitionChanged=new o,this._referenceFrame=t(i,a.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}return r(c.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}}),c.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,a.FIXED,t)},c.prototype.getValueInReferenceFrame=function(e,t,r){return r=this._property.getValue(e,r),i(r)?s.convertToReferenceFrame(e,r,this._referenceFrame,t,r):void 0},c.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)},c.prototype.addSample=function(e,t,i){this._numberOfDerivatives;this._property.addSample(e,t,i)},c.prototype.addSamples=function(e,t,i){this._property.addSamples(e,t,i)},c.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)},c.prototype.equals=function(e){return this===e||e instanceof c&&l.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame},c}),i("DataSources/StripeOrientation",["../Core/freezeObject"],function(e){"use strict";var t={HORIZONTAL:0,VERTICAL:1};return e(t)}),i("DataSources/StripeMaterialProperty",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","./createPropertyDescriptor","./Property","./StripeOrientation"],function(e,t,i,r,n,o,a,s){"use strict";function l(e){e=t(e,t.EMPTY_OBJECT),this._definitionChanged=new n,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat}var u=s.HORIZONTAL,c=e.WHITE,h=e.BLACK,d=0,p=1;return r(l.prototype,{isConstant:{get:function(){return a.isConstant(this._orientation)&&a.isConstant(this._evenColor)&&a.isConstant(this._oddColor)&&a.isConstant(this._offset)&&a.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:o("orientation"),evenColor:o("evenColor"),oddColor:o("oddColor"),offset:o("offset"),repeat:o("repeat")}),l.prototype.getType=function(e){return"Stripe"},l.prototype.getValue=function(e,t){return i(t)||(t={}),t.horizontal=a.getValueOrDefault(this._orientation,e,u)===s.HORIZONTAL,t.evenColor=a.getValueOrClonedDefault(this._evenColor,e,c,t.evenColor),t.oddColor=a.getValueOrClonedDefault(this._oddColor,e,h,t.oddColor),t.offset=a.getValueOrDefault(this._offset,e,d),t.repeat=a.getValueOrDefault(this._repeat,e,p),t},l.prototype.equals=function(e){return this===e||e instanceof l&&a.equals(this._orientation,e._orientation)&&a.equals(this._evenColor,e._evenColor)&&a.equals(this._oddColor,e._oddColor)&&a.equals(this._offset,e._offset)&&a.equals(this._repeat,e._repeat)},l}),i("DataSources/TimeIntervalCollectionPositionProperty",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/ReferenceFrame","../Core/TimeIntervalCollection","./PositionProperty","./Property"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(t){this._definitionChanged=new n,this._intervals=new a,this._intervals.changedEvent.addEventListener(u.prototype._intervalsChanged,this),this._referenceFrame=e(t,o.FIXED)}return i(u.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}}),u.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},u.prototype.getValueInReferenceFrame=function(e,i,r){var n=this._intervals.findDataForIntervalContainingDate(e);return t(n)?s.convertToReferenceFrame(e,n,this._referenceFrame,i,r):void 0},u.prototype.equals=function(e){return this===e||e instanceof u&&this._intervals.equals(e._intervals,l.equals)&&this._referenceFrame===e._referenceFrame},u.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},u}),i("DataSources/TimeIntervalCollectionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/TimeIntervalCollection","./Property"],function(e,t,i,r,n,o){"use strict";function a(){this._definitionChanged=new r,this._intervals=new n,this._intervals.changedEvent.addEventListener(a.prototype._intervalsChanged,this)}return t(a.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}}),a.prototype.getValue=function(t,i){var r=this._intervals.findDataForIntervalContainingDate(t);return e(r)&&"function"==typeof r.clone?r.clone(i):r},a.prototype.equals=function(e){return this===e||e instanceof a&&this._intervals.equals(e._intervals,o.equals)},a.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)},a}),i("DataSources/CzmlDataSource",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartographic","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ExtrapolationType","../Core/getAbsoluteUri","../Core/getFilenameFromUri","../Core/HermitePolynomialApproximation","../Core/isArray","../Core/Iso8601","../Core/JulianDate","../Core/LagrangePolynomialApproximation","../Core/LinearApproximation","../Core/loadJson","../Core/Math","../Core/Quaternion","../Core/Rectangle","../Core/ReferenceFrame","../Core/RuntimeError","../Core/Spherical","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../Scene/VerticalOrigin","../ThirdParty/Uri","../ThirdParty/when","./BillboardGraphics","./ColorMaterialProperty","./CompositeMaterialProperty","./CompositePositionProperty","./CompositeProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./DataSourceClock","./EllipseGraphics","./EllipsoidGraphics","./EntityCollection","./GridMaterialProperty","./ImageMaterialProperty","./LabelGraphics","./ModelGraphics","./NodeTransformationProperty","./PathGraphics","./PointGraphics","./PolygonGraphics","./PolylineGlowMaterialProperty","./PolylineGraphics","./PolylineOutlineMaterialProperty","./PositionPropertyArray","./PropertyBag","./RectangleGraphics","./ReferenceProperty","./Rotation","./SampledPositionProperty","./SampledProperty","./StripeMaterialProperty","./StripeOrientation","./TimeIntervalCollectionPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee,te,ie,re,ne,oe,ae,se,le,ue,ce,he,de,pe,me,fe,ve){"use strict";function ge(e,t){return"#"===t[0]&&(t=ot+t),le.fromString(e,t)}function _e(e){var t=e.rgbaf;if(l(t))return t;var i=e.rgba;if(l(i)){if(i.length===o.length)return[o.byteToFloat(i[0]),o.byteToFloat(i[1]),o.byteToFloat(i[2]),o.byteToFloat(i[3])];var r=i.length;t=new Array(r);for(var n=0;r>n;n+=5)t[n]=i[n],t[n+1]=o.byteToFloat(i[n+1]),t[n+2]=o.byteToFloat(i[n+2]),t[n+3]=o.byteToFloat(i[n+3]),t[n+4]=o.byteToFloat(i[n+4]);return t}}function ye(e,t){var i=s(e.uri,e);return l(t)&&(i=m(i,m(t))),i}function Ce(e){var t=e.wsenDegrees;if(l(t)){for(var i=t.length,r=0;i>r;r++)t[r]=w.toRadians(t[r]);return t}return e.wsen}function Ee(e){if(l(e.cartesian))return e.cartesian;if(l(e.cartesianVelocity))return e.cartesianVelocity;if(l(e.unitCartesian))return e.unitCartesian;var i,r,n,o=e.unitSpherical;if(l(o)){if(r=o.length,2===r)st.clock=o[0],st.cone=o[1],t.fromSpherical(st,at),n=[at.x,at.y,at.z];else{var a=0;for(n=new Array(r/3*4),i=0;r>i;i+=4)n[i]=o[a++],st.clock=o[a++],st.cone=o[a++],t.fromSpherical(st,at),n[i+1]=at.x,n[i+2]=at.y,n[i+3]=at.z}return n}var s=e.cartographicRadians;if(l(s)){if(3===s.length)lt.longitude=s[0],lt.latitude=s[1],lt.height=s[2],h.WGS84.cartographicToCartesian(lt,at),n=[at.x,at.y,at.z];else for(r=s.length,n=new Array(r),i=0;r>i;i+=4)lt.longitude=s[i+1],lt.latitude=s[i+2],lt.height=s[i+3],h.WGS84.cartographicToCartesian(lt,at),n[i]=s[i],n[i+1]=at.x,n[i+2]=at.y,n[i+3]=at.z;return n}var u=e.cartographicDegrees;if(!l(u))throw new A(JSON.stringify(e)+" is not a valid CZML interval.");if(3===u.length)lt.longitude=w.toRadians(u[0]),lt.latitude=w.toRadians(u[1]),lt.height=u[2],h.WGS84.cartographicToCartesian(lt,at),n=[at.x,at.y,at.z];else for(r=u.length,n=new Array(r),i=0;r>i;i+=4)lt.longitude=w.toRadians(u[i+1]),lt.latitude=w.toRadians(u[i+2]),lt.height=u[i+3],h.WGS84.cartographicToCartesian(lt,at),n[i]=u[i],n[i+1]=at.x,n[i+2]=at.y,n[i+3]=at.z;return n}function Se(e,t){var i=e[t],r=e[t+1],n=e[t+2],o=e[t+3],a=1/Math.sqrt(i*i+r*r+n*n+o*o);e[t]=i*a,e[t+1]=r*a,e[t+2]=n*a,e[t+3]=o*a}function we(e){var t=e.unitQuaternion;if(l(t)){if(4===t.length)return Se(t,0),t;for(var i=1;ih);var g="function"==typeof e.unpack&&e!==ue;if(!d&&!v)return void(f?t[i]=ge(a,r.reference):g?t[i]=new G(e.unpack(p,0)):t[i]=new G(p));var C,E=t[i],S=r.epoch;if(l(S)&&(C=y.fromIso8601(S)),d&&!v)return E instanceof he||(E=new he(e),t[i]=E),E.addSamplesPackedArray(p,C),void xe(r,E);var w;if(!d&&v)return u=u.clone(),f?u.data=ge(a,r.reference):g?u.data=e.unpack(p,0):u.data=p,l(E)||(E=f?new z:new fe,t[i]=E),void(!f&&E instanceof fe?E.intervals.addInterval(u):E instanceof z?(u.data=f?u.data:new G(u.data),E.intervals.addInterval(u)):(w=_.MAXIMUM_INTERVAL.clone(),w.data=E,E=new z,t[i]=E,E.intervals.addInterval(w),u.data=f?u.data:new G(u.data),E.intervals.addInterval(u)));l(E)||(E=new z,t[i]=E),E instanceof z||(w=_.MAXIMUM_INTERVAL.clone(),w.data=E,E=new z,t[i]=E,E.intervals.addInterval(w));var T=E.intervals;w=T.findInterval(u),l(w)&&w.data instanceof he||(w=u.clone(),w.data=new he(e),T.addInterval(w)),w.data.addSamplesPackedArray(p,C),xe(r,w.data)}function Ae(e,t,i,r,n,o,a){if(l(r))if(g(r))for(var s=0,u=r.length;u>s;s++)be(e,t,i,r[s],n,o,a);else be(e,t,i,r,n,o,a)}function Pe(e,i,r,n,o,a){var u,c=r.interval;l(c)?(ht.iso8601=c,u=I.fromIso8601(ht),l(n)&&(u=I.intersect(u,n,ut))):l(n)&&(u=n);var h,d,p,m=!1,f=l(r.cartesianVelocity)?1:0,v=t.packedLength*(f+1),g=l(r.reference),C=l(u)&&!u.equals(_.MAXIMUM_INTERVAL);if(g||(l(r.referenceFrame)&&(h=b[r.referenceFrame]),h=s(h,b.FIXED),d=Ee(r),p=s(d.length,1),m=p>v),!m&&!C)return void(g?e[i]=ge(a,r.reference):e[i]=new U(t.unpack(d),h));var E,S=e[i],w=r.epoch;if(l(w)&&(E=y.fromIso8601(w)),m&&!C)return(!(S instanceof ce)||l(h)&&S.referenceFrame!==h)&&(S=new ce(h,f),e[i]=S),S.addSamplesPackedArray(d,E),void xe(r,S);var T;if(!m&&C)return u=u.clone(),g?u.data=ge(a,r.reference):u.data=t.unpack(d),l(S)||(S=g?new k(h):new me(h),e[i]=S),void(!g&&S instanceof me&&l(h)&&S.referenceFrame===h?S.intervals.addInterval(u):S instanceof k?(u.data=g?u.data:new U(u.data,h),S.intervals.addInterval(u)):(T=_.MAXIMUM_INTERVAL.clone(),T.data=S,S=new k(S.referenceFrame),e[i]=S,S.intervals.addInterval(T),u.data=g?u.data:new U(u.data,h),S.intervals.addInterval(u)));l(S)?S instanceof k||(T=_.MAXIMUM_INTERVAL.clone(),T.data=S,S=new k(S.referenceFrame),e[i]=S,S.intervals.addInterval(T)):(S=new k(h),e[i]=S);var x=S.intervals;T=x.findInterval(u),l(T)&&T.data instanceof ce&&(!l(h)||T.data.referenceFrame===h)||(T=u.clone(),T.data=new ce(h,f),x.addInterval(T)),T.data.addSamplesPackedArray(d,E),xe(r,T.data)}function Ie(e,t,i,r,n,o){if(l(i))if(g(i))for(var a=0,s=i.length;s>a;a++)Pe(e,t,i[a],r,n,o);else Pe(e,t,i,r,n,o)}function Me(t,i,r,n,a,s){var u,c=r.interval;l(c)?(ht.iso8601=c,u=I.fromIso8601(ht),l(n)&&(u=I.intersect(u,n,ut))):l(n)&&(u=n);var h,d,p=t[i];if(l(u)){p instanceof V||(p=new V,t[i]=p);var m=p.intervals;d=m.findInterval({start:u.start,stop:u.stop}),l(d)?h=d.data:(d=u.clone(),m.addInterval(d))}else h=p;var f;l(r.solidColor)?(h instanceof B||(h=new B),f=r.solidColor,Ae(o,h,"color",f.color,void 0,void 0,s)):l(r.grid)?(h instanceof X||(h=new X),f=r.grid,Ae(o,h,"color",f.color,void 0,a,s),Ae(Number,h,"cellAlpha",f.cellAlpha,void 0,a,s),Ae(e,h,"lineThickness",f.lineThickness,void 0,a,s),Ae(e,h,"lineOffset",f.lineOffset,void 0,a,s),Ae(e,h,"lineCount",f.lineCount,void 0,a,s)):l(r.image)?(h instanceof Z||(h=new Z),f=r.image,Ae(Image,h,"image",f.image,void 0,a,s),Ae(e,h,"repeat",f.repeat,void 0,a,s),Ae(Number,h,"alpha",f.alpha,void 0,a,s)):l(r.stripe)?(h instanceof de||(h=new de),f=r.stripe,Ae(pe,h,"orientation",f.orientation,void 0,a,s),Ae(o,h,"evenColor",f.evenColor,void 0,a,s),Ae(o,h,"oddColor",f.oddColor,void 0,a,s),Ae(Number,h,"offset",f.offset,void 0,a,s),Ae(Number,h,"repeat",f.repeat,void 0,a,s)):l(r.polylineOutline)?(h instanceof ne||(h=new ne),f=r.polylineOutline,Ae(o,h,"color",f.color,void 0,a,s),Ae(o,h,"outlineColor",f.outlineColor,void 0,a,s),Ae(Number,h,"outlineWidth",f.outlineWidth,void 0,a,s)):l(r.polylineGlow)&&(h instanceof ie||(h=new ie),f=r.polylineGlow,Ae(o,h,"color",f.color,void 0,a,s),Ae(Number,h,"glowPower",f.glowPower,void 0,a,s)),l(d)?d.data=h:t[i]=h}function De(e,t,i,r,n,o){if(l(i))if(g(i))for(var a=0,s=i.length;s>a;a++)Me(e,t,i[a],r,n,o);else Me(e,t,i,r,n,o)}function Re(e,t,i,r){e.name=s(t.name,e.name)}function Oe(e,t,i,r){var n=t.description;l(n)&&Ae(String,e,"description",n,void 0,r,i)}function Ne(e,t,i,r){var n=t.position;l(n)&&Ie(e,"position",n,void 0,r,i)}function Le(e,i,r,n){var o=i.viewFrom;l(o)&&Ae(t,e,"viewFrom",o,void 0,n,r)}function Fe(e,t,i,r){var n=t.orientation;l(n)&&Ae(T,e,"orientation",n,void 0,r,i)}function Be(e,i,r,n){var o,a,s=r.references;if(l(s)){var u=[];for(o=0,a=s.length;a>o;o++)u.push(ge(n,s[o]));var c=r.interval;if(l(c)){if(c=I.fromIso8601(c),!(e[i]instanceof k)){c.data=new oe(u);var d=new k;d.intervals.addInterval(c),e[i]=d}}else e[i]=new oe(u)}else{var p=[],m=r.cartesian;if(l(m)){for(o=0,a=m.length;a>o;o+=3)p.push(new t(m[o],m[o+1],m[o+2]));r.array=p}else if(m=r.cartographicRadians,l(m)){for(o=0,a=m.length;a>o;o+=3)lt.longitude=m[o],lt.latitude=m[o+1],lt.height=m[o+2],p.push(h.WGS84.cartographicToCartesian(lt));r.array=p}else if(m=r.cartographicDegrees,l(m)){for(o=0,a=m.length;a>o;o+=3)p.push(t.fromDegrees(m[o],m[o+1],m[o+2]));r.array=p}l(r.array)&&Ae(Array,e,i,r,void 0,void 0,n)}}function Ve(e,t,i,r){if(l(i))if(g(i))for(var n=i.length,o=0;n>o;o++)Be(e,t,i[o],r);else Be(e,t,i,r)}function ke(e,t,i,r){var n,o=t.availability;if(l(o)){var a;if(g(o))for(var s=o.length,u=0;s>u;u++)l(a)||(a=new M),ht.iso8601=o[u],n=I.fromIso8601(ht),a.addInterval(n);else ht.iso8601=o,n=I.fromIso8601(ht),a=new M,a.addInterval(n);e.availability=a}}function ze(i,r,n,a){var s=r.billboard;if(l(s)){var u,c=s.interval;l(c)&&(ht.iso8601=c,u=I.fromIso8601(ht));var h=i.billboard;l(h)||(i.billboard=h=new F),Ae(o,h,"color",s.color,u,a,n),Ae(t,h,"eyeOffset",s.eyeOffset,u,a,n),Ae(D,h,"horizontalOrigin",s.horizontalOrigin,u,a,n),Ae(Image,h,"image",s.image,u,a,n),Ae(e,h,"pixelOffset",s.pixelOffset,u,a,n),Ae(Number,h,"scale",s.scale,u,a,n),Ae(ue,h,"rotation",s.rotation,u,a,n),Ae(t,h,"alignedAxis",s.alignedAxis,u,a,n),Ae(Boolean,h,"show",s.show,u,a,n),Ae(O,h,"verticalOrigin",s.verticalOrigin,u,a,n),Ae(Boolean,h,"sizeInMeters",s.sizeInMeters,u,a,n)}}function Ue(e,t){var i=e.version;if(l(i)&&"string"==typeof i){var r=i.split(".");if(2===r.length){if("1"!==r[0])throw new A("Cesium only supports CZML version 1.");t._version=i}}if(!l(t._version))throw new A("CZML version information invalid. It is expected to be a property on the document object in the . version format.");var n=t._documentPacket;l(e.name)&&(n.name=e.name);var o=e.clock;if(l(o)){var a=n.clock;l(a)?(a.interval=s(o.interval,a.interval),a.currentTime=s(o.currentTime,a.currentTime),a.range=s(o.range,a.range),a.step=s(o.step,a.step),a.multiplier=s(o.multiplier,a.multiplier)):n.clock={interval:o.interval,currentTime:o.currentTime,range:o.range,step:o.step,multiplier:o.multiplier}}}function Ge(e,t,i,r){var n=t.ellipse;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.ellipse;l(u)||(e.ellipse=u=new q),Ae(Boolean,u,"show",n.show,a,r,i),Ae(ue,u,"rotation",n.rotation,a,r,i),Ae(Number,u,"semiMajorAxis",n.semiMajorAxis,a,r,i),Ae(Number,u,"semiMinorAxis",n.semiMinorAxis,a,r,i),Ae(Number,u,"height",n.height,a,r,i),Ae(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(ue,u,"stRotation",n.stRotation,a,r,i),De(u,"material",n.material,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Number,u,"numberOfVerticalLines",n.numberOfVerticalLines,a,r,i)}}function We(e,i,r,n){var a=i.ellipsoid;if(l(a)){var s,u=a.interval;l(u)&&(ht.iso8601=u,s=I.fromIso8601(ht));var c=e.ellipsoid;l(c)||(e.ellipsoid=c=new j),Ae(Boolean,c,"show",a.show,s,n,r),Ae(t,c,"radii",a.radii,s,n,r),De(c,"material",a.material,s,n,r),Ae(Boolean,c,"fill",a.fill,s,n,r),Ae(Boolean,c,"outline",a.outline,s,n,r),Ae(o,c,"outlineColor",a.outlineColor,s,n,r),Ae(Number,c,"outlineWidth",a.outlineWidth,s,n,r)}}function He(i,r,n,a){var s=r.label;if(l(s)){var u,c=s.interval;l(c)&&(ht.iso8601=c,u=I.fromIso8601(ht));var h=i.label;l(h)||(i.label=h=new K),Ae(o,h,"fillColor",s.fillColor,u,a,n),Ae(o,h,"outlineColor",s.outlineColor,u,a,n),Ae(Number,h,"outlineWidth",s.outlineWidth,u,a,n),Ae(t,h,"eyeOffset",s.eyeOffset,u,a,n),Ae(D,h,"horizontalOrigin",s.horizontalOrigin,u,a,n),Ae(String,h,"text",s.text,u,a,n),Ae(e,h,"pixelOffset",s.pixelOffset,u,a,n),Ae(Number,h,"scale",s.scale,u,a,n),Ae(Boolean,h,"show",s.show,u,a,n),Ae(O,h,"verticalOrigin",s.verticalOrigin,u,a,n),Ae(String,h,"font",s.font,u,a,n),Ae(R,h,"style",s.style,u,a,n)}}function qe(e,t,i,r){var n=t.model;if(l(n)){var o,a=n.interval;l(a)&&(ht.iso8601=a,o=I.fromIso8601(ht));var s=e.model;l(s)||(e.model=s=new Q),Ae(Boolean,s,"show",n.show,o,r,i),Ae(Number,s,"scale",n.scale,o,r,i),Ae(Number,s,"minimumPixelSize",n.minimumPixelSize,o,r,i),Ae(Boolean,s,"incrementallyLoadTextures",n.incrementallyLoadTextures,o,r,i),Ae(N,s,"uri",n.gltf,o,r,i),Ae(Boolean,s,"runAnimations",n.runAnimations,o,r,i);var u=n.nodeTransformations;if(l(u))if(g(u))for(var c=0,h=u.length;h>c;c++)je(s,u[c],o,r,i);else je(s,u,o,r,i)}}function je(e,i,r,n,o){var a,s=i.interval;l(s)?(ht.iso8601=s,a=I.fromIso8601(ht),l(r)&&(a=I.intersect(a,r,ut))):l(r)&&(a=r);for(var u=e.nodeTransformations,c=Object.keys(i),h=0,d=c.length;d>h;++h){var p=c[h];if("interval"!==p){var m=i[p];if(l(m)){l(u)||(e.nodeTransformations=u=new ae),u.hasProperty(p)||u.addProperty(p);var f=u[p];l(f)||(u[p]=f=new J),Ae(t,f,"translation",m.translation,a,n,o),Ae(T,f,"rotation",m.rotation,a,n,o),Ae(t,f,"scale",m.scale,a,n,o)}}}}function Ye(e,t,i,r){var n=t.path;if(l(n)){var o,a=n.interval;l(a)&&(ht.iso8601=a,o=I.fromIso8601(ht));var s=e.path;l(s)||(e.path=s=new $),Ae(Boolean,s,"show",n.show,o,r,i),Ae(Number,s,"width",n.width,o,r,i),Ae(Number,s,"resolution",n.resolution,o,r,i),Ae(Number,s,"leadTime",n.leadTime,o,r,i),Ae(Number,s,"trailTime",n.trailTime,o,r,i),De(s,"material",n.material,o,r,i)}}function Xe(e,t,i,r){var n=t.point;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.point;l(u)||(e.point=u=new ee),Ae(o,u,"color",n.color,a,r,i),Ae(Number,u,"pixelSize",n.pixelSize,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Boolean,u,"show",n.show,a,r,i)}}function Ze(e,t,i,r){var n=t.polygon;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.polygon;l(u)||(e.polygon=u=new te),Ae(Boolean,u,"show",n.show,a,r,i),De(u,"material",n.material,a,r,i),Ae(Number,u,"height",n.height,a,r,i),Ae(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(ue,u,"stRotation",n.stRotation,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Boolean,u,"perPositionHeight",n.perPositionHeight,a,r,i),Ve(u,"hierarchy",n.positions,i)}}function Ke(e,t,i,r){var n=t.rectangle;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.rectangle;l(u)||(e.rectangle=u=new se),Ae(Boolean,u,"show",n.show,a,r,i),Ae(x,u,"coordinates",n.coordinates,a,r,i),De(u,"material",n.material,a,r,i),Ae(Number,u,"height",n.height,a,r,i),Ae(Number,u,"extrudedHeight",n.extrudedHeight,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(ue,u,"rotation",n.rotation,a,r,i),Ae(ue,u,"stRotation",n.stRotation,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ae(Boolean,u,"closeBottom",n.closeBottom,a,r,i),Ae(Boolean,u,"closeTop",n.closeTop,a,r,i)}}function Qe(e,t,i,r){var n=t.wall;if(l(n)){var a,s=n.interval;l(s)&&(ht.iso8601=s,a=I.fromIso8601(ht));var u=e.wall;l(u)||(e.wall=u=new ve),Ae(Boolean,u,"show",n.show,a,r,i),De(u,"material",n.material,a,r,i),Ae(Array,u,"minimumHeights",n.minimumHeights,a,r,i),Ae(Array,u,"maximumHeights",n.maximumHeights,a,r,i),Ae(Number,u,"granularity",n.granularity,a,r,i),Ae(Boolean,u,"fill",n.fill,a,r,i),Ae(Boolean,u,"outline",n.outline,a,r,i),Ae(o,u,"outlineColor",n.outlineColor,a,r,i),Ae(Number,u,"outlineWidth",n.outlineWidth,a,r,i),Ve(u,"positions",n.positions,i)}}function Je(e,t,i,r){var n=t.polyline;if(l(n)){var o,a=n.interval;l(a)&&(ht.iso8601=a,o=I.fromIso8601(ht));var s=e.polyline;l(s)||(e.polyline=s=new re),Ae(Boolean,s,"show",n.show,o,r,i),Ae(Number,s,"width",n.width,o,r,i),De(s,"material",n.material,o,r,i),Ae(Boolean,s,"followSurface",n.followSurface,o,r,i),Ae(Number,s,"granularity",n.granularity,o,r,i),Ve(s,"positions",n.positions,i)}}function $e(e,t,i,r,n){var o=e.id;if(l(o)||(o=a()),ot=o,!l(n._version)&&"document"!==o)throw new A("The first CZML packet is required to be the document object.");if(e["delete"]===!0)t.removeById(o);else if("document"===o)Ue(e,n);else{var s=t.getOrCreateEntity(o),u=e.parent;l(u)&&(s.parent=t.getOrCreateEntity(u));for(var c=i.length-1;c>-1;c--)i[c](s,e,t,r)}ot=void 0}function et(e){var t,i=e._documentPacket.clock;if(!l(i)){if(!l(e._clock)){var o=e._entityCollection.computeAvailability();if(!o.start.equals(_.MINIMUM_VALUE)){var a=o.start,u=o.stop,c=y.secondsDifference(u,a),h=Math.round(c/120);return t=new H,t.startTime=y.clone(a),t.stopTime=y.clone(u),t.clockRange=r.LOOP_STOP,t.multiplier=h,t.currentTime=y.clone(a),t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}if(l(e._clock)?t=e._clock.clone():(t=new H,t.startTime=_.MINIMUM_VALUE.clone(),t.stopTime=_.MAXIMUM_VALUE.clone(),t.currentTime=_.MINIMUM_VALUE.clone(),t.clockRange=r.LOOP_STOP,t.clockStep=n.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1),l(i.interval)){ht.iso8601=i.interval;var d=I.fromIso8601(ht);t.startTime=d.start,t.stopTime=d.stop}return l(i.currentTime)&&(t.currentTime=y.fromIso8601(i.currentTime)),l(i.range)&&(t.clockRange=s(r[i.range],r.LOOP_STOP)),l(i.step)&&(t.clockStep=s(n[i.step],n.SYSTEM_CLOCK_MULTIPLIER)),l(i.multiplier)&&(t.multiplier=i.multiplier),t.equals(e._clock)?!1:(e._clock=t.clone(e._clock),!0)}function tt(e,t,i,r){i=s(i,s.EMPTY_OBJECT);var n=t,o=i.sourceUri;return"string"==typeof t&&(n=S(t),o=s(o,t)),W.setLoading(e,!0),L(n,function(t){return it(e,t,o,r)}).otherwise(function(t){return W.setLoading(e,!1),e._error.raiseEvent(e,t),console.log(t),L.reject(t)})}function it(e,t,i,r){W.setLoading(e,!0);var n=e._entityCollection;r&&(e._version=void 0,e._documentPacket=new rt,n.removeAll()),nt._processCzml(t,n,i,void 0,e);var o=et(e),a=e._documentPacket;return l(a.name)&&e._name!==a.name?(e._name=a.name,o=!0):!l(e._name)&&l(i)&&(e._name=f(i),o=!0),W.setLoading(e,!1),o&&e._changed.raiseEvent(e),e}function rt(){this.name=void 0,this.clock=void 0}function nt(e){this._name=e,this._changed=new d,this._error=new d,this._isLoading=!1,this._loading=new d,this._clock=void 0,this._documentPacket=new rt,this._version=void 0,this._entityCollection=new Y(this)}var ot,at=new t,st=new P,lt=new i,ut=new I,ct={HERMITE:v,LAGRANGE:C,LINEAR:E},ht={iso8601:void 0};return nt.load=function(e,t){return(new nt).load(e,t)},u(nt.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}}}),nt.updaters=[ze,Ge,We,He,qe,Re,Oe,Ye,Xe,Ze,Je,Ke,Ne,Le,Qe,Fe,ke],nt.prototype.process=function(e,t){return tt(this,e,t,!1)},nt.prototype.load=function(e,t){return tt(this,e,t,!0)},nt.processPacketData=Ae,nt.processPositionPacketData=Ie,nt.processMaterialPacketData=De,nt._processCzml=function(e,t,i,r,n){if(r=l(r)?r:nt.updaters,g(e))for(var o=0,a=e.length;a>o;o++)$e(e[o],t,r,i,n);else $e(e,t,r,i,n)},nt}),i("DataSources/DataSourceCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../ThirdParty/when"],function(e,t,i,r,n,o,a){"use strict";function s(){this._dataSources=[],this._dataSourceAdded=new o,this._dataSourceRemoved=new o}return i(s.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}}}),s.prototype.add=function(e){var t=this,i=this._dataSources;return a(e,function(e){return i===t._dataSources&&(t._dataSources.push(e),t._dataSourceAdded.raiseEvent(t,e)),e})},s.prototype.remove=function(t,i){i=e(i,!1);var r=this._dataSources.indexOf(t);return-1!==r?(this._dataSources.splice(r,1),this._dataSourceRemoved.raiseEvent(this,t),i&&"function"==typeof t.destroy&&t.destroy(),!0):!1},s.prototype.removeAll=function(t){t=e(t,!1);for(var i=this._dataSources,r=0,n=i.length;n>r;++r){var o=i[r];this._dataSourceRemoved.raiseEvent(this,o),t&&"function"==typeof o.destroy&&o.destroy()}this._dataSources=[]},s.prototype.contains=function(e){return-1!==this.indexOf(e)},s.prototype.indexOf=function(e){return this._dataSources.indexOf(e)},s.prototype.get=function(e){return this._dataSources[e]},s.prototype.isDestroyed=function(){return!1},s.prototype.destroy=function(){return this.removeAll(!0),r(this)},s}),i("DataSources/EllipseGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipseGeometry","../Core/EllipseOutlineGeometry","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){ return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,l=a.isAvailable(i),u=new d(l&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||l)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new c({id:a,geometry:new s(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new c({id:r,geometry:new l(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"position"===t||"ellipse"===t){var a=this._entity.ellipse;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(h.MINIMUM_VALUE):!0,u=a.outline,c=r(u);if(c&&u.isConstant&&(c=u.getValue(h.MINIMUM_VALUE)),!l&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=this._entity.position,f=a.semiMajorAxis,g=a.semiMinorAxis,_=a.show;if(r(_)&&_.isConstant&&!_.getValue(h.MINIMUM_VALUE)||!r(d)||!r(f)||!r(g))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var y=i(a.material,T),E=y instanceof v;this._materialProperty=y,this._fillProperty=i(s,b),this._showProperty=i(_,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=c?i(a.outlineColor,P):void 0;var S=a.rotation,w=a.height,I=a.extrudedHeight,M=a.granularity,D=a.stRotation,R=a.outlineWidth,O=a.numberOfVerticalLines;if(this._isClosed=r(I),this._fillEnabled=l,this._outlineEnabled=c,d.isConstant&&f.isConstant&&g.isConstant&&C.isConstant(S)&&C.isConstant(w)&&C.isConstant(I)&&C.isConstant(M)&&C.isConstant(D)&&C.isConstant(R)&&C.isConstant(O)){var N=this._options;N.vertexFormat=E?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,N.center=d.getValue(h.MINIMUM_VALUE,N.center),N.semiMajorAxis=f.getValue(h.MINIMUM_VALUE,N.semiMajorAxis),N.semiMinorAxis=g.getValue(h.MINIMUM_VALUE,N.semiMinorAxis),N.rotation=r(S)?S.getValue(h.MINIMUM_VALUE):void 0,N.height=r(w)?w.getValue(h.MINIMUM_VALUE):void 0,N.extrudedHeight=r(I)?I.getValue(h.MINIMUM_VALUE):void 0,N.granularity=r(M)?M.getValue(h.MINIMUM_VALUE):void 0,N.stRotation=r(D)?D.getValue(h.MINIMUM_VALUE):void 0,N.numberOfVerticalLines=r(O)?O.getValue(h.MINIMUM_VALUE):void 0,this._outlineWidth=r(R)?R.getValue(h.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,u=a.ellipse;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(u.show,i,!0)){var h=this._options,d=C.getValueOrUndefined(a.position,i,h.center),v=C.getValueOrUndefined(u.semiMajorAxis,i),g=C.getValueOrUndefined(u.semiMinorAxis,i);if(r(d)&&r(v)&&r(g)){if(h.center=d,h.semiMajorAxis=v,h.semiMinorAxis=g,h.rotation=C.getValueOrUndefined(u.rotation,i),h.height=C.getValueOrUndefined(u.height,i),h.extrudedHeight=C.getValueOrUndefined(u.extrudedHeight,i),h.granularity=C.getValueOrUndefined(u.granularity,i),h.stRotation=C.getValueOrUndefined(u.stRotation,i),h.numberOfVerticalLines=C.getValueOrUndefined(u.numberOfVerticalLines,i),C.getValueOrDefault(u.fill,i,!0)){var _=y.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var E=new p({material:_,translucent:_.isTranslucent(),closed:r(h.extrudedHeight)});h.vertexFormat=E.vertexFormat,this._primitive=n.add(new f({geometryInstances:new c({id:a,geometry:new s(h)}),appearance:E,asynchronous:!1}))}if(C.getValueOrDefault(u.outline,i,!1)){h.vertexFormat=m.VERTEX_FORMAT;var S=C.getValueOrClonedDefault(u.outlineColor,i,e.BLACK,I),w=C.getValueOrDefault(u.outlineWidth,i,1),T=1!==S.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new c({id:a,geometry:new l(h),attributes:{color:t.fromColor(S)}}),appearance:new m({flat:!0,translucent:T,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/EllipsoidGeometryUpdater",["../Core/Cartesian3","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipsoidGeometry","../Core/EllipsoidOutlineGeometry","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/Matrix4","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../Scene/SceneMode","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w){"use strict";function T(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0}function x(e,t){this._scene=t,this._entity=e,this._entitySubscription=e.definitionChanged.addEventListener(x.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new c,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new T(e),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}function b(e,t){this._entity=t._entity,this._scene=t._scene,this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new T(t._entity),this._modelMatrix=new p,this._material=void 0,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0}var A=new y(t.WHITE),P=new C(!0),I=new C(!0),M=new C(!1),D=new C(t.BLACK),R=new e,O=new t,N=new e(1,1,1);return o(x,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),o(x.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&w.isConstant(this._showProperty)&&w.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!n(this._entity.availability)&&w.isConstant(this._showProperty)&&w.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),x.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},x.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},x.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),u=new m(s&&a.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e));if(this._materialProperty instanceof y){var c=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(e)),o=i.fromColor(c),r={show:u,color:o}}else r={show:u};return new h({id:a,geometry:new l(this._options),modelMatrix:a._getModelMatrix(d.MINIMUM_VALUE),attributes:r})},x.prototype.createOutlineGeometryInstance=function(e){var r=this._entity,n=r.isAvailable(e),o=w.getValueOrDefault(this._outlineColorProperty,e,t.BLACK);return new h({id:r,geometry:new u(this._options),modelMatrix:r._getModelMatrix(d.MINIMUM_VALUE),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:i.fromColor(o)}})},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){this._entitySubscription(),a(this)},x.prototype._onEntityPropertyChanged=function(e,t,i,o){if("availability"===t||"position"===t||"orientation"===t||"ellipsoid"===t){var a=e.ellipsoid;if(!n(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=n(s)&&s.isConstant?s.getValue(d.MINIMUM_VALUE):!0,u=a.outline,c=n(u);if(c&&u.isConstant&&(c=u.getValue(d.MINIMUM_VALUE)),!l&&!c)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var h=e.position,p=a.radii,m=a.show;if(n(m)&&m.isConstant&&!m.getValue(d.MINIMUM_VALUE)||!n(h)||!n(p))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=r(a.material,A),_=g instanceof y;this._materialProperty=g,this._fillProperty=r(s,I),this._showProperty=r(m,P),this._showOutlineProperty=r(a.outline,M),this._outlineColorProperty=c?r(a.outlineColor,D):void 0,this._fillEnabled=l,this._outlineEnabled=c;var C=a.stackPartitions,E=a.slicePartitions,S=a.outlineWidth,T=a.subdivisions;if(h.isConstant&&w.isConstant(e.orientation)&&p.isConstant&&w.isConstant(C)&&w.isConstant(E)&&w.isConstant(S)&&w.isConstant(T)){var x=this._options;x.vertexFormat=_?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat,x.radii=p.getValue(d.MINIMUM_VALUE,x.radii),x.stackPartitions=n(C)?C.getValue(d.MINIMUM_VALUE):void 0,x.slicePartitions=n(E)?E.getValue(d.MINIMUM_VALUE):void 0,x.subdivisions=n(T)?T.getValue(d.MINIMUM_VALUE):void 0,this._outlineWidth=n(S)?S.getValue(d.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},x.prototype.createDynamicUpdater=function(e){return new b(e,this)},b.prototype.update=function(e){var o=this._entity,a=o.ellipsoid;if(!o.isShowing||!o.isAvailable(e)||!w.getValueOrDefault(a.show,e,!0))return n(this._primitive)&&(this._primitive.show=!1),void(n(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var s=w.getValueOrUndefined(a.radii,e,R),c=o._getModelMatrix(e,this._modelMatrix);if(!n(c)||!n(s))return n(this._primitive)&&(this._primitive.show=!1),void(n(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1));var d,y=w.getValueOrDefault(a.fill,e,!0),C=w.getValueOrDefault(a.outline,e,!1),E=w.getValueOrClonedDefault(a.outlineColor,e,t.BLACK,O),T=S.getValue(e,r(a.material,A),this._material);this._material=T;var x=w.getValueOrUndefined(a.stackPartitions,e),b=w.getValueOrUndefined(a.slicePartitions,e),P=w.getValueOrUndefined(a.subdivisions,e),I=w.getValueOrDefault(a.outlineWidth,e,1),M=this._scene.mode,D=M===_.SCENE3D,L=this._options,F=!D||this._lastSceneMode!==M||!n(this._primitive)||L.stackPartitions!==x||L.slicePartitions!==b||L.subdivisions!==P||this._lastOutlineWidth!==I;if(F){var B=this._primitives;B.removeAndDestroy(this._primitive),B.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=M,this._lastOutlineWidth=I,L.stackPartitions=x,L.slicePartitions=b,L.subdivisions=P,L.radii=D?N:s,d=new f({material:T,translucent:T.isTranslucent(),closed:!0}),L.vertexFormat=d.vertexFormat,this._primitive=B.add(new g({geometryInstances:new h({id:o,geometry:new l(L),modelMatrix:D?void 0:c,attributes:{show:new m(y)}}),appearance:d,asynchronous:!1})),L.vertexFormat=v.VERTEX_FORMAT,this._outlinePrimitive=B.add(new g({geometryInstances:new h({id:o,geometry:new u(L),modelMatrix:D?void 0:c,attributes:{show:new m(C),color:i.fromColor(E)}}),appearance:new v({flat:!0,translucent:1!==E.alpha,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(I)}}),asynchronous:!1})),this._lastShow=y,this._lastOutlineShow=C,this._lastOutlineColor=t.clone(E,this._lastOutlineColor)}else if(this._primitive.ready){var V=this._primitive,k=this._outlinePrimitive;V.show=!0,k.show=!0,d=V.appearance,d.material=T;var z=this._attributes;n(z)||(z=V.getGeometryInstanceAttributes(o),this._attributes=z),y!==this._lastShow&&(z.show=m.toValue(y,z.show),this._lastShow=y);var U=this._outlineAttributes;n(U)||(U=k.getGeometryInstanceAttributes(o),this._outlineAttributes=U),C!==this._lastOutlineShow&&(U.show=m.toValue(C,U.show),this._lastOutlineShow=C),t.equals(E,this._lastOutlineColor)||(U.color=i.toValue(E,U.color),t.clone(E,this._lastOutlineColor))}D&&(s.x=Math.max(s.x,.001),s.y=Math.max(s.y,.001),s.z=Math.max(s.z,.001),c=p.multiplyByScale(c,s,c),this._primitive.modelMatrix=c,this._outlinePrimitive.modelMatrix=c)},b.prototype.getBoundingSphere=function(e,t){return E(e,this._primitive,this._outlinePrimitive,t)},b.prototype.isDestroyed=function(){return!1},b.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),a(this)},x}),i("DataSources/StaticGeometryColorBatch",["../Core/AssociativeArray","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/Primitive","./BoundingSphereState"],function(e,t,i,r,n,o,a){"use strict";function s(t,i,r,n){this.translucent=i,this.appearanceType=r,this.closed=n,this.primitives=t,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.updaters=new e,this.updatersWithAttributes=new e,this.attributes=new e,this.subscriptions=new e,this.showsUpdated=new e,this.itemsToRemove=[]}function l(e,t,i){this._solidBatch=new s(e,!1,t,i),this._translucentBatch=new s(e,!0,t,i)}var u=new t;return s.prototype.add=function(e,t){var i=e.entity.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener(function(t,i,n,o){"isShowing"===i&&r.showsUpdated.set(t.id,e)}))}else this.updatersWithAttributes.set(i,e)},s.prototype.remove=function(e){var t=e.entity.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);r(i)&&(i(),this.subscriptions.remove(t))}},s.prototype.update=function(e){var a,s,l=!0,c=0,h=this.primitive,d=this.primitives;if(this.createPrimitive){var p=this.geometry.values,m=p.length;if(m>0){for(r(h)&&(r(this.oldPrimitive)?d.remove(h):this.oldPrimitive=h),s=0;m>s;s++){var f=p[s],v=f.attributes;a=this.attributes.get(f.id.id),r(a)&&(r(v.show)&&(v.show.value=a.show),r(v.color)&&(v.color.value=a.color))}h=new o({asynchronous:!0,geometryInstances:p,appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed})}),d.add(h),l=!1}else{r(h)&&(d.remove(h),h=void 0);var g=this.oldPrimitive;r(g)&&(d.remove(g),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=h,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(r(h)&&h.ready){r(this.oldPrimitive)&&(d.remove(this.oldPrimitive),this.oldPrimitive=void 0);var _=this.updatersWithAttributes.values,y=_.length,C=this.waitingOnCreate;for(s=0;y>s;s++){var E=_[s],S=this.geometry.get(E.entity.id);if(a=this.attributes.get(S.id.id),r(a)||(a=h.getGeometryInstanceAttributes(S.id),this.attributes.set(S.id.id,a)),!E.fillMaterialProperty.isConstant||C){var w=E.fillMaterialProperty.color;w.getValue(e,u),t.equals(a._lastColor,u)||(a._lastColor=t.clone(u,a._lastColor),a.color=i.toValue(u,a.color),(this.translucent&&255===a.color[3]||!this.translucent&&255!==a.color[3])&&(this.itemsToRemove[c++]=E))}var T=E.entity.isShowing&&(E.hasConstantFill||E.isFilled(e)),x=1===a.show[0];T!==x&&(a.show=n.toValue(T,a.show))}this.updateShows(h),this.waitingOnCreate=!1}else r(h)&&!h.ready&&(l=!1);return this.itemsToRemove.length=c,l},s.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,o=0;i>o;o++){var a=t[o],s=this.geometry.get(a.entity.id),l=this.attributes.get(s.id.id);r(l)||(l=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,l));var u=a.entity.isShowing,c=1===l.show[0];u!==c&&(l.show=n.toValue(u,l.show))}this.showsUpdated.removeAll()},s.prototype.contains=function(e){return this.updaters.contains(e.id)},s.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return a.PENDING;var n=i.getGeometryInstanceAttributes(e);return!r(n)||!r(n.boundingSphere)||r(n.show)&&0===n.show[0]?a.FAILED:(n.boundingSphere.clone(t),a.DONE)},s.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;r(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;r(i)&&(e.remove(i),this.oldPrimitive=void 0)},l.prototype.add=function(e,t){var i=t.createFillGeometryInstance(e);255===i.attributes.color.value[3]?this._solidBatch.add(t,i):this._translucentBatch.add(t,i)},l.prototype.remove=function(e){this._solidBatch.remove(e)||this._translucentBatch.remove(e)},l.prototype.update=function(e){var t,i,r=this._solidBatch.update(e);r=this._translucentBatch.update(e)&&r;var n=this._solidBatch.itemsToRemove,o=n.length;if(o>0)for(t=0;o>t;t++)i=n[t],this._solidBatch.remove(i),this._translucentBatch.add(i,i.createFillGeometryInstance(e));n=this._translucentBatch.itemsToRemove;var a=n.length;if(a>0)for(t=0;a>t;t++)i=n[t],this._translucentBatch.remove(i),this._solidBatch.add(i,i.createFillGeometryInstance(e));return(o>0||a>0)&&(r=this._solidBatch.update(e)&&r,r=this._translucentBatch.update(e)&&r),r},l.prototype.getBoundingSphere=function(e,t){return this._solidBatch.contains(e)?this._solidBatch.getBoundingSphere(e,t):this._translucentBatch.contains(e)?this._translucentBatch.getBoundingSphere(e,t):a.FAILED},l.prototype.removeAllPrimitives=function(){this._solidBatch.removeAllPrimitives(),this._translucentBatch.removeAllPrimitives()},l}),i("DataSources/StaticGeometryPerMaterialBatch",["../Core/AssociativeArray","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/Primitive","./BoundingSphereState","./MaterialProperty"],function(e,t,i,r,n,o){"use strict";function a(t,i,r,n){this.primitives=t,this.appearanceType=i,this.materialProperty=r,this.closed=n,this.updaters=new e,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.material=void 0,this.updatersWithAttributes=new e,this.attributes=new e,this.invalidated=!1,this.removeMaterialSubscription=r.definitionChanged.addEventListener(a.prototype.onMaterialChanged,this),this.subscriptions=new e,this.showsUpdated=new e}function s(e,t,i){this._items=[],this._primitives=e,this._appearanceType=t,this._closed=i}return a.prototype.onMaterialChanged=function(){this.invalidated=!0},a.prototype.isMaterial=function(e){var i=this.materialProperty,r=e.fillMaterialProperty;return r===i?!0:t(i)?i.equals(r):!1},a.prototype.add=function(e,t){var i=t.entity.id;if(this.updaters.set(i,t),this.geometry.set(i,t.createFillGeometryInstance(e)),t.hasConstantFill&&t.fillMaterialProperty.isConstant){var r=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(e,i,n,o){"isShowing"===i&&r.showsUpdated.set(e.id,t)}))}else this.updatersWithAttributes.set(i,t);this.createPrimitive=!0},a.prototype.remove=function(e){var i=e.entity.id,r=this.updaters.remove(i);if(r){this.geometry.remove(i),this.updatersWithAttributes.remove(i);var n=this.subscriptions.get(i);t(n)&&(n(),this.subscriptions.remove(i))}return this.createPrimitive=r,r},a.prototype.update=function(e){var n,a,s=!0,l=this.primitive,u=this.primitives,c=this.geometry.values;if(this.createPrimitive){var h=c.length;if(h>0){for(t(l)&&(t(this.oldPrimitive)?u.remove(l):this.oldPrimitive=l),a=0;h>a;a++){var d=c[a],p=d.attributes;n=this.attributes.get(d.id.id),t(n)&&(t(p.show)&&(p.show.value=n.show),t(p.color)&&(p.color.value=n.color))}this.material=o.getValue(e,this.materialProperty,this.material),l=new r({asynchronous:!0,geometryInstances:c,appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed})}),u.add(l),s=!1}else{t(l)&&(u.remove(l),l=void 0);var m=this.oldPrimitive;t(m)&&(u.remove(m),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=l,this.createPrimitive=!1}else if(t(l)&&l.ready){t(this.oldPrimitive)&&(u.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=o.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;var f=this.updatersWithAttributes.values,v=f.length;for(a=0;v>a;a++){var g=f[a],_=g.entity,y=this.geometry.get(_.id);n=this.attributes.get(y.id.id),t(n)||(n=l.getGeometryInstanceAttributes(y.id),this.attributes.set(y.id.id,n));var C=_.isShowing&&(g.hasConstantFill||g.isFilled(e)),E=1===n.show[0];C!==E&&(n.show=i.toValue(C,n.show))}this.updateShows(l)}else t(l)&&!l.ready&&(s=!1);return s},a.prototype.updateShows=function(e){for(var r=this.showsUpdated.values,n=r.length,o=0;n>o;o++){var a=r[o],s=a.entity,l=this.geometry.get(s.id),u=this.attributes.get(l.id.id);t(u)||(u=e.getGeometryInstanceAttributes(l.id),this.attributes.set(l.id.id,u));var c=s.isShowing,h=1===u.show[0];c!==h&&(u.show=i.toValue(c,u.show))}this.showsUpdated.removeAll()},a.prototype.contains=function(e){return this.updaters.contains(e.id)},a.prototype.getBoundingSphere=function(e,i){var r=this.primitive;if(!r.ready)return n.PENDING;var o=r.getGeometryInstanceAttributes(e);return!t(o)||!t(o.boundingSphere)||t(o.show)&&0===o.show[0]?n.FAILED:(o.boundingSphere.clone(i),n.DONE)},a.prototype.destroy=function(e){var i=this.primitive,r=this.primitives;t(i)&&r.remove(i);var n=this.oldPrimitive;t(n)&&r.remove(n),this.removeMaterialSubscription()},s.prototype.add=function(e,t){for(var i=this._items,r=i.length,n=0;r>n;n++){var o=i[n];if(o.isMaterial(t))return void o.add(e,t)}var s=new a(this._primitives,this._appearanceType,t.fillMaterialProperty,this._closed);s.add(e,t),i.push(s)},s.prototype.remove=function(e){for(var t=this._items,i=t.length,r=i-1;r>=0;r--){var n=t[r];if(n.remove(e)){0===n.updaters.length&&(t.splice(r,1),n.destroy());break}}},s.prototype.update=function(e){var t,i=this._items,r=i.length;for(t=r-1;t>=0;t--){var n=i[t];if(n.invalidated){i.splice(t,1);for(var o=n.updaters.values,a=o.length,s=0;a>s;s++)this.add(e,o[s]);n.destroy()}}var l=!0;for(t=0;r>t;t++)l=i[t].update(e)&&l;return l},s.prototype.getBoundingSphere=function(e,t){for(var i=this._items,r=i.length,o=0;r>o;o++){var a=i[o];if(a.contains(e))return a.getBoundingSphere(e,t)}return n.FAILED},s.prototype.removeAllPrimitives=function(){for(var e=this._items,t=e.length,i=0;t>i;i++)e[i].destroy();this._items.length=0},s}),i("DataSources/StaticOutlineGeometryBatch",["../Core/AssociativeArray","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defined","../Core/ShowGeometryInstanceAttribute","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./BoundingSphereState"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,i,r){this.translucent=i,this.primitives=t,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new e,this.updaters=new e,this.updatersWithAttributes=new e,this.attributes=new e,this.itemsToRemove=[],this.width=r,this.subscriptions=new e,this.showsUpdated=new e}function u(t,i){this._primitives=t,this._scene=i,this._solidBatches=new e,this._translucentBatches=new e}l.prototype.add=function(e,t){var i=e.entity.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantOutline&&e.outlineColorProperty.isConstant){var r=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener(function(t,i,n,o){"isShowing"===i&&r.showsUpdated.set(t.id,e)}))}else this.updatersWithAttributes.set(i,e)},l.prototype.remove=function(e){var t=e.entity.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);r(i)&&(i(),this.subscriptions.remove(t))}};var c=new t;return l.prototype.update=function(e){var s,l,u=!0,h=0,d=this.primitive,p=this.primitives;if(this.createPrimitive){var m=this.geometry.values,f=m.length;if(f>0){for(r(d)&&(r(this.oldPrimitive)?p.remove(d):this.oldPrimitive=d),l=0;f>l;l++){var v=m[l],g=v.attributes;s=this.attributes.get(v.id.id),r(s)&&(r(g.show)&&(g.show.value=s.show),r(g.color)&&(g.color.value=s.color))}d=new a({asynchronous:!0,geometryInstances:m,appearance:new o({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}})}),p.add(d),u=!1}else{r(d)&&(p.remove(d),d=void 0);var _=this.oldPrimitive;r(_)&&(p.remove(_),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=d,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(r(d)&&d.ready){r(this.oldPrimitive)&&(p.remove(this.oldPrimitive),this.oldPrimitive=void 0);var y=this.updatersWithAttributes.values,C=y.length,E=this.waitingOnCreate;for(l=0;C>l;l++){var S=y[l],w=this.geometry.get(S.entity.id);if(s=this.attributes.get(w.id.id),r(s)||(s=d.getGeometryInstanceAttributes(w.id),this.attributes.set(w.id.id,s)),!S.outlineColorProperty.isConstant||E){var T=S.outlineColorProperty;T.getValue(e,c),t.equals(s._lastColor,c)||(s._lastColor=t.clone(c,s._lastColor),s.color=i.toValue(c,s.color),(this.translucent&&255===s.color[3]||!this.translucent&&255!==s.color[3])&&(this.itemsToRemove[h++]=S))}var x=S.entity.isShowing&&(S.hasConstantOutline||S.isOutlineVisible(e)),b=1===s.show[0];x!==b&&(s.show=n.toValue(x,s.show))}this.updateShows(d),this.waitingOnCreate=!1}else r(d)&&!d.ready&&(u=!1);return this.itemsToRemove.length=h,u},l.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,o=0;i>o;o++){var a=t[o],s=this.geometry.get(a.entity.id),l=this.attributes.get(s.id.id);r(l)||(l=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,l));var u=a.entity.isShowing,c=1===l.show[0];u!==c&&(l.show=n.toValue(u,l.show))}this.showsUpdated.removeAll()},l.prototype.contains=function(e){return this.updaters.contains(e.id)},l.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return s.PENDING;var n=i.getGeometryInstanceAttributes(e);return!r(n)||!r(n.boundingSphere)||r(n.show)&&0===n.show[0]?s.FAILED:(n.boundingSphere.clone(t),s.DONE)},l.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;r(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;r(i)&&(e.remove(i),this.oldPrimitive=void 0)},u.prototype.add=function(e,t){var i,n,o=t.createOutlineGeometryInstance(e),a=this._scene.clampLineWidth(t.outlineWidth);255===o.attributes.color.value[3]?(i=this._solidBatches,n=i.get(a),r(n)||(n=new l(this._primitives,!1,a),i.set(a,n)),n.add(t,o)):(i=this._translucentBatches,n=i.get(a),r(n)||(n=new l(this._primitives,!0,a),i.set(a,n)),n.add(t,o))},u.prototype.remove=function(e){var t,i=this._solidBatches.values,r=i.length;for(t=0;r>t;t++)if(i[t].remove(e))return;var n=this._translucentBatches.values,o=n.length;for(t=0;o>t;t++)if(n[t].remove(e))return},u.prototype.update=function(e){var t,i,r,n,o,a=this._solidBatches.values,s=a.length,l=this._translucentBatches.values,u=l.length,c=!0,h=!1;do{for(h=!1,i=0;s>i;i++){n=a[i],c=n.update(e),o=n.itemsToRemove;var d=o.length;if(d>0)for(h=!0,t=0;d>t;t++)r=o[t],n.remove(r),this.add(e,r)}for(i=0;u>i;i++){n=l[i],c=n.update(e),o=n.itemsToRemove;var p=o.length;if(p>0)for(h=!0,t=0;p>t;t++)r=o[t],n.remove(r),this.add(e,r)}}while(h);return c},u.prototype.getBoundingSphere=function(e,t){var i,r=this._solidBatches.values,n=r.length;for(i=0;n>i;i++){var o=r[i];if(o.contains(e))return o.getBoundingSphere(e,t)}var a=this._translucentBatches.values,l=a.length;for(i=0;l>i;i++){var u=a[i];if(u.contains(e))return u.getBoundingSphere(e,t)}return s.FAILED},u.prototype.removeAllPrimitives=function(){var e,t=this._solidBatches.values,i=t.length;for(e=0;i>e;e++)t[e].removeAllPrimitives();var r=this._translucentBatches.values,n=r.length;for(e=0;n>e;e++)r[e].removeAllPrimitives()},u}),i("DataSources/GeometryVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","./BoundingSphereState","./ColorMaterialProperty","./StaticGeometryColorBatch","./StaticGeometryPerMaterialBatch","./StaticOutlineGeometryBatch"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t){this._primitives=t,this._dynamicUpdaters=new e}function h(e,t){for(var i=e._batches,r=i.length,n=0;r>n;n++)i[n].remove(t)}function d(e,t,i){return i.isDynamic?void e._dynamicBatch.add(t,i):(i.outlineEnabled&&e._outlineBatch.add(t,i),void(i.fillEnabled&&(i.isClosed?i.fillMaterialProperty instanceof a?e._closedColorBatch.add(t,i):e._closedMaterialBatch.add(t,i):i.fillMaterialProperty instanceof a?e._openColorBatch.add(t,i):e._openMaterialBatch.add(t,i))))}function p(t,i,r){this._type=t;var n=i.primitives;this._scene=i,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new e,this._removedObjects=new e,this._changedObjects=new e,this._outlineBatch=new u(n,i),this._closedColorBatch=new s(n,t.perInstanceColorAppearanceType,!0),this._closedMaterialBatch=new l(n,t.materialAppearanceType,!0),this._openColorBatch=new s(n,t.perInstanceColorAppearanceType,!1),this._openMaterialBatch=new l(n,t.materialAppearanceType,!1),this._dynamicBatch=new c(n),this._batches=[this._closedColorBatch,this._closedMaterialBatch,this._openColorBatch,this._openMaterialBatch,this._dynamicBatch,this._outlineBatch],this._subscriptions=new e,this._updaters=new e,this._entityCollection=r,r.collectionChanged.addEventListener(p.prototype._onCollectionChanged,this),this._onCollectionChanged(r,r.values,m)}var m=[];c.prototype.add=function(e,t){this._dynamicUpdaters.set(t.entity.id,t.createDynamicUpdater(this._primitives))},c.prototype.remove=function(e){ var t=e.entity.id,r=this._dynamicUpdaters.get(t);i(r)&&(this._dynamicUpdaters.remove(t),r.destroy())},c.prototype.update=function(e){for(var t=this._dynamicUpdaters.values,i=0,r=t.length;r>i;i++)t[i].update(e);return!0},c.prototype.removeAllPrimitives=function(){for(var e=this._dynamicUpdaters.values,t=0,i=e.length;i>t;t++)e[t].destroy();this._dynamicUpdaters.removeAll()},c.prototype.getBoundingSphere=function(e,t){var r=this._dynamicUpdaters.get(e.id);return i(r)&&i(r.getBoundingSphere)?r.getBoundingSphere(e,t):o.FAILED},p.prototype.update=function(e){var t,i,r,n,o=this._addedObjects,a=o.values,s=this._removedObjects,l=s.values,u=this._changedObjects,c=u.values;for(t=c.length-1;t>-1;t--)i=c[t],r=i.id,n=this._updaters.get(r),n.entity===i?(h(this,n),d(this,e,n)):(l.push(i),a.push(i));for(t=l.length-1;t>-1;t--)i=l[t],r=i.id,n=this._updaters.get(r),h(this,n),n.destroy(),this._updaters.remove(r),this._subscriptions.get(r)(),this._subscriptions.remove(r);for(t=a.length-1;t>-1;t--)i=a[t],r=i.id,n=new this._type(i,this._scene),this._updaters.set(r,n),d(this,e,n),this._subscriptions.set(r,n.geometryChanged.addEventListener(p._onGeometryChanged,this));o.removeAll(),s.removeAll(),u.removeAll();var m=!0,f=this._batches,v=f.length;for(t=0;v>t;t++)m=f[t].update(e)&&m;return m};var f=[],v=new t;return p.prototype.getBoundingSphere=function(e,i){for(var r=f,n=v,a=0,s=o.DONE,l=this._batches,u=l.length,c=0;u>c;c++){if(s=l[c].getBoundingSphere(e,n),s===o.PENDING)return o.PENDING;s===o.DONE&&(r[a]=t.clone(n,r[a]),a++)}return 0===a?o.FAILED:(r.length=a,t.fromBoundingSpheres(r,i),o.DONE)},p.prototype.isDestroyed=function(){return!1},p.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(p.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();var e,t=this._batches,i=t.length;for(e=0;i>e;e++)t[e].removeAllPrimitives();var n=this._subscriptions.values;for(i=n.length,e=0;i>e;e++)n[e]();return this._subscriptions.removeAll(),r(this)},p._onGeometryChanged=function(e){var t=this._removedObjects,r=this._changedObjects,n=e.entity,o=n.id;i(t.get(o))||i(r.get(o))||r.set(o,n)},p.prototype._onCollectionChanged=function(e,t,i){var r,n,o,a=this._addedObjects,s=this._removedObjects,l=this._changedObjects;for(r=i.length-1;r>-1;r--)o=i[r],n=o.id,a.remove(n)||(s.set(n,o),l.remove(n));for(r=t.length-1;r>-1;r--)o=t[r],n=o.id,s.remove(n)?l.set(n,o):a.set(n,o)},p}),i("Scene/Label",["../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/NearFarScalar","./Billboard","./HeightReference","./HorizontalOrigin","./LabelStyle","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d){"use strict";function p(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function m(e){e._rebindAllGlyphs||e._repositionAllGlyphs||e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function f(n,o){n=r(n,r.EMPTY_OBJECT),this._text=r(n.text,""),this._show=r(n.show,!0),this._font=r(n.font,"30px sans-serif"),this._fillColor=i.clone(r(n.fillColor,i.WHITE)),this._outlineColor=i.clone(r(n.outlineColor,i.BLACK)),this._outlineWidth=r(n.outlineWidth,1),this._style=r(n.style,h.FILL),this._verticalOrigin=r(n.verticalOrigin,d.BOTTOM),this._horizontalOrigin=r(n.horizontalOrigin,c.LEFT),this._pixelOffset=e.clone(r(n.pixelOffset,e.ZERO)),this._eyeOffset=t.clone(r(n.eyeOffset,t.ZERO)),this._position=t.clone(r(n.position,t.ZERO)),this._scale=r(n.scale,1),this._id=n.id,this._translucencyByDistance=n.translucencyByDistance,this._pixelOffsetScaleByDistance=n.pixelOffsetScaleByDistance,this._heightReference=r(n.heightReference,u.NONE),this._labelCollection=o,this._glyphs=[],this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._updateClamping()}return o(f.prototype,{show:{get:function(){return this._show},set:function(e){if(this._show!==e){this._show=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.show=e)}}}},position:{get:function(){return this._position},set:function(e){var i=this._position;if(!t.equals(i,e))if(t.clone(e,i),this._heightReference===u.NONE)for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.position=e)}else this._updateClamping()}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightReference=e,this._updateClamping())}},text:{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,p(this))}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,p(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){var t=this._fillColor;i.equals(t,e)||(i.clone(e,t),p(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;i.equals(t,e)||(i.clone(e,t),p(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,p(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(t){var i=this._pixelOffset;if(!e.equals(i,t)){e.clone(t,i);for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.pixelOffset=t)}}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;if(!s.equals(t,e)){this._translucencyByDistance=s.clone(e,t);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.translucencyByDistance=e)}}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){var t=this._pixelOffsetScaleByDistance;if(!s.equals(t,e)){this._pixelOffsetScaleByDistance=s.clone(e,t);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.pixelOffsetScaleByDistance=e)}}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){var i=this._eyeOffset;if(!t.equals(i,e)){t.clone(e,i);for(var r=this._glyphs,o=0,a=r.length;a>o;o++){var s=r[o];n(s.billboard)&&(s.billboard.eyeOffset=e)}}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,m(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(this._verticalOrigin!==e){this._verticalOrigin=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.verticalOrigin=e)}m(this)}}},scale:{get:function(){return this._scale},set:function(e){if(this._scale!==e){this._scale=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.scale=e)}m(this)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;for(var t=this._glyphs,i=0,r=t.length;r>i;i++){var o=t[i];n(o.billboard)&&(o.billboard.id=e)}}}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=t.clone(e,this._actualClampedPosition);for(var i=this._glyphs,r=0,o=i.length;o>r;r++){var a=i[r];n(a.billboard)&&(a.billboard.position=e)}}}}),f.prototype._updateClamping=function(){l._updateClamping(this._labelCollection,this)},f.prototype.computeScreenSpacePosition=function(t,i){n(i)||(i=new e);var r=this._labelCollection,o=r.modelMatrix,a=l._computeActualPosition(this,this._position,t.frameState,o),s=l._computeScreenSpacePosition(o,a,this._eyeOffset,this._pixelOffset,t,i);return s.y=t.canvas.clientHeight-s.y,s},f.prototype.equals=function(r){return this===r||n(r)&&this._show===r._show&&this._scale===r._scale&&this._style===r._style&&this._verticalOrigin===r._verticalOrigin&&this._horizontalOrigin===r._horizontalOrigin&&this._text===r._text&&this._font===r._font&&t.equals(this._position,r._position)&&i.equals(this._fillColor,r._fillColor)&&i.equals(this._outlineColor,r._outlineColor)&&e.equals(this._pixelOffset,r._pixelOffset)&&t.equals(this._eyeOffset,r._eyeOffset)&&s.equals(this._translucencyByDistance,r._translucencyByDistance)&&s.equals(this._pixelOffsetScaleByDistance,r._pixelOffsetScaleByDistance)&&this._id===r._id},f.prototype.isDestroyed=function(){return!1},f}),i("Scene/LabelCollection",["../Core/Cartesian2","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/writeTextToCanvas","./BillboardCollection","./HorizontalOrigin","./Label","./LabelStyle","./TextureAtlas","./VerticalOrigin"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function f(e,t,i){this.labelCollection=e,this.index=t,this.dimensions=i}function v(e,t,i,r,n,o,a){return w.font=t,w.fillColor=i,w.strokeColor=r,w.strokeWidth=n,a===p.BOTTOM?w.textBaseline="bottom":a===p.TOP?w.textBaseline="top":w.textBaseline="middle",w.fill=o===h.FILL||o===h.FILL_AND_OUTLINE,w.stroke=o===h.OUTLINE||o===h.FILL_AND_OUTLINE,s(e,w)}function g(e,t){t.textureInfo=void 0,t.dimensions=void 0;var r=t.billboard;i(r)&&(r.show=!1,r.image=void 0,e._spareBillboards.push(r),t.billboard=void 0)}function _(e,t,i,r){e.addImage(t,i).then(function(e,t){r.index=e})}function y(e,t){var r,n,o,a=t._text,s=a.length,l=t._glyphs,c=l.length;if(c>s)for(n=s;c>n;++n)g(e,l[n]);l.length=s;var h=e._glyphTextureCache;for(o=0;s>o;++o){var d=a.charAt(o),p=t._font,y=t._fillColor,C=t._outlineColor,E=t._outlineWidth,S=t._style,w=t._verticalOrigin,T=JSON.stringify([d,p,y.toRgba(),C.toRgba(),E,+S,+w]),x=h[T];if(!i(x)){var b=v(d,p,y,C,E,S,w);x=new f(e,-1,b.dimensions),h[T]=x,b.width>0&&b.height>0&&_(e._textureAtlas,T,b,x)}if(r=l[o],i(r)?-1===x.index?g(e,r):i(r.textureInfo)&&(r.textureInfo=void 0):(r=new m,l[o]=r),r.textureInfo=x,r.dimensions=x.dimensions,-1!==x.index){var A=r.billboard;i(A)||(A=e._spareBillboards.length>0?e._spareBillboards.pop():e._billboardCollection.add({collection:e}),r.billboard=A),A.show=t._show,A.position=t._position,A.eyeOffset=t._eyeOffset,A.pixelOffset=t._pixelOffset,A.horizontalOrigin=u.LEFT,A.verticalOrigin=t._verticalOrigin,A.scale=t._scale,A.pickPrimitive=t,A.id=t._id,A.image=T,A.translucencyByDistance=t._translucencyByDistance,A.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance}}t._repositionAllGlyphs=!0}function C(e,t){var r,n,o=e._glyphs,a=0,s=0,l=0,c=o.length;for(l=0;c>l;++l)r=o[l],n=r.dimensions,a+=n.computedWidth,s=Math.max(s,n.height);var h=e._scale,d=e._horizontalOrigin,m=0;d===u.CENTER?m-=a/2*h:d===u.RIGHT&&(m-=a*h),T.x=m*t,T.y=0;var f=e._verticalOrigin;for(l=0;c>l;++l)r=o[l],n=r.dimensions,f===p.BOTTOM||n.height===s?T.y=-n.descent*h:f===p.TOP?T.y=-(s-n.height)*h-n.descent*h:f===p.CENTER&&(T.y=-(s-n.height)/2*h-n.descent*h),T.y*=t,i(r.billboard)&&r.billboard._setTranslate(T),T.x+=n.computedWidth*h*t}function E(e,t){for(var r=t._glyphs,o=0,a=r.length;a>o;++o)g(e,r[o]);t._labelCollection=void 0,i(t._removeCallbackFunc)&&t._removeCallbackFunc(),n(t)}function S(e){e=t(e,t.EMPTY_OBJECT),this._scene=e.scene,this._textureAtlas=void 0,this._billboardCollection=new l({scene:this._scene}),this._billboardCollection.destroyTextureAtlas=!1,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._resolutionScale=void 0,this.modelMatrix=a.clone(t(e.modelMatrix,a.IDENTITY)),this.debugShowBoundingVolume=t(e.debugShowBoundingVolume,!1)}var w={},T=new e;return r(S.prototype,{length:{get:function(){return this._labels.length}}}),S.prototype.add=function(e){var t=new c(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t},S.prototype.remove=function(e){if(i(e)&&e._labelCollection===this){var t=this._labels.indexOf(e);if(-1!==t)return this._labels.splice(t,1),E(this,e),!0}return!1},S.prototype.removeAll=function(){for(var e=this._labels,t=0,i=e.length;i>t;++t)E(this,e[t]);e.length=0},S.prototype.contains=function(e){return i(e)&&e._labelCollection===this},S.prototype.get=function(e){return this._labels[e]},S.prototype.update=function(e){var t=this._billboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume;var r=e.context;i(this._textureAtlas)||(this._textureAtlas=new d({context:r}),t.textureAtlas=this._textureAtlas);var n=r.uniformState,o=n.resolutionScale,a=this._resolutionScale!==o;this._resolutionScale=o;var s;s=a?this._labels:this._labelsToUpdate;for(var l=s.length,u=0;l>u;++u){var c=s[u];if(!c.isDestroyed()){var h=c._glyphs.length;c._rebindAllGlyphs&&(y(this,c),c._rebindAllGlyphs=!1),(a||c._repositionAllGlyphs)&&(C(c,o),c._repositionAllGlyphs=!1);var p=c._glyphs.length-h;this._totalGlyphCount+=p}}this._labelsToUpdate.length=0,t.update(e)},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),n(this)},S}),i("DataSources/LabelVisualizer",["../Core/AssociativeArray","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/HorizontalOrigin","../Scene/LabelCollection","../Scene/LabelStyle","../Scene/VerticalOrigin","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e){this.entity=e,this.label=void 0,this.index=void 0}function f(t,i){i.collectionChanged.addEventListener(f.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._labelCollection=void 0,this._entityCollection=i,this._items=new e,this._onCollectionChanged(i,i.values,[],[])}function v(e,t){if(n(e)){var i=e.label;n(i)&&(t.push(e.index),i.show=!1,e.label=void 0,e.index=-1)}}var g=1,_="30px sans-serif",y=c.FILL,C=r.WHITE,E=r.BLACK,S=1,w=t.ZERO,T=i.ZERO,x=l.CENTER,b=h.CENTER,A=new i,P=new r,I=new r,M=new i,D=new t,R=new s,O=new s;return f.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,r=0,o=t.length;o>r;r++){var a,s=t[r],l=s.entity,c=l._label,h=s.label,d=l.isShowing&&l.isAvailable(e)&&p.getValueOrDefault(c._show,e,!0);if(d&&(A=p.getValueOrUndefined(l._position,e,A),a=p.getValueOrUndefined(c._text,e),d=n(A)&&n(a)),d){if(!n(h)){var m=this._labelCollection;n(m)||(m=new u,this._labelCollection=m,this._scene.primitives.add(m));var f=i.length;if(f>0){var N=i.pop();s.index=N,h=m.get(N)}else h=m.add(),s.index=m.length-1;h.id=l,s.label=h}h.show=!0,h.position=A,h.text=a,h.scale=p.getValueOrDefault(c._scale,e,g),h.font=p.getValueOrDefault(c._font,e,_),h.style=p.getValueOrDefault(c._style,e,y),h.fillColor=p.getValueOrDefault(c._fillColor,e,C,P),h.outlineColor=p.getValueOrDefault(c._outlineColor,e,E,I),h.outlineWidth=p.getValueOrDefault(c._outlineWidth,e,S),h.pixelOffset=p.getValueOrDefault(c._pixelOffset,e,w,D),h.eyeOffset=p.getValueOrDefault(c._eyeOffset,e,T,M),h.horizontalOrigin=p.getValueOrDefault(c._horizontalOrigin,e,x),h.verticalOrigin=p.getValueOrDefault(c._verticalOrigin,e,b),h.translucencyByDistance=p.getValueOrUndefined(c._translucencyByDistance,e,R),h.pixelOffsetScaleByDistance=p.getValueOrUndefined(c._pixelOffsetScaleByDistance,e,O)}else v(s,i)}return!0},f.prototype.getBoundingSphere=function(e,t){var r=this._items.get(e.id);return n(r)&&n(r.label)?(t.center=i.clone(r.label.position,t.center),t.radius=0,d.DONE):d.FAILED},f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(f.prototype._onCollectionChanged,this),n(this._labelCollection)&&this._scene.primitives.remove(this._labelCollection),o(this)},f.prototype._onCollectionChanged=function(e,t,i,r){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],n(a._label)&&n(a._position)&&l.set(a.id,new m(a));for(o=r.length-1;o>-1;o--)a=r[o],n(a._label)&&n(a._position)?l.contains(a.id)||l.set(a.id,new m(a)):(v(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],v(l.get(a.id),s),l.remove(a.id)},f}),i("ThirdParty/gltfDefaults",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/Quaternion","../Renderer/WebGLConstants"],function(e,t,i,r,n){"use strict";function o(e){i(e.accessors)||(e.accessors={});var r=e.accessors;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.byteStride=t(o.byteStride,0)}}function a(e){i(e.animations)||(e.animations={});var r=e.animations;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];i(o.channels)||(o.channels=[]),i(o.parameters)||(o.parameters={}),i(o.samplers)||(o.samplers={});var a=r.samplers;for(var s in a)if(a.hasOwnProperty(s)){var l=a[s];l.interpolation=t(l.interpolation,"LINEAR")}}}function s(e){i(e.asset)||(e.asset={});var r=e.asset;i(r.profile)&&"string"!=typeof r.profile||(r.profile={});var n=r.profile;r.premultipliedAlpha=t(r.premultipliedAlpha,!1),n.api=t(n.api,"WebGL"),n.version=t(n.version,"1.0.2"),i(e.version)&&(r.version=t(r.version,e.version),delete e.version),"number"==typeof r.version&&(r.version=r.version.toFixed(1).toString())}function l(e){i(e.buffers)||(e.buffers={});var r=e.buffers;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];o.type=t(o.type,"arraybuffer")}}function u(e){i(e.bufferViews)||(e.bufferViews={})}function c(e){i(e.cameras)||(e.cameras={})}function h(e){i(e.images)||(e.images={})}function d(e){i(e.extensions)||(e.extensions={});var r=e.extensions;i(r.KHR_materials_common)||(r.KHR_materials_common={});var n=r.KHR_materials_common;i(e.lights)?(n.lights=e.lights,delete e.lights):i(n.lights)||(n.lights={});var o=n.lights;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];if("ambient"===s.type){i(s.ambient)||(s.ambient={});var l=s.ambient;i(l.color)||(l.color=[1,1,1])}else if("directional"===s.type){i(s.directional)||(s.directional={});var u=s.directional;i(u.color)||(u.color=[1,1,1])}else if("point"===s.type){i(s.point)||(s.point={});var c=s.point;i(c.color)||(c.color=[1,1,1]),c.constantAttenuation=t(c.constantAttenuation,1),c.linearAttenuation=t(c.linearAttenuation,0),c.quadraticAttenuation=t(c.quadraticAttenuation,0)}else if("spot"===s.type){i(s.spot)||(s.spot={});var h=s.spot;i(h.color)||(h.color=[1,1,1]),h.constantAttenuation=t(h.constantAttenuation,1),h.fallOffAngle=t(h.fallOffAngle,3.14159265),h.fallOffExponent=t(h.fallOffExponent,0),h.linearAttenuation=t(h.linearAttenuation,0),h.quadraticAttenuation=t(h.quadraticAttenuation,0)}}}function p(e){i(e.materials)||(e.materials={});var t=e.materials;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r],a=o.instanceTechnique;if(i(a)&&(o.technique=a.technique,o.values=a.values,delete o.instanceTechnique),!i(o.extensions))if(i(o.technique))i(o.values)||(o.values={});else{delete o.values,o.extensions={KHR_materials_common:{technique:"CONSTANT",transparent:!1,values:{emission:{type:n.FLOAT_VEC4,value:[.5,.5,.5,1]}}}},i(e.extensionsUsed)||(e.extensionsUsed=[]);var s=e.extensionsUsed;-1===s.indexOf("KHR_materials_common")&&s.push("KHR_materials_common")}}}function m(e){i(e.meshes)||(e.meshes={});var r=e.meshes;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];i(a.primitives)||(a.primitives=[]);for(var s=a.primitives.length,l=s.length,u=0;l>u;++u){var c=s[u];i(c.attributes)||(c.attributes={});var h=t(c.primitive,n.TRIANGLES);c.mode=t(c.mode,h)}}}function f(t){i(t.nodes)||(t.nodes={});var n=t.nodes,o=parseFloat(t.asset.version)<1,a=new e,s=new r;for(var l in n)if(n.hasOwnProperty(l)){var u=n[l];if(i(u.children)||(u.children=[]),o&&i(u.rotation)){var c=u.rotation;e.fromArray(c,0,a),r.fromAxisAngle(a,c[3],s),u.rotation=[s.x,s.y,s.z,s.w]}i(u.matrix)||(i(u.translation)||i(u.rotation)||i(u.scale)?(i(u.translation)||(u.translation=[0,0,0]),i(u.rotation)||(u.rotation=[0,0,0,1]),i(u.scale)||(u.scale=[1,1,1])):u.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);var h=u.instanceSkin;i(h)&&(u.skeletons=h.skeletons,u.skin=h.skin,u.meshes=h.meshes,delete u.instanceSkin)}}function v(e){i(e.programs)||(e.programs={});var t=e.programs;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];i(n.attributes)||(n.attributes=[])}}function g(e){i(e.samplers)||(e.samplers={});var r=e.samplers;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];a.magFilter=t(a.magFilter,n.LINEAR),a.minFilter=t(a.minFilter,n.NEAREST_MIPMAP_LINEAR),a.wrapS=t(a.wrapS,n.REPEAT),a.wrapT=t(a.wrapT,n.REPEAT)}}function _(e){i(e.scenes)||(e.scenes={});var t=e.scenes;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];i(n.node)||(n.node=[])}}function y(e){i(e.shaders)||(e.shaders={})}function C(e){i(e.skins)||(e.skins={});var t=e.skins;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];i(n.bindShapeMatrix)&&(n.bindShapeMatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}}function E(e){i(e.enable)||(e.enable=[]),i(e.disable)||(e.disable=[])}function S(e){i(e.techniques)||(e.techniques={});var r=e.techniques;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];i(o.parameters)||(o.parameters={});var a=o.parameters;for(var s in a){var l=a[s];l.node=t(l.node,l.source),l.source=void 0}var u=o.passes;if(i(u)){var c=t(o.pass,"defaultPass");if(u.hasOwnProperty(c)){var h=u[c],d=h.instanceProgram;o.attributes=t(o.attributes,d.attributes),o.program=t(o.program,d.program),o.uniforms=t(o.uniforms,d.uniforms),o.states=t(o.states,h.states)}o.passes=void 0,o.pass=void 0}i(o.attributes)||(o.attributes={}),i(o.uniforms)||(o.uniforms={}),i(o.states)||(o.states={}),E(o.states)}}function w(e){i(e.textures)||(e.textures={});var r=e.textures;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];a.format=t(a.format,n.RGBA),a.internalFormat=t(a.internalFormat,a.format),a.target=t(a.target,n.TEXTURE_2D),a.type=t(a.type,n.UNSIGNED_BYTE)}}var T=function(e){return i(e)?(i(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,e.allExtensions=void 0),e.extensionsUsed=t(e.extensionsUsed,[]),o(e),a(e),s(e),l(e),u(e),c(e),h(e),d(e),p(e),m(e),f(e),v(e),g(e),_(e),y(e),C(e),S(e),w(e),e):void 0};return T}),i("Scene/getModelAccessor",["../Core/ComponentDatatype"],function(e){"use strict";function t(t){var r=t.componentType,n=i[t.type];return{componentsPerAttribute:n,createArrayBufferView:function(t,i,o){return e.createArrayBufferView(r,t,i,n*o)}}}var i={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};return t}),i("Scene/ModelAnimationCache",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/LinearSpline","../Core/Matrix4","../Core/Quaternion","../Core/QuaternionSpline","../Renderer/WebGLConstants","./getModelAccessor"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(){}function c(e,i){var r=e.gltf,n=r.buffers,o=r.bufferViews,a=o[i.bufferView],s=n[a.buffer],u=a.byteOffset+i.byteOffset,c=i.count*l(i).componentsPerAttribute;return e.cacheKey+"//"+t(s.path,"")+"/"+u+"/"+c}function h(e,t,i){return e.cacheKey+"//"+t+"/"+i}function d(e){this._value=e}var p={},m=new e;u.getAnimationParameterValues=function(t,r){var n=c(t,r),a=p[n];if(!i(a)){var u,h=t._loadResources,d=t.gltf,f=parseFloat(d.asset.version)<1,v=d.bufferViews,g=v[r.bufferView],_=r.componentType,y=r.type,C=r.count,E=h.getBuffer(g),S=l(r).createArrayBufferView(E.buffer,E.byteOffset+r.byteOffset,C);if(_===s.FLOAT&&"SCALAR"===y)a=S;else if(_===s.FLOAT&&"VEC3"===y)for(a=new Array(C),u=0;C>u;++u)a[u]=e.fromArray(S,3*u);else if(_===s.FLOAT&&"VEC4"===y)for(a=new Array(C),u=0;C>u;++u){var w=4*u;f?a[u]=o.fromAxisAngle(e.fromArray(S,w,m),S[w+3]):a[u]=o.unpack(S,w)}i(t.cacheKey)&&(p[n]=a)}return a};var f={};d.prototype.evaluate=function(e,t){return this._value},u.getAnimationSpline=function(e,t,n,o,l,u){var c=h(e,t,o),p=f[c];if(!i(p)){var m=u[l.input],v=e.gltf.accessors[n.parameters[l.output]],g=u[l.output];if(1===m.length&&1===g.length)p=new d(g[0]);else{var _=v.componentType,y=v.type;"LINEAR"===l.interpolation&&(_===s.FLOAT&&"VEC3"===y?p=new r({times:m,points:g}):_===s.FLOAT&&"VEC4"===y&&(p=new a({times:m,points:g})))}i(e.cacheKey)&&(f[c]=p)}return p};var v={};return u.getSkinInverseBindMatrices=function(e,t){var r=c(e,t),o=v[r];if(!i(o)){var a=e._loadResources,u=e.gltf,h=u.bufferViews,d=h[t.bufferView],p=t.componentType,m=t.type,f=t.count,g=a.getBuffer(d),_=l(t).createArrayBufferView(g.buffer,g.byteOffset+t.byteOffset,f);if(o=new Array(f),p===s.FLOAT&&"MAT4"===m)for(var y=0;f>y;++y)o[y]=n.fromArray(_,16*y);v[r]=o}return o},u}),i("Scene/ModelAnimationLoop",["../Core/freezeObject"],function(e){"use strict";var t={NONE:0,REPEAT:1,MIRRORED_REPEAT:2};return e(t)}),i("Scene/ModelAnimationState",["../Core/freezeObject"],function(e){"use strict";return e({STOPPED:0,ANIMATING:1})}),i("Scene/ModelAnimation",["../Core/defaultValue","../Core/defineProperties","../Core/Event","../Core/JulianDate","./ModelAnimationLoop","./ModelAnimationState"],function(e,t,i,r,n,o){"use strict";function a(t,a,s){this._name=t.name,this._startTime=r.clone(t.startTime),this._delay=e(t.delay,0),this._stopTime=t.stopTime,this.removeOnStop=e(t.removeOnStop,!1),this._speedup=e(t.speedup,1),this._reverse=e(t.reverse,!1),this._loop=e(t.loop,n.NONE),this.start=new i,this.update=new i,this.stop=new i,this._state=o.STOPPED,this._runtimeAnimation=s,this._computedStartTime=void 0,this._duration=void 0;var l=this;this._raiseStartEvent=function(){l.start.raiseEvent(a,l)},this._updateEventTime=0,this._raiseUpdateEvent=function(){l.update.raiseEvent(a,l,l._updateEventTime)},this._raiseStopEvent=function(){l.stop.raiseEvent(a,l)}}return t(a.prototype,{name:{get:function(){return this._name}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},speedup:{get:function(){return this._speedup}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}}}),a}),i("Scene/ModelAnimationCollection",["../Core/clone","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/JulianDate","../Core/Math","./ModelAnimation","./ModelAnimationLoop","./ModelAnimationState"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(e){this.animationAdded=new o,this.animationRemoved=new o,this._model=e,this._scheduledAnimations=[],this._previousTime=void 0}function d(e,t){for(var i=e.channelEvaluators,r=i.length,n=0;r>n;++n)i[n](t)}function p(e,t,i){return function(){e.animationRemoved.raiseEvent(t,i)}}r(h.prototype,{length:{get:function(){return this._scheduledAnimations.length}}}),h.prototype.add=function(e){e=t(e,t.EMPTY_OBJECT);var i=this._model,r=i._runtime.animations,n=r[e.name],o=new l(e,i,n);return this._scheduledAnimations.push(o),this.animationAdded.raiseEvent(i,o),o},h.prototype.addAll=function(i){i=t(i,t.EMPTY_OBJECT),i=e(i);for(var r=[],n=this._model._animationIds,o=n.length,a=0;o>a;++a)i.name=n[a],r.push(this.add(i));return r},h.prototype.remove=function(e){if(i(e)){var t=this._scheduledAnimations,r=t.indexOf(e);if(-1!==r)return t.splice(r,1),this.animationRemoved.raiseEvent(this._model,e),!0}return!1},h.prototype.removeAll=function(){var e=this._model,t=this._scheduledAnimations,i=t.length;this._scheduledAnimations=[];for(var r=0;i>r;++r)this.animationRemoved.raiseEvent(e,t[r])},h.prototype.contains=function(e){return i(e)?-1!==this._scheduledAnimations.indexOf(e):!1},h.prototype.get=function(e){return this._scheduledAnimations[e]};var m=[];return h.prototype.update=function(e){var r=this._scheduledAnimations,n=r.length;if(0===n)return this._previousTime=void 0,!1;if(a.equals(e.time,this._previousTime))return!1;this._previousTime=a.clone(e.time,this._previousTime);for(var o=!1,l=e.time,h=this._model,f=0;n>f;++f){var v=r[f],g=v._runtimeAnimation;i(v._computedStartTime)||(v._computedStartTime=a.addSeconds(t(v.startTime,l),v.delay,new a)),i(v._duration)||(v._duration=g.stopTime*(1/v.speedup));var _=v._computedStartTime,y=v._duration,C=v.stopTime,E=0!==y?a.secondsDifference(l,_)/y:0,S=E>=0,w=S&&(1>=E||v.loop===u.REPEAT||v.loop===u.MIRRORED_REPEAT)&&(!i(C)||a.lessThanOrEquals(l,C));if(w){if(v._state===c.STOPPED&&(v._state=c.ANIMATING,v.start.numberOfListeners>0&&e.afterRender.push(v._raiseStartEvent)),v.loop===u.REPEAT)E-=Math.floor(E);else if(v.loop===u.MIRRORED_REPEAT){var T=Math.floor(E),x=E-T;E=T%2===1?1-x:x}v.reverse&&(E=1-E);var b=E*y*v.speedup;b=s.clamp(b,g.startTime,g.stopTime),d(g,b),v.update.numberOfListeners>0&&(v._updateEventTime=b,e.afterRender.push(v._raiseUpdateEvent)),o=!0}else S&&v._state===c.ANIMATING&&(v._state=c.STOPPED,v.stop.numberOfListeners>0&&e.afterRender.push(v._raiseStopEvent),v.removeOnStop&&m.push(v))}n=m.length;for(var A=0;n>A;++A){var P=m[A];r.splice(r.indexOf(P),1),e.afterRender.push(p(this,h,P))}return m.length=0,o},h}),i("Scene/ModelMaterial",["../Core/defined","../Core/defineProperties","../Core/DeveloperError"],function(e,t,i){"use strict";function r(e,t,i){this._name=t.name,this._id=i,this._uniformMap=e._uniformMaps[i]}return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}}}),r.prototype.setValue=function(e,t){var i=this._uniformMap.values[e];i.value=i.clone(t,i.value)},r.prototype.getValue=function(t){var i=this._uniformMap.values[t];if(e(i))return i.value},r}),i("Scene/modelMaterialsCommon",["../Core/defaultValue","../Core/defined","../Renderer/WebGLConstants"],function(e,t,i){"use strict";function r(e){switch(e){case i.FLOAT:return"float";case i.FLOAT_VEC2:return"vec2";case i.FLOAT_VEC3:return"vec3";case i.FLOAT_VEC4:return"vec4";case i.FLOAT_MAT2:return"mat2";case i.FLOAT_MAT3:return"mat3";case i.FLOAT_MAT4:return"mat4";case i.SAMPLER_2D:return"sampler2D"}}function n(e){var r,n={};if(t(e.extensions)&&t(e.extensions.KHR_materials_common)&&(r=e.extensions.KHR_materials_common.lights),t(r)){var o=e.nodes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];if(t(s.extensions)&&t(s.extensions.KHR_materials_common)){var l=s.extensions.KHR_materials_common.light;t(l)&&t(r[l])&&(r[l].node=a),delete s.extensions.KHR_materials_common}}var u=0;for(var c in r)if(r.hasOwnProperty(c)){var h=r[c],d=h.type;if("ambient"!==d&&!t(h.node)){delete r[c];continue}var p="light"+u.toString();switch(h.baseName=p,d){case"ambient":var m=h.ambient;n[p+"Color"]={type:i.FLOAT_VEC3,value:m.color};break;case"directional":var f=h.directional;n[p+"Color"]={type:i.FLOAT_VEC3,value:f.color},t(h.node)&&(n[p+"Transform"]={node:h.node,semantic:"MODELVIEW",type:i.FLOAT_MAT4});break;case"point":var v=h.point;n[p+"Color"]={type:i.FLOAT_VEC3,value:v.color},t(h.node)&&(n[p+"Transform"]={node:h.node,semantic:"MODELVIEW",type:i.FLOAT_MAT4}),n[p+"Attenuation"]={type:i.FLOAT_VEC3,value:[v.constantAttenuation,v.linearAttenuation,v.quadraticAttenuation]};break;case"spot":var g=h.spot;n[p+"Color"]={type:i.FLOAT_VEC3,value:g.color},t(h.node)&&(n[p+"Transform"]={node:h.node,semantic:"MODELVIEW",type:i.FLOAT_MAT4},n[p+"InverseTransform"]={node:h.node,semantic:"MODELVIEWINVERSE",type:i.FLOAT_MAT4,useInFragment:!0}),n[p+"Attenuation"]={type:i.FLOAT_VEC3,value:[g.constantAttenuation,g.linearAttenuation,g.quadraticAttenuation]},n[p+"FallOff"]={type:i.FLOAT_VEC2,value:[g.fallOffAngle,g.fallOffExponent]}}++u}}return n}function o(i,r,n){var o,a=e(n,0);do o=r+(a++).toString();while(t(i[o]));return o}function a(n,a,l){var u,m=n.techniques,f=n.shaders,v=n.programs,g=a.technique.toUpperCase();t(n.extensions)&&t(n.extensions.KHR_materials_common)&&(u=n.extensions.KHR_materials_common.lights);var _=e(a.jointCount,0),y=_>0,C=a.values,E="precision highp float;\n",S="precision highp float;\n",w=o(m,"technique",c),T=o(f,"vertexShader",h),x=o(f,"fragmentShader",d),b=o(v,"program",p),A="CONSTANT"!==g,P={modelViewMatrix:{semantic:"MODELVIEW",type:i.FLOAT_MAT4},projectionMatrix:{semantic:"PROJECTION",type:i.FLOAT_MAT4}};A&&(P.normalMatrix={semantic:"MODELVIEWINVERSETRANSPOSE",type:i.FLOAT_MAT3}),y&&(P.jointMatrix={count:_,semantic:"JOINTMATRIX",type:i.FLOAT_MAT4});var I,M=!1;for(var D in C)if(C.hasOwnProperty(D)&&"transparent"!==D&&"doubleSided"!==D){ -var R=s(D,C[D]);I=D.toLowerCase(),M||R!==i.SAMPLER_2D||(M=!0),P[I]={type:R}}if(t(l))for(var O in l)l.hasOwnProperty(O)&&(P[O]=l[O]);var N={};for(var L in P)if(P.hasOwnProperty(L)){var F=P[L];N["u_"+L]=L;var B=t(F.count)?"["+F.count+"]":"";F.type!==i.FLOAT_MAT3&&F.type!==i.FLOAT_MAT4||F.useInFragment?(S+="uniform "+r(F.type)+" u_"+L+B+";\n",delete F.useInFragment):E+="uniform "+r(F.type)+" u_"+L+B+";\n"}var V="";y&&(V+=" mat4 skinMat = a_weight.x * u_jointMatrix[int(a_joint.x)];\n",V+=" skinMat += a_weight.y * u_jointMatrix[int(a_joint.y)];\n",V+=" skinMat += a_weight.z * u_jointMatrix[int(a_joint.z)];\n",V+=" skinMat += a_weight.w * u_jointMatrix[int(a_joint.w)];\n");var k={a_position:"position"};P.position={semantic:"POSITION",type:i.FLOAT_VEC3},E+="attribute vec3 a_position;\n",E+="varying vec3 v_positionEC;\n",V+=y?" vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",V+=" v_positionEC = pos.xyz;\n",V+=" gl_Position = u_projectionMatrix * pos;\n",S+="varying vec3 v_positionEC;\n",A&&(k.a_normal="normal",P.normal={semantic:"NORMAL",type:i.FLOAT_VEC3},E+="attribute vec3 a_normal;\n",E+="varying vec3 v_normal;\n",V+=y?" v_normal = u_normalMatrix * mat3(skinMat) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",S+="varying vec3 v_normal;\n");var z;M&&(k.a_texcoord_0="texcoord_0",P.texcoord_0={semantic:"TEXCOORD_0",type:i.FLOAT_VEC2},z="v_texcoord_0",E+="attribute vec2 a_texcoord_0;\n",E+="varying vec2 "+z+";\n",V+=" "+z+" = a_texcoord_0;\n",S+="varying vec2 "+z+";\n"),y&&(k.a_joint="joint",P.joint={semantic:"JOINT",type:i.FLOAT_VEC4},k.a_weight="weight",P.weight={semantic:"WEIGHT",type:i.FLOAT_VEC4},E+="attribute vec4 a_joint;\n",E+="attribute vec4 a_weight;\n");var U=A&&("BLINN"===g||"PHONG"===g)&&t(P.specular)&&t(P.shininess),G=!1,W=!1,H="";for(var q in u)if(u.hasOwnProperty(q)){var j=u[q],Y=j.type.toLowerCase(),X=j.baseName;H+=" {\n";var Z,K,Q="u_"+X+"Color";"ambient"===Y?(W=!0,H+=" ambientLight += "+Q+";\n"):A&&(G=!0,Z="v_"+X+"Direction",K="v_"+X+"Position","point"!==Y&&(E+="varying vec3 "+Z+";\n",S+="varying vec3 "+Z+";\n",V+=" "+Z+" = mat3(u_"+X+"Transform) * vec3(0.,0.,1.);\n","directional"===Y&&(H+=" vec3 l = normalize("+Z+");\n")),"directional"!==Y?(E+="varying vec3 "+K+";\n",S+="varying vec3 "+K+";\n",V+=" "+K+" = u_"+X+"Transform[3].xyz;\n",H+=" vec3 VP = "+K+" - v_positionEC;\n",H+=" vec3 l = normalize(VP);\n",H+=" float range = length(VP);\n",H+=" float attenuation = 1.0 / (u_"+X+"Attenuation.x + ",H+="(u_"+X+"Attenuation.y * range) + ",H+="(u_"+X+"Attenuation.z * range * range));\n"):H+=" float attenuation = 1.0;\n","spot"===Y&&(H+=" float spotDot = dot(l, normalize("+Z+"));\n",H+=" if (spotDot < cos(u_"+X+"FallOff.x * 0.5))\n",H+=" {\n",H+=" attenuation = 0.0;\n",H+=" }\n",H+=" else\n",H+=" {\n",H+=" attenuation *= max(0.0, pow(spotDot, u_"+X+"FallOff.y));\n",H+=" }\n"),H+=" diffuseLight += "+Q+"* max(dot(normal,l), 0.) * attenuation;\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),H+=" specularLight += "+Q+" * specularIntensity;\n")),H+=" }\n"}W||(H+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),G||"CONSTANT"===g||(H+=" vec3 l = normalize(czm_sunDirectionEC);\n",H+=" diffuseLight += vec3(1.0, 1.0, 1.0) * max(dot(normal,l), 0.);\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),H+=" specularLight += vec3(1.0, 1.0, 1.0) * specularIntensity;\n")),E+="void main(void) {\n",E+=V,E+="}\n",S+="void main(void) {\n";var J=" vec3 color = vec3(0.0, 0.0, 0.0);\n";A&&(S+=" vec3 normal = normalize(v_normal);\n",a.doubleSided&&(S+=" if (gl_FrontFacing == false)\n",S+=" {\n",S+=" normal = -normal;\n",S+=" }\n"));var $;"CONSTANT"!==g?(t(P.diffuse)&&(S+=P.diffuse.type===i.SAMPLER_2D?" vec4 diffuse = texture2D(u_diffuse, "+z+");\n":" vec4 diffuse = u_diffuse;\n",S+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += diffuse.rgb * diffuseLight;\n"),U&&(S+=P.specular.type===i.SAMPLER_2D?" vec3 specular = texture2D(u_specular, "+z+").rgb;\n":" vec3 specular = u_specular.rgb;\n",S+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += specular * specularLight;\n"),$=t(P.transparency)?" gl_FragColor = vec4(color * diffuse.a, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):$=t(P.transparency)?" gl_FragColor = vec4(color, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",t(P.emission)&&(S+=P.emission.type===i.SAMPLER_2D?" vec3 emission = texture2D(u_emission, "+z+").rgb;\n":" vec3 emission = u_emission.rgb;\n",J+=" color += emission;\n"),(t(P.ambient)||"CONSTANT"!==g)&&(S+=t(P.ambient)?P.ambient.type===i.SAMPLER_2D?" vec3 ambient = texture2D(u_ambient, "+z+").rgb;\n":" vec3 ambient = u_ambient.rgb;\n":" vec3 ambient = diffuse.rgb;\n",J+=" color += ambient * ambientLight;\n"),S+=" vec3 viewDir = -normalize(v_positionEC);\n",S+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",S+=H,S+=J,S+=$,S+="}\n";var ee;ee=a.transparent?{enable:[i.DEPTH_TEST,i.BLEND],depthMask:!1,functions:{blendEquationSeparate:[i.FUNC_ADD,i.FUNC_ADD],blendFuncSeparate:[i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA]}}:a.doubleSided?{enable:[i.DEPTH_TEST]}:{enable:[i.CULL_FACE,i.DEPTH_TEST]},m[w]={attributes:k,parameters:P,program:b,states:ee,uniforms:N},f[T]={type:i.VERTEX_SHADER,uri:"",extras:{source:E}},f[x]={type:i.FRAGMENT_SHADER,uri:"",extras:{source:S}};var te=Object.keys(k);return v[b]={attributes:te,fragmentShader:x,vertexShader:T},w}function s(e,r){var n;switch(n=t(r.value)?r.value:r,e){case"ambient":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"diffuse":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"emission":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"specular":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"shininess":return i.FLOAT;case"transparency":return i.FLOAT;case"transparent":return i.BOOL;case"doubleSided":return i.BOOL}}function l(t){var i="";i+="technique:"+t.technique+";";for(var r=t.values,n=Object.keys(r).sort(),o=n.length,a=0;o>a;++a){var l=n[a];r.hasOwnProperty(l)&&"transparent"!==l&&"doubleSided"!==l&&(i+=l+":"+s(l,r[l]),i+=";")}var u=e(t.doubleSided,!1);i+=u.toString()+";";var c=e(t.transparent,!1);i+=c.toString()+";";var h=e(t.jointCount,0);return i+=h.toString()+";"}function u(e){if(t(e)){var i=!1,r=e.extensionsUsed;if(t(r))for(var o=r.length,s=0;o>s;++s)if("KHR_materials_common"===r[s]){i=!0,r.splice(s,1);break}if(i){t(e.programs)||(e.programs={}),t(e.shaders)||(e.shaders={}),t(e.techniques)||(e.techniques={});var u=n(e),c={},h=e.materials;for(var d in h)if(h.hasOwnProperty(d)){var p=h[d];if(t(p.extensions)&&t(p.extensions.KHR_materials_common)){var m=p.extensions.KHR_materials_common,f=l(m),v=c[f];t(v)||(v=a(e,m,u),c[f]=v),p.values={};var g=m.values;for(var _ in g)if(g.hasOwnProperty(_)){var y=g[_];t(y.value)?p.values[_]=y.value:p.values[_]=y}p.technique=v,delete p.extensions.KHR_materials_common}}t(e.extensions)&&delete e.extensions.KHR_materials_common}return e}}var c=0,h=0,d=0,p=0;return u}),i("Scene/ModelMesh",["../Core/defineProperties"],function(e){"use strict";function t(e,t,i){for(var r=[],n=e.primitives,o=n.length,a=0;o>a;++a){var s=n[a];r[a]=t[s.material]}this._name=e.name,this._materials=r,this._id=i}return e(t.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),t}),i("Scene/ModelNode",["../Core/defaultValue","../Core/defineProperties","../Core/Matrix4"],function(e,t,i){"use strict";function r(e,t,r,n,o){this._model=e,this._runtimeNode=r,this._name=t.name,this._id=n,this.useMatrix=!1,this._show=!0,this._matrix=i.clone(o)}return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=i.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}}}),r.prototype.setMatrix=function(e){i.clone(e,this._matrix)},r}),i("Scene/Model",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/clone","../Core/combine","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/getAbsoluteUri","../Core/getBaseUri","../Core/getMagic","../Core/getStringFromTypedArray","../Core/IndexDatatype","../Core/loadArrayBuffer","../Core/loadImage","../Core/loadImageFromTypedArray","../Core/loadText","../Core/Math","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/PrimitiveType","../Core/Quaternion","../Core/Queue","../Core/RuntimeError","../Core/throttleRequestByServer","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Renderer/WebGLConstants","../ThirdParty/gltfDefaults","../ThirdParty/Uri","../ThirdParty/when","./getModelAccessor","./ModelAnimationCache","./ModelAnimationCollection","./ModelMaterial","./modelMaterialsCommon","./ModelMesh","./ModelNode","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee){"use strict";function te(){this.buffersToCreate=new P,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new P,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new P,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new P,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.skinnedNodesIds=[]}function ie(e,t){e._cachedGltf=t,e._animationIds=ne(t)}function re(e){this._gltf=K(W(e.gltf)),this._bgltf=e.bgltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}function ne(e){var t=[];if(l(e)&&l(e.gltf)){var i=e.gltf.animations;for(var r in i)i.hasOwnProperty(r)&&t.push(r)}return t}function oe(t){t=s(t,s.EMPTY_OBJECT);var i=t.cacheKey;this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=s(t.releaseGltfJson,!1),this._animationIds=void 0;var r;if(l(i)&&l(At[i])&&At[i].ready)r=At[i],++r.count;else{var n=t.gltf;if(l(n)){if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),n instanceof Uint8Array){var o=le(n);0!==o.binaryOffset&&(n=n.subarray(o.binaryOffset)),r=new re({gltf:o.glTF,bgltf:n,ready:!0})}else r=new re({gltf:t.gltf,ready:!0});r.count=1,l(i)&&(At[i]=r)}}ie(this,r),this._cache=t.cache,this._shaderOverride=t.shaderOverride,this._basePath=s(t.basePath,"");var a=new H(document.location.href),u=new H(this._basePath);this._baseUri=u.resolve(a),this.show=s(t.show,!0),this.modelMatrix=x.clone(s(t.modelMatrix,x.IDENTITY)),this._modelMatrix=x.clone(this.modelMatrix),this.scale=s(t.scale,1),this._scale=this.scale,this.minimumPixelSize=s(t.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=t.maximumScale,this._maximumScale=this.maximumScale,this.id=t.id,this._id=t.id,this.pickPrimitive=t.pickPrimitive,this._allowPicking=s(t.allowPicking,!0),this._ready=!1,this._readyPromise=q.defer(),this.activeAnimations=new X(this),this._defaultTexture=void 0,this._incrementallyLoadTextures=s(t.incrementallyLoadTextures,!0),this._asynchronous=s(t.asynchronous,!0),this.debugShowBoundingVolume=s(t.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=s(t.debugWireframe,!1),this._debugWireframe=!1,this._precreatedAttributes=t.precreatedAttributes,this._vertexShaderLoaded=t.vertexShaderLoaded,this._fragmentShaderLoaded=t.fragmentShaderLoaded,this._uniformMapLoaded=t.uniformMapLoaded,this._pickVertexShaderLoaded=t.pickVertexShaderLoaded,this._pickFragmentShaderLoaded=t.pickFragmentShaderLoaded,this._pickUniformMapLoaded=t.pickUniformMapLoaded,this._ignoreCommands=s(t.ignoreCommands,!1),this.cull=s(t.cull,!0),this._computedModelMatrix=new x,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new e,this._state=xt.NEEDS_LOAD,this._loadResources=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},pickPrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._loadOptions=t.loadOptions}function ae(e,t,i){return e.subarray(t,t+i)}function se(e){var t=f(e);return"glTF"===t}function le(e){if(!se(e))throw new h("bgltf is not a valid Binary glTF file.");var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;i+=Pt,i+=Pt,i+=Pt;var r=t.getUint32(i,!0);i+=Pt+Pt;var n=i,o=n+r,a=v(e,n,r);return{glTF:JSON.parse(a),binaryOffset:o}}function ue(e,t,i){return e._runtime[t][i]}function ce(t){for(var r=t.nodes,n=t.meshes,o=t.accessors,a=t.scenes[t.scene].nodes,s=a.length,u=[],c=new i(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),h=new i(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),d=0;s>d;++d){var p=r[a[d]];for(p._transformToRoot=Ce(p),u.push(p);u.length>0;){p=u.pop();var m=p._transformToRoot,f=p.meshes;if(l(f))for(var v=f.length,g=0;v>g;++g)for(var _=n[f[g]].primitives,y=_.length,C=0;y>C;++C){var E=_[C].attributes.POSITION;if(l(E)){var S=o[E],w=i.fromArray(S.min,0,It),T=i.fromArray(S.max,0,Mt);l(c)&&l(h)&&(x.multiplyByPoint(m,w,w),x.multiplyByPoint(m,T,T),i.minimumByComponent(c,w,c),i.maximumByComponent(h,T,h))}}for(var b=p.children,A=b.length,P=0;A>P;++P){var I=r[b[P]];I._transformToRoot=Ce(I),x.multiplyTransformation(m,I._transformToRoot,I._transformToRoot),u.push(I)}delete p._transformToRoot}}var M=e.fromCornerPoints(c,h);return e.transformWithoutScale(M,wt,M)}function he(e,t,i){return function(){e._state=xt.FAILED,e._readyPromise.reject(new I("Failed to load "+t+": "+i))}}function de(e,t){return function(i){var r=e._loadResources;r.buffers[t]=new Uint8Array(i),--r.pendingBufferLoads}}function pe(e){var t=e.gltf.buffers;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if("binary_glTF"===i||"KHR_binary_glTF"===i){var n=e._loadResources;n.buffers[i]=e._cachedGltf.bgltf}else if("arraybuffer"===r.type){++e._loadResources.pendingBufferLoads;var o=new H(r.uri),a=o.resolve(e._baseUri).toString();_(a).then(de(e,i)).otherwise(he(e,"buffer",a))}}}function me(e){var t=e.gltf.bufferViews;for(var i in t)t.hasOwnProperty(i)&&t[i].target===G.ARRAY_BUFFER&&e._loadResources.buffersToCreate.enqueue(i)}function fe(e,t){return function(i){var r=e._loadResources;r.shaders[t]={source:i,bufferView:void 0},--r.pendingShaderLoads}}function ve(e){var t=e.gltf.shaders;if(!l(e._shaderParser)||!e._shaderParser(t))for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(l(r.extras)&&l(r.extras.source))e._loadResources.shaders[i]={source:r.extras.source,bufferView:void 0};else if(l(r.extensions)&&l(r.extensions.KHR_binary_glTF)){var n=r.extensions.KHR_binary_glTF;e._loadResources.shaders[i]={source:void 0,bufferView:n.bufferView}}else{var o;if(e._shaderOverride&&(o=e._shaderOverride(r,i,e.gltf)))++e._loadResources.pendingShaderLoads,fe(e,i)(o);else{++e._loadResources.pendingShaderLoads;var a=new H(r.uri),s=a.resolve(e._baseUri).toString();E(s,e._loadOptions).then(fe(e,i)).otherwise(he(e,"shader",s))}}}}function ge(e){var t=e.gltf.programs;for(var i in t)t.hasOwnProperty(i)&&e._loadResources.programsToCreate.enqueue(i)}function _e(e,t){return function(i){var r=e._loadResources;--r.pendingTextureLoads,r.texturesToCreate.enqueue({id:t,image:i,bufferView:void 0})}}function ye(e){var t=e.gltf.images,i=e.gltf.textures;for(var r in i)if(i.hasOwnProperty(r)){var n=t[i[r].source];if(l(n.extensions)&&l(n.extensions.KHR_binary_glTF)){var o=n.extensions.KHR_binary_glTF;e._loadResources.texturesToCreateFromBufferView.enqueue({id:r,image:void 0,bufferView:o.bufferView,mimeType:o.mimeType})}else{var a=void 0,s=new H(n.uri),u=s.resolve(e._baseUri).toString();l(e._cache)&&(a=e._cache.get(u),l(a)&&(++e._loadResources.pendingTextureLoads,a.then(function(t,i){return this._rendererResources.textures[t]=i,i.ref(),--e._loadResources.pendingTextureLoads,i}.bind(e,r),function(e){console.log("error",e)}))),l(a)||(++e._loadResources.pendingTextureLoads,l(e._cache)&&e._cache.reserve(u),y(u).then(_e(e,r)).otherwise(he(e,"image",u)))}}}function Ce(e){return l(e.matrix)?x.fromArray(e.matrix):x.fromTranslationQuaternionRotationScale(i.fromArray(e.translation,0,Dt),A.unpack(e.rotation,0,Rt),i.fromArray(e.scale,0,Ot))}function Ee(e){var t={},i={},r=[],n=e._loadResources.skinnedNodesIds,o=e.gltf.nodes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a],u={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new x,computedMatrix:new x,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:s.jointName,children:[],parents:[],publicNode:void 0};u.publicNode=new J(e,s,u,a,Ce(s)),t[a]=u,i[s.name]=u,l(s.skin)&&(n.push(a),r.push(u))}e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=r}function Se(e){var t={},i={},r=e.gltf.materials,n=e._uniformMaps;for(var o in r)if(r.hasOwnProperty(o)){n[o]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0};var a=r[o],s=new Z(e,a,o);t[a.name]=s,i[o]=s}e._runtime.materialsByName=t,e._runtime.materialsById=i}function we(e){var t={},i=e._runtime.materialsById,r=e.gltf.meshes;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t[o.name]=new Q(o,i,n)}e._runtime.meshesByName=t}function Te(e){e._loadRendererResourcesFromCache||(pe(e),me(e),ve(e),ge(e),ye(e)),Se(e),we(e),Ee(e)}function xe(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){for(var r,n=e.gltf.bufferViews,o=e._rendererResources.buffers;i.buffersToCreate.length>0;){var a=i.buffersToCreate.dequeue();r=n[a];var s=D.createVertexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW});s.vertexArrayDestroyable=!1,o[a]=s}var u=e.gltf.accessors;for(var c in u)if(u.hasOwnProperty(c)){var h=u[c];if(r=n[h.bufferView],r.target===G.ELEMENT_ARRAY_BUFFER&&!l(o[h.bufferView])){var d=D.createIndexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW,indexDatatype:h.componentType});d.vertexArrayDestroyable=!1,o[h.bufferView]=d}}}}function be(e){for(var t={},i=e.length,r=0;i>r;++r)t[e[r]]=r;return t}function Ae(e,t){if(l(t.source))return t.source;var i=e._loadResources,r=e.gltf,n=r.bufferViews[t.bufferView];return v(i.getBuffer(n))}function Pe(e,t,i){return l(i)&&(e=i(e,t)),e}function Ie(e,t,i){var r=t.gltf.programs,n=t._loadResources.shaders,o=r[e],a=be(o.attributes),s=Ae(t,n[o.vertexShader]),u=Ae(t,n[o.fragmentShader]),c=Pe(s,e,t._vertexShaderLoaded),h=Pe(u,e,t._fragmentShaderLoaded),d=o.attributes.length,p=t._precreatedAttributes;if(l(p))for(var m in p)p.hasOwnProperty(m)&&(a[m]=d++);if(t._rendererResources.programs[e]=F.fromCache({context:i,vertexShaderSource:c,fragmentShaderSource:h,attributeLocations:a}),t.allowPicking){var f=Pe(s,e,t._pickVertexShaderLoaded),v=Pe(u,e,t._pickFragmentShaderLoaded);t._pickFragmentShaderLoaded||(v=B.createPickFragmentShaderSource(u,"uniform")),t._rendererResources.pickPrograms[e]=F.fromCache({context:i,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:a})}}function Me(e,t){var i,r=e._loadResources;if(0===r.pendingShaderLoads&&0===r.pendingBufferLoads)if(e.asynchronous)r.programsToCreate.length>0&&(i=r.programsToCreate.dequeue(),Ie(i,e,t));else for(;r.programsToCreate.length>0;)i=r.programsToCreate.dequeue(),Ie(i,e,t)}function De(e,t){return function(i){e.texturesToCreate.enqueue({id:t.id,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function Re(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView],o=De(t,i),a=he(e,"image","id: "+i.id+", bufferView: "+i.bufferView);C(t.getBuffer(n),i.mimeType).then(o).otherwise(a),++t.pendingBufferViewToImage}}function Oe(e,t){var i=e._loadResources;if(i.createSamplers){i.createSamplers=!1;var r=e._rendererResources.samplers,n=e.gltf.samplers;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];r[o]=new L({wrapS:a.wrapS,wrapT:a.wrapT,minificationFilter:a.minFilter,magnificationFilter:a.magFilter})}}}function Ne(e,t,i){var r=t.gltf.textures,n=r[e.id],o=t._rendererResources.samplers,a=o[n.sampler],s=a.minificationFilter===k.NEAREST_MIPMAP_NEAREST||a.minificationFilter===k.NEAREST_MIPMAP_LINEAR||a.minificationFilter===k.LINEAR_MIPMAP_NEAREST||a.minificationFilter===k.LINEAR_MIPMAP_LINEAR,u=s||a.wrapS===z.REPEAT||a.wrapS===z.MIRRORED_REPEAT||a.wrapT===z.REPEAT||a.wrapT===z.MIRRORED_REPEAT,c=e.image,h=!S.isPowerOfTwo(c.width)||!S.isPowerOfTwo(c.height);if(u&&h){var d=document.createElement("canvas");d.width=S.nextPowerOfTwo(c.width),d.height=S.nextPowerOfTwo(c.height);var p=d.getContext("2d");p.drawImage(c,0,0,c.width,c.height,0,0,d.width,d.height),c=d}var m;n.target===G.TEXTURE_2D&&(m=new V({context:i,source:c,pixelFormat:n.internalFormat,pixelDatatype:n.type,sampler:a,flipY:!1})),s&&m.generateMipmap(),t._rendererResources.textures[e.id]=m,l(t._cache)&&t._cache.resolve(e.image.src,m)}function Le(e,t){var i,r=e._loadResources;if(e.asynchronous)r.texturesToCreate.length>0&&(i=r.texturesToCreate.dequeue(),Ne(i,e,t));else for(;r.texturesToCreate.length>0;)i=r.texturesToCreate.dequeue(),Ne(i,e,t)}function Fe(e,t){var i=e.gltf,r=i.techniques,n=i.materials,o={},a=r[n[t.material].technique],s=a.parameters,u=a.attributes,c=e._rendererResources.programs[a.program].vertexAttributes;for(var h in c)if(c.hasOwnProperty(h)){var d=u[h],p=c[h].index;if(l(d)){var m=s[d];o[m.semantic]=p}else o[h]=p}return o}function Be(e,t,i){for(var r=e.length,n=0;r>n;++n)for(var o=[e[n]];o.length>0;){var a=o.pop(),s=i[a];if(s.jointName===t)return a;for(var l=s.children,u=l.length,c=0;u>c;++c)o.push(l[c])}}function Ve(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesIds,s=a.length,l=0;s>l;++l){var u=a[l],c=o[u],h=n[u],d=t[h.skin];c.inverseBindMatrices=d.inverseBindMatrices,c.bindShapeMatrix=d.bindShapeMatrix;for(var p=[],m=h.skeletons,f=m.length,v=0;f>v;++v)p.push(m[v]);for(var g=r[h.skin].jointNames,_=g.length,y=0;_>y;++y){var C=g[y],E=o[Be(p,C,n)];c.joints.push(E)}}}function ke(e){var t=e._loadResources;if(0===t.pendingBufferLoads&&t.createSkins){t.createSkins=!1;var i=e.gltf,r=i.accessors,n=i.skins,o={};for(var a in n)if(n.hasOwnProperty(a)){var s,l=n[a],u=r[l.inverseBindMatrices];x.equals(l.bindShapeMatrix,x.IDENTITY)||(s=x.clone(l.bindShapeMatrix)),o[a]={inverseBindMatrices:Y.getSkinInverseBindMatrices(e,u),bindShapeMatrix:s}}Ve(e,o)}}function ze(e,t,i,r){return function(n){t[i]=r.evaluate(n,t[i]),t.dirtyNumber=e._maxDirtyNumber}}function Ue(e){var t=e._loadResources;if(t.finishedPendingBufferLoads()&&t.createRuntimeAnimations){t.createRuntimeAnimations=!1,e._runtime.animations={};var i=e._runtime.nodes,r=e.gltf.animations,n=e.gltf.accessors;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o],s=a.channels,l=a.parameters,u=a.samplers,c={};for(var h in l)l.hasOwnProperty(h)&&(c[h]=Y.getAnimationParameterValues(e,n[l[h]]));for(var d=Number.MAX_VALUE,p=-Number.MAX_VALUE,m=s.length,f=new Array(m),v=0;m>v;++v){var g=s[v],_=g.target,y=u[g.sampler],C=c[y.input];d=Math.min(d,C[0]),p=Math.max(p,C[C.length-1]);var E=Y.getAnimationSpline(e,o,a,g.sampler,y,c);f[v]=ze(e,i[_.id],_.path,E)}e._runtime.animations[o]={startTime:d,stopTime:p,channelEvaluators:f}}}}function Ge(e,t){var i=e._loadResources;if(i.finishedBuffersCreation()&&i.finishedProgramCreation()&&i.createVertexArrays){i.createVertexArrays=!1;var r=e._rendererResources.buffers,n=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors,s=o.meshes;for(var u in s)if(s.hasOwnProperty(u))for(var c=s[u].primitives,h=c.length,d=0;h>d;++d){var p,m,f,v=c[d],g=Fe(e,v),_=[],y=v.attributes;for(p in y)if(y.hasOwnProperty(p)&&(m=g[p],l(m))){var C=a[y[p]];_.push({index:m,vertexBuffer:r[C.bufferView],componentsPerAttribute:j(C).componentsPerAttribute,componentDatatype:C.componentType,normalize:!1,offsetInBytes:C.byteOffset,strideInBytes:C.byteStride})}var E=e._precreatedAttributes;if(l(E))for(p in E)E.hasOwnProperty(p)&&(m=g[p],l(m)&&(f=E[p],f.index=m,_.push(f)));var S;if(l(v.indices)){var w=a[v.indices];S=r[w.bufferView]}n[u+".primitive."+d]=new U({context:t,attributes:_,indexBuffer:S})}}}function We(e){var t={};t[G.BLEND]=!1,t[G.CULL_FACE]=!1,t[G.DEPTH_TEST]=!1,t[G.POLYGON_OFFSET_FILL]=!1,t[G.SCISSOR_TEST]=!1;var i,r=e.enable,n=r.length;for(i=0;n>i;++i)t[r[i]]=!0;return t}function He(e,t){var i=e._loadResources;if(i.createRenderStates){i.createRenderStates=!1;var r=e._rendererResources.renderStates,n=e.gltf.techniques;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o],u=a.states,c=We(u),h=s(u.functions,s.EMPTY_OBJECT),d=s(h.blendColor,[0,0,0,0]),p=s(h.blendEquationSeparate,[G.FUNC_ADD,G.FUNC_ADD]),m=s(h.blendFuncSeparate,[G.ONE,G.ONE,G.ZERO,G.ZERO]),f=s(h.colorMask,[!0,!0,!0,!0]),v=s(h.depthRange,[0,1]),g=s(h.polygonOffset,[0,0]),_=s(h.scissor,[0,0,0,0]);r[o]=N.fromCache({frontFace:l(h.frontFace)?h.frontFace[0]:G.CCW,cull:{enabled:c[G.CULL_FACE],face:l(h.cullFace)?h.cullFace[0]:G.BACK},lineWidth:l(h.lineWidth)?h.lineWidth[0]:1,polygonOffset:{enabled:c[G.POLYGON_OFFSET_FILL],factor:g[0],units:g[1]},scissorTest:{enabled:c[G.SCISSOR_TEST],rectangle:{x:_[0],y:_[1],width:_[2],height:_[3]}},depthRange:{near:v[0],far:v[1]},depthTest:{enabled:c[G.DEPTH_TEST],func:l(h.depthFunc)?h.depthFunc[0]:G.LESS},colorMask:{red:f[0],green:f[1],blue:f[2],alpha:f[3]},depthMask:l(h.depthMask)?h.depthMask[0]:!0,blending:{enabled:c[G.BLEND],color:{red:d[0],green:d[1],blue:d[2],alpha:d[3]},equationRgb:p[0],equationAlpha:p[1],functionSourceRgb:m[0],functionSourceAlpha:m[1],functionDestinationRgb:m[2],functionDestinationAlpha:m[3]}})}}}function qe(e,t){var i={value:e,clone:function(e,t){return e},func:function(){return i.value}};return i}function je(e,i){var r={value:t.fromArray(e),clone:t.clone,func:function(){return r.value}};return r}function Ye(e,t){var r={value:i.fromArray(e),clone:i.clone,func:function(){return r.value}};return r}function Xe(e,t){var i={value:r.fromArray(e),clone:r.clone,func:function(){return i.value}};return i}function Ze(e,t){var i={value:w.fromColumnMajorArray(e),clone:w.clone,func:function(){return i.value}};return i}function Ke(e,t){var i={value:T.fromColumnMajorArray(e),clone:T.clone,func:function(){return i.value}};return i}function Qe(e,t){var i={value:x.fromColumnMajorArray(e),clone:x.clone,func:function(){return i.value}};return i}function Je(e,t){this._value=void 0,this._textureId=e,this._model=t}function $e(e,t){var i=new Je(e,t);return i.func=function(){return i.value},i}function et(e,t,i,r){var n=t._runtime.nodes[e];return Bt[i](r,t,n)}function tt(e,t){var i=e._loadResources;if(i.finishedProgramCreation()&&i.createUniformMaps){i.createUniformMaps=!1;var r=e.gltf,n=r.materials,o=r.techniques,a=e._uniformMaps;for(var s in n)if(n.hasOwnProperty(s)){var u,c=n[s],h=c.values,d=o[c.technique],p=d.parameters,m=d.uniforms,f={},v={};for(var g in m)if(m.hasOwnProperty(g)){var _=m[g],y=p[_];if(l(h[_])){var C=Ft[y.type](h[_],e);f[g]=C.func,v[_]=C}else if(l(y.node))f[g]=et(y.node,e,y.semantic,t.uniformState);else if(l(y.semantic))"JOINTMATRIX"!==y.semantic?f[g]=Lt[y.semantic](t.uniformState,e):u=g;else if(l(y.value)){var E=Ft[y.type](y.value,e);f[g]=E.func,v[_]=E}}var S=a[s];S.uniformMap=f,S.values=v,S.jointMatrixUniformName=u}}}function it(e){return function(){return e}}function rt(e){return function(){return e.computedJointMatrices}}function nt(t,r,n,u){for(var c=t._nodeCommands,h=t._pickIds,d=t.allowPicking,p=t._runtime.meshesByName,m=t._rendererResources,f=m.vertexArrays,v=m.programs,_=m.pickPrograms,y=m.renderStates,C=t._uniformMaps,E=t.gltf,S=E.accessors,w=E.meshes,T=E.techniques,b=E.materials,A=r.meshes,P=A.length,I=0;P>I;++I)for(var M=A[I],D=w[M],R=D.primitives,N=R.length,L=0;N>L;++L){var F,B=R[L],V=S[B.indices],k=b[B.material],z=T[k.technique],U=z.program,G=B.attributes.POSITION;if(l(G)){var W=S[G];F=e.fromCornerPoints(i.fromArray(W.min),i.fromArray(W.max))}var H,q,Y=f[M+".primitive."+L];if(l(V))q=V.count,H=V.byteOffset/g.getSizeInBytes(V.componentType);else{var X=S[B.attributes.POSITION];q=X.count;var Z=j(X);H=X.byteOffset/(Z.componentsPerAttribute*a.getSizeInBytes(X.componentType))}var K=C[B.material],Q=K.uniformMap;if(l(K.jointMatrixUniformName)){var J={};J[K.jointMatrixUniformName]=rt(n),Q=o(Q,J)}l(t._uniformMapLoaded)&&(Q=t._uniformMapLoaded(Q,U,n));var ee,te=y[k.technique],ie=te.blending.enabled,re={primitive:s(t.pickPrimitive,t),id:t.id,node:n.publicNode,mesh:p[D.name]},ne=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:v[z.program],uniformMap:Q,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE});if(d){var oe;if(l(t._pickFragmentShaderLoaded))oe=l(t._pickUniformMapLoaded)?t._pickUniformMapLoaded(Q):o(Q);else{var ae=u.createPickId(re);h.push(ae);var se={czm_pickColor:it(ae.color)};oe=o(Q,se)}ee=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:_[z.program],uniformMap:oe,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE})}var le={show:!0,boundingSphere:F,command:ne,pickCommand:ee};n.commands.push(le),c.push(le)}}function ot(e,t){var r=e._loadResources;if(r.finishedEverythingButTextureCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],o=e._runtime.nodes,a=e.gltf,s=a.nodes,u=a.scenes[a.scene],c=u.nodes,h=c.length,d=[],p=0;h>p;++p)for(d.push({parentRuntimeNode:void 0,gltfNode:s[c[p]],id:c[p]});d.length>0;){var m=d.pop(),f=m.parentRuntimeNode,v=m.gltfNode,g=o[m.id];if(0===g.parents.length)if(l(v.matrix))g.matrix=x.fromColumnMajorArray(v.matrix);else{var _=v.rotation;g.translation=i.fromArray(v.translation),g.rotation=A.unpack(_),g.scale=i.fromArray(v.scale)}l(f)?(f.children.push(g),g.parents.push(f)):n.push(g),l(v.meshes)&&nt(e,v,g,t);for(var y=v.children,C=y.length,E=0;C>E;++E)d.push({parentRuntimeNode:g,gltfNode:s[y[E]],id:y[E]})}e._runtime.rootNodes=n,e._runtime.nodes=o}}function at(e,t){var i=t.context;if(e._loadRendererResourcesFromCache){var r=e._rendererResources,n=e._cachedRendererResources;n.assign(r),l(e._precreatedAttributes)&&Ge(e,i)}else xe(e,i),Me(e,i),Oe(e,i),Re(e),Le(e,i);ke(e),Ue(e),e._loadRendererResourcesFromCache||(Ge(e,i),He(e,i)),tt(e,i),ot(e,i)}function st(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&l(r)?x.clone(r,t):l(e.matrix)?x.clone(e.matrix,t):(x.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t),i.setMatrix(t))}function lt(t,r,n){for(var o=t._maxDirtyNumber,a=t.allowPicking,s=t._runtime.rootNodes,u=s.length,c=Vt,h=t._computedModelMatrix,d=0;u>d;++d){ -var p=s[d];for(st(p,p.transformToRoot),c.push(p);c.length>0;){p=c.pop();var m=p.transformToRoot,f=p.commands;if(p.dirtyNumber===o||r||n){var v=x.multiplyTransformation(h,m,p.computedMatrix),g=f.length;if(g>0)for(var _=0;g>_;++_){var y=f[_],C=y.command;if(x.clone(v,C.modelMatrix),e.transform(y.boundingSphere,C.modelMatrix,C.boundingVolume),l(t._rtcCenter)&&i.add(t._rtcCenter,C.boundingVolume.center,C.boundingVolume.center),a){var E=y.pickCommand;x.clone(C.modelMatrix,E.modelMatrix),e.clone(C.boundingVolume,E.boundingVolume)}}}for(var S=p.children,w=S.length,T=0;w>T;++T){var b=S[T];b.dirtyNumber=Math.max(b.dirtyNumber,p.dirtyNumber),(b.dirtyNumber===o||n)&&(st(b,b.transformToRoot),x.multiplyTransformation(m,b.transformToRoot,b.transformToRoot)),c.push(b)}}}++t._maxDirtyNumber}function ut(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;i>r;++r){var n=t[r];kt=x.inverseTransformation(n.transformToRoot,kt);for(var o=n.computedJointMatrices,a=n.joints,s=n.bindShapeMatrix,u=n.inverseBindMatrices,c=u.length,h=0;c>h;++h)l(o[h])||(o[h]=new x),o[h]=x.multiplyTransformation(kt,a[h].transformToRoot,o[h]),o[h]=x.multiplyTransformation(o[h],u[h],o[h]),l(s)&&(o[h]=x.multiplyTransformation(o[h],s,o[h]))}}function ct(e){for(var t=e._runtime.rootNodes,i=t.length,r=Vt,n=0;i>n;++n){var o=t[n];for(o.computedShow=o.publicNode.show,r.push(o);r.length>0;){o=r.pop();for(var a=o.computedShow,s=o.commands,l=s.length,u=0;l>u;++u)s[u].show=a;for(var c=o.children,h=c.length,d=0;h>d;++d){var p=c[d];p.computedShow=a&&p.publicNode.show,r.push(p)}}}}function ht(e,t){var i=e.id;if(e._id!==i){e._id=i;for(var r=e._pickIds,n=r.length,o=0;n>o;++o)r[o].object.id=i}}function dt(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?b.LINES:b.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;r>n;++n)i[n].command.primitiveType=t}}function pt(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;r>n;n++)i[n].command.debugShowBoundingVolume=t}}function mt(e,t,i){return zt.center=e,zt.radius=t,i.camera.getPixelSize(zt,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}function ft(e,t){var r=e.scale;if(0!==e.minimumPixelSize){var n=t.context,o=Math.max(n.drawingBufferWidth,n.drawingBufferHeight),a=e.modelMatrix;Ut.x=a[12],Ut.y=a[13],Ut.z=a[14],l(e._rtcCenter)&&i.add(e._rtcCenter,Ut,Ut);var s=e.boundingSphere.radius,u=mt(Ut,s,t),c=1/u,h=Math.min(c*(2*s),o);hr;++r){var n=t[r];if("CESIUM_RTC"!==n&&"KHR_binary_glTF"!==n&&"KHR_materials_common"!==n)throw new I("Unsupported glTF Extension: "+n)}}function _t(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.pickPrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function yt(e){for(var t in e)e.hasOwnProperty(t)&&(l(e[t].unref)?e[t].unref():e[t].destroy())}function Ct(e){yt(e.buffers),yt(e.vertexArrays),yt(e.programs),yt(e.pickPrograms),yt(e.textures)}function Et(e){for(var t in e)e.hasOwnProperty(t)&&e[t].ref&&e[t].ref()}function St(e){for(var t in e)e.hasOwnProperty(t)&&e[t].unref&&e[t].unref()}if(!d.supportsTypedArrays())return{};var wt=x.fromRotationTranslation(T.fromRotationX(S.PI_OVER_TWO)),Tt=new i,xt={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},bt="model/vnd.gltf.binary,model/vnd.gltf+json,model/gltf.binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01";te.prototype.getBuffer=function(e){return ae(this.buffers[e.buffer],e.byteOffset,e.byteLength)},te.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},te.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.buffersToCreate.length},te.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},te.prototype.finishedTextureCreation=function(){var e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},te.prototype.finishedEverythingButTextureCreation=function(){var e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.buffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return e&&t},te.prototype.finished=function(){return this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()},u(re.prototype,{gltf:{set:function(e){this._gltf=K(W(e))},get:function(){return this._gltf}},bgltf:{get:function(){return this._bgltf}}}),re.prototype.makeReady=function(e,t){this.gltf=e,this._bgltf=t;for(var i=this.modelsToLoad,r=i.length,n=0;r>n;++n){var o=i[n];o.isDestroyed()||ie(o,this)}this.modelsToLoad=void 0,this.ready=!0};var At={};u(oe.prototype,{gltf:{get:function(){return l(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._basePath}},boundingSphere:{get:function(){var e=x.getScale(this.modelMatrix,Tt),t=l(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;i.multiplyByScalar(e,t,e);var r=this._scaledBoundingSphere;return r.center=i.multiplyComponents(this._boundingSphere.center,e,r.center),r.radius=i.maximumComponent(e)*this._initialRadius,l(this._rtcCenter)&&i.add(this._rtcCenter,r.center,r.center),r}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return l(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}}});var Pt=Uint32Array.BYTES_PER_ELEMENT;oe.fromGltf=function(e){var t=e.url,i=new oe(e);return i.loadGltf(t,e),i},oe.prototype.loadGltf=function(e){var t=e.url,i=s(e.cacheKey,p(t));e=n(e),e.basePath=m(t),e.cacheKey=i,this._basePath=e.basePath,this._cacheKey=e.cacheKey;var r=new H(document.location.href),o=new H(this._basePath);this._baseUri=o.resolve(r),e.headers=l(e.headers)?n(e.headers):{},l(e.headers.Accept)||(e.headers.Accept=bt);var a=At[i];return l(a)?a.ready||(++a.count,a.modelsToLoad.push(this)):(a=new re({ready:!1}),a.count=1,a.modelsToLoad.push(this),ie(this,a),At[i]=a,_(t,e.headers).then(function(t){var i=new Uint8Array(t);if(se(i)){var r=le(i);0!==r.binaryOffset&&(i=i.subarray(r.binaryOffset)),a.makeReady(r.glTF,i)}else{var n=v(i),o=JSON.parse(n);e.gltfModifier&&(o=e.gltfModifier(o)),a.makeReady(o)}}).otherwise(he(this,"model",t))),this._readyPromise},oe._gltfCache=At,oe.prototype.getNode=function(e){var t=ue(this,"nodesByName",e);return l(t)?t.publicNode:void 0},oe.prototype.getMesh=function(e){return ue(this,"meshesByName",e)},oe.prototype.getMaterial=function(e){return ue(this,"materialsByName",e)};var It=new i,Mt=new i,Dt=new i,Rt=new A,Ot=new i,Nt=new i,Lt={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var r=new x;return function(){return x.getTranslation(e.model,Nt),i.add(Nt,t._rtcCenter,Nt),x.multiplyByPoint(e.view,Nt,Nt),x.setTranslation(e.modelView,Nt,r)}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTranposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};u(Je.prototype,{value:{get:function(){if(!l(this._value)){var e=this._model._rendererResources.textures[this._textureId];if(!l(e))return this._model._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),Je.prototype.clone=function(e,t){return e},Je.prototype.func=void 0;var Ft={};Ft[G.FLOAT]=qe,Ft[G.FLOAT_VEC2]=je,Ft[G.FLOAT_VEC3]=Ye,Ft[G.FLOAT_VEC4]=Xe,Ft[G.INT]=qe,Ft[G.INT_VEC2]=je,Ft[G.INT_VEC3]=Ye,Ft[G.INT_VEC4]=Xe,Ft[G.BOOL]=qe,Ft[G.BOOL_VEC2]=je,Ft[G.BOOL_VEC3]=Ye,Ft[G.BOOL_VEC4]=Xe,Ft[G.FLOAT_MAT2]=Ze,Ft[G.FLOAT_MAT3]=Ke,Ft[G.FLOAT_MAT4]=Qe,Ft[G.SAMPLER_2D]=$e;var Bt={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r)}},CESIUM_RTC_MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.setTranslation(r,t._rtcCenterEye,r)}},MODELVIEWPROJECTION:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r)}},MODELINVERSE:function(e,t,i){var r=new x;return function(){return x.inverse(i.computedMatrix,r)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r),x.inverse(r,n)}},MODELINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new T;return function(){return x.inverse(i.computedMatrix,r),x.getRotation(r,n),T.transpose(n,n)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new x,o=new T;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n),x.getRotation(n,o),T.transpose(o,o)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}},Vt=[],kt=new x,zt=new e,Ut=new i;return _t.prototype.release=function(){return 0===--this.count?(l(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],Ct(this),c(this)):void 0},_t.prototype.init=function(e){this.buffers=e.buffers,Et(this.buffers),this.vertexArrays=e.vertexArrays,Et(this.vertexArrays),this.programs=e.programs,Et(this.programs),this.pickPrograms=e.pickPrograms,Et(this.pickPrograms),this.textures=e.textures,Et(this.textures),this.samplers=e.samplers,Et(this.samplers),this.renderStates=e.renderStates,Et(this.renderStates)},_t.prototype.assign=function(e){e.buffers=this.buffers,refRessource(this.buffers),e.vertexArrays=this.vertexArrays,refRessource(this.vertexArrays),e.programs=this.programs,refRessource(this.programs),e.pickPrograms=this.pickPrograms,refRessource(this.pickPrograms),e.textures=this.textures,refRessource(this.textures),e.samplers=this.samplers,refRessource(this.samplers),e.renderStates=this.renderStates,refRessource(this.renderStates)},oe.prototype.update=function(e){if(e.mode===ee.SCENE3D){var t=e.context;if(this._defaultTexture=t.defaultTexture,this._state===xt.NEEDS_LOAD&&l(this.gltf)){var r,n=this.cacheKey;if(l(n)){t.cache.modelRendererResourceCache=s(t.cache.modelRendererResourceCache,{});var o=t.cache.modelRendererResourceCache;if(r=o[this.cacheKey],l(r)){if(!r.ready)return;++r.count,this._loadRendererResourcesFromCache=!0}else r=new _t(t,n),r.count=1,o[this.cacheKey]=r;this._cachedRendererResources=r}else r=new _t(t),r.count=1,this._cachedRendererResources=r;if(this._state=xt.LOADING,this._boundingSphere=ce(this.gltf),this._initialRadius=this._boundingSphere.radius,gt(this),this._state!==xt.FAILED){var a=this.gltf.extensions;l(a)&&l(a.CESIUM_RTC)&&(this._rtcCenter=i.fromArray(a.CESIUM_RTC.center),this._rtcCenterEye=new i),this._loadResources=new te,Te(this)}}var u=this._loadResources,c=this._incrementallyLoadTextures,h=!1;if(this._state===xt.LOADING&&(at(this,e),(u.finished()||c&&u.finishedEverythingButTextureCreation())&&(this._state=xt.LOADED,h=!0)),l(u)&&this._state===xt.LOADED&&(c&&!h&&at(this,e),u.finished())){this._loadResources=void 0;var d=this._rendererResources,p=this._cachedRendererResources;p.init(d),p.ready=!0,l(this._precreatedAttributes)&&(p.vertexArrays={}),this.releaseGltfJson&&vt(this)}var m=this.show&&0!==this.scale;if(m&&this._state===xt.LOADED||h){var f=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;var v=!x.equals(this._modelMatrix,this.modelMatrix)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale;if(v||h){x.clone(this.modelMatrix,this._modelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale;var g=ft(this,e),_=this._computedModelMatrix;x.multiplyByUniformScale(this.modelMatrix,g,_),x.multiplyTransformation(_,wt,_)}(f||v||h)&&(lt(this,v,h),this._dirty=!0,(f||h)&&ut(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,ct(this)),ht(this,t),dt(this),pt(this)}if(h){var y=this;return void e.afterRender.push(function(){y._ready=!0,y._readyPromise.resolve(y)})}if(m&&!this._ignoreCommands){var C,E,S=e.commandList,w=e.passes,T=this._nodeCommands,b=T.length;if(w.render)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.command);if(w.pick&&this.allowPicking)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.pickCommand)}}},oe.prototype.isDestroyed=function(){return!1},oe.prototype.destroy=function(){l(this._precreatedAttributes)&&yt(this._rendererResources.vertexArrays);var e=this._rendererResources;St(e.buffers),St(e.vertexArrays),St(e.programs),St(e.pickPrograms),St(e.textures),St(e.samplers),St(e.renderStates),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release();for(var t=this._pickIds,i=t.length,r=0;i>r;++r)t[r].destroy();return vt(this),c(this)},oe}),i("DataSources/ModelVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Scene/Model","../Scene/ModelAnimationLoop","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t,i){i.collectionChanged.addEventListener(c.prototype._onCollectionChanged,this),this._scene=t,this._primitives=t.primitives,this._entityCollection=i,this._modelHash={},this._entitiesToVisualize=new e,this._onCollectionChanged(i,i.values,[],[])}function h(e,t,r,n){var o=r[t.id];i(o)&&(n.removeAndDestroy(o.modelPrimitive),delete r[t.id])}function d(e,t){var r=t[e.id];i(r)&&(r.nodeTransformationsScratch={})}function p(e){console.error(e)}var m=1,f=0,v=!0,g=new o,_=new o;return c.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,r=this._modelHash,n=this._primitives,l=0,c=t.length;c>l;l++){var h,d,y=t[l],C=y._model,E=r[y.id],S=y.isShowing&&y.isAvailable(e)&&u.getValueOrDefault(C._show,e,!0);if(S&&(d=y._getModelMatrix(e,g),h=u.getValueOrUndefined(C._uri,e),S=i(d)&&i(h)),S){var w=i(E)?E.modelPrimitive:void 0;if(i(w)&&h===E.uri||(i(w)&&(n.removeAndDestroy(w),delete r[y.id]),w=a.fromGltf({url:h,incrementallyLoadTextures:u.getValueOrDefault(C._incrementallyLoadTextures,e,v)}),w.readyPromise.otherwise(p),w.id=y,n.add(w),E={modelPrimitive:w,uri:h,animationsRunning:!1,nodeTransformationsScratch:{},originalNodeMatrixHash:{}},r[y.id]=E),w.show=!0,w.scale=u.getValueOrDefault(C._scale,e,m),w.minimumPixelSize=u.getValueOrDefault(C._minimumPixelSize,e,f),w.maximumScale=u.getValueOrUndefined(C._maximumScale,e),w.modelMatrix=o.clone(d,w.modelMatrix),w.ready){var T=u.getValueOrDefault(C._runAnimations,e,!0);E.animationsRunning!==T&&(T?w.activeAnimations.addAll({loop:s.REPEAT}):w.activeAnimations.removeAll(),E.animationsRunning=T);var x=u.getValueOrUndefined(C._nodeTransformations,e,E.nodeTransformationsScratch);if(i(x))for(var b=E.originalNodeMatrixHash,A=Object.keys(x),P=0,I=A.length;I>P;++P){var M=A[P],D=x[M];if(i(D)){var R=w.getNode(M);if(i(R)){var O=b[M];i(O)||(O=R.matrix.clone(),b[M]=O);var N=o.fromTranslationRotationScale(D,_);R.matrix=o.multiply(O,N,N)}}}}}else i(E)&&(E.modelPrimitive.show=!1)}return!0},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(c.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,n=e.length-1;n>-1;n--)h(this,e[n],t,i);return r(this)},c.prototype.getBoundingSphere=function(e,r){var n=this._modelHash[e.id];if(!i(n))return l.FAILED;var o=n.modelPrimitive;return i(o)&&o.show?o.ready?(t.transform(o.boundingSphere,o.modelMatrix,r),l.DONE):l.PENDING:l.FAILED},c.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s=this._entitiesToVisualize,l=this._modelHash,u=this._primitives;for(o=t.length-1;o>-1;o--)a=t[o],i(a._model)&&i(a._position)&&s.set(a.id,a);for(o=n.length-1;o>-1;o--)a=n[o],i(a._model)&&i(a._position)?(d(a,l),s.set(a.id,a)):(h(this,a,l,u),s.remove(a.id));for(o=r.length-1;o>-1;o--)a=r[o],h(this,a,l,u),s.remove(a.id)},c}),i("Shaders/PolylineCommon",[],function(){"use strict";return"void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance = -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious) {\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\nif (czm_equalsEpsilon(normalize(previous.xyz - position.xyz), vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(normalize(next.xyz - position.xyz), vec3(0.0), czm_epsilon1) || clipped)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\nreturn vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n}\n"}),i("Shaders/PolylineFS",[],function(){"use strict";return"varying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n"}),i("Shaders/PolylineVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandWidthAndShow;\nattribute vec4 pickColor;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 czm_pickColor;\nvoid main()\n{\nfloat texCoord = texCoordExpandWidthAndShow.x;\nfloat expandDir = texCoordExpandWidthAndShow.y;\nfloat width = abs(texCoordExpandWidthAndShow.z) + 0.5;\nbool usePrev = texCoordExpandWidthAndShow.z < 0.0;\nfloat show = texCoordExpandWidthAndShow.w;\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nczm_pickColor = pickColor;\n}\n"}),i("Scene/Polyline",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/PolylinePipeline","./Material"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(o,a){o=r(o,r.EMPTY_OBJECT),this._show=r(o.show,!0),this._width=r(o.width,1),this._loop=r(o.loop,!1),this._material=o.material,n(this._material)||(this._material=u.fromType(u.ColorType,{color:new i(1,1,1,1)}));var c=o.positions;n(c)||(c=[]),this._positions=c,this._actualPositions=l.removeDuplicates(c),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=c.slice()),this._actualPositions.push(t.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=o.id;var h;n(a)&&(h=s.clone(a.modelMatrix)),this._modelMatrix=h,this._segments=l.wrapLongitude(this._actualPositions,h),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(g),this._polylineCollection=a,this._dirty=!1,this._pickId=void 0,this._boundingVolume=e.fromPoints(this._actualPositions),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new e}function h(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;n(i)&&(i._updatePolyline(e,t),e._dirty=!0)}var d=c.SHOW_INDEX=0,p=c.WIDTH_INDEX=1,m=c.POSITION_INDEX=2,f=c.MATERIAL_INDEX=3,v=c.POSITION_SIZE_INDEX=4,g=c.NUMBER_OF_PROPERTIES=5;return o(c.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,h(this,d))}},positions:{get:function(){return this._positions},set:function(i){var r=l.removeDuplicates(i);this._loop&&r.length>2&&(r===i&&(r=i.slice()),r.push(t.clone(r[0]))),(this._actualPositions.length!==r.length||this._actualPositions.length!==this._length)&&h(this,v),this._positions=i,this._actualPositions=r,this._length=r.length,this._boundingVolume=e.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),h(this,m),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,h(this,f))}},width:{get:function(){return this._width},set:function(e){var t=this._width;e!==t&&(this._width=e,h(this,p))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var i=this._actualPositions;e?i.length>2&&!t.equals(i[0],i[i.length-1])&&(i.length===this._positions.length&&(this._actualPositions=i=this._positions.slice()),i.push(t.clone(i[0]))):i.length>2&&t.equals(i[0],i[i.length-1])&&(i.length-1===this._positions.length?this._actualPositions=this._positions:i.pop()),this._loop=e,h(this,v)}}},id:{get:function(){return this._id},set:function(e){this._id=e,n(this._pickId)&&(this._pickId.object.id=e)}}}),c.prototype.update=function(){var t=s.IDENTITY;n(this._polylineCollection)&&(t=this._polylineCollection.modelMatrix);var i=this._segments.positions.length,r=this._segments.lengths,o=this._propertiesChanged[m]>0||this._propertiesChanged[v]>0;if((!s.equals(t,this._modelMatrix)||o)&&(this._segments=l.wrapLongitude(this._actualPositions,t),this._boundingVolumeWC=e.transform(this._boundingVolume,t,this._boundingVolumeWC)),this._modelMatrix=t,this._segments.positions.length!==i)h(this,v);else for(var a=r.length,u=0;a>u;++u)if(r[u]!==this._segments.lengths[u]){h(this,v);break}},c.prototype.getPickId=function(e){return n(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},c.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;g-1>t;++t)e[t]=0},c.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0},c}),i("Scene/PolylineCollection",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/Plane","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/PolylineCommon","../Shaders/PolylineFS","../Shaders/PolylineVS","./BlendingState","./Material","./Pass","./Polyline","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=a(e,a.EMPTY_OBJECT),this.modelMatrix=f.clone(a(e.modelMatrix,f.IDENTITY)),this._modelMatrix=f.clone(f.IDENTITY),this.debugShowBoundingVolume=a(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._pickCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(Q),this._polylines=[],this._polylineBuckets={},this._buffersUsage=[{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0}],this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._pickColorBuffer=void 0,this._texCoordExpandWidthAndShowBuffer=void 0}function O(t,i,r,n,o){for(var a=i.context,l=i.commandList,u=r.length,c=0,h=!0,d=t._vertexArrays,p=t.debugShowBoundingVolume,m=d.length,f=0;m>f;++f)for(var v=d[f],g=v.buckets,_=g.length,C=0;_>C;++C){for(var E,S,w,T=g[C],x=T.offset,b=o?T.bucket.shaderProgram:T.bucket.pickShaderProgram,A=T.bucket.polylines,P=A.length,M=0,R=0;P>R;++R){var O=A[R],N=F(O._material);if(N!==E){if(s(E)&&M>0){var L=S.isTranslucent();c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=L?t._translucentRS:t._opaqueRS,w.pass=L?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,x+=M,M=0,h=!0,l.push(w)}S=O._material,S.update(a),E=N}for(var B=O._locatorBuckets,V=B.length,k=0;V>k;++k){var z=B[k];z.locator===T&&(M+=z.count)}var U;i.mode===D.SCENE3D?U=O._boundingVolumeWC:i.mode===D.COLUMBUS_VIEW?U=O._boundingVolume2D:i.mode===D.SCENE2D?s(O._boundingVolume2D)&&(U=e.clone(O._boundingVolume2D,ee),U.center.x=0):s(O._boundingVolumeWC)&&s(O._boundingVolume2D)&&(U=e.union(O._boundingVolumeWC,O._boundingVolume2D,ee)),h?(h=!1,e.clone(U,$)):e.union(U,$,$)}s(E)&&M>0&&(c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=S.isTranslucent()?t._translucentRS:t._opaqueRS,w.pass=S.isTranslucent()?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,h=!0,l.push(w)),E=void 0}r.length=c}function N(e){for(var t=e._buffersUsage,i=!1,r=e._propertiesChanged,n=0;Q-2>n;++n){var o=t[n];r[n]?o.bufferUsage!==_.STREAM_DRAW?(i=!0,o.bufferUsage=_.STREAM_DRAW,o.frameCount=100):o.frameCount=100:o.bufferUsage!==_.STATIC_DRAW&&(0===o.frameCount?(i=!0,o.bufferUsage=_.STATIC_DRAW):o.frameCount--)}return i}function L(e,t,i){e._createVertexArray=!1,z(e),U(e),B(e);var r,n,a=[[]],l=a[0],u=[0],c=0,h=[[]],p=0,f=e._polylineBuckets;for(r in f)f.hasOwnProperty(r)&&(n=f[r],n.updateShader(t),p+=n.lengthOfPositions);if(p>0){var v,y=e._mode,C=new Float32Array(6*p*3),E=new Uint8Array(4*p),S=new Float32Array(4*p),T=0,x=0,b=0;for(r in f)if(f.hasOwnProperty(r)){n=f[r],n.write(C,E,S,T,x,b,t,i),y===D.MORPHING&&(s(v)||(v=new Float32Array(6*p*3)),n.writeForMorph(v,T));var A=n.lengthOfPositions;T+=6*A*3,x+=4*A,b+=4*A,c=n.updateIndices(a,u,h,c)}var P=e._buffersUsage[X].bufferUsage,I=e._buffersUsage[j].bufferUsage,M=e._buffersUsage[Y].bufferUsage,R=I===_.STREAM_DRAW||M===_.STREAM_DRAW?_.STREAM_DRAW:_.STATIC_DRAW;e._positionBuffer=g.createVertexBuffer({context:t,typedArray:C,usage:P});var O;s(v)&&(O=g.createVertexBuffer({context:t,typedArray:v,usage:P})),e._pickColorBuffer=g.createVertexBuffer({context:t,typedArray:E,usage:_.STATIC_DRAW}),e._texCoordExpandWidthAndShowBuffer=g.createVertexBuffer({context:t,typedArray:S,usage:R});for(var N=4*Uint8Array.BYTES_PER_ELEMENT,L=3*Float32Array.BYTES_PER_ELEMENT,F=4*Float32Array.BYTES_PER_ELEMENT,V=0,k=a.length,G=0;k>G;++G)if(l=a[G],l.length>0){var W=new Uint16Array(l),H=g.createIndexBuffer({context:t,typedArray:W,usage:_.STATIC_DRAW,indexDatatype:d.UNSIGNED_SHORT});V+=u[G];var q,Z,K,Q,$=6*(G*(L*m.SIXTY_FOUR_KILOBYTES)-V*L),ee=L+$,ie=L+ee,re=L+ie,ne=L+re,oe=L+ne,ae=G*(N*m.SIXTY_FOUR_KILOBYTES)-V*N,se=G*(F*m.SIXTY_FOUR_KILOBYTES)-V*F,le=[{index:J.position3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT, -offsetInBytes:$,strideInBytes:6*L},{index:J.position3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.position2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.texCoordExpandWidthAndShow,componentsPerAttribute:4,componentDatatype:o.FLOAT,vertexBuffer:e._texCoordExpandWidthAndShowBuffer,offsetInBytes:se},{index:J.pickColor,componentsPerAttribute:4,componentDatatype:o.UNSIGNED_BYTE,vertexBuffer:e._pickColorBuffer,offsetInBytes:ae,normalize:!0}];y===D.SCENE3D?(q=e._positionBuffer,Z="vertexBuffer",K=te,Q="value"):y===D.SCENE2D||y===D.COLUMBUS_VIEW?(q=te,Z="value",K=e._positionBuffer,Q="vertexBuffer"):(q=O,Z="vertexBuffer",K=e._positionBuffer,Q="vertexBuffer"),le[0][Z]=q,le[1][Z]=q,le[2][Q]=K,le[3][Q]=K,le[4][Z]=q,le[5][Z]=q,le[6][Q]=K,le[7][Q]=K,le[8][Z]=q,le[9][Z]=q,le[10][Q]=K,le[11][Q]=K;var ue=new w({context:t,attributes:le,indexBuffer:H});e._vertexArrays.push({va:ue,buckets:h[G]})}}}function F(e){var t=P._uniformList[e.type],i=t.length;ie.length=2*i;for(var r=0,n=0;i>n;++n){var o=t[n];ie[r]=o,ie[r+1]=e._uniforms[o](),r+=2}return e.type+":"+JSON.stringify(ie)}function B(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,o=n.length,a=0;o>a;++a){var l=n[a];if(l._actualPositions.length>1){l.update();var u=l.material,c=r[u.type];s(c)||(c=r[u.type]=new H(u,t,i)),c.addPolyline(l)}}}function V(e,t){var i=t.mode;e._mode===i&&f.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=f.clone(e.modelMatrix),e._createVertexArray=!0)}function k(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t=[],i=e._polylines.length,r=0,n=0;i>r;++r){var o=e._polylines[r];s(o)&&(o._index=n++,t.push(o))}e._polylines=t}}function z(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)if(s(t[r])){var n=t[r]._bucket;s(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function U(e){for(var t=e._vertexArrays.length,i=0;t>i;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function G(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)s(t[r])&&t[r]._destroy()}function W(e,t,i){this.count=e,this.offset=t,this.bucket=i}function H(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.pickShaderProgram=void 0,this.mode=t,this.modelMatrix=i}function q(e){return t.dot(t.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(v.ORIGIN_ZX_PLANE)===p.INTERSECTING}var j=M.SHOW_INDEX,Y=M.WIDTH_INDEX,X=M.POSITION_INDEX,Z=M.MATERIAL_INDEX,K=M.POSITION_SIZE_INDEX,Q=M.NUMBER_OF_PROPERTIES,J={texCoordExpandWidthAndShow:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12,pickColor:13};l(R.prototype,{length:{get:function(){return k(this),this._polylines.length}}}),R.prototype.add=function(e){var t=new M(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,t},R.prototype.remove=function(e){if(this.contains(e)){if(this._polylines[e._index]=void 0,this._polylinesRemoved=!0,this._createVertexArray=!0,s(e._bucket)){var t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy(),t.pickShaderProgram=t.pickShaderProgram&&t.pickShaderProgram.destroy()}return e._destroy(),!0}return!1},R.prototype.removeAll=function(){z(this),G(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},R.prototype.contains=function(e){return s(e)&&e._polylineCollection===this},R.prototype.get=function(e){return k(this),this._polylines[e]},R.prototype.update=function(e,t){if(k(this),0!==this._polylines.length){V(this,e);var i,r=e.context,n=e.mapProjection,o=this._propertiesChanged;if(this._createVertexArray||N(this))L(this,r,n);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==D.SCENE3D)for(var l=a.length,u=0;l>u;++u)i=a[u],i.update();if(o[K]||o[Z])L(this,r,n);else for(var c=a.length,h=this._polylineBuckets,d=0;c>d;++d){i=a[d],o=i._propertiesChanged;var p=i._bucket,m=0;for(var v in h)if(h.hasOwnProperty(v)){if(h[v]===p){(o[X]||o[j]||o[Y])&&p.writeUpdate(m,i,this._positionBuffer,this._texCoordExpandWidthAndShowBuffer,n);break}m+=h[v].lengthOfPositions}i._clean()}a.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(var g=0;Q>g;++g)o[g]=0;var _=f.IDENTITY;e.mode===D.SCENE3D&&(_=this.modelMatrix);var y=e.passes,E=0!==e.morphTime;if(s(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===E||(this._opaqueRS=C.fromCache({depthMask:E,depthTest:{enabled:E}})),s(this._translucentRS)&&this._translucentRS.depthTest.enabled===E||(this._translucentRS=C.fromCache({blending:A.ALPHA_BLEND,depthMask:!E,depthTest:{enabled:E}})),y.render){var S=this._colorCommands;O(this,e,S,_,!0)}if(y.pick){var w=this._pickCommands;O(this,e,w,_,!1)}}};var $=new e,ee=new e;R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return U(this),z(this),G(this),u(this)};var te=[0,0,0],ie=[];R.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},H.prototype.addPolyline=function(e){var t=this.polylines;t.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},H.prototype.updateShader=function(e){if(!s(this.shaderProgram)){var t=new S({sources:[T,b]}),i=new S({sources:[this.material.shaderSource,x]}),r=new S({sources:i.sources,pickColorQualifier:"varying"});this.shaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:J}),this.pickShaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:r,attributeLocations:J})}},H.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===D.SCENE3D||!q(e))return t=e._actualPositions.length,4*t-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;t>n;++n)i+=4*r[n]-4;return i};var re=new t,ne=new t,oe=new t,ae=new t;H.prototype.write=function(e,i,r,o,a,s,l,u){for(var c=this.mode,d=this.polylines,p=d.length,m=0;p>m;++m)for(var f,v=d[m],g=v.width,_=v.show&&g>0,y=this.getSegments(v,u),C=y.positions,E=y.lengths,S=C.length,w=v.getPickId(l).color,T=0,x=0,b=0;S>b;++b){0===b?v._loop?f=C[S-2]:(f=ae,t.subtract(C[0],C[1],f),t.add(C[0],f,f)):f=C[b-1],ne.x=f.x,ne.y=f.y,ne.z=c!==D.SCENE2D?f.z:0,f=C[b],re.x=f.x,re.y=f.y,re.z=c!==D.SCENE2D?f.z:0,b===S-1?v._loop?f=C[1]:(f=ae,t.subtract(C[S-1],C[S-2],f),t.add(C[S-1],f,f)):f=C[b+1],oe.x=f.x,oe.y=f.y,oe.z=c!==D.SCENE2D?f.z:0;var A=E[T];b===x+A&&(x+=A,++T);for(var P=b-x===0,I=b===x+E[T]-1,M=P?2:0,R=I?2:4,O=M;R>O;++O){h.writeElements(re,e,o),h.writeElements(ne,e,o+6),h.writeElements(oe,e,o+12),i[a]=n.floatToByte(w.red),i[a+1]=n.floatToByte(w.green),i[a+2]=n.floatToByte(w.blue),i[a+3]=n.floatToByte(w.alpha);var N=0>O-2?-1:1;r[s]=b/(S-1),r[s+1]=2*(O%2)-1,r[s+2]=N*g,r[s+3]=_,o+=18,a+=4,s+=4}}};var se=new t,le=new t,ue=new t,ce=new t;H.prototype.writeForMorph=function(e,i){for(var r=this.modelMatrix,n=this.polylines,o=n.length,a=0;o>a;++a)for(var s=n[a],l=s._segments.positions,u=s._segments.lengths,c=l.length,d=0,p=0,m=0;c>m;++m){var v;0===m?s._loop?v=l[c-2]:(v=ce,t.subtract(l[0],l[1],v),t.add(l[0],v,v)):v=l[m-1],v=f.multiplyByPoint(r,v,le);var g,_=f.multiplyByPoint(r,l[m],se);m===c-1?s._loop?g=l[1]:(g=ce,t.subtract(l[c-1],l[c-2],g),t.add(l[c-1],g,g)):g=l[m+1],g=f.multiplyByPoint(r,g,ue);var y=u[d];m===p+y&&(p+=y,++d);for(var C=m-p===0,E=m===p+u[d]-1,S=C?2:0,w=E?2:4,T=S;w>T;++T)h.writeElements(_,e,i),h.writeElements(v,e,i+6),h.writeElements(g,e,i+12),i+=18}};var he=new Array(1);H.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,o=new W(0,r,this);i[n].push(o);var a=0,s=e[e.length-1],l=0;s.length>0&&(l=s[s.length-1]+1);for(var u=this.polylines,c=u.length,h=0;c>h;++h){var d=u[h];d._locatorBuckets=[];var p;if(this.mode===D.SCENE3D){p=he;var f=d._actualPositions.length;if(!(f>0))continue;p[0]=f}else p=d._segments.lengths;var v=p.length;if(v>0){for(var g=0,_=0;v>_;++_)for(var y=p[_]-1,C=0;y>C;++C)l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(d._locatorBuckets.push({locator:o,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,o.count=a,a=0,r=0,o=new W(0,0,this),i[++n]=[o]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,a+=6,r+=6,l+=4;d._locatorBuckets.push({locator:o,count:g}),l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(t.push(0),s=[],e.push(s),l=0,o.count=a,r=0,a=0,o=new W(0,0,this),i[++n]=[o])}d._clean()}return o.count=a,r},H.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;r>n;++n){var o=t[n];if(o===e)break;i+=o._actualLength}return i};var de={positions:void 0,lengths:void 0},pe=new Array(1),me=new t,fe=new r;H.prototype.getSegments=function(i,r){var n=i._actualPositions;if(this.mode===D.SCENE3D)return pe[0]=n.length,de.positions=n,de.lengths=pe,de;q(i)&&(n=i._segments.positions);for(var o,a=r.ellipsoid,s=[],l=this.modelMatrix,u=n.length,c=me,h=0;u>h;++h)o=n[h],c=f.multiplyByPoint(l,o,c),s.push(r.project(a.cartesianToCartographic(c,fe)));if(s.length>0){i._boundingVolume2D=e.fromPoints(s,i._boundingVolume2D);var d=i._boundingVolume2D.center;i._boundingVolume2D.center=new t(d.z,d.x,d.y)}return de.positions=s,de.lengths=i._segments.lengths,de};var ve,ge;return H.prototype.writeUpdate=function(e,i,r,n,o){var a=this.mode,l=i._actualLength;if(l){e+=this.getPolylineStartIndex(i);var u=ve,c=ge,d=6*l*3;!s(u)||u.lengthd&&(u=new Float32Array(u.buffer,0,d),c=new Float32Array(c.buffer,0,4*l));var p,m=0,f=0,v=this.getSegments(i,o),g=v.positions,_=v.lengths,y=0,C=0,E=i.width,S=i.show&&E>0;l=g.length;for(var w=0;l>w;++w){0===w?i._loop?p=g[l-2]:(p=ae,t.subtract(g[0],g[1],p),t.add(g[0],p,p)):p=g[w-1],ne.x=p.x,ne.y=p.y,ne.z=a!==D.SCENE2D?p.z:0,p=g[w],re.x=p.x,re.y=p.y,re.z=a!==D.SCENE2D?p.z:0,w===l-1?i._loop?p=g[1]:(p=ae,t.subtract(g[l-1],g[l-2],p),t.add(g[l-1],p,p)):p=g[w+1],oe.x=p.x,oe.y=p.y,oe.z=a!==D.SCENE2D?p.z:0;var T=_[y];w===C+T&&(C+=T,++y);for(var x=w-C===0,b=w===C+_[y]-1,A=x?2:0,P=b?2:4,I=A;P>I;++I){h.writeElements(re,u,m),h.writeElements(ne,u,m+6),h.writeElements(oe,u,m+12);var M=0>I-2?-1:1;c[f]=w/(l-1),c[f+1]=2*(I%2)-1,c[f+2]=M*E,c[f+3]=S,m+=18,f+=4}}r.copyFromArrayView(u,18*Float32Array.BYTES_PER_ELEMENT*e),n.copyFromArrayView(c,4*Float32Array.BYTES_PER_ELEMENT*e)}},R}),i("DataSources/ScaledPositionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ReferenceFrame","./Property"],function(e,t,i,r,n,o,a){"use strict";function s(e){this._definitionChanged=new n,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}return t(s.prototype,{isConstant:{get:function(){return a.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return e(this._value)?this._value.referenceFrame:o.FIXED}}}),s.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},s.prototype.setValue=function(t){this._value!==t&&(this._value=t,e(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),e(t)&&(this._removeSubscription=t.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},s.prototype.getValueInReferenceFrame=function(t,i,n){return e(this._value)?(n=this._value.getValueInReferenceFrame(t,i,n),e(n)?r.WGS84.scaleToGeodeticSurface(n,n):void 0):void 0},s.prototype.equals=function(e){return this===e||e instanceof s&&this._value===e._value},s.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},s}),i("DataSources/PathVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/JulianDate","../Core/Matrix3","../Core/Matrix4","../Core/ReferenceFrame","../Core/TimeInterval","../Core/Transforms","../Scene/PolylineCollection","../Scene/SceneMode","./CompositePositionProperty","./ConstantPositionProperty","./MaterialProperty","./Property","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionPositionProperty"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function S(e,t,r,n,a,s,l,u,c){var h,d=u;h=e.getValueInReferenceFrame(t,s,c[d]),i(h)&&(c[d++]=h);for(var p,m,f,v=!i(a)||o.lessThanOrEquals(a,t)||o.greaterThanOrEquals(a,r),g=0,_=n.length,y=n[g],C=r,E=!1;_>g;){if(!v&&o.greaterThanOrEquals(y,a)&&(h=e.getValueInReferenceFrame(a,s,c[d]),i(h)&&(c[d++]=h),v=!0),o.greaterThan(y,t)&&o.lessThan(y,C)&&!y.equals(a)&&(h=e.getValueInReferenceFrame(y,s,c[d]),i(h)&&(c[d++]=h)),_-1>g){if(l>0&&!E){var S=n[g+1],w=o.secondsDifference(S,y);E=w>l,E&&(p=Math.ceil(w/l),m=0,f=w/Math.max(p,2),p=Math.max(p-1,1))}if(E&&p>m){y=o.addSeconds(y,f,new o),m++;continue}}E=!1,g++,y=n[g]}return h=e.getValueInReferenceFrame(r,s,c[d]),i(h)&&(c[d++]=h),d}function w(e,t,r,n,a,s,l,u){for(var c,h=0,d=l,p=t,m=Math.max(s,60),f=!i(n)||o.lessThanOrEquals(n,t)||o.greaterThanOrEquals(n,r);o.lessThan(p,r);)!f&&o.greaterThanOrEquals(p,n)&&(f=!0,c=e.getValueInReferenceFrame(n,a,u[d]),i(c)&&(u[d]=c,d++)),c=e.getValueInReferenceFrame(p,a,u[d]),i(c)&&(u[d]=c,d++),h++,p=o.addSeconds(t,m*h,new o);return c=e.getValueInReferenceFrame(r,a,u[d]),i(c)&&(u[d]=c,d++),d}function T(e,t,r,n,a,s,l,c){L.start=t,L.stop=r;for(var h=l,d=e.intervals,p=0;p0){var T=S.pop();c=this._polylineCollection.get(T),t.index=T}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=a,t.polyline=c}var x=v.getValueOrDefault(s._resolution,e,D);c.show=!0,c.positions=P(l,r,n,e,this._referenceFrame,x,c.positions.slice()),c.material=f.getValue(e,s._material,c.material),c.width=v.getValueOrDefault(s._width,e,R)},I.prototype.removeObject=function(e){var t=e.polyline;i(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,e.index=void 0)},I.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),r(this)},M.prototype.update=function(e){var t=this._updaters;for(var r in t)t.hasOwnProperty(r)&&t[r].update(e);for(var n=this._items.values,o=0,a=n.length;a>o;o++){var s=n[o],u=s.entity,c=u._position,h=s.updater,p=l.FIXED;this._scene.mode===d.SCENE3D&&(p=c.referenceFrame);var m=this._updaters[p];h===m&&i(m)?m.updateObject(e,s):(i(h)&&h.removeObject(s),i(m)||(m=new I(this._scene,p),m.update(e),this._updaters[p]=m),s.updater=m,i(m)&&m.updateObject(e,s))}return!0},M.prototype.isDestroyed=function(){return!1},M.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(M.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return r(this)},M.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],i(a._path)&&i(a._position)&&l.set(a.id,new E(a));for(o=n.length-1;o>-1;o--)a=n[o],i(a._path)&&i(a._position)?l.contains(a.id)||l.set(a.id,new E(a)):(s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id)));for(o=r.length-1;o>-1;o--)a=r[o],s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id))},M._subSample=P,M}),i("Shaders/PointPrimitiveCollectionFS",[],function(){"use strict";return"varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\nif (color.a < 0.005)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n"}),i("Shaders/PointPrimitiveCollectionVS",[],function(){"use strict";return"uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_resolutionScale;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\n#ifdef RENDER_FOR_PICK\ncolor = vec4(0.0);\noutlineColor = vec4(0.0);\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\n#else\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\n#endif\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\n#ifdef RENDER_FOR_PICK\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\n#endif\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_color = color;\nv_color.a *= translucency;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#endif\n}\n"}),i("Scene/PointPrimitive",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/NearFarScalar","./SceneMode","./SceneTransforms"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i){e=n(e,n.EMPTY_OBJECT),this._show=n(e.show,!0),this._position=t.clone(n(e.position,t.ZERO)),this._actualPosition=t.clone(this._position),this._color=r.clone(n(e.color,r.WHITE)),this._outlineColor=r.clone(n(e.outlineColor,r.TRANSPARENT)),this._outlineWidth=n(e.outlineWidth,0),this._pixelSize=n(e.pixelSize,10),this._scaleByDistance=e.scaleByDistance,this._translucencyByDistance=e.translucencyByDistance,this._id=e.id,this._collection=n(e.collection,i),this._pickId=void 0,this._pointPrimitiveCollection=i,this._dirty=!1,this._index=-1}function p(e,t){var i=e._pointPrimitiveCollection;o(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}var m=d.SHOW_INDEX=0,f=d.POSITION_INDEX=1,v=d.COLOR_INDEX=2,g=d.OUTLINE_COLOR_INDEX=3,_=d.OUTLINE_WIDTH_INDEX=4,y=d.PIXEL_SIZE_INDEX=5,C=d.SCALE_BY_DISTANCE_INDEX=6,E=d.TRANSLUCENCY_BY_DISTANCE_INDEX=7;d.NUMBER_OF_PROPERTIES=8,a(d.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,p(this,m))}},position:{get:function(){return this._position},set:function(e){var i=this._position;t.equals(i,e)||(t.clone(e,i),t.clone(e,this._actualPosition),p(this,f))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;u.equals(t,e)||(this._scaleByDistance=u.clone(e,t),p(this,C))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;u.equals(t,e)||(this._translucencyByDistance=u.clone(e,t),p(this,E))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,p(this,y))}},color:{get:function(){return this._color},set:function(e){var t=this._color;r.equals(t,e)||(r.clone(e,t),p(this,v))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;r.equals(t,e)||(r.clone(e,t),p(this,g))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this,_))}},id:{get:function(){return this._id},set:function(e){this._id=e,o(this._pickId)&&(this._pickId.object.id=e)}}}),d.prototype.getPickId=function(e){return o(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},d.prototype._getActualPosition=function(){return this._actualPosition},d.prototype._setActualPosition=function(e){t.clone(e,this._actualPosition),p(this,f)};var S=new i;d._computeActualPosition=function(e,t,i){return t.mode===c.SCENE3D?e:(l.multiplyByPoint(i,e,S),h.computeActualWgs84Position(t,S))};var w=new l,T=new i;return d._computeScreenSpacePosition=function(e,t,r,n){var o=r.camera,a=o.viewMatrix,s=o.frustum.projectionMatrix,u=l.multiplyTransformation(a,e,w),c=l.multiplyByVector(u,i.fromElements(t.x,t.y,t.z,1,T),T),d=l.multiplyByVector(s,c,T),p=h.clipToGLWindowCoordinates(r,d,n);return p},d.prototype.computeScreenSpacePosition=function(t,i){var r=this._pointPrimitiveCollection;o(i)||(i=new e);var n=r.modelMatrix,a=d._computeScreenSpacePosition(n,this._actualPosition,t,i);return a.y=t.canvas.clientHeight-a.y,a},d.prototype.equals=function(e){return this===e||o(e)&&this._id===e._id&&t.equals(this._position,e._position)&&r.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&r.equals(this._outlineColor,e._outlineColor)&&u.equals(this._scaleByDistance,e._scaleByDistance)&&u.equals(this._translucencyByDistance,e._translucencyByDistance)},d.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0},d}),i("Scene/PointPrimitiveCollection",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArrayFacade","../Shaders/PointPrimitiveCollectionFS","../Shaders/PointPrimitiveCollectionVS","./BlendingState","./Pass","./PointPrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(t){t=o(t,o.EMPTY_OBJECT),this._sp=void 0,this._rs=void 0,this._vaf=void 0,this._spPick=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._compiledShaderScaleByDistancePick=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistancePick=!1,this._propertiesChanged=new Uint32Array(Y),this._maxPixelSize=1,this._baseVolume=new e,this._baseVolumeWC=new e,this._baseVolume2D=new e,this._boundingVolume=new e,this._boundingVolumeDirty=!1,this._colorCommands=[],this._pickCommands=[],this.modelMatrix=d.clone(o(t.modelMatrix,d.IDENTITY)),this._modelMatrix=d.clone(d.IDENTITY),this.debugShowBoundingVolume=o(t.debugShowBoundingVolume,!1),this._mode=b.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW];var i=this;this._uniforms={u_maxTotalPointSize:function(){return i._maxTotalPointSize}}}function P(e){for(var t=e.length,i=0;t>i;++i)e[i]&&e[i]._destroy()}function I(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,o=0;r>n;++n){var a=i[n];a&&(a._index=o++,t.push(a))}e._pointPrimitives=t}}function M(e,t,i){return new C(e,[{index:X.positionHighAndSize,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.positionLowAndShow,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.compressedAttribute0,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[U]},{index:X.compressedAttribute1,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[j]},{index:X.scaleByDistance,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[q]}],t)}function D(t,i,r,n){var o=n._index,a=n._getActualPosition();t._mode===b.SCENE3D&&(e.expand(t._baseVolume,a,t._baseVolume),t._boundingVolumeDirty=!0),c.fromCartesian(a,Z);var s=n.pixelSize,l=n.outlineWidth;t._maxPixelSize=Math.max(t._maxPixelSize,s+l);var u=r[X.positionHighAndSize],h=Z.high;u(o,h.x,h.y,h.z,s);var d=r[X.positionLowAndOutline],p=Z.low;d(o,p.x,p.y,p.z,l)}function R(e,t,i,n){var o=n._index,a=n.color,s=n.getPickId(t).color,l=n.outlineColor,u=r.floatToByte(a.red),c=r.floatToByte(a.green),h=r.floatToByte(a.blue),d=u*K+c*Q+h;u=r.floatToByte(l.red),c=r.floatToByte(l.green),h=r.floatToByte(l.blue);var p=u*K+c*Q+h;u=r.floatToByte(s.red),c=r.floatToByte(s.green),h=r.floatToByte(s.blue);var m=u*K+c*Q+h,f=r.floatToByte(a.alpha)*K+r.floatToByte(l.alpha)*Q+r.floatToByte(s.alpha),v=i[X.compressedAttribute0];v(o,d,p,m,f)}function O(e,t,i,r){var n=r._index,o=0,s=1,l=1,u=1,c=r.translucencyByDistance;a(c)&&(o=c.near,s=c.nearValue,l=c.far,u=c.farValue,(1!==s||1!==u)&&(e._shaderTranslucencyByDistance=!0));var d=r.show;0===r.color.alpha&&0===r.outlineColor.alpha&&(d=!1),s=h.clamp(s,0,1),s=1===s?255:255*s|0;var p=(d?1:0)*Q+s;u=h.clamp(u,0,1),u=1===u?255:255*u|0;var m=u,f=i[X.compressedAttribute1];f(n,p,m,o,l)}function N(e,t,i,r){var n=r._index,o=i[X.scaleByDistance],s=0,l=1,u=1,c=1,h=r.scaleByDistance;a(h)&&(s=h.near,l=h.nearValue,u=h.far,c=h.farValue,(1!==l||1!==c)&&(e._shaderScaleByDistance=!0)),o(n,s,l,u,c)}function L(e,t,i,r){D(e,t,i,r),R(e,t,i,r),O(e,t,i,r),N(e,t,i,r)}function F(t,i,r,n,o,s){var l;n.mode===b.SCENE3D?(l=t._baseVolume,t._boundingVolumeDirty=!0):l=t._baseVolume2D;for(var u=[],c=0;r>c;++c){var h=i[c],d=h.position,p=x._computeActualPosition(d,n,o);a(p)&&(h._setActualPosition(p),s?u.push(p):e.expand(l,p,l))}s&&e.fromPoints(u,l)}function B(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==b.SCENE3D&&!d.equals(o,e.modelMatrix)?(e._mode=i,d.clone(e.modelMatrix,o),e._createVertexArray=!0,(i===b.SCENE3D||i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,r,r.length,t,o,!0)):i===b.MORPHING?F(e,r,r.length,t,o,!0):(i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,n,e._pointPrimitivesToUpdateIndex,t,o,!1); +var R=s(D,C[D]);I=D.toLowerCase(),M||R!==i.SAMPLER_2D||(M=!0),P[I]={type:R}}if(t(l))for(var O in l)l.hasOwnProperty(O)&&(P[O]=l[O]);var N={};for(var L in P)if(P.hasOwnProperty(L)){var F=P[L];N["u_"+L]=L;var B=t(F.count)?"["+F.count+"]":"";F.type!==i.FLOAT_MAT3&&F.type!==i.FLOAT_MAT4||F.useInFragment?(S+="uniform "+r(F.type)+" u_"+L+B+";\n",delete F.useInFragment):E+="uniform "+r(F.type)+" u_"+L+B+";\n"}var V="";y&&(V+=" mat4 skinMat = a_weight.x * u_jointMatrix[int(a_joint.x)];\n",V+=" skinMat += a_weight.y * u_jointMatrix[int(a_joint.y)];\n",V+=" skinMat += a_weight.z * u_jointMatrix[int(a_joint.z)];\n",V+=" skinMat += a_weight.w * u_jointMatrix[int(a_joint.w)];\n");var k={a_position:"position"};P.position={semantic:"POSITION",type:i.FLOAT_VEC3},E+="attribute vec3 a_position;\n",E+="varying vec3 v_positionEC;\n",V+=y?" vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);\n":" vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n",V+=" v_positionEC = pos.xyz;\n",V+=" gl_Position = u_projectionMatrix * pos;\n",S+="varying vec3 v_positionEC;\n",A&&(k.a_normal="normal",P.normal={semantic:"NORMAL",type:i.FLOAT_VEC3},E+="attribute vec3 a_normal;\n",E+="varying vec3 v_normal;\n",V+=y?" v_normal = u_normalMatrix * mat3(skinMat) * a_normal;\n":" v_normal = u_normalMatrix * a_normal;\n",S+="varying vec3 v_normal;\n");var z;M&&(k.a_texcoord_0="texcoord_0",P.texcoord_0={semantic:"TEXCOORD_0",type:i.FLOAT_VEC2},z="v_texcoord_0",E+="attribute vec2 a_texcoord_0;\n",E+="varying vec2 "+z+";\n",V+=" "+z+" = a_texcoord_0;\n",S+="varying vec2 "+z+";\n"),y&&(k.a_joint="joint",P.joint={semantic:"JOINT",type:i.FLOAT_VEC4},k.a_weight="weight",P.weight={semantic:"WEIGHT",type:i.FLOAT_VEC4},E+="attribute vec4 a_joint;\n",E+="attribute vec4 a_weight;\n");var U=A&&("BLINN"===g||"PHONG"===g)&&t(P.specular)&&t(P.shininess),G=!1,W=!1,H="";for(var q in u)if(u.hasOwnProperty(q)){var j=u[q],Y=j.type.toLowerCase(),X=j.baseName;H+=" {\n";var Z,K,Q="u_"+X+"Color";"ambient"===Y?(W=!0,H+=" ambientLight += "+Q+";\n"):A&&(G=!0,Z="v_"+X+"Direction",K="v_"+X+"Position","point"!==Y&&(E+="varying vec3 "+Z+";\n",S+="varying vec3 "+Z+";\n",V+=" "+Z+" = mat3(u_"+X+"Transform) * vec3(0.,0.,1.);\n","directional"===Y&&(H+=" vec3 l = normalize("+Z+");\n")),"directional"!==Y?(E+="varying vec3 "+K+";\n",S+="varying vec3 "+K+";\n",V+=" "+K+" = u_"+X+"Transform[3].xyz;\n",H+=" vec3 VP = "+K+" - v_positionEC;\n",H+=" vec3 l = normalize(VP);\n",H+=" float range = length(VP);\n",H+=" float attenuation = 1.0 / (u_"+X+"Attenuation.x + ",H+="(u_"+X+"Attenuation.y * range) + ",H+="(u_"+X+"Attenuation.z * range * range));\n"):H+=" float attenuation = 1.0;\n","spot"===Y&&(H+=" float spotDot = dot(l, normalize("+Z+"));\n",H+=" if (spotDot < cos(u_"+X+"FallOff.x * 0.5))\n",H+=" {\n",H+=" attenuation = 0.0;\n",H+=" }\n",H+=" else\n",H+=" {\n",H+=" attenuation *= max(0.0, pow(spotDot, u_"+X+"FallOff.y));\n",H+=" }\n"),H+=" diffuseLight += "+Q+"* max(dot(normal,l), 0.) * attenuation;\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n"),H+=" specularLight += "+Q+" * specularIntensity;\n")),H+=" }\n"}W||(H+=" ambientLight += vec3(0.2, 0.2, 0.2);\n"),G||"CONSTANT"===g||(H+=" vec3 l = normalize(czm_sunDirectionEC);\n",H+=" diffuseLight += vec3(1.0, 1.0, 1.0) * max(dot(normal,l), 0.);\n",U&&("BLINN"===g?(H+=" vec3 h = normalize(l + viewDir);\n",H+=" float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n"):(H+=" vec3 reflectDir = reflect(-l, normal);\n",H+=" float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n"),H+=" specularLight += vec3(1.0, 1.0, 1.0) * specularIntensity;\n")),E+="void main(void) {\n",E+=V,E+="}\n",S+="void main(void) {\n";var J=" vec3 color = vec3(0.0, 0.0, 0.0);\n";A&&(S+=" vec3 normal = normalize(v_normal);\n",a.doubleSided&&(S+=" if (gl_FrontFacing == false)\n",S+=" {\n",S+=" normal = -normal;\n",S+=" }\n"));var $;"CONSTANT"!==g?(t(P.diffuse)&&(S+=P.diffuse.type===i.SAMPLER_2D?" vec4 diffuse = texture2D(u_diffuse, "+z+");\n":" vec4 diffuse = u_diffuse;\n",S+=" vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += diffuse.rgb * diffuseLight;\n"),U&&(S+=P.specular.type===i.SAMPLER_2D?" vec3 specular = texture2D(u_specular, "+z+").rgb;\n":" vec3 specular = u_specular.rgb;\n",S+=" vec3 specularLight = vec3(0.0, 0.0, 0.0);\n",J+=" color += specular * specularLight;\n"),$=t(P.transparency)?" gl_FragColor = vec4(color * diffuse.a, diffuse.a * u_transparency);\n":" gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n"):$=t(P.transparency)?" gl_FragColor = vec4(color, u_transparency);\n":" gl_FragColor = vec4(color, 1.0);\n",t(P.emission)&&(S+=P.emission.type===i.SAMPLER_2D?" vec3 emission = texture2D(u_emission, "+z+").rgb;\n":" vec3 emission = u_emission.rgb;\n",J+=" color += emission;\n"),(t(P.ambient)||"CONSTANT"!==g)&&(S+=t(P.ambient)?P.ambient.type===i.SAMPLER_2D?" vec3 ambient = texture2D(u_ambient, "+z+").rgb;\n":" vec3 ambient = u_ambient.rgb;\n":" vec3 ambient = diffuse.rgb;\n",J+=" color += ambient * ambientLight;\n"),S+=" vec3 viewDir = -normalize(v_positionEC);\n",S+=" vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n",S+=H,S+=J,S+=$,S+="}\n";var ee;ee=a.transparent?{enable:[i.DEPTH_TEST,i.BLEND],depthMask:!1,functions:{blendEquationSeparate:[i.FUNC_ADD,i.FUNC_ADD],blendFuncSeparate:[i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA]}}:a.doubleSided?{enable:[i.DEPTH_TEST]}:{enable:[i.CULL_FACE,i.DEPTH_TEST]},m[w]={attributes:k,parameters:P,program:b,states:ee,uniforms:N},f[T]={type:i.VERTEX_SHADER,uri:"",extras:{source:E}},f[x]={type:i.FRAGMENT_SHADER,uri:"",extras:{source:S}};var te=Object.keys(k);return v[b]={attributes:te,fragmentShader:x,vertexShader:T},w}function s(e,r){var n;switch(n=t(r.value)?r.value:r,e){case"ambient":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"diffuse":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"emission":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"specular":return n instanceof String||"string"==typeof n?i.SAMPLER_2D:i.FLOAT_VEC4;case"shininess":return i.FLOAT;case"transparency":return i.FLOAT;case"transparent":return i.BOOL;case"doubleSided":return i.BOOL}}function l(t){var i="";i+="technique:"+t.technique+";";for(var r=t.values,n=Object.keys(r).sort(),o=n.length,a=0;o>a;++a){var l=n[a];r.hasOwnProperty(l)&&"transparent"!==l&&"doubleSided"!==l&&(i+=l+":"+s(l,r[l]),i+=";")}var u=e(t.doubleSided,!1);i+=u.toString()+";";var c=e(t.transparent,!1);i+=c.toString()+";";var h=e(t.jointCount,0);return i+=h.toString()+";"}function u(e){if(t(e)){var i=!1,r=e.extensionsUsed;if(t(r))for(var o=r.length,s=0;o>s;++s)if("KHR_materials_common"===r[s]){i=!0,r.splice(s,1);break}if(i){t(e.programs)||(e.programs={}),t(e.shaders)||(e.shaders={}),t(e.techniques)||(e.techniques={});var u=n(e),c={},h=e.materials;for(var d in h)if(h.hasOwnProperty(d)){var p=h[d];if(t(p.extensions)&&t(p.extensions.KHR_materials_common)){var m=p.extensions.KHR_materials_common,f=l(m),v=c[f];t(v)||(v=a(e,m,u),c[f]=v),p.values={};var g=m.values;for(var _ in g)if(g.hasOwnProperty(_)){var y=g[_];t(y.value)?p.values[_]=y.value:p.values[_]=y}p.technique=v,delete p.extensions.KHR_materials_common}}t(e.extensions)&&delete e.extensions.KHR_materials_common}return e}}var c=0,h=0,d=0,p=0;return u}),i("Scene/ModelMesh",["../Core/defineProperties"],function(e){"use strict";function t(e,t,i){for(var r=[],n=e.primitives,o=n.length,a=0;o>a;++a){var s=n[a];r[a]=t[s.material]}this._name=e.name,this._materials=r,this._id=i}return e(t.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},materials:{get:function(){return this._materials}}}),t}),i("Scene/ModelNode",["../Core/defaultValue","../Core/defineProperties","../Core/Matrix4"],function(e,t,i){"use strict";function r(e,t,r,n,o){this._model=e,this._runtimeNode=r,this._name=t.name,this._id=n,this.useMatrix=!1,this._show=!0,this._matrix=i.clone(o)}return t(r.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,this._model._perNodeShowDirty=!0)}},matrix:{get:function(){return this._matrix},set:function(e){this._matrix=i.clone(e,this._matrix),this.useMatrix=!0;var t=this._model;t._cesiumAnimationsDirty=!0,this._runtimeNode.dirtyNumber=t._maxDirtyNumber}}}),r.prototype.setMatrix=function(e){i.clone(e,this._matrix)},r}),i("Scene/Model",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/clone","../Core/combine","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/FeatureDetection","../Core/getAbsoluteUri","../Core/getBaseUri","../Core/getMagic","../Core/getStringFromTypedArray","../Core/IndexDatatype","../Core/loadArrayBuffer","../Core/loadImage","../Core/loadImageFromTypedArray","../Core/loadText","../Core/Math","../Core/Matrix2","../Core/Matrix3","../Core/Matrix4","../Core/PrimitiveType","../Core/Quaternion","../Core/Queue","../Core/RuntimeError","../Core/throttleRequestByServer","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Renderer/WebGLConstants","../ThirdParty/gltfDefaults","../ThirdParty/Uri","../ThirdParty/when","./getModelAccessor","./ModelAnimationCache","./ModelAnimationCollection","./ModelMaterial","./modelMaterialsCommon","./ModelMesh","./ModelNode","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee){"use strict";function te(){this.buffersToCreate=new P,this.buffers={},this.pendingBufferLoads=0,this.programsToCreate=new P,this.shaders={},this.pendingShaderLoads=0,this.texturesToCreate=new P,this.pendingTextureLoads=0,this.texturesToCreateFromBufferView=new P,this.pendingBufferViewToImage=0,this.createSamplers=!0,this.createSkins=!0,this.createRuntimeAnimations=!0,this.createVertexArrays=!0,this.createRenderStates=!0,this.createUniformMaps=!0,this.createRuntimeNodes=!0,this.skinnedNodesIds=[]}function ie(e,t){e._cachedGltf=t,e._animationIds=ne(t)}function re(e){this._gltf=K(W(e.gltf)),this._bgltf=e.bgltf,this.ready=e.ready,this.modelsToLoad=[],this.count=0}function ne(e){var t=[];if(l(e)&&l(e.gltf)){var i=e.gltf.animations;for(var r in i)i.hasOwnProperty(r)&&t.push(r)}return t}function oe(t){t=s(t,s.EMPTY_OBJECT);var i=t.cacheKey;this._cacheKey=i,this._cachedGltf=void 0,this._releaseGltfJson=s(t.releaseGltfJson,!1),this._animationIds=void 0;var r;if(l(i)&&l(At[i])&&At[i].ready)r=At[i],++r.count;else{var n=t.gltf;if(l(n)){if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),n instanceof Uint8Array){var o=le(n);0!==o.binaryOffset&&(n=n.subarray(o.binaryOffset)),r=new re({gltf:o.glTF,bgltf:n,ready:!0})}else r=new re({gltf:t.gltf,ready:!0});r.count=1,l(i)&&(At[i]=r)}}ie(this,r),this._cache=t.cache,this._shaderOverride=t.shaderOverride,this._basePath=s(t.basePath,"");var a=new H(document.location.href),u=new H(this._basePath);this._baseUri=u.resolve(a),this.show=s(t.show,!0),this.modelMatrix=x.clone(s(t.modelMatrix,x.IDENTITY)),this._modelMatrix=x.clone(this.modelMatrix),this.scale=s(t.scale,1),this._scale=this.scale,this.minimumPixelSize=s(t.minimumPixelSize,0),this._minimumPixelSize=this.minimumPixelSize,this.maximumScale=t.maximumScale,this._maximumScale=this.maximumScale,this.id=t.id,this._id=t.id,this.pickPrimitive=t.pickPrimitive,this._allowPicking=s(t.allowPicking,!0),this._ready=!1,this._readyPromise=q.defer(),this.activeAnimations=new X(this),this._defaultTexture=void 0,this._incrementallyLoadTextures=s(t.incrementallyLoadTextures,!0),this._asynchronous=s(t.asynchronous,!0),this.debugShowBoundingVolume=s(t.debugShowBoundingVolume,!1),this._debugShowBoundingVolume=!1,this.debugWireframe=s(t.debugWireframe,!1),this._debugWireframe=!1,this._precreatedAttributes=t.precreatedAttributes,this._vertexShaderLoaded=t.vertexShaderLoaded,this._fragmentShaderLoaded=t.fragmentShaderLoaded,this._uniformMapLoaded=t.uniformMapLoaded,this._pickVertexShaderLoaded=t.pickVertexShaderLoaded,this._pickFragmentShaderLoaded=t.pickFragmentShaderLoaded,this._pickUniformMapLoaded=t.pickUniformMapLoaded,this._ignoreCommands=s(t.ignoreCommands,!1),this.cull=s(t.cull,!0),this._computedModelMatrix=new x,this._initialRadius=void 0,this._boundingSphere=void 0,this._scaledBoundingSphere=new e,this._state=xt.NEEDS_LOAD,this._loadResources=void 0,this._perNodeShowDirty=!1,this._cesiumAnimationsDirty=!1,this._dirty=!1,this._maxDirtyNumber=0,this._runtime={animations:void 0,rootNodes:void 0,nodes:void 0,nodesByName:void 0,skinnedNodes:void 0,meshesByName:void 0,materialsByName:void 0,materialsById:void 0},this._uniformMaps={},this._rendererResources={buffers:{},vertexArrays:{},programs:{},pickPrograms:{},textures:{},samplers:{},renderStates:{}},this._cachedRendererResources=void 0,this._loadRendererResourcesFromCache=!1,this._nodeCommands=[],this._pickIds=[],this._rtcCenter=void 0,this._rtcCenterEye=void 0,this._loadOptions=t.loadOptions}function ae(e,t,i){return e.subarray(t,t+i)}function se(e){var t=f(e);return"glTF"===t}function le(e){if(!se(e))throw new h("bgltf is not a valid Binary glTF file.");var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;i+=Pt,i+=Pt,i+=Pt;var r=t.getUint32(i,!0);i+=Pt+Pt;var n=i,o=n+r,a=v(e,n,r);return{glTF:JSON.parse(a),binaryOffset:o}}function ue(e,t,i){return e._runtime[t][i]}function ce(t){for(var r=t.nodes,n=t.meshes,o=t.accessors,a=t.scenes[t.scene].nodes,s=a.length,u=[],c=new i(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),h=new i(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),d=0;s>d;++d){var p=r[a[d]];for(p._transformToRoot=Ce(p),u.push(p);u.length>0;){p=u.pop();var m=p._transformToRoot,f=p.meshes;if(l(f))for(var v=f.length,g=0;v>g;++g)for(var _=n[f[g]].primitives,y=_.length,C=0;y>C;++C){var E=_[C].attributes.POSITION;if(l(E)){var S=o[E],w=i.fromArray(S.min,0,It),T=i.fromArray(S.max,0,Mt);l(c)&&l(h)&&(x.multiplyByPoint(m,w,w),x.multiplyByPoint(m,T,T),i.minimumByComponent(c,w,c),i.maximumByComponent(h,T,h))}}for(var b=p.children,A=b.length,P=0;A>P;++P){var I=r[b[P]];I._transformToRoot=Ce(I),x.multiplyTransformation(m,I._transformToRoot,I._transformToRoot),u.push(I)}delete p._transformToRoot}}var M=e.fromCornerPoints(c,h);return e.transformWithoutScale(M,wt,M)}function he(e,t,i){return function(){e._state=xt.FAILED,e._readyPromise.reject(new I("Failed to load "+t+": "+i))}}function de(e,t){return function(i){var r=e._loadResources;r.buffers[t]=new Uint8Array(i),--r.pendingBufferLoads}}function pe(e){var t=e.gltf.buffers;for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if("binary_glTF"===i||"KHR_binary_glTF"===i){var n=e._loadResources;n.buffers[i]=e._cachedGltf.bgltf}else if("arraybuffer"===r.type){++e._loadResources.pendingBufferLoads;var o=new H(r.uri),a=o.resolve(e._baseUri).toString();_(a).then(de(e,i)).otherwise(he(e,"buffer",a))}}}function me(e){var t=e.gltf.bufferViews;for(var i in t)t.hasOwnProperty(i)&&t[i].target===G.ARRAY_BUFFER&&e._loadResources.buffersToCreate.enqueue(i)}function fe(e,t){return function(i){var r=e._loadResources;r.shaders[t]={source:i,bufferView:void 0},--r.pendingShaderLoads}}function ve(e){var t=e.gltf.shaders;if(!l(e._shaderParser)||!e._shaderParser(t))for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(l(r.extras)&&l(r.extras.source))e._loadResources.shaders[i]={source:r.extras.source,bufferView:void 0};else if(l(r.extensions)&&l(r.extensions.KHR_binary_glTF)){var n=r.extensions.KHR_binary_glTF;e._loadResources.shaders[i]={source:void 0,bufferView:n.bufferView}}else{var o;if(e._shaderOverride&&(o=e._shaderOverride(r,i,e.gltf)))++e._loadResources.pendingShaderLoads,fe(e,i)(o);else{++e._loadResources.pendingShaderLoads;var a=new H(r.uri),s=a.resolve(e._baseUri).toString();E(s,e._loadOptions).then(fe(e,i)).otherwise(he(e,"shader",s))}}}}function ge(e){var t=e.gltf.programs;for(var i in t)t.hasOwnProperty(i)&&e._loadResources.programsToCreate.enqueue(i)}function _e(e,t){return function(i){var r=e._loadResources;--r.pendingTextureLoads,r.texturesToCreate.enqueue({id:t,image:i,bufferView:void 0})}}function ye(e){var t=e.gltf.images,i=e.gltf.textures;for(var r in i)if(i.hasOwnProperty(r)){var n=t[i[r].source];if(l(n.extensions)&&l(n.extensions.KHR_binary_glTF)){var o=n.extensions.KHR_binary_glTF;e._loadResources.texturesToCreateFromBufferView.enqueue({id:r,image:void 0,bufferView:o.bufferView,mimeType:o.mimeType})}else{var a=void 0,s=new H(n.uri),u=s.resolve(e._baseUri).toString();l(e._cache)&&(a=e._cache.get(u),l(a)&&(++e._loadResources.pendingTextureLoads,a.ref(),a.then(function(t,i,r){e._rendererResources.textures[t]=r,r.ref(),i.unref(),--e._loadResources.pendingTextureLoads}.bind(e,r,a),function(e){console.log("error",e)}))),l(a)||(++e._loadResources.pendingTextureLoads,l(e._cache)&&e._cache.reserve(u),y(u).then(_e(e,r)).otherwise(he(e,"image",u)))}}}function Ce(e){return l(e.matrix)?x.fromArray(e.matrix):x.fromTranslationQuaternionRotationScale(i.fromArray(e.translation,0,Dt),A.unpack(e.rotation,0,Rt),i.fromArray(e.scale,0,Ot))}function Ee(e){var t={},i={},r=[],n=e._loadResources.skinnedNodesIds,o=e.gltf.nodes;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a],u={matrix:void 0,translation:void 0,rotation:void 0,scale:void 0,computedShow:!0,transformToRoot:new x,computedMatrix:new x,dirtyNumber:0,commands:[],inverseBindMatrices:void 0,bindShapeMatrix:void 0,joints:[],computedJointMatrices:[],jointName:s.jointName,children:[],parents:[],publicNode:void 0};u.publicNode=new J(e,s,u,a,Ce(s)),t[a]=u,i[s.name]=u,l(s.skin)&&(n.push(a),r.push(u))}e._runtime.nodes=t,e._runtime.nodesByName=i,e._runtime.skinnedNodes=r}function Se(e){var t={},i={},r=e.gltf.materials,n=e._uniformMaps;for(var o in r)if(r.hasOwnProperty(o)){n[o]={uniformMap:void 0,values:void 0,jointMatrixUniformName:void 0};var a=r[o],s=new Z(e,a,o);t[a.name]=s,i[o]=s}e._runtime.materialsByName=t,e._runtime.materialsById=i}function we(e){var t={},i=e._runtime.materialsById,r=e.gltf.meshes;for(var n in r)if(r.hasOwnProperty(n)){var o=r[n];t[o.name]=new Q(o,i,n)}e._runtime.meshesByName=t}function Te(e){e._loadRendererResourcesFromCache||(pe(e),me(e),ve(e),ge(e),ye(e)),Se(e),we(e),Ee(e)}function xe(e,t){var i=e._loadResources;if(0===i.pendingBufferLoads){for(var r,n=e.gltf.bufferViews,o=e._rendererResources.buffers;i.buffersToCreate.length>0;){var a=i.buffersToCreate.dequeue();r=n[a];var s=D.createVertexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW});s.vertexArrayDestroyable=!1,o[a]=s}if(!i.elementBufferCreated){var u=e.gltf.accessors;for(var c in u)if(u.hasOwnProperty(c)){var h=u[c];if(r=n[h.bufferView],r.target===G.ELEMENT_ARRAY_BUFFER&&!l(o[h.bufferView])){var d=D.createIndexBuffer({context:t,typedArray:i.getBuffer(r),usage:R.STATIC_DRAW,indexDatatype:h.componentType});d.vertexArrayDestroyable=!1,o[h.bufferView]=d}}i.elementBufferCreated=!0}}}function be(e){for(var t={},i=e.length,r=0;i>r;++r)t[e[r]]=r;return t}function Ae(e,t){if(l(t.source))return t.source;var i=e._loadResources,r=e.gltf,n=r.bufferViews[t.bufferView];return v(i.getBuffer(n))}function Pe(e,t,i){return l(i)&&(e=i(e,t)),e}function Ie(e,t,i){var r=t.gltf.programs,n=t._loadResources.shaders,o=r[e],a=be(o.attributes),s=Ae(t,n[o.vertexShader]),u=Ae(t,n[o.fragmentShader]),c=Pe(s,e,t._vertexShaderLoaded),h=Pe(u,e,t._fragmentShaderLoaded),d=o.attributes.length,p=t._precreatedAttributes;if(l(p))for(var m in p)p.hasOwnProperty(m)&&(a[m]=d++);if(t._rendererResources.programs[e]=F.fromCache({context:i,vertexShaderSource:c,fragmentShaderSource:h,attributeLocations:a}),t.allowPicking){var f=Pe(s,e,t._pickVertexShaderLoaded),v=Pe(u,e,t._pickFragmentShaderLoaded);t._pickFragmentShaderLoaded||(v=B.createPickFragmentShaderSource(u,"uniform")),t._rendererResources.pickPrograms[e]=F.fromCache({context:i,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:a})}}function Me(e,t){var i,r=e._loadResources;if(0===r.pendingShaderLoads&&0===r.pendingBufferLoads)if(e.asynchronous)r.programsToCreate.length>0&&(i=r.programsToCreate.dequeue(),Ie(i,e,t));else for(;r.programsToCreate.length>0;)i=r.programsToCreate.dequeue(),Ie(i,e,t)}function De(e,t){return function(i){e.texturesToCreate.enqueue({id:t.id,image:i,bufferView:void 0}),--e.pendingBufferViewToImage}}function Re(e){var t=e._loadResources;if(0===t.pendingBufferLoads)for(;t.texturesToCreateFromBufferView.length>0;){var i=t.texturesToCreateFromBufferView.dequeue(),r=e.gltf,n=r.bufferViews[i.bufferView],o=De(t,i),a=he(e,"image","id: "+i.id+", bufferView: "+i.bufferView);C(t.getBuffer(n),i.mimeType).then(o).otherwise(a),++t.pendingBufferViewToImage}}function Oe(e,t){var i=e._loadResources;if(i.createSamplers){i.createSamplers=!1;var r=e._rendererResources.samplers,n=e.gltf.samplers;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];r[o]=new L({wrapS:a.wrapS,wrapT:a.wrapT,minificationFilter:a.minFilter,magnificationFilter:a.magFilter})}}}function Ne(e,t,i){var r=t.gltf.textures,n=r[e.id],o=t._rendererResources.samplers,a=o[n.sampler],s=a.minificationFilter===k.NEAREST_MIPMAP_NEAREST||a.minificationFilter===k.NEAREST_MIPMAP_LINEAR||a.minificationFilter===k.LINEAR_MIPMAP_NEAREST||a.minificationFilter===k.LINEAR_MIPMAP_LINEAR,u=s||a.wrapS===z.REPEAT||a.wrapS===z.MIRRORED_REPEAT||a.wrapT===z.REPEAT||a.wrapT===z.MIRRORED_REPEAT,c=e.image,h=!S.isPowerOfTwo(c.width)||!S.isPowerOfTwo(c.height);if(u&&h){var d=document.createElement("canvas");d.width=S.nextPowerOfTwo(c.width),d.height=S.nextPowerOfTwo(c.height);var p=d.getContext("2d");p.drawImage(c,0,0,c.width,c.height,0,0,d.width,d.height),c=d}var m;n.target===G.TEXTURE_2D&&(m=new V({context:i,source:c,pixelFormat:n.internalFormat,pixelDatatype:n.type,sampler:a,flipY:!1})),s&&m.generateMipmap(),t._rendererResources.textures[e.id]=m,l(t._cache)&&t._cache.resolve(e.image.src,m)}function Le(e,t){var i,r=e._loadResources;if(e.asynchronous)r.texturesToCreate.length>0&&(i=r.texturesToCreate.dequeue(),Ne(i,e,t));else for(;r.texturesToCreate.length>0;)i=r.texturesToCreate.dequeue(),Ne(i,e,t)}function Fe(e,t){var i=e.gltf,r=i.techniques,n=i.materials,o={},a=r[n[t.material].technique],s=a.parameters,u=a.attributes,c=e._rendererResources.programs[a.program].vertexAttributes;for(var h in c)if(c.hasOwnProperty(h)){var d=u[h],p=c[h].index;if(l(d)){var m=s[d];o[m.semantic]=p}else o[h]=p}return o}function Be(e,t,i){for(var r=e.length,n=0;r>n;++n)for(var o=[e[n]];o.length>0;){var a=o.pop(),s=i[a];if(s.jointName===t)return a;for(var l=s.children,u=l.length,c=0;u>c;++c)o.push(l[c])}}function Ve(e,t){for(var i=e.gltf,r=i.skins,n=i.nodes,o=e._runtime.nodes,a=e._loadResources.skinnedNodesIds,s=a.length,l=0;s>l;++l){var u=a[l],c=o[u],h=n[u],d=t[h.skin];c.inverseBindMatrices=d.inverseBindMatrices,c.bindShapeMatrix=d.bindShapeMatrix;for(var p=[],m=h.skeletons,f=m.length,v=0;f>v;++v)p.push(m[v]);for(var g=r[h.skin].jointNames,_=g.length,y=0;_>y;++y){var C=g[y],E=o[Be(p,C,n)];c.joints.push(E)}}}function ke(e){var t=e._loadResources;if(0===t.pendingBufferLoads&&t.createSkins){t.createSkins=!1;var i=e.gltf,r=i.accessors,n=i.skins,o={};for(var a in n)if(n.hasOwnProperty(a)){var s,l=n[a],u=r[l.inverseBindMatrices];x.equals(l.bindShapeMatrix,x.IDENTITY)||(s=x.clone(l.bindShapeMatrix)),o[a]={inverseBindMatrices:Y.getSkinInverseBindMatrices(e,u),bindShapeMatrix:s}}Ve(e,o)}}function ze(e,t,i,r){return function(n){t[i]=r.evaluate(n,t[i]),t.dirtyNumber=e._maxDirtyNumber}}function Ue(e){var t=e._loadResources;if(t.finishedPendingBufferLoads()&&t.createRuntimeAnimations){t.createRuntimeAnimations=!1,e._runtime.animations={};var i=e._runtime.nodes,r=e.gltf.animations,n=e.gltf.accessors;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o],s=a.channels,l=a.parameters,u=a.samplers,c={};for(var h in l)l.hasOwnProperty(h)&&(c[h]=Y.getAnimationParameterValues(e,n[l[h]]));for(var d=Number.MAX_VALUE,p=-Number.MAX_VALUE,m=s.length,f=new Array(m),v=0;m>v;++v){var g=s[v],_=g.target,y=u[g.sampler],C=c[y.input];d=Math.min(d,C[0]),p=Math.max(p,C[C.length-1]);var E=Y.getAnimationSpline(e,o,a,g.sampler,y,c);f[v]=ze(e,i[_.id],_.path,E)}e._runtime.animations[o]={startTime:d,stopTime:p,channelEvaluators:f}}}}function Ge(e,t){var i=e._loadResources;if(i.finishedBuffersCreation()&&i.finishedProgramCreation()&&i.createVertexArrays){i.createVertexArrays=!1;var r=e._rendererResources.buffers,n=e._rendererResources.vertexArrays,o=e.gltf,a=o.accessors,s=o.meshes;for(var u in s)if(s.hasOwnProperty(u))for(var c=s[u].primitives,h=c.length,d=0;h>d;++d){var p,m,f,v=c[d],g=Fe(e,v),_=[],y=v.attributes;for(p in y)if(y.hasOwnProperty(p)&&(m=g[p],l(m))){var C=a[y[p]];_.push({index:m,vertexBuffer:r[C.bufferView],componentsPerAttribute:j(C).componentsPerAttribute,componentDatatype:C.componentType,normalize:!1,offsetInBytes:C.byteOffset,strideInBytes:C.byteStride})}var E=e._precreatedAttributes;if(l(E))for(p in E)E.hasOwnProperty(p)&&(m=g[p],l(m)&&(f=E[p],f.index=m,_.push(f)));var S;if(l(v.indices)){var w=a[v.indices];S=r[w.bufferView]}n[u+".primitive."+d]=new U({context:t,attributes:_,indexBuffer:S})}}}function We(e){var t={};t[G.BLEND]=!1,t[G.CULL_FACE]=!1,t[G.DEPTH_TEST]=!1,t[G.POLYGON_OFFSET_FILL]=!1,t[G.SCISSOR_TEST]=!1;var i,r=e.enable,n=r.length;for(i=0;n>i;++i)t[r[i]]=!0;return t}function He(e,t){var i=e._loadResources;if(i.createRenderStates){i.createRenderStates=!1;var r=e._rendererResources.renderStates,n=e.gltf.techniques;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o],u=a.states,c=We(u),h=s(u.functions,s.EMPTY_OBJECT),d=s(h.blendColor,[0,0,0,0]),p=s(h.blendEquationSeparate,[G.FUNC_ADD,G.FUNC_ADD]),m=s(h.blendFuncSeparate,[G.ONE,G.ONE,G.ZERO,G.ZERO]),f=s(h.colorMask,[!0,!0,!0,!0]),v=s(h.depthRange,[0,1]),g=s(h.polygonOffset,[0,0]),_=s(h.scissor,[0,0,0,0]);r[o]=N.fromCache({frontFace:l(h.frontFace)?h.frontFace[0]:G.CCW,cull:{enabled:c[G.CULL_FACE],face:l(h.cullFace)?h.cullFace[0]:G.BACK},lineWidth:l(h.lineWidth)?h.lineWidth[0]:1,polygonOffset:{enabled:c[G.POLYGON_OFFSET_FILL],factor:g[0],units:g[1]},scissorTest:{enabled:c[G.SCISSOR_TEST],rectangle:{x:_[0],y:_[1],width:_[2],height:_[3]}},depthRange:{near:v[0],far:v[1]},depthTest:{enabled:c[G.DEPTH_TEST],func:l(h.depthFunc)?h.depthFunc[0]:G.LESS},colorMask:{red:f[0],green:f[1],blue:f[2],alpha:f[3]},depthMask:l(h.depthMask)?h.depthMask[0]:!0,blending:{enabled:c[G.BLEND],color:{red:d[0],green:d[1],blue:d[2],alpha:d[3]},equationRgb:p[0],equationAlpha:p[1],functionSourceRgb:m[0],functionSourceAlpha:m[1],functionDestinationRgb:m[2],functionDestinationAlpha:m[3]}})}}}function qe(e,t){var i={value:e,clone:function(e,t){return e},func:function(){return i.value}};return i}function je(e,i){var r={value:t.fromArray(e),clone:t.clone,func:function(){return r.value}};return r}function Ye(e,t){var r={value:i.fromArray(e),clone:i.clone,func:function(){return r.value}};return r}function Xe(e,t){var i={value:r.fromArray(e),clone:r.clone,func:function(){return i.value}};return i}function Ze(e,t){var i={value:w.fromColumnMajorArray(e),clone:w.clone,func:function(){return i.value}};return i}function Ke(e,t){var i={value:T.fromColumnMajorArray(e),clone:T.clone,func:function(){return i.value}};return i}function Qe(e,t){var i={value:x.fromColumnMajorArray(e),clone:x.clone,func:function(){return i.value}};return i}function Je(e,t){this._value=void 0,this._textureId=e,this._model=t}function $e(e,t){var i=new Je(e,t);return i.func=function(){return i.value},i}function et(e,t,i,r){var n=t._runtime.nodes[e];return Bt[i](r,t,n)}function tt(e,t){var i=e._loadResources;if(i.finishedProgramCreation()&&i.createUniformMaps){i.createUniformMaps=!1;var r=e.gltf,n=r.materials,o=r.techniques,a=e._uniformMaps;for(var s in n)if(n.hasOwnProperty(s)){var u,c=n[s],h=c.values,d=o[c.technique],p=d.parameters,m=d.uniforms,f={},v={};for(var g in m)if(m.hasOwnProperty(g)){var _=m[g],y=p[_];if(l(h[_])){var C=Ft[y.type](h[_],e);f[g]=C.func,v[_]=C}else if(l(y.node))f[g]=et(y.node,e,y.semantic,t.uniformState);else if(l(y.semantic))"JOINTMATRIX"!==y.semantic?f[g]=Lt[y.semantic](t.uniformState,e):u=g;else if(l(y.value)){var E=Ft[y.type](y.value,e);f[g]=E.func,v[_]=E}}var S=a[s];S.uniformMap=f,S.values=v,S.jointMatrixUniformName=u}}}function it(e){return function(){return e}}function rt(e){return function(){return e.computedJointMatrices}}function nt(t,r,n,u){for(var c=t._nodeCommands,h=t._pickIds,d=t.allowPicking,p=t._runtime.meshesByName,m=t._rendererResources,f=m.vertexArrays,v=m.programs,_=m.pickPrograms,y=m.renderStates,C=t._uniformMaps,E=t.gltf,S=E.accessors,w=E.meshes,T=E.techniques,b=E.materials,A=r.meshes,P=A.length,I=0;P>I;++I)for(var M=A[I],D=w[M],R=D.primitives,N=R.length,L=0;N>L;++L){var F,B=R[L],V=S[B.indices],k=b[B.material],z=T[k.technique],U=z.program,G=B.attributes.POSITION;if(l(G)){var W=S[G];F=e.fromCornerPoints(i.fromArray(W.min),i.fromArray(W.max))}var H,q,Y=f[M+".primitive."+L];if(l(V))q=V.count,H=V.byteOffset/g.getSizeInBytes(V.componentType);else{var X=S[B.attributes.POSITION];q=X.count;var Z=j(X);H=X.byteOffset/(Z.componentsPerAttribute*a.getSizeInBytes(X.componentType))}var K=C[B.material],Q=K.uniformMap;if(l(K.jointMatrixUniformName)){var J={};J[K.jointMatrixUniformName]=rt(n),Q=o(Q,J)}l(t._uniformMapLoaded)&&(Q=t._uniformMapLoaded(Q,U,n));var ee,te=y[k.technique],ie=te.blending.enabled,re={primitive:s(t.pickPrimitive,t),id:t.id,node:n.publicNode,mesh:p[D.name]},ne=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:v[z.program],uniformMap:Q,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE});if(d){var oe;if(l(t._pickFragmentShaderLoaded))oe=l(t._pickUniformMapLoaded)?t._pickUniformMapLoaded(Q):o(Q);else{var ae=u.createPickId(re);h.push(ae);var se={czm_pickColor:it(ae.color)};oe=o(Q,se)}ee=new O({boundingVolume:new e,cull:t.cull,modelMatrix:new x,primitiveType:B.mode,vertexArray:Y,count:q,offset:H,shaderProgram:_[z.program],uniformMap:oe,renderState:te,owner:re,pass:ie?$.TRANSLUCENT:$.OPAQUE})}var le={show:!0,boundingSphere:F,command:ne,pickCommand:ee};n.commands.push(le),c.push(le)}}function ot(e,t){var r=e._loadResources;if(r.finishedEverythingButTextureCreation()&&r.createRuntimeNodes){r.createRuntimeNodes=!1;for(var n=[],o=e._runtime.nodes,a=e.gltf,s=a.nodes,u=a.scenes[a.scene],c=u.nodes,h=c.length,d=[],p=0;h>p;++p)for(d.push({parentRuntimeNode:void 0,gltfNode:s[c[p]],id:c[p]});d.length>0;){var m=d.pop(),f=m.parentRuntimeNode,v=m.gltfNode,g=o[m.id];if(0===g.parents.length)if(l(v.matrix))g.matrix=x.fromColumnMajorArray(v.matrix);else{var _=v.rotation;g.translation=i.fromArray(v.translation),g.rotation=A.unpack(_),g.scale=i.fromArray(v.scale)}l(f)?(f.children.push(g),g.parents.push(f)):n.push(g),l(v.meshes)&&nt(e,v,g,t);for(var y=v.children,C=y.length,E=0;C>E;++E)d.push({parentRuntimeNode:g,gltfNode:s[y[E]],id:y[E]})}e._runtime.rootNodes=n,e._runtime.nodes=o}}function at(e,t){var i=t.context;if(e._loadRendererResourcesFromCache){var r=e._rendererResources,n=e._cachedRendererResources;n.assign(r),l(e._precreatedAttributes)&&Ge(e,i)}else xe(e,i),Me(e,i),Oe(e,i),Re(e),Le(e,i);ke(e),Ue(e),e._loadRendererResourcesFromCache||(Ge(e,i),He(e,i)),tt(e,i),ot(e,i)}function st(e,t){var i=e.publicNode,r=i.matrix;i.useMatrix&&l(r)?x.clone(r,t):l(e.matrix)?x.clone(e.matrix,t):(x.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t), +i.setMatrix(t))}function lt(t,r,n){for(var o=t._maxDirtyNumber,a=t.allowPicking,s=t._runtime.rootNodes,u=s.length,c=Vt,h=t._computedModelMatrix,d=0;u>d;++d){var p=s[d];for(st(p,p.transformToRoot),c.push(p);c.length>0;){p=c.pop();var m=p.transformToRoot,f=p.commands;if(p.dirtyNumber===o||r||n){var v=x.multiplyTransformation(h,m,p.computedMatrix),g=f.length;if(g>0)for(var _=0;g>_;++_){var y=f[_],C=y.command;if(x.clone(v,C.modelMatrix),e.transform(y.boundingSphere,C.modelMatrix,C.boundingVolume),l(t._rtcCenter)&&i.add(t._rtcCenter,C.boundingVolume.center,C.boundingVolume.center),a){var E=y.pickCommand;x.clone(C.modelMatrix,E.modelMatrix),e.clone(C.boundingVolume,E.boundingVolume)}}}for(var S=p.children,w=S.length,T=0;w>T;++T){var b=S[T];b.dirtyNumber=Math.max(b.dirtyNumber,p.dirtyNumber),(b.dirtyNumber===o||n)&&(st(b,b.transformToRoot),x.multiplyTransformation(m,b.transformToRoot,b.transformToRoot)),c.push(b)}}}++t._maxDirtyNumber}function ut(e){for(var t=e._runtime.skinnedNodes,i=t.length,r=0;i>r;++r){var n=t[r];kt=x.inverseTransformation(n.transformToRoot,kt);for(var o=n.computedJointMatrices,a=n.joints,s=n.bindShapeMatrix,u=n.inverseBindMatrices,c=u.length,h=0;c>h;++h)l(o[h])||(o[h]=new x),o[h]=x.multiplyTransformation(kt,a[h].transformToRoot,o[h]),o[h]=x.multiplyTransformation(o[h],u[h],o[h]),l(s)&&(o[h]=x.multiplyTransformation(o[h],s,o[h]))}}function ct(e){for(var t=e._runtime.rootNodes,i=t.length,r=Vt,n=0;i>n;++n){var o=t[n];for(o.computedShow=o.publicNode.show,r.push(o);r.length>0;){o=r.pop();for(var a=o.computedShow,s=o.commands,l=s.length,u=0;l>u;++u)s[u].show=a;for(var c=o.children,h=c.length,d=0;h>d;++d){var p=c[d];p.computedShow=a&&p.publicNode.show,r.push(p)}}}}function ht(e,t){var i=e.id;if(e._id!==i){e._id=i;for(var r=e._pickIds,n=r.length,o=0;n>o;++o)r[o].object.id=i}}function dt(e){if(e._debugWireframe!==e.debugWireframe){e._debugWireframe=e.debugWireframe;for(var t=e.debugWireframe?b.LINES:b.TRIANGLES,i=e._nodeCommands,r=i.length,n=0;r>n;++n)i[n].command.primitiveType=t}}function pt(e){if(e.debugShowBoundingVolume!==e._debugShowBoundingVolume){e._debugShowBoundingVolume=e.debugShowBoundingVolume;for(var t=e.debugShowBoundingVolume,i=e._nodeCommands,r=i.length,n=0;r>n;n++)i[n].command.debugShowBoundingVolume=t}}function mt(e,t,i){return zt.center=e,zt.radius=t,i.camera.getPixelSize(zt,i.context.drawingBufferWidth,i.context.drawingBufferHeight)}function ft(e,t){var r=e.scale;if(0!==e.minimumPixelSize){var n=t.context,o=Math.max(n.drawingBufferWidth,n.drawingBufferHeight),a=e.modelMatrix;Ut.x=a[12],Ut.y=a[13],Ut.z=a[14],l(e._rtcCenter)&&i.add(e._rtcCenter,Ut,Ut);var s=e.boundingSphere.radius,u=mt(Ut,s,t),c=1/u,h=Math.min(c*(2*s),o);hr;++r){var n=t[r];if("CESIUM_RTC"!==n&&"KHR_binary_glTF"!==n&&"KHR_materials_common"!==n)throw new I("Unsupported glTF Extension: "+n)}}function _t(e,t){this.buffers=void 0,this.vertexArrays=void 0,this.programs=void 0,this.pickPrograms=void 0,this.textures=void 0,this.samplers=void 0,this.renderStates=void 0,this.ready=!1,this.context=e,this.cacheKey=t,this.count=0}function yt(e){for(var t in e)e.hasOwnProperty(t)&&(l(e[t].unref)?e[t].unref():e[t].destroy())}function Ct(e){yt(e.buffers),yt(e.vertexArrays),yt(e.programs),yt(e.pickPrograms),yt(e.textures)}function Et(e){for(var t in e)e.hasOwnProperty(t)&&e[t].ref&&e[t].ref()}function St(e){for(var t in e)e.hasOwnProperty(t)&&e[t].unref&&e[t].unref()}if(!d.supportsTypedArrays())return{};var wt=x.fromRotationTranslation(T.fromRotationX(S.PI_OVER_TWO)),Tt=new i,xt={NEEDS_LOAD:0,LOADING:1,LOADED:2,FAILED:3},bt="model/vnd.gltf.binary,model/vnd.gltf+json,model/gltf.binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01";te.prototype.getBuffer=function(e){return ae(this.buffers[e.buffer],e.byteOffset,e.byteLength)},te.prototype.finishedPendingBufferLoads=function(){return 0===this.pendingBufferLoads},te.prototype.finishedBuffersCreation=function(){return 0===this.pendingBufferLoads&&0===this.buffersToCreate.length},te.prototype.finishedProgramCreation=function(){return 0===this.pendingShaderLoads&&0===this.programsToCreate.length},te.prototype.finishedTextureCreation=function(){var e=0===this.pendingTextureLoads,t=0===this.texturesToCreate.length&&0===this.texturesToCreateFromBufferView.length;return e&&t},te.prototype.finishedEverythingButTextureCreation=function(){var e=0===this.pendingBufferLoads&&0===this.pendingShaderLoads,t=0===this.buffersToCreate.length&&0===this.programsToCreate.length&&0===this.pendingBufferViewToImage;return e&&t},te.prototype.finished=function(){return this.finishedTextureCreation()&&this.finishedEverythingButTextureCreation()},u(re.prototype,{gltf:{set:function(e){this._gltf=K(W(e))},get:function(){return this._gltf}},bgltf:{get:function(){return this._bgltf}}}),re.prototype.makeReady=function(e,t){this.gltf=e,this._bgltf=t;for(var i=this.modelsToLoad,r=i.length,n=0;r>n;++n){var o=i[n];o.isDestroyed()||ie(o,this)}this.modelsToLoad=void 0,this.ready=!0};var At={};u(oe.prototype,{gltf:{get:function(){return l(this._cachedGltf)?this._cachedGltf.gltf:void 0}},releaseGltfJson:{get:function(){return this._releaseGltfJson}},cacheKey:{get:function(){return this._cacheKey}},basePath:{get:function(){return this._basePath}},boundingSphere:{get:function(){var e=x.getScale(this.modelMatrix,Tt),t=l(this.maximumScale)?Math.min(this.maximumScale,this.scale):this.scale;i.multiplyByScalar(e,t,e);var r=this._scaledBoundingSphere;return r.center=i.multiplyComponents(this._boundingSphere.center,e,r.center),r.radius=i.maximumComponent(e)*this._initialRadius,l(this._rtcCenter)&&i.add(this._rtcCenter,r.center,r.center),r}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},asynchronous:{get:function(){return this._asynchronous}},allowPicking:{get:function(){return this._allowPicking}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},pendingTextureLoads:{get:function(){return l(this._loadResources)?this._loadResources.pendingTextureLoads:0}},dirty:{get:function(){return this._dirty}}});var Pt=Uint32Array.BYTES_PER_ELEMENT;oe.fromGltf=function(e){var t=e.url,i=new oe(e);return i.loadGltf(t,e),i},oe.prototype.loadGltf=function(e){var t=e.url,i=s(e.cacheKey,p(t));e=n(e),e.basePath=m(t),e.cacheKey=i,this._basePath=e.basePath,this._cacheKey=e.cacheKey;var r=new H(document.location.href),o=new H(this._basePath);this._baseUri=o.resolve(r),e.headers=l(e.headers)?n(e.headers):{},l(e.headers.Accept)||(e.headers.Accept=bt);var a=At[i];return l(a)?a.ready||(++a.count,a.modelsToLoad.push(this)):(a=new re({ready:!1}),a.count=1,a.modelsToLoad.push(this),ie(this,a),At[i]=a,_(t,e.headers).then(function(t){var i=new Uint8Array(t);if(se(i)){var r=le(i);0!==r.binaryOffset&&(i=i.subarray(r.binaryOffset)),a.makeReady(r.glTF,i)}else{var n=v(i),o=JSON.parse(n);e.gltfModifier&&(o=e.gltfModifier(o)),a.makeReady(o)}}).otherwise(he(this,"model",t))),this._readyPromise},oe._gltfCache=At,oe.prototype.getNode=function(e){var t=ue(this,"nodesByName",e);return l(t)?t.publicNode:void 0},oe.prototype.getMesh=function(e){return ue(this,"meshesByName",e)},oe.prototype.getMaterial=function(e){return ue(this,"materialsByName",e)};var It=new i,Mt=new i,Dt=new i,Rt=new A,Ot=new i,Nt=new i,Lt={MODEL:function(e,t){return function(){return e.model}},VIEW:function(e,t){return function(){return e.view}},PROJECTION:function(e,t){return function(){return e.projection}},MODELVIEW:function(e,t){return function(){return e.modelView}},CESIUM_RTC_MODELVIEW:function(e,t){var r=new x;return function(){return x.getTranslation(e.model,Nt),i.add(Nt,t._rtcCenter,Nt),x.multiplyByPoint(e.view,Nt,Nt),x.setTranslation(e.modelView,Nt,r)}},MODELVIEWPROJECTION:function(e,t){return function(){return e.modelViewProjection}},MODELINVERSE:function(e,t){return function(){return e.inverseModel}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t){return function(){return e.inverseModelView}},MODELVIEWPROJECTIONINVERSE:function(e,t){return function(){return e.inverseModelViewProjection}},MODELINVERSETRANSPOSE:function(e,t){return function(){return e.inverseTranposeModel}},MODELVIEWINVERSETRANSPOSE:function(e,t){return function(){return e.normal}},VIEWPORT:function(e,t){return function(){return e.viewportCartesian4}}};u(Je.prototype,{value:{get:function(){if(!l(this._value)){var e=this._model._rendererResources.textures[this._textureId];if(!l(e))return this._model._defaultTexture;this._value=e}return this._value},set:function(e){this._value=e}}}),Je.prototype.clone=function(e,t){return e},Je.prototype.func=void 0;var Ft={};Ft[G.FLOAT]=qe,Ft[G.FLOAT_VEC2]=je,Ft[G.FLOAT_VEC3]=Ye,Ft[G.FLOAT_VEC4]=Xe,Ft[G.INT]=qe,Ft[G.INT_VEC2]=je,Ft[G.INT_VEC3]=Ye,Ft[G.INT_VEC4]=Xe,Ft[G.BOOL]=qe,Ft[G.BOOL_VEC2]=je,Ft[G.BOOL_VEC3]=Ye,Ft[G.BOOL_VEC4]=Xe,Ft[G.FLOAT_MAT2]=Ze,Ft[G.FLOAT_MAT3]=Ke,Ft[G.FLOAT_MAT4]=Qe,Ft[G.SAMPLER_2D]=$e;var Bt={MODEL:function(e,t,i){return function(){return i.computedMatrix}},VIEW:function(e,t,i){return function(){return e.view}},PROJECTION:function(e,t,i){return function(){return e.projection}},MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r)}},CESIUM_RTC_MODELVIEW:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.setTranslation(r,t._rtcCenterEye,r)}},MODELVIEWPROJECTION:function(e,t,i){var r=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r)}},MODELINVERSE:function(e,t,i){var r=new x;return function(){return x.inverse(i.computedMatrix,r)}},VIEWINVERSE:function(e,t){return function(){return e.inverseView}},PROJECTIONINVERSE:function(e,t,i){return function(){return e.inverseProjection}},MODELVIEWINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n)}},MODELVIEWPROJECTIONINVERSE:function(e,t,i){var r=new x,n=new x;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.multiply(e._projection,r,r),x.inverse(r,n)}},MODELINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new T;return function(){return x.inverse(i.computedMatrix,r),x.getRotation(r,n),T.transpose(n,n)}},MODELVIEWINVERSETRANSPOSE:function(e,t,i){var r=new x,n=new x,o=new T;return function(){return x.multiplyTransformation(e.view,i.computedMatrix,r),x.inverse(r,n),x.getRotation(n,o),T.transpose(o,o)}},VIEWPORT:function(e,t,i){return function(){return e.viewportCartesian4}}},Vt=[],kt=new x,zt=new e,Ut=new i;return _t.prototype.release=function(){return 0===--this.count?(l(this.cacheKey)&&delete this.context.cache.modelRendererResourceCache[this.cacheKey],Ct(this),c(this)):void 0},_t.prototype.init=function(e){this.buffers=e.buffers,Et(this.buffers),this.vertexArrays=e.vertexArrays,Et(this.vertexArrays),this.programs=e.programs,Et(this.programs),this.pickPrograms=e.pickPrograms,Et(this.pickPrograms),this.textures=e.textures,Et(this.textures),this.samplers=e.samplers,Et(this.samplers),this.renderStates=e.renderStates,Et(this.renderStates)},_t.prototype.assign=function(e){e.buffers=this.buffers,refRessource(this.buffers),e.vertexArrays=this.vertexArrays,refRessource(this.vertexArrays),e.programs=this.programs,refRessource(this.programs),e.pickPrograms=this.pickPrograms,refRessource(this.pickPrograms),e.textures=this.textures,refRessource(this.textures),e.samplers=this.samplers,refRessource(this.samplers),e.renderStates=this.renderStates,refRessource(this.renderStates)},oe.prototype.update=function(e){if(e.mode===ee.SCENE3D){var t=e.context;if(this._defaultTexture=t.defaultTexture,this._state===xt.NEEDS_LOAD&&l(this.gltf)){var r,n=this.cacheKey;if(l(n)){t.cache.modelRendererResourceCache=s(t.cache.modelRendererResourceCache,{});var o=t.cache.modelRendererResourceCache;if(r=o[this.cacheKey],l(r)){if(!r.ready)return;++r.count,this._loadRendererResourcesFromCache=!0}else r=new _t(t,n),r.count=1,o[this.cacheKey]=r;this._cachedRendererResources=r}else r=new _t(t),r.count=1,this._cachedRendererResources=r;if(this._state=xt.LOADING,this._boundingSphere=ce(this.gltf),this._initialRadius=this._boundingSphere.radius,gt(this),this._state!==xt.FAILED){var a=this.gltf.extensions;l(a)&&l(a.CESIUM_RTC)&&(this._rtcCenter=i.fromArray(a.CESIUM_RTC.center),this._rtcCenterEye=new i),this._loadResources=new te,Te(this)}}var u=this._loadResources,c=this._incrementallyLoadTextures,h=!1;if(this._state===xt.LOADING&&(at(this,e),(u.finished()||c&&u.finishedEverythingButTextureCreation())&&(this._state=xt.LOADED,h=!0)),l(u)&&this._state===xt.LOADED&&(c&&!h&&at(this,e),u.finished())){this._loadResources=void 0;var d=this._rendererResources,p=this._cachedRendererResources;p.init(d),p.ready=!0,l(this._precreatedAttributes)&&(p.vertexArrays={}),this.releaseGltfJson&&vt(this)}var m=this.show&&0!==this.scale;if(m&&this._state===xt.LOADED||h){var f=this.activeAnimations.update(e)||this._cesiumAnimationsDirty;this._cesiumAnimationsDirty=!1,this._dirty=!1;var v=!x.equals(this._modelMatrix,this.modelMatrix)||this._scale!==this.scale||this._minimumPixelSize!==this.minimumPixelSize||0!==this.minimumPixelSize||this._maximumScale!==this.maximumScale;if(v||h){x.clone(this.modelMatrix,this._modelMatrix),this._scale=this.scale,this._minimumPixelSize=this.minimumPixelSize,this._maximumScale=this.maximumScale;var g=ft(this,e),_=this._computedModelMatrix;x.multiplyByUniformScale(this.modelMatrix,g,_),x.multiplyTransformation(_,wt,_)}(f||v||h)&&(lt(this,v,h),this._dirty=!0,(f||h)&&ut(this)),this._perNodeShowDirty&&(this._perNodeShowDirty=!1,ct(this)),ht(this,t),dt(this),pt(this)}if(h){var y=this;return void e.afterRender.push(function(){y._ready=!0,y._readyPromise.resolve(y)})}if(m&&!this._ignoreCommands){var C,E,S=e.commandList,w=e.passes,T=this._nodeCommands,b=T.length;if(w.render)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.command);if(w.pick&&this.allowPicking)for(C=0;b>C;++C)E=T[C],E.show&&S.push(E.pickCommand)}}},oe.prototype.isDestroyed=function(){return!1},oe.prototype.destroy=function(){l(this._precreatedAttributes)&&yt(this._rendererResources.vertexArrays);var e=this._rendererResources;St(e.buffers),St(e.vertexArrays),St(e.programs),St(e.pickPrograms),St(e.textures),St(e.samplers),St(e.renderStates),this._rendererResources=void 0,this._cachedRendererResources=this._cachedRendererResources&&this._cachedRendererResources.release();for(var t=this._pickIds,i=t.length,r=0;i>r;++r)t[r].destroy();return vt(this),c(this)},oe}),i("DataSources/ModelVisualizer",["../Core/AssociativeArray","../Core/BoundingSphere","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Scene/Model","../Scene/ModelAnimationLoop","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(t,i){i.collectionChanged.addEventListener(c.prototype._onCollectionChanged,this),this._scene=t,this._primitives=t.primitives,this._entityCollection=i,this._modelHash={},this._entitiesToVisualize=new e,this._onCollectionChanged(i,i.values,[],[])}function h(e,t,r,n){var o=r[t.id];i(o)&&(n.removeAndDestroy(o.modelPrimitive),delete r[t.id])}function d(e,t){var r=t[e.id];i(r)&&(r.nodeTransformationsScratch={})}function p(e){console.error(e)}var m=1,f=0,v=!0,g=new o,_=new o;return c.prototype.update=function(e){for(var t=this._entitiesToVisualize.values,r=this._modelHash,n=this._primitives,l=0,c=t.length;c>l;l++){var h,d,y=t[l],C=y._model,E=r[y.id],S=y.isShowing&&y.isAvailable(e)&&u.getValueOrDefault(C._show,e,!0);if(S&&(d=y._getModelMatrix(e,g),h=u.getValueOrUndefined(C._uri,e),S=i(d)&&i(h)),S){var w=i(E)?E.modelPrimitive:void 0;if(i(w)&&h===E.uri||(i(w)&&(n.removeAndDestroy(w),delete r[y.id]),w=a.fromGltf({url:h,incrementallyLoadTextures:u.getValueOrDefault(C._incrementallyLoadTextures,e,v)}),w.readyPromise.otherwise(p),w.id=y,n.add(w),E={modelPrimitive:w,uri:h,animationsRunning:!1,nodeTransformationsScratch:{},originalNodeMatrixHash:{}},r[y.id]=E),w.show=!0,w.scale=u.getValueOrDefault(C._scale,e,m),w.minimumPixelSize=u.getValueOrDefault(C._minimumPixelSize,e,f),w.maximumScale=u.getValueOrUndefined(C._maximumScale,e),w.modelMatrix=o.clone(d,w.modelMatrix),w.ready){var T=u.getValueOrDefault(C._runAnimations,e,!0);E.animationsRunning!==T&&(T?w.activeAnimations.addAll({loop:s.REPEAT}):w.activeAnimations.removeAll(),E.animationsRunning=T);var x=u.getValueOrUndefined(C._nodeTransformations,e,E.nodeTransformationsScratch);if(i(x))for(var b=E.originalNodeMatrixHash,A=Object.keys(x),P=0,I=A.length;I>P;++P){var M=A[P],D=x[M];if(i(D)){var R=w.getNode(M);if(i(R)){var O=b[M];i(O)||(O=R.matrix.clone(),b[M]=O);var N=o.fromTranslationRotationScale(D,_);R.matrix=o.multiply(O,N,N)}}}}}else i(E)&&(E.modelPrimitive.show=!1)}return!0},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(c.prototype._onCollectionChanged,this);for(var e=this._entitiesToVisualize.values,t=this._modelHash,i=this._primitives,n=e.length-1;n>-1;n--)h(this,e[n],t,i);return r(this)},c.prototype.getBoundingSphere=function(e,r){var n=this._modelHash[e.id];if(!i(n))return l.FAILED;var o=n.modelPrimitive;return i(o)&&o.show?o.ready?(t.transform(o.boundingSphere,o.modelMatrix,r),l.DONE):l.PENDING:l.FAILED},c.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s=this._entitiesToVisualize,l=this._modelHash,u=this._primitives;for(o=t.length-1;o>-1;o--)a=t[o],i(a._model)&&i(a._position)&&s.set(a.id,a);for(o=n.length-1;o>-1;o--)a=n[o],i(a._model)&&i(a._position)?(d(a,l),s.set(a.id,a)):(h(this,a,l,u),s.remove(a.id));for(o=r.length-1;o>-1;o--)a=r[o],h(this,a,l,u),s.remove(a.id)},c}),i("Shaders/PolylineCommon",[],function(){"use strict";return"void clipLineSegmentToNearPlane(\nvec3 p0,\nvec3 p1,\nout vec4 positionWC,\nout bool clipped,\nout bool culledByNearPlane)\n{\nculledByNearPlane = false;\nclipped = false;\nvec3 p1ToP0 = p1 - p0;\nfloat magnitude = length(p1ToP0);\nvec3 direction = normalize(p1ToP0);\nfloat endPoint0Distance = -(czm_currentFrustum.x + p0.z);\nfloat denominator = -direction.z;\nif (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n{\nculledByNearPlane = true;\n}\nelse if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n{\nfloat t = (czm_currentFrustum.x + p0.z) / denominator;\nif (t < 0.0 || t > magnitude)\n{\nculledByNearPlane = true;\n}\nelse\n{\np0 = p0 + t * direction;\nclipped = true;\n}\n}\npositionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n}\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious) {\nvec4 endPointWC, p0, p1;\nbool culledByNearPlane, clipped;\nvec4 positionEC = czm_modelViewRelativeToEye * position;\nvec4 prevEC = czm_modelViewRelativeToEye * previous;\nvec4 nextEC = czm_modelViewRelativeToEye * next;\nclipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\nclipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\nif (culledByNearPlane)\n{\nreturn vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec2 prevWC = normalize(p0.xy - endPointWC.xy);\nvec2 nextWC = normalize(p1.xy - endPointWC.xy);\nfloat expandWidth = width * 0.5;\nvec2 direction;\nif (czm_equalsEpsilon(normalize(previous.xyz - position.xyz), vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n{\ndirection = vec2(-nextWC.y, nextWC.x);\n}\nelse if (czm_equalsEpsilon(normalize(next.xyz - position.xyz), vec3(0.0), czm_epsilon1) || clipped)\n{\ndirection = vec2(prevWC.y, -prevWC.x);\n}\nelse\n{\nvec2 normal = vec2(-nextWC.y, nextWC.x);\ndirection = normalize((nextWC + prevWC) * 0.5);\nif (dot(direction, normal) < 0.0)\n{\ndirection = -direction;\n}\nfloat sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\nexpandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n}\nvec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\nreturn vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n}\n"}),i("Shaders/PolylineFS",[],function(){"use strict";return"varying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nczm_material material = czm_getMaterial(materialInput);\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n"}),i("Shaders/PolylineVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandWidthAndShow;\nattribute vec4 pickColor;\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 czm_pickColor;\nvoid main()\n{\nfloat texCoord = texCoordExpandWidthAndShow.x;\nfloat expandDir = texCoordExpandWidthAndShow.y;\nfloat width = abs(texCoordExpandWidthAndShow.z) + 0.5;\nbool usePrev = texCoordExpandWidthAndShow.z < 0.0;\nfloat show = texCoordExpandWidthAndShow.w;\nvec4 p, prev, next;\nif (czm_morphTime == 1.0)\n{\np = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\nprev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\nnext = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n}\nelse if (czm_morphTime == 0.0)\n{\np = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\nprev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\nnext = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n}\nelse\n{\np = czm_columbusViewMorph(\nczm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\nczm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\nczm_morphTime);\nprev = czm_columbusViewMorph(\nczm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\nczm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\nczm_morphTime);\nnext = czm_columbusViewMorph(\nczm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\nczm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\nczm_morphTime);\n}\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC * show;\nv_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\nv_width = width;\nczm_pickColor = pickColor;\n}\n"}),i("Scene/Polyline",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/PolylinePipeline","./Material"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(o,a){o=r(o,r.EMPTY_OBJECT),this._show=r(o.show,!0),this._width=r(o.width,1),this._loop=r(o.loop,!1),this._material=o.material,n(this._material)||(this._material=u.fromType(u.ColorType,{color:new i(1,1,1,1)}));var c=o.positions;n(c)||(c=[]),this._positions=c,this._actualPositions=l.removeDuplicates(c),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=c.slice()),this._actualPositions.push(t.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=o.id;var h;n(a)&&(h=s.clone(a.modelMatrix)),this._modelMatrix=h,this._segments=l.wrapLongitude(this._actualPositions,h),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(g),this._polylineCollection=a,this._dirty=!1,this._pickId=void 0,this._boundingVolume=e.fromPoints(this._actualPositions),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new e}function h(e,t){++e._propertiesChanged[t];var i=e._polylineCollection;n(i)&&(i._updatePolyline(e,t),e._dirty=!0)}var d=c.SHOW_INDEX=0,p=c.WIDTH_INDEX=1,m=c.POSITION_INDEX=2,f=c.MATERIAL_INDEX=3,v=c.POSITION_SIZE_INDEX=4,g=c.NUMBER_OF_PROPERTIES=5;return o(c.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,h(this,d))}},positions:{get:function(){return this._positions},set:function(i){var r=l.removeDuplicates(i);this._loop&&r.length>2&&(r===i&&(r=i.slice()),r.push(t.clone(r[0]))),(this._actualPositions.length!==r.length||this._actualPositions.length!==this._length)&&h(this,v),this._positions=i,this._actualPositions=r,this._length=r.length,this._boundingVolume=e.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=e.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),h(this,m),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,h(this,f))}},width:{get:function(){return this._width},set:function(e){var t=this._width;e!==t&&(this._width=e,h(this,p))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){var i=this._actualPositions;e?i.length>2&&!t.equals(i[0],i[i.length-1])&&(i.length===this._positions.length&&(this._actualPositions=i=this._positions.slice()),i.push(t.clone(i[0]))):i.length>2&&t.equals(i[0],i[i.length-1])&&(i.length-1===this._positions.length?this._actualPositions=this._positions:i.pop()),this._loop=e,h(this,v)}}},id:{get:function(){return this._id},set:function(e){this._id=e,n(this._pickId)&&(this._pickId.object.id=e)}}}),c.prototype.update=function(){var t=s.IDENTITY;n(this._polylineCollection)&&(t=this._polylineCollection.modelMatrix);var i=this._segments.positions.length,r=this._segments.lengths,o=this._propertiesChanged[m]>0||this._propertiesChanged[v]>0;if((!s.equals(t,this._modelMatrix)||o)&&(this._segments=l.wrapLongitude(this._actualPositions,t),this._boundingVolumeWC=e.transform(this._boundingVolume,t,this._boundingVolumeWC)),this._modelMatrix=t,this._segments.positions.length!==i)h(this,v);else for(var a=r.length,u=0;a>u;++u)if(r[u]!==this._segments.lengths[u]){h(this,v);break}},c.prototype.getPickId=function(e){return n(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId},c.prototype._clean=function(){this._dirty=!1;for(var e=this._propertiesChanged,t=0;g-1>t;++t)e[t]=0},c.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0},c}),i("Scene/PolylineCollection",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/Plane","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/PolylineCommon","../Shaders/PolylineFS","../Shaders/PolylineVS","./BlendingState","./Material","./Pass","./Polyline","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=a(e,a.EMPTY_OBJECT),this.modelMatrix=f.clone(a(e.modelMatrix,f.IDENTITY)),this._modelMatrix=f.clone(f.IDENTITY),this.debugShowBoundingVolume=a(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._pickCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(Q),this._polylines=[],this._polylineBuckets={},this._buffersUsage=[{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0},{bufferUsage:_.STATIC_DRAW,frameCount:0}],this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._pickColorBuffer=void 0,this._texCoordExpandWidthAndShowBuffer=void 0}function O(t,i,r,n,o){for(var a=i.context,l=i.commandList,u=r.length,c=0,h=!0,d=t._vertexArrays,p=t.debugShowBoundingVolume,m=d.length,f=0;m>f;++f)for(var v=d[f],g=v.buckets,_=g.length,C=0;_>C;++C){for(var E,S,w,T=g[C],x=T.offset,b=o?T.bucket.shaderProgram:T.bucket.pickShaderProgram,A=T.bucket.polylines,P=A.length,M=0,R=0;P>R;++R){var O=A[R],N=F(O._material);if(N!==E){if(s(E)&&M>0){var L=S.isTranslucent();c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=L?t._translucentRS:t._opaqueRS,w.pass=L?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,x+=M,M=0,h=!0,l.push(w)}S=O._material,S.update(a),E=N}for(var B=O._locatorBuckets,V=B.length,k=0;V>k;++k){var z=B[k];z.locator===T&&(M+=z.count)}var U;i.mode===D.SCENE3D?U=O._boundingVolumeWC:i.mode===D.COLUMBUS_VIEW?U=O._boundingVolume2D:i.mode===D.SCENE2D?s(O._boundingVolume2D)&&(U=e.clone(O._boundingVolume2D,ee),U.center.x=0):s(O._boundingVolumeWC)&&s(O._boundingVolume2D)&&(U=e.union(O._boundingVolumeWC,O._boundingVolume2D,ee)),h?(h=!1,e.clone(U,$)):e.union(U,$,$)}s(E)&&M>0&&(c>=u?(w=new y({owner:t}),r.push(w)):w=r[c],++c,w.boundingVolume=e.clone($,w.boundingVolume),w.modelMatrix=n,w.shaderProgram=b,w.vertexArray=v.va,w.renderState=S.isTranslucent()?t._translucentRS:t._opaqueRS,w.pass=S.isTranslucent()?I.TRANSLUCENT:I.OPAQUE,w.debugShowBoundingVolume=o?p:!1,w.uniformMap=S._uniforms,w.count=M,w.offset=x,h=!0,l.push(w)),E=void 0}r.length=c}function N(e){for(var t=e._buffersUsage,i=!1,r=e._propertiesChanged,n=0;Q-2>n;++n){var o=t[n];r[n]?o.bufferUsage!==_.STREAM_DRAW?(i=!0,o.bufferUsage=_.STREAM_DRAW,o.frameCount=100):o.frameCount=100:o.bufferUsage!==_.STATIC_DRAW&&(0===o.frameCount?(i=!0,o.bufferUsage=_.STATIC_DRAW):o.frameCount--)}return i}function L(e,t,i){e._createVertexArray=!1,z(e),U(e),B(e);var r,n,a=[[]],l=a[0],u=[0],c=0,h=[[]],p=0,f=e._polylineBuckets;for(r in f)f.hasOwnProperty(r)&&(n=f[r],n.updateShader(t),p+=n.lengthOfPositions);if(p>0){var v,y=e._mode,C=new Float32Array(6*p*3),E=new Uint8Array(4*p),S=new Float32Array(4*p),T=0,x=0,b=0;for(r in f)if(f.hasOwnProperty(r)){n=f[r],n.write(C,E,S,T,x,b,t,i),y===D.MORPHING&&(s(v)||(v=new Float32Array(6*p*3)),n.writeForMorph(v,T));var A=n.lengthOfPositions;T+=6*A*3,x+=4*A,b+=4*A,c=n.updateIndices(a,u,h,c)}var P=e._buffersUsage[X].bufferUsage,I=e._buffersUsage[j].bufferUsage,M=e._buffersUsage[Y].bufferUsage,R=I===_.STREAM_DRAW||M===_.STREAM_DRAW?_.STREAM_DRAW:_.STATIC_DRAW;e._positionBuffer=g.createVertexBuffer({context:t,typedArray:C,usage:P});var O;s(v)&&(O=g.createVertexBuffer({context:t,typedArray:v,usage:P})),e._pickColorBuffer=g.createVertexBuffer({context:t,typedArray:E,usage:_.STATIC_DRAW}),e._texCoordExpandWidthAndShowBuffer=g.createVertexBuffer({context:t,typedArray:S,usage:R});for(var N=4*Uint8Array.BYTES_PER_ELEMENT,L=3*Float32Array.BYTES_PER_ELEMENT,F=4*Float32Array.BYTES_PER_ELEMENT,V=0,k=a.length,G=0;k>G;++G)if(l=a[G],l.length>0){var W=new Uint16Array(l),H=g.createIndexBuffer({context:t,typedArray:W,usage:_.STATIC_DRAW,indexDatatype:d.UNSIGNED_SHORT});V+=u[G];var q,Z,K,Q,$=6*(G*(L*m.SIXTY_FOUR_KILOBYTES)-V*L),ee=L+$,ie=L+ee,re=L+ie,ne=L+re,oe=L+ne,ae=G*(N*m.SIXTY_FOUR_KILOBYTES)-V*N,se=G*(F*m.SIXTY_FOUR_KILOBYTES)-V*F,le=[{ +index:J.position3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.position2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:$,strideInBytes:6*L},{index:J.position2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ee,strideInBytes:6*L},{index:J.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ie,strideInBytes:6*L},{index:J.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:re,strideInBytes:6*L},{index:J.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:ne,strideInBytes:6*L},{index:J.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:o.FLOAT,offsetInBytes:oe,strideInBytes:6*L},{index:J.texCoordExpandWidthAndShow,componentsPerAttribute:4,componentDatatype:o.FLOAT,vertexBuffer:e._texCoordExpandWidthAndShowBuffer,offsetInBytes:se},{index:J.pickColor,componentsPerAttribute:4,componentDatatype:o.UNSIGNED_BYTE,vertexBuffer:e._pickColorBuffer,offsetInBytes:ae,normalize:!0}];y===D.SCENE3D?(q=e._positionBuffer,Z="vertexBuffer",K=te,Q="value"):y===D.SCENE2D||y===D.COLUMBUS_VIEW?(q=te,Z="value",K=e._positionBuffer,Q="vertexBuffer"):(q=O,Z="vertexBuffer",K=e._positionBuffer,Q="vertexBuffer"),le[0][Z]=q,le[1][Z]=q,le[2][Q]=K,le[3][Q]=K,le[4][Z]=q,le[5][Z]=q,le[6][Q]=K,le[7][Q]=K,le[8][Z]=q,le[9][Z]=q,le[10][Q]=K,le[11][Q]=K;var ue=new w({context:t,attributes:le,indexBuffer:H});e._vertexArrays.push({va:ue,buckets:h[G]})}}}function F(e){var t=P._uniformList[e.type],i=t.length;ie.length=2*i;for(var r=0,n=0;i>n;++n){var o=t[n];ie[r]=o,ie[r+1]=e._uniforms[o](),r+=2}return e.type+":"+JSON.stringify(ie)}function B(e){for(var t=e._mode,i=e._modelMatrix,r=e._polylineBuckets={},n=e._polylines,o=n.length,a=0;o>a;++a){var l=n[a];if(l._actualPositions.length>1){l.update();var u=l.material,c=r[u.type];s(c)||(c=r[u.type]=new H(u,t,i)),c.addPolyline(l)}}}function V(e,t){var i=t.mode;e._mode===i&&f.equals(e._modelMatrix,e.modelMatrix)||(e._mode=i,e._modelMatrix=f.clone(e.modelMatrix),e._createVertexArray=!0)}function k(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;for(var t=[],i=e._polylines.length,r=0,n=0;i>r;++r){var o=e._polylines[r];s(o)&&(o._index=n++,t.push(o))}e._polylines=t}}function z(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)if(s(t[r])){var n=t[r]._bucket;s(n)&&(n.shaderProgram=n.shaderProgram&&n.shaderProgram.destroy())}}function U(e){for(var t=e._vertexArrays.length,i=0;t>i;++i)e._vertexArrays[i].va.destroy();e._vertexArrays.length=0}function G(e){for(var t=e._polylines,i=t.length,r=0;i>r;++r)s(t[r])&&t[r]._destroy()}function W(e,t,i){this.count=e,this.offset=t,this.bucket=i}function H(e,t,i){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.pickShaderProgram=void 0,this.mode=t,this.modelMatrix=i}function q(e){return t.dot(t.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(v.ORIGIN_ZX_PLANE)===p.INTERSECTING}var j=M.SHOW_INDEX,Y=M.WIDTH_INDEX,X=M.POSITION_INDEX,Z=M.MATERIAL_INDEX,K=M.POSITION_SIZE_INDEX,Q=M.NUMBER_OF_PROPERTIES,J={texCoordExpandWidthAndShow:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12,pickColor:13};l(R.prototype,{length:{get:function(){return k(this),this._polylines.length}}}),R.prototype.add=function(e){var t=new M(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,t},R.prototype.remove=function(e){if(this.contains(e)){if(this._polylines[e._index]=void 0,this._polylinesRemoved=!0,this._createVertexArray=!0,s(e._bucket)){var t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy(),t.pickShaderProgram=t.pickShaderProgram&&t.pickShaderProgram.destroy()}return e._destroy(),!0}return!1},R.prototype.removeAll=function(){z(this),G(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0},R.prototype.contains=function(e){return s(e)&&e._polylineCollection===this},R.prototype.get=function(e){return k(this),this._polylines[e]},R.prototype.update=function(e,t){if(k(this),0!==this._polylines.length){V(this,e);var i,r=e.context,n=e.mapProjection,o=this._propertiesChanged;if(this._createVertexArray||N(this))L(this,r,n);else if(this._polylinesUpdated){var a=this._polylinesToUpdate;if(this._mode!==D.SCENE3D)for(var l=a.length,u=0;l>u;++u)i=a[u],i.update();if(o[K]||o[Z])L(this,r,n);else for(var c=a.length,h=this._polylineBuckets,d=0;c>d;++d){i=a[d],o=i._propertiesChanged;var p=i._bucket,m=0;for(var v in h)if(h.hasOwnProperty(v)){if(h[v]===p){(o[X]||o[j]||o[Y])&&p.writeUpdate(m,i,this._positionBuffer,this._texCoordExpandWidthAndShowBuffer,n);break}m+=h[v].lengthOfPositions}i._clean()}a.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(var g=0;Q>g;++g)o[g]=0;var _=f.IDENTITY;e.mode===D.SCENE3D&&(_=this.modelMatrix);var y=e.passes,E=0!==e.morphTime;if(s(this._opaqueRS)&&this._opaqueRS.depthTest.enabled===E||(this._opaqueRS=C.fromCache({depthMask:E,depthTest:{enabled:E}})),s(this._translucentRS)&&this._translucentRS.depthTest.enabled===E||(this._translucentRS=C.fromCache({blending:A.ALPHA_BLEND,depthMask:!E,depthTest:{enabled:E}})),y.render){var S=this._colorCommands;O(this,e,S,_,!0)}if(y.pick){var w=this._pickCommands;O(this,e,w,_,!1)}}};var $=new e,ee=new e;R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return U(this),z(this),G(this),u(this)};var te=[0,0,0],ie=[];R.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,this._polylinesToUpdate.push(e),++this._propertiesChanged[t]},H.prototype.addPolyline=function(e){var t=this.polylines;t.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this},H.prototype.updateShader=function(e){if(!s(this.shaderProgram)){var t=new S({sources:[T,b]}),i=new S({sources:[this.material.shaderSource,x]}),r=new S({sources:i.sources,pickColorQualifier:"varying"});this.shaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:i,attributeLocations:J}),this.pickShaderProgram=E.fromCache({context:e,vertexShaderSource:t,fragmentShaderSource:r,attributeLocations:J})}},H.prototype.getPolylinePositionsLength=function(e){var t;if(this.mode===D.SCENE3D||!q(e))return t=e._actualPositions.length,4*t-4;var i=0,r=e._segments.lengths;t=r.length;for(var n=0;t>n;++n)i+=4*r[n]-4;return i};var re=new t,ne=new t,oe=new t,ae=new t;H.prototype.write=function(e,i,r,o,a,s,l,u){for(var c=this.mode,d=this.polylines,p=d.length,m=0;p>m;++m)for(var f,v=d[m],g=v.width,_=v.show&&g>0,y=this.getSegments(v,u),C=y.positions,E=y.lengths,S=C.length,w=v.getPickId(l).color,T=0,x=0,b=0;S>b;++b){0===b?v._loop?f=C[S-2]:(f=ae,t.subtract(C[0],C[1],f),t.add(C[0],f,f)):f=C[b-1],ne.x=f.x,ne.y=f.y,ne.z=c!==D.SCENE2D?f.z:0,f=C[b],re.x=f.x,re.y=f.y,re.z=c!==D.SCENE2D?f.z:0,b===S-1?v._loop?f=C[1]:(f=ae,t.subtract(C[S-1],C[S-2],f),t.add(C[S-1],f,f)):f=C[b+1],oe.x=f.x,oe.y=f.y,oe.z=c!==D.SCENE2D?f.z:0;var A=E[T];b===x+A&&(x+=A,++T);for(var P=b-x===0,I=b===x+E[T]-1,M=P?2:0,R=I?2:4,O=M;R>O;++O){h.writeElements(re,e,o),h.writeElements(ne,e,o+6),h.writeElements(oe,e,o+12),i[a]=n.floatToByte(w.red),i[a+1]=n.floatToByte(w.green),i[a+2]=n.floatToByte(w.blue),i[a+3]=n.floatToByte(w.alpha);var N=0>O-2?-1:1;r[s]=b/(S-1),r[s+1]=2*(O%2)-1,r[s+2]=N*g,r[s+3]=_,o+=18,a+=4,s+=4}}};var se=new t,le=new t,ue=new t,ce=new t;H.prototype.writeForMorph=function(e,i){for(var r=this.modelMatrix,n=this.polylines,o=n.length,a=0;o>a;++a)for(var s=n[a],l=s._segments.positions,u=s._segments.lengths,c=l.length,d=0,p=0,m=0;c>m;++m){var v;0===m?s._loop?v=l[c-2]:(v=ce,t.subtract(l[0],l[1],v),t.add(l[0],v,v)):v=l[m-1],v=f.multiplyByPoint(r,v,le);var g,_=f.multiplyByPoint(r,l[m],se);m===c-1?s._loop?g=l[1]:(g=ce,t.subtract(l[c-1],l[c-2],g),t.add(l[c-1],g,g)):g=l[m+1],g=f.multiplyByPoint(r,g,ue);var y=u[d];m===p+y&&(p+=y,++d);for(var C=m-p===0,E=m===p+u[d]-1,S=C?2:0,w=E?2:4,T=S;w>T;++T)h.writeElements(_,e,i),h.writeElements(v,e,i+6),h.writeElements(g,e,i+12),i+=18}};var he=new Array(1);H.prototype.updateIndices=function(e,t,i,r){var n=i.length-1,o=new W(0,r,this);i[n].push(o);var a=0,s=e[e.length-1],l=0;s.length>0&&(l=s[s.length-1]+1);for(var u=this.polylines,c=u.length,h=0;c>h;++h){var d=u[h];d._locatorBuckets=[];var p;if(this.mode===D.SCENE3D){p=he;var f=d._actualPositions.length;if(!(f>0))continue;p[0]=f}else p=d._segments.lengths;var v=p.length;if(v>0){for(var g=0,_=0;v>_;++_)for(var y=p[_]-1,C=0;y>C;++C)l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(d._locatorBuckets.push({locator:o,count:g}),g=0,t.push(4),s=[],e.push(s),l=0,o.count=a,a=0,r=0,o=new W(0,0,this),i[++n]=[o]),s.push(l,l+2,l+1),s.push(l+1,l+2,l+3),g+=6,a+=6,r+=6,l+=4;d._locatorBuckets.push({locator:o,count:g}),l+4>=m.SIXTY_FOUR_KILOBYTES-2&&(t.push(0),s=[],e.push(s),l=0,o.count=a,r=0,a=0,o=new W(0,0,this),i[++n]=[o])}d._clean()}return o.count=a,r},H.prototype.getPolylineStartIndex=function(e){for(var t=this.polylines,i=0,r=t.length,n=0;r>n;++n){var o=t[n];if(o===e)break;i+=o._actualLength}return i};var de={positions:void 0,lengths:void 0},pe=new Array(1),me=new t,fe=new r;H.prototype.getSegments=function(i,r){var n=i._actualPositions;if(this.mode===D.SCENE3D)return pe[0]=n.length,de.positions=n,de.lengths=pe,de;q(i)&&(n=i._segments.positions);for(var o,a=r.ellipsoid,s=[],l=this.modelMatrix,u=n.length,c=me,h=0;u>h;++h)o=n[h],c=f.multiplyByPoint(l,o,c),s.push(r.project(a.cartesianToCartographic(c,fe)));if(s.length>0){i._boundingVolume2D=e.fromPoints(s,i._boundingVolume2D);var d=i._boundingVolume2D.center;i._boundingVolume2D.center=new t(d.z,d.x,d.y)}return de.positions=s,de.lengths=i._segments.lengths,de};var ve,ge;return H.prototype.writeUpdate=function(e,i,r,n,o){var a=this.mode,l=i._actualLength;if(l){e+=this.getPolylineStartIndex(i);var u=ve,c=ge,d=6*l*3;!s(u)||u.lengthd&&(u=new Float32Array(u.buffer,0,d),c=new Float32Array(c.buffer,0,4*l));var p,m=0,f=0,v=this.getSegments(i,o),g=v.positions,_=v.lengths,y=0,C=0,E=i.width,S=i.show&&E>0;l=g.length;for(var w=0;l>w;++w){0===w?i._loop?p=g[l-2]:(p=ae,t.subtract(g[0],g[1],p),t.add(g[0],p,p)):p=g[w-1],ne.x=p.x,ne.y=p.y,ne.z=a!==D.SCENE2D?p.z:0,p=g[w],re.x=p.x,re.y=p.y,re.z=a!==D.SCENE2D?p.z:0,w===l-1?i._loop?p=g[1]:(p=ae,t.subtract(g[l-1],g[l-2],p),t.add(g[l-1],p,p)):p=g[w+1],oe.x=p.x,oe.y=p.y,oe.z=a!==D.SCENE2D?p.z:0;var T=_[y];w===C+T&&(C+=T,++y);for(var x=w-C===0,b=w===C+_[y]-1,A=x?2:0,P=b?2:4,I=A;P>I;++I){h.writeElements(re,u,m),h.writeElements(ne,u,m+6),h.writeElements(oe,u,m+12);var M=0>I-2?-1:1;c[f]=w/(l-1),c[f+1]=2*(I%2)-1,c[f+2]=M*E,c[f+3]=S,m+=18,f+=4}}r.copyFromArrayView(u,18*Float32Array.BYTES_PER_ELEMENT*e),n.copyFromArrayView(c,4*Float32Array.BYTES_PER_ELEMENT*e)}},R}),i("DataSources/ScaledPositionProperty",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/ReferenceFrame","./Property"],function(e,t,i,r,n,o,a){"use strict";function s(e){this._definitionChanged=new n,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}return t(s.prototype,{isConstant:{get:function(){return a.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return e(this._value)?this._value.referenceFrame:o.FIXED}}}),s.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,o.FIXED,t)},s.prototype.setValue=function(t){this._value!==t&&(this._value=t,e(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),e(t)&&(this._removeSubscription=t.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))},s.prototype.getValueInReferenceFrame=function(t,i,n){return e(this._value)?(n=this._value.getValueInReferenceFrame(t,i,n),e(n)?r.WGS84.scaleToGeodeticSurface(n,n):void 0):void 0},s.prototype.equals=function(e){return this===e||e instanceof s&&this._value===e._value},s.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)},s}),i("DataSources/PathVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/JulianDate","../Core/Matrix3","../Core/Matrix4","../Core/ReferenceFrame","../Core/TimeInterval","../Core/Transforms","../Scene/PolylineCollection","../Scene/SceneMode","./CompositePositionProperty","./ConstantPositionProperty","./MaterialProperty","./Property","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionPositionProperty"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function S(e,t,r,n,a,s,l,u,c){var h,d=u;h=e.getValueInReferenceFrame(t,s,c[d]),i(h)&&(c[d++]=h);for(var p,m,f,v=!i(a)||o.lessThanOrEquals(a,t)||o.greaterThanOrEquals(a,r),g=0,_=n.length,y=n[g],C=r,E=!1;_>g;){if(!v&&o.greaterThanOrEquals(y,a)&&(h=e.getValueInReferenceFrame(a,s,c[d]),i(h)&&(c[d++]=h),v=!0),o.greaterThan(y,t)&&o.lessThan(y,C)&&!y.equals(a)&&(h=e.getValueInReferenceFrame(y,s,c[d]),i(h)&&(c[d++]=h)),_-1>g){if(l>0&&!E){var S=n[g+1],w=o.secondsDifference(S,y);E=w>l,E&&(p=Math.ceil(w/l),m=0,f=w/Math.max(p,2),p=Math.max(p-1,1))}if(E&&p>m){y=o.addSeconds(y,f,new o),m++;continue}}E=!1,g++,y=n[g]}return h=e.getValueInReferenceFrame(r,s,c[d]),i(h)&&(c[d++]=h),d}function w(e,t,r,n,a,s,l,u){for(var c,h=0,d=l,p=t,m=Math.max(s,60),f=!i(n)||o.lessThanOrEquals(n,t)||o.greaterThanOrEquals(n,r);o.lessThan(p,r);)!f&&o.greaterThanOrEquals(p,n)&&(f=!0,c=e.getValueInReferenceFrame(n,a,u[d]),i(c)&&(u[d]=c,d++)),c=e.getValueInReferenceFrame(p,a,u[d]),i(c)&&(u[d]=c,d++),h++,p=o.addSeconds(t,m*h,new o);return c=e.getValueInReferenceFrame(r,a,u[d]),i(c)&&(u[d]=c,d++),d}function T(e,t,r,n,a,s,l,c){L.start=t,L.stop=r;for(var h=l,d=e.intervals,p=0;p0){var T=S.pop();c=this._polylineCollection.get(T),t.index=T}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=a,t.polyline=c}var x=v.getValueOrDefault(s._resolution,e,D);c.show=!0,c.positions=P(l,r,n,e,this._referenceFrame,x,c.positions.slice()),c.material=f.getValue(e,s._material,c.material),c.width=v.getValueOrDefault(s._width,e,R)},I.prototype.removeObject=function(e){var t=e.polyline;i(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,e.index=void 0)},I.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),r(this)},M.prototype.update=function(e){var t=this._updaters;for(var r in t)t.hasOwnProperty(r)&&t[r].update(e);for(var n=this._items.values,o=0,a=n.length;a>o;o++){var s=n[o],u=s.entity,c=u._position,h=s.updater,p=l.FIXED;this._scene.mode===d.SCENE3D&&(p=c.referenceFrame);var m=this._updaters[p];h===m&&i(m)?m.updateObject(e,s):(i(h)&&h.removeObject(s),i(m)||(m=new I(this._scene,p),m.update(e),this._updaters[p]=m),s.updater=m,i(m)&&m.updateObject(e,s))}return!0},M.prototype.isDestroyed=function(){return!1},M.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(M.prototype._onCollectionChanged,this);var e=this._updaters;for(var t in e)e.hasOwnProperty(t)&&e[t].destroy();return r(this)},M.prototype._onCollectionChanged=function(e,t,r,n){var o,a,s,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],i(a._path)&&i(a._position)&&l.set(a.id,new E(a));for(o=n.length-1;o>-1;o--)a=n[o],i(a._path)&&i(a._position)?l.contains(a.id)||l.set(a.id,new E(a)):(s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id)));for(o=r.length-1;o>-1;o--)a=r[o],s=l.get(a.id),i(s)&&(s.updater.removeObject(s),l.remove(a.id))},M._subSample=P,M}),i("Shaders/PointPrimitiveCollectionFS",[],function(){"use strict";return"varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nvoid main()\n{\nfloat distanceToCenter = length(gl_PointCoord - vec2(0.5));\nfloat maxDistance = max(0.0, 0.5 - v_pixelDistance);\nfloat wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\nfloat innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\nvec4 color = mix(v_outlineColor, v_color, innerAlpha);\ncolor.a *= wholeAlpha;\nif (color.a < 0.005)\n{\ndiscard;\n}\n#ifdef RENDER_FOR_PICK\ngl_FragColor = v_pickColor;\n#else\ngl_FragColor = color;\n#endif\n}\n"}),i("Shaders/PointPrimitiveCollectionVS",[],function(){"use strict";return"uniform float u_maxTotalPointSize;\nattribute vec4 positionHighAndSize;\nattribute vec4 positionLowAndOutline;\nattribute vec4 compressedAttribute0;\nattribute vec4 compressedAttribute1;\nattribute vec4 scaleByDistance;\nvarying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\n#ifdef RENDER_FOR_PICK\nvarying vec4 v_pickColor;\n#endif\nconst float SHIFT_LEFT8 = 256.0;\nconst float SHIFT_RIGHT8 = 1.0 / 256.0;\nvoid main()\n{\nvec3 positionHigh = positionHighAndSize.xyz;\nvec3 positionLow = positionLowAndOutline.xyz;\nfloat outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\nfloat totalSize = positionHighAndSize.w + outlineWidthBothSides;\nfloat outlinePercent = outlineWidthBothSides / totalSize;\ntotalSize *= czm_resolutionScale;\ntotalSize += 3.0;\nfloat temp = compressedAttribute1.x * SHIFT_RIGHT8;\nfloat show = floor(temp);\n#ifdef EYE_DISTANCE_TRANSLUCENCY\nvec4 translucencyByDistance;\ntranslucencyByDistance.x = compressedAttribute1.z;\ntranslucencyByDistance.z = compressedAttribute1.w;\ntranslucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\ntemp = compressedAttribute1.y * SHIFT_RIGHT8;\ntranslucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n#endif\nvec4 color;\nvec4 outlineColor;\n#ifdef RENDER_FOR_PICK\ncolor = vec4(0.0);\noutlineColor = vec4(0.0);\nvec4 pickColor;\ntemp = compressedAttribute0.z * SHIFT_RIGHT8;\npickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\npickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor.r = floor(temp);\n#else\ntemp = compressedAttribute0.x * SHIFT_RIGHT8;\ncolor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\ncolor.g = (temp - floor(temp)) * SHIFT_LEFT8;\ncolor.r = floor(temp);\ntemp = compressedAttribute0.y * SHIFT_RIGHT8;\noutlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor.r = floor(temp);\n#endif\ntemp = compressedAttribute0.w * SHIFT_RIGHT8;\n#ifdef RENDER_FOR_PICK\npickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\npickColor = pickColor / 255.0;\n#endif\ntemp = floor(temp) * SHIFT_RIGHT8;\noutlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\noutlineColor /= 255.0;\ncolor.a = floor(temp);\ncolor /= 255.0;\nvec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\nvec4 positionEC = czm_modelViewRelativeToEye * p;\npositionEC.xyz *= show;\n#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY)\nfloat lengthSq;\nif (czm_sceneMode == czm_sceneMode2D)\n{\nlengthSq = czm_eyeHeight2D.y;\n}\nelse\n{\nlengthSq = dot(positionEC.xyz, positionEC.xyz);\n}\n#endif\n#ifdef EYE_DISTANCE_SCALING\ntotalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n#endif\ntotalSize = min(totalSize, u_maxTotalPointSize);\nif (totalSize < 1.0)\n{\npositionEC.xyz = vec3(0.0);\ntotalSize = 1.0;\n}\nfloat translucency = 1.0;\n#ifdef EYE_DISTANCE_TRANSLUCENCY\ntranslucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\nif (translucency < 0.004)\n{\npositionEC.xyz = vec3(0.0);\n}\n#endif\nvec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\ngl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\nv_color = color;\nv_color.a *= translucency;\nv_outlineColor = outlineColor;\nv_outlineColor.a *= translucency;\nv_innerPercent = 1.0 - outlinePercent;\nv_pixelDistance = 2.0 / totalSize;\ngl_PointSize = totalSize;\n#ifdef RENDER_FOR_PICK\nv_pickColor = pickColor;\n#endif\n}\n"}),i("Scene/PointPrimitive",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","../Core/NearFarScalar","./SceneMode","./SceneTransforms"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(e,i){e=n(e,n.EMPTY_OBJECT),this._show=n(e.show,!0),this._position=t.clone(n(e.position,t.ZERO)),this._actualPosition=t.clone(this._position),this._color=r.clone(n(e.color,r.WHITE)),this._outlineColor=r.clone(n(e.outlineColor,r.TRANSPARENT)),this._outlineWidth=n(e.outlineWidth,0),this._pixelSize=n(e.pixelSize,10),this._scaleByDistance=e.scaleByDistance,this._translucencyByDistance=e.translucencyByDistance,this._id=e.id,this._collection=n(e.collection,i),this._pickId=void 0,this._pointPrimitiveCollection=i,this._dirty=!1,this._index=-1}function p(e,t){var i=e._pointPrimitiveCollection;o(i)&&(i._updatePointPrimitive(e,t),e._dirty=!0)}var m=d.SHOW_INDEX=0,f=d.POSITION_INDEX=1,v=d.COLOR_INDEX=2,g=d.OUTLINE_COLOR_INDEX=3,_=d.OUTLINE_WIDTH_INDEX=4,y=d.PIXEL_SIZE_INDEX=5,C=d.SCALE_BY_DISTANCE_INDEX=6,E=d.TRANSLUCENCY_BY_DISTANCE_INDEX=7;d.NUMBER_OF_PROPERTIES=8,a(d.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,p(this,m))}},position:{get:function(){return this._position},set:function(e){var i=this._position;t.equals(i,e)||(t.clone(e,i),t.clone(e,this._actualPosition),p(this,f))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){var t=this._scaleByDistance;u.equals(t,e)||(this._scaleByDistance=u.clone(e,t),p(this,C))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){var t=this._translucencyByDistance;u.equals(t,e)||(this._translucencyByDistance=u.clone(e,t),p(this,E))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,p(this,y))}},color:{get:function(){return this._color},set:function(e){var t=this._color;r.equals(t,e)||(r.clone(e,t),p(this,v))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){var t=this._outlineColor;r.equals(t,e)||(r.clone(e,t),p(this,g))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,p(this,_))}},id:{get:function(){return this._id},set:function(e){this._id=e,o(this._pickId)&&(this._pickId.object.id=e)}}}),d.prototype.getPickId=function(e){return o(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId},d.prototype._getActualPosition=function(){return this._actualPosition},d.prototype._setActualPosition=function(e){t.clone(e,this._actualPosition),p(this,f)};var S=new i;d._computeActualPosition=function(e,t,i){return t.mode===c.SCENE3D?e:(l.multiplyByPoint(i,e,S),h.computeActualWgs84Position(t,S))};var w=new l,T=new i;return d._computeScreenSpacePosition=function(e,t,r,n){var o=r.camera,a=o.viewMatrix,s=o.frustum.projectionMatrix,u=l.multiplyTransformation(a,e,w),c=l.multiplyByVector(u,i.fromElements(t.x,t.y,t.z,1,T),T),d=l.multiplyByVector(s,c,T),p=h.clipToGLWindowCoordinates(r,d,n);return p},d.prototype.computeScreenSpacePosition=function(t,i){var r=this._pointPrimitiveCollection;o(i)||(i=new e);var n=r.modelMatrix,a=d._computeScreenSpacePosition(n,this._actualPosition,t,i);return a.y=t.canvas.clientHeight-a.y,a},d.prototype.equals=function(e){return this===e||o(e)&&this._id===e._id&&t.equals(this._position,e._position)&&r.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&r.equals(this._outlineColor,e._outlineColor)&&u.equals(this._scaleByDistance,e._scaleByDistance)&&u.equals(this._translucencyByDistance,e._translucencyByDistance)},d.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0},d}),i("Scene/PointPrimitiveCollection",["../Core/BoundingSphere","../Core/Cartesian2","../Core/Cartesian3","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EncodedCartesian3","../Core/Math","../Core/Matrix4","../Core/PrimitiveType","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArrayFacade","../Shaders/PointPrimitiveCollectionFS","../Shaders/PointPrimitiveCollectionVS","./BlendingState","./Pass","./PointPrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(t){t=o(t,o.EMPTY_OBJECT),this._sp=void 0,this._rs=void 0,this._vaf=void 0,this._spPick=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._compiledShaderScaleByDistancePick=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistancePick=!1,this._propertiesChanged=new Uint32Array(Y),this._maxPixelSize=1,this._baseVolume=new e,this._baseVolumeWC=new e,this._baseVolume2D=new e,this._boundingVolume=new e,this._boundingVolumeDirty=!1,this._colorCommands=[],this._pickCommands=[],this.modelMatrix=d.clone(o(t.modelMatrix,d.IDENTITY)),this._modelMatrix=d.clone(d.IDENTITY),this.debugShowBoundingVolume=o(t.debugShowBoundingVolume,!1),this._mode=b.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW,m.STATIC_DRAW];var i=this;this._uniforms={u_maxTotalPointSize:function(){return i._maxTotalPointSize}}}function P(e){for(var t=e.length,i=0;t>i;++i)e[i]&&e[i]._destroy()}function I(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;for(var t=[],i=e._pointPrimitives,r=i.length,n=0,o=0;r>n;++n){var a=i[n];a&&(a._index=o++,t.push(a))}e._pointPrimitives=t}}function M(e,t,i){return new C(e,[{index:X.positionHighAndSize,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.positionLowAndShow,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[z]},{index:X.compressedAttribute0,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[U]},{index:X.compressedAttribute1,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[j]},{index:X.scaleByDistance,componentsPerAttribute:4,componentDatatype:n.FLOAT,usage:i[q]}],t)}function D(t,i,r,n){var o=n._index,a=n._getActualPosition();t._mode===b.SCENE3D&&(e.expand(t._baseVolume,a,t._baseVolume),t._boundingVolumeDirty=!0),c.fromCartesian(a,Z);var s=n.pixelSize,l=n.outlineWidth;t._maxPixelSize=Math.max(t._maxPixelSize,s+l);var u=r[X.positionHighAndSize],h=Z.high;u(o,h.x,h.y,h.z,s);var d=r[X.positionLowAndOutline],p=Z.low;d(o,p.x,p.y,p.z,l)}function R(e,t,i,n){var o=n._index,a=n.color,s=n.getPickId(t).color,l=n.outlineColor,u=r.floatToByte(a.red),c=r.floatToByte(a.green),h=r.floatToByte(a.blue),d=u*K+c*Q+h;u=r.floatToByte(l.red),c=r.floatToByte(l.green),h=r.floatToByte(l.blue);var p=u*K+c*Q+h;u=r.floatToByte(s.red),c=r.floatToByte(s.green),h=r.floatToByte(s.blue);var m=u*K+c*Q+h,f=r.floatToByte(a.alpha)*K+r.floatToByte(l.alpha)*Q+r.floatToByte(s.alpha),v=i[X.compressedAttribute0];v(o,d,p,m,f)}function O(e,t,i,r){var n=r._index,o=0,s=1,l=1,u=1,c=r.translucencyByDistance;a(c)&&(o=c.near,s=c.nearValue,l=c.far,u=c.farValue,(1!==s||1!==u)&&(e._shaderTranslucencyByDistance=!0));var d=r.show;0===r.color.alpha&&0===r.outlineColor.alpha&&(d=!1),s=h.clamp(s,0,1),s=1===s?255:255*s|0;var p=(d?1:0)*Q+s;u=h.clamp(u,0,1),u=1===u?255:255*u|0;var m=u,f=i[X.compressedAttribute1];f(n,p,m,o,l)}function N(e,t,i,r){var n=r._index,o=i[X.scaleByDistance],s=0,l=1,u=1,c=1,h=r.scaleByDistance;a(h)&&(s=h.near,l=h.nearValue,u=h.far,c=h.farValue,(1!==l||1!==c)&&(e._shaderScaleByDistance=!0)),o(n,s,l,u,c)}function L(e,t,i,r){D(e,t,i,r),R(e,t,i,r),O(e,t,i,r),N(e,t,i,r)}function F(t,i,r,n,o,s){var l;n.mode===b.SCENE3D?(l=t._baseVolume,t._boundingVolumeDirty=!0):l=t._baseVolume2D;for(var u=[],c=0;r>c;++c){var h=i[c],d=h.position,p=x._computeActualPosition(d,n,o);a(p)&&(h._setActualPosition(p),s?u.push(p):e.expand(l,p,l))}s&&e.fromPoints(u,l)}function B(e,t){var i=t.mode,r=e._pointPrimitives,n=e._pointPrimitivesToUpdate,o=e._modelMatrix;e._createVertexArray||e._mode!==i||i!==b.SCENE3D&&!d.equals(o,e.modelMatrix)?(e._mode=i,d.clone(e.modelMatrix,o),e._createVertexArray=!0,(i===b.SCENE3D||i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,r,r.length,t,o,!0)):i===b.MORPHING?F(e,r,r.length,t,o,!0):(i===b.SCENE2D||i===b.COLUMBUS_VIEW)&&F(e,n,e._pointPrimitivesToUpdateIndex,t,o,!1); }function V(e,t,i){var r=t.camera.getPixelSize(i,t.context.drawingBufferWidth,t.context.drawingBufferHeight),n=r*e._maxPixelSize;i.radius+=n}var k=x.SHOW_INDEX,z=x.POSITION_INDEX,U=x.COLOR_INDEX,G=x.OUTLINE_COLOR_INDEX,W=x.OUTLINE_WIDTH_INDEX,H=x.PIXEL_SIZE_INDEX,q=x.SCALE_BY_DISTANCE_INDEX,j=x.TRANSLUCENCY_BY_DISTANCE_INDEX,Y=x.NUMBER_OF_PROPERTIES,X={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4};s(A.prototype,{length:{get:function(){return I(this),this._pointPrimitives.length}}}),A.prototype.add=function(e){var t=new x(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t},A.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1},A.prototype.removeAll=function(){P(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0},A.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]},A.prototype.contains=function(e){return a(e)&&e._pointPrimitiveCollection===this},A.prototype.get=function(e){return I(this),this._pointPrimitives[e]},A.prototype.computeNewBuffersUsage=function(){for(var e=this._buffersUsage,t=!1,i=this._propertiesChanged,r=0;Y>r;++r){var n=0===i[r]?m.STATIC_DRAW:m.STREAM_DRAW;t=t||e[r]!==n,e[r]=n}return t};var Z=new c,K=65536,Q=256,J=[];return A.prototype.update=function(t){I(this),this._maxTotalPointSize=f.maximumAliasedPointSize,B(this,t);var i,r=this._pointPrimitives,n=r.length,o=this._pointPrimitivesToUpdate,s=this._pointPrimitivesToUpdateIndex,l=this._propertiesChanged,u=this._createVertexArray,c=t.context,h=t.passes,m=h.pick;if(u||!m&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(var C=0;Y>C;++C)l[C]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=M(c,n,this._buffersUsage),i=this._vaf.writers;for(var x=0;n>x;++x){var A=this._pointPrimitives[x];A._dirty=!1,L(this,c,i,A)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(s>0){var P=J;P.length=0,(l[z]||l[W]||l[H])&&P.push(D),(l[U]||l[G])&&P.push(R),(l[k]||l[j])&&P.push(O),l[q]&&P.push(N);var F=P.length;if(i=this._vaf.writers,s/n>.1){for(var Z=0;s>Z;++Z){var K=o[Z];K._dirty=!1;for(var Q=0;F>Q;++Q)P[Q](this,c,i,K)}this._vaf.commit()}else{for(var $=0;s>$;++$){var ee=o[$];ee._dirty=!1;for(var te=0;F>te;++te)P[te](this,c,i,ee);this._vaf.subCommit(ee._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(s>1.5*n&&(o.length=n),a(this._vaf)&&a(this._vaf.va)){this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,e.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));var ie,re=d.IDENTITY;t.mode===b.SCENE3D?(re=this.modelMatrix,ie=e.clone(this._baseVolumeWC,this._boundingVolume)):ie=e.clone(this._baseVolume2D,this._boundingVolume),V(this,t,ie);var ne,oe,ae,se,le,ue,ce=t.commandList;if(h.render){var he=this._colorCommands;for(a(this._rs)||(this._rs=g.fromCache({depthTest:{enabled:!0},blending:w.ALPHA_BLEND})),(!a(this._sp)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance)&&(le=new y({sources:[S]}),this._shaderScaleByDistance&&le.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&le.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._sp=_.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:le,fragmentShaderSource:E,attributeLocations:X}),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance),ne=this._vaf.va,oe=ne.length,he.length=oe,se=0;oe>se;++se)ae=he[se],a(ae)||(ae=he[se]=new v({primitiveType:p.POINTS,pass:T.OPAQUE,owner:this})),ae.boundingVolume=ie,ae.modelMatrix=re,ae.shaderProgram=this._sp,ae.uniformMap=this._uniforms,ae.vertexArray=ne[se].va,ae.renderState=this._rs,ae.debugShowBoundingVolume=this.debugShowBoundingVolume,ce.push(ae)}if(m){var de=this._pickCommands;for((!a(this._spPick)||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistancePick||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistancePick)&&(le=new y({defines:["RENDER_FOR_PICK"],sources:[S]}),this._shaderScaleByDistance&&le.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&le.defines.push("EYE_DISTANCE_TRANSLUCENCY"),ue=new y({defines:["RENDER_FOR_PICK"],sources:[E]}),this._spPick=_.replaceCache({context:c,shaderProgram:this._spPick,vertexShaderSource:le,fragmentShaderSource:ue,attributeLocations:X}),this._compiledShaderScaleByDistancePick=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistancePick=this._shaderTranslucencyByDistance),ne=this._vaf.va,oe=ne.length,de.length=oe,se=0;oe>se;++se)ae=de[se],a(ae)||(ae=de[se]=new v({primitiveType:p.POINTS,pass:T.OPAQUE,owner:this})),ae.boundingVolume=ie,ae.modelMatrix=re,ae.shaderProgram=this._spPick,ae.uniformMap=this._uniforms,ae.vertexArray=ne[se].va,ae.renderState=this._rs,ce.push(ae)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),P(this._pointPrimitives),l(this)},A}),i("DataSources/PointVisualizer",["../Core/AssociativeArray","../Core/Cartesian3","../Core/Color","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/NearFarScalar","../Scene/PointPrimitiveCollection","./BoundingSphereState","./Property"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){this.entity=e,this.pointPrimitive=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function h(t,i){i.collectionChanged.addEventListener(h.prototype._onCollectionChanged,this),this._scene=t,this._unusedIndexes=[],this._entityCollection=i,this._pointPrimitiveCollection=void 0,this._items=new e,this._onCollectionChanged(i,i.values,[],[])}function d(e,t){if(r(e)){var i=e.pointPrimitive;r(i)&&(e.pointPrimitive=void 0,i.show=!1,t.push(i._index))}}var p=i.WHITE,m=i.BLACK,f=0,v=1,g=new i,_=new t,y=new i,C=new a,E=new a;return h.prototype.update=function(e){for(var t=this._items.values,i=this._unusedIndexes,n=0,o=t.length;o>n;n++){var a=t[n],l=a.entity,c=l._point,h=a.pointPrimitive,S=l.isShowing&&l.isAvailable(e)&&u.getValueOrDefault(c._show,e,!0);if(S&&(_=u.getValueOrUndefined(l._position,e,_),S=r(_)),S){if(!r(h)){var w=this._pointPrimitiveCollection;r(w)||(w=new s,this._pointPrimitiveCollection=w,this._scene.primitives.add(w));var T=i.length;h=T>0?w.get(i.pop()):w.add(),h.id=l,a.pointPrimitive=h}h.show=!0,h.position=_,h.scaleByDistance=u.getValueOrUndefined(c._scaleByDistance,e,C),h.translucencyByDistance=u.getValueOrUndefined(c._translucencyByDistance,e,E),h.color=u.getValueOrDefault(c._color,e,p,g),h.outlineColor=u.getValueOrDefault(c._outlineColor,e,m,y),h.outlineWidth=u.getValueOrDefault(c._outlineWidth,e,f),h.pixelSize=u.getValueOrDefault(c._pixelSize,e,v)}else d(a,i)}return!0},h.prototype.getBoundingSphere=function(e,i){var n=this._items.get(e.id);return r(n)&&r(n.pointPrimitive)?(i.center=t.clone(n.pointPrimitive.position,i.center),i.radius=0,l.DONE):l.FAILED},h.prototype.isDestroyed=function(){return!1},h.prototype.destroy=function(){return this._entityCollection.collectionChanged.removeEventListener(h.prototype._onCollectionChanged,this),r(this._pointPrimitiveCollection)&&this._scene.primitives.remove(this._pointPrimitiveCollection),n(this)},h.prototype._onCollectionChanged=function(e,t,i,n){var o,a,s=this._unusedIndexes,l=this._items;for(o=t.length-1;o>-1;o--)a=t[o],r(a._point)&&r(a._position)&&l.set(a.id,new c(a));for(o=n.length-1;o>-1;o--)a=n[o],r(a._point)&&r(a._position)?l.contains(a.id)||l.set(a.id,new c(a)):(d(l.get(a.id),s),l.remove(a.id));for(o=i.length-1;o>-1;o--)a=i[o],d(l.get(a.id),s),l.remove(a.id)},h}),i("DataSources/PolygonGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/isArray","../Core/Iso8601","../Core/PolygonGeometry","../Core/PolygonHierarchy","../Core/PolygonOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0}function T(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(T.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new w(e),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}function x(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new w(t._entity)}var b=new _(e.WHITE),A=new y(!0),P=new y(!0),I=new y(!1),M=new y(e.BLACK),D=new e;return n(T,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:f}}),n(T.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&S.isConstant(this._showProperty)&&S.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),T.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},T.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},T.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new m(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof _){var c=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(c=this._materialProperty.color.getValue(i)),o=t.fromColor(c),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},T.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=S.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new p(this._options),attributes:{show:new m(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){this._entitySubscription(),o(this)},T.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"polygon"===t){var a=this._entity.polygon;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(c.MINIMUM_VALUE):!0,h=a.outline,p=r(h);if(p&&h.isConstant&&(p=h.getValue(c.MINIMUM_VALUE)),!l&&!p)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var m=a.hierarchy,g=a.show;if(r(g)&&g.isConstant&&!g.getValue(c.MINIMUM_VALUE)||!r(m))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var y=i(a.material,b),C=y instanceof _;this._materialProperty=y,this._fillProperty=i(s,P),this._showProperty=i(g,A),this._showOutlineProperty=i(a.outline,I),this._outlineColorProperty=p?i(a.outlineColor,M):void 0;var E=a.height,w=a.extrudedHeight,T=a.granularity,x=a.stRotation,D=a.outlineWidth,R=a.perPositionHeight;if(this._fillEnabled=l,this._outlineEnabled=p,m.isConstant&&S.isConstant(E)&&S.isConstant(w)&&S.isConstant(T)&&S.isConstant(x)&&S.isConstant(D)&&S.isConstant(R)){var O=this._options;O.vertexFormat=C?v.VERTEX_FORMAT:f.MaterialSupport.TEXTURED.vertexFormat;var N=m.getValue(c.MINIMUM_VALUE);u(N)&&(N=new d(N));var L=r(E)?E.getValue(c.MINIMUM_VALUE):void 0,F=r(w)?w.getValue(c.MINIMUM_VALUE):void 0;O.polygonHierarchy=N,O.height=L,O.extrudedHeight=F,O.granularity=r(T)?T.getValue(c.MINIMUM_VALUE):void 0,O.stRotation=r(x)?x.getValue(c.MINIMUM_VALUE):void 0,O.perPositionHeight=r(R)?R.getValue(c.MINIMUM_VALUE):void 0,this._outlineWidth=r(D)?D.getValue(c.MINIMUM_VALUE):1,this._isClosed=r(F)&&F!==L,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},T.prototype.createDynamicUpdater=function(e){return new x(e,this)},x.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polygon;if(a.isShowing&&a.isAvailable(i)&&S.getValueOrDefault(s.show,i,!0)){var c=this._options,m=S.getValueOrUndefined(s.hierarchy,i);if(r(m)){if(u(m)?c.polygonHierarchy=new d(m):c.polygonHierarchy=m,c.height=S.getValueOrUndefined(s.height,i),c.extrudedHeight=S.getValueOrUndefined(s.extrudedHeight,i),c.granularity=S.getValueOrUndefined(s.granularity,i),c.stRotation=S.getValueOrUndefined(s.stRotation,i),c.perPositionHeight=S.getValueOrUndefined(s.perPositionHeight,i),S.getValueOrDefault(s.fill,i,!0)){var _=E.getValue(i,o.fillMaterialProperty,this._material);this._material=_;var y=new f({material:_,translucent:_.isTranslucent(),closed:r(c.extrudedHeight)&&c.extrudedHeight!==c.height});c.vertexFormat=y.vertexFormat,this._primitive=n.add(new g({geometryInstances:new l({id:a,geometry:new h(c)}),appearance:y,asynchronous:!1}))}if(S.getValueOrDefault(s.outline,i,!1)){c.vertexFormat=v.VERTEX_FORMAT;var C=S.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,D),w=S.getValueOrDefault(s.outlineWidth,i,1),T=1!==C.alpha;this._outlinePrimitive=n.add(new g({geometryInstances:new l({id:a,geometry:new p(c),attributes:{color:t.fromColor(C)}}),appearance:new v({flat:!0,translucent:T,renderState:{lineWidth:o._scene.clampLineWidth(w)}}),asynchronous:!1}))}}}},x.prototype.getBoundingSphere=function(e,t){return C(e,this._primitive,this._outlinePrimitive,t)},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},T}),i("Shaders/Appearances/PolylineColorAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nvarying vec4 v_color;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_color = color;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineColorAppearance",["../Core/defaultValue","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PerInstanceFlatColorAppearanceFS","../Shaders/Appearances/PolylineColorAppearanceVS","../Shaders/PolylineCommon","./Appearance"],function(e,t,i,r,n,o,a){"use strict";function s(t){t=e(t,e.EMPTY_OBJECT);var i=e(t.translucent,!0),r=!1,n=s.VERTEX_FORMAT;this.material=void 0,this.translucent=i,this._vertexShaderSource=e(t.vertexShaderSource,l),this._fragmentShaderSource=e(t.fragmentShaderSource,u),this._renderState=a.getDefaultRenderState(i,r,t.renderState),this._closed=r,this._vertexFormat=n}var l=o+"\n"+n,u=r;return t(s.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),s.VERTEX_FORMAT=i.POSITION_ONLY,s.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,s.prototype.isTranslucent=a.prototype.isTranslucent,s.prototype.getRenderState=a.prototype.getRenderState,s}),i("Shaders/Appearances/PolylineMaterialAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nvarying float v_width;\nvarying vec2 v_st;\nvoid main()\n{\nfloat expandDir = expandAndWidth.x;\nfloat width = abs(expandAndWidth.y) + 0.5;\nbool usePrev = expandAndWidth.y < 0.0;\nvec4 p = czm_computePosition();\nvec4 prev = czm_computePrevPosition();\nvec4 next = czm_computeNextPosition();\nv_width = width;\nv_st = st;\nvec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev);\ngl_Position = czm_viewportOrthographic * positionWC;\n}\n"}),i("Scene/PolylineMaterialAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PolylineMaterialAppearanceVS","../Shaders/PolylineCommon","../Shaders/PolylineFS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),n=!1,o=u.VERTEX_FORMAT;this.material=t(i.material)?i.material:l.fromType(l.ColorType),this.translucent=r,this._vertexShaderSource=e(i.vertexShaderSource,c),this._fragmentShaderSource=e(i.fragmentShaderSource,h),this._renderState=s.getDefaultRenderState(r,n,i.renderState),this._closed=n,this._vertexFormat=o}var c=o+"\n"+n,h=a;return i(u.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}}),u.VERTEX_FORMAT=r.POSITION_AND_ST,u.prototype.getFragmentShaderSource=s.prototype.getFragmentShaderSource,u.prototype.isTranslucent=s.prototype.isTranslucent,u.prototype.getRenderState=s.prototype.getRenderState,u}),i("DataSources/PolylineGeometryUpdater",["../Core/BoundingSphere","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineGeometry","../Core/PolylinePipeline","../Core/ShowGeometryInstanceAttribute","../Scene/PolylineCollection","../Scene/PolylineColorAppearance","../Scene/PolylineMaterialAppearance","./BoundingSphereState","./ColorMaterialProperty","./ConstantProperty","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.followSurface=void 0,this.granularity=void 0}function T(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(T.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new u,this._showProperty=void 0,this._materialProperty=void 0,this._options=new w(e),this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}function x(e,t){var i=t._scene.id,r=b[i];!n(r)||r.isDestroyed()?(r=new f,b[i]=r,e.add(r)):e.contains(r)||e.add(r);var o=r.add();o.id=t._entity,this._line=o,this._primitives=e,this._geometryUpdater=t,this._positions=[],I.ellipsoid=t._scene.globe.ellipsoid}var b={},A=new y(t.WHITE),P=new C(!0);o(T,{perInstanceColorAppearanceType:{value:v},materialAppearanceType:{value:g}}),o(T.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!n(this._entity.availability)&&S.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}}}),T.prototype.isOutlineVisible=function(e){return!1},T.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)},T.prototype.createFillGeometryInstance=function(e){var r,o,a=this._entity,s=a.isAvailable(e),l=new m(s&&a.isShowing&&this._showProperty.getValue(e));if(this._materialProperty instanceof y){var u=t.WHITE;n(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(u=this._materialProperty.color.getValue(e)),r=i.fromColor(u),o={show:l,color:r}}else o={show:l};return new c({id:a,geometry:new d(this._options),attributes:o})},T.prototype.createOutlineGeometryInstance=function(e){},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){this._entitySubscription(),a(this)},T.prototype._onEntityPropertyChanged=function(e,t,i,o){if("availability"===t||"polyline"===t){var a=this._entity.polyline;if(!n(a))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.positions,l=a.show;if(n(l)&&l.isConstant&&!l.getValue(h.MINIMUM_VALUE)||!n(s))return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));var u=r(a.material,A),c=u instanceof y;this._materialProperty=u,this._showProperty=r(l,P),this._fillEnabled=!0;var d=a.width,p=a.followSurface,m=a.granularity;if(s.isConstant&&S.isConstant(d)&&S.isConstant(p)&&S.isConstant(m)){var f=this._options,_=s.getValue(h.MINIMUM_VALUE,f.positions);if(!n(_)||_.length<2)return void(this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this)));f.vertexFormat=c?v.VERTEX_FORMAT:g.VERTEX_FORMAT,f.positions=_,f.width=n(d)?d.getValue(h.MINIMUM_VALUE):void 0,f.followSurface=n(p)?p.getValue(h.MINIMUM_VALUE):void 0,f.granularity=n(m)?m.getValue(h.MINIMUM_VALUE):void 0,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},T.prototype.createDynamicUpdater=function(e){return new x(e,this)};var I={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};return x.prototype.update=function(e){var t=this._geometryUpdater,i=t._entity,r=i.polyline,o=this._line;if(!i.isShowing||!i.isAvailable(e)||!S.getValueOrDefault(r._show,e,!0))return void(o.show=!1);var a=r.positions,s=S.getValueOrUndefined(a,e,this._positions);if(!n(s)||s.length<2)return void(o.show=!1);var l=S.getValueOrDefault(r._followSurface,e,!0);l&&(I.positions=s,I.granularity=S.getValueOrUndefined(r._granularity,e),I.height=p.extractHeights(s,this._geometryUpdater._scene.globe.ellipsoid),s=p.generateCartesianArc(I)),o.show=!0,o.positions=s.slice(),o.material=E.getValue(e,t.fillMaterialProperty,o.material),o.width=S.getValueOrDefault(r._width,e,1)},x.prototype.getBoundingSphere=function(t,i){var r=this._line;return r.show&&r.positions.length>0?(e.fromPoints(r.positions,i),_.DONE):_.FAILED},x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){var e=this._geometryUpdater,t=e._scene.id,i=b[t];i.remove(this._line),0===i.length&&(this._primitives.removeAndDestroy(i),delete b[t]),a(this)},T}),i("DataSources/PolylineVolumeGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/PolylineVolumeGeometry","../Core/PolylineVolumeOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!0},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"polylineVolume"===t){var a=this._entity.polylineVolume;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.positions,f=a.shape,g=a.show;if(!r(d)||!r(f)||r(g)&&g.isConstant&&!g.getValue(u.MINIMUM_VALUE))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var _=i(a.material,T),y=_ instanceof v;this._materialProperty=_,this._fillProperty=i(s,b),this._showProperty=i(g,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var E=a.granularity,S=a.outlineWidth,w=a.cornerType;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&f.isConstant&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)){var I=this._options;I.vertexFormat=y?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.polylinePositions=d.getValue(u.MINIMUM_VALUE,I.polylinePositions),I.shapePositions=f.getValue(u.MINIMUM_VALUE,I.shape),I.granularity=r(E)?E.getValue(u.MINIMUM_VALUE):void 0,I.cornerType=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(S)?S.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.polylineVolume;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.positions,i,u.polylinePositions),v=C.getValueOrUndefined(s.shape,i);if(r(d)&&r(v)){if(u.polylinePositions=d,u.shapePositions=v,u.granularity=C.getValueOrUndefined(s.granularity,i),u.cornerType=C.getValueOrUndefined(s.cornerType,i),!r(s.fill)||s.fill.getValue(i)){var g=y.getValue(i,o.fillMaterialProperty,this._material);this._material=g;var _=new p({material:g,translucent:g.isTranslucent(),closed:!0});u.vertexFormat=_.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:_,asynchronous:!1}))}if(r(s.outline)&&s.outline.getValue(i)){u.vertexFormat=m.VERTEX_FORMAT;var E=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),S=C.getValueOrDefault(s.outlineWidth,i,1),w=1!==E.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(E)}}),appearance:new m({flat:!0,translucent:w,renderState:{lineWidth:o._scene.clampLineWidth(S)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){ return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/RectangleGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/RectangleGeometry","../Core/RectangleOutlineGeometry","../Core/ShowGeometryInstanceAttribute","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.closeBottom=void 0,this.closeTop=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._isClosed=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new d(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var h=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(h=this._materialProperty.color.getValue(i)),o=t.fromColor(h),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new c(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new h(this._options),attributes:{show:new d(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"rectangle"===t){var a=this._entity.rectangle;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.coordinates,f=a.show;if(r(f)&&f.isConstant&&!f.getValue(u.MINIMUM_VALUE)||!r(d))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=i(a.material,T),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(s,b),this._showProperty=i(f,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var y=a.height,E=a.extrudedHeight,S=a.granularity,w=a.stRotation,I=a.rotation,M=a.outlineWidth,D=a.closeBottom,R=a.closeTop;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&C.isConstant(y)&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)&&C.isConstant(I)&&C.isConstant(M)&&C.isConstant(D)&&C.isConstant(R)){var O=this._options;O.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,O.rectangle=d.getValue(u.MINIMUM_VALUE,O.rectangle),O.height=r(y)?y.getValue(u.MINIMUM_VALUE):void 0,O.extrudedHeight=r(E)?E.getValue(u.MINIMUM_VALUE):void 0,O.granularity=r(S)?S.getValue(u.MINIMUM_VALUE):void 0,O.stRotation=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,O.rotation=r(I)?I.getValue(u.MINIMUM_VALUE):void 0,O.closeBottom=r(D)?D.getValue(u.MINIMUM_VALUE):void 0,O.closeTop=r(R)?R.getValue(u.MINIMUM_VALUE):void 0,this._isClosed=r(E)&&r(O.closeTop)&&r(O.closeBottom)&&O.closeTop&&O.closeBottom,this._outlineWidth=r(M)?M.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.rectangle;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,d=C.getValueOrUndefined(s.coordinates,i,u.rectangle);if(r(d)){if(u.rectangle=d,u.height=C.getValueOrUndefined(s.height,i),u.extrudedHeight=C.getValueOrUndefined(s.extrudedHeight,i),u.granularity=C.getValueOrUndefined(s.granularity,i),u.stRotation=C.getValueOrUndefined(s.stRotation,i),u.rotation=C.getValueOrUndefined(s.rotation,i),u.closeBottom=C.getValueOrUndefined(s.closeBottom,i),u.closeTop=C.getValueOrUndefined(s.closeTop,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new c(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),E=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/WallGeometryUpdater",["../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/GeometryInstance","../Core/Iso8601","../Core/ShowGeometryInstanceAttribute","../Core/WallGeometry","../Core/WallOutlineGeometry","../Scene/MaterialAppearance","../Scene/PerInstanceColorAppearance","../Scene/Primitive","./ColorMaterialProperty","./ConstantProperty","./dynamicGeometryGetBoundingSphere","./MaterialProperty","./Property"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C){"use strict";function E(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function S(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(S.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new s,this._showProperty=void 0,this._materialProperty=void 0,this._hasConstantOutline=!0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._options=new E(e),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}function w(e,t){this._primitives=e,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=t,this._options=new E(t._entity)}var T=new v(e.WHITE),x=new g(!0),b=new g(!0),A=new g(!1),P=new g(e.BLACK),I=new e;return n(S,{perInstanceColorAppearanceType:{value:m},materialAppearanceType:{value:p}}),n(S.prototype,{entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!r(this._entity.availability)&&C.isConstant(this._showProperty)&&C.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return!1}},geometryChanged:{get:function(){return this._geometryChanged}}}),S.prototype.isOutlineVisible=function(e){var t=this._entity;return this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)},S.prototype.isFilled=function(e){var t=this._entity;return this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)},S.prototype.createFillGeometryInstance=function(i){var n,o,a=this._entity,s=a.isAvailable(i),u=new c(s&&a.isShowing&&this._showProperty.getValue(i)&&this._fillProperty.getValue(i));if(this._materialProperty instanceof v){var d=e.WHITE;r(this._materialProperty.color)&&(this._materialProperty.color.isConstant||s)&&(d=this._materialProperty.color.getValue(i)),o=t.fromColor(d),n={show:u,color:o}}else n={show:u};return new l({id:a,geometry:new h(this._options),attributes:n})},S.prototype.createOutlineGeometryInstance=function(i){var r=this._entity,n=r.isAvailable(i),o=C.getValueOrDefault(this._outlineColorProperty,i,e.BLACK);return new l({id:r,geometry:new d(this._options),attributes:{show:new c(n&&r.isShowing&&this._showProperty.getValue(i)&&this._showOutlineProperty.getValue(i)),color:t.fromColor(o)}})},S.prototype.isDestroyed=function(){return!1},S.prototype.destroy=function(){this._entitySubscription(),o(this)},S.prototype._onEntityPropertyChanged=function(e,t,n,o){if("availability"===t||"wall"===t){var a=this._entity.wall;if(!r(a))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var s=a.fill,l=r(s)&&s.isConstant?s.getValue(u.MINIMUM_VALUE):!0,c=a.outline,h=r(c);if(h&&c.isConstant&&(h=c.getValue(u.MINIMUM_VALUE)),!l&&!h)return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var d=a.positions,f=a.show;if(r(f)&&f.isConstant&&!f.getValue(u.MINIMUM_VALUE)||!r(d))return void((this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this)));var g=i(a.material,T),_=g instanceof v;this._materialProperty=g,this._fillProperty=i(s,b),this._showProperty=i(f,x),this._showOutlineProperty=i(a.outline,A),this._outlineColorProperty=h?i(a.outlineColor,P):void 0;var y=a.minimumHeights,E=a.maximumHeights,S=a.outlineWidth,w=a.granularity;if(this._fillEnabled=l,this._outlineEnabled=h,d.isConstant&&C.isConstant(y)&&C.isConstant(E)&&C.isConstant(S)&&C.isConstant(w)){var I=this._options;I.vertexFormat=_?m.VERTEX_FORMAT:p.MaterialSupport.TEXTURED.vertexFormat,I.positions=d.getValue(u.MINIMUM_VALUE,I.positions),I.minimumHeights=r(y)?y.getValue(u.MINIMUM_VALUE,I.minimumHeights):void 0,I.maximumHeights=r(E)?E.getValue(u.MINIMUM_VALUE,I.maximumHeights):void 0,I.granularity=r(w)?w.getValue(u.MINIMUM_VALUE):void 0,this._outlineWidth=r(S)?S.getValue(u.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}else this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this))}},S.prototype.createDynamicUpdater=function(e){return new w(e,this)},w.prototype.update=function(i){var n=this._primitives;n.removeAndDestroy(this._primitive),n.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0;var o=this._geometryUpdater,a=o._entity,s=a.wall;if(a.isShowing&&a.isAvailable(i)&&C.getValueOrDefault(s.show,i,!0)){var u=this._options,c=C.getValueOrUndefined(s.positions,i,u.positions);if(r(c)){if(u.positions=c,u.minimumHeights=C.getValueOrUndefined(s.minimumHeights,i,u.minimumHeights),u.maximumHeights=C.getValueOrUndefined(s.maximumHeights,i,u.maximumHeights),u.granularity=C.getValueOrUndefined(s.granularity,i),C.getValueOrDefault(s.fill,i,!0)){var v=y.getValue(i,o.fillMaterialProperty,this._material);this._material=v;var g=new p({material:v,translucent:v.isTranslucent(),closed:r(u.extrudedHeight)});u.vertexFormat=g.vertexFormat,this._primitive=n.add(new f({geometryInstances:new l({id:a,geometry:new h(u)}),appearance:g,asynchronous:!1}))}if(C.getValueOrDefault(s.outline,i,!1)){u.vertexFormat=m.VERTEX_FORMAT;var _=C.getValueOrClonedDefault(s.outlineColor,i,e.BLACK,I),E=C.getValueOrDefault(s.outlineWidth,i,1),S=1!==_.alpha;this._outlinePrimitive=n.add(new f({geometryInstances:new l({id:a,geometry:new d(u),attributes:{color:t.fromColor(_)}}),appearance:new m({flat:!0,translucent:S,renderState:{lineWidth:o._scene.clampLineWidth(E)}}),asynchronous:!1}))}}}},w.prototype.getBoundingSphere=function(e,t){return _(e,this._primitive,this._outlinePrimitive,t)},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){var e=this._primitives;e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),o(this)},S}),i("DataSources/DataSourceDisplay",["../Core/BoundingSphere","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EventHelper","./BillboardVisualizer","./BoundingSphereState","./BoxGeometryUpdater","./CorridorGeometryUpdater","./CustomDataSource","./CylinderGeometryUpdater","./EllipseGeometryUpdater","./EllipsoidGeometryUpdater","./GeometryVisualizer","./LabelVisualizer","./ModelVisualizer","./PathVisualizer","./PointVisualizer","./PolygonGeometryUpdater","./PolylineGeometryUpdater","./PolylineVolumeGeometryUpdater","./RectangleGeometryUpdater","./WallGeometryUpdater"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T){"use strict";function x(e){var i=e.scene,r=e.dataSourceCollection;this._eventHelper=new a,this._eventHelper.add(r.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(r.dataSourceRemoved,this._onDataSourceRemoved,this),this._dataSourceCollection=r,this._scene=i,this._visualizersCallback=t(e.visualizersCallback,x.defaultVisualizersCallback);for(var n=0,o=r.length;o>n;n++)this._onDataSourceAdded(r,r.get(n));var s=new h;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s}x.defaultVisualizersCallback=function(e,t){var i=t.entities;return[new s(e,i),new f(u,e,i),new f(d,e,i),new f(c,e,i),new f(p,e,i),new f(m,e,i),new f(C,e,i),new f(E,e,i),new f(S,e,i),new f(w,e,i),new f(T,e,i),new v(e,i),new g(e,i),new y(e,i),new _(e,i)]},r(x.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}}}),x.prototype.isDestroyed=function(){return!1},x.prototype.destroy=function(){this._eventHelper.removeAll();for(var e=this._dataSourceCollection,t=0,i=e.length;i>t;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),n(this)},x.prototype.update=function(e){var t,r,n,o,a=!0,s=this._dataSourceCollection,l=s.length;for(t=0;l>t;t++){var u=s.get(t);for(i(u.update)&&(a=u.update(e)&&a),n=u._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a}for(n=this._defaultDataSource._visualizers,o=n.length,r=0;o>r;r++)a=n[r].update(e)&&a;return a};var b=[],A=new e;return x.prototype.getBoundingSphere=function(t,r,n){var o,a,s=this._defaultDataSource;if(!s.entities.contains(t)){s=void 0;var u=this._dataSourceCollection;for(a=u.length,o=0;a>o;o++){var c=u.get(o);if(c.entities.contains(t)){s=c;break}}}if(!i(s))return l.FAILED;var h=b,d=A,p=0,m=l.DONE,f=s._visualizers,v=f.length;for(o=0;v>o;o++){var g=f[o];if(i(g.getBoundingSphere)){if(m=f[o].getBoundingSphere(t,d),!r&&m===l.PENDING)return l.PENDING;m===l.DONE&&(h[p]=e.clone(d,h[p]),p++)}}return 0===p?l.FAILED:(h.length=p,e.fromBoundingSpheres(h,n),l.DONE)},x.prototype._onDataSourceAdded=function(e,t){var i=this._visualizersCallback(this._scene,t);t._visualizers=i},x.prototype._onDataSourceRemoved=function(e,t){for(var i=t._visualizers,r=i.length,n=0;r>n;n++)i[n].destroy(),t._visualizers=void 0},x}),i("DataSources/DynamicGeometryUpdater",["../Core/DeveloperError"],function(e){"use strict";function t(){e.throwInstantiationError()}return t.prototype.update=e.throwInstantiationError,t.prototype.getBoundingSphere=e.throwInstantiationError,t.prototype.isDestroyed=e.throwInstantiationError,t.prototype.destroy=e.throwInstantiationError,t}),i("DataSources/EntityView",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/HeadingPitchRange","../Core/JulianDate","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Transforms","../Scene/SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(e,i,r,o,a,s,l){var d=e.scene.mode,f=a.getValue(s,e._lastCartesian);if(n(f)){var v,I,M,D=!1;if(d===m.SCENE3D){A=u.addSeconds(s,.001,A);var R=a.getValue(A,E);if(n(R)){var O,N=p.computeFixedToIcrfMatrix(s,g),L=p.computeFixedToIcrfMatrix(A,_);n(N)&&n(L)?O=h.transpose(N,y):(O=p.computeTemeToPseudoFixedMatrix(s,y),N=h.transpose(O,g),L=p.computeTemeToPseudoFixedMatrix(A,_),h.transpose(L,L));var F=h.multiplyByVector(N,f,x),B=h.multiplyByVector(L,R,b);t.subtract(F,B,T);var V=1e3*t.magnitude(T),k=3986004418e5,z=-k/(V*V-2*k/t.magnitude(F));0>z||z>P*l.maximumRadius?(v=S,t.normalize(f,v),t.negate(v,v),M=t.clone(t.UNIT_Z,w),I=t.cross(M,v,E),t.magnitude(I)>c.EPSILON7&&(t.normalize(v,v),t.normalize(I,I),M=t.cross(v,I,w),t.normalize(M,M),D=!0)):t.equalsEpsilon(f,R,c.EPSILON7)||(M=S,t.normalize(F,M),t.normalize(B,B),I=t.cross(M,B,w),t.equalsEpsilon(I,t.ZERO,c.EPSILON7)||(v=t.cross(I,M,E),h.multiplyByVector(O,v,v),h.multiplyByVector(O,I,I),h.multiplyByVector(O,M,M),t.normalize(v,v),t.normalize(I,I),t.normalize(M,M),D=!0))}}n(e._boundingSphereOffset)&&t.add(e._boundingSphereOffset,f,f);var U,G,W;o&&(U=t.clone(i.position,T),G=t.clone(i.direction,x),W=t.clone(i.up,b));var H=C;D?(H[0]=v.x,H[1]=v.y,H[2]=v.z,H[3]=0,H[4]=I.x,H[5]=I.y,H[6]=I.z,H[7]=0,H[8]=M.x,H[9]=M.y,H[10]=M.z,H[11]=0,H[12]=f.x,H[13]=f.y,H[14]=f.z,H[15]=0):p.eastNorthUpToFixedFrame(f,l,H),i._setTransform(H),o&&(t.clone(U,i.position),t.clone(G,i.direction),t.clone(W,i.up),t.cross(G,W,i.right))}if(r){var q=d===m.SCENE2D||t.equals(e._offset3D,t.ZERO)?void 0:e._offset3D;i.lookAtTransform(i.transform,q)}}function v(i,n,o,a){this.entity=i,this.scene=n,this.ellipsoid=r(o,s.WGS84),this.boundingSphere=e.clone(a),this._boundingSphereOffset=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new t,this._defaultOffset3D=void 0,this._offset3D=new t}var g=new h,_=new h,y=new h,C=new d,E=new t,S=new t,w=new t,T=new t,x=new t,b=new t,A=new u,P=1.25;o(v,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=t.clone(e,new t)}}}),v.defaultOffset3D=new t(-14e3,3500,3500);var I=new l,M=new t;return v.prototype.update=function(e){var i=this.scene,r=this.entity,o=this.ellipsoid,a=i.mode;if(a!==m.MORPHING){var s=r.position,l=r!==this._lastEntity,u=a!==this._mode,h=this._offset3D,d=i.camera,p=l||u,g=!0;if(l){var _=r.viewFrom,y=n(_),C=this.boundingSphere;if(this._boundingSphereOffset=void 0,!y&&n(C)){var E=i.screenSpaceCameraController;E.minimumZoomDistance=Math.min(E.minimumZoomDistance,.5*C.radius),I.pitch=-c.PI_OVER_FOUR,I.range=0;var S=s.getValue(e,M);if(n(S)){var w=2-1/Math.max(1,t.magnitude(S)/o.maximumRadius);I.pitch*=w}d.viewBoundingSphere(C,I),this._boundingSphereOffset=t.subtract(C.center,r.position.getValue(e),new t),p=!1,g=!1}else y&&n(_.getValue(e,h))||t.clone(v._defaultOffset3D,h)}else u||i.mode===m.MORPHING||this._mode===m.SCENE2D||t.clone(d.position,h);this._lastEntity=r,this._mode=i.mode!==m.MORPHING?i.mode:this._mode,i.mode!==m.MORPHING&&f(this,d,p,g,s,e,o)}},v}),!function(){function e(e,t){function i(t){var i,r=e.arcs[0>t?~t:t],n=r[0];return e.transform?(i=[0,0],r.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=r[r.length-1],0>t?[i,n]:[n,i]}function r(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){n[0>e?~e:e]=1}),s.push(r)}}var n={},o={},a={},s=[],l=-1;return t.forEach(function(i,r){var n,o=e.arcs[0>i?~i:i];o.length<3&&!o[1][0]&&!o[1][1]&&(n=t[++l],t[l]=i,t[r]=n)}),t.forEach(function(e){var t,r,n=i(e),s=n[0],l=n[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=l,r=o[l]){delete o[r.start];var u=r===t?t:t.concat(r);o[u.start=t.start]=a[u.end=r.end]=u}else o[t.start]=a[t.end]=t;else if(t=o[l])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=l]=t}),r(a,o),r(o,a),t.forEach(function(e){n[0>e?~e:e]||s.push([e])}),s}function t(t,i,r){function n(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function o(e){e.forEach(n)}function a(e){e.forEach(o)}function s(e){"GeometryCollection"===e.type?e.geometries.forEach(s):e.type in h&&(u=e,h[e.type](e.arcs))}var l=[];if(arguments.length>1){var u,c=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(e){e.forEach(a)}};s(i),c.forEach(arguments.length<3?function(e){l.push(e[0].i)}:function(e){r(e[0].g,e[e.length-1].g)&&l.push(e[0].i)})}else for(var d=0,p=t.arcs.length;p>d;++d)l.push(d);return{type:"MultiLineString",arcs:e(t,l)}}function r(t,i){function r(e){e.forEach(function(t){t.forEach(function(t){(a[t=0>t?~t:t]||(a[t]=[])).push(e)})}),l.push(e)}function o(e){return d(s(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var a={},l=[],u=[];return i.forEach(function(e){"Polygon"===e.type?r(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(r)}),l.forEach(function(e){if(!e._){var t=[],i=[e];for(e._=1,u.push(t);e=i.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].forEach(function(e){e._||(e._=1,i.push(e))})})})}}),l.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:u.map(function(i){var r=[];if(i.forEach(function(e){e.forEach(function(e){e.forEach(function(e){a[0>e?~e:e].length<2&&r.push(e)})})}),r=e(t,r),(n=r.length)>1)for(var s,l=o(i[0][0]),u=0;ue?~e:e],n=0,o=r.length;o>n;++n)t.push(i=r[n].slice()),u(i,n);0>e&&l(t,o)}function r(e){return e=e.slice(),u(e,0),e}function n(e){for(var t=[],r=0,n=e.length;n>r;++r)i(e[r],t);return t.length<2&&t.push(t[0].slice()),t}function o(e){for(var t=n(e);t.length<4;)t.push(t[0].slice());return t}function a(e){return e.map(o)}function s(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(s)}:t in h?{type:t,coordinates:h[t](e)}:null}var u=v(e.transform),c=e.arcs,h={Point:function(e){return r(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(r)},LineString:function(e){return n(e.arcs)},MultiLineString:function(e){return e.arcs.map(n)},Polygon:function(e){return a(e.arcs)},MultiPolygon:function(e){return e.arcs.map(a)}};return s(t)}function l(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}function u(e,t){for(var i=0,r=e.length;r>i;){var n=i+r>>>1;e[n]e&&(e=~e);var i=n[e];i?i.push(t):n[e]=[t]})}function i(e,i){e.forEach(function(e){t(e,i)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in a&&a[e.type](e.arcs,t)}var n={},o=e.map(function(){return[]}),a={LineString:t,MultiLineString:i,Polygon:i,MultiPolygon:function(e,t){e.forEach(function(e){i(e,t)})}};e.forEach(r);for(var s in n)for(var l=n[s],c=l.length,h=0;c>h;++h)for(var d=h+1;c>d;++d){var p,m=l[h],f=l[d];(p=o[m])[s=u(p,f)]!==f&&p.splice(s,0,f),(p=o[f])[s=u(p,m)]!==m&&p.splice(s,0,m)}return o}function h(e,t){function i(e){o.remove(e),e[1][2]=t(e),o.push(e)}var r=v(e.transform),n=g(e.transform),o=f();return t||(t=p),e.arcs.forEach(function(e){for(var a,s,l=[],u=0,c=0,h=e.length;h>c;++c)s=e[c],r(e[c]=[s[0],s[1],1/0],c);for(var c=1,h=e.length-1;h>c;++c)a=e.slice(c-1,c+2),a[1][2]=t(a),l.push(a),o.push(a);for(var c=0,h=l.length;h>c;++c)a=l[c],a.previous=l[c-1],a.next=l[c+1];for(;a=o.pop();){var d=a.previous,p=a.next;a[1][2]0;){var i=(t+1>>1)-1,n=r[i];if(m(e,n)>=0)break;r[n._=t]=n,r[e._=t=i]=e}}function t(e,t){for(;;){var i=t+1<<1,o=i-1,a=t,s=r[a];if(n>o&&m(r[o],s)<0&&(s=r[a=o]),n>i&&m(r[i],s)<0&&(s=r[a=i]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var i={},r=[],n=0;return i.push=function(t){return e(r[t._=n]=t,n++),n},i.pop=function(){if(!(0>=n)){var e,i=r[0];return--n>0&&(e=r[n],t(r[e._=0]=e,0)),i}},i.remove=function(i){var o,a=i._;if(r[a]===i)return a!==--n&&(o=r[n],(m(o,i)<0?e:t)(r[o._=a]=o,a)),a},i}function v(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0),e[0]=(t+=e[0])*r+o,e[1]=(i+=e[1])*n+a}}function g(e){if(!e)return _;var t,i,r=e.scale[0],n=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=i=0);var l=(e[0]-o)/r|0,u=(e[1]-a)/n|0;e[0]=l-t,e[1]=u-i,t=l,i=u}}function _(){}var y={version:"1.6.18",mesh:function(e){return s(e,t.apply(this,arguments))},meshArcs:t,merge:function(e){return s(e,r.apply(this,arguments))},mergeArcs:r,feature:o,neighbors:c,presimplify:h};"function"==typeof i&&i.amd?i("ThirdParty/topojson",y):"object"==typeof module&&module.exports?module.exports=y:this.topojson=y}(),i("DataSources/GeoJsonDataSource",["../Core/Cartesian3","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getFilenameFromUri","../Core/loadJson","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/RuntimeError","../Scene/VerticalOrigin","../ThirdParty/topojson","../ThirdParty/when","./BillboardGraphics","./CallbackProperty","./ColorMaterialProperty","./ConstantPositionProperty","./ConstantProperty","./DataSource","./EntityCollection","./PolygonGraphics","./PolylineGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x){"use strict";function b(t){return e.fromDegrees(t[0],t[1],t[2])}function A(e,t){var i="";for(var r in e)if(e.hasOwnProperty(r)){if(r===t||-1!==ae.indexOf(r))continue;var n=e[r];o(n)&&(i+="object"==typeof n?""+r+""+A(n)+"":""+r+""+n+"")}return i.length>0&&(i=''+i+"
"),i}function P(e,t,i){var r;return function(o,a){return n(r)||(r=e(t,i)),r}}function I(e,t){return new _(P(A,e,t),!0)}function M(e,t,r){var a=e.id;if(o(a)&&"Feature"===e.type){for(var s=2,l=a;n(t.getById(l));)l=a+"_"+s,s++;a=l}else a=i();var u=t.getOrCreateEntity(a),c=e.properties;if(o(c)){u.addProperty("properties"),u.properties=c;var h,d=c.title;if(o(d))u.name=d,h="title";else{var p=Number.MAX_VALUE;for(var m in c)if(c.hasOwnProperty(m)&&c[m]){var f=m.toLowerCase();if(p>1&&"title"===f){p=1,h=m;break}p>2&&"name"===f?(p=2,h=m):p>3&&/title/i.test(m)?(p=3,h=m):p>4&&/name/i.test(m)&&(p=4,h=m)}o(h)&&(u.name=c[h])}var v=c.description;n(v)?null!==v&&(u.description=new E(v)):u.description=r(c,h)}return u}function D(e,t){for(var i=new Array(e.length),r=0;ra;a++)R(e,o[a],void 0,r,n)}function N(e,t,i,r,n){for(var a=i.geometries,s=0,l=a.length;l>s;s++){var u=a[s],c=u.type,h=le[c];if(!o(h))throw new p("Unknown geometry type: "+c);h(e,t,u,r,n)}}function L(e,i,a,s,l){var u=l.markerSymbol,c=l.markerColor,h=l.markerSize,d=i.properties;if(o(d)){var p=d["marker-color"];o(p)&&(c=t.fromCssColorString(p)),h=r(oe[d["marker-size"]],h);var f=d["marker-symbol"];o(f)&&(u=f)}var _;_=n(u)?1===u.length?e._pinBuilder.fromText(u.toUpperCase(),c,h):e._pinBuilder.fromMakiIconId(u,c,h):e._pinBuilder.fromColor(c,h),e._promises.push(v(_,function(t){var r=new g;r.verticalOrigin=new E(m.BOTTOM),r.image=new E(t);var n=M(i,e._entityCollection,l.describe);n.billboard=r,n.position=new C(a(s))}))}function F(e,t,i,r,n){L(e,t,r,i.coordinates,n)}function B(e,t,i,r,n){for(var o=i.coordinates,a=0;aw;w++)S.push(new d(D(a[w],r)));var b=a[0];C.hierarchy=new E(new d(D(b,r),S)),b[0].length>2&&(C.perPositionHeight=new E(!0));var A=M(i,e._entityCollection,s.describe);A.polygon=C}}function G(e,t,i,r,n){U(e,t,r,i.coordinates,n)}function W(e,t,i,r,n){for(var o=i.coordinates,a=0;ao;o++){var s=i[o],l=s.getType(),u=s.getText();if("element"===l)"a"===s.getTagName()&&(s.isClosing()?r=Math.max(r-1,0):r++),n.push(u);else if("entity"===l||"comment"===l)n.push(u);else if(0===r){var c=this.linkifyStr(u);n.push(c)}else n.push(u)}return n.join("")},linkifyStr:function(e){return this.getMatchParser().replace(e,this.createMatchReturnVal,this)},createMatchReturnVal:function(t){var i;if(this.replaceFn&&(i=this.replaceFn.call(this,this,t)),"string"==typeof i)return i;if(i===!1)return t.getMatchedText();if(i instanceof e.HtmlTag)return i.toAnchorString();var r=this.getTagBuilder(),n=r.build(t);return n.toAnchorString()},getHtmlParser:function(){var t=this.htmlParser;return t||(t=this.htmlParser=new e.htmlParser.HtmlParser),t},getMatchParser:function(){var t=this.matchParser;return t||(t=this.matchParser=new e.matchParser.MatchParser({urls:this.urls,email:this.email,twitter:this.twitter,phone:this.phone,hashtag:this.hashtag,stripPrefix:this.stripPrefix})),t},getTagBuilder:function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new e.AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t}},e.link=function(t,i){var r=new e(i);return r.link(t)},e.match={},e.htmlParser={},e.matchParser={},e.Util={abstractMethod:function(){throw"abstract"},trimRegex:/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,assign:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},extend:function(t,i){var r=t.prototype,n=function(){};n.prototype=r;var o;o=i.hasOwnProperty("constructor")?i.constructor:function(){r.constructor.apply(this,arguments)};var a=o.prototype=new n;return a.constructor=o,a.superclass=r,delete i.constructor,e.Util.assign(a,i),o},ellipsis:function(e,t,i){return e.length>t&&(i=null==i?"..":i,e=e.substring(0,t-i.length)+i),e},indexOf:function(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var i=0,r=e.length;r>i;i++)if(e[i]===t)return i;return-1},splitAndCapture:function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var i,r=[],n=0;i=t.exec(e);)r.push(e.substring(n,i.index)),r.push(i[0]),n=i.index+i[0].length;return r.push(e.substring(n)),r},trim:function(e){return e.replace(this.trimRegex,"")}},e.HtmlTag=e.Util.extend(Object,{whitespaceRegex:/\s+/,constructor:function(t){e.Util.assign(this,t),this.innerHtml=this.innerHtml||this.innerHTML},setTagName:function(e){return this.tagName=e,this},getTagName:function(){return this.tagName||""},setAttr:function(e,t){var i=this.getAttrs();return i[e]=t,this},getAttr:function(e){return this.getAttrs()[e]},setAttrs:function(t){var i=this.getAttrs();return e.Util.assign(i,t),this},getAttrs:function(){return this.attrs||(this.attrs={})},setClass:function(e){return this.setAttr("class",e)},addClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);i=s.shift();)-1===o(a,i)&&a.push(i);return this.getAttrs()["class"]=a.join(" "),this},removeClass:function(t){for(var i,r=this.getClass(),n=this.whitespaceRegex,o=e.Util.indexOf,a=r?r.split(n):[],s=t.split(n);a.length&&(i=s.shift());){var l=o(a,i);-1!==l&&a.splice(l,1)}return this.getAttrs()["class"]=a.join(" "),this},getClass:function(){return this.getAttrs()["class"]||""},hasClass:function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},setInnerHtml:function(e){return this.innerHtml=e,this},getInnerHtml:function(){return this.innerHtml||""},toAnchorString:function(){var e=this.getTagName(),t=this.buildAttrsStr();return t=t?" "+t:"",["<",e,t,">",this.getInnerHtml(),""].join("")},buildAttrsStr:function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i+'="'+e[i]+'"');return t.join(" ")}}),e.AnchorTagBuilder=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},build:function(t){var i=new e.HtmlTag({tagName:"a",attrs:this.createAttrs(t.getType(),t.getAnchorHref()),innerHtml:this.processAnchorText(t.getAnchorText())});return i},createAttrs:function(e,t){var i={href:t},r=this.createCssClass(e);return r&&(i["class"]=r),this.newWindow&&(i.target="_blank"),i},createCssClass:function(e){var t=this.className;return t?t+" "+t+"-"+e:""},processAnchorText:function(e){return e=this.doTruncate(e)},doTruncate:function(t){return e.Util.ellipsis(t,this.truncate||Number.POSITIVE_INFINITY)}}),e.htmlParser.HtmlParser=e.Util.extend(Object,{htmlRegex:function(){var e=/!--([\s\S]+?)--/,t=/[0-9a-zA-Z][0-9a-zA-Z:]*/,i=/[^\s\0"'>\/=\x01-\x1F\x7F]+/,r=/(?:"[^"]*?"|'[^']*?'|[^'"=<>`\s]+)/,n=i.source+"(?:\\s*=\\s*"+r.source+")?";return new RegExp(["(?:","<(!DOCTYPE)","(?:","\\s+","(?:",n,"|",r.source+")",")*",">",")","|","(?:","<(/)?","(?:",e.source,"|","(?:","("+t.source+")","(?:","\\s+",n,")*","\\s*/?",")",")",">",")"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/( | |<|<|>|>|"|"|')/gi,parse:function(e){for(var t,i,r=this.htmlRegex,n=0,o=[];null!==(t=r.exec(e));){var a=t[0],s=t[3],l=t[1]||t[4],u=!!t[2],c=e.substring(n,t.index);c&&(i=this.parseTextAndEntityNodes(c),o.push.apply(o,i)),s?o.push(this.createCommentNode(a,s)):o.push(this.createElementNode(a,l,u)),n=t.index+a.length}if(nn;n+=2){var a=r[n],s=r[n+1];a&&i.push(this.createTextNode(a)),s&&i.push(this.createEntityNode(s))}return i},createCommentNode:function(t,i){return new e.htmlParser.CommentNode({text:t,comment:e.Util.trim(i)})},createElementNode:function(t,i,r){return new e.htmlParser.ElementNode({text:t,tagName:i.toLowerCase(),closing:r})},createEntityNode:function(t){return new e.htmlParser.EntityNode({text:t})},createTextNode:function(t){return new e.htmlParser.TextNode({text:t})}}),e.htmlParser.HtmlNode=e.Util.extend(Object,{text:"",constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getText:function(){return this.text}}),e.htmlParser.CommentNode=e.Util.extend(e.htmlParser.HtmlNode,{comment:"",getType:function(){return"comment"},getComment:function(){return this.comment}}),e.htmlParser.ElementNode=e.Util.extend(e.htmlParser.HtmlNode,{tagName:"",closing:!1,getType:function(){return"element"},getTagName:function(){return this.tagName},isClosing:function(){return this.closing}}),e.htmlParser.EntityNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"entity"}}),e.htmlParser.TextNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"text"}}),e.matchParser.MatchParser=e.Util.extend(Object,{urls:!0,email:!0,twitter:!0,phone:!0,hashtag:!1,stripPrefix:!0,matcherRegex:function(){var e=/(^|[^\w])@(\w{1,15})/,t=/(^|[^\w])#(\w{1,15})/,i=/(?:[\-;:&=\+\$,\w\.]+@)/,r=/(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/,n=/(?:[A-Za-z][-.+A-Za-z0-9]+:(?![A-Za-z][-.+A-Za-z0-9]+:\/\/)(?!\d+\/?)(?:\/\/)?)/,o=/(?:www\.)/,a=/[A-Za-z0-9\.\-]*[A-Za-z0-9\-]/,s=/\.(?:international|construction|contractors|enterprises|photography|productions|foundation|immobilien|industries|management|properties|technology|christmas|community|directory|education|equipment|institute|marketing|solutions|vacations|bargains|boutique|builders|catering|cleaning|clothing|computer|democrat|diamonds|graphics|holdings|lighting|partners|plumbing|supplies|training|ventures|academy|careers|company|cruises|domains|exposed|flights|florist|gallery|guitars|holiday|kitchen|neustar|okinawa|recipes|rentals|reviews|shiksha|singles|support|systems|agency|berlin|camera|center|coffee|condos|dating|estate|events|expert|futbol|kaufen|luxury|maison|monash|museum|nagoya|photos|repair|report|social|supply|tattoo|tienda|travel|viajes|villas|vision|voting|voyage|actor|build|cards|cheap|codes|dance|email|glass|house|mango|ninja|parts|photo|shoes|solar|today|tokyo|tools|watch|works|aero|arpa|asia|best|bike|blue|buzz|camp|club|cool|coop|farm|fish|gift|guru|info|jobs|kiwi|kred|land|limo|link|menu|mobi|moda|name|pics|pink|post|qpon|rich|ruhr|sexy|tips|vote|voto|wang|wien|wiki|zone|bar|bid|biz|cab|cat|ceo|com|edu|gov|int|kim|mil|net|onl|org|pro|pub|red|tel|uno|wed|xxx|xyz|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)\b/,l=/[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]?!:,.;]*[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]]/;return new RegExp(["(",e.source,")","|","(",i.source,a.source,s.source,")","|","(","(?:","(",n.source,a.source,")","|","(?:","(.?//)?",o.source,a.source,")","|","(?:","(.?//)?",a.source,s.source,")",")","(?:"+l.source+")?",")","|","(",r.source,")","|","(",t.source,")"].join(""),"gi")}(),charBeforeProtocolRelMatchRegex:/^(.)?\/\//,constructor:function(t){e.Util.assign(this,t),this.matchValidator=new e.MatchValidator},replace:function(e,t,i){var r=this;return e.replace(this.matcherRegex,function(e,n,o,a,s,l,u,c,h,d,p,m,f){var v=r.processCandidateMatch(e,n,o,a,s,l,u,c,h,d,p,m,f);if(v){var g=t.call(i,v.match);return v.prefixStr+g+v.suffixStr}return e})},processCandidateMatch:function(t,i,r,n,o,a,s,l,u,c,h,d,p){var m,f=l||u,v="",g="";if(a&&!this.urls||o&&!this.email||c&&!this.phone||i&&!this.twitter||h&&!this.hashtag||!this.matchValidator.isValidMatch(a,s,f))return null;if(this.matchHasUnbalancedClosingParen(t)&&(t=t.substr(0,t.length-1),g=")"),o)m=new e.match.Email({matchedText:t,email:o});else if(i)r&&(v=r,t=t.slice(1)),m=new e.match.Twitter({matchedText:t,twitterHandle:n});else if(c){var _=t.replace(/\D/g,"");m=new e.match.Phone({matchedText:t,number:_})}else if(h)d&&(v=d,t=t.slice(1)),m=new e.match.Hashtag({matchedText:t,serviceName:this.hashtag,hashtag:p});else{if(f){var y=f.match(this.charBeforeProtocolRelMatchRegex)[1]||"";y&&(v=y,t=t.slice(1))}m=new e.match.Url({matchedText:t,url:t,protocolUrlMatch:!!s,protocolRelativeMatch:!!f,stripPrefix:this.stripPrefix})}return{prefixStr:v,suffixStr:g,match:m}},matchHasUnbalancedClosingParen:function(e){var t=e.charAt(e.length-1);if(")"===t){var i=e.match(/\(/g),r=e.match(/\)/g),n=i&&i.length||0,o=r&&r.length||0;if(o>n)return!0}return!1}}),e.MatchValidator=e.Util.extend(Object,{invalidProtocolRelMatchRegex:/^[\w]\/\//,hasFullProtocolRegex:/^[A-Za-z][-.+A-Za-z0-9]+:\/\//,uriSchemeRegex:/^[A-Za-z][-.+A-Za-z0-9]+:/,hasWordCharAfterProtocolRegex:/:[^\s]*?[A-Za-z]/,isValidMatch:function(e,t,i){return t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)||this.isInvalidProtocolRelativeMatch(i)?!1:!0},isValidUriScheme:function(e){var t=e.match(this.uriSchemeRegex)[0].toLowerCase();return"javascript:"!==t&&"vbscript:"!==t},urlMatchDoesNotHaveProtocolOrDot:function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},urlMatchDoesNotHaveAtLeastOneWordChar:function(e,t){return e&&t?!this.hasWordCharAfterProtocolRegex.test(e):!1},isInvalidProtocolRelativeMatch:function(e){return!!e&&this.invalidProtocolRelMatchRegex.test(e)}}),e.match.Match=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getMatchedText:function(){return this.matchedText},getAnchorHref:e.Util.abstractMethod,getAnchorText:e.Util.abstractMethod}),e.match.Email=e.Util.extend(e.match.Match,{getType:function(){return"email"},getEmail:function(){return this.email},getAnchorHref:function(){return"mailto:"+this.email},getAnchorText:function(){return this.email}}),e.match.Hashtag=e.Util.extend(e.match.Match,{getType:function(){return"hashtag"},getHashtag:function(){return this.hashtag},getAnchorHref:function(){var e=this.serviceName,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;default:throw new Error("Unknown service name to point hashtag to: ",e)}},getAnchorText:function(){return"#"+this.hashtag}}),e.match.Phone=e.Util.extend(e.match.Match,{getType:function(){return"phone"},getNumber:function(){return this.number},getAnchorHref:function(){return"tel:"+this.number},getAnchorText:function(){return this.matchedText}}),e.match.Twitter=e.Util.extend(e.match.Match,{getType:function(){return"twitter"},getTwitterHandle:function(){return this.twitterHandle},getAnchorHref:function(){return"https://twitter.com/"+this.twitterHandle},getAnchorText:function(){return"@"+this.twitterHandle}}),e.match.Url=e.Util.extend(e.match.Match,{urlPrefixRegex:/^(https?:\/\/)?(www\.)?/i,protocolRelativeRegex:/^\/\//,protocolPrepended:!1,getType:function(){return"url"},getUrl:function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},getAnchorHref:function(){var e=this.getUrl();return e.replace(/&/g,"&")},getAnchorText:function(){var e=this.getUrl();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix&&(e=this.stripUrlPrefix(e)),e=this.removeTrailingSlash(e)},stripUrlPrefix:function(e){return e.replace(this.urlPrefixRegex,"")},stripProtocolRelativePrefix:function(e){return e.replace(this.protocolRelativeRegex,"")},removeTrailingSlash:function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e}}),e}),i("ThirdParty/zip",["../Core/buildModuleUrl","../Core/defineProperties"],function(e,t){var i={};return function(i){function r(){var e=-1,t=this;t.append=function(i){var r,n=t.table;for(r=0;r>>8^n[255&(e^i[r])]},t.get=function(){return~e}}function n(e,t,i){return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}function o(e,t){var i,r;return i=new ArrayBuffer(e),r=new Uint8Array(i),t&&r.set(t,0),{buffer:i,array:r,view:new DataView(i)}}function a(){}function s(e){function t(t,i){var o=new Blob([e],{type:z});r=new u(o),r.init(function(){n.size=r.size,t()},i)}function i(e,t,i,n){r.readUint8Array(e,t,i,n)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function l(e){function t(t){for(var i=e.length;"="==e.charAt(i-1);)i--;r=e.indexOf(",")+1,n.size=Math.floor(.75*(i-r)),t()}function i(t,i,n){var a,s=o(i),l=4*Math.floor(t/3),u=4*Math.ceil((t+i)/3),c=window.atob(e.substring(l+r,u+r)),h=t-3*Math.floor(l/4);for(a=h;h+i>a;a++)s.array[a-h]=c.charCodeAt(a);n(s.array)}var r,n=this;n.size=0,n.init=t,n.readUint8Array=i}function u(e){function t(t){this.size=e.size,t()}function i(t,i,r,o){var a=new FileReader;a.onload=function(e){r(new Uint8Array(e.target.result))},a.onerror=o,a.readAsArrayBuffer(n(e,t,i))}var r=this;r.size=0,r.init=t,r.readUint8Array=i}function c(){}function h(e){function t(e){n=new Blob([],{type:z}),e()}function i(e,t){n=new Blob([n,P?e:e.buffer],{type:z}),t()}function r(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=i,r.readAsText(n,e)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function d(e){function t(t){o+="data:"+(e||"")+";base64,",t()}function i(e,t){var i,r=a.length,n=a;for(a="",i=0;i<3*Math.floor((r+e.length)/3)-r;i++)n+=String.fromCharCode(e[i]);for(;i2?o+=window.btoa(n):a=n,t()}function r(e){e(o+window.btoa(a))}var n=this,o="",a="";n.init=t,n.writeUint8Array=i,n.getData=r}function p(e){function t(t){n=new Blob([],{type:e}),t()}function i(t,i){n=new Blob([n,P?t:t.buffer],{type:e}),i()}function r(e){e(n)}var n,o=this;o.init=t,o.writeUint8Array=i,o.getData=r}function m(e,t,i,r,n,o,a,s,l,u){function c(){e.removeEventListener(U,h,!1),s(m)}function h(e){var t=e.data,r=t.data;t.onappend&&(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),d()},u)),t.onflush&&(r?(m+=r.length,i.writeUint8Array(r,function(){o(!1,r),c()},u)):c()),t.progress&&a&&a(p+t.current,n)}function d(){p=f*B,n>p?t.readUint8Array(r+p,Math.min(B,n-p),function(t){e.postMessage({append:!0,data:t}),f++,a&&a(p,n),o(!0,t)},l):e.postMessage({flush:!0})}var p,m,f=0;m=0,e.addEventListener(U,h,!1),d()}function f(e,t,i,r,n,o,a,s,l,u){function c(){var m;h=d*B,n>h?t.readUint8Array(r+h,Math.min(B,n-h),function(t){var s=e.append(t,function(){a&&a(r+h,n)});p+=s.length,o(!0,t),i.writeUint8Array(s,function(){o(!1,s),d++,setTimeout(c,1)},u),a&&a(h,n)},l):(m=e.flush(),m?(p+=m.length,i.writeUint8Array(m,function(){o(!1,m),s(p)},u)):s(p))}var h,d=0,p=0;c()}function v(e,t,n,o,a,s,l,u,c){function h(e,t){a&&!e&&v.append(t)}function d(e){s(e,v.get())}var p,v=new r;return i.zip.useWebWorkers?(p=new Worker(i.zip.workerScriptsPath+V),m(p,e,t,n,o,h,l,d,u,c)):f(new i.zip.Inflater,e,t,n,o,h,l,d,u,c),p}function g(e,t,n,o,a,s,l){function u(e,t){e&&p.append(t)}function c(e){o(e,p.get())}function h(){d.removeEventListener(U,h,!1),m(d,e,t,0,e.size,u,a,c,s,l)}var d,p=new r;return i.zip.useWebWorkers?(d=new Worker(i.zip.workerScriptsPath+k),d.addEventListener(U,h,!1),d.postMessage({init:!0,level:n})):f(new i.zip.Deflater,e,t,0,e.size,u,a,c,s,l),d}function _(e,t,i,n,o,a,s,l,u){function c(){var r=h*B;n>r?e.readUint8Array(i+r,Math.min(B,n-r),function(e){o&&d.append(e),s&&s(r,n,e),t.writeUint8Array(e,function(){h++,c()},u)},l):a(n,d.get())}var h=0,d=new r;c()}function y(e){var t,i,r="",n=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(t=0;t127?n[i-128]:String.fromCharCode(i);return r}function C(e){return decodeURIComponent(escape(e))}function E(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(r){}}function w(e,t,i,r,n){return e.version=t.view.getUint16(i,!0),e.bitFlag=t.view.getUint16(i+2,!0),e.compressionMethod=t.view.getUint16(i+4,!0),e.lastModDateRaw=t.view.getUint32(i+6,!0),e.lastModDate=S(e.lastModDateRaw),1===(1&e.bitFlag)?void n(M):((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295===e.compressedSize||4294967295===e.uncompressedSize?void n(D):(e.filenameLength=t.view.getUint16(i+22,!0),void(e.extraFieldLength=t.view.getUint16(i+24,!0))))}function T(e,t){function i(){}function r(i,n){e.readUint8Array(e.size-i,i,function(e){var t=o(e.length,e).view;1347093766!=t.getUint32(0)?r(i+1,n):n(t)},function(){t(R)})}return i.prototype.getData=function(i,r,n,a){function s(e,t){d&&d.terminate(),d=null,e&&e(t)}function l(e){var t=o(4);return t.view.setUint32(0,e),p.crc32==t.view.getUint32(0)}function u(e,t){a&&!l(t)?c():i.getData(function(e){s(r,e)})}function c(){s(t,L)}function h(){s(t,N)}var d,p=this;e.readUint8Array(p.offset,30,function(r){var s,l=o(r.length,r);return 1347093252!=l.view.getUint32(0)?void t(I):(w(p,l,4,!1,t),s=p.offset+30+p.filenameLength+p.extraFieldLength,void i.init(function(){0===p.compressionMethod?_(e,i,s,p.compressedSize,a,u,n,c,h):d=v(e,i,s,p.compressedSize,a,u,n,c,h)},h))},c)},{getEntries:function(n){return e.size<22?void t(I):void r(22,function(r){var a,s;a=r.getUint32(16,!0),s=r.getUint16(8,!0),e.readUint8Array(a,e.size-a,function(e){var r,a,l,u,c=0,h=[],d=o(e.length,e);for(r=0;s>r;r++){if(a=new i,1347092738!=d.view.getUint32(c))return void t(I);w(a,d,c+6,!0,t),a.commentLength=d.view.getUint16(c+32,!0),a.directory=16==(16&d.view.getUint8(c+38)),a.offset=d.view.getUint32(c+42,!0),l=E(d.array.subarray(c+46,c+46+a.filenameLength)),a.filename=2048===(2048&a.bitFlag)?C(l):y(l),a.directory||"/"!=a.filename.charAt(a.filename.length-1)||(a.directory=!0),u=E(d.array.subarray(c+46+a.filenameLength+a.extraFieldLength,c+46+a.filenameLength+a.extraFieldLength+a.commentLength)),a.comment=2048===(2048&a.bitFlag)?C(u):y(u),h.push(a),c+=46+a.filenameLength+a.extraFieldLength+a.commentLength}n(h)},function(){t(R)})})},close:function(e){e&&e()}}}function x(e){return unescape(encodeURIComponent(e))}function b(e){var t,i=[];for(t=0;te;e++){for(i=e,t=0;8>t;t++)1&i?i=i>>>1^3988292384:i>>>=1;r[e]=i}return r}(),s.prototype=new a,s.prototype.constructor=s,l.prototype=new a,l.prototype.constructor=l,u.prototype=new a,u.prototype.constructor=u,c.prototype.getData=function(e){e(this.data)},h.prototype=new c,h.prototype.constructor=h,d.prototype=new c,d.prototype.constructor=d,p.prototype=new c,p.prototype.constructor=p,i.zip={Reader:a,Writer:c,BlobReader:u,Data64URIReader:l,TextReader:s,BlobWriter:p,Data64URIWriter:d,TextWriter:h,createReader:function(e,t,i){e.init(function(){t(T(e,i))},i)},createWriter:function(e,t,i,r){e.init(function(){t(A(e,i,r))},i)},useWebWorkers:!0};var W;t(i.zip,{workerScriptsPath:{get:function(){return"undefined"==typeof W&&(W=e("ThirdParty/Workers/")),W}}})}(i),i.zip}),i("DataSources/KmlDataSource",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian3","../Core/ClockRange","../Core/ClockStep","../Core/Color","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/defineProperties","../Core/DeveloperError","../Core/Ellipsoid","../Core/Event","../Core/getAbsoluteUri","../Core/getExtensionFromUri","../Core/getFilenameFromUri","../Core/Iso8601","../Core/JulianDate","../Core/loadBlob","../Core/loadXML","../Core/Math","../Core/NearFarScalar","../Core/PinBuilder","../Core/PolygonHierarchy","../Core/Rectangle","../Core/RuntimeError","../Core/TimeInterval","../Core/TimeIntervalCollection","../Scene/HorizontalOrigin","../Scene/LabelStyle","../ThirdParty/Autolinker","../ThirdParty/Uri","../ThirdParty/when","../ThirdParty/zip","./BillboardGraphics","./CompositePositionProperty","./ConstantPositionProperty","./DataSource","./DataSourceClock","./Entity","./EntityCollection","./LabelGraphics","./PathGraphics","./PolygonGraphics","./PolylineGraphics","./PositionPropertyArray","./RectangleGraphics","./ReferenceProperty","./SampledPositionProperty","./ScaledPositionProperty","./TimeIntervalCollectionProperty","./WallGraphics"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J){"use strict";function $(e){var t=e.slice(0,Math.min(4,e.size)),i=O.defer(),r=new FileReader;return r.addEventListener("load",function(){i.resolve(1347093252===new DataView(r.result).getUint32(0,!1))}),r.addEventListener("error",function(){i.reject(r.error)}),r.readAsArrayBuffer(t),i.promise}function ee(e){var t=O.defer(),i=new FileReader;return i.addEventListener("load",function(){t.resolve(i.result)}),i.addEventListener("error",function(){t.reject(i.error)}),i.readAsText(e),t.promise}function te(e,t,i,r){t.getData(new N.TextWriter,function(e){i.kml=rt.parseFromString(e,"application/xml"),r.resolve()})}function ie(e,t,i,r){var n=s(it.detectFromFilename(t.filename),"application/octet-stream"); @@ -461,8 +461,8 @@ this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0 "{northDegrees}":V,"{westProjected}":z,"{southProjected}":U,"{eastProjected}":G,"{northProjected}":W,"{width}":H,"{height}":q},me=r(pe,{"{i}":j,"{j}":Y,"{reverseI}":X,"{reverseJ}":Z,"{-i}":X,"{-j}":Z,"{longitudeDegrees}":Q,"{latitudeDegrees}":J,"{longitudeProjected}":$,"{latitudeProjected}":ee,"{format}":ie});return S}),i("Scene/createOpenStreetMapImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/DeveloperError","../Core/Rectangle","../Core/WebMercatorTilingScheme","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o){"use strict";function a(a){a=t(a,{});var u=t(a.url,"//a.tile.openstreetmap.org/");s.test(u)||(u+="/");var c=t(a.fileExtension,"png"),h=new n({ellipsoid:a.ellipsoid}),d=256,p=256,m=t(a.minimumLevel,0),f=a.maximumLevel,v=t(a.rectangle,h.rectangle),g=h.positionToTileXY(r.southwest(v),m),_=h.positionToTileXY(r.northeast(v),m),y=(Math.abs(_.x-g.x)+1)*(Math.abs(_.y-g.y)+1);if(y>4)throw new i("The rectangle and minimumLevel indicate that there are "+y+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");var C=t(a.credit,l);"string"==typeof C&&(C=new e(C));var E=u+"{z}/{x}/{y}."+c;return new o({url:E,proxy:a.proxy,credit:C,tilingScheme:h,tileWidth:d,tileHeight:p,minimumLevel:m,maximumLevel:f,rectangle:v})}var s=/\/$/,l=new e("MapQuest, Open Street Map and contributors, CC-BY-SA");return a}),i("Scene/createTangentSpaceDebugPrimitive",["../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/Matrix4","./PerInstanceColorAppearance","./Primitive"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(r){r=t(r,t.EMPTY_OBJECT);var u=[],c=r.geometry;i(c.attributes)&&i(c.primitiveType)||(c=c.constructor.createGeometry(c));var h=c.attributes,d=a.clone(t(r.modelMatrix,a.IDENTITY)),p=t(r.length,1e4);return i(h.normal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"normal",p),attributes:{color:new e(1,0,0,1)},modelMatrix:d})),i(h.binormal)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"binormal",p),attributes:{color:new e(0,1,0,1)},modelMatrix:d})),i(h.tangent)&&u.push(new n({geometry:o.createLineSegmentsForVectors(c,"tangent",p),attributes:{color:new e(0,0,1,1)},modelMatrix:d})),u.length>0?new l({asynchronous:!1,geometryInstances:u,appearance:new s({flat:!0,translucent:!1})}):void 0}return u}),i("Scene/createTileMapServiceImageryProvider",["../Core/Cartesian2","../Core/Cartographic","../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/joinUrls","../Core/loadXML","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(i){function o(o){for(var a,c,f,v,E=/tileformat/i,S=/tileset/i,w=/tilesets/i,T=/boundingbox/i,x=/srs/i,b=[],A=o.childNodes[0].childNodes,P=0;Pk.rectangle.east&&(U.east=k.rectangle.east),U.southk.rectangle.north&&(U.north=k.rectangle.north);var Y=k.positionToTileXY(h.southwest(U),L),X=k.positionToTileXY(h.northeast(U),L),Z=(Math.abs(X.x-Y.x)+1)*(Math.abs(X.y-Y.y)+1);Z>4&&(L=0);var K=u(_,R);D.length&&(K=u(K,"."+D)),y.resolve({url:K,tilingScheme:k,rectangle:U,tileWidth:O,tileHeight:N,minimumLevel:L,maximumLevel:F,proxy:i.proxy,tileDiscardPolicy:i.tileDiscardPolicy,credit:i.credit,pickFeaturesUrl:i.pickFeaturesUrl,getFeatureInfoFormats:i.getFeatureInfoFormats})}function a(e){var t=r(i.fileExtension,"png"),o=r(i.tileSchema,"{z}/{x}/{reverseY}"),a=r(i.tileWidth,256),s=r(i.tileHeight,256),l=r(i.minimumLevel,0),c=i.maximumLevel,h=n(i.tilingScheme)?i.tilingScheme:new m({ellipsoid:i.ellipsoid}),d=r(i.rectangle,h.rectangle),p=u(_,o);t.length&&(p=u(p,"."+t)),y.resolve({url:p,tilingScheme:h,rectangle:d,tileWidth:a,tileHeight:s,minimumLevel:l,maximumLevel:c,proxy:i.proxy,tileDiscardPolicy:i.tileDiscardPolicy,credit:i.credit,pickFeaturesUrl:i.pickFeaturesUrl,getFeatureInfoFormats:i.getFeatureInfoFormats})}function s(){var e=u(_,"tilemapresource.xml"),t=i.proxy;n(t)&&(e=t.getURL(e)),f(c(e),o,a)}i=r(i,{});var g,_=i.url,y=f.defer(),C=new v(y.promise);return s(),C}return g}),i("Scene/CreditDisplay",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n){"use strict";function o(e,t,r){if(!i(e.element)){var n=e.text,o=e.link,a=document.createElement("span");if(e.hasLink()){var s=document.createElement("a");s.textContent=n,s.href=o,s.target="_blank",a.appendChild(s)}else a.textContent=n;a.className="cesium-credit-text",e.element=a}if(t.hasChildNodes()){var l=document.createElement("span");l.textContent=r,l.className="cesium-credit-delimiter",t.appendChild(l)}t.appendChild(e.element)}function a(e,t){if(!i(e.element)){var r=e.text,n=e.link,o=document.createElement("span"),a=document.createElement("img");if(a.src=e.imageUrl,a.style["vertical-align"]="bottom",i(r)&&(a.alt=r,a.title=r),e.hasLink()){var s=document.createElement("a");s.appendChild(a),s.href=n,s.target="_blank",o.appendChild(s)}else o.appendChild(a);o.className="cesium-credit-image",e.element=o}t.appendChild(e.element)}function s(t,i){for(var r=t.length,n=0;r>n;n++){var o=t[n];if(e.equals(o,i))return!0}return!1}function l(e){var t=e.element;if(i(t)){var r=t.parentNode;if(!e.hasImage()){var n=t.previousSibling;null===n&&(n=t.nextSibling),null!==n&&r.removeChild(n)}r.removeChild(t)}}function u(e,t){var r,n,a,s=e._displayedCredits.textCredits;for(r=0;r= 0.0) {\nt1 = (-b - sqrt(discriminant)) * 0.5;\nt2 = (-b + sqrt(discriminant)) * 0.5;\n}\nif (t1 < 0.0 && t2 < 0.0) {\ndiscard;\n}\nfloat t = min(t1, t2);\nif (t < 0.0) {\nt = 0.0;\n}\nczm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\nczm_ray ray = czm_ray(t * direction, direction);\nczm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\nif (czm_isEmpty(intersection))\n{\ndiscard;\n}\nvec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\nvec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\ngl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\ngl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\nt = (intersection.start != 0.0) ? intersection.start : intersection.stop;\nvec3 positionEC = czm_pointAlongRay(ray, t);\nvec4 positionCC = czm_projection * vec4(positionEC, 1.0);\nfloat z = positionCC.z / positionCC.w;\nfloat n = czm_depthRange.near;\nfloat f = czm_depthRange.far;\ngl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n}\n"}),i("Shaders/EllipsoidVS",[],function(){"use strict";return"attribute vec3 position;\nuniform vec3 u_radii;\nvarying vec3 v_positionEC;\nvoid main()\n{\nvec4 p = vec4(u_radii * position, 1.0);\nv_positionEC = (czm_modelView * p).xyz;\ngl_Position = czm_modelViewProjection * p;\ngl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n}\n"}),i("Scene/EllipsoidPrimitive",["../Core/BoundingSphere","../Core/BoxGeometry","../Core/Cartesian3","../Core/combine","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Matrix4","../Core/VertexFormat","../Renderer/BufferUsage","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/VertexArray","../Shaders/EllipsoidFS","../Shaders/EllipsoidVS","./BlendingState","./CullFace","./Material","./Pass","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(t){t=n(t,n.EMPTY_OBJECT),this.center=i.clone(n(t.center,i.ZERO)),this._center=new i,this.radii=i.clone(t.radii),this._radii=new i,this._oneOverEllipsoidRadiiSquared=new i,this._boundingSphere=new e,this.modelMatrix=l.clone(n(t.modelMatrix,l.IDENTITY)),this._modelMatrix=new l,this._computedModelMatrix=new l,this.show=n(t.show,!0),this.material=n(t.material,C.fromType(C.ColorType)),this._material=void 0,this._translucent=void 0,this.id=t.id,this._id=void 0,this.debugShowBoundingVolume=n(t.debugShowBoundingVolume,!1),this.onlySunLighting=n(t.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=n(t.depthTestEnabled,!0),this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new h({owner:n(t._owner,this)}),this._pickCommand=new h({owner:n(t._owner,this)});var r=this;this._uniforms={u_radii:function(){return r.radii},u_oneOverEllipsoidRadiiSquared:function(){return r._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return r._pickId.color}}}function T(e){var r=e.cache.ellipsoidPrimitive_vertexArray;if(o(r))return r;var n=t.createGeometry(t.fromDimensions({dimensions:new i(2,2,2),vertexFormat:u.POSITION_ONLY}));return r=f.fromGeometry({context:e,geometry:n,attributeLocations:x,bufferUsage:c.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=r,r}var x={position:0};return w.prototype.update=function(t){if(this.show&&t.mode===S.SCENE3D&&o(this.center)&&o(this.radii)){var n=t.context,a=this.material.isTranslucent(),s=this._translucent!==a;(!o(this._rs)||s)&&(this._translucent=a,this._rs=d.fromCache({cull:{enabled:!0,face:y.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!a&&n.fragmentDepth,blending:a?_.ALPHA_BLEND:void 0})),o(this._va)||(this._va=T(n));var u=!1,c=this.radii;if(!i.equals(this._radii,c)){i.clone(c,this._radii);var h=this._oneOverEllipsoidRadiiSquared;h.x=1/(c.x*c.x),h.y=1/(c.y*c.y),h.z=1/(c.z*c.z),u=!0}l.equals(this.modelMatrix,this._modelMatrix)&&i.equals(this.center,this._center)||(l.clone(this.modelMatrix,this._modelMatrix),i.clone(this.center,this._center),l.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),u=!0),u&&(i.clone(i.ZERO,this._boundingSphere.center),this._boundingSphere.radius=i.maximumComponent(c),e.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));var f=this._material!==this.material;this._material=this.material,this._material.update(n);var C=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;var w,b=this._colorCommand;(f||C||s)&&(w=new m({sources:[this.material.shaderSource,v]}),this.onlySunLighting&&w.defines.push("ONLY_SUN_LIGHTING"),!a&&n.fragmentDepth&&w.defines.push("WRITE_DEPTH"),this._sp=p.replaceCache({context:n,shaderProgram:this._sp,vertexShaderSource:g,fragmentShaderSource:w,attributeLocations:x}),b.vertexArray=this._va,b.renderState=this._rs,b.shaderProgram=this._sp,b.uniformMap=r(this._uniforms,this.material._uniforms),b.executeInClosestFrustum=a);var A=t.commandList,P=t.passes;if(P.render&&(b.boundingVolume=this._boundingSphere,b.debugShowBoundingVolume=this.debugShowBoundingVolume,b.modelMatrix=this._computedModelMatrix,b.pass=a?E.TRANSLUCENT:E.OPAQUE,A.push(b)),P.pick){var I=this._pickCommand;o(this._pickId)&&this._id===this.id||(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=n.createPickId({primitive:this,id:this.id})),(f||C||!o(this._pickSP))&&(w=new m({sources:[this.material.shaderSource,v],pickColorQualifier:"uniform"}),this.onlySunLighting&&w.defines.push("ONLY_SUN_LIGHTING"),!a&&n.fragmentDepth&&w.defines.push("WRITE_DEPTH"),this._pickSP=p.replaceCache({context:n,shaderProgram:this._pickSP,vertexShaderSource:g,fragmentShaderSource:w,attributeLocations:x}),I.vertexArray=this._va,I.renderState=this._rs,I.shaderProgram=this._pickSP,I.uniformMap=r(r(this._uniforms,this._pickUniforms),this.material._uniforms),I.executeInClosestFrustum=a),I.boundingVolume=this._boundingSphere,I.modelMatrix=this._computedModelMatrix,I.pass=a?E.TRANSLUCENT:E.OPAQUE,A.push(I)}}},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),a(this)},w}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceFS",[],function(){"use strict";return"varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n#endif\n}\n"}),i("Shaders/Appearances/EllipsoidSurfaceAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"}),i("Scene/EllipsoidSurfaceAppearance",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/EllipsoidSurfaceAppearanceFS","../Shaders/Appearances/EllipsoidSurfaceAppearanceVS","./Appearance","./Material"],function(e,t,i,r,n,o,a,s){"use strict";function l(i){i=e(i,e.EMPTY_OBJECT);var r=e(i.translucent,!0),l=e(i.aboveGround,!1);this.material=t(i.material)?i.material:s.fromType(s.ColorType),this.translucent=e(i.translucent,!0),this._vertexShaderSource=e(i.vertexShaderSource,o),this._fragmentShaderSource=e(i.fragmentShaderSource,n),this._renderState=a.getDefaultRenderState(r,!l,i.renderState),this._closed=!1,this._flat=e(i.flat,!1),this._faceForward=e(i.faceForward,l),this._aboveGround=l}return i(l.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return l.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),l.VERTEX_FORMAT=r.POSITION_AND_ST,l.prototype.getFragmentShaderSource=a.prototype.getFragmentShaderSource,l.prototype.isTranslucent=a.prototype.isTranslucent,l.prototype.getRenderState=a.prototype.getRenderState,l}),i("Scene/Fog",["../Core/Cartesian3","../Core/defined","../Core/Math","./SceneMode"],function(e,t,i,r){"use strict";function n(){this.enabled=!0,this.density=2e-4,this.screenSpaceErrorFactor=2}function o(e){var t=a,i=t.length;if(et[i-1])return d=i-2;if(e>=t[d]){if(i>d+1&&ed+2&&e=0&&e>=t[d-1])return--d,d;var r;for(r=0;i-2>r&&!(e>=t[r]&&e8e5||n.mode!==r.SCENE3D)return void(n.fog.enabled=!1);var m=d.height,f=o(m),v=i.clamp((m-a[f])/(a[f+1]-a[f]),0,1),g=i.lerp(s[f],s[f+1],v),_=1e6*this.density,y=_/u*c;g=g*(_-y)*1e-6;var C=e.normalize(h.positionWC,p),E=i.clamp(e.dot(h.directionWC,C),0,1);g*=1-E,n.fog.density=g,n.fog.sse=this.screenSpaceErrorFactor}},n}),i("Scene/FrameRateMonitor",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/TimeConstants"],function(e,t,i,r,n,o,a,s){"use strict";function l(i){function r(){c(n)}this._scene=i.scene,this.samplingWindow=e(i.samplingWindow,l.defaultSettings.samplingWindow),this.quietPeriod=e(i.quietPeriod,l.defaultSettings.quietPeriod),this.warmupPeriod=e(i.warmupPeriod,l.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=e(i.minimumFrameRateDuringWarmup,l.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=e(i.minimumFrameRateAfterWarmup,l.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new o,this._nominalFrameRate=new o,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;var n=this;this._preRenderRemoveListener=this._scene.preRender.addEventListener(function(e,t){u(n,t); }),this._hiddenPropertyName=t(document.hidden)?"hidden":t(document.mozHidden)?"mozHidden":t(document.msHidden)?"msHidden":t(document.webkitHidden)?"webkitHidden":void 0;var a=t(document.hidden)?"visibilitychange":t(document.mozHidden)?"mozvisibilitychange":t(document.msHidden)?"msvisibilitychange":t(document.webkitHidden)?"webkitvisibilitychange":void 0;this._visibilityChangeRemoveListener=void 0,t(a)&&(document.addEventListener(a,r,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(a,r,!1)})}function u(e,t){if(!(e._pauseCount>0)){var i=a();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=i+e.quietPeriod/s.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/s.SECONDS_PER_MILLISECOND;else if(i>=e._quietPeriodEndTime){e._frameTimes.push(i);var r=i-e.samplingWindow/s.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=r){for(;e._frameTimes.length>=2&&e._frameTimes[1]e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup);n>o?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}}function c(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}return l.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8},l.fromScene=function(e){return(!t(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new l({scene:e})),e._frameRateMonitor},i(l.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}}),l.prototype.pause=function(){++this._pauseCount,1===this._pauseCount&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)},l.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)},l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){return this._preRenderRemoveListener(),t(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),r(this)},l}),i("Scene/FrameState",["./SceneMode"],function(e){"use strict";function t(t,i){this.context=t,this.commandList=[],this.mode=e.SCENE3D,this.morphTime=e.getMorphTime(e.SCENE3D),this.frameNumber=0,this.time=void 0,this.mapProjection=void 0,this.camera=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.passes={render:!1,pick:!1},this.creditDisplay=i,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0},this.terrainExaggeration=1}return t}),i("Scene/FrustumCommands",["../Core/defaultValue","./Pass"],function(e,t){"use strict";function i(i,r){this.near=e(i,0),this.far=e(r,0);for(var n=t.NUMBER_OF_PASSES,o=new Array(n),a=new Array(n),s=0;n>s;++s)o[s]=[],a[s]=0;this.commands=o,this.indices=a}return i}),i("Shaders/PostProcessFilters/FXAA",[],function(){"use strict";return"#ifndef FXAA_PRESET\n#define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 3)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 16\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 24\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n#define FXAA_EDGE_THRESHOLD (1.0/8.0)\n#define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n#define FXAA_SEARCH_STEPS 32\n#define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n#define FXAA_SUBPIX_CAP (3.0/4.0)\n#define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(vec3 rgb) {\nreturn rgb.y * (0.587/0.299) + rgb.x;\n}\nvec3 FxaaLerp3(vec3 a, vec3 b, float amountOfA) {\nreturn (vec3(-amountOfA) * b) + ((a * vec3(amountOfA)) + b);\n}\nvec4 FxaaTexOff(sampler2D tex, vec2 pos, ivec2 off, vec2 rcpFrame) {\nfloat x = pos.x + float(off.x) * rcpFrame.x;\nfloat y = pos.y + float(off.y) * rcpFrame.y;\nreturn texture2D(tex, vec2(x, y));\n}\nvec3 FxaaPixelShader(vec2 pos, sampler2D tex, vec2 rcpFrame)\n{\nvec3 rgbN = FxaaTexOff(tex, pos.xy, ivec2( 0,-1), rcpFrame).xyz;\nvec3 rgbW = FxaaTexOff(tex, pos.xy, ivec2(-1, 0), rcpFrame).xyz;\nvec3 rgbM = FxaaTexOff(tex, pos.xy, ivec2( 0, 0), rcpFrame).xyz;\nvec3 rgbE = FxaaTexOff(tex, pos.xy, ivec2( 1, 0), rcpFrame).xyz;\nvec3 rgbS = FxaaTexOff(tex, pos.xy, ivec2( 0, 1), rcpFrame).xyz;\nfloat lumaN = FxaaLuma(rgbN);\nfloat lumaW = FxaaLuma(rgbW);\nfloat lumaM = FxaaLuma(rgbM);\nfloat lumaE = FxaaLuma(rgbE);\nfloat lumaS = FxaaLuma(rgbS);\nfloat rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\nfloat rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\nfloat range = rangeMax - rangeMin;\nif(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD))\n{\nreturn rgbM;\n}\nvec3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\nfloat lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\nfloat rangeL = abs(lumaL - lumaM);\nfloat blendL = max(0.0, (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\nblendL = min(FXAA_SUBPIX_CAP, blendL);\nvec3 rgbNW = FxaaTexOff(tex, pos.xy, ivec2(-1,-1), rcpFrame).xyz;\nvec3 rgbNE = FxaaTexOff(tex, pos.xy, ivec2( 1,-1), rcpFrame).xyz;\nvec3 rgbSW = FxaaTexOff(tex, pos.xy, ivec2(-1, 1), rcpFrame).xyz;\nvec3 rgbSE = FxaaTexOff(tex, pos.xy, ivec2( 1, 1), rcpFrame).xyz;\nrgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\nrgbL *= vec3(1.0/9.0);\nfloat lumaNW = FxaaLuma(rgbNW);\nfloat lumaNE = FxaaLuma(rgbNE);\nfloat lumaSW = FxaaLuma(rgbSW);\nfloat lumaSE = FxaaLuma(rgbSE);\nfloat edgeVert =\nabs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\nabs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\nabs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\nfloat edgeHorz =\nabs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\nabs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\nabs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\nbool horzSpan = edgeHorz >= edgeVert;\nfloat lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\nif(!horzSpan)\n{\nlumaN = lumaW;\nlumaS = lumaE;\n}\nfloat gradientN = abs(lumaN - lumaM);\nfloat gradientS = abs(lumaS - lumaM);\nlumaN = (lumaN + lumaM) * 0.5;\nlumaS = (lumaS + lumaM) * 0.5;\nif (gradientN < gradientS)\n{\nlumaN = lumaS;\nlumaN = lumaS;\ngradientN = gradientS;\nlengthSign *= -1.0;\n}\nvec2 posN;\nposN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\nposN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\ngradientN *= FXAA_SEARCH_THRESHOLD;\nvec2 posP = posN;\nvec2 offNP = horzSpan ? vec2(rcpFrame.x, 0.0) : vec2(0.0, rcpFrame.y);\nfloat lumaEndN = lumaN;\nfloat lumaEndP = lumaN;\nbool doneN = false;\nbool doneP = false;\nposN += offNP * vec2(-1.0, -1.0);\nposP += offNP * vec2( 1.0, 1.0);\nfor(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\nif(!doneN)\n{\nlumaEndN = FxaaLuma(texture2D(tex, posN.xy).xyz);\n}\nif(!doneP)\n{\nlumaEndP = FxaaLuma(texture2D(tex, posP.xy).xyz);\n}\ndoneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\ndoneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\nif(doneN && doneP)\n{\nbreak;\n}\nif(!doneN)\n{\nposN -= offNP;\n}\nif(!doneP)\n{\nposP += offNP;\n}\n}\nfloat dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\nfloat dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\nbool directionN = dstN < dstP;\nlumaEndN = directionN ? lumaEndN : lumaEndP;\nif(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n{\nlengthSign = 0.0;\n}\nfloat spanLength = (dstP + dstN);\ndstN = directionN ? dstN : dstP;\nfloat subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\nvec3 rgbF = texture2D(tex, vec2(\npos.x + (horzSpan ? 0.0 : subPixelOffset),\npos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\nreturn FxaaLerp3(rgbL, rgbF, blendL);\n}\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = vec4(FxaaPixelShader(v_textureCoordinates, u_texture, u_step), 1.0);\n}\n"}),i("Scene/FXAA",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/Renderbuffer","../Renderer/RenderbufferFormat","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/FXAA"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(t){this._texture=void 0,this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._fbo=void 0,this._command=void 0,this._viewport=new e,this._rs=void 0;var r=new a({color:new i(0,0,0,0),depth:1,owner:this});this._clearCommand=r}function f(e){e._fbo=e._fbo&&e._fbo.destroy(),e._texture=e._texture&&e._texture.destroy(),e._depthTexture=e._depthTexture&&e._depthTexture.destroy(),e._depthRenderbuffer=e._depthRenderbuffer&&e._depthRenderbuffer.destroy(),e._fbo=void 0,e._texture=void 0,e._depthTexture=void 0,e._depthRenderbuffer=void 0,r(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0)}return m.prototype.update=function(i){var n=i.drawingBufferWidth,a=i.drawingBufferHeight,m=this._texture,f=!r(m)||m.width!==n||m.height!==a;if(f&&(this._texture=this._texture&&this._texture.destroy(),this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._texture=new d({context:i,width:n,height:a,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE}),i.depthTexture?this._depthTexture=new d({context:i,width:n,height:a,pixelFormat:o.DEPTH_COMPONENT,pixelDatatype:l.UNSIGNED_SHORT}):this._depthRenderbuffer=new u({context:i,width:n,height:a,format:c.DEPTH_COMPONENT16})),(!r(this._fbo)||f)&&(this._fbo=this._fbo&&this._fbo.destroy(),this._fbo=new s({context:i,colorTextures:[this._texture],depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,destroyAttachments:!1})),r(this._command)||(this._command=i.createViewportQuadCommand(p,{owner:this})),this._viewport.width=n,this._viewport.height=a,r(this._rs)&&e.equals(this._rs.viewport,this._viewport)||(this._rs=h.fromCache({viewport:this._viewport})),this._command.renderState=this._rs,f){var v=this,g=new t(1/this._texture.width,1/this._texture.height);this._command.uniformMap={u_texture:function(){return v._texture},u_step:function(){return g}}}},m.prototype.execute=function(e,t){this._command.execute(e,t)},m.prototype.clear=function(e,t,r){var n=t.framebuffer;t.framebuffer=this._fbo,i.clone(r,this._clearCommand.color),this._clearCommand.execute(e,t),t.framebuffer=n},m.prototype.getColorFramebuffer=function(){return this._fbo},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){return f(this),n(this)},m}),i("Scene/GetFeatureInfoFormat",["../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/definedNotNull","../Core/DeveloperError","../Core/RuntimeError","./ImageryLayerFeatureInfo"],function(e,t,i,r,n,o,a){"use strict";function s(e,t,r){this.type=e,i(t)||("json"===e?t="application/json":"xml"===e?t="text/xml":"html"===e?t="text/html":"text"===e&&(t="text/plain")),this.format=t,i(r)||("json"===e?r=l:"xml"===e?r=u:"html"===e?r=g:"text"===e&&(r=g)),this.callback=r}function l(t){for(var i=[],n=t.features,o=0;o0)for(var o=0;o1&&(t=i[1]);var r=new a;return r.name=t,r.description=e,r.data=e,[r]}}var _="http://www.mapinfo.com/mxp",y="http://www.esri.com/wms",C="http://www.opengis.net/wfs",E="http://www.opengis.net/gml",S=/\s*<\/body>/im,w=//im,T=/([\s\S]*)<\/title>/im;return s}),i("Shaders/GlobeFS",[],function(){"use strict";return"uniform vec4 u_initialColor;\n#if TEXTURE_UNITS > 0\nuniform sampler2D u_dayTextures[TEXTURE_UNITS];\nuniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n#ifdef APPLY_ALPHA\nuniform float u_dayTextureAlpha[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_BRIGHTNESS\nuniform float u_dayTextureBrightness[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_CONTRAST\nuniform float u_dayTextureContrast[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_HUE\nuniform float u_dayTextureHue[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_SATURATION\nuniform float u_dayTextureSaturation[TEXTURE_UNITS];\n#endif\n#ifdef APPLY_GAMMA\nuniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n#endif\nuniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nuniform sampler2D u_waterMask;\nuniform vec4 u_waterMaskTranslationAndScale;\nuniform float u_zoomedOutOceanSpecularIntensity;\n#endif\n#ifdef SHOW_OCEAN_WAVES\nuniform sampler2D u_oceanNormalMap;\n#endif\n#ifdef ENABLE_DAYNIGHT_SHADING\nuniform vec2 u_lightingFadeDistance;\n#endif\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef FOG\nvarying float v_distance;\nvarying vec3 v_rayleighColor;\nvarying vec3 v_mieColor;\n#endif\nvec4 sampleAndBlend(\nvec4 previousColor,\nsampler2D texture,\nvec2 tileTextureCoordinates,\nvec4 textureCoordinateRectangle,\nvec4 textureCoordinateTranslationAndScale,\nfloat textureAlpha,\nfloat textureBrightness,\nfloat textureContrast,\nfloat textureHue,\nfloat textureSaturation,\nfloat textureOneOverGamma)\n{\nvec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nalphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\ntextureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\nvec2 translation = textureCoordinateTranslationAndScale.xy;\nvec2 scale = textureCoordinateTranslationAndScale.zw;\nvec2 textureCoordinates = tileTextureCoordinates * scale + translation;\nvec4 value = texture2D(texture, textureCoordinates);\nvec3 color = value.rgb;\nfloat alpha = value.a;\n#ifdef APPLY_BRIGHTNESS\ncolor = mix(vec3(0.0), color, textureBrightness);\n#endif\n#ifdef APPLY_CONTRAST\ncolor = mix(vec3(0.5), color, textureContrast);\n#endif\n#ifdef APPLY_HUE\ncolor = czm_hue(color, textureHue);\n#endif\n#ifdef APPLY_SATURATION\ncolor = czm_saturation(color, textureSaturation);\n#endif\n#ifdef APPLY_GAMMA\ncolor = pow(color, vec3(textureOneOverGamma));\n#endif\nfloat sourceAlpha = alpha * textureAlpha;\nfloat outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\nvec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\nreturn vec4(outColor, outAlpha);\n}\nvec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates);\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\nvoid main()\n{\nvec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n#ifdef SHOW_TILE_BOUNDARIES\nif (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\nv_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n{\ncolor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n#endif\n#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nvec3 normalMC = normalize(czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\nvec3 normalEC = normalize(czm_normal3D * normalMC);\n#endif\n#ifdef SHOW_REFLECTIVE_OCEAN\nvec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\nvec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\nvec2 waterMaskTextureCoordinates = v_textureCoordinates * waterMaskScale + waterMaskTranslation;\nfloat mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\nif (mask > 0.0)\n{\nmat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\nvec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\nvec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\nvec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\ncolor = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n}\n#endif\n#ifdef ENABLE_VERTEX_LIGHTING\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#elif defined(ENABLE_DAYNIGHT_SHADING)\nfloat diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\nfloat cameraDist = length(czm_view[3]);\nfloat fadeOutDist = u_lightingFadeDistance.x;\nfloat fadeInDist = u_lightingFadeDistance.y;\nfloat t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\ndiffuseIntensity = mix(1.0, diffuseIntensity, t);\nvec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n#else\nvec4 finalColor = color;\n#endif\n#ifdef FOG\nconst float fExposure = 2.0;\nvec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;\nfogColor = vec3(1.0) - exp(-fExposure * fogColor);\ngl_FragColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n#else\ngl_FragColor = finalColor;\n#endif\n}\n#ifdef SHOW_REFLECTIVE_OCEAN\nfloat waveFade(float edge0, float edge1, float x)\n{\nfloat y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn pow(1.0 - y, 5.0);\n}\nfloat linearFade(float edge0, float edge1, float x)\n{\nreturn clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\nconst float oceanFrequencyLowAltitude = 825000.0;\nconst float oceanAnimationSpeedLowAltitude = 0.004;\nconst float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\nconst float oceanSpecularIntensity = 0.5;\nconst float oceanFrequencyHighAltitude = 125000.0;\nconst float oceanAnimationSpeedHighAltitude = 0.008;\nconst float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\nvec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n{\nvec3 positionToEyeEC = -positionEyeCoordinates;\nfloat positionToEyeECLength = length(positionToEyeEC);\nvec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\nfloat waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n#ifdef SHOW_OCEAN_WAVES\nfloat time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\nvec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\nvec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\ntime = czm_frameNumber * oceanAnimationSpeedLowAltitude;\nnoise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\nvec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\nfloat highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\nfloat lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\nvec3 normalTangentSpace =\n(highAltitudeFade * normalTangentSpaceHighAltitude) +\n(lowAltitudeFade * normalTangentSpaceLowAltitude);\nnormalTangentSpace = normalize(normalTangentSpace);\nnormalTangentSpace.xy *= waveIntensity;\nnormalTangentSpace = normalize(normalTangentSpace);\n#else\nvec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n#endif\nvec3 normalEC = enuToEye * normalTangentSpace;\nconst vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\nfloat diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\nvec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n#ifdef SHOW_OCEAN_WAVES\nfloat tsPerturbationRatio = normalTangentSpace.z;\nvec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n#else\nvec3 nonDiffuseHighlight = vec3(0.0);\n#endif\nfloat specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\nfloat surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\nfloat specular = specularIntensity * surfaceReflectance;\nreturn vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);\n}\n#endif\n"}),i("Shaders/GlobeVS",[],function(){"use strict";return"#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec3 textureCoordAndEncodedNormals;\n#endif\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform vec4 u_tileRectangle;\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n#ifdef FOG\nvarying float v_distance;\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\n#endif\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn czm_projection * (u_modifiedModelView * vec4(position, 1.0));\n}\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\nconst float maxTileWidth = 0.003068;\nfloat positionFraction = textureCoordinates.y;\nfloat southLatitude = u_southAndNorthLatitude.x;\nfloat northLatitude = u_southAndNorthLatitude.y;\nif (northLatitude - southLatitude > maxTileWidth)\n{\nfloat southMercatorY = u_southMercatorYAndOneOverHeight.x;\nfloat oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\nfloat currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\ncurrentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\npositionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n}\nreturn positionFraction;\n}\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\nreturn textureCoordinates.y;\n}\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nreturn czm_projection * (u_modifiedModelView * rtcPosition2D);\n}\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\nreturn getPositionPlanarEarth(position, height, textureCoordinates);\n}\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\nvec3 position3DWC = position + u_center3D;\nfloat yPositionFraction = get2DYPositionFraction(textureCoordinates);\nvec4 position2DWC = vec4(0.0, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\nvec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\nreturn czm_modelViewProjection * morphPosition;\n}\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\nvec2 xy = czm_decompressTextureCoordinates(compressed.x);\nvec2 zh = czm_decompressTextureCoordinates(compressed.y);\nvec3 position = vec3(xy, zh.x);\nfloat height = zh.y;\nvec2 textureCoordinates = czm_decompressTextureCoordinates(compressed.z);\nfloat encodedNormal = compressed.w;\nheight = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\nposition = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n#else\nvec3 position = position3DAndHeight.xyz;\nfloat height = position3DAndHeight.w;\nvec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\nfloat encodedNormal = textureCoordAndEncodedNormals.z;\n#endif\nvec3 position3DWC = position + u_center3D;\ngl_Position = getPosition(position, height, textureCoordinates);\nv_textureCoordinates = textureCoordinates;\n#if defined(ENABLE_VERTEX_LIGHTING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\nv_normalMC = czm_octDecode(encodedNormal);\nv_normalEC = czm_normal3D * v_normalMC;\n#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\nv_positionEC = (czm_modelView3D * vec4(position3DWC, 1.0)).xyz;\nv_positionMC = position3DWC;\n#endif\n#ifdef FOG\nAtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(position3DWC);\nv_mieColor = atmosColor.mie;\nv_rayleighColor = atmosColor.rayleigh;\nv_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n}\n"}),i("Shaders/GroundAtmosphere",[],function(){"use strict";return"const float fInnerRadius = 6378137.0;\nconst float fOuterRadius = 6378137.0 * 1.025;\nconst float fOuterRadius2 = fOuterRadius * fOuterRadius;\nconst float Kr = 0.0025;\nconst float Km = 0.0015;\nconst float ESun = 15.0;\nconst float fKrESun = Kr * ESun;\nconst float fKmESun = Km * ESun;\nconst float fKr4PI = Kr * 4.0 * czm_pi;\nconst float fKm4PI = Km * 4.0 * czm_pi;\nconst float fScale = 1.0 / (fOuterRadius - fInnerRadius);\nconst float fScaleDepth = 0.25;\nconst float fScaleOverScaleDepth = fScale / fScaleDepth;\nstruct AtmosphereColor\n{\nvec3 mie;\nvec3 rayleigh;\n};\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nfloat scale(float fCos)\n{\nfloat x = 1.0 - fCos;\nreturn fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos)\n{\nvec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\nvec3 v3Ray = v3Pos - czm_viewerPositionWC;\nfloat fFar = length(v3Ray);\nv3Ray /= fFar;\nfloat fCameraHeight = length(czm_viewerPositionWC);\nfloat fCameraHeight2 = fCameraHeight * fCameraHeight;\nfloat B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\nfloat C = fCameraHeight2 - fOuterRadius2;\nfloat fDet = max(0.0, B*B - 4.0 * C);\nfloat fNear = 0.5 * (-B - sqrt(fDet));\nvec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\nfFar -= fNear;\nfloat fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\nfloat fLightAngle = 1.0;\nfloat fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\nfloat fCameraScale = scale(fCameraAngle);\nfloat fLightScale = scale(fLightAngle);\nfloat fCameraOffset = fDepth*fCameraScale;\nfloat fTemp = (fLightScale + fCameraScale);\nfloat fSampleLength = fFar / fSamples;\nfloat fScaledLength = fSampleLength * fScale;\nvec3 v3SampleRay = v3Ray * fSampleLength;\nvec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\nvec3 v3FrontColor = vec3(0.0);\nvec3 v3Attenuate = vec3(0.0);\nfor(int i=0; i<nSamples; i++)\n{\nfloat fHeight = length(v3SamplePoint);\nfloat fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight));\nfloat fScatter = fDepth*fTemp - fCameraOffset;\nv3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI));\nv3FrontColor += v3Attenuate * (fDepth * fScaledLength);\nv3SamplePoint += v3SampleRay;\n}\nAtmosphereColor color;\ncolor.mie = v3FrontColor * (v3InvWavelength * fKrESun + fKmESun);\ncolor.rayleigh = v3Attenuate;\nreturn color;\n}\n"}),i("Scene/GlobeSurfaceShaderSet",["../Core/defined","../Core/destroyObject","../Core/TerrainQuantization","../Renderer/ShaderProgram","../Scene/SceneMode"],function(e,t,i,r,n){"use strict";function o(e,t,i){this.numberOfDayTextures=e,this.flags=t,this.shaderProgram=i}function a(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this._pickShaderPrograms=[]}function s(e){var t,i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",r="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition2DMode(position, height, textureCoordinates); }",o="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",a="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }";switch(e){case n.SCENE3D:t=i;break;case n.SCENE2D:t=r;break;case n.COLUMBUS_VIEW:t=o;break;case n.MORPHING:t=a}return t}function l(e){var t="float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }",i="float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }"; return e?i:t}return a.prototype.getShaderProgram=function(t,n,a,u,c,h,d,p,m,f,v,g,_,y,C){var E=0,S="",w=n.pickTerrain.mesh.encoding,T=w.quantization;T===i.BITS12&&(E=1,S="QUANTIZATION_BITS12");var x=t.mode,b=x|u<<2|c<<3|h<<4|d<<5|p<<6|m<<7|f<<8|v<<9|g<<10|_<<11|y<<12|C<<13|E<<14,A=n.surfaceShader;if(e(A)&&A.numberOfDayTextures===a&&A.flags===b)return A.shaderProgram;var P=this._shadersByTexturesFlags[a];if(e(P)||(P=this._shadersByTexturesFlags[a]=[]),A=P[b],!e(A)){var I=this.baseVertexShaderSource.clone(),M=this.baseFragmentShaderSource.clone();I.defines.push(S),M.defines.push("TEXTURE_UNITS "+a),u&&M.defines.push("APPLY_BRIGHTNESS"),c&&M.defines.push("APPLY_CONTRAST"),h&&M.defines.push("APPLY_HUE"),d&&M.defines.push("APPLY_SATURATION"),p&&M.defines.push("APPLY_GAMMA"),m&&M.defines.push("APPLY_ALPHA"),f&&(M.defines.push("SHOW_REFLECTIVE_OCEAN"),I.defines.push("SHOW_REFLECTIVE_OCEAN")),v&&M.defines.push("SHOW_OCEAN_WAVES"),g&&(_?(I.defines.push("ENABLE_VERTEX_LIGHTING"),M.defines.push("ENABLE_VERTEX_LIGHTING")):(I.defines.push("ENABLE_DAYNIGHT_SHADING"),M.defines.push("ENABLE_DAYNIGHT_SHADING"))),C&&(I.defines.push("FOG"),M.defines.push("FOG"));for(var D=" vec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates)\n {\n vec4 color = initialColor;\n",R=0;a>R;++R)D+=" color = sampleAndBlend(\n color,\n u_dayTextures["+R+"],\n textureCoordinates,\n u_dayTextureTexCoordsRectangle["+R+"],\n u_dayTextureTranslationAndScale["+R+"],\n "+(m?"u_dayTextureAlpha["+R+"]":"1.0")+",\n "+(u?"u_dayTextureBrightness["+R+"]":"0.0")+",\n "+(c?"u_dayTextureContrast["+R+"]":"0.0")+",\n "+(h?"u_dayTextureHue["+R+"]":"0.0")+",\n "+(d?"u_dayTextureSaturation["+R+"]":"0.0")+",\n "+(p?"u_dayTextureOneOverGamma["+R+"]":"0.0")+"\n );\n";D+=" return color;\n }",M.sources.push(D),I.sources.push(s(x)),I.sources.push(l(y));var O=r.fromCache({context:t.context,vertexShaderSource:I,fragmentShaderSource:M,attributeLocations:w.getAttributeLocations()});A=P[b]=new o(a,b,O)}return n.surfaceShader=A,A.shaderProgram},a.prototype.getPickShaderProgram=function(t,n,o){var a=0,u="",c=n.pickTerrain.mesh.encoding,h=c.quantization;h===i.BITS12&&(a=1,u="QUANTIZATION_BITS12");var d=t.mode,p=d|o<<2|a<<3,m=this._pickShaderPrograms[p];if(!e(m)){var f=this.baseVertexShaderSource.clone();f.defines.push(u),f.sources.push(s(d)),f.sources.push(l(o));var v="void main()\n{\n gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\n";m=this._pickShaderPrograms[p]=r.fromCache({context:t.context,vertexShaderSource:f,fragmentShaderSource:v,attributeLocations:c.getAttributeLocations()})}return m},a.prototype.destroy=function(){var i=this._shadersByTexturesFlags;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];if(!e(n))continue;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];e(a)&&a.shaderProgram.destroy()}}return t(this)},a}),i("Scene/ImageryState",["../Core/freezeObject"],function(e){"use strict";var t={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7};return e(t)}),i("Scene/QuadtreeTileLoadState",["../Core/freezeObject"],function(e){"use strict";var t={START:0,LOADING:1,DONE:2,FAILED:3};return e(t)}),i("Scene/TerrainState",["../Core/freezeObject"],function(e){"use strict";var t={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6};return e(t)}),i("Scene/TileBoundingBox",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/DeveloperError","../Core/Ellipsoid","../Core/Rectangle","./SceneMode"],function(e,t,i,r,n,o,a,s){"use strict";function l(t,i,r){r.cartographicToCartesian(a.southwest(i),t.southwestCornerCartesian),r.cartographicToCartesian(a.northeast(i),t.northeastCornerCartesian),m.longitude=i.west,m.latitude=.5*(i.south+i.north),m.height=0;var n=r.cartographicToCartesian(m,d),o=e.cross(n,e.UNIT_Z,c);e.normalize(o,t.westNormal),m.longitude=i.east;var s=r.cartographicToCartesian(m,p),l=e.cross(e.UNIT_Z,s,c);e.normalize(l,t.eastNormal);var u=r.geodeticSurfaceNormalCartographic(a.southeast(i),h),f=e.subtract(n,s,c),v=e.cross(u,f,h);e.normalize(v,t.southNormal);var g=r.geodeticSurfaceNormalCartographic(a.northwest(i),h),_=e.cross(f,g,h);e.normalize(_,t.northNormal)}var u=function(t){t=i(t,i.EMPTY_OBJECT),this.rectangle=a.clone(t.rectangle),this.minimumHeight=i(t.minimumHeight,0),this.maximumHeight=i(t.maximumHeight,0),this.southwestCornerCartesian=new e,this.northeastCornerCartesian=new e,this.westNormal=new e,this.southNormal=new e,this.eastNormal=new e,this.northNormal=new e;var r=i(t.ellipsoid,o.WGS84);l(this,t.rectangle,r)},c=new e,h=new e,d=new e,p=new e,m=new t,f=new e,v=new e,g=new e(0,-1,0),_=new e(0,0,-1),y=new e;return u.prototype.distanceToCamera=function(t){var i=t.camera,r=i.positionWC,n=i.positionCartographic,o=0;if(!a.contains(this.rectangle,n)){var l=this.southwestCornerCartesian,u=this.northeastCornerCartesian,c=this.westNormal,h=this.southNormal,d=this.eastNormal,p=this.northNormal;t.mode!==s.SCENE3D&&(l=t.mapProjection.project(a.southwest(this.rectangle),f),l.z=l.y,l.y=l.x,l.x=0,u=t.mapProjection.project(a.northeast(this.rectangle),v),u.z=u.y,u.y=u.x,u.x=0,c=g,d=e.UNIT_Y,h=_,p=e.UNIT_Z);var m=e.subtract(r,l,y),C=e.dot(m,c),E=e.dot(m,h),S=e.subtract(r,u,y),w=e.dot(S,d),T=e.dot(S,p);C>0?o+=C*C:w>0&&(o+=w*w),E>0?o+=E*E:T>0&&(o+=T*T)}var x;x=t.mode===s.SCENE3D?n.height:r.x;var b=t.mode===s.SCENE3D?this.maximumHeight:0,A=x-b;return A>0&&(o+=A*A),Math.sqrt(o)},u}),i("Scene/TileTerrain",["../Core/BoundingSphere","../Core/Cartesian3","../Core/ComponentDatatype","../Core/defined","../Core/DeveloperError","../Core/IndexDatatype","../Core/OrientedBoundingBox","../Core/TileProviderError","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/VertexArray","../ThirdParty/when","./TerrainState","./TileBoundingBox"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(e){this.state=d.UNLOADED,this.data=void 0,this.mesh=void 0,this.vertexArray=void 0,this.upsampleDetails=e}function f(e,t,i,n,o){function a(t){e.data=t,e.state=d.RECEIVED}function l(){e.state=d.FAILED;var r="Failed to obtain terrain tile X: "+i+" Y: "+n+" Level: "+o+".";t._requestError=s.handleError(t._requestError,t,t.errorEvent,r,i,n,o,u)}function u(){e.data=t.requestTileGeometry(i,n,o),r(e.data)?(e.state=d.RECEIVING,h(e.data,a,l)):e.state=d.UNLOADED}u()}function v(e,t,i,n,o,a){var s=i.tilingScheme,l=e.data,u=l.createMesh(s,n,o,a,t.terrainExaggeration);r(u)&&(e.state=d.TRANSFORMING,h(u,function(t){e.mesh=t,e.state=d.TRANSFORMED},function(){e.state=d.FAILED}))}function g(e,t,i,n,a,s){var h=e.mesh.vertices,p=l.createVertexBuffer({context:t,typedArray:h,usage:u.STATIC_DRAW}),m=e.mesh.encoding.getAttributes(p),f=e.mesh.indices.indexBuffers||{},v=f[t.id];if(!r(v)||v.isDestroyed()){var g=e.mesh.indices,_=2===g.BYTES_PER_ELEMENT?o.UNSIGNED_SHORT:o.UNSIGNED_INT;v=l.createIndexBuffer({context:t,typedArray:g,usage:u.STATIC_DRAW,indexDatatype:_}),v.vertexArrayDestroyable=!1,v.referenceCount=1,f[t.id]=v,e.mesh.indices.indexBuffers=f}else++v.referenceCount;e.vertexArray=new c({context:t,attributes:m,indexBuffer:v}),e.state=d.READY}return m.prototype.freeResources=function(){if(this.state=d.UNLOADED,this.data=void 0,this.mesh=void 0,r(this.vertexArray)){var e=this.vertexArray.indexBuffer;this.vertexArray.destroy(),this.vertexArray=void 0,!e.isDestroyed()&&r(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())}},m.prototype.publishToTile=function(i){var r=i.data,n=this.mesh;t.clone(n.center,r.center),r.minimumHeight=n.minimumHeight,r.maximumHeight=n.maximumHeight,r.boundingSphere3D=e.clone(n.boundingSphere3D,r.boundingSphere3D),r.orientedBoundingBox=a.clone(n.orientedBoundingBox,r.orientedBoundingBox),r.tileBoundingBox=new p({rectangle:i.rectangle,minimumHeight:n.minimumHeight,maximumHeight:n.maximumHeight,ellipsoid:i.tilingScheme.ellipsoid}),i.data.occludeePointInScaledSpace=t.clone(n.occludeePointInScaledSpace,r.occludeePointInScaledSpace),r.freeVertexArray(),r.vertexArray=this.vertexArray,this.vertexArray=void 0},m.prototype.processLoadStateMachine=function(e,t,i,r,n){this.state===d.UNLOADED&&f(this,t,i,r,n),this.state===d.RECEIVED&&v(this,e,t,i,r,n),this.state===d.TRANSFORMED&&g(this,e.context,t,i,r,n)},m.prototype.processUpsampleStateMachine=function(e,t,i,n,o){if(this.state===d.UNLOADED){var a=this.upsampleDetails,s=a.data,l=a.x,u=a.y,c=a.level;if(this.data=s.upsample(t.tilingScheme,l,u,c,i,n,o),!r(this.data))return;this.state=d.RECEIVING;var p=this;h(this.data,function(e){p.data=e,p.state=d.RECEIVED},function(){p.state=d.FAILED})}this.state===d.RECEIVED&&v(this,e,t,i,n,o),this.state===d.TRANSFORMED&&g(this,e.context,t,i,n,o)},m}),i("Scene/GlobeSurfaceTile",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/IntersectionTests","../Core/PixelFormat","../Core/Rectangle","../Renderer/PixelDatatype","../Renderer/Sampler","../Renderer/Texture","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","./ImageryState","./QuadtreeTileLoadState","./SceneMode","./TerrainState","./TileBoundingBox","./TileTerrain"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E){"use strict";function S(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new i(0,0,1,1),this.terrainData=void 0,this.center=new t,this.vertexArray=void 0,this.minimumHeight=0,this.maximumHeight=0,this.boundingSphere3D=new e,this.boundingSphere2D=new e,this.orientedBoundingBox=void 0,this.tileBoundingBox=void 0,this.occludeePointInScaledSpace=new t,this.loadedTerrain=void 0,this.upsampledTerrain=void 0,this.pickBoundingSphere=new e,this.pickTerrain=void 0,this.surfaceShader=void 0}function w(e,i,r,n,a,s){if(e.decodePosition(n,a,s),o(i)&&i!==_.SCENE3D){var l=r.ellipsoid,u=l.cartesianToCartographic(s);r.project(u,s),t.fromElements(s.z,s.x,s.y,s)}return s}function T(e,t,i){var r=e.data,n=b(e);o(n)&&(r.upsampledTerrain=new E(n)),I(e,t)&&(r.loadedTerrain=new E);for(var a=0,s=i.length;s>a;++a){var l=i.get(a);l.show&&l._createTileImagerySkeletons(e,t)}}function x(e,t,i){var r=e.data,a=r.loadedTerrain,s=r.upsampledTerrain,l=!1;o(a)&&(a.processLoadStateMachine(t,i,e.x,e.y,e.level),a.state>=y.RECEIVED&&(r.terrainData!==a.data&&(r.terrainData=a.data,D(t.context,r),P(e)),l=!0),a.state===y.READY?(a.publishToTile(e),r.pickTerrain=n(r.loadedTerrain,r.upsampledTerrain),r.loadedTerrain=void 0,r.upsampledTerrain=void 0):a.state===y.FAILED&&(r.loadedTerrain=void 0)),!l&&o(s)&&(s.processUpsampleStateMachine(t,i,e.x,e.y,e.level),s.state>=y.RECEIVED&&r.terrainData!==s.data&&(r.terrainData=s.data,i.hasWaterMask&&R(e),A(e)),s.state===y.READY?(s.publishToTile(e),r.pickTerrain=r.upsampledTerrain,r.upsampledTerrain=void 0):s.state===y.FAILED&&(r.upsampledTerrain=void 0))}function b(e){for(var t=e.parent;o(t)&&o(t.data)&&!o(t.data.terrainData);)t=t.parent;return o(t)&&o(t.data)?{data:t.data.terrainData,x:t.x,y:t.y,level:t.level}:void 0}function A(e){var t=e.data;if(o(e._children))for(var i=0;4>i;++i){var r=e._children[i];if(r.state!==g.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new E({data:t.terrainData,x:e.x,y:e.y,level:e.level}),r.state=g.LOADING}}}function P(e){var t=e.data;if(o(e.children))for(var i=0;4>i;++i){var r=e.children[i];if(r.state!==g.START){var n=r.data;if(o(n.terrainData)&&!n.terrainData.wasCreatedByUpsampling())continue;o(n.upsampledTerrain)&&n.upsampledTerrain.freeResources(),n.upsampledTerrain=new E({data:t.terrainData,x:e.x,y:e.y,level:e.level}),t.terrainData.isChildAvailable(e.x,e.y,r.x,r.y)&&(o(n.loadedTerrain)||(n.loadedTerrain=new E)),r.state=g.LOADING}}}function I(e,t){var i=t.getTileDataAvailable(e.x,e.y,e.level);if(o(i))return i;var r=e.parent;return o(r)?o(r.data)&&o(r.data.terrainData)?r.data.terrainData.isChildAvailable(r.x,r.y,e.x,e.y):!1:!0}function M(e){var t=e.cache.tile_waterMaskData;if(!o(t)){var i=new d({context:e,pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});i.referenceCount=1;var r=new h({wrapS:f.CLAMP_TO_EDGE,wrapT:f.CLAMP_TO_EDGE,minificationFilter:m.LINEAR,magnificationFilter:p.LINEAR});t={allWaterTexture:i,sampler:r,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function D(e,t){var r=t.waterMaskTexture;o(r)&&(--r.referenceCount,0===r.referenceCount&&r.destroy(),t.waterMaskTexture=void 0);var n=t.terrainData.waterMask;if(o(n)){var a,s=M(e),u=n.length;if(1===u){if(0===n[0])return;a=s.allWaterTexture}else{var h=Math.sqrt(u);a=new d({context:e,pixelFormat:l.LUMINANCE,pixelDatatype:c.UNSIGNED_BYTE,source:{width:h,height:h,arrayBufferView:n},sampler:s.sampler}),a.referenceCount=0}++a.referenceCount,t.waterMaskTexture=a,i.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}}function R(e){for(var t=e.data,i=e.parent;o(i)&&!o(i.data.terrainData)||i.data.terrainData.wasCreatedByUpsampling();)i=i.parent;if(o(i)&&o(i.data.waterMaskTexture)){t.waterMaskTexture=i.data.waterMaskTexture,++t.waterMaskTexture.referenceCount;var r=i.rectangle,n=e.rectangle,a=n.width,s=n.height,l=a/r.width,u=s/r.height;t.waterMaskTranslationAndScale.x=l*(n.west-r.west)/a,t.waterMaskTranslationAndScale.y=u*(n.south-r.south)/s,t.waterMaskTranslationAndScale.z=l,t.waterMaskTranslationAndScale.w=u}}a(S.prototype,{eligibleForUnloading:{get:function(){for(var e=this.loadedTerrain,t=o(e)&&(e.state===y.RECEIVING||e.state===y.TRANSFORMING),i=this.upsampledTerrain,r=o(i)&&(i.state===y.RECEIVING||i.state===y.TRANSFORMING),n=!t&&!r,a=this.imagery,s=0,l=a.length;n&&l>s;++s){var u=a[s];n=!o(u.loadingImagery)||u.loadingImagery.state!==v.TRANSITIONING}return n}}});var O=new t,N=new t,L=new t,F=new t;return S.prototype.pick=function(e,i,r,n,a){var l=this.pickTerrain;if(o(l)){var u=l.mesh;if(o(u))for(var c=u.vertices,h=u.indices,d=u.encoding,p=h.length,m=0;p>m;m+=3){var f=h[m],v=h[m+1],g=h[m+2],_=w(d,i,r,c,f,O),y=w(d,i,r,c,v,N),C=w(d,i,r,c,g,L),E=s.rayTriangle(e,_,y,C,n,F);if(o(E))return t.clone(E,a)}}},S.prototype.freeResources=function(){o(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,0===this.waterMaskTexture.referenceCount&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,o(this.loadedTerrain)&&(this.loadedTerrain.freeResources(),this.loadedTerrain=void 0),o(this.upsampledTerrain)&&(this.upsampledTerrain.freeResources(),this.upsampledTerrain=void 0),o(this.pickTerrain)&&(this.pickTerrain.freeResources(),this.pickTerrain=void 0);var e,t,i=this.imagery;for(e=0,t=i.length;t>e;++e)i[e].freeResources();this.imagery.length=0,this.freeVertexArray()},S.prototype.freeVertexArray=function(){var e;o(this.vertexArray)&&(e=this.vertexArray.indexBuffer,this.vertexArray=this.vertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy())),o(this.wireframeVertexArray)&&(e=this.wireframeVertexArray.indexBuffer,this.wireframeVertexArray=this.wireframeVertexArray.destroy(),!e.isDestroyed()&&o(e.referenceCount)&&(--e.referenceCount,0===e.referenceCount&&e.destroy()))},S.processStateMachine=function(e,t,i,r){var n=e.data;o(n)||(n=e.data=new S),e.state===g.START&&(T(e,i,r),e.state=g.LOADING),e.state===g.LOADING&&x(e,t,i);for(var a=o(n.vertexArray),s=!o(n.loadedTerrain)&&!o(n.upsampledTerrain),l=o(n.terrainData)&&n.terrainData.wasCreatedByUpsampling(),u=n.imagery,c=0,h=u.length;h>c;++c){var d=u[c];if(o(d.loadingImagery)){if(d.loadingImagery.state===v.PLACEHOLDER){var p=d.loadingImagery.imageryLayer;if(p.imageryProvider.ready){d.freeResources(),u.splice(c,1),p._createTileImagerySkeletons(e,i,c),--c,h=u.length;continue}l=!1}var m=d.processStateMachine(e,t);s=s&&m,a=a&&(m||o(d.readyImagery)),l=l&&o(d.loadingImagery)&&(d.loadingImagery.state===v.FAILED||d.loadingImagery.state===v.INVALID)}else l=!1}e.upsampledFromParent=l,c===h&&(a&&(e.renderable=!0),s&&(e.state=g.DONE))},S}),i("Shaders/ReprojectWebMercatorFS",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Shaders/ReprojectWebMercatorVS",[],function(){"use strict";return"attribute vec4 position;\nattribute float webMercatorT;\nuniform vec2 u_textureDimensions;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nv_textureCoordinates = vec2(position.x, webMercatorT);\ngl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n"}),i("Scene/Imagery",["../Core/defined","../Core/destroyObject","./ImageryState"],function(e,t,i){"use strict";function r(t,r,n,o,a){if(this.imageryLayer=t,this.x=r,this.y=n,this.level=o,0!==o){var s=r/2|0,l=n/2|0,u=o-1;this.parent=t.getImageryFromCache(s,l,u)}if(this.state=i.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.credits=void 0,this.referenceCount=0,!e(a)&&t.imageryProvider.ready){var c=t.imageryProvider.tilingScheme;a=c.tileXYToRectangle(r,n,o)}this.rectangle=a}return r.createPlaceholder=function(e){var t=new r(e,0,0,0);return t.addReference(),t.state=i.PLACEHOLDER,t},r.prototype.addReference=function(){++this.referenceCount},r.prototype.releaseReference=function(){return--this.referenceCount,0===this.referenceCount?(this.imageryLayer.removeImageryFromCache(this),e(this.parent)&&this.parent.releaseReference(),e(this.image)&&e(this.image.destroy)&&this.image.destroy(),e(this.texture)&&this.texture.destroy(),t(this),0):this.referenceCount},r.prototype.processStateMachine=function(e){this.state===i.UNLOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===i.RECEIVED&&(this.state=i.TRANSITIONING,this.imageryLayer._createTexture(e.context,this)),this.state===i.TEXTURE_LOADED&&(this.state=i.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this))},r}),i("Scene/TileImagery",["../Core/defined","./ImageryState"],function(e,t){"use strict";function i(e,t){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0}return i.prototype.freeResources=function(){e(this.readyImagery)&&this.readyImagery.releaseReference(),e(this.loadingImagery)&&this.loadingImagery.releaseReference()},i.prototype.processStateMachine=function(i,r){var n=this.loadingImagery,o=n.imageryLayer;if(n.processStateMachine(r),n.state===t.READY)return e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this),!0;for(var a,s=n.parent;e(s)&&s.state!==t.READY;)s.state!==t.FAILED&&s.state!==t.INVALID&&(a=a||s),s=s.parent;return this.readyImagery!==s&&(e(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=s,e(s)&&(s.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(i,this))),n.state===t.FAILED||n.state===t.INVALID?e(a)?(a.processStateMachine(r),!1):!0:!1},i}),i("Scene/ImageryLayer",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian4","../Core/Color","../Core/ComponentDatatype","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/FeatureDetection","../Core/GeographicTilingScheme","../Core/IndexDatatype","../Core/Math","../Core/PixelFormat","../Core/PrimitiveType","../Core/Rectangle","../Core/TerrainProvider","../Core/TileProviderError","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/ClearCommand","../Renderer/ComputeCommand","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/Framebuffer","../Renderer/MipmapHint","../Renderer/RenderState","../Renderer/Sampler","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/TextureMagnificationFilter","../Renderer/TextureMinificationFilter","../Renderer/TextureWrap","../Renderer/VertexArray","../Shaders/ReprojectWebMercatorFS","../Shaders/ReprojectWebMercatorVS","../ThirdParty/when","./Imagery","./ImageryState","./TileImagery"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z){"use strict";function U(e,t){this._imageryProvider=e,t=o(t,{}),this.alpha=o(t.alpha,o(e.defaultAlpha,1)),this.brightness=o(t.brightness,o(e.defaultBrightness,U.DEFAULT_BRIGHTNESS)),this.contrast=o(t.contrast,o(e.defaultContrast,U.DEFAULT_CONTRAST)),this.hue=o(t.hue,o(e.defaultHue,U.DEFAULT_HUE)),this.saturation=o(t.saturation,o(e.defaultSaturation,U.DEFAULT_SATURATION)),this.gamma=o(t.gamma,o(e.defaultGamma,U.DEFAULT_GAMMA)),this.show=o(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=o(t.rectangle,f.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new z(V.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0}function G(e,t,i,r){if(d.isPowerOfTwo(r.width)&&d.isPowerOfTwo(r.height)){var n=t.cache.imageryLayer_mipmapSampler;if(!a(n)){var s=S.maximumTextureFilterAnisotropy;n=t.cache.imageryLayer_mipmapSampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR_MIPMAP_LINEAR,magnificationFilter:D.LINEAR,maximumAnisotropy:Math.min(s,o(e._maximumAnisotropy,s))})}r.generateMipmap(x.NICEST),r.sampler=n}else{var l=t.cache.imageryLayer_nonMipmapSampler;a(l)||(l=t.cache.imageryLayer_nonMipmapSampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR,magnificationFilter:D.LINEAR})),r.sampler=l}i.state=k.READY}function W(e,t,i){return JSON.stringify([e,t,i])}function H(e,t,i,r){var n=t.cache.imageryLayer_reproject;if(!a(n)){n=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){a(this.framebuffer)&&this.framebuffer.destroy(),a(this.vertexArray)&&this.vertexArray.destroy(),a(this.shaderProgram)&&this.shaderProgram.destroy()}};for(var o=new Float32Array(256),s=0,l=0;64>l;++l){var u=l/63;o[s++]=0,o[s++]=u,o[s++]=1,o[s++]=u}var c={position:0,webMercatorT:1},p=v.getRegularGridIndices(2,64),m=_.createIndexBuffer({context:t,typedArray:p,usage:y.STATIC_DRAW,indexDatatype:h.UNSIGNED_SHORT});n.vertexArray=new N({context:t,attributes:[{index:c.position,vertexBuffer:_.createVertexBuffer({context:t,typedArray:o,usage:y.STATIC_DRAW}),componentsPerAttribute:2},{index:c.webMercatorT,vertexBuffer:_.createVertexBuffer({context:t,sizeInBytes:512,usage:y.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:m});var f=new I({sources:[F]});n.shaderProgram=P.fromCache({context:t,vertexShaderSource:f,fragmentShaderSource:L,attributeLocations:c}),n.sampler=new A({wrapS:O.CLAMP_TO_EDGE,wrapT:O.CLAMP_TO_EDGE,minificationFilter:R.LINEAR,magnificationFilter:D.LINEAR})}i.sampler=n.sampler;var g=i.width,C=i.height;Z.textureDimensions.x=g,Z.textureDimensions.y=C,Z.texture=i;var E=Math.sin(r.south),S=.5*Math.log((1+E)/(1-E));E=Math.sin(r.north);var w=.5*Math.log((1+E)/(1-E)),T=1/(w-S),b=new M({context:t,width:g,height:C,pixelFormat:i.pixelFormat,pixelDatatype:i.pixelDatatype,preMultiplyAlpha:i.preMultiplyAlpha});d.isPowerOfTwo(g)&&d.isPowerOfTwo(C)&&b.generateMipmap(x.NICEST);for(var B=r.south,V=r.north,k=K,z=0,U=0;64>U;++U){var G=U/63,W=d.lerp(B,V,G);E=Math.sin(W);var H=.5*Math.log((1+E)/(1-E)),q=(H-S)*T;k[z++]=q,k[z++]=q}n.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(k),e.shaderProgram=n.shaderProgram,e.outputTexture=b,e.uniformMap=Z,e.vertexArray=n.vertexArray}function q(e,t,i){var r=e._imageryProvider,n=r.tilingScheme,o=n.ellipsoid,a=e._imageryProvider.tilingScheme instanceof c?1:Math.cos(i),s=n.rectangle,l=o.maximumRadius*s.width*a/(r.tileWidth*n.getNumberOfXTilesAtLevel(0)),u=l/t,h=Math.log(u)/Math.log(2),d=Math.round(h);return 0|d}s(U.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}}),U.DEFAULT_BRIGHTNESS=1,U.DEFAULT_CONTRAST=1,U.DEFAULT_HUE=0,U.DEFAULT_SATURATION=1,U.DEFAULT_GAMMA=1,U.prototype.isBaseLayer=function(){return this._isBaseLayer},U.prototype.isDestroyed=function(){return!1},U.prototype.destroy=function(){return l(this)};var j=new f,Y=new f,X=new f;U.prototype.getViewableRectangle=function(){var e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return f.intersection(e.rectangle,t)})},U.prototype._createTileImagerySkeletons=function(e,t,r){var n=e.data;if(a(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel)return!1;if(a(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;var o=this._imageryProvider;if(a(r)||(r=n.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),n.imagery.splice(r,0,this._skeletonPlaceholder),!0;var s=f.intersection(o.rectangle,this._rectangle,j),l=f.intersection(e.rectangle,s,Y);if(!a(l)){if(!this.isBaseLayer())return!1;var u=s,c=e.rectangle;l=Y,c.south>=u.north?l.north=l.south=u.north:c.north<=u.south?l.north=l.south=u.south:(l.south=Math.max(c.south,u.south),l.north=Math.min(c.north,u.north)),c.west>=u.east?l.west=l.east=u.east:c.east<=u.west?l.west=l.east=u.west:(l.west=Math.max(c.west,u.west),l.east=Math.min(c.east,u.east))}var h=0;l.south>0?h=l.south:l.north<0&&(h=l.north);var d=1,p=d*t.getLevelMaximumGeometricError(e.level),m=q(this,p,h);m=Math.max(0,m);var v=o.maximumLevel;if(m>v&&(m=v),a(o.minimumLevel)){var g=o.minimumLevel;g>m&&(m=g)}var _=o.tilingScheme,y=_.positionToTileXY(f.northwest(l),m),C=_.positionToTileXY(f.southeast(l),m),E=e.rectangle.height/512,S=e.rectangle.width/512,w=_.tileXYToRectangle(y.x,y.y,m);Math.abs(w.south-e.rectangle.north)<S&&y.y<C.y&&++y.y,Math.abs(w.east-e.rectangle.west)<E&&y.x<C.x&&++y.x;var T=_.tileXYToRectangle(C.x,C.y,m);Math.abs(T.north-e.rectangle.south)<S&&C.y>y.y&&--C.y,Math.abs(T.west-e.rectangle.east)<E&&C.x>y.x&&--C.x;var x,b,A=e.rectangle,P=_.tileXYToRectangle(y.x,y.y,m),I=f.intersection(P,s,X),M=0,D=1;!this.isBaseLayer()&&Math.abs(I.west-e.rectangle.west)>=E&&(M=Math.min(1,(I.west-A.west)/A.width)),!this.isBaseLayer()&&Math.abs(I.north-e.rectangle.north)>=S&&(D=Math.max(0,(I.north-A.south)/A.height));for(var R=D,O=y.x;O<=C.x;O++){x=M,P=_.tileXYToRectangle(O,y.y,m),I=f.intersection(P,s,X),M=Math.min(1,(I.east-A.west)/A.width),O===C.x&&(this.isBaseLayer()||Math.abs(I.east-e.rectangle.east)<E)&&(M=1),D=R;for(var N=y.y;N<=C.y;N++){b=D,P=_.tileXYToRectangle(O,N,m),I=f.intersection(P,s,X),D=Math.max(0,(I.south-A.south)/A.height),N===C.y&&(this.isBaseLayer()||Math.abs(I.south-e.rectangle.south)<S)&&(D=0);var L=new i(x,D,M,b),F=this.getImageryFromCache(O,N,m,P);n.imagery.splice(r,0,new z(F,L)),++r}}return!0},U.prototype._calculateTextureTranslationAndScale=function(e,t){var r=t.readyImagery.rectangle,n=e.rectangle,o=n.width,a=n.height,s=o/r.width,l=a/r.height;return new i(s*(n.west-r.west)/o,l*(n.south-r.south)/a,s,l)},U.prototype._requestImagery=function(e){function t(t){return a(t)?(e.image=t,e.state=k.RECEIVED,void g.handleSuccess(o._requestImageError)):i()}function i(t){e.state=k.FAILED;var i="Failed to obtain image tile X: "+e.x+" Y: "+e.y+" Level: "+e.level+".";o._requestImageError=g.handleError(o._requestImageError,n,n.errorEvent,i,e.x,e.y,e.level,r,t)}function r(){e.state=k.TRANSITIONING;var r=n.requestImage(e.x,e.y,e.level);return a(r)?(a(n.getTileCredits)&&(e.credits=n.getTileCredits(e.x,e.y,e.level)),void B(r,t,i)):void(e.state=k.UNLOADED)}var n=this._imageryProvider,o=this;r()},U.prototype._createTexture=function(e,t){var i=this._imageryProvider;if(a(i.tileDiscardPolicy)){var r=i.tileDiscardPolicy;if(a(r)){if(!r.isReady())return void(t.state=k.RECEIVED);if(r.shouldDiscardImage(t.image))return void(t.state=k.INVALID)}}var n=new M({context:e,source:t.image,pixelFormat:i.hasAlphaChannel?p.RGBA:p.RGB});t.texture=n,t.image=void 0,t.state=k.TEXTURE_LOADED},U.prototype._reprojectTexture=function(e,t){var i=t.texture,r=t.rectangle,n=e.context;if(!(this._imageryProvider.tilingScheme instanceof c)&&r.width/i.width>1e-5){var o=this,a=new E({persists:!0,owner:this,preExecute:function(e){H(e,n,i,t.rectangle)},postExecute:function(e){i.destroy(),t.texture=e,G(o,n,t,e)}});e.commandList.push(a)}else G(this,n,t,i)},U.prototype.getImageryFromCache=function(e,t,i,r){var n=W(e,t,i),o=this._imageryCache[n];return a(o)||(o=new V(this,e,t,i,r),this._imageryCache[n]=o),o.addReference(),o},U.prototype.removeImageryFromCache=function(e){var t=W(e.x,e.y,e.level);delete this._imageryCache[t]};var Z={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new t,texture:void 0},K=u.supportsTypedArrays()?new Float32Array(128):void 0;return U}),i("Scene/GlobeSurfaceTileProvider",["../Core/BoundingSphere","../Core/BoxOutlineGeometry","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/FeatureDetection","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/IndexDatatype","../Core/Intersect","../Core/Math","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/PrimitiveType","../Core/Rectangle","../Core/SphereOutlineGeometry","../Core/TerrainQuantization","../Core/Visibility","../Core/WebMercatorProjection","../Renderer/Buffer","../Renderer/BufferUsage","../Renderer/ContextLimits","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/VertexArray","../Scene/BlendingState","../Scene/DepthFunction","../Scene/Pass","../Scene/PerInstanceColorAppearance","../Scene/Primitive","../ThirdParty/when","./GlobeSurfaceTile","./ImageryLayer","./ImageryState","./QuadtreeTileLoadState","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W){"use strict";function H(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._pickRenderState=void 0,this._errorEvent=new d,this._imageryLayers.layerAdded.addEventListener(H.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(H.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(H.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(H.prototype._onLayerShownOrHidden,this),this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._pickCommands=[],this._usedDrawCommands=0,this._usedPickCommands=0,this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new o(0,0,.5,1)}function q(e,t){var i=e.loadingImagery;l(i)||(i=e.readyImagery);var r=t.loadingImagery;return l(r)||(r=t.readyImagery),i.imageryLayer._layerIndex-r.imageryLayer._layerIndex}function j(){var e={u_initialColor:function(){return this.initialColor},u_zoomedOutOceanSpecularIntensity:function(){return this.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.oceanNormalMap},u_lightingFadeDistance:function(){return this.lightingFadeDistance},u_center3D:function(){return this.center3D},u_tileRectangle:function(){return this.tileRectangle},u_modifiedModelView:function(){return this.modifiedModelView},u_dayTextures:function(){return this.dayTextures},u_dayTextureTranslationAndScale:function(){return this.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){ -return this.dayTextureTexCoordsRectangle},u_dayTextureAlpha:function(){return this.dayTextureAlpha},u_dayTextureBrightness:function(){return this.dayTextureBrightness},u_dayTextureContrast:function(){return this.dayTextureContrast},u_dayTextureHue:function(){return this.dayTextureHue},u_dayTextureSaturation:function(){return this.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.dayTextureOneOverGamma},u_dayIntensity:function(){return this.dayIntensity},u_southAndNorthLatitude:function(){return this.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.waterMask},u_waterMaskTranslationAndScale:function(){return this.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.minMaxHeight},u_scaleAndBias:function(){return this.scaleAndBias},initialColor:new n(0,0,.5,1),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new i(65e5,9e6),center3D:void 0,modifiedModelView:new y,tileRectangle:new n,dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayIntensity:0,southAndNorthLatitude:new i,southMercatorYAndOneOverHeight:new i,waterMask:void 0,waterMaskTranslationAndScale:new n,minMaxHeight:new i,scaleAndBias:new y};return e}function Y(e,t,i){var r=i.data;l(r.wireframeVertexArray)||l(r.terrainData)&&l(r.terrainData._mesh)&&(r.wireframeVertexArray=X(e,r.vertexArray,r.terrainData._mesh))}function X(e,t,i){var r={indices:i.indices,primitiveType:E.TRIANGLES};f.toWireframe(r);var n=r.indices,o=A.createIndexBuffer({context:e,typedArray:n,usage:P.STATIC_DRAW,indexDatatype:v.UNSIGNED_SHORT});return new R({context:e,attributes:t._attributes,indexBuffer:o})}function Z(t,i,a){var s=i.data,u=a.camera.viewMatrix,c=I.maximumTextureImageUnits,h=s.waterMaskTexture,d=t.hasWaterMask&&l(h),p=t.oceanNormalMap,m=d&&l(p),f=t.terrainProvider.ready&&t.terrainProvider.hasVertexNormals,v=a.fog.enabled;d&&--c,m&&--c;var g=s.center,w=s.pickTerrain.mesh.encoding,x=$,A=0,P=0,D=0,R=0,O=!1;if(a.mode!==W.SCENE3D){var N=a.mapProjection,F=N.project(S.southwest(i.rectangle),ie),B=N.project(S.northeast(i.rectangle),re);if(x.x=F.x,x.y=F.y,x.z=B.x,x.w=B.y,a.mode!==W.MORPHING&&(g=ee,g.x=0,g.y=.5*(x.z+x.x),g.z=.5*(x.w+x.y),x.x-=g.y,x.y-=g.z,x.z-=g.y,x.w-=g.z),a.mode===W.SCENE2D&&w.quantization===T.BITS12){var V=1/(Math.pow(2,12)-1)*.5,k=(x.z-x.x)*V,G=(x.w-x.y)*V;x.x-=k,x.y-=G,x.z+=k,x.w+=G}N instanceof b&&(A=i.rectangle.south,P=i.rectangle.north,D=b.geodeticLatitudeToMercatorAngle(A),R=1/(b.geodeticLatitudeToMercatorAngle(P)-D),O=!0)}var H=y.multiplyByPoint(u,g,te);y.setTranslation(u,H,J);var q=s.imagery,X=0,Z=q.length,K=t._renderState,Q=t._blendRenderState,le=K,ue=t._firstPassInitialColor,ce=a.context;l(t._debug.boundingSphereTile)||ae();do{var he,de,pe=0;t._drawCommands.length<=t._usedDrawCommands?(he=new M,he.owner=i,he.cull=!1,he.boundingVolume=new e,he.orientedBoundingBox=void 0,de=j(),t._drawCommands.push(he),t._uniformMaps.push(de)):(he=t._drawCommands[t._usedDrawCommands],de=t._uniformMaps[t._usedDrawCommands]),he.owner=i,++t._usedDrawCommands,i===t._debug.boundingSphereTile&&(l(s.orientedBoundingBox)?ne(s.orientedBoundingBox,o.RED).update(a):l(s.boundingSphere3D)&&oe(s.boundingSphere3D,o.RED).update(a)),n.clone(ue,de.initialColor),de.oceanNormalMap=p,de.lightingFadeDistance.x=t.lightingFadeOutDistance,de.lightingFadeDistance.y=t.lightingFadeInDistance,de.zoomedOutOceanSpecularIntensity=t.zoomedOutOceanSpecularIntensity,de.center3D=s.center,n.clone(x,de.tileRectangle),de.southAndNorthLatitude.x=A,de.southAndNorthLatitude.y=P,de.southMercatorYAndOneOverHeight.x=D,de.southMercatorYAndOneOverHeight.y=R,y.clone(J,de.modifiedModelView);for(var me=v&&_.fog(i._distance,a.fog.density)>_.EPSILON3,fe=!1,ve=!1,ge=!1,_e=!1,ye=!1,Ce=!1;c>pe&&Z>X;){var Ee=q[X],Se=Ee.readyImagery;if(++X,l(Se)&&Se.state===U.READY&&0!==Se.imageryLayer.alpha){var we=Se.imageryLayer;if(l(Ee.textureTranslationAndScale)||(Ee.textureTranslationAndScale=we._calculateTextureTranslationAndScale(i,Ee)),de.dayTextures[pe]=Se.texture,de.dayTextureTranslationAndScale[pe]=Ee.textureTranslationAndScale,de.dayTextureTexCoordsRectangle[pe]=Ee.textureCoordinateRectangle,de.dayTextureAlpha[pe]=we.alpha,Ce=Ce||1!==de.dayTextureAlpha[pe],de.dayTextureBrightness[pe]=we.brightness,fe=fe||de.dayTextureBrightness[pe]!==z.DEFAULT_BRIGHTNESS,de.dayTextureContrast[pe]=we.contrast,ve=ve||de.dayTextureContrast[pe]!==z.DEFAULT_CONTRAST,de.dayTextureHue[pe]=we.hue,ge=ge||de.dayTextureHue[pe]!==z.DEFAULT_HUE,de.dayTextureSaturation[pe]=we.saturation,_e=_e||de.dayTextureSaturation[pe]!==z.DEFAULT_SATURATION,de.dayTextureOneOverGamma[pe]=1/we.gamma,ye=ye||de.dayTextureOneOverGamma[pe]!==1/z.DEFAULT_GAMMA,l(Se.credits))for(var Te=a.creditDisplay,xe=Se.credits,be=0,Ae=xe.length;Ae>be;++be)Te.addCredit(xe[be]);++pe}}de.dayTextures.length=pe,de.waterMask=h,n.clone(s.waterMaskTranslationAndScale,de.waterMaskTranslationAndScale),de.minMaxHeight.x=w.minimumHeight,de.minMaxHeight.y=w.maximumHeight,y.clone(w.matrix,de.scaleAndBias),he.shaderProgram=t._surfaceShaderSet.getShaderProgram(a,s,pe,fe,ve,ge,_e,ye,Ce,d,m,t.enableLighting,f,O,me),he.renderState=le,he.primitiveType=E.TRIANGLES,he.vertexArray=s.vertexArray,he.uniformMap=de,he.pass=L.GLOBE,t._debug.wireframe&&(Y(ce,t,i),l(s.wireframeVertexArray)&&(he.vertexArray=s.wireframeVertexArray,he.primitiveType=E.LINES));var Pe=he.boundingVolume,Ie=he.orientedBoundingBox;a.mode!==W.SCENE3D?(e.fromRectangleWithHeights2D(i.rectangle,a.mapProjection,s.minimumHeight,s.maximumHeight,Pe),r.fromElements(Pe.center.z,Pe.center.x,Pe.center.y,Pe.center),a.mode===W.MORPHING&&(Pe=e.union(s.boundingSphere3D,Pe,Pe))):(he.boundingVolume=e.clone(s.boundingSphere3D,Pe),he.orientedBoundingBox=C.clone(s.orientedBoundingBox,Ie)),a.commandList.push(he),le=Q,ue=se}while(Z>X)}function K(e,t,i){var r;e._pickCommands.length<=e._usedPickCommands?(r=new M,r.cull=!1,e._pickCommands.push(r)):r=e._pickCommands[e._usedPickCommands],++e._usedPickCommands;var n=t.owner.data,o=i.projection instanceof b;r.shaderProgram=e._surfaceShaderSet.getPickShaderProgram(i,n,o),r.renderState=e._pickRenderState,r.owner=t.owner,r.primitiveType=t.primitiveType,r.vertexArray=t.vertexArray,r.uniformMap=t.uniformMap,r.boundingVolume=t.boundingVolume,r.orientedBoundingBox=r.orientedBoundingBox,r.pass=t.pass,i.commandList.push(r)}u(H.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=n.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles())}}}),H.prototype.beginUpdate=function(e){this._imageryLayers._update(),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(e){e.data.imagery.sort(q)}));var t,i,r=this._tilesToRenderByTextureCount;for(t=0,i=r.length;i>t;++t){var n=r[t];l(n)&&(n.length=0)}this._usedDrawCommands=0;var o=e.creditDisplay;this._terrainProvider.ready&&l(this._terrainProvider.credit)&&o.addCredit(this._terrainProvider.credit);var a=this._imageryLayers;for(t=0,i=a.length;i>t;++t){var s=a.get(t).imageryProvider;s.ready&&l(s.credit)&&o.addCredit(s.credit)}},H.prototype.endUpdate=function(e){l(this._renderState)||(this._renderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS}}),this._blendRenderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS_OR_EQUAL},blending:O.ALPHA_BLEND}));for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;r>i;++i){var n=t[i];if(l(n))for(var o=0,a=n.length;a>o;++o)Z(this,n[o],e)}},H.prototype.updateForPick=function(e){l(this._pickRenderState)||(this._pickRenderState=D.fromCache({colorMask:{red:!1,green:!1,blue:!1,alpha:!1},depthTest:{enabled:!0}})),this._usedPickCommands=0;for(var t=this._drawCommands,i=0,r=this._usedDrawCommands;r>i;++i)K(this,t[i],e)},H.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},H.prototype.loadTile=function(e,t){k.processStateMachine(t,e,this._terrainProvider,this._imageryLayers)};var Q=new e;H.prototype.computeTileVisibility=function(t,i,n){var o=this.computeDistanceToTile(t,i);if(t._distance=o,i.fog.enabled&&_.fog(o,i.fog.density)>=1)return x.NONE;var a=t.data,u=i.cullingVolume,c=s(a.orientedBoundingBox,a.boundingSphere3D);i.mode!==W.SCENE3D&&(c=Q,e.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,a.minimumHeight,a.maximumHeight,c),r.fromElements(c.center.z,c.center.x,c.center.y,c.center),i.mode===W.MORPHING&&(c=e.union(a.boundingSphere3D,c,c)));var h=u.computeVisibility(c);if(h===g.OUTSIDE)return x.NONE;if(i.mode===W.SCENE3D){var d=a.occludeePointInScaledSpace;return l(d)?n.ellipsoid.isScaledSpacePointVisible(d)?h:x.NONE:h}return h};var J=new y,$=new n,ee=new r,te=new r,ie=new r,re=new r;H.prototype.showTileThisFrame=function(e,t){for(var i=0,r=e.data.imagery,n=0,o=r.length;o>n;++n){var a=r[n];l(a.readyImagery)&&0!==a.readyImagery.imageryLayer.alpha&&++i}var s=this._tilesToRenderByTextureCount[i];l(s)||(s=[],this._tilesToRenderByTextureCount[i]=s),s.push(e);var u=this._debug;++u.tilesRendered,u.texturesRendered+=i},H.prototype.computeDistanceToTile=function(e,t){var i=e.data,r=i.tileBoundingBox;return r.distanceToCamera(t)},H.prototype.isDestroyed=function(){return!1},H.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),c(this)},H.prototype._onLayerAdded=function(e,t){if(e.show){var i=this._terrainProvider;this._quadtree.forEachLoadedTile(function(t){e._createTileImagerySkeletons(t,i)&&(t.state=G.LOADING)}),this._layerOrderChanged=!0}},H.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(t){for(var i=t.data.imagery,r=-1,n=0,o=0,a=i.length;a>o;++o){var s=i[o],u=s.loadingImagery;if(l(u)||(u=s.readyImagery),u.imageryLayer===e)-1===r&&(r=o),s.freeResources(),++n;else if(-1!==r)break}-1!==r&&i.splice(r,n)})},H.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0},H.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var ne,oe,ae;!function(){function e(e){return new B({geometryInstances:e,appearance:new F({translucent:!1,flat:!0}),asynchronous:!1})}var i,n,o=new m({geometry:t.fromDimensions({dimensions:new r(2,2,2)})}),s=new m({geometry:new w({radius:1})}),u=new y;ne=function(t,r){return t===i?n:(ae(),i=t,u=y.fromRotationTranslation(t.halfAxes,t.center,u),o.modelMatrix=u,o.attributes.color=a.fromColor(r),n=e(o))},oe=function(t,r){return t===i?n:(ae(),i=t,u=y.fromTranslation(t.center,u),u=y.multiplyByUniformScale(u,t.radius,u),s.modelMatrix=u,s.attributes.color=a.fromColor(r),n=e(s))},ae=function(){l(n)&&(n.destroy(),n=void 0,i=void 0)}}();var se=new n(0,0,0,0);return H}),i("Scene/ImageryLayerCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/Math","../Core/Rectangle","../ThirdParty/when","./ImageryLayer"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(){this._layers=[],this.layerAdded=new o,this.layerRemoved=new o,this.layerMoved=new o,this.layerShownOrHidden=new o}function h(e,t){var i=e.indexOf(t);return i}function d(e,t,i){var r=e._layers;if(t=a.clamp(t,0,r.length-1),i=a.clamp(i,0,r.length-1),t!==i){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}i(c.prototype,{length:{get:function(){return this._layers.length}}}),c.prototype.add=function(e,i){var r=t(i);r?this._layers.splice(i,0,e):(i=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,i)},c.prototype.addImageryProvider=function(e,t){var i=new u(e);return this.add(i,t),i},c.prototype.remove=function(t,i){i=e(i,!0);var r=this._layers.indexOf(t);return-1!==r?(this._layers.splice(r,1),this._update(),this.layerRemoved.raiseEvent(t,r),i&&t.destroy(),!0):!1},c.prototype.removeAll=function(t){t=e(t,!0);for(var i=this._layers,r=0,n=i.length;n>r;r++){var o=i[r];this.layerRemoved.raiseEvent(o,r),t&&o.destroy()}this._layers=[]},c.prototype.contains=function(e){return-1!==this.indexOf(e)},c.prototype.indexOf=function(e){return this._layers.indexOf(e)},c.prototype.get=function(e){return this._layers[e]},c.prototype.raise=function(e){var t=h(this._layers,e);d(this,t,t+1)},c.prototype.lower=function(e){var t=h(this._layers,e);d(this,t,t-1)},c.prototype.raiseToTop=function(e){var t=h(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},c.prototype.lowerToBottom=function(e){var t=h(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var p=new s;return c.prototype.pickImageryLayerFeatures=function(e,i){var r=i.globe.pick(e,i);if(t(r)){for(var n,o=i.globe.ellipsoid.cartesianToCartographic(r),u=i.globe._surface._tilesToRender,c=0;!t(n)&&c<u.length;++c){var h=u[c];s.contains(h.rectangle,o)&&(n=h)}if(t(n)){for(var d=n.data.imagery,m=[],f=[],v=d.length-1;v>=0;--v){var g=d[v],_=g.readyImagery;if(t(_)){var y=_.imageryLayer.imageryProvider;if(t(y.pickFeatures)&&s.contains(_.rectangle,o)){var C=p,E=1/1024;if(C.west=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.x-E),C.east=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.z+E),C.south=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.y-E),C.north=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.w+E),s.contains(C,o)){var S=y.pickFeatures(_.x,_.y,_.level,o.longitude,o.latitude);t(S)&&(m.push(S),f.push(_.imageryLayer))}}}}if(0!==m.length)return l.all(m,function(e){for(var i=[],r=0;r<e.length;++r){var n=e[r],a=f[r];if(t(n)&&n.length>0)for(var s=0;s<n.length;++s){var l=n[s];l.imageryLayer=a,t(l.position)||(l.position=o),i.push(l)}}return i})}}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this.removeAll(!0),r(this)},c.prototype._update=function(){for(var e,i,r=!0,n=this._layers,o=0,a=n.length;a>o;++o)i=n[o],i._layerIndex=o,i.show?(i._isBaseLayer=r,r=!1):i._isBaseLayer=!1,i.show!==i._show&&(t(i._show)&&(t(e)||(e=[]),e.push(i)),i._show=i.show);if(t(e))for(o=0,a=e.length;a>o;++o)i=e[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},c}),i("Scene/QuadtreeOccluders",["../Core/Cartesian3","../Core/defineProperties","../Core/EllipsoidalOccluder"],function(e,t,i){"use strict";function r(t){this._ellipsoid=new i(t.ellipsoid,e.ZERO)}return t(r.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),r}),i("Scene/QuadtreeTile",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Rectangle","./QuadtreeTileLoadState"],function(e,t,i,r,n){"use strict";function o(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._children=void 0,this._replacementPrevious=void 0,this._replacementNext=void 0,this._distance=0,this._customData=[],this._frameUpdated=void 0,this._frameRendered=void 0,this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}return o.createLevelZeroTiles=function(t){if(!e(t))throw new i("tilingScheme is required.");for(var r=t.getNumberOfXTilesAtLevel(0),n=t.getNumberOfYTilesAtLevel(0),a=new Array(r*n),s=0,l=0;n>l;++l)for(var u=0;r>u;++u)a[s++]=new o({tilingScheme:t,x:u,y:l,level:0});return a},o.prototype._updateCustomData=function(t,i,n){var o,a,s,l=this.customData;if(e(i)&&e(n)){for(o=0;o<n.length;++o){a=n[o];for(var u=0;u<l.length;++u)if(l[u]===a){l.splice(u,1);break}}for(s=this._rectangle,o=0;o<i.length;++o)a=i[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=t}else{var c=this._parent;if(e(c)&&this._frameUpdated!==c._frameUpdated){l.length=0,s=this._rectangle;var h=c.customData;for(o=0;o<h.length;++o)a=h[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=c._frameUpdated}}},t(o.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){if(!e(this._children)){var t=this.tilingScheme,i=this.level+1,r=2*this.x,n=2*this.y;this._children=[new o({tilingScheme:t,x:r,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r,y:n+1,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n+1,level:i,parent:this})]}return this._children}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<n.DONE}},eligibleForUnloading:{get:function(){var t=!0;return e(this.data)&&(t=this.data.eligibleForUnloading,e(t)||(t=!0)),t}}}),o.prototype.freeResources=function(){if(this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,e(this.data)&&e(this.data.freeResources)&&(this.data.freeResources(),this.data=void 0),e(this._children)){for(var t=0,i=this._children.length;i>t;++t)this._children[t].freeResources();this._children=void 0}},o}),i("Scene/TileReplacementQueue",["../Core/defined"],function(e){"use strict";function t(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function i(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}return t.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},t.prototype.trimTiles=function(t){for(var r=this.tail,n=!0;n&&e(this._lastBeforeStartOfFrame)&&this.count>t&&e(r);){n=r!==this._lastBeforeStartOfFrame;var o=r.replacementPrevious;r.eligibleForUnloading&&(r.freeResources(),i(this,r)),r=o}},t.prototype.markTileRendered=function(t){var r=this.head;return r===t?void(t===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=t.replacementNext)):(++this.count,e(r)?((e(t.replacementPrevious)||e(t.replacementNext))&&i(this,t),t.replacementPrevious=void 0,t.replacementNext=r,r.replacementPrevious=t,void(this.head=t)):(t.replacementPrevious=void 0,t.replacementNext=void 0,this.head=t,void(this.tail=t)))},t}),i("Scene/QuadtreePrimitive",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/Math","../Core/Queue","../Core/Ray","../Core/Rectangle","../Core/Visibility","./QuadtreeOccluders","./QuadtreeTile","./QuadtreeTileLoadState","./SceneMode","./TileReplacementQueue"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme,r=t.ellipsoid;this._tilesToRender=[],this._tileTraversalQueue=new u,this._tileLoadQueue=[],this._tileReplacementQueue=new g,this._levelZeroTiles=void 0,this._levelZeroTilesReady=!1,this._loadQueueTimeSlice=5,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this.maximumScreenSpaceError=i(e.maximumScreenSpaceError,2),this.tileCacheSize=i(e.tileCacheSize,100),this._occluders=new p({ellipsoid:r}),this._tileLoadProgressEvent=new a,this._lastTileLoadQueueLength=0}function y(e,t){var i=e._debug;if(!i.suspendLodUpdate){var n,o,a=e._tilesToRender;a.length=0;var s=e._tileTraversalQueue;if(s.clear(),i.maxDepth=0,i.tilesVisited=0,i.tilesCulled=0,i.tilesRendered=0,i.tilesWaitingForChildren=0,e._tileLoadQueue.length=0,e._tileReplacementQueue.markStartOfRenderFrame(),!r(e._levelZeroTiles)){if(!e._tileProvider.ready)return;var l=e._tileProvider.tilingScheme;e._levelZeroTiles=m.createLevelZeroTiles(l)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var u,c=e._tileProvider,h=e._occluders,p=e._levelZeroTiles,f=e._addHeightCallbacks,v=e._removeHeightCallbacks,g=t.frameNumber;if(f.length>0||v.length>0){for(n=0,o=p.length;o>n;++n)u=p[n],u._updateCustomData(g,f,v);f.length=0,v.length=0}for(n=0,o=p.length;o>n;++n)u=p[n],e._tileReplacementQueue.markTileRendered(u),u.needsLoading&&x(e,u),u.renderable&&c.computeTileVisibility(u,t,h)!==d.NONE?s.enqueue(u):(++i.tilesCulled,u.renderable||++i.tilesWaitingForChildren);for(;r(u=s.dequeue());)if(++i.tilesVisited,e._tileReplacementQueue.markTileRendered(u),u._updateCustomData(g),u.level>i.maxDepth&&(i.maxDepth=u.level),E(e,t,u)<e.maximumScreenSpaceError)w(e,u);else if(T(e,u)){var _=u.children;for(n=0,o=_.length;o>n;++n)c.computeTileVisibility(_[n],t,h)!==d.NONE?s.enqueue(_[n]):++i.tilesCulled}else w(e,u);C(e),i.enableDebugOutput&&(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren)&&(console.log("Visited "+i.tilesVisited+", Rendered: "+i.tilesRendered+", Culled: "+i.tilesCulled+", Max Depth: "+i.maxDepth+", Waiting for children: "+i.tilesWaitingForChildren),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren)}}function C(e){var t=e._tileLoadQueue.length;t!==e._lastTileLoadQueueLength&&(e._tileLoadProgressEvent.raiseEvent(t),e._lastTileLoadQueueLength=t)}function E(e,t,i){if(t.mode===v.SCENE2D)return S(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,o=t.context.drawingBufferHeight,a=t.camera.frustum.sseDenominator,s=r*o/(n*a);return t.fog.enabled&&(s-=l.fog(n,t.fog.density)*t.fog.sse),s}function S(e,t,i){var r=t.camera,n=r.frustum,o=t.context,a=o.drawingBufferWidth,s=o.drawingBufferHeight,l=e._tileProvider.getLevelMaximumGeometricError(i.level),u=Math.max(n.top-n.bottom,n.right-n.left)/Math.max(a,s);return l/u}function w(e,t){e._tilesToRender.push(t),++e._debug.tilesRendered}function T(e,t){for(var i=!0,r=!0,n=t.children,o=0,a=n.length;a>o;++o){var s=n[o];e._tileReplacementQueue.markTileRendered(s),r=r&&s.upsampledFromParent,i=i&&s.renderable,s.needsLoading&&x(e,s)}return i||++e._debug.tilesWaitingForChildren,i&&!r}function x(e,t){e._tileLoadQueue.push(t)}function b(e,t){var i=e._tileLoadQueue,r=e._tileProvider;if(0!==i.length){t.passes.pick||e._tileReplacementQueue.trimTiles(e.tileCacheSize);for(var n=s(),o=e._loadQueueTimeSlice,a=n+o,l=i.length-1;l>=0;--l){var u=i[l];if(e._tileReplacementQueue.markTileRendered(u),r.loadTile(t,u),s()>=a)break}}}function A(i,n){for(var o=i._tileToUpdateHeights,a=i._tileProvider.terrainProvider,l=s(),u=i._updateHeightsTimeSlice,c=l+u,d=n.mode,p=n.mapProjection,m=p.ellipsoid;o.length>0;){var f=o[o.length-1];f!==i._lastTileUpdated&&(i._lastTileIndex=0);for(var g=f.customData,_=g.length,y=!1,C=i._lastTileIndex;_>C;++C){var E=g[C];if(f.level>E.level){r(E.position)||(E.position=m.cartographicToCartesian(E.positionCartographic)),d===v.SCENE3D?(e.clone(e.ZERO,M.origin),e.normalize(E.position,M.direction)):(t.clone(E.positionCartographic,D),D.height=-11500,p.project(D,R),e.fromElements(R.z,R.x,R.y,R),e.clone(R,M.origin),e.clone(e.UNIT_X,M.direction));var S=f.data.pick(M,d,p,!1,R);r(S)&&E.callback(S),E.level=f.level}else if(f.level===E.level){for(var w,T=f.children,x=T.length,b=0;x>b&&(w=T[b],!h.contains(w.rectangle,E.positionCartographic));++b);var A=a.getTileDataAvailable(w.x,w.y,w.level);(r(A)&&!A||r(parent)&&r(parent.data)&&r(parent.data.terrainData)&&!parent.data.terrainData.isChildAvailable(parent.x,parent.y,w.x,w.y))&&E.removeFunc()}if(s()>=c){y=!0;break}}if(y){i._lastTileUpdated=f,i._lastTileIndex=C;break}o.pop()}}function P(e,t){return e._distance-t._distance}function I(e,t){var i=e._tileProvider,r=e._tilesToRender,n=e._tileToUpdateHeights;r.sort(P);for(var o=0,a=r.length;a>o;++o){var s=r[o];i.showTileThisFrame(s,t),s._frameRendered!==t.frameNumber-1&&n.push(s),s._frameRendered=t.frameNumber}A(e,t)}n(_.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}}}),_.prototype.invalidateAllTiles=function(){var e=this._tileReplacementQueue;e.head=void 0,e.tail=void 0,e.count=0;var t=this._levelZeroTiles;if(r(t))for(var i=0;i<t.length;++i){for(var n=t[i],o=n.customData,a=o.length,s=0;a>s;++s){var l=o[s];l.level=0,this._addHeightCallbacks.push(l)}t[i].freeResources()}this._levelZeroTiles=void 0},_.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;r(t);)t.state!==f.START&&e(t),t=t.replacementNext},_.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;r>i;++i)e(t[i])},_.prototype.updateHeight=function(e,t){var i=this,r={position:void 0,positionCartographic:e,level:-1,callback:t};return r.removeFunc=function(){i._removeHeightCallbacks.push(r)},i._addHeightCallbacks.push(r),r.removeFunc},_.prototype.update=function(e){var t=e.passes;t.render&&(this._tileProvider.beginUpdate(e),y(this,e),b(this,e),I(this,e),this._tileProvider.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&this._tileProvider.updateForPick(e)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var M=new c,D=new t,R=new e;return _}),i("Scene/Globe",["../Core/BoundingSphere","../Core/buildModuleUrl","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/EllipsoidTerrainProvider","../Core/GeographicProjection","../Core/IntersectionTests","../Core/loadImage","../Core/Ray","../Core/Rectangle","../Renderer/ShaderSource","../Renderer/Texture","../Shaders/GlobeFS","../Shaders/GlobeVS","../Shaders/GroundAtmosphere","../ThirdParty/when","./GlobeSurfaceShaderSet","./GlobeSurfaceTileProvider","./ImageryLayerCollection","./QuadtreePrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(e){e=n(e,u.WGS84);var i=new c({ellipsoid:e}),r=new T;this._ellipsoid=e,this._imageryLayerCollection=r,this._surfaceShaderSet=new S,this._surfaceShaderSet.baseVertexShaderSource=new v({sources:[C,y]}),this._surfaceShaderSet.baseFragmentShaderSource=new v({sources:[_]}),this._surface=new x({tileProvider:new w({terrainProvider:i,imageryLayers:r,surfaceShaderSet:this._surfaceShaderSet})}),this.terrainProvider=i,this.show=!0,this.oceanNormalMapUrl=t("Assets/Textures/waterNormalsSmall.jpg"),this._oceanNormalMapUrl=void 0,this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.enableLighting=!1,this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=.5}function P(t){return function(i,r){var n=e.distanceSquaredTo(i.pickBoundingSphere,t),o=e.distanceSquaredTo(r.pickBoundingSphere,t);return n-o}}a(A.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}}});var I=[],M={start:0,stop:0};A.prototype.pick=function(t,r,n){var a=r.mode,s=r.mapProjection,l=I;l.length=0;var u,c,h=this._surface._tilesToRender,p=h.length;for(c=0;p>c;++c){u=h[c];var m=u.data;if(o(m)){var f=m.pickBoundingSphere;a!==b.SCENE3D?(e.fromRectangleWithHeights2D(u.rectangle,s,m.minimumHeight,m.maximumHeight,f),i.fromElements(f.center.z,f.center.x,f.center.y,f.center)):e.clone(m.boundingSphere3D,f);var v=d.raySphere(t,f,M);o(v)&&l.push(m)}}l.sort(P(t.origin));var g;for(p=l.length,c=0;p>c&&(g=l[c].pick(t,r.mode,r.mapProjection,!0,n),!o(g));++c);return g};var D=new i,R=new i,O=new r,N=new m;return A.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(o(t)){var r,n,a=t.length;for(n=0;a>n&&(r=t[n],!f.contains(r.rectangle,e));++n);if(o(r)&&f.contains(r.rectangle,e)){for(;r.renderable;){var s=r.children;for(a=s.length,n=0;a>n&&(r=s[n],!f.contains(r.rectangle,e));++n);}for(;o(r)&&(!o(r.data)||!o(r.data.pickTerrain));)r=r.parent;if(o(r)){var l=this._surface._tileProvider.tilingScheme.ellipsoid,u=l.cartographicToCartesian(e,D),c=N;i.normalize(u,c.direction);var h=r.data.pick(c,void 0,void 0,!1,R);if(o(h))return l.cartesianToCartographic(h,O).height}}}},A.prototype.update=function(e){if(this.show){var t=e.context,i=t.drawingBufferWidth,r=t.drawingBufferHeight;if(0!==i&&0!==r){var n=this._surface,a=n.tileProvider,s=this.terrainProvider,l=this.showWaterEffect&&s.ready&&s.hasWaterMask;if(l&&this.oceanNormalMapUrl!==this._oceanNormalMapUrl){var u=this.oceanNormalMapUrl;if(this._oceanNormalMapUrl=u,o(u)){var c=this;E(p(u),function(e){u===c.oceanNormalMapUrl&&(c._oceanNormalMap=c._oceanNormalMap&&c._oceanNormalMap.destroy(),c._oceanNormalMap=new g({context:t,source:e}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}var h=e.mode,d=e.passes;d.render&&(h===b.SCENE3D?this._zoomedOutOceanSpecularIntensity=.5:this._zoomedOutOceanSpecularIntensity=0,n.maximumScreenSpaceError=this.maximumScreenSpaceError,n.tileCacheSize=this.tileCacheSize,a.terrainProvider=this.terrainProvider,a.lightingFadeOutDistance=this.lightingFadeOutDistance,a.lightingFadeInDistance=this.lightingFadeInDistance,a.zoomedOutOceanSpecularIntensity=this._zoomedOutOceanSpecularIntensity,a.hasWaterMask=l,a.oceanNormalMap=this._oceanNormalMap,a.enableLighting=this.enableLighting,n.update(e)),d.pick&&n.update(e)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),s(this)},A}),i("Shaders/PostProcessFilters/PassThrough",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Scene/GlobeDepth",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(){this._colorTexture=void 0,this._depthStencilTexture=void 0,this._globeDepthTexture=void 0,this.framebuffer=void 0,this._copyDepthFramebuffer=void 0,this._clearColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._viewport=new e,this._rs=void 0, -this._debugGlobeDepthViewportCommand=void 0}function p(e,t,r){if(!i(e._debugGlobeDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";e._debugGlobeDepthViewportCommand=t.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return e._globeDepthTexture}},owner:e})}e._debugGlobeDepthViewportCommand.execute(t,r)}function m(e){e._colorTexture=e._colorTexture&&!e._colorTexture.isDestroyed()&&e._colorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._globeDepthTexture=e._globeDepthTexture&&!e._globeDepthTexture.isDestroyed()&&e._globeDepthTexture.destroy()}function f(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy(),e._copyDepthFramebuffer=e._copyDepthFramebuffer&&!e._copyDepthFramebuffer.isDestroyed()&&e._copyDepthFramebuffer.destroy()}function v(e,t,i,r){e._colorTexture=new c({context:t,width:i,height:r,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE}),e._depthStencilTexture=new c({context:t,width:i,height:r,pixelFormat:o.DEPTH_STENCIL,pixelDatatype:l.UNSIGNED_INT_24_8}),e._globeDepthTexture=new c({context:t,width:i,height:r,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE})}function g(e,t,i,r){m(e),f(e),v(e,t,i,r),e.framebuffer=new s({context:t,colorTextures:[e._colorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._copyDepthFramebuffer=new s({context:t,colorTextures:[e._globeDepthTexture],destroyAttachments:!1})}function _(e,t,r,n){var o=e._colorTexture,a=!i(o)||o.width!==r||o.height!==n;(!i(e.framebuffer)||a)&&g(e,t,r,n)}function y(r,n,o,s){if(r._viewport.width=o,r._viewport.height=s,i(r._rs)&&e.equals(r._viewport,r._rs.viewport)||(r._rs=u.fromCache({viewport:r._viewport})),!i(r._copyDepthCommand)){var l="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";r._copyDepthCommand=n.createViewportQuadCommand(l,{uniformMap:{u_texture:function(){return r._depthStencilTexture}},owner:r})}r._copyDepthCommand.framebuffer=r._copyDepthFramebuffer,i(r._copyColorCommand)||(r._copyColorCommand=n.createViewportQuadCommand(h,{uniformMap:{u_texture:function(){return r._colorTexture}},owner:r})),r._copyDepthCommand.renderState=r._rs,r._copyColorCommand.renderState=r._rs,i(r._clearColorCommand)||(r._clearColorCommand=new a({color:new t(0,0,0,0),stencil:0,owner:r})),r._clearColorCommand.framebuffer=r.framebuffer}return d.prototype.executeDebugGlobeDepth=function(e,t){p(this,e,t)},d.prototype.update=function(e){var t=e.drawingBufferWidth,i=e.drawingBufferHeight;_(this,e,t,i),y(this,e,t,i),e.uniformState.globeDepthTexture=void 0},d.prototype.executeCopyDepth=function(e,t){i(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._globeDepthTexture)},d.prototype.executeCopyColor=function(e,t){i(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},d.prototype.clear=function(e,r,n){var o=this._clearColorCommand;i(o)&&(t.clone(n,o.color),o.execute(e,r))},d.prototype.isDestroyed=function(){return!1},d.prototype.destroy=function(){m(this),f(this),i(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),i(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy());var e=this._debugGlobeDepthViewportCommand;return i(e)&&(e.shaderProgram=e.shaderProgram.destroy()),n(this)},d}),i("Scene/GoogleEarthImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadText","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(r){function n(e){var t;try{t=JSON.parse(e)}catch(n){t=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(var o,s=0;s<t.layers.length;s++)if(t.layers[s].id===_._channel){o=t.layers[s];break}var d;if(!i(o))throw d="Could not find layer with channel (id) of "+_._channel+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);if(!i(o.version))throw d="Could not find a version in channel (id) "+_._channel+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);if(_._version=o.version,i(t.projection)&&"flat"===t.projection)_._tilingScheme=new a({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new l(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:r.ellipsoid});else{if(i(t.projection)&&"mercator"!==t.projection)throw d="Unsupported projection "+t.projection+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);_._tilingScheme=new h({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:r.ellipsoid})}_._imageUrlTemplate=_._imageUrlTemplate.replace("{request}",_._requestType).replace("{channel}",_._channel).replace("{version}",_._version),_._ready=!0,_._readyPromise.resolve(!0),c.handleSuccess(v)}function p(e){var t="An error occurred while accessing "+g+".";v=c.handleError(v,_,_._errorEvent,t,void 0,void 0,void 0,f),_._readyPromise.reject(new u(t))}function f(){var e=i(_._proxy)?_._proxy.getURL(g):g,t=s(e);d(t,n,p)}r=t(r,{}),this._url=r.url,this._path=t(r.path,"/default_map"),this._tileDiscardPolicy=r.tileDiscardPolicy,this._proxy=r.proxy,this._channel=r.channel,this._requestType="ImageryMaps",this._credit=new e("Google Imagery",m._logoData,"http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"),this.defaultGamma=1.9,this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=r.maximumLevel,this._imageUrlTemplate=this._url+this._path+"/query?request={request}&channel={channel}&version={version}&x={x}&y={y}&z={zoom}",this._errorEvent=new o,this._ready=!1,this._readyPromise=d.defer();var v,g=this._url+this._path+"/query?request=Json&vars=geeServerDefs&is2d=t",_=this;f()}function f(e,t,r,n){var o=e._imageUrlTemplate;o=o.replace("{x}",t),o=o.replace("{y}",r),o=o.replace("{zoom}",n+1);var a=e._proxy;return i(a)&&(o=a.getURL(o)),o}return r(m.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),m.prototype.getTileCredits=function(e,t,i){},m.prototype.requestImage=function(e,t,i){var r=f(this,e,t,i);return p.loadImage(this,r)},m.prototype.pickFeatures=function(){},m._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAnCAYAAACmP2LfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAHdElNRQfcDB4TJDr1mp5kAAAAGnRFWHRTb2Z0d2FyZQBQYWludC5ORVQgdjMuNS4xMDD0cqEAAB1zSURBVHhe7ZwHeFTFFsf/u+l9N70npOxuSAKEFFIhCSH0qhEQUHkgKCgWUFGBB6IoCAoo0ntooaRvEkIIBBBpoYSa3nvvfd+5u4sQUigPfMX8v2/Y3Tkzs3fv/d0z58zcgF69Ql1SY+MM1wQJem44ZeiJk8beEOqPwG6uC7ZqyElb9eo/JZEIkH2nRQkBIlNMauuPCS3uGN/kjkmNDghoskBAgzrZ2NLmf1+JwIKQpYsoxdmIV9+N07onCegzBPM9bOdmYKnazF6g/1N6UySPqSJzvCaaiLHtP8G/Phq+FRfgU5ogKWUXMLT6Mvzqr2BE40mMadqO8c3zMabBC6PqDDC8SlY60t9HByCLVTKu+ERmHr5TWI9wjVxEaOZivWo1pil8D1tZeWnLXv1l8iZ3PF2kjymiWRgvCoJv5U243IyAXcQq8A9Mg9W+4bDe6wv+kVGwCZkL+4Sf4ZR+BZ5VGQR3EkbWn8Hopm3wq54Lz2JD6ah/P21XGopQ9Qoc16jGSqVyTJWbQbUsibFXf42mihTwZpsvAtp3k0dOhFOSEH1+ngaDefrgjFCgFkxY8fCisCBvKgODzxRh9qslBFGfYmDGLbiV5mBwRRo8KtPhVBgPu8teMP7u73chD6kMRYRGBY5xqrFKqQwz5SdTbS/Qf5mmUYw8rf01CjHC4VP7AHZxO6E3qy9ZZCQNnio2rE/4o9/tkxiQUYp+KRXgx8XC5FsXcLz/hkCrDUU4pxLHuDVYpdwL9F+qqSJZKlPwenskfOoI5tN7YPCJGVme7wKYr5EBXzgYfW+mwTI0Gjrznaj2WW+I/y8dVPdDGLcKRzXrsEqlHO8oTKHaXqAZWe9hQXCi63NhHWYI3ilfWIW/YLjqL2JRiOFBJRz+LffhcPs09D+0J8vzn3zXdBnYnp8Mi6NboTWzH9X8fVc+DhDQodxqAroe36lU9AJNWr4cEAjNwI8OAC9cT1rbUfzwGeCfKiL7dGnNc+q1NiO80b4BY1oT4V6WDcsdc6j2xbyq4wMWrA9rQmeWFn36ey/jBaoPQ4hmLYI0G/AtAf22fC/QDols8ITrIYi/Bl6knbS2o3gRbxHQxQQ0k0S/gCa2v4OJovPwacqAQ1ICjL40klr+UrWoQbFBETo18jCpZsOoFODkvuCNJYoHW3QKXFEM7ETRcKfiQe8d6NVIFImXvg4skhY40mxnQYVRIIeA1qrHEc1GrFSpxFtP99AiFbDbNKDZpAzzGkVYVcvBuBJQEo/9/6C+dyjPitwLwak74D8V6Bfw0P5VShjXFoTR7TfhUZkL29M/wfATJan1lauWC3aDOgyaVDCuTgbf1bFkfmtkye1ogsK2asivLYfCglIoD8qCknI2NHuG4QSVGMgQyMbt0fioRYh9VYcRU7QX55uDcaHtFOJEsThMtmWtQgxsDodsWaC0c3ea3MzGBJEqxrfbYmzr6xjfPAeTmt5HQPO7eK1xDibUz8eY+k8xtHYJPCtXwvHOu7AXMrMTsF/TH8HajTis1YwVqpWY0TXQDKy1OpBr5EJA52Fukxx+bmKxtjWx2DuaWawNlZD5qhzyo9KhpHAbKpJO/6t65UCPbPHA2PYrGNacgkElabCJJDev/MpDhUKKnuq44LRoYEK1IiswkS1zYCfk5y+F0qjvoTwqBOof34dGeAnUL1ZCLboEnJ9zoe0QD/Nuj00UBVXRabzVLETM3S0ICfwA8yc7Y6C3ANYbZsA7aQ1W1xzEfZEQ6dT2BkG9pP4ouo7jGE1u42JS20QMrzkCr4xwuN4+AM+cYII3EaNar2J86zmMrP8DHulCON4NhU3YWuhOYy6SZENpH9cfx7WacFC7BSvUqjBDsRPQIiugURvazeqYVaqAw6dYrJ9WQy7gayj4nYDy3HtQOVQGpYRqKEWXQf2HdGha/AFdae9Xr4czz0ubISRA75ECbSut7agegO75OLxpahze8j5GtifBpzEDLiV30Dd2mNT6StWiCbVmLt5rUkBQCEt2zWzIMSA8HgrIBkLD+Sp0jhHISYXQ/KMYukfvQ3fQxq68XCTBHId/tMTg7LV1CFs4BszJ6hBarBgHlcRv8H7tbuSKQpFPYGe0BmND+nZ0npECaPKf0r4UIxsuoF/IMpitsAVnrA4s15uh3x8fwLXkLobUZGJIXTqcUzbDaJE5FAVq0t4S7dEcjqMEc6B2K5arVWN6Z6AbdOmm5mJelQKOHWSxF44Cy4CqxW0s6RwchCovFRohdGNfLgX3WiZ0N4aD++y7jfwYJUrAPCle/ZjKV+BFTSegrGAZIm3QjXhBytTWB3zhByzryMUU986jz16wD+96ijCNUIAgmkc3tS6G7GERjCbgR82B4OTbEESqIiCIcqsIYzoGGyrBEMSmgh8xBoIIAR2fAHZhj8Z9DOhl9FHeKkSDvn809fuc+iyCddRYaiOZBTvIt1YJfs0b4N+WDO+GHPLQN2Ab7S61vjJV60C9SRPvNSqzTpxlyQfS1dGUmjppK7gW16B/LhN6abnQu5cDwzO3YNhhqqK4WJY887sEdGzWFpxfOxmDpKZOOvgWFB8sx9L6nShvP4FyUQjKGg5gScpGKEqbUE7RxiGYv6QQ4zIG/r4D2m88sjEy/EIW/a6+TQ4gHe5VhXCvy4JL7gLYnesI2i6t4Tii04r92u1YKt767gB0ozrkGzmY26zEOh7Hkt+kAKhLTX9qOVVdg9aoNOjcToR+wUVKLYKgN0Zq7l7884wn9CKgr4AfWw/B6SwqKQRKOdXVghe9CpbherASSjtIpGpxRIHFjwygNreoXy0lb+lU7lHJBP9kPcGXQnBNghUB/Lh44fbUp5JA+5Hs71LbPPLCVRDEJZDNGIJgeQI6mG6KegKzldq1U7tGKjQmHR8vwl86kgRoAQN0xBw6ztn0nQ/ocxEdQ7L4d/BjG6g+m8aZTL/xsXPuW82Fb8t+DG1Ox5D6XAwqvQ67OA+p9ZWoUQPsei78mjSwNU9GLmEzVGZJTd3qFPTn3YZhXgYMMjNhlHsDxms/hNWfoUdrNPgEc2h7BG5d/Bo7Blt0BuNxXf4MVmXrkdRyEHWiY6hr2oc7mevRX2wc18gioEeI1+N9a+/CNnImVAZ0mhEoNOPAJT8MHjUF8KTiWhqHgbfMpVaJdhLQh3XasU9bJAZ6ekeg6zQwgEKuLSWysmd3QGmatLqD8qDNug3dCX/AIPk4jGr2wDB/JXTmkan70IvmZTY/rB9BdZlKLkG0lG0d5klAObKsw1+jzyFiWPnRawiaDrMYwTyMwMwh220WP2IWFVfqN4CKO8E3n0C6R/ZUej9Y2kUiMdDRFTRePH3nA3q/m7xpAEtAXl0QrkTwscnmS/3eptdzNEYevZLnZ5booqk8tuYs9tAny+n1LL1mghezlcULH0VtHamOZhvhIvoNOXQsd2EZIbluYnlWaMO75TCFG9kYXJ8H14o76H/10Z3yClSrCm6jGtbWK7LC7kIlYRfUmY2XHnUa+mbXYRSfCuNCptyE6b1jMBD/EPKwchQPLxGdxOWWI8iKXYBPqLozgI8pfA5YBWvxbfMeNLUfRmPTLjRnr8YKsdGvRQ5j2zZTSSRQ78H+7GhxfScFAINypsG9ukDspZ0LKKE+O0pqlGi71ggcIqD3dga6RhFKjSqYT+VEFkvu/E9Q+HNWKaE2VVDgVkPFqwAaay5CN3En9M59BM2vfKDs7AvljjPGE5LlharQdL+LoCmhOHU0rIUyD+NgVTOa+q2iVQiIcAKpHtbhXuJOjPqeVCRYThNE6VTvKNs3hM3cHGIxntxKyCbP7Erj1lHZJbVIJAG6iiCroZCAPGukvOyASJbvCgoaAoKoAQ1kHcGC7nmZDkmhBR2PfSQLtkcl4zCSAE2eO6qExYuYxrE4KqdvelBiM4+ncYQy1IY8d0wbhUSLJAZGbsUceNYdwJCGPAyuy4NbZToG3JoO1Qk9AvHvqF4ejo0KCKlisyl04Jw+AE1ma71HRUJP+QqM1t2HcVEyTEoSYVYQCuN3HenCt4XDhGA+KorAnYZ9KIj5ELOl3XpU/k/wrt+OmraDaG7cjpacbxFvYAAZDG5Vw/DWCxjRdp+ATsWAS6+D69H1+XDNsoVb1T06b0VwzCmBIOYdqUWibTojcFBH1CXQctBtUcA6Oh/RmVC4sBmKA5j6erC1qqE4sRpqG25A43QIOHuXgvOmP5R4ZH6m5UY2L9SSLjZ5sKjjsI/o8olH8ngjCZoSgmw9DMIl3t42Up0g+pq89/sEjLK47knZhSkSuDepJP4JOyNJyEFAR8VQKMOR1nbWM69yxNJYwh+VLE90ffPyxLE3EwL9Jq0huWQqwL1iA7zq8+FVl0+epgBO6T+gb2TH+OglqgastxtZrNNlkLt8E5oJx6HZdab7mFZBk3UZRjMewCT7HkzLfodZxREYr5sBjiIBPYiAPt8ehvSGPSg5vwjzpd16VNkmmDTswp22QDTXbkJrxhJkzHGDFoUQmvBpvo2hrZl0TnLhlLIYfUO7nt7dSg3hURcP1/JiDEgphuXBqVKLRFsfA3oJAf3mI6Cr2OjTwGYdqWGzzmZD6WoYVCfehdqsZKjuuwS1oB1Q+5piHac3oaxBzZ9vLZ4nHEeesoXg6niDPSYWP9yUgD5PHu48eKE64krHcErchHIEuRysTpAXjObQWIYEHiV4EQYEojp5aEoyY+IIpOQugKYYOnIdJXrdJ63PtWwXMQM6m6SVT4gfZkbHV0XHsVtaQ3K8yoJr0YfwoHDDq5ZiQSqDik/B4Q9taYtn18gyNia1qGJsmTrGlUjK2FJ1jCjRwOASDnkxDvN95ZD/og5yl0qgfCMJ2leDoeksHaFHXYOJVyrMkm/DrPwMzGr2wmjnLGipthyHL0W7t9pDkduwF2U3lmGFtvbTdyirt0OreT+iWwPRUrUBbSkLkT/fCUZwKVYikBMwpDlPXNzLwuAQ2rWX8KzUh2dDDJyLSmB7/S5Mf3WRWiR6CPSezkCXQs6qBnLCKsheyoXqnTCoL9oOFd9/Qtl9KJT6UJMX3/zhCz8iuCjhiviSYtMx3ZTJBN8lCE7eIRgF0p6krRRaRBDskTTGySBKws5SuUjJHYUiMQdpzCUE0Q3y5MnSDhJJQg5JUvjSgO5hHZofaioGmvc40IycMgbRtJktjgOZ5Ma9irzSg46xYHcaVEZevkgBHqUWGFK+FENKQ+BdGAq/wiMYWbwHI6h4FwTDOes0BMKFMHxPNg9qn1dANakYanfuQSs5FJoTpaP1qBswsSGgb9+EeUU0Af0LDH4dBhXlmv3wajuOpPYQFDcEojxtNQ6sn9ZzUsiofjfUWg/iYOt+tJatRtvN95DqZgxNuKTKwLV4Jdyqc8Wz1uCGTLjmDIVDQqewQ8anwpJi6GsYkF4Ey2O/QvsfXKlJIgboAwT07s5AZ0G1TylUIsuhdKMI6vcuQ3PVAqg+9UZ8JvGEywiuNoIwD4IzaV2X+HSa1otgE3+NwJImVkycG0kx8snfyUZJW+QFApeSu+hN9BpIn6n+ZBp9bqDv+C8Fum+8IpzzJNOmR3UhTaGFcC07iAHXmamuZw28C/S/aIt+CcthF7+ToN0EQdhqOFzcBu/Sm/ApvAGX3DzYXIiF9jtWTJf74L6ZC83UfGg8SId2xnloSZKxp+gWjC0J6KSrMK8KhmnlSugtInpkCzaBV78Hl5oPoaLpECrLt+Bi4jfgS7t1q+YDUGsPwj5KDFsLlqD97JuIpmpZmP+TftM1ezjlxsOllM4H3eReDWHwKrOBW84jqMeK5OBTv4Bu6HxxgqU1s/N3MkAHSoH+ioCe+gjoJHB0s8ENLID6/UJo3E+GVlwoNEwY278tXhR50RhmeexzgmM8JXjdF36MHwEoiXn70Csv6gxBm8PiRc6gJFD1HDzFpq1cP0omo5QJZAfqQzH0f6uHZjQgeR4cC/IJZCnUtSkYVPAWBiX2/CdU/S7Ql+9TgtFCTaiP0qAEXA2yRsqwuzECziWZcM4tgv2DSljF7ID+l+JNh9+hY38HuvcYmLOhk5EEnVPfQOmpW+33YGaXhj53E2BWuxvGebOh5cPUX/sWSgXrsa9mB2qaDqCK4C7I2IA3jn8u7tat2g6D034MIbWb0fZgHlr2DscXUhNNuYdkYRPrg/7JiXDMLYBrZS6GNEZgVJM/JjWY4I16G4xr/BCDq2nKjjoAvY+Zpwo7eXBskQK9Swr0lEdAn4a2wk3o/DMNWmn54KYUQIuZsebGQuXFQ42H4kfNk4QckSOkNZ1lGkGAUoInOKkAm2jJsVtH+om9Nj9ytZxNcNdhljXByo+JJXj/i4G2u2xM02YInPJLxFB7VudTPH0ZHkWu0hbPpwHpfnAszoFDVgVsb1fDMmoL9L8S7wTFQE/1AvR33oB+QSp0czKgl34B2iO9uwJCKib5SGaZjbqLPlkhMG1YDr1gQyioSs24vQTDitagsnIL6loCUVu9C2EJK9FjYtsWBNP2Q7hb9A155zdwY5mTeGexo0w32hEcy2F7JQaOqZfgk38KY6rDMKFBiGHNt+iGPgCNYd0/s/sbAb2fgN5JQC9Wq8bkR0AzioOOx3Xo30mGbnY+tNMKoJOQCm03qfnFxRf6E1yUFAqZJcyuZRWuQmB+TWHJcgJfkjPxImcSSIUsXviMx/O9DvqfALrPDjb6nhuBAWkZ5JFKKTYuIqhz4FUdAo9CGwzO7Ra2LjUg0w9OxdlwyKxAXzHQm8lDi4HeAT1WMPSHnYXR7aswKE6Gfl4K9PdfgZ6+uG8XSmMbKyXD/LsEmFduglH2NHA7rA3Hvg+Ve1/gYO4KNFRvQUPLQVRU7MG4yn1dJ4eiULAo3JhW9xsa77+Hml8GY8FQ425uAM5wRRivNoPlTjs4XhoH35oLGFZ/S/wglyDkbWmrrsUAvY+A3kHlSwJ6ihKzCvLnuQyElmIs9LdfhmHxA+jn5kI3jcrRFOjxU6DTbTx9DybsOBh0f034EeYEVyaFD0IYhnQ9y1pTIsiPvU5AnKYkUBL78yKmQhDLgDRPSWtPp/HFkFtHqFCfRBr73wX67qsD+qFsEubCnqKBAZllcCkkT12RjSHVMfApH0bJXfcH+aQGZg6FU1EWeeoK2NwgoMM3Q++zP/fq/Smf2g392ZEwzk2Acfl9GBHURmuSYPyn132oHBizH8B8wjX0SadQI2cWtOZZQbHTdEgRn8XN93EiczFayn5GU3Mg7lJMPab5SEeoCWZZ0TF4Ne/A/ZSPUbXdDz9Qdddrrk/KtcwR7jX34VXDzGCFGFT0GzyLu922x069kdiv145tOu34jlOHBWoz4arUAZQt0LYOhmFcHJ2H6zAsYnZDc2FwKhv60+m9UQrLUJ4hSYQAVhpM1O6jj30EDD33Q6frZyoY8cMVaWZZR560kuB5V9H6iVUas+Py5L1/IHsT2ZldR4nEkMdkUd8Y8tYd43mLIMhYhenDWvgjQSQiGFOkiEv0rEAzK2u8yG10M2WwBWFdb6q9NKDNd6rCOuYD9L2VI/57QMfcEniU5cCnJgG+lR9haAnz4MzT5ZjmA4e8HBqnGtYXamF+nK7bpx0uwHxoqGyE3sKD5HHjYVJ1C6Z5qTD5Ph2G1hnQEV/0LBhxU2E+4yYsbgTCJGsuNBfYQrnjA0CPxDo2CRYJ0xGesgD1ZWvQ3LQbKeSJ54uC0UcUDVVRGExFR/FB2y7cSf4C+Zv9sXSUeQ9P2z2pQdnmBHQsPKqKqFCyWJsM75o1GMw8O/iEhFZs/KK9CD9wRfhCTYTP1dqwnBOHrQYz8IuuH5ZxxI/MLQZH5kfoeu6D4cVQGNecgXHFbRgXZsD4Xg5MjqfDeE0KTBbRDLXsLiwOR8HkxCJoOs+Eavdr08ZBBGdYP7rYzAZILsH3LYUYtgSsAXlYRwLqW0r8Ksl2id4/Onaz47IE+kayUfwddYhsgwkqXRrLgOpHEuyhVF9B7ytoTAL//qNjeFagGfGEi5nvYPEifqOx/ek4p1J/8aKBWC8N6Icy2+oL6zOhECTmw46SuoHZpXBn/pK7/DK8K1bCp3Q0vAv7wqfIBD55OuS9teFVYASPfAFccseThw+E4Ho5LOMqYB6ZCeOdK6H1bleJH2sOOPZradqlC3otDqY5F2GafQmmCZdgFnMBZteEML2yCnprh0CZWVp66gbDuD5Q2uSLUacm43jSB0gq+h55JeuRX7wRqUUbkJL8DS4GTcPqCdZgduZ6XiZjgvcp9fIY3aAH/yY+3KvcMDBjLSXQBXDML4VbaQG8a9PgUxcOzyIneKY/Or6FHDO8q7INY+RiMFJaJijE4i2VeEylej/FDs99TAPH8Dvofv8bDK/vhVHxMRhX0W+vOgXTijiY5UXANGkNnYeRUGN2VrsPNx6XVaQNgRNM03sBgUjeOKJJ/Cr+LNzFsg61YB5/elyKtic0qM031CaZAG0gqJnVEuYBIoI49gy9D6DXrQR3GoU2j3YE+WE2FI9TGBG1FLywnhNbPt1Y/OhY+o5iGqsGNmdLaVxfqZUB+g0Iztwi2AOkNZ3FCzOm30bHeHK9tKYHKfPZMFhlAtM9c2EpjALv93zY3qlE/8xyOOUVUTiSBrfy83CvDIdbRZC4uJSGwzHzd0qgkmEVfRnGW/dC79vPobtkFLRmm0HDpVt43MnrzoOm/dfQeeOf0P3wB+guJogXrIDuhHfAsdOFbKdQ5GkaYQbNNYNht2c8/AOnYNKB6Ri//Q14zRwIuohdPC76pCbWKGFCkx9GNC7B0NZD8CiJh8Odi7A59zud7EuwvU4hVUYZBhUXwqsqA56V0RiUM1Dam36UoiyFuprQhc6fRZuKKhV5+rcLKD2hrPQ+NPsvgNb0j6C9eCG0v/kU2l9/BK0ZM8EdRJQ833noG8Qib6lDkA0lYD6i8GIJlffZ/IhhbJtQjW4TP164EiWWztTnH9T+a4L/MxpjAn02hWWYDAQnefSZzm7Io7zDOpiSzGh3grwPwd3zDccPZdH4phBEkXcWBrD4wlE07qObw5pmBUGsK43T/YPfgmAFWEe5U2EeCXhGcV5nQ3u2KrTf6w+jdTNhtud7mB/ZC4vg43QAwbAMDYLF0e3os+8HGP80D7oLx0F9dD+oj9AGZ4Y85K0Yj/Vs3kQiFgeybFPIySiDzdwAz9O3JzHjPNtYk8gjv948FOOatlGodR0Dk07Bau9n0F8wFBp+luBO1CXeuDD51Q3830PRP7UIzgUlcC0vhHPRSdic6eI53ecT3W0sKyjI2EFRxhzyz3sOO8voBkEUTclYhAyshCwr642PR79diwlbBOEs8vLMFjgbbuelhpeoz5rEDxsNNl/+9ON5RWJOLsXCysQdh5IhWWbzhUmoel6v/l/RxGpZTKgbh3EtEZQMp5AX2ASd2f3AVu7695ky/7nOuc2U/BZSCFIGp+I82F/rfprsVa/+Mk0sZ2F0tTvGNZ+gRO8B7C/HQ92beWine+/IDWDBbJUmbBN/hUNOGRyyStH34vfQeP3ZV4R61atXIu9Kefg1rIB/XRJciwso9nymLXmxbP+wxcCsVAxIKwfv1AZoDH96jN6rXr1SuVeowKsuFINrs+BSXATbc59JLU/XwCwdDMw7B/vUEpgHfQYZ7v9HCNar/2E55ynDpSwYrhXF4uKUeQiY0/Oy3kM555nCITcJgmvp0F30Yo8L9KpXL1X9E2XhkPoVBuYWwbmolKDOhmv+WHiXyGNkgbTRE1pOublXkRycCz+AfUoRzPdsgKJN1w/19KpXf7n6xlnCPikE/SkWdswrozDkNoZUfIWhFTYYWaPy4a6NkgSR2XAZXSOLIWUWcCv7FP1T7sH8wFZwp7ycxz971auXIm4AG+b77MFLEKLv7ULJMy0FefCsPAOv0t0YUrIMg0s+gVfxYrgVbIJLUSzsrl2F2ZZl4L7J/Pdp/956ca969UrEna0O41/HwSJ4F3in42Fz5Trsbt5Bv3u30e9uImyvnoV15GGY/LIA6kOZP1966pZ8r3r1n5eqhwZ0F/aB4ToHGK9zh/FPHjD60RE6H1tDaaA2cdy7mvFfI+BffksPNrEksu0AAAAASUVORK5CYII=",m}),i("Scene/GridImageryProvider",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","../Core/GeographicTilingScheme","../ThirdParty/when"],function(e,t,i,r,n,o,a){"use strict";function s(e){e=t(e,t.EMPTY_OBJECT),this._tilingScheme=i(e.tilingScheme)?e.tilingScheme:new o({ellipsoid:e.ellipsoid}),this._cells=t(e.cells,8),this._color=t(e.color,l),this._glowColor=t(e.glowColor,u),this._glowWidth=t(e.glowWidth,6),this._backgroundColor=t(e.backgroundColor,c),this._errorEvent=new n,this._tileWidth=t(e.tileWidth,256),this._tileHeight=t(e.tileHeight,256),this._canvasSize=t(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=a.resolve(!0)}var l=new e(1,1,1,.4),u=new e(0,1,0,.05),c=new e(0,.5,0,.2);return r(s.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),s.prototype._drawGrid=function(e){for(var t=0,i=this._canvasSize,r=0;r<=this._cells;++r){var n=r/this._cells,o=1+n*(i-1);e.moveTo(o,t),e.lineTo(o,i),e.moveTo(t,o),e.lineTo(i,o)}e.stroke()},s.prototype._createGridCanvas=function(){var e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;var t=0,i=this._canvasSize,r=e.getContext("2d"),n=this._backgroundColor.toCssColorString();r.fillStyle=n,r.fillRect(t,t,i,i);var o=this._glowColor.toCssColorString();r.strokeStyle=o,r.lineWidth=this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r),r.lineWidth=.5*this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r);var a=this._color.toCssColorString();return r.strokeStyle=a,r.lineWidth=2,r.strokeRect(t,t,i,i),r.lineWidth=1,this._drawGrid(r),e},s.prototype.getTileCredits=function(e,t,i){},s.prototype.requestImage=function(e,t,i){return this._canvas},s.prototype.pickFeatures=function(){},s}),i("Shaders/ShadowVolumeFS",[],function(){"use strict";return"#extension GL_EXT_frag_depth : enable\nvarying float v_WindowZ;\nvarying vec4 v_color;\nvoid writeDepthClampedToFarPlane()\n{\ngl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n}\nvoid main(void)\n{\ngl_FragColor = v_color;\nwriteDepthClampedToFarPlane();\n}\n"}),i("Shaders/ShadowVolumeVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nvarying float v_WindowZ;\nvarying vec4 v_color;\nvec4 depthClampFarPlane(vec4 vertexInClipCoordinates)\n{\nv_WindowZ = (0.5 * (vertexInClipCoordinates.z / vertexInClipCoordinates.w) + 0.5) * vertexInClipCoordinates.w;\nvertexInClipCoordinates.z = min(vertexInClipCoordinates.z, vertexInClipCoordinates.w);\nreturn vertexInClipCoordinates;\n}\nvoid main()\n{\nv_color = color;\nvec4 position = czm_computePosition();\ngl_Position = depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n}\n"}),i("Scene/StencilFunction",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={NEVER:t.NEVER,LESS:t.LESS,EQUAL:t.EQUAL,LESS_OR_EQUAL:t.LEQUAL,GREATER:t.GREATER,NOT_EQUAL:t.NOTEQUAL,GREATER_OR_EQUAL:t.GEQUAL,ALWAYS:t.ALWAYS};return e(i)}),i("Scene/StencilOperation",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={ZERO:t.ZERO,KEEP:t.KEEP,REPLACE:t.REPLACE,INCREMENT:t.INCR,DECREMENT:t.DECR,INVERT:t.INVERT,INCREMENT_WRAP:t.INCR_WRAP,DECREMENT_WRAP:t.DECR_WRAP};return e(i)}),i("Scene/GroundPrimitive",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartographic","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/deprecationWarning","../Core/destroyObject","../Core/DeveloperError","../Core/GeometryInstance","../Core/isArray","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/Rectangle","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Shaders/ShadowVolumeFS","../Shaders/ShadowVolumeVS","../ThirdParty/when","./BlendingState","./DepthFunction","./Pass","./PerInstanceColorAppearance","./Primitive","./SceneMode","./StencilFunction","./StencilOperation"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=n(e,n.EMPTY_OBJECT),o(e.geometryInstance)&&s("GroundPrimitive.geometryInstance","GroundPrimitive.geometryInstance is deprecated in version 1.18 and will be removed in version 1.20. Please use GroundPrimitive.geometryInstances."),this.geometryInstance=e.geometryInstance,this.geometryInstances=e.geometryInstances,this.show=n(e.show,!0),this.debugShowBoundingVolume=n(e.debugShowBoundingVolume,!1),this._sp=void 0,this._spPick=void 0,this._rsStencilPreloadPass=void 0,this._rsStencilDepthPass=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._uniformMap={},this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=w.defer(),this._primitive=void 0;var t,i=new A({flat:!0});o(this.geometryInstances)&&h(this.geometryInstances)&&this.geometryInstances.length>1&&(t=G),this._primitiveOptions={geometryInstances:void 0,appearance:i,vertexCacheOptimize:n(e.vertexCacheOptimize,!1),interleave:n(e.interleave,!1),releaseGeometryInstances:n(e.releaseGeometryInstances,!0),allowPicking:n(e.allowPicking,!0),asynchronous:n(e.asynchronous,!0),compressVertices:n(e.compressVertices,!0),_readOnlyInstanceAttributes:t,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_createPickOffsets:!0}}function O(e,t){var i=t.maximumRadius,r=i/Math.cos(.5*e)-i;return R._maxHeight+r}function N(e,t){return R._minHeight}function L(i,r,n){for(var o=n.attributes.position3DHigh.values,a=n.attributes.position3DLow.values,s=o.length,l=r.mapProjection.ellipsoid,u=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,p=Number.NEGATIVE_INFINITY,m=0;s>m;m+=3){var v=t.unpack(o,m,Y),g=t.unpack(a,m,X),_=t.add(v,g,Z),y=l.cartesianToCartographic(_,K),C=y.latitude,E=y.longitude;u=Math.min(u,C),c=Math.min(c,E),h=Math.max(h,C),p=Math.max(p,E)}var S=Q;if(S.north=h,S.south=u,S.east=p,S.west=c,S.width<d.PI){var w=f.fromRectangle(S,R._maxHeight,R._minOBBHeight,l);i._boundingVolumes.push(w)}else i._boundingVolumes.push(e.fromEncodedCartesianVertices(o,a));if(!r.scene3DOnly){var T=r.mapProjection,x=e.fromRectangleWithHeights2D(S,T,R._maxHeight,R._minOBBHeight);t.fromElements(x.center.z,x.center.x,x.center.y,x.center),i._boundingVolumes2D.push(x)}}function F(e,t,i,r){o(e._rsStencilPreloadPass)||(e._rsStencilPreloadPass=_.fromCache(W),e._rsStencilDepthPass=_.fromCache(H),e._rsColorPass=_.fromCache(q),e._rsPickPass=_.fromCache(j))}function B(e,t,i){if(!o(e._sp)){var r=t.context,n=S;n=P._modifyShaderPosition(e,n,t.scene3DOnly),n=P._appendShowToShader(e._primitive,n);var a=E,s=e._primitive._attributeLocations;if(e._sp=y.replaceCache({context:r,shaderProgram:e._sp,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:s}),e._primitive.allowPicking){var l=new C({sources:[a],pickColorQualifier:"varying"});e._spPick=y.replaceCache({context:r,shaderProgram:e._spPick,vertexShaderSource:C.createPickVertexShaderSource(n),fragmentShaderSource:l,attributeLocations:s})}else e._spPick=y.fromCache({context:r,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:s})}}function V(e,t){var i=e._primitive,r=3*i._va.length;t.length=r;for(var n=0,a=0;r>a;a+=3){var s=i._va[n++],l=t[a];o(l)||(l=t[a]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsStencilPreloadPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND,l=t[a+1],o(l)||(l=t[a+1]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsStencilDepthPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND,l=t[a+2],o(l)||(l=t[a+2]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsColorPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND}}function k(e,t){var i=e._primitive,r=i._pickOffsets,n=3*r.length;t.length=n;for(var a=0,s=0;n>s;s+=3){var l=r[a++],u=l.offset,c=l.count,h=i._va[l.index],d=t[s];o(d)||(d=t[s]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsStencilPreloadPass,d.shaderProgram=e._sp,d.uniformMap=e._uniformMap,d.pass=b.GROUND,d=t[s+1],o(d)||(d=t[s+1]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsStencilDepthPass,d.shaderProgram=e._sp,d.uniformMap=e._uniformMap,d.pass=b.GROUND,d=t[s+2],o(d)||(d=t[s+2]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsPickPass,d.shaderProgram=e._spPick,d.uniformMap=e._uniformMap,d.pass=b.GROUND}}function z(e,t,i,r,n,o,a){V(e,o),k(e,a)}function U(e,t,i,r,n,a,s,l){var u;t.mode===I.SCENE3D?u=e._boundingVolumes:t.mode!==I.SCENE3D&&o(e._boundingVolumes2D)&&(u=e._boundingVolumes2D);var c=t.commandList,h=t.passes;if(h.render)for(var d=i.length,p=0;d>p;++p)i[p].modelMatrix=n,i[p].boundingVolume=u[Math.floor(p/3)],i[p].cull=a,i[p].debugShowBoundingVolume=s,c.push(i[p]);if(h.pick){var m=e._primitive,f=m._pickOffsets,v=3*f.length;r.length=v;for(var g=0,_=0;v>_;_+=3){var y=f[g++],C=u[y.index];r[_].modelMatrix=n,r[_].boundingVolume=C,r[_].cull=a,r[_+1].modelMatrix=n,r[_+1].boundingVolume=C,r[_+1].cull=a,r[_+2].modelMatrix=n,r[_+2].boundingVolume=C,r[_+2].cull=a,c.push(r[_],r[_+1],r[_+2])}}}var G=["color"];a(R.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),R.isSupported=function(e){return e.context.fragmentDepth},R._maxHeight=void 0,R._minHeight=void 0,R._minOBBHeight=void 0,R._maxTerrainHeight=9e3,R._minTerrainHeight=-1e5,R._minOBBTerrainHeight=-11500;var W={colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:M.ALWAYS,frontOperation:{fail:D.KEEP,zFail:D.DECREMENT_WRAP,zPass:D.DECREMENT_WRAP},backFunction:M.ALWAYS,backOperation:{fail:D.KEEP,zFail:D.INCREMENT_WRAP,zPass:D.INCREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1},H={colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:M.ALWAYS,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.INCREMENT_WRAP},backFunction:M.ALWAYS,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!0,func:x.LESS_OR_EQUAL},depthMask:!1},q={stencilTest:{enabled:!0,frontFunction:M.NOT_EQUAL,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},backFunction:M.NOT_EQUAL,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1,blending:T.ALPHA_BLEND},j={stencilTest:{enabled:!0,frontFunction:M.NOT_EQUAL,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},backFunction:M.NOT_EQUAL,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1},Y=new t,X=new t,Z=new t,K=new i,Q=new v;return R.prototype.update=function(e){var t=e.context;if(t.fragmentDepth&&this.show&&(o(this._primitive)||o(this.geometryInstance)||o(this.geometryInstances))){if(!o(R._maxHeight)){var i=e.terrainExaggeration;R._maxHeight=R._maxTerrainHeight*i,R._minHeight=R._minTerrainHeight*i,R._minOBBHeight=R._minOBBTerrainHeight*i}if(!o(this._primitive)){var r,n,a,s=this._primitiveOptions;if(o(this.geometryInstance))r=this.geometryInstance,n=r.geometry,a=n.constructor,o(a)&&o(a.createShadowVolume)&&(r=new c({geometry:a.createShadowVolume(n,N,O),attributes:r.attributes,id:r.id,pickPrimitive:this})),s.geometryInstances=r;else{for(var l=h(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],u=l.length,d=new Array(u),p=0;u>p;++p)if(r=l[p],n=r.geometry,a=n.constructor,o(a)&&o(a.createShadowVolume)){var m=r.attributes;d[p]=new c({geometry:a.createShadowVolume(n,N,O),attributes:m,id:r.id,pickPrimitive:this})}s.geometryInstances=d}var f=this;s._createBoundingVolumeFunction=function(e,t){L(f,e,t)},s._createRenderStatesFunction=function(e,t,i,r){F(f,t)},s._createShaderProgramFunction=function(e,t,i){B(f,t)},s._createCommandsFunction=function(e,t,i,r,n,o,a){z(f,void 0,void 0,!0,!1,o,a)},s._updateAndQueueCommandsFunction=function(e,t,i,r,n,o,a,s){U(f,t,i,r,n,o,a,s)},this._primitive=new P(s),this._primitive.readyPromise.then(function(e){f._ready=!0,f.releaseGeometryInstances&&(f.geometryInstance=void 0,f.geometryInstances=void 0);var t=e._error;o(t)?f._readyPromise.reject(t):f._readyPromise.resolve(f)})}this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}},R.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(), +return this.dayTextureTexCoordsRectangle},u_dayTextureAlpha:function(){return this.dayTextureAlpha},u_dayTextureBrightness:function(){return this.dayTextureBrightness},u_dayTextureContrast:function(){return this.dayTextureContrast},u_dayTextureHue:function(){return this.dayTextureHue},u_dayTextureSaturation:function(){return this.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.dayTextureOneOverGamma},u_dayIntensity:function(){return this.dayIntensity},u_southAndNorthLatitude:function(){return this.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.waterMask},u_waterMaskTranslationAndScale:function(){return this.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.minMaxHeight},u_scaleAndBias:function(){return this.scaleAndBias},initialColor:new n(0,0,.5,1),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new i(65e5,9e6),center3D:void 0,modifiedModelView:new y,tileRectangle:new n,dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayIntensity:0,southAndNorthLatitude:new i,southMercatorYAndOneOverHeight:new i,waterMask:void 0,waterMaskTranslationAndScale:new n,minMaxHeight:new i,scaleAndBias:new y};return e}function Y(e,t,i){var r=i.data;l(r.wireframeVertexArray)||l(r.terrainData)&&l(r.terrainData._mesh)&&(r.wireframeVertexArray=X(e,r.vertexArray,r.terrainData._mesh))}function X(e,t,i){var r={indices:i.indices,primitiveType:E.TRIANGLES};f.toWireframe(r);var n=r.indices,o=A.createIndexBuffer({context:e,typedArray:n,usage:P.STATIC_DRAW,indexDatatype:v.UNSIGNED_SHORT});return new R({context:e,attributes:t._attributes,indexBuffer:o})}function Z(t,i,a){var s=i.data,u=a.camera.viewMatrix,c=I.maximumTextureImageUnits,h=s.waterMaskTexture,d=t.hasWaterMask&&l(h),p=t.oceanNormalMap,m=d&&l(p),f=t.terrainProvider.ready&&t.terrainProvider.hasVertexNormals,v=a.fog.enabled;d&&--c,m&&--c;var g=s.center,w=s.pickTerrain.mesh.encoding,x=$,A=0,P=0,D=0,R=0,O=!1;if(a.mode!==W.SCENE3D){var N=a.mapProjection,F=N.project(S.southwest(i.rectangle),ie),B=N.project(S.northeast(i.rectangle),re);if(x.x=F.x,x.y=F.y,x.z=B.x,x.w=B.y,a.mode!==W.MORPHING&&(g=ee,g.x=0,g.y=.5*(x.z+x.x),g.z=.5*(x.w+x.y),x.x-=g.y,x.y-=g.z,x.z-=g.y,x.w-=g.z),a.mode===W.SCENE2D&&w.quantization===T.BITS12){var V=1/(Math.pow(2,12)-1)*.5,k=(x.z-x.x)*V,G=(x.w-x.y)*V;x.x-=k,x.y-=G,x.z+=k,x.w+=G}N instanceof b&&(A=i.rectangle.south,P=i.rectangle.north,D=b.geodeticLatitudeToMercatorAngle(A),R=1/(b.geodeticLatitudeToMercatorAngle(P)-D),O=!0)}var H=y.multiplyByPoint(u,g,te);y.setTranslation(u,H,J);var q=s.imagery,X=0,Z=q.length,K=t._renderState,Q=t._blendRenderState,le=K,ue=t._firstPassInitialColor,ce=a.context;l(t._debug.boundingSphereTile)||ae();do{var he,de,pe=0;t._drawCommands.length<=t._usedDrawCommands?(he=new M,he.owner=i,he.cull=!1,he.boundingVolume=new e,he.orientedBoundingBox=void 0,de=j(),t._drawCommands.push(he),t._uniformMaps.push(de)):(he=t._drawCommands[t._usedDrawCommands],de=t._uniformMaps[t._usedDrawCommands]),he.owner=i,++t._usedDrawCommands,i===t._debug.boundingSphereTile&&(l(s.orientedBoundingBox)?ne(s.orientedBoundingBox,o.RED).update(a):l(s.boundingSphere3D)&&oe(s.boundingSphere3D,o.RED).update(a)),n.clone(ue,de.initialColor),de.oceanNormalMap=p,de.lightingFadeDistance.x=t.lightingFadeOutDistance,de.lightingFadeDistance.y=t.lightingFadeInDistance,de.zoomedOutOceanSpecularIntensity=t.zoomedOutOceanSpecularIntensity,de.center3D=s.center,n.clone(x,de.tileRectangle),de.southAndNorthLatitude.x=A,de.southAndNorthLatitude.y=P,de.southMercatorYAndOneOverHeight.x=D,de.southMercatorYAndOneOverHeight.y=R,y.clone(J,de.modifiedModelView);for(var me=v&&_.fog(i._distance,a.fog.density)>_.EPSILON3,fe=!1,ve=!1,ge=!1,_e=!1,ye=!1,Ce=!1;c>pe&&Z>X;){var Ee=q[X],Se=Ee.readyImagery;if(++X,l(Se)&&Se.state===U.READY&&0!==Se.imageryLayer.alpha){var we=Se.imageryLayer;if(l(Ee.textureTranslationAndScale)||(Ee.textureTranslationAndScale=we._calculateTextureTranslationAndScale(i,Ee)),de.dayTextures[pe]=Se.texture,de.dayTextureTranslationAndScale[pe]=Ee.textureTranslationAndScale,de.dayTextureTexCoordsRectangle[pe]=Ee.textureCoordinateRectangle,de.dayTextureAlpha[pe]=we.alpha,Ce=Ce||1!==de.dayTextureAlpha[pe],de.dayTextureBrightness[pe]=we.brightness,fe=fe||de.dayTextureBrightness[pe]!==z.DEFAULT_BRIGHTNESS,de.dayTextureContrast[pe]=we.contrast,ve=ve||de.dayTextureContrast[pe]!==z.DEFAULT_CONTRAST,de.dayTextureHue[pe]=we.hue,ge=ge||de.dayTextureHue[pe]!==z.DEFAULT_HUE,de.dayTextureSaturation[pe]=we.saturation,_e=_e||de.dayTextureSaturation[pe]!==z.DEFAULT_SATURATION,de.dayTextureOneOverGamma[pe]=1/we.gamma,ye=ye||de.dayTextureOneOverGamma[pe]!==1/z.DEFAULT_GAMMA,l(Se.credits))for(var Te=a.creditDisplay,xe=Se.credits,be=0,Ae=xe.length;Ae>be;++be)Te.addCredit(xe[be]);++pe}}de.dayTextures.length=pe,de.waterMask=h,n.clone(s.waterMaskTranslationAndScale,de.waterMaskTranslationAndScale),de.minMaxHeight.x=w.minimumHeight,de.minMaxHeight.y=w.maximumHeight,y.clone(w.matrix,de.scaleAndBias),he.shaderProgram=t._surfaceShaderSet.getShaderProgram(a,s,pe,fe,ve,ge,_e,ye,Ce,d,m,t.enableLighting,f,O,me),he.renderState=le,he.primitiveType=E.TRIANGLES,he.vertexArray=s.vertexArray,he.uniformMap=de,he.pass=L.GLOBE,t._debug.wireframe&&(Y(ce,t,i),l(s.wireframeVertexArray)&&(he.vertexArray=s.wireframeVertexArray,he.primitiveType=E.LINES));var Pe=he.boundingVolume,Ie=he.orientedBoundingBox;a.mode!==W.SCENE3D?(e.fromRectangleWithHeights2D(i.rectangle,a.mapProjection,s.minimumHeight,s.maximumHeight,Pe),r.fromElements(Pe.center.z,Pe.center.x,Pe.center.y,Pe.center),a.mode===W.MORPHING&&(Pe=e.union(s.boundingSphere3D,Pe,Pe))):(he.boundingVolume=e.clone(s.boundingSphere3D,Pe),he.orientedBoundingBox=C.clone(s.orientedBoundingBox,Ie)),a.commandList.push(he),le=Q,ue=se}while(Z>X)}function K(e,t,i){var r;e._pickCommands.length<=e._usedPickCommands?(r=new M,r.cull=!1,e._pickCommands.push(r)):r=e._pickCommands[e._usedPickCommands],++e._usedPickCommands;var n=t.owner.data,o=i.projection instanceof b;r.shaderProgram=e._surfaceShaderSet.getPickShaderProgram(i,n,o),r.renderState=e._pickRenderState,r.owner=t.owner,r.primitiveType=t.primitiveType,r.vertexArray=t.vertexArray,r.uniformMap=t.uniformMap,r.boundingVolume=t.boundingVolume,r.orientedBoundingBox=r.orientedBoundingBox,r.pass=t.pass,i.commandList.push(r)}u(H.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=n.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(0===this._imageryLayers.length||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles())}}}),H.prototype.beginUpdate=function(e){this._imageryLayers._update(),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(e){e.data.imagery.sort(q)}));var t,i,r=this._tilesToRenderByTextureCount;for(t=0,i=r.length;i>t;++t){var n=r[t];l(n)&&(n.length=0)}this._usedDrawCommands=0;var o=e.creditDisplay;this._terrainProvider.ready&&l(this._terrainProvider.credit)&&o.addCredit(this._terrainProvider.credit);var a=this._imageryLayers;for(t=0,i=a.length;i>t;++t){var s=a.get(t).imageryProvider;s.ready&&l(s.credit)&&o.addCredit(s.credit)}},H.prototype.endUpdate=function(e){l(this._renderState)||(this._renderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS}}),this._blendRenderState=D.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:N.LESS_OR_EQUAL},blending:O.ALPHA_BLEND}));for(var t=this._tilesToRenderByTextureCount,i=0,r=t.length;r>i;++i){var n=t[i];if(l(n))for(var o=0,a=n.length;a>o;++o)Z(this,n[o],e)}},H.prototype.updateForPick=function(e){l(this._pickRenderState)||(this._pickRenderState=D.fromCache({colorMask:{red:!1,green:!1,blue:!1,alpha:!1},depthTest:{enabled:!0}})),this._usedPickCommands=0;for(var t=this._drawCommands,i=0,r=this._usedDrawCommands;r>i;++i)K(this,t[i],e)},H.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)},H.prototype.loadTile=function(e,t){k.processStateMachine(t,e,this._terrainProvider,this._imageryLayers)};var Q=new e;H.prototype.computeTileVisibility=function(t,i,n){var o=this.computeDistanceToTile(t,i);if(t._distance=o,i.fog.enabled&&_.fog(o,i.fog.density)>=1)return x.NONE;var a=t.data,u=i.cullingVolume,c=s(a.orientedBoundingBox,a.boundingSphere3D);i.mode!==W.SCENE3D&&(c=Q,e.fromRectangleWithHeights2D(t.rectangle,i.mapProjection,a.minimumHeight,a.maximumHeight,c),r.fromElements(c.center.z,c.center.x,c.center.y,c.center),i.mode===W.MORPHING&&(c=e.union(a.boundingSphere3D,c,c)));var h=u.computeVisibility(c);if(h===g.OUTSIDE)return x.NONE;if(i.mode===W.SCENE3D){var d=a.occludeePointInScaledSpace;return l(d)?n.ellipsoid.isScaledSpacePointVisible(d)?h:x.NONE:h}return h};var J=new y,$=new n,ee=new r,te=new r,ie=new r,re=new r;H.prototype.showTileThisFrame=function(e,t){for(var i=0,r=e.data.imagery,n=0,o=r.length;o>n;++n){var a=r[n];l(a.readyImagery)&&0!==a.readyImagery.imageryLayer.alpha&&++i}var s=this._tilesToRenderByTextureCount[i];l(s)||(s=[],this._tilesToRenderByTextureCount[i]=s),s.push(e);var u=this._debug;++u.tilesRendered,u.texturesRendered+=i},H.prototype.computeDistanceToTile=function(e,t){var i=e.data,r=i.tileBoundingBox;return r.distanceToCamera(t)},H.prototype.isDestroyed=function(){return!1},H.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),c(this)},H.prototype._onLayerAdded=function(e,t){if(e.show){var i=this._terrainProvider;this._quadtree.forEachLoadedTile(function(t){e._createTileImagerySkeletons(t,i)&&(t.state=G.LOADING)}),this._layerOrderChanged=!0}},H.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(t){for(var i=t.data.imagery,r=-1,n=0,o=0,a=i.length;a>o;++o){var s=i[o],u=s.loadingImagery;if(l(u)||(u=s.readyImagery),u.imageryLayer===e)-1===r&&(r=o),s.freeResources(),++n;else if(-1!==r)break}-1!==r&&i.splice(r,n)})},H.prototype._onLayerMoved=function(e,t,i){this._layerOrderChanged=!0},H.prototype._onLayerShownOrHidden=function(e,t,i){i?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var ne,oe,ae;!function(){function e(e){return new B({geometryInstances:e,appearance:new F({translucent:!1,flat:!0}),asynchronous:!1})}var i,n,o=new m({geometry:t.fromDimensions({dimensions:new r(2,2,2)})}),s=new m({geometry:new w({radius:1})}),u=new y;ne=function(t,r){return t===i?n:(ae(),i=t,u=y.fromRotationTranslation(t.halfAxes,t.center,u),o.modelMatrix=u,o.attributes.color=a.fromColor(r),n=e(o))},oe=function(t,r){return t===i?n:(ae(),i=t,u=y.fromTranslation(t.center,u),u=y.multiplyByUniformScale(u,t.radius,u),s.modelMatrix=u,s.attributes.color=a.fromColor(r),n=e(s))},ae=function(){l(n)&&(n.destroy(),n=void 0,i=void 0)}}();var se=new n(0,0,0,0);return H}),i("Scene/ImageryLayerCollection",["../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Event","../Core/Math","../Core/Rectangle","../ThirdParty/when","./ImageryLayer"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(){this._layers=[],this.layerAdded=new o,this.layerRemoved=new o,this.layerMoved=new o,this.layerShownOrHidden=new o}function h(e,t){var i=e.indexOf(t);return i}function d(e,t,i){var r=e._layers;if(t=a.clamp(t,0,r.length-1),i=a.clamp(i,0,r.length-1),t!==i){var n=r[t];r[t]=r[i],r[i]=n,e._update(),e.layerMoved.raiseEvent(n,i,t)}}i(c.prototype,{length:{get:function(){return this._layers.length}}}),c.prototype.add=function(e,i){var r=t(i);r?this._layers.splice(i,0,e):(i=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,i)},c.prototype.addImageryProvider=function(e,t){var i=new u(e);return this.add(i,t),i},c.prototype.remove=function(t,i){i=e(i,!0);var r=this._layers.indexOf(t);return-1!==r?(this._layers.splice(r,1),this._update(),this.layerRemoved.raiseEvent(t,r),i&&t.destroy(),!0):!1},c.prototype.removeAll=function(t){t=e(t,!0);for(var i=this._layers,r=0,n=i.length;n>r;r++){var o=i[r];this.layerRemoved.raiseEvent(o,r),t&&o.destroy()}this._layers=[]},c.prototype.contains=function(e){return-1!==this.indexOf(e)},c.prototype.indexOf=function(e){return this._layers.indexOf(e)},c.prototype.get=function(e){return this._layers[e]},c.prototype.raise=function(e){var t=h(this._layers,e);d(this,t,t+1)},c.prototype.lower=function(e){var t=h(this._layers,e);d(this,t,t-1)},c.prototype.raiseToTop=function(e){var t=h(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))},c.prototype.lowerToBottom=function(e){var t=h(this._layers,e);0!==t&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var p=new s;return c.prototype.pickImageryLayerFeatures=function(e,i){var r=i.globe.pick(e,i);if(t(r)){for(var n,o=i.globe.ellipsoid.cartesianToCartographic(r),u=i.globe._surface._tilesToRender,c=0;!t(n)&&c<u.length;++c){var h=u[c];s.contains(h.rectangle,o)&&(n=h)}if(t(n)){for(var d=n.data.imagery,m=[],f=[],v=d.length-1;v>=0;--v){var g=d[v],_=g.readyImagery;if(t(_)){var y=_.imageryLayer.imageryProvider;if(t(y.pickFeatures)&&s.contains(_.rectangle,o)){var C=p,E=1/1024;if(C.west=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.x-E),C.east=a.lerp(n.rectangle.west,n.rectangle.east,g.textureCoordinateRectangle.z+E),C.south=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.y-E),C.north=a.lerp(n.rectangle.south,n.rectangle.north,g.textureCoordinateRectangle.w+E),s.contains(C,o)){var S=y.pickFeatures(_.x,_.y,_.level,o.longitude,o.latitude);t(S)&&(m.push(S),f.push(_.imageryLayer))}}}}if(0!==m.length)return l.all(m,function(e){for(var i=[],r=0;r<e.length;++r){var n=e[r],a=f[r];if(t(n)&&n.length>0)for(var s=0;s<n.length;++s){var l=n[s];l.imageryLayer=a,t(l.position)||(l.position=o),i.push(l)}}return i})}}},c.prototype.isDestroyed=function(){return!1},c.prototype.destroy=function(){return this.removeAll(!0),r(this)},c.prototype._update=function(){for(var e,i,r=!0,n=this._layers,o=0,a=n.length;a>o;++o)i=n[o],i._layerIndex=o,i.show?(i._isBaseLayer=r,r=!1):i._isBaseLayer=!1,i.show!==i._show&&(t(i._show)&&(t(e)||(e=[]),e.push(i)),i._show=i.show);if(t(e))for(o=0,a=e.length;a>o;++o)i=e[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)},c}),i("Scene/QuadtreeOccluders",["../Core/Cartesian3","../Core/defineProperties","../Core/EllipsoidalOccluder"],function(e,t,i){"use strict";function r(t){this._ellipsoid=new i(t.ellipsoid,e.ZERO)}return t(r.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}}),r}),i("Scene/QuadtreeTile",["../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Rectangle","./QuadtreeTileLoadState"],function(e,t,i,r,n){"use strict";function o(e){this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._children=void 0,this._replacementPrevious=void 0,this._replacementNext=void 0,this._distance=0,this._customData=[],this._frameUpdated=void 0,this._frameRendered=void 0,this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}return o.createLevelZeroTiles=function(t){if(!e(t))throw new i("tilingScheme is required.");for(var r=t.getNumberOfXTilesAtLevel(0),n=t.getNumberOfYTilesAtLevel(0),a=new Array(r*n),s=0,l=0;n>l;++l)for(var u=0;r>u;++u)a[s++]=new o({tilingScheme:t,x:u,y:l,level:0});return a},o.prototype._updateCustomData=function(t,i,n){var o,a,s,l=this.customData;if(e(i)&&e(n)){for(o=0;o<n.length;++o){a=n[o];for(var u=0;u<l.length;++u)if(l[u]===a){l.splice(u,1);break}}for(s=this._rectangle,o=0;o<i.length;++o)a=i[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=t}else{var c=this._parent;if(e(c)&&this._frameUpdated!==c._frameUpdated){l.length=0,s=this._rectangle;var h=c.customData;for(o=0;o<h.length;++o)a=h[o],r.contains(s,a.positionCartographic)&&l.push(a);this._frameUpdated=c._frameUpdated}}},t(o.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){if(!e(this._children)){var t=this.tilingScheme,i=this.level+1,r=2*this.x,n=2*this.y;this._children=[new o({tilingScheme:t,x:r,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n,level:i,parent:this}),new o({tilingScheme:t,x:r,y:n+1,level:i,parent:this}),new o({tilingScheme:t,x:r+1,y:n+1,level:i,parent:this})]}return this._children}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<n.DONE}},eligibleForUnloading:{get:function(){var t=!0;return e(this.data)&&(t=this.data.eligibleForUnloading,e(t)||(t=!0)),t}}}),o.prototype.freeResources=function(){if(this.state=n.START,this.renderable=!1,this.upsampledFromParent=!1,e(this.data)&&e(this.data.freeResources)&&(this.data.freeResources(),this.data=void 0),e(this._children)){for(var t=0,i=this._children.length;i>t;++t)this._children[t].freeResources();this._children=void 0}},o}),i("Scene/TileReplacementQueue",["../Core/defined"],function(e){"use strict";function t(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}function i(e,t){var i=t.replacementPrevious,r=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=r),t===e.head?e.head=r:i.replacementNext=r,t===e.tail?e.tail=i:r.replacementPrevious=i,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}return t.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head},t.prototype.trimTiles=function(t){for(var r=this.tail,n=!0;n&&e(this._lastBeforeStartOfFrame)&&this.count>t&&e(r);){n=r!==this._lastBeforeStartOfFrame;var o=r.replacementPrevious;r.eligibleForUnloading&&(r.freeResources(),i(this,r)),r=o}},t.prototype.markTileRendered=function(t){var r=this.head;return r===t?void(t===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=t.replacementNext)):(++this.count,e(r)?((e(t.replacementPrevious)||e(t.replacementNext))&&i(this,t),t.replacementPrevious=void 0,t.replacementNext=r,r.replacementPrevious=t,void(this.head=t)):(t.replacementPrevious=void 0,t.replacementNext=void 0,this.head=t,void(this.tail=t)))},t}),i("Scene/QuadtreePrimitive",["../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/getTimestamp","../Core/Math","../Core/Queue","../Core/Ray","../Core/Rectangle","../Core/Visibility","./QuadtreeOccluders","./QuadtreeTile","./QuadtreeTileLoadState","./SceneMode","./TileReplacementQueue"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g){"use strict";function _(e){this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};var t=this._tileProvider.tilingScheme,r=t.ellipsoid;this._tilesToRender=[],this._tileTraversalQueue=new u,this._tileLoadQueue=[],this._tileReplacementQueue=new g,this._levelZeroTiles=void 0,this._levelZeroTilesReady=!1,this._loadQueueTimeSlice=5,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this.maximumScreenSpaceError=i(e.maximumScreenSpaceError,2),this.tileCacheSize=i(e.tileCacheSize,100),this._occluders=new p({ellipsoid:r}),this._tileLoadProgressEvent=new a,this._lastTileLoadQueueLength=0}function y(e,t){var i=e._debug;if(!i.suspendLodUpdate){var n,o,a=e._tilesToRender;a.length=0;var s=e._tileTraversalQueue;if(s.clear(),i.maxDepth=0,i.tilesVisited=0,i.tilesCulled=0,i.tilesRendered=0,i.tilesWaitingForChildren=0,e._tileLoadQueue.length=0,e._tileReplacementQueue.markStartOfRenderFrame(),!r(e._levelZeroTiles)){if(!e._tileProvider.ready)return;var l=e._tileProvider.tilingScheme;e._levelZeroTiles=m.createLevelZeroTiles(l)}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;var u,c=e._tileProvider,h=e._occluders,p=e._levelZeroTiles,f=e._addHeightCallbacks,v=e._removeHeightCallbacks,g=t.frameNumber;if(f.length>0||v.length>0){for(n=0,o=p.length;o>n;++n)u=p[n],u._updateCustomData(g,f,v);f.length=0,v.length=0}for(n=0,o=p.length;o>n;++n)u=p[n],e._tileReplacementQueue.markTileRendered(u),u.needsLoading&&x(e,u),u.renderable&&c.computeTileVisibility(u,t,h)!==d.NONE?s.enqueue(u):(++i.tilesCulled,u.renderable||++i.tilesWaitingForChildren);for(;r(u=s.dequeue());)if(++i.tilesVisited,e._tileReplacementQueue.markTileRendered(u),u._updateCustomData(g),u.level>i.maxDepth&&(i.maxDepth=u.level),E(e,t,u)<e.maximumScreenSpaceError)w(e,u);else if(T(e,u)){var _=u.children;for(n=0,o=_.length;o>n;++n)c.computeTileVisibility(_[n],t,h)!==d.NONE?s.enqueue(_[n]):++i.tilesCulled}else w(e,u);C(e),i.enableDebugOutput&&(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren)&&(console.log("Visited "+i.tilesVisited+", Rendered: "+i.tilesRendered+", Culled: "+i.tilesCulled+", Max Depth: "+i.maxDepth+", Waiting for children: "+i.tilesWaitingForChildren),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren)}}function C(e){var t=e._tileLoadQueue.length;t!==e._lastTileLoadQueueLength&&(e._tileLoadProgressEvent.raiseEvent(t),e._lastTileLoadQueueLength=t)}function E(e,t,i){if(t.mode===v.SCENE2D)return S(e,t,i);var r=e._tileProvider.getLevelMaximumGeometricError(i.level),n=i._distance,o=t.context.drawingBufferHeight,a=t.camera.frustum.sseDenominator,s=r*o/(n*a);return t.fog.enabled&&(s-=l.fog(n,t.fog.density)*t.fog.sse),s}function S(e,t,i){var r=t.camera,n=r.frustum,o=t.context,a=o.drawingBufferWidth,s=o.drawingBufferHeight,l=e._tileProvider.getLevelMaximumGeometricError(i.level),u=Math.max(n.top-n.bottom,n.right-n.left)/Math.max(a,s);return l/u}function w(e,t){e._tilesToRender.push(t),++e._debug.tilesRendered}function T(e,t){for(var i=!0,r=!0,n=t.children,o=0,a=n.length;a>o;++o){var s=n[o];e._tileReplacementQueue.markTileRendered(s),r=r&&s.upsampledFromParent,i=i&&s.renderable,s.needsLoading&&x(e,s)}return i||++e._debug.tilesWaitingForChildren,i&&!r}function x(e,t){e._tileLoadQueue.push(t)}function b(e,t){var i=e._tileLoadQueue,r=e._tileProvider;if(0!==i.length){e._tileReplacementQueue.trimTiles(e.tileCacheSize);for(var n=s(),o=e._loadQueueTimeSlice,a=n+o,l=i.length-1;l>=0;--l){var u=i[l];if(e._tileReplacementQueue.markTileRendered(u),r.loadTile(t,u),s()>=a)break}}}function A(i,n){for(var o=i._tileToUpdateHeights,a=i._tileProvider.terrainProvider,l=s(),u=i._updateHeightsTimeSlice,c=l+u,d=n.mode,p=n.mapProjection,m=p.ellipsoid;o.length>0;){var f=o[o.length-1];f!==i._lastTileUpdated&&(i._lastTileIndex=0);for(var g=f.customData,_=g.length,y=!1,C=i._lastTileIndex;_>C;++C){var E=g[C];if(f.level>E.level){r(E.position)||(E.position=m.cartographicToCartesian(E.positionCartographic)),d===v.SCENE3D?(e.clone(e.ZERO,M.origin),e.normalize(E.position,M.direction)):(t.clone(E.positionCartographic,D),D.height=-11500,p.project(D,R),e.fromElements(R.z,R.x,R.y,R),e.clone(R,M.origin),e.clone(e.UNIT_X,M.direction));var S=f.data.pick(M,d,p,!1,R);r(S)&&E.callback(S),E.level=f.level}else if(f.level===E.level){for(var w,T=f.children,x=T.length,b=0;x>b&&(w=T[b],!h.contains(w.rectangle,E.positionCartographic));++b);var A=a.getTileDataAvailable(w.x,w.y,w.level);(r(A)&&!A||r(parent)&&r(parent.data)&&r(parent.data.terrainData)&&!parent.data.terrainData.isChildAvailable(parent.x,parent.y,w.x,w.y))&&E.removeFunc()}if(s()>=c){y=!0;break}}if(y){i._lastTileUpdated=f,i._lastTileIndex=C;break}o.pop()}}function P(e,t){return e._distance-t._distance}function I(e,t){var i=e._tileProvider,r=e._tilesToRender,n=e._tileToUpdateHeights;r.sort(P);for(var o=0,a=r.length;a>o;++o){var s=r[o];i.showTileThisFrame(s,t),s._frameRendered!==t.frameNumber-1&&n.push(s),s._frameRendered=t.frameNumber}A(e,t)}n(_.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}}}),_.prototype.invalidateAllTiles=function(){var e=this._tileReplacementQueue;e.head=void 0,e.tail=void 0,e.count=0;var t=this._levelZeroTiles;if(r(t))for(var i=0;i<t.length;++i){for(var n=t[i],o=n.customData,a=o.length,s=0;a>s;++s){var l=o[s];l.level=0,this._addHeightCallbacks.push(l)}t[i].freeResources()}this._levelZeroTiles=void 0},_.prototype.forEachLoadedTile=function(e){for(var t=this._tileReplacementQueue.head;r(t);)t.state!==f.START&&e(t),t=t.replacementNext},_.prototype.forEachRenderedTile=function(e){for(var t=this._tilesToRender,i=0,r=t.length;r>i;++i)e(t[i])},_.prototype.updateHeight=function(e,t){var i=this,r={position:void 0,positionCartographic:e,level:-1,callback:t};return r.removeFunc=function(){i._removeHeightCallbacks.push(r)},i._addHeightCallbacks.push(r),r.removeFunc},_.prototype.update=function(e){var t=e.passes;t.render&&(this._tileProvider.beginUpdate(e),y(this,e),b(this,e),I(this,e),this._tileProvider.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&this._tileProvider.updateForPick(e)},_.prototype.isDestroyed=function(){return!1},_.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var M=new c,D=new t,R=new e;return _}),i("Scene/Globe",["../Core/BoundingSphere","../Core/buildModuleUrl","../Core/Cartesian3","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/EllipsoidTerrainProvider","../Core/GeographicProjection","../Core/IntersectionTests","../Core/loadImage","../Core/Ray","../Core/Rectangle","../Renderer/ShaderSource","../Renderer/Texture","../Shaders/GlobeFS","../Shaders/GlobeVS","../Shaders/GroundAtmosphere","../ThirdParty/when","./GlobeSurfaceShaderSet","./GlobeSurfaceTileProvider","./ImageryLayerCollection","./QuadtreePrimitive","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b){"use strict";function A(e){e=n(e,u.WGS84);var i=new c({ellipsoid:e}),r=new T;this._ellipsoid=e,this._imageryLayerCollection=r,this._surfaceShaderSet=new S,this._surfaceShaderSet.baseVertexShaderSource=new v({sources:[C,y]}),this._surfaceShaderSet.baseFragmentShaderSource=new v({sources:[_]}),this._surface=new x({tileProvider:new w({terrainProvider:i,imageryLayers:r,surfaceShaderSet:this._surfaceShaderSet})}),this.terrainProvider=i,this.show=!0,this.oceanNormalMapUrl=t("Assets/Textures/waterNormalsSmall.jpg"),this._oceanNormalMapUrl=void 0,this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.enableLighting=!1,this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=.5}function P(t){return function(i,r){var n=e.distanceSquaredTo(i.pickBoundingSphere,t),o=e.distanceSquaredTo(r.pickBoundingSphere,t);return n-o}}a(A.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}}});var I=[],M={start:0,stop:0};A.prototype.pick=function(t,r,n){var a=r.mode,s=r.mapProjection,l=I;l.length=0;var u,c,h=this._surface._tilesToRender,p=h.length;for(c=0;p>c;++c){u=h[c];var m=u.data;if(o(m)){var f=m.pickBoundingSphere;a!==b.SCENE3D?(e.fromRectangleWithHeights2D(u.rectangle,s,m.minimumHeight,m.maximumHeight,f),i.fromElements(f.center.z,f.center.x,f.center.y,f.center)):e.clone(m.boundingSphere3D,f);var v=d.raySphere(t,f,M);o(v)&&l.push(m)}}l.sort(P(t.origin));var g;for(p=l.length,c=0;p>c&&(g=l[c].pick(t,r.mode,r.mapProjection,!0,n),!o(g));++c);return g};var D=new i,R=new i,O=new r,N=new m;return A.prototype.getHeight=function(e){var t=this._surface._levelZeroTiles;if(o(t)){var r,n,a=t.length;for(n=0;a>n&&(r=t[n],!f.contains(r.rectangle,e));++n);if(o(r)&&f.contains(r.rectangle,e)){for(;r.renderable;){var s=r.children;for(a=s.length,n=0;a>n&&(r=s[n],!f.contains(r.rectangle,e));++n);}for(;o(r)&&(!o(r.data)||!o(r.data.pickTerrain));)r=r.parent;if(o(r)){var l=this._surface._tileProvider.tilingScheme.ellipsoid,u=l.cartographicToCartesian(e,D),c=N;i.normalize(u,c.direction);var h=r.data.pick(c,void 0,void 0,!1,R);if(o(h))return l.cartesianToCartographic(h,O).height}}}},A.prototype.update=function(e){if(this.show){var t=e.context,i=t.drawingBufferWidth,r=t.drawingBufferHeight;if(0!==i&&0!==r){var n=this._surface,a=n.tileProvider,s=this.terrainProvider,l=this.showWaterEffect&&s.ready&&s.hasWaterMask;if(l&&this.oceanNormalMapUrl!==this._oceanNormalMapUrl){var u=this.oceanNormalMapUrl;if(this._oceanNormalMapUrl=u,o(u)){var c=this;E(p(u),function(e){u===c.oceanNormalMapUrl&&(c._oceanNormalMap=c._oceanNormalMap&&c._oceanNormalMap.destroy(),c._oceanNormalMap=new g({context:t,source:e}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}var h=e.mode,d=e.passes;d.render&&(h===b.SCENE3D?this._zoomedOutOceanSpecularIntensity=.5:this._zoomedOutOceanSpecularIntensity=0,n.maximumScreenSpaceError=this.maximumScreenSpaceError,n.tileCacheSize=this.tileCacheSize,a.terrainProvider=this.terrainProvider,a.lightingFadeOutDistance=this.lightingFadeOutDistance,a.lightingFadeInDistance=this.lightingFadeInDistance,a.zoomedOutOceanSpecularIntensity=this._zoomedOutOceanSpecularIntensity,a.hasWaterMask=l,a.oceanNormalMap=this._oceanNormalMap,a.enableLighting=this.enableLighting,n.update(e)),d.pick&&n.update(e)}}},A.prototype.isDestroyed=function(){return!1},A.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),s(this)},A}),i("Shaders/PostProcessFilters/PassThrough",[],function(){"use strict";return"uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\ngl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n"}),i("Scene/GlobeDepth",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l,u,c,h){"use strict";function d(){this._colorTexture=void 0,this._depthStencilTexture=void 0,this._globeDepthTexture=void 0,this.framebuffer=void 0,this._copyDepthFramebuffer=void 0,this._clearColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._viewport=new e,this._rs=void 0,this._debugGlobeDepthViewportCommand=void 0; +}function p(e,t,r){if(!i(e._debugGlobeDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";e._debugGlobeDepthViewportCommand=t.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return e._globeDepthTexture}},owner:e})}e._debugGlobeDepthViewportCommand.execute(t,r)}function m(e){e._colorTexture=e._colorTexture&&!e._colorTexture.isDestroyed()&&e._colorTexture.destroy(),e._depthStencilTexture=e._depthStencilTexture&&!e._depthStencilTexture.isDestroyed()&&e._depthStencilTexture.destroy(),e._globeDepthTexture=e._globeDepthTexture&&!e._globeDepthTexture.isDestroyed()&&e._globeDepthTexture.destroy()}function f(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy(),e._copyDepthFramebuffer=e._copyDepthFramebuffer&&!e._copyDepthFramebuffer.isDestroyed()&&e._copyDepthFramebuffer.destroy()}function v(e,t,i,r){e._colorTexture=new c({context:t,width:i,height:r,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE}),e._depthStencilTexture=new c({context:t,width:i,height:r,pixelFormat:o.DEPTH_STENCIL,pixelDatatype:l.UNSIGNED_INT_24_8}),e._globeDepthTexture=new c({context:t,width:i,height:r,pixelFormat:o.RGBA,pixelDatatype:l.UNSIGNED_BYTE})}function g(e,t,i,r){m(e),f(e),v(e,t,i,r),e.framebuffer=new s({context:t,colorTextures:[e._colorTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._copyDepthFramebuffer=new s({context:t,colorTextures:[e._globeDepthTexture],destroyAttachments:!1})}function _(e,t,r,n){var o=e._colorTexture,a=!i(o)||o.width!==r||o.height!==n;(!i(e.framebuffer)||a)&&g(e,t,r,n)}function y(r,n,o,s){if(r._viewport.width=o,r._viewport.height=s,i(r._rs)&&e.equals(r._viewport,r._rs.viewport)||(r._rs=u.fromCache({viewport:r._viewport})),!i(r._copyDepthCommand)){var l="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";r._copyDepthCommand=n.createViewportQuadCommand(l,{uniformMap:{u_texture:function(){return r._depthStencilTexture}},owner:r})}r._copyDepthCommand.framebuffer=r._copyDepthFramebuffer,i(r._copyColorCommand)||(r._copyColorCommand=n.createViewportQuadCommand(h,{uniformMap:{u_texture:function(){return r._colorTexture}},owner:r})),r._copyDepthCommand.renderState=r._rs,r._copyColorCommand.renderState=r._rs,i(r._clearColorCommand)||(r._clearColorCommand=new a({color:new t(0,0,0,0),stencil:0,owner:r})),r._clearColorCommand.framebuffer=r.framebuffer}return d.prototype.executeDebugGlobeDepth=function(e,t){p(this,e,t)},d.prototype.update=function(e){var t=e.drawingBufferWidth,i=e.drawingBufferHeight;_(this,e,t,i),y(this,e,t,i),e.uniformState.globeDepthTexture=void 0},d.prototype.executeCopyDepth=function(e,t){i(this._copyDepthCommand)&&(this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._globeDepthTexture)},d.prototype.executeCopyColor=function(e,t){i(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)},d.prototype.clear=function(e,r,n){var o=this._clearColorCommand;i(o)&&(t.clone(n,o.color),o.execute(e,r))},d.prototype.isDestroyed=function(){return!1},d.prototype.destroy=function(){m(this),f(this),i(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),i(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy());var e=this._debugGlobeDepthViewportCommand;return i(e)&&(e.shaderProgram=e.shaderProgram.destroy()),n(this)},d}),i("Scene/GoogleEarthImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Event","../Core/GeographicTilingScheme","../Core/loadText","../Core/Rectangle","../Core/RuntimeError","../Core/TileProviderError","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(r){function n(e){var t;try{t=JSON.parse(e)}catch(n){t=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}for(var o,s=0;s<t.layers.length;s++)if(t.layers[s].id===_._channel){o=t.layers[s];break}var d;if(!i(o))throw d="Could not find layer with channel (id) of "+_._channel+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);if(!i(o.version))throw d="Could not find a version in channel (id) "+_._channel+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);if(_._version=o.version,i(t.projection)&&"flat"===t.projection)_._tilingScheme=new a({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new l(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:r.ellipsoid});else{if(i(t.projection)&&"mercator"!==t.projection)throw d="Unsupported projection "+t.projection+".",v=c.handleError(v,_,_._errorEvent,d,void 0,void 0,void 0,f),new u(d);_._tilingScheme=new h({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:r.ellipsoid})}_._imageUrlTemplate=_._imageUrlTemplate.replace("{request}",_._requestType).replace("{channel}",_._channel).replace("{version}",_._version),_._ready=!0,_._readyPromise.resolve(!0),c.handleSuccess(v)}function p(e){var t="An error occurred while accessing "+g+".";v=c.handleError(v,_,_._errorEvent,t,void 0,void 0,void 0,f),_._readyPromise.reject(new u(t))}function f(){var e=i(_._proxy)?_._proxy.getURL(g):g,t=s(e);d(t,n,p)}r=t(r,{}),this._url=r.url,this._path=t(r.path,"/default_map"),this._tileDiscardPolicy=r.tileDiscardPolicy,this._proxy=r.proxy,this._channel=r.channel,this._requestType="ImageryMaps",this._credit=new e("Google Imagery",m._logoData,"http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"),this.defaultGamma=1.9,this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=r.maximumLevel,this._imageUrlTemplate=this._url+this._path+"/query?request={request}&channel={channel}&version={version}&x={x}&y={y}&z={zoom}",this._errorEvent=new o,this._ready=!1,this._readyPromise=d.defer();var v,g=this._url+this._path+"/query?request=Json&vars=geeServerDefs&is2d=t",_=this;f()}function f(e,t,r,n){var o=e._imageUrlTemplate;o=o.replace("{x}",t),o=o.replace("{y}",r),o=o.replace("{zoom}",n+1);var a=e._proxy;return i(a)&&(o=a.getURL(o)),o}return r(m.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),m.prototype.getTileCredits=function(e,t,i){},m.prototype.requestImage=function(e,t,i){var r=f(this,e,t,i);return p.loadImage(this,r)},m.prototype.pickFeatures=function(){},m._logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAnCAYAAACmP2LfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAHdElNRQfcDB4TJDr1mp5kAAAAGnRFWHRTb2Z0d2FyZQBQYWludC5ORVQgdjMuNS4xMDD0cqEAAB1zSURBVHhe7ZwHeFTFFsf/u+l9N70npOxuSAKEFFIhCSH0qhEQUHkgKCgWUFGBB6IoCAoo0ntooaRvEkIIBBBpoYSa3nvvfd+5u4sQUigPfMX8v2/Y3Tkzs3fv/d0z58zcgF69Ql1SY+MM1wQJem44ZeiJk8beEOqPwG6uC7ZqyElb9eo/JZEIkH2nRQkBIlNMauuPCS3uGN/kjkmNDghoskBAgzrZ2NLmf1+JwIKQpYsoxdmIV9+N07onCegzBPM9bOdmYKnazF6g/1N6UySPqSJzvCaaiLHtP8G/Phq+FRfgU5ogKWUXMLT6Mvzqr2BE40mMadqO8c3zMabBC6PqDDC8SlY60t9HByCLVTKu+ERmHr5TWI9wjVxEaOZivWo1pil8D1tZeWnLXv1l8iZ3PF2kjymiWRgvCoJv5U243IyAXcQq8A9Mg9W+4bDe6wv+kVGwCZkL+4Sf4ZR+BZ5VGQR3EkbWn8Hopm3wq54Lz2JD6ah/P21XGopQ9Qoc16jGSqVyTJWbQbUsibFXf42mihTwZpsvAtp3k0dOhFOSEH1+ngaDefrgjFCgFkxY8fCisCBvKgODzxRh9qslBFGfYmDGLbiV5mBwRRo8KtPhVBgPu8teMP7u73chD6kMRYRGBY5xqrFKqQwz5SdTbS/Qf5mmUYw8rf01CjHC4VP7AHZxO6E3qy9ZZCQNnio2rE/4o9/tkxiQUYp+KRXgx8XC5FsXcLz/hkCrDUU4pxLHuDVYpdwL9F+qqSJZKlPwenskfOoI5tN7YPCJGVme7wKYr5EBXzgYfW+mwTI0Gjrznaj2WW+I/y8dVPdDGLcKRzXrsEqlHO8oTKHaXqAZWe9hQXCi63NhHWYI3ilfWIW/YLjqL2JRiOFBJRz+LffhcPs09D+0J8vzn3zXdBnYnp8Mi6NboTWzH9X8fVc+DhDQodxqAroe36lU9AJNWr4cEAjNwI8OAC9cT1rbUfzwGeCfKiL7dGnNc+q1NiO80b4BY1oT4V6WDcsdc6j2xbyq4wMWrA9rQmeWFn36ey/jBaoPQ4hmLYI0G/AtAf22fC/QDols8ITrIYi/Bl6knbS2o3gRbxHQxQQ0k0S/gCa2v4OJovPwacqAQ1ICjL40klr+UrWoQbFBETo18jCpZsOoFODkvuCNJYoHW3QKXFEM7ETRcKfiQe8d6NVIFImXvg4skhY40mxnQYVRIIeA1qrHEc1GrFSpxFtP99AiFbDbNKDZpAzzGkVYVcvBuBJQEo/9/6C+dyjPitwLwak74D8V6Bfw0P5VShjXFoTR7TfhUZkL29M/wfATJan1lauWC3aDOgyaVDCuTgbf1bFkfmtkye1ogsK2asivLYfCglIoD8qCknI2NHuG4QSVGMgQyMbt0fioRYh9VYcRU7QX55uDcaHtFOJEsThMtmWtQgxsDodsWaC0c3ea3MzGBJEqxrfbYmzr6xjfPAeTmt5HQPO7eK1xDibUz8eY+k8xtHYJPCtXwvHOu7AXMrMTsF/TH8HajTis1YwVqpWY0TXQDKy1OpBr5EJA52Fukxx+bmKxtjWx2DuaWawNlZD5qhzyo9KhpHAbKpJO/6t65UCPbPHA2PYrGNacgkElabCJJDev/MpDhUKKnuq44LRoYEK1IiswkS1zYCfk5y+F0qjvoTwqBOof34dGeAnUL1ZCLboEnJ9zoe0QD/Nuj00UBVXRabzVLETM3S0ICfwA8yc7Y6C3ANYbZsA7aQ1W1xzEfZEQ6dT2BkG9pP4ouo7jGE1u42JS20QMrzkCr4xwuN4+AM+cYII3EaNar2J86zmMrP8DHulCON4NhU3YWuhOYy6SZENpH9cfx7WacFC7BSvUqjBDsRPQIiugURvazeqYVaqAw6dYrJ9WQy7gayj4nYDy3HtQOVQGpYRqKEWXQf2HdGha/AFdae9Xr4czz0ubISRA75ECbSut7agegO75OLxpahze8j5GtifBpzEDLiV30Dd2mNT6StWiCbVmLt5rUkBQCEt2zWzIMSA8HgrIBkLD+Sp0jhHISYXQ/KMYukfvQ3fQxq68XCTBHId/tMTg7LV1CFs4BszJ6hBarBgHlcRv8H7tbuSKQpFPYGe0BmND+nZ0npECaPKf0r4UIxsuoF/IMpitsAVnrA4s15uh3x8fwLXkLobUZGJIXTqcUzbDaJE5FAVq0t4S7dEcjqMEc6B2K5arVWN6Z6AbdOmm5mJelQKOHWSxF44Cy4CqxW0s6RwchCovFRohdGNfLgX3WiZ0N4aD++y7jfwYJUrAPCle/ZjKV+BFTSegrGAZIm3QjXhBytTWB3zhByzryMUU986jz16wD+96ijCNUIAgmkc3tS6G7GERjCbgR82B4OTbEESqIiCIcqsIYzoGGyrBEMSmgh8xBoIIAR2fAHZhj8Z9DOhl9FHeKkSDvn809fuc+iyCddRYaiOZBTvIt1YJfs0b4N+WDO+GHPLQN2Ab7S61vjJV60C9SRPvNSqzTpxlyQfS1dGUmjppK7gW16B/LhN6abnQu5cDwzO3YNhhqqK4WJY887sEdGzWFpxfOxmDpKZOOvgWFB8sx9L6nShvP4FyUQjKGg5gScpGKEqbUE7RxiGYv6QQ4zIG/r4D2m88sjEy/EIW/a6+TQ4gHe5VhXCvy4JL7gLYnesI2i6t4Tii04r92u1YKt767gB0ozrkGzmY26zEOh7Hkt+kAKhLTX9qOVVdg9aoNOjcToR+wUVKLYKgN0Zq7l7884wn9CKgr4AfWw/B6SwqKQRKOdXVghe9CpbherASSjtIpGpxRIHFjwygNreoXy0lb+lU7lHJBP9kPcGXQnBNghUB/Lh44fbUp5JA+5Hs71LbPPLCVRDEJZDNGIJgeQI6mG6KegKzldq1U7tGKjQmHR8vwl86kgRoAQN0xBw6ztn0nQ/ocxEdQ7L4d/BjG6g+m8aZTL/xsXPuW82Fb8t+DG1Ox5D6XAwqvQ67OA+p9ZWoUQPsei78mjSwNU9GLmEzVGZJTd3qFPTn3YZhXgYMMjNhlHsDxms/hNWfoUdrNPgEc2h7BG5d/Bo7Blt0BuNxXf4MVmXrkdRyEHWiY6hr2oc7mevRX2wc18gioEeI1+N9a+/CNnImVAZ0mhEoNOPAJT8MHjUF8KTiWhqHgbfMpVaJdhLQh3XasU9bJAZ6ekeg6zQwgEKuLSWysmd3QGmatLqD8qDNug3dCX/AIPk4jGr2wDB/JXTmkan70IvmZTY/rB9BdZlKLkG0lG0d5klAObKsw1+jzyFiWPnRawiaDrMYwTyMwMwh220WP2IWFVfqN4CKO8E3n0C6R/ZUej9Y2kUiMdDRFTRePH3nA3q/m7xpAEtAXl0QrkTwscnmS/3eptdzNEYevZLnZ5booqk8tuYs9tAny+n1LL1mghezlcULH0VtHamOZhvhIvoNOXQsd2EZIbluYnlWaMO75TCFG9kYXJ8H14o76H/10Z3yClSrCm6jGtbWK7LC7kIlYRfUmY2XHnUa+mbXYRSfCuNCptyE6b1jMBD/EPKwchQPLxGdxOWWI8iKXYBPqLozgI8pfA5YBWvxbfMeNLUfRmPTLjRnr8YKsdGvRQ5j2zZTSSRQ78H+7GhxfScFAINypsG9ukDspZ0LKKE+O0pqlGi71ggcIqD3dga6RhFKjSqYT+VEFkvu/E9Q+HNWKaE2VVDgVkPFqwAaay5CN3En9M59BM2vfKDs7AvljjPGE5LlharQdL+LoCmhOHU0rIUyD+NgVTOa+q2iVQiIcAKpHtbhXuJOjPqeVCRYThNE6VTvKNs3hM3cHGIxntxKyCbP7Erj1lHZJbVIJAG6iiCroZCAPGukvOyASJbvCgoaAoKoAQ1kHcGC7nmZDkmhBR2PfSQLtkcl4zCSAE2eO6qExYuYxrE4KqdvelBiM4+ncYQy1IY8d0wbhUSLJAZGbsUceNYdwJCGPAyuy4NbZToG3JoO1Qk9AvHvqF4ejo0KCKlisyl04Jw+AE1ma71HRUJP+QqM1t2HcVEyTEoSYVYQCuN3HenCt4XDhGA+KorAnYZ9KIj5ELOl3XpU/k/wrt+OmraDaG7cjpacbxFvYAAZDG5Vw/DWCxjRdp+ATsWAS6+D69H1+XDNsoVb1T06b0VwzCmBIOYdqUWibTojcFBH1CXQctBtUcA6Oh/RmVC4sBmKA5j6erC1qqE4sRpqG25A43QIOHuXgvOmP5R4ZH6m5UY2L9SSLjZ5sKjjsI/o8olH8ngjCZoSgmw9DMIl3t42Up0g+pq89/sEjLK47knZhSkSuDepJP4JOyNJyEFAR8VQKMOR1nbWM69yxNJYwh+VLE90ffPyxLE3EwL9Jq0huWQqwL1iA7zq8+FVl0+epgBO6T+gb2TH+OglqgastxtZrNNlkLt8E5oJx6HZdab7mFZBk3UZRjMewCT7HkzLfodZxREYr5sBjiIBPYiAPt8ehvSGPSg5vwjzpd16VNkmmDTswp22QDTXbkJrxhJkzHGDFoUQmvBpvo2hrZl0TnLhlLIYfUO7nt7dSg3hURcP1/JiDEgphuXBqVKLRFsfA3oJAf3mI6Cr2OjTwGYdqWGzzmZD6WoYVCfehdqsZKjuuwS1oB1Q+5piHac3oaxBzZ9vLZ4nHEeesoXg6niDPSYWP9yUgD5PHu48eKE64krHcErchHIEuRysTpAXjObQWIYEHiV4EQYEojp5aEoyY+IIpOQugKYYOnIdJXrdJ63PtWwXMQM6m6SVT4gfZkbHV0XHsVtaQ3K8yoJr0YfwoHDDq5ZiQSqDik/B4Q9taYtn18gyNia1qGJsmTrGlUjK2FJ1jCjRwOASDnkxDvN95ZD/og5yl0qgfCMJ2leDoeksHaFHXYOJVyrMkm/DrPwMzGr2wmjnLGipthyHL0W7t9pDkduwF2U3lmGFtvbTdyirt0OreT+iWwPRUrUBbSkLkT/fCUZwKVYikBMwpDlPXNzLwuAQ2rWX8KzUh2dDDJyLSmB7/S5Mf3WRWiR6CPSezkCXQs6qBnLCKsheyoXqnTCoL9oOFd9/Qtl9KJT6UJMX3/zhCz8iuCjhiviSYtMx3ZTJBN8lCE7eIRgF0p6krRRaRBDskTTGySBKws5SuUjJHYUiMQdpzCUE0Q3y5MnSDhJJQg5JUvjSgO5hHZofaioGmvc40IycMgbRtJktjgOZ5Ma9irzSg46xYHcaVEZevkgBHqUWGFK+FENKQ+BdGAq/wiMYWbwHI6h4FwTDOes0BMKFMHxPNg9qn1dANakYanfuQSs5FJoTpaP1qBswsSGgb9+EeUU0Af0LDH4dBhXlmv3wajuOpPYQFDcEojxtNQ6sn9ZzUsiofjfUWg/iYOt+tJatRtvN95DqZgxNuKTKwLV4Jdyqc8Wz1uCGTLjmDIVDQqewQ8anwpJi6GsYkF4Ey2O/QvsfXKlJIgboAwT07s5AZ0G1TylUIsuhdKMI6vcuQ3PVAqg+9UZ8JvGEywiuNoIwD4IzaV2X+HSa1otgE3+NwJImVkycG0kx8snfyUZJW+QFApeSu+hN9BpIn6n+ZBp9bqDv+C8Fum+8IpzzJNOmR3UhTaGFcC07iAHXmamuZw28C/S/aIt+CcthF7+ToN0EQdhqOFzcBu/Sm/ApvAGX3DzYXIiF9jtWTJf74L6ZC83UfGg8SId2xnloSZKxp+gWjC0J6KSrMK8KhmnlSugtInpkCzaBV78Hl5oPoaLpECrLt+Bi4jfgS7t1q+YDUGsPwj5KDFsLlqD97JuIpmpZmP+TftM1ezjlxsOllM4H3eReDWHwKrOBW84jqMeK5OBTv4Bu6HxxgqU1s/N3MkAHSoH+ioCe+gjoJHB0s8ENLID6/UJo3E+GVlwoNEwY278tXhR50RhmeexzgmM8JXjdF36MHwEoiXn70Csv6gxBm8PiRc6gJFD1HDzFpq1cP0omo5QJZAfqQzH0f6uHZjQgeR4cC/IJZCnUtSkYVPAWBiX2/CdU/S7Ql+9TgtFCTaiP0qAEXA2yRsqwuzECziWZcM4tgv2DSljF7ID+l+JNh9+hY38HuvcYmLOhk5EEnVPfQOmpW+33YGaXhj53E2BWuxvGebOh5cPUX/sWSgXrsa9mB2qaDqCK4C7I2IA3jn8u7tat2g6D034MIbWb0fZgHlr2DscXUhNNuYdkYRPrg/7JiXDMLYBrZS6GNEZgVJM/JjWY4I16G4xr/BCDq2nKjjoAvY+Zpwo7eXBskQK9Swr0lEdAn4a2wk3o/DMNWmn54KYUQIuZsebGQuXFQ42H4kfNk4QckSOkNZ1lGkGAUoInOKkAm2jJsVtH+om9Nj9ytZxNcNdhljXByo+JJXj/i4G2u2xM02YInPJLxFB7VudTPH0ZHkWu0hbPpwHpfnAszoFDVgVsb1fDMmoL9L8S7wTFQE/1AvR33oB+QSp0czKgl34B2iO9uwJCKib5SGaZjbqLPlkhMG1YDr1gQyioSs24vQTDitagsnIL6loCUVu9C2EJK9FjYtsWBNP2Q7hb9A155zdwY5mTeGexo0w32hEcy2F7JQaOqZfgk38KY6rDMKFBiGHNt+iGPgCNYd0/s/sbAb2fgN5JQC9Wq8bkR0AzioOOx3Xo30mGbnY+tNMKoJOQCm03qfnFxRf6E1yUFAqZJcyuZRWuQmB+TWHJcgJfkjPxImcSSIUsXviMx/O9DvqfALrPDjb6nhuBAWkZ5JFKKTYuIqhz4FUdAo9CGwzO7Ra2LjUg0w9OxdlwyKxAXzHQm8lDi4HeAT1WMPSHnYXR7aswKE6Gfl4K9PdfgZ6+uG8XSmMbKyXD/LsEmFduglH2NHA7rA3Hvg+Ve1/gYO4KNFRvQUPLQVRU7MG4yn1dJ4eiULAo3JhW9xsa77+Hml8GY8FQ425uAM5wRRivNoPlTjs4XhoH35oLGFZ/S/wglyDkbWmrrsUAvY+A3kHlSwJ6ihKzCvLnuQyElmIs9LdfhmHxA+jn5kI3jcrRFOjxU6DTbTx9DybsOBh0f034EeYEVyaFD0IYhnQ9y1pTIsiPvU5AnKYkUBL78yKmQhDLgDRPSWtPp/HFkFtHqFCfRBr73wX67qsD+qFsEubCnqKBAZllcCkkT12RjSHVMfApH0bJXfcH+aQGZg6FU1EWeeoK2NwgoMM3Q++zP/fq/Smf2g392ZEwzk2Acfl9GBHURmuSYPyn132oHBizH8B8wjX0SadQI2cWtOZZQbHTdEgRn8XN93EiczFayn5GU3Mg7lJMPab5SEeoCWZZ0TF4Ne/A/ZSPUbXdDz9Qdddrrk/KtcwR7jX34VXDzGCFGFT0GzyLu922x069kdiv145tOu34jlOHBWoz4arUAZQt0LYOhmFcHJ2H6zAsYnZDc2FwKhv60+m9UQrLUJ4hSYQAVhpM1O6jj30EDD33Q6frZyoY8cMVaWZZR560kuB5V9H6iVUas+Py5L1/IHsT2ZldR4nEkMdkUd8Y8tYd43mLIMhYhenDWvgjQSQiGFOkiEv0rEAzK2u8yG10M2WwBWFdb6q9NKDNd6rCOuYD9L2VI/57QMfcEniU5cCnJgG+lR9haAnz4MzT5ZjmA4e8HBqnGtYXamF+nK7bpx0uwHxoqGyE3sKD5HHjYVJ1C6Z5qTD5Ph2G1hnQEV/0LBhxU2E+4yYsbgTCJGsuNBfYQrnjA0CPxDo2CRYJ0xGesgD1ZWvQ3LQbKeSJ54uC0UcUDVVRGExFR/FB2y7cSf4C+Zv9sXSUeQ9P2z2pQdnmBHQsPKqKqFCyWJsM75o1GMw8O/iEhFZs/KK9CD9wRfhCTYTP1dqwnBOHrQYz8IuuH5ZxxI/MLQZH5kfoeu6D4cVQGNecgXHFbRgXZsD4Xg5MjqfDeE0KTBbRDLXsLiwOR8HkxCJoOs+Eavdr08ZBBGdYP7rYzAZILsH3LYUYtgSsAXlYRwLqW0r8Ksl2id4/Onaz47IE+kayUfwddYhsgwkqXRrLgOpHEuyhVF9B7ytoTAL//qNjeFagGfGEi5nvYPEifqOx/ek4p1J/8aKBWC8N6Icy2+oL6zOhECTmw46SuoHZpXBn/pK7/DK8K1bCp3Q0vAv7wqfIBD55OuS9teFVYASPfAFccseThw+E4Ho5LOMqYB6ZCeOdK6H1bleJH2sOOPZradqlC3otDqY5F2GafQmmCZdgFnMBZteEML2yCnprh0CZWVp66gbDuD5Q2uSLUacm43jSB0gq+h55JeuRX7wRqUUbkJL8DS4GTcPqCdZgduZ6XiZjgvcp9fIY3aAH/yY+3KvcMDBjLSXQBXDML4VbaQG8a9PgUxcOzyIneKY/Or6FHDO8q7INY+RiMFJaJijE4i2VeEylej/FDs99TAPH8Dvofv8bDK/vhVHxMRhX0W+vOgXTijiY5UXANGkNnYeRUGN2VrsPNx6XVaQNgRNM03sBgUjeOKJJ/Cr+LNzFsg61YB5/elyKtic0qM031CaZAG0gqJnVEuYBIoI49gy9D6DXrQR3GoU2j3YE+WE2FI9TGBG1FLywnhNbPt1Y/OhY+o5iGqsGNmdLaVxfqZUB+g0Iztwi2AOkNZ3FCzOm30bHeHK9tKYHKfPZMFhlAtM9c2EpjALv93zY3qlE/8xyOOUVUTiSBrfy83CvDIdbRZC4uJSGwzHzd0qgkmEVfRnGW/dC79vPobtkFLRmm0HDpVt43MnrzoOm/dfQeeOf0P3wB+guJogXrIDuhHfAsdOFbKdQ5GkaYQbNNYNht2c8/AOnYNKB6Ri//Q14zRwIuohdPC76pCbWKGFCkx9GNC7B0NZD8CiJh8Odi7A59zud7EuwvU4hVUYZBhUXwqsqA56V0RiUM1Dam36UoiyFuprQhc6fRZuKKhV5+rcLKD2hrPQ+NPsvgNb0j6C9eCG0v/kU2l9/BK0ZM8EdRJQ833noG8Qib6lDkA0lYD6i8GIJlffZ/IhhbJtQjW4TP164EiWWztTnH9T+a4L/MxpjAn02hWWYDAQnefSZzm7Io7zDOpiSzGh3grwPwd3zDccPZdH4phBEkXcWBrD4wlE07qObw5pmBUGsK43T/YPfgmAFWEe5U2EeCXhGcV5nQ3u2KrTf6w+jdTNhtud7mB/ZC4vg43QAwbAMDYLF0e3os+8HGP80D7oLx0F9dD+oj9AGZ4Y85K0Yj/Vs3kQiFgeybFPIySiDzdwAz9O3JzHjPNtYk8gjv948FOOatlGodR0Dk07Bau9n0F8wFBp+luBO1CXeuDD51Q3830PRP7UIzgUlcC0vhHPRSdic6eI53ecT3W0sKyjI2EFRxhzyz3sOO8voBkEUTclYhAyshCwr642PR79diwlbBOEs8vLMFjgbbuelhpeoz5rEDxsNNl/+9ON5RWJOLsXCysQdh5IhWWbzhUmoel6v/l/RxGpZTKgbh3EtEZQMp5AX2ASd2f3AVu7695ky/7nOuc2U/BZSCFIGp+I82F/rfprsVa/+Mk0sZ2F0tTvGNZ+gRO8B7C/HQ92beWine+/IDWDBbJUmbBN/hUNOGRyyStH34vfQeP3ZV4R61atXIu9Kefg1rIB/XRJciwso9nymLXmxbP+wxcCsVAxIKwfv1AZoDH96jN6rXr1SuVeowKsuFINrs+BSXATbc59JLU/XwCwdDMw7B/vUEpgHfQYZ7v9HCNar/2E55ynDpSwYrhXF4uKUeQiY0/Oy3kM555nCITcJgmvp0F30Yo8L9KpXL1X9E2XhkPoVBuYWwbmolKDOhmv+WHiXyGNkgbTRE1pOublXkRycCz+AfUoRzPdsgKJN1w/19KpXf7n6xlnCPikE/SkWdswrozDkNoZUfIWhFTYYWaPy4a6NkgSR2XAZXSOLIWUWcCv7FP1T7sH8wFZwp7ycxz971auXIm4AG+b77MFLEKLv7ULJMy0FefCsPAOv0t0YUrIMg0s+gVfxYrgVbIJLUSzsrl2F2ZZl4L7J/Pdp/956ca969UrEna0O41/HwSJ4F3in42Fz5Trsbt5Bv3u30e9uImyvnoV15GGY/LIA6kOZP1966pZ8r3r1n5eqhwZ0F/aB4ToHGK9zh/FPHjD60RE6H1tDaaA2cdy7mvFfI+BffksPNrEksu0AAAAASUVORK5CYII=",m}),i("Scene/GridImageryProvider",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/Event","../Core/GeographicTilingScheme","../ThirdParty/when"],function(e,t,i,r,n,o,a){"use strict";function s(e){e=t(e,t.EMPTY_OBJECT),this._tilingScheme=i(e.tilingScheme)?e.tilingScheme:new o({ellipsoid:e.ellipsoid}),this._cells=t(e.cells,8),this._color=t(e.color,l),this._glowColor=t(e.glowColor,u),this._glowWidth=t(e.glowWidth,6),this._backgroundColor=t(e.backgroundColor,c),this._errorEvent=new n,this._tileWidth=t(e.tileWidth,256),this._tileHeight=t(e.tileHeight,256),this._canvasSize=t(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=a.resolve(!0)}var l=new e(1,1,1,.4),u=new e(0,1,0,.05),c=new e(0,.5,0,.2);return r(s.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}}),s.prototype._drawGrid=function(e){for(var t=0,i=this._canvasSize,r=0;r<=this._cells;++r){var n=r/this._cells,o=1+n*(i-1);e.moveTo(o,t),e.lineTo(o,i),e.moveTo(t,o),e.lineTo(i,o)}e.stroke()},s.prototype._createGridCanvas=function(){var e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;var t=0,i=this._canvasSize,r=e.getContext("2d"),n=this._backgroundColor.toCssColorString();r.fillStyle=n,r.fillRect(t,t,i,i);var o=this._glowColor.toCssColorString();r.strokeStyle=o,r.lineWidth=this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r),r.lineWidth=.5*this._glowWidth,r.strokeRect(t,t,i,i),this._drawGrid(r);var a=this._color.toCssColorString();return r.strokeStyle=a,r.lineWidth=2,r.strokeRect(t,t,i,i),r.lineWidth=1,this._drawGrid(r),e},s.prototype.getTileCredits=function(e,t,i){},s.prototype.requestImage=function(e,t,i){return this._canvas},s.prototype.pickFeatures=function(){},s}),i("Shaders/ShadowVolumeFS",[],function(){"use strict";return"#extension GL_EXT_frag_depth : enable\nvarying float v_WindowZ;\nvarying vec4 v_color;\nvoid writeDepthClampedToFarPlane()\n{\ngl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n}\nvoid main(void)\n{\ngl_FragColor = v_color;\nwriteDepthClampedToFarPlane();\n}\n"}),i("Shaders/ShadowVolumeVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nvarying float v_WindowZ;\nvarying vec4 v_color;\nvec4 depthClampFarPlane(vec4 vertexInClipCoordinates)\n{\nv_WindowZ = (0.5 * (vertexInClipCoordinates.z / vertexInClipCoordinates.w) + 0.5) * vertexInClipCoordinates.w;\nvertexInClipCoordinates.z = min(vertexInClipCoordinates.z, vertexInClipCoordinates.w);\nreturn vertexInClipCoordinates;\n}\nvoid main()\n{\nv_color = color;\nvec4 position = czm_computePosition();\ngl_Position = depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n}\n"}),i("Scene/StencilFunction",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={NEVER:t.NEVER,LESS:t.LESS,EQUAL:t.EQUAL,LESS_OR_EQUAL:t.LEQUAL,GREATER:t.GREATER,NOT_EQUAL:t.NOTEQUAL,GREATER_OR_EQUAL:t.GEQUAL,ALWAYS:t.ALWAYS};return e(i)}),i("Scene/StencilOperation",["../Core/freezeObject","../Renderer/WebGLConstants"],function(e,t){"use strict";var i={ZERO:t.ZERO,KEEP:t.KEEP,REPLACE:t.REPLACE,INCREMENT:t.INCR,DECREMENT:t.DECR,INVERT:t.INVERT,INCREMENT_WRAP:t.INCR_WRAP,DECREMENT_WRAP:t.DECR_WRAP};return e(i)}),i("Scene/GroundPrimitive",["../Core/BoundingSphere","../Core/Cartesian3","../Core/Cartographic","../Core/ColorGeometryInstanceAttribute","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/deprecationWarning","../Core/destroyObject","../Core/DeveloperError","../Core/GeometryInstance","../Core/isArray","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/OrientedBoundingBox","../Core/Rectangle","../Renderer/DrawCommand","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Shaders/ShadowVolumeFS","../Shaders/ShadowVolumeVS","../ThirdParty/when","./BlendingState","./DepthFunction","./Pass","./PerInstanceColorAppearance","./Primitive","./SceneMode","./StencilFunction","./StencilOperation"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D){"use strict";function R(e){e=n(e,n.EMPTY_OBJECT),o(e.geometryInstance)&&s("GroundPrimitive.geometryInstance","GroundPrimitive.geometryInstance is deprecated in version 1.18 and will be removed in version 1.20. Please use GroundPrimitive.geometryInstances."),this.geometryInstance=e.geometryInstance,this.geometryInstances=e.geometryInstances,this.show=n(e.show,!0),this.debugShowBoundingVolume=n(e.debugShowBoundingVolume,!1),this._sp=void 0,this._spPick=void 0,this._rsStencilPreloadPass=void 0,this._rsStencilDepthPass=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._uniformMap={},this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._readyPromise=w.defer(),this._primitive=void 0;var t,i=new A({flat:!0});o(this.geometryInstances)&&h(this.geometryInstances)&&this.geometryInstances.length>1&&(t=G),this._primitiveOptions={geometryInstances:void 0,appearance:i,vertexCacheOptimize:n(e.vertexCacheOptimize,!1),interleave:n(e.interleave,!1),releaseGeometryInstances:n(e.releaseGeometryInstances,!0),allowPicking:n(e.allowPicking,!0),asynchronous:n(e.asynchronous,!0),compressVertices:n(e.compressVertices,!0),_readOnlyInstanceAttributes:t,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_createPickOffsets:!0}}function O(e,t){var i=t.maximumRadius,r=i/Math.cos(.5*e)-i;return R._maxHeight+r}function N(e,t){return R._minHeight}function L(i,r,n){for(var o=n.attributes.position3DHigh.values,a=n.attributes.position3DLow.values,s=o.length,l=r.mapProjection.ellipsoid,u=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,p=Number.NEGATIVE_INFINITY,m=0;s>m;m+=3){var v=t.unpack(o,m,Y),g=t.unpack(a,m,X),_=t.add(v,g,Z),y=l.cartesianToCartographic(_,K),C=y.latitude,E=y.longitude;u=Math.min(u,C),c=Math.min(c,E),h=Math.max(h,C),p=Math.max(p,E)}var S=Q;if(S.north=h,S.south=u,S.east=p,S.west=c,S.width<d.PI){var w=f.fromRectangle(S,R._maxHeight,R._minOBBHeight,l);i._boundingVolumes.push(w)}else i._boundingVolumes.push(e.fromEncodedCartesianVertices(o,a));if(!r.scene3DOnly){var T=r.mapProjection,x=e.fromRectangleWithHeights2D(S,T,R._maxHeight,R._minOBBHeight);t.fromElements(x.center.z,x.center.x,x.center.y,x.center),i._boundingVolumes2D.push(x)}}function F(e,t,i,r){o(e._rsStencilPreloadPass)||(e._rsStencilPreloadPass=_.fromCache(W),e._rsStencilDepthPass=_.fromCache(H),e._rsColorPass=_.fromCache(q),e._rsPickPass=_.fromCache(j))}function B(e,t,i){if(!o(e._sp)){var r=t.context,n=S;n=P._modifyShaderPosition(e,n,t.scene3DOnly),n=P._appendShowToShader(e._primitive,n);var a=E,s=e._primitive._attributeLocations;if(e._sp=y.replaceCache({context:r,shaderProgram:e._sp,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:s}),e._primitive.allowPicking){var l=new C({sources:[a],pickColorQualifier:"varying"});e._spPick=y.replaceCache({context:r,shaderProgram:e._spPick,vertexShaderSource:C.createPickVertexShaderSource(n),fragmentShaderSource:l,attributeLocations:s})}else e._spPick=y.fromCache({context:r,vertexShaderSource:n,fragmentShaderSource:a,attributeLocations:s})}}function V(e,t){var i=e._primitive,r=3*i._va.length;t.length=r;for(var n=0,a=0;r>a;a+=3){var s=i._va[n++],l=t[a];o(l)||(l=t[a]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsStencilPreloadPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND,l=t[a+1],o(l)||(l=t[a+1]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsStencilDepthPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND,l=t[a+2],o(l)||(l=t[a+2]=new g({owner:e,primitiveType:i._primitiveType})),l.vertexArray=s,l.renderState=e._rsColorPass,l.shaderProgram=e._sp,l.uniformMap=e._uniformMap,l.pass=b.GROUND}}function k(e,t){var i=e._primitive,r=i._pickOffsets,n=3*r.length;t.length=n;for(var a=0,s=0;n>s;s+=3){var l=r[a++],u=l.offset,c=l.count,h=i._va[l.index],d=t[s];o(d)||(d=t[s]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsStencilPreloadPass,d.shaderProgram=e._sp,d.uniformMap=e._uniformMap,d.pass=b.GROUND,d=t[s+1],o(d)||(d=t[s+1]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsStencilDepthPass,d.shaderProgram=e._sp,d.uniformMap=e._uniformMap,d.pass=b.GROUND,d=t[s+2],o(d)||(d=t[s+2]=new g({owner:e,primitiveType:i._primitiveType})),d.vertexArray=h,d.offset=u,d.count=c,d.renderState=e._rsPickPass,d.shaderProgram=e._spPick,d.uniformMap=e._uniformMap,d.pass=b.GROUND}}function z(e,t,i,r,n,o,a){V(e,o),k(e,a)}function U(e,t,i,r,n,a,s,l){var u;t.mode===I.SCENE3D?u=e._boundingVolumes:t.mode!==I.SCENE3D&&o(e._boundingVolumes2D)&&(u=e._boundingVolumes2D);var c=t.commandList,h=t.passes;if(h.render)for(var d=i.length,p=0;d>p;++p)i[p].modelMatrix=n,i[p].boundingVolume=u[Math.floor(p/3)],i[p].cull=a,i[p].debugShowBoundingVolume=s,c.push(i[p]);if(h.pick){var m=e._primitive,f=m._pickOffsets,v=3*f.length;r.length=v;for(var g=0,_=0;v>_;_+=3){var y=f[g++],C=u[y.index];r[_].modelMatrix=n,r[_].boundingVolume=C,r[_].cull=a,r[_+1].modelMatrix=n,r[_+1].boundingVolume=C,r[_+1].cull=a,r[_+2].modelMatrix=n,r[_+2].boundingVolume=C,r[_+2].cull=a,c.push(r[_],r[_+1],r[_+2])}}}var G=["color"];a(R.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise.promise}}}),R.isSupported=function(e){return e.context.fragmentDepth},R._maxHeight=void 0,R._minHeight=void 0,R._minOBBHeight=void 0,R._maxTerrainHeight=9e3,R._minTerrainHeight=-1e5,R._minOBBTerrainHeight=-11500;var W={colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:M.ALWAYS,frontOperation:{fail:D.KEEP,zFail:D.DECREMENT_WRAP,zPass:D.DECREMENT_WRAP},backFunction:M.ALWAYS,backOperation:{fail:D.KEEP,zFail:D.INCREMENT_WRAP,zPass:D.INCREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1},H={colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:M.ALWAYS,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.INCREMENT_WRAP},backFunction:M.ALWAYS,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!0,func:x.LESS_OR_EQUAL},depthMask:!1},q={stencilTest:{enabled:!0,frontFunction:M.NOT_EQUAL,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},backFunction:M.NOT_EQUAL,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1,blending:T.ALPHA_BLEND},j={stencilTest:{enabled:!0,frontFunction:M.NOT_EQUAL,frontOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},backFunction:M.NOT_EQUAL,backOperation:{fail:D.KEEP,zFail:D.KEEP,zPass:D.DECREMENT_WRAP},reference:0,mask:-1},depthTest:{enabled:!1},depthMask:!1},Y=new t,X=new t,Z=new t,K=new i,Q=new v;return R.prototype.update=function(e){var t=e.context;if(t.fragmentDepth&&this.show&&(o(this._primitive)||o(this.geometryInstance)||o(this.geometryInstances))){if(!o(R._maxHeight)){var i=e.terrainExaggeration;R._maxHeight=R._maxTerrainHeight*i,R._minHeight=R._minTerrainHeight*i,R._minOBBHeight=R._minOBBTerrainHeight*i}if(!o(this._primitive)){var r,n,a,s=this._primitiveOptions;if(o(this.geometryInstance))r=this.geometryInstance,n=r.geometry,a=n.constructor,o(a)&&o(a.createShadowVolume)&&(r=new c({geometry:a.createShadowVolume(n,N,O),attributes:r.attributes,id:r.id,pickPrimitive:this})),s.geometryInstances=r;else{for(var l=h(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],u=l.length,d=new Array(u),p=0;u>p;++p)if(r=l[p],n=r.geometry,a=n.constructor,o(a)&&o(a.createShadowVolume)){var m=r.attributes;d[p]=new c({geometry:a.createShadowVolume(n,N,O),attributes:m,id:r.id,pickPrimitive:this})}s.geometryInstances=d}var f=this;s._createBoundingVolumeFunction=function(e,t){L(f,e,t)},s._createRenderStatesFunction=function(e,t,i,r){F(f,t)},s._createShaderProgramFunction=function(e,t,i){B(f,t)},s._createCommandsFunction=function(e,t,i,r,n,o,a){z(f,void 0,void 0,!0,!1,o,a)},s._updateAndQueueCommandsFunction=function(e,t,i,r,n,o,a,s){U(f,t,i,r,n,o,a,s)},this._primitive=new P(s),this._primitive.readyPromise.then(function(e){f._ready=!0,f.releaseGeometryInstances&&(f.geometryInstance=void 0,f.geometryInstances=void 0);var t=e._error;o(t)?f._readyPromise.reject(t):f._readyPromise.resolve(f)})}this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)}},R.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)},R.prototype.isDestroyed=function(){return!1},R.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(), l(this)},R}),i("Scene/MapboxImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/MapboxApi","./UrlTemplateImageryProvider"],function(e,t,i,r,n,o,a){"use strict";function s(r){r=t(r,t.EMPTY_OBJECT);var n=r.mapId,s=t(r.url,"//api.mapbox.com/v4/");this._url=s,this._mapId=n,this._accessToken=o.getAccessToken(r.accessToken);var h=t(r.format,"png");this._format=h.replace(".","");var d=s;if(l.test(s)||(d+="/"),d+=n+"/{z}/{x}/{y}."+this._format,i(this._accessToken)&&(d+="?access_token="+this._accessToken),i(r.credit)){var p=r.credit;"string"==typeof p&&(p=new e(p)),u=p,c.length=0}this._imageryProvider=new a({url:d,proxy:r.proxy,credit:u,ellipsoid:r.ellipsoid,minimumLevel:r.minimumLevel,maximumLevel:r.maximumLevel,rectangle:r.rectangle})}var l=/\/$/,u=new e("© Mapbox © OpenStreetMap",void 0,"https://www.mapbox.com/about/maps/"),c=[new e("Improve this map",void 0,"https://www.mapbox.com/map-feedback/")];return r(s.prototype,{url:{get:function(){return this._url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}}),s.prototype.getTileCredits=function(e,t,i){return c},s.prototype.requestImage=function(e,t,i){return this._imageryProvider.requestImage(e,t,i)},s.prototype.pickFeatures=function(e,t,i,r,n){return this._imageryProvider.pickFeatures(e,t,i,r,n)},s}),i("Scene/Moon",["../Core/buildModuleUrl","../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/Ellipsoid","../Core/IauOrientationAxes","../Core/Matrix3","../Core/Matrix4","../Core/Simon1994PlanetaryPositions","../Core/Transforms","./EllipsoidPrimitive","./Material"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p){"use strict";function m(t){t=i(t,i.EMPTY_OBJECT);var n=t.textureUrl;r(n)||(n=e("Assets/Textures/moonSmall.jpg")),this.show=i(t.show,!0),this.textureUrl=n,this._ellipsoid=i(t.ellipsoid,a.MOON),this.onlySunLighting=i(t.onlySunLighting,!0),this._ellipsoidPrimitive=new d({radii:this.ellipsoid.radii,material:p.fromType(p.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new s}n(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var f=new l,v=new l,g=new t,_=[];return m.prototype.update=function(e){if(this.show){var t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;var i=e.time;r(h.computeIcrfToFixedMatrix(i,f))||h.computeTemeToPseudoFixedMatrix(i,f);var n=this._axes.evaluate(i,v);l.transpose(n,n),l.multiply(f,n,n);var o=c.computeMoonPositionInEarthInertialFrame(i,g);l.multiplyByVector(f,o,o),u.fromRotationTranslation(n,o,t.modelMatrix);var a=e.commandList;return e.commandList=_,_.length=0,t.update(e),e.commandList=a,1===_.length?_[0]:void 0}},m.prototype.isDestroyed=function(){return!1},m.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),o(this)},m}),i("Scene/NeverTileDiscardPolicy",[],function(){"use strict";function e(e){}return e.prototype.isReady=function(){return!0},e.prototype.shouldDiscardImage=function(e){return!1},e}),i("Shaders/AdjustTranslucentFS",[],function(){"use strict";return"#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nif (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n{\n#ifdef MRT\ngl_FragData[0] = u_bgColor;\ngl_FragData[1] = vec4(u_bgColor.a);\n#else\ngl_FragColor = u_bgColor;\n#endif\nreturn;\n}\ndiscard;\n}\n"}),i("Shaders/CompositeOITFS",[],function(){"use strict";return"uniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 opaque = texture2D(u_opaque, v_textureCoordinates);\nvec4 accum = texture2D(u_accumulation, v_textureCoordinates);\nfloat r = texture2D(u_revealage, v_textureCoordinates).r;\n#ifdef MRT\nvec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\nvec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\ngl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n}\n"}),i("Scene/OIT",["../Core/BoundingRectangle","../Core/Color","../Core/defined","../Core/destroyObject","../Core/PixelFormat","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/ShaderProgram","../Renderer/ShaderSource","../Renderer/Texture","../Renderer/WebGLConstants","../Shaders/AdjustTranslucentFS","../Shaders/CompositeOITFS","./BlendEquation","./BlendFunction"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v){"use strict";function g(i){this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;var r=i.floatingPointTexture&&i.depthTexture;this._translucentMRTSupport=i.drawBuffers&&r,this._translucentMultipassSupport=!this._translucentMRTSupport&&r,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=void 0,this._alphaFBO=void 0,this._adjustTranslucentFBO=void 0,this._adjustAlphaFBO=void 0,this._opaqueClearCommand=new o({color:new t(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new o({color:new t(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new o({color:new t(0,0,0,0),owner:this}),this._alphaClearCommand=new o({color:new t(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._translucentShaderCache={},this._alphaShaderCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new e,this._rs=void 0}function _(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function y(e){e._translucentFBO=e._translucentFBO&&!e._translucentFBO.isDestroyed()&&e._translucentFBO.destroy(),e._alphaFBO=e._alphaFBO&&!e._alphaFBO.isDestroyed()&&e._alphaFBO.destroy(),e._adjustTranslucentFBO=e._adjustTranslucentFBO&&!e._adjustTranslucentFBO.isDestroyed()&&e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO=e._adjustAlphaFBO&&!e._adjustAlphaFBO.isDestroyed()&&e._adjustAlphaFBO.destroy()}function C(e){_(e),y(e)}function E(e,t,i,r){_(e),e._accumulationTexture=new h({context:t,width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:s.FLOAT}),e._revealageTexture=new h({context:t,width:i,height:r,pixelFormat:n.RGBA,pixelDatatype:s.FLOAT})}function S(e,t){y(e);var i=d.FRAMEBUFFER_COMPLETE,r=!0;if(e._translucentMRTSupport&&(e._translucentFBO=new a({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new a({context:t,colorTextures:[e._accumulationTexture,e._revealageTexture],destroyAttachments:!1}),(e._translucentFBO.status!==i||e._adjustTranslucentFBO.status!==i)&&(y(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO=new a({context:t,colorTextures:[e._accumulationTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._alphaFBO=new a({context:t,colorTextures:[e._revealageTexture],depthStencilTexture:e._depthStencilTexture,destroyAttachments:!1}),e._adjustTranslucentFBO=new a({context:t,colorTextures:[e._accumulationTexture],destroyAttachments:!1}),e._adjustAlphaFBO=new a({context:t,colorTextures:[e._revealageTexture],destroyAttachments:!1});var n=e._translucentFBO.status===i,o=e._alphaFBO.status===i,s=e._adjustTranslucentFBO.status===i,l=e._adjustAlphaFBO.status===i;n&&o&&s&&l||(C(e),e._translucentMultipassSupport=!1,r=!1)}return r}function w(e,t,r,n){var o=r[n.id];if(!i(o)){var a=l.getState(n);a.depthMask=!1,a.blending=t,o=l.fromCache(a),r[n.id]=o}return o}function T(e,t,i){return w(t,O,e._translucentRenderStateCache,i)}function x(e,t,i){return w(t,N,e._translucentRenderStateCache,i)}function b(e,t,i){return w(t,L,e._alphaRenderStateCache,i)}function A(e,t,r,n){var o=t.id,a=r[o];if(!i(a)){var s=t._attributeLocations,l=t.fragmentShaderSource.clone();l.sources=l.sources.map(function(e){return e=c.replaceMain(e,"czm_translucent_main"),e=e.replace(/gl_FragColor/g,"czm_gl_FragColor"),e=e.replace(/\bdiscard\b/g,"czm_discard = true"),e=e.replace(/czm_phong/g,"czm_translucentPhong")}),l.sources.splice(0,0,(-1!==n.indexOf("gl_FragData")?"#extension GL_EXT_draw_buffers : enable \n":"")+"vec4 czm_gl_FragColor;\nbool czm_discard = false;\n"),l.sources.push("void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n"+n+"}\n"),a=u.fromCache({context:e,vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:l,attributeLocations:s}),r[o]=a}return a}function P(e,t,i){return A(t,i,e._translucentShaderCache,F)}function I(e,t,i){return A(t,i,e._translucentShaderCache,B)}function M(e,t,i){return A(t,i,e._alphaShaderCache,V)}function D(e,t,r,n,o){var a,s,l,u,c=t.context,h=n.framebuffer,d=o.length;n.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(c,n),n.framebuffer=e._adjustAlphaFBO,e._adjustAlphaCommand.execute(c,n);var p=e._opaqueFBO;for(n.framebuffer=e._translucentFBO,u=0;d>u;++u)a=o[u],i(a.oit)&&a.shaderProgram.id===a.oit.shaderProgramId||(a.oit={colorRenderState:x(e,c,a.renderState),alphaRenderState:b(e,c,a.renderState),colorShaderProgram:I(e,c,a.shaderProgram),alphaShaderProgram:M(e,c,a.shaderProgram),shaderProgramId:a.shaderProgram.id}),s=a.oit.colorRenderState,l=a.oit.colorShaderProgram,r(a,t,c,n,s,l,p);for(n.framebuffer=e._alphaFBO,u=0;d>u;++u)a=o[u],s=a.oit.alphaRenderState,l=a.oit.alphaShaderProgram,r(a,t,c,n,s,l,p);n.framebuffer=h}function R(e,t,r,n,o){var a=t.context,s=n.framebuffer,l=o.length;n.framebuffer=e._adjustTranslucentFBO,e._adjustTranslucentCommand.execute(a,n);var u=e._opaqueFBO;n.framebuffer=e._translucentFBO;for(var c=0;l>c;++c){var h=o[c];i(h.oit)&&h.shaderProgram.id===h.oit.shaderProgramId||(h.oit={translucentRenderState:T(e,a,h.renderState),translucentShaderProgram:P(e,a,h.shaderProgram),shaderProgramId:h.shaderProgram.id});var d=h.oit.translucentRenderState,p=h.oit.translucentShaderProgram;r(h,t,a,n,d,p,u)}n.framebuffer=s}g.prototype.update=function(t,r){if(this.isSupported()){this._opaqueFBO=r,this._opaqueTexture=r.getColorTexture(0),this._depthStencilTexture=r.depthStencilTexture;var n=this._opaqueTexture.width,o=this._opaqueTexture.height,a=this._accumulationTexture,s=!i(a)||a.width!==n||a.height!==o;if(s&&E(this,t,n,o),i(this._translucentFBO)&&!s||S(this,t)){var u,h,d=this;i(this._compositeCommand)||(u=new c({sources:[m]}),this._translucentMRTSupport&&u.defines.push("MRT"),h={u_opaque:function(){return d._opaqueTexture},u_accumulation:function(){return d._accumulationTexture},u_revealage:function(){return d._revealageTexture}},this._compositeCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this})),i(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(u=new c({defines:["MRT"],sources:[p]}),h={u_bgColor:function(){return d._translucentMRTClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this})):this._translucentMultipassSupport&&(u=new c({sources:[p]}),h={u_bgColor:function(){return d._translucentMultipassClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this}),h={u_bgColor:function(){return d._alphaClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustAlphaCommand=t.createViewportQuadCommand(u,{uniformMap:h,owner:this}))),this._viewport.width=n,this._viewport.height=o,i(this._rs)&&e.equals(this._viewport,this._rs.viewport)||(this._rs=l.fromCache({viewport:this._viewport})),i(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderstate=this._rs),i(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)}}};var O={enabled:!0,color:new t(0,0,0,0),equationRgb:f.ADD,equationAlpha:f.ADD,functionSourceRgb:v.ONE,functionDestinationRgb:v.ONE,functionSourceAlpha:v.ZERO,functionDestinationAlpha:v.ONE_MINUS_SOURCE_ALPHA},N={enabled:!0,color:new t(0,0,0,0),equationRgb:f.ADD,equationAlpha:f.ADD,functionSourceRgb:v.ONE,functionDestinationRgb:v.ONE,functionSourceAlpha:v.ONE,functionDestinationAlpha:v.ONE},L={enabled:!0,color:new t(0,0,0,0),equationRgb:f.ADD,equationAlpha:f.ADD,functionSourceRgb:v.ZERO,functionDestinationRgb:v.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:v.ZERO,functionDestinationAlpha:v.ONE_MINUS_SOURCE_ALPHA},F=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragData[0] = vec4(Ci * wzi, ai);\n gl_FragData[1] = vec4(ai * wzi);\n",B=" vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragColor = vec4(Ci, ai) * wzi;\n",V=" float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";return g.prototype.executeCommands=function(e,t,i,r){return this._translucentMRTSupport?void R(this,e,t,i,r):void D(this,e,t,i,r)},g.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)},g.prototype.clear=function(e,i,r){var n=i.framebuffer;i.framebuffer=this._opaqueFBO,t.clone(r,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,i),i.framebuffer=this._translucentFBO;var o=this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand;o.execute(e,i),this._translucentMultipassSupport&&(i.framebuffer=this._alphaFBO,this._alphaClearCommand.execute(e,i)),i.framebuffer=n},g.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport},g.prototype.isDestroyed=function(){return!1},g.prototype.destroy=function(){C(this),i(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),i(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),i(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy());var e,t=this._translucentShaderCache;for(e in t)t.hasOwnProperty(e)&&i(t[e])&&t[e].destroy();this._translucentShaderCache={},t=this._alphaShaderCache;for(e in t)t.hasOwnProperty(e)&&i(t[e])&&t[e].destroy();return this._alphaShaderCache={},r(this)},g}),i("Scene/OpenStreetMapImageryProvider",["../Core/Credit","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/deprecationWarning","../Core/DeveloperError","../Core/Event","../Core/Rectangle","../Core/WebMercatorTilingScheme","../ThirdParty/when","./ImageryProvider"],function(e,t,i,r,n,o,a,s,l,u,c){"use strict";function h(i){n("OpenStreetMapImageryProvider","OpenStreetMapImageryProvider is deprecated. It will be removed in Cesium 1.18. Use createOpenStreetMapImageryProvider instead."),i=t(i,{});var r=t(i.url,"//a.tile.openstreetmap.org/");p.test(r)||(r+="/"),this._url=r,this._fileExtension=t(i.fileExtension,"png"),this._proxy=i.proxy,this._tileDiscardPolicy=i.tileDiscardPolicy,this._tilingScheme=new l({ellipsoid:i.ellipsoid}),this._tileWidth=256,this._tileHeight=256,this._minimumLevel=t(i.minimumLevel,0),this._maximumLevel=i.maximumLevel,this._rectangle=t(i.rectangle,this._tilingScheme.rectangle);var c=this._tilingScheme.positionToTileXY(s.southwest(this._rectangle),this._minimumLevel),h=this._tilingScheme.positionToTileXY(s.northeast(this._rectangle),this._minimumLevel),d=(Math.abs(h.x-c.x)+1)*(Math.abs(h.y-c.y)+1);if(d>4)throw new o("The imagery provider's rectangle and minimumLevel indicate that there are "+d+" tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.");this._errorEvent=new a,this._ready=!0,this._readyPromise=u.resolve(!0);var f=t(i.credit,m);"string"==typeof f&&(f=new e(f)),this._credit=f}function d(e,t,r,n){var o=e._url+n+"/"+t+"/"+r+"."+e._fileExtension,a=e._proxy;return i(a)&&(o=a.getURL(o)),o}var p=/\/$/,m=new e("MapQuest, Open Street Map and contributors, CC-BY-SA");return r(h.prototype,{url:{get:function(){return this._url}},proxy:{get:function(){return this._proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}}),h.prototype.getTileCredits=function(e,t,i){},h.prototype.requestImage=function(e,t,i){var r=d(this,e,t,i);return c.loadImage(this,r)},h.prototype.pickFeatures=function(){},h}),i("Scene/OrthographicFrustum",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/Matrix4","./CullingVolume"],function(e,t,i,r,n,o,a,s){"use strict";function l(){this.left=void 0,this._left=void 0,this.right=void 0,this._right=void 0,this.top=void 0,this._top=void 0,this.bottom=void 0,this._bottom=void 0,this.near=1,this._near=this.near,this.far=5e8,this._far=this.far,this._cullingVolume=new s,this._orthographicMatrix=new a}function u(e){(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far)&&(e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=a.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}n(l.prototype,{projectionMatrix:{get:function(){return u(this),this._orthographicMatrix}}});var c=new t,h=new t,d=new t,p=new t;return l.prototype.computeCullingVolume=function(e,n,o){var a=this._cullingVolume.planes,s=this.top,l=this.bottom,u=this.right,m=this.left,f=this.near,v=this.far,g=t.cross(n,o,c),_=h;t.multiplyByScalar(n,f,_),t.add(e,_,_);var y=d;t.multiplyByScalar(g,m,y),t.add(_,y,y);var C=a[0];return r(C)||(C=a[0]=new i),C.x=g.x,C.y=g.y,C.z=g.z,C.w=-t.dot(g,y),t.multiplyByScalar(g,u,y),t.add(_,y,y),C=a[1],r(C)||(C=a[1]=new i),C.x=-g.x,C.y=-g.y,C.z=-g.z,C.w=-t.dot(t.negate(g,p),y),t.multiplyByScalar(o,l,y),t.add(_,y,y),C=a[2],r(C)||(C=a[2]=new i),C.x=o.x,C.y=o.y,C.z=o.z,C.w=-t.dot(o,y),t.multiplyByScalar(o,s,y),t.add(_,y,y),C=a[3],r(C)||(C=a[3]=new i),C.x=-o.x,C.y=-o.y,C.z=-o.z,C.w=-t.dot(t.negate(o,p),y),C=a[4],r(C)||(C=a[4]=new i),C.x=n.x,C.y=n.y,C.z=n.z,C.w=-t.dot(n,_),t.multiplyByScalar(n,v,y),t.add(e,y,y),C=a[5],r(C)||(C=a[5]=new i),C.x=-n.x,C.y=-n.y,C.z=-n.z,C.w=-t.dot(t.negate(n,p),y),this._cullingVolume},l.prototype.getPixelDimensions=function(e,t,i,r){u(this);var n=this.right-this.left,o=this.top-this.bottom,a=n/e,s=o/t;return r.x=a,r.y=s,r},l.prototype.clone=function(e){return r(e)||(e=new l),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e},l.prototype.equals=function(e){return r(e)&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far},l}),i("Widgets/getElement",["../Core/DeveloperError"],function(e){"use strict";function t(e){if("string"==typeof e){var t=document.getElementById(e);e=t}return e}return t}),i("Scene/PerformanceDisplay",["../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/getTimestamp","../Widgets/getElement"],function(e,t,i,r,n,o,a){"use strict";function s(e){e=t(e,t.EMPTY_OBJECT);var r=a(e.container);if(!i(r))throw new n("container is required");this._container=r;var o=document.createElement("div");o.className="cesium-performanceDisplay";var s=document.createElement("div");s.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),s.appendChild(this._fpsText);var l=document.createElement("div");l.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),l.appendChild(this._msText),o.appendChild(l),o.appendChild(s),this._container.appendChild(o),this._lastFpsSampleTime=void 0,this._frameCount=0,this._time=void 0,this._fps=0,this._frameTime=0}return s.prototype.update=function(){if(!i(this._time))return this._lastFpsSampleTime=o(),void(this._time=o());var e=this._time,t=o();this._time=t;var r=t-e;this._frameCount++;var n=this._fps,a=t-this._lastFpsSampleTime;a>1e3&&(n=1e3*this._frameCount/a|0,this._lastFpsSampleTime=t,this._frameCount=0),n!==this._fps&&(this._fpsText.nodeValue=n+" FPS",this._fps=n),r!==this._frameTime&&(this._msText.nodeValue=r.toFixed(2)+" MS",this._frameTime=r)},s.prototype.destroy=function(){return r(this)},s}),i("Scene/PickDepth",["../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/PixelFormat","../Renderer/Framebuffer","../Renderer/PixelDatatype","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(){this.framebuffer=void 0,this._depthTexture=void 0,this._textureToCopy=void 0,this._copyDepthCommand=void 0,this._debugPickDepthViewportCommand=void 0}function c(t,i,r){if(!e(t._debugPickDepthViewportCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";t._debugPickDepthViewportCommand=i.createViewportQuadCommand(n,{uniformMap:{u_texture:function(){return t._depthTexture}},owner:t})}t._debugPickDepthViewportCommand.execute(i,r)}function h(e){e._depthTexture=e._depthTexture&&!e._depthTexture.isDestroyed()&&e._depthTexture.destroy()}function d(e){e.framebuffer=e.framebuffer&&!e.framebuffer.isDestroyed()&&e.framebuffer.destroy()}function p(e,t,i,n){e._depthTexture=new s({context:t,width:i,height:n,pixelFormat:r.RGBA,pixelDatatype:o.UNSIGNED_BYTE})}function m(e,t,i,r){h(e),d(e),p(e,t,i,r),e.framebuffer=new n({context:t,colorTextures:[e._depthTexture],destroyAttachments:!1})}function f(t,i,r){var n=r.width,o=r.height,a=t._depthTexture,s=!e(a)||a.width!==n||a.height!==o;(!e(t.framebuffer)||s)&&m(t,i,n,o)}function v(t,i,r){if(!e(t._copyDepthCommand)){var n="uniform sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";t._copyDepthCommand=i.createViewportQuadCommand(n,{renderState:a.fromCache(),uniformMap:{u_texture:function(){return t._textureToCopy}},owner:t})}t._textureToCopy=r,t._copyDepthCommand.framebuffer=t.framebuffer}return u.prototype.executeDebugPickDepth=function(e,t){c(this,e,t)},u.prototype.update=function(e,t){f(this,e,t),v(this,e,t)},u.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)},u.prototype.isDestroyed=function(){return!1},u.prototype.destroy=function(){return h(this),d(this),this._copyDepthCommand.shaderProgram=e(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy(),i(this)},u}),i("Shaders/Appearances/PointAppearanceFS",[],function(){"use strict";return"uniform vec4 highlightColor;\nvarying vec3 v_color;\nvoid main()\n{\ngl_FragColor = vec4(v_color * highlightColor.rgb, highlightColor.a);\n}\n"}),i("Shaders/Appearances/PointAppearanceVS",[],function(){"use strict";return"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 color;\nuniform float pointSize;\nvarying vec3 v_positionEC;\nvarying vec3 v_color;\nvoid main()\n{\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * czm_computePosition();\ngl_PointSize = pointSize;\n}\n"}),i("Scene/PointAppearance",["../Core/clone","../Core/Color","../Core/combine","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/VertexFormat","../Shaders/Appearances/PointAppearanceFS","../Shaders/Appearances/PointAppearanceVS","./Appearance"],function(e,t,i,r,n,o,a,s,l,u){"use strict";function c(e){e=r(e,r.EMPTY_OBJECT),this._vertexShaderSource=r(e.vertexShaderSource,l),this._fragmentShaderSource=r(e.fragmentShaderSource,s),this._renderState=u.getDefaultRenderState(!1,!1,e.renderState),this._pointSize=r(e.pointSize,2),this._highlightColor=n(e.highlightColor)?e.highlightColor:new t,this.material=void 0,this.translucent=r(e.translucent,!1),this.uniforms={highlightColor:this._highlightColor,pointSize:this._pointSize};var o=e.uniforms;this.uniforms=i(this.uniforms,o,!0)}return o(c.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return!1}},vertexFormat:{get:function(){return c.VERTEX_FORMAT}},pixelSize:{get:function(){return this._pointSize}}}),c.VERTEX_FORMAT=a.POSITION_AND_COLOR,c.prototype.getFragmentShaderSource=u.prototype.getFragmentShaderSource,c.prototype.isTranslucent=u.prototype.isTranslucent,c.prototype.getRenderState=u.prototype.getRenderState,c}),i("Scene/PrimitiveCollection",["../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError"],function(e,t,i,r,n,o){"use strict";function a(i){i=t(i,t.EMPTY_OBJECT),this._primitives=[],this._guid=e(),this.show=t(i.show,!0),this.destroyPrimitives=t(i.destroyPrimitives,!0)}function s(e,t){return e._primitives.indexOf(t)}return r(a.prototype,{length:{get:function(){return this._primitives.length}}}),a.prototype.add=function(e){var t=e._external=e._external||{},i=t._composites=t._composites||{};return i[this._guid]={collection:this},this._primitives.push(e),e},a.prototype.remove=function(e){if(this.contains(e)){var t=this._primitives.indexOf(e);if(-1!==t)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1},a.prototype.removeAndDestroy=function(e){var t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t},a.prototype.removeAll=function(){if(this.destroyPrimitives)for(var e=this._primitives,t=e.length,i=0;t>i;++i)e[i].destroy();this._primitives=[]},a.prototype.contains=function(e){return!!(i(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])},a.prototype.raise=function(e){if(i(e)){var t=s(this,e),r=this._primitives;if(t!==r.length-1){var n=r[t];r[t]=r[t+1],r[t+1]=n}}},a.prototype.raiseToTop=function(e){if(i(e)){var t=s(this,e),r=this._primitives;t!==r.length-1&&(r.splice(t,1),r.push(e))}},a.prototype.lower=function(e){if(i(e)){var t=s(this,e),r=this._primitives;if(0!==t){var n=r[t];r[t]=r[t-1],r[t-1]=n}}},a.prototype.lowerToBottom=function(e){if(i(e)){var t=s(this,e),r=this._primitives;0!==t&&(r.splice(t,1),r.unshift(e))}},a.prototype.get=function(e){return this._primitives[e]},a.prototype.update=function(e){if(this.show)for(var t=this._primitives,i=0;i<t.length;++i)t[i].update(e)},a.prototype.isDestroyed=function(){return!1},a.prototype.destroy=function(){return this.removeAll(),n(this)},a}),i("Scene/QuadtreeTileProvider",["../Core/defineProperties","../Core/DeveloperError"],function(e,t){"use strict";function i(){t.throwInstantiationError()}return i.computeDefaultLevelZeroMaximumGeometricError=function(e){return 2*e.ellipsoid.maximumRadius*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))},e(i.prototype,{quadtree:{get:t.throwInstantiationError,set:t.throwInstantiationError},ready:{get:t.throwInstantiationError},tilingScheme:{get:t.throwInstantiationError},errorEvent:{get:t.throwInstantiationError}}),i.prototype.beginUpdate=t.throwInstantiationError,i.prototype.endUpdate=t.throwInstantiationError,i.prototype.getLevelMaximumGeometricError=t.throwInstantiationError,i.prototype.loadTile=t.throwInstantiationError,i.prototype.computeTileVisibility=t.throwInstantiationError,i.prototype.showTileThisFrame=t.throwInstantiationError,i.prototype.computeDistanceToTile=t.throwInstantiationError,i.prototype.isDestroyed=t.throwInstantiationError,i.prototype.destroy=t.throwInstantiationError,i}),i("Scene/SceneTransitioner",["../Core/Cartesian3","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/EasingFunction","../Core/Ellipsoid","../Core/Math","../Core/Matrix4","../Core/ScreenSpaceEventHandler","../Core/ScreenSpaceEventType","./Camera","./OrthographicFrustum","./PerspectiveFrustum","./SceneMode"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m){"use strict";function f(i,r){this._scene=i,r=t(r,a.WGS84);var n=r.maximumRadius,o=new e(0,0,2*n),u=new e;u=e.normalize(e.negate(o,u),u);var c=e.clone(e.UNIT_Y),m=l.multiplyByPoint(h.TRANSFORM_2D,o,new e),f=l.multiplyByPointAsVector(h.TRANSFORM_2D,u,new e),v=l.multiplyByPointAsVector(h.TRANSFORM_2D,c,new e),g=new d;g.right=n*Math.PI,g.left=-g.right,g.top=g.right*(i.drawingBufferHeight/i.drawingBufferWidth),g.bottom=-g.top,this._camera2D={position:o,direction:u,up:c,position2D:m,direction2D:f,up2D:v,frustum:g},o=new e(0,-1,1),o=e.multiplyByScalar(e.normalize(o,o),5*n,o),u=new e,u=e.normalize(e.subtract(e.ZERO,o,u),u);var _=new e;_=e.normalize(e.cross(u,e.UNIT_Z,_),_),c=new e,c=e.normalize(e.cross(_,u,c),c),m=l.multiplyByPoint(h.TRANSFORM_2D,o,new e),f=l.multiplyByPointAsVector(h.TRANSFORM_2D,u,new e);var y=l.multiplyByPointAsVector(h.TRANSFORM_2D,_,new e);v=new e,v=e.normalize(e.cross(y,f,v),v),g=new p,g.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,g.fov=s.toRadians(60),this._cameraCV={position:o,direction:u,up:c,position2D:m,direction2D:f,up2D:v,frustum:g},o=new e,o=e.multiplyByScalar(e.normalize(new e(0,-2,1),o),2*n,o),u=new e,u=e.normalize(e.subtract(e.ZERO,o,u),u),_=new e,_=e.normalize(e.cross(u,e.UNIT_Z,_),_),c=new e,c=e.normalize(e.cross(_,u,c),c),this._camera3D={position:o,direction:u,up:c,frustum:g},this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0}function v(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new u(e._scene.canvas,!1);var i=function(){e._morphCancelled=!0,t(e)};e._completeMorph=i,e._morphHandler.setInputAction(i,c.LEFT_DOWN), e._morphHandler.setInputAction(i,c.MIDDLE_DOWN),e._morphHandler.setInputAction(i,c.RIGHT_DOWN),e._morphHandler.setInputAction(i,c.WHEEL)}}function g(e){for(var t=e._currentTweens,i=0;i<t.length;++i)t[i].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}function _(t,i,r,n){function a(t){u.position=C(c,p,t.time),u.direction=C(h,m,t.time),u.up=C(d,f,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY);var c=u.position,h=u.direction,d=u.up,p=e.clone(t._camera2D.position),m=e.clone(t._camera2D.direction),f=e.clone(t._camera2D.up),v=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:a});t._currentTweens.push(v),A(t,s,0,1,i,n)}function y(e,t,i,r){t*=.5;var n=e._scene.camera;n._setTransform(l.IDENTITY),T(e,t,i,function(){n.frustum=e._cameraCV.frustum.clone(),_(e,t,i,r)})}function C(t,i,r){return e.lerp(t,i,r,new e)}function E(t,i,r){function n(t){l.frustum.fov=s.lerp(c,h,t.time);var i=d/Math.tan(.5*l.frustum.fov),r=new e;l.position=e.multiplyByScalar(e.normalize(l.position,r),i,r)}var a=t._scene,l=a.camera,u=l.position,c=l.frustum.fov,h=.5*s.RADIANS_PER_DEGREE,d=e.magnitude(u)*Math.tan(.5*c);l.frustum.far=d/Math.tan(.5*h)+1e7;var p=a.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:n,complete:function(){l.frustum=t._camera2D.frustum.clone(),r(t)}});t._currentTweens.push(p)}function S(t,i,r,n){function a(t){u.position=C(h,g,t.time),u.direction=C(d,_,t.time),u.up=C(p,y,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY);var c=r.maximumRadius,h=e.clone(u.position),d=e.clone(u.direction),p=e.clone(u.up),m=Math.tan(.5*t._cameraCV.frustum.fovy),f=t._cameraCV.frustum.aspectRatio*m,v=c*Math.PI/f,g=new e;g=e.multiplyByScalar(e.normalize(t._camera2D.position,g),v,g);var _=e.clone(t._camera2D.direction),y=e.clone(t._camera2D.up);i*=.5;var S=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:a,complete:function(){E(t,i,n)}});t._currentTweens.push(S)}function w(t,i,r,n){function o(){E(t,i,n)}i*=.5;var a=r.maximumRadius,s=Math.tan(.5*t._camera3D.frustum.fovy),l=t._camera3D.frustum.aspectRatio*s,u=a*Math.PI/l,c={},h=new e;c.position2D=e.multiplyByScalar(e.normalize(t._camera2D.position2D,h),u,h),c.direction2D=e.clone(t._camera2D.direction2D),c.up2D=e.clone(t._camera2D.up2D),b(t,i,c,o)}function T(t,i,r,n){function a(e){u.position=C(S,m,e.time),u.frustum.top=s.lerp(f,y.top,e.time),u.frustum.bottom=s.lerp(v,y.bottom,e.time),u.frustum.right=s.lerp(g,y.right,e.time),u.frustum.left=s.lerp(_,y.left,e.time)}var l=t._scene,u=l.camera,c=r.maximumRadius,h=Math.tan(.5*t._cameraCV.frustum.fovy),d=t._cameraCV.frustum.aspectRatio*h,p=c*Math.PI/d,m=new e;m=e.multiplyByScalar(e.normalize(t._camera2D.position,m),p,m);var f=u.frustum.top,v=u.frustum.bottom,g=u.frustum.right,_=u.frustum.left,y=t._camera2D.frustum,E=t._cameraCV.frustum,S=e.clone(u.position),w=(g-_)/(2*c*Math.PI),T=1;w>T&&(w=0);var x=(T-w)*i;if(x<s.EPSILON6){if(e.equalsEpsilon(S,m,s.EPSILON6))return u.position=m,u.frustum=E.clone(),void n(t);x=i,w=0,T=1}var b=l.tweens.add({easingFunction:o.QUARTIC_OUT,duration:x,startObject:{time:w},stopObject:{time:T},update:a,complete:function(){u.frustum=E.clone(),n(t)}});t._currentTweens.push(b)}function x(t,i,r,n){function a(){function r(t){u.position=C(a,h,t.time),u.direction=C(l,d,t.time),u.up=C(c,p,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var a=e.clone(u.position),l=e.clone(u.direction),c=e.clone(u.up),h=e.clone(t._cameraCV.position),d=e.clone(t._cameraCV.direction),p=e.clone(t._cameraCV.up),m=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:r,complete:function(){n(t)}});t._currentTweens.push(m)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY),i*=.5,T(t,i,r,a)}function b(t,i,r,n){function a(t){u.position=C(c,p,t.time),u.direction=C(h,m,t.time),u.up=C(d,f,t.time),u.right=e.cross(u.direction,u.up,u.right),e.normalize(u.right,u.right)}var s=t._scene,u=s.camera;u._setTransform(l.IDENTITY);var c=e.clone(u.position),h=e.clone(u.direction),d=e.clone(u.up),p=e.clone(r.position2D),m=e.clone(r.direction2D),f=e.clone(r.up2D),v=s.tweens.add({duration:i,easingFunction:o.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:a,complete:function(){u.position=p,u.direction=m,u.up=f,u.right=e.cross(m,f,u.right),e.normalize(u.right,u.right)}});t._currentTweens.push(v),A(t,s,1,0,i,n)}function A(e,t,r,n,a,s){var l={object:t,property:"morphTime",startValue:r,stopValue:n,duration:a,easingFunction:o.QUARTIC_OUT};i(s)&&(l.complete=function(){s(e)});var u=t.tweens.addProperty(l);e._currentTweens.push(u)}function P(e){var t=e._scene,i=t.drawingBufferHeight/t.drawingBufferWidth,r=e._camera2D.frustum;r.top=r.right*i,r.bottom=-r.top,i=1/i,r=e._cameraCV.frustum,r.aspectRatio=i,r=e._camera3D.frustum,r.aspectRatio=i;var n=t.camera;switch(t.mode){case m.SCENE3D:n.frustum=e._camera3D.frustum.clone();break;case m.COLUMBUS_VIEW:n.frustum=e._cameraCV.frustum.clone();break;case m.SCENE2D:n.frustum=e._camera2D.frustum.clone()}}function I(t){var r=t._scene;if(r._mode=m.SCENE3D,r.morphTime=m.getMorphTime(m.SCENE3D),g(t),P(t),t._previousMode!==m.MORPHING||t._morphCancelled){t._morphCancelled=!1;var n=r.camera;n.position=e.clone(t._camera3D.position),n.direction=e.clone(t._camera3D.direction),n.up=e.clone(t._camera3D.up),n.right=e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right)}var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.SCENE3D,o)}function M(t){var r=t._scene;r._mode=m.SCENE2D,r.morphTime=m.getMorphTime(m.SCENE2D),g(t),P(t);var n=r.camera;e.clone(t._camera2D.position,n.position),e.clone(t._camera2D.direction,n.direction),e.clone(t._camera2D.up,n.up),e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right);var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.SCENE2D,o)}function D(t){var r=t._scene;if(r._mode=m.COLUMBUS_VIEW,r.morphTime=m.getMorphTime(m.COLUMBUS_VIEW),g(t),P(t),t._previousModeMode!==m.MORPHING||t._morphCancelled){t._morphCancelled=!1;var n=r.camera;e.clone(t._cameraCV.position,n.position),e.clone(t._cameraCV.direction,n.direction),e.clone(t._cameraCV.up,n.up),e.cross(n.direction,n.up,n.right),e.normalize(n.right,n.right)}var o=i(t._completeMorph);t._completeMorph=void 0,r.camera.update(r.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,m.COLUMBUS_VIEW,o)}return f.prototype.completeMorph=function(){i(this._completeMorph)&&this._completeMorph()},f.prototype.morphTo2D=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.SCENE2D&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.SCENE2D,!0),P(this),r._mode=m.MORPHING,v(this,M),this._previousMode===m.COLUMBUS_VIEW?S(this,e,t,M):w(this,e,t,M),0===e&&i(this._completeMorph)&&this._completeMorph())},f.prototype.morphToColumbusView=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.COLUMBUS_VIEW&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.COLUMBUS_VIEW,!0),P(this),r._mode=m.MORPHING,v(this,D),this._previousMode===m.SCENE2D?x(this,e,t,D):b(this,e,this._cameraCV,D),0===e&&i(this._completeMorph)&&this._completeMorph())},f.prototype.morphTo3D=function(e,t){i(this._completeMorph)&&this._completeMorph();var r=this._scene;this._previousMode=r.mode,this._previousMode!==m.SCENE3D&&this._previousMode!==m.MORPHING&&(this._scene.morphStart.raiseEvent(this,this._previousMode,m.SCENE3D,!0),P(this),r._mode=m.MORPHING,v(this,I),this._previousMode===m.SCENE2D?y(this,e,t,I):_(this,e,t,I),0===e&&i(this._completeMorph)&&this._completeMorph())},f.prototype.isDestroyed=function(){return!1},f.prototype.destroy=function(){return g(this),r(this)},f}),i("Scene/TweenCollection",["../Core/clone","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/DeveloperError","../Core/EasingFunction","../Core/getTimestamp","../Core/TimeConstants","../ThirdParty/Tween"],function(e,t,i,r,n,o,a,s,l){"use strict";function u(t,i,r,n,o,a,s,l,u,c){this._tweens=t,this._tweenjs=i,this._startObject=e(r),this._stopObject=e(n),this._duration=o,this._delay=a,this._easingFunction=s,this._update=l,this._complete=u,this.cancel=c,this.needsStart=!0}function c(){this._tweens=[]}return r(u.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}}),u.prototype.cancelTween=function(){this._tweens.remove(this)},r(c.prototype,{length:{get:function(){return this._tweens.length}}}),c.prototype.add=function(r){if(r=t(r,t.EMPTY_OBJECT),0===r.duration)return i(r.complete)&&r.complete(),new u(this);var n=r.duration/s.SECONDS_PER_MILLISECOND,a=t(r.delay,0),c=a/s.SECONDS_PER_MILLISECOND,h=t(r.easingFunction,o.LINEAR_NONE),d=r.startObject,p=new l.Tween(d);p.to(e(r.stopObject),n),p.delay(c),p.easing(h),i(r.update)&&p.onUpdate(function(){r.update(d)}),p.onComplete(t(r.complete,null)),p.repeat(t(r._repeat,0));var m=new u(this,p,r.startObject,r.stopObject,r.duration,a,h,r.update,r.complete,r.cancel);return this._tweens.push(m),m},c.prototype.addProperty=function(e){function i(e){r[n]=e.value}e=t(e,t.EMPTY_OBJECT);var r=e.object,n=e.property,o=e.startValue,a=e.stopValue;return this.add({startObject:{value:o},stopObject:{value:a},duration:t(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})},c.prototype.addAlpha=function(e){function r(e){for(var t=o.length,i=0;t>i;++i)n.uniforms[o[i]].alpha=e.alpha}e=t(e,t.EMPTY_OBJECT);var n=e.material,o=[];for(var a in n.uniforms)n.uniforms.hasOwnProperty(a)&&i(n.uniforms[a])&&i(n.uniforms[a].alpha)&&o.push(a);return this.add({startObject:{alpha:t(e.startValue,0)},stopObject:{alpha:t(e.stopValue,1)},duration:t(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel})},c.prototype.addOffsetIncrement=function(e){e=t(e,t.EMPTY_OBJECT);var i=e.material,r=i.uniforms;return this.addProperty({object:r,property:"offset",startValue:r.offset,stopValue:r.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})},c.prototype.remove=function(e){if(!i(e))return!1;var t=this._tweens.indexOf(e);return-1!==t?(e.tweenjs.stop(),i(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1},c.prototype.removeAll=function(){for(var e=this._tweens,t=0;t<e.length;++t){var r=e[t];r.tweenjs.stop(),i(r.cancel)&&r.cancel()}e.length=0},c.prototype.contains=function(e){return i(e)&&-1!==this._tweens.indexOf(e)},c.prototype.get=function(e){return this._tweens[e]},c.prototype.update=function(e){var t=this._tweens,r=0;for(e=i(e)?e/s.SECONDS_PER_MILLISECOND:a();r<t.length;){var n=t[r],o=n.tweenjs;n.needsStart?(n.needsStart=!1,o.start(e)):o.update(e)?r++:(o.stop(),t.splice(r,1))}},c}),i("Scene/ScreenSpaceCameraController",["../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Cartographic","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/DeveloperError","../Core/Ellipsoid","../Core/IntersectionTests","../Core/isArray","../Core/KeyboardEventModifier","../Core/Math","../Core/Matrix3","../Core/Matrix4","../Core/Plane","../Core/Quaternion","../Core/Ray","../Core/Transforms","./CameraEventAggregator","./CameraEventType","./SceneMode","./SceneTransforms","./TweenCollection"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w){"use strict";function T(i){this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=C.LEFT_DRAG,this.zoomEventTypes=[C.RIGHT_DRAG,C.WHEEL,C.PINCH],this.rotateEventTypes=C.LEFT_DRAG,this.tiltEventTypes=[C.MIDDLE_DRAG,C.PINCH,{eventType:C.LEFT_DRAG,modifier:h.CTRL},{eventType:C.RIGHT_DRAG,modifier:h.CTRL}],this.lookEventTypes={eventType:C.LEFT_DRAG,modifier:h.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=i,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new y(i.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._tweens=new w,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new e(-1,-1),this._tiltCenter=new t,this._rotateMousePosition=new e(-1,-1),this._rotateStartPosition=new t,this._strafeStartPosition=new t,this._zoomMouseStart=new e,this._zoomWorldPosition=new t,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._rotatingZoom=!1;var n=i.mapProjection;this._maxCoord=n.project(new r(Math.PI,d.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=2e-4,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3}function x(e,t){if(0>e)return 0;var i=25*(1-t);return Math.exp(-i*e)}function b(t){return e.equalsEpsilon(t.startPosition,t.endPosition,d.EPSILON14)}function A(t,i,r,n,a,s,l){var u=s[l];o(u)||(u=s[l]={startPosition:new e,endPosition:new e,motion:new e,active:!1});var c=t.getButtonPressTime(i,r),h=t.getButtonReleaseTime(i,r),d=c&&h&&(h.getTime()-c.getTime())/1e3,p=new Date,m=h&&(p.getTime()-h.getTime())/1e3;if(c&&h&&$>d){var f=x(m,n);if(u.active)u.startPosition=e.clone(u.endPosition,u.startPosition),u.endPosition=e.multiplyByScalar(u.motion,f,u.endPosition),u.endPosition=e.add(u.startPosition,u.endPosition,u.endPosition),u.motion=e.clone(e.ZERO,u.motion);else{var v=t.getLastMovement(i,r);if(!o(v)||b(v))return;u.motion.x=.5*(v.endPosition.x-v.startPosition.x),u.motion.y=.5*(v.endPosition.y-v.startPosition.y),u.startPosition=e.clone(v.startPosition,u.startPosition),u.endPosition=e.multiplyByScalar(u.motion,f,u.endPosition),u.endPosition=e.add(u.startPosition,u.endPosition,u.endPosition),u.active=!0}if(isNaN(u.endPosition.x)||isNaN(u.endPosition.y)||e.distance(u.startPosition,u.endPosition)<.5)return void(u.active=!1);if(!t.isButtonDown(i,r)){var g=t.getStartMousePosition(i,r);a(s,g,u)}}else u.active=!1}function P(e,t,i,r,n,a){if(o(i)){var s=e._aggregator;c(i)||(ee[0]=i,i=ee);for(var l=i.length,u=0;l>u;++u){var h=i[u],d=o(h.eventType)?h.eventType:h,p=h.modifier,m=s.isMoving(d,p)&&s.getMovement(d,p),f=s.getStartMousePosition(d,p);e.enableInputs&&t&&(m?r(e,f,m):1>n&&A(s,d,p,n,r,e,a))}}}function I(i,r,n,a,s,l){var u=1;o(l)&&(u=d.clamp(Math.abs(l),.25,1));var c=i.minimumZoomDistance*u,h=i.maximumZoomDistance,p=s-c,m=a*p;m=d.clamp(m,i._minimumZoomRate,i._maximumZoomRate);var f=n.endPosition.y-n.startPosition.y,v=f/i._scene.canvas.clientHeight;v=Math.min(v,i.maximumMovementRatio);var g=m*v;if(!(g>0&&Math.abs(s-c)<1||0>g&&Math.abs(s-h)<1)){c>s-g?g=s-c-1:s-g>h&&(g=s-h);var _,y=i._scene,C=y.camera,w=y.mode;if(o(i._globe)&&(_=w!==E.SCENE2D?L(i,r,ie):C.getPickRay(r,te).origin),!o(_))return void C.zoomIn(g);var T=e.equals(r,i._zoomMouseStart),x=i._zoomingOnVector,b=i._rotatingZoom;T||(i._zoomMouseStart=e.clone(r,i._zoomMouseStart),i._zoomWorldPosition=t.clone(_,i._zoomWorldPosition),x=i._zoomingOnVector=!1,b=i._rotatingZoom=!1);var A=w===E.COLUMBUS_VIEW;if(!T||b){if(w===E.SCENE2D){var P=i._zoomWorldPosition,I=C.position;if(!t.equals(P,I)){var M=t.subtract(P,I,ne);t.normalize(M,M);var D=t.distance(P,I)*g/(.5*C.getMagnitude());C.move(M,.5*D)}}else if(w===E.SCENE3D){var R=t.normalize(C.position,ce);if(C.positionCartographic.height<3e3&&Math.abs(t.dot(C.direction,R))<.6)A=!0;else{var O=y.canvas,N=oe;N.x=O.clientWidth/2,N.y=O.clientHeight/2;var F=L(i,N,ae);if(o(F)){var B=t.normalize(F,se),V=t.normalize(i._zoomWorldPosition,le),k=t.dot(V,B);if(k>0){var z=d.acosClamped(k),U=t.cross(V,B,ue),G=Math.abs(z)>d.toRadians(20)?.75*C.positionCartographic.height:C.positionCartographic.height-g,W=g/G;C.rotate(U,z*W)}}else A=!0}}i._rotatingZoom=!A}if(!T&&A||x){var H,q=S.wgs84ToWindowCoordinates(y,i._zoomWorldPosition,re);H=w!==E.COLUMBUS_VIEW&&e.equals(r,i._zoomMouseStart)&&o(q)?C.getPickRay(q,te):C.getPickRay(r,te);var j=H.direction;w===E.COLUMBUS_VIEW&&t.fromElements(j.y,j.z,j.x,j),C.move(j,g),i._zoomingOnVector=!0}else C.zoomIn(g)}}function M(e,i,r){var n=e._scene,o=n.camera,a=o.getPickRay(r.startPosition,he).origin,s=o.getPickRay(r.endPosition,de).origin,l=t.subtract(a,s,pe),u=t.magnitude(l);u>0&&(t.normalize(l,l),o.move(l,u))}function D(e,t,i){o(i.distance)&&(i=i.distance);var r=e._scene,n=r.camera;I(e,t,i,e._zoomFactor,n.getMagnitude())}function R(t,i,r){if(o(r.angleAndHeight))return void O(t,i,r.angleAndHeight);var n=t._scene,a=n.camera,s=n.canvas,l=s.clientWidth,u=s.clientHeight,c=me;c.x=2/l*r.startPosition.x-1,c.y=2/u*(u-r.startPosition.y)-1,c=e.normalize(c,c);var h=fe;h.x=2/l*r.endPosition.x-1,h.y=2/u*(u-r.endPosition.y)-1,h=e.normalize(h,h);var p=d.acosClamped(c.x);c.y<0&&(p=d.TWO_PI-p);var m=d.acosClamped(h.x);h.y<0&&(m=d.TWO_PI-m);var f=m-p;a.twistRight(f)}function O(e,t,i){var r=e._rotateFactor*e._rotateRateRangeAdjustment;r>e._maximumRotateRate&&(r=e._maximumRotateRate),r<e._minimumRotateRate&&(r=e._minimumRotateRate);var n=e._scene,o=n.camera,a=n.canvas,s=(i.endPosition.x-i.startPosition.x)/a.clientWidth;s=Math.min(s,e.maximumMovementRatio);var l=r*s*Math.PI*4;o.twistRight(l)}function N(e){var t=e._tweens;e._aggregator.anyButtonDown&&t.removeAll();var i=e._scene,r=i.camera;if(t.contains(e._tween)||(m.equals(m.IDENTITY,r.transform)?(P(e,e.enableTranslate,e.translateEventTypes,M,e.inertiaTranslate,"_lastInertiaTranslateMovement"),P(e,e.enableZoom,e.zoomEventTypes,D,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableRotate,e.tiltEventTypes,R,e.inertiaSpin,"_lastInertiaTiltMovement")):(P(e,e.enableRotate,e.translateEventTypes,R,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,D,e.inertiaZoom,"_lastInertiaZoomMovement"))),!(e._aggregator.anyButtonDown||o(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||o(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||t.contains(e._tween))){var n=r.createCorrectPositionTween(e.bounceAnimationTime);o(n)&&(e._tween=t.add(n))}t.update()}function L(e,i,r){var n=e._scene,a=e._globe,s=n.camera;if(o(a)){var l;n.pickPositionSupported&&(l=n.pickPosition(i,ge));var u=s.getPickRay(i,ve),c=a.pick(u,n,_e),h=o(l)?t.distance(l,s.positionWC):Number.POSITIVE_INFINITY,d=o(c)?t.distance(c,s.positionWC):Number.POSITIVE_INFINITY;return d>h?t.clone(l,r):t.clone(c,r)}}function F(i,r,n){if(t.equals(r,i._translateMousePosition)||(i._looking=!1),t.equals(r,i._strafeMousePosition)||(i._strafing=!1),i._looking)return void K(i,r,n);if(i._strafing)return void G(i,r,n);var a,s=i._scene,l=s.camera,c=e.clone(n.startPosition,be),h=e.clone(n.endPosition,Ae),p=l.getPickRay(c,ye),m=t.clone(t.ZERO,Te),v=t.UNIT_X;if(l.position.z<i._minimumPickingTerrainHeight&&(a=L(i,c,Ee),o(a)&&(m.x=a.x)),m.x>l.position.z&&o(a))return t.clone(a,i._strafeStartPosition),i._strafing=!0,G(i,r,n),void(i._strafeMousePosition=e.clone(r,i._strafeMousePosition));var g=f.fromPointNormal(m,v,xe);p=l.getPickRay(c,ye);var _=u.rayPlane(p,g,Ee),y=l.getPickRay(h,Ce),C=u.rayPlane(y,g,Se);if(!o(_)||!o(C))return i._looking=!0,K(i,r,n),void e.clone(r,i._translateMousePosition);var E=t.subtract(_,C,we),S=E.x;E.x=E.y,E.y=E.z,E.z=S;var w=t.magnitude(E);w>d.EPSILON6&&(t.normalize(E,E),l.move(E,w))}function B(t,i,r){if(o(r.angleAndHeight)&&(r=r.angleAndHeight),e.equals(i,t._tiltCenterMousePosition)||(t._tiltCVOffMap=!1,t._looking=!1),t._looking)return void K(t,i,r);var n=t._scene,a=n.camera,s=t._maxCoord,l=Math.abs(a.position.x)-s.x<0&&Math.abs(a.position.y)-s.y<0;t._tiltCVOffMap||!l||a.position.z>t._minimumPickingTerrainHeight?(t._tiltCVOffMap=!0,V(t,i,r)):k(t,i,r)}function V(i,r,n){var a=i._scene,s=a.camera,u=a.canvas,c=Pe;c.x=u.clientWidth/2,c.y=u.clientHeight/2;var h,p=s.getPickRay(c,Ie),f=t.UNIT_X,v=p.origin,g=p.direction,y=t.dot(f,g);if(Math.abs(y)>d.EPSILON6&&(h=-t.dot(f,v)/y),!o(h)||0>=h)return i._looking=!0,K(i,r,n),void e.clone(r,i._tiltCenterMousePosition);var C=t.multiplyByScalar(g,h,Me);t.add(v,C,C);var E=a.mapProjection,S=E.ellipsoid;t.fromElements(C.y,C.z,C.x,C);var w=E.unproject(C,Be);S.cartographicToCartesian(w,C);var T=_.eastNorthUpToFixedFrame(C,S,Re),x=i._globe,b=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var A=m.clone(s.transform,Ve);s._setTransform(T),H(i,r,n,t.UNIT_Z),s._setTransform(A),i._globe=x,i._ellipsoid=b;var P=b.maximumRadius;i._rotateFactor=1/P,i._rotateRateRangeAdjustment=P}function k(i,r,n){var a,s,c=i._ellipsoid,h=i._scene,g=h.camera,y=t.UNIT_X;if(e.equals(r,i._tiltCenterMousePosition))a=t.clone(i._tiltCenter,Me);else{if(g.position.z<i._minimumPickingTerrainHeight&&(a=L(i,r,Me)),!o(a)){s=g.getPickRay(r,Ie);var C,E=s.origin,S=s.direction,w=t.dot(y,S);if(Math.abs(w)>d.EPSILON6&&(C=-t.dot(y,E)/w),!o(C)||0>=C)return i._looking=!0,K(i,r,n),void e.clone(r,i._tiltCenterMousePosition);a=t.multiplyByScalar(S,C,Me),t.add(E,a,a)}e.clone(r,i._tiltCenterMousePosition),t.clone(a,i._tiltCenter)}var T=h.canvas,x=Pe;x.x=T.clientWidth/2,x.y=i._tiltCenterMousePosition.y,s=g.getPickRay(x,Ie);var b=t.clone(t.ZERO,Ne);b.x=a.x;var A=f.fromPointNormal(b,y,Le),P=u.rayPlane(s,A,De),I=g._projection;c=I.ellipsoid,t.fromElements(a.y,a.z,a.x,a);var M=I.unproject(a,Be);c.cartographicToCartesian(M,a);var D,R=_.eastNorthUpToFixedFrame(a,c,Re);o(P)?(t.fromElements(P.y,P.z,P.x,P),M=I.unproject(P,Be),c.cartographicToCartesian(M,P),D=_.eastNorthUpToFixedFrame(P,c,Oe)):D=R;var O=i._globe,N=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var F=t.UNIT_Z,B=m.clone(g.transform,Ve);g._setTransform(R);var V=t.cross(t.UNIT_Z,t.normalize(g.position,Fe),Fe),k=t.dot(g.right,V);if(H(i,r,n,F,!1,!0),g._setTransform(D),0>k){n.startPosition.y>n.endPosition.y&&(F=void 0);var z=g.constrainedAxis;g.constrainedAxis=void 0,H(i,r,n,F,!0,!1),g.constrainedAxis=z}else H(i,r,n,F,!0,!1);if(o(g.constrainedAxis)){var U=t.cross(g.direction,g.constrainedAxis,vt);t.equalsEpsilon(U,t.ZERO,d.EPSILON6)||(t.dot(U,g.right)<0&&t.negate(U,U),t.cross(U,g.direction,g.up),t.cross(g.direction,g.up,g.right),t.normalize(g.up,g.up),t.normalize(g.right,g.right))}g._setTransform(B),i._globe=O,i._ellipsoid=N;var G=N.maximumRadius;i._rotateFactor=1/G,i._rotateRateRangeAdjustment=G;var W=t.clone(g.positionWC,Fe);if(J(i),!t.equals(g.positionWC,W)){g._setTransform(D),g.worldToCameraCoordinatesPoint(W,W);var q=t.magnitudeSquared(W);t.magnitudeSquared(g.position)>q&&(t.normalize(g.position,g.position),t.multiplyByScalar(g.position,Math.sqrt(q),g.position));var j=t.angleBetween(W,g.position),Y=t.cross(W,g.position,W);t.normalize(Y,Y);var X=v.fromAxisAngle(Y,j,ke),Z=p.fromQuaternion(X,ze);p.multiplyByVector(Z,g.direction,g.direction),p.multiplyByVector(Z,g.up,g.up),t.cross(g.direction,g.up,g.right),t.cross(g.right,g.direction,g.up),g._setTransform(B)}}function z(e,i,r){o(r.distance)&&(r=r.distance);var n=e._scene,a=n.camera,s=n.canvas,l=Ue;l.x=s.clientWidth/2,l.y=s.clientHeight/2;var u,c=a.getPickRay(l,Ge);a.position.z<e._minimumPickingTerrainHeight&&(u=L(e,l,We));var h;if(o(u))h=t.distance(c.origin,u);else{var d=t.UNIT_X,p=c.origin,m=c.direction;h=-t.dot(d,p)/t.dot(d,m)}I(e,i,r,e._zoomFactor,h)}function U(e){var t=e._scene,i=t.camera;if(m.equals(m.IDENTITY,i.transform)){var r=e._tweens;if(e._aggregator.anyButtonDown&&r.removeAll(),P(e,e.enableTilt,e.tiltEventTypes,B,e.inertiaSpin,"_lastInertiaTiltMovement"),P(e,e.enableTranslate,e.translateEventTypes,F,e.inertiaTranslate,"_lastInertiaTranslateMovement"),P(e,e.enableZoom,e.zoomEventTypes,z,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableLook,e.lookEventTypes,K),!(e._aggregator.anyButtonDown||o(e._lastInertiaZoomMovement)&&e._lastInertiaZoomMovement.active||o(e._lastInertiaTranslateMovement)&&e._lastInertiaTranslateMovement.active||r.contains(e._tween))){var n=i.createCorrectPositionTween(e.bounceAnimationTime);o(n)&&(e._tween=r.add(n))}r.update()}else P(e,e.enableRotate,e.rotateEventTypes,H,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,j,e.inertiaZoom,"_lastInertiaZoomMovement")}function G(e,i,r){var n=e._scene,a=n.camera,s=L(e,r.startPosition,Ke);if(o(s)){var l=r.endPosition,c=a.getPickRay(l,He),h=t.clone(a.direction,Ye);n.mode===E.COLUMBUS_VIEW&&t.fromElements(h.z,h.x,h.y,h);var d=f.fromPointNormal(s,h,qe),p=u.rayPlane(c,d,je);o(p)&&(h=t.subtract(s,p,h),n.mode===E.COLUMBUS_VIEW&&t.fromElements(h.y,h.z,h.x,h),t.add(a.position,h,a.position))}}function W(i,r,n){var a=i._scene,s=a.camera;if(!m.equals(s.transform,m.IDENTITY))return void H(i,r,n);var u,c,h,d,p=i._ellipsoid.geodeticSurfaceNormal(s.position,$e),f=i._ellipsoid.cartesianToCartographic(s.positionWC,Ze).height,v=i._globe,g=!1;if(o(v)&&f<i._minimumPickingTerrainHeight&&(d=L(i,n.startPosition,Ke),o(d))){var _=s.getPickRay(n.startPosition,ve),y=i._ellipsoid.geodeticSurfaceNormal(d);g=Math.abs(t.dot(_.direction,y))<.05,g&&!i._looking&&(i._rotating=!1,i._strafing=!0)}return e.equals(r,i._rotateMousePosition)?void(i._looking?K(i,r,n,p):i._rotating?H(i,r,n):i._strafing?(t.clone(d,i._strafeStartPosition),G(i,r,n)):(u=t.magnitude(i._rotateStartPosition),c=Qe,c.x=c.y=c.z=u,h=l.fromCartesian3(c,Je),q(i,r,n,h))):(i._looking=!1,i._rotating=!1,i._strafing=!1,o(v)&&f<i._minimumPickingTerrainHeight?o(d)?t.magnitude(s.position)<t.magnitude(d)?(t.clone(d,i._strafeStartPosition),i._strafing=!0,G(i,r,n)):(u=t.magnitude(d),c=Qe,c.x=c.y=c.z=u,h=l.fromCartesian3(c,Je),q(i,r,n,h),t.clone(d,i._rotateStartPosition)):(i._looking=!0,K(i,r,n,p)):o(s.pickEllipsoid(n.startPosition,i._ellipsoid,Xe))?(q(i,r,n,i._ellipsoid),t.clone(Xe,i._rotateStartPosition)):f>i._minimumTrackBallHeight?(i._rotating=!0,H(i,r,n)):(i._looking=!0,K(i,r,n,p)),void e.clone(r,i._rotateMousePosition))}function H(e,i,r,a,s,l){s=n(s,!1),l=n(l,!1);var u=e._scene,c=u.camera,h=u.canvas,d=c.constrainedAxis;o(a)&&(c.constrainedAxis=a);var p=t.magnitude(c.position),m=e._rotateFactor*(p-e._rotateRateRangeAdjustment);m>e._maximumRotateRate&&(m=e._maximumRotateRate),m<e._minimumRotateRate&&(m=e._minimumRotateRate);var f=(r.startPosition.x-r.endPosition.x)/h.clientWidth,v=(r.startPosition.y-r.endPosition.y)/h.clientHeight;f=Math.min(f,e.maximumMovementRatio),v=Math.min(v,e.maximumMovementRatio);var g=m*f*Math.PI*2,_=m*v*Math.PI;s||c.rotateRight(g),l||c.rotateUp(_),c.constrainedAxis=d}function q(i,r,n,a){var s=i._scene,l=s.camera,u=e.clone(n.startPosition,at),c=e.clone(n.endPosition,st),h=l.pickEllipsoid(u,a,et),p=l.pickEllipsoid(c,a,tt);if(!o(h)||!o(p))return i._rotating=!0,void H(i,r,n);if(h=l.worldToCameraCoordinates(h,h),p=l.worldToCameraCoordinates(p,p),o(l.constrainedAxis)){var m=l.constrainedAxis,f=t.mostOrthogonalAxis(m,it);t.cross(f,m,f),t.normalize(f,f);var v=t.cross(m,f,rt),g=t.magnitude(h),_=t.dot(m,h),y=Math.acos(_/g),C=t.multiplyByScalar(m,_,nt);t.subtract(h,C,C),t.normalize(C,C);var E=t.magnitude(p),S=t.dot(m,p),w=Math.acos(S/E),T=t.multiplyByScalar(m,S,ot);t.subtract(p,T,T),t.normalize(T,T);var x=Math.acos(t.dot(C,f));t.dot(C,v)<0&&(x=d.TWO_PI-x);var b=Math.acos(t.dot(T,f));t.dot(T,v)<0&&(b=d.TWO_PI-b);var A,P=x-b;A=t.equalsEpsilon(m,l.position,d.EPSILON2)?l.right:t.cross(m,l.position,it);var I,M=t.cross(m,A,it),D=t.dot(M,t.subtract(h,m,rt)),R=t.dot(M,t.subtract(p,m,rt));I=D>0&&R>0?w-y:D>0&&0>=R?t.dot(l.position,m)>0?-y-w:y+w:y-w,l.rotateRight(P),l.rotateUp(I)}else{t.normalize(h,h),t.normalize(p,p);var O=t.dot(h,p),N=t.cross(h,p,it);if(1>O&&!t.equalsEpsilon(N,t.ZERO,d.EPSILON14)){var L=Math.acos(O);l.rotate(N,L)}}}function j(e,i,r){o(r.distance)&&(r=r.distance);var n=e._ellipsoid,a=e._scene,s=a.camera,l=a.canvas,u=Ue;u.x=l.clientWidth/2,u.y=l.clientHeight/2;var c,h=s.getPickRay(u,Ge),d=n.cartesianToCartographic(s.position,ut).height;d<e._minimumPickingTerrainHeight&&(c=L(e,u,We));var p;p=o(c)?t.distance(h.origin,c):d;var m=t.normalize(s.position,lt);I(e,i,r,e._zoomFactor,p,t.dot(m,s.direction))}function Y(t,i,r){var n=t._scene,a=n.camera;if(m.equals(a.transform,m.IDENTITY)){if(o(r.angleAndHeight)&&(r=r.angleAndHeight),e.equals(i,t._tiltCenterMousePosition)||(t._tiltOnEllipsoid=!1,t._looking=!1),t._looking){var s=t._ellipsoid.geodeticSurfaceNormal(a.position,Et);return void K(t,i,r,s)}var l=t._ellipsoid,u=l.cartesianToCartographic(a.position,Ct);t._tiltOnEllipsoid||u.height>t._minimumCollisionTerrainHeight?(t._tiltOnEllipsoid=!0,X(t,i,r)):Z(t,i,r)}}function X(i,r,n){var a=i._ellipsoid,s=i._scene,c=s.camera,h=.25*i.minimumZoomDistance,p=a.cartesianToCartographic(c.positionWC,St).height;if(!(p-h-1<d.EPSILON3&&n.endPosition.y-n.startPosition.y<0)){var f=s.canvas,v=ct;v.x=f.clientWidth/2,v.y=f.clientHeight/2;var y,C=c.getPickRay(v,ht),E=u.rayEllipsoid(C,a);if(o(E))y=g.getPoint(C,E.start,dt);else{if(!(p>i._minimumTrackBallHeight)){i._looking=!0;var S=i._ellipsoid.geodeticSurfaceNormal(c.position,Et);return K(i,r,n,S),void e.clone(r,i._tiltCenterMousePosition)}var w=u.grazingAltitudeLocation(C,a);if(!o(w))return;var T=a.cartesianToCartographic(w,Ct);T.height=0,y=a.cartographicToCartesian(T,dt)}var x=_.eastNorthUpToFixedFrame(y,a,mt),b=i._globe,A=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var P=m.clone(c.transform,gt);c._setTransform(x),H(i,r,n,t.UNIT_Z),c._setTransform(P),i._globe=b,i._ellipsoid=A;var I=A.maximumRadius;i._rotateFactor=1/I,i._rotateRateRangeAdjustment=I}}function Z(i,r,n){var a,s,c,h=i._ellipsoid,f=i._scene,y=f.camera;if(e.equals(r,i._tiltCenterMousePosition))a=t.clone(i._tiltCenter,dt);else{if(a=L(i,r,dt),!o(a)){if(s=y.getPickRay(r,ht),c=u.rayEllipsoid(s,h),!o(c)){var C=h.cartesianToCartographic(y.position,Ct);if(C.height<=i._minimumTrackBallHeight){i._looking=!0;var E=i._ellipsoid.geodeticSurfaceNormal(y.position,Et);K(i,r,n,E),e.clone(r,i._tiltCenterMousePosition)}return}a=g.getPoint(s,c.start,dt)}e.clone(r,i._tiltCenterMousePosition),t.clone(a,i._tiltCenter)}var S=f.canvas,w=ct;w.x=S.clientWidth/2,w.y=i._tiltCenterMousePosition.y,s=y.getPickRay(w,ht);var T=t.magnitude(a),x=t.fromElements(T,T,T,Qe),b=l.fromCartesian3(x,Je);if(c=u.rayEllipsoid(s,b),o(c)){var A=t.magnitude(s.origin)>T?c.start:c.stop,P=g.getPoint(s,A,pt),I=_.eastNorthUpToFixedFrame(a,h,mt),M=_.eastNorthUpToFixedFrame(P,b,ft),D=i._globe,R=i._ellipsoid;i._globe=void 0,i._ellipsoid=l.UNIT_SPHERE,i._rotateFactor=1,i._rotateRateRangeAdjustment=1;var O=t.UNIT_Z,N=m.clone(y.transform,gt);y._setTransform(I);var F=t.cross(P,y.positionWC,vt),B=t.dot(y.rightWC,F);if(H(i,r,n,O,!1,!0),y._setTransform(M),0>B){n.startPosition.y>n.endPosition.y&&(O=void 0);var V=y.constrainedAxis;y.constrainedAxis=void 0,H(i,r,n,O,!0,!1),y.constrainedAxis=V}else H(i,r,n,O,!0,!1);if(o(y.constrainedAxis)){var k=t.cross(y.direction,y.constrainedAxis,vt); t.equalsEpsilon(k,t.ZERO,d.EPSILON6)||(t.dot(k,y.right)<0&&t.negate(k,k),t.cross(k,y.direction,y.up),t.cross(y.direction,y.up,y.right),t.normalize(y.up,y.up),t.normalize(y.right,y.right))}y._setTransform(N),i._globe=D,i._ellipsoid=R;var z=R.maximumRadius;i._rotateFactor=1/z,i._rotateRateRangeAdjustment=z;var U=t.clone(y.positionWC,vt);if(J(i),!t.equals(y.positionWC,U)){y._setTransform(M),y.worldToCameraCoordinatesPoint(U,U);var G=t.magnitudeSquared(U);t.magnitudeSquared(y.position)>G&&(t.normalize(y.position,y.position),t.multiplyByScalar(y.position,Math.sqrt(G),y.position));var W=t.angleBetween(U,y.position),q=t.cross(U,y.position,U);t.normalize(q,q);var j=v.fromAxisAngle(q,W,_t),Y=p.fromQuaternion(j,yt);p.multiplyByVector(Y,y.direction,y.direction),p.multiplyByVector(Y,y.up,y.up),t.cross(y.direction,y.up,y.right),t.cross(y.right,y.direction,y.up),y._setTransform(N)}}}function K(e,i,r,a){var s=e._scene,l=s.camera,u=wt;u.x=r.startPosition.x,u.y=0;var c=Tt;c.x=r.endPosition.x,c.y=0;var h=l.getPickRay(u,xt).direction,p=l.getPickRay(c,bt).direction,m=0,f=t.dot(h,p);1>f&&(m=Math.acos(f)),m=r.startPosition.x>r.endPosition.x?-m:m;var v=e._horizontalRotationAxis;if(o(a)?l.look(a,-m):o(v)?l.look(v,-m):l.lookLeft(m),u.x=0,u.y=r.startPosition.y,c.x=0,c.y=r.endPosition.y,h=l.getPickRay(u,xt).direction,p=l.getPickRay(c,bt).direction,m=0,f=t.dot(h,p),1>f&&(m=Math.acos(f)),m=r.startPosition.y>r.endPosition.y?-m:m,a=n(a,v),o(a)){var g=l.direction,_=t.negate(a,At),y=t.equalsEpsilon(g,a,d.EPSILON2),C=t.equalsEpsilon(g,_,d.EPSILON2);if(y||C)(y&&0>m||C&&m>0)&&l.look(l.right,-m);else{f=t.dot(g,a);var E=d.acosClamped(f);m>0&&m>E&&(m=E-d.EPSILON4),f=t.dot(g,_),E=d.acosClamped(f),0>m&&-m>E&&(m=-E+d.EPSILON4);var S=t.cross(a,g,Pt);l.look(S,m)}}else l.lookUp(m)}function Q(e){P(e,e.enableRotate,e.rotateEventTypes,W,e.inertiaSpin,"_lastInertiaSpinMovement"),P(e,e.enableZoom,e.zoomEventTypes,j,e.inertiaZoom,"_lastInertiaZoomMovement"),P(e,e.enableTilt,e.tiltEventTypes,Y,e.inertiaSpin,"_lastInertiaTiltMovement"),P(e,e.enableLook,e.lookEventTypes,K)}function J(e){if(e.enableCollisionDetection){var i=e._scene,r=i.mode,n=i.globe;if(o(n)&&r!==E.SCENE2D&&r!==E.MORPHING){var a,s,l=i.camera,u=n.ellipsoid,c=i.mapProjection;m.equals(l.transform,m.IDENTITY)||(a=m.clone(l.transform),s=t.magnitude(l.position),l._setTransform(m.IDENTITY));var h=It;r===E.SCENE3D?u.cartesianToCartographic(l.position,h):c.unproject(l.position,h);var d=!1;if(h.height<e._minimumCollisionTerrainHeight){var p=n.getHeight(h);o(p)&&(p+=e.minimumZoomDistance,h.height<p&&(h.height=p,r===E.SCENE3D?u.cartographicToCartesian(h,l.position):c.project(h,l.position),d=!0))}o(a)&&(l._setTransform(a),d&&(t.normalize(l.position,l.position),t.negate(l.position,l.direction),t.multiplyByScalar(l.position,Math.max(s,e.minimumZoomDistance),l.position),t.normalize(l.direction,l.direction),t.cross(l.direction,l.up,l.right),t.cross(l.right,l.direction,l.up)))}}}var $=.4,ee=[],te=new g,ie=new t,re=new e,ne=new t,oe=new e,ae=new t,se=new t,le=new t,ue=new t,ce=new t,he=new g,de=new g,pe=new t,me=new e,fe=new e,ve=new g,ge=new t,_e=new t,ye=new g,Ce=new g,Ee=new t,Se=new t,we=new t,Te=new t,xe=new f(t.ZERO,0),be=new e,Ae=new e,Pe=new e,Ie=new g,Me=new t,De=new t,Re=new m,Oe=new m,Ne=new t,Le=new f(t.ZERO,0),Fe=new t,Be=new r,Ve=new m,ke=new v,ze=new p,Ue=new e,Ge=new g,We=new t,He=new g,qe=new f(t.ZERO,0),je=new t,Ye=new t,Xe=new t,Ze=new r,Ke=new t,Qe=new t,Je=new l,$e=new t,et=i.clone(i.UNIT_W),tt=i.clone(i.UNIT_W),it=new t,rt=new t,nt=new t,ot=new t,at=new e,st=new e,lt=new t,ut=new r,ct=new e,ht=new g,dt=new t,pt=new t,mt=new m,ft=new m,vt=new t,gt=new m,_t=new v,yt=new p,Ct=new r,Et=new t,St=new r,wt=new e,Tt=new e,xt=new g,bt=new g,At=new t,Pt=new t,It=new r;return T.prototype.update=function(){m.equals(this._scene.camera.transform,m.IDENTITY)?(this._globe=this._scene.globe,this._ellipsoid=o(this._globe)?this._globe.ellipsoid:this._scene.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=l.UNIT_SPHERE),this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight*this._scene.terrainExaggeration,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight*this._scene.terrainExaggeration,this._minimumTrackBallHeight=this.minimumTrackBallHeight*this._scene.terrainExaggeration;var e=this._ellipsoid.maximumRadius;this._rotateFactor=1/e,this._rotateRateRangeAdjustment=e;var i=this._scene,r=i.mode;r===E.SCENE2D?N(this):r===E.COLUMBUS_VIEW?(this._horizontalRotationAxis=t.UNIT_Z,U(this)):r===E.SCENE3D&&(this._horizontalRotationAxis=void 0,Q(this)),J(this),this._aggregator.reset()},T.prototype.isDestroyed=function(){return!1},T.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),a(this)},T}),i("Shaders/PostProcessFilters/AdditiveBlend",[],function(){"use strict";return"uniform sampler2D u_texture0;\nuniform sampler2D u_texture1;\nuniform vec2 u_center;\nuniform float u_radius;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec4 color0 = texture2D(u_texture0, v_textureCoordinates);\nvec4 color1 = texture2D(u_texture1, v_textureCoordinates);\nfloat x = length(gl_FragCoord.xy - u_center) / u_radius;\nfloat t = smoothstep(0.5, 0.8, x);\ngl_FragColor = mix(color0 + color1, color0, t);\n}\n"}),i("Shaders/PostProcessFilters/BrightPass",[],function(){"use strict";return"uniform sampler2D u_texture;\nuniform float u_avgLuminance;\nuniform float u_threshold;\nuniform float u_offset;\nvarying vec2 v_textureCoordinates;\nfloat key(float avg)\n{\nfloat guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\nreturn max(0.0, guess) + 0.1;\n}\nvoid main()\n{\nvec4 color = texture2D(u_texture, v_textureCoordinates);\nvec3 xyz = czm_RGBToXYZ(color.rgb);\nfloat luminance = xyz.r;\nfloat scaledLum = key(u_avgLuminance) * luminance / u_avgLuminance;\nfloat brightLum = max(scaledLum - u_threshold, 0.0);\nfloat brightness = brightLum / (u_offset + brightLum);\nxyz.r = brightness;\ngl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n"}),i("Shaders/PostProcessFilters/GaussianBlur1D",[],function(){"use strict";return"#define SAMPLES 8\nuniform float delta;\nuniform float sigma;\nuniform float direction;\nuniform sampler2D u_texture;\nuniform vec2 u_step;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\nvec2 st = v_textureCoordinates;\nvec2 dir = vec2(1.0 - direction, direction);\nvec3 g;\ng.x = 1.0 / (sqrt(czm_twoPi) * sigma);\ng.y = exp((-0.5 * delta * delta) / (sigma * sigma));\ng.z = g.y * g.y;\nvec4 result = texture2D(u_texture, st) * g.x;\nfor (int i = 1; i < SAMPLES; ++i)\n{\ng.xy *= g.yz;\nvec2 offset = float(i) * dir * u_step;\nresult += texture2D(u_texture, st - offset) * g.x;\nresult += texture2D(u_texture, st + offset) * g.x;\n}\ngl_FragColor = result;\n}\n"}),i("Scene/SunPostProcess",["../Core/BoundingRectangle","../Core/Cartesian2","../Core/Cartesian4","../Core/Color","../Core/defaultValue","../Core/defined","../Core/destroyObject","../Core/Math","../Core/Matrix4","../Core/PixelFormat","../Core/Transforms","../Renderer/ClearCommand","../Renderer/Framebuffer","../Renderer/PassState","../Renderer/PixelDatatype","../Renderer/Renderbuffer","../Renderer/RenderbufferFormat","../Renderer/RenderState","../Renderer/Texture","../Shaders/PostProcessFilters/AdditiveBlend","../Shaders/PostProcessFilters/BrightPass","../Shaders/PostProcessFilters/GaussianBlur1D","../Shaders/PostProcessFilters/PassThrough"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S){"use strict";function w(){this._fbo=void 0,this._downSampleFBO1=void 0,this._downSampleFBO2=void 0,this._clearFBO1Command=void 0,this._clearFBO2Command=void 0,this._downSampleCommand=void 0,this._brightPassCommand=void 0,this._blurXCommand=void 0,this._blurYCommand=void 0,this._blendCommand=void 0,this._fullScreenCommand=void 0,this._downSamplePassState=new p,this._downSamplePassState.scissorTest={enable:!0,rectangle:new e},this._upSamplePassState=new p,this._upSamplePassState.scissorTest={enabled:!0,rectangle:new e},this._uCenter=new t,this._uRadius=void 0,this._blurStep=new t}w.prototype.clear=function(e,t){var i=this._clearFBO1Command;r.clone(n(t,r.BLACK),i.color),i.execute(e),i=this._clearFBO2Command,r.clone(n(t,r.BLACK),i.color),i.execute(e)},w.prototype.execute=function(e,t){this._downSampleCommand.execute(e,this._downSamplePassState),this._brightPassCommand.execute(e,this._downSamplePassState),this._blurXCommand.execute(e,this._downSamplePassState),this._blurYCommand.execute(e,this._downSamplePassState),this._fullScreenCommand.framebuffer=t,this._blendCommand.framebuffer=t,this._fullScreenCommand.execute(e),this._blendCommand.execute(e,this._upSamplePassState)};var T=new e,x=new e,b=new i,A=new t,P=new t,I=new l;return w.prototype.update=function(e){var i=e.context,n=e.viewport,a=i.drawingBufferWidth,p=i.drawingBufferHeight,w=this;if(!o(this._downSampleCommand)){this._clearFBO1Command=new h({color:new r}),this._clearFBO2Command=new h({color:new r});var M={};this._downSampleCommand=i.createViewportQuadCommand(S,{uniformMap:M,owner:this}),M={u_avgLuminance:function(){return.5},u_threshold:function(){return.25},u_offset:function(){return.1}},this._brightPassCommand=i.createViewportQuadCommand(C,{uniformMap:M,owner:this});var D=1,R=2;M={delta:function(){return D},sigma:function(){return R},direction:function(){return 0}},this._blurXCommand=i.createViewportQuadCommand(E,{uniformMap:M,owner:this}),M={delta:function(){return D},sigma:function(){return R},direction:function(){return 1}},this._blurYCommand=i.createViewportQuadCommand(E,{uniformMap:M,owner:this}),M={u_center:function(){return w._uCenter},u_radius:function(){return w._uRadius}},this._blendCommand=i.createViewportQuadCommand(y,{uniformMap:M,owner:this}),M={},this._fullScreenCommand=i.createViewportQuadCommand(S,{uniformMap:M,owner:this})}var O=Math.pow(2,Math.ceil(Math.log(a)/Math.log(2))-2),N=Math.pow(2,Math.ceil(Math.log(p)/Math.log(2))-2),L=Math.max(O,N),F=x;F.width=L,F.height=L;var B=this._fbo,V=o(B)&&B.getColorTexture(0)||void 0;if(!o(V)||V.width!==a||V.height!==p){B=B&&B.destroy(),this._downSampleFBO1=this._downSampleFBO1&&this._downSampleFBO1.destroy(),this._downSampleFBO2=this._downSampleFBO2&&this._downSampleFBO2.destroy(),this._blurStep.x=this._blurStep.y=1/L;var k=[new _({context:i,width:a,height:p})];B=i.depthTexture?this._fbo=new d({context:i,colorTextures:k,depthTexture:new _({context:i,width:a,height:p,pixelFormat:u.DEPTH_COMPONENT,pixelDatatype:m.UNSIGNED_SHORT})}):this._fbo=new d({context:i,colorTextures:k,depthRenderbuffer:new f({context:i,format:v.DEPTH_COMPONENT16})}),this._downSampleFBO1=new d({context:i,colorTextures:[new _({context:i,width:L,height:L})]}),this._downSampleFBO2=new d({context:i,colorTextures:[new _({context:i,width:L,height:L})]}),this._clearFBO1Command.framebuffer=this._downSampleFBO1,this._clearFBO2Command.framebuffer=this._downSampleFBO2,this._downSampleCommand.framebuffer=this._downSampleFBO1,this._brightPassCommand.framebuffer=this._downSampleFBO2,this._blurXCommand.framebuffer=this._downSampleFBO1,this._blurYCommand.framebuffer=this._downSampleFBO2;var z=g.fromCache({viewport:F});this._downSampleCommand.uniformMap.u_texture=function(){return B.getColorTexture(0)},this._downSampleCommand.renderState=z,this._brightPassCommand.uniformMap.u_texture=function(){return w._downSampleFBO1.getColorTexture(0)},this._brightPassCommand.renderState=z,this._blurXCommand.uniformMap.u_texture=function(){return w._downSampleFBO2.getColorTexture(0)},this._blurXCommand.uniformMap.u_step=function(){return w._blurStep},this._blurXCommand.renderState=z,this._blurYCommand.uniformMap.u_texture=function(){return w._downSampleFBO1.getColorTexture(0)},this._blurYCommand.uniformMap.u_step=function(){return w._blurStep},this._blurYCommand.renderState=z;var U=T;U.width=a,U.height=p;var G=g.fromCache({viewport:U});this._blendCommand.uniformMap.u_texture0=function(){return B.getColorTexture(0)},this._blendCommand.uniformMap.u_texture1=function(){return w._downSampleFBO2.getColorTexture(0)},this._blendCommand.renderState=G,this._fullScreenCommand.uniformMap.u_texture=function(){return B.getColorTexture(0)},this._fullScreenCommand.renderState=G}var W=i.uniformState,H=W.sunPositionWC,q=W.view,j=W.viewProjection,Y=W.projection,X=l.computeViewportTransformation(n,0,1,I),Z=l.multiplyByPoint(q,H,b),K=c.pointToGLWindowCoordinates(j,X,H,A);Z.x+=s.SOLAR_RADIUS;var Q=c.pointToGLWindowCoordinates(Y,X,Z,Z),J=30*t.magnitude(t.subtract(Q,K,Q))*2,$=P;$.x=J,$.y=J;var ee=this._upSamplePassState.scissorTest.rectangle;return ee.x=Math.max(K.x-.5*$.x,0),ee.y=Math.max(K.y-.5*$.y,0),ee.width=Math.min($.x,a),ee.height=Math.min($.y,p),this._uCenter=t.clone(K,this._uCenter),this._uRadius=.5*Math.max($.x,$.y),X=l.computeViewportTransformation(F,0,1,I),K=c.pointToGLWindowCoordinates(j,X,H,A),$.x*=O/a,$.y*=N/p,ee=this._downSamplePassState.scissorTest.rectangle,ee.x=Math.max(K.x-.5*$.x,0),ee.y=Math.max(K.y-.5*$.y,0),ee.width=Math.min($.x,a),ee.height=Math.min($.y,p),this._downSamplePassState.context=i,this._upSamplePassState.context=i,this._fbo},w.prototype.isDestroyed=function(){return!1},w.prototype.destroy=function(){return this._fbo=this._fbo&&this._fbo.destroy(),this._downSampleFBO1=this._downSampleFBO1&&this._downSampleFBO1.destroy(),this._downSampleFBO2=this._downSampleFBO2&&this._downSampleFBO2.destroy(),this._downSampleCommand=this._downSampleCommand&&this._downSampleCommand.shaderProgram&&this._downSampleCommand.shaderProgram.destroy(),this._brightPassCommand=this._brightPassCommand&&this._brightPassCommand.shaderProgram&&this._brightPassCommand.shaderProgram.destroy(),this._blurXCommand=this._blurXCommand&&this._blurXCommand.shaderProgram&&this._blurXCommand.shaderProgram.destroy(),this._blurYCommand=this._blurYCommand&&this._blurYCommand.shaderProgram&&this._blurYCommand.shaderProgram.destroy(),this._blendCommand=this._blendCommand&&this._blendCommand.shaderProgram&&this._blendCommand.shaderProgram.destroy(),this._fullScreenCommand=this._fullScreenCommand&&this._fullScreenCommand.shaderProgram&&this._fullScreenCommand.shaderProgram.destroy(),a(this)},w}),i("Scene/Scene",["../Core/BoundingRectangle","../Core/BoundingSphere","../Core/BoxGeometry","../Core/Cartesian2","../Core/Cartesian3","../Core/Cartesian4","../Core/Color","../Core/ColorGeometryInstanceAttribute","../Core/createGuid","../Core/defaultValue","../Core/defined","../Core/defineProperties","../Core/destroyObject","../Core/DeveloperError","../Core/EllipsoidGeometry","../Core/Event","../Core/GeographicProjection","../Core/GeometryInstance","../Core/GeometryPipeline","../Core/getTimestamp","../Core/Intersect","../Core/Interval","../Core/JulianDate","../Core/Math","../Core/Matrix4","../Core/mergeSort","../Core/Occluder","../Core/ShowGeometryInstanceAttribute","../Renderer/ClearCommand","../Renderer/ComputeEngine","../Renderer/Context","../Renderer/ContextLimits","../Renderer/PassState","../Renderer/ShaderProgram","../Renderer/ShaderSource","./Camera","./CreditDisplay","./CullingVolume","./DepthPlane","./DeviceOrientationCameraController","./Fog","./FrameState","./FrustumCommands","./FXAA","./GlobeDepth","./OIT","./OrthographicFrustum","./Pass","./PerformanceDisplay","./PerInstanceColorAppearance","./PerspectiveFrustum","./PerspectiveOffCenterFrustum","./PickDepth","./Primitive","./PrimitiveCollection","./SceneMode","./SceneTransforms","./SceneTransitioner","./ScreenSpaceCameraController","./SunPostProcess","./TweenCollection"],function(e,t,i,r,n,o,a,s,l,u,c,h,d,p,m,f,v,g,_,y,C,E,S,w,T,x,b,A,P,I,M,D,R,O,N,L,F,B,V,k,z,U,G,W,H,q,j,Y,X,Z,K,Q,J,$,ee,te,ie,re,ne,oe,ae){"use strict";function se(t){t=u(t,u.EMPTY_OBJECT);var i=t.canvas,r=t.contextOptions,n=t.creditContainer,o=new M(i,r);c(n)||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0px 0px 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",i.parentNode.appendChild(n)),this._id=l(),this._frameState=new U(o,new F(n)),this._frameState.scene3DOnly=u(t.scene3DOnly,!1);var s=new R(o);s.viewport=new e,s.viewport.x=0,s.viewport.y=0,s.viewport.width=o.drawingBufferWidth,s.viewport.height=o.drawingBufferHeight,this._passState=s,this._canvas=i,this._context=o,this._computeEngine=new I(o),this._globe=void 0,this._primitives=new ee,this._groundPrimitives=new ee,this._tweens=new ae,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._frustumCommandsList=[],this._overlayCommandList=[],this._pickFramebuffer=void 0,this._useOIT=u(t.orderIndependentTranslucency,!0),this._executeOITFunction=void 0;var h;o.depthTexture&&(h=new H);var d;this._useOIT&&c(h)&&(d=new q(o)),this._globeDepth=h,this._depthPlane=new V,this._oit=d,this._fxaa=new W,this._clearColorCommand=new P({color:new a,stencil:0,owner:this}),this._depthClearCommand=new P({depth:1,owner:this}),this._pickDepths=[],this._debugGlobeDepths=[],this._transitioner=new re(this),this._renderError=new f,this._preRender=new f,this._postRender=new f,this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new f,this.morphComplete=new f,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=a.clone(a.BLACK),this._mode=te.SCENE3D,this._mapProjection=c(t.mapProjection)?t.mapProjection:new v,this._transitioner=new re(this,this._mapProjection.ellipsoid),this.morphTime=1,this.farToNearRatio=1e3,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this._debugFrustumStatistics=void 0,this.debugShowFramesPerSecond=!1,this.debugShowGlobeDepth=!1,this.debugShowDepthFrustum=1,this.fxaa=!0,this.useDepthPicking=!0,this.cameraEventWaitTime=500,this.copyGlobeDepth=!1,this.fog=new z,this._terrainExaggeration=u(t.terrainExaggeration,1),this._performanceDisplay=void 0,this._debugVolume=void 0;var p=new L(this);this._camera=p,this._cameraClone=L.clone(p),this._screenSpaceCameraController=new ne(this),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useFXAA:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0;var m=p.frustum.near,g=p.frustum.far,_=Math.ceil(Math.log(g/m)/Math.log(this.farToNearRatio));pe(m,g,this.farToNearRatio,_,this._frustumCommandsList),de(this,0,S.now()),this.initializeFrame()}function le(e,t){var i=Math.max(Math.abs(e.x),Math.abs(t.x)),r=Math.max(Math.abs(e.y),Math.abs(t.y)),n=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(i,r),n)}function ue(e,t,i){var r=1/Math.max(1,le(e.position,t.position));return n.multiplyByScalar(e.position,r,ze),n.multiplyByScalar(t.position,r,Ue),n.equalsEpsilon(ze,Ue,i)&&n.equalsEpsilon(e.direction,t.direction,i)&&n.equalsEpsilon(e.up,t.up,i)&&n.equalsEpsilon(e.right,t.right,i)&&T.equalsEpsilon(e.transform,t.transform,i)}function ce(e){var t=e.globe;if(e._mode===te.SCENE3D&&c(t)){var i=t.ellipsoid;return Ge.radius=i.minimumRadius,ke=b.fromBoundingSphere(Ge,e._camera.positionWC,ke)}}function he(e){e.render=!1,e.pick=!1}function de(e,t,i){var r=e._camera,n=e._frameState;n.commandList.length=0,n.mode=e._mode,n.morphTime=e.morphTime,n.mapProjection=e.mapProjection,n.frameNumber=t,n.time=S.clone(i,n.time),n.camera=r,n.cullingVolume=r.frustum.computeCullingVolume(r.positionWC,r.directionWC,r.upWC),n.occluder=ce(e),n.terrainExaggeration=e._terrainExaggeration,he(n.passes)}function pe(e,t,i,r,n){n.length=r;for(var o=0;r>o;++o){var a=Math.max(e,Math.pow(i,o)*e),s=Math.min(t,i*a),l=n[o];c(l)?(l.near=a,l.far=s):l=n[o]=new G(a,s)}}function me(e,t,i){e.debugShowFrustums&&(t.debugOverlappingFrustums=0);for(var r=e._frustumCommandsList,n=r.length,o=0;n>o;++o){var a=r[o],s=a.near,l=a.far;if(!(i.start>l)){if(i.stop<s)break;var u=t instanceof P?Y.OPAQUE:t.pass,h=a.indices[u]++;if(a.commands[u][h]=t,e.debugShowFrustums&&(t.debugOverlappingFrustums|=1<<o),t.executeInClosestFrustum)break}}if(e.debugShowFrustums){var d=e._debugFrustumStatistics.commandsInFrustums;d[t.debugOverlappingFrustums]=c(d[t.debugOverlappingFrustums])?d[t.debugOverlappingFrustums]+1:1,++e._debugFrustumStatistics.totalCommands}}function fe(e,t,i){return c(e)&&(!c(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==C.OUTSIDE&&(!c(i)||!e.boundingVolume.isOccluded(i)))}function ve(e){var t=e._frameState,i=t.camera,r=i.directionWC,n=i.positionWC,o=e._computeCommandList,a=e._overlayCommandList,s=t.commandList;e.debugShowFrustums&&(e._debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});for(var l=e._frustumCommandsList,u=l.length,h=Y.NUMBER_OF_PASSES,d=0;u>d;++d)for(var p=0;h>p;++p)l[d].indices[p]=0;o.length=0,a.length=0;for(var m=Number.MAX_VALUE,f=Number.MIN_VALUE,v=!1,g=t.mode===te.SCENE3D?t.occluder:void 0,_=t.cullingVolume,y=We.planes,C=0;5>C;++C)y[C]=_.planes[C];_=We;var E=e._environmentState;E.isSkyAtmosphereVisible=c(E.skyAtmosphereCommand)&&c(e.globe)&&e.globe._surface._tilesToRender.length>0,E.isSunVisible=fe(E.sunDrawCommand,_,g),E.isMoonVisible=fe(E.moonCommand,_,g);for(var S=s.length,w=0;S>w;++w){var T=s[w],x=T.pass;if(x===Y.COMPUTE)o.push(T);else if(x===Y.OVERLAY)a.push(T);else{var b=T.boundingVolume;if(c(b)){if(!fe(T,_,g))continue;He=b.computePlaneDistances(n,r,He),m=Math.min(m,He.start),f=Math.max(f,He.stop)}else He.start=i.frustum.near,He.stop=i.frustum.far,v=!(T instanceof P);me(e,T,He)}}v?(m=i.frustum.near,f=i.frustum.far):(m=Math.min(Math.max(m,i.frustum.near),i.frustum.far),f=Math.max(Math.min(f,i.frustum.far),m));var A=e.farToNearRatio,I=Math.ceil(Math.log(f/m)/Math.log(A));m!==Number.MAX_VALUE&&(I!==u||0!==l.length&&(m<l[0].near||f>l[u-1].far))&&(pe(m,f,A,I,l),ve(e))}function ge(e){var t={},i=e.vertexAttributes;for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r].index);return t}function _e(e,t,i){var r=t.context,n=u(i,e.shaderProgram),o=n.fragmentShaderSource.clone();o.sources=o.sources.map(function(e){return e=N.replaceMain(e,"czm_Debug_main")});var s="void main() \n{ \n czm_Debug_main(); \n";if(t.debugShowCommands){c(e._debugColor)||(e._debugColor=a.fromRandom());var l=e._debugColor;s+=" gl_FragColor.rgb *= vec3("+l.red+", "+l.green+", "+l.blue+"); \n"}if(t.debugShowFrustums){var h=1&e.debugOverlappingFrustums?"1.0":"0.0",d=2&e.debugOverlappingFrustums?"1.0":"0.0",p=4&e.debugOverlappingFrustums?"1.0":"0.0";s+=" gl_FragColor.rgb *= vec3("+h+", "+d+", "+p+"); \n"}s+="}",o.sources.push(s);var m=ge(n);return O.fromCache({context:r,vertexShaderSource:n.vertexShaderSource,fragmentShaderSource:o,attributeLocations:m})}function ye(e,t,i,r,n){if(c(e.shaderProgram)||c(n)){var o=_e(e,t,n);e.execute(t.context,i,r,o),o.destroy()}}function Ce(e,t,r,o,a,l,u){if((!c(t.debugCommandFilter)||t.debugCommandFilter(e))&&(t.debugShowCommands||t.debugShowFrustums?ye(e,t,o,a,l):e.execute(r,o,a,l),e.debugShowBoundingVolume&&c(e.boundingVolume))){var h=t._frameState,d=e.boundingVolume;c(t._debugVolume)&&t._debugVolume.destroy();var p,f=n.clone(d.center);if(h.mode!==te.SCENE3D){f=T.multiplyByPoint(qe,f,f);var v=h.mapProjection,y=v.unproject(f);f=v.ellipsoid.cartographicToCartesian(y)}if(c(d.radius)){var C=d.radius;p=_.toWireframe(m.createGeometry(new m({radii:new n(C,C,C),vertexFormat:Z.FLAT_VERTEX_FORMAT}))),t._debugVolume=new $({geometryInstances:new g({geometry:p,modelMatrix:T.multiplyByTranslation(T.IDENTITY,f,new T),attributes:{color:new s(1,0,0,1)}}),appearance:new Z({flat:!0,translucent:!1}),asynchronous:!1})}else{var E=d.halfAxes;p=_.toWireframe(i.createGeometry(i.fromDimensions({dimensions:new n(2,2,2),vertexFormat:Z.FLAT_VERTEX_FORMAT}))),t._debugVolume=new $({geometryInstances:new g({geometry:p,modelMatrix:T.fromRotationTranslation(E,f,new T),attributes:{color:new s(1,0,0,1)}}),appearance:new Z({flat:!0,translucent:!1}),asynchronous:!1})}var S=h.commandList,w=h.commandList=[];t._debugVolume.update(h);var x;c(u)&&(x=o.framebuffer,o.framebuffer=u),w[0].execute(r,o),c(x)&&(o.framebuffer=x),h.commandList=S}}function Ee(e,t,i){return t.boundingVolume.distanceSquaredTo(i)-e.boundingVolume.distanceSquaredTo(i)}function Se(e,t,i,r){var n=e.context;x(r,Ee,e._camera.positionWC);for(var o=r.length,a=0;o>a;++a)t(r[a],e,n,i)}function we(e,t){var i=e._debugGlobeDepths[t];return!c(i)&&e.context.depthTexture&&(i=new H,e._debugGlobeDepths[t]=i),i}function Te(e,t){var i=e._pickDepths[t];return c(i)||(i=new J,e._pickDepths[t]=i),i}function xe(e,t){var i,r=e._camera,n=e.context,o=n.uniformState;i=c(r.frustum.fov)?r.frustum.clone(je):c(r.frustum.infiniteProjectionMatrix)?r.frustum.clone(Ye):r.frustum.clone(Xe),i.near=r.frustum.near,i.far=r.frustum.far,o.updateFrustum(i);var a=e._environmentState,s=a.skyBoxCommand;if(c(s)&&Ce(s,e,n,t),a.isSkyAtmosphereVisible&&Ce(a.skyAtmosphereCommand,e,n,t),a.isSunVisible&&(a.sunDrawCommand.execute(n,t),e.sunBloom&&!e._useWebVR)){var l;l=a.useGlobeDepthFramebuffer?e._globeDepth.framebuffer:a.useFXAA?e._fxaa.getColorFramebuffer():a.originalFramebuffer,e._sunPostProcess.execute(n,l),t.framebuffer=l}a.isMoonVisible&&a.moonCommand.execute(n,t);var u;a.useOIT?(c(e._executeOITFunction)||(e._executeOITFunction=function(e,t,i,r){e._oit.executeCommands(e,t,i,r)}),u=e._executeOITFunction):u=Se;for(var h,d=a.clearGlobeDepth,p=a.clearGlobeDepth,m=e._depthClearCommand,f=e._depthPlane,v=e._frustumCommandsList,g=v.length,_=0;g>_;++_){var y=g-_-1,C=v[y];i.near=0!==y?C.near*Ve:C.near,i.far=C.far;var E,S=e.debugShowGlobeDepth?we(e,y):e._globeDepth;e.debugShowGlobeDepth&&c(S)&&a.useGlobeDepthFramebuffer&&(E=t.framebuffer,t.framebuffer=S.framebuffer),o.updateFrustum(i),m.execute(n,t);var w=C.commands[Y.GLOBE],T=C.indices[Y.GLOBE];for(h=0;T>h;++h)Ce(w[h],e,n,t);for(c(S)&&a.useGlobeDepthFramebuffer&&(e.copyGlobeDepth||e.debugShowGlobeDepth)&&(S.update(n),S.executeCopyDepth(n,t)),e.debugShowGlobeDepth&&c(S)&&a.useGlobeDepthFramebuffer&&(t.framebuffer=E),w=C.commands[Y.GROUND],T=C.indices[Y.GROUND],h=0;T>h;++h)Ce(w[h],e,n,t);d&&(m.execute(n,t),p&&f.execute(n,t));for(var x=Y.GROUND+1,b=Y.TRANSLUCENT,A=x;b>A;++A)for(w=C.commands[A],T=C.indices[A],h=0;T>h;++h)Ce(w[h],e,n,t);if(0!==y&&(i.near=C.near,o.updateFrustum(i)),w=C.commands[Y.TRANSLUCENT],w.length=C.indices[Y.TRANSLUCENT],u(e,Ce,t,w),c(S)&&a.useGlobeDepthFramebuffer&&e.useDepthPicking){var P=Te(e,y);P.update(n,S.framebuffer.depthStencilTexture),P.executeCopyDepth(n,t)}}}function be(e){var t=e._environmentState.sunComputeCommand;c(t)&&t.execute(e._computeEngine);for(var i=e._computeCommandList,r=i.length,n=0;r>n;++n)i[n].execute(e._computeEngine)}function Ae(e,t){for(var i=e.context,r=e._overlayCommandList,n=r.length,o=0;n>o;++o)r[o].execute(i,t)}function Pe(e,t){var i=e._context,r=t.viewport,o=e._frameState,a=o.camera;if(e._useWebVR)if(o.mode!==te.SCENE2D){r.x=0,r.y=0,r.width=.5*i.drawingBufferWidth,r.height=i.drawingBufferHeight;var s=L.clone(a,e._cameraVR),l=a.frustum.near,u=5*l,c=u/30,h=n.multiplyByScalar(s.right,.5*c,Ze);a.frustum.aspectRatio=r.width/r.height;var d=.5*c*l/u;n.add(s.position,h,a.position),a.frustum.xOffset=d,xe(e,t),r.x=t.viewport.width,n.subtract(s.position,h,a.position),a.frustum.xOffset=-d,xe(e,t),L.clone(s,a)}else{r.x=0,r.y=0,r.width=.5*i.drawingBufferWidth,r.height=i.drawingBufferHeight;var p=a.frustum.top;a.frustum.top=a.frustum.right*(r.height/r.width),a.frustum.bottom=-a.frustum.top,xe(e,t),r.x=t.viewport.width,xe(e,t),a.frustum.top=p,a.frustum.bottom=-p}else r.x=0,r.y=0,r.width=i.drawingBufferWidth,r.height=i.drawingBufferHeight,xe(e,t)}function Ie(e){var t=e._frameState,i=e._environmentState,r=t.passes.render;i.skyBoxCommand=r&&c(e.skyBox)?e.skyBox.update(t):void 0,i.skyAtmosphereCommand=r&&c(e.skyAtmosphere)?e.skyAtmosphere.update(t):void 0;var n=r&&c(e.sun)?e.sun.update(e):void 0;i.sunDrawCommand=c(n)?n.drawCommand:void 0,i.sunComputeCommand=c(n)?n.computeCommand:void 0,i.moonCommand=r&&c(e.moon)?e.moon.update(t):void 0;var o=i.clearGlobeDepth=c(e.globe)&&(!e.globe.depthTestAgainstTerrain||e.mode===te.SCENE2D),a=i.useDepthPlane=o&&e.mode===te.SCENE3D;a&&e._depthPlane.update(t)}function Me(e){var t=e._frameState;e._globe&&e._globe.update(t),e._groundPrimitives.update(t),e._primitives.update(t)}function De(e,t,i,r){var n=e._context,o=e._environmentState;o.originalFramebuffer=t.framebuffer,c(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!e._useWebVR?e._sunPostProcess=new oe:c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!c(e.sun)&&c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);var s=e._clearColorCommand;a.clone(i,s.color),s.execute(n,t);var l=o.useGlobeDepthFramebuffer=!r&&c(e._globeDepth);l&&(e._globeDepth.update(n),e._globeDepth.clear(n,t,i));for(var u=!1,h=e._frustumCommandsList,d=h.length,p=0;d>p;++p)if(h[p].indices[Y.TRANSLUCENT]>0){u=!0;break}var m=o.useOIT=!r&&u&&c(e._oit)&&e._oit.isSupported();m&&(e._oit.update(n,e._globeDepth.framebuffer),e._oit.clear(n,t,i),o.useOIT=e._oit.isSupported());var f=o.useFXAA=!r&&e.fxaa;f&&(e._fxaa.update(n),e._fxaa.clear(n,t,i)),o.isSunVisible&&e.sunBloom&&!e._useWebVR?t.framebuffer=e._sunPostProcess.update(t):l?t.framebuffer=e._globeDepth.framebuffer:f&&(t.framebuffer=e._fxaa.getColorFramebuffer()),c(t.framebuffer)&&s.execute(n,t)}function Re(e,t){var i=e._context,r=e._environmentState,n=r.useGlobeDepthFramebuffer;if(e.debugShowGlobeDepth&&n){var o=we(e,e.debugShowDepthFrustum-1);o.executeDebugGlobeDepth(i,t)}if(e.debugShowPickDepth&&n){var a=Te(e,e.debugShowDepthFrustum-1);a.executeDebugPickDepth(i,t)}var s=r.useOIT,l=r.useFXAA;s&&(t.framebuffer=l?e._fxaa.getColorFramebuffer():void 0,e._oit.execute(i,t)),l&&(!s&&n&&(t.framebuffer=e._fxaa.getColorFramebuffer(),e._globeDepth.executeCopyColor(i,t)),t.framebuffer=r.originalFramebuffer,e._fxaa.execute(i,t)),s||l||!n||(t.framebuffer=r.originalFramebuffer,e._globeDepth.executeCopyColor(i,t))}function Oe(e){for(var t=e.afterRender,i=0,r=t.length;r>i;++i)t[i]();t.length=0}function Ne(e,t){c(t)||(t=S.now());var i=e._camera;ue(i,e._cameraClone,w.EPSILON6)?e._cameraStartFired&&y()-e._cameraMovedTime>e.cameraEventWaitTime&&(i.moveEnd.raiseEvent(),e._cameraStartFired=!1):(e._cameraStartFired||(i.moveStart.raiseEvent(),e._cameraStartFired=!0),e._cameraMovedTime=y(),L.clone(i,e._cameraClone)),e._preRender.raiseEvent(e,t);var r=e.context,n=r.uniformState,o=e._frameState,s=w.incrementWrap(o.frameNumber,15e6,1);de(e,s,t),o.passes.render=!0,o.creditDisplay.beginFrame(),e.fog.update(o),n.update(o),e._computeCommandList.length=0,e._overlayCommandList.length=0;var l=e._passState;l.framebuffer=void 0,l.blendingEnabled=void 0,l.scissorTest=void 0;var h=l.viewport;if(h.x=0,h.y=0,h.width=r.drawingBufferWidth,h.height=r.drawingBufferHeight,Ie(e),Me(e),ve(e),De(e,l,u(e.backgroundColor,a.BLACK)),be(e),Pe(e,l),Re(e,l),Ae(e,l),o.creditDisplay.endFrame(),e.debugShowFramesPerSecond){if(!c(e._performanceDisplay)){var d=document.createElement("div");d.className="cesium-performanceDisplay-defaultContainer";var p=e._canvas.parentNode;p.appendChild(d);var m=new X({container:d});e._performanceDisplay=m,e._performanceContainer=d}e._performanceDisplay.update()}else c(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer));r.endFrame(),Oe(o),e._postRender.raiseEvent(e,t)}function Le(e,t,i,r){var o=e._camera,a=o.frustum,s=e._passState.viewport,l=2*(t.x-s.x)/s.width-1;l*=.5*(a.right-a.left);var u=2*(s.height-t.y-s.y)/s.height-1;u*=.5*(a.top-a.bottom);var c=T.clone(o.transform,et);o._setTransform(T.IDENTITY);var h=n.clone(o.position,Qe);n.multiplyByScalar(o.right,l,Je),n.add(Je,h,h),n.multiplyByScalar(o.up,u,Je),n.add(Je,h,h),o._setTransform(c),n.fromElements(h.z,h.x,h.y,h);var d=a.getPixelDimensions(s.width,s.height,1,$e),p=Ke;return p.right=.5*d.x,