define(["exports","./Cartographic-1bbcab04","./Check-3aa71481","./when-515d5295","./Rectangle-e170be8b","./Intersect-53434a77","./Math-5e38123d","./PrimitiveType-b38a4004","./Event-9821f5d9","./RuntimeError-350acae3"],(function(e,t,r,n,a,i,o,s,u,c){"use strict";function p(e,t){this.start=n.e(e,0),this.stop=n.e(t,0)}function f(e,r){this.center=t.a.clone(n.e(e,t.a.ZERO)),this.radius=n.e(r,0)}var l=new t.a,h=new t.a,d=new t.a,m=new t.a,y=new t.a,v=new t.a,g=new t.a,q=new t.a,b=new t.a,w=new t.a,R=new t.a,O=new t.a,A=4/3*o.n.PI;f.fromPoints=function(e,r){if(n.t(r)||(r=new f),!n.t(e)||0===e.length)return r.center=t.a.clone(t.a.ZERO,r.center),r.radius=0,r;var a,i=t.a.clone(e[0],g),o=t.a.clone(i,l),s=t.a.clone(i,h),u=t.a.clone(i,d),c=t.a.clone(i,m),p=t.a.clone(i,y),A=t.a.clone(i,v),x=e.length;for(a=1;ac.x&&t.a.clone(i,c),Ep.y&&t.a.clone(i,p),_A.z&&t.a.clone(i,A)}var C=t.a.magnitudeSquared(t.a.subtract(c,o,q)),I=t.a.magnitudeSquared(t.a.subtract(p,s,q)),T=t.a.magnitudeSquared(t.a.subtract(A,u,q)),P=o,U=c,B=C;I>B&&(B=I,P=s,U=p),T>B&&(B=T,P=u,U=A);var k=b;k.x=.5*(P.x+U.x),k.y=.5*(P.y+U.y),k.z=.5*(P.z+U.z);var j=t.a.magnitudeSquared(t.a.subtract(U,k,q)),D=Math.sqrt(j),z=w;z.x=o.x,z.y=s.y,z.z=u.z;var L=R;L.x=c.x,L.y=p.y,L.z=A.z;var K=t.a.midpoint(z,L,O),M=0;for(a=0;aM&&(M=F);var N=t.a.magnitudeSquared(t.a.subtract(i,k,q));if(N>j){var H=Math.sqrt(N);j=(D=.5*(D+H))*D;var V=H-D;k.x=(D*k.x+V*i.x)/H,k.y=(D*k.y+V*i.y)/H,k.z=(D*k.z+V*i.z)/H}}return Dx.x&&t.a.clone(s,x),IS.y&&t.a.clone(s,S),TE.z&&t.a.clone(s,E)}var P=t.a.magnitudeSquared(t.a.subtract(x,c,q)),U=t.a.magnitudeSquared(t.a.subtract(S,p,q)),B=t.a.magnitudeSquared(t.a.subtract(E,A,q)),k=c,j=x,D=P;U>D&&(D=U,k=p,j=S),B>D&&(D=B,k=A,j=E);var z=b;z.x=.5*(k.x+j.x),z.y=.5*(k.y+j.y),z.z=.5*(k.z+j.z);var L=t.a.magnitudeSquared(t.a.subtract(j,z,q)),K=Math.sqrt(L),M=w;M.x=c.x,M.y=p.y,M.z=A.z;var F=R;F.x=x.x,F.y=S.y,F.z=E.z;var N=t.a.midpoint(M,F,O),H=0;for(u=0;u<_;u+=i){s.x=e[u]+a.x,s.y=e[u+1]+a.y,s.z=e[u+2]+a.z;var V=t.a.magnitude(t.a.subtract(s,N,q));V>H&&(H=V);var Y=t.a.magnitudeSquared(t.a.subtract(s,z,q));if(Y>L){var J=Math.sqrt(Y);L=(K=.5*(K+J))*K;var X=J-K;z.x=(K*z.x+X*s.x)/J,z.y=(K*z.y+X*s.y)/J,z.z=(K*z.z+X*s.z)/J}}return Kp.x&&t.a.clone(i,p),_A.y&&t.a.clone(i,A),Cx.z&&t.a.clone(i,x)}var I=t.a.magnitudeSquared(t.a.subtract(p,s,q)),T=t.a.magnitudeSquared(t.a.subtract(A,u,q)),P=t.a.magnitudeSquared(t.a.subtract(x,c,q)),U=s,B=p,k=I;T>k&&(k=T,U=u,B=A),P>k&&(k=P,U=c,B=x);var j=b;j.x=.5*(U.x+B.x),j.y=.5*(U.y+B.y),j.z=.5*(U.z+B.z);var D=t.a.magnitudeSquared(t.a.subtract(B,j,q)),z=Math.sqrt(D),L=w;L.x=s.x,L.y=u.y,L.z=c.z;var K=R;K.x=p.x,K.y=A.y,K.z=x.z;var M=t.a.midpoint(L,K,O),F=0;for(o=0;oF&&(F=N);var H=t.a.magnitudeSquared(t.a.subtract(i,j,q));if(H>D){var V=Math.sqrt(H);D=(z=.5*(z+V))*z;var Y=V-z;j.x=(z*j.x+Y*i.x)/V,j.y=(z*j.y+Y*i.y)/V,j.z=(z*j.z+Y*i.z)/V}}return z=l+c)return e.clone(i),i;if(c>=l+s)return a.clone(i),i;var h=.5*(s+l+c),d=t.a.multiplyByScalar(p,(-s+h)/l,j);return t.a.add(d,o,d),t.a.clone(d,i.center),i.radius=h,i};var D=new t.a;f.expand=function(e,n,a){r.n.typeOf.object("sphere",e),r.n.typeOf.object("point",n),a=f.clone(e,a);var i=t.a.magnitude(t.a.subtract(n,a.center,D));return i>a.radius&&(a.radius=i),a},f.intersectPlane=function(e,n){r.n.typeOf.object("sphere",e),r.n.typeOf.object("plane",n);var a=e.center,o=e.radius,s=n.normal,u=t.a.dot(s,a)+n.distance;return u<-o?i.S.OUTSIDE:u"u")return e;t=n.e(a.baseURI,a.location.href)}var i=new G(t);return new G(e).resolve(i).toString()};var ie,oe=/^blob:/i;function se(e){return r.n.typeOf.string("uri",e),oe.test(e)}var ue=/^data:/i;function ce(e){return r.n.typeOf.string("uri",e),ue.test(e)}var pe=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),fe=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3,PACK:4,BLOCK:5,BLOCKPACK:6});function le(e){e=n.e(e,n.e.EMPTY_OBJECT);var t=n.e(e.throttleByServer,!1),r=n.e(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=n.e(e.priority,0),this.throttle=r,this.throttleByServer=t,this.type=n.e(e.type,fe.OTHER),this.serverKey=void 0,this.state=pe.UNISSUED,this.deferred=void 0,this.cancelled=!1}function he(e,t,r){this.statusCode=e,this.response=t,this.responseHeaders=r,"string"==typeof this.responseHeaders&&(this.responseHeaders=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0;n0){var o=a.substring(0,i),s=a.substring(i+2);t[o]=s}}return t}(this.responseHeaders))}function de(e){r.n.typeOf.object("options",e),r.n.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function me(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}le.prototype.cancel=function(){this.cancelled=!0},le.prototype.clone=function(e){return n.t(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=this.RequestState.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new le(this)},he.prototype.toString=function(){var e="Request has failed.";return n.t(this.statusCode)&&(e+=" Status Code: "+this.statusCode),e},Object.defineProperties(de.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){this._maximumLength=e,this._length>e&&e>0&&(this._length=e,this._array.length=e)}},comparator:{get:function(){return this._comparator}}}),de.prototype.reserve=function(e){e=n.e(e,this._length),this._array.length=e},de.prototype.heapify=function(e){e=n.e(e,0);for(var t=this._length,r=this._comparator,a=this._array,i=-1,o=!0;o;){var s=2*(e+1),u=s-1;i=u=0;--t)this.heapify(t)},de.prototype.insert=function(e){r.n.defined("element",e);var t,a=this._array,i=this._comparator,o=this._maximumLength,s=this._length++;for(so&&(t=a[o],a.pop(),this._length=o),t},de.prototype.pop=function(e){if(e=n.e(e,0),0!==this._length){r.n.typeOf.number.lessThan("index",e,this._length);var t=this._array,a=t[e];return me(t,e,--this._length),t[this._length]=void 0,this.heapify(e),a}};var ye=typeof performance<"u"&&"function"==typeof performance.now&&isFinite(performance.now())?function(){return performance.now()}:function(){return Date.now()};function ve(e,t){return e.priority-t.priority}var ge={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0,totalRequestTime:0},qe=20,be=new de({comparator:ve});be.maximumLength=qe,be.reserve(qe);var we=[],Re={},Oe=typeof document<"u"?new G(document.location.href):new G,Ae=new u.o;function xe(){}function Se(e){n.t(e.priorityFunction)&&(e.priority=e.priorityFunction())}function Ee(e){var t=n.e(xe.requestsByServer[e],xe.maximumRequestsPerServer);return Re[e]0||e.type!==fe.OTHER)&&(ge.totalRequestTime+=e.endTime-e.startTime),e.type===fe.BLOCK||e.type===fe.BLOCKPACK)){var r=Ce(e);n.t(xe.blockDefer[r])&&(xe.blockDefer[r]=void 0,delete xe.blockDefer[r])}}}(e)).otherwise(function(e){return function(t){e.state!==pe.CANCELLED&&(++ge.numberOfFailedRequests,--ge.numberOfActiveRequests,--Re[e.serverKey],Ae.raiseEvent(t),e.state=pe.FAILED,e.deferred.reject(t))}}(e)),r}function De(e){var t=e.state===pe.ACTIVE;e.state=pe.CANCELLED,++ge.numberOfCancelledRequests,e.deferred.reject(),t&&(--ge.numberOfActiveRequests,--Re[e.serverKey],++ge.numberOfCancelledActiveRequests),n.t(e.cancelFunction)&&e.cancelFunction()}xe.TIMEOUT=5e3,xe.CANCLE_COUNT=3,xe.statisticRequestTime=-1,xe.maximumRequests=50,xe.maximumRequestsPerServer=6,xe.perPacketCount=20,xe.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18},xe.throttleRequests=!0,xe.debugShowStatistics=!1,xe.requestCompletedEvent=Ae,Object.defineProperties(xe,{activeRequestLength:{get:function(){return we.length}},statistics:{get:function(){return ge}},priorityHeapLength:{get:function(){return qe},set:function(e){if(ee;){De(be.pop())}qe=e,be.maximumLength=e,be.reserve(e)}}}),xe.packRequestGroup={},xe.packRequestPromise={},xe.packRequestQuadKey={},xe.quadKeyIndex={},xe.packRequestHeap={},xe.blockDefer={},xe.blockRequest={},xe.update=function(){var e,t,r=0,n=we.length;for(e=0;e0&&(we[e-r]=t):++r;we.length-=r;var a=be.internalArray,i=be.length;for(e=0;e0;){var r=t.pop();r.cancelled?De(r):Ie(r)}Ue()}();for(var o=Math.max(xe.maximumRequests-we.length,0),s=0;s0;)(t=be.pop()).cancelled?De(t):!t.throttleByServer||Ee(t.serverKey)?(je(t),++s):De(t);!xe.debugShowStatistics||(0===ge.numberOfActiveRequests&&ge.lastNumberOfActiveRequests>0&&(ge.numberOfAttemptedRequests>0&&(console.log("Number of attempted requests: "+ge.numberOfAttemptedRequests),ge.numberOfAttemptedRequests=0),ge.numberOfCancelledRequests>0&&(console.log("Number of cancelled requests: "+ge.numberOfCancelledRequests),ge.numberOfCancelledRequests=0),ge.numberOfCancelledActiveRequests>0&&(console.log("Number of cancelled active requests: "+ge.numberOfCancelledActiveRequests),ge.numberOfCancelledActiveRequests=0),ge.numberOfFailedRequests>0&&(console.log("Number of failed requests: "+ge.numberOfFailedRequests),ge.numberOfFailedRequests=0)),ge.lastNumberOfActiveRequests=ge.numberOfActiveRequests)},xe.getServerKey=function(e){r.n.typeOf.string("url",e);var t=new G(e).resolve(Oe);t.normalize();var a=t.authority;/:/.test(a)||(a=a+":"+("https"===t.scheme?"443":"80"));var i=Re[a];return n.t(i)||(Re[a]=0),a},xe.request=function(e){if(r.n.typeOf.object("request",e),r.n.typeOf.string("request.url",e.url),r.n.typeOf.func("request.requestFunction",e.requestFunction),ce(e.url)||se(e.url))return Ae.raiseEvent(),e.state=pe.RECEIVED,e.requestFunction();if(++ge.numberOfAttemptedRequests,n.t(e.serverKey)||(e.serverKey=xe.getServerKey(e.url)),e.type===fe.BLOCK)return function(e){var t=Ce(e),r=xe.blockDefer[t];return n.t(r)||(r=xe.blockDefer[t]=n.c.defer(),xe.blockRequest[t]=e),e.deferred=r,e.state=pe.ISSUED,e.deferred.promise}(e);if(!e.throttleByServer||Ee(e.serverKey)){if(!xe.throttleRequests||!e.throttle)return je(e);if(!(we.length>=xe.maximumRequests)){var t;if(Se(e),e.type===fe.PACK||e.type===fe.BLOCKPACK){var a=function(e){var t=_e(e),r=xe.packRequestHeap[t];return n.t(r)||((r=xe.packRequestHeap[t]=new de({comparator:ve})).maximumLength=xe.perPacketCount,r.reserve(qe)),r}(e),i=!0;if(e.type===fe.BLOCKPACK)for(var o=0;o0;){De(be.pop())}for(var e=we.length,t=0;t2){var u=a[i].indexOf("=");s=[a[i].substring(0,u),a[i].substring(u+1,a[i].length)]}var c=decodeURIComponent(s[0]),p=s[1];p=n.t(p)?decodeURIComponent(p):"";var f=t[c];"string"==typeof f?t[c]=[f,p]:Array.isArray(f)?f.push(p):t[c]=p}return t}(s);t._queryParameters=a?Xe(o,t._queryParameters,i):o,e.query=void 0}function Ve(e,t){var a=t._queryParameters,i=Object.keys(a);1!==i.length||n.t(a[i[0]])?e.query=function(e,t){if(!n.t(e))throw new r.t("obj is required.");var a="";for(var i in e)if(e.hasOwnProperty(i)){var o=e[i],s=encodeURIComponent(i)+"=";if(Array.isArray(o))for(var u=0,c=o.length;u0}}}),Ge.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;var r=new G(this._url);e&&Ve(r,this);var a=r.toString().replace(/%7B/g,"{").replace(/%7D/g,"}"),i=this._templateValues;return a=a.replace(/{(.*?)}/g,(function(e,t){var r=i[t];return n.t(r)&&"s"==t?encodeURI(r):n.t(r)?encodeURIComponent(r):e})),t&&n.t(this.proxy)&&(a=this.proxy.getURL(a)),a},Ge.prototype.setQueryParameters=function(e,t){this._queryParameters=t?Xe(this._queryParameters,e,!1):Xe(e,this._queryParameters,!1)},Ge.prototype.appendQueryParameters=function(e){this._queryParameters=Xe(e,this._queryParameters,!0)},Ge.prototype.setTemplateValues=function(e,t){this._templateValues=t?ne(this._templateValues,e):ne(e,this._templateValues)},Ge.prototype.getDerivedResource=function(e){var t=this.clone();if(t._retryCount=0,n.t(e.url)){var r=new G(e.url);He(r,t,!0,n.e(e.preserveQueryParameters,!1)),r.fragment=void 0,t._url=r.resolve(new G(ae(this._url))).toString()}return n.t(e.queryParameters)&&(t._queryParameters=ne(e.queryParameters,t._queryParameters)),n.t(e.templateValues)&&(t._templateValues=ne(e.templateValues,t.templateValues)),n.t(e.headers)&&(t.headers=ne(e.headers,t.headers)),n.t(e.proxy)&&(t.proxy=e.proxy),n.t(e.request)&&(t.request=e.request),n.t(e.retryCallback)&&(t.retryCallback=e.retryCallback),n.t(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},Ge.prototype.retryOnError=function(e){var t=this.retryCallback;if("function"!=typeof t||this._retryCount>=this.retryAttempts)return n.c(!1);var r=this;return n.c(t(this,e)).then((function(e){return++r._retryCount,e}))},Ge.prototype.clone=function(e){return n.t(e)||(e=new Ge({url:this._url})),e._url=this._url,e._queryParameters=re(this._queryParameters),e._templateValues=re(this._templateValues),e.headers=re(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e},Ge.prototype.getBaseUri=function(e){return function(e,t){if(!n.t(e))throw new r.t("uri is required.");var a="",i=e.lastIndexOf("/");return-1!==i&&(a=e.substring(0,i+1)),t&&(e=new G(e),n.t(e.query)&&(a+="?"+e.query),n.t(e.fragment)&&(a+="#"+e.fragment)),a}(this.getUrlComponent(e),e)},Ge.prototype.appendForwardSlash=function(){this._url=function(e){return(0===e.length||"/"!==e[e.length-1])&&(e+="/"),e}(this._url)},Ge.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},Ge.fetchArrayBuffer=function(e){return new Ge(e).fetchArrayBuffer()},Ge.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},Ge.fetchBlob=function(e){return new Ge(e).fetchBlob()},Ge.prototype.fetchImage=function(e){e=n.e(e,n.e.EMPTY_OBJECT);var t=n.e(e.preferImageBitmap,!1),r=n.e(e.preferBlob,!1),a=n.e(e.flipY,!1);if(Je(this.request),!Ne||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!r)return Qe({resource:this,flipY:a,preferImageBitmap:t});var i,o,s,u=this.fetchBlob();return n.t(u)?Ge.supportsImageBitmapOptions().then((function(e){return i=e&&t,u})).then((function(e){if(n.t(e)){if(s=e,i)return Ge.createImageBitmapFromBlob(e,{flipY:a,premultiplyAlpha:!1});var t=window.URL.createObjectURL(e);return Qe({resource:o=new Ge({url:t}),flipY:a,preferImageBitmap:!1})}})).then((function(e){if(n.t(e))return e.blob=s,i||window.URL.revokeObjectURL(o.url),e})).otherwise((function(e){return n.t(o)&&window.URL.revokeObjectURL(o.url),e.blob=s,n.c.reject(e)})):void 0},Ge.fetchImage=function(e){return new Ge(e).fetchImage({flipY:e.flipY,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},Ge.prototype.fetchText=function(){return this.fetch({responseType:"text"})},Ge.fetchText=function(e){return new Ge(e).fetchText()},Ge.prototype.fetchJson=function(){var e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(n.t(e))return e.then((function(e){if(n.t(e))return JSON.parse(e)}))},Ge.fetchJson=function(e){return new Ge(e).fetchJson()},Ge.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},Ge.fetchXML=function(e){return new Ge(e).fetchXML()},Ge.prototype.fetchJsonp=function(e){var t;e=n.e(e,"callback"),Je(this.request);do{t="loadJsonp"+Math.random().toString().substring(2,8)}while(n.t(window[t]));return Ze(this,e,t)},Ge.fetchJsonp=function(e){return new Ge(e).fetchJsonp(e.callbackParameterName)},Ge.prototype._makeRequest=function(e){var t=this;Je(t.request);var r=t.request;r.url=t.url,r.requestFunction=function(a){var i=e.responseType,o=ne(e.headers,t.headers),s=e.overrideMimeType,u=e.method,c=e.data,p=n.c.defer(),f=n.t(a)?a:t.url,l=Ge._Implementations.loadWithXhr(f,i,u,c,o,p,s);return n.t(l)&&n.t(l.abort)&&(r.cancelFunction=function(){l.abort()}),p.promise};var a=xe.request(r);if(n.t(a))return a.then((function(e){return e})).otherwise((function(a){return r.state!==pe.FAILED?n.c.reject(a):t.retryOnError(a).then((function(i){return i?(r.state=pe.UNISSUED,r.deferred=void 0,t.fetch(e)):n.c.reject(a)}))}))};var We=/^data:(.*?)(;base64)?,(.*)$/;function $e(e,t){var r=decodeURIComponent(t);return e?atob(r):r}function et(e,t){for(var r=$e(e,t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i"u";Ge._Implementations.loadWithXhr=function(e,t,a,i,o,s,u){var p=We.exec(e);if(null===p){if(!rt){var f=new XMLHttpRequest;if(ze.contains(e)&&(f.withCredentials=!0),e=e.replace(/{/g,"%7B").replace(/}/g,"%7D"),f.open(a,e,!0),n.t(u)&&n.t(f.overrideMimeType)&&f.overrideMimeType(u),n.t(o))for(var l in o)o.hasOwnProperty(l)&&f.setRequestHeader(l,o[l]);n.t(t)&&(f.responseType=t);var h=!1;return"string"==typeof e&&(h=0===e.indexOf("file://")||typeof window<"u"&&"file://"===window.location.origin),f.onload=function(){if(!(f.status<200||f.status>=300)||h&&0===f.status){var e=f.response,r=f.responseType;if("HEAD"===a||"OPTIONS"===a){var i=f.getAllResponseHeaders().trim().split(/[\r\n]+/),o={};return i.forEach((function(e){var t=e.split(": "),r=t.shift();o[r]=t.join(": ")})),void s.resolve(o)}if(204===f.status)s.resolve();else if(!n.t(e)||n.t(t)&&r!==t)if("json"===t&&"string"==typeof e)try{s.resolve(JSON.parse(e))}catch(e){s.reject(e)}else(""===r||"document"===r)&&n.t(f.responseXML)&&f.responseXML.hasChildNodes()?s.resolve(f.responseXML):""!==r&&"text"!==r||!n.t(f.responseText)?s.reject(new c.t("Invalid XMLHttpRequest response type.")):s.resolve(f.responseText);else s.resolve(e)}else s.reject(new he(f.status,f.response,f.getAllResponseHeaders()))},f.onerror=function(e){s.reject(new he)},f.send(i),f}!function(e,t,r,n,a,i,o){var s=require("url").parse(e),u="https:"===s.protocol?require("https"):require("http"),p=require("zlib"),f={protocol:s.protocol,hostname:s.hostname,port:s.port,path:s.path,query:s.query,method:r,headers:a};u.request(f).on("response",(function(e){if(e.statusCode<200||e.statusCode>=300)i.reject(new he(e.statusCode,e,e.headers));else{var r=[];e.on("data",(function(e){r.push(e)})),e.on("end",(function(){var n=Buffer.concat(r);"gzip"===e.headers["content-encoding"]?p.gunzip(n,(function(e,r){e?i.reject(new c.t("Error decompressing response.")):i.resolve(tt(r,t))})):i.resolve(tt(n,t))}))}})).on("error",(function(e){i.reject(new he)})).end()}(e,t,a,0,o,s)}else s.resolve(function(e,t){t=n.e(t,"");var a=e[1],i=!!e[2],o=e[3];switch(t){case"":case"text":return $e(i,o);case"arraybuffer":return et(i,o);case"blob":var s=et(i,o);return new Blob([s],{type:a});case"document":return(new DOMParser).parseFromString($e(i,o),a);case"json":return JSON.parse($e(i,o));default:throw new r.t("Unhandled responseType: "+t)}}(p,t))},Ge._Implementations.loadAndExecuteScript=function(e,t,r){return function(e){var t=n.c.defer(),r=document.createElement("script");r.async=!0,r.src=e;var a=document.getElementsByTagName("head")[0];return r.onload=function(){r.onload=void 0,a.removeChild(r),t.resolve()},r.onerror=function(e){t.reject(e)},a.appendChild(r),t.promise}(e).otherwise(r.reject)},Ge._DefaultImplementations={},Ge._DefaultImplementations.createImage=Ge._Implementations.createImage,Ge._DefaultImplementations.loadWithXhr=Ge._Implementations.loadWithXhr,Ge._DefaultImplementations.loadAndExecuteScript=Ge._Implementations.loadAndExecuteScript,Ge.DEFAULT=Object.freeze(new Ge({url:typeof document>"u"?"":document.location.href.split("?")[0]}));var nt,at,it,ot=/((?:.*\/)|^)Cesium\.js$/;function st(e){return typeof document>"u"?e:(n.t(nt)||(nt=document.createElement("a")),nt.href=e,nt.href=nt.href,nt.href)}function ut(){if(n.t(at))return at;var e;if(e=typeof CESIUM_BASE_URL<"u"?CESIUM_BASE_URL:"object"==typeof define&&n.t(define.amd)&&!define.amd.toUrlUndefined&&n.t(require.toUrl)?ae("..",ft("Core/buildModuleUrl.js")):function(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;t