!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Cesium={})}(this,(function(exports){"use strict";function defined(e){return null!=e}function DeveloperError(e){let t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return defined(this.stack)&&(e+=`\n${this.stack.toString()}`),e},DeveloperError.throwInstantiationError=function(){throw new DeveloperError("This function defines an interface and should not be called directly.")};const Check={};function getUndefinedErrorMessage(e){return`${e} is required, actual value was undefined`}function getFailedTypeErrorMessage(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}function defaultValue(e,t){return null!=e?e:t}Check.typeOf={},Check.defined=function(e,t){if(!defined(t))throw new DeveloperError(getUndefinedErrorMessage(e))},Check.typeOf.func=function(e,t){if("function"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"function",e))},Check.typeOf.string=function(e,t){if("string"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"string",e))},Check.typeOf.number=function(e,t){if("number"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"number",e))},Check.typeOf.number.lessThan=function(e,t,n){if(Check.typeOf.number(e,t),t>=n)throw new DeveloperError(`Expected ${e} to be less than ${n}, actual value was ${t}`)},Check.typeOf.number.lessThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t>n)throw new DeveloperError(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)},Check.typeOf.number.greaterThan=function(e,t,n){if(Check.typeOf.number(e,t),t<=n)throw new DeveloperError(`Expected ${e} to be greater than ${n}, actual value was ${t}`)},Check.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.init_by_array=function(e,t){var n,i,r;for(this.init_seed(19650218),n=1,i=0,r=this.N>t?this.N:t;r;r--){var o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1664525*((4294901760&o)>>>16)<<16)+1664525*(65535&o))+e[i]+i,this.mt[n]>>>=0,i++,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(r=this.N-1;r;r--){o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1566083941*((4294901760&o)>>>16)<<16)+1566083941*(65535&o))-n,this.mt[n]>>>=0,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648},MersenneTwister.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n>>1^t[1&e];for(;n>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,(e^=e>>>18)>>>0},MersenneTwister.prototype.random_int31=function(){return this.random_int()>>>1},MersenneTwister.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.random_int()*(1/4294967296)},MersenneTwister.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},MersenneTwister.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)};var mersenneTwister=MersenneTwister;const CesiumMath={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,EPSILON21:1e-21,GRAVITATIONALPARAMETER:3986004418e5,SOLAR_RADIUS:6955e5,LUNAR_RADIUS:1737400,SIXTY_FOUR_KILOBYTES:65536,FOUR_GIGABYTES:4294967296};CesiumMath.sign=defaultValue(Math.sign,(function(e){return 0===(e=+e)||e!=e?e:e>0?1:-1})),CesiumMath.signNotZero=function(e){return e<0?-1:1},CesiumMath.toSNorm=function(e,t){return t=defaultValue(t,255),Math.round((.5*CesiumMath.clamp(e,-1,1)+.5)*t)},CesiumMath.fromSNorm=function(e,t){return t=defaultValue(t,255),CesiumMath.clamp(e,0,t)/t*2-1},CesiumMath.normalize=function(e,t,n){return 0===(n=Math.max(n-t,0))?0:CesiumMath.clamp((e-t)/n,0,1)},CesiumMath.sinh=defaultValue(Math.sinh,(function(e){return(Math.exp(e)-Math.exp(-e))/2})),CesiumMath.cosh=defaultValue(Math.cosh,(function(e){return(Math.exp(e)+Math.exp(-e))/2})),CesiumMath.lerp=function(e,t,n){return(1-n)*e+n*t},CesiumMath.PI=Math.PI,CesiumMath.ONE_OVER_PI=1/Math.PI,CesiumMath.PI_OVER_TWO=Math.PI/2,CesiumMath.PI_OVER_THREE=Math.PI/3,CesiumMath.PI_OVER_FOUR=Math.PI/4,CesiumMath.PI_OVER_SIX=Math.PI/6,CesiumMath.THREE_PI_OVER_TWO=3*Math.PI/2,CesiumMath.TWO_PI=2*Math.PI,CesiumMath.ONE_OVER_TWO_PI=1/(2*Math.PI),CesiumMath.RADIANS_PER_DEGREE=Math.PI/180,CesiumMath.DEGREES_PER_RADIAN=180/Math.PI,CesiumMath.RADIANS_PER_ARCSECOND=CesiumMath.RADIANS_PER_DEGREE/3600,CesiumMath.toRadians=function(e){return e*CesiumMath.RADIANS_PER_DEGREE},CesiumMath.toDegrees=function(e){return e*CesiumMath.DEGREES_PER_RADIAN},CesiumMath.convertLongitudeRange=function(e){const t=CesiumMath.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n},CesiumMath.clampToLatitudeRange=function(e){return CesiumMath.clamp(e,-1*CesiumMath.PI_OVER_TWO,CesiumMath.PI_OVER_TWO)},CesiumMath.negativePiToPi=function(e){return e>=-CesiumMath.PI&&e<=CesiumMath.PI?e:CesiumMath.zeroToTwoPi(e+CesiumMath.PI)-CesiumMath.PI},CesiumMath.zeroToTwoPi=function(e){if(e>=0&&e<=CesiumMath.TWO_PI)return e;const t=CesiumMath.mod(e,CesiumMath.TWO_PI);return Math.abs(t)CesiumMath.EPSILON14?CesiumMath.TWO_PI:t},CesiumMath.mod=function(e,t){return CesiumMath.sign(e)===CesiumMath.sign(t)&&Math.abs(e)n},CesiumMath.greaterThanOrEquals=function(e,t,n){return e-t>-n};const factorials=[1];CesiumMath.factorial=function(e){const t=factorials.length;if(e>=t){let n=factorials[t-1];for(let i=t;i<=e;i++){const e=n*i;factorials.push(e),n=e}}return factorials[e]},CesiumMath.incrementWrap=function(e,t,n){return n=defaultValue(n,0),++e>t&&(e=n),e},CesiumMath.isPowerOfTwo=function(e){return 0!==e&&0==(e&e-1)},CesiumMath.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},CesiumMath.previousPowerOfTwo=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e=((e|=e>>32)>>>0)-(e>>>1)},CesiumMath.clamp=function(e,t,n){return en?n:e};let randomNumberGenerator$2=new mersenneTwister;function Cartesian3(e,t,n){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0)}CesiumMath.setRandomNumberSeed=function(e){randomNumberGenerator$2=new mersenneTwister(e)},CesiumMath.nextRandomNumber=function(){return randomNumberGenerator$2.random()},CesiumMath.randomBetween=function(e,t){return CesiumMath.nextRandomNumber()*(t-e)+e},CesiumMath.acosClamped=function(e){return Math.acos(CesiumMath.clamp(e,-1,1))},CesiumMath.asinClamped=function(e){return Math.asin(CesiumMath.clamp(e,-1,1))},CesiumMath.chordLength=function(e,t){return 2*t*Math.sin(.5*e)},CesiumMath.logBase=function(e,t){return Math.log(e)/Math.log(t)},CesiumMath.cbrt=defaultValue(Math.cbrt,(function(e){const t=Math.pow(Math.abs(e),1/3);return e<0?-t:t})),CesiumMath.log2=defaultValue(Math.log2,(function(e){return Math.log(e)*Math.LOG2E})),CesiumMath.fog=function(e,t){const n=e*t;return 1-Math.exp(-n*n)},CesiumMath.fastApproximateAtan=function(e){return e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},CesiumMath.fastApproximateAtan2=function(e,t){let n,i=Math.abs(e);n=Math.abs(t);const r=Math.max(i,n);n=Math.min(i,n);const o=n/r;return i=CesiumMath.fastApproximateAtan(o),i=Math.abs(t)>Math.abs(e)?CesiumMath.PI_OVER_TWO-i:i,i=e<0?CesiumMath.PI-i:i,i=t<0?-i:i,i},Cartesian3.fromSpherical=function(e,t){defined(t)||(t=new Cartesian3);const n=e.clock,i=e.cone,r=defaultValue(e.magnitude,1),o=r*Math.sin(i);return t.x=o*Math.cos(n),t.y=o*Math.sin(n),t.z=r*Math.cos(i),t},Cartesian3.fromElements=function(e,t,n,i){return defined(i)?(i.x=e,i.y=t,i.z=n,i):new Cartesian3(e,t,n)},Cartesian3.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new Cartesian3(e.x,e.y,e.z)},Cartesian3.fromCartesian4=Cartesian3.clone,Cartesian3.packedLength=3,Cartesian3.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t},Cartesian3.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian3),n.x=e[t++],n.y=e[t++],n.z=e[t],n},Cartesian3.packArray=function(e,t){const n=e.length,i=3*n;defined(t)?(Array.isArray(t)||t.length===i)&&t.length!==i&&(t.length=i):t=new Array(i);for(let i=0;iCesiumMath.EPSILON12);return defined(r)?(r.x=o*v,r.y=a*E,r.z=s*b,r):new Cartesian3(o*v,a*E,s*b)}function Cartographic(e,t,n){this.longitude=defaultValue(e,0),this.latitude=defaultValue(t,0),this.height=defaultValue(n,0)}Cartographic.fromRadians=function(e,t,n,i){return n=defaultValue(n,0),defined(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Cartographic(e,t,n)},Cartographic.fromDegrees=function(e,t,n,i){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartographic.fromRadians(e,t,n,i)};const cartesianToCartographicN$1=new Cartesian3,cartesianToCartographicP$1=new Cartesian3,cartesianToCartographicH$1=new Cartesian3,wgs84OneOverRadii=new Cartesian3(1/6378137,1/6378137,1/6356752.314245179),wgs84OneOverRadiiSquared=new Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),wgs84CenterToleranceSquared=CesiumMath.EPSILON1;function initialize$e(e,t,n,i){t=defaultValue(t,0),n=defaultValue(n,0),i=defaultValue(i,0),e._radii=new Cartesian3(t,n,i),e._radiiSquared=new Cartesian3(t*t,n*n,i*i),e._radiiToTheFourth=new Cartesian3(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new Cartesian3(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),e._oneOverRadiiSquared=new Cartesian3(0===t?0:1/(t*t),0===n?0:1/(n*n),0===i?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function Ellipsoid(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,initialize$e(this,e,t,n)}Cartographic.fromCartesian=function(e,t,n){const i=defined(t)?t.oneOverRadii:wgs84OneOverRadii,r=defined(t)?t.oneOverRadiiSquared:wgs84OneOverRadiiSquared,o=scaleToGeodeticSurface(e,i,r,defined(t)?t._centerToleranceSquared:wgs84CenterToleranceSquared,cartesianToCartographicP$1);if(!defined(o))return;let a=Cartesian3.multiplyComponents(o,r,cartesianToCartographicN$1);a=Cartesian3.normalize(a,a);const s=Cartesian3.subtract(e,o,cartesianToCartographicH$1),c=Math.atan2(a.y,a.x),l=Math.asin(a.z),u=CesiumMath.sign(Cartesian3.dot(s,e))*Cartesian3.magnitude(s);return defined(n)?(n.longitude=c,n.latitude=l,n.height=u,n):new Cartographic(c,l,u)},Cartographic.toCartesian=function(e,t,n){return Cartesian3.fromRadians(e.longitude,e.latitude,e.height,t,n)},Cartographic.clone=function(e,t){if(defined(e))return defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Cartographic(e.longitude,e.latitude,e.height)},Cartographic.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},Cartographic.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},Cartographic.ZERO=Object.freeze(new Cartographic(0,0,0)),Cartographic.prototype.clone=function(e){return Cartographic.clone(this,e)},Cartographic.prototype.equals=function(e){return Cartographic.equals(this,e)},Cartographic.prototype.equalsEpsilon=function(e,t){return Cartographic.equalsEpsilon(this,e,t)},Cartographic.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(Ellipsoid.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),Ellipsoid.clone=function(e,t){if(!defined(e))return;const n=e._radii;return defined(t)?(Cartesian3.clone(n,t._radii),Cartesian3.clone(e._radiiSquared,t._radiiSquared),Cartesian3.clone(e._radiiToTheFourth,t._radiiToTheFourth),Cartesian3.clone(e._oneOverRadii,t._oneOverRadii),Cartesian3.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new Ellipsoid(n.x,n.y,n.z)},Ellipsoid.fromCartesian3=function(e,t){return defined(t)||(t=new Ellipsoid),defined(e)?(initialize$e(t,e.x,e.y,e.z),t):t},Ellipsoid.WGS84=Object.freeze(new Ellipsoid(6378137,6378137,6356752.314245179)),Ellipsoid.UNIT_SPHERE=Object.freeze(new Ellipsoid(1,1,1)),Ellipsoid.MOON=Object.freeze(new Ellipsoid(CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS,CesiumMath.LUNAR_RADIUS)),Ellipsoid.prototype.clone=function(e){return Ellipsoid.clone(this,e)},Ellipsoid.packedLength=Cartesian3.packedLength,Ellipsoid.pack=function(e,t,n){return n=defaultValue(n,0),Cartesian3.pack(e._radii,t,n),t},Ellipsoid.unpack=function(e,t,n){t=defaultValue(t,0);const i=Cartesian3.unpack(e,t);return Ellipsoid.fromCartesian3(i,n)},Ellipsoid.prototype.geocentricSurfaceNormal=Cartesian3.normalize,Ellipsoid.prototype.geodeticSurfaceNormalCartographic=function(e,t){const n=e.longitude,i=e.latitude,r=Math.cos(i),o=r*Math.cos(n),a=r*Math.sin(n),s=Math.sin(i);return defined(t)||(t=new Cartesian3),t.x=o,t.y=a,t.z=s,Cartesian3.normalize(t,t)},Ellipsoid.prototype.geodeticSurfaceNormal=function(e,t){if(!Cartesian3.equalsEpsilon(e,Cartesian3.ZERO,CesiumMath.EPSILON14))return defined(t)||(t=new Cartesian3),t=Cartesian3.multiplyComponents(e,this._oneOverRadiiSquared,t),Cartesian3.normalize(t,t)};const cartographicToCartesianNormal=new Cartesian3,cartographicToCartesianK=new Cartesian3;Ellipsoid.prototype.cartographicToCartesian=function(e,t){const n=cartographicToCartesianNormal,i=cartographicToCartesianK;this.geodeticSurfaceNormalCartographic(e,n),Cartesian3.multiplyComponents(this._radiiSquared,n,i);const r=Math.sqrt(Cartesian3.dot(n,i));return Cartesian3.divideByScalar(i,r,i),Cartesian3.multiplyByScalar(n,e.height,n),defined(t)||(t=new Cartesian3),Cartesian3.add(i,n,t)},Ellipsoid.prototype.cartographicArrayToCartesianArray=function(e,t){const n=e.length;defined(t)?t.length=n:t=new Array(n);for(let i=0;i=this._radii.z-t))return n};const abscissas=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],weights=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function gaussLegendreQuadrature(e,t,n){const i=.5*(t+e),r=.5*(t-e);let o=0;for(let e=0;e<5;e++){const t=r*abscissas[e];o+=weights[e]*(n(i+t)+n(i-t))}return o*=r,o}function GeographicProjection(e){this._ellipsoid=defaultValue(e,Ellipsoid.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Ellipsoid.prototype.surfaceArea=function(e){const t=e.west;let n=e.east;const i=e.south,r=e.north;for(;ni&&(r=t,i=n)}let o=1,a=0;const s=rowVal[r],c=colVal[r];if(Math.abs(e[Matrix3.getElementIndex(c,s)])>n){const t=(e[Matrix3.getElementIndex(c,c)]-e[Matrix3.getElementIndex(s,s)])/2/e[Matrix3.getElementIndex(c,s)];let n;n=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+n*n),a=n*o}return(t=Matrix3.clone(Matrix3.IDENTITY,t))[Matrix3.getElementIndex(s,s)]=t[Matrix3.getElementIndex(c,c)]=o,t[Matrix3.getElementIndex(c,s)]=a,t[Matrix3.getElementIndex(s,c)]=-a,t}const jMatrix=new Matrix3,jMatrixTranspose=new Matrix3;Matrix3.computeEigenDecomposition=function(e,t){const n=CesiumMath.EPSILON20;let i=0,r=0;defined(t)||(t={});const o=t.unitary=Matrix3.clone(Matrix3.IDENTITY,t.unitary),a=t.diagonal=Matrix3.clone(e,t.diagonal),s=n*computeFrobeniusNorm(a);for(;r<10&&offDiagonalFrobeniusNorm(a)>s;)shurDecomposition(a,jMatrix),Matrix3.transpose(jMatrix,jMatrixTranspose),Matrix3.multiply(a,jMatrix,a),Matrix3.multiply(jMatrixTranspose,a,a),Matrix3.multiply(o,jMatrix,o),++i>2&&(++r,i=0);return t},Matrix3.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},Matrix3.determinant=function(e){const t=e[0],n=e[3],i=e[6],r=e[1],o=e[4],a=e[7],s=e[2],c=e[5],l=e[8];return t*(o*l-c*a)+r*(c*i-n*l)+s*(n*a-o*i)},Matrix3.inverse=function(e,t){const n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=Matrix3.determinant(e);t[0]=a*u-l*s,t[1]=l*r-i*u,t[2]=i*s-a*r,t[3]=c*s-o*u,t[4]=n*u-c*r,t[5]=o*r-n*s,t[6]=o*l-c*a,t[7]=c*i-n*l,t[8]=n*a-o*i;const h=1/d;return Matrix3.multiplyByScalar(t,h,t)};const scratchTransposeMatrix$1=new Matrix3;function Cartesian4(e,t,n,i){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(n,0),this.w=defaultValue(i,0)}Matrix3.inverseTranspose=function(e,t){return Matrix3.inverse(Matrix3.transpose(e,scratchTransposeMatrix$1),t)},Matrix3.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},Matrix3.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n},Matrix3.IDENTITY=Object.freeze(new Matrix3(1,0,0,0,1,0,0,0,1)),Matrix3.ZERO=Object.freeze(new Matrix3(0,0,0,0,0,0,0,0,0)),Matrix3.COLUMN0ROW0=0,Matrix3.COLUMN0ROW1=1,Matrix3.COLUMN0ROW2=2,Matrix3.COLUMN1ROW0=3,Matrix3.COLUMN1ROW1=4,Matrix3.COLUMN1ROW2=5,Matrix3.COLUMN2ROW0=6,Matrix3.COLUMN2ROW1=7,Matrix3.COLUMN2ROW2=8,Object.defineProperties(Matrix3.prototype,{length:{get:function(){return Matrix3.packedLength}}}),Matrix3.prototype.clone=function(e){return Matrix3.clone(this,e)},Matrix3.prototype.equals=function(e){return Matrix3.equals(this,e)},Matrix3.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]},Matrix3.prototype.equalsEpsilon=function(e,t){return Matrix3.equalsEpsilon(this,e,t)},Matrix3.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})`},Cartesian4.fromElements=function(e,t,n,i,r){return defined(r)?(r.x=e,r.y=t,r.z=n,r.w=i,r):new Cartesian4(e,t,n,i)},Cartesian4.fromColor=function(e,t){return defined(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new Cartesian4(e.red,e.green,e.blue,e.alpha)},Cartesian4.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Cartesian4(e.x,e.y,e.z,e.w)},Cartesian4.packedLength=4,Cartesian4.pack=function(e,t,n){return n=defaultValue(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t},Cartesian4.unpack=function(e,t,n){return t=defaultValue(t,0),defined(n)||(n=new Cartesian4),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n},Cartesian4.packArray=function(e,t){const n=e.length,i=4*n;defined(t)?(Array.isArray(t)||t.length===i)&&t.length!==i&&(t.length=i):t=new Array(i);for(let i=0;i=0?c.longitude:c.longitude+CesiumMath.TWO_PI;r=Math.min(r,l),o=Math.max(o,l)}return i-n>o-r&&(n=r,i=o,i>CesiumMath.PI&&(i-=CesiumMath.TWO_PI),n>CesiumMath.PI&&(n-=CesiumMath.TWO_PI)),defined(t)?(t.west=n,t.south=a,t.east=i,t.north=s,t):new Rectangle(n,a,i,s)},Rectangle.fromCartesianArray=function(e,t,n){t=defaultValue(t,Ellipsoid.WGS84);let i=Number.MAX_VALUE,r=-Number.MAX_VALUE,o=Number.MAX_VALUE,a=-Number.MAX_VALUE,s=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let n=0,l=e.length;n=0?l.longitude:l.longitude+CesiumMath.TWO_PI;o=Math.min(o,u),a=Math.max(a,u)}return r-i>a-o&&(i=o,r=a,r>CesiumMath.PI&&(r-=CesiumMath.TWO_PI),i>CesiumMath.PI&&(i-=CesiumMath.TWO_PI)),defined(n)?(n.west=i,n.south=s,n.east=r,n.north=c,n):new Rectangle(i,s,r,c)},Rectangle.clone=function(e,t){if(defined(e))return defined(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new Rectangle(e.west,e.south,e.east,e.north)},Rectangle.equalsEpsilon=function(e,t,n){return n=defaultValue(n,0),e===t||defined(e)&&defined(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n},Rectangle.prototype.clone=function(e){return Rectangle.clone(this,e)},Rectangle.prototype.equals=function(e){return Rectangle.equals(this,e)},Rectangle.equals=function(e,t){return e===t||defined(e)&&defined(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},Rectangle.prototype.equalsEpsilon=function(e,t){return Rectangle.equalsEpsilon(this,e,t)},Rectangle.validate=function(e){},Rectangle.southwest=function(e,t){return defined(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Cartographic(e.west,e.south)},Rectangle.northwest=function(e,t){return defined(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Cartographic(e.west,e.north)},Rectangle.northeast=function(e,t){return defined(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Cartographic(e.east,e.north)},Rectangle.southeast=function(e,t){return defined(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Cartographic(e.east,e.south)},Rectangle.center=function(e,t){let n=e.east;const i=e.west;n0?i+=CesiumMath.TWO_PI:o0&&(o+=CesiumMath.TWO_PI),i=u?void 0:defined(n)?(n.west=s,n.south=l,n.east=c,n.north=u,n):new Rectangle(s,l,c,u)},Rectangle.simpleIntersection=function(e,t,n){const i=Math.max(e.west,t.west),r=Math.max(e.south,t.south),o=Math.min(e.east,t.east),a=Math.min(e.north,t.north);if(!(r>=a||i>=o))return defined(n)?(n.west=i,n.south=r,n.east=o,n.north=a,n):new Rectangle(i,r,o,a)},Rectangle.union=function(e,t,n){defined(n)||(n=new Rectangle);let i=e.east,r=e.west,o=t.east,a=t.west;i0?i+=CesiumMath.TWO_PI:o0&&(o+=CesiumMath.TWO_PI),ir||CesiumMath.equalsEpsilon(n,r,CesiumMath.EPSILON14))&&(n=e.south&&i<=e.north};const subsampleLlaScratch=new Cartographic;function BoundingSphere(e,t){this.center=Cartesian3.clone(defaultValue(e,Cartesian3.ZERO)),this.radius=defaultValue(t,0)}Rectangle.subsample=function(e,t,n,i){t=defaultValue(t,Ellipsoid.WGS84),n=defaultValue(n,0),defined(i)||(i=[]);let r=0;const o=e.north,a=e.south,s=e.east,c=e.west,l=subsampleLlaScratch;l.height=n,l.longitude=c,l.latitude=o,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.longitude=s,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.latitude=a,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.longitude=c,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.latitude=o<0?o:a>0?a:0;for(let n=1;n<8;++n)l.longitude=-Math.PI+n*CesiumMath.PI_OVER_TWO,Rectangle.contains(e,l)&&(i[r]=t.cartographicToCartesian(l,i[r]),r++);return 0===l.latitude&&(l.longitude=c,i[r]=t.cartographicToCartesian(l,i[r]),r++,l.longitude=s,i[r]=t.cartographicToCartesian(l,i[r]),r++),i.length=r,i},Rectangle.subsection=function(e,t,n,i,r,o){if(defined(o)||(o=new Rectangle),e.west<=e.east){const n=e.east-e.west;o.west=e.west+t*n,o.east=e.west+i*n}else{const n=CesiumMath.TWO_PI+e.east-e.west;o.west=CesiumMath.negativePiToPi(e.west+t*n),o.east=CesiumMath.negativePiToPi(e.west+i*n)}const a=e.north-e.south;return o.south=e.south+n*a,o.north=e.south+r*a,1===t&&(o.west=e.east),1===i&&(o.east=e.east),1===n&&(o.south=e.north),1===r&&(o.north=e.north),o},Rectangle.MAX_VALUE=Object.freeze(new Rectangle(-Math.PI,-CesiumMath.PI_OVER_TWO,Math.PI,CesiumMath.PI_OVER_TWO));const fromPointsXMin=new Cartesian3,fromPointsYMin=new Cartesian3,fromPointsZMin=new Cartesian3,fromPointsXMax=new Cartesian3,fromPointsYMax=new Cartesian3,fromPointsZMax=new Cartesian3,fromPointsCurrentPos=new Cartesian3,fromPointsScratch=new Cartesian3,fromPointsRitterCenter=new Cartesian3,fromPointsMinBoxPt=new Cartesian3,fromPointsMaxBoxPt=new Cartesian3,fromPointsNaiveCenterScratch=new Cartesian3,volumeConstant=4/3*CesiumMath.PI;BoundingSphere.fromPoints=function(e,t){if(defined(t)||(t=new BoundingSphere),!defined(e)||0===e.length)return t.center=Cartesian3.clone(Cartesian3.ZERO,t.center),t.radius=0,t;const n=Cartesian3.clone(e[0],fromPointsCurrentPos),i=Cartesian3.clone(n,fromPointsXMin),r=Cartesian3.clone(n,fromPointsYMin),o=Cartesian3.clone(n,fromPointsZMin),a=Cartesian3.clone(n,fromPointsXMax),s=Cartesian3.clone(n,fromPointsYMax),c=Cartesian3.clone(n,fromPointsZMax),l=e.length;let u;for(u=1;ua.x&&Cartesian3.clone(n,a),ls.y&&Cartesian3.clone(n,s),dc.z&&Cartesian3.clone(n,c)}const d=Cartesian3.magnitudeSquared(Cartesian3.subtract(a,i,fromPointsScratch)),h=Cartesian3.magnitudeSquared(Cartesian3.subtract(s,r,fromPointsScratch)),p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch));let f=i,m=a,g=d;h>g&&(g=h,f=r,m=s),p>g&&(g=p,f=o,m=c);const _=fromPointsRitterCenter;_.x=.5*(f.x+m.x),_.y=.5*(f.y+m.y),_.z=.5*(f.z+m.z);let y=Cartesian3.magnitudeSquared(Cartesian3.subtract(m,_,fromPointsScratch)),C=Math.sqrt(y);const T=fromPointsMinBoxPt;T.x=i.x,T.y=r.y,T.z=o.z;const S=fromPointsMaxBoxPt;S.x=a.x,S.y=s.y,S.z=c.z;const A=Cartesian3.midpoint(T,S,fromPointsNaiveCenterScratch);let v=0;for(u=0;uv&&(v=t);const i=Cartesian3.magnitudeSquared(Cartesian3.subtract(n,_,fromPointsScratch));if(i>y){const e=Math.sqrt(i);C=.5*(C+e),y=C*C;const t=e-C;_.x=(C*_.x+t*n.x)/e,_.y=(C*_.y+t*n.y)/e,_.z=(C*_.z+t*n.z)/e}}return Cc.x&&Cartesian3.clone(r,c),il.y&&Cartesian3.clone(r,l),du.z&&Cartesian3.clone(r,u)}const p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),f=Cartesian3.magnitudeSquared(Cartesian3.subtract(l,a,fromPointsScratch)),m=Cartesian3.magnitudeSquared(Cartesian3.subtract(u,s,fromPointsScratch));let g=o,_=c,y=p;f>y&&(y=f,g=a,_=l),m>y&&(y=m,g=s,_=u);const C=fromPointsRitterCenter;C.x=.5*(g.x+_.x),C.y=.5*(g.y+_.y),C.z=.5*(g.z+_.z);let T=Cartesian3.magnitudeSquared(Cartesian3.subtract(_,C,fromPointsScratch)),S=Math.sqrt(T);const A=fromPointsMinBoxPt;A.x=o.x,A.y=a.y,A.z=s.z;const v=fromPointsMaxBoxPt;v.x=c.x,v.y=l.y,v.z=u.z;const E=Cartesian3.midpoint(A,v,fromPointsNaiveCenterScratch);let b=0;for(h=0;hb&&(b=n);const i=Cartesian3.magnitudeSquared(Cartesian3.subtract(r,C,fromPointsScratch));if(i>T){const e=Math.sqrt(i);S=.5*(S+e),T=S*S;const t=e-S;C.x=(S*C.x+t*r.x)/e,C.y=(S*C.y+t*r.y)/e,C.z=(S*C.z+t*r.z)/e}}return Ss.x&&Cartesian3.clone(i,s),uc.y&&Cartesian3.clone(i,c),hl.z&&Cartesian3.clone(i,l)}const h=Cartesian3.magnitudeSquared(Cartesian3.subtract(s,r,fromPointsScratch)),p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch)),f=Cartesian3.magnitudeSquared(Cartesian3.subtract(l,a,fromPointsScratch));let m=r,g=s,_=h;p>_&&(_=p,m=o,g=c),f>_&&(_=f,m=a,g=l);const y=fromPointsRitterCenter;y.x=.5*(m.x+g.x),y.y=.5*(m.y+g.y),y.z=.5*(m.z+g.z);let C=Cartesian3.magnitudeSquared(Cartesian3.subtract(g,y,fromPointsScratch)),T=Math.sqrt(C);const S=fromPointsMinBoxPt;S.x=r.x,S.y=o.y,S.z=a.z;const A=fromPointsMaxBoxPt;A.x=s.x,A.y=c.y,A.z=l.z;const v=Cartesian3.midpoint(S,A,fromPointsNaiveCenterScratch);let E=0;for(d=0;dE&&(E=n);const r=Cartesian3.magnitudeSquared(Cartesian3.subtract(i,y,fromPointsScratch));if(r>C){const e=Math.sqrt(r);T=.5*(T+e),C=T*T;const t=e-T;y.x=(T*y.x+t*i.x)/e,y.y=(T*y.y+t*i.y)/e,y.z=(T*y.z+t*i.z)/e}}return T=c+a)return e.clone(n),n;if(a>=c+r)return t.clone(n),n;const l=.5*(r+c+a),u=Cartesian3.multiplyByScalar(s,(-r+l)/c,unionScratchCenter);return Cartesian3.add(u,i,u),Cartesian3.clone(u,n.center),n.radius=l,n};const expandScratch=new Cartesian3;BoundingSphere.expand=function(e,t,n){n=BoundingSphere.clone(e,n);const i=Cartesian3.magnitude(Cartesian3.subtract(t,n.center,expandScratch));return i>n.radius&&(n.radius=i),n},BoundingSphere.intersectPlane=function(e,t){const n=e.center,i=e.radius,r=t.normal,o=Cartesian3.dot(r,n)+t.distance;return o<-i?Intersect$1.OUTSIDE:o= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,m=String.fromCharCode;function g(e){throw new RangeError(p[e])}function _(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function y(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+_((e=e.replace(h,".")).split("."),t).join(".")}function C(e){for(var t,n,i=[],r=0,o=e.length;r=55296&&t<=56319&&r65535&&(t+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=m(e)})).join("")}function S(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function A(e,t,n){var i=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;i+=l)e=f(e/35);return f(i+36*e/(e+38))}function v(e){var t,n,i,r,o,a,s,u,d,h,p,m=[],_=e.length,y=0,C=128,S=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i=128&&g("not-basic"),m.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<_;){for(o=y,a=1,s=l;r>=_&&g("invalid-input"),((u=(p=e.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:l)>=l||u>f((c-y)/a))&&g("overflow"),y+=u*a,!(u<(d=s<=S?1:s>=S+26?26:s-S));s+=l)a>f(c/(h=l-d))&&g("overflow"),a*=h;S=A(y-o,t=m.length+1,0==o),f(y/t)>c-C&&g("overflow"),C+=f(y/t),y%=t,m.splice(y++,0,C)}return T(m)}function E(e){var t,n,i,r,o,a,s,u,d,h,p,_,y,T,v,E=[];for(_=(e=C(e)).length,t=128,n=0,o=72,a=0;a<_;++a)(p=e[a])<128&&E.push(m(p));for(i=r=E.length,r&&E.push("-");i<_;){for(s=c,a=0;a<_;++a)(p=e[a])>=t&&pf((c-n)/(y=i+1))&&g("overflow"),n+=(s-t)*y,t=s,a=0;a<_;++a)if((p=e[a])c&&g("overflow"),p==t){for(u=n,d=l;!(u<(h=d<=o?1:d>=o+26?26:d-o));d+=l)v=u-h,T=l-h,E.push(m(S(h+v%T,0))),u=f(v/T);E.push(m(S(u,0))),o=A(n,y,i==r),n=0,++i}++n,++t}return E.join("")}if(a={version:"1.3.2",ucs2:{decode:C,encode:T},decode:v,encode:E,toASCII:function(e){return y(e,(function(e){return d.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return y(e,(function(e){return u.test(e)?v(e.slice(4).toLowerCase()):e}))}},i&&r)if(e.exports==i)r.exports=a;else for(s in a)a.hasOwnProperty(s)&&(i[s]=a[s]);else n.punycode=a}(commonjsGlobal)})),IPv6=createCommonjsModule((function(e){ /*! * URI.js - Mutating URLs * IPv6 Support * * Version: 1.19.8 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */var t,n;t=commonjsGlobal,n=function(e){var t=e&&e.IPv6;return{best:function(e){var t,n,i=e.toLowerCase().split(":"),r=i.length,o=8;for(""===i[0]&&""===i[1]&&""===i[2]?(i.shift(),i.shift()):""===i[0]&&""===i[1]?i.shift():""===i[r-1]&&""===i[r-2]&&i.pop(),-1!==i[(r=i.length)-1].indexOf(".")&&(o=7),t=0;t1;s++)n.splice(0,1);i[a]=n.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(a=0;al&&(c=d,l=u)):"0"===i[a]&&(h=!0,d=a,u=1);u>l&&(c=d,l=u),l>1&&i.splice(c,l,""),r=i.length;var p="";for(""===i[0]&&(p=":"),a=0;a=e.length-1)return!1;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return!1;var r=n.list[e.slice(t+1)];return!!r&&r.indexOf(" "+e.slice(i+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return null;var r=n.list[e.slice(t+1)];return r?r.indexOf(" "+e.slice(i+1,t)+" ")<0?null:e.slice(i+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n},e.exports?e.exports=n():t.SecondLevelDomains=n(t)})),URI=createCommonjsModule((function(e){ /*! * URI.js - Mutating URLs * * Version: 1.19.8 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */var t,n;t=commonjsGlobal,n=function(e,t,n,i){var r=i&&i.URI;function o(e,t){var n=arguments.length>=1,i=arguments.length>=2;if(!(this instanceof o))return n?i?new o(e,t):new o(e):new o;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}o.version="1.19.8";var a=o.prototype,s=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function u(e){return"Array"===l(e)}function d(e,t){var n,i,r={};if("RegExp"===l(t))r=null;else if(u(t))for(n=0,i=t.length;n]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o.encode=g,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=g,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(e,t){var n=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},o.decodeQuery=function(e,t){e+="",void 0===t&&(t=o.escapeQuerySpace);try{return o.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var _,y={encode:"encode",decode:"decode"},C=function(e,t){return function(n){try{return o[t](n+"").replace(o.characters[e][t].expression,(function(n){return o.characters[e][t].map[n]}))}catch(e){return n}}};for(_ in y)o[_+"PathSegment"]=C("pathname",y[_]),o[_+"UrnPathSegment"]=C("urnpath",y[_]);var T=function(e,t,n){return function(i){var r;r=n?function(e){return o[t](o[n](e))}:o[t];for(var a=(i+"").split(e),s=0,c=a.length;s-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),(n=e.indexOf("?"))>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),"//"===(e=e.replace(/^(https?|ftp|wss?)?:[/\\]*/i,"$1://")).substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3).replace(/\\/g,"/")?(e=e.substring(n+3),e=o.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},o.parseHost=function(e,t){e||(e="");var n,i,r=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===r&&(r=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,r)||null,"/"===t.port&&(t.port=null);else{var a=e.indexOf(":"),s=e.indexOf("/"),c=e.indexOf(":",a+1);-1!==c&&(-1===s||c-1?r:e.length-1);return a>-1&&(-1===r||a-1?p.slice(0,f)+p.slice(f).replace(a,""):p.replace(a,"")).length<=l[0].length||n.ignore&&n.ignore.test(p))){var _=t(p,u,h=u+p.length,e);void 0!==_?(_=String(_),e=e.slice(0,u)+_+e.slice(h),i.lastIndex=u+_.length):i.lastIndex=h}}return i.lastIndex=0,e},o.ensureValidHostname=function(t,n){var i=!!t,r=!1;if(!!n&&(r=h(o.hostProtocols,n)),r&&!i)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(o.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},o.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},o.noConflict=function(e){if(e){var t={URI:this.noConflict()};return i.URITemplate&&"function"==typeof i.URITemplate.noConflict&&(t.URITemplate=i.URITemplate.noConflict()),i.IPv6&&"function"==typeof i.IPv6.noConflict&&(t.IPv6=i.IPv6.noConflict()),i.SecondLevelDomains&&"function"==typeof i.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=i.SecondLevelDomains.noConflict()),t}return i.URI===this&&(i.URI=r),this},a.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},a.clone=function(){return new o(this)},a.valueOf=a.toString=function(){return this.build(!1)._string},a.protocol=S("protocol"),a.username=S("username"),a.password=S("password"),a.hostname=S("hostname"),a.port=S("port"),a.query=A("query","?"),a.fragment=A("fragment","#"),a.search=function(e,t){var n=this.query(e,t);return"string"==typeof n&&n.length?"?"+n:n},a.hash=function(e,t){var n=this.fragment(e,t);return"string"==typeof n&&n.length?"#"+n:n},a.pathname=function(e,t){if(void 0===e||!0===e){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(n):n}return this._parts.urn?this._parts.path=e?o.recodeUrnPath(e):"":this._parts.path=e?o.recodePath(e):"/",this.build(!t),this},a.path=a.pathname,a.href=function(e,t){var n;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var i=e instanceof o,r="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName&&(e=e[o.getDomAttribute(e)]||"",r=!1),!i&&r&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!i&&!r)throw new TypeError("invalid input");var a=i?e._parts:e;for(n in a)"query"!==n&&s.call(this._parts,n)&&(this._parts[n]=a[n]);a.query&&this.query(a.query,!1)}return this.build(!t),this},a.is=function(e){var t=!1,i=!1,r=!1,a=!1,s=!1,c=!1,l=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,i=o.ip4_expression.test(this._parts.hostname),r=o.ip6_expression.test(this._parts.hostname),s=(a=!(t=i||r))&&n&&n.has(this._parts.hostname),c=a&&o.idn_expression.test(this._parts.hostname),l=a&&o.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return a;case"sld":return s;case"ip":return t;case"ip4":case"ipv4":case"inet4":return i;case"ip6":case"ipv6":case"inet6":return r;case"idn":return c;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var v=a.protocol,E=a.port,b=a.hostname;a.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return v.call(this,e,t)},a.scheme=a.protocol,a.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),o.ensureValidPort(e))),E.call(this,e,t))},a.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var n={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&o.ensureValidHostname(e,this._parts.protocol)}return b.call(this,e,t)},a.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=this.protocol();return this.authority()?(n?n+"://":"")+this.authority():""}var i=o(e);return this.protocol(i.protocol()).authority(i.authority()).build(!t),this},a.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildHost(this._parts):"";if("/"!==o.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},a.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildAuthority(this._parts):"";if("/"!==o.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},a.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=o.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},a.resource=function(e,t){var n;return void 0===e?this.path()+this.search()+this.hash():(n=o.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},a.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var i=this._parts.hostname.length-this.domain().length,r=this._parts.hostname.substring(0,i),a=new RegExp("^"+c(r));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&o.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(a,e),this.build(!t),this},a.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var i=this._parts.hostname.length-this.tld(t).length-1;return i=this._parts.hostname.lastIndexOf(".",i-1)+1,this._parts.hostname.substring(i)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(o.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var r=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(r,e)}return this.build(!t),this},a.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var i=this._parts.hostname.lastIndexOf("."),r=this._parts.hostname.substring(i+1);return!0!==t&&n&&n.list[r.toLowerCase()]&&n.get(this._parts.hostname)||r}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},a.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var n=this._parts.path.length-this.filename().length-1,i=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?o.decodePath(i):i}var r=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,r),s=new RegExp("^"+c(a));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e),this.build(!t),this},a.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var n=this._parts.path.lastIndexOf("/"),i=this._parts.path.substring(n+1);return e?o.decodePathSegment(i):i}var r=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(r=!0);var a=new RegExp(c(this.filename())+"$");return e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e),r?this.normalizePath(t):this.build(!t),this},a.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var n,i,r=this.filename(),a=r.lastIndexOf(".");return-1===a?"":(n=r.substring(a+1),i=/^[a-z0-9%]+$/i.test(n)?n:"",e?o.decodePathSegment(i):i)}"."===e.charAt(0)&&(e=e.substring(1));var s,l=this.suffix();if(l)s=e?new RegExp(c(l)+"$"):new RegExp(c("."+l)+"$");else{if(!e)return this;this._parts.path+="."+o.recodePath(e)}return s&&(e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e)),this.build(!t),this},a.segment=function(e,t,n){var i=this._parts.urn?":":"/",r=this.path(),o="/"===r.substring(0,1),a=r.split(i);if(void 0!==e&&"number"!=typeof e&&(n=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(o&&a.shift(),e<0&&(e=Math.max(a.length+e,0)),void 0===t)return void 0===e?a:a[e];if(null===e||void 0===a[e])if(u(t)){a=[];for(var s=0,c=t.length;s>>0,a=Math.max(0,Math.min(t,g)),l=[],c=g-a+1,u=[],d=s(),a)for(m=d.progress,p=function(e){u.push(e),--c||(h=p=f,d.reject(u))},h=function(e){l.push(e),--a||(h=p=f,d.resolve(l))},_=0;_>>0,n=[],l=s(),o)for(a=function(e,r){i(e,t).then((function(e){n[r]=e,--o||l.resolve(n)}),l.reject)},c=0;ce;)if(null!=(n=t[--i])&&"function"!=typeof n)throw new Error("arg "+i+" must be a function")}function f(){}function m(e){return e}return i.defer=s,i.resolve=r,i.reject=function(e){return i(e,a)},i.join=function(){return d(arguments,m)},i.all=u,i.map=d,i.reduce=function(n,r){var o=t.call(arguments,1);return i(n,(function(t){var n;return n=t.length,o[0]=function(e,t,o){return i(e,(function(e){return i(t,(function(t){return r(e,t,o,n)}))}))},e.apply(t,o)}))},i.any=function(e,t,n,i){return l(e,1,(function(e){return t?t(e[0]):e[0]}),n,i)},i.some=l,i.chain=function(e,t,n){var r=arguments.length>2;return i(e,(function(e){return e=r?n:e,t.resolve(e),e}),(function(e){return t.reject(e),a(e)}),t.progress)},i.isPromise=c,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then((function(){return e}))},spread:function(e){return this.then((function(t){return u(t,(function(t){return e.apply(n,t)}))}))}},t=[].slice,e=[].reduce||function(e){var t,n,i,r,o;if(o=0,r=(t=Object(this)).length>>>0,(n=arguments).length<=1)for(;;){if(o in t){i=t[o++];break}if(++o>=r)throw new TypeError}else i=n[1];for(;o0){const e=i.substring(0,r),n=i.substring(r+2);t[e]=n}}return t}function RequestErrorEvent(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,"string"==typeof this.responseHeaders&&(this.responseHeaders=parseResponseHeaders(this.responseHeaders))}function Event(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}function compareNumber(e,t){return t-e}function Heap(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}function swap$3(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function sortRequests(e,t){return e.priority-t.priority}Request.prototype.cancel=function(){this.cancelled=!0},Request.prototype.clone=function(e){return defined(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 Request(this)},RequestErrorEvent.prototype.toString=function(){let e="Request has failed.";return defined(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e},Object.defineProperties(Event.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),Event.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}},Event.prototype.removeEventListener=function(e,t){const n=this._listeners,i=this._scopes;let r=-1;for(let o=0;o0){for(r.sort(compareNumber),e=0;e=0;--t)this.heapify(t)},Heap.prototype.insert=function(e){const t=this._array,n=this._comparator,i=this._maximumLength;let r,o=this._length++;for(oi&&(r=t[i],this._length=i),r},Heap.prototype.pop=function(e){if(e=defaultValue(e,0),0===this._length)return;const t=this._array,n=t[e];return swap$3(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};const statistics={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let priorityHeapLength=20;const requestHeap=new Heap({comparator:sortRequests});requestHeap.maximumLength=priorityHeapLength,requestHeap.reserve(priorityHeapLength);const activeRequests=[];let numberOfActiveRequestsByServer={};const pageUri="undefined"!=typeof document?new URI(document.location.href):new URI,requestCompletedEvent=new Event;function RequestScheduler(){}function updatePriority(e){defined(e.priorityFunction)&&(e.priority=e.priorityFunction())}function issueRequest(e){return e.state===RequestState$1.UNISSUED&&(e.state=RequestState$1.ISSUED,e.deferred=when.defer()),e.deferred.promise}function getRequestReceivedFunction(e){return function(t){if(e.state===RequestState$1.CANCELLED)return;const n=e.deferred;--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],requestCompletedEvent.raiseEvent(),e.state=RequestState$1.RECEIVED,e.deferred=void 0,n.resolve(t)}}function getRequestFailedFunction(e){return function(t){e.state!==RequestState$1.CANCELLED&&(++statistics.numberOfFailedRequests,--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],requestCompletedEvent.raiseEvent(t),e.state=RequestState$1.FAILED,e.deferred.reject(t))}}function startRequest(e){const t=issueRequest(e);return e.state=RequestState$1.ACTIVE,activeRequests.push(e),++statistics.numberOfActiveRequests,++statistics.numberOfActiveRequestsEver,++numberOfActiveRequestsByServer[e.serverKey],e.requestFunction().then(getRequestReceivedFunction(e)).otherwise(getRequestFailedFunction(e)),t}function cancelRequest(e){const t=e.state===RequestState$1.ACTIVE;if(e.state=RequestState$1.CANCELLED,++statistics.numberOfCancelledRequests,defined(e.deferred)){const t=e.deferred;e.deferred=void 0,t.reject()}t&&(--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],++statistics.numberOfCancelledActiveRequests),defined(e.cancelFunction)&&e.cancelFunction()}function updateStatistics(){RequestScheduler.debugShowStatistics&&(0===statistics.numberOfActiveRequests&&statistics.lastNumberOfActiveRequests>0&&(statistics.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${statistics.numberOfAttemptedRequests}`),statistics.numberOfAttemptedRequests=0),statistics.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${statistics.numberOfCancelledRequests}`),statistics.numberOfCancelledRequests=0),statistics.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${statistics.numberOfCancelledActiveRequests}`),statistics.numberOfCancelledActiveRequests=0),statistics.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${statistics.numberOfFailedRequests}`),statistics.numberOfFailedRequests=0)),statistics.lastNumberOfActiveRequests=statistics.numberOfActiveRequests)}RequestScheduler.maximumRequests=50,RequestScheduler.maximumRequestsPerServer=6,RequestScheduler.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18},RequestScheduler.throttleRequests=!0,RequestScheduler.debugShowStatistics=!1,RequestScheduler.requestCompletedEvent=requestCompletedEvent,Object.defineProperties(RequestScheduler,{statistics:{get:function(){return statistics}},priorityHeapLength:{get:function(){return priorityHeapLength},set:function(e){if(ee;){cancelRequest(requestHeap.pop())}priorityHeapLength=e,requestHeap.maximumLength=e,requestHeap.reserve(e)}}}),RequestScheduler.serverHasOpenSlots=function(e,t){t=defaultValue(t,1);const n=defaultValue(RequestScheduler.requestsByServer[e],RequestScheduler.maximumRequestsPerServer);return numberOfActiveRequestsByServer[e]+t<=n},RequestScheduler.heapHasOpenSlots=function(e){return requestHeap.length+e<=priorityHeapLength},RequestScheduler.update=function(){let e,t,n=0;const i=activeRequests.length;for(e=0;e0&&(activeRequests[e-n]=t):++n;activeRequests.length-=n;const r=requestHeap.internalArray,o=requestHeap.length;for(e=0;e0;)t=requestHeap.pop(),t.cancelled?cancelRequest(t):!t.throttleByServer||RequestScheduler.serverHasOpenSlots(t.serverKey)?(startRequest(t),++s):cancelRequest(t);updateStatistics()},RequestScheduler.getServerKey=function(e){let t=new URI(e);""===t.scheme()&&(t=new URI(e).absoluteTo(pageUri),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${"https"===t.scheme()?"443":"80"}`);return defined(numberOfActiveRequestsByServer[n])||(numberOfActiveRequestsByServer[n]=0),n},RequestScheduler.request=function(e){if(isDataUri(e.url)||isBlobUri(e.url))return requestCompletedEvent.raiseEvent(),e.state=RequestState$1.RECEIVED,e.requestFunction();if(++statistics.numberOfAttemptedRequests,defined(e.serverKey)||(e.serverKey=RequestScheduler.getServerKey(e.url)),RequestScheduler.throttleRequests&&e.throttleByServer&&!RequestScheduler.serverHasOpenSlots(e.serverKey))return;if(!RequestScheduler.throttleRequests||!e.throttle)return startRequest(e);if(activeRequests.length>=RequestScheduler.maximumRequests)return;updatePriority(e);const t=requestHeap.insert(e);if(defined(t)){if(t===e)return;cancelRequest(t)}return issueRequest(e)},RequestScheduler.clearForSpecs=function(){for(;requestHeap.length>0;){cancelRequest(requestHeap.pop())}const e=activeRequests.length;for(let t=0;t0}}}),Resource.prototype.toString=function(){return this.getUrlComponent(!0,!0)},Resource.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;const n=new URI(this._url);e&&stringifyQuery(n,this);let i=n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}");const r=this._templateValues;return i=i.replace(/{(.*?)}/g,(function(e,t){const n=r[t];return defined(n)?encodeURIComponent(n):e})),t&&defined(this.proxy)&&(i=this.proxy.getURL(i)),i},Resource.prototype.setQueryParameters=function(e,t){this._queryParameters=t?combineQueryParameters(this._queryParameters,e,!1):combineQueryParameters(e,this._queryParameters,!1)},Resource.prototype.appendQueryParameters=function(e){this._queryParameters=combineQueryParameters(e,this._queryParameters,!0)},Resource.prototype.setTemplateValues=function(e,t){this._templateValues=t?combine$2(this._templateValues,e):combine$2(e,this._templateValues)},Resource.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,defined(e.url)){const n=new URI(e.url);parseQuery(n,t,!0,defaultValue(e.preserveQueryParameters,!1)),n.fragment(""),""!==n.scheme()?t._url=n.toString():t._url=n.absoluteTo(new URI(getAbsoluteUri(this._url))).toString()}return defined(e.queryParameters)&&(t._queryParameters=combine$2(e.queryParameters,t._queryParameters)),defined(e.templateValues)&&(t._templateValues=combine$2(e.templateValues,t.templateValues)),defined(e.headers)&&(t.headers=combine$2(e.headers,t.headers)),defined(e.proxy)&&(t.proxy=e.proxy),defined(e.request)&&(t.request=e.request),defined(e.retryCallback)&&(t.retryCallback=e.retryCallback),defined(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t},Resource.prototype.retryOnError=function(e){const t=this.retryCallback;if("function"!=typeof t||this._retryCount>=this.retryAttempts)return when(!1);const n=this;return when(t(this,e)).then((function(e){return++n._retryCount,e}))},Resource.prototype.clone=function(e){return defined(e)||(e=new Resource({url:this._url})),e._url=this._url,e._queryParameters=clone$1(this._queryParameters),e._templateValues=clone$1(this._templateValues),e.headers=clone$1(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e},Resource.prototype.getBaseUri=function(e){return getBaseUri(this.getUrlComponent(e),e)},Resource.prototype.appendForwardSlash=function(){this._url=appendForwardSlash(this._url)},Resource.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},Resource.fetchArrayBuffer=function(e){return new Resource(e).fetchArrayBuffer()},Resource.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},Resource.fetchBlob=function(e){return new Resource(e).fetchBlob()},Resource.prototype.fetchImage=function(e){e=defaultValue(e,defaultValue.EMPTY_OBJECT);const t=defaultValue(e.preferImageBitmap,!1),n=defaultValue(e.preferBlob,!1),i=defaultValue(e.flipY,!1),r=defaultValue(e.skipColorSpaceConversion,!1);if(checkAndResetRequest(this.request),!xhrBlobSupported||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return fetchImage({resource:this,flipY:i,skipColorSpaceConversion:r,preferImageBitmap:t});const o=this.fetchBlob();if(!defined(o))return;let a,s,c,l;return Resource.supportsImageBitmapOptions().then((function(e){return a=e,s=a&&t,o})).then((function(e){if(!defined(e))return;if(l=e,s)return Resource.createImageBitmapFromBlob(e,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:r});const t=window.URL.createObjectURL(e);return c=new Resource({url:t}),fetchImage({resource:c,flipY:i,skipColorSpaceConversion:r,preferImageBitmap:!1})})).then((function(e){if(defined(e))return e.blob=l,s||window.URL.revokeObjectURL(c.url),e})).otherwise((function(e){return defined(c)&&window.URL.revokeObjectURL(c.url),e.blob=l,when.reject(e)}))},Resource.fetchImage=function(e){return new Resource(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})},Resource.prototype.fetchText=function(){return this.fetch({responseType:"text"})},Resource.fetchText=function(e){return new Resource(e).fetchText()},Resource.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(defined(e))return e.then((function(e){if(defined(e))return JSON.parse(e)}))},Resource.fetchJson=function(e){return new Resource(e).fetchJson()},Resource.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},Resource.fetchXML=function(e){return new Resource(e).fetchXML()},Resource.prototype.fetchJsonp=function(e){let t;e=defaultValue(e,"callback"),checkAndResetRequest(this.request);do{t=`loadJsonp${CesiumMath.nextRandomNumber().toString().substring(2,8)}`}while(defined(window[t]));return fetchJsonp(this,e,t)},Resource.fetchJsonp=function(e){return new Resource(e).fetchJsonp(e.callbackParameterName)},Resource.prototype._makeRequest=function(e){const t=this;checkAndResetRequest(t.request);const n=t.request;n.url=t.url,n.requestFunction=function(){const i=e.responseType,r=combine$2(e.headers,t.headers),o=e.overrideMimeType,a=e.method,s=e.data,c=when.defer(),l=Resource._Implementations.loadWithXhr(t.url,i,a,s,r,c,o);return defined(l)&&defined(l.abort)&&(n.cancelFunction=function(){l.abort()}),c.promise};const i=RequestScheduler.request(n);if(defined(i))return i.then((function(e){return n.cancelFunction=void 0,e})).otherwise((function(i){return n.cancelFunction=void 0,n.state!==RequestState$1.FAILED?when.reject(i):t.retryOnError(i).then((function(r){return r?(n.state=RequestState$1.UNISSUED,n.deferred=void 0,t.fetch(e)):when.reject(i)}))}))};const dataUriRegex$1=/^data:(.*?)(;base64)?,(.*)$/;function decodeDataUriText(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function decodeDataUriArrayBuffer(e,t){const n=decodeDataUriText(e,t),i=new ArrayBuffer(n.length),r=new Uint8Array(i);for(let e=0;e=300)return void o.reject(new RequestErrorEvent(e.statusCode,e,e.headers));const n=[];e.on("data",(function(e){n.push(e)})),e.on("end",(function(){const i=Buffer.concat(n);"gzip"===e.headers["content-encoding"]?l.gunzip(i,(function(e,n){e?o.reject(new RuntimeError("Error decompressing response.")):o.resolve(decodeResponse(n,t))})):o.resolve(decodeResponse(i,t))}))})).on("error",(function(e){o.reject(new RequestErrorEvent)})).end()}Resource.prototype.fetch=function(e){return(e=defaultClone(e,{})).method="GET",this._makeRequest(e)},Resource.fetch=function(e){return new Resource(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.delete=function(e){return(e=defaultClone(e,{})).method="DELETE",this._makeRequest(e)},Resource.delete=function(e){return new Resource(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})},Resource.prototype.head=function(e){return(e=defaultClone(e,{})).method="HEAD",this._makeRequest(e)},Resource.head=function(e){return new Resource(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.options=function(e){return(e=defaultClone(e,{})).method="OPTIONS",this._makeRequest(e)},Resource.options=function(e){return new Resource(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.post=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="POST",t.data=e,this._makeRequest(t)},Resource.post=function(e){return new Resource(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.put=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="PUT",t.data=e,this._makeRequest(t)},Resource.put=function(e){return new Resource(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource.prototype.patch=function(e,t){return Check.defined("data",e),(t=defaultClone(t,{})).method="PATCH",t.data=e,this._makeRequest(t)},Resource.patch=function(e){return new Resource(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})},Resource._Implementations={},Resource._Implementations.createImage=function(e,t,n,i,r,o){const a=e.url;Resource.supportsImageBitmapOptions().then((function(s){if(!s||!o)return void loadImageElement(a,t,n);const c=when.defer(),l=Resource._Implementations.loadWithXhr(a,"blob","GET",void 0,void 0,c,void 0,void 0,void 0);return defined(l)&&defined(l.abort)&&(e.cancelFunction=function(){l.abort()}),c.promise.then((function(e){if(defined(e))return Resource.createImageBitmapFromBlob(e,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:r});n.reject(new RuntimeError(`Successfully retrieved ${a} but it contained no content.`))})).then(n.resolve)})).otherwise(n.reject)},Resource.createImageBitmapFromBlob=function(e,t){return Check.defined("options",t),Check.typeOf.bool("options.flipY",t.flipY),Check.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),Check.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};const noXMLHttpRequest="undefined"==typeof XMLHttpRequest;Resource._Implementations.loadWithXhr=function(e,t,n,i,r,o,a){const s=dataUriRegex$1.exec(e);if(null!==s)return void o.resolve(decodeDataUri(s,t));if(noXMLHttpRequest)return void loadWithHttpRequest(e,t,n,i,r,o);const c=new XMLHttpRequest;if(TrustedServers.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),defined(a)&&defined(c.overrideMimeType)&&c.overrideMimeType(a),defined(r))for(const e in r)r.hasOwnProperty(e)&&c.setRequestHeader(e,r[e]);defined(t)&&(c.responseType=t);let l=!1;return"string"==typeof e&&(l=0===e.indexOf("file://")||"undefined"!=typeof window&&"file://"===window.location.origin),c.onload=function(){if((c.status<200||c.status>=300)&&(!l||0!==c.status))return void o.reject(new RequestErrorEvent(c.status,c.response,c.getAllResponseHeaders()));const e=c.response,i=c.responseType;if("HEAD"===n||"OPTIONS"===n){const e=c.getAllResponseHeaders().trim().split(/[\r\n]+/),t={};return e.forEach((function(e){const n=e.split(": "),i=n.shift();t[i]=n.join(": ")})),void o.resolve(t)}if(204===c.status)o.resolve();else if(!defined(e)||defined(t)&&i!==t)if("json"===t&&"string"==typeof e)try{o.resolve(JSON.parse(e))}catch(e){o.reject(e)}else(""===i||"document"===i)&&defined(c.responseXML)&&c.responseXML.hasChildNodes()?o.resolve(c.responseXML):""!==i&&"text"!==i||!defined(c.responseText)?o.reject(new RuntimeError("Invalid XMLHttpRequest response type.")):o.resolve(c.responseText);else o.resolve(e)},c.onerror=function(e){o.reject(new RequestErrorEvent)},c.send(i),c},Resource._Implementations.loadAndExecuteScript=function(e,t,n){return loadAndExecuteScript(e).otherwise(n.reject)},Resource._DefaultImplementations={},Resource._DefaultImplementations.createImage=Resource._Implementations.createImage,Resource._DefaultImplementations.loadWithXhr=Resource._Implementations.loadWithXhr,Resource._DefaultImplementations.loadAndExecuteScript=Resource._Implementations.loadAndExecuteScript,Resource.DEFAULT=Object.freeze(new Resource({url:"undefined"==typeof document?"":document.location.href.split("?")[0]}));const cesiumScriptRegex=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function getBaseUrlFromCesiumScript(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t=r&&(l=r-1);let u=(i.north-e.latitude)/s|0;return u>=o&&(u=o-1),defined(n)?(n.x=l,n.y=u,n):new Cartesian2(l,u)};const scratchDiagonalCartesianNE=new Cartesian3,scratchDiagonalCartesianSW=new Cartesian3,scratchDiagonalCartographic=new Cartographic,scratchCenterCartesian=new Cartesian3,scratchSurfaceCartesian=new Cartesian3,scratchBoundingSphere$4=new BoundingSphere,tilingScheme=new GeographicTilingScheme,scratchCorners=[new Cartographic,new Cartographic,new Cartographic,new Cartographic],scratchTileXY=new Cartesian2,ApproximateTerrainHeights={};function getTileXYLevel(e){Cartographic.fromRadians(e.east,e.north,0,scratchCorners[0]),Cartographic.fromRadians(e.west,e.north,0,scratchCorners[1]),Cartographic.fromRadians(e.east,e.south,0,scratchCorners[2]),Cartographic.fromRadians(e.west,e.south,0,scratchCorners[3]);let t=0,n=0,i=0,r=0;const o=ApproximateTerrainHeights._terrainHeightsMaxLevel;let a;for(a=0;a<=o;++a){let e=!1;for(let t=0;t<4;++t){const n=scratchCorners[t];if(tilingScheme.positionToTileXY(n,a,scratchTileXY),0===t)i=scratchTileXY.x,r=scratchTileXY.y;else if(i!==scratchTileXY.x||r!==scratchTileXY.y){e=!0;break}}if(e)break;t=i,n=r}if(0!==a)return{x:t,y:n,level:a>o?o:a-1}} /*! @license DOMPurify 2.3.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.6/LICENSE */ function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1?n-1:0),r=1;r/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _toConsumableArray$1(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:getGlobal(),t=function(e){return createDOMPurify(e)};if(t.version="2.3.6",t.removed=[],!e||!e.document||9!==e.document.nodeType)return t.isSupported=!1,t;var n=e.document,i=e.document,r=e.DocumentFragment,o=e.HTMLTemplateElement,a=e.Node,s=e.Element,c=e.NodeFilter,l=e.NamedNodeMap,u=void 0===l?e.NamedNodeMap||e.MozNamedAttrMap:l,d=e.HTMLFormElement,h=e.DOMParser,p=e.trustedTypes,f=s.prototype,m=lookupGetter(f,"cloneNode"),g=lookupGetter(f,"nextSibling"),_=lookupGetter(f,"childNodes"),y=lookupGetter(f,"parentNode");if("function"==typeof o){var C=i.createElement("template");C.content&&C.content.ownerDocument&&(i=C.content.ownerDocument)}var T=_createTrustedTypesPolicy(p,n),S=T?T.createHTML(""):"",A=i,v=A.implementation,E=A.createNodeIterator,b=A.createDocumentFragment,x=A.getElementsByTagName,P=n.importNode,D={};try{D=clone(i).documentMode?i.documentMode:{}}catch(e){}var w={};t.isSupported="function"==typeof y&&v&&void 0!==v.createHTMLDocument&&9!==D;var M=MUSTACHE_EXPR,I=ERB_EXPR,R=DATA_ATTR,O=ARIA_ATTR,B=IS_SCRIPT_OR_DATA,L=ATTR_WHITESPACE,F=IS_ALLOWED_URI,N=null,V=addToSet({},[].concat(_toConsumableArray$1(html),_toConsumableArray$1(svg),_toConsumableArray$1(svgFilters),_toConsumableArray$1(mathMl),_toConsumableArray$1(text))),$=null,k=addToSet({},[].concat(_toConsumableArray$1(html$1),_toConsumableArray$1(svg$1),_toConsumableArray$1(mathMl$1),_toConsumableArray$1(xml))),U=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,z=null,H=!0,W=!0,q=!1,j=!1,X=!1,Y=!1,K=!1,J=!1,Q=!1,Z=!1,ee=!0,te=!0,ne=!1,ie={},re=null,oe=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ae=null,se=addToSet({},["audio","video","img","source","image","track"]),ce=null,le=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",de="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml",pe=he,fe=!1,me=void 0,ge=["application/xhtml+xml","text/html"],_e="text/html",ye=void 0,Ce=null,Te=i.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Ae=function(e){Ce&&Ce===e||(e&&"object"===(void 0===e?"undefined":_typeof(e))||(e={}),e=clone(e),N="ALLOWED_TAGS"in e?addToSet({},e.ALLOWED_TAGS):V,$="ALLOWED_ATTR"in e?addToSet({},e.ALLOWED_ATTR):k,ce="ADD_URI_SAFE_ATTR"in e?addToSet(clone(le),e.ADD_URI_SAFE_ATTR):le,ae="ADD_DATA_URI_TAGS"in e?addToSet(clone(se),e.ADD_DATA_URI_TAGS):se,re="FORBID_CONTENTS"in e?addToSet({},e.FORBID_CONTENTS):oe,G="FORBID_TAGS"in e?addToSet({},e.FORBID_TAGS):{},z="FORBID_ATTR"in e?addToSet({},e.FORBID_ATTR):{},ie="USE_PROFILES"in e&&e.USE_PROFILES,H=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,j=e.SAFE_FOR_TEMPLATES||!1,X=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,Z=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||F,pe=e.NAMESPACE||he,e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(U.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),me=me=-1===ge.indexOf(e.PARSER_MEDIA_TYPE)?_e:e.PARSER_MEDIA_TYPE,ye="application/xhtml+xml"===me?function(e){return e}:stringToLowerCase,j&&(W=!1),Q&&(J=!0),ie&&(N=addToSet({},[].concat(_toConsumableArray$1(text))),$=[],!0===ie.html&&(addToSet(N,html),addToSet($,html$1)),!0===ie.svg&&(addToSet(N,svg),addToSet($,svg$1),addToSet($,xml)),!0===ie.svgFilters&&(addToSet(N,svgFilters),addToSet($,svg$1),addToSet($,xml)),!0===ie.mathMl&&(addToSet(N,mathMl),addToSet($,mathMl$1),addToSet($,xml))),e.ADD_TAGS&&(N===V&&(N=clone(N)),addToSet(N,e.ADD_TAGS)),e.ADD_ATTR&&($===k&&($=clone($)),addToSet($,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&addToSet(ce,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(re===oe&&(re=clone(re)),addToSet(re,e.FORBID_CONTENTS)),te&&(N["#text"]=!0),X&&addToSet(N,["html","head","body"]),N.table&&(addToSet(N,["tbody"]),delete G.tbody),freeze&&freeze(e),Ce=e)},ve=addToSet({},["mi","mo","mn","ms","mtext"]),Ee=addToSet({},["foreignobject","desc","title","annotation-xml"]),be=addToSet({},svg);addToSet(be,svgFilters),addToSet(be,svgDisallowed);var xe=addToSet({},mathMl);addToSet(xe,mathMlDisallowed);var Pe=function(e){var t=y(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});var n=stringToLowerCase(e.tagName),i=stringToLowerCase(t.tagName);if(e.namespaceURI===de)return t.namespaceURI===he?"svg"===n:t.namespaceURI===ue?"svg"===n&&("annotation-xml"===i||ve[i]):Boolean(be[n]);if(e.namespaceURI===ue)return t.namespaceURI===he?"math"===n:t.namespaceURI===de?"math"===n&&Ee[i]:Boolean(xe[n]);if(e.namespaceURI===he){if(t.namespaceURI===de&&!Ee[i])return!1;if(t.namespaceURI===ue&&!ve[i])return!1;var r=addToSet({},["title","style","font","a","script"]);return!xe[n]&&(r[n]||!be[n])}return!1},De=function(e){arrayPush(t.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=S}catch(t){e.remove()}}},we=function(e,n){try{arrayPush(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch(e){arrayPush(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),"is"===e&&!$[e])if(J||Q)try{De(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,n=void 0;if(K)e=""+e;else{var r=stringMatch(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===me&&(e=''+e+"");var o=T?T.createHTML(e):e;if(pe===he)try{t=(new h).parseFromString(o,me)}catch(e){}if(!t||!t.documentElement){t=v.createDocument(pe,"template",null);try{t.documentElement.innerHTML=fe?"":o}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),pe===he?x.call(t,X?"html":"body")[0]:X?t.documentElement:a},Ie=function(e){return E.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Re=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Oe=function(e){return"object"===(void 0===a?"undefined":_typeof(a))?e instanceof a:e&&"object"===(void 0===e?"undefined":_typeof(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Be=function(e,n,i){w[e]&&arrayForEach(w[e],(function(e){e.call(t,n,i,Ce)}))},Le=function(e){var n=void 0;if(Be("beforeSanitizeElements",e,null),Re(e))return De(e),!0;if(stringMatch(e.nodeName,/[\u0080-\uFFFF]/))return De(e),!0;var i=ye(e.nodeName);if(Be("uponSanitizeElement",e,{tagName:i,allowedTags:N}),!Oe(e.firstElementChild)&&(!Oe(e.content)||!Oe(e.content.firstElementChild))&®ExpTest(/<[/\w]/g,e.innerHTML)&®ExpTest(/<[/\w]/g,e.textContent))return De(e),!0;if("select"===i&®ExpTest(/