!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 appendForwardSlash(e){return 0!==e.length&&"/"===e[e.length-1]||(e=`${e}/`),e}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,i){return`Expected ${i} 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,i){if(Check.typeOf.number(e,t),t>=i)throw new DeveloperError(`Expected ${e} to be less than ${i}, actual value was ${t}`)},Check.typeOf.number.lessThanOrEquals=function(e,t,i){if(Check.typeOf.number(e,t),t>i)throw new DeveloperError(`Expected ${e} to be less than or equal to ${i}, actual value was ${t}`)},Check.typeOf.number.greaterThan=function(e,t,i){if(Check.typeOf.number(e,t),t<=i)throw new DeveloperError(`Expected ${e} to be greater than ${i}, actual value was ${t}`)},Check.typeOf.number.greaterThanOrEquals=function(e,t,i){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 i,n,r;for(this.init_seed(19650218),i=1,n=0,r=this.N>t?this.N:t;r;r--){var o=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(1664525*((4294901760&o)>>>16)<<16)+1664525*(65535&o))+e[n]+n,this.mt[i]>>>=0,n++,++i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1),n>=t&&(n=0)}for(r=this.N-1;r;r--){o=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(1566083941*((4294901760&o)>>>16)<<16)+1566083941*(65535&o))-i,this.mt[i]>>>=0,++i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=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 i;for(this.mti==this.N+1&&this.init_seed(5489),i=0;i>>1^t[1&e];for(;i>>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,i){return 0===(i=Math.max(i-t,0))?0:CesiumMath.clamp((e-t)/i,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,i){return(1-i)*e+i*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,i=e-Math.floor(e/t)*t;return i<-Math.PI?i+t:i>=Math.PI?i-t:i},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)i},CesiumMath.greaterThanOrEquals=function(e,t,i){return e-t>-i};const factorials=[1];CesiumMath.factorial=function(e){const t=factorials.length;if(e>=t){let i=factorials[t-1];for(let n=t;n<=e;n++){const e=i*n;factorials.push(e),i=e}}return factorials[e]},CesiumMath.incrementWrap=function(e,t,i){return i=defaultValue(i,0),++e>t&&(e=i),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,i){return ei?i:e};let randomNumberGenerator$2=new mersenneTwister;function clone$1(e,t){if(null===e||"object"!=typeof e)return e;t=defaultValue(t,!1);const i=new e.constructor;for(const n in e)if(e.hasOwnProperty(n)){let r=e[n];t&&(r=clone$1(r,t)),i[n]=r}return i}function Cartesian2(e,t){this.x=defaultValue(e,0),this.y=defaultValue(t,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 i=e*t;return 1-Math.exp(-i*i)},CesiumMath.fastApproximateAtan=function(e){return e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},CesiumMath.fastApproximateAtan2=function(e,t){let i,n=Math.abs(e);i=Math.abs(t);const r=Math.max(n,i);i=Math.min(n,i);const o=i/r;return n=CesiumMath.fastApproximateAtan(o),n=Math.abs(t)>Math.abs(e)?CesiumMath.PI_OVER_TWO-n:n,n=e<0?CesiumMath.PI-n:n,n=t<0?-n:n,n},Cartesian2.fromElements=function(e,t,i){return defined(i)?(i.x=e,i.y=t,i):new Cartesian2(e,t)},Cartesian2.clone=function(e,t){if(defined(e))return defined(t)?(t.x=e.x,t.y=e.y,t):new Cartesian2(e.x,e.y)},Cartesian2.fromCartesian3=Cartesian2.clone,Cartesian2.fromCartesian4=Cartesian2.clone,Cartesian2.packedLength=2,Cartesian2.pack=function(e,t,i){return i=defaultValue(i,0),t[i++]=e.x,t[i]=e.y,t},Cartesian2.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Cartesian2),i.x=e[t++],i.y=e[t],i},Cartesian2.packArray=function(e,t){const i=e.length,n=2*i;defined(t)?(Array.isArray(t)||t.length===n)&&t.length!==n&&(t.length=n):t=new Array(n);for(let n=0;n0;s--){var c=e[s].color.replace("#",""),l=e[s-1].color.replace("#",""),u=parseInt(c,16),d=parseInt(l,16),h=e[s].val,p=e[s-1].val,f=Math.floor((h-o)*a+.5),m=Math.floor((p-o)*a+.5),g=m-f;if(0!=g)for(var _=(16711680&u)>>16<<16,y=(65280&u)>>8<<16,C=(255&u)<<16,T=(16711680&d)>>16<<16,S=(65280&d)>>8<<16,A=(255&d)<<16,v=Math.floor((T-_)/g),E=Math.floor((S-y)/g),b=Math.floor((A-C)/g),x=f;x>16,i[4*x+1]=y>>16,i[4*x+2]=C>>16,i[4*x+3]=255}var P=getTexture(i,t);return this._slopeTex=P,this.slopeMapTexture=this._slopeTex,P},setSlopeMapPallete:function(e){var t=[];(e=Object.entries(e)).length>0&&e.forEach((function(e){2==e.length&&e[0]>=0&&e[0]<=90&&t.push({val:100*Math.cos(Cesium.Math.toRadians(e[0])),color:e[1]})})),0!==t.length?(t.sort((function(e,t){return e.valCesiumMath.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,i){this.longitude=defaultValue(e,0),this.latitude=defaultValue(t,0),this.height=defaultValue(i,0)}Cartographic.fromRadians=function(e,t,i,n){return i=defaultValue(i,0),defined(n)?(n.longitude=e,n.latitude=t,n.height=i,n):new Cartographic(e,t,i)},Cartographic.fromDegrees=function(e,t,i,n){return e=CesiumMath.toRadians(e),t=CesiumMath.toRadians(t),Cartographic.fromRadians(e,t,i,n)};const cartesianToCartographicN$1=new Cartesian3,cartesianToCartographicP$1=new Cartesian3,cartesianToCartographicH$1=new Cartesian3,wgs84OneOverRadii=new Cartesian3(1/ExpandBySmartEarth.Ellipsoid.x,1/ExpandBySmartEarth.Ellipsoid.y,1/ExpandBySmartEarth.Ellipsoid.z),wgs84OneOverRadiiSquared=new Cartesian3(1/(ExpandBySmartEarth.Ellipsoid.x*ExpandBySmartEarth.Ellipsoid.x),1/(ExpandBySmartEarth.Ellipsoid.y*ExpandBySmartEarth.Ellipsoid.y),1/(ExpandBySmartEarth.Ellipsoid.z*ExpandBySmartEarth.Ellipsoid.z)),wgs84CenterToleranceSquared=CesiumMath.EPSILON1;function initialize$e(e,t,i,n){t=defaultValue(t,0),i=defaultValue(i,0),n=defaultValue(n,0),e._radii=new Cartesian3(t,i,n),e._radiiSquared=new Cartesian3(t*t,i*i,n*n),e._radiiToTheFourth=new Cartesian3(t*t*t*t,i*i*i*i,n*n*n*n),e._oneOverRadii=new Cartesian3(0===t?0:1/t,0===i?0:1/i,0===n?0:1/n),e._oneOverRadiiSquared=new Cartesian3(0===t?0:1/(t*t),0===i?0:1/(i*i),0===n?0:1/(n*n)),e._minimumRadius=Math.min(t,i,n),e._maximumRadius=Math.max(t,i,n),e._centerToleranceSquared=CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function Ellipsoid(e,t,i){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,i)}Cartographic.fromCartesian=function(e,t,i){const n=defined(t)?t.oneOverRadii:wgs84OneOverRadii,r=defined(t)?t.oneOverRadiiSquared:wgs84OneOverRadiiSquared,o=scaleToGeodeticSurface(e,n,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(i)?(i.longitude=c,i.latitude=l,i.height=u,i):new Cartographic(c,l,u)},Cartographic.toCartesian=function(e,t,i){return Cartesian3.fromRadians(e.longitude,e.latitude,e.height,t,i)},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,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e.longitude-t.longitude)<=i&&Math.abs(e.latitude-t.latitude)<=i&&Math.abs(e.height-t.height)<=i},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 i=e._radii;return defined(t)?(Cartesian3.clone(i,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(i.x,i.y,i.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(ExpandBySmartEarth.Ellipsoid.x,ExpandBySmartEarth.Ellipsoid.y,ExpandBySmartEarth.Ellipsoid.z)),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,i){return i=defaultValue(i,0),Cartesian3.pack(e._radii,t,i),t},Ellipsoid.unpack=function(e,t,i){t=defaultValue(t,0);const n=Cartesian3.unpack(e,t);return Ellipsoid.fromCartesian3(n,i)},Ellipsoid.prototype.geocentricSurfaceNormal=Cartesian3.normalize,Ellipsoid.prototype.geodeticSurfaceNormalCartographic=function(e,t){const i=e.longitude,n=e.latitude,r=Math.cos(n),o=r*Math.cos(i),a=r*Math.sin(i),s=Math.sin(n);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 i=cartographicToCartesianNormal,n=cartographicToCartesianK;this.geodeticSurfaceNormalCartographic(e,i),Cartesian3.multiplyComponents(this._radiiSquared,i,n);const r=Math.sqrt(Cartesian3.dot(i,n));return Cartesian3.divideByScalar(n,r,n),Cartesian3.multiplyByScalar(i,e.height,i),defined(t)||(t=new Cartesian3),Cartesian3.add(n,i,t)},Ellipsoid.prototype.cartographicArrayToCartesianArray=function(e,t){const i=e.length;defined(t)?t.length=i:t=new Array(i);for(let n=0;n=this._radii.z-t))return i};const abscissas=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],weights=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function gaussLegendreQuadrature(e,t,i){const n=.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]*(i(n+t)+i(n-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 i=e.east;const n=e.south,r=e.north;for(;in&&(r=t,n=i)}let o=1,a=0;const s=rowVal[r],c=colVal[r];if(Math.abs(e[Matrix3.getElementIndex(c,s)])>i){const t=(e[Matrix3.getElementIndex(c,c)]-e[Matrix3.getElementIndex(s,s)])/2/e[Matrix3.getElementIndex(c,s)];let i;i=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),o=1/Math.sqrt(1+i*i),a=i*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 i=CesiumMath.EPSILON20;let n=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=i*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),++n>2&&(++r,n=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],i=e[3],n=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*n-i*l)+s*(i*a-o*n)},Matrix3.inverse=function(e,t){const i=e[0],n=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-n*u,t[2]=n*s-a*r,t[3]=c*s-o*u,t[4]=i*u-c*r,t[5]=o*r-i*s,t[6]=o*l-c*a,t[7]=c*n-i*l,t[8]=i*a-o*n;const h=1/d;return Matrix3.multiplyByScalar(t,h,t)};const scratchTransposeMatrix$1=new Matrix3;function Cartesian4(e,t,i,n){this.x=defaultValue(e,0),this.y=defaultValue(t,0),this.z=defaultValue(i,0),this.w=defaultValue(n,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,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e[0]-t[0])<=i&&Math.abs(e[1]-t[1])<=i&&Math.abs(e[2]-t[2])<=i&&Math.abs(e[3]-t[3])<=i&&Math.abs(e[4]-t[4])<=i&&Math.abs(e[5]-t[5])<=i&&Math.abs(e[6]-t[6])<=i&&Math.abs(e[7]-t[7])<=i&&Math.abs(e[8]-t[8])<=i},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,i){return e[0]===t[i]&&e[1]===t[i+1]&&e[2]===t[i+2]&&e[3]===t[i+3]&&e[4]===t[i+4]&&e[5]===t[i+5]&&e[6]===t[i+6]&&e[7]===t[i+7]&&e[8]===t[i+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,i,n,r){return defined(r)?(r.x=e,r.y=t,r.z=i,r.w=n,r):new Cartesian4(e,t,i,n)},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,i){return i=defaultValue(i,0),t[i++]=e.x,t[i++]=e.y,t[i++]=e.z,t[i]=e.w,t},Cartesian4.unpack=function(e,t,i){return t=defaultValue(t,0),defined(i)||(i=new Cartesian4),i.x=e[t++],i.y=e[t++],i.z=e[t++],i.w=e[t],i},Cartesian4.packArray=function(e,t){const i=e.length,n=4*i;defined(t)?(Array.isArray(t)||t.length===n)&&t.length!==n&&(t.length=n):t=new Array(n);for(let n=0;n=0?c.longitude:c.longitude+CesiumMath.TWO_PI;r=Math.min(r,l),o=Math.max(o,l)}return n-i>o-r&&(i=r,n=o,n>CesiumMath.PI&&(n-=CesiumMath.TWO_PI),i>CesiumMath.PI&&(i-=CesiumMath.TWO_PI)),defined(t)?(t.west=i,t.south=a,t.east=n,t.north=s,t):new Rectangle(i,a,n,s)},Rectangle.fromCartesianArray=function(e,t,i){t=defaultValue(t,Ellipsoid.WGS84);let n=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 i=0,l=e.length;i=0?l.longitude:l.longitude+CesiumMath.TWO_PI;o=Math.min(o,u),a=Math.max(a,u)}return r-n>a-o&&(n=o,r=a,r>CesiumMath.PI&&(r-=CesiumMath.TWO_PI),n>CesiumMath.PI&&(n-=CesiumMath.TWO_PI)),defined(i)?(i.west=n,i.south=s,i.east=r,i.north=c,i):new Rectangle(n,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,i){return i=defaultValue(i,0),e===t||defined(e)&&defined(t)&&Math.abs(e.west-t.west)<=i&&Math.abs(e.south-t.south)<=i&&Math.abs(e.east-t.east)<=i&&Math.abs(e.north-t.north)<=i},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 i=e.east;const n=e.west;i0?n+=CesiumMath.TWO_PI:o0&&(o+=CesiumMath.TWO_PI),n=u?void 0:defined(i)?(i.west=s,i.south=l,i.east=c,i.north=u,i):new Rectangle(s,l,c,u)},Rectangle.simpleIntersection=function(e,t,i){const n=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||n>=o))return defined(i)?(i.west=n,i.south=r,i.east=o,i.north=a,i):new Rectangle(n,r,o,a)},Rectangle.union=function(e,t,i){defined(i)||(i=new Rectangle);let n=e.east,r=e.west,o=t.east,a=t.west;n0?n+=CesiumMath.TWO_PI:o0&&(o+=CesiumMath.TWO_PI),nr||CesiumMath.equalsEpsilon(i,r,CesiumMath.EPSILON14))&&(i=e.south&&n<=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,i,n){t=defaultValue(t,Ellipsoid.WGS84),i=defaultValue(i,0),defined(n)||(n=[]);let r=0;const o=e.north,a=e.south,s=e.east,c=e.west,l=subsampleLlaScratch;l.height=i,l.longitude=c,l.latitude=o,n[r]=t.cartographicToCartesian(l,n[r]),r++,l.longitude=s,n[r]=t.cartographicToCartesian(l,n[r]),r++,l.latitude=a,n[r]=t.cartographicToCartesian(l,n[r]),r++,l.longitude=c,n[r]=t.cartographicToCartesian(l,n[r]),r++,l.latitude=o<0?o:a>0?a:0;for(let i=1;i<8;++i)l.longitude=-Math.PI+i*CesiumMath.PI_OVER_TWO,Rectangle.contains(e,l)&&(n[r]=t.cartographicToCartesian(l,n[r]),r++);return 0===l.latitude&&(l.longitude=c,n[r]=t.cartographicToCartesian(l,n[r]),r++,l.longitude=s,n[r]=t.cartographicToCartesian(l,n[r]),r++),n.length=r,n},Rectangle.subsection=function(e,t,i,n,r,o){if(defined(o)||(o=new Rectangle),e.west<=e.east){const i=e.east-e.west;o.west=e.west+t*i,o.east=e.west+n*i}else{const i=CesiumMath.TWO_PI+e.east-e.west;o.west=CesiumMath.negativePiToPi(e.west+t*i),o.east=CesiumMath.negativePiToPi(e.west+n*i)}const a=e.north-e.south;return o.south=e.south+i*a,o.north=e.south+r*a,1===t&&(o.west=e.east),1===n&&(o.east=e.east),1===i&&(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 i=Cartesian3.clone(e[0],fromPointsCurrentPos),n=Cartesian3.clone(i,fromPointsXMin),r=Cartesian3.clone(i,fromPointsYMin),o=Cartesian3.clone(i,fromPointsZMin),a=Cartesian3.clone(i,fromPointsXMax),s=Cartesian3.clone(i,fromPointsYMax),c=Cartesian3.clone(i,fromPointsZMax),l=e.length;let u;for(u=1;ua.x&&Cartesian3.clone(i,a),ls.y&&Cartesian3.clone(i,s),dc.z&&Cartesian3.clone(i,c)}const d=Cartesian3.magnitudeSquared(Cartesian3.subtract(a,n,fromPointsScratch)),h=Cartesian3.magnitudeSquared(Cartesian3.subtract(s,r,fromPointsScratch)),p=Cartesian3.magnitudeSquared(Cartesian3.subtract(c,o,fromPointsScratch));let f=n,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=n.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 n=Cartesian3.magnitudeSquared(Cartesian3.subtract(i,_,fromPointsScratch));if(n>y){const e=Math.sqrt(n);C=.5*(C+e),y=C*C;const t=e-C;_.x=(C*_.x+t*i.x)/e,_.y=(C*_.y+t*i.y)/e,_.z=(C*_.z+t*i.z)/e}}return Cc.x&&Cartesian3.clone(r,c),nl.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=i);const n=Cartesian3.magnitudeSquared(Cartesian3.subtract(r,C,fromPointsScratch));if(n>T){const e=Math.sqrt(n);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(n,s),uc.y&&Cartesian3.clone(n,c),hl.z&&Cartesian3.clone(n,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=i);const r=Cartesian3.magnitudeSquared(Cartesian3.subtract(n,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*n.x)/e,y.y=(T*y.y+t*n.y)/e,y.z=(T*y.z+t*n.z)/e}}return T=c+a)return e.clone(i),i;if(a>=c+r)return t.clone(i),i;const l=.5*(r+c+a),u=Cartesian3.multiplyByScalar(s,(-r+l)/c,unionScratchCenter);return Cartesian3.add(u,n,u),Cartesian3.clone(u,i.center),i.radius=l,i};const expandScratch=new Cartesian3;BoundingSphere.expand=function(e,t,i){i=BoundingSphere.clone(e,i);const n=Cartesian3.magnitude(Cartesian3.subtract(t,i.center,expandScratch));return n>i.radius&&(i.radius=n),i},BoundingSphere.intersectPlane=function(e,t){const i=e.center,n=e.radius,r=t.normal,o=Cartesian3.dot(r,i)+t.distance;return o<-n?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 i=e.length,n=[];i--;)n[i]=t(e[i]);return n}function y(e,t){var i=e.split("@"),n="";return i.length>1&&(n=i[0]+"@",e=i[1]),n+_((e=e.replace(h,".")).split("."),t).join(".")}function C(e){for(var t,i,n=[],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,i){var n=0;for(e=i?f(e/700):e>>1,e+=f(e/t);e>455;n+=l)e=f(e/35);return f(n+36*e/(e+38))}function v(e){var t,i,n,r,o,a,s,u,d,h,p,m=[],_=e.length,y=0,C=128,S=72;for((i=e.lastIndexOf("-"))<0&&(i=0),n=0;n=128&&g("not-basic"),m.push(e.charCodeAt(n));for(r=i>0?i+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,i,n,r,o,a,s,u,d,h,p,_,y,T,v,E=[];for(_=(e=C(e)).length,t=128,i=0,o=72,a=0;a<_;++a)(p=e[a])<128&&E.push(m(p));for(n=r=E.length,r&&E.push("-");n<_;){for(s=c,a=0;a<_;++a)(p=e[a])>=t&&pf((c-i)/(y=n+1))&&g("overflow"),i+=(s-t)*y,t=s,a=0;a<_;++a)if((p=e[a])c&&g("overflow"),p==t){for(u=i,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(i,y,n==r),i=0,++n}++i,++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}))}},n&&r)if(e.exports==n)r.exports=a;else for(s in a)a.hasOwnProperty(s)&&(n[s]=a[s]);else i.punycode=a}(commonjsGlobal)})),IPv6=createCommonjsModule((function(e){ /*! * URI.js - Mutating URLs * IPv6 Support * * Version: 1.19.10 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */var t,i;t=commonjsGlobal,i=function(e){var t=e&&e.IPv6;return{best:function(e){var t,i,n=e.toLowerCase().split(":"),r=n.length,o=8;for(""===n[0]&&""===n[1]&&""===n[2]?(n.shift(),n.shift()):""===n[0]&&""===n[1]?n.shift():""===n[r-1]&&""===n[r-2]&&n.pop(),-1!==n[(r=n.length)-1].indexOf(".")&&(o=7),t=0;t1;s++)i.splice(0,1);n[a]=i.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(a=0;al&&(c=d,l=u)):"0"===n[a]&&(h=!0,d=a,u=1);u>l&&(c=d,l=u),l>1&&n.splice(c,l,""),r=n.length;var p="";for(""===n[0]&&(p=":"),a=0;a=e.length-1)return!1;var n=e.lastIndexOf(".",t-1);if(n<=0||n>=t-1)return!1;var r=i.list[e.slice(t+1)];return!!r&&r.indexOf(" "+e.slice(n+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 n=i.list[e.slice(t+1)];return!!n&&n.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var n=e.lastIndexOf(".",t-1);if(n<=0||n>=t-1)return null;var r=i.list[e.slice(t+1)];return r?r.indexOf(" "+e.slice(n+1,t)+" ")<0?null:e.slice(n+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return i},e.exports?e.exports=i():t.SecondLevelDomains=i(t)})),URI=createCommonjsModule((function(e){ /*! * URI.js - Mutating URLs * * Version: 1.19.10 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */var t,i;t=commonjsGlobal,i=function(e,t,i,n){var r=n&&n.URI;function o(e,t){var i=arguments.length>=1,n=arguments.length>=2;if(!(this instanceof o))return i?n?new o(e,t):new o(e):new o;if(void 0===e){if(i)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&i)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.10";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 i,n,r={};if("RegExp"===l(t))r=null;else if(u(t))for(i=0,n=t.length;i]+|\(([^\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.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,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 i=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?i.replace(/%20/g,"+"):i},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(i){try{return o[t](i+"").replace(o.characters[e][t].expression,(function(i){return o.characters[e][t].map[i]}))}catch(e){return i}}};for(_ in y)o[_+"PathSegment"]=C("pathname",y[_]),o[_+"UrnPathSegment"]=C("urnpath",y[_]);var T=function(e,t,i){return function(n){var r;r=i?function(e){return o[t](o[i](e))}:o[t];for(var a=(n+"").split(e),s=0,c=a.length;s-1&&(t.fragment=e.substring(i+1)||null,e=e.substring(0,i)),(i=e.indexOf("?"))>-1&&(t.query=e.substring(i+1)||null,e=e.substring(0,i)),"//"===(e=e.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(i=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,i)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(i+1,i+3).replace(/\\/g,"/")?(e=e.substring(i+3),e=o.parseAuthority(e,t)):(e=e.substring(i+1),t.urn=!0)),t.path=e,t},o.parseHost=function(e,t){e||(e="");var i,n,r=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===r&&(r=e.length),"["===e.charAt(0))i=e.indexOf("]"),t.hostname=e.substring(1,i)||null,t.port=e.substring(i+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||i.ignore&&i.ignore.test(p))){var _=t(p,u,h=u+p.length,e);void 0!==_?(_=String(_),e=e.slice(0,u)+_+e.slice(h),n.lastIndex=u+_.length):n.lastIndex=h}}return n.lastIndex=0,e},o.ensureValidHostname=function(t,i){var n=!!t,r=!1;if(!!i&&(r=h(o.hostProtocols,i)),r&&!n)throw new TypeError("Hostname cannot be empty, if protocol is "+i);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 n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(t.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(t.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=n.SecondLevelDomains.noConflict()),t}return n.URI===this&&(n.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 i=this.query(e,t);return"string"==typeof i&&i.length?"?"+i:i},a.hash=function(e,t){var i=this.fragment(e,t);return"string"==typeof i&&i.length?"#"+i:i},a.pathname=function(e,t){if(void 0===e||!0===e){var i=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(i):i}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 i;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var n=e instanceof o,r="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName&&(e=e[o.getDomAttribute(e)]||"",r=!1),!n&&r&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!n&&!r)throw new TypeError("invalid input");var a=n?e._parts:e;for(i in a)"query"!==i&&s.call(this._parts,i)&&(this._parts[i]=a[i]);a.query&&this.query(a.query,!1)}return this.build(!t),this},a.is=function(e){var t=!1,n=!1,r=!1,a=!1,s=!1,c=!1,l=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,n=o.ip4_expression.test(this._parts.hostname),r=o.ip6_expression.test(this._parts.hostname),s=(a=!(t=n||r))&&i&&i.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 n;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 i={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(e,i))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=i.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 i=this.protocol();return this.authority()?(i?i+"://":"")+this.authority():""}var n=o(e);return this.protocol(n.protocol()).authority(n.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 i=o.buildUserinfo(this._parts);return i?i.substring(0,i.length-1):i}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},a.resource=function(e,t){var i;return void 0===e?this.path()+this.search()+this.hash():(i=o.parse(e),this._parts.path=i.path,this._parts.query=i.query,this._parts.fragment=i.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 i=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,i)||""}var n=this._parts.hostname.length-this.domain().length,r=this._parts.hostname.substring(0,n),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 i=this._parts.hostname.match(/\./g);if(i&&i.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(t).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}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 n=this._parts.hostname.lastIndexOf("."),r=this._parts.hostname.substring(n+1);return!0!==t&&i&&i.list[r.toLowerCase()]&&i.get(this._parts.hostname)||r}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!i||!i.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 i=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,i)||(this._parts.hostname?"/":"");return e?o.decodePath(n):n}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 i=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(i+1);return e?o.decodePathSegment(n):n}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 i,n,r=this.filename(),a=r.lastIndexOf(".");return-1===a?"":(i=r.substring(a+1),n=/^[a-z0-9%]+$/i.test(i)?i:"",e?o.decodePathSegment(n):n)}"."===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,i){var n=this._parts.urn?":":"/",r=this.path(),o="/"===r.substring(0,1),a=r.split(n);if(void 0!==e&&"number"!=typeof e&&(i=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;s0){const e=n.substring(0,r),i=n.substring(r+2);t[e]=i}}return t}function RequestErrorEvent(e,t,i){this.statusCode=e,this.response=t,this.responseHeaders=i,"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,i){const n=e[t];e[t]=e[i],e[i]=n}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 i=this;return function(){i.removeEventListener(e,t)}},Event.prototype.removeEventListener=function(e,t){const i=this._listeners,n=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,i=this._comparator,n=this._maximumLength;let r,o=this._length++;for(on&&(r=t[n],this._length=n),r},Heap.prototype.pop=function(e){if(e=defaultValue(e,0),0===this._length)return;const t=this._array,i=t[e];return swap$3(t,e,--this._length),this.heapify(e),t[this._length]=void 0,i};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=defer()),e.deferred.promise}function getRequestReceivedFunction(e){return function(t){if(e.state===RequestState$1.CANCELLED)return;const i=e.deferred;--statistics.numberOfActiveRequests,--numberOfActiveRequestsByServer[e.serverKey],requestCompletedEvent.raiseEvent(),e.state=RequestState$1.RECEIVED,e.deferred=void 0,i.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)).catch(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 i=defaultValue(RequestScheduler.requestsByServer[e],RequestScheduler.maximumRequestsPerServer);return numberOfActiveRequestsByServer[e]+t<=i},RequestScheduler.heapHasOpenSlots=function(e){return requestHeap.length+e<=priorityHeapLength},RequestScheduler.update=function(){let e,t,i=0;const n=activeRequests.length;for(e=0;e0&&(activeRequests[e-i]=t):++i;activeRequests.length-=i;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 i=t.authority();/:/.test(i)||(i=`${i}:${"https"===t.scheme()?"443":"80"}`);return defined(numberOfActiveRequestsByServer[i])||(numberOfActiveRequestsByServer[i]=0),i},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 i=new URI(this._url);e&&stringifyQuery(i,this);let n=i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}");const r=this._templateValues;return n=n.replace(/{(.*?)}/g,(function(e,t){const i=r[t];return defined(i)?encodeURIComponent(i):e})),t&&defined(this.proxy)&&(n=this.proxy.getURL(n)),n},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 i=new URI(e.url);parseQuery(i,t,!0,defaultValue(e.preserveQueryParameters,!1)),i.fragment(""),""!==i.scheme()?t._url=i.toString():t._url=i.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 Promise.resolve(!1);const i=this;return Promise.resolve(t(this,e)).then((function(e){return++i._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),i=defaultValue(e.preferBlob,!1),n=defaultValue(e.flipY,!1),r=defaultValue(e.skipColorSpaceConversion,!1);if(checkAndResetRequest(this.request),!xhrBlobSupported||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!i)return fetchImage({resource:this,flipY:n,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:n,premultiplyAlpha:!1,skipColorSpaceConversion:r});const t=window.URL.createObjectURL(e);return c=new Resource({url:t}),fetchImage({resource:c,flipY:n,skipColorSpaceConversion:r,preferImageBitmap:!1})})).then((function(e){if(defined(e))return e.blob=l,s||window.URL.revokeObjectURL(c.url),e})).catch((function(e){return defined(c)&&window.URL.revokeObjectURL(c.url),e.blob=l,Promise.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 i=t.request;i.url=t.url,i.requestFunction=function(){const n=e.responseType,r=combine$2(e.headers,t.headers),o=e.overrideMimeType,a=e.method,s=e.data,c=defer(),l=Resource._Implementations.loadWithXhr(t.url,n,a,s,r,c,o);return defined(l)&&defined(l.abort)&&(i.cancelFunction=function(){l.abort()}),c.promise};const n=RequestScheduler.request(i);if(defined(n))return n.then((function(e){return i.cancelFunction=void 0,e})).catch((function(n){return i.cancelFunction=void 0,i.state!==RequestState$1.FAILED?Promise.reject(n):t.retryOnError(n).then((function(r){return r?(i.state=RequestState$1.UNISSUED,i.deferred=void 0,t.fetch(e)):Promise.reject(n)}))}))};const dataUriRegex$1=/^data:(.*?)(;base64)?,(.*)$/;function decodeDataUriText(e,t){const i=decodeURIComponent(t);return e?atob(i):i}function decodeDataUriArrayBuffer(e,t){const i=decodeDataUriText(e,t),n=new ArrayBuffer(i.length),r=new Uint8Array(n);for(let e=0;e=300)return void o.reject(new RequestErrorEvent(e.statusCode,e,e.headers));const i=[];e.on("data",(function(e){i.push(e)})),e.on("end",(function(){const n=Buffer.concat(i);"gzip"===e.headers["content-encoding"]?l.gunzip(n,(function(e,i){e?o.reject(new RuntimeError("Error decompressing response.")):o.resolve(decodeResponse(i,t))})):o.resolve(decodeResponse(n,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.loadImageElement=function(e,t,i){const n=new Image;n.onload=function(){0===n.naturalWidth&&0===n.naturalHeight&&0===n.width&&0===n.height&&(n.width=300,n.height=150),i.resolve(n)},n.onerror=function(e){i.reject(e)},t&&(TrustedServers.contains(e)?n.crossOrigin="use-credentials":n.crossOrigin=""),n.src=e},Resource._Implementations.createImage=function(e,t,i,n,r,o){const a=e.url;Resource.supportsImageBitmapOptions().then((function(s){if(!s||!o)return void Resource._Implementations.loadImageElement(a,t,i);const c=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:n,premultiplyAlpha:!1,skipColorSpaceConversion:r});i.reject(new RuntimeError(`Successfully retrieved ${a} but it contained no content.`))})).then((function(e){i.resolve(e)}))})).catch((function(e){i.reject(e)}))},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,i,n,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,i,n,r,o);const c=new XMLHttpRequest;if(TrustedServers.contains(e)&&(c.withCredentials=!0),c.open(i,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,n=c.responseType;if("HEAD"===i||"OPTIONS"===i){const e=c.getAllResponseHeaders().trim().split(/[\r\n]+/),t={};return e.forEach((function(e){const i=e.split(": "),n=i.shift();t[n]=i.join(": ")})),void o.resolve(t)}if(204===c.status)o.resolve();else if(!defined(e)||defined(t)&&n!==t)if("json"===t&&"string"==typeof e)try{o.resolve(JSON.parse(e))}catch(e){o.reject(e)}else(""===n||"document"===n)&&defined(c.responseXML)&&c.responseXML.hasChildNodes()?o.resolve(c.responseXML):""!==n&&"text"!==n||!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)},e.includes("gisserver")&&e.includes("tmsserver")&&e.includes(".json")||c.send(n),c},Resource._Implementations.loadAndExecuteScript=function(e,t,i){return loadAndExecuteScript(e).catch((function(e){i.reject(e)}))},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,i=e.length;t=r&&(l=r-1);let u=(n.north-e.latitude)/s|0;return u>=o&&(u=o-1),defined(i)?(i.x=l,i.y=u,i):new Cartesian2(l,u)};const scratchDiagonalCartesianNE=new Cartesian3,scratchDiagonalCartesianSW=new Cartesian3,scratchDiagonalCartographic=new Cartographic,scratchCenterCartesian=new Cartesian3,scratchSurfaceCartesian=new Cartesian3,scratchBoundingSphere$5=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,i=0,n=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 i=scratchCorners[t];if(tilingScheme.positionToTileXY(i,a,scratchTileXY),0===t)n=scratchTileXY.x,r=scratchTileXY.y;else if(n!==scratchTileXY.x||r!==scratchTileXY.y){e=!0;break}}if(e)break;t=n,i=r}if(0!==a)return{x:t,y:i,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,i=Array(e.length);t1?i-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,i=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 i=e.document,n=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=n.createElement("template");C.content&&C.content.ownerDocument&&(n=C.content.ownerDocument)}var T=_createTrustedTypesPolicy(p,i),S=T?T.createHTML(""):"",A=n,v=A.implementation,E=A.createNodeIterator,b=A.createDocumentFragment,x=A.getElementsByTagName,P=i.importNode,D={};try{D=clone(n).documentMode?n.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,ie=!1,ne={},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=n.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):{},ne="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,ie=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),ne&&(N=addToSet({},[].concat(_toConsumableArray$1(text))),$=[],!0===ne.html&&(addToSet(N,html),addToSet($,html$1)),!0===ne.svg&&(addToSet(N,svg),addToSet($,svg$1),addToSet($,xml)),!0===ne.svgFilters&&(addToSet(N,svgFilters),addToSet($,svg$1),addToSet($,xml)),!0===ne.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 i=stringToLowerCase(e.tagName),n=stringToLowerCase(t.tagName);if(e.namespaceURI===de)return t.namespaceURI===he?"svg"===i:t.namespaceURI===ue?"svg"===i&&("annotation-xml"===n||ve[n]):Boolean(be[i]);if(e.namespaceURI===ue)return t.namespaceURI===he?"math"===i:t.namespaceURI===de?"math"===i&&Ee[n]:Boolean(xe[i]);if(e.namespaceURI===he){if(t.namespaceURI===de&&!Ee[n])return!1;if(t.namespaceURI===ue&&!ve[n])return!1;var r=addToSet({},["title","style","font","a","script"]);return!xe[i]&&(r[i]||!be[i])}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,i){try{arrayPush(t.removed,{attribute:i.getAttributeNode(e),from:i})}catch(e){arrayPush(t.removed,{attribute:null,from:i})}if(i.removeAttribute(e),"is"===e&&!$[e])if(J||Q)try{De(i)}catch(e){}else try{i.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,i=void 0;if(K)e=""+e;else{var r=stringMatch(e,/^[\r\n\t ]+/);i=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&&i&&a.insertBefore(n.createTextNode(i),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,i,n){w[e]&&arrayForEach(w[e],(function(e){e.call(t,i,n,Ce)}))},Le=function(e){var i=void 0;if(Be("beforeSanitizeElements",e,null),Re(e))return De(e),!0;if(stringMatch(e.nodeName,/[\u0080-\uFFFF]/))return De(e),!0;var n=ye(e.nodeName);if(Be("uponSanitizeElement",e,{tagName:n,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"===n&®ExpTest(/