define(["exports","./Cartographic-67e73ef9","./Check-52a7d806","./when-92c6cf3c","./Rectangle-bab7abf0","./Intersect-b97e930a","./Math-92c3b5f7","./PrimitiveType-cdfe443e","./Event-3390cd7d","./RuntimeError-c6a62a80"],(function(e,t,r,n,o,i,a,u,s,c){"use strict";function p(e,t){this.start=n.u(e,0),this.stop=n.u(t,0)}function f(e,r){this.center=t.t.clone(n.u(e,t.t.ZERO)),this.radius=n.u(r,0)}var l=new t.t,h=new t.t,d=new t.t,y=new t.t,m=new t.t,v=new t.t,g=new t.t,q=new t.t,b=new t.t,w=new t.t,R=new t.t,O=new t.t,A=4/3*a.e.PI;f.fromPoints=function(e,r){if(n.e(r)||(r=new f),!n.e(e)||0===e.length)return r.center=t.t.clone(t.t.ZERO,r.center),r.radius=0,r;var o,i=t.t.clone(e[0],g),a=t.t.clone(i,l),u=t.t.clone(i,h),s=t.t.clone(i,d),c=t.t.clone(i,y),p=t.t.clone(i,m),A=t.t.clone(i,v),x=e.length;for(o=1;oc.x&&t.t.clone(i,c),Ep.y&&t.t.clone(i,p),_A.z&&t.t.clone(i,A)}var C=t.t.magnitudeSquared(t.t.subtract(c,a,q)),I=t.t.magnitudeSquared(t.t.subtract(p,u,q)),T=t.t.magnitudeSquared(t.t.subtract(A,s,q)),P=a,U=c,B=C;I>B&&(B=I,P=u,U=p),T>B&&(B=T,P=s,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.t.magnitudeSquared(t.t.subtract(U,k,q)),D=Math.sqrt(j),z=w;z.x=a.x,z.y=u.y,z.z=s.z;var L=R;L.x=c.x,L.y=p.y,L.z=A.z;var K=t.t.midpoint(z,L,O),M=0;for(o=0;oM&&(M=F);var N=t.t.magnitudeSquared(t.t.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.t.clone(u,x),IS.y&&t.t.clone(u,S),TE.z&&t.t.clone(u,E)}var P=t.t.magnitudeSquared(t.t.subtract(x,c,q)),U=t.t.magnitudeSquared(t.t.subtract(S,p,q)),B=t.t.magnitudeSquared(t.t.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.t.magnitudeSquared(t.t.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.t.midpoint(M,F,O),H=0;for(s=0;s<_;s+=i){u.x=e[s]+o.x,u.y=e[s+1]+o.y,u.z=e[s+2]+o.z;var V=t.t.magnitude(t.t.subtract(u,N,q));V>H&&(H=V);var Y=t.t.magnitudeSquared(t.t.subtract(u,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*u.x)/J,z.y=(K*z.y+X*u.y)/J,z.z=(K*z.z+X*u.z)/J}}return Kp.x&&t.t.clone(i,p),_A.y&&t.t.clone(i,A),Cx.z&&t.t.clone(i,x)}var I=t.t.magnitudeSquared(t.t.subtract(p,u,q)),T=t.t.magnitudeSquared(t.t.subtract(A,s,q)),P=t.t.magnitudeSquared(t.t.subtract(x,c,q)),U=u,B=p,k=I;T>k&&(k=T,U=s,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.t.magnitudeSquared(t.t.subtract(B,j,q)),z=Math.sqrt(D),L=w;L.x=u.x,L.y=s.y,L.z=c.z;var K=R;K.x=p.x,K.y=A.y,K.z=x.z;var M=t.t.midpoint(L,K,O),F=0;for(a=0;aF&&(F=N);var H=t.t.magnitudeSquared(t.t.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+u)return o.clone(i),i;var h=.5*(u+l+c),d=t.t.multiplyByScalar(p,(-u+h)/l,j);return t.t.add(d,a,d),t.t.clone(d,i.center),i.radius=h,i};var D=new t.t;f.expand=function(e,n,o){r.o.typeOf.object("sphere",e),r.o.typeOf.object("point",n),o=f.clone(e,o);var i=t.t.magnitude(t.t.subtract(n,o.center,D));return i>o.radius&&(o.radius=i),o},f.intersectPlane=function(e,n){r.o.typeOf.object("sphere",e),r.o.typeOf.object("plane",n);var o=e.center,a=e.radius,u=n.normal,s=t.t.dot(u,o)+n.distance;return s<-a?i.S.OUTSIDE:s"u")return e;t=n.u(o.baseURI,o.location.href)}var i=new G(t);return new G(e).resolve(i).toString()};var ie,ae=/^blob:/i;function ue(e){return r.o.typeOf.string("uri",e),ae.test(e)}var se=/^data:/i;function ce(e){return r.o.typeOf.string("uri",e),se.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.u(e,n.u.EMPTY_OBJECT);var t=n.u(e.throttleByServer,!1),r=n.u(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=n.u(e.priority,0),this.throttle=r,this.throttleByServer=t,this.type=n.u(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 a=o.substring(0,i),u=o.substring(i+2);t[a]=u}}return t}(this.responseHeaders))}function de(e){r.o.typeOf.object("options",e),r.o.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function ye(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.e(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.e(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.u(e,this._length),this._array.length=e},de.prototype.heapify=function(e){e=n.u(e,0);for(var t=this._length,r=this._comparator,o=this._array,i=-1,a=!0;a;){var u=2*(e+1),s=u-1;i=s=0;--t)this.heapify(t)},de.prototype.insert=function(e){r.o.defined("element",e);var t,o=this._array,i=this._comparator,a=this._maximumLength,u=this._length++;for(ua&&(t=o[a],o.pop(),this._length=a),t},de.prototype.pop=function(e){if(e=n.u(e,0),0!==this._length){r.o.typeOf.number.lessThan("index",e,this._length);var t=this._array,o=t[e];return ye(t,e,--this._length),t[this._length]=void 0,this.heapify(e),o}};var me=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 s.o;function xe(){}function Se(e){n.e(e.priorityFunction)&&(e.priority=e.priorityFunction())}function Ee(e){var t=n.u(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.e(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.e(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={},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 o=be.internalArray,i=be.length;for(e=0;e0;){var r=t.pop();r.cancelled?De(r):Ie(r)}Ue()}();for(var a=Math.max(xe.maximumRequests-we.length,0),u=0;u0;)(t=be.pop()).cancelled?De(t):!t.throttleByServer||Ee(t.serverKey)?(je(t),++u):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.o.typeOf.string("url",e);var t=new G(e).resolve(Oe);t.normalize();var o=t.authority;/:/.test(o)||(o=o+":"+("https"===t.scheme?"443":"80"));var i=Re[o];return n.e(i)||(Re[o]=0),o},xe.request=function(e){if(r.o.typeOf.object("request",e),r.o.typeOf.string("request.url",e.url),r.o.typeOf.func("request.requestFunction",e.requestFunction),ce(e.url)||ue(e.url))return Ae.raiseEvent(),e.state=pe.RECEIVED,e.requestFunction();if(++ge.numberOfAttemptedRequests,n.e(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.e(r)||(r=xe.blockDefer[t]=n.o.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 o=function(e){var t=_e(e),r=xe.packRequestHeap[t];return n.e(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 a=0;a0;){De(be.pop())}for(var e=we.length,t=0;t2){var s=o[i].indexOf("=");u=[o[i].substring(0,s),o[i].substring(s+1,o[i].length)]}var c=decodeURIComponent(u[0]),p=u[1];p=n.e(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}(u);t._queryParameters=o?Xe(a,t._queryParameters,i):a,e.query=void 0}function Ve(e,t){var o=t._queryParameters,i=Object.keys(o);1!==i.length||n.e(o[i[0]])?e.query=function(e,t){if(!n.e(e))throw new r.t("obj is required.");var o="";for(var i in e)if(e.hasOwnProperty(i)){var a=e[i],u=encodeURIComponent(i)+"=";if(Array.isArray(a))for(var s=0,c=a.length;s0}}}),Ge.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;var r=new G(this._url);e&&Ve(r,this);var o=r.toString().replace(/%7B/g,"{").replace(/%7D/g,"}"),i=this._templateValues;return o=o.replace(/{(.*?)}/g,(function(e,t){var r=i[t];return n.e(r)&&"s"==t?encodeURI(r):n.e(r)?encodeURIComponent(r):e})),t&&n.e(this.proxy)&&(o=this.proxy.getURL(o)),o},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.e(e.url)){var r=new G(e.url);He(r,t,!0,n.u(e.preserveQueryParameters,!1)),r.fragment=void 0,t._url=r.resolve(new G(oe(this._url))).toString()}return n.e(e.queryParameters)&&(t._queryParameters=ne(e.queryParameters,t._queryParameters)),n.e(e.templateValues)&&(t._templateValues=ne(e.templateValues,t.templateValues)),n.e(e.headers)&&(t.headers=ne(e.headers,t.headers)),n.e(e.proxy)&&(t.proxy=e.proxy),n.e(e.request)&&(t.request=e.request),n.e(e.retryCallback)&&(t.retryCallback=e.retryCallback),n.e(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.o(!1);var r=this;return n.o(t(this,e)).then((function(e){return++r._retryCount,e}))},Ge.prototype.clone=function(e){return n.e(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.e(e))throw new r.t("uri is required.");var o="",i=e.lastIndexOf("/");return-1!==i&&(o=e.substring(0,i+1)),t&&(e=new G(e),n.e(e.query)&&(o+="?"+e.query),n.e(e.fragment)&&(o+="#"+e.fragment)),o}(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.u(e,n.u.EMPTY_OBJECT);var t=n.u(e.preferImageBitmap,!1),r=n.u(e.preferBlob,!1),o=n.u(e.flipY,!1);if(Je(this.request),!Ne||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!r)return Qe({resource:this,flipY:o,preferImageBitmap:t});var i,a,u,s=this.fetchBlob();return n.e(s)?Ge.supportsImageBitmapOptions().then((function(e){return i=e&&t,s})).then((function(e){if(n.e(e)){if(u=e,i)return Ge.createImageBitmapFromBlob(e,{flipY:o,premultiplyAlpha:!1});var t=window.URL.createObjectURL(e);return Qe({resource:a=new Ge({url:t}),flipY:o,preferImageBitmap:!1})}})).then((function(e){if(n.e(e))return e.blob=u,i||window.URL.revokeObjectURL(a.url),e})).otherwise((function(e){return n.e(a)&&window.URL.revokeObjectURL(a.url),e.blob=u,n.o.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.e(e))return e.then((function(e){if(n.e(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.u(e,"callback"),Je(this.request);do{t="loadJsonp"+Math.random().toString().substring(2,8)}while(n.e(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(o){var i=e.responseType,a=ne(e.headers,t.headers),u=e.overrideMimeType,s=e.method,c=e.data,p=n.o.defer(),f=n.e(o)?o:t.url,l=Ge._Implementations.loadWithXhr(f,i,s,c,a,p,u);return n.e(l)&&n.e(l.abort)&&(r.cancelFunction=function(){l.abort()}),p.promise};var o=xe.request(r);if(n.e(o))return o.then((function(e){return e})).otherwise((function(o){return r.state!==pe.FAILED?n.o.reject(o):t.retryOnError(o).then((function(i){return i?(r.state=pe.UNISSUED,r.deferred=void 0,t.fetch(e)):n.o.reject(o)}))}))};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),o=new Uint8Array(n),i=0;i"u";Ge._Implementations.loadWithXhr=function(e,t,o,i,a,u,s){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(o,e,!0),n.e(s)&&n.e(f.overrideMimeType)&&f.overrideMimeType(s),n.e(a))for(var l in a)a.hasOwnProperty(l)&&f.setRequestHeader(l,a[l]);n.e(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"===o||"OPTIONS"===o){var i=f.getAllResponseHeaders().trim().split(/[\r\n]+/),a={};return i.forEach((function(e){var t=e.split(": "),r=t.shift();a[r]=t.join(": ")})),void u.resolve(a)}if(204===f.status)u.resolve();else if(!n.e(e)||n.e(t)&&r!==t)if("json"===t&&"string"==typeof e)try{u.resolve(JSON.parse(e))}catch(e){u.reject(e)}else(""===r||"document"===r)&&n.e(f.responseXML)&&f.responseXML.hasChildNodes()?u.resolve(f.responseXML):""!==r&&"text"!==r||!n.e(f.responseText)?u.reject(new c.t("Invalid XMLHttpRequest response type.")):u.resolve(f.responseText);else u.resolve(e)}else u.reject(new he(f.status,f.response,f.getAllResponseHeaders()))},f.onerror=function(e){u.reject(new he)},f.send(i),f}!function(e,t,r,n,o,i,a){var u=require("url").parse(e),s="https:"===u.protocol?require("https"):require("http"),p=require("zlib"),f={protocol:u.protocol,hostname:u.hostname,port:u.port,path:u.path,query:u.query,method:r,headers:o};s.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,o,0,a,u)}else u.resolve(function(e,t){t=n.u(t,"");var o=e[1],i=!!e[2],a=e[3];switch(t){case"":case"text":return $e(i,a);case"arraybuffer":return et(i,a);case"blob":var u=et(i,a);return new Blob([u],{type:o});case"document":return(new DOMParser).parseFromString($e(i,a),o);case"json":return JSON.parse($e(i,a));default:throw new r.t("Unhandled responseType: "+t)}}(p,t))},Ge._Implementations.loadAndExecuteScript=function(e,t,r){return function(e){var t=n.o.defer(),r=document.createElement("script");r.async=!0,r.src=e;var o=document.getElementsByTagName("head")[0];return r.onload=function(){r.onload=void 0,o.removeChild(r),t.resolve()},r.onerror=function(e){t.reject(e)},o.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,ot,it,at=/((?:.*\/)|^)Cesium\.js$/;function ut(e){return typeof document>"u"?e:(n.e(nt)||(nt=document.createElement("a")),nt.href=e,nt.href=nt.href,nt.href)}function st(){if(n.e(ot))return ot;var e;if(e=typeof CESIUM_BASE_URL<"u"?CESIUM_BASE_URL:"object"==typeof define&&n.e(define.amd)&&!define.amd.toUrlUndefined&&n.e(require.toUrl)?oe("..",ft("Core/buildModuleUrl.js")):function(){for(var e=document.getElementsByTagName("script"),t=0,r=e.length;t